{"version":3,"sources":["../../../packages/docviewhelper/src/lib/helper.ts","../../../packages/docviewhelper/src/lib/model.ts","../../../packages/docviewhelper/src/lib/viewer-recovery-controller.ts"],"sourcesContent":["declare const mammoth: {\n  convertToHtml: (input: { arrayBuffer: ArrayBuffer }) => Promise<{ value: string }>;\n};\nimport { IFrameReloader, ViewerRecoveryPlan, ViewerType } from './model';\n\nexport const fileToArray = (url: string): Promise<ArrayBuffer> => {\n  return new Promise<ArrayBuffer>((resolve, reject) => {\n    try {\n      const request = new XMLHttpRequest();\n      request.open('GET', url, true);\n      request.responseType = 'arraybuffer';\n      request.onload = () => {\n        if (request.status >= 200 && request.status < 300) {\n          resolve(request.response as ArrayBuffer);\n        } else {\n          reject(`error while retrieving file ${url} (status ${request.status}).`);\n        }\n      };\n      request.onerror = () => reject(`error while retrieving file ${url}.`);\n      request.send();\n    } catch {\n      reject(`error while retrieving file ${url}.`);\n    }\n  });\n};\n\nexport const timeout = (ms: number) => {\n  return new Promise((resolve) => setTimeout(resolve, ms));\n};\n\nconst reloadIFrame = (iframe: HTMLIFrameElement) => {\n  if (iframe) {\n    const url = iframe.src;\n    iframe.src = 'about:blank';\n    setTimeout(() => {\n      if (iframe) {\n        iframe.src = url;\n      }\n    }, 100);\n  }\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const handleFileUpload = (fileInput: any) => {\n  return new Promise<string>((resolve, reject) => {\n    if (fileInput.target.files && fileInput.target.files[0]) {\n      const reader = new FileReader();\n      // eslint-disable-next-line @typescript-eslint/no-explicit-any\n      reader.onload = (e: any) => {\n        resolve(e.target.result);\n      };\n      reader.readAsDataURL(fileInput.target.files[0]);\n    } else {\n      reject('no files selected');\n    }\n  });\n};\n\nexport const getbaseUrl = (): string => {\n  const pathArray = window.location.href.split('/');\n  const protocol = pathArray[0];\n  const host = pathArray[2];\n  return protocol + '//' + host;\n};\n\nexport const getLocation = (href: string) => {\n   \n  const match = href.match(\n    /^(https?\\:)\\/\\/(([^:\\/?#]*)(?:\\:([0-9]+))?)([\\/]{0,1}[^?#]*)(\\?[^#]*|)(#.*|)$/,\n  );\n  return (\n    match && {\n      href,\n      protocol: match[1],\n      host: match[2],\n      hostname: match[3],\n      port: match[4],\n      pathname: match[5],\n      search: match[6],\n      hash: match[7],\n    }\n  );\n};\n\nexport const getDocxToHtml = async (url: string) => {\n  if (!mammoth) {\n    console.error(\n      'Please install mammoth and make sure mammoth.browser.min.js is loaded.',\n    );\n  }\n  const arrayBuffer = await fileToArray(url);\n  const resultObject = await mammoth.convertToHtml({ arrayBuffer });\n  return resultObject.value;\n};\n\nexport const googleCheckSubscription = (): IFrameReloader => {\n  let subscription: ReturnType<typeof setInterval> | undefined = undefined;\n  let checkCount = 0;\n  return {\n    subscribe: (iframe: HTMLIFrameElement, interval = 3000, maxChecks = 5) => {\n      if (!iframeIsLoaded(iframe)) {\n        subscription = setInterval(() => {\n          checkCount++;\n          if (checkCount >= maxChecks) {\n            clearInterval(subscription);\n          }\n          reloadIFrame(iframe);\n        }, interval);\n      } else if (subscription) {\n        clearInterval(subscription);\n      }\n      return subscription;\n    },\n    unsubscribe: () => {\n      if (subscription) {\n        clearInterval(subscription);\n      }\n    },\n  };\n};\n\nexport const iframeIsLoaded = (iframe: HTMLIFrameElement) => {\n  // its #document <html><head></head><body></body></html> when google is returning a 204\n  // so if contentDocument = null then it's loaded.\n  let isLoaded = false;\n  try {\n    isLoaded = !iframe?.contentDocument;\n  } catch {\n    // ignore message Blocked a frame with origin \"http://...\" from accessing a cross-origin frame.\n  }\n  return isLoaded;\n};\n\nexport const getViewerDetails = (\n  url: string,\n  configuredViewer: ViewerType = 'google',\n  queryParams = '',\n  viewerUrl = '',\n) => {\n  switch (configuredViewer) {\n    case 'google':\n      viewerUrl = `https://docs.google.com/gview?url=%URL%&embedded=true`;\n      break;\n    case 'office': {\n      viewerUrl = `https://view.officeapps.live.com/op/embed.aspx?src=%URL%`;\n      break;\n    }\n    case 'pdf': {\n      viewerUrl = '';\n      break;\n    }\n  }\n  const externalViewer =\n    configuredViewer === 'google' ||\n    configuredViewer === 'office' ||\n    configuredViewer === 'url';\n\n  const u = url?.indexOf('/') ? encodeURIComponent(url) : url;\n  let fullUrl = viewerUrl ? viewerUrl.replace('%URL%', u) : url;\n  if (queryParams && externalViewer && configuredViewer !== 'url') {\n    const start = queryParams.startsWith('&') ? '' : '&';\n    fullUrl = `${fullUrl}${start}${queryParams}`;\n  }\n  return {\n    url: fullUrl,\n    externalViewer,\n  };\n};\n\nexport const getViewerRecoveryPlan = ({\n  viewer,\n  googleCheckContentLoaded = true,\n  googleFinalRetryDelay = 0,\n  officeAutoRetry = false,\n}: {\n  viewer: ViewerType;\n  googleCheckContentLoaded?: boolean;\n  googleFinalRetryDelay?: number;\n  officeAutoRetry?: boolean;\n}): ViewerRecoveryPlan => {\n  const modes: ViewerRecoveryPlan['modes'] = [];\n\n  if (viewer === 'google' && googleCheckContentLoaded) {\n    modes.push('google-probe');\n  }\n\n  if (viewer === 'google' && googleFinalRetryDelay > 0) {\n    modes.push('google-final-retry');\n  }\n\n  if (viewer === 'office' && officeAutoRetry) {\n    modes.push('office-auto-retry');\n  }\n\n  return { modes };\n};\n\nexport const replaceLocalUrl = (url: string, overrideLocalhost: string) => {\n  const loc = getLocation(url);\n  const locReplace = getLocation(overrideLocalhost);\n  if (loc && locReplace) {\n    return url.replace(\n      loc.port ? `${loc.hostname}:${loc.port}` : loc.hostname,\n      locReplace.port\n        ? `${locReplace.hostname}:${locReplace.port}`\n        : locReplace.hostname,\n    );\n  }\n  return url;\n};\n\nconst getBlobFromUrl = (url: string) => {\n  return new Promise<File>((resolve, reject) => {\n    const request = new XMLHttpRequest();\n    request.open('GET', url, true);\n    request.responseType = 'blob';\n    request.onload = () => {\n      resolve(request.response as File);\n    };\n    request.onerror = reject;\n    request.send();\n  });\n};\n\nexport const uploadToCloud = (fileUrl: string, api: string) =>\n  new Promise((resolve, reject) => {\n    getBlobFromUrl(fileUrl).then((blob) => {\n      const loc = getLocation(fileUrl);\n      const name = loc?.pathname\n        ? loc?.pathname?.split('/')[loc?.pathname?.split('/').length - 1]\n        : '';\n      const formData = new FormData();\n      const request = new XMLHttpRequest();\n      formData.append('file', blob, name);\n      // eslint-disable-next-line @typescript-eslint/no-unused-vars\n      request.onreadystatechange = (e) => {\n        if (request.readyState === XMLHttpRequest.DONE) {\n          if (request.status === 200) {\n            resolve(request.responseText);\n          } else {\n            reject(request.responseText);\n          }\n        }\n      };\n      request.onerror = reject;\n      request.open('post', api, true);\n      request.send(formData);\n    });\n  });\n\nexport const isLocalFile = (file: string) => {\n  const loc = getLocation(file);\n  const hostname = loc?.hostname || '';\n  return (\n    ['localhost', '127.0.0.1', '', '::1'].includes(hostname) ||\n    hostname.startsWith('192.168.') ||\n    hostname.startsWith('10.0.') ||\n    hostname.endsWith('.local')\n  );\n};\n","export type ViewerType = 'google' | 'office' | 'mammoth' | 'pdf' | 'url';\nexport type ViewerRenderPhase = 'idle' | 'loading' | 'ready' | 'error';\nexport type ViewerRecoveryMode =\n  | 'google-probe'\n  | 'google-final-retry'\n  | 'office-auto-retry';\n\nexport interface ViewerRecoveryPlan {\n  modes: ViewerRecoveryMode[];\n}\n\ninterface Props {\n  loaded?: () => void;\n  url: string;\n  queryParams?: string;\n  viewerUrl?: string;\n  googleCheckInterval?: number;\n  disableContent?: 'none' | 'all' | 'poput' | 'popout-hide';\n  googleCheckContentLoaded?: boolean;\n  viewer?: ViewerType;\n}\n\nexport interface IFrameReloader {\n  subscribe: (\n    iframe: HTMLIFrameElement,\n    interval?: number,\n    maxChecks?: number\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  ) => any;\n  unsubscribe: () => void;\n}\n\nexport const defaultProps: Props = {\n   \n  loaded: () => {},\n  disableContent: 'none',\n  googleCheckContentLoaded: true,\n  googleCheckInterval: 3000,\n  queryParams: '',\n  url: '',\n  viewer: 'google',\n  viewerUrl: '',\n};\n","import { getViewerRecoveryPlan } from './helper';\nimport { ViewerRecoveryPlan, ViewerType } from './model';\n\nexport interface ViewerRecoveryConfig {\n  viewer: ViewerType;\n  googleCheckContentLoaded: boolean;\n  googleCheckInterval: number;\n  googleMaxChecks: number;\n  googleFinalRetryDelay: number;\n  officeAutoRetry: boolean;\n  officeRetryDelay: number;\n}\n\nexport interface ViewerRecoveryHandlers {\n  /**\n   * Start a fresh load of the current document. Used by the google final-retry\n   * and office auto-retry recovery modes.\n   */\n  triggerRetry: () => void;\n  /**\n   * The external viewer did not finish loading in time and no retry is pending.\n   * The host should surface the timeout error (guarding on its own load phase).\n   */\n  reportTimeout: () => void;\n}\n\n/**\n * Framework-agnostic orchestration for the google/office iframe recovery logic\n * shared by ngx-doc-viewer and react-documents. Owns the load-timeout,\n * google-final-retry and office-auto-retry timers plus the per-source retry\n * bookkeeping. The google-probe iframe reload stays in the host because it is\n * framework specific (iframe refs, Angular zones).\n */\nexport class ViewerRecoveryController {\n  private externalLoadTimeoutId?: ReturnType<typeof setTimeout>;\n  private googleFinalRetryTimeoutId?: ReturnType<typeof setTimeout>;\n  private officeRetryTimeoutId?: ReturnType<typeof setTimeout>;\n  private googleFinalRetriedSourceKey?: string;\n  private currentGoogleSourceKey?: string;\n  private officeAutoRetriedSourceKey?: string;\n  private currentOfficeSourceKey?: string;\n\n  constructor(\n    private config: ViewerRecoveryConfig,\n    private readonly handlers: ViewerRecoveryHandlers,\n  ) {}\n\n  /** Update the active configuration (e.g. after inputs change). */\n  configure(config: ViewerRecoveryConfig): void {\n    this.config = config;\n  }\n\n  /**\n   * Track the resolved viewer URL as the current source. Resets the per-source\n   * \"already retried\" flags whenever the source changes so a new document gets\n   * its own recovery budget.\n   */\n  trackSource(resolvedUrl: string): void {\n    const officeSourceKey =\n      this.config.viewer === 'office' ? resolvedUrl : undefined;\n    if (officeSourceKey !== this.currentOfficeSourceKey) {\n      this.officeAutoRetriedSourceKey = undefined;\n    }\n    this.currentOfficeSourceKey = officeSourceKey;\n\n    const googleSourceKey =\n      this.config.viewer === 'google' ? resolvedUrl : undefined;\n    if (googleSourceKey !== this.currentGoogleSourceKey) {\n      this.googleFinalRetriedSourceKey = undefined;\n    }\n    this.currentGoogleSourceKey = googleSourceKey;\n  }\n\n  /**\n   * Begin watching an external (iframe/pdf/url) load. Clears any prior timers,\n   * arms the load-timeout and schedules office auto-retry. Returns the recovery\n   * plan so the host can run the framework-specific google-probe if present.\n   */\n  beginExternalLoad(isActive: () => boolean): ViewerRecoveryPlan {\n    this.clearTimers();\n    const { viewer, googleCheckInterval, googleMaxChecks } = this.config;\n    const timeoutMs =\n      viewer === 'google'\n        ? Math.max(googleCheckInterval * googleMaxChecks + 2000, 15000)\n        : 15000;\n    this.externalLoadTimeoutId = setTimeout(() => {\n      if (!isActive()) {\n        return;\n      }\n      if (this.scheduleGoogleFinalRetry(isActive)) {\n        return;\n      }\n      this.handlers.reportTimeout();\n    }, timeoutMs);\n\n    const plan = this.recoveryPlan();\n    if (plan.modes.includes('office-auto-retry')) {\n      this.scheduleOfficeRetry(isActive);\n    }\n    return plan;\n  }\n\n  /** The external viewer finished loading; stop all pending recovery timers. */\n  notifyLoaded(): void {\n    this.clearTimers();\n  }\n\n  /** Clear every pending recovery timer without tearing down state. */\n  clearTimers(): void {\n    this.clearExternalLoadTimeout();\n    this.clearGoogleFinalRetry();\n    this.clearOfficeRetry();\n  }\n\n  /** Release all timers; call on destroy. */\n  dispose(): void {\n    this.clearTimers();\n  }\n\n  private recoveryPlan(): ViewerRecoveryPlan {\n    return getViewerRecoveryPlan({\n      viewer: this.config.viewer,\n      googleCheckContentLoaded: this.config.googleCheckContentLoaded,\n      googleFinalRetryDelay: this.config.googleFinalRetryDelay,\n      officeAutoRetry: this.config.officeAutoRetry,\n    });\n  }\n\n  private scheduleGoogleFinalRetry(isActive: () => boolean): boolean {\n    if (\n      !this.recoveryPlan().modes.includes('google-final-retry') ||\n      !this.currentGoogleSourceKey ||\n      this.googleFinalRetriedSourceKey === this.currentGoogleSourceKey\n    ) {\n      return false;\n    }\n    this.clearGoogleFinalRetry();\n    this.googleFinalRetryTimeoutId = setTimeout(() => {\n      if (\n        !isActive() ||\n        !this.currentGoogleSourceKey ||\n        this.googleFinalRetriedSourceKey === this.currentGoogleSourceKey\n      ) {\n        return;\n      }\n      this.googleFinalRetriedSourceKey = this.currentGoogleSourceKey;\n      this.handlers.triggerRetry();\n    }, this.config.googleFinalRetryDelay);\n    return true;\n  }\n\n  private scheduleOfficeRetry(isActive: () => boolean): void {\n    if (\n      this.config.viewer !== 'office' ||\n      !this.config.officeAutoRetry ||\n      !this.currentOfficeSourceKey ||\n      this.officeAutoRetriedSourceKey === this.currentOfficeSourceKey\n    ) {\n      return;\n    }\n    this.clearOfficeRetry();\n    this.officeRetryTimeoutId = setTimeout(() => {\n      if (\n        !isActive() ||\n        !this.currentOfficeSourceKey ||\n        this.officeAutoRetriedSourceKey === this.currentOfficeSourceKey\n      ) {\n        return;\n      }\n      this.officeAutoRetriedSourceKey = this.currentOfficeSourceKey;\n      this.handlers.triggerRetry();\n    }, this.config.officeRetryDelay);\n  }\n\n  private clearExternalLoadTimeout(): void {\n    if (this.externalLoadTimeoutId) {\n      clearTimeout(this.externalLoadTimeoutId);\n      this.externalLoadTimeoutId = undefined;\n    }\n  }\n\n  private clearGoogleFinalRetry(): void {\n    if (this.googleFinalRetryTimeoutId) {\n      clearTimeout(this.googleFinalRetryTimeoutId);\n      this.googleFinalRetryTimeoutId = undefined;\n    }\n  }\n\n  private clearOfficeRetry(): void {\n    if (this.officeRetryTimeoutId) {\n      clearTimeout(this.officeRetryTimeoutId);\n      this.officeRetryTimeoutId = undefined;\n    }\n  }\n}\n"],"mappings":";AAKO,IAAM,cAAc,CAAC,QAAsC;AAChE,SAAO,IAAI,QAAqB,CAAC,SAAS,WAAW;AACnD,QAAI;AACF,YAAM,UAAU,IAAI,eAAe;AACnC,cAAQ,KAAK,OAAO,KAAK,IAAI;AAC7B,cAAQ,eAAe;AACvB,cAAQ,SAAS,MAAM;AACrB,YAAI,QAAQ,U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