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AATA,CAAA,EAAyB;EACvB,MAAM9sE,MAAA,GAAS6sE,sBAAA,EAAf;EAME,MAAM/4D,KAAA,GAAQ3gB,QAAA,CAASw4E,WAAT,CAAqB,aAArB,CAAd;EACA73D,KAAA,CAAM83D,eAAN,CAAsB,iBAAtB,EAAyC,IAAzC,EAA+C,IAA/C,EAAqD;IACnD3zE,MAAA,EAAQ1C;EAD2C,CAArD;EAGA,IAAI;IAIFC,MAAA,CAAOrC,QAAP,CAAgBglC,aAAhB,CAA8BrkB,KAA9B;EAJE,CAAJ,CAKE,OAAO7a,EAAP,EAAW;IAGXZ,OAAA,CAAQK,KAAR,CAAe,oBAAmBO,EAApB,EAAd;IACA9F,QAAA,CAASglC,aAAT,CAAuBrkB,KAAvB;EAJW;EAOfrkB,yBAAA,CAAqBsQ,GAArB,CAAyBC,MAAzB;AAvBuB;AA4BzB7M,QAAA,CAAS2iB,kBAAT,GAA8B,IAA9B;AAEA,IACE3iB,QAAA,CAASmwE,UAAT,KAAwB,aAAxB,IACAnwE,QAAA,CAASmwE,UAAT,KAAwB,UAF1B,EAGE;EACAwJ,aAAA;AADA,CAHF,MAKO;EACL35E,QAAA,CAAS+a,gBAAT,CAA0B,kBAA1B,EAA8C4+D,aAA9C,EAA6D,IAA7D;AADK","sources":["webpack://pdf.js/web/genericcom.js","webpack://pdf.js/web/app.js","webpack://pdf.js/web/ui_utils.js","webpack://pdf.js/web/pdfjs.js","webpack://pdf.js/web/app_options.js","webpack://pdf.js/web/event_utils.js","webpack://pdf.js/web/pdf_link_service.js","webpack://pdf.js/web/annotation_editor_params.js","webpack://pdf.js/web/overlay_manager.js","webpack://pdf.js/web/password_prompt.js","webpack://pdf.js/web/pdf_attachment_viewer.js","webpack://pdf.js/web/base_tree_viewer.js","webpack://pdf.js/web/pdf_cursor_tools.js","webpack://pdf.js/web/grab_to_pan.js","webpack://pdf.js/web/pdf_document_properties.js","webpack://pdf.js/web/pdf_find_bar.js","webpack://pdf.js/web/pdf_find_controller.js","webpack://pdf.js/web/pdf_find_utils.js","webpack://pdf.js/web/pdf_history.js","webpack://pdf.js/web/pdf_layer_viewer.js","webpack://pdf.js/web/pdf_outline_viewer.js","webpack://pdf.js/web/pdf_presentation_mode.js","webpack://pdf.js/web/pdf_rendering_queue.js","webpack://pdf.js/web/pdf_scripting_manager.js","webpack://pdf.js/web/pdf_sidebar.js","webpack://pdf.js/web/pdf_sidebar_resizer.js","webpack://pdf.js/web/pdf_thumbnail_viewer.js","webpack://pdf.js/web/pdf_thumbnail_view.js","webpack://pdf.js/web/pdf_viewer.js","webpack://pdf.js/web/l10n_utils.js","webpack://pdf.js/web/pdf_page_view.js","webpack://pdf.js/web/annotation_editor_layer_builder.js","webpack://pdf.js/web/annotation_layer_builder.js","webpack://pdf.js/web/struct_tree_layer_builder.js","webpack://pdf.js/web/text_accessibility.js","webpack://pdf.js/web/text_highlighter.js","webpack://pdf.js/web/text_layer_builder.js","webpack://pdf.js/web/xfa_layer_builder.js","webpack://pdf.js/web/secondary_toolbar.js","webpack://pdf.js/web/toolbar.js","webpack://pdf.js/web/view_history.js","webpack://pdf.js/web/preferences.js","webpack://pdf.js/web/download_manager.js","webpack://pdf.js/web/genericl10n.js","webpack://pdf.js/external/webL10n/l10n.js","webpack://pdf.js/web/generic_scripting.js","webpack://pdf.js/web/pdf_print_service.js","webpack://pdf.js/web/print_utils.js","webpack://pdf.js/webpack/bootstrap","webpack://pdf.js/web/viewer.js"],"sourcesContent":["/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DefaultExternalServices, PDFViewerApplication } from \"./app.js\";\nimport { BasePreferences } from \"./preferences.js\";\nimport { DownloadManager } from \"./download_manager.js\";\nimport { GenericL10n } from \"./genericl10n.js\";\nimport { GenericScripting } from \"./generic_scripting.js\";\n\nif (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"GENERIC\")) {\n throw new Error(\n 'Module \"pdfjs-web/genericcom\" shall not be used outside GENERIC build.'\n );\n}\n\nconst GenericCom = {};\n\nclass GenericPreferences extends BasePreferences {\n async _writeToStorage(prefObj) {\n localStorage.setItem(\"pdfjs.preferences\", JSON.stringify(prefObj));\n }\n\n async _readFromStorage(prefObj) {\n return JSON.parse(localStorage.getItem(\"pdfjs.preferences\"));\n }\n}\n\nclass GenericExternalServices extends DefaultExternalServices {\n static createDownloadManager() {\n return new DownloadManager();\n }\n\n static createPreferences() {\n return new GenericPreferences();\n }\n\n static createL10n({ locale = \"en-US\" }) {\n return new GenericL10n(locale);\n }\n\n static createScripting({ sandboxBundleSrc }) {\n return new GenericScripting(sandboxBundleSrc);\n }\n}\nPDFViewerApplication.externalServices = GenericExternalServices;\n\nexport { GenericCom };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n animationStarted,\n apiPageLayoutToViewerModes,\n apiPageModeToSidebarView,\n AutoPrintRegExp,\n CursorTool,\n DEFAULT_SCALE_VALUE,\n getActiveOrFocusedElement,\n isValidRotation,\n isValidScrollMode,\n isValidSpreadMode,\n normalizeWheelEventDirection,\n parseQueryString,\n ProgressBar,\n RendererType,\n RenderingStates,\n ScrollMode,\n SidebarView,\n SpreadMode,\n TextLayerMode,\n} from \"./ui_utils.js\";\nimport {\n AnnotationEditorType,\n build,\n createPromiseCapability,\n FeatureTest,\n getDocument,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n GlobalWorkerOptions,\n InvalidPDFException,\n isDataScheme,\n isPdfFile,\n loadScript,\n MissingPDFException,\n OPS,\n PDFWorker,\n shadow,\n UnexpectedResponseException,\n version,\n} from \"pdfjs-lib\";\nimport { AppOptions, OptionKind } from \"./app_options.js\";\nimport { AutomationEventBus, EventBus } from \"./event_utils.js\";\nimport { LinkTarget, PDFLinkService } from \"./pdf_link_service.js\";\nimport { AnnotationEditorParams } from \"web-annotation_editor_params\";\nimport { OverlayManager } from \"./overlay_manager.js\";\nimport { PasswordPrompt } from \"./password_prompt.js\";\nimport { PDFAttachmentViewer } from \"web-pdf_attachment_viewer\";\nimport { PDFCursorTools } from \"web-pdf_cursor_tools\";\nimport { PDFDocumentProperties } from \"web-pdf_document_properties\";\nimport { PDFFindBar } from \"web-pdf_find_bar\";\nimport { PDFFindController } from \"./pdf_find_controller.js\";\nimport { PDFHistory } from \"./pdf_history.js\";\nimport { PDFLayerViewer } from \"web-pdf_layer_viewer\";\nimport { PDFOutlineViewer } from \"web-pdf_outline_viewer\";\nimport { PDFPresentationMode } from \"web-pdf_presentation_mode\";\nimport { PDFRenderingQueue } from \"./pdf_rendering_queue.js\";\nimport { PDFScriptingManager } from \"./pdf_scripting_manager.js\";\nimport { PDFSidebar } from \"web-pdf_sidebar\";\nimport { PDFSidebarResizer } from \"web-pdf_sidebar_resizer\";\nimport { PDFThumbnailViewer } from \"web-pdf_thumbnail_viewer\";\nimport { PDFViewer } from \"./pdf_viewer.js\";\nimport { SecondaryToolbar } from \"web-secondary_toolbar\";\nimport { Toolbar } from \"web-toolbar\";\nimport { ViewHistory } from \"./view_history.js\";\n\nconst FORCE_PAGES_LOADED_TIMEOUT = 10000; // ms\nconst WHEEL_ZOOM_DISABLED_TIMEOUT = 1000; // ms\n\nconst ViewOnLoad = {\n UNKNOWN: -1,\n PREVIOUS: 0, // Default value.\n INITIAL: 1,\n};\n\nconst ViewerCssTheme = {\n AUTOMATIC: 0, // Default value.\n LIGHT: 1,\n DARK: 2,\n};\n\nclass DefaultExternalServices {\n constructor() {\n throw new Error(\"Cannot initialize DefaultExternalServices.\");\n }\n\n static updateFindControlState(data) {}\n\n static updateFindMatchesCount(data) {}\n\n static initPassiveLoading(callbacks) {}\n\n static reportTelemetry(data) {}\n\n static createDownloadManager() {\n throw new Error(\"Not implemented: createDownloadManager\");\n }\n\n static createPreferences() {\n throw new Error(\"Not implemented: createPreferences\");\n }\n\n static createL10n(options) {\n throw new Error(\"Not implemented: createL10n\");\n }\n\n static createScripting(options) {\n throw new Error(\"Not implemented: createScripting\");\n }\n\n static get supportsPinchToZoom() {\n return shadow(this, \"supportsPinchToZoom\", true);\n }\n\n static get supportsIntegratedFind() {\n return shadow(this, \"supportsIntegratedFind\", false);\n }\n\n static get supportsDocumentFonts() {\n return shadow(this, \"supportsDocumentFonts\", true);\n }\n\n static get supportedMouseWheelZoomModifierKeys() {\n return shadow(this, \"supportedMouseWheelZoomModifierKeys\", {\n ctrlKey: true,\n metaKey: true,\n });\n }\n\n static get isInAutomation() {\n return shadow(this, \"isInAutomation\", false);\n }\n\n static updateEditorStates(data) {\n throw new Error(\"Not implemented: updateEditorStates\");\n }\n\n static get canvasMaxAreaInBytes() {\n return shadow(this, \"canvasMaxAreaInBytes\", -1);\n }\n}\n\nconst PDFViewerApplication = {\n initialBookmark: document.location.hash.substring(1),\n _initializedCapability: createPromiseCapability(),\n appConfig: null,\n pdfDocument: null,\n pdfLoadingTask: null,\n printService: null,\n /** @type {PDFViewer} */\n pdfViewer: null,\n /** @type {PDFThumbnailViewer} */\n pdfThumbnailViewer: null,\n /** @type {PDFRenderingQueue} */\n pdfRenderingQueue: null,\n /** @type {PDFPresentationMode} */\n pdfPresentationMode: null,\n /** @type {PDFDocumentProperties} */\n pdfDocumentProperties: null,\n /** @type {PDFLinkService} */\n pdfLinkService: null,\n /** @type {PDFHistory} */\n pdfHistory: null,\n /** @type {PDFSidebar} */\n pdfSidebar: null,\n /** @type {PDFSidebarResizer} */\n pdfSidebarResizer: null,\n /** @type {PDFOutlineViewer} */\n pdfOutlineViewer: null,\n /** @type {PDFAttachmentViewer} */\n pdfAttachmentViewer: null,\n /** @type {PDFLayerViewer} */\n pdfLayerViewer: null,\n /** @type {PDFCursorTools} */\n pdfCursorTools: null,\n /** @type {PDFScriptingManager} */\n pdfScriptingManager: null,\n /** @type {ViewHistory} */\n store: null,\n /** @type {DownloadManager} */\n downloadManager: null,\n /** @type {OverlayManager} */\n overlayManager: null,\n /** @type {Preferences} */\n preferences: null,\n /** @type {Toolbar} */\n toolbar: null,\n /** @type {SecondaryToolbar} */\n secondaryToolbar: null,\n /** @type {EventBus} */\n eventBus: null,\n /** @type {IL10n} */\n l10n: null,\n /** @type {AnnotationEditorParams} */\n annotationEditorParams: null,\n isInitialViewSet: false,\n downloadComplete: false,\n isViewerEmbedded: window.parent !== window,\n url: \"\",\n baseUrl: \"\",\n _downloadUrl: \"\",\n externalServices: DefaultExternalServices,\n _boundEvents: Object.create(null),\n documentInfo: null,\n metadata: null,\n _contentDispositionFilename: null,\n _contentLength: null,\n _saveInProgress: false,\n _wheelUnusedTicks: 0,\n _wheelUnusedFactor: 1,\n _touchUnusedTicks: 0,\n _touchUnusedFactor: 1,\n _PDFBug: null,\n _hasAnnotationEditors: false,\n _title: document.title,\n _printAnnotationStoragePromise: null,\n _touchInfo: null,\n _isCtrlKeyDown: false,\n\n // Called once when the document is loaded.\n async initialize(appConfig) {\n this.preferences = this.externalServices.createPreferences();\n this.appConfig = appConfig;\n\n await this._initializeOptions();\n this._forceCssTheme();\n await this._initializeL10n();\n\n if (\n this.isViewerEmbedded &&\n AppOptions.get(\"externalLinkTarget\") === LinkTarget.NONE\n ) {\n // Prevent external links from \"replacing\" the viewer,\n // when it's embedded in e.g. an <iframe> or an <object>.\n AppOptions.set(\"externalLinkTarget\", LinkTarget.TOP);\n }\n await this._initializeViewerComponents();\n\n // Bind the various event handlers *after* the viewer has been\n // initialized, to prevent errors if an event arrives too soon.\n this.bindEvents();\n this.bindWindowEvents();\n\n // We can start UI localization now.\n const appContainer = appConfig.appContainer || document.documentElement;\n this.l10n.translate(appContainer).then(() => {\n // Dispatch the 'localized' event on the `eventBus` once the viewer\n // has been fully initialized and translated.\n this.eventBus.dispatch(\"localized\", { source: this });\n });\n\n this._initializedCapability.resolve();\n },\n\n /**\n * @private\n */\n async _initializeOptions() {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n if (AppOptions.get(\"disablePreferences\")) {\n if (AppOptions.get(\"pdfBugEnabled\")) {\n await this._parseHashParams();\n }\n // Give custom implementations of the default viewer a simpler way to\n // opt-out of having the `Preferences` override existing `AppOptions`.\n return;\n }\n if (AppOptions._hasUserOptions()) {\n console.warn(\n \"_initializeOptions: The Preferences may override manually set AppOptions; \" +\n 'please use the \"disablePreferences\"-option in order to prevent that.'\n );\n }\n }\n try {\n AppOptions.setAll(await this.preferences.getAll());\n } catch (reason) {\n console.error(`_initializeOptions: \"${reason.message}\".`);\n }\n\n if (AppOptions.get(\"pdfBugEnabled\")) {\n await this._parseHashParams();\n }\n },\n\n /**\n * Potentially parse special debugging flags in the hash section of the URL.\n * @private\n */\n async _parseHashParams() {\n const hash = document.location.hash.substring(1);\n if (!hash) {\n return;\n }\n const { mainContainer, viewerContainer } = this.appConfig,\n params = parseQueryString(hash);\n\n if (\n (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")) &&\n params.get(\"workermodules\") === \"true\"\n ) {\n AppOptions.set(\"workerSrc\", \"../src/pdf.worker.js\");\n } else if (params.get(\"disableworker\") === \"true\") {\n try {\n await loadFakeWorker();\n } catch (ex) {\n console.error(`_parseHashParams: \"${ex.message}\".`);\n }\n }\n if (params.has(\"disablerange\")) {\n AppOptions.set(\"disableRange\", params.get(\"disablerange\") === \"true\");\n }\n if (params.has(\"disablestream\")) {\n AppOptions.set(\"disableStream\", params.get(\"disablestream\") === \"true\");\n }\n if (params.has(\"disableautofetch\")) {\n AppOptions.set(\n \"disableAutoFetch\",\n params.get(\"disableautofetch\") === \"true\"\n );\n }\n if (params.has(\"disablefontface\")) {\n AppOptions.set(\n \"disableFontFace\",\n params.get(\"disablefontface\") === \"true\"\n );\n }\n if (params.has(\"disablehistory\")) {\n AppOptions.set(\"disableHistory\", params.get(\"disablehistory\") === \"true\");\n }\n if (params.has(\"verbosity\")) {\n AppOptions.set(\"verbosity\", params.get(\"verbosity\") | 0);\n }\n if (params.has(\"textlayer\")) {\n switch (params.get(\"textlayer\")) {\n case \"off\":\n AppOptions.set(\"textLayerMode\", TextLayerMode.DISABLE);\n break;\n case \"visible\":\n case \"shadow\":\n case \"hover\":\n viewerContainer.classList.add(`textLayer-${params.get(\"textlayer\")}`);\n try {\n await loadPDFBug(this);\n this._PDFBug.loadCSS();\n } catch (ex) {\n console.error(`_parseHashParams: \"${ex.message}\".`);\n }\n break;\n }\n }\n if (params.has(\"pdfbug\")) {\n AppOptions.set(\"pdfBug\", true);\n AppOptions.set(\"fontExtraProperties\", true);\n\n const enabled = params.get(\"pdfbug\").split(\",\");\n try {\n await loadPDFBug(this);\n this._PDFBug.init({ OPS }, mainContainer, enabled);\n } catch (ex) {\n console.error(`_parseHashParams: \"${ex.message}\".`);\n }\n }\n // It is not possible to change locale for the (various) extension builds.\n if (\n (typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")) &&\n params.has(\"locale\")\n ) {\n AppOptions.set(\"locale\", params.get(\"locale\"));\n }\n },\n\n /**\n * @private\n */\n async _initializeL10n() {\n this.l10n = this.externalServices.createL10n(\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n ? { locale: AppOptions.get(\"locale\") }\n : null\n );\n const dir = await this.l10n.getDirection();\n document.getElementsByTagName(\"html\")[0].dir = dir;\n },\n\n /**\n * @private\n */\n _forceCssTheme() {\n const cssTheme = AppOptions.get(\"viewerCssTheme\");\n if (\n cssTheme === ViewerCssTheme.AUTOMATIC ||\n !Object.values(ViewerCssTheme).includes(cssTheme)\n ) {\n return;\n }\n try {\n const styleSheet = document.styleSheets[0];\n const cssRules = styleSheet?.cssRules || [];\n for (let i = 0, ii = cssRules.length; i < ii; i++) {\n const rule = cssRules[i];\n if (\n rule instanceof CSSMediaRule &&\n rule.media?.[0] === \"(prefers-color-scheme: dark)\"\n ) {\n if (cssTheme === ViewerCssTheme.LIGHT) {\n styleSheet.deleteRule(i);\n return;\n }\n // cssTheme === ViewerCssTheme.DARK\n const darkRules =\n /^@media \\(prefers-color-scheme: dark\\) {\\n\\s*([\\w\\s-.,:;/\\\\{}()]+)\\n}$/.exec(\n rule.cssText\n );\n if (darkRules?.[1]) {\n styleSheet.deleteRule(i);\n styleSheet.insertRule(darkRules[1], i);\n }\n return;\n }\n }\n } catch (reason) {\n console.error(`_forceCssTheme: \"${reason?.message}\".`);\n }\n },\n\n /**\n * @private\n */\n async _initializeViewerComponents() {\n const { appConfig, externalServices } = this;\n\n const eventBus = externalServices.isInAutomation\n ? new AutomationEventBus()\n : new EventBus();\n this.eventBus = eventBus;\n\n this.overlayManager = new OverlayManager();\n\n const pdfRenderingQueue = new PDFRenderingQueue();\n pdfRenderingQueue.onIdle = this._cleanup.bind(this);\n this.pdfRenderingQueue = pdfRenderingQueue;\n\n const pdfLinkService = new PDFLinkService({\n eventBus,\n externalLinkTarget: AppOptions.get(\"externalLinkTarget\"),\n externalLinkRel: AppOptions.get(\"externalLinkRel\"),\n ignoreDestinationZoom: AppOptions.get(\"ignoreDestinationZoom\"),\n });\n this.pdfLinkService = pdfLinkService;\n\n const downloadManager = externalServices.createDownloadManager();\n this.downloadManager = downloadManager;\n\n const findController = new PDFFindController({\n linkService: pdfLinkService,\n eventBus,\n updateMatchesCountOnProgress:\n typeof PDFJSDev === \"undefined\"\n ? !window.isGECKOVIEW\n : !PDFJSDev.test(\"GECKOVIEW\"),\n });\n this.findController = findController;\n\n const pdfScriptingManager = new PDFScriptingManager({\n eventBus,\n sandboxBundleSrc:\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC || CHROME\")\n ? AppOptions.get(\"sandboxBundleSrc\")\n : null,\n scriptingFactory: externalServices,\n docPropertiesLookup: this._scriptingDocProperties.bind(this),\n });\n this.pdfScriptingManager = pdfScriptingManager;\n\n const container = appConfig.mainContainer,\n viewer = appConfig.viewerContainer;\n const annotationEditorMode = AppOptions.get(\"annotationEditorMode\");\n const pageColors =\n AppOptions.get(\"forcePageColors\") ||\n window.matchMedia(\"(forced-colors: active)\").matches\n ? {\n background: AppOptions.get(\"pageColorsBackground\"),\n foreground: AppOptions.get(\"pageColorsForeground\"),\n }\n : null;\n\n this.pdfViewer = new PDFViewer({\n container,\n viewer,\n eventBus,\n renderingQueue: pdfRenderingQueue,\n linkService: pdfLinkService,\n downloadManager,\n findController,\n scriptingManager:\n AppOptions.get(\"enableScripting\") && pdfScriptingManager,\n renderer:\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n ? AppOptions.get(\"renderer\")\n : null,\n l10n: this.l10n,\n textLayerMode: AppOptions.get(\"textLayerMode\"),\n annotationMode: AppOptions.get(\"annotationMode\"),\n annotationEditorMode,\n imageResourcesPath: AppOptions.get(\"imageResourcesPath\"),\n enablePrintAutoRotate: AppOptions.get(\"enablePrintAutoRotate\"),\n useOnlyCssZoom: AppOptions.get(\"useOnlyCssZoom\"),\n isOffscreenCanvasSupported: AppOptions.get(\"isOffscreenCanvasSupported\"),\n maxCanvasPixels: AppOptions.get(\"maxCanvasPixels\"),\n enablePermissions: AppOptions.get(\"enablePermissions\"),\n pageColors,\n });\n pdfRenderingQueue.setViewer(this.pdfViewer);\n pdfLinkService.setViewer(this.pdfViewer);\n pdfScriptingManager.setViewer(this.pdfViewer);\n\n if (appConfig.sidebar?.thumbnailView) {\n this.pdfThumbnailViewer = new PDFThumbnailViewer({\n container: appConfig.sidebar.thumbnailView,\n renderingQueue: pdfRenderingQueue,\n linkService: pdfLinkService,\n l10n: this.l10n,\n pageColors,\n });\n pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);\n }\n\n // The browsing history is only enabled when the viewer is standalone,\n // i.e. not when it is embedded in a web page.\n if (!this.isViewerEmbedded && !AppOptions.get(\"disableHistory\")) {\n this.pdfHistory = new PDFHistory({\n linkService: pdfLinkService,\n eventBus,\n });\n pdfLinkService.setHistory(this.pdfHistory);\n }\n\n if (!this.supportsIntegratedFind && appConfig.findBar) {\n this.findBar = new PDFFindBar(appConfig.findBar, eventBus, this.l10n);\n }\n\n if (appConfig.annotationEditorParams) {\n if (annotationEditorMode !== AnnotationEditorType.DISABLE) {\n this.annotationEditorParams = new AnnotationEditorParams(\n appConfig.annotationEditorParams,\n eventBus\n );\n } else {\n for (const id of [\"editorModeButtons\", \"editorModeSeparator\"]) {\n document.getElementById(id)?.classList.add(\"hidden\");\n }\n }\n }\n\n if (appConfig.documentProperties) {\n this.pdfDocumentProperties = new PDFDocumentProperties(\n appConfig.documentProperties,\n this.overlayManager,\n eventBus,\n this.l10n,\n /* fileNameLookup = */ () => {\n return this._docFilename;\n }\n );\n }\n\n // NOTE: The cursor-tools are unlikely to be helpful/useful in GeckoView,\n // in particular the `HandTool` which basically simulates touch scrolling.\n if (appConfig.secondaryToolbar?.cursorHandToolButton) {\n this.pdfCursorTools = new PDFCursorTools({\n container,\n eventBus,\n cursorToolOnLoad: AppOptions.get(\"cursorToolOnLoad\"),\n });\n }\n\n if (appConfig.toolbar) {\n this.toolbar = new Toolbar(appConfig.toolbar, eventBus, this.l10n);\n }\n\n if (appConfig.secondaryToolbar) {\n this.secondaryToolbar = new SecondaryToolbar(\n appConfig.secondaryToolbar,\n eventBus,\n this.externalServices\n );\n }\n\n if (\n this.supportsFullscreen &&\n appConfig.secondaryToolbar?.presentationModeButton\n ) {\n this.pdfPresentationMode = new PDFPresentationMode({\n container,\n pdfViewer: this.pdfViewer,\n eventBus,\n });\n }\n\n if (appConfig.passwordOverlay) {\n this.passwordPrompt = new PasswordPrompt(\n appConfig.passwordOverlay,\n this.overlayManager,\n this.l10n,\n this.isViewerEmbedded\n );\n }\n\n if (appConfig.sidebar?.outlineView) {\n this.pdfOutlineViewer = new PDFOutlineViewer({\n container: appConfig.sidebar.outlineView,\n eventBus,\n linkService: pdfLinkService,\n downloadManager,\n });\n }\n\n if (appConfig.sidebar?.attachmentsView) {\n this.pdfAttachmentViewer = new PDFAttachmentViewer({\n container: appConfig.sidebar.attachmentsView,\n eventBus,\n downloadManager,\n });\n }\n\n if (appConfig.sidebar?.layersView) {\n this.pdfLayerViewer = new PDFLayerViewer({\n container: appConfig.sidebar.layersView,\n eventBus,\n l10n: this.l10n,\n });\n }\n\n if (appConfig.sidebar) {\n this.pdfSidebar = new PDFSidebar({\n elements: appConfig.sidebar,\n pdfViewer: this.pdfViewer,\n pdfThumbnailViewer: this.pdfThumbnailViewer,\n eventBus,\n l10n: this.l10n,\n });\n this.pdfSidebar.onToggled = this.forceRendering.bind(this);\n\n this.pdfSidebarResizer = new PDFSidebarResizer(\n appConfig.sidebarResizer,\n eventBus,\n this.l10n\n );\n }\n },\n\n run(config) {\n this.initialize(config).then(webViewerInitialized);\n },\n\n get initialized() {\n return this._initializedCapability.settled;\n },\n\n get initializedPromise() {\n return this._initializedCapability.promise;\n },\n\n zoomIn(steps, scaleFactor) {\n if (this.pdfViewer.isInPresentationMode) {\n return;\n }\n this.pdfViewer.increaseScale({\n drawingDelay: AppOptions.get(\"defaultZoomDelay\"),\n steps,\n scaleFactor,\n });\n },\n\n zoomOut(steps, scaleFactor) {\n if (this.pdfViewer.isInPresentationMode) {\n return;\n }\n this.pdfViewer.decreaseScale({\n drawingDelay: AppOptions.get(\"defaultZoomDelay\"),\n steps,\n scaleFactor,\n });\n },\n\n zoomReset() {\n if (this.pdfViewer.isInPresentationMode) {\n return;\n }\n this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;\n },\n\n get pagesCount() {\n return this.pdfDocument ? this.pdfDocument.numPages : 0;\n },\n\n get page() {\n return this.pdfViewer.currentPageNumber;\n },\n\n set page(val) {\n this.pdfViewer.currentPageNumber = val;\n },\n\n get supportsPrinting() {\n return PDFPrintServiceFactory.instance.supportsPrinting;\n },\n\n get supportsFullscreen() {\n return shadow(this, \"supportsFullscreen\", document.fullscreenEnabled);\n },\n\n get supportsPinchToZoom() {\n return this.externalServices.supportsPinchToZoom;\n },\n\n get supportsIntegratedFind() {\n return this.externalServices.supportsIntegratedFind;\n },\n\n get supportsDocumentFonts() {\n return this.externalServices.supportsDocumentFonts;\n },\n\n get loadingBar() {\n const barElement = document.getElementById(\"loadingBar\");\n const bar = barElement ? new ProgressBar(barElement) : null;\n return shadow(this, \"loadingBar\", bar);\n },\n\n get supportedMouseWheelZoomModifierKeys() {\n return this.externalServices.supportedMouseWheelZoomModifierKeys;\n },\n\n initPassiveLoading() {\n if (\n typeof PDFJSDev === \"undefined\" ||\n !PDFJSDev.test(\"MOZCENTRAL || CHROME\")\n ) {\n throw new Error(\"Not implemented: initPassiveLoading\");\n }\n this.externalServices.initPassiveLoading({\n onOpenWithTransport: range => {\n this.open({ range });\n },\n onOpenWithData: (data, contentDispositionFilename) => {\n if (isPdfFile(contentDispositionFilename)) {\n this._contentDispositionFilename = contentDispositionFilename;\n }\n this.open({ data });\n },\n onOpenWithURL: (url, length, originalUrl) => {\n this.open({ url, length, originalUrl });\n },\n onError: err => {\n this.l10n.get(\"loading_error\").then(msg => {\n this._documentError(msg, err);\n });\n },\n onProgress: (loaded, total) => {\n this.progress(loaded / total);\n },\n });\n },\n\n setTitleUsingUrl(url = \"\", downloadUrl = null) {\n this.url = url;\n this.baseUrl = url.split(\"#\")[0];\n if (downloadUrl) {\n this._downloadUrl =\n downloadUrl === url ? this.baseUrl : downloadUrl.split(\"#\")[0];\n }\n if (isDataScheme(url)) {\n this._hideViewBookmark();\n }\n let title = getPdfFilenameFromUrl(url, \"\");\n if (!title) {\n try {\n title = decodeURIComponent(getFilenameFromUrl(url)) || url;\n } catch (ex) {\n // decodeURIComponent may throw URIError,\n // fall back to using the unprocessed url in that case\n title = url;\n }\n }\n this.setTitle(title);\n },\n\n setTitle(title = this._title) {\n this._title = title;\n\n if (this.isViewerEmbedded) {\n // Embedded PDF viewers should not be changing their parent page's title.\n return;\n }\n const editorIndicator =\n this._hasAnnotationEditors && !this.pdfRenderingQueue.printing;\n document.title = `${editorIndicator ? \"* \" : \"\"}${title}`;\n },\n\n get _docFilename() {\n // Use `this.url` instead of `this.baseUrl` to perform filename detection\n // based on the reference fragment as ultimate fallback if needed.\n return this._contentDispositionFilename || getPdfFilenameFromUrl(this.url);\n },\n\n /**\n * @private\n */\n _hideViewBookmark() {\n const { secondaryToolbar } = this.appConfig;\n // URL does not reflect proper document location - hiding some buttons.\n secondaryToolbar?.viewBookmarkButton.classList.add(\"hidden\");\n\n // Avoid displaying multiple consecutive separators in the secondaryToolbar.\n if (secondaryToolbar?.presentationModeButton.classList.contains(\"hidden\")) {\n document.getElementById(\"viewBookmarkSeparator\")?.classList.add(\"hidden\");\n }\n },\n\n /**\n * Closes opened PDF document.\n * @returns {Promise} - Returns the promise, which is resolved when all\n * destruction is completed.\n */\n async close() {\n this._unblockDocumentLoadEvent();\n this._hideViewBookmark();\n\n if (!this.pdfLoadingTask) {\n return;\n }\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this.pdfDocument?.annotationStorage.size > 0 &&\n this._annotationStorageModified\n ) {\n try {\n // Trigger saving, to prevent data loss in forms; see issue 12257.\n await this.save();\n } catch (reason) {\n // Ignoring errors, to ensure that document closing won't break.\n }\n }\n const promises = [];\n\n promises.push(this.pdfLoadingTask.destroy());\n this.pdfLoadingTask = null;\n\n if (this.pdfDocument) {\n this.pdfDocument = null;\n\n this.pdfThumbnailViewer?.setDocument(null);\n this.pdfViewer.setDocument(null);\n this.pdfLinkService.setDocument(null);\n this.pdfDocumentProperties?.setDocument(null);\n }\n this.pdfLinkService.externalLinkEnabled = true;\n this.store = null;\n this.isInitialViewSet = false;\n this.downloadComplete = false;\n this.url = \"\";\n this.baseUrl = \"\";\n this._downloadUrl = \"\";\n this.documentInfo = null;\n this.metadata = null;\n this._contentDispositionFilename = null;\n this._contentLength = null;\n this._saveInProgress = false;\n this._hasAnnotationEditors = false;\n\n promises.push(this.pdfScriptingManager.destroyPromise);\n\n this.setTitle();\n this.pdfSidebar?.reset();\n this.pdfOutlineViewer?.reset();\n this.pdfAttachmentViewer?.reset();\n this.pdfLayerViewer?.reset();\n\n this.pdfHistory?.reset();\n this.findBar?.reset();\n this.toolbar?.reset();\n this.secondaryToolbar?.reset();\n this._PDFBug?.cleanup();\n\n await Promise.all(promises);\n },\n\n /**\n * Opens a new PDF document.\n * @param {Object} args - Accepts any/all of the properties from\n * {@link DocumentInitParameters}, and also a `originalUrl` string.\n * @returns {Promise} - Promise that is resolved when the document is opened.\n */\n async open(args) {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n let deprecatedArgs = false;\n if (typeof args === \"string\") {\n args = { url: args }; // URL\n deprecatedArgs = true;\n } else if (args?.byteLength) {\n args = { data: args }; // ArrayBuffer\n deprecatedArgs = true;\n }\n if (deprecatedArgs) {\n console.error(\n \"The `PDFViewerApplication.open` signature was updated, please use an object instead.\"\n );\n }\n }\n\n if (this.pdfLoadingTask) {\n // We need to destroy already opened document.\n await this.close();\n }\n // Set the necessary global worker parameters, using the available options.\n const workerParams = AppOptions.getAll(OptionKind.WORKER);\n Object.assign(GlobalWorkerOptions, workerParams);\n\n if (\n (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) &&\n args.url\n ) {\n // The Firefox built-in viewer always calls `setTitleUsingUrl`, before\n // `initPassiveLoading`, and it never provides an `originalUrl` here.\n this.setTitleUsingUrl(\n args.originalUrl || args.url,\n /* downloadUrl = */ args.url\n );\n }\n // Set the necessary API parameters, using all the available options.\n const apiParams = AppOptions.getAll(OptionKind.API);\n const params = {\n canvasMaxAreaInBytes: this.externalServices.canvasMaxAreaInBytes,\n ...apiParams,\n ...args,\n };\n\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")) {\n params.docBaseUrl ||= document.URL.split(\"#\")[0];\n } else if (PDFJSDev.test(\"MOZCENTRAL || CHROME\")) {\n params.docBaseUrl ||= this.baseUrl;\n }\n const loadingTask = getDocument(params);\n this.pdfLoadingTask = loadingTask;\n\n loadingTask.onPassword = (updateCallback, reason) => {\n if (this.isViewerEmbedded) {\n // The load event can't be triggered until the password is entered, so\n // if the viewer is in an iframe and its visibility depends on the\n // onload callback then the viewer never shows (bug 1801341).\n this._unblockDocumentLoadEvent();\n }\n\n this.pdfLinkService.externalLinkEnabled = false;\n this.passwordPrompt.setUpdateCallback(updateCallback, reason);\n this.passwordPrompt.open();\n };\n\n loadingTask.onProgress = ({ loaded, total }) => {\n this.progress(loaded / total);\n };\n\n return loadingTask.promise.then(\n pdfDocument => {\n this.load(pdfDocument);\n },\n reason => {\n if (loadingTask !== this.pdfLoadingTask) {\n return undefined; // Ignore errors for previously opened PDF files.\n }\n\n let key = \"loading_error\";\n if (reason instanceof InvalidPDFException) {\n key = \"invalid_file_error\";\n } else if (reason instanceof MissingPDFException) {\n key = \"missing_file_error\";\n } else if (reason instanceof UnexpectedResponseException) {\n key = \"unexpected_response_error\";\n }\n return this.l10n.get(key).then(msg => {\n this._documentError(msg, { message: reason?.message });\n throw reason;\n });\n }\n );\n },\n\n /**\n * @private\n */\n _ensureDownloadComplete() {\n if (this.pdfDocument && this.downloadComplete) {\n return;\n }\n throw new Error(\"PDF document not downloaded.\");\n },\n\n async download() {\n const url = this._downloadUrl,\n filename = this._docFilename;\n try {\n this._ensureDownloadComplete();\n\n const data = await this.pdfDocument.getData();\n const blob = new Blob([data], { type: \"application/pdf\" });\n\n await this.downloadManager.download(blob, url, filename);\n } catch (reason) {\n // When the PDF document isn't ready, or the PDF file is still\n // downloading, simply download using the URL.\n await this.downloadManager.downloadUrl(url, filename);\n }\n },\n\n async save() {\n if (this._saveInProgress) {\n return;\n }\n this._saveInProgress = true;\n await this.pdfScriptingManager.dispatchWillSave();\n\n const url = this._downloadUrl,\n filename = this._docFilename;\n try {\n this._ensureDownloadComplete();\n\n const data = await this.pdfDocument.saveDocument();\n const blob = new Blob([data], { type: \"application/pdf\" });\n\n await this.downloadManager.download(blob, url, filename);\n } catch (reason) {\n // When the PDF document isn't ready, or the PDF file is still\n // downloading, simply fallback to a \"regular\" download.\n console.error(`Error when saving the document: ${reason.message}`);\n await this.download();\n } finally {\n await this.pdfScriptingManager.dispatchDidSave();\n this._saveInProgress = false;\n }\n\n if (this._hasAnnotationEditors) {\n this.externalServices.reportTelemetry({\n type: \"editing\",\n data: { type: \"save\" },\n });\n }\n },\n\n downloadOrSave() {\n if (this.pdfDocument?.annotationStorage.size > 0) {\n this.save();\n } else {\n this.download();\n }\n },\n\n /**\n * Report the error; used for errors affecting loading and/or parsing of\n * the entire PDF document.\n */\n _documentError(message, moreInfo = null) {\n this._unblockDocumentLoadEvent();\n\n this._otherError(message, moreInfo);\n\n this.eventBus.dispatch(\"documenterror\", {\n source: this,\n message,\n reason: moreInfo?.message ?? null,\n });\n },\n\n /**\n * Report the error; used for errors affecting e.g. only a single page.\n * @param {string} message - A message that is human readable.\n * @param {Object} [moreInfo] - Further information about the error that is\n * more technical. Should have a 'message' and\n * optionally a 'stack' property.\n */\n _otherError(message, moreInfo = null) {\n const moreInfoText = [`PDF.js v${version || \"?\"} (build: ${build || \"?\"})`];\n if (moreInfo) {\n moreInfoText.push(`Message: ${moreInfo.message}`);\n\n if (moreInfo.stack) {\n moreInfoText.push(`Stack: ${moreInfo.stack}`);\n } else {\n if (moreInfo.filename) {\n moreInfoText.push(`File: ${moreInfo.filename}`);\n }\n if (moreInfo.lineNumber) {\n moreInfoText.push(`Line: ${moreInfo.lineNumber}`);\n }\n }\n }\n\n console.error(`${message}\\n\\n${moreInfoText.join(\"\\n\")}`);\n },\n\n progress(level) {\n if (!this.loadingBar || this.downloadComplete) {\n // Don't accidentally show the loading bar again when the entire file has\n // already been fetched (only an issue when disableAutoFetch is enabled).\n return;\n }\n const percent = Math.round(level * 100);\n // When we transition from full request to range requests, it's possible\n // that we discard some of the loaded data. This can cause the loading\n // bar to move backwards. So prevent this by only updating the bar if it\n // increases.\n if (percent <= this.loadingBar.percent) {\n return;\n }\n this.loadingBar.percent = percent;\n\n // When disableAutoFetch is enabled, it's not uncommon for the entire file\n // to never be fetched (depends on e.g. the file structure). In this case\n // the loading bar will not be completely filled, nor will it be hidden.\n // To prevent displaying a partially filled loading bar permanently, we\n // hide it when no data has been loaded during a certain amount of time.\n if (\n this.pdfDocument?.loadingParams.disableAutoFetch ??\n AppOptions.get(\"disableAutoFetch\")\n ) {\n this.loadingBar.setDisableAutoFetch();\n }\n },\n\n load(pdfDocument) {\n this.pdfDocument = pdfDocument;\n\n pdfDocument.getDownloadInfo().then(({ length }) => {\n this._contentLength = length; // Ensure that the correct length is used.\n this.downloadComplete = true;\n this.loadingBar?.hide();\n\n firstPagePromise.then(() => {\n this.eventBus.dispatch(\"documentloaded\", { source: this });\n });\n });\n\n // Since the `setInitialView` call below depends on this being resolved,\n // fetch it early to avoid delaying initial rendering of the PDF document.\n const pageLayoutPromise = pdfDocument.getPageLayout().catch(function () {\n /* Avoid breaking initial rendering; ignoring errors. */\n });\n const pageModePromise = pdfDocument.getPageMode().catch(function () {\n /* Avoid breaking initial rendering; ignoring errors. */\n });\n const openActionPromise = pdfDocument.getOpenAction().catch(function () {\n /* Avoid breaking initial rendering; ignoring errors. */\n });\n\n this.toolbar?.setPagesCount(pdfDocument.numPages, false);\n this.secondaryToolbar?.setPagesCount(pdfDocument.numPages);\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")) {\n const baseUrl = location.href.split(\"#\")[0];\n // Ignore \"data:\"-URLs for performance reasons, even though it may cause\n // internal links to not work perfectly in all cases (see bug 1803050).\n this.pdfLinkService.setDocument(\n pdfDocument,\n isDataScheme(baseUrl) ? null : baseUrl\n );\n } else {\n this.pdfLinkService.setDocument(pdfDocument);\n }\n this.pdfDocumentProperties?.setDocument(pdfDocument);\n\n const pdfViewer = this.pdfViewer;\n pdfViewer.setDocument(pdfDocument);\n const { firstPagePromise, onePageRendered, pagesPromise } = pdfViewer;\n\n this.pdfThumbnailViewer?.setDocument(pdfDocument);\n\n const storedPromise = (this.store = new ViewHistory(\n pdfDocument.fingerprints[0]\n ))\n .getMultiple({\n page: null,\n zoom: DEFAULT_SCALE_VALUE,\n scrollLeft: \"0\",\n scrollTop: \"0\",\n rotation: null,\n sidebarView: SidebarView.UNKNOWN,\n scrollMode: ScrollMode.UNKNOWN,\n spreadMode: SpreadMode.UNKNOWN,\n })\n .catch(() => {\n /* Unable to read from storage; ignoring errors. */\n return Object.create(null);\n });\n\n firstPagePromise.then(pdfPage => {\n this.loadingBar?.setWidth(this.appConfig.viewerContainer);\n this._initializeAnnotationStorageCallbacks(pdfDocument);\n\n Promise.all([\n animationStarted,\n storedPromise,\n pageLayoutPromise,\n pageModePromise,\n openActionPromise,\n ])\n .then(async ([timeStamp, stored, pageLayout, pageMode, openAction]) => {\n const viewOnLoad = AppOptions.get(\"viewOnLoad\");\n\n this._initializePdfHistory({\n fingerprint: pdfDocument.fingerprints[0],\n viewOnLoad,\n initialDest: openAction?.dest,\n });\n const initialBookmark = this.initialBookmark;\n\n // Initialize the default values, from user preferences.\n const zoom = AppOptions.get(\"defaultZoomValue\");\n let hash = zoom ? `zoom=${zoom}` : null;\n\n let rotation = null;\n let sidebarView = AppOptions.get(\"sidebarViewOnLoad\");\n let scrollMode = AppOptions.get(\"scrollModeOnLoad\");\n let spreadMode = AppOptions.get(\"spreadModeOnLoad\");\n\n if (stored.page && viewOnLoad !== ViewOnLoad.INITIAL) {\n hash =\n `page=${stored.page}&zoom=${zoom || stored.zoom},` +\n `${stored.scrollLeft},${stored.scrollTop}`;\n\n rotation = parseInt(stored.rotation, 10);\n // Always let user preference take precedence over the view history.\n if (sidebarView === SidebarView.UNKNOWN) {\n sidebarView = stored.sidebarView | 0;\n }\n if (scrollMode === ScrollMode.UNKNOWN) {\n scrollMode = stored.scrollMode | 0;\n }\n if (spreadMode === SpreadMode.UNKNOWN) {\n spreadMode = stored.spreadMode | 0;\n }\n }\n // NOTE: Ignore the pageMode/pageLayout in GeckoView since there's no\n // sidebar available, nor any UI for changing the Scroll/Spread modes.\n if (\n typeof PDFJSDev === \"undefined\"\n ? !window.isGECKOVIEW\n : !PDFJSDev.test(\"GECKOVIEW\")\n ) {\n // Always let the user preference/view history take precedence.\n if (pageMode && sidebarView === SidebarView.UNKNOWN) {\n sidebarView = apiPageModeToSidebarView(pageMode);\n }\n if (\n pageLayout &&\n scrollMode === ScrollMode.UNKNOWN &&\n spreadMode === SpreadMode.UNKNOWN\n ) {\n const modes = apiPageLayoutToViewerModes(pageLayout);\n // TODO: Try to improve page-switching when using the mouse-wheel\n // and/or arrow-keys before allowing the document to control this.\n // scrollMode = modes.scrollMode;\n spreadMode = modes.spreadMode;\n }\n }\n\n this.setInitialView(hash, {\n rotation,\n sidebarView,\n scrollMode,\n spreadMode,\n });\n this.eventBus.dispatch(\"documentinit\", { source: this });\n // Make all navigation keys work on document load,\n // unless the viewer is embedded in a web page.\n if (!this.isViewerEmbedded) {\n pdfViewer.focus();\n }\n\n // For documents with different page sizes, once all pages are\n // resolved, ensure that the correct location becomes visible on load.\n // (To reduce the risk, in very large and/or slow loading documents,\n // that the location changes *after* the user has started interacting\n // with the viewer, wait for either `pagesPromise` or a timeout.)\n await Promise.race([\n pagesPromise,\n new Promise(resolve => {\n setTimeout(resolve, FORCE_PAGES_LOADED_TIMEOUT);\n }),\n ]);\n if (!initialBookmark && !hash) {\n return;\n }\n if (pdfViewer.hasEqualPageSizes) {\n return;\n }\n this.initialBookmark = initialBookmark;\n\n // eslint-disable-next-line no-self-assign\n pdfViewer.currentScaleValue = pdfViewer.currentScaleValue;\n // Re-apply the initial document location.\n this.setInitialView(hash);\n })\n .catch(() => {\n // Ensure that the document is always completely initialized,\n // even if there are any errors thrown above.\n this.setInitialView();\n })\n .then(function () {\n // At this point, rendering of the initial page(s) should always have\n // started (and may even have completed).\n // To prevent any future issues, e.g. the document being completely\n // blank on load, always trigger rendering here.\n pdfViewer.update();\n });\n });\n\n pagesPromise.then(\n () => {\n this._unblockDocumentLoadEvent();\n\n this._initializeAutoPrint(pdfDocument, openActionPromise);\n },\n reason => {\n this.l10n.get(\"loading_error\").then(msg => {\n this._documentError(msg, { message: reason?.message });\n });\n }\n );\n\n onePageRendered.then(data => {\n this.externalServices.reportTelemetry({\n type: \"pageInfo\",\n timestamp: data.timestamp,\n });\n\n if (this.pdfOutlineViewer) {\n pdfDocument.getOutline().then(outline => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the outline resolved.\n }\n this.pdfOutlineViewer.render({ outline, pdfDocument });\n });\n }\n if (this.pdfAttachmentViewer) {\n pdfDocument.getAttachments().then(attachments => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the attachments resolved.\n }\n this.pdfAttachmentViewer.render({ attachments });\n });\n }\n if (this.pdfLayerViewer) {\n // Ensure that the layers accurately reflects the current state in the\n // viewer itself, rather than the default state provided by the API.\n pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the layers resolved.\n }\n this.pdfLayerViewer.render({ optionalContentConfig, pdfDocument });\n });\n }\n });\n\n this._initializePageLabels(pdfDocument);\n this._initializeMetadata(pdfDocument);\n },\n\n /**\n * @private\n */\n async _scriptingDocProperties(pdfDocument) {\n if (!this.documentInfo) {\n // It should be *extremely* rare for metadata to not have been resolved\n // when this code runs, but ensure that we handle that case here.\n await new Promise(resolve => {\n this.eventBus._on(\"metadataloaded\", resolve, { once: true });\n });\n if (pdfDocument !== this.pdfDocument) {\n return null; // The document was closed while the metadata resolved.\n }\n }\n if (!this._contentLength) {\n // Always waiting for the entire PDF document to be loaded will, most\n // likely, delay sandbox-creation too much in the general case for all\n // PDF documents which are not provided as binary data to the API.\n // Hence we'll simply have to trust that the `contentLength` (as provided\n // by the server), when it exists, is accurate enough here.\n await new Promise(resolve => {\n this.eventBus._on(\"documentloaded\", resolve, { once: true });\n });\n if (pdfDocument !== this.pdfDocument) {\n return null; // The document was closed while the downloadInfo resolved.\n }\n }\n\n return {\n ...this.documentInfo,\n baseURL: this.baseUrl,\n filesize: this._contentLength,\n filename: this._docFilename,\n metadata: this.metadata?.getRaw(),\n authors: this.metadata?.get(\"dc:creator\"),\n numPages: this.pagesCount,\n URL: this.url,\n };\n },\n\n /**\n * @private\n */\n async _initializeAutoPrint(pdfDocument, openActionPromise) {\n const [openAction, javaScript] = await Promise.all([\n openActionPromise,\n !this.pdfViewer.enableScripting ? pdfDocument.getJavaScript() : null,\n ]);\n\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the auto print data resolved.\n }\n let triggerAutoPrint = false;\n\n if (openAction?.action === \"Print\") {\n triggerAutoPrint = true;\n }\n if (javaScript) {\n javaScript.some(js => {\n if (!js) {\n // Don't warn/fallback for empty JavaScript actions.\n return false;\n }\n console.warn(\"Warning: JavaScript support is not enabled\");\n return true;\n });\n\n if (!triggerAutoPrint) {\n // Hack to support auto printing.\n for (const js of javaScript) {\n if (js && AutoPrintRegExp.test(js)) {\n triggerAutoPrint = true;\n break;\n }\n }\n }\n }\n\n if (triggerAutoPrint) {\n this.triggerPrinting();\n }\n },\n\n /**\n * @private\n */\n async _initializeMetadata(pdfDocument) {\n const { info, metadata, contentDispositionFilename, contentLength } =\n await pdfDocument.getMetadata();\n\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the metadata resolved.\n }\n this.documentInfo = info;\n this.metadata = metadata;\n this._contentDispositionFilename ??= contentDispositionFilename;\n this._contentLength ??= contentLength; // See `getDownloadInfo`-call above.\n\n // Provides some basic debug information\n console.log(\n `PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` +\n `${(info.Producer || \"-\").trim()} / ${(info.Creator || \"-\").trim()}] ` +\n `(PDF.js: ${version || \"?\"} [${build || \"?\"}])`\n );\n let pdfTitle = info.Title;\n\n const metadataTitle = metadata?.get(\"dc:title\");\n if (metadataTitle) {\n // Ghostscript can produce invalid 'dc:title' Metadata entries:\n // - The title may be \"Untitled\" (fixes bug 1031612).\n // - The title may contain incorrectly encoded characters, which thus\n // looks broken, hence we ignore the Metadata entry when it contains\n // characters from the Specials Unicode block (fixes bug 1605526).\n if (\n metadataTitle !== \"Untitled\" &&\n !/[\\uFFF0-\\uFFFF]/g.test(metadataTitle)\n ) {\n pdfTitle = metadataTitle;\n }\n }\n if (pdfTitle) {\n this.setTitle(\n `${pdfTitle} - ${this._contentDispositionFilename || this._title}`\n );\n } else if (this._contentDispositionFilename) {\n this.setTitle(this._contentDispositionFilename);\n }\n\n if (\n info.IsXFAPresent &&\n !info.IsAcroFormPresent &&\n !pdfDocument.isPureXfa\n ) {\n if (pdfDocument.loadingParams.enableXfa) {\n console.warn(\"Warning: XFA Foreground documents are not supported\");\n } else {\n console.warn(\"Warning: XFA support is not enabled\");\n }\n } else if (\n (info.IsAcroFormPresent || info.IsXFAPresent) &&\n !this.pdfViewer.renderForms\n ) {\n console.warn(\"Warning: Interactive form support is not enabled\");\n }\n\n if (info.IsSignaturesPresent) {\n console.warn(\"Warning: Digital signatures validation is not supported\");\n }\n\n this.eventBus.dispatch(\"metadataloaded\", { source: this });\n },\n\n /**\n * @private\n */\n async _initializePageLabels(pdfDocument) {\n if (\n typeof PDFJSDev === \"undefined\"\n ? window.isGECKOVIEW\n : PDFJSDev.test(\"GECKOVIEW\")\n ) {\n return;\n }\n const labels = await pdfDocument.getPageLabels();\n\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the page labels resolved.\n }\n if (!labels || AppOptions.get(\"disablePageLabels\")) {\n return;\n }\n const numLabels = labels.length;\n // Ignore page labels that correspond to standard page numbering,\n // or page labels that are all empty.\n let standardLabels = 0,\n emptyLabels = 0;\n for (let i = 0; i < numLabels; i++) {\n const label = labels[i];\n if (label === (i + 1).toString()) {\n standardLabels++;\n } else if (label === \"\") {\n emptyLabels++;\n } else {\n break;\n }\n }\n if (standardLabels >= numLabels || emptyLabels >= numLabels) {\n return;\n }\n const { pdfViewer, pdfThumbnailViewer, toolbar } = this;\n\n pdfViewer.setPageLabels(labels);\n pdfThumbnailViewer?.setPageLabels(labels);\n\n // Changing toolbar page display to use labels and we need to set\n // the label of the current page.\n toolbar?.setPagesCount(numLabels, true);\n toolbar?.setPageNumber(\n pdfViewer.currentPageNumber,\n pdfViewer.currentPageLabel\n );\n },\n\n /**\n * @private\n */\n _initializePdfHistory({ fingerprint, viewOnLoad, initialDest = null }) {\n if (!this.pdfHistory) {\n return;\n }\n this.pdfHistory.initialize({\n fingerprint,\n resetHistory: viewOnLoad === ViewOnLoad.INITIAL,\n updateUrl: AppOptions.get(\"historyUpdateUrl\"),\n });\n\n if (this.pdfHistory.initialBookmark) {\n this.initialBookmark = this.pdfHistory.initialBookmark;\n\n this.initialRotation = this.pdfHistory.initialRotation;\n }\n\n // Always let the browser history/document hash take precedence.\n if (\n initialDest &&\n !this.initialBookmark &&\n viewOnLoad === ViewOnLoad.UNKNOWN\n ) {\n this.initialBookmark = JSON.stringify(initialDest);\n // TODO: Re-factor the `PDFHistory` initialization to remove this hack\n // that's currently necessary to prevent weird initial history state.\n this.pdfHistory.push({ explicitDest: initialDest, pageNumber: null });\n }\n },\n\n /**\n * @private\n */\n _initializeAnnotationStorageCallbacks(pdfDocument) {\n if (pdfDocument !== this.pdfDocument) {\n return;\n }\n const { annotationStorage } = pdfDocument;\n\n annotationStorage.onSetModified = () => {\n window.addEventListener(\"beforeunload\", beforeUnload);\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this._annotationStorageModified = true;\n }\n };\n annotationStorage.onResetModified = () => {\n window.removeEventListener(\"beforeunload\", beforeUnload);\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n delete this._annotationStorageModified;\n }\n };\n annotationStorage.onAnnotationEditor = typeStr => {\n this._hasAnnotationEditors = !!typeStr;\n this.setTitle();\n\n if (typeStr) {\n this.externalServices.reportTelemetry({\n type: \"editing\",\n data: { type: typeStr },\n });\n }\n };\n },\n\n setInitialView(\n storedHash,\n { rotation, sidebarView, scrollMode, spreadMode } = {}\n ) {\n const setRotation = angle => {\n if (isValidRotation(angle)) {\n this.pdfViewer.pagesRotation = angle;\n }\n };\n const setViewerModes = (scroll, spread) => {\n if (isValidScrollMode(scroll)) {\n this.pdfViewer.scrollMode = scroll;\n }\n if (isValidSpreadMode(spread)) {\n this.pdfViewer.spreadMode = spread;\n }\n };\n this.isInitialViewSet = true;\n this.pdfSidebar?.setInitialView(sidebarView);\n\n setViewerModes(scrollMode, spreadMode);\n\n if (this.initialBookmark) {\n setRotation(this.initialRotation);\n delete this.initialRotation;\n\n this.pdfLinkService.setHash(this.initialBookmark);\n this.initialBookmark = null;\n } else if (storedHash) {\n setRotation(rotation);\n\n this.pdfLinkService.setHash(storedHash);\n }\n\n // Ensure that the correct page number is displayed in the UI,\n // even if the active page didn't change during document load.\n this.toolbar?.setPageNumber(\n this.pdfViewer.currentPageNumber,\n this.pdfViewer.currentPageLabel\n );\n this.secondaryToolbar?.setPageNumber(this.pdfViewer.currentPageNumber);\n\n if (!this.pdfViewer.currentScaleValue) {\n // Scale was not initialized: invalid bookmark or scale was not specified.\n // Setting the default one.\n this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;\n }\n },\n\n /**\n * @private\n */\n _cleanup() {\n if (!this.pdfDocument) {\n return; // run cleanup when document is loaded\n }\n this.pdfViewer.cleanup();\n this.pdfThumbnailViewer?.cleanup();\n\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n ) {\n // We don't want to remove fonts used by active page SVGs.\n this.pdfDocument.cleanup(\n /* keepLoadedFonts = */ this.pdfViewer.renderer === RendererType.SVG\n );\n } else {\n this.pdfDocument.cleanup();\n }\n },\n\n forceRendering() {\n this.pdfRenderingQueue.printing = !!this.printService;\n this.pdfRenderingQueue.isThumbnailViewEnabled =\n this.pdfSidebar?.visibleView === SidebarView.THUMBS;\n this.pdfRenderingQueue.renderHighestPriority();\n },\n\n beforePrint() {\n this._printAnnotationStoragePromise = this.pdfScriptingManager\n .dispatchWillPrint()\n .catch(() => {\n /* Avoid breaking printing; ignoring errors. */\n })\n .then(() => {\n return this.pdfDocument?.annotationStorage.print;\n });\n\n if (this.printService) {\n // There is no way to suppress beforePrint/afterPrint events,\n // but PDFPrintService may generate double events -- this will ignore\n // the second event that will be coming from native window.print().\n return;\n }\n\n if (!this.supportsPrinting) {\n this.l10n.get(\"printing_not_supported\").then(msg => {\n this._otherError(msg);\n });\n return;\n }\n\n // The beforePrint is a sync method and we need to know layout before\n // returning from this method. Ensure that we can get sizes of the pages.\n if (!this.pdfViewer.pageViewsReady) {\n this.l10n.get(\"printing_not_ready\").then(msg => {\n // eslint-disable-next-line no-alert\n window.alert(msg);\n });\n return;\n }\n\n const pagesOverview = this.pdfViewer.getPagesOverview();\n const printContainer = this.appConfig.printContainer;\n const printResolution = AppOptions.get(\"printResolution\");\n const optionalContentConfigPromise =\n this.pdfViewer.optionalContentConfigPromise;\n\n const printService = PDFPrintServiceFactory.instance.createPrintService(\n this.pdfDocument,\n pagesOverview,\n printContainer,\n printResolution,\n optionalContentConfigPromise,\n this._printAnnotationStoragePromise,\n this.l10n\n );\n this.printService = printService;\n this.forceRendering();\n // Disable the editor-indicator during printing (fixes bug 1790552).\n this.setTitle();\n\n printService.layout();\n\n if (this._hasAnnotationEditors) {\n this.externalServices.reportTelemetry({\n type: \"editing\",\n data: { type: \"print\" },\n });\n }\n },\n\n afterPrint() {\n if (this._printAnnotationStoragePromise) {\n this._printAnnotationStoragePromise.then(() => {\n this.pdfScriptingManager.dispatchDidPrint();\n });\n this._printAnnotationStoragePromise = null;\n }\n\n if (this.printService) {\n this.printService.destroy();\n this.printService = null;\n\n this.pdfDocument?.annotationStorage.resetModified();\n }\n this.forceRendering();\n // Re-enable the editor-indicator after printing (fixes bug 1790552).\n this.setTitle();\n },\n\n rotatePages(delta) {\n this.pdfViewer.pagesRotation += delta;\n // Note that the thumbnail viewer is updated, and rendering is triggered,\n // in the 'rotationchanging' event handler.\n },\n\n requestPresentationMode() {\n this.pdfPresentationMode?.request();\n },\n\n triggerPrinting() {\n if (!this.supportsPrinting) {\n return;\n }\n window.print();\n },\n\n bindEvents() {\n const { eventBus, _boundEvents } = this;\n\n _boundEvents.beforePrint = this.beforePrint.bind(this);\n _boundEvents.afterPrint = this.afterPrint.bind(this);\n\n eventBus._on(\"resize\", webViewerResize);\n eventBus._on(\"hashchange\", webViewerHashchange);\n eventBus._on(\"beforeprint\", _boundEvents.beforePrint);\n eventBus._on(\"afterprint\", _boundEvents.afterPrint);\n eventBus._on(\"pagerender\", webViewerPageRender);\n eventBus._on(\"pagerendered\", webViewerPageRendered);\n eventBus._on(\"updateviewarea\", webViewerUpdateViewarea);\n eventBus._on(\"pagechanging\", webViewerPageChanging);\n eventBus._on(\"scalechanging\", webViewerScaleChanging);\n eventBus._on(\"rotationchanging\", webViewerRotationChanging);\n eventBus._on(\"sidebarviewchanged\", webViewerSidebarViewChanged);\n eventBus._on(\"pagemode\", webViewerPageMode);\n eventBus._on(\"namedaction\", webViewerNamedAction);\n eventBus._on(\"presentationmodechanged\", webViewerPresentationModeChanged);\n eventBus._on(\"presentationmode\", webViewerPresentationMode);\n eventBus._on(\n \"switchannotationeditormode\",\n webViewerSwitchAnnotationEditorMode\n );\n eventBus._on(\n \"switchannotationeditorparams\",\n webViewerSwitchAnnotationEditorParams\n );\n eventBus._on(\"print\", webViewerPrint);\n eventBus._on(\"download\", webViewerDownload);\n eventBus._on(\"firstpage\", webViewerFirstPage);\n eventBus._on(\"lastpage\", webViewerLastPage);\n eventBus._on(\"nextpage\", webViewerNextPage);\n eventBus._on(\"previouspage\", webViewerPreviousPage);\n eventBus._on(\"zoomin\", webViewerZoomIn);\n eventBus._on(\"zoomout\", webViewerZoomOut);\n eventBus._on(\"zoomreset\", webViewerZoomReset);\n eventBus._on(\"pagenumberchanged\", webViewerPageNumberChanged);\n eventBus._on(\"scalechanged\", webViewerScaleChanged);\n eventBus._on(\"rotatecw\", webViewerRotateCw);\n eventBus._on(\"rotateccw\", webViewerRotateCcw);\n eventBus._on(\"optionalcontentconfig\", webViewerOptionalContentConfig);\n eventBus._on(\"switchscrollmode\", webViewerSwitchScrollMode);\n eventBus._on(\"scrollmodechanged\", webViewerScrollModeChanged);\n eventBus._on(\"switchspreadmode\", webViewerSwitchSpreadMode);\n eventBus._on(\"spreadmodechanged\", webViewerSpreadModeChanged);\n eventBus._on(\"documentproperties\", webViewerDocumentProperties);\n eventBus._on(\"findfromurlhash\", webViewerFindFromUrlHash);\n eventBus._on(\"updatefindmatchescount\", webViewerUpdateFindMatchesCount);\n eventBus._on(\"updatefindcontrolstate\", webViewerUpdateFindControlState);\n\n if (AppOptions.get(\"pdfBug\")) {\n _boundEvents.reportPageStatsPDFBug = reportPageStatsPDFBug;\n\n eventBus._on(\"pagerendered\", _boundEvents.reportPageStatsPDFBug);\n eventBus._on(\"pagechanging\", _boundEvents.reportPageStatsPDFBug);\n }\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n eventBus._on(\"fileinputchange\", webViewerFileInputChange);\n eventBus._on(\"openfile\", webViewerOpenFile);\n }\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n eventBus._on(\n \"annotationeditorstateschanged\",\n webViewerAnnotationEditorStatesChanged\n );\n }\n },\n\n bindWindowEvents() {\n const { eventBus, _boundEvents } = this;\n\n function addWindowResolutionChange(evt = null) {\n if (evt) {\n webViewerResolutionChange(evt);\n }\n const mediaQueryList = window.matchMedia(\n `(resolution: ${window.devicePixelRatio || 1}dppx)`\n );\n mediaQueryList.addEventListener(\"change\", addWindowResolutionChange, {\n once: true,\n });\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n return;\n }\n _boundEvents.removeWindowResolutionChange ||= function () {\n mediaQueryList.removeEventListener(\"change\", addWindowResolutionChange);\n _boundEvents.removeWindowResolutionChange = null;\n };\n }\n addWindowResolutionChange();\n\n _boundEvents.windowResize = () => {\n eventBus.dispatch(\"resize\", { source: window });\n };\n _boundEvents.windowHashChange = () => {\n eventBus.dispatch(\"hashchange\", {\n source: window,\n hash: document.location.hash.substring(1),\n });\n };\n _boundEvents.windowBeforePrint = () => {\n eventBus.dispatch(\"beforeprint\", { source: window });\n };\n _boundEvents.windowAfterPrint = () => {\n eventBus.dispatch(\"afterprint\", { source: window });\n };\n _boundEvents.windowUpdateFromSandbox = event => {\n eventBus.dispatch(\"updatefromsandbox\", {\n source: window,\n detail: event.detail,\n });\n };\n\n window.addEventListener(\"visibilitychange\", webViewerVisibilityChange);\n window.addEventListener(\"wheel\", webViewerWheel, { passive: false });\n window.addEventListener(\"touchstart\", webViewerTouchStart, {\n passive: false,\n });\n window.addEventListener(\"touchmove\", webViewerTouchMove, {\n passive: false,\n });\n window.addEventListener(\"touchend\", webViewerTouchEnd, {\n passive: false,\n });\n window.addEventListener(\"click\", webViewerClick);\n window.addEventListener(\"keydown\", webViewerKeyDown);\n window.addEventListener(\"keyup\", webViewerKeyUp);\n window.addEventListener(\"resize\", _boundEvents.windowResize);\n window.addEventListener(\"hashchange\", _boundEvents.windowHashChange);\n window.addEventListener(\"beforeprint\", _boundEvents.windowBeforePrint);\n window.addEventListener(\"afterprint\", _boundEvents.windowAfterPrint);\n window.addEventListener(\n \"updatefromsandbox\",\n _boundEvents.windowUpdateFromSandbox\n );\n },\n\n unbindEvents() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: unbindEvents\");\n }\n const { eventBus, _boundEvents } = this;\n\n eventBus._off(\"resize\", webViewerResize);\n eventBus._off(\"hashchange\", webViewerHashchange);\n eventBus._off(\"beforeprint\", _boundEvents.beforePrint);\n eventBus._off(\"afterprint\", _boundEvents.afterPrint);\n eventBus._off(\"pagerender\", webViewerPageRender);\n eventBus._off(\"pagerendered\", webViewerPageRendered);\n eventBus._off(\"updateviewarea\", webViewerUpdateViewarea);\n eventBus._off(\"pagechanging\", webViewerPageChanging);\n eventBus._off(\"scalechanging\", webViewerScaleChanging);\n eventBus._off(\"rotationchanging\", webViewerRotationChanging);\n eventBus._off(\"sidebarviewchanged\", webViewerSidebarViewChanged);\n eventBus._off(\"pagemode\", webViewerPageMode);\n eventBus._off(\"namedaction\", webViewerNamedAction);\n eventBus._off(\"presentationmodechanged\", webViewerPresentationModeChanged);\n eventBus._off(\"presentationmode\", webViewerPresentationMode);\n eventBus._off(\"print\", webViewerPrint);\n eventBus._off(\"download\", webViewerDownload);\n eventBus._off(\"firstpage\", webViewerFirstPage);\n eventBus._off(\"lastpage\", webViewerLastPage);\n eventBus._off(\"nextpage\", webViewerNextPage);\n eventBus._off(\"previouspage\", webViewerPreviousPage);\n eventBus._off(\"zoomin\", webViewerZoomIn);\n eventBus._off(\"zoomout\", webViewerZoomOut);\n eventBus._off(\"zoomreset\", webViewerZoomReset);\n eventBus._off(\"pagenumberchanged\", webViewerPageNumberChanged);\n eventBus._off(\"scalechanged\", webViewerScaleChanged);\n eventBus._off(\"rotatecw\", webViewerRotateCw);\n eventBus._off(\"rotateccw\", webViewerRotateCcw);\n eventBus._off(\"optionalcontentconfig\", webViewerOptionalContentConfig);\n eventBus._off(\"switchscrollmode\", webViewerSwitchScrollMode);\n eventBus._off(\"scrollmodechanged\", webViewerScrollModeChanged);\n eventBus._off(\"switchspreadmode\", webViewerSwitchSpreadMode);\n eventBus._off(\"spreadmodechanged\", webViewerSpreadModeChanged);\n eventBus._off(\"documentproperties\", webViewerDocumentProperties);\n eventBus._off(\"findfromurlhash\", webViewerFindFromUrlHash);\n eventBus._off(\"updatefindmatchescount\", webViewerUpdateFindMatchesCount);\n eventBus._off(\"updatefindcontrolstate\", webViewerUpdateFindControlState);\n\n if (_boundEvents.reportPageStatsPDFBug) {\n eventBus._off(\"pagerendered\", _boundEvents.reportPageStatsPDFBug);\n eventBus._off(\"pagechanging\", _boundEvents.reportPageStatsPDFBug);\n\n _boundEvents.reportPageStatsPDFBug = null;\n }\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n eventBus._off(\"fileinputchange\", webViewerFileInputChange);\n eventBus._off(\"openfile\", webViewerOpenFile);\n }\n\n _boundEvents.beforePrint = null;\n _boundEvents.afterPrint = null;\n },\n\n unbindWindowEvents() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: unbindWindowEvents\");\n }\n const { _boundEvents } = this;\n\n window.removeEventListener(\"visibilitychange\", webViewerVisibilityChange);\n window.removeEventListener(\"wheel\", webViewerWheel, { passive: false });\n window.removeEventListener(\"touchstart\", webViewerTouchStart, {\n passive: false,\n });\n window.removeEventListener(\"touchmove\", webViewerTouchMove, {\n passive: false,\n });\n window.removeEventListener(\"touchend\", webViewerTouchEnd, {\n passive: false,\n });\n window.removeEventListener(\"click\", webViewerClick);\n window.removeEventListener(\"keydown\", webViewerKeyDown);\n window.removeEventListener(\"keyup\", webViewerKeyUp);\n window.removeEventListener(\"resize\", _boundEvents.windowResize);\n window.removeEventListener(\"hashchange\", _boundEvents.windowHashChange);\n window.removeEventListener(\"beforeprint\", _boundEvents.windowBeforePrint);\n window.removeEventListener(\"afterprint\", _boundEvents.windowAfterPrint);\n window.removeEventListener(\n \"updatefromsandbox\",\n _boundEvents.windowUpdateFromSandbox\n );\n\n _boundEvents.removeWindowResolutionChange?.();\n _boundEvents.windowResize = null;\n _boundEvents.windowHashChange = null;\n _boundEvents.windowBeforePrint = null;\n _boundEvents.windowAfterPrint = null;\n _boundEvents.windowUpdateFromSandbox = null;\n },\n\n _accumulateTicks(ticks, prop) {\n // If the direction changed, reset the accumulated ticks.\n if ((this[prop] > 0 && ticks < 0) || (this[prop] < 0 && ticks > 0)) {\n this[prop] = 0;\n }\n this[prop] += ticks;\n const wholeTicks = Math.trunc(this[prop]);\n this[prop] -= wholeTicks;\n return wholeTicks;\n },\n\n _accumulateFactor(previousScale, factor, prop) {\n if (factor === 1) {\n return 1;\n }\n // If the direction changed, reset the accumulated factor.\n if ((this[prop] > 1 && factor < 1) || (this[prop] < 1 && factor > 1)) {\n this[prop] = 1;\n }\n\n const newFactor =\n Math.floor(previousScale * factor * this[prop] * 100) /\n (100 * previousScale);\n this[prop] = factor / newFactor;\n\n return newFactor;\n },\n\n _centerAtPos(previousScale, x, y) {\n const { pdfViewer } = this;\n const scaleDiff = pdfViewer.currentScale / previousScale - 1;\n if (scaleDiff !== 0) {\n const [top, left] = pdfViewer.containerTopLeft;\n pdfViewer.container.scrollLeft += (x - left) * scaleDiff;\n pdfViewer.container.scrollTop += (y - top) * scaleDiff;\n }\n },\n\n /**\n * Should be called *after* all pages have loaded, or if an error occurred,\n * to unblock the \"load\" event; see https://bugzilla.mozilla.org/show_bug.cgi?id=1618553\n * @private\n */\n _unblockDocumentLoadEvent() {\n document.blockUnblockOnload?.(false);\n\n // Ensure that this method is only ever run once.\n this._unblockDocumentLoadEvent = () => {};\n },\n\n /**\n * Used together with the integration-tests, to enable awaiting full\n * initialization of the scripting/sandbox.\n */\n get scriptingReady() {\n return this.pdfScriptingManager.ready;\n },\n};\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n const HOSTED_VIEWER_ORIGINS = [\n \"null\",\n \"http://mozilla.github.io\",\n \"https://mozilla.github.io\",\n ];\n // eslint-disable-next-line no-var\n var validateFileURL = function (file) {\n if (!file) {\n return;\n }\n try {\n const viewerOrigin = new URL(window.location.href).origin || \"null\";\n if (HOSTED_VIEWER_ORIGINS.includes(viewerOrigin)) {\n // Hosted or local viewer, allow for any file locations\n return;\n }\n const fileOrigin = new URL(file, window.location.href).origin;\n // Removing of the following line will not guarantee that the viewer will\n // start accepting URLs from foreign origin -- CORS headers on the remote\n // server must be properly configured.\n if (fileOrigin !== viewerOrigin) {\n throw new Error(\"file origin does not match viewer's\");\n }\n } catch (ex) {\n PDFViewerApplication.l10n.get(\"loading_error\").then(msg => {\n PDFViewerApplication._documentError(msg, { message: ex?.message });\n });\n throw ex;\n }\n };\n}\n\nasync function loadFakeWorker() {\n GlobalWorkerOptions.workerSrc ||= AppOptions.get(\"workerSrc\");\n\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")) {\n window.pdfjsWorker = await import(\"pdfjs/pdf.worker.js\");\n return;\n }\n await loadScript(PDFWorker.workerSrc);\n}\n\nasync function loadPDFBug(self) {\n const { debuggerScriptPath } = self.appConfig;\n const { PDFBug } =\n typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n ? await import(debuggerScriptPath) // eslint-disable-line no-unsanitized/method\n : await import(debuggerScriptPath); // eslint-disable-line no-undef\n\n self._PDFBug = PDFBug;\n}\n\nfunction reportPageStatsPDFBug({ pageNumber }) {\n if (!globalThis.Stats?.enabled) {\n return;\n }\n const pageView = PDFViewerApplication.pdfViewer.getPageView(\n /* index = */ pageNumber - 1\n );\n globalThis.Stats.add(pageNumber, pageView?.pdfPage?.stats);\n}\n\nfunction webViewerInitialized() {\n const { appConfig, eventBus, l10n } = PDFViewerApplication;\n let file;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n const queryString = document.location.search.substring(1);\n const params = parseQueryString(queryString);\n file = params.get(\"file\") ?? AppOptions.get(\"defaultUrl\");\n validateFileURL(file);\n } else if (PDFJSDev.test(\"MOZCENTRAL\")) {\n file = window.location.href;\n } else if (PDFJSDev.test(\"CHROME\")) {\n file = AppOptions.get(\"defaultUrl\");\n }\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n const fileInput = appConfig.openFileInput;\n fileInput.value = null;\n\n fileInput.addEventListener(\"change\", function (evt) {\n const { files } = evt.target;\n if (!files || files.length === 0) {\n return;\n }\n eventBus.dispatch(\"fileinputchange\", {\n source: this,\n fileInput: evt.target,\n });\n });\n\n // Enable dragging-and-dropping a new PDF file onto the viewerContainer.\n appConfig.mainContainer.addEventListener(\"dragover\", function (evt) {\n evt.preventDefault();\n\n evt.dataTransfer.dropEffect =\n evt.dataTransfer.effectAllowed === \"copy\" ? \"copy\" : \"move\";\n });\n appConfig.mainContainer.addEventListener(\"drop\", function (evt) {\n evt.preventDefault();\n\n const { files } = evt.dataTransfer;\n if (!files || files.length === 0) {\n return;\n }\n eventBus.dispatch(\"fileinputchange\", {\n source: this,\n fileInput: evt.dataTransfer,\n });\n });\n }\n\n if (!PDFViewerApplication.supportsDocumentFonts) {\n AppOptions.set(\"disableFontFace\", true);\n l10n.get(\"web_fonts_disabled\").then(msg => {\n console.warn(msg);\n });\n }\n\n if (!PDFViewerApplication.supportsPrinting) {\n appConfig.toolbar?.print.classList.add(\"hidden\");\n appConfig.secondaryToolbar?.printButton.classList.add(\"hidden\");\n }\n\n if (!PDFViewerApplication.supportsFullscreen) {\n appConfig.secondaryToolbar?.presentationModeButton.classList.add(\"hidden\");\n }\n\n if (PDFViewerApplication.supportsIntegratedFind) {\n appConfig.toolbar?.viewFind.classList.add(\"hidden\");\n }\n\n appConfig.mainContainer.addEventListener(\n \"transitionend\",\n function (evt) {\n if (evt.target === /* mainContainer */ this) {\n eventBus.dispatch(\"resize\", { source: this });\n }\n },\n true\n );\n\n try {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n if (file) {\n PDFViewerApplication.open({ url: file });\n } else {\n PDFViewerApplication._hideViewBookmark();\n }\n } else if (PDFJSDev.test(\"MOZCENTRAL || CHROME\")) {\n PDFViewerApplication.setTitleUsingUrl(file, /* downloadUrl = */ file);\n PDFViewerApplication.initPassiveLoading();\n } else {\n throw new Error(\"Not implemented: webViewerInitialized\");\n }\n } catch (reason) {\n l10n.get(\"loading_error\").then(msg => {\n PDFViewerApplication._documentError(msg, reason);\n });\n }\n}\n\nfunction webViewerPageRender({ pageNumber }) {\n // If the page is (the most) visible when it starts rendering,\n // ensure that the page number input loading indicator is displayed.\n if (pageNumber === PDFViewerApplication.page) {\n PDFViewerApplication.toolbar?.updateLoadingIndicatorState(true);\n }\n}\n\nfunction webViewerPageRendered({ pageNumber, error }) {\n // If the page is still visible when it has finished rendering,\n // ensure that the page number input loading indicator is hidden.\n if (pageNumber === PDFViewerApplication.page) {\n PDFViewerApplication.toolbar?.updateLoadingIndicatorState(false);\n }\n\n // Use the rendered page to set the corresponding thumbnail image.\n if (PDFViewerApplication.pdfSidebar?.visibleView === SidebarView.THUMBS) {\n const pageView = PDFViewerApplication.pdfViewer.getPageView(\n /* index = */ pageNumber - 1\n );\n const thumbnailView = PDFViewerApplication.pdfThumbnailViewer?.getThumbnail(\n /* index = */ pageNumber - 1\n );\n if (pageView && thumbnailView) {\n thumbnailView.setImage(pageView);\n }\n }\n\n if (error) {\n PDFViewerApplication.l10n.get(\"rendering_error\").then(msg => {\n PDFViewerApplication._otherError(msg, error);\n });\n }\n}\n\nfunction webViewerPageMode({ mode }) {\n // Handle the 'pagemode' hash parameter, see also `PDFLinkService_setHash`.\n let view;\n switch (mode) {\n case \"thumbs\":\n view = SidebarView.THUMBS;\n break;\n case \"bookmarks\":\n case \"outline\": // non-standard\n view = SidebarView.OUTLINE;\n break;\n case \"attachments\": // non-standard\n view = SidebarView.ATTACHMENTS;\n break;\n case \"layers\": // non-standard\n view = SidebarView.LAYERS;\n break;\n case \"none\":\n view = SidebarView.NONE;\n break;\n default:\n console.error('Invalid \"pagemode\" hash parameter: ' + mode);\n return;\n }\n PDFViewerApplication.pdfSidebar?.switchView(view, /* forceOpen = */ true);\n}\n\nfunction webViewerNamedAction(evt) {\n // Processing a couple of named actions that might be useful, see also\n // `PDFLinkService.executeNamedAction`.\n switch (evt.action) {\n case \"GoToPage\":\n PDFViewerApplication.appConfig.toolbar?.pageNumber.select();\n break;\n\n case \"Find\":\n if (!PDFViewerApplication.supportsIntegratedFind) {\n PDFViewerApplication?.findBar.toggle();\n }\n break;\n\n case \"Print\":\n PDFViewerApplication.triggerPrinting();\n break;\n\n case \"SaveAs\":\n PDFViewerApplication.downloadOrSave();\n break;\n }\n}\n\nfunction webViewerPresentationModeChanged(evt) {\n PDFViewerApplication.pdfViewer.presentationModeState = evt.state;\n}\n\nfunction webViewerSidebarViewChanged({ view }) {\n PDFViewerApplication.pdfRenderingQueue.isThumbnailViewEnabled =\n view === SidebarView.THUMBS;\n\n if (PDFViewerApplication.isInitialViewSet) {\n // Only update the storage when the document has been loaded *and* rendered.\n PDFViewerApplication.store?.set(\"sidebarView\", view).catch(() => {\n // Unable to write to storage.\n });\n }\n}\n\nfunction webViewerUpdateViewarea({ location }) {\n if (PDFViewerApplication.isInitialViewSet) {\n // Only update the storage when the document has been loaded *and* rendered.\n PDFViewerApplication.store\n ?.setMultiple({\n page: location.pageNumber,\n zoom: location.scale,\n scrollLeft: location.left,\n scrollTop: location.top,\n rotation: location.rotation,\n })\n .catch(() => {\n // Unable to write to storage.\n });\n }\n if (PDFViewerApplication.appConfig.secondaryToolbar) {\n const href = PDFViewerApplication.pdfLinkService.getAnchorUrl(\n location.pdfOpenParams\n );\n PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href =\n href;\n }\n}\n\nfunction webViewerScrollModeChanged(evt) {\n if (\n PDFViewerApplication.isInitialViewSet &&\n !PDFViewerApplication.pdfViewer.isInPresentationMode\n ) {\n // Only update the storage when the document has been loaded *and* rendered.\n PDFViewerApplication.store?.set(\"scrollMode\", evt.mode).catch(() => {\n // Unable to write to storage.\n });\n }\n}\n\nfunction webViewerSpreadModeChanged(evt) {\n if (\n PDFViewerApplication.isInitialViewSet &&\n !PDFViewerApplication.pdfViewer.isInPresentationMode\n ) {\n // Only update the storage when the document has been loaded *and* rendered.\n PDFViewerApplication.store?.set(\"spreadMode\", evt.mode).catch(() => {\n // Unable to write to storage.\n });\n }\n}\n\nfunction webViewerResize() {\n const { pdfDocument, pdfViewer, pdfRenderingQueue } = PDFViewerApplication;\n\n if (pdfRenderingQueue.printing && window.matchMedia(\"print\").matches) {\n // Work-around issue 15324 by ignoring \"resize\" events during printing.\n return;\n }\n\n if (!pdfDocument) {\n return;\n }\n const currentScaleValue = pdfViewer.currentScaleValue;\n if (\n currentScaleValue === \"auto\" ||\n currentScaleValue === \"page-fit\" ||\n currentScaleValue === \"page-width\"\n ) {\n // Note: the scale is constant for 'page-actual'.\n pdfViewer.currentScaleValue = currentScaleValue;\n }\n pdfViewer.update();\n}\n\nfunction webViewerHashchange(evt) {\n const hash = evt.hash;\n if (!hash) {\n return;\n }\n if (!PDFViewerApplication.isInitialViewSet) {\n PDFViewerApplication.initialBookmark = hash;\n } else if (!PDFViewerApplication.pdfHistory?.popStateInProgress) {\n PDFViewerApplication.pdfLinkService.setHash(hash);\n }\n}\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n // eslint-disable-next-line no-var\n var webViewerFileInputChange = function (evt) {\n if (PDFViewerApplication.pdfViewer?.isInPresentationMode) {\n return; // Opening a new PDF file isn't supported in Presentation Mode.\n }\n const file = evt.fileInput.files[0];\n\n PDFViewerApplication.open({\n url: URL.createObjectURL(file),\n originalUrl: file.name,\n });\n };\n\n // eslint-disable-next-line no-var\n var webViewerOpenFile = function (evt) {\n const fileInput = PDFViewerApplication.appConfig.openFileInput;\n fileInput.click();\n };\n}\n\nfunction webViewerPresentationMode() {\n PDFViewerApplication.requestPresentationMode();\n}\nfunction webViewerSwitchAnnotationEditorMode(evt) {\n PDFViewerApplication.pdfViewer.annotationEditorMode = evt.mode;\n}\nfunction webViewerSwitchAnnotationEditorParams(evt) {\n PDFViewerApplication.pdfViewer.annotationEditorParams = evt;\n}\nfunction webViewerPrint() {\n PDFViewerApplication.triggerPrinting();\n}\nfunction webViewerDownload() {\n PDFViewerApplication.downloadOrSave();\n}\nfunction webViewerFirstPage() {\n PDFViewerApplication.page = 1;\n}\nfunction webViewerLastPage() {\n PDFViewerApplication.page = PDFViewerApplication.pagesCount;\n}\nfunction webViewerNextPage() {\n PDFViewerApplication.pdfViewer.nextPage();\n}\nfunction webViewerPreviousPage() {\n PDFViewerApplication.pdfViewer.previousPage();\n}\nfunction webViewerZoomIn() {\n PDFViewerApplication.zoomIn();\n}\nfunction webViewerZoomOut() {\n PDFViewerApplication.zoomOut();\n}\nfunction webViewerZoomReset() {\n PDFViewerApplication.zoomReset();\n}\nfunction webViewerPageNumberChanged(evt) {\n const pdfViewer = PDFViewerApplication.pdfViewer;\n // Note that for `<input type=\"number\">` HTML elements, an empty string will\n // be returned for non-number inputs; hence we simply do nothing in that case.\n if (evt.value !== \"\") {\n PDFViewerApplication.pdfLinkService.goToPage(evt.value);\n }\n\n // Ensure that the page number input displays the correct value, even if the\n // value entered by the user was invalid (e.g. a floating point number).\n if (\n evt.value !== pdfViewer.currentPageNumber.toString() &&\n evt.value !== pdfViewer.currentPageLabel\n ) {\n PDFViewerApplication.toolbar?.setPageNumber(\n pdfViewer.currentPageNumber,\n pdfViewer.currentPageLabel\n );\n }\n}\nfunction webViewerScaleChanged(evt) {\n PDFViewerApplication.pdfViewer.currentScaleValue = evt.value;\n}\nfunction webViewerRotateCw() {\n PDFViewerApplication.rotatePages(90);\n}\nfunction webViewerRotateCcw() {\n PDFViewerApplication.rotatePages(-90);\n}\nfunction webViewerOptionalContentConfig(evt) {\n PDFViewerApplication.pdfViewer.optionalContentConfigPromise = evt.promise;\n}\nfunction webViewerSwitchScrollMode(evt) {\n PDFViewerApplication.pdfViewer.scrollMode = evt.mode;\n}\nfunction webViewerSwitchSpreadMode(evt) {\n PDFViewerApplication.pdfViewer.spreadMode = evt.mode;\n}\nfunction webViewerDocumentProperties() {\n PDFViewerApplication.pdfDocumentProperties?.open();\n}\n\nfunction webViewerFindFromUrlHash(evt) {\n PDFViewerApplication.eventBus.dispatch(\"find\", {\n source: evt.source,\n type: \"\",\n query: evt.query,\n phraseSearch: evt.phraseSearch,\n caseSensitive: false,\n entireWord: false,\n highlightAll: true,\n findPrevious: false,\n matchDiacritics: true,\n });\n}\n\nfunction webViewerUpdateFindMatchesCount({ matchesCount }) {\n if (PDFViewerApplication.supportsIntegratedFind) {\n PDFViewerApplication.externalServices.updateFindMatchesCount(matchesCount);\n } else {\n PDFViewerApplication.findBar.updateResultsCount(matchesCount);\n }\n}\n\nfunction webViewerUpdateFindControlState({\n state,\n previous,\n matchesCount,\n rawQuery,\n}) {\n if (PDFViewerApplication.supportsIntegratedFind) {\n PDFViewerApplication.externalServices.updateFindControlState({\n result: state,\n findPrevious: previous,\n matchesCount,\n rawQuery,\n });\n } else {\n PDFViewerApplication.findBar?.updateUIState(state, previous, matchesCount);\n }\n}\n\nfunction webViewerScaleChanging(evt) {\n PDFViewerApplication.toolbar?.setPageScale(evt.presetValue, evt.scale);\n\n PDFViewerApplication.pdfViewer.update();\n}\n\nfunction webViewerRotationChanging(evt) {\n if (PDFViewerApplication.pdfThumbnailViewer) {\n PDFViewerApplication.pdfThumbnailViewer.pagesRotation = evt.pagesRotation;\n }\n\n PDFViewerApplication.forceRendering();\n // Ensure that the active page doesn't change during rotation.\n PDFViewerApplication.pdfViewer.currentPageNumber = evt.pageNumber;\n}\n\nfunction webViewerPageChanging({ pageNumber, pageLabel }) {\n PDFViewerApplication.toolbar?.setPageNumber(pageNumber, pageLabel);\n PDFViewerApplication.secondaryToolbar?.setPageNumber(pageNumber);\n\n if (PDFViewerApplication.pdfSidebar?.visibleView === SidebarView.THUMBS) {\n PDFViewerApplication.pdfThumbnailViewer?.scrollThumbnailIntoView(\n pageNumber\n );\n }\n\n // Show/hide the loading indicator in the page number input element.\n const currentPage = PDFViewerApplication.pdfViewer.getPageView(\n /* index = */ pageNumber - 1\n );\n PDFViewerApplication.toolbar?.updateLoadingIndicatorState(\n currentPage?.renderingState === RenderingStates.RUNNING\n );\n}\n\nfunction webViewerResolutionChange(evt) {\n PDFViewerApplication.pdfViewer.refresh();\n}\n\nfunction webViewerVisibilityChange(evt) {\n if (document.visibilityState === \"visible\") {\n // Ignore mouse wheel zooming during tab switches (bug 1503412).\n setZoomDisabledTimeout();\n }\n}\n\nlet zoomDisabledTimeout = null;\nfunction setZoomDisabledTimeout() {\n if (zoomDisabledTimeout) {\n clearTimeout(zoomDisabledTimeout);\n }\n zoomDisabledTimeout = setTimeout(function () {\n zoomDisabledTimeout = null;\n }, WHEEL_ZOOM_DISABLED_TIMEOUT);\n}\n\nfunction webViewerWheel(evt) {\n const {\n pdfViewer,\n supportedMouseWheelZoomModifierKeys,\n supportsPinchToZoom,\n } = PDFViewerApplication;\n\n if (pdfViewer.isInPresentationMode) {\n return;\n }\n\n // Pinch-to-zoom on a trackpad maps to a wheel event with ctrlKey set to true\n // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent#browser_compatibility\n // Hence if ctrlKey is true but ctrl key hasn't been pressed then we can\n // infer that we have a pinch-to-zoom.\n // But the ctrlKey could have been pressed outside of the browser window,\n // hence we try to do some magic to guess if the scaleFactor is likely coming\n // from a pinch-to-zoom or not.\n\n // It is important that we query deltaMode before delta{X,Y}, so that\n // Firefox doesn't switch to DOM_DELTA_PIXEL mode for compat with other\n // browsers, see https://bugzilla.mozilla.org/show_bug.cgi?id=1392460.\n const deltaMode = evt.deltaMode;\n\n // The following formula is a bit strange but it comes from:\n // https://searchfox.org/mozilla-central/rev/d62c4c4d5547064487006a1506287da394b64724/widget/InputData.cpp#618-626\n let scaleFactor = Math.exp(-evt.deltaY / 100);\n\n const isBuiltInMac =\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"MOZCENTRAL\") &&\n FeatureTest.platform.isMac;\n const isPinchToZoom =\n evt.ctrlKey &&\n !PDFViewerApplication._isCtrlKeyDown &&\n deltaMode === WheelEvent.DOM_DELTA_PIXEL &&\n evt.deltaX === 0 &&\n (Math.abs(scaleFactor - 1) < 0.05 || isBuiltInMac) &&\n evt.deltaZ === 0;\n\n if (\n isPinchToZoom ||\n (evt.ctrlKey && supportedMouseWheelZoomModifierKeys.ctrlKey) ||\n (evt.metaKey && supportedMouseWheelZoomModifierKeys.metaKey)\n ) {\n // Only zoom the pages, not the entire viewer.\n evt.preventDefault();\n // NOTE: this check must be placed *after* preventDefault.\n if (zoomDisabledTimeout || document.visibilityState === \"hidden\") {\n return;\n }\n\n const previousScale = pdfViewer.currentScale;\n if (isPinchToZoom && supportsPinchToZoom) {\n scaleFactor = PDFViewerApplication._accumulateFactor(\n previousScale,\n scaleFactor,\n \"_wheelUnusedFactor\"\n );\n if (scaleFactor < 1) {\n PDFViewerApplication.zoomOut(null, scaleFactor);\n } else if (scaleFactor > 1) {\n PDFViewerApplication.zoomIn(null, scaleFactor);\n } else {\n return;\n }\n } else {\n const delta = normalizeWheelEventDirection(evt);\n\n let ticks = 0;\n if (\n deltaMode === WheelEvent.DOM_DELTA_LINE ||\n deltaMode === WheelEvent.DOM_DELTA_PAGE\n ) {\n // For line-based devices, use one tick per event, because different\n // OSs have different defaults for the number lines. But we generally\n // want one \"clicky\" roll of the wheel (which produces one event) to\n // adjust the zoom by one step.\n if (Math.abs(delta) >= 1) {\n ticks = Math.sign(delta);\n } else {\n // If we're getting fractional lines (I can't think of a scenario\n // this might actually happen), be safe and use the accumulator.\n ticks = PDFViewerApplication._accumulateTicks(\n delta,\n \"_wheelUnusedTicks\"\n );\n }\n } else {\n // pixel-based devices\n const PIXELS_PER_LINE_SCALE = 30;\n ticks = PDFViewerApplication._accumulateTicks(\n delta / PIXELS_PER_LINE_SCALE,\n \"_wheelUnusedTicks\"\n );\n }\n\n if (ticks < 0) {\n PDFViewerApplication.zoomOut(-ticks);\n } else if (ticks > 0) {\n PDFViewerApplication.zoomIn(ticks);\n } else {\n return;\n }\n }\n\n // After scaling the page via zoomIn/zoomOut, the position of the upper-\n // left corner is restored. When the mouse wheel is used, the position\n // under the cursor should be restored instead.\n PDFViewerApplication._centerAtPos(previousScale, evt.clientX, evt.clientY);\n } else {\n setZoomDisabledTimeout();\n }\n}\n\nfunction webViewerTouchStart(evt) {\n if (\n PDFViewerApplication.pdfViewer.isInPresentationMode ||\n evt.touches.length < 2\n ) {\n return;\n }\n evt.preventDefault();\n\n if (evt.touches.length !== 2) {\n PDFViewerApplication._touchInfo = null;\n return;\n }\n\n let [touch0, touch1] = evt.touches;\n if (touch0.identifier > touch1.identifier) {\n [touch0, touch1] = [touch1, touch0];\n }\n PDFViewerApplication._touchInfo = {\n touch0X: touch0.pageX,\n touch0Y: touch0.pageY,\n touch1X: touch1.pageX,\n touch1Y: touch1.pageY,\n };\n}\n\nfunction webViewerTouchMove(evt) {\n if (!PDFViewerApplication._touchInfo || evt.touches.length !== 2) {\n return;\n }\n\n const { pdfViewer, _touchInfo, supportsPinchToZoom } = PDFViewerApplication;\n let [touch0, touch1] = evt.touches;\n if (touch0.identifier > touch1.identifier) {\n [touch0, touch1] = [touch1, touch0];\n }\n const { pageX: page0X, pageY: page0Y } = touch0;\n const { pageX: page1X, pageY: page1Y } = touch1;\n const {\n touch0X: pTouch0X,\n touch0Y: pTouch0Y,\n touch1X: pTouch1X,\n touch1Y: pTouch1Y,\n } = _touchInfo;\n\n if (\n Math.abs(pTouch0X - page0X) <= 1 &&\n Math.abs(pTouch0Y - page0Y) <= 1 &&\n Math.abs(pTouch1X - page1X) <= 1 &&\n Math.abs(pTouch1Y - page1Y) <= 1\n ) {\n // Touches are really too close and it's hard do some basic\n // geometry in order to guess something.\n return;\n }\n\n _touchInfo.touch0X = page0X;\n _touchInfo.touch0Y = page0Y;\n _touchInfo.touch1X = page1X;\n _touchInfo.touch1Y = page1Y;\n\n if (pTouch0X === page0X && pTouch0Y === page0Y) {\n // First touch is fixed, if the vectors are collinear then we've a pinch.\n const v1X = pTouch1X - page0X;\n const v1Y = pTouch1Y - page0Y;\n const v2X = page1X - page0X;\n const v2Y = page1Y - page0Y;\n const det = v1X * v2Y - v1Y * v2X;\n // 0.02 is approximatively sin(0.15deg).\n if (Math.abs(det) > 0.02 * Math.hypot(v1X, v1Y) * Math.hypot(v2X, v2Y)) {\n return;\n }\n } else if (pTouch1X === page1X && pTouch1Y === page1Y) {\n // Second touch is fixed, if the vectors are collinear then we've a pinch.\n const v1X = pTouch0X - page1X;\n const v1Y = pTouch0Y - page1Y;\n const v2X = page0X - page1X;\n const v2Y = page0Y - page1Y;\n const det = v1X * v2Y - v1Y * v2X;\n if (Math.abs(det) > 0.02 * Math.hypot(v1X, v1Y) * Math.hypot(v2X, v2Y)) {\n return;\n }\n } else {\n const diff0X = page0X - pTouch0X;\n const diff1X = page1X - pTouch1X;\n const diff0Y = page0Y - pTouch0Y;\n const diff1Y = page1Y - pTouch1Y;\n const dotProduct = diff0X * diff1X + diff0Y * diff1Y;\n if (dotProduct >= 0) {\n // The two touches go in almost the same direction.\n return;\n }\n }\n\n evt.preventDefault();\n\n const distance = Math.hypot(page0X - page1X, page0Y - page1Y) || 1;\n const pDistance = Math.hypot(pTouch0X - pTouch1X, pTouch0Y - pTouch1Y) || 1;\n const previousScale = pdfViewer.currentScale;\n if (supportsPinchToZoom) {\n const newScaleFactor = PDFViewerApplication._accumulateFactor(\n previousScale,\n distance / pDistance,\n \"_touchUnusedFactor\"\n );\n if (newScaleFactor < 1) {\n PDFViewerApplication.zoomOut(null, newScaleFactor);\n } else if (newScaleFactor > 1) {\n PDFViewerApplication.zoomIn(null, newScaleFactor);\n } else {\n return;\n }\n } else {\n const PIXELS_PER_LINE_SCALE = 30;\n const ticks = PDFViewerApplication._accumulateTicks(\n (distance - pDistance) / PIXELS_PER_LINE_SCALE,\n \"_touchUnusedTicks\"\n );\n if (ticks < 0) {\n PDFViewerApplication.zoomOut(-ticks);\n } else if (ticks > 0) {\n PDFViewerApplication.zoomIn(ticks);\n } else {\n return;\n }\n }\n\n PDFViewerApplication._centerAtPos(\n previousScale,\n (page0X + page1X) / 2,\n (page0Y + page1Y) / 2\n );\n}\n\nfunction webViewerTouchEnd(evt) {\n if (!PDFViewerApplication._touchInfo) {\n return;\n }\n\n evt.preventDefault();\n PDFViewerApplication._touchInfo = null;\n PDFViewerApplication._touchUnusedTicks = 0;\n PDFViewerApplication._touchUnusedFactor = 1;\n}\n\nfunction webViewerClick(evt) {\n if (!PDFViewerApplication.secondaryToolbar?.isOpen) {\n return;\n }\n const appConfig = PDFViewerApplication.appConfig;\n if (\n PDFViewerApplication.pdfViewer.containsElement(evt.target) ||\n (appConfig.toolbar?.container.contains(evt.target) &&\n evt.target !== appConfig.secondaryToolbar?.toggleButton)\n ) {\n PDFViewerApplication.secondaryToolbar.close();\n }\n}\n\nfunction webViewerKeyUp(evt) {\n // evt.ctrlKey is false hence we use evt.key.\n if (evt.key === \"Control\") {\n PDFViewerApplication._isCtrlKeyDown = false;\n }\n}\n\nfunction webViewerKeyDown(evt) {\n PDFViewerApplication._isCtrlKeyDown = evt.key === \"Control\";\n\n if (PDFViewerApplication.overlayManager.active) {\n return;\n }\n const { eventBus, pdfViewer } = PDFViewerApplication;\n const isViewerInPresentationMode = pdfViewer.isInPresentationMode;\n\n let handled = false,\n ensureViewerFocused = false;\n const cmd =\n (evt.ctrlKey ? 1 : 0) |\n (evt.altKey ? 2 : 0) |\n (evt.shiftKey ? 4 : 0) |\n (evt.metaKey ? 8 : 0);\n\n // First, handle the key bindings that are independent whether an input\n // control is selected or not.\n if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) {\n // either CTRL or META key with optional SHIFT.\n switch (evt.keyCode) {\n case 70: // f\n if (!PDFViewerApplication.supportsIntegratedFind && !evt.shiftKey) {\n PDFViewerApplication.findBar?.open();\n handled = true;\n }\n break;\n case 71: // g\n if (!PDFViewerApplication.supportsIntegratedFind) {\n const { state } = PDFViewerApplication.findController;\n if (state) {\n const newState = {\n source: window,\n type: \"again\",\n findPrevious: cmd === 5 || cmd === 12,\n };\n eventBus.dispatch(\"find\", { ...state, ...newState });\n }\n handled = true;\n }\n break;\n case 61: // FF/Mac '='\n case 107: // FF '+' and '='\n case 187: // Chrome '+'\n case 171: // FF with German keyboard\n PDFViewerApplication.zoomIn();\n handled = true;\n break;\n case 173: // FF/Mac '-'\n case 109: // FF '-'\n case 189: // Chrome '-'\n PDFViewerApplication.zoomOut();\n handled = true;\n break;\n case 48: // '0'\n case 96: // '0' on Numpad of Swedish keyboard\n if (!isViewerInPresentationMode) {\n // keeping it unhandled (to restore page zoom to 100%)\n setTimeout(function () {\n // ... and resetting the scale after browser adjusts its scale\n PDFViewerApplication.zoomReset();\n });\n handled = false;\n }\n break;\n\n case 38: // up arrow\n if (isViewerInPresentationMode || PDFViewerApplication.page > 1) {\n PDFViewerApplication.page = 1;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n case 40: // down arrow\n if (\n isViewerInPresentationMode ||\n PDFViewerApplication.page < PDFViewerApplication.pagesCount\n ) {\n PDFViewerApplication.page = PDFViewerApplication.pagesCount;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n }\n }\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC || CHROME\")) {\n // CTRL or META without shift\n if (cmd === 1 || cmd === 8) {\n switch (evt.keyCode) {\n case 83: // s\n eventBus.dispatch(\"download\", { source: window });\n handled = true;\n break;\n\n case 79: // o\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n eventBus.dispatch(\"openfile\", { source: window });\n handled = true;\n }\n break;\n }\n }\n }\n\n // CTRL+ALT or Option+Command\n if (cmd === 3 || cmd === 10) {\n switch (evt.keyCode) {\n case 80: // p\n PDFViewerApplication.requestPresentationMode();\n handled = true;\n PDFViewerApplication.externalServices.reportTelemetry({\n type: \"buttons\",\n data: { id: \"presentationModeKeyboard\" },\n });\n break;\n case 71: // g\n // focuses input#pageNumber field\n if (PDFViewerApplication.appConfig.toolbar) {\n PDFViewerApplication.appConfig.toolbar.pageNumber.select();\n handled = true;\n }\n break;\n }\n }\n\n if (handled) {\n if (ensureViewerFocused && !isViewerInPresentationMode) {\n pdfViewer.focus();\n }\n evt.preventDefault();\n return;\n }\n\n // Some shortcuts should not get handled if a control/input element\n // is selected.\n const curElement = getActiveOrFocusedElement();\n const curElementTagName = curElement?.tagName.toUpperCase();\n if (\n curElementTagName === \"INPUT\" ||\n curElementTagName === \"TEXTAREA\" ||\n curElementTagName === \"SELECT\" ||\n curElement?.isContentEditable\n ) {\n // Make sure that the secondary toolbar is closed when Escape is pressed.\n if (evt.keyCode !== /* Esc = */ 27) {\n return;\n }\n }\n\n // No control key pressed at all.\n if (cmd === 0) {\n let turnPage = 0,\n turnOnlyIfPageFit = false;\n switch (evt.keyCode) {\n case 38: // up arrow\n case 33: // pg up\n // vertical scrolling using arrow/pg keys\n if (pdfViewer.isVerticalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n turnPage = -1;\n break;\n case 8: // backspace\n if (!isViewerInPresentationMode) {\n turnOnlyIfPageFit = true;\n }\n turnPage = -1;\n break;\n case 37: // left arrow\n // horizontal scrolling using arrow keys\n if (pdfViewer.isHorizontalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n /* falls through */\n case 75: // 'k'\n case 80: // 'p'\n turnPage = -1;\n break;\n case 27: // esc key\n if (PDFViewerApplication.secondaryToolbar?.isOpen) {\n PDFViewerApplication.secondaryToolbar.close();\n handled = true;\n }\n if (\n !PDFViewerApplication.supportsIntegratedFind &&\n PDFViewerApplication.findBar?.opened\n ) {\n PDFViewerApplication.findBar.close();\n handled = true;\n }\n break;\n case 40: // down arrow\n case 34: // pg down\n // vertical scrolling using arrow/pg keys\n if (pdfViewer.isVerticalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n turnPage = 1;\n break;\n case 13: // enter key\n case 32: // spacebar\n if (!isViewerInPresentationMode) {\n turnOnlyIfPageFit = true;\n }\n turnPage = 1;\n break;\n case 39: // right arrow\n // horizontal scrolling using arrow keys\n if (pdfViewer.isHorizontalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n /* falls through */\n case 74: // 'j'\n case 78: // 'n'\n turnPage = 1;\n break;\n\n case 36: // home\n if (isViewerInPresentationMode || PDFViewerApplication.page > 1) {\n PDFViewerApplication.page = 1;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n case 35: // end\n if (\n isViewerInPresentationMode ||\n PDFViewerApplication.page < PDFViewerApplication.pagesCount\n ) {\n PDFViewerApplication.page = PDFViewerApplication.pagesCount;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n\n case 83: // 's'\n PDFViewerApplication.pdfCursorTools?.switchTool(CursorTool.SELECT);\n break;\n case 72: // 'h'\n PDFViewerApplication.pdfCursorTools?.switchTool(CursorTool.HAND);\n break;\n\n case 82: // 'r'\n PDFViewerApplication.rotatePages(90);\n break;\n\n case 115: // F4\n PDFViewerApplication.pdfSidebar?.toggle();\n break;\n }\n\n if (\n turnPage !== 0 &&\n (!turnOnlyIfPageFit || pdfViewer.currentScaleValue === \"page-fit\")\n ) {\n if (turnPage > 0) {\n pdfViewer.nextPage();\n } else {\n pdfViewer.previousPage();\n }\n handled = true;\n }\n }\n\n // shift-key\n if (cmd === 4) {\n switch (evt.keyCode) {\n case 13: // enter key\n case 32: // spacebar\n if (\n !isViewerInPresentationMode &&\n pdfViewer.currentScaleValue !== \"page-fit\"\n ) {\n break;\n }\n pdfViewer.previousPage();\n\n handled = true;\n break;\n\n case 82: // 'r'\n PDFViewerApplication.rotatePages(-90);\n break;\n }\n }\n\n if (!handled && !isViewerInPresentationMode) {\n // 33=Page Up 34=Page Down 35=End 36=Home\n // 37=Left 38=Up 39=Right 40=Down\n // 32=Spacebar\n if (\n (evt.keyCode >= 33 && evt.keyCode <= 40) ||\n (evt.keyCode === 32 && curElementTagName !== \"BUTTON\")\n ) {\n ensureViewerFocused = true;\n }\n }\n\n if (ensureViewerFocused && !pdfViewer.containsElement(curElement)) {\n // The page container is not focused, but a page navigation key has been\n // pressed. Change the focus to the viewer container to make sure that\n // navigation by keyboard works as expected.\n pdfViewer.focus();\n }\n\n if (handled) {\n evt.preventDefault();\n }\n}\n\nfunction beforeUnload(evt) {\n evt.preventDefault();\n evt.returnValue = \"\";\n return false;\n}\n\nfunction webViewerAnnotationEditorStatesChanged(data) {\n PDFViewerApplication.externalServices.updateEditorStates(data);\n}\n\n/* Abstract factory for the print service. */\nconst PDFPrintServiceFactory = {\n instance: {\n supportsPrinting: false,\n createPrintService() {\n throw new Error(\"Not implemented: createPrintService\");\n },\n },\n};\n\nexport {\n DefaultExternalServices,\n PDFPrintServiceFactory,\n PDFViewerApplication,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst DEFAULT_SCALE_VALUE = \"auto\";\nconst DEFAULT_SCALE = 1.0;\nconst DEFAULT_SCALE_DELTA = 1.1;\nconst MIN_SCALE = 0.1;\nconst MAX_SCALE = 10.0;\nconst UNKNOWN_SCALE = 0;\nconst MAX_AUTO_SCALE = 1.25;\nconst SCROLLBAR_PADDING = 40;\nconst VERTICAL_PADDING = 5;\n\nconst RenderingStates = {\n INITIAL: 0,\n RUNNING: 1,\n PAUSED: 2,\n FINISHED: 3,\n};\n\nconst PresentationModeState = {\n UNKNOWN: 0,\n NORMAL: 1,\n CHANGING: 2,\n FULLSCREEN: 3,\n};\n\nconst SidebarView = {\n UNKNOWN: -1,\n NONE: 0,\n THUMBS: 1, // Default value.\n OUTLINE: 2,\n ATTACHMENTS: 3,\n LAYERS: 4,\n};\n\nconst RendererType =\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n ? {\n CANVAS: \"canvas\",\n SVG: \"svg\",\n }\n : null;\n\nconst TextLayerMode = {\n DISABLE: 0,\n ENABLE: 1,\n};\n\nconst ScrollMode = {\n UNKNOWN: -1,\n VERTICAL: 0, // Default value.\n HORIZONTAL: 1,\n WRAPPED: 2,\n PAGE: 3,\n};\n\nconst SpreadMode = {\n UNKNOWN: -1,\n NONE: 0, // Default value.\n ODD: 1,\n EVEN: 2,\n};\n\nconst CursorTool = {\n SELECT: 0, // The default value.\n HAND: 1,\n ZOOM: 2,\n};\n\n// Used by `PDFViewerApplication`, and by the API unit-tests.\nconst AutoPrintRegExp = /\\bprint\\s*\\(/;\n\n/**\n * Scale factors for the canvas, necessary with HiDPI displays.\n */\nclass OutputScale {\n constructor() {\n const pixelRatio = window.devicePixelRatio || 1;\n\n /**\n * @type {number} Horizontal scale.\n */\n this.sx = pixelRatio;\n\n /**\n * @type {number} Vertical scale.\n */\n this.sy = pixelRatio;\n }\n\n /**\n * @type {boolean} Returns `true` when scaling is required, `false` otherwise.\n */\n get scaled() {\n return this.sx !== 1 || this.sy !== 1;\n }\n}\n\n/**\n * Scrolls specified element into view of its parent.\n * @param {Object} element - The element to be visible.\n * @param {Object} spot - An object with optional top and left properties,\n * specifying the offset from the top left edge.\n * @param {boolean} [scrollMatches] - When scrolling search results into view,\n * ignore elements that either: Contains marked content identifiers,\n * or have the CSS-rule `overflow: hidden;` set. The default value is `false`.\n */\nfunction scrollIntoView(element, spot, scrollMatches = false) {\n // Assuming offsetParent is available (it's not available when viewer is in\n // hidden iframe or object). We have to scroll: if the offsetParent is not set\n // producing the error. See also animationStarted.\n let parent = element.offsetParent;\n if (!parent) {\n console.error(\"offsetParent is not set -- cannot scroll\");\n return;\n }\n let offsetY = element.offsetTop + element.clientTop;\n let offsetX = element.offsetLeft + element.clientLeft;\n while (\n (parent.clientHeight === parent.scrollHeight &&\n parent.clientWidth === parent.scrollWidth) ||\n (scrollMatches &&\n (parent.classList.contains(\"markedContent\") ||\n getComputedStyle(parent).overflow === \"hidden\"))\n ) {\n offsetY += parent.offsetTop;\n offsetX += parent.offsetLeft;\n\n parent = parent.offsetParent;\n if (!parent) {\n return; // no need to scroll\n }\n }\n if (spot) {\n if (spot.top !== undefined) {\n offsetY += spot.top;\n }\n if (spot.left !== undefined) {\n offsetX += spot.left;\n parent.scrollLeft = offsetX;\n }\n }\n parent.scrollTop = offsetY;\n}\n\n/**\n * Helper function to start monitoring the scroll event and converting them into\n * PDF.js friendly one: with scroll debounce and scroll direction.\n */\nfunction watchScroll(viewAreaElement, callback) {\n const debounceScroll = function (evt) {\n if (rAF) {\n return;\n }\n // schedule an invocation of scroll for next animation frame.\n rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {\n rAF = null;\n\n const currentX = viewAreaElement.scrollLeft;\n const lastX = state.lastX;\n if (currentX !== lastX) {\n state.right = currentX > lastX;\n }\n state.lastX = currentX;\n const currentY = viewAreaElement.scrollTop;\n const lastY = state.lastY;\n if (currentY !== lastY) {\n state.down = currentY > lastY;\n }\n state.lastY = currentY;\n callback(state);\n });\n };\n\n const state = {\n right: true,\n down: true,\n lastX: viewAreaElement.scrollLeft,\n lastY: viewAreaElement.scrollTop,\n _eventHandler: debounceScroll,\n };\n\n let rAF = null;\n viewAreaElement.addEventListener(\"scroll\", debounceScroll, true);\n return state;\n}\n\n/**\n * Helper function to parse query string (e.g. ?param1=value¶m2=...).\n * @param {string}\n * @returns {Map}\n */\nfunction parseQueryString(query) {\n const params = new Map();\n for (const [key, value] of new URLSearchParams(query)) {\n params.set(key.toLowerCase(), value);\n }\n return params;\n}\n\nconst InvisibleCharactersRegExp = /[\\x01-\\x1F]/g;\n\n/**\n * @param {string} str\n * @param {boolean} [replaceInvisible]\n */\nfunction removeNullCharacters(str, replaceInvisible = false) {\n if (typeof str !== \"string\") {\n console.error(`The argument must be a string.`);\n return str;\n }\n if (replaceInvisible) {\n str = str.replaceAll(InvisibleCharactersRegExp, \" \");\n }\n return str.replaceAll(\"\\x00\", \"\");\n}\n\n/**\n * Use binary search to find the index of the first item in a given array which\n * passes a given condition. The items are expected to be sorted in the sense\n * that if the condition is true for one item in the array, then it is also true\n * for all following items.\n *\n * @returns {number} Index of the first array element to pass the test,\n * or |items.length| if no such element exists.\n */\nfunction binarySearchFirstItem(items, condition, start = 0) {\n let minIndex = start;\n let maxIndex = items.length - 1;\n\n if (maxIndex < 0 || !condition(items[maxIndex])) {\n return items.length;\n }\n if (condition(items[minIndex])) {\n return minIndex;\n }\n\n while (minIndex < maxIndex) {\n const currentIndex = (minIndex + maxIndex) >> 1;\n const currentItem = items[currentIndex];\n if (condition(currentItem)) {\n maxIndex = currentIndex;\n } else {\n minIndex = currentIndex + 1;\n }\n }\n return minIndex; /* === maxIndex */\n}\n\n/**\n * Approximates float number as a fraction using Farey sequence (max order\n * of 8).\n * @param {number} x - Positive float number.\n * @returns {Array} Estimated fraction: the first array item is a numerator,\n * the second one is a denominator.\n */\nfunction approximateFraction(x) {\n // Fast paths for int numbers or their inversions.\n if (Math.floor(x) === x) {\n return [x, 1];\n }\n const xinv = 1 / x;\n const limit = 8;\n if (xinv > limit) {\n return [1, limit];\n } else if (Math.floor(xinv) === xinv) {\n return [1, xinv];\n }\n\n const x_ = x > 1 ? xinv : x;\n // a/b and c/d are neighbours in Farey sequence.\n let a = 0,\n b = 1,\n c = 1,\n d = 1;\n // Limiting search to order 8.\n while (true) {\n // Generating next term in sequence (order of q).\n const p = a + c,\n q = b + d;\n if (q > limit) {\n break;\n }\n if (x_ <= p / q) {\n c = p;\n d = q;\n } else {\n a = p;\n b = q;\n }\n }\n let result;\n // Select closest of the neighbours to x.\n if (x_ - a / b < c / d - x_) {\n result = x_ === x ? [a, b] : [b, a];\n } else {\n result = x_ === x ? [c, d] : [d, c];\n }\n return result;\n}\n\nfunction roundToDivide(x, div) {\n const r = x % div;\n return r === 0 ? x : Math.round(x - r + div);\n}\n\n/**\n * @typedef {Object} GetPageSizeInchesParameters\n * @property {number[]} view\n * @property {number} userUnit\n * @property {number} rotate\n */\n\n/**\n * @typedef {Object} PageSize\n * @property {number} width - In inches.\n * @property {number} height - In inches.\n */\n\n/**\n * Gets the size of the specified page, converted from PDF units to inches.\n * @param {GetPageSizeInchesParameters} params\n * @returns {PageSize}\n */\nfunction getPageSizeInches({ view, userUnit, rotate }) {\n const [x1, y1, x2, y2] = view;\n // We need to take the page rotation into account as well.\n const changeOrientation = rotate % 180 !== 0;\n\n const width = ((x2 - x1) / 72) * userUnit;\n const height = ((y2 - y1) / 72) * userUnit;\n\n return {\n width: changeOrientation ? height : width,\n height: changeOrientation ? width : height,\n };\n}\n\n/**\n * Helper function for getVisibleElements.\n *\n * @param {number} index - initial guess at the first visible element\n * @param {Array} views - array of pages, into which `index` is an index\n * @param {number} top - the top of the scroll pane\n * @returns {number} less than or equal to `index` that is definitely at or\n * before the first visible element in `views`, but not by too much. (Usually,\n * this will be the first element in the first partially visible row in\n * `views`, although sometimes it goes back one row further.)\n */\nfunction backtrackBeforeAllVisibleElements(index, views, top) {\n // binarySearchFirstItem's assumption is that the input is ordered, with only\n // one index where the conditions flips from false to true: [false ...,\n // true...]. With vertical scrolling and spreads, it is possible to have\n // [false ..., true, false, true ...]. With wrapped scrolling we can have a\n // similar sequence, with many more mixed true and false in the middle.\n //\n // So there is no guarantee that the binary search yields the index of the\n // first visible element. It could have been any of the other visible elements\n // that were preceded by a hidden element.\n\n // Of course, if either this element or the previous (hidden) element is also\n // the first element, there's nothing to worry about.\n if (index < 2) {\n return index;\n }\n\n // That aside, the possible cases are represented below.\n //\n // **** = fully hidden\n // A*B* = mix of partially visible and/or hidden pages\n // CDEF = fully visible\n //\n // (1) Binary search could have returned A, in which case we can stop.\n // (2) Binary search could also have returned B, in which case we need to\n // check the whole row.\n // (3) Binary search could also have returned C, in which case we need to\n // check the whole previous row.\n //\n // There's one other possibility:\n //\n // **** = fully hidden\n // ABCD = mix of fully and/or partially visible pages\n //\n // (4) Binary search could only have returned A.\n\n // Initially assume that we need to find the beginning of the current row\n // (case 1, 2, or 4), which means finding a page that is above the current\n // page's top. If the found page is partially visible, we're definitely not in\n // case 3, and this assumption is correct.\n let elt = views[index].div;\n let pageTop = elt.offsetTop + elt.clientTop;\n\n if (pageTop >= top) {\n // The found page is fully visible, so we're actually either in case 3 or 4,\n // and unfortunately we can't tell the difference between them without\n // scanning the entire previous row, so we just conservatively assume that\n // we do need to backtrack to that row. In both cases, the previous page is\n // in the previous row, so use its top instead.\n elt = views[index - 1].div;\n pageTop = elt.offsetTop + elt.clientTop;\n }\n\n // Now we backtrack to the first page that still has its bottom below\n // `pageTop`, which is the top of a page in the first visible row (unless\n // we're in case 4, in which case it's the row before that).\n // `index` is found by binary search, so the page at `index - 1` is\n // invisible and we can start looking for potentially visible pages from\n // `index - 2`. (However, if this loop terminates on its first iteration,\n // which is the case when pages are stacked vertically, `index` should remain\n // unchanged, so we use a distinct loop variable.)\n for (let i = index - 2; i >= 0; --i) {\n elt = views[i].div;\n if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) {\n // We have reached the previous row, so stop now.\n // This loop is expected to terminate relatively quickly because the\n // number of pages per row is expected to be small.\n break;\n }\n index = i;\n }\n return index;\n}\n\n/**\n * @typedef {Object} GetVisibleElementsParameters\n * @property {HTMLElement} scrollEl - A container that can possibly scroll.\n * @property {Array} views - Objects with a `div` property that contains an\n * HTMLElement, which should all be descendants of `scrollEl` satisfying the\n * relevant layout assumptions.\n * @property {boolean} sortByVisibility - If `true`, the returned elements are\n * sorted in descending order of the percent of their padding box that is\n * visible. The default value is `false`.\n * @property {boolean} horizontal - If `true`, the elements are assumed to be\n * laid out horizontally instead of vertically. The default value is `false`.\n * @property {boolean} rtl - If `true`, the `scrollEl` container is assumed to\n * be in right-to-left mode. The default value is `false`.\n */\n\n/**\n * Generic helper to find out what elements are visible within a scroll pane.\n *\n * Well, pretty generic. There are some assumptions placed on the elements\n * referenced by `views`:\n * - If `horizontal`, no left of any earlier element is to the right of the\n * left of any later element.\n * - Otherwise, `views` can be split into contiguous rows where, within a row,\n * no top of any element is below the bottom of any other element, and\n * between rows, no bottom of any element in an earlier row is below the\n * top of any element in a later row.\n *\n * (Here, top, left, etc. all refer to the padding edge of the element in\n * question. For pages, that ends up being equivalent to the bounding box of the\n * rendering canvas. Earlier and later refer to index in `views`, not page\n * layout.)\n *\n * @param {GetVisibleElementsParameters}\n * @returns {Object} `{ first, last, views: [{ id, x, y, view, percent }] }`\n */\nfunction getVisibleElements({\n scrollEl,\n views,\n sortByVisibility = false,\n horizontal = false,\n rtl = false,\n}) {\n const top = scrollEl.scrollTop,\n bottom = top + scrollEl.clientHeight;\n const left = scrollEl.scrollLeft,\n right = left + scrollEl.clientWidth;\n\n // Throughout this \"generic\" function, comments will assume we're working with\n // PDF document pages, which is the most important and complex case. In this\n // case, the visible elements we're actually interested is the page canvas,\n // which is contained in a wrapper which adds no padding/border/margin, which\n // is itself contained in `view.div` which adds no padding (but does add a\n // border). So, as specified in this function's doc comment, this function\n // does all of its work on the padding edge of the provided views, starting at\n // offsetLeft/Top (which includes margin) and adding clientLeft/Top (which is\n // the border). Adding clientWidth/Height gets us the bottom-right corner of\n // the padding edge.\n function isElementBottomAfterViewTop(view) {\n const element = view.div;\n const elementBottom =\n element.offsetTop + element.clientTop + element.clientHeight;\n return elementBottom > top;\n }\n function isElementNextAfterViewHorizontally(view) {\n const element = view.div;\n const elementLeft = element.offsetLeft + element.clientLeft;\n const elementRight = elementLeft + element.clientWidth;\n return rtl ? elementLeft < right : elementRight > left;\n }\n\n const visible = [],\n ids = new Set(),\n numViews = views.length;\n let firstVisibleElementInd = binarySearchFirstItem(\n views,\n horizontal\n ? isElementNextAfterViewHorizontally\n : isElementBottomAfterViewTop\n );\n\n // Please note the return value of the `binarySearchFirstItem` function when\n // no valid element is found (hence the `firstVisibleElementInd` check below).\n if (\n firstVisibleElementInd > 0 &&\n firstVisibleElementInd < numViews &&\n !horizontal\n ) {\n // In wrapped scrolling (or vertical scrolling with spreads), with some page\n // sizes, isElementBottomAfterViewTop doesn't satisfy the binary search\n // condition: there can be pages with bottoms above the view top between\n // pages with bottoms below. This function detects and corrects that error;\n // see it for more comments.\n firstVisibleElementInd = backtrackBeforeAllVisibleElements(\n firstVisibleElementInd,\n views,\n top\n );\n }\n\n // lastEdge acts as a cutoff for us to stop looping, because we know all\n // subsequent pages will be hidden.\n //\n // When using wrapped scrolling or vertical scrolling with spreads, we can't\n // simply stop the first time we reach a page below the bottom of the view;\n // the tops of subsequent pages on the same row could still be visible. In\n // horizontal scrolling, we don't have that issue, so we can stop as soon as\n // we pass `right`, without needing the code below that handles the -1 case.\n let lastEdge = horizontal ? right : -1;\n\n for (let i = firstVisibleElementInd; i < numViews; i++) {\n const view = views[i],\n element = view.div;\n const currentWidth = element.offsetLeft + element.clientLeft;\n const currentHeight = element.offsetTop + element.clientTop;\n const viewWidth = element.clientWidth,\n viewHeight = element.clientHeight;\n const viewRight = currentWidth + viewWidth;\n const viewBottom = currentHeight + viewHeight;\n\n if (lastEdge === -1) {\n // As commented above, this is only needed in non-horizontal cases.\n // Setting lastEdge to the bottom of the first page that is partially\n // visible ensures that the next page fully below lastEdge is on the\n // next row, which has to be fully hidden along with all subsequent rows.\n if (viewBottom >= bottom) {\n lastEdge = viewBottom;\n }\n } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) {\n break;\n }\n\n if (\n viewBottom <= top ||\n currentHeight >= bottom ||\n viewRight <= left ||\n currentWidth >= right\n ) {\n continue;\n }\n\n const hiddenHeight =\n Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom);\n const hiddenWidth =\n Math.max(0, left - currentWidth) + Math.max(0, viewRight - right);\n\n const fractionHeight = (viewHeight - hiddenHeight) / viewHeight,\n fractionWidth = (viewWidth - hiddenWidth) / viewWidth;\n const percent = (fractionHeight * fractionWidth * 100) | 0;\n\n visible.push({\n id: view.id,\n x: currentWidth,\n y: currentHeight,\n view,\n percent,\n widthPercent: (fractionWidth * 100) | 0,\n });\n ids.add(view.id);\n }\n\n const first = visible[0],\n last = visible.at(-1);\n\n if (sortByVisibility) {\n visible.sort(function (a, b) {\n const pc = a.percent - b.percent;\n if (Math.abs(pc) > 0.001) {\n return -pc;\n }\n return a.id - b.id; // ensure stability\n });\n }\n return { first, last, views: visible, ids };\n}\n\n/**\n * Event handler to suppress context menu.\n */\nfunction noContextMenuHandler(evt) {\n evt.preventDefault();\n}\n\nfunction normalizeWheelEventDirection(evt) {\n let delta = Math.hypot(evt.deltaX, evt.deltaY);\n const angle = Math.atan2(evt.deltaY, evt.deltaX);\n if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {\n // All that is left-up oriented has to change the sign.\n delta = -delta;\n }\n return delta;\n}\n\nfunction normalizeWheelEventDelta(evt) {\n const deltaMode = evt.deltaMode; // Avoid being affected by bug 1392460.\n let delta = normalizeWheelEventDirection(evt);\n\n const MOUSE_PIXELS_PER_LINE = 30;\n const MOUSE_LINES_PER_PAGE = 30;\n\n // Converts delta to per-page units\n if (deltaMode === WheelEvent.DOM_DELTA_PIXEL) {\n delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;\n } else if (deltaMode === WheelEvent.DOM_DELTA_LINE) {\n delta /= MOUSE_LINES_PER_PAGE;\n }\n return delta;\n}\n\nfunction isValidRotation(angle) {\n return Number.isInteger(angle) && angle % 90 === 0;\n}\n\nfunction isValidScrollMode(mode) {\n return (\n Number.isInteger(mode) &&\n Object.values(ScrollMode).includes(mode) &&\n mode !== ScrollMode.UNKNOWN\n );\n}\n\nfunction isValidSpreadMode(mode) {\n return (\n Number.isInteger(mode) &&\n Object.values(SpreadMode).includes(mode) &&\n mode !== SpreadMode.UNKNOWN\n );\n}\n\nfunction isPortraitOrientation(size) {\n return size.width <= size.height;\n}\n\n/**\n * Promise that is resolved when DOM window becomes visible.\n */\nconst animationStarted = new Promise(function (resolve) {\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"LIB\") &&\n typeof window === \"undefined\"\n ) {\n // Prevent \"ReferenceError: window is not defined\" errors when running the\n // unit-tests in Node.js environments.\n setTimeout(resolve, 20);\n return;\n }\n window.requestAnimationFrame(resolve);\n});\n\nconst docStyle =\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"LIB\") &&\n typeof document === \"undefined\"\n ? null\n : document.documentElement.style;\n\nfunction clamp(v, min, max) {\n return Math.min(Math.max(v, min), max);\n}\n\nclass ProgressBar {\n #classList = null;\n\n #disableAutoFetchTimeout = null;\n\n #percent = 0;\n\n #style = null;\n\n #visible = true;\n\n constructor(bar) {\n this.#classList = bar.classList;\n this.#style = bar.style;\n }\n\n get percent() {\n return this.#percent;\n }\n\n set percent(val) {\n this.#percent = clamp(val, 0, 100);\n\n if (isNaN(val)) {\n this.#classList.add(\"indeterminate\");\n return;\n }\n this.#classList.remove(\"indeterminate\");\n\n this.#style.setProperty(\"--progressBar-percent\", `${this.#percent}%`);\n }\n\n setWidth(viewer) {\n if (!viewer) {\n return;\n }\n const container = viewer.parentNode;\n const scrollbarWidth = container.offsetWidth - viewer.offsetWidth;\n if (scrollbarWidth > 0) {\n this.#style.setProperty(\n \"--progressBar-end-offset\",\n `${scrollbarWidth}px`\n );\n }\n }\n\n setDisableAutoFetch(delay = /* ms = */ 5000) {\n if (isNaN(this.#percent)) {\n return;\n }\n if (this.#disableAutoFetchTimeout) {\n clearTimeout(this.#disableAutoFetchTimeout);\n }\n this.show();\n\n this.#disableAutoFetchTimeout = setTimeout(() => {\n this.#disableAutoFetchTimeout = null;\n this.hide();\n }, delay);\n }\n\n hide() {\n if (!this.#visible) {\n return;\n }\n this.#visible = false;\n this.#classList.add(\"hidden\");\n }\n\n show() {\n if (this.#visible) {\n return;\n }\n this.#visible = true;\n this.#classList.remove(\"hidden\");\n }\n}\n\n/**\n * Get the active or focused element in current DOM.\n *\n * Recursively search for the truly active or focused element in case there are\n * shadow DOMs.\n *\n * @returns {Element} the truly active or focused element.\n */\nfunction getActiveOrFocusedElement() {\n let curRoot = document;\n let curActiveOrFocused =\n curRoot.activeElement || curRoot.querySelector(\":focus\");\n\n while (curActiveOrFocused?.shadowRoot) {\n curRoot = curActiveOrFocused.shadowRoot;\n curActiveOrFocused =\n curRoot.activeElement || curRoot.querySelector(\":focus\");\n }\n\n return curActiveOrFocused;\n}\n\n/**\n * Converts API PageLayout values to the format used by `BaseViewer`.\n * @param {string} mode - The API PageLayout value.\n * @returns {Object}\n */\nfunction apiPageLayoutToViewerModes(layout) {\n let scrollMode = ScrollMode.VERTICAL,\n spreadMode = SpreadMode.NONE;\n\n switch (layout) {\n case \"SinglePage\":\n scrollMode = ScrollMode.PAGE;\n break;\n case \"OneColumn\":\n break;\n case \"TwoPageLeft\":\n scrollMode = ScrollMode.PAGE;\n /* falls through */\n case \"TwoColumnLeft\":\n spreadMode = SpreadMode.ODD;\n break;\n case \"TwoPageRight\":\n scrollMode = ScrollMode.PAGE;\n /* falls through */\n case \"TwoColumnRight\":\n spreadMode = SpreadMode.EVEN;\n break;\n }\n return { scrollMode, spreadMode };\n}\n\n/**\n * Converts API PageMode values to the format used by `PDFSidebar`.\n * NOTE: There's also a \"FullScreen\" parameter which is not possible to support,\n * since the Fullscreen API used in browsers requires that entering\n * fullscreen mode only occurs as a result of a user-initiated event.\n * @param {string} mode - The API PageMode value.\n * @returns {number} A value from {SidebarView}.\n */\nfunction apiPageModeToSidebarView(mode) {\n switch (mode) {\n case \"UseNone\":\n return SidebarView.NONE;\n case \"UseThumbs\":\n return SidebarView.THUMBS;\n case \"UseOutlines\":\n return SidebarView.OUTLINE;\n case \"UseAttachments\":\n return SidebarView.ATTACHMENTS;\n case \"UseOC\":\n return SidebarView.LAYERS;\n }\n return SidebarView.NONE; // Default value.\n}\n\nexport {\n animationStarted,\n apiPageLayoutToViewerModes,\n apiPageModeToSidebarView,\n approximateFraction,\n AutoPrintRegExp,\n backtrackBeforeAllVisibleElements, // only exported for testing\n binarySearchFirstItem,\n CursorTool,\n DEFAULT_SCALE,\n DEFAULT_SCALE_DELTA,\n DEFAULT_SCALE_VALUE,\n docStyle,\n getActiveOrFocusedElement,\n getPageSizeInches,\n getVisibleElements,\n isPortraitOrientation,\n isValidRotation,\n isValidScrollMode,\n isValidSpreadMode,\n MAX_AUTO_SCALE,\n MAX_SCALE,\n MIN_SCALE,\n noContextMenuHandler,\n normalizeWheelEventDelta,\n normalizeWheelEventDirection,\n OutputScale,\n parseQueryString,\n PresentationModeState,\n ProgressBar,\n removeNullCharacters,\n RendererType,\n RenderingStates,\n roundToDivide,\n SCROLLBAR_PADDING,\n scrollIntoView,\n ScrollMode,\n SidebarView,\n SpreadMode,\n TextLayerMode,\n UNKNOWN_SCALE,\n VERTICAL_PADDING,\n watchScroll,\n};\n","/* Copyright 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* globals module, __non_webpack_require__ */\n\n\"use strict\";\n\nlet pdfjsLib;\nif (typeof window !== \"undefined\" && window[\"pdfjs-dist/build/pdf\"]) {\n pdfjsLib = window[\"pdfjs-dist/build/pdf\"];\n} else {\n pdfjsLib = __non_webpack_require__(\"../build/pdf.js\");\n}\nmodule.exports = pdfjsLib;\n","/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst compatibilityParams = Object.create(null);\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"LIB\") &&\n typeof navigator === \"undefined\"\n ) {\n globalThis.navigator = Object.create(null);\n }\n const userAgent = navigator.userAgent || \"\";\n const platform = navigator.platform || \"\";\n const maxTouchPoints = navigator.maxTouchPoints || 1;\n\n const isAndroid = /Android/.test(userAgent);\n const isIOS =\n /\\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) ||\n (platform === \"MacIntel\" && maxTouchPoints > 1);\n\n // Limit canvas size to 5 mega-pixels on mobile.\n // Support: Android, iOS\n (function checkCanvasSizeLimitation() {\n if (isIOS || isAndroid) {\n compatibilityParams.maxCanvasPixels = 5242880;\n }\n })();\n}\n\nconst OptionKind = {\n VIEWER: 0x02,\n API: 0x04,\n WORKER: 0x08,\n PREFERENCE: 0x80,\n};\n\n/**\n * NOTE: These options are used to generate the `default_preferences.json` file,\n * see `OptionKind.PREFERENCE`, hence the values below must use only\n * primitive types and cannot rely on any imported types.\n */\nconst defaultOptions = {\n annotationEditorMode: {\n /** @type {number} */\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n annotationMode: {\n /** @type {number} */\n value: 2,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n cursorToolOnLoad: {\n /** @type {number} */\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n defaultZoomDelay: {\n /** @type {number} */\n value: 400,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n defaultZoomValue: {\n /** @type {string} */\n value: \"\",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n disableHistory: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER,\n },\n disablePageLabels: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enablePermissions: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enablePrintAutoRotate: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableScripting: {\n /** @type {boolean} */\n value: typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"CHROME\"),\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n externalLinkRel: {\n /** @type {string} */\n value: \"noopener noreferrer nofollow\",\n kind: OptionKind.VIEWER,\n },\n externalLinkTarget: {\n /** @type {number} */\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n historyUpdateUrl: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n ignoreDestinationZoom: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n imageResourcesPath: {\n /** @type {string} */\n value:\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n ? \"resource://pdf.js/web/images/\"\n : \"./images/\",\n kind: OptionKind.VIEWER,\n },\n maxCanvasPixels: {\n /** @type {number} */\n value: 16777216,\n kind: OptionKind.VIEWER,\n },\n forcePageColors: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n pageColorsBackground: {\n /** @type {string} */\n value: \"Canvas\",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n pageColorsForeground: {\n /** @type {string} */\n value: \"CanvasText\",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n pdfBugEnabled: {\n /** @type {boolean} */\n value: typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\"),\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n printResolution: {\n /** @type {number} */\n value: 150,\n kind: OptionKind.VIEWER,\n },\n sidebarViewOnLoad: {\n /** @type {number} */\n value: -1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n scrollModeOnLoad: {\n /** @type {number} */\n value: -1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n spreadModeOnLoad: {\n /** @type {number} */\n value: -1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n textLayerMode: {\n /** @type {number} */\n value: 1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n useOnlyCssZoom: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n viewerCssTheme: {\n /** @type {number} */\n value: typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\") ? 2 : 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n viewOnLoad: {\n /** @type {boolean} */\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n\n cMapPacked: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.API,\n },\n cMapUrl: {\n /** @type {string} */\n value:\n typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n ? \"../external/bcmaps/\"\n : \"../web/cmaps/\",\n kind: OptionKind.API,\n },\n disableAutoFetch: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n disableFontFace: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n disableRange: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n disableStream: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n docBaseUrl: {\n /** @type {string} */\n value: \"\",\n kind: OptionKind.API,\n },\n enableXfa: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n fontExtraProperties: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API,\n },\n isEvalSupported: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.API,\n },\n isOffscreenCanvasSupported: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.API,\n },\n maxImageSize: {\n /** @type {number} */\n value: -1,\n kind: OptionKind.API,\n },\n pdfBug: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API,\n },\n standardFontDataUrl: {\n /** @type {string} */\n value:\n typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n ? \"../external/standard_fonts/\"\n : \"../web/standard_fonts/\",\n kind: OptionKind.API,\n },\n verbosity: {\n /** @type {number} */\n value: 1,\n kind: OptionKind.API,\n },\n\n workerPort: {\n /** @type {Object} */\n value: null,\n kind: OptionKind.WORKER,\n },\n workerSrc: {\n /** @type {string} */\n value:\n // eslint-disable-next-line no-nested-ternary\n typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n ? \"../src/worker_loader.js\"\n : PDFJSDev.test(\"MOZCENTRAL\")\n ? \"resource://pdf.js/build/pdf.worker.js\"\n : \"../build/pdf.worker.js\",\n kind: OptionKind.WORKER,\n },\n};\nif (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n) {\n defaultOptions.defaultUrl = {\n /** @type {string} */\n value: \"compressed.tracemonkey-pldi-09.pdf\",\n kind: OptionKind.VIEWER,\n };\n defaultOptions.disablePreferences = {\n /** @type {boolean} */\n value: typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\"),\n kind: OptionKind.VIEWER,\n };\n defaultOptions.locale = {\n /** @type {string} */\n value: navigator.language || \"en-US\",\n kind: OptionKind.VIEWER,\n };\n defaultOptions.renderer = {\n /** @type {string} */\n value: \"canvas\",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n };\n defaultOptions.sandboxBundleSrc = {\n /** @type {string} */\n value:\n typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n ? \"../build/dev-sandbox/pdf.sandbox.js\"\n : \"../build/pdf.sandbox.js\",\n kind: OptionKind.VIEWER,\n };\n} else if (PDFJSDev.test(\"CHROME\")) {\n defaultOptions.defaultUrl = {\n /** @type {string} */\n value: \"\",\n kind: OptionKind.VIEWER,\n };\n defaultOptions.disableTelemetry = {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n };\n defaultOptions.sandboxBundleSrc = {\n /** @type {string} */\n value: \"../build/pdf.sandbox.js\",\n kind: OptionKind.VIEWER,\n };\n}\n\nconst userOptions = Object.create(null);\n\nclass AppOptions {\n constructor() {\n throw new Error(\"Cannot initialize AppOptions.\");\n }\n\n static get(name) {\n const userOption = userOptions[name];\n if (userOption !== undefined) {\n return userOption;\n }\n const defaultOption = defaultOptions[name];\n if (defaultOption !== undefined) {\n return compatibilityParams[name] ?? defaultOption.value;\n }\n return undefined;\n }\n\n static getAll(kind = null) {\n const options = Object.create(null);\n for (const name in defaultOptions) {\n const defaultOption = defaultOptions[name];\n if (kind) {\n if ((kind & defaultOption.kind) === 0) {\n continue;\n }\n if (kind === OptionKind.PREFERENCE) {\n const value = defaultOption.value,\n valueType = typeof value;\n\n if (\n valueType === \"boolean\" ||\n valueType === \"string\" ||\n (valueType === \"number\" && Number.isInteger(value))\n ) {\n options[name] = value;\n continue;\n }\n throw new Error(`Invalid type for preference: ${name}`);\n }\n }\n const userOption = userOptions[name];\n options[name] =\n userOption !== undefined\n ? userOption\n : compatibilityParams[name] ?? defaultOption.value;\n }\n return options;\n }\n\n static set(name, value) {\n userOptions[name] = value;\n }\n\n static setAll(options) {\n for (const name in options) {\n userOptions[name] = options[name];\n }\n }\n\n static remove(name) {\n delete userOptions[name];\n }\n}\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n AppOptions._hasUserOptions = function () {\n return Object.keys(userOptions).length > 0;\n };\n}\n\nexport { AppOptions, compatibilityParams, OptionKind };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst WaitOnType = {\n EVENT: \"event\",\n TIMEOUT: \"timeout\",\n};\n\n/**\n * @typedef {Object} WaitOnEventOrTimeoutParameters\n * @property {Object} target - The event target, can for example be:\n * `window`, `document`, a DOM element, or an {EventBus} instance.\n * @property {string} name - The name of the event.\n * @property {number} delay - The delay, in milliseconds, after which the\n * timeout occurs (if the event wasn't already dispatched).\n */\n\n/**\n * Allows waiting for an event or a timeout, whichever occurs first.\n * Can be used to ensure that an action always occurs, even when an event\n * arrives late or not at all.\n *\n * @param {WaitOnEventOrTimeoutParameters}\n * @returns {Promise} A promise that is resolved with a {WaitOnType} value.\n */\nfunction waitOnEventOrTimeout({ target, name, delay = 0 }) {\n return new Promise(function (resolve, reject) {\n if (\n typeof target !== \"object\" ||\n !(name && typeof name === \"string\") ||\n !(Number.isInteger(delay) && delay >= 0)\n ) {\n throw new Error(\"waitOnEventOrTimeout - invalid parameters.\");\n }\n\n function handler(type) {\n if (target instanceof EventBus) {\n target._off(name, eventHandler);\n } else {\n target.removeEventListener(name, eventHandler);\n }\n\n if (timeout) {\n clearTimeout(timeout);\n }\n resolve(type);\n }\n\n const eventHandler = handler.bind(null, WaitOnType.EVENT);\n if (target instanceof EventBus) {\n target._on(name, eventHandler);\n } else {\n target.addEventListener(name, eventHandler);\n }\n\n const timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);\n const timeout = setTimeout(timeoutHandler, delay);\n });\n}\n\n/**\n * Simple event bus for an application. Listeners are attached using the `on`\n * and `off` methods. To raise an event, the `dispatch` method shall be used.\n */\nclass EventBus {\n #listeners = Object.create(null);\n\n /**\n * @param {string} eventName\n * @param {function} listener\n * @param {Object} [options]\n */\n on(eventName, listener, options = null) {\n this._on(eventName, listener, {\n external: true,\n once: options?.once,\n });\n }\n\n /**\n * @param {string} eventName\n * @param {function} listener\n * @param {Object} [options]\n */\n off(eventName, listener, options = null) {\n this._off(eventName, listener, {\n external: true,\n once: options?.once,\n });\n }\n\n /**\n * @param {string} eventName\n * @param {Object} data\n */\n dispatch(eventName, data) {\n const eventListeners = this.#listeners[eventName];\n if (!eventListeners || eventListeners.length === 0) {\n return;\n }\n let externalListeners;\n // Making copy of the listeners array in case if it will be modified\n // during dispatch.\n for (const { listener, external, once } of eventListeners.slice(0)) {\n if (once) {\n this._off(eventName, listener);\n }\n if (external) {\n (externalListeners ||= []).push(listener);\n continue;\n }\n listener(data);\n }\n // Dispatch any \"external\" listeners *after* the internal ones, to give the\n // viewer components time to handle events and update their state first.\n if (externalListeners) {\n for (const listener of externalListeners) {\n listener(data);\n }\n externalListeners = null;\n }\n }\n\n /**\n * @ignore\n */\n _on(eventName, listener, options = null) {\n const eventListeners = (this.#listeners[eventName] ||= []);\n eventListeners.push({\n listener,\n external: options?.external === true,\n once: options?.once === true,\n });\n }\n\n /**\n * @ignore\n */\n _off(eventName, listener, options = null) {\n const eventListeners = this.#listeners[eventName];\n if (!eventListeners) {\n return;\n }\n for (let i = 0, ii = eventListeners.length; i < ii; i++) {\n if (eventListeners[i].listener === listener) {\n eventListeners.splice(i, 1);\n return;\n }\n }\n }\n}\n\n/**\n * NOTE: Only used to support various PDF viewer tests in `mozilla-central`.\n */\nclass AutomationEventBus extends EventBus {\n dispatch(eventName, data) {\n if (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: AutomationEventBus.dispatch\");\n }\n super.dispatch(eventName, data);\n\n const details = Object.create(null);\n if (data) {\n for (const key in data) {\n const value = data[key];\n if (key === \"source\") {\n if (value === window || value === document) {\n return; // No need to re-dispatch (already) global events.\n }\n continue; // Ignore the `source` property.\n }\n details[key] = value;\n }\n }\n const event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(eventName, true, true, details);\n document.dispatchEvent(event);\n }\n}\n\nexport { AutomationEventBus, EventBus, waitOnEventOrTimeout, WaitOnType };\n","/* Copyright 2015 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { parseQueryString, removeNullCharacters } from \"./ui_utils.js\";\n\nconst DEFAULT_LINK_REL = \"noopener noreferrer nofollow\";\n\nconst LinkTarget = {\n NONE: 0, // Default value.\n SELF: 1,\n BLANK: 2,\n PARENT: 3,\n TOP: 4,\n};\n\n/**\n * @typedef {Object} ExternalLinkParameters\n * @property {string} url - An absolute URL.\n * @property {LinkTarget} [target] - The link target. The default value is\n * `LinkTarget.NONE`.\n * @property {string} [rel] - The link relationship. The default value is\n * `DEFAULT_LINK_REL`.\n * @property {boolean} [enabled] - Whether the link should be enabled. The\n * default value is true.\n */\n\n/**\n * Adds various attributes (href, title, target, rel) to hyperlinks.\n * @param {HTMLAnchorElement} link - The link element.\n * @param {ExternalLinkParameters} params\n */\nfunction addLinkAttributes(link, { url, target, rel, enabled = true } = {}) {\n if (!url || typeof url !== \"string\") {\n throw new Error('A valid \"url\" parameter must provided.');\n }\n\n const urlNullRemoved = removeNullCharacters(url);\n if (enabled) {\n link.href = link.title = urlNullRemoved;\n } else {\n link.href = \"\";\n link.title = `Disabled: ${urlNullRemoved}`;\n link.onclick = () => {\n return false;\n };\n }\n\n let targetStr = \"\"; // LinkTarget.NONE\n switch (target) {\n case LinkTarget.NONE:\n break;\n case LinkTarget.SELF:\n targetStr = \"_self\";\n break;\n case LinkTarget.BLANK:\n targetStr = \"_blank\";\n break;\n case LinkTarget.PARENT:\n targetStr = \"_parent\";\n break;\n case LinkTarget.TOP:\n targetStr = \"_top\";\n break;\n }\n link.target = targetStr;\n\n link.rel = typeof rel === \"string\" ? rel : DEFAULT_LINK_REL;\n}\n\n/**\n * @typedef {Object} PDFLinkServiceOptions\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} [externalLinkTarget] - Specifies the `target` attribute\n * for external links. Must use one of the values from {LinkTarget}.\n * Defaults to using no target.\n * @property {string} [externalLinkRel] - Specifies the `rel` attribute for\n * external links. Defaults to stripping the referrer.\n * @property {boolean} [ignoreDestinationZoom] - Ignores the zoom argument,\n * thus preserving the current zoom level in the viewer, when navigating\n * to internal destinations. The default value is `false`.\n */\n\n/**\n * Performs navigation functions inside PDF, such as opening specified page,\n * or destination.\n * @implements {IPDFLinkService}\n */\nclass PDFLinkService {\n #pagesRefCache = new Map();\n\n /**\n * @param {PDFLinkServiceOptions} options\n */\n constructor({\n eventBus,\n externalLinkTarget = null,\n externalLinkRel = null,\n ignoreDestinationZoom = false,\n } = {}) {\n this.eventBus = eventBus;\n this.externalLinkTarget = externalLinkTarget;\n this.externalLinkRel = externalLinkRel;\n this.externalLinkEnabled = true;\n this._ignoreDestinationZoom = ignoreDestinationZoom;\n\n this.baseUrl = null;\n this.pdfDocument = null;\n this.pdfViewer = null;\n this.pdfHistory = null;\n }\n\n setDocument(pdfDocument, baseUrl = null) {\n this.baseUrl = baseUrl;\n this.pdfDocument = pdfDocument;\n this.#pagesRefCache.clear();\n }\n\n setViewer(pdfViewer) {\n this.pdfViewer = pdfViewer;\n }\n\n setHistory(pdfHistory) {\n this.pdfHistory = pdfHistory;\n }\n\n /**\n * @type {number}\n */\n get pagesCount() {\n return this.pdfDocument ? this.pdfDocument.numPages : 0;\n }\n\n /**\n * @type {number}\n */\n get page() {\n return this.pdfViewer.currentPageNumber;\n }\n\n /**\n * @param {number} value\n */\n set page(value) {\n this.pdfViewer.currentPageNumber = value;\n }\n\n /**\n * @type {number}\n */\n get rotation() {\n return this.pdfViewer.pagesRotation;\n }\n\n /**\n * @param {number} value\n */\n set rotation(value) {\n this.pdfViewer.pagesRotation = value;\n }\n\n /**\n * @type {boolean}\n */\n get isInPresentationMode() {\n return this.pdfViewer.isInPresentationMode;\n }\n\n #goToDestinationHelper(rawDest, namedDest = null, explicitDest) {\n // Dest array looks like that: <page-ref> </XYZ|/FitXXX> <args..>\n const destRef = explicitDest[0];\n let pageNumber;\n\n if (typeof destRef === \"object\" && destRef !== null) {\n pageNumber = this._cachedPageNumber(destRef);\n\n if (!pageNumber) {\n // Fetch the page reference if it's not yet available. This could\n // only occur during loading, before all pages have been resolved.\n this.pdfDocument\n .getPageIndex(destRef)\n .then(pageIndex => {\n this.cachePageRef(pageIndex + 1, destRef);\n this.#goToDestinationHelper(rawDest, namedDest, explicitDest);\n })\n .catch(() => {\n console.error(\n `PDFLinkService.#goToDestinationHelper: \"${destRef}\" is not ` +\n `a valid page reference, for dest=\"${rawDest}\".`\n );\n });\n return;\n }\n } else if (Number.isInteger(destRef)) {\n pageNumber = destRef + 1;\n } else {\n console.error(\n `PDFLinkService.#goToDestinationHelper: \"${destRef}\" is not ` +\n `a valid destination reference, for dest=\"${rawDest}\".`\n );\n return;\n }\n if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {\n console.error(\n `PDFLinkService.#goToDestinationHelper: \"${pageNumber}\" is not ` +\n `a valid page number, for dest=\"${rawDest}\".`\n );\n return;\n }\n\n if (this.pdfHistory) {\n // Update the browser history before scrolling the new destination into\n // view, to be able to accurately capture the current document position.\n this.pdfHistory.pushCurrentPosition();\n this.pdfHistory.push({ namedDest, explicitDest, pageNumber });\n }\n\n this.pdfViewer.scrollPageIntoView({\n pageNumber,\n destArray: explicitDest,\n ignoreDestinationZoom: this._ignoreDestinationZoom,\n });\n }\n\n /**\n * This method will, when available, also update the browser history.\n *\n * @param {string|Array} dest - The named, or explicit, PDF destination.\n */\n async goToDestination(dest) {\n if (!this.pdfDocument) {\n return;\n }\n let namedDest, explicitDest;\n if (typeof dest === \"string\") {\n namedDest = dest;\n explicitDest = await this.pdfDocument.getDestination(dest);\n } else {\n namedDest = null;\n explicitDest = await dest;\n }\n if (!Array.isArray(explicitDest)) {\n console.error(\n `PDFLinkService.goToDestination: \"${explicitDest}\" is not ` +\n `a valid destination array, for dest=\"${dest}\".`\n );\n return;\n }\n this.#goToDestinationHelper(dest, namedDest, explicitDest);\n }\n\n /**\n * This method will, when available, also update the browser history.\n *\n * @param {number|string} val - The page number, or page label.\n */\n goToPage(val) {\n if (!this.pdfDocument) {\n return;\n }\n const pageNumber =\n (typeof val === \"string\" && this.pdfViewer.pageLabelToPageNumber(val)) ||\n val | 0;\n if (\n !(\n Number.isInteger(pageNumber) &&\n pageNumber > 0 &&\n pageNumber <= this.pagesCount\n )\n ) {\n console.error(`PDFLinkService.goToPage: \"${val}\" is not a valid page.`);\n return;\n }\n\n if (this.pdfHistory) {\n // Update the browser history before scrolling the new page into view,\n // to be able to accurately capture the current document position.\n this.pdfHistory.pushCurrentPosition();\n this.pdfHistory.pushPage(pageNumber);\n }\n\n this.pdfViewer.scrollPageIntoView({ pageNumber });\n }\n\n /**\n * Wrapper around the `addLinkAttributes` helper function.\n * @param {HTMLAnchorElement} link\n * @param {string} url\n * @param {boolean} [newWindow]\n */\n addLinkAttributes(link, url, newWindow = false) {\n addLinkAttributes(link, {\n url,\n target: newWindow ? LinkTarget.BLANK : this.externalLinkTarget,\n rel: this.externalLinkRel,\n enabled: this.externalLinkEnabled,\n });\n }\n\n /**\n * @param {string|Array} dest - The PDF destination object.\n * @returns {string} The hyperlink to the PDF object.\n */\n getDestinationHash(dest) {\n if (typeof dest === \"string\") {\n if (dest.length > 0) {\n return this.getAnchorUrl(\"#\" + escape(dest));\n }\n } else if (Array.isArray(dest)) {\n const str = JSON.stringify(dest);\n if (str.length > 0) {\n return this.getAnchorUrl(\"#\" + escape(str));\n }\n }\n return this.getAnchorUrl(\"\");\n }\n\n /**\n * Prefix the full url on anchor links to make sure that links are resolved\n * relative to the current URL instead of the one defined in <base href>.\n * @param {string} anchor - The anchor hash, including the #.\n * @returns {string} The hyperlink to the PDF object.\n */\n getAnchorUrl(anchor) {\n return this.baseUrl ? this.baseUrl + anchor : anchor;\n }\n\n /**\n * @param {string} hash\n */\n setHash(hash) {\n if (!this.pdfDocument) {\n return;\n }\n let pageNumber, dest;\n if (hash.includes(\"=\")) {\n const params = parseQueryString(hash);\n if (params.has(\"search\")) {\n this.eventBus.dispatch(\"findfromurlhash\", {\n source: this,\n query: params.get(\"search\").replaceAll('\"', \"\"),\n phraseSearch: params.get(\"phrase\") === \"true\",\n });\n }\n // borrowing syntax from \"Parameters for Opening PDF Files\"\n if (params.has(\"page\")) {\n pageNumber = params.get(\"page\") | 0 || 1;\n }\n if (params.has(\"zoom\")) {\n // Build the destination array.\n const zoomArgs = params.get(\"zoom\").split(\",\"); // scale,left,top\n const zoomArg = zoomArgs[0];\n const zoomArgNumber = parseFloat(zoomArg);\n\n if (!zoomArg.includes(\"Fit\")) {\n // If the zoomArg is a number, it has to get divided by 100. If it's\n // a string, it should stay as it is.\n dest = [\n null,\n { name: \"XYZ\" },\n zoomArgs.length > 1 ? zoomArgs[1] | 0 : null,\n zoomArgs.length > 2 ? zoomArgs[2] | 0 : null,\n zoomArgNumber ? zoomArgNumber / 100 : zoomArg,\n ];\n } else {\n if (zoomArg === \"Fit\" || zoomArg === \"FitB\") {\n dest = [null, { name: zoomArg }];\n } else if (\n zoomArg === \"FitH\" ||\n zoomArg === \"FitBH\" ||\n zoomArg === \"FitV\" ||\n zoomArg === \"FitBV\"\n ) {\n dest = [\n null,\n { name: zoomArg },\n zoomArgs.length > 1 ? zoomArgs[1] | 0 : null,\n ];\n } else if (zoomArg === \"FitR\") {\n if (zoomArgs.length !== 5) {\n console.error(\n 'PDFLinkService.setHash: Not enough parameters for \"FitR\".'\n );\n } else {\n dest = [\n null,\n { name: zoomArg },\n zoomArgs[1] | 0,\n zoomArgs[2] | 0,\n zoomArgs[3] | 0,\n zoomArgs[4] | 0,\n ];\n }\n } else {\n console.error(\n `PDFLinkService.setHash: \"${zoomArg}\" is not a valid zoom value.`\n );\n }\n }\n }\n if (dest) {\n this.pdfViewer.scrollPageIntoView({\n pageNumber: pageNumber || this.page,\n destArray: dest,\n allowNegativeOffset: true,\n });\n } else if (pageNumber) {\n this.page = pageNumber; // simple page\n }\n if (params.has(\"pagemode\")) {\n this.eventBus.dispatch(\"pagemode\", {\n source: this,\n mode: params.get(\"pagemode\"),\n });\n }\n // Ensure that this parameter is *always* handled last, in order to\n // guarantee that it won't be overridden (e.g. by the \"page\" parameter).\n if (params.has(\"nameddest\")) {\n this.goToDestination(params.get(\"nameddest\"));\n }\n } else {\n // Named (or explicit) destination.\n dest = unescape(hash);\n try {\n dest = JSON.parse(dest);\n\n if (!Array.isArray(dest)) {\n // Avoid incorrectly rejecting a valid named destination, such as\n // e.g. \"4.3\" or \"true\", because `JSON.parse` converted its type.\n dest = dest.toString();\n }\n } catch (ex) {}\n\n if (\n typeof dest === \"string\" ||\n PDFLinkService.#isValidExplicitDestination(dest)\n ) {\n this.goToDestination(dest);\n return;\n }\n console.error(\n `PDFLinkService.setHash: \"${unescape(\n hash\n )}\" is not a valid destination.`\n );\n }\n }\n\n /**\n * @param {string} action\n */\n executeNamedAction(action) {\n // See PDF reference, table 8.45 - Named action\n switch (action) {\n case \"GoBack\":\n this.pdfHistory?.back();\n break;\n\n case \"GoForward\":\n this.pdfHistory?.forward();\n break;\n\n case \"NextPage\":\n this.pdfViewer.nextPage();\n break;\n\n case \"PrevPage\":\n this.pdfViewer.previousPage();\n break;\n\n case \"LastPage\":\n this.page = this.pagesCount;\n break;\n\n case \"FirstPage\":\n this.page = 1;\n break;\n\n default:\n break; // No action according to spec\n }\n\n this.eventBus.dispatch(\"namedaction\", {\n source: this,\n action,\n });\n }\n\n /**\n * @param {Object} action\n */\n async executeSetOCGState(action) {\n const pdfDocument = this.pdfDocument;\n const optionalContentConfig = await this.pdfViewer\n .optionalContentConfigPromise;\n\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the optional content resolved.\n }\n let operator;\n\n for (const elem of action.state) {\n switch (elem) {\n case \"ON\":\n case \"OFF\":\n case \"Toggle\":\n operator = elem;\n continue;\n }\n switch (operator) {\n case \"ON\":\n optionalContentConfig.setVisibility(elem, true);\n break;\n case \"OFF\":\n optionalContentConfig.setVisibility(elem, false);\n break;\n case \"Toggle\":\n const group = optionalContentConfig.getGroup(elem);\n if (group) {\n optionalContentConfig.setVisibility(elem, !group.visible);\n }\n break;\n }\n }\n\n this.pdfViewer.optionalContentConfigPromise = Promise.resolve(\n optionalContentConfig\n );\n }\n\n /**\n * @param {number} pageNum - page number.\n * @param {Object} pageRef - reference to the page.\n */\n cachePageRef(pageNum, pageRef) {\n if (!pageRef) {\n return;\n }\n const refStr =\n pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;\n this.#pagesRefCache.set(refStr, pageNum);\n }\n\n /**\n * @ignore\n */\n _cachedPageNumber(pageRef) {\n if (!pageRef) {\n return null;\n }\n const refStr =\n pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;\n return this.#pagesRefCache.get(refStr) || null;\n }\n\n /**\n * @param {number} pageNumber\n */\n isPageVisible(pageNumber) {\n return this.pdfViewer.isPageVisible(pageNumber);\n }\n\n /**\n * @param {number} pageNumber\n */\n isPageCached(pageNumber) {\n return this.pdfViewer.isPageCached(pageNumber);\n }\n\n static #isValidExplicitDestination(dest) {\n if (!Array.isArray(dest)) {\n return false;\n }\n const destLength = dest.length;\n if (destLength < 2) {\n return false;\n }\n const page = dest[0];\n if (\n !(\n typeof page === \"object\" &&\n Number.isInteger(page.num) &&\n Number.isInteger(page.gen)\n ) &&\n !(Number.isInteger(page) && page >= 0)\n ) {\n return false;\n }\n const zoom = dest[1];\n if (!(typeof zoom === \"object\" && typeof zoom.name === \"string\")) {\n return false;\n }\n let allowNull = true;\n switch (zoom.name) {\n case \"XYZ\":\n if (destLength !== 5) {\n return false;\n }\n break;\n case \"Fit\":\n case \"FitB\":\n return destLength === 2;\n case \"FitH\":\n case \"FitBH\":\n case \"FitV\":\n case \"FitBV\":\n if (destLength !== 3) {\n return false;\n }\n break;\n case \"FitR\":\n if (destLength !== 6) {\n return false;\n }\n allowNull = false;\n break;\n default:\n return false;\n }\n for (let i = 2; i < destLength; i++) {\n const param = dest[i];\n if (!(typeof param === \"number\" || (allowNull && param === null))) {\n return false;\n }\n }\n return true;\n }\n}\n\n/**\n * @implements {IPDFLinkService}\n */\nclass SimpleLinkService {\n constructor() {\n this.externalLinkEnabled = true;\n }\n\n /**\n * @type {number}\n */\n get pagesCount() {\n return 0;\n }\n\n /**\n * @type {number}\n */\n get page() {\n return 0;\n }\n\n /**\n * @param {number} value\n */\n set page(value) {}\n\n /**\n * @type {number}\n */\n get rotation() {\n return 0;\n }\n\n /**\n * @param {number} value\n */\n set rotation(value) {}\n\n /**\n * @type {boolean}\n */\n get isInPresentationMode() {\n return false;\n }\n\n /**\n * @param {string|Array} dest - The named, or explicit, PDF destination.\n */\n async goToDestination(dest) {}\n\n /**\n * @param {number|string} val - The page number, or page label.\n */\n goToPage(val) {}\n\n /**\n * @param {HTMLAnchorElement} link\n * @param {string} url\n * @param {boolean} [newWindow]\n */\n addLinkAttributes(link, url, newWindow = false) {\n addLinkAttributes(link, { url, enabled: this.externalLinkEnabled });\n }\n\n /**\n * @param dest - The PDF destination object.\n * @returns {string} The hyperlink to the PDF object.\n */\n getDestinationHash(dest) {\n return \"#\";\n }\n\n /**\n * @param hash - The PDF parameters/hash.\n * @returns {string} The hyperlink to the PDF object.\n */\n getAnchorUrl(hash) {\n return \"#\";\n }\n\n /**\n * @param {string} hash\n */\n setHash(hash) {}\n\n /**\n * @param {string} action\n */\n executeNamedAction(action) {}\n\n /**\n * @param {Object} action\n */\n executeSetOCGState(action) {}\n\n /**\n * @param {number} pageNum - page number.\n * @param {Object} pageRef - reference to the page.\n */\n cachePageRef(pageNum, pageRef) {}\n\n /**\n * @param {number} pageNumber\n */\n isPageVisible(pageNumber) {\n return true;\n }\n\n /**\n * @param {number} pageNumber\n */\n isPageCached(pageNumber) {\n return true;\n }\n}\n\nexport { LinkTarget, PDFLinkService, SimpleLinkService };\n","/* Copyright 2022 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AnnotationEditorParamsType } from \"pdfjs-lib\";\n\nclass AnnotationEditorParams {\n /**\n * @param {AnnotationEditorParamsOptions} options\n * @param {EventBus} eventBus\n */\n constructor(options, eventBus) {\n this.eventBus = eventBus;\n this.#bindListeners(options);\n }\n\n #bindListeners({\n editorFreeTextFontSize,\n editorFreeTextColor,\n editorInkColor,\n editorInkThickness,\n editorInkOpacity,\n }) {\n editorFreeTextFontSize.addEventListener(\"input\", evt => {\n this.eventBus.dispatch(\"switchannotationeditorparams\", {\n source: this,\n type: AnnotationEditorParamsType.FREETEXT_SIZE,\n value: editorFreeTextFontSize.valueAsNumber,\n });\n });\n editorFreeTextColor.addEventListener(\"input\", evt => {\n this.eventBus.dispatch(\"switchannotationeditorparams\", {\n source: this,\n type: AnnotationEditorParamsType.FREETEXT_COLOR,\n value: editorFreeTextColor.value,\n });\n });\n editorInkColor.addEventListener(\"input\", evt => {\n this.eventBus.dispatch(\"switchannotationeditorparams\", {\n source: this,\n type: AnnotationEditorParamsType.INK_COLOR,\n value: editorInkColor.value,\n });\n });\n editorInkThickness.addEventListener(\"input\", evt => {\n this.eventBus.dispatch(\"switchannotationeditorparams\", {\n source: this,\n type: AnnotationEditorParamsType.INK_THICKNESS,\n value: editorInkThickness.valueAsNumber,\n });\n });\n editorInkOpacity.addEventListener(\"input\", evt => {\n this.eventBus.dispatch(\"switchannotationeditorparams\", {\n source: this,\n type: AnnotationEditorParamsType.INK_OPACITY,\n value: editorInkOpacity.valueAsNumber,\n });\n });\n\n this.eventBus._on(\"annotationeditorparamschanged\", evt => {\n for (const [type, value] of evt.details) {\n switch (type) {\n case AnnotationEditorParamsType.FREETEXT_SIZE:\n editorFreeTextFontSize.value = value;\n break;\n case AnnotationEditorParamsType.FREETEXT_COLOR:\n editorFreeTextColor.value = value;\n break;\n case AnnotationEditorParamsType.INK_COLOR:\n editorInkColor.value = value;\n break;\n case AnnotationEditorParamsType.INK_THICKNESS:\n editorInkThickness.value = value;\n break;\n case AnnotationEditorParamsType.INK_OPACITY:\n editorInkOpacity.value = value;\n break;\n }\n }\n });\n }\n}\n\nexport { AnnotationEditorParams };\n","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nclass OverlayManager {\n #overlays = new WeakMap();\n\n #active = null;\n\n get active() {\n return this.#active;\n }\n\n /**\n * @param {HTMLDialogElement} dialog - The overlay's DOM element.\n * @param {boolean} [canForceClose] - Indicates if opening the overlay closes\n * an active overlay. The default is `false`.\n * @returns {Promise} A promise that is resolved when the overlay has been\n * registered.\n */\n async register(dialog, canForceClose = false) {\n if (typeof dialog !== \"object\") {\n throw new Error(\"Not enough parameters.\");\n } else if (this.#overlays.has(dialog)) {\n throw new Error(\"The overlay is already registered.\");\n }\n this.#overlays.set(dialog, { canForceClose });\n\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"GENERIC && !SKIP_BABEL\") &&\n !dialog.showModal\n ) {\n const dialogPolyfill = require(\"dialog-polyfill/dist/dialog-polyfill.js\");\n dialogPolyfill.registerDialog(dialog);\n\n if (!this._dialogPolyfillCSS) {\n this._dialogPolyfillCSS = true;\n\n const style = document.createElement(\"style\");\n style.textContent = PDFJSDev.eval(\"DIALOG_POLYFILL_CSS\");\n\n document.head.prepend(style);\n }\n }\n\n dialog.addEventListener(\"cancel\", evt => {\n this.#active = null;\n });\n }\n\n /**\n * @param {HTMLDialogElement} dialog - The overlay's DOM element.\n * @returns {Promise} A promise that is resolved when the overlay has been\n * unregistered.\n */\n async unregister(dialog) {\n if (!this.#overlays.has(dialog)) {\n throw new Error(\"The overlay does not exist.\");\n } else if (this.#active === dialog) {\n throw new Error(\"The overlay cannot be removed while it is active.\");\n }\n this.#overlays.delete(dialog);\n }\n\n /**\n * @param {HTMLDialogElement} dialog - The overlay's DOM element.\n * @returns {Promise} A promise that is resolved when the overlay has been\n * opened.\n */\n async open(dialog) {\n if (!this.#overlays.has(dialog)) {\n throw new Error(\"The overlay does not exist.\");\n } else if (this.#active) {\n if (this.#active === dialog) {\n throw new Error(\"The overlay is already active.\");\n } else if (this.#overlays.get(dialog).canForceClose) {\n await this.close();\n } else {\n throw new Error(\"Another overlay is currently active.\");\n }\n }\n this.#active = dialog;\n dialog.showModal();\n }\n\n /**\n * @param {HTMLDialogElement} dialog - The overlay's DOM element.\n * @returns {Promise} A promise that is resolved when the overlay has been\n * closed.\n */\n async close(dialog = this.#active) {\n if (!this.#overlays.has(dialog)) {\n throw new Error(\"The overlay does not exist.\");\n } else if (!this.#active) {\n throw new Error(\"The overlay is currently not active.\");\n } else if (this.#active !== dialog) {\n throw new Error(\"Another overlay is currently active.\");\n }\n dialog.close();\n this.#active = null;\n }\n}\n\nexport { OverlayManager };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createPromiseCapability, PasswordResponses } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} PasswordPromptOptions\n * @property {HTMLDialogElement} dialog - The overlay's DOM element.\n * @property {HTMLParagraphElement} label - Label containing instructions for\n * entering the password.\n * @property {HTMLInputElement} input - Input field for entering the password.\n * @property {HTMLButtonElement} submitButton - Button for submitting the\n * password.\n * @property {HTMLButtonElement} cancelButton - Button for cancelling password\n * entry.\n */\n\nclass PasswordPrompt {\n #activeCapability = null;\n\n #updateCallback = null;\n\n #reason = null;\n\n /**\n * @param {PasswordPromptOptions} options\n * @param {OverlayManager} overlayManager - Manager for the viewer overlays.\n * @param {IL10n} l10n - Localization service.\n * @param {boolean} [isViewerEmbedded] - If the viewer is embedded, in e.g.\n * an <iframe> or an <object>. The default value is `false`.\n */\n constructor(options, overlayManager, l10n, isViewerEmbedded = false) {\n this.dialog = options.dialog;\n this.label = options.label;\n this.input = options.input;\n this.submitButton = options.submitButton;\n this.cancelButton = options.cancelButton;\n this.overlayManager = overlayManager;\n this.l10n = l10n;\n this._isViewerEmbedded = isViewerEmbedded;\n\n // Attach the event listeners.\n this.submitButton.addEventListener(\"click\", this.#verify.bind(this));\n this.cancelButton.addEventListener(\"click\", this.close.bind(this));\n this.input.addEventListener(\"keydown\", e => {\n if (e.keyCode === /* Enter = */ 13) {\n this.#verify();\n }\n });\n\n this.overlayManager.register(this.dialog, /* canForceClose = */ true);\n\n this.dialog.addEventListener(\"close\", this.#cancel.bind(this));\n }\n\n async open() {\n if (this.#activeCapability) {\n await this.#activeCapability.promise;\n }\n this.#activeCapability = createPromiseCapability();\n\n try {\n await this.overlayManager.open(this.dialog);\n } catch (ex) {\n this.#activeCapability = null;\n throw ex;\n }\n\n const passwordIncorrect =\n this.#reason === PasswordResponses.INCORRECT_PASSWORD;\n\n if (!this._isViewerEmbedded || passwordIncorrect) {\n this.input.focus();\n }\n this.label.textContent = await this.l10n.get(\n `password_${passwordIncorrect ? \"invalid\" : \"label\"}`\n );\n }\n\n async close() {\n if (this.overlayManager.active === this.dialog) {\n this.overlayManager.close(this.dialog);\n }\n }\n\n #verify() {\n const password = this.input.value;\n if (password?.length > 0) {\n this.#invokeCallback(password);\n }\n }\n\n #cancel() {\n this.#invokeCallback(new Error(\"PasswordPrompt cancelled.\"));\n this.#activeCapability.resolve();\n }\n\n #invokeCallback(password) {\n if (!this.#updateCallback) {\n return; // Ensure that the callback is only invoked once.\n }\n this.close();\n this.input.value = \"\";\n\n this.#updateCallback(password);\n this.#updateCallback = null;\n }\n\n async setUpdateCallback(updateCallback, reason) {\n if (this.#activeCapability) {\n await this.#activeCapability.promise;\n }\n this.#updateCallback = updateCallback;\n this.#reason = reason;\n }\n}\n\nexport { PasswordPrompt };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createPromiseCapability, getFilenameFromUrl } from \"pdfjs-lib\";\nimport { BaseTreeViewer } from \"./base_tree_viewer.js\";\nimport { waitOnEventOrTimeout } from \"./event_utils.js\";\n\n/**\n * @typedef {Object} PDFAttachmentViewerOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {DownloadManager} downloadManager - The download manager.\n */\n\n/**\n * @typedef {Object} PDFAttachmentViewerRenderParameters\n * @property {Object|null} attachments - A lookup table of attachment objects.\n */\n\nclass PDFAttachmentViewer extends BaseTreeViewer {\n /**\n * @param {PDFAttachmentViewerOptions} options\n */\n constructor(options) {\n super(options);\n this.downloadManager = options.downloadManager;\n\n this.eventBus._on(\n \"fileattachmentannotation\",\n this.#appendAttachment.bind(this)\n );\n }\n\n reset(keepRenderedCapability = false) {\n super.reset();\n this._attachments = null;\n\n if (!keepRenderedCapability) {\n // The only situation in which the `_renderedCapability` should *not* be\n // replaced is when appending FileAttachment annotations.\n this._renderedCapability = createPromiseCapability();\n }\n this._pendingDispatchEvent = false;\n }\n\n /**\n * @private\n */\n async _dispatchEvent(attachmentsCount) {\n this._renderedCapability.resolve();\n\n if (attachmentsCount === 0 && !this._pendingDispatchEvent) {\n // Delay the event when no \"regular\" attachments exist, to allow time for\n // parsing of any FileAttachment annotations that may be present on the\n // *initially* rendered page; this reduces the likelihood of temporarily\n // disabling the attachmentsView when the `PDFSidebar` handles the event.\n this._pendingDispatchEvent = true;\n\n await waitOnEventOrTimeout({\n target: this.eventBus,\n name: \"annotationlayerrendered\",\n delay: 1000,\n });\n\n if (!this._pendingDispatchEvent) {\n return; // There was already another `_dispatchEvent`-call`.\n }\n }\n this._pendingDispatchEvent = false;\n\n this.eventBus.dispatch(\"attachmentsloaded\", {\n source: this,\n attachmentsCount,\n });\n }\n\n /**\n * @private\n */\n _bindLink(element, { content, filename }) {\n element.onclick = () => {\n this.downloadManager.openOrDownloadData(element, content, filename);\n return false;\n };\n }\n\n /**\n * @param {PDFAttachmentViewerRenderParameters} params\n */\n render({ attachments, keepRenderedCapability = false }) {\n if (this._attachments) {\n this.reset(keepRenderedCapability);\n }\n this._attachments = attachments || null;\n\n if (!attachments) {\n this._dispatchEvent(/* attachmentsCount = */ 0);\n return;\n }\n const names = Object.keys(attachments).sort(function (a, b) {\n return a.toLowerCase().localeCompare(b.toLowerCase());\n });\n\n const fragment = document.createDocumentFragment();\n let attachmentsCount = 0;\n for (const name of names) {\n const item = attachments[name];\n const content = item.content,\n filename = getFilenameFromUrl(\n item.filename,\n /* onlyStripPath = */ true\n );\n\n const div = document.createElement(\"div\");\n div.className = \"treeItem\";\n\n const element = document.createElement(\"a\");\n this._bindLink(element, { content, filename });\n element.textContent = this._normalizeTextContent(filename);\n\n div.append(element);\n\n fragment.append(div);\n attachmentsCount++;\n }\n\n this._finishRendering(fragment, attachmentsCount);\n }\n\n /**\n * Used to append FileAttachment annotations to the sidebar.\n */\n #appendAttachment({ filename, content }) {\n const renderedPromise = this._renderedCapability.promise;\n\n renderedPromise.then(() => {\n if (renderedPromise !== this._renderedCapability.promise) {\n return; // The FileAttachment annotation belongs to a previous document.\n }\n const attachments = this._attachments || Object.create(null);\n\n for (const name in attachments) {\n if (filename === name) {\n return; // Ignore the new attachment if it already exists.\n }\n }\n attachments[filename] = {\n filename,\n content,\n };\n this.render({\n attachments,\n keepRenderedCapability: true,\n });\n });\n }\n}\n\nexport { PDFAttachmentViewer };\n","/* Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { removeNullCharacters } from \"./ui_utils.js\";\n\nconst TREEITEM_OFFSET_TOP = -100; // px\nconst TREEITEM_SELECTED_CLASS = \"selected\";\n\nclass BaseTreeViewer {\n constructor(options) {\n if (this.constructor === BaseTreeViewer) {\n throw new Error(\"Cannot initialize BaseTreeViewer.\");\n }\n this.container = options.container;\n this.eventBus = options.eventBus;\n\n this.reset();\n }\n\n reset() {\n this._pdfDocument = null;\n this._lastToggleIsShow = true;\n this._currentTreeItem = null;\n\n // Remove the tree from the DOM.\n this.container.textContent = \"\";\n // Ensure that the left (right in RTL locales) margin is always reset,\n // to prevent incorrect tree alignment if a new document is opened.\n this.container.classList.remove(\"treeWithDeepNesting\");\n }\n\n /**\n * @private\n */\n _dispatchEvent(count) {\n throw new Error(\"Not implemented: _dispatchEvent\");\n }\n\n /**\n * @private\n */\n _bindLink(element, params) {\n throw new Error(\"Not implemented: _bindLink\");\n }\n\n /**\n * @private\n */\n _normalizeTextContent(str) {\n // Chars in range [0x01-0x1F] will be replaced with a white space\n // and 0x00 by \"\".\n return (\n removeNullCharacters(str, /* replaceInvisible */ true) ||\n /* en dash = */ \"\\u2013\"\n );\n }\n\n /**\n * Prepend a button before a tree item which allows the user to collapse or\n * expand all tree items at that level; see `_toggleTreeItem`.\n * @private\n */\n _addToggleButton(div, hidden = false) {\n const toggler = document.createElement(\"div\");\n toggler.className = \"treeItemToggler\";\n if (hidden) {\n toggler.classList.add(\"treeItemsHidden\");\n }\n toggler.onclick = evt => {\n evt.stopPropagation();\n toggler.classList.toggle(\"treeItemsHidden\");\n\n if (evt.shiftKey) {\n const shouldShowAll = !toggler.classList.contains(\"treeItemsHidden\");\n this._toggleTreeItem(div, shouldShowAll);\n }\n };\n div.prepend(toggler);\n }\n\n /**\n * Collapse or expand the subtree of a tree item.\n *\n * @param {Element} root - the root of the item (sub)tree.\n * @param {boolean} show - whether to show the item (sub)tree. If false,\n * the item subtree rooted at `root` will be collapsed.\n * @private\n */\n _toggleTreeItem(root, show = false) {\n this._lastToggleIsShow = show;\n for (const toggler of root.querySelectorAll(\".treeItemToggler\")) {\n toggler.classList.toggle(\"treeItemsHidden\", !show);\n }\n }\n\n /**\n * Collapse or expand all subtrees of the `container`.\n * @private\n */\n _toggleAllTreeItems() {\n this._toggleTreeItem(this.container, !this._lastToggleIsShow);\n }\n\n /**\n * @private\n */\n _finishRendering(fragment, count, hasAnyNesting = false) {\n if (hasAnyNesting) {\n this.container.classList.add(\"treeWithDeepNesting\");\n\n this._lastToggleIsShow = !fragment.querySelector(\".treeItemsHidden\");\n }\n this.container.append(fragment);\n\n this._dispatchEvent(count);\n }\n\n render(params) {\n throw new Error(\"Not implemented: render\");\n }\n\n /**\n * @private\n */\n _updateCurrentTreeItem(treeItem = null) {\n if (this._currentTreeItem) {\n // Ensure that the current treeItem-selection is always removed.\n this._currentTreeItem.classList.remove(TREEITEM_SELECTED_CLASS);\n this._currentTreeItem = null;\n }\n if (treeItem) {\n treeItem.classList.add(TREEITEM_SELECTED_CLASS);\n this._currentTreeItem = treeItem;\n }\n }\n\n /**\n * @private\n */\n _scrollToCurrentTreeItem(treeItem) {\n if (!treeItem) {\n return;\n }\n // Ensure that the treeItem is *fully* expanded, such that it will first of\n // all be visible and secondly that scrolling it into view works correctly.\n let currentNode = treeItem.parentNode;\n while (currentNode && currentNode !== this.container) {\n if (currentNode.classList.contains(\"treeItem\")) {\n const toggler = currentNode.firstElementChild;\n toggler?.classList.remove(\"treeItemsHidden\");\n }\n currentNode = currentNode.parentNode;\n }\n this._updateCurrentTreeItem(treeItem);\n\n this.container.scrollTo(\n treeItem.offsetLeft,\n treeItem.offsetTop + TREEITEM_OFFSET_TOP\n );\n }\n}\n\nexport { BaseTreeViewer };\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CursorTool, PresentationModeState } from \"./ui_utils.js\";\nimport { AnnotationEditorType } from \"pdfjs-lib\";\nimport { GrabToPan } from \"./grab_to_pan.js\";\n\n/**\n * @typedef {Object} PDFCursorToolsOptions\n * @property {HTMLDivElement} container - The document container.\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} [cursorToolOnLoad] - The cursor tool that will be enabled\n * on load; the constants from {CursorTool} should be used. The default value\n * is `CursorTool.SELECT`.\n */\n\nclass PDFCursorTools {\n /**\n * @param {PDFCursorToolsOptions} options\n */\n constructor({ container, eventBus, cursorToolOnLoad = CursorTool.SELECT }) {\n this.container = container;\n this.eventBus = eventBus;\n\n this.active = CursorTool.SELECT;\n this.previouslyActive = null;\n\n this.handTool = new GrabToPan({\n element: this.container,\n });\n\n this.#addEventListeners();\n\n // Defer the initial `switchTool` call, to give other viewer components\n // time to initialize *and* register 'cursortoolchanged' event listeners.\n Promise.resolve().then(() => {\n this.switchTool(cursorToolOnLoad);\n });\n }\n\n /**\n * @type {number} One of the values in {CursorTool}.\n */\n get activeTool() {\n return this.active;\n }\n\n /**\n * @param {number} tool - The cursor mode that should be switched to,\n * must be one of the values in {CursorTool}.\n */\n switchTool(tool) {\n if (this.previouslyActive !== null) {\n // Cursor tools cannot be used in PresentationMode/AnnotationEditor.\n return;\n }\n if (tool === this.active) {\n return; // The requested tool is already active.\n }\n\n const disableActiveTool = () => {\n switch (this.active) {\n case CursorTool.SELECT:\n break;\n case CursorTool.HAND:\n this.handTool.deactivate();\n break;\n case CursorTool.ZOOM:\n /* falls through */\n }\n };\n\n // Enable the new cursor tool.\n switch (tool) {\n case CursorTool.SELECT:\n disableActiveTool();\n break;\n case CursorTool.HAND:\n disableActiveTool();\n this.handTool.activate();\n break;\n case CursorTool.ZOOM:\n /* falls through */\n default:\n console.error(`switchTool: \"${tool}\" is an unsupported value.`);\n return;\n }\n // Update the active tool *after* it has been validated above,\n // in order to prevent setting it to an invalid state.\n this.active = tool;\n\n this.#dispatchEvent();\n }\n\n #dispatchEvent() {\n this.eventBus.dispatch(\"cursortoolchanged\", {\n source: this,\n tool: this.active,\n });\n }\n\n #addEventListeners() {\n this.eventBus._on(\"switchcursortool\", evt => {\n this.switchTool(evt.tool);\n });\n\n let annotationEditorMode = AnnotationEditorType.NONE,\n presentationModeState = PresentationModeState.NORMAL;\n\n const disableActive = () => {\n const previouslyActive = this.active;\n\n this.switchTool(CursorTool.SELECT);\n this.previouslyActive ??= previouslyActive; // Keep track of the first one.\n };\n const enableActive = () => {\n const previouslyActive = this.previouslyActive;\n\n if (\n previouslyActive !== null &&\n annotationEditorMode === AnnotationEditorType.NONE &&\n presentationModeState === PresentationModeState.NORMAL\n ) {\n this.previouslyActive = null;\n this.switchTool(previouslyActive);\n }\n };\n\n this.eventBus._on(\"secondarytoolbarreset\", evt => {\n if (this.previouslyActive !== null) {\n annotationEditorMode = AnnotationEditorType.NONE;\n presentationModeState = PresentationModeState.NORMAL;\n\n enableActive();\n }\n });\n\n this.eventBus._on(\"annotationeditormodechanged\", ({ mode }) => {\n annotationEditorMode = mode;\n\n if (mode === AnnotationEditorType.NONE) {\n enableActive();\n } else {\n disableActive();\n }\n });\n\n this.eventBus._on(\"presentationmodechanged\", ({ state }) => {\n presentationModeState = state;\n\n if (state === PresentationModeState.NORMAL) {\n enableActive();\n } else if (state === PresentationModeState.FULLSCREEN) {\n disableActive();\n }\n });\n }\n}\n\nexport { PDFCursorTools };\n","/* Copyright 2013 Rob Wu <rob@robwu.nl>\n * https://github.com/Rob--W/grab-to-pan.js\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Class name of element which can be grabbed.\nconst CSS_CLASS_GRAB = \"grab-to-pan-grab\";\n\nclass GrabToPan {\n /**\n * Construct a GrabToPan instance for a given HTML element.\n * @param {Element} options.element\n * @param {function} [options.ignoreTarget] - See `ignoreTarget(node)`.\n * @param {function(boolean)} [options.onActiveChanged] - Called when\n * grab-to-pan is (de)activated. The first argument is a boolean that\n * shows whether grab-to-pan is activated.\n */\n constructor(options) {\n this.element = options.element;\n this.document = options.element.ownerDocument;\n if (typeof options.ignoreTarget === \"function\") {\n this.ignoreTarget = options.ignoreTarget;\n }\n this.onActiveChanged = options.onActiveChanged;\n\n // Bind the contexts to ensure that `this` always points to\n // the GrabToPan instance.\n this.activate = this.activate.bind(this);\n this.deactivate = this.deactivate.bind(this);\n this.toggle = this.toggle.bind(this);\n this._onMouseDown = this.#onMouseDown.bind(this);\n this._onMouseMove = this.#onMouseMove.bind(this);\n this._endPan = this.#endPan.bind(this);\n\n // This overlay will be inserted in the document when the mouse moves during\n // a grab operation, to ensure that the cursor has the desired appearance.\n const overlay = (this.overlay = document.createElement(\"div\"));\n overlay.className = \"grab-to-pan-grabbing\";\n }\n\n /**\n * Bind a mousedown event to the element to enable grab-detection.\n */\n activate() {\n if (!this.active) {\n this.active = true;\n this.element.addEventListener(\"mousedown\", this._onMouseDown, true);\n this.element.classList.add(CSS_CLASS_GRAB);\n\n this.onActiveChanged?.(true);\n }\n }\n\n /**\n * Removes all events. Any pending pan session is immediately stopped.\n */\n deactivate() {\n if (this.active) {\n this.active = false;\n this.element.removeEventListener(\"mousedown\", this._onMouseDown, true);\n this._endPan();\n this.element.classList.remove(CSS_CLASS_GRAB);\n\n this.onActiveChanged?.(false);\n }\n }\n\n toggle() {\n if (this.active) {\n this.deactivate();\n } else {\n this.activate();\n }\n }\n\n /**\n * Whether to not pan if the target element is clicked.\n * Override this method to change the default behaviour.\n *\n * @param {Element} node - The target of the event.\n * @returns {boolean} Whether to not react to the click event.\n */\n ignoreTarget(node) {\n // Check whether the clicked element is, a child of, an input element/link.\n return node.matches(\n \"a[href], a[href] *, input, textarea, button, button *, select, option\"\n );\n }\n\n #onMouseDown(event) {\n if (event.button !== 0 || this.ignoreTarget(event.target)) {\n return;\n }\n if (event.originalTarget) {\n try {\n // eslint-disable-next-line no-unused-expressions\n event.originalTarget.tagName;\n } catch (e) {\n // Mozilla-specific: element is a scrollbar (XUL element)\n return;\n }\n }\n\n this.scrollLeftStart = this.element.scrollLeft;\n this.scrollTopStart = this.element.scrollTop;\n this.clientXStart = event.clientX;\n this.clientYStart = event.clientY;\n this.document.addEventListener(\"mousemove\", this._onMouseMove, true);\n this.document.addEventListener(\"mouseup\", this._endPan, true);\n // When a scroll event occurs before a mousemove, assume that the user\n // dragged a scrollbar (necessary for Opera Presto, Safari and IE)\n // (not needed for Chrome/Firefox)\n this.element.addEventListener(\"scroll\", this._endPan, true);\n event.preventDefault();\n event.stopPropagation();\n\n const focusedElement = document.activeElement;\n if (focusedElement && !focusedElement.contains(event.target)) {\n focusedElement.blur();\n }\n }\n\n #onMouseMove(event) {\n this.element.removeEventListener(\"scroll\", this._endPan, true);\n if (!(event.buttons & 1)) {\n // The left mouse button is released.\n this._endPan();\n return;\n }\n const xDiff = event.clientX - this.clientXStart;\n const yDiff = event.clientY - this.clientYStart;\n const scrollTop = this.scrollTopStart - yDiff;\n const scrollLeft = this.scrollLeftStart - xDiff;\n if (this.element.scrollTo) {\n this.element.scrollTo({\n top: scrollTop,\n left: scrollLeft,\n behavior: \"instant\",\n });\n } else {\n this.element.scrollTop = scrollTop;\n this.element.scrollLeft = scrollLeft;\n }\n if (!this.overlay.parentNode) {\n document.body.append(this.overlay);\n }\n }\n\n #endPan() {\n this.element.removeEventListener(\"scroll\", this._endPan, true);\n this.document.removeEventListener(\"mousemove\", this._onMouseMove, true);\n this.document.removeEventListener(\"mouseup\", this._endPan, true);\n // Note: ChildNode.remove doesn't throw if the parentNode is undefined.\n this.overlay.remove();\n }\n}\n\nexport { GrabToPan };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createPromiseCapability, PDFDateString } from \"pdfjs-lib\";\nimport { getPageSizeInches, isPortraitOrientation } from \"./ui_utils.js\";\n\nconst DEFAULT_FIELD_CONTENT = \"-\";\n\n// See https://en.wikibooks.org/wiki/Lentis/Conversion_to_the_Metric_Standard_in_the_United_States\nconst NON_METRIC_LOCALES = [\"en-us\", \"en-lr\", \"my\"];\n\n// Should use the format: `width x height`, in portrait orientation.\n// See https://en.wikipedia.org/wiki/Paper_size\nconst US_PAGE_NAMES = {\n \"8.5x11\": \"Letter\",\n \"8.5x14\": \"Legal\",\n};\nconst METRIC_PAGE_NAMES = {\n \"297x420\": \"A3\",\n \"210x297\": \"A4\",\n};\n\nfunction getPageName(size, isPortrait, pageNames) {\n const width = isPortrait ? size.width : size.height;\n const height = isPortrait ? size.height : size.width;\n\n return pageNames[`${width}x${height}`];\n}\n\n/**\n * @typedef {Object} PDFDocumentPropertiesOptions\n * @property {HTMLDialogElement} dialog - The overlay's DOM element.\n * @property {Object} fields - Names and elements of the overlay's fields.\n * @property {HTMLButtonElement} closeButton - Button for closing the overlay.\n */\n\nclass PDFDocumentProperties {\n #fieldData = null;\n\n /**\n * @param {PDFDocumentPropertiesOptions} options\n * @param {OverlayManager} overlayManager - Manager for the viewer overlays.\n * @param {EventBus} eventBus - The application event bus.\n * @param {IL10n} l10n - Localization service.\n * @param {function} fileNameLookup - The function that is used to lookup\n * the document fileName.\n */\n constructor(\n { dialog, fields, closeButton },\n overlayManager,\n eventBus,\n l10n,\n fileNameLookup\n ) {\n this.dialog = dialog;\n this.fields = fields;\n this.overlayManager = overlayManager;\n this.l10n = l10n;\n this._fileNameLookup = fileNameLookup;\n\n this.#reset();\n // Bind the event listener for the Close button.\n closeButton.addEventListener(\"click\", this.close.bind(this));\n\n this.overlayManager.register(this.dialog);\n\n eventBus._on(\"pagechanging\", evt => {\n this._currentPageNumber = evt.pageNumber;\n });\n eventBus._on(\"rotationchanging\", evt => {\n this._pagesRotation = evt.pagesRotation;\n });\n\n this._isNonMetricLocale = true; // The default viewer locale is 'en-us'.\n l10n.getLanguage().then(locale => {\n this._isNonMetricLocale = NON_METRIC_LOCALES.includes(locale);\n });\n }\n\n /**\n * Open the document properties overlay.\n */\n async open() {\n await Promise.all([\n this.overlayManager.open(this.dialog),\n this._dataAvailableCapability.promise,\n ]);\n const currentPageNumber = this._currentPageNumber;\n const pagesRotation = this._pagesRotation;\n\n // If the document properties were previously fetched (for this PDF file),\n // just update the dialog immediately to avoid redundant lookups.\n if (\n this.#fieldData &&\n currentPageNumber === this.#fieldData._currentPageNumber &&\n pagesRotation === this.#fieldData._pagesRotation\n ) {\n this.#updateUI();\n return;\n }\n\n // Get the document properties.\n const {\n info,\n /* metadata, */\n /* contentDispositionFilename, */\n contentLength,\n } = await this.pdfDocument.getMetadata();\n\n const [\n fileName,\n fileSize,\n creationDate,\n modificationDate,\n pageSize,\n isLinearized,\n ] = await Promise.all([\n this._fileNameLookup(),\n this.#parseFileSize(contentLength),\n this.#parseDate(info.CreationDate),\n this.#parseDate(info.ModDate),\n this.pdfDocument.getPage(currentPageNumber).then(pdfPage => {\n return this.#parsePageSize(getPageSizeInches(pdfPage), pagesRotation);\n }),\n this.#parseLinearization(info.IsLinearized),\n ]);\n\n this.#fieldData = Object.freeze({\n fileName,\n fileSize,\n title: info.Title,\n author: info.Author,\n subject: info.Subject,\n keywords: info.Keywords,\n creationDate,\n modificationDate,\n creator: info.Creator,\n producer: info.Producer,\n version: info.PDFFormatVersion,\n pageCount: this.pdfDocument.numPages,\n pageSize,\n linearized: isLinearized,\n _currentPageNumber: currentPageNumber,\n _pagesRotation: pagesRotation,\n });\n this.#updateUI();\n\n // Get the correct fileSize, since it may not have been available\n // or could potentially be wrong.\n const { length } = await this.pdfDocument.getDownloadInfo();\n if (contentLength === length) {\n return; // The fileSize has already been correctly set.\n }\n const data = Object.assign(Object.create(null), this.#fieldData);\n data.fileSize = await this.#parseFileSize(length);\n\n this.#fieldData = Object.freeze(data);\n this.#updateUI();\n }\n\n /**\n * Close the document properties overlay.\n */\n async close() {\n this.overlayManager.close(this.dialog);\n }\n\n /**\n * Set a reference to the PDF document in order to populate the dialog fields\n * with the document properties. Note that the dialog will contain no\n * information if this method is not called.\n *\n * @param {PDFDocumentProxy} pdfDocument - A reference to the PDF document.\n */\n setDocument(pdfDocument) {\n if (this.pdfDocument) {\n this.#reset();\n this.#updateUI(true);\n }\n if (!pdfDocument) {\n return;\n }\n this.pdfDocument = pdfDocument;\n\n this._dataAvailableCapability.resolve();\n }\n\n #reset() {\n this.pdfDocument = null;\n\n this.#fieldData = null;\n this._dataAvailableCapability = createPromiseCapability();\n this._currentPageNumber = 1;\n this._pagesRotation = 0;\n }\n\n /**\n * Always updates all of the dialog fields, to prevent inconsistent UI state.\n * NOTE: If the contents of a particular field is neither a non-empty string,\n * nor a number, it will fall back to `DEFAULT_FIELD_CONTENT`.\n */\n #updateUI(reset = false) {\n if (reset || !this.#fieldData) {\n for (const id in this.fields) {\n this.fields[id].textContent = DEFAULT_FIELD_CONTENT;\n }\n return;\n }\n if (this.overlayManager.active !== this.dialog) {\n // Don't bother updating the dialog if has already been closed,\n // since it will be updated the next time `this.open` is called.\n return;\n }\n for (const id in this.fields) {\n const content = this.#fieldData[id];\n this.fields[id].textContent =\n content || content === 0 ? content : DEFAULT_FIELD_CONTENT;\n }\n }\n\n async #parseFileSize(fileSize = 0) {\n const kb = fileSize / 1024,\n mb = kb / 1024;\n if (!kb) {\n return undefined;\n }\n return this.l10n.get(`document_properties_${mb >= 1 ? \"mb\" : \"kb\"}`, {\n size_mb: mb >= 1 && (+mb.toPrecision(3)).toLocaleString(),\n size_kb: mb < 1 && (+kb.toPrecision(3)).toLocaleString(),\n size_b: fileSize.toLocaleString(),\n });\n }\n\n async #parsePageSize(pageSizeInches, pagesRotation) {\n if (!pageSizeInches) {\n return undefined;\n }\n // Take the viewer rotation into account as well; compare with Adobe Reader.\n if (pagesRotation % 180 !== 0) {\n pageSizeInches = {\n width: pageSizeInches.height,\n height: pageSizeInches.width,\n };\n }\n const isPortrait = isPortraitOrientation(pageSizeInches);\n\n let sizeInches = {\n width: Math.round(pageSizeInches.width * 100) / 100,\n height: Math.round(pageSizeInches.height * 100) / 100,\n };\n // 1in == 25.4mm; no need to round to 2 decimals for millimeters.\n let sizeMillimeters = {\n width: Math.round(pageSizeInches.width * 25.4 * 10) / 10,\n height: Math.round(pageSizeInches.height * 25.4 * 10) / 10,\n };\n\n let rawName =\n getPageName(sizeInches, isPortrait, US_PAGE_NAMES) ||\n getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES);\n\n if (\n !rawName &&\n !(\n Number.isInteger(sizeMillimeters.width) &&\n Number.isInteger(sizeMillimeters.height)\n )\n ) {\n // Attempt to improve the page name detection by falling back to fuzzy\n // matching of the metric dimensions, to account for e.g. rounding errors\n // and/or PDF files that define the page sizes in an imprecise manner.\n const exactMillimeters = {\n width: pageSizeInches.width * 25.4,\n height: pageSizeInches.height * 25.4,\n };\n const intMillimeters = {\n width: Math.round(sizeMillimeters.width),\n height: Math.round(sizeMillimeters.height),\n };\n\n // Try to avoid false positives, by only considering \"small\" differences.\n if (\n Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 &&\n Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1\n ) {\n rawName = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES);\n if (rawName) {\n // Update *both* sizes, computed above, to ensure that the displayed\n // dimensions always correspond to the detected page name.\n sizeInches = {\n width: Math.round((intMillimeters.width / 25.4) * 100) / 100,\n height: Math.round((intMillimeters.height / 25.4) * 100) / 100,\n };\n sizeMillimeters = intMillimeters;\n }\n }\n }\n\n const [{ width, height }, unit, name, orientation] = await Promise.all([\n this._isNonMetricLocale ? sizeInches : sizeMillimeters,\n this.l10n.get(\n `document_properties_page_size_unit_${\n this._isNonMetricLocale ? \"inches\" : \"millimeters\"\n }`\n ),\n rawName &&\n this.l10n.get(\n `document_properties_page_size_name_${rawName.toLowerCase()}`\n ),\n this.l10n.get(\n `document_properties_page_size_orientation_${\n isPortrait ? \"portrait\" : \"landscape\"\n }`\n ),\n ]);\n\n return this.l10n.get(\n `document_properties_page_size_dimension_${name ? \"name_\" : \"\"}string`,\n {\n width: width.toLocaleString(),\n height: height.toLocaleString(),\n unit,\n name,\n orientation,\n }\n );\n }\n\n async #parseDate(inputDate) {\n const dateObject = PDFDateString.toDateObject(inputDate);\n if (!dateObject) {\n return undefined;\n }\n return this.l10n.get(\"document_properties_date_string\", {\n date: dateObject.toLocaleDateString(),\n time: dateObject.toLocaleTimeString(),\n });\n }\n\n #parseLinearization(isLinearized) {\n return this.l10n.get(\n `document_properties_linearized_${isLinearized ? \"yes\" : \"no\"}`\n );\n }\n}\n\nexport { PDFDocumentProperties };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FindState } from \"./pdf_find_controller.js\";\n\nconst MATCHES_COUNT_LIMIT = 1000;\n\n/**\n * Creates a \"search bar\" given a set of DOM elements that act as controls\n * for searching or for setting search preferences in the UI. This object\n * also sets up the appropriate events for the controls. Actual searching\n * is done by PDFFindController.\n */\nclass PDFFindBar {\n constructor(options, eventBus, l10n) {\n this.opened = false;\n\n this.bar = options.bar;\n this.toggleButton = options.toggleButton;\n this.findField = options.findField;\n this.highlightAll = options.highlightAllCheckbox;\n this.caseSensitive = options.caseSensitiveCheckbox;\n this.matchDiacritics = options.matchDiacriticsCheckbox;\n this.entireWord = options.entireWordCheckbox;\n this.findMsg = options.findMsg;\n this.findResultsCount = options.findResultsCount;\n this.findPreviousButton = options.findPreviousButton;\n this.findNextButton = options.findNextButton;\n this.eventBus = eventBus;\n this.l10n = l10n;\n\n // Add event listeners to the DOM elements.\n this.toggleButton.addEventListener(\"click\", () => {\n this.toggle();\n });\n\n this.findField.addEventListener(\"input\", () => {\n this.dispatchEvent(\"\");\n });\n\n this.bar.addEventListener(\"keydown\", e => {\n switch (e.keyCode) {\n case 13: // Enter\n if (e.target === this.findField) {\n this.dispatchEvent(\"again\", e.shiftKey);\n }\n break;\n case 27: // Escape\n this.close();\n break;\n }\n });\n\n this.findPreviousButton.addEventListener(\"click\", () => {\n this.dispatchEvent(\"again\", true);\n });\n\n this.findNextButton.addEventListener(\"click\", () => {\n this.dispatchEvent(\"again\", false);\n });\n\n this.highlightAll.addEventListener(\"click\", () => {\n this.dispatchEvent(\"highlightallchange\");\n });\n\n this.caseSensitive.addEventListener(\"click\", () => {\n this.dispatchEvent(\"casesensitivitychange\");\n });\n\n this.entireWord.addEventListener(\"click\", () => {\n this.dispatchEvent(\"entirewordchange\");\n });\n\n this.matchDiacritics.addEventListener(\"click\", () => {\n this.dispatchEvent(\"diacriticmatchingchange\");\n });\n\n this.eventBus._on(\"resize\", this.#adjustWidth.bind(this));\n }\n\n reset() {\n this.updateUIState();\n }\n\n dispatchEvent(type, findPrev = false) {\n this.eventBus.dispatch(\"find\", {\n source: this,\n type,\n query: this.findField.value,\n phraseSearch: true,\n caseSensitive: this.caseSensitive.checked,\n entireWord: this.entireWord.checked,\n highlightAll: this.highlightAll.checked,\n findPrevious: findPrev,\n matchDiacritics: this.matchDiacritics.checked,\n });\n }\n\n updateUIState(state, previous, matchesCount) {\n let findMsg = Promise.resolve(\"\");\n let status = \"\";\n\n switch (state) {\n case FindState.FOUND:\n break;\n case FindState.PENDING:\n status = \"pending\";\n break;\n case FindState.NOT_FOUND:\n findMsg = this.l10n.get(\"find_not_found\");\n status = \"notFound\";\n break;\n case FindState.WRAPPED:\n findMsg = this.l10n.get(`find_reached_${previous ? \"top\" : \"bottom\"}`);\n break;\n }\n this.findField.setAttribute(\"data-status\", status);\n this.findField.setAttribute(\"aria-invalid\", state === FindState.NOT_FOUND);\n\n findMsg.then(msg => {\n this.findMsg.textContent = msg;\n this.#adjustWidth();\n });\n\n this.updateResultsCount(matchesCount);\n }\n\n updateResultsCount({ current = 0, total = 0 } = {}) {\n const limit = MATCHES_COUNT_LIMIT;\n let matchCountMsg = Promise.resolve(\"\");\n\n if (total > 0) {\n if (total > limit) {\n let key = \"find_match_count_limit\";\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n // TODO: Remove this hard-coded `[other]` form once plural support has\n // been implemented in the mozilla-central specific `l10n.js` file.\n key += \"[other]\";\n }\n matchCountMsg = this.l10n.get(key, { limit });\n } else {\n let key = \"find_match_count\";\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n // TODO: Remove this hard-coded `[other]` form once plural support has\n // been implemented in the mozilla-central specific `l10n.js` file.\n key += \"[other]\";\n }\n matchCountMsg = this.l10n.get(key, { current, total });\n }\n }\n matchCountMsg.then(msg => {\n this.findResultsCount.textContent = msg;\n // Since `updateResultsCount` may be called from `PDFFindController`,\n // ensure that the width of the findbar is always updated correctly.\n this.#adjustWidth();\n });\n }\n\n open() {\n if (!this.opened) {\n this.opened = true;\n this.toggleButton.classList.add(\"toggled\");\n this.toggleButton.setAttribute(\"aria-expanded\", \"true\");\n this.bar.classList.remove(\"hidden\");\n }\n this.findField.select();\n this.findField.focus();\n\n this.#adjustWidth();\n }\n\n close() {\n if (!this.opened) {\n return;\n }\n this.opened = false;\n this.toggleButton.classList.remove(\"toggled\");\n this.toggleButton.setAttribute(\"aria-expanded\", \"false\");\n this.bar.classList.add(\"hidden\");\n\n this.eventBus.dispatch(\"findbarclose\", { source: this });\n }\n\n toggle() {\n if (this.opened) {\n this.close();\n } else {\n this.open();\n }\n }\n\n #adjustWidth() {\n if (!this.opened) {\n return;\n }\n\n // The find bar has an absolute position and thus the browser extends\n // its width to the maximum possible width once the find bar does not fit\n // entirely within the window anymore (and its elements are automatically\n // wrapped). Here we detect and fix that.\n this.bar.classList.remove(\"wrapContainers\");\n\n const findbarHeight = this.bar.clientHeight;\n const inputContainerHeight = this.bar.firstElementChild.clientHeight;\n\n if (findbarHeight > inputContainerHeight) {\n // The findbar is taller than the input container, which means that\n // the browser wrapped some of the elements. For a consistent look,\n // wrap all of them to adjust the width of the find bar.\n this.bar.classList.add(\"wrapContainers\");\n }\n }\n}\n\nexport { PDFFindBar };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFDocumentProxy} PDFDocumentProxy */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { binarySearchFirstItem, scrollIntoView } from \"./ui_utils.js\";\nimport { createPromiseCapability } from \"pdfjs-lib\";\nimport { getCharacterType } from \"./pdf_find_utils.js\";\n\nconst FindState = {\n FOUND: 0,\n NOT_FOUND: 1,\n WRAPPED: 2,\n PENDING: 3,\n};\n\nconst FIND_TIMEOUT = 250; // ms\nconst MATCH_SCROLL_OFFSET_TOP = -50; // px\nconst MATCH_SCROLL_OFFSET_LEFT = -400; // px\n\nconst CHARACTERS_TO_NORMALIZE = {\n \"\\u2010\": \"-\", // Hyphen\n \"\\u2018\": \"'\", // Left single quotation mark\n \"\\u2019\": \"'\", // Right single quotation mark\n \"\\u201A\": \"'\", // Single low-9 quotation mark\n \"\\u201B\": \"'\", // Single high-reversed-9 quotation mark\n \"\\u201C\": '\"', // Left double quotation mark\n \"\\u201D\": '\"', // Right double quotation mark\n \"\\u201E\": '\"', // Double low-9 quotation mark\n \"\\u201F\": '\"', // Double high-reversed-9 quotation mark\n \"\\u00BC\": \"1/4\", // Vulgar fraction one quarter\n \"\\u00BD\": \"1/2\", // Vulgar fraction one half\n \"\\u00BE\": \"3/4\", // Vulgar fraction three quarters\n};\n\n// These diacritics aren't considered as combining diacritics\n// when searching in a document:\n// https://searchfox.org/mozilla-central/source/intl/unicharutil/util/is_combining_diacritic.py.\n// The combining class definitions can be found:\n// https://www.unicode.org/reports/tr44/#Canonical_Combining_Class_Values\n// Category 0 corresponds to [^\\p{Mn}].\nconst DIACRITICS_EXCEPTION = new Set([\n // UNICODE_COMBINING_CLASS_KANA_VOICING\n // https://www.compart.com/fr/unicode/combining/8\n 0x3099, 0x309a,\n // UNICODE_COMBINING_CLASS_VIRAMA (under 0xFFFF)\n // https://www.compart.com/fr/unicode/combining/9\n 0x094d, 0x09cd, 0x0a4d, 0x0acd, 0x0b4d, 0x0bcd, 0x0c4d, 0x0ccd, 0x0d3b,\n 0x0d3c, 0x0d4d, 0x0dca, 0x0e3a, 0x0eba, 0x0f84, 0x1039, 0x103a, 0x1714,\n 0x1734, 0x17d2, 0x1a60, 0x1b44, 0x1baa, 0x1bab, 0x1bf2, 0x1bf3, 0x2d7f,\n 0xa806, 0xa82c, 0xa8c4, 0xa953, 0xa9c0, 0xaaf6, 0xabed,\n // 91\n // https://www.compart.com/fr/unicode/combining/91\n 0x0c56,\n // 129\n // https://www.compart.com/fr/unicode/combining/129\n 0x0f71,\n // 130\n // https://www.compart.com/fr/unicode/combining/130\n 0x0f72, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f80,\n // 132\n // https://www.compart.com/fr/unicode/combining/132\n 0x0f74,\n]);\nlet DIACRITICS_EXCEPTION_STR; // Lazily initialized, see below.\n\nconst DIACRITICS_REG_EXP = /\\p{M}+/gu;\nconst SPECIAL_CHARS_REG_EXP =\n /([.*+?^${}()|[\\]\\\\])|(\\p{P})|(\\s+)|(\\p{M})|(\\p{L})/gu;\nconst NOT_DIACRITIC_FROM_END_REG_EXP = /([^\\p{M}])\\p{M}*$/u;\nconst NOT_DIACRITIC_FROM_START_REG_EXP = /^\\p{M}*([^\\p{M}])/u;\n\n// The range [AC00-D7AF] corresponds to the Hangul syllables.\n// The few other chars are some CJK Compatibility Ideographs.\nconst SYLLABLES_REG_EXP = /[\\uAC00-\\uD7AF\\uFA6C\\uFACF-\\uFAD1\\uFAD5-\\uFAD7]+/g;\nconst SYLLABLES_LENGTHS = new Map();\n// When decomposed (in using NFD) the above syllables will start\n// with one of the chars in this regexp.\nconst FIRST_CHAR_SYLLABLES_REG_EXP =\n \"[\\\\u1100-\\\\u1112\\\\ud7a4-\\\\ud7af\\\\ud84a\\\\ud84c\\\\ud850\\\\ud854\\\\ud857\\\\ud85f]\";\n\nconst NFKC_CHARS_TO_NORMALIZE = new Map();\n\nlet noSyllablesRegExp = null;\nlet withSyllablesRegExp = null;\n\nfunction normalize(text) {\n // The diacritics in the text or in the query can be composed or not.\n // So we use a decomposed text using NFD (and the same for the query)\n // in order to be sure that diacritics are in the same order.\n\n // Collect syllables length and positions.\n const syllablePositions = [];\n let m;\n while ((m = SYLLABLES_REG_EXP.exec(text)) !== null) {\n let { index } = m;\n for (const char of m[0]) {\n let len = SYLLABLES_LENGTHS.get(char);\n if (!len) {\n len = char.normalize(\"NFD\").length;\n SYLLABLES_LENGTHS.set(char, len);\n }\n syllablePositions.push([len, index++]);\n }\n }\n\n let normalizationRegex;\n if (syllablePositions.length === 0 && noSyllablesRegExp) {\n normalizationRegex = noSyllablesRegExp;\n } else if (syllablePositions.length > 0 && withSyllablesRegExp) {\n normalizationRegex = withSyllablesRegExp;\n } else {\n // Compile the regular expression for text normalization once.\n const replace = Object.keys(CHARACTERS_TO_NORMALIZE).join(\"\");\n const toNormalizeWithNFKC =\n \"\\u2460-\\u2473\" + // Circled numbers.\n \"\\u24b6-\\u24ff\" + // Circled letters/numbers.\n \"\\u3244-\\u32bf\" + // Circled ideograms/numbers.\n \"\\u32d0-\\u32fe\" + // Circled ideograms.\n \"\\uff00-\\uffef\"; // Halfwidth, fullwidth forms.\n\n // 3040-309F: Hiragana\n // 30A0-30FF: Katakana\n const CJK = \"(?:\\\\p{Ideographic}|[\\u3040-\\u30FF])\";\n const HKDiacritics = \"(?:\\u3099|\\u309A)\";\n const regexp = `([${replace}])|([${toNormalizeWithNFKC}])|(${HKDiacritics}\\\\n)|(\\\\p{M}+(?:-\\\\n)?)|(\\\\S-\\\\n)|(${CJK}\\\\n)|(\\\\n)`;\n\n if (syllablePositions.length === 0) {\n // Most of the syllables belong to Hangul so there are no need\n // to search for them in a non-Hangul document.\n // We use the \\0 in order to have the same number of groups.\n normalizationRegex = noSyllablesRegExp = new RegExp(\n regexp + \"|(\\\\u0000)\",\n \"gum\"\n );\n } else {\n normalizationRegex = withSyllablesRegExp = new RegExp(\n regexp + `|(${FIRST_CHAR_SYLLABLES_REG_EXP})`,\n \"gum\"\n );\n }\n }\n\n // The goal of this function is to normalize the string and\n // be able to get from an index in the new string the\n // corresponding index in the old string.\n // For example if we have: abCd12ef456gh where C is replaced by ccc\n // and numbers replaced by nothing (it's the case for diacritics), then\n // we'll obtain the normalized string: abcccdefgh.\n // So here the reverse map is: [0,1,2,2,2,3,6,7,11,12].\n\n // The goal is to obtain the array: [[0, 0], [3, -1], [4, -2],\n // [6, 0], [8, 3]].\n // which can be used like this:\n // - let say that i is the index in new string and j the index\n // the old string.\n // - if i is in [0; 3[ then j = i + 0\n // - if i is in [3; 4[ then j = i - 1\n // - if i is in [4; 6[ then j = i - 2\n // ...\n // Thanks to a binary search it's easy to know where is i and what's the\n // shift.\n // Let say that the last entry in the array is [x, s] and we have a\n // substitution at index y (old string) which will replace o chars by n chars.\n // Firstly, if o === n, then no need to add a new entry: the shift is\n // the same.\n // Secondly, if o < n, then we push the n - o elements:\n // [y - (s - 1), s - 1], [y - (s - 2), s - 2], ...\n // Thirdly, if o > n, then we push the element: [y - (s - n), o + s - n]\n\n // Collect diacritics length and positions.\n const rawDiacriticsPositions = [];\n while ((m = DIACRITICS_REG_EXP.exec(text)) !== null) {\n rawDiacriticsPositions.push([m[0].length, m.index]);\n }\n\n let normalized = text.normalize(\"NFD\");\n const positions = [[0, 0]];\n let rawDiacriticsIndex = 0;\n let syllableIndex = 0;\n let shift = 0;\n let shiftOrigin = 0;\n let eol = 0;\n let hasDiacritics = false;\n\n normalized = normalized.replace(\n normalizationRegex,\n (match, p1, p2, p3, p4, p5, p6, p7, p8, i) => {\n i -= shiftOrigin;\n if (p1) {\n // Maybe fractions or quotations mark...\n const replacement = CHARACTERS_TO_NORMALIZE[p1];\n const jj = replacement.length;\n for (let j = 1; j < jj; j++) {\n positions.push([i - shift + j, shift - j]);\n }\n shift -= jj - 1;\n return replacement;\n }\n\n if (p2) {\n // Use the NFKC representation to normalize the char.\n let replacement = NFKC_CHARS_TO_NORMALIZE.get(p2);\n if (!replacement) {\n replacement = p2.normalize(\"NFKC\");\n NFKC_CHARS_TO_NORMALIZE.set(p2, replacement);\n }\n const jj = replacement.length;\n for (let j = 1; j < jj; j++) {\n positions.push([i - shift + j, shift - j]);\n }\n shift -= jj - 1;\n return replacement;\n }\n\n if (p3) {\n // We've a Katakana-Hiragana diacritic followed by a \\n so don't replace\n // the \\n by a whitespace.\n hasDiacritics = true;\n\n // Diacritic.\n if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) {\n ++rawDiacriticsIndex;\n } else {\n // i is the position of the first diacritic\n // so (i - 1) is the position for the letter before.\n positions.push([i - 1 - shift + 1, shift - 1]);\n shift -= 1;\n shiftOrigin += 1;\n }\n\n // End-of-line.\n positions.push([i - shift + 1, shift]);\n shiftOrigin += 1;\n eol += 1;\n\n return p3.charAt(0);\n }\n\n if (p4) {\n const hasTrailingDashEOL = p4.endsWith(\"\\n\");\n const len = hasTrailingDashEOL ? p4.length - 2 : p4.length;\n\n // Diacritics.\n hasDiacritics = true;\n let jj = len;\n if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) {\n jj -= rawDiacriticsPositions[rawDiacriticsIndex][0];\n ++rawDiacriticsIndex;\n }\n\n for (let j = 1; j <= jj; j++) {\n // i is the position of the first diacritic\n // so (i - 1) is the position for the letter before.\n positions.push([i - 1 - shift + j, shift - j]);\n }\n shift -= jj;\n shiftOrigin += jj;\n\n if (hasTrailingDashEOL) {\n // Diacritics are followed by a -\\n.\n // See comments in `if (p5)` block.\n i += len - 1;\n positions.push([i - shift + 1, 1 + shift]);\n shift += 1;\n shiftOrigin += 1;\n eol += 1;\n return p4.slice(0, len);\n }\n\n return p4;\n }\n\n if (p5) {\n // \"X-\\n\" is removed because an hyphen at the end of a line\n // with not a space before is likely here to mark a break\n // in a word.\n // If X is encoded with UTF-32 then it can have a length greater than 1.\n // The \\n isn't in the original text so here y = i, n = X.len - 2 and\n // o = X.len - 1.\n const len = p5.length - 2;\n positions.push([i - shift + len, 1 + shift]);\n shift += 1;\n shiftOrigin += 1;\n eol += 1;\n return p5.slice(0, -2);\n }\n\n if (p6) {\n // An ideographic at the end of a line doesn't imply adding an extra\n // white space.\n // A CJK can be encoded in UTF-32, hence their length isn't always 1.\n const len = p6.length - 1;\n positions.push([i - shift + len, shift]);\n shiftOrigin += 1;\n eol += 1;\n return p6.slice(0, -1);\n }\n\n if (p7) {\n // eol is replaced by space: \"foo\\nbar\" is likely equivalent to\n // \"foo bar\".\n positions.push([i - shift + 1, shift - 1]);\n shift -= 1;\n shiftOrigin += 1;\n eol += 1;\n return \" \";\n }\n\n // p8\n if (i + eol === syllablePositions[syllableIndex]?.[1]) {\n // A syllable (1 char) is replaced with several chars (n) so\n // newCharsLen = n - 1.\n const newCharLen = syllablePositions[syllableIndex][0] - 1;\n ++syllableIndex;\n for (let j = 1; j <= newCharLen; j++) {\n positions.push([i - (shift - j), shift - j]);\n }\n shift -= newCharLen;\n shiftOrigin += newCharLen;\n }\n return p8;\n }\n );\n\n positions.push([normalized.length, shift]);\n\n return [normalized, positions, hasDiacritics];\n}\n\n// Determine the original, non-normalized, match index such that highlighting of\n// search results is correct in the `textLayer` for strings containing e.g. \"½\"\n// characters; essentially \"inverting\" the result of the `normalize` function.\nfunction getOriginalIndex(diffs, pos, len) {\n if (!diffs) {\n return [pos, len];\n }\n\n const start = pos;\n const end = pos + len;\n let i = binarySearchFirstItem(diffs, x => x[0] >= start);\n if (diffs[i][0] > start) {\n --i;\n }\n\n let j = binarySearchFirstItem(diffs, x => x[0] >= end, i);\n if (diffs[j][0] > end) {\n --j;\n }\n\n return [start + diffs[i][1], len + diffs[j][1] - diffs[i][1]];\n}\n\n/**\n * @typedef {Object} PDFFindControllerOptions\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {EventBus} eventBus - The application event bus.\n * @property {boolean} [updateMatchesCountOnProgress] - True if the matches\n * count must be updated on progress or only when the last page is reached.\n * The default value is `true`.\n */\n\n/**\n * Provides search functionality to find a given string in a PDF document.\n */\nclass PDFFindController {\n #updateMatchesCountOnProgress = true;\n\n #visitedPagesCount = 0;\n\n /**\n * @param {PDFFindControllerOptions} options\n */\n constructor({ linkService, eventBus, updateMatchesCountOnProgress = true }) {\n this._linkService = linkService;\n this._eventBus = eventBus;\n this.#updateMatchesCountOnProgress = updateMatchesCountOnProgress;\n\n this.#reset();\n eventBus._on(\"find\", this.#onFind.bind(this));\n eventBus._on(\"findbarclose\", this.#onFindBarClose.bind(this));\n }\n\n get highlightMatches() {\n return this._highlightMatches;\n }\n\n get pageMatches() {\n return this._pageMatches;\n }\n\n get pageMatchesLength() {\n return this._pageMatchesLength;\n }\n\n get selected() {\n return this._selected;\n }\n\n get state() {\n return this._state;\n }\n\n /**\n * Set a reference to the PDF document in order to search it.\n * Note that searching is not possible if this method is not called.\n *\n * @param {PDFDocumentProxy} pdfDocument - The PDF document to search.\n */\n setDocument(pdfDocument) {\n if (this._pdfDocument) {\n this.#reset();\n }\n if (!pdfDocument) {\n return;\n }\n this._pdfDocument = pdfDocument;\n this._firstPageCapability.resolve();\n }\n\n #onFind(state) {\n if (!state) {\n return;\n }\n const pdfDocument = this._pdfDocument;\n const { type } = state;\n\n if (this._state === null || this.#shouldDirtyMatch(state)) {\n this._dirtyMatch = true;\n }\n this._state = state;\n if (type !== \"highlightallchange\") {\n this.#updateUIState(FindState.PENDING);\n }\n\n this._firstPageCapability.promise.then(() => {\n // If the document was closed before searching began, or if the search\n // operation was relevant for a previously opened document, do nothing.\n if (\n !this._pdfDocument ||\n (pdfDocument && this._pdfDocument !== pdfDocument)\n ) {\n return;\n }\n this.#extractText();\n\n const findbarClosed = !this._highlightMatches;\n const pendingTimeout = !!this._findTimeout;\n\n if (this._findTimeout) {\n clearTimeout(this._findTimeout);\n this._findTimeout = null;\n }\n if (!type) {\n // Trigger the find action with a small delay to avoid starting the\n // search when the user is still typing (saving resources).\n this._findTimeout = setTimeout(() => {\n this.#nextMatch();\n this._findTimeout = null;\n }, FIND_TIMEOUT);\n } else if (this._dirtyMatch) {\n // Immediately trigger searching for non-'find' operations, when the\n // current state needs to be reset and matches re-calculated.\n this.#nextMatch();\n } else if (type === \"again\") {\n this.#nextMatch();\n\n // When the findbar was previously closed, and `highlightAll` is set,\n // ensure that the matches on all active pages are highlighted again.\n if (findbarClosed && this._state.highlightAll) {\n this.#updateAllPages();\n }\n } else if (type === \"highlightallchange\") {\n // If there was a pending search operation, synchronously trigger a new\n // search *first* to ensure that the correct matches are highlighted.\n if (pendingTimeout) {\n this.#nextMatch();\n } else {\n this._highlightMatches = true;\n }\n this.#updateAllPages(); // Update the highlighting on all active pages.\n } else {\n this.#nextMatch();\n }\n });\n }\n\n scrollMatchIntoView({\n element = null,\n selectedLeft = 0,\n pageIndex = -1,\n matchIndex = -1,\n }) {\n if (!this._scrollMatches || !element) {\n return;\n } else if (matchIndex === -1 || matchIndex !== this._selected.matchIdx) {\n return;\n } else if (pageIndex === -1 || pageIndex !== this._selected.pageIdx) {\n return;\n }\n this._scrollMatches = false; // Ensure that scrolling only happens once.\n\n const spot = {\n top: MATCH_SCROLL_OFFSET_TOP,\n left: selectedLeft + MATCH_SCROLL_OFFSET_LEFT,\n };\n scrollIntoView(element, spot, /* scrollMatches = */ true);\n }\n\n #reset() {\n this._highlightMatches = false;\n this._scrollMatches = false;\n this._pdfDocument = null;\n this._pageMatches = [];\n this._pageMatchesLength = [];\n this.#visitedPagesCount = 0;\n this._state = null;\n // Currently selected match.\n this._selected = {\n pageIdx: -1,\n matchIdx: -1,\n };\n // Where the find algorithm currently is in the document.\n this._offset = {\n pageIdx: null,\n matchIdx: null,\n wrapped: false,\n };\n this._extractTextPromises = [];\n this._pageContents = []; // Stores the normalized text for each page.\n this._pageDiffs = [];\n this._hasDiacritics = [];\n this._matchesCountTotal = 0;\n this._pagesToSearch = null;\n this._pendingFindMatches = new Set();\n this._resumePageIdx = null;\n this._dirtyMatch = false;\n clearTimeout(this._findTimeout);\n this._findTimeout = null;\n\n this._firstPageCapability = createPromiseCapability();\n }\n\n /**\n * @type {string} The (current) normalized search query.\n */\n get #query() {\n if (this._state.query !== this._rawQuery) {\n this._rawQuery = this._state.query;\n [this._normalizedQuery] = normalize(this._state.query);\n }\n return this._normalizedQuery;\n }\n\n #shouldDirtyMatch(state) {\n // When the search query changes, regardless of the actual search command\n // used, always re-calculate matches to avoid errors (fixes bug 1030622).\n if (state.query !== this._state.query) {\n return true;\n }\n switch (state.type) {\n case \"again\":\n const pageNumber = this._selected.pageIdx + 1;\n const linkService = this._linkService;\n // Only treat a 'findagain' event as a new search operation when it's\n // *absolutely* certain that the currently selected match is no longer\n // visible, e.g. as a result of the user scrolling in the document.\n //\n // NOTE: If only a simple `this._linkService.page` check was used here,\n // there's a risk that consecutive 'findagain' operations could \"skip\"\n // over matches at the top/bottom of pages thus making them completely\n // inaccessible when there's multiple pages visible in the viewer.\n if (\n pageNumber >= 1 &&\n pageNumber <= linkService.pagesCount &&\n pageNumber !== linkService.page &&\n !linkService.isPageVisible(pageNumber)\n ) {\n return true;\n }\n return false;\n case \"highlightallchange\":\n return false;\n }\n return true;\n }\n\n /**\n * Determine if the search query constitutes a \"whole word\", by comparing the\n * first/last character type with the preceding/following character type.\n */\n #isEntireWord(content, startIdx, length) {\n let match = content\n .slice(0, startIdx)\n .match(NOT_DIACRITIC_FROM_END_REG_EXP);\n if (match) {\n const first = content.charCodeAt(startIdx);\n const limit = match[1].charCodeAt(0);\n if (getCharacterType(first) === getCharacterType(limit)) {\n return false;\n }\n }\n\n match = content\n .slice(startIdx + length)\n .match(NOT_DIACRITIC_FROM_START_REG_EXP);\n if (match) {\n const last = content.charCodeAt(startIdx + length - 1);\n const limit = match[1].charCodeAt(0);\n if (getCharacterType(last) === getCharacterType(limit)) {\n return false;\n }\n }\n\n return true;\n }\n\n #calculateRegExpMatch(query, entireWord, pageIndex, pageContent) {\n const matches = (this._pageMatches[pageIndex] = []);\n const matchesLength = (this._pageMatchesLength[pageIndex] = []);\n if (!query) {\n // The query can be empty because some chars like diacritics could have\n // been stripped out.\n return;\n }\n const diffs = this._pageDiffs[pageIndex];\n let match;\n while ((match = query.exec(pageContent)) !== null) {\n if (\n entireWord &&\n !this.#isEntireWord(pageContent, match.index, match[0].length)\n ) {\n continue;\n }\n\n const [matchPos, matchLen] = getOriginalIndex(\n diffs,\n match.index,\n match[0].length\n );\n\n if (matchLen) {\n matches.push(matchPos);\n matchesLength.push(matchLen);\n }\n }\n }\n\n #convertToRegExpString(query, hasDiacritics) {\n const { matchDiacritics } = this._state;\n let isUnicode = false;\n query = query.replaceAll(\n SPECIAL_CHARS_REG_EXP,\n (\n match,\n p1 /* to escape */,\n p2 /* punctuation */,\n p3 /* whitespaces */,\n p4 /* diacritics */,\n p5 /* letters */\n ) => {\n // We don't need to use a \\s for whitespaces since all the different\n // kind of whitespaces are replaced by a single \" \".\n\n if (p1) {\n // Escape characters like *+?... to not interfer with regexp syntax.\n return `[ ]*\\\\${p1}[ ]*`;\n }\n if (p2) {\n // Allow whitespaces around punctuation signs.\n return `[ ]*${p2}[ ]*`;\n }\n if (p3) {\n // Replace spaces by \\s+ to be sure to match any spaces.\n return \"[ ]+\";\n }\n if (matchDiacritics) {\n return p4 || p5;\n }\n\n if (p4) {\n // Diacritics are removed with few exceptions.\n return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : \"\";\n }\n\n // A letter has been matched and it can be followed by any diacritics\n // in normalized text.\n if (hasDiacritics) {\n isUnicode = true;\n return `${p5}\\\\p{M}*`;\n }\n return p5;\n }\n );\n\n const trailingSpaces = \"[ ]*\";\n if (query.endsWith(trailingSpaces)) {\n // The [ ]* has been added in order to help to match \"foo . bar\" but\n // it doesn't make sense to match some whitespaces after the dot\n // when it's the last character.\n query = query.slice(0, query.length - trailingSpaces.length);\n }\n\n if (matchDiacritics) {\n // aX must not match aXY.\n if (hasDiacritics) {\n DIACRITICS_EXCEPTION_STR ||= String.fromCharCode(\n ...DIACRITICS_EXCEPTION\n );\n\n isUnicode = true;\n query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\\\p{M}]|$)`;\n }\n }\n\n return [isUnicode, query];\n }\n\n #calculateMatch(pageIndex) {\n let query = this.#query;\n if (!query) {\n // Do nothing: the matches should be wiped out already.\n return;\n }\n\n const { caseSensitive, entireWord, phraseSearch } = this._state;\n const pageContent = this._pageContents[pageIndex];\n const hasDiacritics = this._hasDiacritics[pageIndex];\n\n let isUnicode = false;\n if (phraseSearch) {\n [isUnicode, query] = this.#convertToRegExpString(query, hasDiacritics);\n } else {\n // Words are sorted in reverse order to be sure that \"foobar\" is matched\n // before \"foo\" in case the query is \"foobar foo\".\n const match = query.match(/\\S+/g);\n if (match) {\n query = match\n .sort()\n .reverse()\n .map(q => {\n const [isUnicodePart, queryPart] = this.#convertToRegExpString(\n q,\n hasDiacritics\n );\n isUnicode ||= isUnicodePart;\n return `(${queryPart})`;\n })\n .join(\"|\");\n }\n }\n\n const flags = `g${isUnicode ? \"u\" : \"\"}${caseSensitive ? \"\" : \"i\"}`;\n query = query ? new RegExp(query, flags) : null;\n\n this.#calculateRegExpMatch(query, entireWord, pageIndex, pageContent);\n\n // When `highlightAll` is set, ensure that the matches on previously\n // rendered (and still active) pages are correctly highlighted.\n if (this._state.highlightAll) {\n this.#updatePage(pageIndex);\n }\n if (this._resumePageIdx === pageIndex) {\n this._resumePageIdx = null;\n this.#nextPageMatch();\n }\n\n // Update the match count.\n const pageMatchesCount = this._pageMatches[pageIndex].length;\n this._matchesCountTotal += pageMatchesCount;\n if (this.#updateMatchesCountOnProgress) {\n if (pageMatchesCount > 0) {\n this.#updateUIResultsCount();\n }\n } else if (++this.#visitedPagesCount === this._linkService.pagesCount) {\n // For example, in GeckoView we want to have only the final update because\n // the Java side provides only one object to update the counts.\n this.#updateUIResultsCount();\n }\n }\n\n #extractText() {\n // Perform text extraction once if this method is called multiple times.\n if (this._extractTextPromises.length > 0) {\n return;\n }\n\n let promise = Promise.resolve();\n for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) {\n const extractTextCapability = createPromiseCapability();\n this._extractTextPromises[i] = extractTextCapability.promise;\n\n promise = promise.then(() => {\n return this._pdfDocument\n .getPage(i + 1)\n .then(pdfPage => {\n return pdfPage.getTextContent();\n })\n .then(\n textContent => {\n const strBuf = [];\n\n for (const textItem of textContent.items) {\n strBuf.push(textItem.str);\n if (textItem.hasEOL) {\n strBuf.push(\"\\n\");\n }\n }\n\n // Store the normalized page content (text items) as one string.\n [\n this._pageContents[i],\n this._pageDiffs[i],\n this._hasDiacritics[i],\n ] = normalize(strBuf.join(\"\"));\n extractTextCapability.resolve();\n },\n reason => {\n console.error(\n `Unable to get text content for page ${i + 1}`,\n reason\n );\n // Page error -- assuming no text content.\n this._pageContents[i] = \"\";\n this._pageDiffs[i] = null;\n this._hasDiacritics[i] = false;\n extractTextCapability.resolve();\n }\n );\n });\n }\n }\n\n #updatePage(index) {\n if (this._scrollMatches && this._selected.pageIdx === index) {\n // If the page is selected, scroll the page into view, which triggers\n // rendering the page, which adds the text layer. Once the text layer\n // is built, it will attempt to scroll the selected match into view.\n this._linkService.page = index + 1;\n }\n\n this._eventBus.dispatch(\"updatetextlayermatches\", {\n source: this,\n pageIndex: index,\n });\n }\n\n #updateAllPages() {\n this._eventBus.dispatch(\"updatetextlayermatches\", {\n source: this,\n pageIndex: -1,\n });\n }\n\n #nextMatch() {\n const previous = this._state.findPrevious;\n const currentPageIndex = this._linkService.page - 1;\n const numPages = this._linkService.pagesCount;\n\n this._highlightMatches = true;\n\n if (this._dirtyMatch) {\n // Need to recalculate the matches, reset everything.\n this._dirtyMatch = false;\n this._selected.pageIdx = this._selected.matchIdx = -1;\n this._offset.pageIdx = currentPageIndex;\n this._offset.matchIdx = null;\n this._offset.wrapped = false;\n this._resumePageIdx = null;\n this._pageMatches.length = 0;\n this._pageMatchesLength.length = 0;\n this.#visitedPagesCount = 0;\n this._matchesCountTotal = 0;\n\n this.#updateAllPages(); // Wipe out any previously highlighted matches.\n\n for (let i = 0; i < numPages; i++) {\n // Start finding the matches as soon as the text is extracted.\n if (this._pendingFindMatches.has(i)) {\n continue;\n }\n this._pendingFindMatches.add(i);\n this._extractTextPromises[i].then(() => {\n this._pendingFindMatches.delete(i);\n this.#calculateMatch(i);\n });\n }\n }\n\n // If there's no query there's no point in searching.\n if (!this.#query) {\n this.#updateUIState(FindState.FOUND);\n return;\n }\n // If we're waiting on a page, we return since we can't do anything else.\n if (this._resumePageIdx) {\n return;\n }\n\n const offset = this._offset;\n // Keep track of how many pages we should maximally iterate through.\n this._pagesToSearch = numPages;\n // If there's already a `matchIdx` that means we are iterating through a\n // page's matches.\n if (offset.matchIdx !== null) {\n const numPageMatches = this._pageMatches[offset.pageIdx].length;\n if (\n (!previous && offset.matchIdx + 1 < numPageMatches) ||\n (previous && offset.matchIdx > 0)\n ) {\n // The simple case; we just have advance the matchIdx to select\n // the next match on the page.\n offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1;\n this.#updateMatch(/* found = */ true);\n return;\n }\n // We went beyond the current page's matches, so we advance to\n // the next page.\n this.#advanceOffsetPage(previous);\n }\n // Start searching through the page.\n this.#nextPageMatch();\n }\n\n #matchesReady(matches) {\n const offset = this._offset;\n const numMatches = matches.length;\n const previous = this._state.findPrevious;\n\n if (numMatches) {\n // There were matches for the page, so initialize `matchIdx`.\n offset.matchIdx = previous ? numMatches - 1 : 0;\n this.#updateMatch(/* found = */ true);\n return true;\n }\n // No matches, so attempt to search the next page.\n this.#advanceOffsetPage(previous);\n if (offset.wrapped) {\n offset.matchIdx = null;\n if (this._pagesToSearch < 0) {\n // No point in wrapping again, there were no matches.\n this.#updateMatch(/* found = */ false);\n // While matches were not found, searching for a page\n // with matches should nevertheless halt.\n return true;\n }\n }\n // Matches were not found (and searching is not done).\n return false;\n }\n\n #nextPageMatch() {\n if (this._resumePageIdx !== null) {\n console.error(\"There can only be one pending page.\");\n }\n\n let matches = null;\n do {\n const pageIdx = this._offset.pageIdx;\n matches = this._pageMatches[pageIdx];\n if (!matches) {\n // The matches don't exist yet for processing by `_matchesReady`,\n // so set a resume point for when they do exist.\n this._resumePageIdx = pageIdx;\n break;\n }\n } while (!this.#matchesReady(matches));\n }\n\n #advanceOffsetPage(previous) {\n const offset = this._offset;\n const numPages = this._linkService.pagesCount;\n offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1;\n offset.matchIdx = null;\n\n this._pagesToSearch--;\n\n if (offset.pageIdx >= numPages || offset.pageIdx < 0) {\n offset.pageIdx = previous ? numPages - 1 : 0;\n offset.wrapped = true;\n }\n }\n\n #updateMatch(found = false) {\n let state = FindState.NOT_FOUND;\n const wrapped = this._offset.wrapped;\n this._offset.wrapped = false;\n\n if (found) {\n const previousPage = this._selected.pageIdx;\n this._selected.pageIdx = this._offset.pageIdx;\n this._selected.matchIdx = this._offset.matchIdx;\n state = wrapped ? FindState.WRAPPED : FindState.FOUND;\n\n // Update the currently selected page to wipe out any selected matches.\n if (previousPage !== -1 && previousPage !== this._selected.pageIdx) {\n this.#updatePage(previousPage);\n }\n }\n\n this.#updateUIState(state, this._state.findPrevious);\n if (this._selected.pageIdx !== -1) {\n // Ensure that the match will be scrolled into view.\n this._scrollMatches = true;\n\n this.#updatePage(this._selected.pageIdx);\n }\n }\n\n #onFindBarClose(evt) {\n const pdfDocument = this._pdfDocument;\n // Since searching is asynchronous, ensure that the removal of highlighted\n // matches (from the UI) is async too such that the 'updatetextlayermatches'\n // events will always be dispatched in the expected order.\n this._firstPageCapability.promise.then(() => {\n // Only update the UI if the document is open, and is the current one.\n if (\n !this._pdfDocument ||\n (pdfDocument && this._pdfDocument !== pdfDocument)\n ) {\n return;\n }\n // Ensure that a pending, not yet started, search operation is aborted.\n if (this._findTimeout) {\n clearTimeout(this._findTimeout);\n this._findTimeout = null;\n }\n // Abort any long running searches, to avoid a match being scrolled into\n // view *after* the findbar has been closed. In this case `this._offset`\n // will most likely differ from `this._selected`, hence we also ensure\n // that any new search operation will always start with a clean slate.\n if (this._resumePageIdx) {\n this._resumePageIdx = null;\n this._dirtyMatch = true;\n }\n // Avoid the UI being in a pending state when the findbar is re-opened.\n this.#updateUIState(FindState.FOUND);\n\n this._highlightMatches = false;\n this.#updateAllPages(); // Wipe out any previously highlighted matches.\n });\n }\n\n #requestMatchesCount() {\n const { pageIdx, matchIdx } = this._selected;\n let current = 0,\n total = this._matchesCountTotal;\n if (matchIdx !== -1) {\n for (let i = 0; i < pageIdx; i++) {\n current += this._pageMatches[i]?.length || 0;\n }\n current += matchIdx + 1;\n }\n // When searching starts, this method may be called before the `pageMatches`\n // have been counted (in `_calculateMatch`). Ensure that the UI won't show\n // temporarily broken state when the active find result doesn't make sense.\n if (current < 1 || current > total) {\n current = total = 0;\n }\n return { current, total };\n }\n\n #updateUIResultsCount() {\n this._eventBus.dispatch(\"updatefindmatchescount\", {\n source: this,\n matchesCount: this.#requestMatchesCount(),\n });\n }\n\n #updateUIState(state, previous = false) {\n if (\n !this.#updateMatchesCountOnProgress &&\n (this.#visitedPagesCount !== this._linkService.pagesCount ||\n state === FindState.PENDING)\n ) {\n // When this.#updateMatchesCountOnProgress is false we only send an update\n // when everything is ready.\n return;\n }\n\n this._eventBus.dispatch(\"updatefindcontrolstate\", {\n source: this,\n state,\n previous,\n matchesCount: this.#requestMatchesCount(),\n rawQuery: this._state?.query ?? null,\n });\n }\n}\n\nexport { FindState, PDFFindController };\n","/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst CharacterType = {\n SPACE: 0,\n ALPHA_LETTER: 1,\n PUNCT: 2,\n HAN_LETTER: 3,\n KATAKANA_LETTER: 4,\n HIRAGANA_LETTER: 5,\n HALFWIDTH_KATAKANA_LETTER: 6,\n THAI_LETTER: 7,\n};\n\nfunction isAlphabeticalScript(charCode) {\n return charCode < 0x2e80;\n}\n\nfunction isAscii(charCode) {\n return (charCode & 0xff80) === 0;\n}\n\nfunction isAsciiAlpha(charCode) {\n return (\n (charCode >= /* a = */ 0x61 && charCode <= /* z = */ 0x7a) ||\n (charCode >= /* A = */ 0x41 && charCode <= /* Z = */ 0x5a)\n );\n}\n\nfunction isAsciiDigit(charCode) {\n return charCode >= /* 0 = */ 0x30 && charCode <= /* 9 = */ 0x39;\n}\n\nfunction isAsciiSpace(charCode) {\n return (\n charCode === /* SPACE = */ 0x20 ||\n charCode === /* TAB = */ 0x09 ||\n charCode === /* CR = */ 0x0d ||\n charCode === /* LF = */ 0x0a\n );\n}\n\nfunction isHan(charCode) {\n return (\n (charCode >= 0x3400 && charCode <= 0x9fff) ||\n (charCode >= 0xf900 && charCode <= 0xfaff)\n );\n}\n\nfunction isKatakana(charCode) {\n return charCode >= 0x30a0 && charCode <= 0x30ff;\n}\n\nfunction isHiragana(charCode) {\n return charCode >= 0x3040 && charCode <= 0x309f;\n}\n\nfunction isHalfwidthKatakana(charCode) {\n return charCode >= 0xff60 && charCode <= 0xff9f;\n}\n\nfunction isThai(charCode) {\n return (charCode & 0xff80) === 0x0e00;\n}\n\n/**\n * This function is based on the word-break detection implemented in:\n * https://hg.mozilla.org/mozilla-central/file/tip/intl/lwbrk/WordBreaker.cpp\n */\nfunction getCharacterType(charCode) {\n if (isAlphabeticalScript(charCode)) {\n if (isAscii(charCode)) {\n if (isAsciiSpace(charCode)) {\n return CharacterType.SPACE;\n } else if (\n isAsciiAlpha(charCode) ||\n isAsciiDigit(charCode) ||\n charCode === /* UNDERSCORE = */ 0x5f\n ) {\n return CharacterType.ALPHA_LETTER;\n }\n return CharacterType.PUNCT;\n } else if (isThai(charCode)) {\n return CharacterType.THAI_LETTER;\n } else if (charCode === /* NBSP = */ 0xa0) {\n return CharacterType.SPACE;\n }\n return CharacterType.ALPHA_LETTER;\n }\n\n if (isHan(charCode)) {\n return CharacterType.HAN_LETTER;\n } else if (isKatakana(charCode)) {\n return CharacterType.KATAKANA_LETTER;\n } else if (isHiragana(charCode)) {\n return CharacterType.HIRAGANA_LETTER;\n } else if (isHalfwidthKatakana(charCode)) {\n return CharacterType.HALFWIDTH_KATAKANA_LETTER;\n }\n return CharacterType.ALPHA_LETTER;\n}\n\nexport { CharacterType, getCharacterType };\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { isValidRotation, parseQueryString } from \"./ui_utils.js\";\nimport { waitOnEventOrTimeout } from \"./event_utils.js\";\n\n// Heuristic value used when force-resetting `this._blockHashChange`.\nconst HASH_CHANGE_TIMEOUT = 1000; // milliseconds\n// Heuristic value used when adding the current position to the browser history.\nconst POSITION_UPDATED_THRESHOLD = 50;\n// Heuristic value used when adding a temporary position to the browser history.\nconst UPDATE_VIEWAREA_TIMEOUT = 1000; // milliseconds\n\n/**\n * @typedef {Object} PDFHistoryOptions\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {EventBus} eventBus - The application event bus.\n */\n\n/**\n * @typedef {Object} InitializeParameters\n * @property {string} fingerprint - The PDF document's unique fingerprint.\n * @property {boolean} [resetHistory] - Reset the browsing history.\n * @property {boolean} [updateUrl] - Attempt to update the document URL, with\n * the current hash, when pushing/replacing browser history entries.\n */\n\n/**\n * @typedef {Object} PushParameters\n * @property {string} [namedDest] - The named destination. If absent, a\n * stringified version of `explicitDest` is used.\n * @property {Array} explicitDest - The explicit destination array.\n * @property {number} pageNumber - The page to which the destination points.\n */\n\nfunction getCurrentHash() {\n return document.location.hash;\n}\n\nclass PDFHistory {\n /**\n * @param {PDFHistoryOptions} options\n */\n constructor({ linkService, eventBus }) {\n this.linkService = linkService;\n this.eventBus = eventBus;\n\n this._initialized = false;\n this._fingerprint = \"\";\n this.reset();\n\n this._boundEvents = null;\n // Ensure that we don't miss a \"pagesinit\" event,\n // by registering the listener immediately.\n this.eventBus._on(\"pagesinit\", () => {\n this._isPagesLoaded = false;\n\n this.eventBus._on(\n \"pagesloaded\",\n evt => {\n this._isPagesLoaded = !!evt.pagesCount;\n },\n { once: true }\n );\n });\n }\n\n /**\n * Initialize the history for the PDF document, using either the current\n * browser history entry or the document hash, whichever is present.\n * @param {InitializeParameters} params\n */\n initialize({ fingerprint, resetHistory = false, updateUrl = false }) {\n if (!fingerprint || typeof fingerprint !== \"string\") {\n console.error(\n 'PDFHistory.initialize: The \"fingerprint\" must be a non-empty string.'\n );\n return;\n }\n // Ensure that any old state is always reset upon initialization.\n if (this._initialized) {\n this.reset();\n }\n const reInitialized =\n this._fingerprint !== \"\" && this._fingerprint !== fingerprint;\n this._fingerprint = fingerprint;\n this._updateUrl = updateUrl === true;\n\n this._initialized = true;\n this._bindEvents();\n const state = window.history.state;\n\n this._popStateInProgress = false;\n this._blockHashChange = 0;\n this._currentHash = getCurrentHash();\n this._numPositionUpdates = 0;\n\n this._uid = this._maxUid = 0;\n this._destination = null;\n this._position = null;\n\n if (!this._isValidState(state, /* checkReload = */ true) || resetHistory) {\n const { hash, page, rotation } = this._parseCurrentHash(\n /* checkNameddest = */ true\n );\n\n if (!hash || reInitialized || resetHistory) {\n // Ensure that the browser history is reset on PDF document load.\n this._pushOrReplaceState(null, /* forceReplace = */ true);\n return;\n }\n // Ensure that the browser history is initialized correctly when\n // the document hash is present on PDF document load.\n this._pushOrReplaceState(\n { hash, page, rotation },\n /* forceReplace = */ true\n );\n return;\n }\n\n // The browser history contains a valid entry, ensure that the history is\n // initialized correctly on PDF document load.\n const destination = state.destination;\n this._updateInternalState(\n destination,\n state.uid,\n /* removeTemporary = */ true\n );\n\n if (destination.rotation !== undefined) {\n this._initialRotation = destination.rotation;\n }\n if (destination.dest) {\n this._initialBookmark = JSON.stringify(destination.dest);\n\n // If the history is updated, e.g. through the user changing the hash,\n // before the initial destination has become visible, then we do *not*\n // want to potentially add `this._position` to the browser history.\n this._destination.page = null;\n } else if (destination.hash) {\n this._initialBookmark = destination.hash;\n } else if (destination.page) {\n // Fallback case; shouldn't be necessary, but better safe than sorry.\n this._initialBookmark = `page=${destination.page}`;\n }\n }\n\n /**\n * Reset the current `PDFHistory` instance, and consequently prevent any\n * further updates and/or navigation of the browser history.\n */\n reset() {\n if (this._initialized) {\n this._pageHide(); // Simulate a 'pagehide' event when resetting.\n\n this._initialized = false;\n this._unbindEvents();\n }\n if (this._updateViewareaTimeout) {\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n this._initialBookmark = null;\n this._initialRotation = null;\n }\n\n /**\n * Push an internal destination to the browser history.\n * @param {PushParameters}\n */\n push({ namedDest = null, explicitDest, pageNumber }) {\n if (!this._initialized) {\n return;\n }\n if (namedDest && typeof namedDest !== \"string\") {\n console.error(\n \"PDFHistory.push: \" +\n `\"${namedDest}\" is not a valid namedDest parameter.`\n );\n return;\n } else if (!Array.isArray(explicitDest)) {\n console.error(\n \"PDFHistory.push: \" +\n `\"${explicitDest}\" is not a valid explicitDest parameter.`\n );\n return;\n } else if (!this._isValidPage(pageNumber)) {\n // Allow an unset `pageNumber` if and only if the history is still empty;\n // please refer to the `this._destination.page = null;` comment above.\n if (pageNumber !== null || this._destination) {\n console.error(\n \"PDFHistory.push: \" +\n `\"${pageNumber}\" is not a valid pageNumber parameter.`\n );\n return;\n }\n }\n\n const hash = namedDest || JSON.stringify(explicitDest);\n if (!hash) {\n // The hash *should* never be undefined, but if that were to occur,\n // avoid any possible issues by not updating the browser history.\n return;\n }\n\n let forceReplace = false;\n if (\n this._destination &&\n (isDestHashesEqual(this._destination.hash, hash) ||\n isDestArraysEqual(this._destination.dest, explicitDest))\n ) {\n // When the new destination is identical to `this._destination`, and\n // its `page` is undefined, replace the current browser history entry.\n // NOTE: This can only occur if `this._destination` was set either:\n // - through the document hash being specified on load.\n // - through the user changing the hash of the document.\n if (this._destination.page) {\n return;\n }\n forceReplace = true;\n }\n if (this._popStateInProgress && !forceReplace) {\n return;\n }\n\n this._pushOrReplaceState(\n {\n dest: explicitDest,\n hash,\n page: pageNumber,\n rotation: this.linkService.rotation,\n },\n forceReplace\n );\n\n if (!this._popStateInProgress) {\n // Prevent the browser history from updating while the new destination is\n // being scrolled into view, to avoid potentially inconsistent state.\n this._popStateInProgress = true;\n // We defer the resetting of `this._popStateInProgress`, to account for\n // e.g. zooming occurring when the new destination is being navigated to.\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n }\n\n /**\n * Push a page to the browser history; generally the `push` method should be\n * used instead.\n * @param {number} pageNumber\n */\n pushPage(pageNumber) {\n if (!this._initialized) {\n return;\n }\n if (!this._isValidPage(pageNumber)) {\n console.error(\n `PDFHistory.pushPage: \"${pageNumber}\" is not a valid page number.`\n );\n return;\n }\n\n if (this._destination?.page === pageNumber) {\n // When the new page is identical to the one in `this._destination`, we\n // don't want to add a potential duplicate entry in the browser history.\n return;\n }\n if (this._popStateInProgress) {\n return;\n }\n\n this._pushOrReplaceState({\n // Simulate an internal destination, for `this._tryPushCurrentPosition`:\n dest: null,\n hash: `page=${pageNumber}`,\n page: pageNumber,\n rotation: this.linkService.rotation,\n });\n\n if (!this._popStateInProgress) {\n // Prevent the browser history from updating while the new page is\n // being scrolled into view, to avoid potentially inconsistent state.\n this._popStateInProgress = true;\n // We defer the resetting of `this._popStateInProgress`, to account for\n // e.g. zooming occurring when the new page is being navigated to.\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n }\n\n /**\n * Push the current position to the browser history.\n */\n pushCurrentPosition() {\n if (!this._initialized || this._popStateInProgress) {\n return;\n }\n this._tryPushCurrentPosition();\n }\n\n /**\n * Go back one step in the browser history.\n * NOTE: Avoids navigating away from the document, useful for \"named actions\".\n */\n back() {\n if (!this._initialized || this._popStateInProgress) {\n return;\n }\n const state = window.history.state;\n if (this._isValidState(state) && state.uid > 0) {\n window.history.back();\n }\n }\n\n /**\n * Go forward one step in the browser history.\n * NOTE: Avoids navigating away from the document, useful for \"named actions\".\n */\n forward() {\n if (!this._initialized || this._popStateInProgress) {\n return;\n }\n const state = window.history.state;\n if (this._isValidState(state) && state.uid < this._maxUid) {\n window.history.forward();\n }\n }\n\n /**\n * @type {boolean} Indicating if the user is currently moving through the\n * browser history, useful e.g. for skipping the next 'hashchange' event.\n */\n get popStateInProgress() {\n return (\n this._initialized &&\n (this._popStateInProgress || this._blockHashChange > 0)\n );\n }\n\n get initialBookmark() {\n return this._initialized ? this._initialBookmark : null;\n }\n\n get initialRotation() {\n return this._initialized ? this._initialRotation : null;\n }\n\n /**\n * @private\n */\n _pushOrReplaceState(destination, forceReplace = false) {\n const shouldReplace = forceReplace || !this._destination;\n const newState = {\n fingerprint: this._fingerprint,\n uid: shouldReplace ? this._uid : this._uid + 1,\n destination,\n };\n\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"CHROME\") &&\n window.history.state?.chromecomState\n ) {\n // history.state.chromecomState is managed by chromecom.js.\n newState.chromecomState = window.history.state.chromecomState;\n }\n this._updateInternalState(destination, newState.uid);\n\n let newUrl;\n if (this._updateUrl && destination?.hash) {\n const baseUrl = document.location.href.split(\"#\")[0];\n // Prevent errors in Firefox.\n if (!baseUrl.startsWith(\"file://\")) {\n newUrl = `${baseUrl}#${destination.hash}`;\n }\n }\n if (shouldReplace) {\n window.history.replaceState(newState, \"\", newUrl);\n } else {\n window.history.pushState(newState, \"\", newUrl);\n }\n\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"CHROME\") &&\n top === window\n ) {\n // eslint-disable-next-line no-undef\n chrome.runtime.sendMessage(\"showPageAction\");\n }\n }\n\n /**\n * @private\n */\n _tryPushCurrentPosition(temporary = false) {\n if (!this._position) {\n return;\n }\n let position = this._position;\n if (temporary) {\n position = Object.assign(Object.create(null), this._position);\n position.temporary = true;\n }\n\n if (!this._destination) {\n this._pushOrReplaceState(position);\n return;\n }\n if (this._destination.temporary) {\n // Always replace a previous *temporary* position.\n this._pushOrReplaceState(position, /* forceReplace = */ true);\n return;\n }\n if (this._destination.hash === position.hash) {\n return; // The current document position has not changed.\n }\n if (\n !this._destination.page &&\n (POSITION_UPDATED_THRESHOLD <= 0 ||\n this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)\n ) {\n // `this._destination` was set through the user changing the hash of\n // the document. Do not add `this._position` to the browser history,\n // to avoid \"flooding\" it with lots of (nearly) identical entries,\n // since we cannot ensure that the document position has changed.\n return;\n }\n\n let forceReplace = false;\n if (\n this._destination.page >= position.first &&\n this._destination.page <= position.page\n ) {\n // When the `page` of `this._destination` is still visible, do not\n // update the browsing history when `this._destination` either:\n // - contains an internal destination, since in this case we\n // cannot ensure that the document position has actually changed.\n // - was set through the user changing the hash of the document.\n if (this._destination.dest !== undefined || !this._destination.first) {\n return;\n }\n // To avoid \"flooding\" the browser history, replace the current entry.\n forceReplace = true;\n }\n this._pushOrReplaceState(position, forceReplace);\n }\n\n /**\n * @private\n */\n _isValidPage(val) {\n return (\n Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount\n );\n }\n\n /**\n * @private\n */\n _isValidState(state, checkReload = false) {\n if (!state) {\n return false;\n }\n if (state.fingerprint !== this._fingerprint) {\n if (checkReload) {\n // Potentially accept the history entry, even if the fingerprints don't\n // match, when the viewer was reloaded (see issue 6847).\n if (\n typeof state.fingerprint !== \"string\" ||\n state.fingerprint.length !== this._fingerprint.length\n ) {\n return false;\n }\n const [perfEntry] = performance.getEntriesByType(\"navigation\");\n if (perfEntry?.type !== \"reload\") {\n return false;\n }\n } else {\n // This should only occur in viewers with support for opening more than\n // one PDF document, e.g. the GENERIC viewer.\n return false;\n }\n }\n if (!Number.isInteger(state.uid) || state.uid < 0) {\n return false;\n }\n if (state.destination === null || typeof state.destination !== \"object\") {\n return false;\n }\n return true;\n }\n\n /**\n * @private\n */\n _updateInternalState(destination, uid, removeTemporary = false) {\n if (this._updateViewareaTimeout) {\n // When updating `this._destination`, make sure that we always wait for\n // the next 'updateviewarea' event before (potentially) attempting to\n // push the current position to the browser history.\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n if (removeTemporary && destination?.temporary) {\n // When the `destination` comes from the browser history,\n // we no longer treat it as a *temporary* position.\n delete destination.temporary;\n }\n this._destination = destination;\n this._uid = uid;\n this._maxUid = Math.max(this._maxUid, uid);\n // This should always be reset when `this._destination` is updated.\n this._numPositionUpdates = 0;\n }\n\n /**\n * @private\n */\n _parseCurrentHash(checkNameddest = false) {\n const hash = unescape(getCurrentHash()).substring(1);\n const params = parseQueryString(hash);\n\n const nameddest = params.get(\"nameddest\") || \"\";\n let page = params.get(\"page\") | 0;\n\n if (!this._isValidPage(page) || (checkNameddest && nameddest.length > 0)) {\n page = null;\n }\n return { hash, page, rotation: this.linkService.rotation };\n }\n\n /**\n * @private\n */\n _updateViewarea({ location }) {\n if (this._updateViewareaTimeout) {\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n\n this._position = {\n hash: location.pdfOpenParams.substring(1),\n page: this.linkService.page,\n first: location.pageNumber,\n rotation: location.rotation,\n };\n\n if (this._popStateInProgress) {\n return;\n }\n\n if (\n POSITION_UPDATED_THRESHOLD > 0 &&\n this._isPagesLoaded &&\n this._destination &&\n !this._destination.page\n ) {\n // If the current destination was set through the user changing the hash\n // of the document, we will usually not try to push the current position\n // to the browser history; see `this._tryPushCurrentPosition()`.\n //\n // To prevent `this._tryPushCurrentPosition()` from effectively being\n // reduced to a no-op in this case, we will assume that the position\n // *did* in fact change if the 'updateviewarea' event was dispatched\n // more than `POSITION_UPDATED_THRESHOLD` times.\n this._numPositionUpdates++;\n }\n\n if (UPDATE_VIEWAREA_TIMEOUT > 0) {\n // When closing the browser, a 'pagehide' event will be dispatched which\n // *should* allow us to push the current position to the browser history.\n // In practice, it seems that the event is arriving too late in order for\n // the session history to be successfully updated.\n // (For additional details, please refer to the discussion in\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1153393.)\n //\n // To workaround this we attempt to *temporarily* add the current position\n // to the browser history only when the viewer is *idle*,\n // i.e. when scrolling and/or zooming does not occur.\n //\n // PLEASE NOTE: It's absolutely imperative that the browser history is\n // *not* updated too often, since that would render the viewer more or\n // less unusable. Hence the use of a timeout to delay the update until\n // the viewer has been idle for `UPDATE_VIEWAREA_TIMEOUT` milliseconds.\n this._updateViewareaTimeout = setTimeout(() => {\n if (!this._popStateInProgress) {\n this._tryPushCurrentPosition(/* temporary = */ true);\n }\n this._updateViewareaTimeout = null;\n }, UPDATE_VIEWAREA_TIMEOUT);\n }\n }\n\n /**\n * @private\n */\n _popState({ state }) {\n const newHash = getCurrentHash(),\n hashChanged = this._currentHash !== newHash;\n this._currentHash = newHash;\n\n if (\n (typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"CHROME\") &&\n state?.chromecomState &&\n !this._isValidState(state)) ||\n !state\n ) {\n // This case corresponds to the user changing the hash of the document.\n this._uid++;\n\n const { hash, page, rotation } = this._parseCurrentHash();\n this._pushOrReplaceState(\n { hash, page, rotation },\n /* forceReplace = */ true\n );\n return;\n }\n if (!this._isValidState(state)) {\n // This should only occur in viewers with support for opening more than\n // one PDF document, e.g. the GENERIC viewer.\n return;\n }\n\n // Prevent the browser history from updating until the new destination,\n // as stored in the browser history, has been scrolled into view.\n this._popStateInProgress = true;\n\n if (hashChanged) {\n // When the hash changed, implying that the 'popstate' event will be\n // followed by a 'hashchange' event, then we do *not* want to update the\n // browser history when handling the 'hashchange' event (in web/app.js)\n // since that would *overwrite* the new destination navigated to below.\n //\n // To avoid accidentally disabling all future user-initiated hash changes,\n // if there's e.g. another 'hashchange' listener that stops the event\n // propagation, we make sure to always force-reset `this._blockHashChange`\n // after `HASH_CHANGE_TIMEOUT` milliseconds have passed.\n this._blockHashChange++;\n waitOnEventOrTimeout({\n target: window,\n name: \"hashchange\",\n delay: HASH_CHANGE_TIMEOUT,\n }).then(() => {\n this._blockHashChange--;\n });\n }\n\n // Navigate to the new destination.\n const destination = state.destination;\n this._updateInternalState(\n destination,\n state.uid,\n /* removeTemporary = */ true\n );\n\n if (isValidRotation(destination.rotation)) {\n this.linkService.rotation = destination.rotation;\n }\n if (destination.dest) {\n this.linkService.goToDestination(destination.dest);\n } else if (destination.hash) {\n this.linkService.setHash(destination.hash);\n } else if (destination.page) {\n // Fallback case; shouldn't be necessary, but better safe than sorry.\n this.linkService.page = destination.page;\n }\n\n // Since `PDFLinkService.goToDestination` is asynchronous, we thus defer the\n // resetting of `this._popStateInProgress` slightly.\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n\n /**\n * @private\n */\n _pageHide() {\n // Attempt to push the `this._position` into the browser history when\n // navigating away from the document. This is *only* done if the history\n // is empty/temporary, since otherwise an existing browser history entry\n // will end up being overwritten (given that new entries cannot be pushed\n // into the browser history when the 'unload' event has already fired).\n if (!this._destination || this._destination.temporary) {\n this._tryPushCurrentPosition();\n }\n }\n\n /**\n * @private\n */\n _bindEvents() {\n if (this._boundEvents) {\n return; // The event listeners were already added.\n }\n this._boundEvents = {\n updateViewarea: this._updateViewarea.bind(this),\n popState: this._popState.bind(this),\n pageHide: this._pageHide.bind(this),\n };\n\n this.eventBus._on(\"updateviewarea\", this._boundEvents.updateViewarea);\n window.addEventListener(\"popstate\", this._boundEvents.popState);\n window.addEventListener(\"pagehide\", this._boundEvents.pageHide);\n }\n\n /**\n * @private\n */\n _unbindEvents() {\n if (!this._boundEvents) {\n return; // The event listeners were already removed.\n }\n this.eventBus._off(\"updateviewarea\", this._boundEvents.updateViewarea);\n window.removeEventListener(\"popstate\", this._boundEvents.popState);\n window.removeEventListener(\"pagehide\", this._boundEvents.pageHide);\n\n this._boundEvents = null;\n }\n}\n\nfunction isDestHashesEqual(destHash, pushHash) {\n if (typeof destHash !== \"string\" || typeof pushHash !== \"string\") {\n return false;\n }\n if (destHash === pushHash) {\n return true;\n }\n const nameddest = parseQueryString(destHash).get(\"nameddest\");\n if (nameddest === pushHash) {\n return true;\n }\n return false;\n}\n\nfunction isDestArraysEqual(firstDest, secondDest) {\n function isEntryEqual(first, second) {\n if (typeof first !== typeof second) {\n return false;\n }\n if (Array.isArray(first) || Array.isArray(second)) {\n return false;\n }\n if (first !== null && typeof first === \"object\" && second !== null) {\n if (Object.keys(first).length !== Object.keys(second).length) {\n return false;\n }\n for (const key in first) {\n if (!isEntryEqual(first[key], second[key])) {\n return false;\n }\n }\n return true;\n }\n return first === second || (Number.isNaN(first) && Number.isNaN(second));\n }\n\n if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) {\n return false;\n }\n if (firstDest.length !== secondDest.length) {\n return false;\n }\n for (let i = 0, ii = firstDest.length; i < ii; i++) {\n if (!isEntryEqual(firstDest[i], secondDest[i])) {\n return false;\n }\n }\n return true;\n}\n\nexport { isDestArraysEqual, isDestHashesEqual, PDFHistory };\n","/* Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BaseTreeViewer } from \"./base_tree_viewer.js\";\n\n/**\n * @typedef {Object} PDFLayerViewerOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IL10n} l10n - Localization service.\n */\n\n/**\n * @typedef {Object} PDFLayerViewerRenderParameters\n * @property {OptionalContentConfig|null} optionalContentConfig - An\n * {OptionalContentConfig} instance.\n * @property {PDFDocument} pdfDocument - A {PDFDocument} instance.\n */\n\nclass PDFLayerViewer extends BaseTreeViewer {\n constructor(options) {\n super(options);\n this.l10n = options.l10n;\n\n this.eventBus._on(\"optionalcontentconfigchanged\", evt => {\n this.#updateLayers(evt.promise);\n });\n this.eventBus._on(\"resetlayers\", () => {\n this.#updateLayers();\n });\n this.eventBus._on(\"togglelayerstree\", this._toggleAllTreeItems.bind(this));\n }\n\n reset() {\n super.reset();\n this._optionalContentConfig = null;\n this._optionalContentHash = null;\n }\n\n /**\n * @private\n */\n _dispatchEvent(layersCount) {\n this.eventBus.dispatch(\"layersloaded\", {\n source: this,\n layersCount,\n });\n }\n\n /**\n * @private\n */\n _bindLink(element, { groupId, input }) {\n const setVisibility = () => {\n this._optionalContentConfig.setVisibility(groupId, input.checked);\n this._optionalContentHash = this._optionalContentConfig.getHash();\n\n this.eventBus.dispatch(\"optionalcontentconfig\", {\n source: this,\n promise: Promise.resolve(this._optionalContentConfig),\n });\n };\n\n element.onclick = evt => {\n if (evt.target === input) {\n setVisibility();\n return true;\n } else if (evt.target !== element) {\n return true; // The target is the \"label\", which is handled above.\n }\n input.checked = !input.checked;\n setVisibility();\n return false;\n };\n }\n\n /**\n * @private\n */\n async _setNestedName(element, { name = null }) {\n if (typeof name === \"string\") {\n element.textContent = this._normalizeTextContent(name);\n return;\n }\n element.textContent = await this.l10n.get(\"additional_layers\");\n element.style.fontStyle = \"italic\";\n }\n\n /**\n * @private\n */\n _addToggleButton(div, { name = null }) {\n super._addToggleButton(div, /* hidden = */ name === null);\n }\n\n /**\n * @private\n */\n _toggleAllTreeItems() {\n if (!this._optionalContentConfig) {\n return;\n }\n super._toggleAllTreeItems();\n }\n\n /**\n * @param {PDFLayerViewerRenderParameters} params\n */\n render({ optionalContentConfig, pdfDocument }) {\n if (this._optionalContentConfig) {\n this.reset();\n }\n this._optionalContentConfig = optionalContentConfig || null;\n this._pdfDocument = pdfDocument || null;\n\n const groups = optionalContentConfig?.getOrder();\n if (!groups) {\n this._dispatchEvent(/* layersCount = */ 0);\n return;\n }\n this._optionalContentHash = optionalContentConfig.getHash();\n\n const fragment = document.createDocumentFragment(),\n queue = [{ parent: fragment, groups }];\n let layersCount = 0,\n hasAnyNesting = false;\n while (queue.length > 0) {\n const levelData = queue.shift();\n for (const groupId of levelData.groups) {\n const div = document.createElement(\"div\");\n div.className = \"treeItem\";\n\n const element = document.createElement(\"a\");\n div.append(element);\n\n if (typeof groupId === \"object\") {\n hasAnyNesting = true;\n this._addToggleButton(div, groupId);\n this._setNestedName(element, groupId);\n\n const itemsDiv = document.createElement(\"div\");\n itemsDiv.className = \"treeItems\";\n div.append(itemsDiv);\n\n queue.push({ parent: itemsDiv, groups: groupId.order });\n } else {\n const group = optionalContentConfig.getGroup(groupId);\n\n const input = document.createElement(\"input\");\n this._bindLink(element, { groupId, input });\n input.type = \"checkbox\";\n input.checked = group.visible;\n\n const label = document.createElement(\"label\");\n label.textContent = this._normalizeTextContent(group.name);\n\n label.append(input);\n element.append(label);\n layersCount++;\n }\n\n levelData.parent.append(div);\n }\n }\n\n this._finishRendering(fragment, layersCount, hasAnyNesting);\n }\n\n async #updateLayers(promise = null) {\n if (!this._optionalContentConfig) {\n return;\n }\n const pdfDocument = this._pdfDocument;\n const optionalContentConfig = await (promise ||\n pdfDocument.getOptionalContentConfig());\n\n if (pdfDocument !== this._pdfDocument) {\n return; // The document was closed while the optional content resolved.\n }\n if (promise) {\n if (optionalContentConfig.getHash() === this._optionalContentHash) {\n return; // The optional content didn't change, hence no need to reset the UI.\n }\n } else {\n this.eventBus.dispatch(\"optionalcontentconfig\", {\n source: this,\n promise: Promise.resolve(optionalContentConfig),\n });\n }\n\n // Reset the sidebarView to the new state.\n this.render({\n optionalContentConfig,\n pdfDocument: this._pdfDocument,\n });\n }\n}\n\nexport { PDFLayerViewer };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BaseTreeViewer } from \"./base_tree_viewer.js\";\nimport { createPromiseCapability } from \"pdfjs-lib\";\nimport { SidebarView } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} PDFOutlineViewerOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {DownloadManager} downloadManager - The download manager.\n */\n\n/**\n * @typedef {Object} PDFOutlineViewerRenderParameters\n * @property {Array|null} outline - An array of outline objects.\n * @property {PDFDocument} pdfDocument - A {PDFDocument} instance.\n */\n\nclass PDFOutlineViewer extends BaseTreeViewer {\n /**\n * @param {PDFOutlineViewerOptions} options\n */\n constructor(options) {\n super(options);\n this.linkService = options.linkService;\n this.downloadManager = options.downloadManager;\n\n this.eventBus._on(\"toggleoutlinetree\", this._toggleAllTreeItems.bind(this));\n this.eventBus._on(\n \"currentoutlineitem\",\n this._currentOutlineItem.bind(this)\n );\n\n this.eventBus._on(\"pagechanging\", evt => {\n this._currentPageNumber = evt.pageNumber;\n });\n this.eventBus._on(\"pagesloaded\", evt => {\n this._isPagesLoaded = !!evt.pagesCount;\n\n // If the capability is still pending, see the `_dispatchEvent`-method,\n // we know that the `currentOutlineItem`-button can be enabled here.\n if (\n this._currentOutlineItemCapability &&\n !this._currentOutlineItemCapability.settled\n ) {\n this._currentOutlineItemCapability.resolve(\n /* enabled = */ this._isPagesLoaded\n );\n }\n });\n this.eventBus._on(\"sidebarviewchanged\", evt => {\n this._sidebarView = evt.view;\n });\n }\n\n reset() {\n super.reset();\n this._outline = null;\n\n this._pageNumberToDestHashCapability = null;\n this._currentPageNumber = 1;\n this._isPagesLoaded = null;\n\n if (\n this._currentOutlineItemCapability &&\n !this._currentOutlineItemCapability.settled\n ) {\n this._currentOutlineItemCapability.resolve(/* enabled = */ false);\n }\n this._currentOutlineItemCapability = null;\n }\n\n /**\n * @private\n */\n _dispatchEvent(outlineCount) {\n this._currentOutlineItemCapability = createPromiseCapability();\n if (\n outlineCount === 0 ||\n this._pdfDocument?.loadingParams.disableAutoFetch\n ) {\n this._currentOutlineItemCapability.resolve(/* enabled = */ false);\n } else if (this._isPagesLoaded !== null) {\n this._currentOutlineItemCapability.resolve(\n /* enabled = */ this._isPagesLoaded\n );\n }\n\n this.eventBus.dispatch(\"outlineloaded\", {\n source: this,\n outlineCount,\n currentOutlineItemPromise: this._currentOutlineItemCapability.promise,\n });\n }\n\n /**\n * @private\n */\n _bindLink(\n element,\n { url, newWindow, action, attachment, dest, setOCGState }\n ) {\n const { linkService } = this;\n\n if (url) {\n linkService.addLinkAttributes(element, url, newWindow);\n return;\n }\n if (action) {\n element.href = linkService.getAnchorUrl(\"\");\n element.onclick = () => {\n linkService.executeNamedAction(action);\n return false;\n };\n return;\n }\n if (attachment) {\n element.href = linkService.getAnchorUrl(\"\");\n element.onclick = () => {\n this.downloadManager.openOrDownloadData(\n element,\n attachment.content,\n attachment.filename\n );\n return false;\n };\n return;\n }\n if (setOCGState) {\n element.href = linkService.getAnchorUrl(\"\");\n element.onclick = () => {\n linkService.executeSetOCGState(setOCGState);\n return false;\n };\n return;\n }\n\n element.href = linkService.getDestinationHash(dest);\n element.onclick = evt => {\n this._updateCurrentTreeItem(evt.target.parentNode);\n\n if (dest) {\n linkService.goToDestination(dest);\n }\n return false;\n };\n }\n\n /**\n * @private\n */\n _setStyles(element, { bold, italic }) {\n if (bold) {\n element.style.fontWeight = \"bold\";\n }\n if (italic) {\n element.style.fontStyle = \"italic\";\n }\n }\n\n /**\n * @private\n */\n _addToggleButton(div, { count, items }) {\n let hidden = false;\n if (count < 0) {\n let totalCount = items.length;\n if (totalCount > 0) {\n const queue = [...items];\n while (queue.length > 0) {\n const { count: nestedCount, items: nestedItems } = queue.shift();\n if (nestedCount > 0 && nestedItems.length > 0) {\n totalCount += nestedItems.length;\n queue.push(...nestedItems);\n }\n }\n }\n if (Math.abs(count) === totalCount) {\n hidden = true;\n }\n }\n super._addToggleButton(div, hidden);\n }\n\n /**\n * @private\n */\n _toggleAllTreeItems() {\n if (!this._outline) {\n return;\n }\n super._toggleAllTreeItems();\n }\n\n /**\n * @param {PDFOutlineViewerRenderParameters} params\n */\n render({ outline, pdfDocument }) {\n if (this._outline) {\n this.reset();\n }\n this._outline = outline || null;\n this._pdfDocument = pdfDocument || null;\n\n if (!outline) {\n this._dispatchEvent(/* outlineCount = */ 0);\n return;\n }\n\n const fragment = document.createDocumentFragment();\n const queue = [{ parent: fragment, items: outline }];\n let outlineCount = 0,\n hasAnyNesting = false;\n while (queue.length > 0) {\n const levelData = queue.shift();\n for (const item of levelData.items) {\n const div = document.createElement(\"div\");\n div.className = \"treeItem\";\n\n const element = document.createElement(\"a\");\n this._bindLink(element, item);\n this._setStyles(element, item);\n element.textContent = this._normalizeTextContent(item.title);\n\n div.append(element);\n\n if (item.items.length > 0) {\n hasAnyNesting = true;\n this._addToggleButton(div, item);\n\n const itemsDiv = document.createElement(\"div\");\n itemsDiv.className = \"treeItems\";\n div.append(itemsDiv);\n\n queue.push({ parent: itemsDiv, items: item.items });\n }\n\n levelData.parent.append(div);\n outlineCount++;\n }\n }\n\n this._finishRendering(fragment, outlineCount, hasAnyNesting);\n }\n\n /**\n * Find/highlight the current outline item, corresponding to the active page.\n * @private\n */\n async _currentOutlineItem() {\n if (!this._isPagesLoaded) {\n throw new Error(\"_currentOutlineItem: All pages have not been loaded.\");\n }\n if (!this._outline || !this._pdfDocument) {\n return;\n }\n\n const pageNumberToDestHash = await this._getPageNumberToDestHash(\n this._pdfDocument\n );\n if (!pageNumberToDestHash) {\n return;\n }\n this._updateCurrentTreeItem(/* treeItem = */ null);\n\n if (this._sidebarView !== SidebarView.OUTLINE) {\n return; // The outline view is no longer visible, hence do nothing.\n }\n // When there is no destination on the current page, always check the\n // previous ones in (reverse) order.\n for (let i = this._currentPageNumber; i > 0; i--) {\n const destHash = pageNumberToDestHash.get(i);\n if (!destHash) {\n continue;\n }\n const linkElement = this.container.querySelector(`a[href=\"${destHash}\"]`);\n if (!linkElement) {\n continue;\n }\n this._scrollToCurrentTreeItem(linkElement.parentNode);\n break;\n }\n }\n\n /**\n * To (significantly) simplify the overall implementation, we will only\n * consider *one* destination per page when finding/highlighting the current\n * outline item (similar to e.g. Adobe Reader); more specifically, we choose\n * the *first* outline item at the *lowest* level of the outline tree.\n * @private\n */\n async _getPageNumberToDestHash(pdfDocument) {\n if (this._pageNumberToDestHashCapability) {\n return this._pageNumberToDestHashCapability.promise;\n }\n this._pageNumberToDestHashCapability = createPromiseCapability();\n\n const pageNumberToDestHash = new Map(),\n pageNumberNesting = new Map();\n const queue = [{ nesting: 0, items: this._outline }];\n while (queue.length > 0) {\n const levelData = queue.shift(),\n currentNesting = levelData.nesting;\n for (const { dest, items } of levelData.items) {\n let explicitDest, pageNumber;\n if (typeof dest === \"string\") {\n explicitDest = await pdfDocument.getDestination(dest);\n\n if (pdfDocument !== this._pdfDocument) {\n return null; // The document was closed while the data resolved.\n }\n } else {\n explicitDest = dest;\n }\n if (Array.isArray(explicitDest)) {\n const [destRef] = explicitDest;\n\n if (typeof destRef === \"object\" && destRef !== null) {\n pageNumber = this.linkService._cachedPageNumber(destRef);\n\n if (!pageNumber) {\n try {\n pageNumber = (await pdfDocument.getPageIndex(destRef)) + 1;\n\n if (pdfDocument !== this._pdfDocument) {\n return null; // The document was closed while the data resolved.\n }\n this.linkService.cachePageRef(pageNumber, destRef);\n } catch (ex) {\n // Invalid page reference, ignore it and continue parsing.\n }\n }\n } else if (Number.isInteger(destRef)) {\n pageNumber = destRef + 1;\n }\n\n if (\n Number.isInteger(pageNumber) &&\n (!pageNumberToDestHash.has(pageNumber) ||\n currentNesting > pageNumberNesting.get(pageNumber))\n ) {\n const destHash = this.linkService.getDestinationHash(dest);\n pageNumberToDestHash.set(pageNumber, destHash);\n pageNumberNesting.set(pageNumber, currentNesting);\n }\n }\n\n if (items.length > 0) {\n queue.push({ nesting: currentNesting + 1, items });\n }\n }\n }\n\n this._pageNumberToDestHashCapability.resolve(\n pageNumberToDestHash.size > 0 ? pageNumberToDestHash : null\n );\n return this._pageNumberToDestHashCapability.promise;\n }\n}\n\nexport { PDFOutlineViewer };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n normalizeWheelEventDelta,\n PresentationModeState,\n ScrollMode,\n SpreadMode,\n} from \"./ui_utils.js\";\nimport { AnnotationEditorType } from \"pdfjs-lib\";\n\nconst DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms\nconst ACTIVE_SELECTOR = \"pdfPresentationMode\";\nconst CONTROLS_SELECTOR = \"pdfPresentationModeControls\";\nconst MOUSE_SCROLL_COOLDOWN_TIME = 50; // in ms\nconst PAGE_SWITCH_THRESHOLD = 0.1;\n\n// Number of CSS pixels for a movement to count as a swipe.\nconst SWIPE_MIN_DISTANCE_THRESHOLD = 50;\n\n// Swipe angle deviation from the x or y axis before it is not\n// considered a swipe in that direction any more.\nconst SWIPE_ANGLE_THRESHOLD = Math.PI / 6;\n\n/**\n * @typedef {Object} PDFPresentationModeOptions\n * @property {HTMLDivElement} container - The container for the viewer element.\n * @property {PDFViewer} pdfViewer - The document viewer.\n * @property {EventBus} eventBus - The application event bus.\n */\n\nclass PDFPresentationMode {\n #state = PresentationModeState.UNKNOWN;\n\n #args = null;\n\n /**\n * @param {PDFPresentationModeOptions} options\n */\n constructor({ container, pdfViewer, eventBus }) {\n this.container = container;\n this.pdfViewer = pdfViewer;\n this.eventBus = eventBus;\n\n this.contextMenuOpen = false;\n this.mouseScrollTimeStamp = 0;\n this.mouseScrollDelta = 0;\n this.touchSwipeState = null;\n }\n\n /**\n * Request the browser to enter fullscreen mode.\n * @returns {Promise<boolean>} Indicating if the request was successful.\n */\n async request() {\n const { container, pdfViewer } = this;\n\n if (this.active || !pdfViewer.pagesCount || !container.requestFullscreen) {\n return false;\n }\n this.#addFullscreenChangeListeners();\n this.#notifyStateChange(PresentationModeState.CHANGING);\n\n const promise = container.requestFullscreen();\n\n this.#args = {\n pageNumber: pdfViewer.currentPageNumber,\n scaleValue: pdfViewer.currentScaleValue,\n scrollMode: pdfViewer.scrollMode,\n spreadMode: null,\n annotationEditorMode: null,\n };\n\n if (\n pdfViewer.spreadMode !== SpreadMode.NONE &&\n !(pdfViewer.pageViewsReady && pdfViewer.hasEqualPageSizes)\n ) {\n console.warn(\n \"Ignoring Spread modes when entering PresentationMode, \" +\n \"since the document may contain varying page sizes.\"\n );\n this.#args.spreadMode = pdfViewer.spreadMode;\n }\n if (pdfViewer.annotationEditorMode !== AnnotationEditorType.DISABLE) {\n this.#args.annotationEditorMode = pdfViewer.annotationEditorMode;\n }\n\n try {\n await promise;\n pdfViewer.focus(); // Fixes bug 1787456.\n return true;\n } catch (reason) {\n this.#removeFullscreenChangeListeners();\n this.#notifyStateChange(PresentationModeState.NORMAL);\n }\n return false;\n }\n\n get active() {\n return (\n this.#state === PresentationModeState.CHANGING ||\n this.#state === PresentationModeState.FULLSCREEN\n );\n }\n\n #mouseWheel(evt) {\n if (!this.active) {\n return;\n }\n evt.preventDefault();\n\n const delta = normalizeWheelEventDelta(evt);\n const currentTime = Date.now();\n const storedTime = this.mouseScrollTimeStamp;\n\n // If we've already switched page, avoid accidentally switching again.\n if (\n currentTime > storedTime &&\n currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME\n ) {\n return;\n }\n // If the scroll direction changed, reset the accumulated scroll delta.\n if (\n (this.mouseScrollDelta > 0 && delta < 0) ||\n (this.mouseScrollDelta < 0 && delta > 0)\n ) {\n this.#resetMouseScrollState();\n }\n this.mouseScrollDelta += delta;\n\n if (Math.abs(this.mouseScrollDelta) >= PAGE_SWITCH_THRESHOLD) {\n const totalDelta = this.mouseScrollDelta;\n this.#resetMouseScrollState();\n const success =\n totalDelta > 0\n ? this.pdfViewer.previousPage()\n : this.pdfViewer.nextPage();\n if (success) {\n this.mouseScrollTimeStamp = currentTime;\n }\n }\n }\n\n #notifyStateChange(state) {\n this.#state = state;\n\n this.eventBus.dispatch(\"presentationmodechanged\", { source: this, state });\n }\n\n #enter() {\n this.#notifyStateChange(PresentationModeState.FULLSCREEN);\n this.container.classList.add(ACTIVE_SELECTOR);\n\n // Ensure that the correct page is scrolled into view when entering\n // Presentation Mode, by waiting until fullscreen mode in enabled.\n setTimeout(() => {\n this.pdfViewer.scrollMode = ScrollMode.PAGE;\n if (this.#args.spreadMode !== null) {\n this.pdfViewer.spreadMode = SpreadMode.NONE;\n }\n this.pdfViewer.currentPageNumber = this.#args.pageNumber;\n this.pdfViewer.currentScaleValue = \"page-fit\";\n\n if (this.#args.annotationEditorMode !== null) {\n this.pdfViewer.annotationEditorMode = AnnotationEditorType.NONE;\n }\n }, 0);\n\n this.#addWindowListeners();\n this.#showControls();\n this.contextMenuOpen = false;\n\n // Text selection is disabled in Presentation Mode, thus it's not possible\n // for the user to deselect text that is selected (e.g. with \"Select all\")\n // when entering Presentation Mode, hence we remove any active selection.\n window.getSelection().removeAllRanges();\n }\n\n #exit() {\n const pageNumber = this.pdfViewer.currentPageNumber;\n this.container.classList.remove(ACTIVE_SELECTOR);\n\n // Ensure that the correct page is scrolled into view when exiting\n // Presentation Mode, by waiting until fullscreen mode is disabled.\n setTimeout(() => {\n this.#removeFullscreenChangeListeners();\n this.#notifyStateChange(PresentationModeState.NORMAL);\n\n this.pdfViewer.scrollMode = this.#args.scrollMode;\n if (this.#args.spreadMode !== null) {\n this.pdfViewer.spreadMode = this.#args.spreadMode;\n }\n this.pdfViewer.currentScaleValue = this.#args.scaleValue;\n this.pdfViewer.currentPageNumber = pageNumber;\n\n if (this.#args.annotationEditorMode !== null) {\n this.pdfViewer.annotationEditorMode = this.#args.annotationEditorMode;\n }\n this.#args = null;\n }, 0);\n\n this.#removeWindowListeners();\n this.#hideControls();\n this.#resetMouseScrollState();\n this.contextMenuOpen = false;\n }\n\n #mouseDown(evt) {\n if (this.contextMenuOpen) {\n this.contextMenuOpen = false;\n evt.preventDefault();\n return;\n }\n if (evt.button !== 0) {\n return;\n }\n // Enable clicking of links in presentation mode. Note: only links\n // pointing to destinations in the current PDF document work.\n if (\n evt.target.href &&\n evt.target.parentNode?.hasAttribute(\"data-internal-link\")\n ) {\n return;\n }\n // Unless an internal link was clicked, advance one page.\n evt.preventDefault();\n\n if (evt.shiftKey) {\n this.pdfViewer.previousPage();\n } else {\n this.pdfViewer.nextPage();\n }\n }\n\n #contextMenu() {\n this.contextMenuOpen = true;\n }\n\n #showControls() {\n if (this.controlsTimeout) {\n clearTimeout(this.controlsTimeout);\n } else {\n this.container.classList.add(CONTROLS_SELECTOR);\n }\n this.controlsTimeout = setTimeout(() => {\n this.container.classList.remove(CONTROLS_SELECTOR);\n delete this.controlsTimeout;\n }, DELAY_BEFORE_HIDING_CONTROLS);\n }\n\n #hideControls() {\n if (!this.controlsTimeout) {\n return;\n }\n clearTimeout(this.controlsTimeout);\n this.container.classList.remove(CONTROLS_SELECTOR);\n delete this.controlsTimeout;\n }\n\n /**\n * Resets the properties used for tracking mouse scrolling events.\n */\n #resetMouseScrollState() {\n this.mouseScrollTimeStamp = 0;\n this.mouseScrollDelta = 0;\n }\n\n #touchSwipe(evt) {\n if (!this.active) {\n return;\n }\n if (evt.touches.length > 1) {\n // Multiple touch points detected; cancel the swipe.\n this.touchSwipeState = null;\n return;\n }\n\n switch (evt.type) {\n case \"touchstart\":\n this.touchSwipeState = {\n startX: evt.touches[0].pageX,\n startY: evt.touches[0].pageY,\n endX: evt.touches[0].pageX,\n endY: evt.touches[0].pageY,\n };\n break;\n case \"touchmove\":\n if (this.touchSwipeState === null) {\n return;\n }\n this.touchSwipeState.endX = evt.touches[0].pageX;\n this.touchSwipeState.endY = evt.touches[0].pageY;\n // Avoid the swipe from triggering browser gestures (Chrome in\n // particular has some sort of swipe gesture in fullscreen mode).\n evt.preventDefault();\n break;\n case \"touchend\":\n if (this.touchSwipeState === null) {\n return;\n }\n let delta = 0;\n const dx = this.touchSwipeState.endX - this.touchSwipeState.startX;\n const dy = this.touchSwipeState.endY - this.touchSwipeState.startY;\n const absAngle = Math.abs(Math.atan2(dy, dx));\n if (\n Math.abs(dx) > SWIPE_MIN_DISTANCE_THRESHOLD &&\n (absAngle <= SWIPE_ANGLE_THRESHOLD ||\n absAngle >= Math.PI - SWIPE_ANGLE_THRESHOLD)\n ) {\n // Horizontal swipe.\n delta = dx;\n } else if (\n Math.abs(dy) > SWIPE_MIN_DISTANCE_THRESHOLD &&\n Math.abs(absAngle - Math.PI / 2) <= SWIPE_ANGLE_THRESHOLD\n ) {\n // Vertical swipe.\n delta = dy;\n }\n if (delta > 0) {\n this.pdfViewer.previousPage();\n } else if (delta < 0) {\n this.pdfViewer.nextPage();\n }\n break;\n }\n }\n\n #addWindowListeners() {\n this.showControlsBind = this.#showControls.bind(this);\n this.mouseDownBind = this.#mouseDown.bind(this);\n this.mouseWheelBind = this.#mouseWheel.bind(this);\n this.resetMouseScrollStateBind = this.#resetMouseScrollState.bind(this);\n this.contextMenuBind = this.#contextMenu.bind(this);\n this.touchSwipeBind = this.#touchSwipe.bind(this);\n\n window.addEventListener(\"mousemove\", this.showControlsBind);\n window.addEventListener(\"mousedown\", this.mouseDownBind);\n window.addEventListener(\"wheel\", this.mouseWheelBind, { passive: false });\n window.addEventListener(\"keydown\", this.resetMouseScrollStateBind);\n window.addEventListener(\"contextmenu\", this.contextMenuBind);\n window.addEventListener(\"touchstart\", this.touchSwipeBind);\n window.addEventListener(\"touchmove\", this.touchSwipeBind);\n window.addEventListener(\"touchend\", this.touchSwipeBind);\n }\n\n #removeWindowListeners() {\n window.removeEventListener(\"mousemove\", this.showControlsBind);\n window.removeEventListener(\"mousedown\", this.mouseDownBind);\n window.removeEventListener(\"wheel\", this.mouseWheelBind, {\n passive: false,\n });\n window.removeEventListener(\"keydown\", this.resetMouseScrollStateBind);\n window.removeEventListener(\"contextmenu\", this.contextMenuBind);\n window.removeEventListener(\"touchstart\", this.touchSwipeBind);\n window.removeEventListener(\"touchmove\", this.touchSwipeBind);\n window.removeEventListener(\"touchend\", this.touchSwipeBind);\n\n delete this.showControlsBind;\n delete this.mouseDownBind;\n delete this.mouseWheelBind;\n delete this.resetMouseScrollStateBind;\n delete this.contextMenuBind;\n delete this.touchSwipeBind;\n }\n\n #fullscreenChange() {\n if (/* isFullscreen = */ document.fullscreenElement) {\n this.#enter();\n } else {\n this.#exit();\n }\n }\n\n #addFullscreenChangeListeners() {\n this.fullscreenChangeBind = this.#fullscreenChange.bind(this);\n window.addEventListener(\"fullscreenchange\", this.fullscreenChangeBind);\n }\n\n #removeFullscreenChangeListeners() {\n window.removeEventListener(\"fullscreenchange\", this.fullscreenChangeBind);\n delete this.fullscreenChangeBind;\n }\n}\n\nexport { PDFPresentationMode };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces\").IRenderableView} IRenderableView */\n/** @typedef {import(\"./pdf_viewer\").PDFViewer} PDFViewer */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_thumbnail_viewer\").PDFThumbnailViewer} PDFThumbnailViewer */\n\nimport { RenderingCancelledException } from \"pdfjs-lib\";\nimport { RenderingStates } from \"./ui_utils.js\";\n\nconst CLEANUP_TIMEOUT = 30000;\n\n/**\n * Controls rendering of the views for pages and thumbnails.\n */\nclass PDFRenderingQueue {\n constructor() {\n this.pdfViewer = null;\n this.pdfThumbnailViewer = null;\n this.onIdle = null;\n this.highestPriorityPage = null;\n /** @type {number} */\n this.idleTimeout = null;\n this.printing = false;\n this.isThumbnailViewEnabled = false;\n }\n\n /**\n * @param {PDFViewer} pdfViewer\n */\n setViewer(pdfViewer) {\n this.pdfViewer = pdfViewer;\n }\n\n /**\n * @param {PDFThumbnailViewer} pdfThumbnailViewer\n */\n setThumbnailViewer(pdfThumbnailViewer) {\n this.pdfThumbnailViewer = pdfThumbnailViewer;\n }\n\n /**\n * @param {IRenderableView} view\n * @returns {boolean}\n */\n isHighestPriority(view) {\n return this.highestPriorityPage === view.renderingId;\n }\n\n /**\n * @returns {boolean}\n */\n hasViewer() {\n return !!this.pdfViewer;\n }\n\n /**\n * @param {Object} currentlyVisiblePages\n */\n renderHighestPriority(currentlyVisiblePages) {\n if (this.idleTimeout) {\n clearTimeout(this.idleTimeout);\n this.idleTimeout = null;\n }\n\n // Pages have a higher priority than thumbnails, so check them first.\n if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {\n return;\n }\n // No pages needed rendering, so check thumbnails.\n if (\n this.isThumbnailViewEnabled &&\n this.pdfThumbnailViewer?.forceRendering()\n ) {\n return;\n }\n\n if (this.printing) {\n // If printing is currently ongoing do not reschedule cleanup.\n return;\n }\n\n if (this.onIdle) {\n this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);\n }\n }\n\n /**\n * @param {Object} visible\n * @param {Array} views\n * @param {boolean} scrolledDown\n * @param {boolean} [preRenderExtra]\n */\n getHighestPriority(visible, views, scrolledDown, preRenderExtra = false) {\n /**\n * The state has changed. Figure out which page has the highest priority to\n * render next (if any).\n *\n * Priority:\n * 1. visible pages\n * 2. if last scrolled down, the page after the visible pages, or\n * if last scrolled up, the page before the visible pages\n */\n const visibleViews = visible.views,\n numVisible = visibleViews.length;\n\n if (numVisible === 0) {\n return null;\n }\n for (let i = 0; i < numVisible; i++) {\n const view = visibleViews[i].view;\n if (!this.isViewFinished(view)) {\n return view;\n }\n }\n const firstId = visible.first.id,\n lastId = visible.last.id;\n\n // All the visible views have rendered; try to handle any \"holes\" in the\n // page layout (can happen e.g. with spreadModes at higher zoom levels).\n if (lastId - firstId + 1 > numVisible) {\n const visibleIds = visible.ids;\n for (let i = 1, ii = lastId - firstId; i < ii; i++) {\n const holeId = scrolledDown ? firstId + i : lastId - i;\n if (visibleIds.has(holeId)) {\n continue;\n }\n const holeView = views[holeId - 1];\n if (!this.isViewFinished(holeView)) {\n return holeView;\n }\n }\n }\n\n // All the visible views have rendered; try to render next/previous page.\n // (IDs start at 1, so no need to add 1 when `scrolledDown === true`.)\n let preRenderIndex = scrolledDown ? lastId : firstId - 2;\n let preRenderView = views[preRenderIndex];\n\n if (preRenderView && !this.isViewFinished(preRenderView)) {\n return preRenderView;\n }\n if (preRenderExtra) {\n preRenderIndex += scrolledDown ? 1 : -1;\n preRenderView = views[preRenderIndex];\n\n if (preRenderView && !this.isViewFinished(preRenderView)) {\n return preRenderView;\n }\n }\n // Everything that needs to be rendered has been.\n return null;\n }\n\n /**\n * @param {IRenderableView} view\n * @returns {boolean}\n */\n isViewFinished(view) {\n return view.renderingState === RenderingStates.FINISHED;\n }\n\n /**\n * Render a page or thumbnail view. This calls the appropriate function\n * based on the views state. If the view is already rendered it will return\n * `false`.\n *\n * @param {IRenderableView} view\n */\n renderView(view) {\n switch (view.renderingState) {\n case RenderingStates.FINISHED:\n return false;\n case RenderingStates.PAUSED:\n this.highestPriorityPage = view.renderingId;\n view.resume();\n break;\n case RenderingStates.RUNNING:\n this.highestPriorityPage = view.renderingId;\n break;\n case RenderingStates.INITIAL:\n this.highestPriorityPage = view.renderingId;\n view\n .draw()\n .finally(() => {\n this.renderHighestPriority();\n })\n .catch(reason => {\n if (reason instanceof RenderingCancelledException) {\n return;\n }\n console.error(`renderView: \"${reason}\"`);\n });\n break;\n }\n return true;\n }\n}\n\nexport { PDFRenderingQueue };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n\nimport { apiPageLayoutToViewerModes, RenderingStates } from \"./ui_utils.js\";\nimport { createPromiseCapability, shadow } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} PDFScriptingManagerOptions\n * @property {EventBus} eventBus - The application event bus.\n * @property {string} sandboxBundleSrc - The path and filename of the scripting\n * bundle.\n * @property {Object} [scriptingFactory] - The factory that is used when\n * initializing scripting; must contain a `createScripting` method.\n * PLEASE NOTE: Primarily intended for the default viewer use-case.\n * @property {function} [docPropertiesLookup] - The function that is used to\n * lookup the necessary document properties.\n */\n\nclass PDFScriptingManager {\n /**\n * @param {PDFScriptingManagerOptions} options\n */\n constructor({\n eventBus,\n sandboxBundleSrc = null,\n scriptingFactory = null,\n docPropertiesLookup = null,\n }) {\n this._pdfDocument = null;\n this._pdfViewer = null;\n this._closeCapability = null;\n this._destroyCapability = null;\n\n this._scripting = null;\n this._ready = false;\n\n this._eventBus = eventBus;\n this._sandboxBundleSrc = sandboxBundleSrc;\n this._scriptingFactory = scriptingFactory;\n this._docPropertiesLookup = docPropertiesLookup;\n\n // The default viewer already handles adding/removing of DOM events,\n // hence limit this to only the viewer components.\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"COMPONENTS\") &&\n !this._scriptingFactory\n ) {\n window.addEventListener(\"updatefromsandbox\", event => {\n this._eventBus.dispatch(\"updatefromsandbox\", {\n source: window,\n detail: event.detail,\n });\n });\n }\n }\n\n setViewer(pdfViewer) {\n this._pdfViewer = pdfViewer;\n }\n\n async setDocument(pdfDocument) {\n if (this._pdfDocument) {\n await this._destroyScripting();\n }\n this._pdfDocument = pdfDocument;\n\n if (!pdfDocument) {\n return;\n }\n const [objects, calculationOrder, docActions] = await Promise.all([\n pdfDocument.getFieldObjects(),\n pdfDocument.getCalculationOrderIds(),\n pdfDocument.getJSActions(),\n ]);\n\n if (!objects && !docActions) {\n // No FieldObjects or JavaScript actions were found in the document.\n await this._destroyScripting();\n return;\n }\n if (pdfDocument !== this._pdfDocument) {\n return; // The document was closed while the data resolved.\n }\n try {\n this._scripting = this._createScripting();\n } catch (error) {\n console.error(`PDFScriptingManager.setDocument: \"${error?.message}\".`);\n\n await this._destroyScripting();\n return;\n }\n\n this._internalEvents.set(\"updatefromsandbox\", event => {\n if (event?.source !== window) {\n return;\n }\n this._updateFromSandbox(event.detail);\n });\n this._internalEvents.set(\"dispatcheventinsandbox\", event => {\n this._scripting?.dispatchEventInSandbox(event.detail);\n });\n\n this._internalEvents.set(\"pagechanging\", ({ pageNumber, previous }) => {\n if (pageNumber === previous) {\n return; // The current page didn't change.\n }\n this._dispatchPageClose(previous);\n this._dispatchPageOpen(pageNumber);\n });\n this._internalEvents.set(\"pagerendered\", ({ pageNumber }) => {\n if (!this._pageOpenPending.has(pageNumber)) {\n return; // No pending \"PageOpen\" event for the newly rendered page.\n }\n if (pageNumber !== this._pdfViewer.currentPageNumber) {\n return; // The newly rendered page is no longer the current one.\n }\n this._dispatchPageOpen(pageNumber);\n });\n this._internalEvents.set(\"pagesdestroy\", async event => {\n await this._dispatchPageClose(this._pdfViewer.currentPageNumber);\n\n await this._scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"WillClose\",\n });\n\n this._closeCapability?.resolve();\n });\n\n for (const [name, listener] of this._internalEvents) {\n this._eventBus._on(name, listener);\n }\n\n try {\n const docProperties = await this._getDocProperties();\n if (pdfDocument !== this._pdfDocument) {\n return; // The document was closed while the properties resolved.\n }\n\n await this._scripting.createSandbox({\n objects,\n calculationOrder,\n appInfo: {\n platform: navigator.platform,\n language: navigator.language,\n },\n docInfo: {\n ...docProperties,\n actions: docActions,\n },\n });\n\n this._eventBus.dispatch(\"sandboxcreated\", { source: this });\n } catch (error) {\n console.error(`PDFScriptingManager.setDocument: \"${error?.message}\".`);\n\n await this._destroyScripting();\n return;\n }\n\n await this._scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"Open\",\n });\n await this._dispatchPageOpen(\n this._pdfViewer.currentPageNumber,\n /* initialize = */ true\n );\n\n // Defer this slightly, to ensure that scripting is *fully* initialized.\n Promise.resolve().then(() => {\n if (pdfDocument === this._pdfDocument) {\n this._ready = true;\n }\n });\n }\n\n async dispatchWillSave(detail) {\n return this._scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"WillSave\",\n });\n }\n\n async dispatchDidSave(detail) {\n return this._scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"DidSave\",\n });\n }\n\n async dispatchWillPrint(detail) {\n return this._scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"WillPrint\",\n });\n }\n\n async dispatchDidPrint(detail) {\n return this._scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"DidPrint\",\n });\n }\n\n get destroyPromise() {\n return this._destroyCapability?.promise || null;\n }\n\n get ready() {\n return this._ready;\n }\n\n /**\n * @private\n */\n get _internalEvents() {\n return shadow(this, \"_internalEvents\", new Map());\n }\n\n /**\n * @private\n */\n get _pageOpenPending() {\n return shadow(this, \"_pageOpenPending\", new Set());\n }\n\n /**\n * @private\n */\n get _visitedPages() {\n return shadow(this, \"_visitedPages\", new Map());\n }\n\n /**\n * @private\n */\n async _updateFromSandbox(detail) {\n // Ignore some events, see below, that don't make sense in PresentationMode.\n const isInPresentationMode =\n this._pdfViewer.isInPresentationMode ||\n this._pdfViewer.isChangingPresentationMode;\n\n const { id, siblings, command, value } = detail;\n if (!id) {\n switch (command) {\n case \"clear\":\n console.clear();\n break;\n case \"error\":\n console.error(value);\n break;\n case \"layout\": {\n // NOTE: Always ignore the pageLayout in GeckoView since there's\n // no UI available to change Scroll/Spread modes for the user.\n if (\n (typeof PDFJSDev === \"undefined\"\n ? window.isGECKOVIEW\n : PDFJSDev.test(\"GECKOVIEW\")) ||\n isInPresentationMode\n ) {\n return;\n }\n const modes = apiPageLayoutToViewerModes(value);\n this._pdfViewer.spreadMode = modes.spreadMode;\n break;\n }\n case \"page-num\":\n this._pdfViewer.currentPageNumber = value + 1;\n break;\n case \"print\":\n await this._pdfViewer.pagesPromise;\n this._eventBus.dispatch(\"print\", { source: this });\n break;\n case \"println\":\n console.log(value);\n break;\n case \"zoom\":\n if (isInPresentationMode) {\n return;\n }\n this._pdfViewer.currentScaleValue = value;\n break;\n case \"SaveAs\":\n this._eventBus.dispatch(\"download\", { source: this });\n break;\n case \"FirstPage\":\n this._pdfViewer.currentPageNumber = 1;\n break;\n case \"LastPage\":\n this._pdfViewer.currentPageNumber = this._pdfViewer.pagesCount;\n break;\n case \"NextPage\":\n this._pdfViewer.nextPage();\n break;\n case \"PrevPage\":\n this._pdfViewer.previousPage();\n break;\n case \"ZoomViewIn\":\n if (isInPresentationMode) {\n return;\n }\n this._pdfViewer.increaseScale();\n break;\n case \"ZoomViewOut\":\n if (isInPresentationMode) {\n return;\n }\n this._pdfViewer.decreaseScale();\n break;\n }\n return;\n }\n\n if (isInPresentationMode) {\n if (detail.focus) {\n return;\n }\n }\n delete detail.id;\n delete detail.siblings;\n\n const ids = siblings ? [id, ...siblings] : [id];\n for (const elementId of ids) {\n const element = document.querySelector(\n `[data-element-id=\"${elementId}\"]`\n );\n if (element) {\n element.dispatchEvent(new CustomEvent(\"updatefromsandbox\", { detail }));\n } else {\n // The element hasn't been rendered yet, use the AnnotationStorage.\n this._pdfDocument?.annotationStorage.setValue(elementId, detail);\n }\n }\n }\n\n /**\n * @private\n */\n async _dispatchPageOpen(pageNumber, initialize = false) {\n const pdfDocument = this._pdfDocument,\n visitedPages = this._visitedPages;\n\n if (initialize) {\n this._closeCapability = createPromiseCapability();\n }\n if (!this._closeCapability) {\n return; // Scripting isn't fully initialized yet.\n }\n const pageView = this._pdfViewer.getPageView(/* index = */ pageNumber - 1);\n\n if (pageView?.renderingState !== RenderingStates.FINISHED) {\n this._pageOpenPending.add(pageNumber);\n return; // Wait for the page to finish rendering.\n }\n this._pageOpenPending.delete(pageNumber);\n\n const actionsPromise = (async () => {\n // Avoid sending, and thus serializing, the `actions` data more than once.\n const actions = await (!visitedPages.has(pageNumber)\n ? pageView.pdfPage?.getJSActions()\n : null);\n if (pdfDocument !== this._pdfDocument) {\n return; // The document was closed while the actions resolved.\n }\n\n await this._scripting?.dispatchEventInSandbox({\n id: \"page\",\n name: \"PageOpen\",\n pageNumber,\n actions,\n });\n })();\n visitedPages.set(pageNumber, actionsPromise);\n }\n\n /**\n * @private\n */\n async _dispatchPageClose(pageNumber) {\n const pdfDocument = this._pdfDocument,\n visitedPages = this._visitedPages;\n\n if (!this._closeCapability) {\n return; // Scripting isn't fully initialized yet.\n }\n if (this._pageOpenPending.has(pageNumber)) {\n return; // The page is still rendering; no \"PageOpen\" event dispatched.\n }\n const actionsPromise = visitedPages.get(pageNumber);\n if (!actionsPromise) {\n return; // The \"PageClose\" event must be preceded by a \"PageOpen\" event.\n }\n visitedPages.set(pageNumber, null);\n\n // Ensure that the \"PageOpen\" event is dispatched first.\n await actionsPromise;\n if (pdfDocument !== this._pdfDocument) {\n return; // The document was closed while the actions resolved.\n }\n\n await this._scripting?.dispatchEventInSandbox({\n id: \"page\",\n name: \"PageClose\",\n pageNumber,\n });\n }\n\n /**\n * @returns {Promise<Object>} A promise that is resolved with an {Object}\n * containing the necessary document properties; please find the expected\n * format in `PDFViewerApplication._scriptingDocProperties`.\n * @private\n */\n async _getDocProperties() {\n if (this._docPropertiesLookup) {\n return this._docPropertiesLookup(this._pdfDocument);\n }\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"COMPONENTS\")) {\n const { docPropertiesLookup } = require(\"./generic_scripting.js\");\n\n return docPropertiesLookup(this._pdfDocument);\n }\n throw new Error(\"_getDocProperties: Unable to lookup properties.\");\n }\n\n /**\n * @private\n */\n _createScripting() {\n this._destroyCapability = createPromiseCapability();\n\n if (this._scripting) {\n throw new Error(\"_createScripting: Scripting already exists.\");\n }\n if (this._scriptingFactory) {\n return this._scriptingFactory.createScripting({\n sandboxBundleSrc: this._sandboxBundleSrc,\n });\n }\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"COMPONENTS\")) {\n const { GenericScripting } = require(\"./generic_scripting.js\");\n\n return new GenericScripting(this._sandboxBundleSrc);\n }\n throw new Error(\"_createScripting: Cannot create scripting.\");\n }\n\n /**\n * @private\n */\n async _destroyScripting() {\n if (!this._scripting) {\n this._pdfDocument = null;\n\n this._destroyCapability?.resolve();\n return;\n }\n if (this._closeCapability) {\n await Promise.race([\n this._closeCapability.promise,\n new Promise(resolve => {\n // Avoid the scripting/sandbox-destruction hanging indefinitely.\n setTimeout(resolve, 1000);\n }),\n ]).catch(reason => {\n // Ignore any errors, to ensure that the sandbox is always destroyed.\n });\n this._closeCapability = null;\n }\n this._pdfDocument = null;\n\n try {\n await this._scripting.destroySandbox();\n } catch (ex) {}\n\n for (const [name, listener] of this._internalEvents) {\n this._eventBus._off(name, listener);\n }\n this._internalEvents.clear();\n\n this._pageOpenPending.clear();\n this._visitedPages.clear();\n\n this._scripting = null;\n this._ready = false;\n\n this._destroyCapability?.resolve();\n }\n}\n\nexport { PDFScriptingManager };\n","/* Copyright 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n PresentationModeState,\n RenderingStates,\n SidebarView,\n} from \"./ui_utils.js\";\n\nconst UI_NOTIFICATION_CLASS = \"pdfSidebarNotification\";\n\n/**\n * @typedef {Object} PDFSidebarOptions\n * @property {PDFSidebarElements} elements - The DOM elements.\n * @property {PDFViewer} pdfViewer - The document viewer.\n * @property {PDFThumbnailViewer} pdfThumbnailViewer - The thumbnail viewer.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IL10n} l10n - The localization service.\n */\n\n/**\n * @typedef {Object} PDFSidebarElements\n * @property {HTMLDivElement} outerContainer - The outer container\n * (encasing both the viewer and sidebar elements).\n * @property {HTMLDivElement} sidebarContainer - The sidebar container\n * (in which the views are placed).\n * @property {HTMLButtonElement} toggleButton - The button used for\n * opening/closing the sidebar.\n * @property {HTMLButtonElement} thumbnailButton - The button used to show\n * the thumbnail view.\n * @property {HTMLButtonElement} outlineButton - The button used to show\n * the outline view.\n * @property {HTMLButtonElement} attachmentsButton - The button used to show\n * the attachments view.\n * @property {HTMLButtonElement} layersButton - The button used to show\n * the layers view.\n * @property {HTMLDivElement} thumbnailView - The container in which\n * the thumbnails are placed.\n * @property {HTMLDivElement} outlineView - The container in which\n * the outline is placed.\n * @property {HTMLDivElement} attachmentsView - The container in which\n * the attachments are placed.\n * @property {HTMLDivElement} layersView - The container in which\n * the layers are placed.\n * @property {HTMLDivElement} outlineOptionsContainer - The container in which\n * the outline view-specific option button(s) are placed.\n * @property {HTMLButtonElement} currentOutlineItemButton - The button used to\n * find the current outline item.\n */\n\nclass PDFSidebar {\n /**\n * @param {PDFSidebarOptions} options\n */\n constructor({ elements, pdfViewer, pdfThumbnailViewer, eventBus, l10n }) {\n this.isOpen = false;\n this.active = SidebarView.THUMBS;\n this.isInitialViewSet = false;\n this.isInitialEventDispatched = false;\n\n /**\n * Callback used when the sidebar has been opened/closed, to ensure that\n * the viewers (PDFViewer/PDFThumbnailViewer) are updated correctly.\n */\n this.onToggled = null;\n\n this.pdfViewer = pdfViewer;\n this.pdfThumbnailViewer = pdfThumbnailViewer;\n\n this.outerContainer = elements.outerContainer;\n this.sidebarContainer = elements.sidebarContainer;\n this.toggleButton = elements.toggleButton;\n\n this.thumbnailButton = elements.thumbnailButton;\n this.outlineButton = elements.outlineButton;\n this.attachmentsButton = elements.attachmentsButton;\n this.layersButton = elements.layersButton;\n\n this.thumbnailView = elements.thumbnailView;\n this.outlineView = elements.outlineView;\n this.attachmentsView = elements.attachmentsView;\n this.layersView = elements.layersView;\n\n this._outlineOptionsContainer = elements.outlineOptionsContainer;\n this._currentOutlineItemButton = elements.currentOutlineItemButton;\n\n this.eventBus = eventBus;\n this.l10n = l10n;\n\n this.#addEventListeners();\n }\n\n reset() {\n this.isInitialViewSet = false;\n this.isInitialEventDispatched = false;\n\n this.#hideUINotification(/* reset = */ true);\n this.switchView(SidebarView.THUMBS);\n\n this.outlineButton.disabled = false;\n this.attachmentsButton.disabled = false;\n this.layersButton.disabled = false;\n this._currentOutlineItemButton.disabled = true;\n }\n\n /**\n * @type {number} One of the values in {SidebarView}.\n */\n get visibleView() {\n return this.isOpen ? this.active : SidebarView.NONE;\n }\n\n /**\n * @param {number} view - The sidebar view that should become visible,\n * must be one of the values in {SidebarView}.\n */\n setInitialView(view = SidebarView.NONE) {\n if (this.isInitialViewSet) {\n return;\n }\n this.isInitialViewSet = true;\n\n // If the user has already manually opened the sidebar, immediately closing\n // it would be bad UX; also ignore the \"unknown\" sidebar view value.\n if (view === SidebarView.NONE || view === SidebarView.UNKNOWN) {\n this.#dispatchEvent();\n return;\n }\n this.switchView(view, /* forceOpen = */ true);\n\n // Prevent dispatching two back-to-back \"sidebarviewchanged\" events,\n // since `this.switchView` dispatched the event if the view changed.\n if (!this.isInitialEventDispatched) {\n this.#dispatchEvent();\n }\n }\n\n /**\n * @param {number} view - The sidebar view that should be switched to,\n * must be one of the values in {SidebarView}.\n * @param {boolean} [forceOpen] - Ensure that the sidebar is open.\n * The default value is `false`.\n */\n switchView(view, forceOpen = false) {\n const isViewChanged = view !== this.active;\n let shouldForceRendering = false;\n\n switch (view) {\n case SidebarView.NONE:\n if (this.isOpen) {\n this.close();\n }\n return; // Closing will trigger rendering and dispatch the event.\n case SidebarView.THUMBS:\n if (this.isOpen && isViewChanged) {\n shouldForceRendering = true;\n }\n break;\n case SidebarView.OUTLINE:\n if (this.outlineButton.disabled) {\n return;\n }\n break;\n case SidebarView.ATTACHMENTS:\n if (this.attachmentsButton.disabled) {\n return;\n }\n break;\n case SidebarView.LAYERS:\n if (this.layersButton.disabled) {\n return;\n }\n break;\n default:\n console.error(`PDFSidebar.switchView: \"${view}\" is not a valid view.`);\n return;\n }\n // Update the active view *after* it has been validated above,\n // in order to prevent setting it to an invalid state.\n this.active = view;\n\n const isThumbs = view === SidebarView.THUMBS,\n isOutline = view === SidebarView.OUTLINE,\n isAttachments = view === SidebarView.ATTACHMENTS,\n isLayers = view === SidebarView.LAYERS;\n\n // Update the CSS classes (and aria attributes), for all buttons...\n this.thumbnailButton.classList.toggle(\"toggled\", isThumbs);\n this.outlineButton.classList.toggle(\"toggled\", isOutline);\n this.attachmentsButton.classList.toggle(\"toggled\", isAttachments);\n this.layersButton.classList.toggle(\"toggled\", isLayers);\n\n this.thumbnailButton.setAttribute(\"aria-checked\", isThumbs);\n this.outlineButton.setAttribute(\"aria-checked\", isOutline);\n this.attachmentsButton.setAttribute(\"aria-checked\", isAttachments);\n this.layersButton.setAttribute(\"aria-checked\", isLayers);\n // ... and for all views.\n this.thumbnailView.classList.toggle(\"hidden\", !isThumbs);\n this.outlineView.classList.toggle(\"hidden\", !isOutline);\n this.attachmentsView.classList.toggle(\"hidden\", !isAttachments);\n this.layersView.classList.toggle(\"hidden\", !isLayers);\n\n // Finally, update view-specific CSS classes.\n this._outlineOptionsContainer.classList.toggle(\"hidden\", !isOutline);\n\n if (forceOpen && !this.isOpen) {\n this.open();\n return; // Opening will trigger rendering and dispatch the event.\n }\n if (shouldForceRendering) {\n this.#updateThumbnailViewer();\n this.#forceRendering();\n }\n if (isViewChanged) {\n this.#dispatchEvent();\n }\n }\n\n open() {\n if (this.isOpen) {\n return;\n }\n this.isOpen = true;\n this.toggleButton.classList.add(\"toggled\");\n this.toggleButton.setAttribute(\"aria-expanded\", \"true\");\n\n this.outerContainer.classList.add(\"sidebarMoving\", \"sidebarOpen\");\n\n if (this.active === SidebarView.THUMBS) {\n this.#updateThumbnailViewer();\n }\n this.#forceRendering();\n this.#dispatchEvent();\n\n this.#hideUINotification();\n }\n\n close() {\n if (!this.isOpen) {\n return;\n }\n this.isOpen = false;\n this.toggleButton.classList.remove(\"toggled\");\n this.toggleButton.setAttribute(\"aria-expanded\", \"false\");\n\n this.outerContainer.classList.add(\"sidebarMoving\");\n this.outerContainer.classList.remove(\"sidebarOpen\");\n\n this.#forceRendering();\n this.#dispatchEvent();\n }\n\n toggle() {\n if (this.isOpen) {\n this.close();\n } else {\n this.open();\n }\n }\n\n #dispatchEvent() {\n if (this.isInitialViewSet && !this.isInitialEventDispatched) {\n this.isInitialEventDispatched = true;\n }\n\n this.eventBus.dispatch(\"sidebarviewchanged\", {\n source: this,\n view: this.visibleView,\n });\n }\n\n #forceRendering() {\n if (this.onToggled) {\n this.onToggled();\n } else {\n // Fallback\n this.pdfViewer.forceRendering();\n this.pdfThumbnailViewer.forceRendering();\n }\n }\n\n #updateThumbnailViewer() {\n const { pdfViewer, pdfThumbnailViewer } = this;\n\n // Use the rendered pages to set the corresponding thumbnail images.\n const pagesCount = pdfViewer.pagesCount;\n for (let pageIndex = 0; pageIndex < pagesCount; pageIndex++) {\n const pageView = pdfViewer.getPageView(pageIndex);\n if (pageView?.renderingState === RenderingStates.FINISHED) {\n const thumbnailView = pdfThumbnailViewer.getThumbnail(pageIndex);\n thumbnailView.setImage(pageView);\n }\n }\n pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber);\n }\n\n #showUINotification() {\n this.toggleButton.setAttribute(\n \"data-l10n-id\",\n \"toggle_sidebar_notification2\"\n );\n this.l10n.translate(this.toggleButton);\n\n if (!this.isOpen) {\n // Only show the notification on the `toggleButton` if the sidebar is\n // currently closed, to avoid unnecessarily bothering the user.\n this.toggleButton.classList.add(UI_NOTIFICATION_CLASS);\n }\n }\n\n #hideUINotification(reset = false) {\n if (this.isOpen || reset) {\n // Only hide the notification on the `toggleButton` if the sidebar is\n // currently open, or when the current PDF document is being closed.\n this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS);\n }\n\n if (reset) {\n this.toggleButton.setAttribute(\"data-l10n-id\", \"toggle_sidebar\");\n this.l10n.translate(this.toggleButton);\n }\n }\n\n #addEventListeners() {\n this.sidebarContainer.addEventListener(\"transitionend\", evt => {\n if (evt.target === this.sidebarContainer) {\n this.outerContainer.classList.remove(\"sidebarMoving\");\n }\n });\n\n this.toggleButton.addEventListener(\"click\", () => {\n this.toggle();\n });\n\n // Buttons for switching views.\n this.thumbnailButton.addEventListener(\"click\", () => {\n this.switchView(SidebarView.THUMBS);\n });\n\n this.outlineButton.addEventListener(\"click\", () => {\n this.switchView(SidebarView.OUTLINE);\n });\n this.outlineButton.addEventListener(\"dblclick\", () => {\n this.eventBus.dispatch(\"toggleoutlinetree\", { source: this });\n });\n\n this.attachmentsButton.addEventListener(\"click\", () => {\n this.switchView(SidebarView.ATTACHMENTS);\n });\n\n this.layersButton.addEventListener(\"click\", () => {\n this.switchView(SidebarView.LAYERS);\n });\n this.layersButton.addEventListener(\"dblclick\", () => {\n this.eventBus.dispatch(\"resetlayers\", { source: this });\n });\n\n // Buttons for view-specific options.\n this._currentOutlineItemButton.addEventListener(\"click\", () => {\n this.eventBus.dispatch(\"currentoutlineitem\", { source: this });\n });\n\n // Disable/enable views.\n const onTreeLoaded = (count, button, view) => {\n button.disabled = !count;\n\n if (count) {\n this.#showUINotification();\n } else if (this.active === view) {\n // If the `view` was opened by the user during document load,\n // switch away from it if it turns out to be empty.\n this.switchView(SidebarView.THUMBS);\n }\n };\n\n this.eventBus._on(\"outlineloaded\", evt => {\n onTreeLoaded(evt.outlineCount, this.outlineButton, SidebarView.OUTLINE);\n\n evt.currentOutlineItemPromise.then(enabled => {\n if (!this.isInitialViewSet) {\n return;\n }\n this._currentOutlineItemButton.disabled = !enabled;\n });\n });\n\n this.eventBus._on(\"attachmentsloaded\", evt => {\n onTreeLoaded(\n evt.attachmentsCount,\n this.attachmentsButton,\n SidebarView.ATTACHMENTS\n );\n });\n\n this.eventBus._on(\"layersloaded\", evt => {\n onTreeLoaded(evt.layersCount, this.layersButton, SidebarView.LAYERS);\n });\n\n // Update the thumbnailViewer, if visible, when exiting presentation mode.\n this.eventBus._on(\"presentationmodechanged\", evt => {\n if (\n evt.state === PresentationModeState.NORMAL &&\n this.visibleView === SidebarView.THUMBS\n ) {\n this.#updateThumbnailViewer();\n }\n });\n }\n}\n\nexport { PDFSidebar };\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { docStyle } from \"./ui_utils.js\";\n\nconst SIDEBAR_WIDTH_VAR = \"--sidebar-width\";\nconst SIDEBAR_MIN_WIDTH = 200; // pixels\nconst SIDEBAR_RESIZING_CLASS = \"sidebarResizing\";\n\n/**\n * @typedef {Object} PDFSidebarResizerOptions\n * @property {HTMLDivElement} outerContainer - The outer container\n * (encasing both the viewer and sidebar elements).\n * @property {HTMLDivElement} resizer - The DOM element that can be dragged in\n * order to adjust the width of the sidebar.\n */\n\nclass PDFSidebarResizer {\n /**\n * @param {PDFSidebarResizerOptions} options\n * @param {EventBus} eventBus - The application event bus.\n * @param {IL10n} l10n - Localization service.\n */\n constructor(options, eventBus, l10n) {\n this.isRTL = false;\n this.sidebarOpen = false;\n this._width = null;\n this._outerContainerWidth = null;\n this._boundEvents = Object.create(null);\n\n this.outerContainer = options.outerContainer;\n this.resizer = options.resizer;\n this.eventBus = eventBus;\n\n l10n.getDirection().then(dir => {\n this.isRTL = dir === \"rtl\";\n });\n this._addEventListeners();\n }\n\n /**\n * @type {number}\n */\n get outerContainerWidth() {\n return (this._outerContainerWidth ||= this.outerContainer.clientWidth);\n }\n\n /**\n * @private\n * returns {boolean} Indicating if the sidebar width was updated.\n */\n _updateWidth(width = 0) {\n // Prevent the sidebar from becoming too narrow, or from occupying more\n // than half of the available viewer width.\n const maxWidth = Math.floor(this.outerContainerWidth / 2);\n if (width > maxWidth) {\n width = maxWidth;\n }\n if (width < SIDEBAR_MIN_WIDTH) {\n width = SIDEBAR_MIN_WIDTH;\n }\n // Only update the UI when the sidebar width did in fact change.\n if (width === this._width) {\n return false;\n }\n this._width = width;\n\n docStyle.setProperty(SIDEBAR_WIDTH_VAR, `${width}px`);\n return true;\n }\n\n /**\n * @private\n */\n _mouseMove(evt) {\n let width = evt.clientX;\n // For sidebar resizing to work correctly in RTL mode, invert the width.\n if (this.isRTL) {\n width = this.outerContainerWidth - width;\n }\n this._updateWidth(width);\n }\n\n /**\n * @private\n */\n _mouseUp(evt) {\n // Re-enable the `transition-duration` rules when sidebar resizing ends...\n this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);\n // ... and ensure that rendering will always be triggered.\n this.eventBus.dispatch(\"resize\", { source: this });\n\n const _boundEvents = this._boundEvents;\n window.removeEventListener(\"mousemove\", _boundEvents.mouseMove);\n window.removeEventListener(\"mouseup\", _boundEvents.mouseUp);\n }\n\n /**\n * @private\n */\n _addEventListeners() {\n const _boundEvents = this._boundEvents;\n _boundEvents.mouseMove = this._mouseMove.bind(this);\n _boundEvents.mouseUp = this._mouseUp.bind(this);\n\n this.resizer.addEventListener(\"mousedown\", evt => {\n if (evt.button !== 0) {\n return;\n }\n // Disable the `transition-duration` rules when sidebar resizing begins,\n // in order to improve responsiveness and to avoid visual glitches.\n this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);\n\n window.addEventListener(\"mousemove\", _boundEvents.mouseMove);\n window.addEventListener(\"mouseup\", _boundEvents.mouseUp);\n });\n\n this.eventBus._on(\"sidebarviewchanged\", evt => {\n this.sidebarOpen = !!evt?.view;\n });\n\n this.eventBus._on(\"resize\", evt => {\n // When the *entire* viewer is resized, such that it becomes narrower,\n // ensure that the sidebar doesn't end up being too wide.\n if (evt?.source !== window) {\n return;\n }\n // Always reset the cached width when the viewer is resized.\n this._outerContainerWidth = null;\n\n if (!this._width) {\n // The sidebar hasn't been resized, hence no need to adjust its width.\n return;\n }\n // NOTE: If the sidebar is closed, we don't need to worry about\n // visual glitches nor ensure that rendering is triggered.\n if (!this.sidebarOpen) {\n this._updateWidth(this._width);\n return;\n }\n this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);\n const updated = this._updateWidth(this._width);\n\n Promise.resolve().then(() => {\n this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);\n // Trigger rendering if the sidebar width changed, to avoid\n // depending on the order in which 'resize' events are handled.\n if (updated) {\n this.eventBus.dispatch(\"resize\", { source: this });\n }\n });\n });\n }\n}\n\nexport { PDFSidebarResizer };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFDocumentProxy} PDFDocumentProxy */\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n\nimport {\n getVisibleElements,\n isValidRotation,\n RenderingStates,\n scrollIntoView,\n watchScroll,\n} from \"./ui_utils.js\";\nimport { PDFThumbnailView, TempImageFactory } from \"./pdf_thumbnail_view.js\";\n\nconst THUMBNAIL_SCROLL_MARGIN = -19;\nconst THUMBNAIL_SELECTED_CLASS = \"selected\";\n\n/**\n * @typedef {Object} PDFThumbnailViewerOptions\n * @property {HTMLDivElement} container - The container for the thumbnail\n * elements.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.\n * @property {IL10n} l10n - Localization service.\n * @property {Object} [pageColors] - Overwrites background and foreground colors\n * with user defined ones in order to improve readability in high contrast\n * mode.\n */\n\n/**\n * Viewer control to display thumbnails for pages in a PDF document.\n */\nclass PDFThumbnailViewer {\n /**\n * @param {PDFThumbnailViewerOptions} options\n */\n constructor({ container, linkService, renderingQueue, l10n, pageColors }) {\n this.container = container;\n this.linkService = linkService;\n this.renderingQueue = renderingQueue;\n this.l10n = l10n;\n this.pageColors = pageColors || null;\n\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n if (\n this.pageColors &&\n !(\n CSS.supports(\"color\", this.pageColors.background) &&\n CSS.supports(\"color\", this.pageColors.foreground)\n )\n ) {\n if (this.pageColors.background || this.pageColors.foreground) {\n console.warn(\n \"PDFThumbnailViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used.\"\n );\n }\n this.pageColors = null;\n }\n }\n\n this.scroll = watchScroll(this.container, this._scrollUpdated.bind(this));\n this._resetView();\n }\n\n /**\n * @private\n */\n _scrollUpdated() {\n this.renderingQueue.renderHighestPriority();\n }\n\n getThumbnail(index) {\n return this._thumbnails[index];\n }\n\n /**\n * @private\n */\n _getVisibleThumbs() {\n return getVisibleElements({\n scrollEl: this.container,\n views: this._thumbnails,\n });\n }\n\n scrollThumbnailIntoView(pageNumber) {\n if (!this.pdfDocument) {\n return;\n }\n const thumbnailView = this._thumbnails[pageNumber - 1];\n\n if (!thumbnailView) {\n console.error('scrollThumbnailIntoView: Invalid \"pageNumber\" parameter.');\n return;\n }\n\n if (pageNumber !== this._currentPageNumber) {\n const prevThumbnailView = this._thumbnails[this._currentPageNumber - 1];\n // Remove the highlight from the previous thumbnail...\n prevThumbnailView.div.classList.remove(THUMBNAIL_SELECTED_CLASS);\n // ... and add the highlight to the new thumbnail.\n thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);\n }\n const { first, last, views } = this._getVisibleThumbs();\n\n // If the thumbnail isn't currently visible, scroll it into view.\n if (views.length > 0) {\n let shouldScroll = false;\n if (pageNumber <= first.id || pageNumber >= last.id) {\n shouldScroll = true;\n } else {\n for (const { id, percent } of views) {\n if (id !== pageNumber) {\n continue;\n }\n shouldScroll = percent < 100;\n break;\n }\n }\n if (shouldScroll) {\n scrollIntoView(thumbnailView.div, { top: THUMBNAIL_SCROLL_MARGIN });\n }\n }\n\n this._currentPageNumber = pageNumber;\n }\n\n get pagesRotation() {\n return this._pagesRotation;\n }\n\n set pagesRotation(rotation) {\n if (!isValidRotation(rotation)) {\n throw new Error(\"Invalid thumbnails rotation angle.\");\n }\n if (!this.pdfDocument) {\n return;\n }\n if (this._pagesRotation === rotation) {\n return; // The rotation didn't change.\n }\n this._pagesRotation = rotation;\n\n const updateArgs = { rotation };\n for (const thumbnail of this._thumbnails) {\n thumbnail.update(updateArgs);\n }\n }\n\n cleanup() {\n for (const thumbnail of this._thumbnails) {\n if (thumbnail.renderingState !== RenderingStates.FINISHED) {\n thumbnail.reset();\n }\n }\n TempImageFactory.destroyCanvas();\n }\n\n /**\n * @private\n */\n _resetView() {\n this._thumbnails = [];\n this._currentPageNumber = 1;\n this._pageLabels = null;\n this._pagesRotation = 0;\n\n // Remove the thumbnails from the DOM.\n this.container.textContent = \"\";\n }\n\n /**\n * @param {PDFDocumentProxy} pdfDocument\n */\n setDocument(pdfDocument) {\n if (this.pdfDocument) {\n this._cancelRendering();\n this._resetView();\n }\n\n this.pdfDocument = pdfDocument;\n if (!pdfDocument) {\n return;\n }\n const firstPagePromise = pdfDocument.getPage(1);\n const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();\n\n firstPagePromise\n .then(firstPdfPage => {\n const pagesCount = pdfDocument.numPages;\n const viewport = firstPdfPage.getViewport({ scale: 1 });\n\n for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n const thumbnail = new PDFThumbnailView({\n container: this.container,\n id: pageNum,\n defaultViewport: viewport.clone(),\n optionalContentConfigPromise,\n linkService: this.linkService,\n renderingQueue: this.renderingQueue,\n l10n: this.l10n,\n pageColors: this.pageColors,\n });\n this._thumbnails.push(thumbnail);\n }\n // Set the first `pdfPage` immediately, since it's already loaded,\n // rather than having to repeat the `PDFDocumentProxy.getPage` call in\n // the `this.#ensurePdfPageLoaded` method before rendering can start.\n this._thumbnails[0]?.setPdfPage(firstPdfPage);\n\n // Ensure that the current thumbnail is always highlighted on load.\n const thumbnailView = this._thumbnails[this._currentPageNumber - 1];\n thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);\n })\n .catch(reason => {\n console.error(\"Unable to initialize thumbnail viewer\", reason);\n });\n }\n\n /**\n * @private\n */\n _cancelRendering() {\n for (const thumbnail of this._thumbnails) {\n thumbnail.cancelRendering();\n }\n }\n\n /**\n * @param {Array|null} labels\n */\n setPageLabels(labels) {\n if (!this.pdfDocument) {\n return;\n }\n if (!labels) {\n this._pageLabels = null;\n } else if (\n !(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)\n ) {\n this._pageLabels = null;\n console.error(\"PDFThumbnailViewer_setPageLabels: Invalid page labels.\");\n } else {\n this._pageLabels = labels;\n }\n // Update all the `PDFThumbnailView` instances.\n for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {\n this._thumbnails[i].setPageLabel(this._pageLabels?.[i] ?? null);\n }\n }\n\n /**\n * @param {PDFThumbnailView} thumbView\n * @returns {Promise<PDFPageProxy | null>}\n */\n async #ensurePdfPageLoaded(thumbView) {\n if (thumbView.pdfPage) {\n return thumbView.pdfPage;\n }\n try {\n const pdfPage = await this.pdfDocument.getPage(thumbView.id);\n if (!thumbView.pdfPage) {\n thumbView.setPdfPage(pdfPage);\n }\n return pdfPage;\n } catch (reason) {\n console.error(\"Unable to get page for thumb view\", reason);\n return null; // Page error -- there is nothing that can be done.\n }\n }\n\n #getScrollAhead(visible) {\n if (visible.first?.id === 1) {\n return true;\n } else if (visible.last?.id === this._thumbnails.length) {\n return false;\n }\n return this.scroll.down;\n }\n\n forceRendering() {\n const visibleThumbs = this._getVisibleThumbs();\n const scrollAhead = this.#getScrollAhead(visibleThumbs);\n const thumbView = this.renderingQueue.getHighestPriority(\n visibleThumbs,\n this._thumbnails,\n scrollAhead\n );\n if (thumbView) {\n this.#ensurePdfPageLoaded(thumbView).then(() => {\n this.renderingQueue.renderView(thumbView);\n });\n return true;\n }\n return false;\n }\n}\n\nexport { PDFThumbnailViewer };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n/** @typedef {import(\"./interfaces\").IRenderableView} IRenderableView */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n\nimport { OutputScale, RenderingStates } from \"./ui_utils.js\";\nimport { RenderingCancelledException } from \"pdfjs-lib\";\n\nconst DRAW_UPSCALE_FACTOR = 2; // See comment in `PDFThumbnailView.draw` below.\nconst MAX_NUM_SCALING_STEPS = 3;\nconst THUMBNAIL_CANVAS_BORDER_WIDTH = 1; // px\nconst THUMBNAIL_WIDTH = 98; // px\n\n/**\n * @typedef {Object} PDFThumbnailViewOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {number} id - The thumbnail's unique ID (normally its number).\n * @property {PageViewport} defaultViewport - The page viewport.\n * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -\n * A promise that is resolved with an {@link OptionalContentConfig} instance.\n * The default value is `null`.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.\n * @property {IL10n} l10n - Localization service.\n * @property {Object} [pageColors] - Overwrites background and foreground colors\n * with user defined ones in order to improve readability in high contrast\n * mode.\n */\n\nclass TempImageFactory {\n static #tempCanvas = null;\n\n static getCanvas(width, height) {\n const tempCanvas = (this.#tempCanvas ||= document.createElement(\"canvas\"));\n tempCanvas.width = width;\n tempCanvas.height = height;\n\n // Since this is a temporary canvas, we need to fill it with a white\n // background ourselves. `_getPageDrawContext` uses CSS rules for this.\n const ctx = tempCanvas.getContext(\"2d\", { alpha: false });\n ctx.save();\n ctx.fillStyle = \"rgb(255, 255, 255)\";\n ctx.fillRect(0, 0, width, height);\n ctx.restore();\n return [tempCanvas, tempCanvas.getContext(\"2d\")];\n }\n\n static destroyCanvas() {\n const tempCanvas = this.#tempCanvas;\n if (tempCanvas) {\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n tempCanvas.width = 0;\n tempCanvas.height = 0;\n }\n this.#tempCanvas = null;\n }\n}\n\n/**\n * @implements {IRenderableView}\n */\nclass PDFThumbnailView {\n /**\n * @param {PDFThumbnailViewOptions} options\n */\n constructor({\n container,\n id,\n defaultViewport,\n optionalContentConfigPromise,\n linkService,\n renderingQueue,\n l10n,\n pageColors,\n }) {\n this.id = id;\n this.renderingId = \"thumbnail\" + id;\n this.pageLabel = null;\n\n this.pdfPage = null;\n this.rotation = 0;\n this.viewport = defaultViewport;\n this.pdfPageRotate = defaultViewport.rotation;\n this._optionalContentConfigPromise = optionalContentConfigPromise || null;\n this.pageColors = pageColors || null;\n\n this.linkService = linkService;\n this.renderingQueue = renderingQueue;\n\n this.renderTask = null;\n this.renderingState = RenderingStates.INITIAL;\n this.resume = null;\n\n const pageWidth = this.viewport.width,\n pageHeight = this.viewport.height,\n pageRatio = pageWidth / pageHeight;\n\n this.canvasWidth = THUMBNAIL_WIDTH;\n this.canvasHeight = (this.canvasWidth / pageRatio) | 0;\n this.scale = this.canvasWidth / pageWidth;\n\n this.l10n = l10n;\n\n const anchor = document.createElement(\"a\");\n anchor.href = linkService.getAnchorUrl(\"#page=\" + id);\n this._thumbPageTitle.then(msg => {\n anchor.title = msg;\n });\n anchor.onclick = function () {\n linkService.goToPage(id);\n return false;\n };\n this.anchor = anchor;\n\n const div = document.createElement(\"div\");\n div.className = \"thumbnail\";\n div.setAttribute(\"data-page-number\", this.id);\n this.div = div;\n\n const ring = document.createElement(\"div\");\n ring.className = \"thumbnailSelectionRing\";\n const borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH;\n ring.style.width = this.canvasWidth + borderAdjustment + \"px\";\n ring.style.height = this.canvasHeight + borderAdjustment + \"px\";\n this.ring = ring;\n\n div.append(ring);\n anchor.append(div);\n container.append(anchor);\n }\n\n setPdfPage(pdfPage) {\n this.pdfPage = pdfPage;\n this.pdfPageRotate = pdfPage.rotate;\n const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = pdfPage.getViewport({ scale: 1, rotation: totalRotation });\n this.reset();\n }\n\n reset() {\n this.cancelRendering();\n this.renderingState = RenderingStates.INITIAL;\n\n const pageWidth = this.viewport.width,\n pageHeight = this.viewport.height,\n pageRatio = pageWidth / pageHeight;\n\n this.canvasHeight = (this.canvasWidth / pageRatio) | 0;\n this.scale = this.canvasWidth / pageWidth;\n\n this.div.removeAttribute(\"data-loaded\");\n const ring = this.ring;\n ring.textContent = \"\"; // Remove the thumbnail from the DOM.\n const borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH;\n ring.style.width = this.canvasWidth + borderAdjustment + \"px\";\n ring.style.height = this.canvasHeight + borderAdjustment + \"px\";\n\n if (this.canvas) {\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n this.canvas.width = 0;\n this.canvas.height = 0;\n delete this.canvas;\n }\n if (this.image) {\n this.image.removeAttribute(\"src\");\n delete this.image;\n }\n }\n\n update({ rotation = null }) {\n if (typeof rotation === \"number\") {\n this.rotation = rotation; // The rotation may be zero.\n }\n const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = this.viewport.clone({\n scale: 1,\n rotation: totalRotation,\n });\n this.reset();\n }\n\n /**\n * PLEASE NOTE: Most likely you want to use the `this.reset()` method,\n * rather than calling this one directly.\n */\n cancelRendering() {\n if (this.renderTask) {\n this.renderTask.cancel();\n this.renderTask = null;\n }\n this.resume = null;\n }\n\n /**\n * @private\n */\n _getPageDrawContext(upscaleFactor = 1) {\n // Keep the no-thumbnail outline visible, i.e. `data-loaded === false`,\n // until rendering/image conversion is complete, to avoid display issues.\n const canvas = document.createElement(\"canvas\");\n const ctx = canvas.getContext(\"2d\", { alpha: false });\n const outputScale = new OutputScale();\n\n canvas.width = (upscaleFactor * this.canvasWidth * outputScale.sx) | 0;\n canvas.height = (upscaleFactor * this.canvasHeight * outputScale.sy) | 0;\n\n const transform = outputScale.scaled\n ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]\n : null;\n\n return { ctx, canvas, transform };\n }\n\n /**\n * @private\n */\n _convertCanvasToImage(canvas) {\n if (this.renderingState !== RenderingStates.FINISHED) {\n throw new Error(\"_convertCanvasToImage: Rendering has not finished.\");\n }\n const reducedCanvas = this._reduceImage(canvas);\n\n const image = document.createElement(\"img\");\n image.className = \"thumbnailImage\";\n this._thumbPageCanvas.then(msg => {\n image.setAttribute(\"aria-label\", msg);\n });\n image.style.width = this.canvasWidth + \"px\";\n image.style.height = this.canvasHeight + \"px\";\n\n image.src = reducedCanvas.toDataURL();\n this.image = image;\n\n this.div.setAttribute(\"data-loaded\", true);\n this.ring.append(image);\n\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n reducedCanvas.width = 0;\n reducedCanvas.height = 0;\n }\n\n draw() {\n if (this.renderingState !== RenderingStates.INITIAL) {\n console.error(\"Must be in new state before drawing\");\n return Promise.resolve();\n }\n const { pdfPage } = this;\n\n if (!pdfPage) {\n this.renderingState = RenderingStates.FINISHED;\n return Promise.reject(new Error(\"pdfPage is not loaded\"));\n }\n\n this.renderingState = RenderingStates.RUNNING;\n\n const finishRenderTask = async (error = null) => {\n // The renderTask may have been replaced by a new one, so only remove\n // the reference to the renderTask if it matches the one that is\n // triggering this callback.\n if (renderTask === this.renderTask) {\n this.renderTask = null;\n }\n\n if (error instanceof RenderingCancelledException) {\n return;\n }\n this.renderingState = RenderingStates.FINISHED;\n this._convertCanvasToImage(canvas);\n\n if (error) {\n throw error;\n }\n };\n\n // Render the thumbnail at a larger size and downsize the canvas (similar\n // to `setImage`), to improve consistency between thumbnails created by\n // the `draw` and `setImage` methods (fixes issue 8233).\n // NOTE: To primarily avoid increasing memory usage too much, but also to\n // reduce downsizing overhead, we purposely limit the up-scaling factor.\n const { ctx, canvas, transform } =\n this._getPageDrawContext(DRAW_UPSCALE_FACTOR);\n const drawViewport = this.viewport.clone({\n scale: DRAW_UPSCALE_FACTOR * this.scale,\n });\n const renderContinueCallback = cont => {\n if (!this.renderingQueue.isHighestPriority(this)) {\n this.renderingState = RenderingStates.PAUSED;\n this.resume = () => {\n this.renderingState = RenderingStates.RUNNING;\n cont();\n };\n return;\n }\n cont();\n };\n\n const renderContext = {\n canvasContext: ctx,\n transform,\n viewport: drawViewport,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n pageColors: this.pageColors,\n };\n const renderTask = (this.renderTask = pdfPage.render(renderContext));\n renderTask.onContinue = renderContinueCallback;\n\n const resultPromise = renderTask.promise.then(\n function () {\n return finishRenderTask(null);\n },\n function (error) {\n return finishRenderTask(error);\n }\n );\n resultPromise.finally(() => {\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n canvas.width = 0;\n canvas.height = 0;\n\n // Only trigger cleanup, once rendering has finished, when the current\n // pageView is *not* cached on the `BaseViewer`-instance.\n const pageCached = this.linkService.isPageCached(this.id);\n if (!pageCached) {\n this.pdfPage?.cleanup();\n }\n });\n\n return resultPromise;\n }\n\n setImage(pageView) {\n if (this.renderingState !== RenderingStates.INITIAL) {\n return;\n }\n const { thumbnailCanvas: canvas, pdfPage, scale } = pageView;\n if (!canvas) {\n return;\n }\n if (!this.pdfPage) {\n this.setPdfPage(pdfPage);\n }\n if (scale < this.scale) {\n // Avoid upscaling the image, since that makes the thumbnail look blurry.\n return;\n }\n this.renderingState = RenderingStates.FINISHED;\n this._convertCanvasToImage(canvas);\n }\n\n /**\n * @private\n */\n _reduceImage(img) {\n const { ctx, canvas } = this._getPageDrawContext();\n\n if (img.width <= 2 * canvas.width) {\n ctx.drawImage(\n img,\n 0,\n 0,\n img.width,\n img.height,\n 0,\n 0,\n canvas.width,\n canvas.height\n );\n return canvas;\n }\n // drawImage does an awful job of rescaling the image, doing it gradually.\n let reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS;\n let reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS;\n const [reducedImage, reducedImageCtx] = TempImageFactory.getCanvas(\n reducedWidth,\n reducedHeight\n );\n\n while (reducedWidth > img.width || reducedHeight > img.height) {\n reducedWidth >>= 1;\n reducedHeight >>= 1;\n }\n reducedImageCtx.drawImage(\n img,\n 0,\n 0,\n img.width,\n img.height,\n 0,\n 0,\n reducedWidth,\n reducedHeight\n );\n while (reducedWidth > 2 * canvas.width) {\n reducedImageCtx.drawImage(\n reducedImage,\n 0,\n 0,\n reducedWidth,\n reducedHeight,\n 0,\n 0,\n reducedWidth >> 1,\n reducedHeight >> 1\n );\n reducedWidth >>= 1;\n reducedHeight >>= 1;\n }\n ctx.drawImage(\n reducedImage,\n 0,\n 0,\n reducedWidth,\n reducedHeight,\n 0,\n 0,\n canvas.width,\n canvas.height\n );\n return canvas;\n }\n\n get _thumbPageTitle() {\n return this.l10n.get(\"thumb_page_title\", {\n page: this.pageLabel ?? this.id,\n });\n }\n\n get _thumbPageCanvas() {\n return this.l10n.get(\"thumb_page_canvas\", {\n page: this.pageLabel ?? this.id,\n });\n }\n\n /**\n * @param {string|null} label\n */\n setPageLabel(label) {\n this.pageLabel = typeof label === \"string\" ? label : null;\n\n this._thumbPageTitle.then(msg => {\n this.anchor.title = msg;\n });\n\n if (this.renderingState !== RenderingStates.FINISHED) {\n return;\n }\n\n this._thumbPageCanvas.then(msg => {\n this.image?.setAttribute(\"aria-label\", msg);\n });\n }\n}\n\nexport { PDFThumbnailView, TempImageFactory };\n","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFDocumentProxy} PDFDocumentProxy */\n/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/optional_content_config\").OptionalContentConfig} OptionalContentConfig */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IDownloadManager} IDownloadManager */\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport {\n AnnotationEditorType,\n AnnotationEditorUIManager,\n AnnotationMode,\n createPromiseCapability,\n PermissionFlag,\n PixelsPerInch,\n version,\n} from \"pdfjs-lib\";\nimport {\n DEFAULT_SCALE,\n DEFAULT_SCALE_DELTA,\n DEFAULT_SCALE_VALUE,\n docStyle,\n getVisibleElements,\n isPortraitOrientation,\n isValidRotation,\n isValidScrollMode,\n isValidSpreadMode,\n MAX_AUTO_SCALE,\n MAX_SCALE,\n MIN_SCALE,\n PresentationModeState,\n RendererType,\n RenderingStates,\n SCROLLBAR_PADDING,\n scrollIntoView,\n ScrollMode,\n SpreadMode,\n TextLayerMode,\n UNKNOWN_SCALE,\n VERTICAL_PADDING,\n watchScroll,\n} from \"./ui_utils.js\";\nimport { NullL10n } from \"./l10n_utils.js\";\nimport { PDFPageView } from \"./pdf_page_view.js\";\nimport { PDFRenderingQueue } from \"./pdf_rendering_queue.js\";\nimport { SimpleLinkService } from \"./pdf_link_service.js\";\n\nconst DEFAULT_CACHE_SIZE = 10;\nconst ENABLE_PERMISSIONS_CLASS = \"enablePermissions\";\n\nconst PagesCountLimit = {\n FORCE_SCROLL_MODE_PAGE: 15000,\n FORCE_LAZY_PAGE_INIT: 7500,\n PAUSE_EAGER_PAGE_INIT: 250,\n};\n\nfunction isValidAnnotationEditorMode(mode) {\n return (\n Object.values(AnnotationEditorType).includes(mode) &&\n mode !== AnnotationEditorType.DISABLE\n );\n}\n\n/**\n * @typedef {Object} PDFViewerOptions\n * @property {HTMLDivElement} container - The container for the viewer element.\n * @property {HTMLDivElement} [viewer] - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {IDownloadManager} [downloadManager] - The download manager\n * component.\n * @property {PDFFindController} [findController] - The find controller\n * component.\n * @property {PDFScriptingManager} [scriptingManager] - The scripting manager\n * component.\n * @property {PDFRenderingQueue} [renderingQueue] - The rendering queue object.\n * @property {boolean} [removePageBorders] - Removes the border shadow around\n * the pages. The default value is `false`.\n * @property {number} [textLayerMode] - Controls if the text layer used for\n * selection and searching is created. The constants from {TextLayerMode}\n * should be used. The default value is `TextLayerMode.ENABLE`.\n * @property {number} [annotationMode] - Controls if the annotation layer is\n * created, and if interactive form elements or `AnnotationStorage`-data are\n * being rendered. The constants from {@link AnnotationMode} should be used;\n * see also {@link RenderParameters} and {@link GetOperatorListParameters}.\n * The default value is `AnnotationMode.ENABLE_FORMS`.\n * @property {number} [annotationEditorMode] - Enables the creation and editing\n * of new Annotations. The constants from {@link AnnotationEditorType} should\n * be used. The default value is `AnnotationEditorType.NONE`.\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n * mainly for annotation icons. Include trailing slash.\n * @property {boolean} [enablePrintAutoRotate] - Enables automatic rotation of\n * landscape pages upon printing. The default is `false`.\n * @property {boolean} [useOnlyCssZoom] - Enables CSS only zooming. The default\n * value is `false`.\n * @property {boolean} [isOffscreenCanvasSupported] - Allows to use an\n * OffscreenCanvas if needed.\n * @property {number} [maxCanvasPixels] - The maximum supported canvas size in\n * total pixels, i.e. width * height. Use -1 for no limit. The default value\n * is 4096 * 4096 (16 mega-pixels).\n * @property {IL10n} l10n - Localization service.\n * @property {boolean} [enablePermissions] - Enables PDF document permissions,\n * when they exist. The default value is `false`.\n * @property {Object} [pageColors] - Overwrites background and foreground colors\n * with user defined ones in order to improve readability in high contrast\n * mode.\n */\n\nclass PDFPageViewBuffer {\n // Here we rely on the fact that `Set`s preserve the insertion order.\n #buf = new Set();\n\n #size = 0;\n\n constructor(size) {\n this.#size = size;\n }\n\n push(view) {\n const buf = this.#buf;\n if (buf.has(view)) {\n buf.delete(view); // Move the view to the \"end\" of the buffer.\n }\n buf.add(view);\n\n if (buf.size > this.#size) {\n this.#destroyFirstView();\n }\n }\n\n /**\n * After calling resize, the size of the buffer will be `newSize`.\n * The optional parameter `idsToKeep` is, if present, a Set of page-ids to\n * push to the back of the buffer, delaying their destruction. The size of\n * `idsToKeep` has no impact on the final size of the buffer; if `idsToKeep`\n * is larger than `newSize`, some of those pages will be destroyed anyway.\n */\n resize(newSize, idsToKeep = null) {\n this.#size = newSize;\n\n const buf = this.#buf;\n if (idsToKeep) {\n const ii = buf.size;\n let i = 1;\n for (const view of buf) {\n if (idsToKeep.has(view.id)) {\n buf.delete(view); // Move the view to the \"end\" of the buffer.\n buf.add(view);\n }\n if (++i > ii) {\n break;\n }\n }\n }\n\n while (buf.size > this.#size) {\n this.#destroyFirstView();\n }\n }\n\n has(view) {\n return this.#buf.has(view);\n }\n\n [Symbol.iterator]() {\n return this.#buf.keys();\n }\n\n #destroyFirstView() {\n const firstView = this.#buf.keys().next().value;\n\n firstView?.destroy();\n this.#buf.delete(firstView);\n }\n}\n\n/**\n * Simple viewer control to display PDF content/pages.\n */\nclass PDFViewer {\n #buffer = null;\n\n #annotationEditorMode = AnnotationEditorType.NONE;\n\n #annotationEditorUIManager = null;\n\n #annotationMode = AnnotationMode.ENABLE_FORMS;\n\n #containerTopLeft = null;\n\n #enablePermissions = false;\n\n #previousContainerHeight = 0;\n\n #resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this));\n\n #scrollModePageState = null;\n\n #onVisibilityChange = null;\n\n #scaleTimeoutId = null;\n\n /**\n * @param {PDFViewerOptions} options\n */\n constructor(options) {\n const viewerVersion =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : null;\n if (version !== viewerVersion) {\n throw new Error(\n `The API version \"${version}\" does not match the Viewer version \"${viewerVersion}\".`\n );\n }\n this.container = options.container;\n this.viewer = options.viewer || options.container.firstElementChild;\n\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n ) {\n if (this.container?.tagName !== \"DIV\" || this.viewer?.tagName !== \"DIV\") {\n throw new Error(\"Invalid `container` and/or `viewer` option.\");\n }\n\n if (\n this.container.offsetParent &&\n getComputedStyle(this.container).position !== \"absolute\"\n ) {\n throw new Error(\"The `container` must be absolutely positioned.\");\n }\n }\n this.#resizeObserver.observe(this.container);\n\n this.eventBus = options.eventBus;\n this.linkService = options.linkService || new SimpleLinkService();\n this.downloadManager = options.downloadManager || null;\n this.findController = options.findController || null;\n this._scriptingManager = options.scriptingManager || null;\n this.textLayerMode = options.textLayerMode ?? TextLayerMode.ENABLE;\n this.#annotationMode =\n options.annotationMode ?? AnnotationMode.ENABLE_FORMS;\n this.#annotationEditorMode =\n options.annotationEditorMode ?? AnnotationEditorType.NONE;\n this.imageResourcesPath = options.imageResourcesPath || \"\";\n this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n ) {\n this.removePageBorders = options.removePageBorders || false;\n this.renderer = options.renderer || RendererType.CANVAS;\n }\n this.useOnlyCssZoom = options.useOnlyCssZoom || false;\n this.isOffscreenCanvasSupported =\n options.isOffscreenCanvasSupported ?? true;\n this.maxCanvasPixels = options.maxCanvasPixels;\n this.l10n = options.l10n || NullL10n;\n this.#enablePermissions = options.enablePermissions || false;\n this.pageColors = options.pageColors || null;\n\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n if (\n this.pageColors &&\n !(\n CSS.supports(\"color\", this.pageColors.background) &&\n CSS.supports(\"color\", this.pageColors.foreground)\n )\n ) {\n if (this.pageColors.background || this.pageColors.foreground) {\n console.warn(\n \"PDFViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used.\"\n );\n }\n this.pageColors = null;\n }\n }\n\n this.defaultRenderingQueue = !options.renderingQueue;\n if (this.defaultRenderingQueue) {\n // Custom rendering queue is not specified, using default one\n this.renderingQueue = new PDFRenderingQueue();\n this.renderingQueue.setViewer(this);\n } else {\n this.renderingQueue = options.renderingQueue;\n }\n\n this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this));\n this.presentationModeState = PresentationModeState.UNKNOWN;\n this._onBeforeDraw = this._onAfterDraw = null;\n this._resetView();\n\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this.removePageBorders\n ) {\n this.viewer.classList.add(\"removePageBorders\");\n }\n\n this.#updateContainerHeightCss();\n }\n\n get pagesCount() {\n return this._pages.length;\n }\n\n getPageView(index) {\n return this._pages[index];\n }\n\n /**\n * @type {boolean} - True if all {PDFPageView} objects are initialized.\n */\n get pageViewsReady() {\n if (!this._pagesCapability.settled) {\n return false;\n }\n // Prevent printing errors when 'disableAutoFetch' is set, by ensuring\n // that *all* pages have in fact been completely loaded.\n return this._pages.every(function (pageView) {\n return pageView?.pdfPage;\n });\n }\n\n /**\n * @type {boolean}\n */\n get renderForms() {\n return this.#annotationMode === AnnotationMode.ENABLE_FORMS;\n }\n\n /**\n * @type {boolean}\n */\n get enableScripting() {\n return !!this._scriptingManager;\n }\n\n /**\n * @type {number}\n */\n get currentPageNumber() {\n return this._currentPageNumber;\n }\n\n /**\n * @param {number} val - The page number.\n */\n set currentPageNumber(val) {\n if (!Number.isInteger(val)) {\n throw new Error(\"Invalid page number.\");\n }\n if (!this.pdfDocument) {\n return;\n }\n // The intent can be to just reset a scroll position and/or scale.\n if (!this._setCurrentPageNumber(val, /* resetCurrentPageView = */ true)) {\n console.error(`currentPageNumber: \"${val}\" is not a valid page.`);\n }\n }\n\n /**\n * @returns {boolean} Whether the pageNumber is valid (within bounds).\n * @private\n */\n _setCurrentPageNumber(val, resetCurrentPageView = false) {\n if (this._currentPageNumber === val) {\n if (resetCurrentPageView) {\n this.#resetCurrentPageView();\n }\n return true;\n }\n\n if (!(0 < val && val <= this.pagesCount)) {\n return false;\n }\n const previous = this._currentPageNumber;\n this._currentPageNumber = val;\n\n this.eventBus.dispatch(\"pagechanging\", {\n source: this,\n pageNumber: val,\n pageLabel: this._pageLabels?.[val - 1] ?? null,\n previous,\n });\n\n if (resetCurrentPageView) {\n this.#resetCurrentPageView();\n }\n return true;\n }\n\n /**\n * @type {string|null} Returns the current page label, or `null` if no page\n * labels exist.\n */\n get currentPageLabel() {\n return this._pageLabels?.[this._currentPageNumber - 1] ?? null;\n }\n\n /**\n * @param {string} val - The page label.\n */\n set currentPageLabel(val) {\n if (!this.pdfDocument) {\n return;\n }\n let page = val | 0; // Fallback page number.\n if (this._pageLabels) {\n const i = this._pageLabels.indexOf(val);\n if (i >= 0) {\n page = i + 1;\n }\n }\n // The intent can be to just reset a scroll position and/or scale.\n if (!this._setCurrentPageNumber(page, /* resetCurrentPageView = */ true)) {\n console.error(`currentPageLabel: \"${val}\" is not a valid page.`);\n }\n }\n\n /**\n * @type {number}\n */\n get currentScale() {\n return this._currentScale !== UNKNOWN_SCALE\n ? this._currentScale\n : DEFAULT_SCALE;\n }\n\n /**\n * @param {number} val - Scale of the pages in percents.\n */\n set currentScale(val) {\n if (isNaN(val)) {\n throw new Error(\"Invalid numeric scale.\");\n }\n if (!this.pdfDocument) {\n return;\n }\n this.#setScale(val, { noScroll: false });\n }\n\n /**\n * @type {string}\n */\n get currentScaleValue() {\n return this._currentScaleValue;\n }\n\n /**\n * @param val - The scale of the pages (in percent or predefined value).\n */\n set currentScaleValue(val) {\n if (!this.pdfDocument) {\n return;\n }\n this.#setScale(val, { noScroll: false });\n }\n\n /**\n * @type {number}\n */\n get pagesRotation() {\n return this._pagesRotation;\n }\n\n /**\n * @param {number} rotation - The rotation of the pages (0, 90, 180, 270).\n */\n set pagesRotation(rotation) {\n if (!isValidRotation(rotation)) {\n throw new Error(\"Invalid pages rotation angle.\");\n }\n if (!this.pdfDocument) {\n return;\n }\n // Normalize the rotation, by clamping it to the [0, 360) range.\n rotation %= 360;\n if (rotation < 0) {\n rotation += 360;\n }\n if (this._pagesRotation === rotation) {\n return; // The rotation didn't change.\n }\n this._pagesRotation = rotation;\n\n const pageNumber = this._currentPageNumber;\n\n this.refresh(true, { rotation });\n\n // Prevent errors in case the rotation changes *before* the scale has been\n // set to a non-default value.\n if (this._currentScaleValue) {\n this.#setScale(this._currentScaleValue, { noScroll: true });\n }\n\n this.eventBus.dispatch(\"rotationchanging\", {\n source: this,\n pagesRotation: rotation,\n pageNumber,\n });\n\n if (this.defaultRenderingQueue) {\n this.update();\n }\n }\n\n get firstPagePromise() {\n return this.pdfDocument ? this._firstPageCapability.promise : null;\n }\n\n get onePageRendered() {\n return this.pdfDocument ? this._onePageRenderedCapability.promise : null;\n }\n\n get pagesPromise() {\n return this.pdfDocument ? this._pagesCapability.promise : null;\n }\n\n #layerProperties() {\n const self = this;\n return {\n get annotationEditorUIManager() {\n return self.#annotationEditorUIManager;\n },\n get annotationStorage() {\n return self.pdfDocument?.annotationStorage;\n },\n get downloadManager() {\n return self.downloadManager;\n },\n get enableScripting() {\n return !!self._scriptingManager;\n },\n get fieldObjectsPromise() {\n return self.pdfDocument?.getFieldObjects();\n },\n get findController() {\n return self.findController;\n },\n get hasJSActionsPromise() {\n return self.pdfDocument?.hasJSActions();\n },\n get linkService() {\n return self.linkService;\n },\n };\n }\n\n /**\n * Currently only *some* permissions are supported.\n * @returns {Object}\n */\n #initializePermissions(permissions) {\n const params = {\n annotationEditorMode: this.#annotationEditorMode,\n annotationMode: this.#annotationMode,\n textLayerMode: this.textLayerMode,\n };\n if (!permissions) {\n return params;\n }\n\n if (!permissions.includes(PermissionFlag.COPY)) {\n this.viewer.classList.add(ENABLE_PERMISSIONS_CLASS);\n }\n\n if (!permissions.includes(PermissionFlag.MODIFY_CONTENTS)) {\n params.annotationEditorMode = AnnotationEditorType.DISABLE;\n }\n\n if (\n !permissions.includes(PermissionFlag.MODIFY_ANNOTATIONS) &&\n !permissions.includes(PermissionFlag.FILL_INTERACTIVE_FORMS) &&\n this.#annotationMode === AnnotationMode.ENABLE_FORMS\n ) {\n params.annotationMode = AnnotationMode.ENABLE;\n }\n\n return params;\n }\n\n #onePageRenderedOrForceFetch() {\n // Unless the viewer *and* its pages are visible, rendering won't start and\n // `this._onePageRenderedCapability` thus won't be resolved.\n // To ensure that automatic printing, on document load, still works even in\n // those cases we force-allow fetching of all pages when:\n // - The current window/tab is inactive, which will prevent rendering since\n // `requestAnimationFrame` is being used; fixes bug 1746213.\n // - The viewer is hidden in the DOM, e.g. in a `display: none` <iframe>\n // element; fixes bug 1618621.\n // - The viewer is visible, but none of the pages are (e.g. if the\n // viewer is very small); fixes bug 1618955.\n if (\n document.visibilityState === \"hidden\" ||\n !this.container.offsetParent ||\n this._getVisiblePages().views.length === 0\n ) {\n return Promise.resolve();\n }\n\n // Handle the window/tab becoming inactive *after* rendering has started;\n // fixes (another part of) bug 1746213.\n const visibilityChangePromise = new Promise(resolve => {\n this.#onVisibilityChange = () => {\n if (document.visibilityState !== \"hidden\") {\n return;\n }\n resolve();\n\n document.removeEventListener(\n \"visibilitychange\",\n this.#onVisibilityChange\n );\n this.#onVisibilityChange = null;\n };\n document.addEventListener(\"visibilitychange\", this.#onVisibilityChange);\n });\n\n return Promise.race([\n this._onePageRenderedCapability.promise,\n visibilityChangePromise,\n ]);\n }\n\n /**\n * @param {PDFDocumentProxy} pdfDocument\n */\n setDocument(pdfDocument) {\n if (this.pdfDocument) {\n this.eventBus.dispatch(\"pagesdestroy\", { source: this });\n\n this._cancelRendering();\n this._resetView();\n\n this.findController?.setDocument(null);\n this._scriptingManager?.setDocument(null);\n\n if (this.#annotationEditorUIManager) {\n this.#annotationEditorUIManager.destroy();\n this.#annotationEditorUIManager = null;\n }\n }\n\n this.pdfDocument = pdfDocument;\n if (!pdfDocument) {\n return;\n }\n const pagesCount = pdfDocument.numPages;\n const firstPagePromise = pdfDocument.getPage(1);\n // Rendering (potentially) depends on this, hence fetching it immediately.\n const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();\n const permissionsPromise = this.#enablePermissions\n ? pdfDocument.getPermissions()\n : Promise.resolve();\n\n // Given that browsers don't handle huge amounts of DOM-elements very well,\n // enforce usage of PAGE-scrolling when loading *very* long/large documents.\n if (pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {\n console.warn(\n \"Forcing PAGE-scrolling for performance reasons, given the length of the document.\"\n );\n const mode = (this._scrollMode = ScrollMode.PAGE);\n this.eventBus.dispatch(\"scrollmodechanged\", { source: this, mode });\n }\n\n this._pagesCapability.promise.then(\n () => {\n this.eventBus.dispatch(\"pagesloaded\", { source: this, pagesCount });\n },\n () => {\n /* Prevent \"Uncaught (in promise)\"-messages in the console. */\n }\n );\n\n this._onBeforeDraw = evt => {\n const pageView = this._pages[evt.pageNumber - 1];\n if (!pageView) {\n return;\n }\n // Add the page to the buffer at the start of drawing. That way it can be\n // evicted from the buffer and destroyed even if we pause its rendering.\n this.#buffer.push(pageView);\n };\n this.eventBus._on(\"pagerender\", this._onBeforeDraw);\n\n this._onAfterDraw = evt => {\n if (evt.cssTransform || this._onePageRenderedCapability.settled) {\n return;\n }\n this._onePageRenderedCapability.resolve({ timestamp: evt.timestamp });\n\n this.eventBus._off(\"pagerendered\", this._onAfterDraw);\n this._onAfterDraw = null;\n\n if (this.#onVisibilityChange) {\n document.removeEventListener(\n \"visibilitychange\",\n this.#onVisibilityChange\n );\n this.#onVisibilityChange = null;\n }\n };\n this.eventBus._on(\"pagerendered\", this._onAfterDraw);\n\n // Fetch a single page so we can get a viewport that will be the default\n // viewport for all pages\n Promise.all([firstPagePromise, permissionsPromise])\n .then(([firstPdfPage, permissions]) => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the first page resolved.\n }\n this._firstPageCapability.resolve(firstPdfPage);\n this._optionalContentConfigPromise = optionalContentConfigPromise;\n\n const { annotationEditorMode, annotationMode, textLayerMode } =\n this.#initializePermissions(permissions);\n\n if (annotationEditorMode !== AnnotationEditorType.DISABLE) {\n const mode = annotationEditorMode;\n\n if (pdfDocument.isPureXfa) {\n console.warn(\"Warning: XFA-editing is not implemented.\");\n } else if (isValidAnnotationEditorMode(mode)) {\n this.#annotationEditorUIManager = new AnnotationEditorUIManager(\n this.container,\n this.eventBus,\n pdfDocument?.annotationStorage\n );\n if (mode !== AnnotationEditorType.NONE) {\n this.#annotationEditorUIManager.updateMode(mode);\n }\n } else {\n console.error(`Invalid AnnotationEditor mode: ${mode}`);\n }\n }\n\n const layerProperties = this.#layerProperties.bind(this);\n const viewerElement =\n this._scrollMode === ScrollMode.PAGE ? null : this.viewer;\n const scale = this.currentScale;\n const viewport = firstPdfPage.getViewport({\n scale: scale * PixelsPerInch.PDF_TO_CSS_UNITS,\n });\n // Ensure that the various layers always get the correct initial size,\n // see issue 15795.\n this.viewer.style.setProperty(\"--scale-factor\", viewport.scale);\n\n for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n const pageView = new PDFPageView({\n container: viewerElement,\n eventBus: this.eventBus,\n id: pageNum,\n scale,\n defaultViewport: viewport.clone(),\n optionalContentConfigPromise,\n renderingQueue: this.renderingQueue,\n textLayerMode,\n annotationMode,\n imageResourcesPath: this.imageResourcesPath,\n renderer:\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n ? this.renderer\n : null,\n useOnlyCssZoom: this.useOnlyCssZoom,\n isOffscreenCanvasSupported: this.isOffscreenCanvasSupported,\n maxCanvasPixels: this.maxCanvasPixels,\n pageColors: this.pageColors,\n l10n: this.l10n,\n layerProperties,\n });\n this._pages.push(pageView);\n }\n // Set the first `pdfPage` immediately, since it's already loaded,\n // rather than having to repeat the `PDFDocumentProxy.getPage` call in\n // the `this.#ensurePdfPageLoaded` method before rendering can start.\n const firstPageView = this._pages[0];\n if (firstPageView) {\n firstPageView.setPdfPage(firstPdfPage);\n this.linkService.cachePageRef(1, firstPdfPage.ref);\n }\n\n if (this._scrollMode === ScrollMode.PAGE) {\n // Ensure that the current page becomes visible on document load.\n this.#ensurePageViewVisible();\n } else if (this._spreadMode !== SpreadMode.NONE) {\n this._updateSpreadMode();\n }\n\n // Fetch all the pages since the viewport is needed before printing\n // starts to create the correct size canvas. Wait until one page is\n // rendered so we don't tie up too many resources early on.\n this.#onePageRenderedOrForceFetch().then(async () => {\n this.findController?.setDocument(pdfDocument); // Enable searching.\n this._scriptingManager?.setDocument(pdfDocument); // Enable scripting.\n\n if (this.#annotationEditorUIManager) {\n // Ensure that the Editor buttons, in the toolbar, are updated.\n this.eventBus.dispatch(\"annotationeditormodechanged\", {\n source: this,\n mode: this.#annotationEditorMode,\n });\n }\n\n // In addition to 'disableAutoFetch' being set, also attempt to reduce\n // resource usage when loading *very* long/large documents.\n if (\n pdfDocument.loadingParams.disableAutoFetch ||\n pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT\n ) {\n // XXX: Printing is semi-broken with auto fetch disabled.\n this._pagesCapability.resolve();\n return;\n }\n let getPagesLeft = pagesCount - 1; // The first page was already loaded.\n\n if (getPagesLeft <= 0) {\n this._pagesCapability.resolve();\n return;\n }\n for (let pageNum = 2; pageNum <= pagesCount; ++pageNum) {\n const promise = pdfDocument.getPage(pageNum).then(\n pdfPage => {\n const pageView = this._pages[pageNum - 1];\n if (!pageView.pdfPage) {\n pageView.setPdfPage(pdfPage);\n }\n this.linkService.cachePageRef(pageNum, pdfPage.ref);\n if (--getPagesLeft === 0) {\n this._pagesCapability.resolve();\n }\n },\n reason => {\n console.error(\n `Unable to get page ${pageNum} to initialize viewer`,\n reason\n );\n if (--getPagesLeft === 0) {\n this._pagesCapability.resolve();\n }\n }\n );\n\n if (pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0) {\n await promise;\n }\n }\n });\n\n this.eventBus.dispatch(\"pagesinit\", { source: this });\n\n pdfDocument.getMetadata().then(({ info }) => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the metadata resolved.\n }\n if (info.Language) {\n this.viewer.lang = info.Language;\n }\n });\n\n if (this.defaultRenderingQueue) {\n this.update();\n }\n })\n .catch(reason => {\n console.error(\"Unable to initialize viewer\", reason);\n\n this._pagesCapability.reject(reason);\n });\n }\n\n /**\n * @param {Array|null} labels\n */\n setPageLabels(labels) {\n if (!this.pdfDocument) {\n return;\n }\n if (!labels) {\n this._pageLabels = null;\n } else if (\n !(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)\n ) {\n this._pageLabels = null;\n console.error(`setPageLabels: Invalid page labels.`);\n } else {\n this._pageLabels = labels;\n }\n // Update all the `PDFPageView` instances.\n for (let i = 0, ii = this._pages.length; i < ii; i++) {\n this._pages[i].setPageLabel(this._pageLabels?.[i] ?? null);\n }\n }\n\n _resetView() {\n this._pages = [];\n this._currentPageNumber = 1;\n this._currentScale = UNKNOWN_SCALE;\n this._currentScaleValue = null;\n this._pageLabels = null;\n this.#buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);\n this._location = null;\n this._pagesRotation = 0;\n this._optionalContentConfigPromise = null;\n this._firstPageCapability = createPromiseCapability();\n this._onePageRenderedCapability = createPromiseCapability();\n this._pagesCapability = createPromiseCapability();\n this._scrollMode = ScrollMode.VERTICAL;\n this._previousScrollMode = ScrollMode.UNKNOWN;\n this._spreadMode = SpreadMode.NONE;\n\n this.#scrollModePageState = {\n previousPageNumber: 1,\n scrollDown: true,\n pages: [],\n };\n\n if (this._onBeforeDraw) {\n this.eventBus._off(\"pagerender\", this._onBeforeDraw);\n this._onBeforeDraw = null;\n }\n if (this._onAfterDraw) {\n this.eventBus._off(\"pagerendered\", this._onAfterDraw);\n this._onAfterDraw = null;\n }\n if (this.#onVisibilityChange) {\n document.removeEventListener(\n \"visibilitychange\",\n this.#onVisibilityChange\n );\n this.#onVisibilityChange = null;\n }\n // Remove the pages from the DOM...\n this.viewer.textContent = \"\";\n // ... and reset the Scroll mode CSS class(es) afterwards.\n this._updateScrollMode();\n\n this.viewer.removeAttribute(\"lang\");\n // Reset all PDF document permissions.\n this.viewer.classList.remove(ENABLE_PERMISSIONS_CLASS);\n }\n\n #ensurePageViewVisible() {\n if (this._scrollMode !== ScrollMode.PAGE) {\n throw new Error(\"#ensurePageViewVisible: Invalid scrollMode value.\");\n }\n const pageNumber = this._currentPageNumber,\n state = this.#scrollModePageState,\n viewer = this.viewer;\n\n // Temporarily remove all the pages from the DOM...\n viewer.textContent = \"\";\n // ... and clear out the active ones.\n state.pages.length = 0;\n\n if (this._spreadMode === SpreadMode.NONE && !this.isInPresentationMode) {\n // Finally, append the new page to the viewer.\n const pageView = this._pages[pageNumber - 1];\n viewer.append(pageView.div);\n\n state.pages.push(pageView);\n } else {\n const pageIndexSet = new Set(),\n parity = this._spreadMode - 1;\n\n // Determine the pageIndices in the new spread.\n if (parity === -1) {\n // PresentationMode is active, with `SpreadMode.NONE` set.\n pageIndexSet.add(pageNumber - 1);\n } else if (pageNumber % 2 !== parity) {\n // Left-hand side page.\n pageIndexSet.add(pageNumber - 1);\n pageIndexSet.add(pageNumber);\n } else {\n // Right-hand side page.\n pageIndexSet.add(pageNumber - 2);\n pageIndexSet.add(pageNumber - 1);\n }\n\n // Finally, append the new pages to the viewer and apply the spreadMode.\n const spread = document.createElement(\"div\");\n spread.className = \"spread\";\n\n if (this.isInPresentationMode) {\n const dummyPage = document.createElement(\"div\");\n dummyPage.className = \"dummyPage\";\n spread.append(dummyPage);\n }\n\n for (const i of pageIndexSet) {\n const pageView = this._pages[i];\n if (!pageView) {\n continue;\n }\n spread.append(pageView.div);\n\n state.pages.push(pageView);\n }\n viewer.append(spread);\n }\n\n state.scrollDown = pageNumber >= state.previousPageNumber;\n state.previousPageNumber = pageNumber;\n }\n\n _scrollUpdate() {\n if (this.pagesCount === 0) {\n return;\n }\n this.update();\n }\n\n #scrollIntoView(pageView, pageSpot = null) {\n const { div, id } = pageView;\n\n // Ensure that `this._currentPageNumber` is correct, when `#scrollIntoView`\n // is called directly (and not from `#resetCurrentPageView`).\n if (this._currentPageNumber !== id) {\n this._setCurrentPageNumber(id);\n }\n if (this._scrollMode === ScrollMode.PAGE) {\n this.#ensurePageViewVisible();\n // Ensure that rendering always occurs, to avoid showing a blank page,\n // even if the current position doesn't change when the page is scrolled.\n this.update();\n }\n\n if (!pageSpot && !this.isInPresentationMode) {\n const left = div.offsetLeft + div.clientLeft,\n right = left + div.clientWidth;\n const { scrollLeft, clientWidth } = this.container;\n if (\n this._scrollMode === ScrollMode.HORIZONTAL ||\n left < scrollLeft ||\n right > scrollLeft + clientWidth\n ) {\n pageSpot = { left: 0, top: 0 };\n }\n }\n scrollIntoView(div, pageSpot);\n\n // Ensure that the correct *initial* document position is set, when any\n // OpenParameters are used, for documents with non-default Scroll/Spread\n // modes (fixes issue 15695). This is necessary since the scroll-handler\n // invokes the `update`-method asynchronously, and `this._location` could\n // thus be wrong when the initial zooming occurs in the default viewer.\n if (!this._currentScaleValue && this._location) {\n this._location = null;\n }\n }\n\n /**\n * Prevent unnecessary re-rendering of all pages when the scale changes\n * only because of limited numerical precision.\n */\n #isSameScale(newScale) {\n return (\n newScale === this._currentScale ||\n Math.abs(newScale - this._currentScale) < 1e-15\n );\n }\n\n #setScaleUpdatePages(\n newScale,\n newValue,\n { noScroll = false, preset = false, drawingDelay = -1 }\n ) {\n this._currentScaleValue = newValue.toString();\n\n if (this.#isSameScale(newScale)) {\n if (preset) {\n this.eventBus.dispatch(\"scalechanging\", {\n source: this,\n scale: newScale,\n presetValue: newValue,\n });\n }\n return;\n }\n\n this.viewer.style.setProperty(\n \"--scale-factor\",\n newScale * PixelsPerInch.PDF_TO_CSS_UNITS\n );\n\n const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000;\n this.refresh(true, {\n scale: newScale,\n drawingDelay: postponeDrawing ? drawingDelay : -1,\n });\n\n if (postponeDrawing) {\n this.#scaleTimeoutId = setTimeout(() => {\n this.#scaleTimeoutId = null;\n this.refresh();\n }, drawingDelay);\n }\n\n this._currentScale = newScale;\n\n if (!noScroll) {\n let page = this._currentPageNumber,\n dest;\n if (\n this._location &&\n !(this.isInPresentationMode || this.isChangingPresentationMode)\n ) {\n page = this._location.pageNumber;\n dest = [\n null,\n { name: \"XYZ\" },\n this._location.left,\n this._location.top,\n null,\n ];\n }\n this.scrollPageIntoView({\n pageNumber: page,\n destArray: dest,\n allowNegativeOffset: true,\n });\n }\n\n this.eventBus.dispatch(\"scalechanging\", {\n source: this,\n scale: newScale,\n presetValue: preset ? newValue : undefined,\n });\n\n if (this.defaultRenderingQueue) {\n this.update();\n }\n }\n\n get #pageWidthScaleFactor() {\n if (\n this._spreadMode !== SpreadMode.NONE &&\n this._scrollMode !== ScrollMode.HORIZONTAL\n ) {\n return 2;\n }\n return 1;\n }\n\n #setScale(value, options) {\n let scale = parseFloat(value);\n\n if (scale > 0) {\n options.preset = false;\n this.#setScaleUpdatePages(scale, value, options);\n } else {\n const currentPage = this._pages[this._currentPageNumber - 1];\n if (!currentPage) {\n return;\n }\n let hPadding = SCROLLBAR_PADDING,\n vPadding = VERTICAL_PADDING;\n\n if (this.isInPresentationMode) {\n // Pages have a 2px (transparent) border in PresentationMode, see\n // the `web/pdf_viewer.css` file.\n hPadding = vPadding = 4; // 2 * 2px\n if (this._spreadMode !== SpreadMode.NONE) {\n // Account for two pages being visible in PresentationMode, thus\n // \"doubling\" the total border width.\n hPadding *= 2;\n }\n } else if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this.removePageBorders\n ) {\n hPadding = vPadding = 0;\n } else if (this._scrollMode === ScrollMode.HORIZONTAL) {\n [hPadding, vPadding] = [vPadding, hPadding]; // Swap the padding values.\n }\n const pageWidthScale =\n (((this.container.clientWidth - hPadding) / currentPage.width) *\n currentPage.scale) /\n this.#pageWidthScaleFactor;\n const pageHeightScale =\n ((this.container.clientHeight - vPadding) / currentPage.height) *\n currentPage.scale;\n switch (value) {\n case \"page-actual\":\n scale = 1;\n break;\n case \"page-width\":\n scale = pageWidthScale;\n break;\n case \"page-height\":\n scale = pageHeightScale;\n break;\n case \"page-fit\":\n scale = Math.min(pageWidthScale, pageHeightScale);\n break;\n case \"auto\":\n // For pages in landscape mode, fit the page height to the viewer\n // *unless* the page would thus become too wide to fit horizontally.\n const horizontalScale = isPortraitOrientation(currentPage)\n ? pageWidthScale\n : Math.min(pageHeightScale, pageWidthScale);\n scale = Math.min(MAX_AUTO_SCALE, horizontalScale);\n break;\n default:\n console.error(`#setScale: \"${value}\" is an unknown zoom value.`);\n return;\n }\n options.preset = true;\n this.#setScaleUpdatePages(scale, value, options);\n }\n }\n\n /**\n * Refreshes page view: scrolls to the current page and updates the scale.\n */\n #resetCurrentPageView() {\n const pageView = this._pages[this._currentPageNumber - 1];\n\n if (this.isInPresentationMode) {\n // Fixes the case when PDF has different page sizes.\n this.#setScale(this._currentScaleValue, { noScroll: true });\n }\n this.#scrollIntoView(pageView);\n }\n\n /**\n * @param {string} label - The page label.\n * @returns {number|null} The page number corresponding to the page label,\n * or `null` when no page labels exist and/or the input is invalid.\n */\n pageLabelToPageNumber(label) {\n if (!this._pageLabels) {\n return null;\n }\n const i = this._pageLabels.indexOf(label);\n if (i < 0) {\n return null;\n }\n return i + 1;\n }\n\n /**\n * @typedef {Object} ScrollPageIntoViewParameters\n * @property {number} pageNumber - The page number.\n * @property {Array} [destArray] - The original PDF destination array, in the\n * format: <page-ref> </XYZ|/FitXXX> <args..>\n * @property {boolean} [allowNegativeOffset] - Allow negative page offsets.\n * The default value is `false`.\n * @property {boolean} [ignoreDestinationZoom] - Ignore the zoom argument in\n * the destination array. The default value is `false`.\n */\n\n /**\n * Scrolls page into view.\n * @param {ScrollPageIntoViewParameters} params\n */\n scrollPageIntoView({\n pageNumber,\n destArray = null,\n allowNegativeOffset = false,\n ignoreDestinationZoom = false,\n }) {\n if (!this.pdfDocument) {\n return;\n }\n const pageView =\n Number.isInteger(pageNumber) && this._pages[pageNumber - 1];\n if (!pageView) {\n console.error(\n `scrollPageIntoView: \"${pageNumber}\" is not a valid pageNumber parameter.`\n );\n return;\n }\n\n if (this.isInPresentationMode || !destArray) {\n this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n return;\n }\n let x = 0,\n y = 0;\n let width = 0,\n height = 0,\n widthScale,\n heightScale;\n const changeOrientation = pageView.rotation % 180 !== 0;\n const pageWidth =\n (changeOrientation ? pageView.height : pageView.width) /\n pageView.scale /\n PixelsPerInch.PDF_TO_CSS_UNITS;\n const pageHeight =\n (changeOrientation ? pageView.width : pageView.height) /\n pageView.scale /\n PixelsPerInch.PDF_TO_CSS_UNITS;\n let scale = 0;\n switch (destArray[1].name) {\n case \"XYZ\":\n x = destArray[2];\n y = destArray[3];\n scale = destArray[4];\n // If x and/or y coordinates are not supplied, default to\n // _top_ left of the page (not the obvious bottom left,\n // since aligning the bottom of the intended page with the\n // top of the window is rarely helpful).\n x = x !== null ? x : 0;\n y = y !== null ? y : pageHeight;\n break;\n case \"Fit\":\n case \"FitB\":\n scale = \"page-fit\";\n break;\n case \"FitH\":\n case \"FitBH\":\n y = destArray[2];\n scale = \"page-width\";\n // According to the PDF spec, section 12.3.2.2, a `null` value in the\n // parameter should maintain the position relative to the new page.\n if (y === null && this._location) {\n x = this._location.left;\n y = this._location.top;\n } else if (typeof y !== \"number\" || y < 0) {\n // The \"top\" value isn't optional, according to the spec, however some\n // bad PDF generators will pretend that it is (fixes bug 1663390).\n y = pageHeight;\n }\n break;\n case \"FitV\":\n case \"FitBV\":\n x = destArray[2];\n width = pageWidth;\n height = pageHeight;\n scale = \"page-height\";\n break;\n case \"FitR\":\n x = destArray[2];\n y = destArray[3];\n width = destArray[4] - x;\n height = destArray[5] - y;\n let hPadding = SCROLLBAR_PADDING,\n vPadding = VERTICAL_PADDING;\n\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this.removePageBorders\n ) {\n hPadding = vPadding = 0;\n }\n widthScale =\n (this.container.clientWidth - hPadding) /\n width /\n PixelsPerInch.PDF_TO_CSS_UNITS;\n heightScale =\n (this.container.clientHeight - vPadding) /\n height /\n PixelsPerInch.PDF_TO_CSS_UNITS;\n scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));\n break;\n default:\n console.error(\n `scrollPageIntoView: \"${destArray[1].name}\" is not a valid destination type.`\n );\n return;\n }\n\n if (!ignoreDestinationZoom) {\n if (scale && scale !== this._currentScale) {\n this.currentScaleValue = scale;\n } else if (this._currentScale === UNKNOWN_SCALE) {\n this.currentScaleValue = DEFAULT_SCALE_VALUE;\n }\n }\n\n if (scale === \"page-fit\" && !destArray[4]) {\n this.#scrollIntoView(pageView);\n return;\n }\n\n const boundingRect = [\n pageView.viewport.convertToViewportPoint(x, y),\n pageView.viewport.convertToViewportPoint(x + width, y + height),\n ];\n let left = Math.min(boundingRect[0][0], boundingRect[1][0]);\n let top = Math.min(boundingRect[0][1], boundingRect[1][1]);\n\n if (!allowNegativeOffset) {\n // Some bad PDF generators will create destinations with e.g. top values\n // that exceeds the page height. Ensure that offsets are not negative,\n // to prevent a previous page from becoming visible (fixes bug 874482).\n left = Math.max(left, 0);\n top = Math.max(top, 0);\n }\n this.#scrollIntoView(pageView, /* pageSpot = */ { left, top });\n }\n\n _updateLocation(firstPage) {\n const currentScale = this._currentScale;\n const currentScaleValue = this._currentScaleValue;\n const normalizedScaleValue =\n parseFloat(currentScaleValue) === currentScale\n ? Math.round(currentScale * 10000) / 100\n : currentScaleValue;\n\n const pageNumber = firstPage.id;\n const currentPageView = this._pages[pageNumber - 1];\n const container = this.container;\n const topLeft = currentPageView.getPagePoint(\n container.scrollLeft - firstPage.x,\n container.scrollTop - firstPage.y\n );\n const intLeft = Math.round(topLeft[0]);\n const intTop = Math.round(topLeft[1]);\n\n let pdfOpenParams = `#page=${pageNumber}`;\n if (!this.isInPresentationMode) {\n pdfOpenParams += `&zoom=${normalizedScaleValue},${intLeft},${intTop}`;\n }\n\n this._location = {\n pageNumber,\n scale: normalizedScaleValue,\n top: intTop,\n left: intLeft,\n rotation: this._pagesRotation,\n pdfOpenParams,\n };\n }\n\n update() {\n const visible = this._getVisiblePages();\n const visiblePages = visible.views,\n numVisiblePages = visiblePages.length;\n\n if (numVisiblePages === 0) {\n return;\n }\n const newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1);\n this.#buffer.resize(newCacheSize, visible.ids);\n\n this.renderingQueue.renderHighestPriority(visible);\n\n const isSimpleLayout =\n this._spreadMode === SpreadMode.NONE &&\n (this._scrollMode === ScrollMode.PAGE ||\n this._scrollMode === ScrollMode.VERTICAL);\n const currentId = this._currentPageNumber;\n let stillFullyVisible = false;\n\n for (const page of visiblePages) {\n if (page.percent < 100) {\n break;\n }\n if (page.id === currentId && isSimpleLayout) {\n stillFullyVisible = true;\n break;\n }\n }\n this._setCurrentPageNumber(\n stillFullyVisible ? currentId : visiblePages[0].id\n );\n\n this._updateLocation(visible.first);\n this.eventBus.dispatch(\"updateviewarea\", {\n source: this,\n location: this._location,\n });\n }\n\n containsElement(element) {\n return this.container.contains(element);\n }\n\n focus() {\n this.container.focus();\n }\n\n get _isContainerRtl() {\n return getComputedStyle(this.container).direction === \"rtl\";\n }\n\n get isInPresentationMode() {\n return this.presentationModeState === PresentationModeState.FULLSCREEN;\n }\n\n get isChangingPresentationMode() {\n return this.presentationModeState === PresentationModeState.CHANGING;\n }\n\n get isHorizontalScrollbarEnabled() {\n return this.isInPresentationMode\n ? false\n : this.container.scrollWidth > this.container.clientWidth;\n }\n\n get isVerticalScrollbarEnabled() {\n return this.isInPresentationMode\n ? false\n : this.container.scrollHeight > this.container.clientHeight;\n }\n\n _getVisiblePages() {\n const views =\n this._scrollMode === ScrollMode.PAGE\n ? this.#scrollModePageState.pages\n : this._pages,\n horizontal = this._scrollMode === ScrollMode.HORIZONTAL,\n rtl = horizontal && this._isContainerRtl;\n\n return getVisibleElements({\n scrollEl: this.container,\n views,\n sortByVisibility: true,\n horizontal,\n rtl,\n });\n }\n\n /**\n * @param {number} pageNumber\n */\n isPageVisible(pageNumber) {\n if (!this.pdfDocument) {\n return false;\n }\n if (\n !(\n Number.isInteger(pageNumber) &&\n pageNumber > 0 &&\n pageNumber <= this.pagesCount\n )\n ) {\n console.error(`isPageVisible: \"${pageNumber}\" is not a valid page.`);\n return false;\n }\n return this._getVisiblePages().ids.has(pageNumber);\n }\n\n /**\n * @param {number} pageNumber\n */\n isPageCached(pageNumber) {\n if (!this.pdfDocument) {\n return false;\n }\n if (\n !(\n Number.isInteger(pageNumber) &&\n pageNumber > 0 &&\n pageNumber <= this.pagesCount\n )\n ) {\n console.error(`isPageCached: \"${pageNumber}\" is not a valid page.`);\n return false;\n }\n const pageView = this._pages[pageNumber - 1];\n return this.#buffer.has(pageView);\n }\n\n cleanup() {\n for (const pageView of this._pages) {\n if (pageView.renderingState !== RenderingStates.FINISHED) {\n pageView.reset();\n }\n }\n }\n\n /**\n * @private\n */\n _cancelRendering() {\n for (const pageView of this._pages) {\n pageView.cancelRendering();\n }\n }\n\n /**\n * @param {PDFPageView} pageView\n * @returns {Promise<PDFPageProxy | null>}\n */\n async #ensurePdfPageLoaded(pageView) {\n if (pageView.pdfPage) {\n return pageView.pdfPage;\n }\n try {\n const pdfPage = await this.pdfDocument.getPage(pageView.id);\n if (!pageView.pdfPage) {\n pageView.setPdfPage(pdfPage);\n }\n if (!this.linkService._cachedPageNumber?.(pdfPage.ref)) {\n this.linkService.cachePageRef(pageView.id, pdfPage.ref);\n }\n return pdfPage;\n } catch (reason) {\n console.error(\"Unable to get page for page view\", reason);\n return null; // Page error -- there is nothing that can be done.\n }\n }\n\n #getScrollAhead(visible) {\n if (visible.first?.id === 1) {\n return true;\n } else if (visible.last?.id === this.pagesCount) {\n return false;\n }\n switch (this._scrollMode) {\n case ScrollMode.PAGE:\n return this.#scrollModePageState.scrollDown;\n case ScrollMode.HORIZONTAL:\n return this.scroll.right;\n }\n return this.scroll.down;\n }\n\n forceRendering(currentlyVisiblePages) {\n const visiblePages = currentlyVisiblePages || this._getVisiblePages();\n const scrollAhead = this.#getScrollAhead(visiblePages);\n const preRenderExtra =\n this._spreadMode !== SpreadMode.NONE &&\n this._scrollMode !== ScrollMode.HORIZONTAL;\n\n const pageView = this.renderingQueue.getHighestPriority(\n visiblePages,\n this._pages,\n scrollAhead,\n preRenderExtra\n );\n\n if (pageView) {\n this.#ensurePdfPageLoaded(pageView).then(() => {\n this.renderingQueue.renderView(pageView);\n });\n return true;\n }\n return false;\n }\n\n /**\n * @type {boolean} Whether all pages of the PDF document have identical\n * widths and heights.\n */\n get hasEqualPageSizes() {\n const firstPageView = this._pages[0];\n for (let i = 1, ii = this._pages.length; i < ii; ++i) {\n const pageView = this._pages[i];\n if (\n pageView.width !== firstPageView.width ||\n pageView.height !== firstPageView.height\n ) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Returns sizes of the pages.\n * @returns {Array} Array of objects with width/height/rotation fields.\n */\n getPagesOverview() {\n return this._pages.map(pageView => {\n const viewport = pageView.pdfPage.getViewport({ scale: 1 });\n\n if (!this.enablePrintAutoRotate || isPortraitOrientation(viewport)) {\n return {\n width: viewport.width,\n height: viewport.height,\n rotation: viewport.rotation,\n };\n }\n // Landscape orientation.\n return {\n width: viewport.height,\n height: viewport.width,\n rotation: (viewport.rotation - 90) % 360,\n };\n });\n }\n\n /**\n * @type {Promise<OptionalContentConfig | null>}\n */\n get optionalContentConfigPromise() {\n if (!this.pdfDocument) {\n return Promise.resolve(null);\n }\n if (!this._optionalContentConfigPromise) {\n console.error(\"optionalContentConfigPromise: Not initialized yet.\");\n // Prevent issues if the getter is accessed *before* the `onePageRendered`\n // promise has resolved; won't (normally) happen in the default viewer.\n return this.pdfDocument.getOptionalContentConfig();\n }\n return this._optionalContentConfigPromise;\n }\n\n /**\n * @param {Promise<OptionalContentConfig>} promise - A promise that is\n * resolved with an {@link OptionalContentConfig} instance.\n */\n set optionalContentConfigPromise(promise) {\n if (!(promise instanceof Promise)) {\n throw new Error(`Invalid optionalContentConfigPromise: ${promise}`);\n }\n if (!this.pdfDocument) {\n return;\n }\n if (!this._optionalContentConfigPromise) {\n // Ignore the setter *before* the `onePageRendered` promise has resolved,\n // since it'll be overwritten anyway; won't happen in the default viewer.\n return;\n }\n this._optionalContentConfigPromise = promise;\n\n this.refresh(false, { optionalContentConfigPromise: promise });\n\n this.eventBus.dispatch(\"optionalcontentconfigchanged\", {\n source: this,\n promise,\n });\n }\n\n /**\n * @type {number} One of the values in {ScrollMode}.\n */\n get scrollMode() {\n return this._scrollMode;\n }\n\n /**\n * @param {number} mode - The direction in which the document pages should be\n * laid out within the scrolling container.\n * The constants from {ScrollMode} should be used.\n */\n set scrollMode(mode) {\n if (this._scrollMode === mode) {\n return; // The Scroll mode didn't change.\n }\n if (!isValidScrollMode(mode)) {\n throw new Error(`Invalid scroll mode: ${mode}`);\n }\n if (this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {\n return; // Disabled for performance reasons.\n }\n this._previousScrollMode = this._scrollMode;\n\n this._scrollMode = mode;\n this.eventBus.dispatch(\"scrollmodechanged\", { source: this, mode });\n\n this._updateScrollMode(/* pageNumber = */ this._currentPageNumber);\n }\n\n _updateScrollMode(pageNumber = null) {\n const scrollMode = this._scrollMode,\n viewer = this.viewer;\n\n viewer.classList.toggle(\n \"scrollHorizontal\",\n scrollMode === ScrollMode.HORIZONTAL\n );\n viewer.classList.toggle(\"scrollWrapped\", scrollMode === ScrollMode.WRAPPED);\n\n if (!this.pdfDocument || !pageNumber) {\n return;\n }\n\n if (scrollMode === ScrollMode.PAGE) {\n this.#ensurePageViewVisible();\n } else if (this._previousScrollMode === ScrollMode.PAGE) {\n // Ensure that the current spreadMode is still applied correctly when\n // the *previous* scrollMode was `ScrollMode.PAGE`.\n this._updateSpreadMode();\n }\n // Non-numeric scale values can be sensitive to the scroll orientation.\n // Call this before re-scrolling to the current page, to ensure that any\n // changes in scale don't move the current page.\n if (this._currentScaleValue && isNaN(this._currentScaleValue)) {\n this.#setScale(this._currentScaleValue, { noScroll: true });\n }\n this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n this.update();\n }\n\n /**\n * @type {number} One of the values in {SpreadMode}.\n */\n get spreadMode() {\n return this._spreadMode;\n }\n\n /**\n * @param {number} mode - Group the pages in spreads, starting with odd- or\n * even-number pages (unless `SpreadMode.NONE` is used).\n * The constants from {SpreadMode} should be used.\n */\n set spreadMode(mode) {\n if (this._spreadMode === mode) {\n return; // The Spread mode didn't change.\n }\n if (!isValidSpreadMode(mode)) {\n throw new Error(`Invalid spread mode: ${mode}`);\n }\n this._spreadMode = mode;\n this.eventBus.dispatch(\"spreadmodechanged\", { source: this, mode });\n\n this._updateSpreadMode(/* pageNumber = */ this._currentPageNumber);\n }\n\n _updateSpreadMode(pageNumber = null) {\n if (!this.pdfDocument) {\n return;\n }\n const viewer = this.viewer,\n pages = this._pages;\n\n if (this._scrollMode === ScrollMode.PAGE) {\n this.#ensurePageViewVisible();\n } else {\n // Temporarily remove all the pages from the DOM.\n viewer.textContent = \"\";\n\n if (this._spreadMode === SpreadMode.NONE) {\n for (const pageView of this._pages) {\n viewer.append(pageView.div);\n }\n } else {\n const parity = this._spreadMode - 1;\n let spread = null;\n for (let i = 0, ii = pages.length; i < ii; ++i) {\n if (spread === null) {\n spread = document.createElement(\"div\");\n spread.className = \"spread\";\n viewer.append(spread);\n } else if (i % 2 === parity) {\n spread = spread.cloneNode(false);\n viewer.append(spread);\n }\n spread.append(pages[i].div);\n }\n }\n }\n\n if (!pageNumber) {\n return;\n }\n // Non-numeric scale values can be sensitive to the scroll orientation.\n // Call this before re-scrolling to the current page, to ensure that any\n // changes in scale don't move the current page.\n if (this._currentScaleValue && isNaN(this._currentScaleValue)) {\n this.#setScale(this._currentScaleValue, { noScroll: true });\n }\n this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n this.update();\n }\n\n /**\n * @private\n */\n _getPageAdvance(currentPageNumber, previous = false) {\n switch (this._scrollMode) {\n case ScrollMode.WRAPPED: {\n const { views } = this._getVisiblePages(),\n pageLayout = new Map();\n\n // Determine the current (visible) page layout.\n for (const { id, y, percent, widthPercent } of views) {\n if (percent === 0 || widthPercent < 100) {\n continue;\n }\n let yArray = pageLayout.get(y);\n if (!yArray) {\n pageLayout.set(y, (yArray ||= []));\n }\n yArray.push(id);\n }\n // Find the row of the current page.\n for (const yArray of pageLayout.values()) {\n const currentIndex = yArray.indexOf(currentPageNumber);\n if (currentIndex === -1) {\n continue;\n }\n const numPages = yArray.length;\n if (numPages === 1) {\n break;\n }\n // Handle documents with varying page sizes.\n if (previous) {\n for (let i = currentIndex - 1, ii = 0; i >= ii; i--) {\n const currentId = yArray[i],\n expectedId = yArray[i + 1] - 1;\n if (currentId < expectedId) {\n return currentPageNumber - expectedId;\n }\n }\n } else {\n for (let i = currentIndex + 1, ii = numPages; i < ii; i++) {\n const currentId = yArray[i],\n expectedId = yArray[i - 1] + 1;\n if (currentId > expectedId) {\n return expectedId - currentPageNumber;\n }\n }\n }\n // The current row is \"complete\", advance to the previous/next one.\n if (previous) {\n const firstId = yArray[0];\n if (firstId < currentPageNumber) {\n return currentPageNumber - firstId + 1;\n }\n } else {\n const lastId = yArray[numPages - 1];\n if (lastId > currentPageNumber) {\n return lastId - currentPageNumber + 1;\n }\n }\n break;\n }\n break;\n }\n case ScrollMode.HORIZONTAL: {\n break;\n }\n case ScrollMode.PAGE:\n case ScrollMode.VERTICAL: {\n if (this._spreadMode === SpreadMode.NONE) {\n break; // Normal vertical scrolling.\n }\n const parity = this._spreadMode - 1;\n\n if (previous && currentPageNumber % 2 !== parity) {\n break; // Left-hand side page.\n } else if (!previous && currentPageNumber % 2 === parity) {\n break; // Right-hand side page.\n }\n const { views } = this._getVisiblePages(),\n expectedId = previous ? currentPageNumber - 1 : currentPageNumber + 1;\n\n for (const { id, percent, widthPercent } of views) {\n if (id !== expectedId) {\n continue;\n }\n if (percent > 0 && widthPercent === 100) {\n return 2;\n }\n break;\n }\n break;\n }\n }\n return 1;\n }\n\n /**\n * Go to the next page, taking scroll/spread-modes into account.\n * @returns {boolean} Whether navigation occurred.\n */\n nextPage() {\n const currentPageNumber = this._currentPageNumber,\n pagesCount = this.pagesCount;\n\n if (currentPageNumber >= pagesCount) {\n return false;\n }\n const advance =\n this._getPageAdvance(currentPageNumber, /* previous = */ false) || 1;\n\n this.currentPageNumber = Math.min(currentPageNumber + advance, pagesCount);\n return true;\n }\n\n /**\n * Go to the previous page, taking scroll/spread-modes into account.\n * @returns {boolean} Whether navigation occurred.\n */\n previousPage() {\n const currentPageNumber = this._currentPageNumber;\n\n if (currentPageNumber <= 1) {\n return false;\n }\n const advance =\n this._getPageAdvance(currentPageNumber, /* previous = */ true) || 1;\n\n this.currentPageNumber = Math.max(currentPageNumber - advance, 1);\n return true;\n }\n\n /**\n * @typedef {Object} ChangeScaleOptions\n * @property {number} [drawingDelay]\n * @property {number} [scaleFactor]\n * @property {number} [steps]\n */\n\n /**\n * Increase the current zoom level one, or more, times.\n * @param {ChangeScaleOptions} [options]\n */\n increaseScale({ drawingDelay, scaleFactor, steps } = {}) {\n if (!this.pdfDocument) {\n return;\n }\n let newScale = this._currentScale;\n if (scaleFactor > 1) {\n newScale = Math.round(newScale * scaleFactor * 100) / 100;\n } else {\n steps ??= 1;\n do {\n newScale =\n Math.ceil((newScale * DEFAULT_SCALE_DELTA).toFixed(2) * 10) / 10;\n } while (--steps > 0 && newScale < MAX_SCALE);\n }\n this.#setScale(Math.min(MAX_SCALE, newScale), {\n noScroll: false,\n drawingDelay,\n });\n }\n\n /**\n * Decrease the current zoom level one, or more, times.\n * @param {ChangeScaleOptions} [options]\n */\n decreaseScale({ drawingDelay, scaleFactor, steps } = {}) {\n if (!this.pdfDocument) {\n return;\n }\n let newScale = this._currentScale;\n if (scaleFactor > 0 && scaleFactor < 1) {\n newScale = Math.round(newScale * scaleFactor * 100) / 100;\n } else {\n steps ??= 1;\n do {\n newScale =\n Math.floor((newScale / DEFAULT_SCALE_DELTA).toFixed(2) * 10) / 10;\n } while (--steps > 0 && newScale > MIN_SCALE);\n }\n this.#setScale(Math.max(MIN_SCALE, newScale), {\n noScroll: false,\n drawingDelay,\n });\n }\n\n #updateContainerHeightCss(height = this.container.clientHeight) {\n if (height !== this.#previousContainerHeight) {\n this.#previousContainerHeight = height;\n docStyle.setProperty(\"--viewer-container-height\", `${height}px`);\n }\n }\n\n #resizeObserverCallback(entries) {\n for (const entry of entries) {\n if (entry.target === this.container) {\n this.#updateContainerHeightCss(\n Math.floor(entry.borderBoxSize[0].blockSize)\n );\n this.#containerTopLeft = null;\n break;\n }\n }\n }\n\n get containerTopLeft() {\n return (this.#containerTopLeft ||= [\n this.container.offsetTop,\n this.container.offsetLeft,\n ]);\n }\n\n /**\n * @type {number}\n */\n get annotationEditorMode() {\n return this.#annotationEditorUIManager\n ? this.#annotationEditorMode\n : AnnotationEditorType.DISABLE;\n }\n\n /**\n * @param {number} mode - AnnotationEditor mode (None, FreeText, Ink, ...)\n */\n set annotationEditorMode(mode) {\n if (!this.#annotationEditorUIManager) {\n throw new Error(`The AnnotationEditor is not enabled.`);\n }\n if (this.#annotationEditorMode === mode) {\n return; // The AnnotationEditor mode didn't change.\n }\n if (!isValidAnnotationEditorMode(mode)) {\n throw new Error(`Invalid AnnotationEditor mode: ${mode}`);\n }\n if (!this.pdfDocument) {\n return;\n }\n this.#annotationEditorMode = mode;\n this.eventBus.dispatch(\"annotationeditormodechanged\", {\n source: this,\n mode,\n });\n\n this.#annotationEditorUIManager.updateMode(mode);\n }\n\n // eslint-disable-next-line accessor-pairs\n set annotationEditorParams({ type, value }) {\n if (!this.#annotationEditorUIManager) {\n throw new Error(`The AnnotationEditor is not enabled.`);\n }\n this.#annotationEditorUIManager.updateParams(type, value);\n }\n\n refresh(noUpdate = false, updateArgs = Object.create(null)) {\n if (!this.pdfDocument) {\n return;\n }\n for (const pageView of this._pages) {\n pageView.update(updateArgs);\n }\n if (this.#scaleTimeoutId !== null) {\n clearTimeout(this.#scaleTimeoutId);\n this.#scaleTimeoutId = null;\n }\n if (!noUpdate) {\n this.update();\n }\n }\n}\n\nexport { PagesCountLimit, PDFPageViewBuffer, PDFViewer };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A subset of the l10n strings in the `l10n/en-US/viewer.properties` file.\n */\nconst DEFAULT_L10N_STRINGS = {\n of_pages: \"of {{pagesCount}}\",\n page_of_pages: \"({{pageNumber}} of {{pagesCount}})\",\n\n document_properties_kb: \"{{size_kb}} KB ({{size_b}} bytes)\",\n document_properties_mb: \"{{size_mb}} MB ({{size_b}} bytes)\",\n document_properties_date_string: \"{{date}}, {{time}}\",\n document_properties_page_size_unit_inches: \"in\",\n document_properties_page_size_unit_millimeters: \"mm\",\n document_properties_page_size_orientation_portrait: \"portrait\",\n document_properties_page_size_orientation_landscape: \"landscape\",\n document_properties_page_size_name_a3: \"A3\",\n document_properties_page_size_name_a4: \"A4\",\n document_properties_page_size_name_letter: \"Letter\",\n document_properties_page_size_name_legal: \"Legal\",\n document_properties_page_size_dimension_string:\n \"{{width}} × {{height}} {{unit}} ({{orientation}})\",\n document_properties_page_size_dimension_name_string:\n \"{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})\",\n document_properties_linearized_yes: \"Yes\",\n document_properties_linearized_no: \"No\",\n\n additional_layers: \"Additional Layers\",\n page_landmark: \"Page {{page}}\",\n thumb_page_title: \"Page {{page}}\",\n thumb_page_canvas: \"Thumbnail of Page {{page}}\",\n\n find_reached_top: \"Reached top of document, continued from bottom\",\n find_reached_bottom: \"Reached end of document, continued from top\",\n \"find_match_count[one]\": \"{{current}} of {{total}} match\",\n \"find_match_count[other]\": \"{{current}} of {{total}} matches\",\n \"find_match_count_limit[one]\": \"More than {{limit}} match\",\n \"find_match_count_limit[other]\": \"More than {{limit}} matches\",\n find_not_found: \"Phrase not found\",\n\n page_scale_width: \"Page Width\",\n page_scale_fit: \"Page Fit\",\n page_scale_auto: \"Automatic Zoom\",\n page_scale_actual: \"Actual Size\",\n page_scale_percent: \"{{scale}}%\",\n\n loading_error: \"An error occurred while loading the PDF.\",\n invalid_file_error: \"Invalid or corrupted PDF file.\",\n missing_file_error: \"Missing PDF file.\",\n unexpected_response_error: \"Unexpected server response.\",\n rendering_error: \"An error occurred while rendering the page.\",\n\n printing_not_supported:\n \"Warning: Printing is not fully supported by this browser.\",\n printing_not_ready: \"Warning: The PDF is not fully loaded for printing.\",\n web_fonts_disabled:\n \"Web fonts are disabled: unable to use embedded PDF fonts.\",\n\n free_text2_default_content: \"Start typing…\",\n editor_free_text2_aria_label: \"Text Editor\",\n editor_ink2_aria_label: \"Draw Editor\",\n editor_ink_canvas_aria_label: \"User-created image\",\n};\nif (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n DEFAULT_L10N_STRINGS.print_progress_percent = \"{{progress}}%\";\n}\n\nfunction getL10nFallback(key, args) {\n switch (key) {\n case \"find_match_count\":\n key = `find_match_count[${args.total === 1 ? \"one\" : \"other\"}]`;\n break;\n case \"find_match_count_limit\":\n key = `find_match_count_limit[${args.limit === 1 ? \"one\" : \"other\"}]`;\n break;\n }\n return DEFAULT_L10N_STRINGS[key] || \"\";\n}\n\nconst PARTIAL_LANG_CODES = {\n en: \"en-US\",\n es: \"es-ES\",\n fy: \"fy-NL\",\n ga: \"ga-IE\",\n gu: \"gu-IN\",\n hi: \"hi-IN\",\n hy: \"hy-AM\",\n nb: \"nb-NO\",\n ne: \"ne-NP\",\n nn: \"nn-NO\",\n pa: \"pa-IN\",\n pt: \"pt-PT\",\n sv: \"sv-SE\",\n zh: \"zh-CN\",\n};\n\n// Try to support \"incompletely\" specified language codes (see issue 13689).\nfunction fixupLangCode(langCode) {\n return PARTIAL_LANG_CODES[langCode?.toLowerCase()] || langCode;\n}\n\n// Replaces {{arguments}} with their values.\nfunction formatL10nValue(text, args) {\n if (!args) {\n return text;\n }\n return text.replaceAll(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (all, name) => {\n return name in args ? args[name] : \"{{\" + name + \"}}\";\n });\n}\n\n/**\n * No-op implementation of the localization service.\n * @implements {IL10n}\n */\nconst NullL10n = {\n async getLanguage() {\n return \"en-us\";\n },\n\n async getDirection() {\n return \"ltr\";\n },\n\n async get(key, args = null, fallback = getL10nFallback(key, args)) {\n return formatL10nValue(fallback, args);\n },\n\n async translate(element) {},\n};\n\nexport { fixupLangCode, getL10nFallback, NullL10n };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/optional_content_config\").OptionalContentConfig} OptionalContentConfig */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n/** @typedef {import(\"./interfaces\").IRenderableView} IRenderableView */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n\nimport {\n AbortException,\n AnnotationMode,\n createPromiseCapability,\n PixelsPerInch,\n RenderingCancelledException,\n setLayerDimensions,\n shadow,\n SVGGraphics,\n} from \"pdfjs-lib\";\nimport {\n approximateFraction,\n DEFAULT_SCALE,\n OutputScale,\n RendererType,\n RenderingStates,\n roundToDivide,\n TextLayerMode,\n} from \"./ui_utils.js\";\nimport { AnnotationEditorLayerBuilder } from \"./annotation_editor_layer_builder.js\";\nimport { AnnotationLayerBuilder } from \"./annotation_layer_builder.js\";\nimport { compatibilityParams } from \"./app_options.js\";\nimport { NullL10n } from \"./l10n_utils.js\";\nimport { SimpleLinkService } from \"./pdf_link_service.js\";\nimport { StructTreeLayerBuilder } from \"./struct_tree_layer_builder.js\";\nimport { TextAccessibilityManager } from \"./text_accessibility.js\";\nimport { TextHighlighter } from \"./text_highlighter.js\";\nimport { TextLayerBuilder } from \"./text_layer_builder.js\";\nimport { XfaLayerBuilder } from \"./xfa_layer_builder.js\";\n\n/**\n * @typedef {Object} PDFPageViewOptions\n * @property {HTMLDivElement} [container] - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} id - The page unique ID (normally its number).\n * @property {number} [scale] - The page scale display.\n * @property {PageViewport} defaultViewport - The page viewport.\n * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -\n * A promise that is resolved with an {@link OptionalContentConfig} instance.\n * The default value is `null`.\n * @property {PDFRenderingQueue} [renderingQueue] - The rendering queue object.\n * @property {number} [textLayerMode] - Controls if the text layer used for\n * selection and searching is created. The constants from {TextLayerMode}\n * should be used. The default value is `TextLayerMode.ENABLE`.\n * @property {number} [annotationMode] - Controls if the annotation layer is\n * created, and if interactive form elements or `AnnotationStorage`-data are\n * being rendered. The constants from {@link AnnotationMode} should be used;\n * see also {@link RenderParameters} and {@link GetOperatorListParameters}.\n * The default value is `AnnotationMode.ENABLE_FORMS`.\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n * for annotation icons. Include trailing slash.\n * @property {boolean} [useOnlyCssZoom] - Enables CSS only zooming. The default\n * value is `false`.\n * @property {boolean} [isOffscreenCanvasSupported] - Allows to use an\n * OffscreenCanvas if needed.\n * @property {number} [maxCanvasPixels] - The maximum supported canvas size in\n * total pixels, i.e. width * height. Use -1 for no limit. The default value\n * is 4096 * 4096 (16 mega-pixels).\n * @property {Object} [pageColors] - Overwrites background and foreground colors\n * with user defined ones in order to improve readability in high contrast\n * mode.\n * @property {IL10n} [l10n] - Localization service.\n * @property {function} [layerProperties] - The function that is used to lookup\n * the necessary layer-properties.\n */\n\nconst MAX_CANVAS_PIXELS = compatibilityParams.maxCanvasPixels || 16777216;\n\nconst DEFAULT_LAYER_PROPERTIES = () => {\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"COMPONENTS\")) {\n return null;\n }\n return {\n annotationEditorUIManager: null,\n annotationStorage: null,\n downloadManager: null,\n enableScripting: false,\n fieldObjectsPromise: null,\n findController: null,\n hasJSActionsPromise: null,\n get linkService() {\n return new SimpleLinkService();\n },\n };\n};\n\n/**\n * @implements {IRenderableView}\n */\nclass PDFPageView {\n #annotationMode = AnnotationMode.ENABLE_FORMS;\n\n #layerProperties = null;\n\n #loadingId = null;\n\n #previousRotation = null;\n\n #renderingState = RenderingStates.INITIAL;\n\n #useThumbnailCanvas = {\n initialOptionalContent: true,\n regularAnnotations: true,\n };\n\n /**\n * @param {PDFPageViewOptions} options\n */\n constructor(options) {\n const container = options.container;\n const defaultViewport = options.defaultViewport;\n\n this.id = options.id;\n this.renderingId = \"page\" + this.id;\n this.#layerProperties = options.layerProperties || DEFAULT_LAYER_PROPERTIES;\n\n this.pdfPage = null;\n this.pageLabel = null;\n this.rotation = 0;\n this.scale = options.scale || DEFAULT_SCALE;\n this.viewport = defaultViewport;\n this.pdfPageRotate = defaultViewport.rotation;\n this._optionalContentConfigPromise =\n options.optionalContentConfigPromise || null;\n this.hasRestrictedScaling = false;\n this.textLayerMode = options.textLayerMode ?? TextLayerMode.ENABLE;\n this.#annotationMode =\n options.annotationMode ?? AnnotationMode.ENABLE_FORMS;\n this.imageResourcesPath = options.imageResourcesPath || \"\";\n this.useOnlyCssZoom = options.useOnlyCssZoom || false;\n this.isOffscreenCanvasSupported =\n options.isOffscreenCanvasSupported ?? true;\n this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS;\n this.pageColors = options.pageColors || null;\n\n this.eventBus = options.eventBus;\n this.renderingQueue = options.renderingQueue;\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n ) {\n this.renderer = options.renderer || RendererType.CANVAS;\n }\n this.l10n = options.l10n || NullL10n;\n\n this.paintTask = null;\n this.paintedViewportMap = new WeakMap();\n this.resume = null;\n this._renderError = null;\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n ) {\n this._isStandalone = !this.renderingQueue?.hasViewer();\n }\n\n this._annotationCanvasMap = null;\n\n this.annotationLayer = null;\n this.annotationEditorLayer = null;\n this.textLayer = null;\n this.zoomLayer = null;\n this.xfaLayer = null;\n this.structTreeLayer = null;\n\n const div = document.createElement(\"div\");\n div.className = \"page\";\n div.setAttribute(\"data-page-number\", this.id);\n div.setAttribute(\"role\", \"region\");\n this.l10n.get(\"page_landmark\", { page: this.id }).then(msg => {\n div.setAttribute(\"aria-label\", msg);\n });\n this.div = div;\n\n this.#setDimensions();\n container?.append(div);\n\n if (\n (typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")) &&\n this._isStandalone\n ) {\n // Ensure that the various layers always get the correct initial size,\n // see issue 15795.\n container?.style.setProperty(\n \"--scale-factor\",\n this.scale * PixelsPerInch.PDF_TO_CSS_UNITS\n );\n\n const { optionalContentConfigPromise } = options;\n if (optionalContentConfigPromise) {\n // Ensure that the thumbnails always display the *initial* document\n // state, for documents with optional content.\n optionalContentConfigPromise.then(optionalContentConfig => {\n if (\n optionalContentConfigPromise !== this._optionalContentConfigPromise\n ) {\n return;\n }\n this.#useThumbnailCanvas.initialOptionalContent =\n optionalContentConfig.hasInitialVisibility;\n });\n }\n }\n }\n\n get renderingState() {\n return this.#renderingState;\n }\n\n set renderingState(state) {\n if (state === this.#renderingState) {\n return;\n }\n this.#renderingState = state;\n\n if (this.#loadingId) {\n clearTimeout(this.#loadingId);\n this.#loadingId = null;\n }\n\n switch (state) {\n case RenderingStates.PAUSED:\n this.div.classList.remove(\"loading\");\n break;\n case RenderingStates.RUNNING:\n this.div.classList.add(\"loadingIcon\");\n this.#loadingId = setTimeout(() => {\n // Adding the loading class is slightly postponed in order to not have\n // it with loadingIcon.\n // If we don't do that the visibility of the background is changed but\n // the transition isn't triggered.\n this.div.classList.add(\"loading\");\n this.#loadingId = null;\n }, 0);\n break;\n case RenderingStates.INITIAL:\n case RenderingStates.FINISHED:\n this.div.classList.remove(\"loadingIcon\", \"loading\");\n break;\n }\n }\n\n #setDimensions() {\n const { viewport } = this;\n if (this.pdfPage) {\n if (this.#previousRotation === viewport.rotation) {\n return;\n }\n this.#previousRotation = viewport.rotation;\n }\n\n setLayerDimensions(\n this.div,\n viewport,\n /* mustFlip = */ true,\n /* mustRotate = */ false\n );\n }\n\n setPdfPage(pdfPage) {\n this.pdfPage = pdfPage;\n this.pdfPageRotate = pdfPage.rotate;\n\n const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = pdfPage.getViewport({\n scale: this.scale * PixelsPerInch.PDF_TO_CSS_UNITS,\n rotation: totalRotation,\n });\n this.#setDimensions();\n this.reset();\n }\n\n destroy() {\n this.reset();\n this.pdfPage?.cleanup();\n }\n\n get _textHighlighter() {\n return shadow(\n this,\n \"_textHighlighter\",\n new TextHighlighter({\n pageIndex: this.id - 1,\n eventBus: this.eventBus,\n findController: this.#layerProperties().findController,\n })\n );\n }\n\n async #renderAnnotationLayer() {\n let error = null;\n try {\n await this.annotationLayer.render(this.viewport, \"display\");\n } catch (ex) {\n console.error(`#renderAnnotationLayer: \"${ex}\".`);\n error = ex;\n } finally {\n this.eventBus.dispatch(\"annotationlayerrendered\", {\n source: this,\n pageNumber: this.id,\n error,\n });\n }\n }\n\n async #renderAnnotationEditorLayer() {\n let error = null;\n try {\n await this.annotationEditorLayer.render(this.viewport, \"display\");\n } catch (ex) {\n console.error(`#renderAnnotationEditorLayer: \"${ex}\".`);\n error = ex;\n } finally {\n this.eventBus.dispatch(\"annotationeditorlayerrendered\", {\n source: this,\n pageNumber: this.id,\n error,\n });\n }\n }\n\n async #renderXfaLayer() {\n let error = null;\n try {\n const result = await this.xfaLayer.render(this.viewport, \"display\");\n if (result?.textDivs && this._textHighlighter) {\n this.#buildXfaTextContentItems(result.textDivs);\n }\n } catch (ex) {\n console.error(`#renderXfaLayer: \"${ex}\".`);\n error = ex;\n } finally {\n this.eventBus.dispatch(\"xfalayerrendered\", {\n source: this,\n pageNumber: this.id,\n error,\n });\n }\n }\n\n async #renderTextLayer() {\n const { pdfPage, textLayer, viewport } = this;\n if (!textLayer) {\n return;\n }\n\n let error = null;\n try {\n if (!textLayer.renderingDone) {\n const readableStream = pdfPage.streamTextContent({\n includeMarkedContent: true,\n });\n textLayer.setTextContentSource(readableStream);\n }\n await textLayer.render(viewport);\n } catch (ex) {\n if (ex instanceof AbortException) {\n return;\n }\n console.error(`#renderTextLayer: \"${ex}\".`);\n error = ex;\n }\n\n this.eventBus.dispatch(\"textlayerrendered\", {\n source: this,\n pageNumber: this.id,\n numTextDivs: textLayer.numTextDivs,\n error,\n });\n\n this.#renderStructTreeLayer();\n }\n\n /**\n * The structure tree is currently only supported when the text layer is\n * enabled and a canvas is used for rendering.\n *\n * The structure tree must be generated after the text layer for the\n * aria-owns to work.\n */\n async #renderStructTreeLayer() {\n if (!this.textLayer) {\n return;\n }\n this.structTreeLayer ||= new StructTreeLayerBuilder();\n\n const tree = await (!this.structTreeLayer.renderingDone\n ? this.pdfPage.getStructTree()\n : null);\n const treeDom = this.structTreeLayer?.render(tree);\n if (treeDom) {\n this.canvas?.append(treeDom);\n }\n this.structTreeLayer?.show();\n }\n\n async #buildXfaTextContentItems(textDivs) {\n const text = await this.pdfPage.getTextContent();\n const items = [];\n for (const item of text.items) {\n items.push(item.str);\n }\n this._textHighlighter.setTextMapping(textDivs, items);\n this._textHighlighter.enable();\n }\n\n /**\n * @private\n */\n _resetZoomLayer(removeFromDOM = false) {\n if (!this.zoomLayer) {\n return;\n }\n const zoomLayerCanvas = this.zoomLayer.firstChild;\n this.paintedViewportMap.delete(zoomLayerCanvas);\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n zoomLayerCanvas.width = 0;\n zoomLayerCanvas.height = 0;\n\n if (removeFromDOM) {\n // Note: `ChildNode.remove` doesn't throw if the parent node is undefined.\n this.zoomLayer.remove();\n }\n this.zoomLayer = null;\n }\n\n reset({\n keepZoomLayer = false,\n keepAnnotationLayer = false,\n keepAnnotationEditorLayer = false,\n keepXfaLayer = false,\n keepTextLayer = false,\n } = {}) {\n this.cancelRendering({\n keepAnnotationLayer,\n keepAnnotationEditorLayer,\n keepXfaLayer,\n keepTextLayer,\n });\n this.renderingState = RenderingStates.INITIAL;\n\n const div = this.div;\n\n const childNodes = div.childNodes,\n zoomLayerNode = (keepZoomLayer && this.zoomLayer) || null,\n annotationLayerNode =\n (keepAnnotationLayer && this.annotationLayer?.div) || null,\n annotationEditorLayerNode =\n (keepAnnotationEditorLayer && this.annotationEditorLayer?.div) || null,\n xfaLayerNode = (keepXfaLayer && this.xfaLayer?.div) || null,\n textLayerNode = (keepTextLayer && this.textLayer?.div) || null;\n for (let i = childNodes.length - 1; i >= 0; i--) {\n const node = childNodes[i];\n switch (node) {\n case zoomLayerNode:\n case annotationLayerNode:\n case annotationEditorLayerNode:\n case xfaLayerNode:\n case textLayerNode:\n continue;\n }\n node.remove();\n }\n div.removeAttribute(\"data-loaded\");\n\n if (annotationLayerNode) {\n // Hide the annotation layer until all elements are resized\n // so they are not displayed on the already resized page.\n this.annotationLayer.hide();\n }\n if (annotationEditorLayerNode) {\n this.annotationEditorLayer.hide();\n }\n if (xfaLayerNode) {\n // Hide the XFA layer until all elements are resized\n // so they are not displayed on the already resized page.\n this.xfaLayer.hide();\n }\n if (textLayerNode) {\n this.textLayer.hide();\n }\n this.structTreeLayer?.hide();\n\n if (!zoomLayerNode) {\n if (this.canvas) {\n this.paintedViewportMap.delete(this.canvas);\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n this.canvas.width = 0;\n this.canvas.height = 0;\n delete this.canvas;\n }\n this._resetZoomLayer();\n }\n if (\n (typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")) &&\n this.svg\n ) {\n this.paintedViewportMap.delete(this.svg);\n delete this.svg;\n }\n }\n\n update({\n scale = 0,\n rotation = null,\n optionalContentConfigPromise = null,\n drawingDelay = -1,\n }) {\n this.scale = scale || this.scale;\n if (typeof rotation === \"number\") {\n this.rotation = rotation; // The rotation may be zero.\n }\n if (optionalContentConfigPromise instanceof Promise) {\n this._optionalContentConfigPromise = optionalContentConfigPromise;\n\n // Ensure that the thumbnails always display the *initial* document state,\n // for documents with optional content.\n optionalContentConfigPromise.then(optionalContentConfig => {\n if (\n optionalContentConfigPromise !== this._optionalContentConfigPromise\n ) {\n return;\n }\n this.#useThumbnailCanvas.initialOptionalContent =\n optionalContentConfig.hasInitialVisibility;\n });\n }\n\n const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = this.viewport.clone({\n scale: this.scale * PixelsPerInch.PDF_TO_CSS_UNITS,\n rotation: totalRotation,\n });\n this.#setDimensions();\n\n if (\n (typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")) &&\n this._isStandalone\n ) {\n this.div.parentNode?.style.setProperty(\n \"--scale-factor\",\n this.viewport.scale\n );\n }\n\n if (\n (typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")) &&\n this.svg\n ) {\n this.cssTransform({\n target: this.svg,\n redrawAnnotationLayer: true,\n redrawAnnotationEditorLayer: true,\n redrawXfaLayer: true,\n redrawTextLayer: true,\n });\n\n this.eventBus.dispatch(\"pagerendered\", {\n source: this,\n pageNumber: this.id,\n cssTransform: true,\n timestamp: performance.now(),\n error: this._renderError,\n });\n return;\n }\n\n let isScalingRestricted = false;\n if (this.canvas && this.maxCanvasPixels > 0) {\n const outputScale = this.outputScale;\n if (\n ((Math.floor(this.viewport.width) * outputScale.sx) | 0) *\n ((Math.floor(this.viewport.height) * outputScale.sy) | 0) >\n this.maxCanvasPixels\n ) {\n isScalingRestricted = true;\n }\n }\n const onlyCssZoom =\n this.useOnlyCssZoom || (this.hasRestrictedScaling && isScalingRestricted);\n const postponeDrawing =\n !onlyCssZoom && drawingDelay >= 0 && drawingDelay < 1000;\n\n if (this.canvas) {\n if (postponeDrawing || onlyCssZoom) {\n if (\n postponeDrawing &&\n this.renderingState !== RenderingStates.FINISHED\n ) {\n this.cancelRendering({\n keepZoomLayer: true,\n keepAnnotationLayer: true,\n keepAnnotationEditorLayer: true,\n keepXfaLayer: true,\n keepTextLayer: true,\n cancelExtraDelay: drawingDelay,\n });\n // It isn't really finished, but once we have finished\n // to postpone, we'll call this.reset(...) which will set\n // the rendering state to INITIAL, hence the next call to\n // PDFViewer.update() will trigger a redraw (if it's mandatory).\n this.renderingState = RenderingStates.FINISHED;\n }\n\n this.cssTransform({\n target: this.canvas,\n redrawAnnotationLayer: true,\n redrawAnnotationEditorLayer: true,\n redrawXfaLayer: true,\n redrawTextLayer: !postponeDrawing,\n hideTextLayer: postponeDrawing,\n });\n\n this.eventBus.dispatch(\"pagerendered\", {\n source: this,\n pageNumber: this.id,\n cssTransform: true,\n timestamp: performance.now(),\n error: this._renderError,\n });\n return;\n }\n if (!this.zoomLayer && !this.canvas.hidden) {\n this.zoomLayer = this.canvas.parentNode;\n this.zoomLayer.style.position = \"absolute\";\n }\n }\n if (this.zoomLayer) {\n this.cssTransform({ target: this.zoomLayer.firstChild });\n }\n this.reset({\n keepZoomLayer: true,\n keepAnnotationLayer: true,\n keepAnnotationEditorLayer: true,\n keepXfaLayer: true,\n keepTextLayer: true,\n });\n }\n\n /**\n * PLEASE NOTE: Most likely you want to use the `this.reset()` method,\n * rather than calling this one directly.\n */\n cancelRendering({\n keepAnnotationLayer = false,\n keepAnnotationEditorLayer = false,\n keepXfaLayer = false,\n keepTextLayer = false,\n cancelExtraDelay = 0,\n } = {}) {\n if (this.paintTask) {\n this.paintTask.cancel(cancelExtraDelay);\n this.paintTask = null;\n }\n this.resume = null;\n\n if (this.textLayer && (!keepTextLayer || !this.textLayer.div)) {\n this.textLayer.cancel();\n this.textLayer = null;\n }\n if (this.structTreeLayer && !this.textLayer) {\n this.structTreeLayer = null;\n }\n if (\n this.annotationLayer &&\n (!keepAnnotationLayer || !this.annotationLayer.div)\n ) {\n this.annotationLayer.cancel();\n this.annotationLayer = null;\n this._annotationCanvasMap = null;\n }\n if (\n this.annotationEditorLayer &&\n (!keepAnnotationEditorLayer || !this.annotationEditorLayer.div)\n ) {\n this.annotationEditorLayer.cancel();\n this.annotationEditorLayer = null;\n }\n if (this.xfaLayer && (!keepXfaLayer || !this.xfaLayer.div)) {\n this.xfaLayer.cancel();\n this.xfaLayer = null;\n this._textHighlighter?.disable();\n }\n }\n\n cssTransform({\n target,\n redrawAnnotationLayer = false,\n redrawAnnotationEditorLayer = false,\n redrawXfaLayer = false,\n redrawTextLayer = false,\n hideTextLayer = false,\n }) {\n // Scale target (canvas or svg), its wrapper and page container.\n\n if (target instanceof HTMLCanvasElement) {\n if (!target.hasAttribute(\"zooming\")) {\n target.setAttribute(\"zooming\", true);\n const { style } = target;\n style.width = style.height = \"\";\n }\n } else {\n const div = this.div;\n const { width, height } = this.viewport;\n\n target.style.width =\n target.parentNode.style.width =\n div.style.width =\n Math.floor(width) + \"px\";\n target.style.height =\n target.parentNode.style.height =\n div.style.height =\n Math.floor(height) + \"px\";\n }\n\n const originalViewport = this.paintedViewportMap.get(target);\n if (this.viewport !== originalViewport) {\n // The canvas may have been originally rotated; rotate relative to that.\n const relativeRotation =\n this.viewport.rotation - originalViewport.rotation;\n const absRotation = Math.abs(relativeRotation);\n let scaleX = 1,\n scaleY = 1;\n if (absRotation === 90 || absRotation === 270) {\n const { width, height } = this.viewport;\n // Scale x and y because of the rotation.\n scaleX = height / width;\n scaleY = width / height;\n }\n target.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX}, ${scaleY})`;\n }\n\n if (redrawAnnotationLayer && this.annotationLayer) {\n this.#renderAnnotationLayer();\n }\n if (redrawAnnotationEditorLayer && this.annotationEditorLayer) {\n this.#renderAnnotationEditorLayer();\n }\n if (redrawXfaLayer && this.xfaLayer) {\n this.#renderXfaLayer();\n }\n\n if (this.textLayer) {\n if (hideTextLayer) {\n this.textLayer.hide();\n this.structTreeLayer?.hide();\n } else if (redrawTextLayer) {\n this.#renderTextLayer();\n }\n }\n }\n\n get width() {\n return this.viewport.width;\n }\n\n get height() {\n return this.viewport.height;\n }\n\n getPagePoint(x, y) {\n return this.viewport.convertToPdfPoint(x, y);\n }\n\n draw() {\n if (this.renderingState !== RenderingStates.INITIAL) {\n console.error(\"Must be in new state before drawing\");\n this.reset(); // Ensure that we reset all state to prevent issues.\n }\n const { div, pdfPage } = this;\n\n if (!pdfPage) {\n this.renderingState = RenderingStates.FINISHED;\n return Promise.reject(new Error(\"pdfPage is not loaded\"));\n }\n\n this.renderingState = RenderingStates.RUNNING;\n\n // Wrap the canvas so that if it has a CSS transform for high DPI the\n // overflow will be hidden in Firefox.\n const canvasWrapper = document.createElement(\"div\");\n canvasWrapper.classList.add(\"canvasWrapper\");\n div.append(canvasWrapper);\n\n if (\n !this.textLayer &&\n this.textLayerMode !== TextLayerMode.DISABLE &&\n !pdfPage.isPureXfa\n ) {\n this._accessibilityManager ||= new TextAccessibilityManager();\n\n this.textLayer = new TextLayerBuilder({\n highlighter: this._textHighlighter,\n accessibilityManager: this._accessibilityManager,\n isOffscreenCanvasSupported: this.isOffscreenCanvasSupported,\n });\n div.append(this.textLayer.div);\n }\n\n if (\n !this.annotationLayer &&\n this.#annotationMode !== AnnotationMode.DISABLE\n ) {\n const {\n annotationStorage,\n downloadManager,\n enableScripting,\n fieldObjectsPromise,\n hasJSActionsPromise,\n linkService,\n } = this.#layerProperties();\n\n this._annotationCanvasMap ||= new Map();\n this.annotationLayer = new AnnotationLayerBuilder({\n pageDiv: div,\n pdfPage,\n annotationStorage,\n imageResourcesPath: this.imageResourcesPath,\n renderForms: this.#annotationMode === AnnotationMode.ENABLE_FORMS,\n linkService,\n downloadManager,\n l10n: this.l10n,\n enableScripting,\n hasJSActionsPromise,\n fieldObjectsPromise,\n annotationCanvasMap: this._annotationCanvasMap,\n accessibilityManager: this._accessibilityManager,\n });\n }\n\n let renderContinueCallback = null;\n if (this.renderingQueue) {\n renderContinueCallback = cont => {\n if (!this.renderingQueue.isHighestPriority(this)) {\n this.renderingState = RenderingStates.PAUSED;\n this.resume = () => {\n this.renderingState = RenderingStates.RUNNING;\n cont();\n };\n return;\n }\n cont();\n };\n }\n\n const finishPaintTask = async (error = null) => {\n // The paintTask may have been replaced by a new one, so only remove\n // the reference to the paintTask if it matches the one that is\n // triggering this callback.\n if (paintTask === this.paintTask) {\n this.paintTask = null;\n }\n\n if (error instanceof RenderingCancelledException) {\n this._renderError = null;\n return;\n }\n this._renderError = error;\n\n this.renderingState = RenderingStates.FINISHED;\n this._resetZoomLayer(/* removeFromDOM = */ true);\n\n // Ensure that the thumbnails won't become partially (or fully) blank,\n // for documents that contain interactive form elements.\n this.#useThumbnailCanvas.regularAnnotations = !paintTask.separateAnnots;\n\n this.eventBus.dispatch(\"pagerendered\", {\n source: this,\n pageNumber: this.id,\n cssTransform: false,\n timestamp: performance.now(),\n error: this._renderError,\n });\n\n if (error) {\n throw error;\n }\n };\n\n const paintTask =\n (typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")) &&\n this.renderer === RendererType.SVG\n ? this.paintOnSvg(canvasWrapper)\n : this.paintOnCanvas(canvasWrapper);\n paintTask.onRenderContinue = renderContinueCallback;\n this.paintTask = paintTask;\n\n const resultPromise = paintTask.promise.then(\n () => {\n return finishPaintTask(null).then(async () => {\n this.#renderTextLayer();\n\n if (this.annotationLayer) {\n await this.#renderAnnotationLayer();\n }\n\n if (!this.annotationEditorLayer) {\n const { annotationEditorUIManager } = this.#layerProperties();\n\n if (!annotationEditorUIManager) {\n return;\n }\n this.annotationEditorLayer = new AnnotationEditorLayerBuilder({\n uiManager: annotationEditorUIManager,\n pageDiv: div,\n pdfPage,\n l10n: this.l10n,\n accessibilityManager: this._accessibilityManager,\n });\n }\n this.#renderAnnotationEditorLayer();\n });\n },\n function (reason) {\n return finishPaintTask(reason);\n }\n );\n\n if (pdfPage.isPureXfa) {\n if (!this.xfaLayer) {\n const { annotationStorage, linkService } = this.#layerProperties();\n\n this.xfaLayer = new XfaLayerBuilder({\n pageDiv: div,\n pdfPage,\n annotationStorage,\n linkService,\n });\n } else if (this.xfaLayer.div) {\n // The xfa layer needs to stay on top.\n div.append(this.xfaLayer.div);\n }\n this.#renderXfaLayer();\n }\n\n div.setAttribute(\"data-loaded\", true);\n\n this.eventBus.dispatch(\"pagerender\", {\n source: this,\n pageNumber: this.id,\n });\n return resultPromise;\n }\n\n paintOnCanvas(canvasWrapper) {\n const renderCapability = createPromiseCapability();\n const result = {\n promise: renderCapability.promise,\n onRenderContinue(cont) {\n cont();\n },\n cancel(extraDelay = 0) {\n renderTask.cancel(extraDelay);\n },\n get separateAnnots() {\n return renderTask.separateAnnots;\n },\n };\n\n const viewport = this.viewport;\n const { width, height } = viewport;\n const canvas = document.createElement(\"canvas\");\n canvas.setAttribute(\"role\", \"presentation\");\n\n // Keep the canvas hidden until the first draw callback, or until drawing\n // is complete when `!this.renderingQueue`, to prevent black flickering.\n canvas.hidden = true;\n let isCanvasHidden = true;\n const hasHCM = !!(\n this.pageColors?.background && this.pageColors?.foreground\n );\n const showCanvas = function (isLastShow) {\n // In HCM, a final filter is applied on the canvas which means that\n // before it's applied we've normal colors. Consequently, to avoid to have\n // a final flash we just display it once all the drawing is done.\n if (isCanvasHidden && (!hasHCM || isLastShow)) {\n canvas.hidden = false;\n isCanvasHidden = false;\n }\n };\n\n canvasWrapper.append(canvas);\n this.canvas = canvas;\n\n const ctx = canvas.getContext(\"2d\", { alpha: false });\n const outputScale = (this.outputScale = new OutputScale());\n\n if (this.useOnlyCssZoom) {\n const actualSizeViewport = viewport.clone({\n scale: PixelsPerInch.PDF_TO_CSS_UNITS,\n });\n // Use a scale that makes the canvas have the originally intended size\n // of the page.\n outputScale.sx *= actualSizeViewport.width / width;\n outputScale.sy *= actualSizeViewport.height / height;\n }\n\n if (this.maxCanvasPixels > 0) {\n const pixelsInViewport = width * height;\n const maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport);\n if (outputScale.sx > maxScale || outputScale.sy > maxScale) {\n outputScale.sx = maxScale;\n outputScale.sy = maxScale;\n this.hasRestrictedScaling = true;\n } else {\n this.hasRestrictedScaling = false;\n }\n }\n\n const sfx = approximateFraction(outputScale.sx);\n const sfy = approximateFraction(outputScale.sy);\n\n canvas.width = roundToDivide(viewport.width * outputScale.sx, sfx[0]);\n canvas.height = roundToDivide(viewport.height * outputScale.sy, sfy[0]);\n const { style } = canvas;\n style.width = roundToDivide(viewport.width, sfx[1]) + \"px\";\n style.height = roundToDivide(viewport.height, sfy[1]) + \"px\";\n\n // Add the viewport so it's known what it was originally drawn with.\n this.paintedViewportMap.set(canvas, viewport);\n\n // Rendering area\n const transform = outputScale.scaled\n ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]\n : null;\n const renderContext = {\n canvasContext: ctx,\n transform,\n viewport,\n annotationMode: this.#annotationMode,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n annotationCanvasMap: this._annotationCanvasMap,\n pageColors: this.pageColors,\n };\n const renderTask = this.pdfPage.render(renderContext);\n renderTask.onContinue = function (cont) {\n showCanvas(false);\n if (result.onRenderContinue) {\n result.onRenderContinue(cont);\n } else {\n cont();\n }\n };\n\n renderTask.promise.then(\n function () {\n showCanvas(true);\n renderCapability.resolve();\n },\n function (error) {\n // When zooming with a `drawingDelay` set, avoid temporarily showing\n // a black canvas if rendering was cancelled before the `onContinue`-\n // callback had been invoked at least once.\n if (!(error instanceof RenderingCancelledException)) {\n showCanvas(true);\n }\n renderCapability.reject(error);\n }\n );\n return result;\n }\n\n paintOnSvg(wrapper) {\n if (\n !(\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n )\n ) {\n throw new Error(\"Not implemented: paintOnSvg\");\n }\n let cancelled = false;\n const ensureNotCancelled = () => {\n if (cancelled) {\n throw new RenderingCancelledException(\n `Rendering cancelled, page ${this.id}`,\n \"svg\"\n );\n }\n };\n\n const pdfPage = this.pdfPage;\n const actualSizeViewport = this.viewport.clone({\n scale: PixelsPerInch.PDF_TO_CSS_UNITS,\n });\n const promise = pdfPage\n .getOperatorList({\n annotationMode: this.#annotationMode,\n })\n .then(opList => {\n ensureNotCancelled();\n const svgGfx = new SVGGraphics(pdfPage.commonObjs, pdfPage.objs);\n return svgGfx.getSVG(opList, actualSizeViewport).then(svg => {\n ensureNotCancelled();\n this.svg = svg;\n this.paintedViewportMap.set(svg, actualSizeViewport);\n\n svg.style.width = wrapper.style.width;\n svg.style.height = wrapper.style.height;\n this.renderingState = RenderingStates.FINISHED;\n wrapper.append(svg);\n });\n });\n\n return {\n promise,\n onRenderContinue(cont) {\n cont();\n },\n cancel() {\n cancelled = true;\n },\n get separateAnnots() {\n return false;\n },\n };\n }\n\n /**\n * @param {string|null} label\n */\n setPageLabel(label) {\n this.pageLabel = typeof label === \"string\" ? label : null;\n\n if (this.pageLabel !== null) {\n this.div.setAttribute(\"data-page-label\", this.pageLabel);\n } else {\n this.div.removeAttribute(\"data-page-label\");\n }\n }\n\n /**\n * For use by the `PDFThumbnailView.setImage`-method.\n * @ignore\n */\n get thumbnailCanvas() {\n const { initialOptionalContent, regularAnnotations } =\n this.#useThumbnailCanvas;\n return initialOptionalContent && regularAnnotations ? this.canvas : null;\n }\n}\n\nexport { PDFPageView };\n","/* Copyright 2022 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/editor/tools.js\").AnnotationEditorUIManager} AnnotationEditorUIManager */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n\nimport { AnnotationEditorLayer } from \"pdfjs-lib\";\nimport { NullL10n } from \"./l10n_utils.js\";\n\n/**\n * @typedef {Object} AnnotationEditorLayerBuilderOptions\n * @property {AnnotationEditorUIManager} [uiManager]\n * @property {HTMLDivElement} pageDiv\n * @property {PDFPageProxy} pdfPage\n * @property {IL10n} [l10n]\n * @property {TextAccessibilityManager} [accessibilityManager]\n */\n\nclass AnnotationEditorLayerBuilder {\n #uiManager;\n\n /**\n * @param {AnnotationEditorLayerBuilderOptions} options\n */\n constructor(options) {\n this.pageDiv = options.pageDiv;\n this.pdfPage = options.pdfPage;\n this.accessibilityManager = options.accessibilityManager;\n this.l10n = options.l10n || NullL10n;\n this.annotationEditorLayer = null;\n this.div = null;\n this._cancelled = false;\n this.#uiManager = options.uiManager;\n }\n\n /**\n * @param {PageViewport} viewport\n * @param {string} intent (default value is 'display')\n */\n async render(viewport, intent = \"display\") {\n if (intent !== \"display\") {\n return;\n }\n\n if (this._cancelled) {\n return;\n }\n\n const clonedViewport = viewport.clone({ dontFlip: true });\n if (this.div) {\n this.annotationEditorLayer.update({ viewport: clonedViewport });\n this.show();\n return;\n }\n\n // Create an AnnotationEditor layer div\n const div = (this.div = document.createElement(\"div\"));\n div.className = \"annotationEditorLayer\";\n div.tabIndex = 0;\n div.hidden = true;\n this.pageDiv.append(div);\n\n this.annotationEditorLayer = new AnnotationEditorLayer({\n uiManager: this.#uiManager,\n div,\n accessibilityManager: this.accessibilityManager,\n pageIndex: this.pdfPage.pageNumber - 1,\n l10n: this.l10n,\n viewport: clonedViewport,\n });\n\n const parameters = {\n viewport: clonedViewport,\n div,\n annotations: null,\n intent,\n };\n\n this.annotationEditorLayer.render(parameters);\n this.show();\n }\n\n cancel() {\n this._cancelled = true;\n\n if (!this.div) {\n return;\n }\n this.pageDiv = null;\n this.annotationEditorLayer.destroy();\n this.div.remove();\n }\n\n hide() {\n if (!this.div) {\n return;\n }\n this.div.hidden = true;\n }\n\n show() {\n if (!this.div || this.annotationEditorLayer.isEmpty) {\n return;\n }\n this.div.hidden = false;\n }\n}\n\nexport { AnnotationEditorLayerBuilder };\n","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"./interfaces\").IDownloadManager} IDownloadManager */\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./textaccessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n\nimport { AnnotationLayer } from \"pdfjs-lib\";\nimport { NullL10n } from \"./l10n_utils.js\";\nimport { PresentationModeState } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} AnnotationLayerBuilderOptions\n * @property {HTMLDivElement} pageDiv\n * @property {PDFPageProxy} pdfPage\n * @property {AnnotationStorage} [annotationStorage]\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n * for annotation icons. Include trailing slash.\n * @property {boolean} renderForms\n * @property {IPDFLinkService} linkService\n * @property {IDownloadManager} downloadManager\n * @property {IL10n} l10n - Localization service.\n * @property {boolean} [enableScripting]\n * @property {Promise<boolean>} [hasJSActionsPromise]\n * @property {Promise<Object<string, Array<Object>> | null>}\n * [fieldObjectsPromise]\n * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]\n * @property {TextAccessibilityManager} [accessibilityManager]\n */\n\nclass AnnotationLayerBuilder {\n #numAnnotations = 0;\n\n #onPresentationModeChanged = null;\n\n /**\n * @param {AnnotationLayerBuilderOptions} options\n */\n constructor({\n pageDiv,\n pdfPage,\n linkService,\n downloadManager,\n annotationStorage = null,\n imageResourcesPath = \"\",\n renderForms = true,\n l10n = NullL10n,\n enableScripting = false,\n hasJSActionsPromise = null,\n fieldObjectsPromise = null,\n annotationCanvasMap = null,\n accessibilityManager = null,\n }) {\n this.pageDiv = pageDiv;\n this.pdfPage = pdfPage;\n this.linkService = linkService;\n this.downloadManager = downloadManager;\n this.imageResourcesPath = imageResourcesPath;\n this.renderForms = renderForms;\n this.l10n = l10n;\n this.annotationStorage = annotationStorage;\n this.enableScripting = enableScripting;\n this._hasJSActionsPromise = hasJSActionsPromise || Promise.resolve(false);\n this._fieldObjectsPromise = fieldObjectsPromise || Promise.resolve(null);\n this._annotationCanvasMap = annotationCanvasMap;\n this._accessibilityManager = accessibilityManager;\n\n this.div = null;\n this._cancelled = false;\n this._eventBus = linkService.eventBus;\n }\n\n /**\n * @param {PageViewport} viewport\n * @param {string} intent (default value is 'display')\n * @returns {Promise<void>} A promise that is resolved when rendering of the\n * annotations is complete.\n */\n async render(viewport, intent = \"display\") {\n if (this.div) {\n if (this._cancelled || this.#numAnnotations === 0) {\n return;\n }\n // If an annotationLayer already exists, refresh its children's\n // transformation matrices.\n AnnotationLayer.update({\n viewport: viewport.clone({ dontFlip: true }),\n div: this.div,\n annotationCanvasMap: this._annotationCanvasMap,\n });\n return;\n }\n\n const [annotations, hasJSActions, fieldObjects] = await Promise.all([\n this.pdfPage.getAnnotations({ intent }),\n this._hasJSActionsPromise,\n this._fieldObjectsPromise,\n ]);\n if (this._cancelled) {\n return;\n }\n this.#numAnnotations = annotations.length;\n\n // Create an annotation layer div and render the annotations\n // if there is at least one annotation.\n this.div = document.createElement(\"div\");\n this.div.className = \"annotationLayer\";\n this.pageDiv.append(this.div);\n\n if (this.#numAnnotations === 0) {\n this.hide();\n return;\n }\n AnnotationLayer.render({\n viewport: viewport.clone({ dontFlip: true }),\n div: this.div,\n annotations,\n page: this.pdfPage,\n imageResourcesPath: this.imageResourcesPath,\n renderForms: this.renderForms,\n linkService: this.linkService,\n downloadManager: this.downloadManager,\n annotationStorage: this.annotationStorage,\n enableScripting: this.enableScripting,\n hasJSActions,\n fieldObjects,\n annotationCanvasMap: this._annotationCanvasMap,\n accessibilityManager: this._accessibilityManager,\n });\n this.l10n.translate(this.div);\n\n // Ensure that interactive form elements in the annotationLayer are\n // disabled while PresentationMode is active (see issue 12232).\n if (this.linkService.isInPresentationMode) {\n this.#updatePresentationModeState(PresentationModeState.FULLSCREEN);\n }\n if (!this.#onPresentationModeChanged) {\n this.#onPresentationModeChanged = evt => {\n this.#updatePresentationModeState(evt.state);\n };\n this._eventBus?._on(\n \"presentationmodechanged\",\n this.#onPresentationModeChanged\n );\n }\n }\n\n cancel() {\n this._cancelled = true;\n\n if (this.#onPresentationModeChanged) {\n this._eventBus?._off(\n \"presentationmodechanged\",\n this.#onPresentationModeChanged\n );\n this.#onPresentationModeChanged = null;\n }\n }\n\n hide() {\n if (!this.div) {\n return;\n }\n this.div.hidden = true;\n }\n\n #updatePresentationModeState(state) {\n if (!this.div) {\n return;\n }\n let disableFormElements = false;\n\n switch (state) {\n case PresentationModeState.FULLSCREEN:\n disableFormElements = true;\n break;\n case PresentationModeState.NORMAL:\n break;\n default:\n return;\n }\n for (const section of this.div.childNodes) {\n if (section.hasAttribute(\"data-internal-link\")) {\n continue;\n }\n section.inert = disableFormElements;\n }\n }\n}\n\nexport { AnnotationLayerBuilder };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst PDF_ROLE_TO_HTML_ROLE = {\n // Document level structure types\n Document: null, // There's a \"document\" role, but it doesn't make sense here.\n DocumentFragment: null,\n // Grouping level structure types\n Part: \"group\",\n Sect: \"group\", // XXX: There's a \"section\" role, but it's abstract.\n Div: \"group\",\n Aside: \"note\",\n NonStruct: \"none\",\n // Block level structure types\n P: null,\n // H<n>,\n H: \"heading\",\n Title: null,\n FENote: \"note\",\n // Sub-block level structure type\n Sub: \"group\",\n // General inline level structure types\n Lbl: null,\n Span: null,\n Em: null,\n Strong: null,\n Link: \"link\",\n Annot: \"note\",\n Form: \"form\",\n // Ruby and Warichu structure types\n Ruby: null,\n RB: null,\n RT: null,\n RP: null,\n Warichu: null,\n WT: null,\n WP: null,\n // List standard structure types\n L: \"list\",\n LI: \"listitem\",\n LBody: null,\n // Table standard structure types\n Table: \"table\",\n TR: \"row\",\n TH: \"columnheader\",\n TD: \"cell\",\n THead: \"columnheader\",\n TBody: null,\n TFoot: null,\n // Standard structure type Caption\n Caption: null,\n // Standard structure type Figure\n Figure: \"figure\",\n // Standard structure type Formula\n Formula: null,\n // standard structure type Artifact\n Artifact: null,\n};\n\nconst HEADING_PATTERN = /^H(\\d+)$/;\n\nclass StructTreeLayerBuilder {\n #treeDom = undefined;\n\n get renderingDone() {\n return this.#treeDom !== undefined;\n }\n\n render(structTree) {\n if (this.#treeDom !== undefined) {\n return this.#treeDom;\n }\n const treeDom = this.#walk(structTree);\n treeDom?.classList.add(\"structTree\");\n return (this.#treeDom = treeDom);\n }\n\n hide() {\n if (this.#treeDom && !this.#treeDom.hidden) {\n this.#treeDom.hidden = true;\n }\n }\n\n show() {\n if (this.#treeDom?.hidden) {\n this.#treeDom.hidden = false;\n }\n }\n\n #setAttributes(structElement, htmlElement) {\n if (structElement.alt !== undefined) {\n htmlElement.setAttribute(\"aria-label\", structElement.alt);\n }\n if (structElement.id !== undefined) {\n htmlElement.setAttribute(\"aria-owns\", structElement.id);\n }\n if (structElement.lang !== undefined) {\n htmlElement.setAttribute(\"lang\", structElement.lang);\n }\n }\n\n #walk(node) {\n if (!node) {\n return null;\n }\n\n const element = document.createElement(\"span\");\n if (\"role\" in node) {\n const { role } = node;\n const match = role.match(HEADING_PATTERN);\n if (match) {\n element.setAttribute(\"role\", \"heading\");\n element.setAttribute(\"aria-level\", match[1]);\n } else if (PDF_ROLE_TO_HTML_ROLE[role]) {\n element.setAttribute(\"role\", PDF_ROLE_TO_HTML_ROLE[role]);\n }\n }\n\n this.#setAttributes(node, element);\n\n if (node.children) {\n if (node.children.length === 1 && \"id\" in node.children[0]) {\n // Often there is only one content node so just set the values on the\n // parent node to avoid creating an extra span.\n this.#setAttributes(node.children[0], element);\n } else {\n for (const kid of node.children) {\n element.append(this.#walk(kid));\n }\n }\n }\n return element;\n }\n}\n\nexport { StructTreeLayerBuilder };\n","/* Copyright 2022 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { binarySearchFirstItem } from \"./ui_utils.js\";\n\n/**\n * This class aims to provide some methods:\n * - to reorder elements in the DOM with respect to the visual order;\n * - to create a link, using aria-owns, between spans in the textLayer and\n * annotations in the annotationLayer. The goal is to help to know\n * where the annotations are in the text flow.\n */\nclass TextAccessibilityManager {\n #enabled = false;\n\n #textChildren = null;\n\n #textNodes = new Map();\n\n #waitingElements = new Map();\n\n setTextMapping(textDivs) {\n this.#textChildren = textDivs;\n }\n\n /**\n * Compare the positions of two elements, it must correspond to\n * the visual ordering.\n *\n * @param {HTMLElement} e1\n * @param {HTMLElement} e2\n * @returns {number}\n */\n static #compareElementPositions(e1, e2) {\n const rect1 = e1.getBoundingClientRect();\n const rect2 = e2.getBoundingClientRect();\n\n if (rect1.width === 0 && rect1.height === 0) {\n return +1;\n }\n\n if (rect2.width === 0 && rect2.height === 0) {\n return -1;\n }\n\n const top1 = rect1.y;\n const bot1 = rect1.y + rect1.height;\n const mid1 = rect1.y + rect1.height / 2;\n\n const top2 = rect2.y;\n const bot2 = rect2.y + rect2.height;\n const mid2 = rect2.y + rect2.height / 2;\n\n if (mid1 <= top2 && mid2 >= bot1) {\n return -1;\n }\n\n if (mid2 <= top1 && mid1 >= bot2) {\n return +1;\n }\n\n const centerX1 = rect1.x + rect1.width / 2;\n const centerX2 = rect2.x + rect2.width / 2;\n\n return centerX1 - centerX2;\n }\n\n /**\n * Function called when the text layer has finished rendering.\n */\n enable() {\n if (this.#enabled) {\n throw new Error(\"TextAccessibilityManager is already enabled.\");\n }\n if (!this.#textChildren) {\n throw new Error(\"Text divs and strings have not been set.\");\n }\n\n this.#enabled = true;\n this.#textChildren = this.#textChildren.slice();\n this.#textChildren.sort(TextAccessibilityManager.#compareElementPositions);\n\n if (this.#textNodes.size > 0) {\n // Some links have been made before this manager has been disabled, hence\n // we restore them.\n const textChildren = this.#textChildren;\n for (const [id, nodeIndex] of this.#textNodes) {\n const element = document.getElementById(id);\n if (!element) {\n // If the page was *fully* reset the element no longer exists, and it\n // will be re-inserted later (i.e. when the annotationLayer renders).\n this.#textNodes.delete(id);\n continue;\n }\n this.#addIdToAriaOwns(id, textChildren[nodeIndex]);\n }\n }\n\n for (const [element, isRemovable] of this.#waitingElements) {\n this.addPointerInTextLayer(element, isRemovable);\n }\n this.#waitingElements.clear();\n }\n\n disable() {\n if (!this.#enabled) {\n return;\n }\n\n // Don't clear this.#textNodes which is used to rebuild the aria-owns\n // in case it's re-enabled at some point.\n\n this.#waitingElements.clear();\n this.#textChildren = null;\n this.#enabled = false;\n }\n\n /**\n * Remove an aria-owns id from a node in the text layer.\n * @param {HTMLElement} element\n */\n removePointerInTextLayer(element) {\n if (!this.#enabled) {\n this.#waitingElements.delete(element);\n return;\n }\n\n const children = this.#textChildren;\n if (!children || children.length === 0) {\n return;\n }\n\n const { id } = element;\n const nodeIndex = this.#textNodes.get(id);\n if (nodeIndex === undefined) {\n return;\n }\n\n const node = children[nodeIndex];\n\n this.#textNodes.delete(id);\n let owns = node.getAttribute(\"aria-owns\");\n if (owns?.includes(id)) {\n owns = owns\n .split(\" \")\n .filter(x => x !== id)\n .join(\" \");\n if (owns) {\n node.setAttribute(\"aria-owns\", owns);\n } else {\n node.removeAttribute(\"aria-owns\");\n node.setAttribute(\"role\", \"presentation\");\n }\n }\n }\n\n #addIdToAriaOwns(id, node) {\n const owns = node.getAttribute(\"aria-owns\");\n if (!owns?.includes(id)) {\n node.setAttribute(\"aria-owns\", owns ? `${owns} ${id}` : id);\n }\n node.removeAttribute(\"role\");\n }\n\n /**\n * Find the text node which is the nearest and add an aria-owns attribute\n * in order to correctly position this editor in the text flow.\n * @param {HTMLElement} element\n * @param {boolean} isRemovable\n */\n addPointerInTextLayer(element, isRemovable) {\n const { id } = element;\n if (!id) {\n return;\n }\n\n if (!this.#enabled) {\n // The text layer needs to be there, so we postpone the association.\n this.#waitingElements.set(element, isRemovable);\n return;\n }\n\n if (isRemovable) {\n this.removePointerInTextLayer(element);\n }\n\n const children = this.#textChildren;\n if (!children || children.length === 0) {\n return;\n }\n\n const index = binarySearchFirstItem(\n children,\n node =>\n TextAccessibilityManager.#compareElementPositions(element, node) < 0\n );\n\n const nodeIndex = Math.max(0, index - 1);\n this.#addIdToAriaOwns(id, children[nodeIndex]);\n this.#textNodes.set(id, nodeIndex);\n }\n\n /**\n * Move a div in the DOM in order to respect the visual order.\n * @param {HTMLDivElement} element\n */\n moveElementInDOM(container, element, contentElement, isRemovable) {\n this.addPointerInTextLayer(contentElement, isRemovable);\n\n if (!container.hasChildNodes()) {\n container.append(element);\n return;\n }\n\n const children = Array.from(container.childNodes).filter(\n node => node !== element\n );\n\n if (children.length === 0) {\n return;\n }\n\n const elementToCompare = contentElement || element;\n const index = binarySearchFirstItem(\n children,\n node =>\n TextAccessibilityManager.#compareElementPositions(\n elementToCompare,\n node\n ) < 0\n );\n\n if (index === 0) {\n children[0].before(element);\n } else {\n children[index - 1].after(element);\n }\n }\n}\n\nexport { TextAccessibilityManager };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_find_controller\").PDFFindController} PDFFindController */\n\n/**\n * @typedef {Object} TextHighlighterOptions\n * @property {PDFFindController} findController\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} pageIndex - The page index.\n */\n\n/**\n * TextHighlighter handles highlighting matches from the FindController in\n * either the text layer or XFA layer depending on the type of document.\n */\nclass TextHighlighter {\n /**\n * @param {TextHighlighterOptions} options\n */\n constructor({ findController, eventBus, pageIndex }) {\n this.findController = findController;\n this.matches = [];\n this.eventBus = eventBus;\n this.pageIdx = pageIndex;\n this._onUpdateTextLayerMatches = null;\n this.textDivs = null;\n this.textContentItemsStr = null;\n this.enabled = false;\n }\n\n /**\n * Store two arrays that will map DOM nodes to text they should contain.\n * The arrays should be of equal length and the array element at each index\n * should correspond to the other. e.g.\n * `items[0] = \"<span>Item 0</span>\" and texts[0] = \"Item 0\";\n *\n * @param {Array<Node>} divs\n * @param {Array<string>} texts\n */\n setTextMapping(divs, texts) {\n this.textDivs = divs;\n this.textContentItemsStr = texts;\n }\n\n /**\n * Start listening for events to update the highlighter and check if there are\n * any current matches that need be highlighted.\n */\n enable() {\n if (!this.textDivs || !this.textContentItemsStr) {\n throw new Error(\"Text divs and strings have not been set.\");\n }\n if (this.enabled) {\n throw new Error(\"TextHighlighter is already enabled.\");\n }\n this.enabled = true;\n if (!this._onUpdateTextLayerMatches) {\n this._onUpdateTextLayerMatches = evt => {\n if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) {\n this._updateMatches();\n }\n };\n this.eventBus._on(\n \"updatetextlayermatches\",\n this._onUpdateTextLayerMatches\n );\n }\n this._updateMatches();\n }\n\n disable() {\n if (!this.enabled) {\n return;\n }\n this.enabled = false;\n if (this._onUpdateTextLayerMatches) {\n this.eventBus._off(\n \"updatetextlayermatches\",\n this._onUpdateTextLayerMatches\n );\n this._onUpdateTextLayerMatches = null;\n }\n this._updateMatches(/* reset = */ true);\n }\n\n _convertMatches(matches, matchesLength) {\n // Early exit if there is nothing to convert.\n if (!matches) {\n return [];\n }\n const { textContentItemsStr } = this;\n\n let i = 0,\n iIndex = 0;\n const end = textContentItemsStr.length - 1;\n const result = [];\n\n for (let m = 0, mm = matches.length; m < mm; m++) {\n // Calculate the start position.\n let matchIdx = matches[m];\n\n // Loop over the divIdxs.\n while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) {\n iIndex += textContentItemsStr[i].length;\n i++;\n }\n\n if (i === textContentItemsStr.length) {\n console.error(\"Could not find a matching mapping\");\n }\n\n const match = {\n begin: {\n divIdx: i,\n offset: matchIdx - iIndex,\n },\n };\n\n // Calculate the end position.\n matchIdx += matchesLength[m];\n\n // Somewhat the same array as above, but use > instead of >= to get\n // the end position right.\n while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) {\n iIndex += textContentItemsStr[i].length;\n i++;\n }\n\n match.end = {\n divIdx: i,\n offset: matchIdx - iIndex,\n };\n result.push(match);\n }\n return result;\n }\n\n _renderMatches(matches) {\n // Early exit if there is nothing to render.\n if (matches.length === 0) {\n return;\n }\n const { findController, pageIdx } = this;\n const { textContentItemsStr, textDivs } = this;\n\n const isSelectedPage = pageIdx === findController.selected.pageIdx;\n const selectedMatchIdx = findController.selected.matchIdx;\n const highlightAll = findController.state.highlightAll;\n let prevEnd = null;\n const infinity = {\n divIdx: -1,\n offset: undefined,\n };\n\n function beginText(begin, className) {\n const divIdx = begin.divIdx;\n textDivs[divIdx].textContent = \"\";\n return appendTextToDiv(divIdx, 0, begin.offset, className);\n }\n\n function appendTextToDiv(divIdx, fromOffset, toOffset, className) {\n let div = textDivs[divIdx];\n if (div.nodeType === Node.TEXT_NODE) {\n const span = document.createElement(\"span\");\n div.before(span);\n span.append(div);\n textDivs[divIdx] = span;\n div = span;\n }\n const content = textContentItemsStr[divIdx].substring(\n fromOffset,\n toOffset\n );\n const node = document.createTextNode(content);\n if (className) {\n const span = document.createElement(\"span\");\n span.className = `${className} appended`;\n span.append(node);\n div.append(span);\n return className.includes(\"selected\") ? span.offsetLeft : 0;\n }\n div.append(node);\n return 0;\n }\n\n let i0 = selectedMatchIdx,\n i1 = i0 + 1;\n if (highlightAll) {\n i0 = 0;\n i1 = matches.length;\n } else if (!isSelectedPage) {\n // Not highlighting all and this isn't the selected page, so do nothing.\n return;\n }\n\n for (let i = i0; i < i1; i++) {\n const match = matches[i];\n const begin = match.begin;\n const end = match.end;\n const isSelected = isSelectedPage && i === selectedMatchIdx;\n const highlightSuffix = isSelected ? \" selected\" : \"\";\n let selectedLeft = 0;\n\n // Match inside new div.\n if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {\n // If there was a previous div, then add the text at the end.\n if (prevEnd !== null) {\n appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);\n }\n // Clear the divs and set the content until the starting point.\n beginText(begin);\n } else {\n appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);\n }\n\n if (begin.divIdx === end.divIdx) {\n selectedLeft = appendTextToDiv(\n begin.divIdx,\n begin.offset,\n end.offset,\n \"highlight\" + highlightSuffix\n );\n } else {\n selectedLeft = appendTextToDiv(\n begin.divIdx,\n begin.offset,\n infinity.offset,\n \"highlight begin\" + highlightSuffix\n );\n for (let n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {\n textDivs[n0].className = \"highlight middle\" + highlightSuffix;\n }\n beginText(end, \"highlight end\" + highlightSuffix);\n }\n prevEnd = end;\n\n if (isSelected) {\n // Attempt to scroll the selected match into view.\n findController.scrollMatchIntoView({\n element: textDivs[begin.divIdx],\n selectedLeft,\n pageIndex: pageIdx,\n matchIndex: selectedMatchIdx,\n });\n }\n }\n\n if (prevEnd) {\n appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);\n }\n }\n\n _updateMatches(reset = false) {\n if (!this.enabled && !reset) {\n return;\n }\n const { findController, matches, pageIdx } = this;\n const { textContentItemsStr, textDivs } = this;\n let clearedUntilDivIdx = -1;\n\n // Clear all current matches.\n for (const match of matches) {\n const begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);\n for (let n = begin, end = match.end.divIdx; n <= end; n++) {\n const div = textDivs[n];\n div.textContent = textContentItemsStr[n];\n div.className = \"\";\n }\n clearedUntilDivIdx = match.end.divIdx + 1;\n }\n\n if (!findController?.highlightMatches || reset) {\n return;\n }\n // Convert the matches on the `findController` into the match format\n // used for the textLayer.\n const pageMatches = findController.pageMatches[pageIdx] || null;\n const pageMatchesLength = findController.pageMatchesLength[pageIdx] || null;\n\n this.matches = this._convertMatches(pageMatches, pageMatchesLength);\n this._renderMatches(this.matches);\n }\n}\n\nexport { TextHighlighter };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"../src/display/api\").TextContent} TextContent */\n/** @typedef {import(\"./text_highlighter\").TextHighlighter} TextHighlighter */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n\nimport { renderTextLayer, updateTextLayer } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} TextLayerBuilderOptions\n * @property {TextHighlighter} highlighter - Optional object that will handle\n * highlighting text from the find controller.\n * @property {TextAccessibilityManager} [accessibilityManager]\n * @property {boolean} [isOffscreenCanvasSupported] - Allows to use an\n * OffscreenCanvas if needed.\n */\n\n/**\n * The text layer builder provides text selection functionality for the PDF.\n * It does this by creating overlay divs over the PDF's text. These divs\n * contain text that matches the PDF text they are overlaying.\n */\nclass TextLayerBuilder {\n #rotation = 0;\n\n #scale = 0;\n\n #textContentSource = null;\n\n constructor({\n highlighter = null,\n accessibilityManager = null,\n isOffscreenCanvasSupported = true,\n }) {\n this.textContentItemsStr = [];\n this.renderingDone = false;\n this.textDivs = [];\n this.textDivProperties = new WeakMap();\n this.textLayerRenderTask = null;\n this.highlighter = highlighter;\n this.accessibilityManager = accessibilityManager;\n this.isOffscreenCanvasSupported = isOffscreenCanvasSupported;\n\n this.div = document.createElement(\"div\");\n this.div.className = \"textLayer\";\n this.hide();\n }\n\n #finishRendering() {\n this.renderingDone = true;\n\n const endOfContent = document.createElement(\"div\");\n endOfContent.className = \"endOfContent\";\n this.div.append(endOfContent);\n\n this.#bindMouse();\n }\n\n get numTextDivs() {\n return this.textDivs.length;\n }\n\n /**\n * Renders the text layer.\n * @param {PageViewport} viewport\n */\n async render(viewport) {\n if (!this.#textContentSource) {\n throw new Error('No \"textContentSource\" parameter specified.');\n }\n\n const scale = viewport.scale * (globalThis.devicePixelRatio || 1);\n const { rotation } = viewport;\n if (this.renderingDone) {\n const mustRotate = rotation !== this.#rotation;\n const mustRescale = scale !== this.#scale;\n if (mustRotate || mustRescale) {\n this.hide();\n updateTextLayer({\n container: this.div,\n viewport,\n textDivs: this.textDivs,\n textDivProperties: this.textDivProperties,\n isOffscreenCanvasSupported: this.isOffscreenCanvasSupported,\n mustRescale,\n mustRotate,\n });\n this.#scale = scale;\n this.#rotation = rotation;\n }\n this.show();\n return;\n }\n\n this.cancel();\n this.highlighter?.setTextMapping(this.textDivs, this.textContentItemsStr);\n this.accessibilityManager?.setTextMapping(this.textDivs);\n\n this.textLayerRenderTask = renderTextLayer({\n textContentSource: this.#textContentSource,\n container: this.div,\n viewport,\n textDivs: this.textDivs,\n textDivProperties: this.textDivProperties,\n textContentItemsStr: this.textContentItemsStr,\n isOffscreenCanvasSupported: this.isOffscreenCanvasSupported,\n });\n\n await this.textLayerRenderTask.promise;\n this.#finishRendering();\n this.#scale = scale;\n this.#rotation = rotation;\n this.show();\n this.accessibilityManager?.enable();\n }\n\n hide() {\n if (!this.div.hidden) {\n // We turn off the highlighter in order to avoid to scroll into view an\n // element of the text layer which could be hidden.\n this.highlighter?.disable();\n this.div.hidden = true;\n }\n }\n\n show() {\n if (this.div.hidden && this.renderingDone) {\n this.div.hidden = false;\n this.highlighter?.enable();\n }\n }\n\n /**\n * Cancel rendering of the text layer.\n */\n cancel() {\n if (this.textLayerRenderTask) {\n this.textLayerRenderTask.cancel();\n this.textLayerRenderTask = null;\n }\n this.highlighter?.disable();\n this.accessibilityManager?.disable();\n this.textContentItemsStr.length = 0;\n this.textDivs.length = 0;\n this.textDivProperties = new WeakMap();\n }\n\n /**\n * @param {ReadableStream | TextContent} source\n */\n setTextContentSource(source) {\n this.cancel();\n this.#textContentSource = source;\n }\n\n /**\n * Improves text selection by adding an additional div where the mouse was\n * clicked. This reduces flickering of the content if the mouse is slowly\n * dragged up or down.\n */\n #bindMouse() {\n const { div } = this;\n\n div.addEventListener(\"mousedown\", evt => {\n const end = div.querySelector(\".endOfContent\");\n if (!end) {\n return;\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n // On non-Firefox browsers, the selection will feel better if the height\n // of the `endOfContent` div is adjusted to start at mouse click\n // location. This avoids flickering when the selection moves up.\n // However it does not work when selection is started on empty space.\n let adjustTop = evt.target !== div;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n adjustTop &&=\n getComputedStyle(end).getPropertyValue(\"-moz-user-select\") !==\n \"none\";\n }\n if (adjustTop) {\n const divBounds = div.getBoundingClientRect();\n const r = Math.max(0, (evt.pageY - divBounds.top) / divBounds.height);\n end.style.top = (r * 100).toFixed(2) + \"%\";\n }\n }\n end.classList.add(\"active\");\n });\n\n div.addEventListener(\"mouseup\", () => {\n const end = div.querySelector(\".endOfContent\");\n if (!end) {\n return;\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n end.style.top = \"\";\n }\n end.classList.remove(\"active\");\n });\n }\n}\n\nexport { TextLayerBuilder };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { XfaLayer } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} XfaLayerBuilderOptions\n * @property {HTMLDivElement} pageDiv\n * @property {PDFPageProxy} pdfPage\n * @property {AnnotationStorage} [annotationStorage]\n * @property {IPDFLinkService} linkService\n * @property {Object} [xfaHtml]\n */\n\nclass XfaLayerBuilder {\n /**\n * @param {XfaLayerBuilderOptions} options\n */\n constructor({\n pageDiv,\n pdfPage,\n annotationStorage = null,\n linkService,\n xfaHtml = null,\n }) {\n this.pageDiv = pageDiv;\n this.pdfPage = pdfPage;\n this.annotationStorage = annotationStorage;\n this.linkService = linkService;\n this.xfaHtml = xfaHtml;\n\n this.div = null;\n this._cancelled = false;\n }\n\n /**\n * @param {PageViewport} viewport\n * @param {string} intent (default value is 'display')\n * @returns {Promise<Object | void>} A promise that is resolved when rendering\n * of the XFA layer is complete. The first rendering will return an object\n * with a `textDivs` property that can be used with the TextHighlighter.\n */\n async render(viewport, intent = \"display\") {\n if (intent === \"print\") {\n const parameters = {\n viewport: viewport.clone({ dontFlip: true }),\n div: this.div,\n xfaHtml: this.xfaHtml,\n annotationStorage: this.annotationStorage,\n linkService: this.linkService,\n intent,\n };\n\n // Create an xfa layer div and render the form\n const div = document.createElement(\"div\");\n this.pageDiv.append(div);\n parameters.div = div;\n\n return XfaLayer.render(parameters);\n }\n\n // intent === \"display\"\n const xfaHtml = await this.pdfPage.getXfa();\n if (this._cancelled || !xfaHtml) {\n return { textDivs: [] };\n }\n\n const parameters = {\n viewport: viewport.clone({ dontFlip: true }),\n div: this.div,\n xfaHtml,\n annotationStorage: this.annotationStorage,\n linkService: this.linkService,\n intent,\n };\n\n if (this.div) {\n return XfaLayer.update(parameters);\n }\n // Create an xfa layer div and render the form\n this.div = document.createElement(\"div\");\n this.pageDiv.append(this.div);\n parameters.div = this.div;\n\n return XfaLayer.render(parameters);\n }\n\n cancel() {\n this._cancelled = true;\n }\n\n hide() {\n if (!this.div) {\n return;\n }\n this.div.hidden = true;\n }\n}\n\nexport { XfaLayerBuilder };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CursorTool, ScrollMode, SpreadMode } from \"./ui_utils.js\";\nimport { PagesCountLimit } from \"./pdf_viewer.js\";\n\n/**\n * @typedef {Object} SecondaryToolbarOptions\n * @property {HTMLDivElement} toolbar - Container for the secondary toolbar.\n * @property {HTMLButtonElement} toggleButton - Button to toggle the visibility\n * of the secondary toolbar.\n * @property {HTMLButtonElement} presentationModeButton - Button for entering\n * presentation mode.\n * @property {HTMLButtonElement} openFileButton - Button to open a file.\n * @property {HTMLButtonElement} printButton - Button to print the document.\n * @property {HTMLButtonElement} downloadButton - Button to download the\n * document.\n * @property {HTMLAnchorElement} viewBookmarkButton - Button to obtain a\n * bookmark link to the current location in the document.\n * @property {HTMLButtonElement} firstPageButton - Button to go to the first\n * page in the document.\n * @property {HTMLButtonElement} lastPageButton - Button to go to the last page\n * in the document.\n * @property {HTMLButtonElement} pageRotateCwButton - Button to rotate the pages\n * clockwise.\n * @property {HTMLButtonElement} pageRotateCcwButton - Button to rotate the\n * pages counterclockwise.\n * @property {HTMLButtonElement} cursorSelectToolButton - Button to enable the\n * select tool.\n * @property {HTMLButtonElement} cursorHandToolButton - Button to enable the\n * hand tool.\n * @property {HTMLButtonElement} documentPropertiesButton - Button for opening\n * the document properties dialog.\n */\n\nclass SecondaryToolbar {\n /**\n * @param {SecondaryToolbarOptions} options\n * @param {EventBus} eventBus\n */\n constructor(options, eventBus, externalServices) {\n this.toolbar = options.toolbar;\n this.toggleButton = options.toggleButton;\n this.buttons = [\n {\n element: options.presentationModeButton,\n eventName: \"presentationmode\",\n close: true,\n },\n { element: options.printButton, eventName: \"print\", close: true },\n { element: options.downloadButton, eventName: \"download\", close: true },\n { element: options.viewBookmarkButton, eventName: null, close: true },\n { element: options.firstPageButton, eventName: \"firstpage\", close: true },\n { element: options.lastPageButton, eventName: \"lastpage\", close: true },\n {\n element: options.pageRotateCwButton,\n eventName: \"rotatecw\",\n close: false,\n },\n {\n element: options.pageRotateCcwButton,\n eventName: \"rotateccw\",\n close: false,\n },\n {\n element: options.cursorSelectToolButton,\n eventName: \"switchcursortool\",\n eventDetails: { tool: CursorTool.SELECT },\n close: true,\n },\n {\n element: options.cursorHandToolButton,\n eventName: \"switchcursortool\",\n eventDetails: { tool: CursorTool.HAND },\n close: true,\n },\n {\n element: options.scrollPageButton,\n eventName: \"switchscrollmode\",\n eventDetails: { mode: ScrollMode.PAGE },\n close: true,\n },\n {\n element: options.scrollVerticalButton,\n eventName: \"switchscrollmode\",\n eventDetails: { mode: ScrollMode.VERTICAL },\n close: true,\n },\n {\n element: options.scrollHorizontalButton,\n eventName: \"switchscrollmode\",\n eventDetails: { mode: ScrollMode.HORIZONTAL },\n close: true,\n },\n {\n element: options.scrollWrappedButton,\n eventName: \"switchscrollmode\",\n eventDetails: { mode: ScrollMode.WRAPPED },\n close: true,\n },\n {\n element: options.spreadNoneButton,\n eventName: \"switchspreadmode\",\n eventDetails: { mode: SpreadMode.NONE },\n close: true,\n },\n {\n element: options.spreadOddButton,\n eventName: \"switchspreadmode\",\n eventDetails: { mode: SpreadMode.ODD },\n close: true,\n },\n {\n element: options.spreadEvenButton,\n eventName: \"switchspreadmode\",\n eventDetails: { mode: SpreadMode.EVEN },\n close: true,\n },\n {\n element: options.documentPropertiesButton,\n eventName: \"documentproperties\",\n close: true,\n },\n ];\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this.buttons.push({\n element: options.openFileButton,\n eventName: \"openfile\",\n close: true,\n });\n }\n this.items = {\n firstPage: options.firstPageButton,\n lastPage: options.lastPageButton,\n pageRotateCw: options.pageRotateCwButton,\n pageRotateCcw: options.pageRotateCcwButton,\n };\n\n this.eventBus = eventBus;\n this.externalServices = externalServices;\n this.opened = false;\n\n // Bind the event listeners for click, cursor tool, and scroll/spread mode\n // actions.\n this.#bindClickListeners();\n this.#bindCursorToolsListener(options);\n this.#bindScrollModeListener(options);\n this.#bindSpreadModeListener(options);\n\n this.reset();\n }\n\n /**\n * @type {boolean}\n */\n get isOpen() {\n return this.opened;\n }\n\n setPageNumber(pageNumber) {\n this.pageNumber = pageNumber;\n this.#updateUIState();\n }\n\n setPagesCount(pagesCount) {\n this.pagesCount = pagesCount;\n this.#updateUIState();\n }\n\n reset() {\n this.pageNumber = 0;\n this.pagesCount = 0;\n this.#updateUIState();\n\n // Reset the Scroll/Spread buttons too, since they're document specific.\n this.eventBus.dispatch(\"secondarytoolbarreset\", { source: this });\n }\n\n #updateUIState() {\n this.items.firstPage.disabled = this.pageNumber <= 1;\n this.items.lastPage.disabled = this.pageNumber >= this.pagesCount;\n this.items.pageRotateCw.disabled = this.pagesCount === 0;\n this.items.pageRotateCcw.disabled = this.pagesCount === 0;\n }\n\n #bindClickListeners() {\n // Button to toggle the visibility of the secondary toolbar.\n this.toggleButton.addEventListener(\"click\", this.toggle.bind(this));\n\n // All items within the secondary toolbar.\n for (const { element, eventName, close, eventDetails } of this.buttons) {\n element.addEventListener(\"click\", evt => {\n if (eventName !== null) {\n this.eventBus.dispatch(eventName, { source: this, ...eventDetails });\n }\n if (close) {\n this.close();\n }\n this.externalServices.reportTelemetry({\n type: \"buttons\",\n data: { id: element.id },\n });\n });\n }\n }\n\n #bindCursorToolsListener({ cursorSelectToolButton, cursorHandToolButton }) {\n this.eventBus._on(\"cursortoolchanged\", function ({ tool }) {\n const isSelect = tool === CursorTool.SELECT,\n isHand = tool === CursorTool.HAND;\n\n cursorSelectToolButton.classList.toggle(\"toggled\", isSelect);\n cursorHandToolButton.classList.toggle(\"toggled\", isHand);\n\n cursorSelectToolButton.setAttribute(\"aria-checked\", isSelect);\n cursorHandToolButton.setAttribute(\"aria-checked\", isHand);\n });\n }\n\n #bindScrollModeListener({\n scrollPageButton,\n scrollVerticalButton,\n scrollHorizontalButton,\n scrollWrappedButton,\n spreadNoneButton,\n spreadOddButton,\n spreadEvenButton,\n }) {\n const scrollModeChanged = ({ mode }) => {\n const isPage = mode === ScrollMode.PAGE,\n isVertical = mode === ScrollMode.VERTICAL,\n isHorizontal = mode === ScrollMode.HORIZONTAL,\n isWrapped = mode === ScrollMode.WRAPPED;\n\n scrollPageButton.classList.toggle(\"toggled\", isPage);\n scrollVerticalButton.classList.toggle(\"toggled\", isVertical);\n scrollHorizontalButton.classList.toggle(\"toggled\", isHorizontal);\n scrollWrappedButton.classList.toggle(\"toggled\", isWrapped);\n\n scrollPageButton.setAttribute(\"aria-checked\", isPage);\n scrollVerticalButton.setAttribute(\"aria-checked\", isVertical);\n scrollHorizontalButton.setAttribute(\"aria-checked\", isHorizontal);\n scrollWrappedButton.setAttribute(\"aria-checked\", isWrapped);\n\n // Permanently *disable* the Scroll buttons when PAGE-scrolling is being\n // enforced for *very* long/large documents; please see the `BaseViewer`.\n const forceScrollModePage =\n this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE;\n scrollPageButton.disabled = forceScrollModePage;\n scrollVerticalButton.disabled = forceScrollModePage;\n scrollHorizontalButton.disabled = forceScrollModePage;\n scrollWrappedButton.disabled = forceScrollModePage;\n\n // Temporarily *disable* the Spread buttons when horizontal scrolling is\n // enabled, since the non-default Spread modes doesn't affect the layout.\n spreadNoneButton.disabled = isHorizontal;\n spreadOddButton.disabled = isHorizontal;\n spreadEvenButton.disabled = isHorizontal;\n };\n this.eventBus._on(\"scrollmodechanged\", scrollModeChanged);\n\n this.eventBus._on(\"secondarytoolbarreset\", evt => {\n if (evt.source === this) {\n scrollModeChanged({ mode: ScrollMode.VERTICAL });\n }\n });\n }\n\n #bindSpreadModeListener({\n spreadNoneButton,\n spreadOddButton,\n spreadEvenButton,\n }) {\n function spreadModeChanged({ mode }) {\n const isNone = mode === SpreadMode.NONE,\n isOdd = mode === SpreadMode.ODD,\n isEven = mode === SpreadMode.EVEN;\n\n spreadNoneButton.classList.toggle(\"toggled\", isNone);\n spreadOddButton.classList.toggle(\"toggled\", isOdd);\n spreadEvenButton.classList.toggle(\"toggled\", isEven);\n\n spreadNoneButton.setAttribute(\"aria-checked\", isNone);\n spreadOddButton.setAttribute(\"aria-checked\", isOdd);\n spreadEvenButton.setAttribute(\"aria-checked\", isEven);\n }\n this.eventBus._on(\"spreadmodechanged\", spreadModeChanged);\n\n this.eventBus._on(\"secondarytoolbarreset\", evt => {\n if (evt.source === this) {\n spreadModeChanged({ mode: SpreadMode.NONE });\n }\n });\n }\n\n open() {\n if (this.opened) {\n return;\n }\n this.opened = true;\n this.toggleButton.classList.add(\"toggled\");\n this.toggleButton.setAttribute(\"aria-expanded\", \"true\");\n this.toolbar.classList.remove(\"hidden\");\n }\n\n close() {\n if (!this.opened) {\n return;\n }\n this.opened = false;\n this.toolbar.classList.add(\"hidden\");\n this.toggleButton.classList.remove(\"toggled\");\n this.toggleButton.setAttribute(\"aria-expanded\", \"false\");\n }\n\n toggle() {\n if (this.opened) {\n this.close();\n } else {\n this.open();\n }\n }\n}\n\nexport { SecondaryToolbar };\n","/* Copyright 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n animationStarted,\n DEFAULT_SCALE,\n DEFAULT_SCALE_VALUE,\n MAX_SCALE,\n MIN_SCALE,\n noContextMenuHandler,\n} from \"./ui_utils.js\";\nimport { AnnotationEditorType } from \"pdfjs-lib\";\n\nconst PAGE_NUMBER_LOADING_INDICATOR = \"visiblePageIsLoading\";\n\n/**\n * @typedef {Object} ToolbarOptions\n * @property {HTMLDivElement} container - Container for the secondary toolbar.\n * @property {HTMLSpanElement} numPages - Label that contains number of pages.\n * @property {HTMLInputElement} pageNumber - Control for display and user input\n * of the current page number.\n * @property {HTMLSelectElement} scaleSelect - Scale selection control.\n * Its width is adjusted, when necessary, on UI localization.\n * @property {HTMLOptionElement} customScaleOption - The item used to display\n * a non-predefined scale.\n * @property {HTMLButtonElement} previous - Button to go to the previous page.\n * @property {HTMLButtonElement} next - Button to go to the next page.\n * @property {HTMLButtonElement} zoomIn - Button to zoom in the pages.\n * @property {HTMLButtonElement} zoomOut - Button to zoom out the pages.\n * @property {HTMLButtonElement} viewFind - Button to open find bar.\n * @property {HTMLButtonElement} openFile - Button to open a new document.\n * @property {HTMLButtonElement} editorFreeTextButton - Button to switch to\n * FreeText editing.\n * @property {HTMLButtonElement} download - Button to download the document.\n */\n\nclass Toolbar {\n #wasLocalized = false;\n\n /**\n * @param {ToolbarOptions} options\n * @param {EventBus} eventBus\n * @param {IL10n} l10n - Localization service.\n */\n constructor(options, eventBus, l10n) {\n this.toolbar = options.container;\n this.eventBus = eventBus;\n this.l10n = l10n;\n this.buttons = [\n { element: options.previous, eventName: \"previouspage\" },\n { element: options.next, eventName: \"nextpage\" },\n { element: options.zoomIn, eventName: \"zoomin\" },\n { element: options.zoomOut, eventName: \"zoomout\" },\n { element: options.print, eventName: \"print\" },\n { element: options.download, eventName: \"download\" },\n {\n element: options.editorFreeTextButton,\n eventName: \"switchannotationeditormode\",\n eventDetails: {\n get mode() {\n const { classList } = options.editorFreeTextButton;\n return classList.contains(\"toggled\")\n ? AnnotationEditorType.NONE\n : AnnotationEditorType.FREETEXT;\n },\n },\n },\n {\n element: options.editorInkButton,\n eventName: \"switchannotationeditormode\",\n eventDetails: {\n get mode() {\n const { classList } = options.editorInkButton;\n return classList.contains(\"toggled\")\n ? AnnotationEditorType.NONE\n : AnnotationEditorType.INK;\n },\n },\n },\n ];\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this.buttons.push({ element: options.openFile, eventName: \"openfile\" });\n }\n this.items = {\n numPages: options.numPages,\n pageNumber: options.pageNumber,\n scaleSelect: options.scaleSelect,\n customScaleOption: options.customScaleOption,\n previous: options.previous,\n next: options.next,\n zoomIn: options.zoomIn,\n zoomOut: options.zoomOut,\n };\n\n // Bind the event listeners for click and various other actions.\n this.#bindListeners(options);\n\n this.reset();\n }\n\n setPageNumber(pageNumber, pageLabel) {\n this.pageNumber = pageNumber;\n this.pageLabel = pageLabel;\n this.#updateUIState(false);\n }\n\n setPagesCount(pagesCount, hasPageLabels) {\n this.pagesCount = pagesCount;\n this.hasPageLabels = hasPageLabels;\n this.#updateUIState(true);\n }\n\n setPageScale(pageScaleValue, pageScale) {\n this.pageScaleValue = (pageScaleValue || pageScale).toString();\n this.pageScale = pageScale;\n this.#updateUIState(false);\n }\n\n reset() {\n this.pageNumber = 0;\n this.pageLabel = null;\n this.hasPageLabels = false;\n this.pagesCount = 0;\n this.pageScaleValue = DEFAULT_SCALE_VALUE;\n this.pageScale = DEFAULT_SCALE;\n this.#updateUIState(true);\n this.updateLoadingIndicatorState();\n\n // Reset the Editor buttons too, since they're document specific.\n this.eventBus.dispatch(\"toolbarreset\", { source: this });\n }\n\n #bindListeners(options) {\n const { pageNumber, scaleSelect } = this.items;\n const self = this;\n\n // The buttons within the toolbar.\n for (const { element, eventName, eventDetails } of this.buttons) {\n element.addEventListener(\"click\", evt => {\n if (eventName !== null) {\n this.eventBus.dispatch(eventName, { source: this, ...eventDetails });\n }\n });\n }\n // The non-button elements within the toolbar.\n pageNumber.addEventListener(\"click\", function () {\n this.select();\n });\n pageNumber.addEventListener(\"change\", function () {\n self.eventBus.dispatch(\"pagenumberchanged\", {\n source: self,\n value: this.value,\n });\n });\n\n scaleSelect.addEventListener(\"change\", function () {\n if (this.value === \"custom\") {\n return;\n }\n self.eventBus.dispatch(\"scalechanged\", {\n source: self,\n value: this.value,\n });\n });\n // Here we depend on browsers dispatching the \"click\" event *after* the\n // \"change\" event, when the <select>-element changes.\n scaleSelect.addEventListener(\"click\", function (evt) {\n const target = evt.target;\n // Remove focus when an <option>-element was *clicked*, to improve the UX\n // for mouse users (fixes bug 1300525 and issue 4923).\n if (\n this.value === self.pageScaleValue &&\n target.tagName.toUpperCase() === \"OPTION\"\n ) {\n this.blur();\n }\n });\n // Suppress context menus for some controls.\n scaleSelect.oncontextmenu = noContextMenuHandler;\n\n this.eventBus._on(\"localized\", () => {\n this.#wasLocalized = true;\n this.#adjustScaleWidth();\n this.#updateUIState(true);\n });\n\n this.#bindEditorToolsListener(options);\n }\n\n #bindEditorToolsListener({\n editorFreeTextButton,\n editorFreeTextParamsToolbar,\n editorInkButton,\n editorInkParamsToolbar,\n }) {\n const editorModeChanged = (evt, disableButtons = false) => {\n const editorButtons = [\n {\n mode: AnnotationEditorType.FREETEXT,\n button: editorFreeTextButton,\n toolbar: editorFreeTextParamsToolbar,\n },\n {\n mode: AnnotationEditorType.INK,\n button: editorInkButton,\n toolbar: editorInkParamsToolbar,\n },\n ];\n\n for (const { mode, button, toolbar } of editorButtons) {\n const checked = mode === evt.mode;\n button.classList.toggle(\"toggled\", checked);\n button.setAttribute(\"aria-checked\", checked);\n button.disabled = disableButtons;\n toolbar?.classList.toggle(\"hidden\", !checked);\n }\n };\n this.eventBus._on(\"annotationeditormodechanged\", editorModeChanged);\n\n this.eventBus._on(\"toolbarreset\", evt => {\n if (evt.source === this) {\n editorModeChanged(\n { mode: AnnotationEditorType.NONE },\n /* disableButtons = */ true\n );\n }\n });\n }\n\n #updateUIState(resetNumPages = false) {\n if (!this.#wasLocalized) {\n // Don't update the UI state until we localize the toolbar.\n return;\n }\n const { pageNumber, pagesCount, pageScaleValue, pageScale, items } = this;\n\n if (resetNumPages) {\n if (this.hasPageLabels) {\n items.pageNumber.type = \"text\";\n } else {\n items.pageNumber.type = \"number\";\n this.l10n.get(\"of_pages\", { pagesCount }).then(msg => {\n items.numPages.textContent = msg;\n });\n }\n items.pageNumber.max = pagesCount;\n }\n\n if (this.hasPageLabels) {\n items.pageNumber.value = this.pageLabel;\n this.l10n.get(\"page_of_pages\", { pageNumber, pagesCount }).then(msg => {\n items.numPages.textContent = msg;\n });\n } else {\n items.pageNumber.value = pageNumber;\n }\n\n items.previous.disabled = pageNumber <= 1;\n items.next.disabled = pageNumber >= pagesCount;\n\n items.zoomOut.disabled = pageScale <= MIN_SCALE;\n items.zoomIn.disabled = pageScale >= MAX_SCALE;\n\n this.l10n\n .get(\"page_scale_percent\", { scale: Math.round(pageScale * 10000) / 100 })\n .then(msg => {\n let predefinedValueFound = false;\n for (const option of items.scaleSelect.options) {\n if (option.value !== pageScaleValue) {\n option.selected = false;\n continue;\n }\n option.selected = true;\n predefinedValueFound = true;\n }\n if (!predefinedValueFound) {\n items.customScaleOption.textContent = msg;\n items.customScaleOption.selected = true;\n }\n });\n }\n\n updateLoadingIndicatorState(loading = false) {\n const { pageNumber } = this.items;\n\n pageNumber.classList.toggle(PAGE_NUMBER_LOADING_INDICATOR, loading);\n }\n\n /**\n * Increase the width of the zoom dropdown DOM element if, and only if, it's\n * too narrow to fit the *longest* of the localized strings.\n */\n async #adjustScaleWidth() {\n const { items, l10n } = this;\n\n const predefinedValuesPromise = Promise.all([\n l10n.get(\"page_scale_auto\"),\n l10n.get(\"page_scale_actual\"),\n l10n.get(\"page_scale_fit\"),\n l10n.get(\"page_scale_width\"),\n ]);\n await animationStarted;\n\n const style = getComputedStyle(items.scaleSelect);\n const scaleSelectWidth = parseFloat(\n style.getPropertyValue(\"--scale-select-width\")\n );\n\n // The temporary canvas is used to measure text length in the DOM.\n const canvas = document.createElement(\"canvas\");\n const ctx = canvas.getContext(\"2d\", { alpha: false });\n ctx.font = `${style.fontSize} ${style.fontFamily}`;\n\n let maxWidth = 0;\n for (const predefinedValue of await predefinedValuesPromise) {\n const { width } = ctx.measureText(predefinedValue);\n if (width > maxWidth) {\n maxWidth = width;\n }\n }\n // Account for the icon width, and ensure that there's always some spacing\n // between the text and the icon.\n maxWidth += 0.3 * scaleSelectWidth;\n\n if (maxWidth > scaleSelectWidth) {\n const container = items.scaleSelect.parentNode;\n container.style.setProperty(\"--scale-select-width\", `${maxWidth}px`);\n }\n // Zeroing the width and height cause Firefox to release graphics resources\n // immediately, which can greatly reduce memory consumption.\n canvas.width = 0;\n canvas.height = 0;\n }\n}\n\nexport { Toolbar };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20;\n\n/**\n * View History - This is a utility for saving various view parameters for\n * recently opened files.\n *\n * The way that the view parameters are stored depends on how PDF.js is built,\n * for 'gulp <flag>' the following cases exist:\n * - MOZCENTRAL - uses sessionStorage.\n * - GENERIC or CHROME - uses localStorage, if it is available.\n */\nclass ViewHistory {\n constructor(fingerprint, cacheSize = DEFAULT_VIEW_HISTORY_CACHE_SIZE) {\n this.fingerprint = fingerprint;\n this.cacheSize = cacheSize;\n\n this._initializedPromise = this._readFromStorage().then(databaseStr => {\n const database = JSON.parse(databaseStr || \"{}\");\n let index = -1;\n if (!Array.isArray(database.files)) {\n database.files = [];\n } else {\n while (database.files.length >= this.cacheSize) {\n database.files.shift();\n }\n\n for (let i = 0, ii = database.files.length; i < ii; i++) {\n const branch = database.files[i];\n if (branch.fingerprint === this.fingerprint) {\n index = i;\n break;\n }\n }\n }\n if (index === -1) {\n index = database.files.push({ fingerprint: this.fingerprint }) - 1;\n }\n this.file = database.files[index];\n this.database = database;\n });\n }\n\n async _writeToStorage() {\n const databaseStr = JSON.stringify(this.database);\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n sessionStorage.setItem(\"pdfjs.history\", databaseStr);\n return;\n }\n localStorage.setItem(\"pdfjs.history\", databaseStr);\n }\n\n async _readFromStorage() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n return sessionStorage.getItem(\"pdfjs.history\");\n }\n return localStorage.getItem(\"pdfjs.history\");\n }\n\n async set(name, val) {\n await this._initializedPromise;\n this.file[name] = val;\n return this._writeToStorage();\n }\n\n async setMultiple(properties) {\n await this._initializedPromise;\n for (const name in properties) {\n this.file[name] = properties[name];\n }\n return this._writeToStorage();\n }\n\n async get(name, defaultValue) {\n await this._initializedPromise;\n const val = this.file[name];\n return val !== undefined ? val : defaultValue;\n }\n\n async getMultiple(properties) {\n await this._initializedPromise;\n const values = Object.create(null);\n\n for (const name in properties) {\n const val = this.file[name];\n values[name] = val !== undefined ? val : properties[name];\n }\n return values;\n }\n}\n\nexport { ViewHistory };\n","/* Copyright 2013 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AppOptions, OptionKind } from \"./app_options.js\";\n\n/**\n * BasePreferences - Abstract base class for storing persistent settings.\n * Used for settings that should be applied to all opened documents,\n * or every time the viewer is loaded.\n */\nclass BasePreferences {\n #defaults = Object.freeze(\n typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n ? AppOptions.getAll(OptionKind.PREFERENCE)\n : PDFJSDev.eval(\"DEFAULT_PREFERENCES\")\n );\n\n #prefs = Object.create(null);\n\n #initializedPromise = null;\n\n constructor() {\n if (this.constructor === BasePreferences) {\n throw new Error(\"Cannot initialize BasePreferences.\");\n }\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")) {\n Object.defineProperty(this, \"defaults\", {\n get() {\n return this.#defaults;\n },\n });\n }\n\n this.#initializedPromise = this._readFromStorage(this.#defaults).then(\n prefs => {\n for (const name in this.#defaults) {\n const prefValue = prefs?.[name];\n // Ignore preferences whose types don't match the default values.\n if (typeof prefValue === typeof this.#defaults[name]) {\n this.#prefs[name] = prefValue;\n }\n }\n }\n );\n }\n\n /**\n * Stub function for writing preferences to storage.\n * @param {Object} prefObj The preferences that should be written to storage.\n * @returns {Promise} A promise that is resolved when the preference values\n * have been written.\n */\n async _writeToStorage(prefObj) {\n throw new Error(\"Not implemented: _writeToStorage\");\n }\n\n /**\n * Stub function for reading preferences from storage.\n * @param {Object} prefObj The preferences that should be read from storage.\n * @returns {Promise} A promise that is resolved with an {Object} containing\n * the preferences that have been read.\n */\n async _readFromStorage(prefObj) {\n throw new Error(\"Not implemented: _readFromStorage\");\n }\n\n /**\n * Reset the preferences to their default values and update storage.\n * @returns {Promise} A promise that is resolved when the preference values\n * have been reset.\n */\n async reset() {\n await this.#initializedPromise;\n const prefs = this.#prefs;\n\n this.#prefs = Object.create(null);\n return this._writeToStorage(this.#defaults).catch(reason => {\n // Revert all preference values, since writing to storage failed.\n this.#prefs = prefs;\n throw reason;\n });\n }\n\n /**\n * Set the value of a preference.\n * @param {string} name The name of the preference that should be changed.\n * @param {boolean|number|string} value The new value of the preference.\n * @returns {Promise} A promise that is resolved when the value has been set,\n * provided that the preference exists and the types match.\n */\n async set(name, value) {\n await this.#initializedPromise;\n const defaultValue = this.#defaults[name],\n prefs = this.#prefs;\n\n if (defaultValue === undefined) {\n throw new Error(`Set preference: \"${name}\" is undefined.`);\n } else if (value === undefined) {\n throw new Error(\"Set preference: no value is specified.\");\n }\n const valueType = typeof value,\n defaultType = typeof defaultValue;\n\n if (valueType !== defaultType) {\n if (valueType === \"number\" && defaultType === \"string\") {\n value = value.toString();\n } else {\n throw new Error(\n `Set preference: \"${value}\" is a ${valueType}, expected a ${defaultType}.`\n );\n }\n } else {\n if (valueType === \"number\" && !Number.isInteger(value)) {\n throw new Error(`Set preference: \"${value}\" must be an integer.`);\n }\n }\n\n this.#prefs[name] = value;\n return this._writeToStorage(this.#prefs).catch(reason => {\n // Revert all preference values, since writing to storage failed.\n this.#prefs = prefs;\n throw reason;\n });\n }\n\n /**\n * Get the value of a preference.\n * @param {string} name The name of the preference whose value is requested.\n * @returns {Promise} A promise resolved with a {boolean|number|string}\n * containing the value of the preference.\n */\n async get(name) {\n await this.#initializedPromise;\n const defaultValue = this.#defaults[name];\n\n if (defaultValue === undefined) {\n throw new Error(`Get preference: \"${name}\" is undefined.`);\n }\n return this.#prefs[name] ?? defaultValue;\n }\n\n /**\n * Get the values of all preferences.\n * @returns {Promise} A promise that is resolved with an {Object} containing\n * the values of all preferences.\n */\n async getAll() {\n await this.#initializedPromise;\n const obj = Object.create(null);\n\n for (const name in this.#defaults) {\n obj[name] = this.#prefs[name] ?? this.#defaults[name];\n }\n return obj;\n }\n}\n\nexport { BasePreferences };\n","/* Copyright 2013 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces\").IDownloadManager} IDownloadManager */\n\nimport { createValidAbsoluteUrl, isPdfFile } from \"pdfjs-lib\";\n\nif (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"CHROME || GENERIC\")) {\n throw new Error(\n 'Module \"pdfjs-web/download_manager\" shall not be used ' +\n \"outside CHROME and GENERIC builds.\"\n );\n}\n\nfunction download(blobUrl, filename) {\n const a = document.createElement(\"a\");\n if (!a.click) {\n throw new Error('DownloadManager: \"a.click()\" is not supported.');\n }\n a.href = blobUrl;\n a.target = \"_parent\";\n // Use a.download if available. This increases the likelihood that\n // the file is downloaded instead of opened by another PDF plugin.\n if (\"download\" in a) {\n a.download = filename;\n }\n // <a> must be in the document for recent Firefox versions,\n // otherwise .click() is ignored.\n (document.body || document.documentElement).append(a);\n a.click();\n a.remove();\n}\n\n/**\n * @implements {IDownloadManager}\n */\nclass DownloadManager {\n #openBlobUrls = new WeakMap();\n\n downloadUrl(url, filename) {\n if (!createValidAbsoluteUrl(url, \"http://example.com\")) {\n console.error(`downloadUrl - not a valid URL: ${url}`);\n return; // restricted/invalid URL\n }\n download(url + \"#pdfjs.action=download\", filename);\n }\n\n downloadData(data, filename, contentType) {\n const blobUrl = URL.createObjectURL(\n new Blob([data], { type: contentType })\n );\n download(blobUrl, filename);\n }\n\n /**\n * @returns {boolean} Indicating if the data was opened.\n */\n openOrDownloadData(element, data, filename) {\n const isPdfData = isPdfFile(filename);\n const contentType = isPdfData ? \"application/pdf\" : \"\";\n\n if (\n (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"COMPONENTS\")) &&\n isPdfData\n ) {\n let blobUrl = this.#openBlobUrls.get(element);\n if (!blobUrl) {\n blobUrl = URL.createObjectURL(new Blob([data], { type: contentType }));\n this.#openBlobUrls.set(element, blobUrl);\n }\n let viewerUrl;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n // The current URL is the viewer, let's use it and append the file.\n viewerUrl = \"?file=\" + encodeURIComponent(blobUrl + \"#\" + filename);\n } else if (PDFJSDev.test(\"CHROME\")) {\n // In the Chrome extension, the URL is rewritten using the history API\n // in viewer.js, so an absolute URL must be generated.\n viewerUrl =\n // eslint-disable-next-line no-undef\n chrome.runtime.getURL(\"/content/web/viewer.html\") +\n \"?file=\" +\n encodeURIComponent(blobUrl + \"#\" + filename);\n }\n\n try {\n window.open(viewerUrl);\n return true;\n } catch (ex) {\n console.error(`openOrDownloadData: ${ex}`);\n // Release the `blobUrl`, since opening it failed, and fallback to\n // downloading the PDF file.\n URL.revokeObjectURL(blobUrl);\n this.#openBlobUrls.delete(element);\n }\n }\n\n this.downloadData(data, filename, contentType);\n return false;\n }\n\n download(blob, url, filename) {\n const blobUrl = URL.createObjectURL(blob);\n download(blobUrl, filename);\n }\n}\n\nexport { DownloadManager };\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n\nimport \"../external/webL10n/l10n.js\";\nimport { fixupLangCode, getL10nFallback } from \"./l10n_utils.js\";\n\nconst webL10n = document.webL10n;\n\n/**\n * @implements {IL10n}\n */\nclass GenericL10n {\n constructor(lang) {\n this._lang = lang;\n this._ready = new Promise((resolve, reject) => {\n webL10n.setLanguage(fixupLangCode(lang), () => {\n resolve(webL10n);\n });\n });\n }\n\n async getLanguage() {\n const l10n = await this._ready;\n return l10n.getLanguage();\n }\n\n async getDirection() {\n const l10n = await this._ready;\n return l10n.getDirection();\n }\n\n async get(key, args = null, fallback = getL10nFallback(key, args)) {\n const l10n = await this._ready;\n return l10n.get(key, args, fallback);\n }\n\n async translate(element) {\n const l10n = await this._ready;\n return l10n.translate(element);\n }\n}\n\nexport { GenericL10n };\n","/**\n * Copyright (c) 2011-2013 Fabien Cazenave, Mozilla.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n/*\n Additional modifications for PDF.js project:\n - Disables language initialization on page loading.\n - Disables document translation on page loading.\n - Removes consoleWarn and consoleLog and use console.log/warn directly.\n - Removes window._ assignment.\n - Remove compatibility code for OldIE.\n - Replaces `String.prototype.substr()` with `String.prototype.substring()`.\n - Replaces one `Node.insertBefore()` with `Element.prepend()`.\n - Removes `fireL10nReadyEvent` since the \"localized\" event it dispatches\n is unused and may clash with an identically named event in the viewer.\n*/\n\n/*jshint browser: true, devel: true, es5: true, globalstrict: true */\n'use strict';\n\ndocument.webL10n = (function(window, document, undefined) {\n var gL10nData = {};\n var gTextData = '';\n var gTextProp = 'textContent';\n var gLanguage = '';\n var gMacros = {};\n var gReadyState = 'loading';\n\n\n /**\n * Synchronously loading l10n resources significantly minimizes flickering\n * from displaying the app with non-localized strings and then updating the\n * strings. Although this will block all script execution on this page, we\n * expect that the l10n resources are available locally on flash-storage.\n *\n * As synchronous XHR is generally considered as a bad idea, we're still\n * loading l10n resources asynchronously -- but we keep this in a setting,\n * just in case... and applications using this library should hide their\n * content until the `localized' event happens.\n */\n\n var gAsyncResourceLoading = true; // read-only\n\n\n /**\n * DOM helpers for the so-called \"HTML API\".\n *\n * These functions are written for modern browsers. For old versions of IE,\n * they're overridden in the 'startup' section at the end of this file.\n */\n\n function getL10nResourceLinks() {\n return document.querySelectorAll('link[type=\"application/l10n\"]');\n }\n\n function getL10nDictionary() {\n var script = document.querySelector('script[type=\"application/l10n\"]');\n // TODO: support multiple and external JSON dictionaries\n return script ? JSON.parse(script.innerHTML) : null;\n }\n\n function getTranslatableChildren(element) {\n return element ? element.querySelectorAll('*[data-l10n-id]') : [];\n }\n\n function getL10nAttributes(element) {\n if (!element)\n return {};\n\n var l10nId = element.getAttribute('data-l10n-id');\n var l10nArgs = element.getAttribute('data-l10n-args');\n var args = {};\n if (l10nArgs) {\n try {\n args = JSON.parse(l10nArgs);\n } catch (e) {\n console.warn('could not parse arguments for #' + l10nId);\n }\n }\n return { id: l10nId, args: args };\n }\n\n function xhrLoadText(url, onSuccess, onFailure) {\n onSuccess = onSuccess || function _onSuccess(data) {};\n onFailure = onFailure || function _onFailure() {};\n\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, gAsyncResourceLoading);\n if (xhr.overrideMimeType) {\n xhr.overrideMimeType('text/plain; charset=utf-8');\n }\n xhr.onreadystatechange = function() {\n if (xhr.readyState == 4) {\n if (xhr.status == 200 || xhr.status === 0) {\n onSuccess(xhr.responseText);\n } else {\n onFailure();\n }\n }\n };\n xhr.onerror = onFailure;\n xhr.ontimeout = onFailure;\n\n // in Firefox OS with the app:// protocol, trying to XHR a non-existing\n // URL will raise an exception here -- hence this ugly try...catch.\n try {\n xhr.send(null);\n } catch (e) {\n onFailure();\n }\n }\n\n\n /**\n * l10n resource parser:\n * - reads (async XHR) the l10n resource matching `lang';\n * - imports linked resources (synchronously) when specified;\n * - parses the text data (fills `gL10nData' and `gTextData');\n * - triggers success/failure callbacks when done.\n *\n * @param {string} href\n * URL of the l10n resource to parse.\n *\n * @param {string} lang\n * locale (language) to parse. Must be a lowercase string.\n *\n * @param {Function} successCallback\n * triggered when the l10n resource has been successfully parsed.\n *\n * @param {Function} failureCallback\n * triggered when the an error has occurred.\n *\n * @return {void}\n * uses the following global variables: gL10nData, gTextData, gTextProp.\n */\n\n function parseResource(href, lang, successCallback, failureCallback) {\n var baseURL = href.replace(/[^\\/]*$/, '') || './';\n\n // handle escaped characters (backslashes) in a string\n function evalString(text) {\n if (text.lastIndexOf('\\\\') < 0)\n return text;\n return text.replace(/\\\\\\\\/g, '\\\\')\n .replace(/\\\\n/g, '\\n')\n .replace(/\\\\r/g, '\\r')\n .replace(/\\\\t/g, '\\t')\n .replace(/\\\\b/g, '\\b')\n .replace(/\\\\f/g, '\\f')\n .replace(/\\\\{/g, '{')\n .replace(/\\\\}/g, '}')\n .replace(/\\\\\"/g, '\"')\n .replace(/\\\\'/g, \"'\");\n }\n\n // parse *.properties text data into an l10n dictionary\n // If gAsyncResourceLoading is false, then the callback will be called\n // synchronously. Otherwise it is called asynchronously.\n function parseProperties(text, parsedPropertiesCallback) {\n var dictionary = {};\n\n // token expressions\n var reBlank = /^\\s*|\\s*$/;\n var reComment = /^\\s*#|^\\s*$/;\n var reSection = /^\\s*\\[(.*)\\]\\s*$/;\n var reImport = /^\\s*@import\\s+url\\((.*)\\)\\s*$/i;\n var reSplit = /^([^=\\s]*)\\s*=\\s*(.+)$/; // TODO: escape EOLs with '\\'\n\n // parse the *.properties file into an associative array\n function parseRawLines(rawText, extendedSyntax, parsedRawLinesCallback) {\n var entries = rawText.replace(reBlank, '').split(/[\\r\\n]+/);\n var currentLang = '*';\n var genericLang = lang.split('-', 1)[0];\n var skipLang = false;\n var match = '';\n\n function nextEntry() {\n // Use infinite loop instead of recursion to avoid reaching the\n // maximum recursion limit for content with many lines.\n while (true) {\n if (!entries.length) {\n parsedRawLinesCallback();\n return;\n }\n var line = entries.shift();\n\n // comment or blank line?\n if (reComment.test(line))\n continue;\n\n // the extended syntax supports [lang] sections and @import rules\n if (extendedSyntax) {\n match = reSection.exec(line);\n if (match) { // section start?\n // RFC 4646, section 4.4, \"All comparisons MUST be performed\n // in a case-insensitive manner.\"\n\n currentLang = match[1].toLowerCase();\n skipLang = (currentLang !== '*') &&\n (currentLang !== lang) && (currentLang !== genericLang);\n continue;\n } else if (skipLang) {\n continue;\n }\n match = reImport.exec(line);\n if (match) { // @import rule?\n loadImport(baseURL + match[1], nextEntry);\n return;\n }\n }\n\n // key-value pair\n var tmp = line.match(reSplit);\n if (tmp && tmp.length == 3) {\n dictionary[tmp[1]] = evalString(tmp[2]);\n }\n }\n }\n nextEntry();\n }\n\n // import another *.properties file\n function loadImport(url, callback) {\n xhrLoadText(url, function(content) {\n parseRawLines(content, false, callback); // don't allow recursive imports\n }, function () {\n console.warn(url + ' not found.');\n callback();\n });\n }\n\n // fill the dictionary\n parseRawLines(text, true, function() {\n parsedPropertiesCallback(dictionary);\n });\n }\n\n // load and parse l10n data (warning: global variables are used here)\n xhrLoadText(href, function(response) {\n gTextData += response; // mostly for debug\n\n // parse *.properties text data into an l10n dictionary\n parseProperties(response, function(data) {\n\n // find attribute descriptions, if any\n for (var key in data) {\n var id, prop, index = key.lastIndexOf('.');\n if (index > 0) { // an attribute has been specified\n id = key.substring(0, index);\n prop = key.substring(index + 1);\n } else { // no attribute: assuming text content by default\n id = key;\n prop = gTextProp;\n }\n if (!gL10nData[id]) {\n gL10nData[id] = {};\n }\n gL10nData[id][prop] = data[key];\n }\n\n // trigger callback\n if (successCallback) {\n successCallback();\n }\n });\n }, failureCallback);\n }\n\n // load and parse all resources for the specified locale\n function loadLocale(lang, callback) {\n // RFC 4646, section 2.1 states that language tags have to be treated as\n // case-insensitive. Convert to lowercase for case-insensitive comparisons.\n if (lang) {\n lang = lang.toLowerCase();\n }\n\n callback = callback || function _callback() {};\n\n clear();\n gLanguage = lang;\n\n // check all <link type=\"application/l10n\" href=\"...\" /> nodes\n // and load the resource files\n var langLinks = getL10nResourceLinks();\n var langCount = langLinks.length;\n if (langCount === 0) {\n // we might have a pre-compiled dictionary instead\n var dict = getL10nDictionary();\n if (dict && dict.locales && dict.default_locale) {\n console.log('using the embedded JSON directory, early way out');\n gL10nData = dict.locales[lang];\n if (!gL10nData) {\n var defaultLocale = dict.default_locale.toLowerCase();\n for (var anyCaseLang in dict.locales) {\n anyCaseLang = anyCaseLang.toLowerCase();\n if (anyCaseLang === lang) {\n gL10nData = dict.locales[lang];\n break;\n } else if (anyCaseLang === defaultLocale) {\n gL10nData = dict.locales[defaultLocale];\n }\n }\n }\n callback();\n } else {\n console.log('no resource to load, early way out');\n }\n // early way out\n gReadyState = 'complete';\n return;\n }\n\n // start the callback when all resources are loaded\n var onResourceLoaded = null;\n var gResourceCount = 0;\n onResourceLoaded = function() {\n gResourceCount++;\n if (gResourceCount >= langCount) {\n callback();\n gReadyState = 'complete';\n }\n };\n\n // load all resource files\n function L10nResourceLink(link) {\n var href = link.href;\n // Note: If |gAsyncResourceLoading| is false, then the following callbacks\n // are synchronously called.\n this.load = function(lang, callback) {\n parseResource(href, lang, callback, function() {\n console.warn(href + ' not found.');\n // lang not found, used default resource instead\n console.warn('\"' + lang + '\" resource not found');\n gLanguage = '';\n // Resource not loaded, but we still need to call the callback.\n callback();\n });\n };\n }\n\n for (var i = 0; i < langCount; i++) {\n var resource = new L10nResourceLink(langLinks[i]);\n resource.load(lang, onResourceLoaded);\n }\n }\n\n // clear all l10n data\n function clear() {\n gL10nData = {};\n gTextData = '';\n gLanguage = '';\n // TODO: clear all non predefined macros.\n // There's no such macro /yet/ but we're planning to have some...\n }\n\n\n /**\n * Get rules for plural forms (shared with JetPack), see:\n * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html\n * https://github.com/mozilla/addon-sdk/blob/master/python-lib/plural-rules-generator.p\n *\n * @param {string} lang\n * locale (language) used.\n *\n * @return {Function}\n * returns a function that gives the plural form name for a given integer:\n * var fun = getPluralRules('en');\n * fun(1) -> 'one'\n * fun(0) -> 'other'\n * fun(1000) -> 'other'.\n */\n\n function getPluralRules(lang) {\n var locales2rules = {\n 'af': 3,\n 'ak': 4,\n 'am': 4,\n 'ar': 1,\n 'asa': 3,\n 'az': 0,\n 'be': 11,\n 'bem': 3,\n 'bez': 3,\n 'bg': 3,\n 'bh': 4,\n 'bm': 0,\n 'bn': 3,\n 'bo': 0,\n 'br': 20,\n 'brx': 3,\n 'bs': 11,\n 'ca': 3,\n 'cgg': 3,\n 'chr': 3,\n 'cs': 12,\n 'cy': 17,\n 'da': 3,\n 'de': 3,\n 'dv': 3,\n 'dz': 0,\n 'ee': 3,\n 'el': 3,\n 'en': 3,\n 'eo': 3,\n 'es': 3,\n 'et': 3,\n 'eu': 3,\n 'fa': 0,\n 'ff': 5,\n 'fi': 3,\n 'fil': 4,\n 'fo': 3,\n 'fr': 5,\n 'fur': 3,\n 'fy': 3,\n 'ga': 8,\n 'gd': 24,\n 'gl': 3,\n 'gsw': 3,\n 'gu': 3,\n 'guw': 4,\n 'gv': 23,\n 'ha': 3,\n 'haw': 3,\n 'he': 2,\n 'hi': 4,\n 'hr': 11,\n 'hu': 0,\n 'id': 0,\n 'ig': 0,\n 'ii': 0,\n 'is': 3,\n 'it': 3,\n 'iu': 7,\n 'ja': 0,\n 'jmc': 3,\n 'jv': 0,\n 'ka': 0,\n 'kab': 5,\n 'kaj': 3,\n 'kcg': 3,\n 'kde': 0,\n 'kea': 0,\n 'kk': 3,\n 'kl': 3,\n 'km': 0,\n 'kn': 0,\n 'ko': 0,\n 'ksb': 3,\n 'ksh': 21,\n 'ku': 3,\n 'kw': 7,\n 'lag': 18,\n 'lb': 3,\n 'lg': 3,\n 'ln': 4,\n 'lo': 0,\n 'lt': 10,\n 'lv': 6,\n 'mas': 3,\n 'mg': 4,\n 'mk': 16,\n 'ml': 3,\n 'mn': 3,\n 'mo': 9,\n 'mr': 3,\n 'ms': 0,\n 'mt': 15,\n 'my': 0,\n 'nah': 3,\n 'naq': 7,\n 'nb': 3,\n 'nd': 3,\n 'ne': 3,\n 'nl': 3,\n 'nn': 3,\n 'no': 3,\n 'nr': 3,\n 'nso': 4,\n 'ny': 3,\n 'nyn': 3,\n 'om': 3,\n 'or': 3,\n 'pa': 3,\n 'pap': 3,\n 'pl': 13,\n 'ps': 3,\n 'pt': 3,\n 'rm': 3,\n 'ro': 9,\n 'rof': 3,\n 'ru': 11,\n 'rwk': 3,\n 'sah': 0,\n 'saq': 3,\n 'se': 7,\n 'seh': 3,\n 'ses': 0,\n 'sg': 0,\n 'sh': 11,\n 'shi': 19,\n 'sk': 12,\n 'sl': 14,\n 'sma': 7,\n 'smi': 7,\n 'smj': 7,\n 'smn': 7,\n 'sms': 7,\n 'sn': 3,\n 'so': 3,\n 'sq': 3,\n 'sr': 11,\n 'ss': 3,\n 'ssy': 3,\n 'st': 3,\n 'sv': 3,\n 'sw': 3,\n 'syr': 3,\n 'ta': 3,\n 'te': 3,\n 'teo': 3,\n 'th': 0,\n 'ti': 4,\n 'tig': 3,\n 'tk': 3,\n 'tl': 4,\n 'tn': 3,\n 'to': 0,\n 'tr': 0,\n 'ts': 3,\n 'tzm': 22,\n 'uk': 11,\n 'ur': 3,\n 've': 3,\n 'vi': 0,\n 'vun': 3,\n 'wa': 4,\n 'wae': 3,\n 'wo': 0,\n 'xh': 3,\n 'xog': 3,\n 'yo': 0,\n 'zh': 0,\n 'zu': 3\n };\n\n // utility functions for plural rules methods\n function isIn(n, list) {\n return list.indexOf(n) !== -1;\n }\n function isBetween(n, start, end) {\n return start <= n && n <= end;\n }\n\n // list of all plural rules methods:\n // map an integer to the plural form name to use\n var pluralRules = {\n '0': function(n) {\n return 'other';\n },\n '1': function(n) {\n if ((isBetween((n % 100), 3, 10)))\n return 'few';\n if (n === 0)\n return 'zero';\n if ((isBetween((n % 100), 11, 99)))\n return 'many';\n if (n == 2)\n return 'two';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '2': function(n) {\n if (n !== 0 && (n % 10) === 0)\n return 'many';\n if (n == 2)\n return 'two';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '3': function(n) {\n if (n == 1)\n return 'one';\n return 'other';\n },\n '4': function(n) {\n if ((isBetween(n, 0, 1)))\n return 'one';\n return 'other';\n },\n '5': function(n) {\n if ((isBetween(n, 0, 2)) && n != 2)\n return 'one';\n return 'other';\n },\n '6': function(n) {\n if (n === 0)\n return 'zero';\n if ((n % 10) == 1 && (n % 100) != 11)\n return 'one';\n return 'other';\n },\n '7': function(n) {\n if (n == 2)\n return 'two';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '8': function(n) {\n if ((isBetween(n, 3, 6)))\n return 'few';\n if ((isBetween(n, 7, 10)))\n return 'many';\n if (n == 2)\n return 'two';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '9': function(n) {\n if (n === 0 || n != 1 && (isBetween((n % 100), 1, 19)))\n return 'few';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '10': function(n) {\n if ((isBetween((n % 10), 2, 9)) && !(isBetween((n % 100), 11, 19)))\n return 'few';\n if ((n % 10) == 1 && !(isBetween((n % 100), 11, 19)))\n return 'one';\n return 'other';\n },\n '11': function(n) {\n if ((isBetween((n % 10), 2, 4)) && !(isBetween((n % 100), 12, 14)))\n return 'few';\n if ((n % 10) === 0 ||\n (isBetween((n % 10), 5, 9)) ||\n (isBetween((n % 100), 11, 14)))\n return 'many';\n if ((n % 10) == 1 && (n % 100) != 11)\n return 'one';\n return 'other';\n },\n '12': function(n) {\n if ((isBetween(n, 2, 4)))\n return 'few';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '13': function(n) {\n if ((isBetween((n % 10), 2, 4)) && !(isBetween((n % 100), 12, 14)))\n return 'few';\n if (n != 1 && (isBetween((n % 10), 0, 1)) ||\n (isBetween((n % 10), 5, 9)) ||\n (isBetween((n % 100), 12, 14)))\n return 'many';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '14': function(n) {\n if ((isBetween((n % 100), 3, 4)))\n return 'few';\n if ((n % 100) == 2)\n return 'two';\n if ((n % 100) == 1)\n return 'one';\n return 'other';\n },\n '15': function(n) {\n if (n === 0 || (isBetween((n % 100), 2, 10)))\n return 'few';\n if ((isBetween((n % 100), 11, 19)))\n return 'many';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '16': function(n) {\n if ((n % 10) == 1 && n != 11)\n return 'one';\n return 'other';\n },\n '17': function(n) {\n if (n == 3)\n return 'few';\n if (n === 0)\n return 'zero';\n if (n == 6)\n return 'many';\n if (n == 2)\n return 'two';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '18': function(n) {\n if (n === 0)\n return 'zero';\n if ((isBetween(n, 0, 2)) && n !== 0 && n != 2)\n return 'one';\n return 'other';\n },\n '19': function(n) {\n if ((isBetween(n, 2, 10)))\n return 'few';\n if ((isBetween(n, 0, 1)))\n return 'one';\n return 'other';\n },\n '20': function(n) {\n if ((isBetween((n % 10), 3, 4) || ((n % 10) == 9)) && !(\n isBetween((n % 100), 10, 19) ||\n isBetween((n % 100), 70, 79) ||\n isBetween((n % 100), 90, 99)\n ))\n return 'few';\n if ((n % 1000000) === 0 && n !== 0)\n return 'many';\n if ((n % 10) == 2 && !isIn((n % 100), [12, 72, 92]))\n return 'two';\n if ((n % 10) == 1 && !isIn((n % 100), [11, 71, 91]))\n return 'one';\n return 'other';\n },\n '21': function(n) {\n if (n === 0)\n return 'zero';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '22': function(n) {\n if ((isBetween(n, 0, 1)) || (isBetween(n, 11, 99)))\n return 'one';\n return 'other';\n },\n '23': function(n) {\n if ((isBetween((n % 10), 1, 2)) || (n % 20) === 0)\n return 'one';\n return 'other';\n },\n '24': function(n) {\n if ((isBetween(n, 3, 10) || isBetween(n, 13, 19)))\n return 'few';\n if (isIn(n, [2, 12]))\n return 'two';\n if (isIn(n, [1, 11]))\n return 'one';\n return 'other';\n }\n };\n\n // return a function that gives the plural form name for a given integer\n var index = locales2rules[lang.replace(/-.*$/, '')];\n if (!(index in pluralRules)) {\n console.warn('plural form unknown for [' + lang + ']');\n return function() { return 'other'; };\n }\n return pluralRules[index];\n }\n\n // pre-defined 'plural' macro\n gMacros.plural = function(str, param, key, prop) {\n var n = parseFloat(param);\n if (isNaN(n))\n return str;\n\n // TODO: support other properties (l20n still doesn't...)\n if (prop != gTextProp)\n return str;\n\n // initialize _pluralRules\n if (!gMacros._pluralRules) {\n gMacros._pluralRules = getPluralRules(gLanguage);\n }\n var index = '[' + gMacros._pluralRules(n) + ']';\n\n // try to find a [zero|one|two] key if it's defined\n if (n === 0 && (key + '[zero]') in gL10nData) {\n str = gL10nData[key + '[zero]'][prop];\n } else if (n == 1 && (key + '[one]') in gL10nData) {\n str = gL10nData[key + '[one]'][prop];\n } else if (n == 2 && (key + '[two]') in gL10nData) {\n str = gL10nData[key + '[two]'][prop];\n } else if ((key + index) in gL10nData) {\n str = gL10nData[key + index][prop];\n } else if ((key + '[other]') in gL10nData) {\n str = gL10nData[key + '[other]'][prop];\n }\n\n return str;\n };\n\n\n /**\n * l10n dictionary functions\n */\n\n // fetch an l10n object, warn if not found, apply `args' if possible\n function getL10nData(key, args, fallback) {\n var data = gL10nData[key];\n if (!data) {\n console.warn('#' + key + ' is undefined.');\n if (!fallback) {\n return null;\n }\n data = fallback;\n }\n\n /** This is where l10n expressions should be processed.\n * The plan is to support C-style expressions from the l20n project;\n * until then, only two kinds of simple expressions are supported:\n * {[ index ]} and {{ arguments }}.\n */\n var rv = {};\n for (var prop in data) {\n var str = data[prop];\n str = substIndexes(str, args, key, prop);\n str = substArguments(str, args, key);\n rv[prop] = str;\n }\n return rv;\n }\n\n // replace {[macros]} with their values\n function substIndexes(str, args, key, prop) {\n var reIndex = /\\{\\[\\s*([a-zA-Z]+)\\(([a-zA-Z]+)\\)\\s*\\]\\}/;\n var reMatch = reIndex.exec(str);\n if (!reMatch || !reMatch.length)\n return str;\n\n // an index/macro has been found\n // Note: at the moment, only one parameter is supported\n var macroName = reMatch[1];\n var paramName = reMatch[2];\n var param;\n if (args && paramName in args) {\n param = args[paramName];\n } else if (paramName in gL10nData) {\n param = gL10nData[paramName];\n }\n\n // there's no macro parser yet: it has to be defined in gMacros\n if (macroName in gMacros) {\n var macro = gMacros[macroName];\n str = macro(str, param, key, prop);\n }\n return str;\n }\n\n // replace {{arguments}} with their values\n function substArguments(str, args, key) {\n var reArgs = /\\{\\{\\s*(.+?)\\s*\\}\\}/g;\n return str.replace(reArgs, function(matched_text, arg) {\n if (args && arg in args) {\n return args[arg];\n }\n if (arg in gL10nData) {\n return gL10nData[arg];\n }\n console.log('argument {{' + arg + '}} for #' + key + ' is undefined.');\n return matched_text;\n });\n }\n\n // translate an HTML element\n function translateElement(element) {\n var l10n = getL10nAttributes(element);\n if (!l10n.id)\n return;\n\n // get the related l10n object\n var data = getL10nData(l10n.id, l10n.args);\n if (!data) {\n console.warn('#' + l10n.id + ' is undefined.');\n return;\n }\n\n // translate element (TODO: security checks?)\n if (data[gTextProp]) { // XXX\n if (getChildElementCount(element) === 0) {\n element[gTextProp] = data[gTextProp];\n } else {\n // this element has element children: replace the content of the first\n // (non-empty) child textNode and clear other child textNodes\n var children = element.childNodes;\n var found = false;\n for (var i = 0, l = children.length; i < l; i++) {\n if (children[i].nodeType === 3 && /\\S/.test(children[i].nodeValue)) {\n if (found) {\n children[i].nodeValue = '';\n } else {\n children[i].nodeValue = data[gTextProp];\n found = true;\n }\n }\n }\n // if no (non-empty) textNode is found, insert a textNode before the\n // first element child.\n if (!found) {\n var textNode = document.createTextNode(data[gTextProp]);\n element.prepend(textNode);\n }\n }\n delete data[gTextProp];\n }\n\n for (var k in data) {\n element[k] = data[k];\n }\n }\n\n // webkit browsers don't currently support 'children' on SVG elements...\n function getChildElementCount(element) {\n if (element.children) {\n return element.children.length;\n }\n if (typeof element.childElementCount !== 'undefined') {\n return element.childElementCount;\n }\n var count = 0;\n for (var i = 0; i < element.childNodes.length; i++) {\n count += element.nodeType === 1 ? 1 : 0;\n }\n return count;\n }\n\n // translate an HTML subtree\n function translateFragment(element) {\n element = element || document.documentElement;\n\n // check all translatable children (= w/ a `data-l10n-id' attribute)\n var children = getTranslatableChildren(element);\n var elementCount = children.length;\n for (var i = 0; i < elementCount; i++) {\n translateElement(children[i]);\n }\n\n // translate element itself if necessary\n translateElement(element);\n }\n\n return {\n // get a localized string\n get: function(key, args, fallbackString) {\n var index = key.lastIndexOf('.');\n var prop = gTextProp;\n if (index > 0) { // An attribute has been specified\n prop = key.substring(index + 1);\n key = key.substring(0, index);\n }\n var fallback;\n if (fallbackString) {\n fallback = {};\n fallback[prop] = fallbackString;\n }\n var data = getL10nData(key, args, fallback);\n if (data && prop in data) {\n return data[prop];\n }\n return '{{' + key + '}}';\n },\n\n // debug\n getData: function() { return gL10nData; },\n getText: function() { return gTextData; },\n\n // get|set the document language\n getLanguage: function() { return gLanguage; },\n setLanguage: function(lang, callback) {\n loadLocale(lang, function() {\n if (callback)\n callback();\n });\n },\n\n // get the direction (ltr|rtl) of the current language\n getDirection: function() {\n // http://www.w3.org/International/questions/qa-scripts\n // Arabic, Hebrew, Farsi, Pashto, Urdu\n var rtlList = ['ar', 'he', 'fa', 'ps', 'ur'];\n var shortCode = gLanguage.split('-', 1)[0];\n return (rtlList.indexOf(shortCode) >= 0) ? 'rtl' : 'ltr';\n },\n\n // translate an element or document fragment\n translate: translateFragment,\n\n // this can be used to prevent race conditions\n getReadyState: function() { return gReadyState; },\n ready: function(callback) {\n if (!callback) {\n return;\n } else if (gReadyState == 'complete' || gReadyState == 'interactive') {\n window.setTimeout(function() {\n callback();\n });\n } else if (document.addEventListener) {\n document.addEventListener('localized', function once() {\n document.removeEventListener('localized', once);\n callback();\n });\n }\n }\n };\n}) (window, document);\n","/* Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getPdfFilenameFromUrl, loadScript } from \"pdfjs-lib\";\n\nasync function docPropertiesLookup(pdfDocument) {\n const url = \"\",\n baseUrl = url.split(\"#\")[0];\n // eslint-disable-next-line prefer-const\n let { info, metadata, contentDispositionFilename, contentLength } =\n await pdfDocument.getMetadata();\n\n if (!contentLength) {\n const { length } = await pdfDocument.getDownloadInfo();\n contentLength = length;\n }\n\n return {\n ...info,\n baseURL: baseUrl,\n filesize: contentLength,\n filename: contentDispositionFilename || getPdfFilenameFromUrl(url),\n metadata: metadata?.getRaw(),\n authors: metadata?.get(\"dc:creator\"),\n numPages: pdfDocument.numPages,\n URL: url,\n };\n}\n\nclass GenericScripting {\n constructor(sandboxBundleSrc) {\n this._ready = loadScript(\n sandboxBundleSrc,\n /* removeScriptElement = */ true\n ).then(() => {\n return window.pdfjsSandbox.QuickJSSandbox();\n });\n }\n\n async createSandbox(data) {\n const sandbox = await this._ready;\n sandbox.create(data);\n }\n\n async dispatchEventInSandbox(event) {\n const sandbox = await this._ready;\n setTimeout(() => sandbox.dispatchEvent(event), 0);\n }\n\n async destroySandbox() {\n const sandbox = await this._ready;\n sandbox.nukeSandbox();\n }\n}\n\nexport { docPropertiesLookup, GenericScripting };\n","/* Copyright 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AnnotationMode, PixelsPerInch } from \"pdfjs-lib\";\nimport { PDFPrintServiceFactory, PDFViewerApplication } from \"./app.js\";\nimport { getXfaHtmlForPrinting } from \"./print_utils.js\";\n\nlet activeService = null;\nlet dialog = null;\nlet overlayManager = null;\n\n// Renders the page to the canvas of the given print service, and returns\n// the suggested dimensions of the output page.\nfunction renderPage(\n activeServiceOnEntry,\n pdfDocument,\n pageNumber,\n size,\n printResolution,\n optionalContentConfigPromise,\n printAnnotationStoragePromise\n) {\n const scratchCanvas = activeService.scratchCanvas;\n\n // The size of the canvas in pixels for printing.\n const PRINT_UNITS = printResolution / PixelsPerInch.PDF;\n scratchCanvas.width = Math.floor(size.width * PRINT_UNITS);\n scratchCanvas.height = Math.floor(size.height * PRINT_UNITS);\n\n const ctx = scratchCanvas.getContext(\"2d\");\n ctx.save();\n ctx.fillStyle = \"rgb(255, 255, 255)\";\n ctx.fillRect(0, 0, scratchCanvas.width, scratchCanvas.height);\n ctx.restore();\n\n return Promise.all([\n pdfDocument.getPage(pageNumber),\n printAnnotationStoragePromise,\n ]).then(function ([pdfPage, printAnnotationStorage]) {\n const renderContext = {\n canvasContext: ctx,\n transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],\n viewport: pdfPage.getViewport({ scale: 1, rotation: size.rotation }),\n intent: \"print\",\n annotationMode: AnnotationMode.ENABLE_STORAGE,\n optionalContentConfigPromise,\n printAnnotationStorage,\n };\n return pdfPage.render(renderContext).promise;\n });\n}\n\nfunction PDFPrintService(\n pdfDocument,\n pagesOverview,\n printContainer,\n printResolution,\n optionalContentConfigPromise = null,\n printAnnotationStoragePromise = null,\n l10n\n) {\n this.pdfDocument = pdfDocument;\n this.pagesOverview = pagesOverview;\n this.printContainer = printContainer;\n this._printResolution = printResolution || 150;\n this._optionalContentConfigPromise =\n optionalContentConfigPromise || pdfDocument.getOptionalContentConfig();\n this._printAnnotationStoragePromise =\n printAnnotationStoragePromise || Promise.resolve();\n this.l10n = l10n;\n this.currentPage = -1;\n // The temporary canvas where renderPage paints one page at a time.\n this.scratchCanvas = document.createElement(\"canvas\");\n}\n\nPDFPrintService.prototype = {\n layout() {\n this.throwIfInactive();\n\n const body = document.querySelector(\"body\");\n body.setAttribute(\"data-pdfjsprinting\", true);\n\n const hasEqualPageSizes = this.pagesOverview.every(function (size) {\n return (\n size.width === this.pagesOverview[0].width &&\n size.height === this.pagesOverview[0].height\n );\n }, this);\n if (!hasEqualPageSizes) {\n console.warn(\n \"Not all pages have the same size. The printed \" +\n \"result may be incorrect!\"\n );\n }\n\n // Insert a @page + size rule to make sure that the page size is correctly\n // set. Note that we assume that all pages have the same size, because\n // variable-size pages are not supported yet (e.g. in Chrome & Firefox).\n // TODO(robwu): Use named pages when size calculation bugs get resolved\n // (e.g. https://crbug.com/355116) AND when support for named pages is\n // added (http://www.w3.org/TR/css3-page/#using-named-pages).\n // In browsers where @page + size is not supported (such as Firefox,\n // https://bugzil.la/851441), the next stylesheet will be ignored and the\n // user has to select the correct paper size in the UI if wanted.\n this.pageStyleSheet = document.createElement(\"style\");\n const pageSize = this.pagesOverview[0];\n this.pageStyleSheet.textContent =\n \"@page { size: \" + pageSize.width + \"pt \" + pageSize.height + \"pt;}\";\n body.append(this.pageStyleSheet);\n },\n\n destroy() {\n if (activeService !== this) {\n // |activeService| cannot be replaced without calling destroy() first,\n // so if it differs then an external consumer has a stale reference to us.\n return;\n }\n this.printContainer.textContent = \"\";\n\n const body = document.querySelector(\"body\");\n body.removeAttribute(\"data-pdfjsprinting\");\n\n if (this.pageStyleSheet) {\n this.pageStyleSheet.remove();\n this.pageStyleSheet = null;\n }\n this.scratchCanvas.width = this.scratchCanvas.height = 0;\n this.scratchCanvas = null;\n activeService = null;\n ensureOverlay().then(function () {\n if (overlayManager.active === dialog) {\n overlayManager.close(dialog);\n }\n });\n },\n\n renderPages() {\n if (this.pdfDocument.isPureXfa) {\n getXfaHtmlForPrinting(this.printContainer, this.pdfDocument);\n return Promise.resolve();\n }\n\n const pageCount = this.pagesOverview.length;\n const renderNextPage = (resolve, reject) => {\n this.throwIfInactive();\n if (++this.currentPage >= pageCount) {\n renderProgress(pageCount, pageCount, this.l10n);\n resolve();\n return;\n }\n const index = this.currentPage;\n renderProgress(index, pageCount, this.l10n);\n renderPage(\n this,\n this.pdfDocument,\n /* pageNumber = */ index + 1,\n this.pagesOverview[index],\n this._printResolution,\n this._optionalContentConfigPromise,\n this._printAnnotationStoragePromise\n )\n .then(this.useRenderedPage.bind(this))\n .then(function () {\n renderNextPage(resolve, reject);\n }, reject);\n };\n return new Promise(renderNextPage);\n },\n\n useRenderedPage() {\n this.throwIfInactive();\n const img = document.createElement(\"img\");\n const scratchCanvas = this.scratchCanvas;\n if (\"toBlob\" in scratchCanvas) {\n scratchCanvas.toBlob(function (blob) {\n img.src = URL.createObjectURL(blob);\n });\n } else {\n img.src = scratchCanvas.toDataURL();\n }\n\n const wrapper = document.createElement(\"div\");\n wrapper.className = \"printedPage\";\n wrapper.append(img);\n this.printContainer.append(wrapper);\n\n return new Promise(function (resolve, reject) {\n img.onload = resolve;\n img.onerror = reject;\n });\n },\n\n performPrint() {\n this.throwIfInactive();\n return new Promise(resolve => {\n // Push window.print in the macrotask queue to avoid being affected by\n // the deprecation of running print() code in a microtask, see\n // https://github.com/mozilla/pdf.js/issues/7547.\n setTimeout(() => {\n if (!this.active) {\n resolve();\n return;\n }\n print.call(window);\n // Delay promise resolution in case print() was not synchronous.\n setTimeout(resolve, 20); // Tidy-up.\n }, 0);\n });\n },\n\n get active() {\n return this === activeService;\n },\n\n throwIfInactive() {\n if (!this.active) {\n throw new Error(\"This print request was cancelled or completed.\");\n }\n },\n};\n\nconst print = window.print;\nwindow.print = function () {\n if (activeService) {\n console.warn(\"Ignored window.print() because of a pending print job.\");\n return;\n }\n ensureOverlay().then(function () {\n if (activeService) {\n overlayManager.open(dialog);\n }\n });\n\n try {\n dispatchEvent(\"beforeprint\");\n } finally {\n if (!activeService) {\n console.error(\"Expected print service to be initialized.\");\n ensureOverlay().then(function () {\n if (overlayManager.active === dialog) {\n overlayManager.close(dialog);\n }\n });\n return; // eslint-disable-line no-unsafe-finally\n }\n const activeServiceOnEntry = activeService;\n activeService\n .renderPages()\n .then(function () {\n return activeServiceOnEntry.performPrint();\n })\n .catch(function () {\n // Ignore any error messages.\n })\n .then(function () {\n // aborts acts on the \"active\" print request, so we need to check\n // whether the print request (activeServiceOnEntry) is still active.\n // Without the check, an unrelated print request (created after aborting\n // this print request while the pages were being generated) would be\n // aborted.\n if (activeServiceOnEntry.active) {\n abort();\n }\n });\n }\n};\n\nfunction dispatchEvent(eventType) {\n const event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(eventType, false, false, \"custom\");\n window.dispatchEvent(event);\n}\n\nfunction abort() {\n if (activeService) {\n activeService.destroy();\n dispatchEvent(\"afterprint\");\n }\n}\n\nfunction renderProgress(index, total, l10n) {\n dialog ||= document.getElementById(\"printServiceDialog\");\n const progress = Math.round((100 * index) / total);\n const progressBar = dialog.querySelector(\"progress\");\n const progressPerc = dialog.querySelector(\".relative-progress\");\n progressBar.value = progress;\n l10n.get(\"print_progress_percent\", { progress }).then(msg => {\n progressPerc.textContent = msg;\n });\n}\n\nwindow.addEventListener(\n \"keydown\",\n function (event) {\n // Intercept Cmd/Ctrl + P in all browsers.\n // Also intercept Cmd/Ctrl + Shift + P in Chrome and Opera\n if (\n event.keyCode === /* P= */ 80 &&\n (event.ctrlKey || event.metaKey) &&\n !event.altKey &&\n (!event.shiftKey || window.chrome || window.opera)\n ) {\n window.print();\n\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n },\n true\n);\n\nif (\"onbeforeprint\" in window) {\n // Do not propagate before/afterprint events when they are not triggered\n // from within this polyfill. (FF / Chrome 63+).\n const stopPropagationIfNeeded = function (event) {\n if (event.detail !== \"custom\") {\n event.stopImmediatePropagation();\n }\n };\n window.addEventListener(\"beforeprint\", stopPropagationIfNeeded);\n window.addEventListener(\"afterprint\", stopPropagationIfNeeded);\n}\n\nlet overlayPromise;\nfunction ensureOverlay() {\n if (!overlayPromise) {\n overlayManager = PDFViewerApplication.overlayManager;\n if (!overlayManager) {\n throw new Error(\"The overlay manager has not yet been initialized.\");\n }\n dialog ||= document.getElementById(\"printServiceDialog\");\n\n overlayPromise = overlayManager.register(\n dialog,\n /* canForceClose = */ true\n );\n\n document.getElementById(\"printCancel\").onclick = abort;\n dialog.addEventListener(\"close\", abort);\n }\n return overlayPromise;\n}\n\nPDFPrintServiceFactory.instance = {\n supportsPrinting: true,\n\n createPrintService(\n pdfDocument,\n pagesOverview,\n printContainer,\n printResolution,\n optionalContentConfigPromise,\n printAnnotationStoragePromise,\n l10n\n ) {\n if (activeService) {\n throw new Error(\"The print service is created and active.\");\n }\n activeService = new PDFPrintService(\n pdfDocument,\n pagesOverview,\n printContainer,\n printResolution,\n optionalContentConfigPromise,\n printAnnotationStoragePromise,\n l10n\n );\n return activeService;\n },\n};\n\nexport { PDFPrintService };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getXfaPageViewport, PixelsPerInch } from \"pdfjs-lib\";\nimport { SimpleLinkService } from \"./pdf_link_service.js\";\nimport { XfaLayerBuilder } from \"./xfa_layer_builder.js\";\n\nfunction getXfaHtmlForPrinting(printContainer, pdfDocument) {\n const xfaHtml = pdfDocument.allXfaHtml;\n const linkService = new SimpleLinkService();\n const scale = Math.round(PixelsPerInch.PDF_TO_CSS_UNITS * 100) / 100;\n\n for (const xfaPage of xfaHtml.children) {\n const page = document.createElement(\"div\");\n page.className = \"xfaPrintedPage\";\n printContainer.append(page);\n\n const builder = new XfaLayerBuilder({\n pageDiv: page,\n pdfPage: null,\n annotationStorage: pdfDocument.annotationStorage,\n linkService,\n xfaHtml: xfaPage,\n });\n const viewport = getXfaPageViewport(xfaPage, { scale });\n\n builder.render(viewport, \"print\");\n }\n}\n\nexport { getXfaHtmlForPrinting };\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/* Copyright 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport \"web-com\";\nimport \"web-print_service\";\nimport { RenderingStates, ScrollMode, SpreadMode } from \"./ui_utils.js\";\nimport { AppOptions } from \"./app_options.js\";\nimport { LinkTarget } from \"./pdf_link_service.js\";\nimport { PDFViewerApplication } from \"./app.js\";\n\n/* eslint-disable-next-line no-unused-vars */\nconst pdfjsVersion =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : void 0;\n/* eslint-disable-next-line no-unused-vars */\nconst pdfjsBuild =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_BUILD\") : void 0;\n\nconst AppConstants =\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n ? { LinkTarget, RenderingStates, ScrollMode, SpreadMode }\n : null;\n\nwindow.PDFViewerApplication = PDFViewerApplication;\nwindow.PDFViewerApplicationConstants = AppConstants;\nwindow.PDFViewerApplicationOptions = AppOptions;\n\nfunction getViewerConfiguration() {\n return {\n appContainer: document.body,\n mainContainer: document.getElementById(\"viewerContainer\"),\n viewerContainer: document.getElementById(\"viewer\"),\n toolbar: {\n container: document.getElementById(\"toolbarViewer\"),\n numPages: document.getElementById(\"numPages\"),\n pageNumber: document.getElementById(\"pageNumber\"),\n scaleSelect: document.getElementById(\"scaleSelect\"),\n customScaleOption: document.getElementById(\"customScaleOption\"),\n previous: document.getElementById(\"previous\"),\n next: document.getElementById(\"next\"),\n zoomIn: document.getElementById(\"zoomIn\"),\n zoomOut: document.getElementById(\"zoomOut\"),\n viewFind: document.getElementById(\"viewFind\"),\n openFile:\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n ? document.getElementById(\"openFile\")\n : null,\n print: document.getElementById(\"print\"),\n editorFreeTextButton: document.getElementById(\"editorFreeText\"),\n editorFreeTextParamsToolbar: document.getElementById(\n \"editorFreeTextParamsToolbar\"\n ),\n editorInkButton: document.getElementById(\"editorInk\"),\n editorInkParamsToolbar: document.getElementById(\"editorInkParamsToolbar\"),\n download: document.getElementById(\"download\"),\n },\n secondaryToolbar: {\n toolbar: document.getElementById(\"secondaryToolbar\"),\n toggleButton: document.getElementById(\"secondaryToolbarToggle\"),\n presentationModeButton: document.getElementById(\"presentationMode\"),\n openFileButton:\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n ? document.getElementById(\"secondaryOpenFile\")\n : null,\n printButton: document.getElementById(\"secondaryPrint\"),\n downloadButton: document.getElementById(\"secondaryDownload\"),\n viewBookmarkButton: document.getElementById(\"viewBookmark\"),\n firstPageButton: document.getElementById(\"firstPage\"),\n lastPageButton: document.getElementById(\"lastPage\"),\n pageRotateCwButton: document.getElementById(\"pageRotateCw\"),\n pageRotateCcwButton: document.getElementById(\"pageRotateCcw\"),\n cursorSelectToolButton: document.getElementById(\"cursorSelectTool\"),\n cursorHandToolButton: document.getElementById(\"cursorHandTool\"),\n scrollPageButton: document.getElementById(\"scrollPage\"),\n scrollVerticalButton: document.getElementById(\"scrollVertical\"),\n scrollHorizontalButton: document.getElementById(\"scrollHorizontal\"),\n scrollWrappedButton: document.getElementById(\"scrollWrapped\"),\n spreadNoneButton: document.getElementById(\"spreadNone\"),\n spreadOddButton: document.getElementById(\"spreadOdd\"),\n spreadEvenButton: document.getElementById(\"spreadEven\"),\n documentPropertiesButton: document.getElementById(\"documentProperties\"),\n },\n sidebar: {\n // Divs (and sidebar button)\n outerContainer: document.getElementById(\"outerContainer\"),\n sidebarContainer: document.getElementById(\"sidebarContainer\"),\n toggleButton: document.getElementById(\"sidebarToggle\"),\n // Buttons\n thumbnailButton: document.getElementById(\"viewThumbnail\"),\n outlineButton: document.getElementById(\"viewOutline\"),\n attachmentsButton: document.getElementById(\"viewAttachments\"),\n layersButton: document.getElementById(\"viewLayers\"),\n // Views\n thumbnailView: document.getElementById(\"thumbnailView\"),\n outlineView: document.getElementById(\"outlineView\"),\n attachmentsView: document.getElementById(\"attachmentsView\"),\n layersView: document.getElementById(\"layersView\"),\n // View-specific options\n outlineOptionsContainer: document.getElementById(\n \"outlineOptionsContainer\"\n ),\n currentOutlineItemButton: document.getElementById(\"currentOutlineItem\"),\n },\n sidebarResizer: {\n outerContainer: document.getElementById(\"outerContainer\"),\n resizer: document.getElementById(\"sidebarResizer\"),\n },\n findBar: {\n bar: document.getElementById(\"findbar\"),\n toggleButton: document.getElementById(\"viewFind\"),\n findField: document.getElementById(\"findInput\"),\n highlightAllCheckbox: document.getElementById(\"findHighlightAll\"),\n caseSensitiveCheckbox: document.getElementById(\"findMatchCase\"),\n matchDiacriticsCheckbox: document.getElementById(\"findMatchDiacritics\"),\n entireWordCheckbox: document.getElementById(\"findEntireWord\"),\n findMsg: document.getElementById(\"findMsg\"),\n findResultsCount: document.getElementById(\"findResultsCount\"),\n findPreviousButton: document.getElementById(\"findPrevious\"),\n findNextButton: document.getElementById(\"findNext\"),\n },\n passwordOverlay: {\n dialog: document.getElementById(\"passwordDialog\"),\n label: document.getElementById(\"passwordText\"),\n input: document.getElementById(\"password\"),\n submitButton: document.getElementById(\"passwordSubmit\"),\n cancelButton: document.getElementById(\"passwordCancel\"),\n },\n documentProperties: {\n dialog: document.getElementById(\"documentPropertiesDialog\"),\n closeButton: document.getElementById(\"documentPropertiesClose\"),\n fields: {\n fileName: document.getElementById(\"fileNameField\"),\n fileSize: document.getElementById(\"fileSizeField\"),\n title: document.getElementById(\"titleField\"),\n author: document.getElementById(\"authorField\"),\n subject: document.getElementById(\"subjectField\"),\n keywords: document.getElementById(\"keywordsField\"),\n creationDate: document.getElementById(\"creationDateField\"),\n modificationDate: document.getElementById(\"modificationDateField\"),\n creator: document.getElementById(\"creatorField\"),\n producer: document.getElementById(\"producerField\"),\n version: document.getElementById(\"versionField\"),\n pageCount: document.getElementById(\"pageCountField\"),\n pageSize: document.getElementById(\"pageSizeField\"),\n linearized: document.getElementById(\"linearizedField\"),\n },\n },\n annotationEditorParams: {\n editorFreeTextFontSize: document.getElementById(\"editorFreeTextFontSize\"),\n editorFreeTextColor: document.getElementById(\"editorFreeTextColor\"),\n editorInkColor: document.getElementById(\"editorInkColor\"),\n editorInkThickness: document.getElementById(\"editorInkThickness\"),\n editorInkOpacity: document.getElementById(\"editorInkOpacity\"),\n },\n printContainer: document.getElementById(\"printContainer\"),\n openFileInput:\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n ? document.getElementById(\"fileInput\")\n : null,\n debuggerScriptPath: \"./debugger.js\",\n };\n}\n\nfunction webViewerLoad() {\n const config = getViewerConfiguration();\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"GENERIC\")) {\n // Give custom implementations of the default viewer a simpler way to\n // set various `AppOptions`, by dispatching an event once all viewer\n // files are loaded but *before* the viewer initialization has run.\n const event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(\"webviewerloaded\", true, true, {\n source: window,\n });\n try {\n // Attempt to dispatch the event at the embedding `document`,\n // in order to support cases where the viewer is embedded in\n // a *dynamically* created <iframe> element.\n parent.document.dispatchEvent(event);\n } catch (ex) {\n // The viewer could be in e.g. a cross-origin <iframe> element,\n // fallback to dispatching the event at the current `document`.\n console.error(`webviewerloaded: ${ex}`);\n document.dispatchEvent(event);\n }\n }\n PDFViewerApplication.run(config);\n}\n\n// Block the \"load\" event until all pages are loaded, to ensure that printing\n// works in Firefox; see https://bugzilla.mozilla.org/show_bug.cgi?id=1618553\ndocument.blockUnblockOnload?.(true);\n\nif (\n document.readyState === \"interactive\" ||\n document.readyState === \"complete\"\n) {\n webViewerLoad();\n} else {\n document.addEventListener(\"DOMContentLoaded\", webViewerLoad, true);\n}\n\nexport {\n PDFViewerApplication,\n AppConstants as PDFViewerApplicationConstants,\n AppOptions as PDFViewerApplicationOptions,\n};\n"],"names":["_app","require","_preferences","_download_manager","_genericl10n","_generic_scripting","GenericCom","exports","GenericPreferences","BasePreferences","_writeToStorage","prefObj","localStorage","setItem","JSON","stringify","_readFromStorage","parse","getItem","GenericExternalServices","DefaultExternalServices","createDownloadManager","DownloadManager","createPreferences","createL10n","locale","GenericL10n","createScripting","sandboxBundleSrc","GenericScripting","PDFViewerApplication","externalServices","_ui_utils","_pdfjsLib","_app_options","_event_utils","_pdf_link_service","_webAnnotation_editor_params","_overlay_manager","_password_prompt","_webPdf_attachment_viewer","_webPdf_cursor_tools","_webPdf_document_properties","_webPdf_find_bar","_pdf_find_controller","_pdf_history","_webPdf_layer_viewer","_webPdf_outline_viewer","_webPdf_presentation_mode","_pdf_rendering_queue","_pdf_scripting_manager","_webPdf_sidebar","_webPdf_sidebar_resizer","_webPdf_thumbnail_viewer","_pdf_viewer","_webSecondary_toolbar","_webToolbar","_view_history","FORCE_PAGES_LOADED_TIMEOUT","WHEEL_ZOOM_DISABLED_TIMEOUT","ViewOnLoad","UNKNOWN","PREVIOUS","INITIAL","ViewerCssTheme","AUTOMATIC","LIGHT","DARK","constructor","Error","updateFindControlState","data","updateFindMatchesCount","initPassiveLoading","callbacks","reportTelemetry","options","supportsPinchToZoom","shadow","supportsIntegratedFind","supportsDocumentFonts","supportedMouseWheelZoomModifierKeys","ctrlKey","metaKey","isInAutomation","updateEditorStates","canvasMaxAreaInBytes","initialBookmark","document","location","hash","substring","_initializedCapability","createPromiseCapability","appConfig","pdfDocument","pdfLoadingTask","printService","pdfViewer","pdfThumbnailViewer","pdfRenderingQueue","pdfPresentationMode","pdfDocumentProperties","pdfLinkService","pdfHistory","pdfSidebar","pdfSidebarResizer","pdfOutlineViewer","pdfAttachmentViewer","pdfLayerViewer","pdfCursorTools","pdfScriptingManager","store","downloadManager","overlayManager","preferences","toolbar","secondaryToolbar","eventBus","l10n","annotationEditorParams","isInitialViewSet","downloadComplete","isViewerEmbedded","window","parent","url","baseUrl","_downloadUrl","_boundEvents","Object","create","documentInfo","metadata","_contentDispositionFilename","_contentLength","_saveInProgress","_wheelUnusedTicks","_wheelUnusedFactor","_touchUnusedTicks","_touchUnusedFactor","_PDFBug","_hasAnnotationEditors","_title","title","_printAnnotationStoragePromise","_touchInfo","_isCtrlKeyDown","initialize","_initializeOptions","_forceCssTheme","_initializeL10n","AppOptions","get","LinkTarget","NONE","set","TOP","_initializeViewerComponents","bindEvents","bindWindowEvents","appContainer","documentElement","translate","then","dispatch","source","resolve","_parseHashParams","_hasUserOptions","console","warn","setAll","getAll","reason","error","message","mainContainer","viewerContainer","params","parseQueryString","loadFakeWorker","ex","has","TextLayerMode","DISABLE","classList","add","loadPDFBug","loadCSS","enabled","split","init","OPS","dir","getDirection","getElementsByTagName","cssTheme","values","includes","styleSheet","styleSheets","cssRules","i","ii","length","rule","CSSMediaRule","media","deleteRule","darkRules","exec","cssText","insertRule","AutomationEventBus","EventBus","OverlayManager","PDFRenderingQueue","onIdle","_cleanup","bind","PDFLinkService","externalLinkTarget","externalLinkRel","ignoreDestinationZoom","findController","PDFFindController","linkService","updateMatchesCountOnProgress","PDFScriptingManager","scriptingFactory","docPropertiesLookup","_scriptingDocProperties","container","viewer","annotationEditorMode","pageColors","matchMedia","matches","background","foreground","PDFViewer","renderingQueue","scriptingManager","renderer","textLayerMode","annotationMode","imageResourcesPath","enablePrintAutoRotate","useOnlyCssZoom","isOffscreenCanvasSupported","maxCanvasPixels","enablePermissions","setViewer","sidebar","thumbnailView","PDFThumbnailViewer","setThumbnailViewer","PDFHistory","setHistory","findBar","PDFFindBar","AnnotationEditorType","AnnotationEditorParams","id","getElementById","documentProperties","PDFDocumentProperties","_docFilename","cursorHandToolButton","PDFCursorTools","cursorToolOnLoad","Toolbar","SecondaryToolbar","supportsFullscreen","presentationModeButton","PDFPresentationMode","passwordOverlay","passwordPrompt","PasswordPrompt","outlineView","PDFOutlineViewer","attachmentsView","PDFAttachmentViewer","layersView","PDFLayerViewer","PDFSidebar","elements","onToggled","forceRendering","PDFSidebarResizer","sidebarResizer","run","config","webViewerInitialized","initialized","settled","initializedPromise","promise","zoomIn","steps","scaleFactor","isInPresentationMode","increaseScale","drawingDelay","zoomOut","decreaseScale","zoomReset","currentScaleValue","DEFAULT_SCALE_VALUE","pagesCount","numPages","page","currentPageNumber","val","supportsPrinting","PDFPrintServiceFactory","instance","fullscreenEnabled","loadingBar","barElement","bar","ProgressBar","setTitleUsingUrl","downloadUrl","isDataScheme","_hideViewBookmark","getPdfFilenameFromUrl","decodeURIComponent","getFilenameFromUrl","setTitle","editorIndicator","printing","viewBookmarkButton","contains","close","_unblockDocumentLoadEvent","annotationStorage","size","_annotationStorageModified","save","promises","push","destroy","setDocument","externalLinkEnabled","destroyPromise","reset","cleanup","Promise","all","open","args","deprecatedArgs","byteLength","workerParams","OptionKind","WORKER","assign","GlobalWorkerOptions","originalUrl","apiParams","API","loadingTask","getDocument","onPassword","updateCallback","setUpdateCallback","onProgress","loaded","total","progress","load","undefined","key","InvalidPDFException","MissingPDFException","UnexpectedResponseException","msg","_documentError","_ensureDownloadComplete","download","filename","getData","blob","Blob","type","dispatchWillSave","saveDocument","dispatchDidSave","downloadOrSave","moreInfo","_otherError","moreInfoText","version","build","stack","lineNumber","join","level","percent","Math","round","loadingParams","disableAutoFetch","setDisableAutoFetch","getDownloadInfo","hide","firstPagePromise","pageLayoutPromise","getPageLayout","catch","pageModePromise","getPageMode","openActionPromise","getOpenAction","setPagesCount","onePageRendered","pagesPromise","storedPromise","ViewHistory","fingerprints","getMultiple","zoom","scrollLeft","scrollTop","rotation","sidebarView","SidebarView","scrollMode","ScrollMode","spreadMode","SpreadMode","pdfPage","setWidth","_initializeAnnotationStorageCallbacks","animationStarted","timeStamp","stored","pageLayout","pageMode","openAction","viewOnLoad","_initializePdfHistory","fingerprint","initialDest","dest","parseInt","apiPageModeToSidebarView","modes","apiPageLayoutToViewerModes","setInitialView","focus","race","setTimeout","hasEqualPageSizes","update","_initializeAutoPrint","timestamp","getOutline","outline","render","getAttachments","attachments","optionalContentConfigPromise","optionalContentConfig","_initializePageLabels","_initializeMetadata","_on","once","baseURL","filesize","getRaw","authors","URL","javaScript","enableScripting","getJavaScript","triggerAutoPrint","action","some","js","AutoPrintRegExp","test","triggerPrinting","info","contentDispositionFilename","contentLength","getMetadata","log","PDFFormatVersion","Producer","trim","Creator","pdfTitle","Title","metadataTitle","IsXFAPresent","IsAcroFormPresent","isPureXfa","enableXfa","renderForms","IsSignaturesPresent","labels","getPageLabels","numLabels","standardLabels","emptyLabels","label","toString","setPageLabels","setPageNumber","currentPageLabel","resetHistory","updateUrl","initialRotation","explicitDest","pageNumber","onSetModified","addEventListener","beforeUnload","onResetModified","removeEventListener","onAnnotationEditor","typeStr","storedHash","setRotation","angle","isValidRotation","pagesRotation","setViewerModes","scroll","spread","isValidScrollMode","isValidSpreadMode","setHash","RendererType","SVG","isThumbnailViewEnabled","visibleView","THUMBS","renderHighestPriority","beforePrint","dispatchWillPrint","print","pageViewsReady","alert","pagesOverview","getPagesOverview","printContainer","printResolution","createPrintService","layout","afterPrint","dispatchDidPrint","resetModified","rotatePages","delta","requestPresentationMode","request","webViewerResize","webViewerHashchange","webViewerPageRender","webViewerPageRendered","webViewerUpdateViewarea","webViewerPageChanging","webViewerScaleChanging","webViewerRotationChanging","webViewerSidebarViewChanged","webViewerPageMode","webViewerNamedAction","webViewerPresentationModeChanged","webViewerPresentationMode","webViewerSwitchAnnotationEditorMode","webViewerSwitchAnnotationEditorParams","webViewerPrint","webViewerDownload","webViewerFirstPage","webViewerLastPage","webViewerNextPage","webViewerPreviousPage","webViewerZoomIn","webViewerZoomOut","webViewerZoomReset","webViewerPageNumberChanged","webViewerScaleChanged","webViewerRotateCw","webViewerRotateCcw","webViewerOptionalContentConfig","webViewerSwitchScrollMode","webViewerScrollModeChanged","webViewerSwitchSpreadMode","webViewerSpreadModeChanged","webViewerDocumentProperties","webViewerFindFromUrlHash","webViewerUpdateFindMatchesCount","webViewerUpdateFindControlState","reportPageStatsPDFBug","webViewerFileInputChange","webViewerOpenFile","addWindowResolutionChange","evt","webViewerResolutionChange","mediaQueryList","devicePixelRatio","removeWindowResolutionChange","windowResize","windowHashChange","windowBeforePrint","windowAfterPrint","windowUpdateFromSandbox","event","detail","webViewerVisibilityChange","webViewerWheel","passive","webViewerTouchStart","webViewerTouchMove","webViewerTouchEnd","webViewerClick","webViewerKeyDown","webViewerKeyUp","unbindEvents","_off","unbindWindowEvents","_accumulateTicks","ticks","prop","wholeTicks","trunc","_accumulateFactor","previousScale","factor","newFactor","floor","_centerAtPos","x","y","scaleDiff","currentScale","top","left","containerTopLeft","blockUnblockOnload","scriptingReady","ready","HOSTED_VIEWER_ORIGINS","validateFileURL","file","viewerOrigin","href","origin","fileOrigin","workerSrc","loadScript","PDFWorker","self","debuggerScriptPath","PDFBug","import","globalThis","Stats","pageView","getPageView","stats","queryString","search","fileInput","openFileInput","value","files","target","preventDefault","dataTransfer","dropEffect","effectAllowed","printButton","viewFind","updateLoadingIndicatorState","getThumbnail","setImage","mode","view","OUTLINE","ATTACHMENTS","LAYERS","switchView","select","toggle","presentationModeState","state","setMultiple","scale","getAnchorUrl","pdfOpenParams","popStateInProgress","createObjectURL","name","click","nextPage","previousPage","goToPage","query","phraseSearch","caseSensitive","entireWord","highlightAll","findPrevious","matchDiacritics","matchesCount","updateResultsCount","previous","rawQuery","result","updateUIState","setPageScale","presetValue","pageLabel","scrollThumbnailIntoView","currentPage","renderingState","RenderingStates","RUNNING","refresh","visibilityState","setZoomDisabledTimeout","zoomDisabledTimeout","clearTimeout","deltaMode","exp","deltaY","isBuiltInMac","isPinchToZoom","WheelEvent","DOM_DELTA_PIXEL","deltaX","abs","deltaZ","normalizeWheelEventDirection","DOM_DELTA_LINE","DOM_DELTA_PAGE","sign","PIXELS_PER_LINE_SCALE","clientX","clientY","touches","touch0","touch1","identifier","touch0X","pageX","touch0Y","pageY","touch1X","touch1Y","page0X","page0Y","page1X","page1Y","pTouch0X","pTouch0Y","pTouch1X","pTouch1Y","v1X","v1Y","v2X","v2Y","det","hypot","diff0X","diff1X","diff0Y","diff1Y","dotProduct","distance","pDistance","newScaleFactor","isOpen","containsElement","toggleButton","active","isViewerInPresentationMode","handled","ensureViewerFocused","cmd","altKey","shiftKey","keyCode","newState","curElement","getActiveOrFocusedElement","curElementTagName","tagName","toUpperCase","isContentEditable","turnPage","turnOnlyIfPageFit","isVerticalScrollbarEnabled","isHorizontalScrollbarEnabled","opened","switchTool","CursorTool","SELECT","HAND","returnValue","webViewerAnnotationEditorStatesChanged","DEFAULT_SCALE","DEFAULT_SCALE_DELTA","MIN_SCALE","MAX_SCALE","UNKNOWN_SCALE","MAX_AUTO_SCALE","SCROLLBAR_PADDING","VERTICAL_PADDING","PAUSED","FINISHED","PresentationModeState","NORMAL","CHANGING","FULLSCREEN","CANVAS","ENABLE","VERTICAL","HORIZONTAL","WRAPPED","PAGE","ODD","EVEN","ZOOM","OutputScale","pixelRatio","sx","sy","scaled","scrollIntoView","element","spot","scrollMatches","offsetParent","offsetY","offsetTop","clientTop","offsetX","offsetLeft","clientLeft","clientHeight","scrollHeight","clientWidth","scrollWidth","getComputedStyle","overflow","watchScroll","viewAreaElement","callback","debounceScroll","rAF","requestAnimationFrame","viewAreaElementScrolled","currentX","lastX","right","currentY","lastY","down","_eventHandler","Map","URLSearchParams","toLowerCase","InvisibleCharactersRegExp","removeNullCharacters","str","replaceInvisible","replaceAll","binarySearchFirstItem","items","condition","start","minIndex","maxIndex","currentIndex","currentItem","approximateFraction","xinv","limit","x_","a","b","c","d","p","q","roundToDivide","div","r","getPageSizeInches","userUnit","rotate","x1","y1","x2","y2","changeOrientation","width","height","backtrackBeforeAllVisibleElements","index","views","elt","pageTop","getVisibleElements","scrollEl","sortByVisibility","horizontal","rtl","bottom","isElementBottomAfterViewTop","elementBottom","isElementNextAfterViewHorizontally","elementLeft","elementRight","visible","ids","Set","numViews","firstVisibleElementInd","lastEdge","currentWidth","currentHeight","viewWidth","viewHeight","viewRight","viewBottom","hiddenHeight","max","hiddenWidth","fractionHeight","fractionWidth","widthPercent","first","last","at","sort","pc","noContextMenuHandler","atan2","PI","normalizeWheelEventDelta","MOUSE_PIXELS_PER_LINE","MOUSE_LINES_PER_PAGE","Number","isInteger","isPortraitOrientation","docStyle","style","clamp","v","min","disableAutoFetchTimeout","isNaN","remove","setProperty","parentNode","scrollbarWidth","offsetWidth","delay","show","curRoot","curActiveOrFocused","activeElement","querySelector","shadowRoot","pdfjsLib","__non_webpack_require__","module","compatibilityParams","userAgent","navigator","platform","maxTouchPoints","isAndroid","isIOS","checkCanvasSizeLimitation","VIEWER","PREFERENCE","defaultOptions","kind","defaultZoomDelay","defaultZoomValue","disableHistory","disablePageLabels","historyUpdateUrl","forcePageColors","pageColorsBackground","pageColorsForeground","pdfBugEnabled","sidebarViewOnLoad","scrollModeOnLoad","spreadModeOnLoad","viewerCssTheme","cMapPacked","cMapUrl","disableFontFace","disableRange","disableStream","docBaseUrl","fontExtraProperties","isEvalSupported","maxImageSize","pdfBug","standardFontDataUrl","verbosity","workerPort","defaultUrl","disablePreferences","language","userOptions","userOption","defaultOption","valueType","keys","WaitOnType","EVENT","TIMEOUT","waitOnEventOrTimeout","reject","handler","eventHandler","timeout","timeoutHandler","listeners","on","eventName","listener","external","off","eventListeners","externalListeners","slice","splice","DEFAULT_LINK_REL","SELF","BLANK","PARENT","addLinkAttributes","link","rel","urlNullRemoved","onclick","targetStr","pagesRefCache","_ignoreDestinationZoom","clear","goToDestinationHelper","rawDest","namedDest","destRef","_cachedPageNumber","getPageIndex","pageIndex","cachePageRef","pushCurrentPosition","scrollPageIntoView","destArray","goToDestination","getDestination","Array","isArray","pageLabelToPageNumber","pushPage","newWindow","getDestinationHash","escape","anchor","zoomArgs","zoomArg","zoomArgNumber","parseFloat","allowNegativeOffset","unescape","isValidExplicitDestination","executeNamedAction","back","forward","executeSetOCGState","operator","elem","setVisibility","group","getGroup","pageNum","pageRef","refStr","gen","num","isPageVisible","isPageCached","destLength","allowNull","param","SimpleLinkService","bindListeners","editorFreeTextFontSize","editorFreeTextColor","editorInkColor","editorInkThickness","editorInkOpacity","AnnotationEditorParamsType","FREETEXT_SIZE","valueAsNumber","FREETEXT_COLOR","INK_COLOR","INK_THICKNESS","INK_OPACITY","details","overlays","WeakMap","register","dialog","canForceClose","unregister","delete","showModal","activeCapability","input","submitButton","cancelButton","_isViewerEmbedded","verify","e","cancel","passwordIncorrect","PasswordResponses","INCORRECT_PASSWORD","textContent","password","invokeCallback","_base_tree_viewer","BaseTreeViewer","appendAttachment","keepRenderedCapability","_attachments","_renderedCapability","_pendingDispatchEvent","_dispatchEvent","attachmentsCount","_bindLink","content","openOrDownloadData","names","localeCompare","fragment","createDocumentFragment","item","createElement","className","_normalizeTextContent","append","_finishRendering","renderedPromise","TREEITEM_OFFSET_TOP","TREEITEM_SELECTED_CLASS","_pdfDocument","_lastToggleIsShow","_currentTreeItem","count","_addToggleButton","hidden","toggler","stopPropagation","shouldShowAll","_toggleTreeItem","prepend","root","querySelectorAll","_toggleAllTreeItems","hasAnyNesting","_updateCurrentTreeItem","treeItem","_scrollToCurrentTreeItem","currentNode","firstElementChild","scrollTo","_grab_to_pan","previouslyActive","handTool","GrabToPan","addEventListeners","activeTool","tool","disableActiveTool","deactivate","activate","dispatchEvent","disableActive","enableActive","CSS_CLASS_GRAB","ownerDocument","ignoreTarget","onActiveChanged","_onMouseDown","onMouseDown","_onMouseMove","onMouseMove","_endPan","endPan","overlay","node","button","originalTarget","scrollLeftStart","scrollTopStart","clientXStart","clientYStart","focusedElement","blur","buttons","xDiff","yDiff","behavior","body","DEFAULT_FIELD_CONTENT","NON_METRIC_LOCALES","US_PAGE_NAMES","METRIC_PAGE_NAMES","getPageName","isPortrait","pageNames","fieldData","fields","closeButton","fileNameLookup","_fileNameLookup","_currentPageNumber","_pagesRotation","_isNonMetricLocale","getLanguage","_dataAvailableCapability","updateUI","fileName","fileSize","creationDate","modificationDate","pageSize","isLinearized","parseFileSize","parseDate","CreationDate","ModDate","getPage","parsePageSize","parseLinearization","IsLinearized","freeze","author","Author","subject","Subject","keywords","Keywords","creator","producer","pageCount","linearized","kb","mb","size_mb","toPrecision","toLocaleString","size_kb","size_b","pageSizeInches","sizeInches","sizeMillimeters","rawName","exactMillimeters","intMillimeters","unit","orientation","inputDate","dateObject","PDFDateString","toDateObject","date","toLocaleDateString","time","toLocaleTimeString","MATCHES_COUNT_LIMIT","findField","highlightAllCheckbox","caseSensitiveCheckbox","matchDiacriticsCheckbox","entireWordCheckbox","findMsg","findResultsCount","findPreviousButton","findNextButton","adjustWidth","findPrev","checked","status","FindState","FOUND","PENDING","NOT_FOUND","setAttribute","current","matchCountMsg","findbarHeight","inputContainerHeight","_pdf_find_utils","FIND_TIMEOUT","MATCH_SCROLL_OFFSET_TOP","MATCH_SCROLL_OFFSET_LEFT","CHARACTERS_TO_NORMALIZE","DIACRITICS_EXCEPTION","DIACRITICS_EXCEPTION_STR","DIACRITICS_REG_EXP","SPECIAL_CHARS_REG_EXP","NOT_DIACRITIC_FROM_END_REG_EXP","NOT_DIACRITIC_FROM_START_REG_EXP","SYLLABLES_REG_EXP","SYLLABLES_LENGTHS","FIRST_CHAR_SYLLABLES_REG_EXP","NFKC_CHARS_TO_NORMALIZE","noSyllablesRegExp","withSyllablesRegExp","normalize","text","syllablePositions","m","char","len","normalizationRegex","replace","toNormalizeWithNFKC","CJK","HKDiacritics","regexp","RegExp","rawDiacriticsPositions","normalized","positions","rawDiacriticsIndex","syllableIndex","shift","shiftOrigin","eol","hasDiacritics","match","p1","p2","p3","p4","p5","p6","p7","p8","replacement","jj","j","charAt","hasTrailingDashEOL","endsWith","newCharLen","getOriginalIndex","diffs","pos","end","visitedPagesCount","_linkService","_eventBus","onFind","onFindBarClose","highlightMatches","_highlightMatches","pageMatches","_pageMatches","pageMatchesLength","_pageMatchesLength","selected","_selected","_state","_firstPageCapability","shouldDirtyMatch","_dirtyMatch","extractText","findbarClosed","pendingTimeout","_findTimeout","nextMatch","updateAllPages","scrollMatchIntoView","selectedLeft","matchIndex","_scrollMatches","matchIdx","pageIdx","_offset","wrapped","_extractTextPromises","_pageContents","_pageDiffs","_hasDiacritics","_matchesCountTotal","_pagesToSearch","_pendingFindMatches","_resumePageIdx","_rawQuery","_normalizedQuery","isEntireWord","startIdx","charCodeAt","getCharacterType","calculateRegExpMatch","pageContent","matchesLength","matchPos","matchLen","convertToRegExpString","isUnicode","trailingSpaces","String","fromCharCode","calculateMatch","reverse","map","isUnicodePart","queryPart","flags","updatePage","nextPageMatch","pageMatchesCount","updateUIResultsCount","extractTextCapability","getTextContent","strBuf","textItem","hasEOL","currentPageIndex","offset","numPageMatches","updateMatch","advanceOffsetPage","matchesReady","numMatches","found","requestMatchesCount","CharacterType","SPACE","ALPHA_LETTER","PUNCT","HAN_LETTER","KATAKANA_LETTER","HIRAGANA_LETTER","HALFWIDTH_KATAKANA_LETTER","THAI_LETTER","isAlphabeticalScript","charCode","isAscii","isAsciiAlpha","isAsciiDigit","isAsciiSpace","isHan","isKatakana","isHiragana","isHalfwidthKatakana","isThai","HASH_CHANGE_TIMEOUT","POSITION_UPDATED_THRESHOLD","UPDATE_VIEWAREA_TIMEOUT","getCurrentHash","_initialized","_fingerprint","_isPagesLoaded","reInitialized","_updateUrl","_bindEvents","history","_popStateInProgress","_blockHashChange","_currentHash","_numPositionUpdates","_uid","_maxUid","_destination","_position","_isValidState","_parseCurrentHash","_pushOrReplaceState","destination","_updateInternalState","uid","_initialRotation","_initialBookmark","_pageHide","_unbindEvents","_updateViewareaTimeout","_isValidPage","forceReplace","isDestHashesEqual","isDestArraysEqual","_tryPushCurrentPosition","shouldReplace","newUrl","startsWith","replaceState","pushState","temporary","position","checkReload","perfEntry","performance","getEntriesByType","removeTemporary","checkNameddest","nameddest","_updateViewarea","_popState","newHash","hashChanged","updateViewarea","popState","pageHide","destHash","pushHash","firstDest","secondDest","isEntryEqual","second","updateLayers","_optionalContentConfig","_optionalContentHash","layersCount","groupId","getHash","_setNestedName","fontStyle","groups","getOrder","queue","levelData","itemsDiv","order","getOptionalContentConfig","_currentOutlineItem","_currentOutlineItemCapability","_sidebarView","_outline","_pageNumberToDestHashCapability","outlineCount","currentOutlineItemPromise","attachment","setOCGState","_setStyles","bold","italic","fontWeight","totalCount","nestedCount","nestedItems","pageNumberToDestHash","_getPageNumberToDestHash","linkElement","pageNumberNesting","nesting","currentNesting","DELAY_BEFORE_HIDING_CONTROLS","ACTIVE_SELECTOR","CONTROLS_SELECTOR","MOUSE_SCROLL_COOLDOWN_TIME","PAGE_SWITCH_THRESHOLD","SWIPE_MIN_DISTANCE_THRESHOLD","SWIPE_ANGLE_THRESHOLD","contextMenuOpen","mouseScrollTimeStamp","mouseScrollDelta","touchSwipeState","requestFullscreen","addFullscreenChangeListeners","notifyStateChange","scaleValue","removeFullscreenChangeListeners","mouseWheel","currentTime","Date","now","storedTime","resetMouseScrollState","totalDelta","success","enter","addWindowListeners","showControls","getSelection","removeAllRanges","exit","removeWindowListeners","hideControls","mouseDown","hasAttribute","contextMenu","controlsTimeout","touchSwipe","startX","startY","endX","endY","dx","dy","absAngle","showControlsBind","mouseDownBind","mouseWheelBind","resetMouseScrollStateBind","contextMenuBind","touchSwipeBind","fullscreenChange","fullscreenElement","fullscreenChangeBind","CLEANUP_TIMEOUT","highestPriorityPage","idleTimeout","isHighestPriority","renderingId","hasViewer","currentlyVisiblePages","getHighestPriority","scrolledDown","preRenderExtra","visibleViews","numVisible","isViewFinished","firstId","lastId","visibleIds","holeId","holeView","preRenderIndex","preRenderView","renderView","resume","draw","finally","RenderingCancelledException","_pdfViewer","_closeCapability","_destroyCapability","_scripting","_ready","_sandboxBundleSrc","_scriptingFactory","_docPropertiesLookup","_destroyScripting","objects","calculationOrder","docActions","getFieldObjects","getCalculationOrderIds","getJSActions","_createScripting","_internalEvents","_updateFromSandbox","dispatchEventInSandbox","_dispatchPageClose","_dispatchPageOpen","_pageOpenPending","docProperties","_getDocProperties","createSandbox","appInfo","docInfo","actions","_visitedPages","isChangingPresentationMode","siblings","command","elementId","CustomEvent","setValue","visitedPages","actionsPromise","destroySandbox","UI_NOTIFICATION_CLASS","isInitialEventDispatched","outerContainer","sidebarContainer","thumbnailButton","outlineButton","attachmentsButton","layersButton","_outlineOptionsContainer","outlineOptionsContainer","_currentOutlineItemButton","currentOutlineItemButton","hideUINotification","disabled","forceOpen","isViewChanged","shouldForceRendering","isThumbs","isOutline","isAttachments","isLayers","updateThumbnailViewer","showUINotification","onTreeLoaded","SIDEBAR_WIDTH_VAR","SIDEBAR_MIN_WIDTH","SIDEBAR_RESIZING_CLASS","isRTL","sidebarOpen","_width","_outerContainerWidth","resizer","_addEventListeners","outerContainerWidth","_updateWidth","maxWidth","_mouseMove","_mouseUp","mouseMove","mouseUp","updated","_pdf_thumbnail_view","THUMBNAIL_SCROLL_MARGIN","THUMBNAIL_SELECTED_CLASS","CSS","supports","_scrollUpdated","_resetView","_thumbnails","_getVisibleThumbs","prevThumbnailView","shouldScroll","updateArgs","thumbnail","TempImageFactory","destroyCanvas","_pageLabels","_cancelRendering","firstPdfPage","viewport","getViewport","PDFThumbnailView","defaultViewport","clone","setPdfPage","cancelRendering","setPageLabel","ensurePdfPageLoaded","thumbView","getScrollAhead","visibleThumbs","scrollAhead","DRAW_UPSCALE_FACTOR","MAX_NUM_SCALING_STEPS","THUMBNAIL_CANVAS_BORDER_WIDTH","THUMBNAIL_WIDTH","tempCanvas","getCanvas","ctx","getContext","alpha","fillStyle","fillRect","restore","pdfPageRotate","_optionalContentConfigPromise","renderTask","pageWidth","pageHeight","pageRatio","canvasWidth","canvasHeight","_thumbPageTitle","ring","borderAdjustment","totalRotation","removeAttribute","canvas","image","_getPageDrawContext","upscaleFactor","outputScale","transform","_convertCanvasToImage","reducedCanvas","_reduceImage","_thumbPageCanvas","src","toDataURL","finishRenderTask","drawViewport","renderContinueCallback","cont","renderContext","canvasContext","onContinue","resultPromise","pageCached","thumbnailCanvas","img","drawImage","reducedWidth","reducedHeight","reducedImage","reducedImageCtx","_l10n_utils","_pdf_page_view","DEFAULT_CACHE_SIZE","ENABLE_PERMISSIONS_CLASS","PagesCountLimit","FORCE_SCROLL_MODE_PAGE","FORCE_LAZY_PAGE_INIT","PAUSE_EAGER_PAGE_INIT","isValidAnnotationEditorMode","PDFPageViewBuffer","buf","destroyFirstView","resize","newSize","idsToKeep","Symbol","iterator","firstView","next","buffer","annotationEditorUIManager","AnnotationMode","ENABLE_FORMS","previousContainerHeight","resizeObserver","ResizeObserver","resizeObserverCallback","scrollModePageState","onVisibilityChange","scaleTimeoutId","viewerVersion","observe","_scriptingManager","removePageBorders","NullL10n","defaultRenderingQueue","_scrollUpdate","_onBeforeDraw","_onAfterDraw","updateContainerHeightCss","_pages","_pagesCapability","every","_setCurrentPageNumber","resetCurrentPageView","indexOf","_currentScale","setScale","noScroll","_currentScaleValue","_onePageRenderedCapability","layerProperties","fieldObjectsPromise","hasJSActionsPromise","hasJSActions","initializePermissions","permissions","PermissionFlag","COPY","MODIFY_CONTENTS","MODIFY_ANNOTATIONS","FILL_INTERACTIVE_FORMS","onePageRenderedOrForceFetch","_getVisiblePages","visibilityChangePromise","permissionsPromise","getPermissions","_scrollMode","cssTransform","AnnotationEditorUIManager","updateMode","viewerElement","PixelsPerInch","PDF_TO_CSS_UNITS","PDFPageView","firstPageView","ref","ensurePageViewVisible","_spreadMode","_updateSpreadMode","getPagesLeft","Language","lang","_location","_previousScrollMode","previousPageNumber","scrollDown","pages","_updateScrollMode","pageIndexSet","parity","dummyPage","pageSpot","isSameScale","newScale","setScaleUpdatePages","newValue","preset","postponeDrawing","pageWidthScaleFactor","hPadding","vPadding","pageWidthScale","pageHeightScale","horizontalScale","widthScale","heightScale","boundingRect","convertToViewportPoint","_updateLocation","firstPage","normalizedScaleValue","currentPageView","topLeft","getPagePoint","intLeft","intTop","visiblePages","numVisiblePages","newCacheSize","isSimpleLayout","currentId","stillFullyVisible","_isContainerRtl","direction","cloneNode","_getPageAdvance","yArray","expectedId","advance","ceil","toFixed","entries","entry","borderBoxSize","blockSize","updateParams","noUpdate","DEFAULT_L10N_STRINGS","of_pages","page_of_pages","document_properties_kb","document_properties_mb","document_properties_date_string","document_properties_page_size_unit_inches","document_properties_page_size_unit_millimeters","document_properties_page_size_orientation_portrait","document_properties_page_size_orientation_landscape","document_properties_page_size_name_a3","document_properties_page_size_name_a4","document_properties_page_size_name_letter","document_properties_page_size_name_legal","document_properties_page_size_dimension_string","document_properties_page_size_dimension_name_string","document_properties_linearized_yes","document_properties_linearized_no","additional_layers","page_landmark","thumb_page_title","thumb_page_canvas","find_reached_top","find_reached_bottom","find_not_found","page_scale_width","page_scale_fit","page_scale_auto","page_scale_actual","page_scale_percent","loading_error","invalid_file_error","missing_file_error","unexpected_response_error","rendering_error","printing_not_supported","printing_not_ready","web_fonts_disabled","free_text2_default_content","editor_free_text2_aria_label","editor_ink2_aria_label","editor_ink_canvas_aria_label","print_progress_percent","getL10nFallback","PARTIAL_LANG_CODES","en","es","fy","ga","gu","hi","hy","nb","ne","nn","pa","pt","sv","zh","fixupLangCode","langCode","formatL10nValue","fallback","_annotation_editor_layer_builder","_annotation_layer_builder","_struct_tree_layer_builder","_text_accessibility","_text_highlighter","_text_layer_builder","_xfa_layer_builder","MAX_CANVAS_PIXELS","DEFAULT_LAYER_PROPERTIES","loadingId","previousRotation","useThumbnailCanvas","initialOptionalContent","regularAnnotations","hasRestrictedScaling","paintTask","paintedViewportMap","_renderError","_isStandalone","_annotationCanvasMap","annotationLayer","annotationEditorLayer","textLayer","zoomLayer","xfaLayer","structTreeLayer","setDimensions","hasInitialVisibility","setLayerDimensions","_textHighlighter","TextHighlighter","renderAnnotationLayer","renderAnnotationEditorLayer","renderXfaLayer","textDivs","buildXfaTextContentItems","renderTextLayer","renderingDone","readableStream","streamTextContent","includeMarkedContent","setTextContentSource","AbortException","numTextDivs","renderStructTreeLayer","StructTreeLayerBuilder","tree","getStructTree","treeDom","setTextMapping","enable","_resetZoomLayer","removeFromDOM","zoomLayerCanvas","firstChild","keepZoomLayer","keepAnnotationLayer","keepAnnotationEditorLayer","keepXfaLayer","keepTextLayer","childNodes","zoomLayerNode","annotationLayerNode","annotationEditorLayerNode","xfaLayerNode","textLayerNode","svg","redrawAnnotationLayer","redrawAnnotationEditorLayer","redrawXfaLayer","redrawTextLayer","isScalingRestricted","onlyCssZoom","cancelExtraDelay","hideTextLayer","disable","HTMLCanvasElement","originalViewport","relativeRotation","absRotation","scaleX","scaleY","convertToPdfPoint","canvasWrapper","_accessibilityManager","TextAccessibilityManager","TextLayerBuilder","highlighter","accessibilityManager","AnnotationLayerBuilder","pageDiv","annotationCanvasMap","finishPaintTask","separateAnnots","paintOnSvg","paintOnCanvas","onRenderContinue","AnnotationEditorLayerBuilder","uiManager","XfaLayerBuilder","renderCapability","extraDelay","isCanvasHidden","hasHCM","showCanvas","isLastShow","actualSizeViewport","pixelsInViewport","maxScale","sqrt","sfx","sfy","wrapper","cancelled","ensureNotCancelled","getOperatorList","opList","svgGfx","SVGGraphics","commonObjs","objs","getSVG","_cancelled","intent","clonedViewport","dontFlip","tabIndex","AnnotationEditorLayer","parameters","annotations","isEmpty","numAnnotations","onPresentationModeChanged","_hasJSActionsPromise","_fieldObjectsPromise","AnnotationLayer","fieldObjects","getAnnotations","updatePresentationModeState","disableFormElements","section","inert","PDF_ROLE_TO_HTML_ROLE","Document","DocumentFragment","Part","Sect","Div","Aside","NonStruct","P","H","FENote","Sub","Lbl","Span","Em","Strong","Link","Annot","Form","Ruby","RB","RT","RP","Warichu","WT","WP","L","LI","LBody","Table","TR","TH","TD","THead","TBody","TFoot","Caption","Figure","Formula","Artifact","HEADING_PATTERN","structTree","walk","setAttributes","structElement","htmlElement","alt","role","children","kid","textChildren","textNodes","waitingElements","compareElementPositions","e1","e2","rect1","getBoundingClientRect","rect2","top1","bot1","mid1","top2","bot2","mid2","centerX1","centerX2","nodeIndex","addIdToAriaOwns","isRemovable","addPointerInTextLayer","removePointerInTextLayer","owns","getAttribute","filter","moveElementInDOM","contentElement","hasChildNodes","from","elementToCompare","before","after","_onUpdateTextLayerMatches","textContentItemsStr","divs","texts","_updateMatches","_convertMatches","iIndex","mm","begin","divIdx","_renderMatches","isSelectedPage","selectedMatchIdx","prevEnd","infinity","beginText","appendTextToDiv","fromOffset","toOffset","nodeType","Node","TEXT_NODE","span","createTextNode","i0","i1","isSelected","highlightSuffix","n0","n1","clearedUntilDivIdx","n","textContentSource","textDivProperties","textLayerRenderTask","finishRendering","endOfContent","bindMouse","mustRotate","mustRescale","updateTextLayer","adjustTop","getPropertyValue","divBounds","xfaHtml","XfaLayer","getXfa","downloadButton","firstPageButton","lastPageButton","pageRotateCwButton","pageRotateCcwButton","cursorSelectToolButton","eventDetails","scrollPageButton","scrollVerticalButton","scrollHorizontalButton","scrollWrappedButton","spreadNoneButton","spreadOddButton","spreadEvenButton","documentPropertiesButton","openFileButton","lastPage","pageRotateCw","pageRotateCcw","bindClickListeners","bindCursorToolsListener","bindScrollModeListener","bindSpreadModeListener","isSelect","isHand","scrollModeChanged","isPage","isVertical","isHorizontal","isWrapped","forceScrollModePage","spreadModeChanged","isNone","isOdd","isEven","PAGE_NUMBER_LOADING_INDICATOR","wasLocalized","editorFreeTextButton","FREETEXT","editorInkButton","INK","openFile","scaleSelect","customScaleOption","hasPageLabels","pageScaleValue","pageScale","oncontextmenu","adjustScaleWidth","bindEditorToolsListener","editorFreeTextParamsToolbar","editorInkParamsToolbar","editorModeChanged","disableButtons","editorButtons","resetNumPages","predefinedValueFound","option","loading","predefinedValuesPromise","scaleSelectWidth","font","fontSize","fontFamily","predefinedValue","measureText","DEFAULT_VIEW_HISTORY_CACHE_SIZE","cacheSize","_initializedPromise","databaseStr","database","branch","properties","defaultValue","defaults","prefs","prefValue","defaultType","obj","blobUrl","openBlobUrls","createValidAbsoluteUrl","downloadData","contentType","isPdfData","isPdfFile","viewerUrl","encodeURIComponent","revokeObjectURL","webL10n","_lang","setLanguage","gL10nData","gTextData","gTextProp","gLanguage","gMacros","gReadyState","gAsyncResourceLoading","getL10nResourceLinks","getL10nDictionary","script","innerHTML","getTranslatableChildren","getL10nAttributes","l10nId","l10nArgs","xhrLoadText","onSuccess","onFailure","_onSuccess","_onFailure","xhr","XMLHttpRequest","overrideMimeType","onreadystatechange","readyState","responseText","onerror","ontimeout","send","parseResource","successCallback","failureCallback","evalString","lastIndexOf","parseProperties","parsedPropertiesCallback","dictionary","reBlank","reComment","reSection","reImport","reSplit","parseRawLines","rawText","extendedSyntax","parsedRawLinesCallback","currentLang","genericLang","skipLang","nextEntry","line","loadImport","tmp","response","loadLocale","_callback","langLinks","langCount","dict","locales","default_locale","defaultLocale","anyCaseLang","onResourceLoaded","gResourceCount","L10nResourceLink","resource","getPluralRules","locales2rules","isIn","list","isBetween","pluralRules","0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","plural","_pluralRules","getL10nData","rv","substIndexes","substArguments","reIndex","reMatch","macroName","paramName","macro","reArgs","matched_text","arg","translateElement","getChildElementCount","l","nodeValue","textNode","k","childElementCount","translateFragment","elementCount","fallbackString","getText","rtlList","shortCode","getReadyState","pdfjsSandbox","QuickJSSandbox","sandbox","nukeSandbox","_print_utils","activeService","renderPage","activeServiceOnEntry","printAnnotationStoragePromise","scratchCanvas","PRINT_UNITS","PDF","printAnnotationStorage","ENABLE_STORAGE","PDFPrintService","_printResolution","prototype","throwIfInactive","pageStyleSheet","ensureOverlay","renderPages","getXfaHtmlForPrinting","renderNextPage","renderProgress","useRenderedPage","toBlob","onload","performPrint","call","abort","eventType","createEvent","initCustomEvent","progressBar","progressPerc","chrome","opera","stopImmediatePropagation","stopPropagationIfNeeded","overlayPromise","allXfaHtml","xfaPage","builder","getXfaPageViewport","pdfjsVersion","pdfjsBuild","AppConstants","PDFViewerApplicationConstants","PDFViewerApplicationOptions","getViewerConfiguration","webViewerLoad"],"sourceRoot":""}