mirror of
https://github.com/zadam/trilium.git
synced 2026-03-22 16:23:50 +01:00
1 line
1.6 MiB
1 line
1.6 MiB
{"version":3,"file":"viewer.mjs","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;SAAA;SACA;;;;;UCDA;UACA;UACA;UACA;UACA,yCAAyC,wCAAwC;UACjF;UACA;UACA,E;;;;;UCPA,wF;;;;;;;ACeA,MAAM;EACJA,cAAc;EACdC,qBAAqB;EACrBC,0BAA0B;EAC1BC,oBAAoB;EACpBC,yBAAyB;EACzBC,eAAe;EACfC,cAAc;EACdC,cAAc;EACdC,YAAY;EACZC,KAAK;EACLC,WAAW;EACXC,sBAAsB;EACtBC,YAAY;EACZC,aAAa;EACbC,SAAS;EACTC,WAAW;EACXC,SAAS;EACTC,iBAAiB;EACjBC,WAAW;EACXC,kBAAkB;EAClBC,qBAAqB;EACrBC,MAAM;EACNC,OAAO;EACPC,kBAAkB;EAClBC,mBAAmB;EACnBC,SAAS;EACTC,mBAAmB;EACnBC,YAAY;EACZC,SAAS;EACTC,mBAAmB;EACnBC,OAAO;EACPC,OAAO;EACPC,OAAO;EACPC,SAAS;EACTC,aAAa;EACbC,gBAAgB;EAChBC,GAAG;EACHC,WAAW;EACXC,iBAAiB;EACjBC,qBAAqB;EACrBC,aAAa;EACbC,SAAS;EACTC,cAAc;EACdC,aAAa;EACbC,2BAA2B;EAC3BC,cAAc;EACdC,iBAAiB;EACjBC,kBAAkB;EAClBC,MAAM;EACNC,kBAAkB;EAClBC,SAAS;EACTC,uBAAuB;EACvBC,SAAS;EACTC,YAAY;EACZC,aAAa;EACbC,IAAI;EACJC,cAAc;EACdC,OAAO;EACPC;AACF,CAAC,GAAGC,UAAU,CAACC,QAAQ;;;AC5De;AAEtC,MAAMC,mBAAmB,GAAG,MAAM;AAClC,MAAMC,aAAa,GAAG,GAAG;AACzB,MAAMC,mBAAmB,GAAG,GAAG;AAC/B,MAAMC,SAAS,GAAG,GAAG;AACrB,MAAMC,SAAS,GAAG,IAA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OAAO,EAAE,IAAI;IACbC,UAAU,EAAE,IAAI;IAChBplC,MAAM,EAAE;MACNlpB,MAAM,EAAEjU;IACV;EACF,CAAC,CAAC;EACF,IAAI;IAIFlC,MAAM,CAACuL,QAAQ,CAACmuB,aAAa,CAACD,KAAK,CAAC;EACtC,CAAC,CAAC,OAAOtE,EAAE,EAAE;IAGXj1B,OAAO,CAACC,KAAK,CAAC,kBAAkB,EAAEg1B,EAAE,CAAC;IACrC5pB,QAAQ,CAACmuB,aAAa,CAACD,KAAK,CAAC;EAC/B;EAEF+5E,oBAAoB,CAAC6E,GAAG,CAACC,MAAM,CAAC;AAClC;AAIA/sG,QAAQ,CAAC01G,kBAAkB,GAAG,IAAI,CAAC;AAEnC,IACE11G,QAAQ,CAACw3G,UAAU,KAAK,aAAa,IACrCx3G,QAAQ,CAACw3G,UAAU,KAAK,UAAU,EAClC;EACAD,aAAa,CAAC,CAAC;AACjB,CAAC,MAAM;EACLv3G,QAAQ,CAAC1I,gBAAgB,CAAC,kBAAkB,EAAEigH,aAAa,EAAE,IAAI,CAAC;AACpE","sources":["webpack://pdf.js/webpack/bootstrap","webpack://pdf.js/webpack/runtime/define property getters","webpack://pdf.js/webpack/runtime/hasOwnProperty shorthand","webpack://pdf.js/./web/pdfjs.js","webpack://pdf.js/./web/ui_utils.js","webpack://pdf.js/./web/app_options.js","webpack://pdf.js/./web/pdf_link_service.js","webpack://pdf.js/./web/event_utils.js","webpack://pdf.js/./web/external_services.js","webpack://pdf.js/./web/preferences.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/types.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/resolver.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/scope.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/builtins.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/memoizer.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/bundle.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/resource.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/index.js","webpack://pdf.js/./node_modules/@fluent/dom/esm/overlay.js","webpack://pdf.js/./node_modules/cached-iterable/src/cached_iterable.mjs","webpack://pdf.js/./node_modules/cached-iterable/src/cached_sync_iterable.mjs","webpack://pdf.js/./node_modules/cached-iterable/src/cached_async_iterable.mjs","webpack://pdf.js/./node_modules/cached-iterable/src/index.mjs","webpack://pdf.js/./node_modules/@fluent/dom/esm/localization.js","webpack://pdf.js/./node_modules/@fluent/dom/esm/dom_localization.js","webpack://pdf.js/./node_modules/@fluent/dom/esm/index.js","webpack://pdf.js/./web/l10n.js","webpack://pdf.js/./web/genericl10n.js","webpack://pdf.js/./web/generic_scripting.js","webpack://pdf.js/./web/generic_signature_storage.js","webpack://pdf.js/./web/genericcom.js","webpack://pdf.js/./web/new_alt_text_manager.js","webpack://pdf.js/./web/alt_text_manager.js","webpack://pdf.js/./web/annotation_editor_params.js","webpack://pdf.js/./web/caret_browsing.js","webpack://pdf.js/./web/sidebar.js","webpack://pdf.js/./web/comment_manager.js","webpack://pdf.js/./web/base_download_manager.js","webpack://pdf.js/./web/download_manager.js","webpack://pdf.js/./web/editor_undo_bar.js","webpack://pdf.js/./web/overlay_manager.js","webpack://pdf.js/./web/password_prompt.js","webpack://pdf.js/./web/base_tree_viewer.js","webpack://pdf.js/./web/pdf_attachment_viewer.js","webpack://pdf.js/./web/grab_to_pan.js","webpack://pdf.js/./web/pdf_cursor_tools.js","webpack://pdf.js/./web/pdf_document_properties.js","webpack://pdf.js/./web/pdf_find_utils.js","webpack://pdf.js/./web/pdf_find_controller.js","webpack://pdf.js/./web/pdf_find_bar.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/xfa_layer_builder.js","webpack://pdf.js/./web/print_utils.js","webpack://pdf.js/./web/pdf_print_service.js","webpack://pdf.js/./web/renderable_view.js","webpack://pdf.js/./web/pdf_rendering_queue.js","webpack://pdf.js/./web/pdf_scripting_manager.js","webpack://pdf.js/./web/pdf_text_extractor.js","webpack://pdf.js/./web/menu.js","webpack://pdf.js/./web/pdf_thumbnail_view.js","webpack://pdf.js/./web/pdf_thumbnail_viewer.js","webpack://pdf.js/./web/annotation_editor_layer_builder.js","webpack://pdf.js/./web/annotation_layer_builder.js","webpack://pdf.js/./web/autolinker.js","webpack://pdf.js/./web/base_pdf_page_view.js","webpack://pdf.js/./web/draw_layer_builder.js","webpack://pdf.js/./web/pdf_page_detail_view.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/pdf_page_view.js","webpack://pdf.js/./web/pdf_viewer.js","webpack://pdf.js/./web/secondary_toolbar.js","webpack://pdf.js/./web/signature_manager.js","webpack://pdf.js/./web/toolbar.js","webpack://pdf.js/./web/view_history.js","webpack://pdf.js/./web/views_manager.js","webpack://pdf.js/./web/app.js","webpack://pdf.js/./web/viewer.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","/* 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\nconst {\n AbortException,\n AnnotationEditorLayer,\n AnnotationEditorParamsType,\n AnnotationEditorType,\n AnnotationEditorUIManager,\n AnnotationLayer,\n AnnotationMode,\n AnnotationType,\n applyOpacity,\n build,\n ColorPicker,\n createValidAbsoluteUrl,\n CSSConstants,\n DOMSVGFactory,\n DrawLayer,\n FeatureTest,\n fetchData,\n findContrastColor,\n getDocument,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n getRGB,\n getUuid,\n getXfaPageViewport,\n GlobalWorkerOptions,\n ImageKind,\n InvalidPDFException,\n isDataScheme,\n isPdfFile,\n isValidExplicitDest,\n makeArr,\n makeMap,\n makeObj,\n MathClamp,\n noContextMenu,\n normalizeUnicode,\n OPS,\n OutputScale,\n PasswordResponses,\n PDFDataRangeTransport,\n PDFDateString,\n PDFWorker,\n PermissionFlag,\n PixelsPerInch,\n RenderingCancelledException,\n renderRichText,\n ResponseException,\n setLayerDimensions,\n shadow,\n SignatureExtractor,\n stopEvent,\n SupportedImageMimeTypes,\n TextLayer,\n TouchManager,\n updateUrlHash,\n Util,\n VerbosityLevel,\n version,\n XfaLayer,\n} = globalThis.pdfjsLib;\n\nexport {\n AbortException,\n AnnotationEditorLayer,\n AnnotationEditorParamsType,\n AnnotationEditorType,\n AnnotationEditorUIManager,\n AnnotationLayer,\n AnnotationMode,\n AnnotationType,\n applyOpacity,\n build,\n ColorPicker,\n createValidAbsoluteUrl,\n CSSConstants,\n DOMSVGFactory,\n DrawLayer,\n FeatureTest,\n fetchData,\n findContrastColor,\n getDocument,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n getRGB,\n getUuid,\n getXfaPageViewport,\n GlobalWorkerOptions,\n ImageKind,\n InvalidPDFException,\n isDataScheme,\n isPdfFile,\n isValidExplicitDest,\n makeArr,\n makeMap,\n makeObj,\n MathClamp,\n noContextMenu,\n normalizeUnicode,\n OPS,\n OutputScale,\n PasswordResponses,\n PDFDataRangeTransport,\n PDFDateString,\n PDFWorker,\n PermissionFlag,\n PixelsPerInch,\n RenderingCancelledException,\n renderRichText,\n ResponseException,\n setLayerDimensions,\n shadow,\n SignatureExtractor,\n stopEvent,\n SupportedImageMimeTypes,\n TextLayer,\n TouchManager,\n updateUrlHash,\n Util,\n VerbosityLevel,\n version,\n XfaLayer,\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\nimport { MathClamp } from \"pdfjs-lib\";\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 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 TextLayerMode = {\n DISABLE: 0,\n ENABLE: 1,\n ENABLE_PERMISSIONS: 2,\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 * Scrolls specified element into view of its parent.\n * @param {HTMLElement} 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 {number} [spot.left]\n * @param {number} [spot.top]\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 if (scrollMatches) {\n const elementWidth = element.getBoundingClientRect().width;\n const padding = MathClamp(\n (parent.clientWidth - elementWidth) / 2,\n 20,\n 400\n );\n offsetX += spot.left - padding;\n } else {\n offsetX += spot.left;\n }\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, abortSignal = undefined) {\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, {\n useCapture: true,\n signal: abortSignal,\n });\n abortSignal?.addEventListener(\n \"abort\",\n () => window.cancelAnimationFrame(rAF),\n { once: true }\n );\n return state;\n}\n\n/**\n * Helper function to parse query string (e.g. ?param1=value¶m2=...).\n * @param {string} query\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 InvisibleCharsRegExp = /[\\x00-\\x1F]/g;\n\n/**\n * @param {string} str\n * @param {boolean} [replaceInvisible]\n */\nfunction removeNullCharacters(str, replaceInvisible = false) {\n if (!InvisibleCharsRegExp.test(str)) {\n return str;\n }\n if (replaceInvisible) {\n return str.replaceAll(InvisibleCharsRegExp, m => (m === \"\\x00\" ? \"\" : \" \"));\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 * They are both natural numbers.\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\n/**\n * @param {number} x - A positive number to round to a multiple of `div`.\n * @param {number} div - A natural number.\n */\nfunction floorToDivide(x, div) {\n return x - (x % 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} params\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 minY = Math.max(0, top - currentHeight);\n const minX = Math.max(0, left - currentWidth);\n\n const hiddenHeight = minY + Math.max(0, viewBottom - bottom);\n const hiddenWidth = minX + 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 visibleArea:\n // We only specify which part of the page is visible when it's not\n // the full page, as there is no point in handling a partial page\n // rendering otherwise.\n percent === 100\n ? null\n : {\n minX,\n minY,\n maxX: Math.min(viewRight, right) - currentWidth,\n maxY: Math.min(viewBottom, bottom) - currentHeight,\n },\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\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\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 = val;\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 (this.#percent === 100 || 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} layout - 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\nfunction toggleCheckedBtn(button, toggle, view = null) {\n button.classList.toggle(\"toggled\", toggle);\n button.setAttribute(\"aria-checked\", toggle);\n\n view?.classList.toggle(\"hidden\", !toggle);\n}\n\nfunction toggleSelectedBtn(button, toggle, view = null) {\n button.classList.toggle(\"selected\", toggle);\n button.setAttribute(\"aria-selected\", toggle);\n\n view?.classList.toggle(\"hidden\", !toggle);\n}\n\nfunction toggleExpandedBtn(button, toggle, view = null) {\n button.classList.toggle(\"toggled\", toggle);\n button.setAttribute(\"aria-expanded\", toggle);\n\n view?.classList.toggle(\"hidden\", !toggle);\n}\n\n// In Firefox, the css calc function uses f32 precision but the Chrome or Safari\n// are using f64 one. So in order to have the same rendering in all browsers, we\n// need to use the right precision in order to have correct dimensions.\nconst calcRound =\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n ? Math.fround\n : (function () {\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"LIB\") &&\n typeof document === \"undefined\"\n ) {\n return x => x;\n }\n const e = document.createElement(\"div\");\n e.style.width = \"round(down, calc(1.6666666666666665 * 792px), 1px)\";\n return e.style.width === \"calc(1320px)\" ? Math.fround : x => x;\n })();\n\nexport {\n animationStarted,\n apiPageLayoutToViewerModes,\n apiPageModeToSidebarView,\n approximateFraction,\n AutoPrintRegExp,\n backtrackBeforeAllVisibleElements, // only exported for testing\n binarySearchFirstItem,\n calcRound,\n CursorTool,\n DEFAULT_SCALE,\n DEFAULT_SCALE_DELTA,\n DEFAULT_SCALE_VALUE,\n docStyle,\n floorToDivide,\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 normalizeWheelEventDelta,\n normalizeWheelEventDirection,\n parseQueryString,\n PresentationModeState,\n ProgressBar,\n removeNullCharacters,\n SCROLLBAR_PADDING,\n scrollIntoView,\n ScrollMode,\n SidebarView,\n SpreadMode,\n TextLayerMode,\n toggleCheckedBtn,\n toggleExpandedBtn,\n toggleSelectedBtn,\n UNKNOWN_SCALE,\n VERTICAL_PADDING,\n watchScroll,\n};\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\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n // eslint-disable-next-line no-var\n var compatParams = new Map();\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"LIB\") &&\n !globalThis.navigator?.language\n ) {\n globalThis.navigator = {\n language: \"en-US\",\n maxTouchPoints: 1,\n platform: \"\",\n userAgent: \"\",\n };\n }\n const { maxTouchPoints, platform, userAgent } = navigator;\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 if (isIOS || isAndroid) {\n compatParams.set(\"maxCanvasPixels\", 5242880);\n }\n\n // Don't use system fonts on Android (issue 18210).\n // Support: Android\n if (isAndroid) {\n compatParams.set(\"useSystemFonts\", false);\n }\n}\n\nconst OptionKind = {\n BROWSER: 0x01,\n VIEWER: 0x02,\n API: 0x04,\n WORKER: 0x08,\n EVENT_DISPATCH: 0x10,\n PREFERENCE: 0x80,\n};\n\n// Should only be used with options that allow multiple types.\nconst Type = {\n BOOLEAN: 0x01,\n NUMBER: 0x02,\n OBJECT: 0x04,\n STRING: 0x08,\n UNDEFINED: 0x10,\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 allowedGlobalEvents: {\n /** @type {Object} */\n value: null,\n kind: OptionKind.BROWSER,\n },\n canvasMaxAreaInBytes: {\n /** @type {number} */\n value: -1,\n kind: OptionKind.BROWSER + OptionKind.API,\n },\n isInAutomation: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.BROWSER,\n },\n localeProperties: {\n /** @type {Object} */\n value:\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n ? { lang: navigator.language || \"en-US\" }\n : null,\n kind: OptionKind.BROWSER,\n },\n maxCanvasDim: {\n /** @type {number} */\n value: 32767,\n kind: OptionKind.BROWSER + OptionKind.VIEWER,\n },\n nimbusDataStr: {\n /** @type {string} */\n value: \"\",\n kind: OptionKind.BROWSER,\n },\n supportsCaretBrowsingMode: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.BROWSER,\n },\n supportsDocumentFonts: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.BROWSER,\n },\n supportsIntegratedFind: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.BROWSER,\n },\n supportsMouseWheelZoomCtrlKey: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.BROWSER,\n },\n supportsMouseWheelZoomMetaKey: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.BROWSER,\n },\n supportsPinchToZoom: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.BROWSER,\n },\n supportsPrinting: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.BROWSER,\n },\n toolbarDensity: {\n /** @type {number} */\n value: 0, // 0 = \"normal\", 1 = \"compact\", 2 = \"touch\"\n kind: OptionKind.BROWSER + OptionKind.EVENT_DISPATCH,\n },\n\n altTextLearnMoreUrl: {\n /** @type {string} */\n value:\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n ? \"https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/pdf-alt-text\"\n : \"\",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\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 capCanvasAreaFactor: {\n /** @type {number} */\n value: 200,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n commentLearnMoreUrl: {\n /** @type {string} */\n value:\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"MOZCENTRAL\")\n ? \"https://support.mozilla.org/%LOCALE%/kb/view-pdf-files-firefox-or-choose-another-viewer#w_add-a-comment-to-a-pdf\"\n : \"\",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n cursorToolOnLoad: {\n /** @type {number} */\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n debuggerSrc: {\n /** @type {string} */\n value: \"./debugger.mjs\",\n kind: OptionKind.VIEWER,\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 enableAltText: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableAltTextModelDownload: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE + OptionKind.EVENT_DISPATCH,\n },\n enableAutoLinking: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableComment: {\n /** @type {boolean} */\n value: typeof PDFJSDev === \"undefined\",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableDetailCanvas: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER,\n },\n enableGuessAltText: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE + OptionKind.EVENT_DISPATCH,\n },\n enableHighlightFloatingButton: {\n // We'll probably want to make some experiments before enabling this\n // in Firefox release, but it has to be temporary.\n // TODO: remove it when unnecessary.\n /** @type {boolean} */\n value: typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\"),\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableNewAltTextWhenAddingImage: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableOptimizedPartialRendering: {\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 enableSignatureEditor: {\n /** @type {boolean} */\n value: typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\"),\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableSplitMerge: {\n /** @type {boolean} */\n value: typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\"),\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableUpdatedAddImage: {\n // We'll probably want to make some experiments before enabling this\n // in Firefox release, but it has to be temporary.\n // TODO: remove it when unnecessary.\n /** @type {boolean} */\n value: false,\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 highlightEditorColors: {\n /** @type {string} */\n value:\n \"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F,\" +\n \"yellow_HCM=#FFFFCC,green_HCM=#53FFBC,blue_HCM=#80EBFF,pink_HCM=#F6B8FF,red_HCM=#C50043\",\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: 2 ** 25,\n kind: OptionKind.VIEWER,\n },\n minDurationToUpdateCanvas: {\n /** @type {number} */\n value: 500, // ms\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(\"TESTING\"),\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 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 // eslint-disable-next-line no-nested-ternary\n typeof PDFJSDev === \"undefined\"\n ? \"../external/bcmaps/\"\n : PDFJSDev.test(\"MOZCENTRAL\")\n ? \"resource://pdf.js/web/cmaps/\"\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 typeof PDFJSDev === \"undefined\"\n ? // NOTE: We cannot use the `updateUrlHash` function here, because of\n // the default preferences generation (see `gulpfile.mjs`).\n // However, the following line is *only* used in development mode.\n document.URL.split(\"#\", 1)[0]\n : \"\",\n kind: OptionKind.API,\n },\n enableHWA: {\n /** @type {boolean} */\n value: typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"MOZCENTRAL\"),\n kind: OptionKind.API + OptionKind.VIEWER + OptionKind.PREFERENCE,\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 iccUrl: {\n /** @type {string} */\n value:\n // eslint-disable-next-line no-nested-ternary\n typeof PDFJSDev === \"undefined\"\n ? \"../external/iccs/\"\n : PDFJSDev.test(\"MOZCENTRAL\")\n ? \"resource://pdf.js/web/iccs/\"\n : \"../web/iccs/\",\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 // eslint-disable-next-line no-nested-ternary\n typeof PDFJSDev === \"undefined\"\n ? \"../external/standard_fonts/\"\n : PDFJSDev.test(\"MOZCENTRAL\")\n ? \"resource://pdf.js/web/standard_fonts/\"\n : \"../web/standard_fonts/\",\n kind: OptionKind.API,\n },\n useSystemFonts: {\n // On Android, there is almost no chance to have the font we want so we\n // don't use the system fonts in this case (bug 1882613).\n /** @type {boolean|undefined} */\n value: (\n typeof PDFJSDev === \"undefined\"\n ? window.isGECKOVIEW\n : PDFJSDev.test(\"GECKOVIEW\")\n )\n ? false\n : undefined,\n kind: OptionKind.API,\n type: Type.BOOLEAN + Type.UNDEFINED,\n },\n verbosity: {\n /** @type {number} */\n value: 1,\n kind: OptionKind.API,\n },\n wasmUrl: {\n /** @type {string} */\n value:\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n ? \"resource://pdf.js/web/wasm/\"\n : \"../web/wasm/\",\n kind: OptionKind.API,\n },\n\n workerPort: {\n /** @type {Object} */\n value:\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n ? globalThis.pdfjsPreloadedWorker || null\n : 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\"\n ? \"../src/pdf.worker.js\"\n : PDFJSDev.test(\"MOZCENTRAL\")\n ? \"resource://pdf.js/build/pdf.worker.mjs\"\n : \"../build/pdf.worker.mjs\",\n kind: OptionKind.WORKER,\n },\n};\nif (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n defaultOptions.defaultUrl = {\n /** @type {string} */\n value:\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")\n ? \"\"\n : \"compressed.tracemonkey-pldi-09.pdf\",\n kind: OptionKind.VIEWER,\n };\n defaultOptions.sandboxBundleSrc = {\n /** @type {string} */\n value:\n typeof PDFJSDev === \"undefined\"\n ? \"../build/dev-sandbox/pdf.sandbox.mjs\"\n : \"../build/pdf.sandbox.mjs\",\n kind: OptionKind.VIEWER,\n };\n defaultOptions.enableFakeMLManager = {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER,\n };\n}\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n defaultOptions.disablePreferences = {\n /** @type {boolean} */\n value: typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\"),\n kind: OptionKind.VIEWER,\n };\n} else if (PDFJSDev.test(\"CHROME\")) {\n defaultOptions.disableTelemetry = {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n };\n}\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n // Ensure that the `defaultOptions` are correctly specified.\n for (const name in defaultOptions) {\n const { value, kind, type } = defaultOptions[name];\n\n if (kind & OptionKind.PREFERENCE) {\n if (kind === OptionKind.PREFERENCE) {\n throw new Error(`Cannot use only \"PREFERENCE\" kind: ${name}`);\n }\n if (kind & OptionKind.BROWSER) {\n throw new Error(`Cannot mix \"PREFERENCE\" and \"BROWSER\" kind: ${name}`);\n }\n if (type !== undefined) {\n throw new Error(\n `Cannot have \\`type\\`-field for \"PREFERENCE\" kind: ${name}`\n );\n }\n if (typeof compatParams === \"object\" && compatParams.has(name)) {\n throw new Error(\n `Should not have compatibility-value for \"PREFERENCE\" kind: ${name}`\n );\n }\n // Only \"simple\" preference-values are allowed.\n if (\n typeof value !== \"boolean\" &&\n typeof value !== \"string\" &&\n !Number.isInteger(value)\n ) {\n throw new Error(`Invalid value for \"PREFERENCE\" kind: ${name}`);\n }\n } else if (kind & OptionKind.BROWSER) {\n if (type !== undefined) {\n throw new Error(\n `Cannot have \\`type\\`-field for \"BROWSER\" kind: ${name}`\n );\n }\n if (typeof compatParams === \"object\" && compatParams.has(name)) {\n throw new Error(\n `Should not have compatibility-value for \"BROWSER\" kind: ${name}`\n );\n }\n if (value === undefined) {\n throw new Error(`Invalid value for \"BROWSER\" kind: ${name}`);\n }\n }\n }\n}\n\nclass AppOptions {\n static eventBus;\n\n static #opts = new Map();\n\n static {\n // Initialize all the user-options.\n for (const name in defaultOptions) {\n this.#opts.set(name, defaultOptions[name].value);\n }\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n // Apply any compatibility-values to the user-options.\n for (const [name, value] of compatParams) {\n this.#opts.set(name, value);\n }\n this._hasInvokedSet = false;\n\n this._checkDisablePreferences = () => {\n if (this.get(\"disablePreferences\")) {\n // Give custom implementations of the default viewer a simpler way to\n // opt-out of having the `Preferences` override existing `AppOptions`.\n return true;\n }\n if (this._hasInvokedSet) {\n console.warn(\n \"The Preferences may override manually set AppOptions; \" +\n 'please use the \"disablePreferences\"-option to prevent that.'\n );\n }\n return false;\n };\n }\n }\n\n constructor() {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n throw new Error(\"Cannot initialize AppOptions.\");\n }\n }\n\n static get(name) {\n return this.#opts.get(name);\n }\n\n static getAll(kind = null, defaultOnly = false) {\n const options = Object.create(null);\n for (const name in defaultOptions) {\n const defaultOpt = defaultOptions[name];\n\n if (kind && !(kind & defaultOpt.kind)) {\n continue;\n }\n options[name] = !defaultOnly ? this.#opts.get(name) : defaultOpt.value;\n }\n return options;\n }\n\n static set(name, value) {\n this.setAll({ [name]: value });\n }\n\n static setAll(options, prefs = false) {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this._hasInvokedSet ||= true;\n }\n let events;\n\n for (const name in options) {\n const defaultOpt = defaultOptions[name],\n userOpt = options[name];\n\n if (\n !defaultOpt ||\n !(\n typeof userOpt === typeof defaultOpt.value ||\n Type[(typeof userOpt).toUpperCase()] & defaultOpt.type\n )\n ) {\n continue;\n }\n const { kind } = defaultOpt;\n\n if (\n prefs &&\n !(kind & OptionKind.BROWSER || kind & OptionKind.PREFERENCE)\n ) {\n continue;\n }\n if (this.eventBus && kind & OptionKind.EVENT_DISPATCH) {\n (events ||= new Map()).set(name, userOpt);\n }\n this.#opts.set(name, userOpt);\n }\n\n if (events) {\n for (const [name, value] of events) {\n this.eventBus.dispatch(name.toLowerCase(), { source: this, value });\n }\n }\n }\n}\n\nexport { AppOptions, OptionKind };\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\nimport { isValidExplicitDest } from \"pdfjs-lib\";\nimport { parseQueryString } 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} 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 */\nclass PDFLinkService {\n externalLinkEnabled = true;\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._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 }\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?.pagesMapper.pagesNumber || 0;\n }\n\n /**\n * @type {number}\n */\n get page() {\n return this.pdfDocument ? this.pdfViewer.currentPageNumber : 1;\n }\n\n /**\n * @param {number} value\n */\n set page(value) {\n if (this.pdfDocument) {\n this.pdfViewer.currentPageNumber = value;\n }\n }\n\n /**\n * @type {number}\n */\n get rotation() {\n return this.pdfDocument ? this.pdfViewer.pagesRotation : 0;\n }\n\n /**\n * @param {number} value\n */\n set rotation(value) {\n if (this.pdfDocument) {\n this.pdfViewer.pagesRotation = value;\n }\n }\n\n /**\n * @type {boolean}\n */\n get isInPresentationMode() {\n return this.pdfDocument ? this.pdfViewer.isInPresentationMode : false;\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, pageNumber;\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 `goToDestination: \"${explicitDest}\" is not a valid destination array, for dest=\"${dest}\".`\n );\n return;\n }\n // Dest array looks like that: <page-ref> </XYZ|/FitXXX> <args..>\n const [destRef] = explicitDest;\n\n if (destRef && typeof destRef === \"object\") {\n pageNumber = this.pdfDocument.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 try {\n pageNumber = (await this.pdfDocument.getPageIndex(destRef)) + 1;\n } catch {\n console.error(\n `goToDestination: \"${destRef}\" is not a valid page reference, for dest=\"${dest}\".`\n );\n return;\n }\n }\n } else if (Number.isInteger(destRef)) {\n pageNumber = destRef + 1;\n }\n if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {\n console.error(\n `goToDestination: \"${pageNumber}\" is not a valid page number, for dest=\"${dest}\".`\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 const ac = new AbortController();\n this.eventBus._on(\n \"textlayerrendered\",\n evt => {\n if (evt.pageNumber === pageNumber) {\n evt.source.textLayer.div.focus();\n ac.abort();\n }\n },\n { signal: ac.signal }\n );\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 * Scrolls to a specific location in the PDF document.\n * @param {number} pageNumber - The page number to scroll to.\n * @param {number} x - The x-coordinate to scroll to in page coordinates.\n * @param {number} y - The y-coordinate to scroll to in page coordinates.\n * @param {Object} [options]\n */\n goToXY(pageNumber, x, y, options = {}) {\n this.pdfViewer.scrollPageIntoView({\n pageNumber,\n destArray: [null, { name: \"XYZ\" }, x, y],\n ignoreDestinationZoom: true,\n ...options,\n });\n }\n\n /**\n * Adds various attributes (href, title, target, rel) to hyperlinks.\n * @param {HTMLAnchorElement} link\n * @param {string} url\n * @param {boolean} [newWindow]\n */\n addLinkAttributes(link, url, newWindow = false) {\n if (!url || typeof url !== \"string\") {\n throw new Error('A valid \"url\" parameter must provided.');\n }\n const target = newWindow ? LinkTarget.BLANK : this.externalLinkTarget,\n rel = this.externalLinkRel;\n\n if (this.externalLinkEnabled) {\n link.href = link.title = url;\n } else {\n link.href = \"\";\n link.title = `Disabled: ${url}`;\n link.onclick = () => false;\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 * @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 const query = params.get(\"search\").replaceAll('\"', \"\"),\n phrase = params.get(\"phrase\") === \"true\";\n\n this.eventBus.dispatch(\"findfromurlhash\", {\n source: this,\n query: phrase ? query : query.match(/\\S+/g),\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 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 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\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n return;\n }\n // Support opening of PDF attachments in the Firefox PDF Viewer,\n // which uses a couple of non-standard hash parameters; refer to\n // `DownloadManager._getOpenDataUrl` in the firefoxcom.js file.\n if (!params.has(\"filename\") || !params.has(\"filedest\")) {\n return;\n }\n hash = params.get(\"filedest\");\n }\n\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 {}\n\n if (typeof dest === \"string\" || isValidExplicitDest(dest)) {\n this.goToDestination(dest);\n return;\n }\n console.error(\n `PDFLinkService.setHash: \"${unescape(hash)}\" is not a valid destination.`\n );\n }\n\n /**\n * @param {string} action\n */\n executeNamedAction(action) {\n if (!this.pdfDocument) {\n return;\n }\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 if (!this.pdfDocument) {\n return;\n }\n const pdfDocument = this.pdfDocument,\n optionalContentConfig = await this.pdfViewer.optionalContentConfigPromise;\n\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the optional content resolved.\n }\n optionalContentConfig.setOCGState(action);\n\n this.pdfViewer.optionalContentConfigPromise = Promise.resolve(\n optionalContentConfig\n );\n }\n}\n\nclass SimpleLinkService extends PDFLinkService {\n setDocument(pdfDocument, baseUrl = null) {}\n}\n\nexport { LinkTarget, PDFLinkService, SimpleLinkService };\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 */\nasync function waitOnEventOrTimeout({ target, name, delay = 0 }) {\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 const { promise, resolve } = Promise.withResolvers();\n const ac = new AbortController();\n\n function handler(type) {\n ac.abort(); // Remove event listener.\n clearTimeout(timeout);\n\n resolve(type);\n }\n\n const evtMethod = target instanceof EventBus ? \"_on\" : \"addEventListener\";\n target[evtMethod](name, handler.bind(null, WaitOnType.EVENT), {\n signal: ac.signal,\n });\n\n const timeout = setTimeout(handler.bind(null, WaitOnType.TIMEOUT), delay);\n\n return promise;\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 signal: options?.signal,\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 }\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 let rmAbort = null;\n if (options?.signal instanceof AbortSignal) {\n const { signal } = options;\n if (signal.aborted) {\n console.error(\"Cannot use an `aborted` signal.\");\n return;\n }\n const onAbort = () => this._off(eventName, listener);\n rmAbort = () => signal.removeEventListener(\"abort\", onAbort);\n\n signal.addEventListener(\"abort\", onAbort);\n }\n\n const eventListeners = (this.#listeners[eventName] ||= []);\n eventListeners.push({\n listener,\n external: options?.external === true,\n once: options?.once === true,\n rmAbort,\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 const evt = eventListeners[i];\n if (evt.listener === listener) {\n evt.rmAbort?.(); // Ensure that the `AbortSignal` listener is removed.\n eventListeners.splice(i, 1);\n return;\n }\n }\n }\n}\n\n/**\n * NOTE: Only used in the Firefox built-in pdf viewer.\n */\nclass FirefoxEventBus extends EventBus {\n #externalServices;\n\n #globalEventNames;\n\n #isInAutomation;\n\n constructor(globalEventNames, externalServices, isInAutomation) {\n super();\n this.#globalEventNames = globalEventNames;\n this.#externalServices = externalServices;\n this.#isInAutomation = isInAutomation;\n }\n\n dispatch(eventName, data) {\n if (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: FirefoxEventBus.dispatch\");\n }\n super.dispatch(eventName, data);\n\n if (this.#isInAutomation) {\n const detail = 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 detail[key] = value;\n }\n }\n const event = new CustomEvent(eventName, {\n bubbles: true,\n cancelable: true,\n detail,\n });\n document.dispatchEvent(event);\n }\n\n if (this.#globalEventNames?.has(eventName)) {\n this.#externalServices.dispatchGlobalEvent({\n eventName,\n detail: data,\n });\n }\n }\n}\n\nexport { EventBus, FirefoxEventBus, waitOnEventOrTimeout, WaitOnType };\n","/* Copyright 2024 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 BaseExternalServices {\n constructor() {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n this.constructor === BaseExternalServices\n ) {\n throw new Error(\"Cannot initialize BaseExternalServices.\");\n }\n }\n\n updateFindControlState(data) {}\n\n updateFindMatchesCount(data) {}\n\n initPassiveLoading() {}\n\n reportTelemetry(data) {}\n\n reportText(data) {}\n\n /**\n * @returns {Promise<L10n>}\n */\n async createL10n() {\n throw new Error(\"Not implemented: createL10n\");\n }\n\n createScripting() {\n throw new Error(\"Not implemented: createScripting\");\n }\n\n createSignatureStorage() {\n throw new Error(\"Not implemented: createSignatureStorage\");\n }\n\n updateEditorStates(data) {\n throw new Error(\"Not implemented: updateEditorStates\");\n }\n\n dispatchGlobalEvent(_event) {}\n}\n\nexport { BaseExternalServices };\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 AppOptions.getAll(OptionKind.PREFERENCE, /* defaultOnly = */ true)\n );\n\n #initializedPromise = null;\n\n constructor() {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n this.constructor === BasePreferences\n ) {\n throw new Error(\"Cannot initialize BasePreferences.\");\n }\n\n this.#initializedPromise = this._readFromStorage(this.#defaults).then(\n ({ browserPrefs, prefs }) => {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n AppOptions._checkDisablePreferences()\n ) {\n return;\n }\n AppOptions.setAll({ ...browserPrefs, ...prefs }, /* prefs = */ true);\n }\n );\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n window.addEventListener(\n \"updatedPreference\",\n async ({ detail: { name, value } }) => {\n await this.#initializedPromise;\n AppOptions.setAll({ [name]: value }, /* prefs = */ true);\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 if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Please use `about:config` to change preferences.\");\n }\n await this.#initializedPromise;\n AppOptions.setAll(this.#defaults, /* prefs = */ true);\n\n await this._writeToStorage(this.#defaults);\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 AppOptions.setAll({ [name]: value }, /* prefs = */ true);\n\n await this._writeToStorage(\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n ? { [name]: AppOptions.get(name) }\n : AppOptions.getAll(OptionKind.PREFERENCE)\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 if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: get\");\n }\n await this.#initializedPromise;\n return AppOptions.get(name);\n }\n\n get defaults() {\n return this.#defaults;\n }\n\n get initializedPromise() {\n return this.#initializedPromise;\n }\n}\n\nexport { BasePreferences };\n","/**\n * The `FluentType` class is the base of Fluent's type system.\n *\n * Fluent types wrap JavaScript values and store additional configuration for\n * them, which can then be used in the `toString` method together with a proper\n * `Intl` formatter.\n */\nexport class FluentType {\n /**\n * Create a `FluentType` instance.\n *\n * @param value The JavaScript value to wrap.\n */\n constructor(value) {\n this.value = value;\n }\n /**\n * Unwrap the raw value stored by this `FluentType`.\n */\n valueOf() {\n return this.value;\n }\n}\n/**\n * A {@link FluentType} representing no correct value.\n */\nexport class FluentNone extends FluentType {\n /**\n * Create an instance of `FluentNone` with an optional fallback value.\n * @param value The fallback value of this `FluentNone`.\n */\n constructor(value = \"???\") {\n super(value);\n }\n /**\n * Format this `FluentNone` to the fallback string.\n */\n toString(scope) {\n return `{${this.value}}`;\n }\n}\n/**\n * A {@link FluentType} representing a number.\n *\n * A `FluentNumber` instance stores the number value of the number it\n * represents. It may also store an option bag of options which will be passed\n * to `Intl.NumerFormat` when the `FluentNumber` is formatted to a string.\n */\nexport class FluentNumber extends FluentType {\n /**\n * Create an instance of `FluentNumber` with options to the\n * `Intl.NumberFormat` constructor.\n *\n * @param value The number value of this `FluentNumber`.\n * @param opts Options which will be passed to `Intl.NumberFormat`.\n */\n constructor(value, opts = {}) {\n super(value);\n this.opts = opts;\n }\n /**\n * Format this `FluentNumber` to a string.\n */\n toString(scope) {\n if (scope) {\n try {\n const nf = scope.memoizeIntlObject(Intl.NumberFormat, this.opts);\n return nf.format(this.value);\n }\n catch (err) {\n scope.reportError(err);\n }\n }\n return this.value.toString(10);\n }\n}\n/**\n * A {@link FluentType} representing a date and time.\n *\n * A `FluentDateTime` instance stores a Date object, Temporal object, or a number\n * as a numerical timestamp in milliseconds. It may also store an\n * option bag of options which will be passed to `Intl.DateTimeFormat` when the\n * `FluentDateTime` is formatted to a string.\n */\nexport class FluentDateTime extends FluentType {\n static supportsValue(value) {\n if (typeof value === \"number\")\n return true;\n if (value instanceof Date)\n return true;\n if (value instanceof FluentType)\n return FluentDateTime.supportsValue(value.valueOf());\n // Temporary workaround to support environments without Temporal\n if (\"Temporal\" in globalThis) {\n // for TypeScript, which doesn't know about Temporal yet\n const _Temporal = globalThis.Temporal;\n if (value instanceof _Temporal.Instant ||\n value instanceof _Temporal.PlainDateTime ||\n value instanceof _Temporal.PlainDate ||\n value instanceof _Temporal.PlainMonthDay ||\n value instanceof _Temporal.PlainTime ||\n value instanceof _Temporal.PlainYearMonth) {\n return true;\n }\n }\n return false;\n }\n /**\n * Create an instance of `FluentDateTime` with options to the\n * `Intl.DateTimeFormat` constructor.\n *\n * @param value The number value of this `FluentDateTime`, in milliseconds.\n * @param opts Options which will be passed to `Intl.DateTimeFormat`.\n */\n constructor(value, opts = {}) {\n // unwrap any FluentType value, but only retain the opts from FluentDateTime\n if (value instanceof FluentDateTime) {\n opts = { ...value.opts, ...opts };\n value = value.value;\n }\n else if (value instanceof FluentType) {\n value = value.valueOf();\n }\n // Intl.DateTimeFormat defaults to gregorian calendar, but Temporal defaults to iso8601\n if (typeof value === \"object\" &&\n \"calendarId\" in value &&\n opts.calendar === undefined) {\n opts = { ...opts, calendar: value.calendarId };\n }\n super(value);\n this.opts = opts;\n }\n [Symbol.toPrimitive](hint) {\n return hint === \"string\" ? this.toString() : this.toNumber();\n }\n /**\n * Convert this `FluentDateTime` to a number.\n * Note that this isn't always possible due to the nature of Temporal objects.\n * In such cases, a TypeError will be thrown.\n */\n toNumber() {\n const value = this.value;\n if (typeof value === \"number\")\n return value;\n if (value instanceof Date)\n return value.getTime();\n if (\"epochMilliseconds\" in value) {\n return value.epochMilliseconds;\n }\n if (\"toZonedDateTime\" in value) {\n return value.toZonedDateTime(\"UTC\").epochMilliseconds;\n }\n throw new TypeError(\"Unwrapping a non-number value as a number\");\n }\n /**\n * Format this `FluentDateTime` to a string.\n */\n toString(scope) {\n if (scope) {\n try {\n const dtf = scope.memoizeIntlObject(Intl.DateTimeFormat, this.opts);\n return dtf.format(this.value);\n }\n catch (err) {\n scope.reportError(err);\n }\n }\n if (typeof this.value === \"number\" || this.value instanceof Date) {\n return new Date(this.value).toISOString();\n }\n return this.value.toString();\n }\n}\n","/**\n * The role of the Fluent resolver is to format a `Pattern` to an instance of\n * `FluentValue`. For performance reasons, primitive strings are considered\n * such instances, too.\n *\n * Translations can contain references to other messages or variables,\n * conditional logic in form of select expressions, traits which describe their\n * grammatical features, and can use Fluent builtins which make use of the\n * `Intl` formatters to format numbers and dates into the bundle's languages.\n * See the documentation of the Fluent syntax for more information.\n *\n * In case of errors the resolver will try to salvage as much of the\n * translation as possible. In rare situations where the resolver didn't know\n * how to recover from an error it will return an instance of `FluentNone`.\n *\n * All expressions resolve to an instance of `FluentValue`. The caller should\n * use the `toString` method to convert the instance to a native value.\n *\n * Functions in this file pass around an instance of the `Scope` class, which\n * stores the data required for successful resolution and error recovery.\n */\nimport { FluentType, FluentNone, FluentNumber, FluentDateTime, } from \"./types.js\";\n/**\n * The maximum number of placeables which can be expanded in a single call to\n * `formatPattern`. The limit protects against the Billion Laughs and Quadratic\n * Blowup attacks. See https://msdn.microsoft.com/en-us/magazine/ee335713.aspx.\n */\nconst MAX_PLACEABLES = 100;\n/** Unicode bidi isolation characters. */\nconst FSI = \"\\u2068\";\nconst PDI = \"\\u2069\";\n/** Helper: match a variant key to the given selector. */\nfunction match(scope, selector, key) {\n if (key === selector) {\n // Both are strings.\n return true;\n }\n // XXX Consider comparing options too, e.g. minimumFractionDigits.\n if (key instanceof FluentNumber &&\n selector instanceof FluentNumber &&\n key.value === selector.value) {\n return true;\n }\n if (selector instanceof FluentNumber && typeof key === \"string\") {\n let category = scope\n .memoizeIntlObject(Intl.PluralRules, selector.opts)\n .select(selector.value);\n if (key === category) {\n return true;\n }\n }\n return false;\n}\n/** Helper: resolve the default variant from a list of variants. */\nfunction getDefault(scope, variants, star) {\n if (variants[star]) {\n return resolvePattern(scope, variants[star].value);\n }\n scope.reportError(new RangeError(\"No default\"));\n return new FluentNone();\n}\n/** Helper: resolve arguments to a call expression. */\nfunction getArguments(scope, args) {\n const positional = [];\n const named = Object.create(null);\n for (const arg of args) {\n if (arg.type === \"narg\") {\n named[arg.name] = resolveExpression(scope, arg.value);\n }\n else {\n positional.push(resolveExpression(scope, arg));\n }\n }\n return { positional, named };\n}\n/** Resolve an expression to a Fluent type. */\nfunction resolveExpression(scope, expr) {\n switch (expr.type) {\n case \"str\":\n return expr.value;\n case \"num\":\n return new FluentNumber(expr.value, {\n minimumFractionDigits: expr.precision,\n });\n case \"var\":\n return resolveVariableReference(scope, expr);\n case \"mesg\":\n return resolveMessageReference(scope, expr);\n case \"term\":\n return resolveTermReference(scope, expr);\n case \"func\":\n return resolveFunctionReference(scope, expr);\n case \"select\":\n return resolveSelectExpression(scope, expr);\n default:\n return new FluentNone();\n }\n}\n/** Resolve a reference to a variable. */\nfunction resolveVariableReference(scope, { name }) {\n let arg;\n if (scope.params) {\n // We're inside a TermReference. It's OK to reference undefined parameters.\n if (Object.prototype.hasOwnProperty.call(scope.params, name)) {\n arg = scope.params[name];\n }\n else {\n return new FluentNone(`$${name}`);\n }\n }\n else if (scope.args &&\n Object.prototype.hasOwnProperty.call(scope.args, name)) {\n // We're in the top-level Pattern or inside a MessageReference. Missing\n // variables references produce ReferenceErrors.\n arg = scope.args[name];\n }\n else {\n scope.reportError(new ReferenceError(`Unknown variable: $${name}`));\n return new FluentNone(`$${name}`);\n }\n // Return early if the argument already is an instance of FluentType.\n if (arg instanceof FluentType) {\n return arg;\n }\n // Convert the argument to a Fluent type.\n switch (typeof arg) {\n case \"string\":\n return arg;\n case \"number\":\n return new FluentNumber(arg);\n case \"object\":\n if (FluentDateTime.supportsValue(arg)) {\n return new FluentDateTime(arg);\n }\n // eslint-disable-next-line no-fallthrough\n default:\n scope.reportError(new TypeError(`Variable type not supported: $${name}, ${typeof arg}`));\n return new FluentNone(`$${name}`);\n }\n}\n/** Resolve a reference to another message. */\nfunction resolveMessageReference(scope, { name, attr }) {\n const message = scope.bundle._messages.get(name);\n if (!message) {\n scope.reportError(new ReferenceError(`Unknown message: ${name}`));\n return new FluentNone(name);\n }\n if (attr) {\n const attribute = message.attributes[attr];\n if (attribute) {\n return resolvePattern(scope, attribute);\n }\n scope.reportError(new ReferenceError(`Unknown attribute: ${attr}`));\n return new FluentNone(`${name}.${attr}`);\n }\n if (message.value) {\n return resolvePattern(scope, message.value);\n }\n scope.reportError(new ReferenceError(`No value: ${name}`));\n return new FluentNone(name);\n}\n/** Resolve a call to a Term with key-value arguments. */\nfunction resolveTermReference(scope, { name, attr, args }) {\n const id = `-${name}`;\n const term = scope.bundle._terms.get(id);\n if (!term) {\n scope.reportError(new ReferenceError(`Unknown term: ${id}`));\n return new FluentNone(id);\n }\n if (attr) {\n const attribute = term.attributes[attr];\n if (attribute) {\n // Every TermReference has its own variables.\n scope.params = getArguments(scope, args).named;\n const resolved = resolvePattern(scope, attribute);\n scope.params = null;\n return resolved;\n }\n scope.reportError(new ReferenceError(`Unknown attribute: ${attr}`));\n return new FluentNone(`${id}.${attr}`);\n }\n scope.params = getArguments(scope, args).named;\n const resolved = resolvePattern(scope, term.value);\n scope.params = null;\n return resolved;\n}\n/** Resolve a call to a Function with positional and key-value arguments. */\nfunction resolveFunctionReference(scope, { name, args }) {\n // Some functions are built-in. Others may be provided by the runtime via\n // the `FluentBundle` constructor.\n let func = scope.bundle._functions[name];\n if (!func) {\n scope.reportError(new ReferenceError(`Unknown function: ${name}()`));\n return new FluentNone(`${name}()`);\n }\n if (typeof func !== \"function\") {\n scope.reportError(new TypeError(`Function ${name}() is not callable`));\n return new FluentNone(`${name}()`);\n }\n try {\n let resolved = getArguments(scope, args);\n return func(resolved.positional, resolved.named);\n }\n catch (err) {\n scope.reportError(err);\n return new FluentNone(`${name}()`);\n }\n}\n/** Resolve a select expression to the member object. */\nfunction resolveSelectExpression(scope, { selector, variants, star }) {\n let sel = resolveExpression(scope, selector);\n if (sel instanceof FluentNone) {\n return getDefault(scope, variants, star);\n }\n // Match the selector against keys of each variant, in order.\n for (const variant of variants) {\n const key = resolveExpression(scope, variant.key);\n if (match(scope, sel, key)) {\n return resolvePattern(scope, variant.value);\n }\n }\n return getDefault(scope, variants, star);\n}\n/** Resolve a pattern (a complex string with placeables). */\nexport function resolveComplexPattern(scope, ptn) {\n if (scope.dirty.has(ptn)) {\n scope.reportError(new RangeError(\"Cyclic reference\"));\n return new FluentNone();\n }\n // Tag the pattern as dirty for the purpose of the current resolution.\n scope.dirty.add(ptn);\n const result = [];\n // Wrap interpolations with Directional Isolate Formatting characters\n // only when the pattern has more than one element.\n const useIsolating = scope.bundle._useIsolating && ptn.length > 1;\n for (const elem of ptn) {\n if (typeof elem === \"string\") {\n result.push(scope.bundle._transform(elem));\n continue;\n }\n scope.placeables++;\n if (scope.placeables > MAX_PLACEABLES) {\n scope.dirty.delete(ptn);\n // This is a fatal error which causes the resolver to instantly bail out\n // on this pattern. The length check protects against excessive memory\n // usage, and throwing protects against eating up the CPU when long\n // placeables are deeply nested.\n throw new RangeError(`Too many placeables expanded: ${scope.placeables}, ` +\n `max allowed is ${MAX_PLACEABLES}`);\n }\n if (useIsolating) {\n result.push(FSI);\n }\n result.push(resolveExpression(scope, elem).toString(scope));\n if (useIsolating) {\n result.push(PDI);\n }\n }\n scope.dirty.delete(ptn);\n return result.join(\"\");\n}\n/**\n * Resolve a simple or a complex Pattern to a FluentString\n * (which is really the string primitive).\n */\nfunction resolvePattern(scope, value) {\n // Resolve a simple pattern.\n if (typeof value === \"string\") {\n return scope.bundle._transform(value);\n }\n return resolveComplexPattern(scope, value);\n}\n","export class Scope {\n constructor(bundle, errors, args) {\n /**\n * The Set of patterns already encountered during this resolution.\n * Used to detect and prevent cyclic resolutions.\n * @ignore\n */\n this.dirty = new WeakSet();\n /** A dict of parameters passed to a TermReference. */\n this.params = null;\n /**\n * The running count of placeables resolved so far.\n * Used to detect the Billion Laughs and Quadratic Blowup attacks.\n * @ignore\n */\n this.placeables = 0;\n this.bundle = bundle;\n this.errors = errors;\n this.args = args;\n }\n reportError(error) {\n if (!this.errors || !(error instanceof Error)) {\n throw error;\n }\n this.errors.push(error);\n }\n memoizeIntlObject(ctor, opts) {\n let cache = this.bundle._intls.get(ctor);\n if (!cache) {\n cache = {};\n this.bundle._intls.set(ctor, cache);\n }\n let id = JSON.stringify(opts);\n if (!cache[id]) {\n // @ts-expect-error This is fine.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n cache[id] = new ctor(this.bundle.locales, opts);\n }\n return cache[id];\n }\n}\n","/**\n * @overview\n *\n * The FTL resolver ships with a number of functions built-in.\n *\n * Each function take two arguments:\n * - args - an array of positional args\n * - opts - an object of key-value args\n *\n * Arguments to functions are guaranteed to already be instances of\n * `FluentValue`. Functions must return `FluentValues` as well.\n */\nimport { FluentNone, FluentNumber, FluentDateTime, } from \"./types.js\";\nfunction values(opts, allowed) {\n const unwrapped = Object.create(null);\n for (const [name, opt] of Object.entries(opts)) {\n if (allowed.includes(name)) {\n unwrapped[name] = opt.valueOf();\n }\n }\n return unwrapped;\n}\nconst NUMBER_ALLOWED = [\n \"unitDisplay\",\n \"currencyDisplay\",\n \"useGrouping\",\n \"minimumIntegerDigits\",\n \"minimumFractionDigits\",\n \"maximumFractionDigits\",\n \"minimumSignificantDigits\",\n \"maximumSignificantDigits\",\n];\n/**\n * The implementation of the `NUMBER()` builtin available to translations.\n *\n * Translations may call the `NUMBER()` builtin in order to specify formatting\n * options of a number. For example:\n *\n * pi = The value of π is {NUMBER($pi, maximumFractionDigits: 2)}.\n *\n * The implementation expects an array of {@link FluentValue | FluentValues} representing the\n * positional arguments, and an object of named {@link FluentValue | FluentValues} representing the\n * named parameters.\n *\n * The following options are recognized:\n *\n * unitDisplay\n * currencyDisplay\n * useGrouping\n * minimumIntegerDigits\n * minimumFractionDigits\n * maximumFractionDigits\n * minimumSignificantDigits\n * maximumSignificantDigits\n *\n * Other options are ignored.\n *\n * @param args The positional arguments passed to this `NUMBER()`.\n * @param opts The named argments passed to this `NUMBER()`.\n */\nexport function NUMBER(args, opts) {\n let arg = args[0];\n if (arg instanceof FluentNone) {\n return new FluentNone(`NUMBER(${arg.valueOf()})`);\n }\n if (arg instanceof FluentNumber) {\n return new FluentNumber(arg.valueOf(), {\n ...arg.opts,\n ...values(opts, NUMBER_ALLOWED),\n });\n }\n if (arg instanceof FluentDateTime) {\n return new FluentNumber(arg.toNumber(), {\n ...values(opts, NUMBER_ALLOWED),\n });\n }\n throw new TypeError(\"Invalid argument to NUMBER\");\n}\nconst DATETIME_ALLOWED = [\n \"dateStyle\",\n \"timeStyle\",\n \"fractionalSecondDigits\",\n \"dayPeriod\",\n \"hour12\",\n \"weekday\",\n \"era\",\n \"year\",\n \"month\",\n \"day\",\n \"hour\",\n \"minute\",\n \"second\",\n \"timeZoneName\",\n];\n/**\n * The implementation of the `DATETIME()` builtin available to translations.\n *\n * Translations may call the `DATETIME()` builtin in order to specify\n * formatting options of a number. For example:\n *\n * now = It's {DATETIME($today, month: \"long\")}.\n *\n * The implementation expects an array of {@link FluentValue | FluentValues} representing the\n * positional arguments, and an object of named {@link FluentValue | FluentValues} representing the\n * named parameters.\n *\n * The following options are recognized:\n *\n * dateStyle\n * timeStyle\n * fractionalSecondDigits\n * dayPeriod\n * hour12\n * weekday\n * era\n * year\n * month\n * day\n * hour\n * minute\n * second\n * timeZoneName\n *\n * Other options are ignored.\n *\n * @param args The positional arguments passed to this `DATETIME()`.\n * @param opts The named argments passed to this `DATETIME()`.\n */\nexport function DATETIME(args, opts) {\n let arg = args[0];\n if (arg instanceof FluentNone) {\n return new FluentNone(`DATETIME(${arg.valueOf()})`);\n }\n if (arg instanceof FluentDateTime || arg instanceof FluentNumber) {\n return new FluentDateTime(arg, values(opts, DATETIME_ALLOWED));\n }\n throw new TypeError(\"Invalid argument to DATETIME\");\n}\n","const cache = new Map();\nexport function getMemoizerForLocale(locales) {\n const stringLocale = Array.isArray(locales) ? locales.join(\" \") : locales;\n let memoizer = cache.get(stringLocale);\n if (memoizer === undefined) {\n memoizer = new Map();\n cache.set(stringLocale, memoizer);\n }\n return memoizer;\n}\n","import { resolveComplexPattern } from \"./resolver.js\";\nimport { Scope } from \"./scope.js\";\nimport { FluentNone } from \"./types.js\";\nimport { NUMBER, DATETIME } from \"./builtins.js\";\nimport { getMemoizerForLocale } from \"./memoizer.js\";\n/**\n * Message bundles are single-language stores of translation resources. They are\n * responsible for formatting message values and attributes to strings.\n */\nexport class FluentBundle {\n /**\n * Create an instance of `FluentBundle`.\n *\n * @example\n * ```js\n * let bundle = new FluentBundle([\"en-US\", \"en\"]);\n *\n * let bundle = new FluentBundle(locales, {useIsolating: false});\n *\n * let bundle = new FluentBundle(locales, {\n * useIsolating: true,\n * functions: {\n * NODE_ENV: () => process.env.NODE_ENV\n * }\n * });\n * ```\n *\n * @param locales - Used to instantiate `Intl` formatters used by translations.\n * @param options - Optional configuration for the bundle.\n */\n constructor(locales, { functions, useIsolating = true, transform = (v) => v, } = {}) {\n /** @ignore */\n this._terms = new Map();\n /** @ignore */\n this._messages = new Map();\n this.locales = Array.isArray(locales) ? locales : [locales];\n this._functions = {\n NUMBER,\n DATETIME,\n ...functions,\n };\n this._useIsolating = useIsolating;\n this._transform = transform;\n this._intls = getMemoizerForLocale(locales);\n }\n /**\n * Check if a message is present in the bundle.\n *\n * @param id - The identifier of the message to check.\n */\n hasMessage(id) {\n return this._messages.has(id);\n }\n /**\n * Return a raw unformatted message object from the bundle.\n *\n * Raw messages are `{value, attributes}` shapes containing translation units\n * called `Patterns`. `Patterns` are implementation-specific; they should be\n * treated as black boxes and formatted with `FluentBundle.formatPattern`.\n *\n * @param id - The identifier of the message to check.\n */\n getMessage(id) {\n return this._messages.get(id);\n }\n /**\n * Add a translation resource to the bundle.\n *\n * @example\n * ```js\n * let res = new FluentResource(\"foo = Foo\");\n * bundle.addResource(res);\n * bundle.getMessage(\"foo\");\n * // → {value: .., attributes: {..}}\n * ```\n *\n * @param res\n * @param options\n */\n addResource(res, { allowOverrides = false, } = {}) {\n const errors = [];\n for (let i = 0; i < res.body.length; i++) {\n let entry = res.body[i];\n if (entry.id.startsWith(\"-\")) {\n // Identifiers starting with a dash (-) define terms. Terms are private\n // and cannot be retrieved from FluentBundle.\n if (allowOverrides === false && this._terms.has(entry.id)) {\n errors.push(new Error(`Attempt to override an existing term: \"${entry.id}\"`));\n continue;\n }\n this._terms.set(entry.id, entry);\n }\n else {\n if (allowOverrides === false && this._messages.has(entry.id)) {\n errors.push(new Error(`Attempt to override an existing message: \"${entry.id}\"`));\n continue;\n }\n this._messages.set(entry.id, entry);\n }\n }\n return errors;\n }\n /**\n * Format a `Pattern` to a string.\n *\n * Format a raw `Pattern` into a string. `args` will be used to resolve\n * references to variables passed as arguments to the translation.\n *\n * In case of errors `formatPattern` will try to salvage as much of the\n * translation as possible and will still return a string. For performance\n * reasons, the encountered errors are not returned but instead are appended\n * to the `errors` array passed as the third argument.\n *\n * If `errors` is omitted, the first encountered error will be thrown.\n *\n * @example\n * ```js\n * let errors = [];\n * bundle.addResource(\n * new FluentResource(\"hello = Hello, {$name}!\"));\n *\n * let hello = bundle.getMessage(\"hello\");\n * if (hello.value) {\n * bundle.formatPattern(hello.value, {name: \"Jane\"}, errors);\n * // Returns \"Hello, Jane!\" and `errors` is empty.\n *\n * bundle.formatPattern(hello.value, undefined, errors);\n * // Returns \"Hello, {$name}!\" and `errors` is now:\n * // [<ReferenceError: Unknown variable: name>]\n * }\n * ```\n */\n formatPattern(pattern, args = null, errors = null) {\n // Resolve a simple pattern without creating a scope. No error handling is\n // required; by definition simple patterns don't have placeables.\n if (typeof pattern === \"string\") {\n return this._transform(pattern);\n }\n // Resolve a complex pattern.\n let scope = new Scope(this, errors, args);\n try {\n let value = resolveComplexPattern(scope, pattern);\n return value.toString(scope);\n }\n catch (err) {\n if (scope.errors && err instanceof Error) {\n scope.errors.push(err);\n return new FluentNone().toString(scope);\n }\n throw err;\n }\n }\n}\n","// This regex is used to iterate through the beginnings of messages and terms.\n// With the /m flag, the ^ matches at the beginning of every line.\nconst RE_MESSAGE_START = /^(-?[a-zA-Z][\\w-]*) *= */gm;\n// Both Attributes and Variants are parsed in while loops. These regexes are\n// used to break out of them.\nconst RE_ATTRIBUTE_START = /\\.([a-zA-Z][\\w-]*) *= */y;\nconst RE_VARIANT_START = /\\*?\\[/y;\nconst RE_NUMBER_LITERAL = /(-?[0-9]+(?:\\.([0-9]+))?)/y;\nconst RE_IDENTIFIER = /([a-zA-Z][\\w-]*)/y;\nconst RE_REFERENCE = /([$-])?([a-zA-Z][\\w-]*)(?:\\.([a-zA-Z][\\w-]*))?/y;\nconst RE_FUNCTION_NAME = /^[A-Z][A-Z0-9_-]*$/;\n// A \"run\" is a sequence of text or string literal characters which don't\n// require any special handling. For TextElements such special characters are: {\n// (starts a placeable), and line breaks which require additional logic to check\n// if the next line is indented. For StringLiterals they are: \\ (starts an\n// escape sequence), \" (ends the literal), and line breaks which are not allowed\n// in StringLiterals. Note that string runs may be empty; text runs may not.\nconst RE_TEXT_RUN = /([^{}\\n\\r]+)/y;\nconst RE_STRING_RUN = /([^\\\\\"\\n\\r]*)/y;\n// Escape sequences.\nconst RE_STRING_ESCAPE = /\\\\([\\\\\"])/y;\nconst RE_UNICODE_ESCAPE = /\\\\u([a-fA-F0-9]{4})|\\\\U([a-fA-F0-9]{6})/y;\n// Used for trimming TextElements and indents.\nconst RE_LEADING_NEWLINES = /^\\n+/;\nconst RE_TRAILING_SPACES = / +$/;\n// Used in makeIndent to strip spaces from blank lines and normalize CRLF to LF.\nconst RE_BLANK_LINES = / *\\r?\\n/g;\n// Used in makeIndent to measure the indentation.\nconst RE_INDENT = /( *)$/;\n// Common tokens.\nconst TOKEN_BRACE_OPEN = /{\\s*/y;\nconst TOKEN_BRACE_CLOSE = /\\s*}/y;\nconst TOKEN_BRACKET_OPEN = /\\[\\s*/y;\nconst TOKEN_BRACKET_CLOSE = /\\s*] */y;\nconst TOKEN_PAREN_OPEN = /\\s*\\(\\s*/y;\nconst TOKEN_ARROW = /\\s*->\\s*/y;\nconst TOKEN_COLON = /\\s*:\\s*/y;\n// Note the optional comma. As a deviation from the Fluent EBNF, the parser\n// doesn't enforce commas between call arguments.\nconst TOKEN_COMMA = /\\s*,?\\s*/y;\nconst TOKEN_BLANK = /\\s+/y;\n/**\n * Fluent Resource is a structure storing parsed localization entries.\n */\nexport class FluentResource {\n constructor(source) {\n this.body = [];\n RE_MESSAGE_START.lastIndex = 0;\n let cursor = 0;\n // Iterate over the beginnings of messages and terms to efficiently skip\n // comments and recover from errors.\n while (true) {\n let next = RE_MESSAGE_START.exec(source);\n if (next === null) {\n break;\n }\n cursor = RE_MESSAGE_START.lastIndex;\n try {\n this.body.push(parseMessage(next[1]));\n }\n catch (err) {\n if (err instanceof SyntaxError) {\n // Don't report any Fluent syntax errors. Skip directly to the\n // beginning of the next message or term.\n continue;\n }\n throw err;\n }\n }\n // The parser implementation is inlined below for performance reasons,\n // as well as for convenience of accessing `source` and `cursor`.\n // The parser focuses on minimizing the number of false negatives at the\n // expense of increasing the risk of false positives. In other words, it\n // aims at parsing valid Fluent messages with a success rate of 100%, but it\n // may also parse a few invalid messages which the reference parser would\n // reject. The parser doesn't perform any validation and may produce entries\n // which wouldn't make sense in the real world. For best results users are\n // advised to validate translations with the fluent-syntax parser\n // pre-runtime.\n // The parser makes an extensive use of sticky regexes which can be anchored\n // to any offset of the source string without slicing it. Errors are thrown\n // to bail out of parsing of ill-formed messages.\n function test(re) {\n re.lastIndex = cursor;\n return re.test(source);\n }\n // Advance the cursor by the char if it matches. May be used as a predicate\n // (was the match found?) or, if errorClass is passed, as an assertion.\n function consumeChar(char, errorClass) {\n if (source[cursor] === char) {\n cursor++;\n return true;\n }\n if (errorClass) {\n throw new errorClass(`Expected ${char}`);\n }\n return false;\n }\n // Advance the cursor by the token if it matches. May be used as a predicate\n // (was the match found?) or, if errorClass is passed, as an assertion.\n function consumeToken(re, errorClass) {\n if (test(re)) {\n cursor = re.lastIndex;\n return true;\n }\n if (errorClass) {\n throw new errorClass(`Expected ${re.toString()}`);\n }\n return false;\n }\n // Execute a regex, advance the cursor, and return all capture groups.\n function match(re) {\n re.lastIndex = cursor;\n let result = re.exec(source);\n if (result === null) {\n throw new SyntaxError(`Expected ${re.toString()}`);\n }\n cursor = re.lastIndex;\n return result;\n }\n // Execute a regex, advance the cursor, and return the capture group.\n function match1(re) {\n return match(re)[1];\n }\n function parseMessage(id) {\n let value = parsePattern();\n let attributes = parseAttributes();\n if (value === null && Object.keys(attributes).length === 0) {\n throw new SyntaxError(\"Expected message value or attributes\");\n }\n return { id, value, attributes };\n }\n function parseAttributes() {\n let attrs = Object.create(null);\n while (test(RE_ATTRIBUTE_START)) {\n let name = match1(RE_ATTRIBUTE_START);\n let value = parsePattern();\n if (value === null) {\n throw new SyntaxError(\"Expected attribute value\");\n }\n attrs[name] = value;\n }\n return attrs;\n }\n function parsePattern() {\n let first;\n // First try to parse any simple text on the same line as the id.\n if (test(RE_TEXT_RUN)) {\n first = match1(RE_TEXT_RUN);\n }\n // If there's a placeable on the first line, parse a complex pattern.\n if (source[cursor] === \"{\" || source[cursor] === \"}\") {\n // Re-use the text parsed above, if possible.\n return parsePatternElements(first ? [first] : [], Infinity);\n }\n // RE_TEXT_VALUE stops at newlines. Only continue parsing the pattern if\n // what comes after the newline is indented.\n let indent = parseIndent();\n if (indent) {\n if (first) {\n // If there's text on the first line, the blank block is part of the\n // translation content in its entirety.\n return parsePatternElements([first, indent], indent.length);\n }\n // Otherwise, we're dealing with a block pattern, i.e. a pattern which\n // starts on a new line. Discrad the leading newlines but keep the\n // inline indent; it will be used by the dedentation logic.\n indent.value = trim(indent.value, RE_LEADING_NEWLINES);\n return parsePatternElements([indent], indent.length);\n }\n if (first) {\n // It was just a simple inline text after all.\n return trim(first, RE_TRAILING_SPACES);\n }\n return null;\n }\n // Parse a complex pattern as an array of elements.\n function parsePatternElements(elements = [], commonIndent) {\n while (true) {\n if (test(RE_TEXT_RUN)) {\n elements.push(match1(RE_TEXT_RUN));\n continue;\n }\n if (source[cursor] === \"{\") {\n elements.push(parsePlaceable());\n continue;\n }\n if (source[cursor] === \"}\") {\n throw new SyntaxError(\"Unbalanced closing brace\");\n }\n let indent = parseIndent();\n if (indent) {\n elements.push(indent);\n commonIndent = Math.min(commonIndent, indent.length);\n continue;\n }\n break;\n }\n let lastIndex = elements.length - 1;\n let lastElement = elements[lastIndex];\n // Trim the trailing spaces in the last element if it's a TextElement.\n if (typeof lastElement === \"string\") {\n elements[lastIndex] = trim(lastElement, RE_TRAILING_SPACES);\n }\n let baked = [];\n for (let element of elements) {\n if (element instanceof Indent) {\n // Dedent indented lines by the maximum common indent.\n element = element.value.slice(0, element.value.length - commonIndent);\n }\n if (element) {\n baked.push(element);\n }\n }\n return baked;\n }\n function parsePlaceable() {\n consumeToken(TOKEN_BRACE_OPEN, SyntaxError);\n let selector = parseInlineExpression();\n if (consumeToken(TOKEN_BRACE_CLOSE)) {\n return selector;\n }\n if (consumeToken(TOKEN_ARROW)) {\n let variants = parseVariants();\n consumeToken(TOKEN_BRACE_CLOSE, SyntaxError);\n return {\n type: \"select\",\n selector,\n ...variants,\n };\n }\n throw new SyntaxError(\"Unclosed placeable\");\n }\n function parseInlineExpression() {\n if (source[cursor] === \"{\") {\n // It's a nested placeable.\n return parsePlaceable();\n }\n if (test(RE_REFERENCE)) {\n let [, sigil, name, attr = null] = match(RE_REFERENCE);\n if (sigil === \"$\") {\n return { type: \"var\", name };\n }\n if (consumeToken(TOKEN_PAREN_OPEN)) {\n let args = parseArguments();\n if (sigil === \"-\") {\n // A parameterized term: -term(...).\n return { type: \"term\", name, attr, args };\n }\n if (RE_FUNCTION_NAME.test(name)) {\n return { type: \"func\", name, args };\n }\n throw new SyntaxError(\"Function names must be all upper-case\");\n }\n if (sigil === \"-\") {\n // A non-parameterized term: -term.\n return {\n type: \"term\",\n name,\n attr,\n args: [],\n };\n }\n return { type: \"mesg\", name, attr };\n }\n return parseLiteral();\n }\n function parseArguments() {\n let args = [];\n while (true) {\n switch (source[cursor]) {\n case \")\": // End of the argument list.\n cursor++;\n return args;\n case undefined: // EOF\n throw new SyntaxError(\"Unclosed argument list\");\n }\n args.push(parseArgument());\n // Commas between arguments are treated as whitespace.\n consumeToken(TOKEN_COMMA);\n }\n }\n function parseArgument() {\n let expr = parseInlineExpression();\n if (expr.type !== \"mesg\") {\n return expr;\n }\n if (consumeToken(TOKEN_COLON)) {\n // The reference is the beginning of a named argument.\n return {\n type: \"narg\",\n name: expr.name,\n value: parseLiteral(),\n };\n }\n // It's a regular message reference.\n return expr;\n }\n function parseVariants() {\n let variants = [];\n let count = 0;\n let star;\n while (test(RE_VARIANT_START)) {\n if (consumeChar(\"*\")) {\n star = count;\n }\n let key = parseVariantKey();\n let value = parsePattern();\n if (value === null) {\n throw new SyntaxError(\"Expected variant value\");\n }\n variants[count++] = { key, value };\n }\n if (count === 0) {\n return null;\n }\n if (star === undefined) {\n throw new SyntaxError(\"Expected default variant\");\n }\n return { variants, star };\n }\n function parseVariantKey() {\n consumeToken(TOKEN_BRACKET_OPEN, SyntaxError);\n let key;\n if (test(RE_NUMBER_LITERAL)) {\n key = parseNumberLiteral();\n }\n else {\n key = {\n type: \"str\",\n value: match1(RE_IDENTIFIER),\n };\n }\n consumeToken(TOKEN_BRACKET_CLOSE, SyntaxError);\n return key;\n }\n function parseLiteral() {\n if (test(RE_NUMBER_LITERAL)) {\n return parseNumberLiteral();\n }\n if (source[cursor] === '\"') {\n return parseStringLiteral();\n }\n throw new SyntaxError(\"Invalid expression\");\n }\n function parseNumberLiteral() {\n let [, value, fraction = \"\"] = match(RE_NUMBER_LITERAL);\n let precision = fraction.length;\n return {\n type: \"num\",\n value: parseFloat(value),\n precision,\n };\n }\n function parseStringLiteral() {\n consumeChar('\"', SyntaxError);\n let value = \"\";\n while (true) {\n value += match1(RE_STRING_RUN);\n if (source[cursor] === \"\\\\\") {\n value += parseEscapeSequence();\n continue;\n }\n if (consumeChar('\"')) {\n return { type: \"str\", value };\n }\n // We've reached an EOL of EOF.\n throw new SyntaxError(\"Unclosed string literal\");\n }\n }\n // Unescape known escape sequences.\n function parseEscapeSequence() {\n if (test(RE_STRING_ESCAPE)) {\n return match1(RE_STRING_ESCAPE);\n }\n if (test(RE_UNICODE_ESCAPE)) {\n let [, codepoint4, codepoint6] = match(RE_UNICODE_ESCAPE);\n let codepoint = parseInt(codepoint4 || codepoint6, 16);\n return codepoint <= 0xd7ff || 0xe000 <= codepoint\n ? // It's a Unicode scalar value.\n String.fromCodePoint(codepoint)\n : // Lonely surrogates can cause trouble when the parsing result is\n // saved using UTF-8. Use U+FFFD REPLACEMENT CHARACTER instead.\n \"<22>\";\n }\n throw new SyntaxError(\"Unknown escape sequence\");\n }\n // Parse blank space. Return it if it looks like indent before a pattern\n // line. Skip it othwerwise.\n function parseIndent() {\n let start = cursor;\n consumeToken(TOKEN_BLANK);\n // Check the first non-blank character after the indent.\n switch (source[cursor]) {\n case \".\":\n case \"[\":\n case \"*\":\n case \"}\":\n case undefined: // EOF\n // A special character. End the Pattern.\n return false;\n case \"{\":\n // Placeables don't require indentation (in EBNF: block-placeable).\n // Continue the Pattern.\n return makeIndent(source.slice(start, cursor));\n }\n // If the first character on the line is not one of the special characters\n // listed above, it's a regular text character. Check if there's at least\n // one space of indent before it.\n if (source[cursor - 1] === \" \") {\n // It's an indented text character (in EBNF: indented-char). Continue\n // the Pattern.\n return makeIndent(source.slice(start, cursor));\n }\n // A not-indented text character is likely the identifier of the next\n // message. End the Pattern.\n return false;\n }\n // Trim blanks in text according to the given regex.\n function trim(text, re) {\n return text.replace(re, \"\");\n }\n // Normalize a blank block and extract the indent details.\n function makeIndent(blank) {\n let value = blank.replace(RE_BLANK_LINES, \"\\n\");\n let length = RE_INDENT.exec(blank)[1].length;\n return new Indent(value, length);\n }\n }\n}\nclass Indent {\n constructor(value, length) {\n this.value = value;\n this.length = length;\n }\n}\n","/**\n * A JavaScript implementation of Project Fluent, a localization\n * framework designed to unleash the expressive power of the natural language.\n *\n * @module\n */\nexport { FluentBundle } from \"./bundle.js\";\nexport { FluentResource } from \"./resource.js\";\nexport { FluentType, FluentNone, FluentNumber, FluentDateTime, } from \"./types.js\";\n","/* eslint no-console: [\"error\", {allow: [\"warn\"]}] */\n/* global console */\n// Match the opening angle bracket (<) in HTML tags, and HTML entities like\n// &, &, &.\nconst reOverlay = /<|&#?\\w+;/;\n/**\n * Elements allowed in translations even if they are not present in the source\n * HTML. They are text-level elements as defined by the HTML5 spec:\n * https://www.w3.org/TR/html5/text-level-semantics.html with the exception of:\n *\n * - a - because we don't allow href on it anyways,\n * - ruby, rt, rp - because we don't allow nested elements to be inserted.\n */\nconst TEXT_LEVEL_ELEMENTS = {\n \"http://www.w3.org/1999/xhtml\": [\n \"em\",\n \"strong\",\n \"small\",\n \"s\",\n \"cite\",\n \"q\",\n \"dfn\",\n \"abbr\",\n \"data\",\n \"time\",\n \"code\",\n \"var\",\n \"samp\",\n \"kbd\",\n \"sub\",\n \"sup\",\n \"i\",\n \"b\",\n \"u\",\n \"mark\",\n \"bdi\",\n \"bdo\",\n \"span\",\n \"br\",\n \"wbr\",\n ],\n};\nconst LOCALIZABLE_ATTRIBUTES = {\n \"http://www.w3.org/1999/xhtml\": {\n global: [\"title\", \"aria-description\", \"aria-label\", \"aria-valuetext\"],\n a: [\"download\"],\n area: [\"download\", \"alt\"],\n // value is special-cased in isAttrNameLocalizable\n input: [\"alt\", \"placeholder\"],\n menuitem: [\"label\"],\n menu: [\"label\"],\n optgroup: [\"label\"],\n option: [\"label\"],\n track: [\"label\"],\n img: [\"alt\"],\n textarea: [\"placeholder\"],\n th: [\"abbr\"],\n },\n \"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul\": {\n global: [\n \"accesskey\",\n \"aria-label\",\n \"aria-valuetext\",\n \"label\",\n \"title\",\n \"tooltiptext\",\n ],\n description: [\"value\"],\n key: [\"key\", \"keycode\"],\n label: [\"value\"],\n textbox: [\"placeholder\", \"value\"],\n },\n};\n/**\n * Translate an element.\n *\n * Translate the element's text content and attributes. Some HTML markup is\n * allowed in the translation. The element's children with the data-l10n-name\n * attribute will be treated as arguments to the translation. If the\n * translation defines the same children, their attributes and text contents\n * will be used for translating the matching source child.\n *\n * @param {Element} element\n * @param {Object} translation\n * @private\n */\nexport default function translateElement(element, translation) {\n const { value } = translation;\n if (typeof value === \"string\") {\n if (element.localName === \"title\" &&\n element.namespaceURI === \"http://www.w3.org/1999/xhtml\") {\n // A special case for the HTML title element whose content must be text.\n element.textContent = value;\n }\n else if (!reOverlay.test(value)) {\n // If the translation doesn't contain any markup skip the overlay logic.\n element.textContent = value;\n }\n else {\n // Else parse the translation's HTML using an inert template element,\n // sanitize it and replace the element's content.\n const templateElement = element.ownerDocument.createElementNS(\"http://www.w3.org/1999/xhtml\", \"template\");\n templateElement.innerHTML = value;\n overlayChildNodes(templateElement.content, element);\n }\n }\n // Even if the translation doesn't define any localizable attributes, run\n // overlayAttributes to remove any localizable attributes set by previous\n // translations.\n overlayAttributes(translation, element);\n}\n/**\n * Replace child nodes of an element with child nodes of another element.\n *\n * The contents of the target element will be cleared and fully replaced with\n * sanitized contents of the source element.\n *\n * @param {DocumentFragment} fromFragment - The source of children to overlay.\n * @param {Element} toElement - The target of the overlay.\n * @private\n */\nfunction overlayChildNodes(fromFragment, toElement) {\n for (const childNode of fromFragment.childNodes) {\n if (childNode.nodeType === childNode.TEXT_NODE) {\n // Keep the translated text node.\n continue;\n }\n if (childNode.hasAttribute(\"data-l10n-name\")) {\n const sanitized = getNodeForNamedElement(toElement, childNode);\n fromFragment.replaceChild(sanitized, childNode);\n continue;\n }\n if (isElementAllowed(childNode)) {\n const sanitized = createSanitizedElement(childNode);\n fromFragment.replaceChild(sanitized, childNode);\n continue;\n }\n console.warn(`An element of forbidden type \"${childNode.localName}\" was found in ` +\n \"the translation. Only safe text-level elements and elements with \" +\n \"data-l10n-name are allowed.\");\n // If all else fails, replace the element with its text content.\n fromFragment.replaceChild(createTextNodeFromTextContent(childNode), childNode);\n }\n toElement.textContent = \"\";\n toElement.appendChild(fromFragment);\n}\nfunction hasAttribute(attributes, name) {\n if (!attributes) {\n return false;\n }\n for (let attr of attributes) {\n if (attr.name === name) {\n return true;\n }\n }\n return false;\n}\n/**\n * Transplant localizable attributes of an element to another element.\n *\n * Any localizable attributes already set on the target element will be\n * cleared.\n *\n * @param {Element|Object} fromElement - The source of child nodes to overlay.\n * @param {Element} toElement - The target of the overlay.\n * @private\n */\nfunction overlayAttributes(fromElement, toElement) {\n const explicitlyAllowed = toElement.hasAttribute(\"data-l10n-attrs\")\n ? toElement\n .getAttribute(\"data-l10n-attrs\")\n .split(\",\")\n .map(i => i.trim())\n : null;\n // Remove existing localizable attributes if they\n // will not be used in the new translation.\n for (const attr of Array.from(toElement.attributes)) {\n if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) &&\n !hasAttribute(fromElement.attributes, attr.name)) {\n toElement.removeAttribute(attr.name);\n }\n }\n // fromElement might be a {value, attributes} object as returned by\n // Localization.messageFromBundle. In which case attributes may be null to\n // save GC cycles.\n if (!fromElement.attributes) {\n return;\n }\n // Set localizable attributes.\n for (const attr of Array.from(fromElement.attributes)) {\n if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) &&\n toElement.getAttribute(attr.name) !== attr.value) {\n toElement.setAttribute(attr.name, attr.value);\n }\n }\n}\n/**\n * Sanitize a child element created by the translation.\n *\n * Try to find a corresponding child in sourceElement and use it as the base\n * for the sanitization. This will preserve functional attribtues defined on\n * the child element in the source HTML.\n *\n * @param {Element} sourceElement - The source for data-l10n-name lookups.\n * @param {Element} translatedChild - The translated child to be sanitized.\n * @returns {Element}\n * @private\n */\nfunction getNodeForNamedElement(sourceElement, translatedChild) {\n const childName = translatedChild.getAttribute(\"data-l10n-name\");\n const sourceChild = sourceElement.querySelector(`[data-l10n-name=\"${childName}\"]`);\n if (!sourceChild) {\n console.warn(`An element named \"${childName}\" wasn't found in the source.`);\n return createTextNodeFromTextContent(translatedChild);\n }\n if (sourceChild.localName !== translatedChild.localName) {\n console.warn(`An element named \"${childName}\" was found in the translation ` +\n `but its type ${translatedChild.localName} didn't match the ` +\n `element found in the source (${sourceChild.localName}).`);\n return createTextNodeFromTextContent(translatedChild);\n }\n // Remove it from sourceElement so that the translation cannot use\n // the same reference name again.\n sourceElement.removeChild(sourceChild);\n // We can't currently guarantee that a translation won't remove\n // sourceChild from the element completely, which could break the app if\n // it relies on an event handler attached to the sourceChild. Let's make\n // this limitation explicit for now by breaking the identitiy of the\n // sourceChild by cloning it. This will destroy all event handlers\n // attached to sourceChild via addEventListener and via on<name>\n // properties.\n const clone = sourceChild.cloneNode(false);\n return shallowPopulateUsing(translatedChild, clone);\n}\n/**\n * Sanitize an allowed element.\n *\n * Text-level elements allowed in translations may only use safe attributes\n * and will have any nested markup stripped to text content.\n *\n * @param {Element} element - The element to be sanitized.\n * @returns {Element}\n * @private\n */\nfunction createSanitizedElement(element) {\n // Start with an empty element of the same type to remove nested children\n // and non-localizable attributes defined by the translation.\n const clone = element.ownerDocument.createElement(element.localName);\n return shallowPopulateUsing(element, clone);\n}\n/**\n * Convert an element to a text node.\n *\n * @param {Element} element - The element to be sanitized.\n * @returns {Node}\n * @private\n */\nfunction createTextNodeFromTextContent(element) {\n return element.ownerDocument.createTextNode(element.textContent);\n}\n/**\n * Check if element is allowed in the translation.\n *\n * This method is used by the sanitizer when the translation markup contains\n * an element which is not present in the source code.\n *\n * @param {Element} element\n * @returns {boolean}\n * @private\n */\nfunction isElementAllowed(element) {\n const allowed = TEXT_LEVEL_ELEMENTS[element.namespaceURI];\n return allowed && allowed.includes(element.localName);\n}\n/**\n * Check if attribute is allowed for the given element.\n *\n * This method is used by the sanitizer when the translation markup contains\n * DOM attributes, or when the translation has traits which map to DOM\n * attributes.\n *\n * `explicitlyAllowed` can be passed as a list of attributes explicitly\n * allowed on this element.\n *\n * @param {string} name\n * @param {Element} element\n * @param {Array} explicitlyAllowed\n * @returns {boolean}\n * @private\n */\nfunction isAttrNameLocalizable(name, element, explicitlyAllowed = null) {\n if (explicitlyAllowed && explicitlyAllowed.includes(name)) {\n return true;\n }\n const allowed = LOCALIZABLE_ATTRIBUTES[element.namespaceURI];\n if (!allowed) {\n return false;\n }\n const attrName = name.toLowerCase();\n const elemName = element.localName;\n // Is it a globally safe attribute?\n if (allowed.global.includes(attrName)) {\n return true;\n }\n // Are there no allowed attributes for this element?\n if (!allowed[elemName]) {\n return false;\n }\n // Is it allowed on this element?\n if (allowed[elemName].includes(attrName)) {\n return true;\n }\n // Special case for value on HTML inputs with type button, reset, submit\n if (element.namespaceURI === \"http://www.w3.org/1999/xhtml\" &&\n elemName === \"input\" &&\n attrName === \"value\") {\n const type = element.type.toLowerCase();\n if (type === \"submit\" || type === \"button\" || type === \"reset\") {\n return true;\n }\n }\n return false;\n}\n/**\n * Helper to set textContent and localizable attributes on an element.\n *\n * @param {Element} fromElement\n * @param {Element} toElement\n * @returns {Element}\n * @private\n */\nfunction shallowPopulateUsing(fromElement, toElement) {\n toElement.textContent = fromElement.textContent;\n overlayAttributes(fromElement, toElement);\n return toElement;\n}\n","/*\n * Base CachedIterable class.\n */\nexport default class CachedIterable extends Array {\n /**\n * Create a `CachedIterable` instance from an iterable or, if another\n * instance of `CachedIterable` is passed, return it without any\n * modifications.\n *\n * @param {Iterable} iterable\n * @returns {CachedIterable}\n */\n static from(iterable) {\n if (iterable instanceof this) {\n return iterable;\n }\n\n return new this(iterable);\n }\n}\n","import CachedIterable from \"./cached_iterable.mjs\";\n\n/*\n * CachedSyncIterable caches the elements yielded by an iterable.\n *\n * It can be used to iterate over an iterable many times without depleting the\n * iterable.\n */\nexport default class CachedSyncIterable extends CachedIterable {\n /**\n * Create an `CachedSyncIterable` instance.\n *\n * @param {Iterable} iterable\n * @returns {CachedSyncIterable}\n */\n constructor(iterable) {\n super();\n\n if (Symbol.iterator in Object(iterable)) {\n this.iterator = iterable[Symbol.iterator]();\n } else {\n throw new TypeError(\"Argument must implement the iteration protocol.\");\n }\n }\n\n [Symbol.iterator]() {\n const cached = this;\n let cur = 0;\n\n return {\n next() {\n if (cached.length <= cur) {\n cached.push(cached.iterator.next());\n }\n return cached[cur++];\n }\n };\n }\n\n /**\n * This method allows user to consume the next element from the iterator\n * into the cache.\n *\n * @param {number} count - number of elements to consume\n */\n touchNext(count = 1) {\n let idx = 0;\n while (idx++ < count) {\n const last = this[this.length - 1];\n if (last && last.done) {\n break;\n }\n this.push(this.iterator.next());\n }\n // Return the last cached {value, done} object to allow the calling\n // code to decide if it needs to call touchNext again.\n return this[this.length - 1];\n }\n}\n","import CachedIterable from \"./cached_iterable.mjs\";\n\n/*\n * CachedAsyncIterable caches the elements yielded by an async iterable.\n *\n * It can be used to iterate over an iterable many times without depleting the\n * iterable.\n */\nexport default class CachedAsyncIterable extends CachedIterable {\n /**\n * Create an `CachedAsyncIterable` instance.\n *\n * @param {Iterable} iterable\n * @returns {CachedAsyncIterable}\n */\n constructor(iterable) {\n super();\n\n if (Symbol.asyncIterator in Object(iterable)) {\n this.iterator = iterable[Symbol.asyncIterator]();\n } else if (Symbol.iterator in Object(iterable)) {\n this.iterator = iterable[Symbol.iterator]();\n } else {\n throw new TypeError(\"Argument must implement the iteration protocol.\");\n }\n }\n\n /**\n * Asynchronous iterator caching the yielded elements.\n *\n * Elements yielded by the original iterable will be cached and available\n * synchronously. Returns an async generator object implementing the\n * iterator protocol over the elements of the original (async or sync)\n * iterable.\n */\n [Symbol.asyncIterator]() {\n const cached = this;\n let cur = 0;\n\n return {\n async next() {\n if (cached.length <= cur) {\n cached.push(cached.iterator.next());\n }\n return cached[cur++];\n }\n };\n }\n\n /**\n * This method allows user to consume the next element from the iterator\n * into the cache.\n *\n * @param {number} count - number of elements to consume\n */\n async touchNext(count = 1) {\n let idx = 0;\n while (idx++ < count) {\n const last = this[this.length - 1];\n if (last && (await last).done) {\n break;\n }\n this.push(this.iterator.next());\n }\n // Return the last cached {value, done} object to allow the calling\n // code to decide if it needs to call touchNext again.\n return this[this.length - 1];\n }\n}\n","export {default as CachedSyncIterable} from \"./cached_sync_iterable.mjs\";\nexport {default as CachedAsyncIterable} from \"./cached_async_iterable.mjs\";\n","/* eslint no-console: [\"error\", { allow: [\"warn\", \"error\"] }] */\n/* global console */\nimport { CachedAsyncIterable } from \"cached-iterable\";\n/**\n * The `Localization` class is a central high-level API for vanilla\n * JavaScript use of Fluent.\n * It combines language negotiation, FluentBundle and I/O to\n * provide a scriptable API to format translations.\n */\nexport default class Localization {\n /**\n * @param {Array<String>} resourceIds - List of resource IDs\n * @param {Function} generateBundles - Function that returns a\n * generator over FluentBundles\n *\n * @returns {Localization}\n */\n constructor(resourceIds = [], generateBundles) {\n this.resourceIds = resourceIds;\n this.generateBundles = generateBundles;\n this.onChange(true);\n }\n addResourceIds(resourceIds, eager = false) {\n this.resourceIds.push(...resourceIds);\n this.onChange(eager);\n return this.resourceIds.length;\n }\n removeResourceIds(resourceIds) {\n this.resourceIds = this.resourceIds.filter(r => !resourceIds.includes(r));\n this.onChange();\n return this.resourceIds.length;\n }\n /**\n * Format translations and handle fallback if needed.\n *\n * Format translations for `keys` from `FluentBundle` instances on this\n * DOMLocalization. In case of errors, fetch the next context in the\n * fallback chain.\n *\n * @param {Array<Object>} keys - Translation keys to format.\n * @param {Function} method - Formatting function.\n * @returns {Promise<Array<string|Object>>}\n * @private\n */\n async formatWithFallback(keys, method) {\n const translations = [];\n let hasAtLeastOneBundle = false;\n for await (const bundle of this.bundles) {\n hasAtLeastOneBundle = true;\n const missingIds = keysFromBundle(method, bundle, keys, translations);\n if (missingIds.size === 0) {\n break;\n }\n if (typeof console !== \"undefined\") {\n const locale = bundle.locales[0];\n const ids = Array.from(missingIds).join(\", \");\n console.warn(`[fluent] Missing translations in ${locale}: ${ids}`);\n }\n }\n if (!hasAtLeastOneBundle && typeof console !== \"undefined\") {\n console.warn(`[fluent] Request for keys failed because no resource bundles got generated.\n keys: ${JSON.stringify(keys)}.\n resourceIds: ${JSON.stringify(this.resourceIds)}.`);\n }\n return translations;\n }\n /**\n * Format translations into `{value, attributes}` objects.\n *\n * The fallback logic is the same as in `formatValues`\n * but it returns `{value, attributes}` objects\n * which are suitable for the translation of DOM elements.\n *\n * Returns a Promise resolving to an array of the translation strings.\n *\n * @example\n * ```js\n * docL10n.formatMessages([\n * {id: 'hello', args: { who: 'Mary' }},\n * {id: 'welcome'}\n * ]).then(console.log);\n *\n * // [\n * // { value: 'Hello, Mary!', attributes: null },\n * // {\n * // value: 'Welcome!',\n * // attributes: [ { name: \"title\", value: 'Hello' } ]\n * // }\n * // ]\n * ```\n *\n * @param {Array<Object>} keys\n * @returns {Promise<Array<{value: string, attributes: Object}>>}\n * @private\n */\n formatMessages(keys) {\n return this.formatWithFallback(keys, messageFromBundle);\n }\n /**\n * Retrieve translations corresponding to the passed keys.\n *\n * A generalized version of `DOMLocalization.formatValue`. Keys must\n * be `{id, args}` objects.\n *\n * Returns a Promise resolving to an array of the translation strings.\n *\n * @example\n * ```js\n * docL10n.formatValues([\n * {id: 'hello', args: { who: 'Mary' }},\n * {id: 'hello', args: { who: 'John' }},\n * {id: 'welcome'}\n * ]).then(console.log);\n *\n * // ['Hello, Mary!', 'Hello, John!', 'Welcome!']\n * ```\n *\n * @param {Array<Object>} keys\n * @returns {Promise<Array<string>>}\n */\n formatValues(keys) {\n return this.formatWithFallback(keys, valueFromBundle);\n }\n /**\n * Retrieve the translation corresponding to the `id` identifier.\n *\n * If passed, `args` is a simple hash object with a list of variables that\n * will be interpolated in the value of the translation.\n *\n * Returns a Promise resolving to the translation string.\n *\n * Use this sparingly for one-off messages which don't need to be\n * retranslated when the user changes their language preferences, e.g. in\n * notifications.\n *\n * @example\n * ```js\n * docL10n.formatValue(\n * 'hello', { who: 'world' }\n * ).then(console.log);\n *\n * // 'Hello, world!'\n * ```\n *\n * @param {string} id - Identifier of the translation to format\n * @param {Object} [args] - Optional external arguments\n * @returns {Promise<string>}\n */\n async formatValue(id, args) {\n const [val] = await this.formatValues([{ id, args }]);\n return val;\n }\n handleEvent() {\n this.onChange();\n }\n /**\n * This method should be called when there's a reason to believe\n * that language negotiation or available resources changed.\n */\n onChange(eager = false) {\n this.bundles = CachedAsyncIterable.from(this.generateBundles(this.resourceIds));\n if (eager) {\n this.bundles.touchNext(2);\n }\n }\n}\n/**\n * Format the value of a message into a string or `null`.\n *\n * This function is passed as a method to `keysFromBundle` and resolve\n * a value of a single L10n Entity using provided `FluentBundle`.\n *\n * If the message doesn't have a value, return `null`.\n *\n * @param {FluentBundle} bundle\n * @param {Array<Error>} errors\n * @param {Object} message\n * @param {Object} args\n * @returns {string|null}\n * @private\n */\nfunction valueFromBundle(bundle, errors, message, args) {\n if (message.value) {\n return bundle.formatPattern(message.value, args, errors);\n }\n return null;\n}\n/**\n * Format all public values of a message into a {value, attributes} object.\n *\n * This function is passed as a method to `keysFromBundle` and resolve\n * a single L10n Entity using provided `FluentBundle`.\n *\n * The function will return an object with a value and attributes of the\n * entity.\n *\n * @param {FluentBundle} bundle\n * @param {Array<Error>} errors\n * @param {Object} message\n * @param {Object} args\n * @returns {Object}\n * @private\n */\nfunction messageFromBundle(bundle, errors, message, args) {\n const formatted = {\n value: null,\n attributes: null,\n };\n if (message.value) {\n formatted.value = bundle.formatPattern(message.value, args, errors);\n }\n let attrNames = Object.keys(message.attributes);\n if (attrNames.length > 0) {\n formatted.attributes = new Array(attrNames.length);\n for (let [i, name] of attrNames.entries()) {\n let value = bundle.formatPattern(message.attributes[name], args, errors);\n formatted.attributes[i] = { name, value };\n }\n }\n return formatted;\n}\n/**\n * This function is an inner function for `Localization.formatWithFallback`.\n *\n * It takes a `FluentBundle`, list of l10n-ids and a method to be used for\n * key resolution (either `valueFromBundle` or `messageFromBundle`) and\n * optionally a value returned from `keysFromBundle` executed against\n * another `FluentBundle`.\n *\n * The idea here is that if the previous `FluentBundle` did not resolve\n * all keys, we're calling this function with the next context to resolve\n * the remaining ones.\n *\n * In the function, we loop over `keys` and check if we have the `prev`\n * passed and if it has an error entry for the position we're in.\n *\n * If it doesn't, it means that we have a good translation for this key and\n * we return it. If it does, we'll try to resolve the key using the passed\n * `FluentBundle`.\n *\n * In the end, we fill the translations array, and return the Set with\n * missing ids.\n *\n * See `Localization.formatWithFallback` for more info on how this is used.\n *\n * @param {Function} method\n * @param {FluentBundle} bundle\n * @param {Array<string>} keys\n * @param {{Array<{value: string, attributes: Object}>}} translations\n *\n * @returns {Set<string>}\n * @private\n */\nfunction keysFromBundle(method, bundle, keys, translations) {\n const messageErrors = [];\n const missingIds = new Set();\n keys.forEach(({ id, args }, i) => {\n if (translations[i] !== undefined) {\n return;\n }\n let message = bundle.getMessage(id);\n if (message) {\n messageErrors.length = 0;\n translations[i] = method(bundle, messageErrors, message, args);\n if (messageErrors.length > 0 && typeof console !== \"undefined\") {\n const locale = bundle.locales[0];\n const errors = messageErrors.join(\", \");\n console.warn(`[fluent][resolver] errors in ${locale}/${id}: ${errors}.`);\n }\n }\n else {\n missingIds.add(id);\n }\n });\n return missingIds;\n}\n","import translateElement from \"./overlay.js\";\nimport Localization from \"./localization.js\";\nconst L10NID_ATTR_NAME = \"data-l10n-id\";\nconst L10NARGS_ATTR_NAME = \"data-l10n-args\";\nconst L10N_ELEMENT_QUERY = `[${L10NID_ATTR_NAME}]`;\n/**\n * The `DOMLocalization` class is responsible for fetching resources and\n * formatting translations.\n *\n * It implements the fallback strategy in case of errors encountered during the\n * formatting of translations and methods for observing DOM\n * trees with a `MutationObserver`.\n */\nexport default class DOMLocalization extends Localization {\n /**\n * @param {Array<String>} resourceIds - List of resource IDs\n * @param {Function} generateBundles - Function that returns a\n * generator over FluentBundles\n * @returns {DOMLocalization}\n */\n constructor(resourceIds, generateBundles) {\n super(resourceIds, generateBundles);\n // A Set of DOM trees observed by the `MutationObserver`.\n this.roots = new Set();\n // requestAnimationFrame handler.\n this.pendingrAF = null;\n // list of elements pending for translation.\n this.pendingElements = new Set();\n this.windowElement = null;\n this.mutationObserver = null;\n this.observerConfig = {\n attributes: true,\n characterData: false,\n childList: true,\n subtree: true,\n attributeFilter: [L10NID_ATTR_NAME, L10NARGS_ATTR_NAME],\n };\n }\n onChange(eager = false) {\n super.onChange(eager);\n if (this.roots) {\n this.translateRoots();\n }\n }\n /**\n * Set the `data-l10n-id` and `data-l10n-args` attributes on DOM elements.\n * FluentDOM makes use of mutation observers to detect changes\n * to `data-l10n-*` attributes and translate elements asynchronously.\n * `setAttributes` is a convenience method which allows to translate\n * DOM elements declaratively.\n *\n * You should always prefer to use `data-l10n-id` on elements (statically in\n * HTML or dynamically via `setAttributes`) over manually retrieving\n * translations with `format`. The use of attributes ensures that the\n * elements can be retranslated when the user changes their language\n * preferences.\n *\n * ```javascript\n * localization.setAttributes(\n * document.querySelector('#welcome'), 'hello', { who: 'world' }\n * );\n * ```\n *\n * This will set the following attributes on the `#welcome` element.\n * The MutationObserver will pick up this change and will localize the element\n * asynchronously.\n *\n * ```html\n * <p id='welcome'\n * data-l10n-id='hello'\n * data-l10n-args='{\"who\": \"world\"}'>\n * </p>\n * ```\n *\n * @param {Element} element - Element to set attributes on\n * @param {string} id - l10n-id string\n * @param {Object<string, string>} args - KVP list of l10n arguments\n * @returns {Element}\n */\n setAttributes(element, id, args) {\n element.setAttribute(L10NID_ATTR_NAME, id);\n if (args) {\n element.setAttribute(L10NARGS_ATTR_NAME, JSON.stringify(args));\n }\n else {\n element.removeAttribute(L10NARGS_ATTR_NAME);\n }\n return element;\n }\n /**\n * Get the `data-l10n-*` attributes from DOM elements.\n *\n * ```javascript\n * localization.getAttributes(\n * document.querySelector('#welcome')\n * );\n * // -> { id: 'hello', args: { who: 'world' } }\n * ```\n *\n * @param {Element} element - HTML element\n * @returns {{id: string, args: Object}}\n */\n getAttributes(element) {\n return {\n id: element.getAttribute(L10NID_ATTR_NAME),\n args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null),\n };\n }\n /**\n * Add `newRoot` to the list of roots managed by this `DOMLocalization`.\n *\n * Additionally, if this `DOMLocalization` has an observer, start observing\n * `newRoot` in order to translate mutations in it.\n *\n * @param {Element | DocumentFragment} newRoot - Root to observe.\n */\n connectRoot(newRoot) {\n for (const root of this.roots) {\n if (root === newRoot ||\n root.contains(newRoot) ||\n newRoot.contains(root)) {\n throw new Error(\"Cannot add a root that overlaps with existing root.\");\n }\n }\n if (this.windowElement) {\n if (this.windowElement !== newRoot.ownerDocument.defaultView) {\n throw new Error(`Cannot connect a root:\n DOMLocalization already has a root from a different window.`);\n }\n }\n else {\n this.windowElement = newRoot.ownerDocument.defaultView;\n this.mutationObserver = new this.windowElement.MutationObserver(mutations => this.translateMutations(mutations));\n }\n this.roots.add(newRoot);\n this.mutationObserver.observe(newRoot, this.observerConfig);\n }\n /**\n * Remove `root` from the list of roots managed by this `DOMLocalization`.\n *\n * Additionally, if this `DOMLocalization` has an observer, stop observing\n * `root`.\n *\n * Returns `true` if the root was the last one managed by this\n * `DOMLocalization`.\n *\n * @param {Element | DocumentFragment} root - Root to disconnect.\n * @returns {boolean}\n */\n disconnectRoot(root) {\n this.roots.delete(root);\n // Pause the mutation observer to stop observing `root`.\n this.pauseObserving();\n if (this.roots.size === 0) {\n this.mutationObserver = null;\n if (this.windowElement && this.pendingrAF) {\n this.windowElement.cancelAnimationFrame(this.pendingrAF);\n }\n this.windowElement = null;\n this.pendingrAF = null;\n this.pendingElements.clear();\n return true;\n }\n // Resume observing all other roots.\n this.resumeObserving();\n return false;\n }\n /**\n * Translate all roots associated with this `DOMLocalization`.\n *\n * @returns {Promise}\n */\n translateRoots() {\n const roots = Array.from(this.roots);\n return Promise.all(roots.map(root => this.translateFragment(root)));\n }\n /**\n * Pauses the `MutationObserver`.\n */\n pauseObserving() {\n if (!this.mutationObserver) {\n return;\n }\n this.translateMutations(this.mutationObserver.takeRecords());\n this.mutationObserver.disconnect();\n }\n /**\n * Resumes the `MutationObserver`.\n */\n resumeObserving() {\n if (!this.mutationObserver) {\n return;\n }\n for (const root of this.roots) {\n this.mutationObserver.observe(root, this.observerConfig);\n }\n }\n /**\n * Translate mutations detected by the `MutationObserver`.\n *\n * @private\n */\n translateMutations(mutations) {\n for (const mutation of mutations) {\n switch (mutation.type) {\n case \"attributes\":\n if (mutation.target.hasAttribute(\"data-l10n-id\")) {\n this.pendingElements.add(mutation.target);\n }\n break;\n case \"childList\":\n for (const addedNode of mutation.addedNodes) {\n if (addedNode.nodeType === addedNode.ELEMENT_NODE) {\n if (addedNode.childElementCount) {\n for (const element of this.getTranslatables(addedNode)) {\n this.pendingElements.add(element);\n }\n }\n else if (addedNode.hasAttribute(L10NID_ATTR_NAME)) {\n this.pendingElements.add(addedNode);\n }\n }\n }\n break;\n }\n }\n // This fragment allows us to coalesce all pending translations\n // into a single requestAnimationFrame.\n if (this.pendingElements.size > 0) {\n if (this.pendingrAF === null) {\n this.pendingrAF = this.windowElement.requestAnimationFrame(() => {\n this.translateElements(Array.from(this.pendingElements));\n this.pendingElements.clear();\n this.pendingrAF = null;\n });\n }\n }\n }\n /**\n * Translate a DOM element or fragment asynchronously using this\n * `DOMLocalization` object.\n *\n * Manually trigger the translation (or re-translation) of a DOM fragment.\n * Use the `data-l10n-id` and `data-l10n-args` attributes to mark up the DOM\n * with information about which translations to use.\n *\n * Returns a `Promise` that gets resolved once the translation is complete.\n *\n * @param {Element | DocumentFragment} frag - Element or DocumentFragment to be translated\n * @returns {Promise}\n */\n translateFragment(frag) {\n return this.translateElements(this.getTranslatables(frag));\n }\n /**\n * Translate a list of DOM elements asynchronously using this\n * `DOMLocalization` object.\n *\n * Manually trigger the translation (or re-translation) of a list of elements.\n * Use the `data-l10n-id` and `data-l10n-args` attributes to mark up the DOM\n * with information about which translations to use.\n *\n * Returns a `Promise` that gets resolved once the translation is complete.\n *\n * @param {Array<Element>} elements - List of elements to be translated\n * @returns {Promise}\n */\n async translateElements(elements) {\n if (!elements.length) {\n return undefined;\n }\n const keys = elements.map(this.getKeysForElement);\n const translations = await this.formatMessages(keys);\n return this.applyTranslations(elements, translations);\n }\n /**\n * Applies translations onto elements.\n *\n * @param {Array<Element>} elements\n * @param {Array<Object>} translations\n * @private\n */\n applyTranslations(elements, translations) {\n this.pauseObserving();\n for (let i = 0; i < elements.length; i++) {\n if (translations[i] !== undefined) {\n translateElement(elements[i], translations[i]);\n }\n }\n this.resumeObserving();\n }\n /**\n * Collects all translatable child elements of the element.\n *\n * @param {Element | DocumentFragment} element\n * @returns {Array<Element>}\n * @private\n */\n getTranslatables(element) {\n const nodes = Array.from(element.querySelectorAll(L10N_ELEMENT_QUERY));\n if (typeof element.hasAttribute === \"function\" &&\n element.hasAttribute(L10NID_ATTR_NAME)) {\n nodes.push(element);\n }\n return nodes;\n }\n /**\n * Get the `data-l10n-*` attributes from DOM elements as a two-element\n * array.\n *\n * @param {Element} element\n * @returns {Object}\n * @private\n */\n getKeysForElement(element) {\n return {\n id: element.getAttribute(L10NID_ATTR_NAME),\n args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null),\n };\n }\n}\n","export { default as DOMLocalization } from \"./dom_localization.js\";\nexport { default as Localization } from \"./localization.js\";\n","/* Copyright 2023 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 * NOTE: The L10n-implementations should use lowercase language-codes\n * internally.\n */\nclass L10n {\n #dir;\n\n #elements;\n\n #lang;\n\n #l10n;\n\n constructor({ lang, isRTL }, l10n = null) {\n this.#lang = L10n.#fixupLangCode(lang);\n this.#l10n = l10n;\n this.#dir = (isRTL ?? L10n.#isRTL(this.#lang)) ? \"rtl\" : \"ltr\";\n }\n\n _setL10n(l10n) {\n this.#l10n = l10n;\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n document.l10n = l10n;\n }\n }\n\n /** @inheritdoc */\n getLanguage() {\n return this.#lang;\n }\n\n /** @inheritdoc */\n getDirection() {\n return this.#dir;\n }\n\n /** @inheritdoc */\n async get(ids, args = null, fallback) {\n if (Array.isArray(ids)) {\n ids = ids.map(id => ({ id }));\n const messages = await this.#l10n.formatMessages(ids);\n return messages.map(message => message.value);\n }\n\n const messages = await this.#l10n.formatMessages([\n {\n id: ids,\n args,\n },\n ]);\n return messages[0]?.value || fallback;\n }\n\n /** @inheritdoc */\n async translate(element) {\n (this.#elements ||= new Set()).add(element);\n try {\n this.#l10n.connectRoot(element);\n await this.#l10n.translateRoots();\n } catch {\n // Element is under an existing root, so there is no need to add it again.\n }\n }\n\n /** @inheritdoc */\n async translateOnce(element) {\n try {\n await this.#l10n.translateElements([element]);\n } catch (ex) {\n console.error(\"translateOnce:\", ex);\n }\n }\n\n /** @inheritdoc */\n async destroy() {\n if (this.#elements) {\n for (const element of this.#elements) {\n this.#l10n.disconnectRoot(element);\n }\n this.#elements.clear();\n this.#elements = null;\n }\n this.#l10n.pauseObserving();\n }\n\n /** @inheritdoc */\n pause() {\n this.#l10n.pauseObserving();\n }\n\n /** @inheritdoc */\n resume() {\n this.#l10n.resumeObserving();\n }\n\n static #fixupLangCode(langCode) {\n // Use only lowercase language-codes internally, and fallback to English.\n langCode = langCode?.toLowerCase() || \"en-us\";\n\n // Try to support \"incompletely\" specified language codes (see issue 13689).\n const 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 return PARTIAL_LANG_CODES[langCode] || langCode;\n }\n\n static #isRTL(lang) {\n const shortCode = lang.split(\"-\", 1)[0];\n return [\"ar\", \"he\", \"fa\", \"ps\", \"ur\"].includes(shortCode);\n }\n}\n\nconst GenericL10n = null;\n\nexport { GenericL10n, L10n };\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 { FeatureTest, fetchData } from \"pdfjs-lib\";\nimport { FluentBundle, FluentResource } from \"fluent-bundle\";\nimport { DOMLocalization } from \"fluent-dom\";\nimport { L10n } from \"./l10n.js\";\n\nfunction PLATFORM() {\n const { isAndroid, isLinux, isMac, isWindows } = FeatureTest.platform;\n if (isLinux) {\n return \"linux\";\n }\n if (isWindows) {\n return \"windows\";\n }\n if (isMac) {\n return \"macos\";\n }\n if (isAndroid) {\n return \"android\";\n }\n return \"other\";\n}\n\nfunction createBundle(lang, text) {\n const resource = new FluentResource(text);\n const bundle = new FluentBundle(lang, {\n functions: { PLATFORM },\n });\n const errors = bundle.addResource(resource);\n if (errors.length) {\n console.error(\"L10n errors\", errors);\n }\n return bundle;\n}\n\nclass GenericL10n extends L10n {\n constructor(lang) {\n super({ lang });\n\n const generateBundles = !lang\n ? GenericL10n.#generateBundlesFallback.bind(\n GenericL10n,\n this.getLanguage()\n )\n : GenericL10n.#generateBundles.bind(\n GenericL10n,\n \"en-us\",\n this.getLanguage()\n );\n this._setL10n(new DOMLocalization([], generateBundles));\n }\n\n /**\n * Generate the bundles for Fluent.\n * @param {String} defaultLang - The fallback language to use for\n * translations.\n * @param {String} baseLang - The base language to use for translations.\n */\n static async *#generateBundles(defaultLang, baseLang) {\n const { baseURL, paths } = await this.#getPaths();\n\n const langs = [baseLang];\n if (defaultLang !== baseLang) {\n // Also fallback to the short-format of the base language\n // (see issue 17269).\n const shortLang = baseLang.split(\"-\", 1)[0];\n\n if (shortLang !== baseLang) {\n langs.push(shortLang);\n }\n langs.push(defaultLang);\n }\n // Trigger fetching of bundles in parallel, to reduce overall load time.\n const bundles = langs.map(lang => [\n lang,\n this.#createBundle(lang, baseURL, paths),\n ]);\n\n for (const [lang, bundlePromise] of bundles) {\n const bundle = await bundlePromise;\n if (bundle) {\n yield bundle;\n } else if (lang === \"en-us\") {\n yield this.#createBundleFallback(lang);\n }\n }\n }\n\n static async #createBundle(lang, baseURL, paths) {\n const path = paths[lang];\n if (!path) {\n return null;\n }\n const url = new URL(path, baseURL);\n const text = await fetchData(url, /* type = */ \"text\");\n\n return createBundle(lang, text);\n }\n\n static async #getPaths() {\n try {\n const { href } = document.querySelector(`link[type=\"application/l10n\"]`);\n const paths = await fetchData(href, /* type = */ \"json\");\n\n return {\n baseURL: href.substring(0, href.lastIndexOf(\"/\") + 1) || \"./\",\n paths,\n };\n } catch {}\n return { baseURL: \"./\", paths: Object.create(null) };\n }\n\n static async *#generateBundlesFallback(lang) {\n yield this.#createBundleFallback(lang);\n }\n\n static async #createBundleFallback(lang) {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n throw new Error(\"Not implemented: #createBundleFallback\");\n }\n const text =\n typeof PDFJSDev === \"undefined\"\n ? await fetchData(\n new URL(\"../l10n/en-US/viewer.ftl\", window.location.href),\n /* type = */ \"text\"\n )\n : PDFJSDev.eval(\"DEFAULT_FTL\");\n\n return createBundle(lang, text);\n }\n}\n\nexport { GenericL10n };\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 } from \"pdfjs-lib\";\n\nasync function docProperties(pdfDocument) {\n const url = \"\",\n baseUrl = \"\";\n const { info, metadata, contentDispositionFilename, contentLength } =\n await pdfDocument.getMetadata();\n\n return {\n ...info,\n baseURL: baseUrl,\n filesize: contentLength || (await pdfDocument.getDownloadInfo()).length,\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 = new Promise((resolve, reject) => {\n const sandbox =\n typeof PDFJSDev === \"undefined\"\n ? import(sandboxBundleSrc) // eslint-disable-line no-unsanitized/method\n : __raw_import__(sandboxBundleSrc);\n sandbox\n .then(pdfjsSandbox => {\n resolve(pdfjsSandbox.QuickJSSandbox());\n })\n .catch(reject);\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 { docProperties, GenericScripting };\n","/* Copyright 2025 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 { getUuid } from \"pdfjs-lib\";\n\nconst KEY_STORAGE = \"pdfjs.signature\";\n\nclass SignatureStorage {\n // TODO: Encrypt the data in using a password and add a UI for entering it.\n // We could use the Web Crypto API for this (see https://bradyjoslin.com/blog/encryption-webcrypto/\n // for an example).\n\n #eventBus;\n\n #signatures = null;\n\n #signal = null;\n\n constructor(eventBus, signal) {\n this.#eventBus = eventBus;\n this.#signal = signal;\n }\n\n #save() {\n localStorage.setItem(\n KEY_STORAGE,\n JSON.stringify(Object.fromEntries(this.#signatures))\n );\n }\n\n async getAll() {\n if (this.#signal) {\n window.addEventListener(\n \"storage\",\n ({ key }) => {\n if (key === KEY_STORAGE) {\n this.#signatures = null;\n this.#eventBus?.dispatch(\"storedsignatureschanged\", {\n source: this,\n });\n }\n },\n { signal: this.#signal }\n );\n this.#signal = null;\n }\n if (!this.#signatures) {\n this.#signatures = new Map();\n const data = localStorage.getItem(KEY_STORAGE);\n if (data) {\n for (const [key, value] of Object.entries(JSON.parse(data))) {\n this.#signatures.set(key, value);\n }\n }\n }\n return this.#signatures;\n }\n\n async isFull() {\n // Only allow 5 signatures to be saved.\n return (await this.size()) === 5;\n }\n\n async size() {\n return (await this.getAll()).size;\n }\n\n async create(data) {\n if (await this.isFull()) {\n return null;\n }\n const uuid = getUuid();\n this.#signatures.set(uuid, data);\n this.#save();\n\n return uuid;\n }\n\n async delete(uuid) {\n const signatures = await this.getAll();\n if (!signatures.has(uuid)) {\n return false;\n }\n signatures.delete(uuid);\n this.#save();\n\n return true;\n }\n}\n\nexport { SignatureStorage };\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 { AppOptions } from \"./app_options.js\";\nimport { BaseExternalServices } from \"./external_services.js\";\nimport { BasePreferences } from \"./preferences.js\";\nimport { GenericL10n } from \"./genericl10n.js\";\nimport { GenericScripting } from \"./generic_scripting.js\";\nimport { SignatureStorage } from \"./generic_signature_storage.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\nfunction initCom(app) {}\n\nclass Preferences extends BasePreferences {\n async _writeToStorage(prefObj) {\n localStorage.setItem(\"pdfjs.preferences\", JSON.stringify(prefObj));\n }\n\n async _readFromStorage(prefObj) {\n return { prefs: JSON.parse(localStorage.getItem(\"pdfjs.preferences\")) };\n }\n}\n\nclass ExternalServices extends BaseExternalServices {\n async createL10n() {\n return new GenericL10n(AppOptions.get(\"localeProperties\")?.lang);\n }\n\n createScripting() {\n return new GenericScripting(AppOptions.get(\"sandboxBundleSrc\"));\n }\n\n createSignatureStorage(eventBus, signal) {\n return new SignatureStorage(eventBus, signal);\n }\n}\n\nclass MLManager {\n static {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n this.getFakeMLManager = options => new FakeMLManager(options);\n }\n }\n\n async isEnabledFor(_name) {\n return false;\n }\n\n async deleteModel(_service) {\n return null;\n }\n\n isReady(_name) {\n return false;\n }\n\n guess(_data) {}\n\n toggleService(_name, _enabled) {}\n}\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n // eslint-disable-next-line no-var\n var FakeMLManager = class {\n eventBus = null;\n\n hasProgress = false;\n\n constructor({ enableGuessAltText, enableAltTextModelDownload }) {\n this.enableGuessAltText = enableGuessAltText;\n this.enableAltTextModelDownload = enableAltTextModelDownload;\n }\n\n setEventBus(eventBus, abortSignal) {\n this.eventBus = eventBus;\n }\n\n async isEnabledFor(_name) {\n return this.enableGuessAltText;\n }\n\n async deleteModel(_name) {\n this.enableAltTextModelDownload = false;\n return null;\n }\n\n async loadModel(_name) {}\n\n async downloadModel(_name) {\n // Simulate downloading the model but with progress.\n // The progress can be seen in the new alt-text dialog.\n this.hasProgress = true;\n\n const { promise, resolve } = Promise.withResolvers();\n const total = 1e8;\n const end = 1.5 * total;\n const increment = 5e6;\n let loaded = 0;\n const id = setInterval(() => {\n loaded += increment;\n if (loaded <= end) {\n this.eventBus.dispatch(\"loadaiengineprogress\", {\n source: this,\n detail: {\n total,\n totalLoaded: loaded,\n finished: loaded + increment >= end,\n },\n });\n return;\n }\n clearInterval(id);\n this.hasProgress = false;\n this.enableAltTextModelDownload = true;\n resolve(true);\n }, 900);\n return promise;\n }\n\n isReady(_name) {\n return this.enableAltTextModelDownload;\n }\n\n guess({ request: { data } }) {\n return new Promise(resolve => {\n setTimeout(() => {\n resolve(data ? { output: \"Fake alt text.\" } : { error: true });\n }, 3000);\n });\n }\n\n toggleService(_name, enabled) {\n this.enableGuessAltText = enabled;\n }\n };\n}\n\nexport { ExternalServices, initCom, MLManager, Preferences };\n","/* Copyright 2024 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 { noContextMenu } from \"pdfjs-lib\";\n\nclass NewAltTextManager {\n #boundCancel = this.#cancel.bind(this);\n\n #createAutomaticallyButton;\n\n #currentEditor = null;\n\n #cancelButton;\n\n #descriptionContainer;\n\n #dialog;\n\n #disclaimer;\n\n #downloadModel;\n\n #downloadModelDescription;\n\n #eventBus;\n\n #firstTime = false;\n\n #guessedAltText;\n\n #hasAI = null;\n\n #isEditing = null;\n\n #imagePreview;\n\n #imageData;\n\n #isAILoading = false;\n\n #wasAILoading = false;\n\n #learnMore;\n\n #notNowButton;\n\n #overlayManager;\n\n #textarea;\n\n #title;\n\n #uiManager;\n\n #previousAltText = null;\n\n constructor(\n {\n descriptionContainer,\n dialog,\n imagePreview,\n cancelButton,\n disclaimer,\n notNowButton,\n saveButton,\n textarea,\n learnMore,\n errorCloseButton,\n createAutomaticallyButton,\n downloadModel,\n downloadModelDescription,\n title,\n },\n overlayManager,\n eventBus\n ) {\n this.#cancelButton = cancelButton;\n this.#createAutomaticallyButton = createAutomaticallyButton;\n this.#descriptionContainer = descriptionContainer;\n this.#dialog = dialog;\n this.#disclaimer = disclaimer;\n this.#notNowButton = notNowButton;\n this.#imagePreview = imagePreview;\n this.#textarea = textarea;\n this.#learnMore = learnMore;\n this.#title = title;\n this.#downloadModel = downloadModel;\n this.#downloadModelDescription = downloadModelDescription;\n this.#overlayManager = overlayManager;\n this.#eventBus = eventBus;\n\n dialog.addEventListener(\"close\", this.#close.bind(this));\n dialog.addEventListener(\"contextmenu\", event => {\n if (event.target !== this.#textarea) {\n event.preventDefault();\n }\n });\n cancelButton.addEventListener(\"click\", this.#boundCancel);\n notNowButton.addEventListener(\"click\", this.#boundCancel);\n saveButton.addEventListener(\"click\", this.#save.bind(this));\n errorCloseButton.addEventListener(\"click\", () => {\n this.#toggleError(false);\n });\n createAutomaticallyButton.addEventListener(\"click\", async () => {\n const checked =\n createAutomaticallyButton.getAttribute(\"aria-pressed\") !== \"true\";\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.image.alt_text.ai_generation_check\",\n data: { status: checked },\n });\n\n if (this.#uiManager) {\n const isAltTextEnabled =\n await this.#uiManager.mlManager.isEnabledFor(\"altText\");\n this.#createAutomaticallyButton.disabled = true;\n if (checked && !isAltTextEnabled) {\n this.#textarea.value = \"\";\n this.#setProgress();\n this.#uiManager.setPreference(\"enableGuessAltText\", true);\n await this.#uiManager.mlManager.downloadModel(\"altText\");\n this.#setPref(\"enableAltTextModelDownload\", true);\n } else if (!checked && isAltTextEnabled) {\n this.#uiManager.setPreference(\"enableGuessAltText\", false);\n await this.#uiManager.mlManager.deleteModel(\"altText\");\n this.#setPref(\"enableAltTextModelDownload\", false);\n }\n this.#createAutomaticallyButton.disabled = false;\n await this.#uiManager.mlManager.toggleService(\"altText\", checked);\n }\n this.#toggleGuessAltText(checked, /* isInitial = */ false);\n });\n textarea.addEventListener(\"focus\", () => {\n this.#wasAILoading = this.#isAILoading;\n this.#toggleLoading(false);\n this.#toggleTitleAndDisclaimer();\n });\n textarea.addEventListener(\"blur\", () => {\n if (!textarea.value) {\n this.#toggleLoading(this.#wasAILoading);\n }\n this.#toggleTitleAndDisclaimer();\n });\n textarea.addEventListener(\"input\", () => {\n this.#toggleTitleAndDisclaimer();\n });\n textarea.addEventListener(\"keydown\", e => {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.key === \"Enter\" &&\n !saveButton.disabled\n ) {\n this.#save();\n }\n });\n\n eventBus._on(\"enableguessalttext\", ({ value }) => {\n this.#toggleGuessAltText(value, /* isInitial = */ false);\n });\n\n this.#overlayManager.register(dialog);\n\n this.#learnMore.addEventListener(\"click\", () => {\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.image.alt_text.info\",\n data: { topic: \"alt_text\" },\n });\n });\n }\n\n #setPref(name, value) {\n this.#eventBus.dispatch(\"setpreference\", {\n source: this,\n name,\n value,\n });\n }\n\n #toggleLoading(value) {\n if (!this.#uiManager || this.#isAILoading === value) {\n return;\n }\n this.#isAILoading = value;\n this.#descriptionContainer.classList.toggle(\"loading\", value);\n }\n\n #toggleError(value) {\n if (!this.#uiManager) {\n return;\n }\n this.#dialog.classList.toggle(\"error\", value);\n }\n\n async #toggleGuessAltText(value, isInitial) {\n if (!this.#uiManager) {\n return;\n }\n this.#dialog.classList.toggle(\"aiDisabled\", !value);\n this.#createAutomaticallyButton.setAttribute(\"aria-pressed\", value);\n\n if (value) {\n const { altTextLearnMoreUrl } = this.#uiManager.mlManager;\n if (altTextLearnMoreUrl) {\n this.#learnMore.href = altTextLearnMoreUrl;\n }\n this.#mlGuessAltText(isInitial);\n } else {\n this.#toggleLoading(false);\n this.#isAILoading = false;\n this.#toggleTitleAndDisclaimer();\n }\n }\n\n #toggleNotNow() {\n this.#notNowButton.classList.toggle(\"hidden\", !this.#firstTime);\n this.#cancelButton.classList.toggle(\"hidden\", this.#firstTime);\n }\n\n #toggleAI(value) {\n if (!this.#uiManager || this.#hasAI === value) {\n return;\n }\n this.#hasAI = value;\n this.#dialog.classList.toggle(\"noAi\", !value);\n this.#toggleTitleAndDisclaimer();\n }\n\n #toggleTitleAndDisclaimer() {\n // Disclaimer is visible when the AI is loading or the user didn't change\n // the guessed alt text.\n const visible =\n this.#isAILoading ||\n (this.#guessedAltText && this.#guessedAltText === this.#textarea.value);\n this.#disclaimer.hidden = !visible;\n\n // The title changes depending if the text area is empty or not.\n const isEditing = this.#isAILoading || !!this.#textarea.value;\n if (this.#isEditing === isEditing) {\n return;\n }\n this.#isEditing = isEditing;\n this.#title.setAttribute(\n \"data-l10n-id\",\n isEditing\n ? \"pdfjs-editor-new-alt-text-dialog-edit-label\"\n : \"pdfjs-editor-new-alt-text-dialog-add-label\"\n );\n }\n\n async #mlGuessAltText(isInitial) {\n if (this.#isAILoading) {\n // We're still loading the previous guess.\n return;\n }\n\n if (this.#textarea.value) {\n // The user has already set an alt text.\n return;\n }\n\n if (isInitial && this.#previousAltText !== null) {\n // The user has already set an alt text (empty or not).\n return;\n }\n\n this.#guessedAltText = this.#currentEditor.guessedAltText;\n if (this.#previousAltText === null && this.#guessedAltText) {\n // We have a guessed alt text and the user didn't change it.\n this.#addAltText(this.#guessedAltText);\n return;\n }\n\n this.#toggleLoading(true);\n this.#toggleTitleAndDisclaimer();\n\n let hasError = false;\n try {\n // When calling #mlGuessAltText we don't wait for it, so we must take care\n // that the alt text dialog can have been closed before the response is.\n\n const altText = await this.#currentEditor.mlGuessAltText(\n this.#imageData,\n /* updateAltTextData = */ false\n );\n if (altText) {\n this.#guessedAltText = altText;\n this.#wasAILoading = this.#isAILoading;\n if (this.#isAILoading) {\n this.#addAltText(altText);\n }\n }\n } catch (e) {\n console.error(e);\n hasError = true;\n }\n\n this.#toggleLoading(false);\n this.#toggleTitleAndDisclaimer();\n\n if (hasError && this.#uiManager) {\n this.#toggleError(true);\n }\n }\n\n #addAltText(altText) {\n if (!this.#uiManager || this.#textarea.value) {\n return;\n }\n this.#textarea.value = altText;\n this.#toggleTitleAndDisclaimer();\n }\n\n #setProgress() {\n // Show the download model progress.\n this.#downloadModel.classList.toggle(\"hidden\", false);\n\n const callback = async ({ detail: { finished, total, totalLoaded } }) => {\n const ONE_MEGA_BYTES = 1e6;\n // totalLoaded can be greater than total if the download is compressed.\n // So we cheat to avoid any confusion.\n totalLoaded = Math.min(0.99 * total, totalLoaded);\n\n // Update the progress.\n const totalSize = (this.#downloadModelDescription.ariaValueMax =\n Math.round(total / ONE_MEGA_BYTES));\n const downloadedSize = (this.#downloadModelDescription.ariaValueNow =\n Math.round(totalLoaded / ONE_MEGA_BYTES));\n this.#downloadModelDescription.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({ totalSize, downloadedSize })\n );\n if (!finished) {\n return;\n }\n\n // We're done, remove the listener and hide the download model progress.\n this.#eventBus._off(\"loadaiengineprogress\", callback);\n this.#downloadModel.classList.toggle(\"hidden\", true);\n\n this.#toggleAI(true);\n if (!this.#uiManager) {\n return;\n }\n const { mlManager } = this.#uiManager;\n\n // The model has been downloaded, we can now enable the AI service.\n mlManager.toggleService(\"altText\", true);\n this.#toggleGuessAltText(\n await mlManager.isEnabledFor(\"altText\"),\n /* isInitial = */ true\n );\n };\n this.#eventBus._on(\"loadaiengineprogress\", callback);\n }\n\n async editAltText(uiManager, editor, firstTime) {\n if (this.#currentEditor || !editor) {\n return;\n }\n\n if (firstTime && editor.hasAltTextData()) {\n editor.altTextFinish();\n return;\n }\n\n this.#firstTime = firstTime;\n const { mlManager } = uiManager;\n const hasAI = !!mlManager;\n this.#toggleTitleAndDisclaimer();\n\n if (mlManager && !mlManager.isReady(\"altText\")) {\n if (mlManager.hasProgress) {\n this.#setProgress();\n } else {\n this.#createAutomaticallyButton.setAttribute(\"aria-pressed\", false);\n }\n } else {\n this.#downloadModel.classList.toggle(\"hidden\", true);\n }\n\n const isAltTextEnabledPromise = mlManager?.isEnabledFor(\"altText\");\n\n this.#currentEditor = editor;\n this.#uiManager = uiManager;\n this.#uiManager.removeEditListeners();\n\n ({ altText: this.#previousAltText } = editor.altTextData);\n this.#textarea.value = this.#previousAltText ?? \"\";\n\n // TODO: get this value from Firefox\n // (https://bugzilla.mozilla.org/show_bug.cgi?id=1908184)\n const AI_MAX_IMAGE_DIMENSION = 224;\n const MAX_PREVIEW_DIMENSION = 180;\n\n // The max dimension of the preview in the dialog is 180px, so we keep 224px\n // and rescale it thanks to css.\n\n let canvas, width, height;\n if (mlManager) {\n ({\n canvas,\n width,\n height,\n imageData: this.#imageData,\n } = editor.copyCanvas(\n AI_MAX_IMAGE_DIMENSION,\n MAX_PREVIEW_DIMENSION,\n /* createImageData = */ true\n ));\n if (hasAI) {\n this.#toggleGuessAltText(\n await isAltTextEnabledPromise,\n /* isInitial = */ true\n );\n }\n } else {\n ({ canvas, width, height } = editor.copyCanvas(\n AI_MAX_IMAGE_DIMENSION,\n MAX_PREVIEW_DIMENSION,\n /* createImageData = */ false\n ));\n }\n\n canvas.setAttribute(\"role\", \"presentation\");\n const { style } = canvas;\n style.width = `${width}px`;\n style.height = `${height}px`;\n this.#imagePreview.append(canvas);\n\n this.#toggleNotNow();\n this.#toggleAI(hasAI);\n this.#toggleError(false);\n\n try {\n await this.#overlayManager.open(this.#dialog);\n } catch (ex) {\n this.#close();\n throw ex;\n }\n }\n\n #cancel() {\n this.#currentEditor.altTextData = {\n cancel: true,\n };\n const altText = this.#textarea.value.trim();\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.image.alt_text.dismiss\",\n data: {\n alt_text_type: altText ? \"present\" : \"empty\",\n flow: this.#firstTime ? \"image_add\" : \"alt_text_edit\",\n },\n });\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.image.image_added\",\n data: { alt_text_modal: true, alt_text_type: \"skipped\" },\n });\n this.#finish();\n }\n\n #finish() {\n this.#overlayManager.closeIfActive(this.#dialog);\n }\n\n #close() {\n const canvas = this.#imagePreview.firstElementChild;\n canvas.remove();\n canvas.width = canvas.height = 0;\n this.#imageData = null;\n\n this.#toggleLoading(false);\n\n this.#uiManager?.addEditListeners();\n this.#currentEditor.altTextFinish();\n this.#uiManager?.setSelected(this.#currentEditor);\n this.#currentEditor = null;\n this.#uiManager = null;\n }\n\n #extractWords(text) {\n return new Set(\n text\n .toLowerCase()\n .split(/[^\\p{L}\\p{N}]+/gu)\n .filter(x => !!x)\n );\n }\n\n #save() {\n const altText = this.#textarea.value.trim();\n this.#currentEditor.altTextData = {\n altText,\n decorative: false,\n };\n this.#currentEditor.altTextData.guessedAltText = this.#guessedAltText;\n\n if (this.#guessedAltText && this.#guessedAltText !== altText) {\n const guessedWords = this.#extractWords(this.#guessedAltText);\n const words = this.#extractWords(altText);\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.image.alt_text.user_edit\",\n data: {\n total_words: guessedWords.size,\n words_removed: guessedWords.difference(words).size,\n words_added: words.difference(guessedWords).size,\n },\n });\n }\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.image.image_added\",\n data: {\n alt_text_modal: true,\n alt_text_type: altText ? \"present\" : \"empty\",\n },\n });\n\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.image.alt_text.save\",\n data: {\n alt_text_type: altText ? \"present\" : \"empty\",\n flow: this.#firstTime ? \"image_add\" : \"alt_text_edit\",\n },\n });\n\n this.#finish();\n }\n\n destroy() {\n this.#uiManager = null; // Avoid re-adding the edit listeners.\n this.#finish();\n }\n}\n\nclass ImageAltTextSettings {\n #createModelButton;\n\n #dialog;\n\n #eventBus;\n\n #mlManager;\n\n #overlayManager;\n\n #showAltTextDialogButton;\n\n constructor(\n {\n dialog,\n createModelButton,\n learnMore,\n closeButton,\n showAltTextDialogButton,\n },\n overlayManager,\n eventBus,\n mlManager\n ) {\n this.#dialog = dialog;\n this.#createModelButton = createModelButton;\n this.#showAltTextDialogButton = showAltTextDialogButton;\n this.#overlayManager = overlayManager;\n this.#eventBus = eventBus;\n this.#mlManager = mlManager;\n\n const { altTextLearnMoreUrl } = mlManager;\n if (altTextLearnMoreUrl) {\n learnMore.href = altTextLearnMoreUrl;\n }\n\n dialog.addEventListener(\"contextmenu\", noContextMenu);\n\n createModelButton.addEventListener(\"click\", async e => {\n const checked = this.#togglePref(\"enableGuessAltText\", e);\n await (checked ? this.#download(true) : this.#delete(true));\n await mlManager.toggleService(\"altText\", checked);\n this.#reportTelemetry({\n type: \"stamp\",\n action: \"pdfjs.image.alt_text.settings_ai_generation_check\",\n data: { status: checked },\n });\n });\n\n showAltTextDialogButton.addEventListener(\"click\", e => {\n const checked = this.#togglePref(\"enableNewAltTextWhenAddingImage\", e);\n this.#reportTelemetry({\n type: \"stamp\",\n action: \"pdfjs.image.alt_text.settings_edit_alt_text_check\",\n data: { status: checked },\n });\n });\n\n closeButton.addEventListener(\"click\", this.#finish.bind(this));\n\n learnMore.addEventListener(\"click\", () => {\n this.#reportTelemetry({\n type: \"stamp\",\n action: \"pdfjs.image.alt_text.info\",\n data: { topic: \"ai_generation\" },\n });\n });\n\n eventBus._on(\"enablealttextmodeldownload\", ({ value }) => {\n if (value) {\n this.#download(false);\n } else {\n this.#delete(false);\n }\n });\n\n this.#overlayManager.register(dialog);\n }\n\n #reportTelemetry(data) {\n this.#eventBus.dispatch(\"reporttelemetry\", {\n source: this,\n details: {\n type: \"editing\",\n data,\n },\n });\n }\n\n async #download(isFromUI = false) {\n if (isFromUI) {\n await this.#mlManager.downloadModel(\"altText\");\n\n this.#setPref(\"enableGuessAltText\", true);\n this.#mlManager.toggleService(\"altText\", true);\n this.#setPref(\"enableAltTextModelDownload\", true);\n }\n }\n\n async #delete(isFromUI = false) {\n if (isFromUI) {\n await this.#mlManager.deleteModel(\"altText\");\n this.#setPref(\"enableGuessAltText\", false);\n this.#setPref(\"enableAltTextModelDownload\", false);\n }\n\n this.#createModelButton.setAttribute(\"aria-pressed\", false);\n }\n\n async open({ enableGuessAltText, enableNewAltTextWhenAddingImage }) {\n const { enableAltTextModelDownload } = this.#mlManager;\n this.#createModelButton.setAttribute(\n \"aria-pressed\",\n enableAltTextModelDownload && enableGuessAltText\n );\n this.#showAltTextDialogButton.setAttribute(\n \"aria-pressed\",\n enableNewAltTextWhenAddingImage\n );\n\n await this.#overlayManager.open(this.#dialog);\n this.#reportTelemetry({\n type: \"stamp\",\n action: \"pdfjs.image.alt_text.settings_displayed\",\n });\n }\n\n #togglePref(name, { target }) {\n const checked = target.getAttribute(\"aria-pressed\") !== \"true\";\n this.#setPref(name, checked);\n target.setAttribute(\"aria-pressed\", checked);\n return checked;\n }\n\n #setPref(name, value) {\n this.#eventBus.dispatch(\"setpreference\", {\n source: this,\n name,\n value,\n });\n }\n\n #finish() {\n this.#overlayManager.closeIfActive(this.#dialog);\n }\n}\n\nexport { ImageAltTextSettings, NewAltTextManager };\n","/* Copyright 2023 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 { DOMSVGFactory } from \"pdfjs-lib\";\n\nclass AltTextManager {\n #clickAC = null;\n\n #currentEditor = null;\n\n #cancelButton;\n\n #dialog;\n\n #eventBus;\n\n #hasUsedPointer = false;\n\n #optionDescription;\n\n #optionDecorative;\n\n #overlayManager;\n\n #saveButton;\n\n #textarea;\n\n #uiManager;\n\n #previousAltText = null;\n\n #resizeAC = null;\n\n #svgElement = null;\n\n #rectElement = null;\n\n #container;\n\n #telemetryData = null;\n\n constructor(\n {\n dialog,\n optionDescription,\n optionDecorative,\n textarea,\n cancelButton,\n saveButton,\n },\n container,\n overlayManager,\n eventBus\n ) {\n this.#dialog = dialog;\n this.#optionDescription = optionDescription;\n this.#optionDecorative = optionDecorative;\n this.#textarea = textarea;\n this.#cancelButton = cancelButton;\n this.#saveButton = saveButton;\n this.#overlayManager = overlayManager;\n this.#eventBus = eventBus;\n this.#container = container;\n\n const onUpdateUIState = this.#updateUIState.bind(this);\n\n dialog.addEventListener(\"close\", this.#close.bind(this));\n dialog.addEventListener(\"contextmenu\", event => {\n if (event.target !== this.#textarea) {\n event.preventDefault();\n }\n });\n cancelButton.addEventListener(\"click\", this.#finish.bind(this));\n saveButton.addEventListener(\"click\", this.#save.bind(this));\n optionDescription.addEventListener(\"change\", onUpdateUIState);\n optionDecorative.addEventListener(\"change\", onUpdateUIState);\n textarea.addEventListener(\"keydown\", e => {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.key === \"Enter\" &&\n !saveButton.disabled\n ) {\n this.#save();\n }\n });\n\n this.#overlayManager.register(dialog);\n }\n\n #createSVGElement() {\n if (this.#svgElement) {\n return;\n }\n\n // We create a mask to add to the dialog backdrop: the idea is to have a\n // darken background everywhere except on the editor to clearly see the\n // picture to describe.\n\n const svgFactory = new DOMSVGFactory();\n const svg = (this.#svgElement = svgFactory.createElement(\"svg\"));\n svg.setAttribute(\"width\", \"0\");\n svg.setAttribute(\"height\", \"0\");\n const defs = svgFactory.createElement(\"defs\");\n svg.append(defs);\n const mask = svgFactory.createElement(\"mask\");\n defs.append(mask);\n mask.setAttribute(\"id\", \"alttext-manager-mask\");\n mask.setAttribute(\"maskContentUnits\", \"objectBoundingBox\");\n let rect = svgFactory.createElement(\"rect\");\n mask.append(rect);\n rect.setAttribute(\"fill\", \"white\");\n rect.setAttribute(\"width\", \"1\");\n rect.setAttribute(\"height\", \"1\");\n rect.setAttribute(\"x\", \"0\");\n rect.setAttribute(\"y\", \"0\");\n\n rect = this.#rectElement = svgFactory.createElement(\"rect\");\n mask.append(rect);\n rect.setAttribute(\"fill\", \"black\");\n this.#dialog.append(svg);\n }\n\n async editAltText(uiManager, editor) {\n if (this.#currentEditor || !editor) {\n return;\n }\n this.#createSVGElement();\n\n this.#hasUsedPointer = false;\n\n this.#clickAC = new AbortController();\n const clickOpts = { signal: this.#clickAC.signal },\n onClick = this.#onClick.bind(this);\n for (const element of [\n this.#optionDescription,\n this.#optionDecorative,\n this.#textarea,\n this.#saveButton,\n this.#cancelButton,\n ]) {\n element.addEventListener(\"click\", onClick, clickOpts);\n }\n\n const { altText, decorative } = editor.altTextData;\n if (decorative === true) {\n this.#optionDecorative.checked = true;\n this.#optionDescription.checked = false;\n } else {\n this.#optionDecorative.checked = false;\n this.#optionDescription.checked = true;\n }\n this.#previousAltText = this.#textarea.value = altText?.trim() || \"\";\n this.#updateUIState();\n\n this.#currentEditor = editor;\n this.#uiManager = uiManager;\n this.#uiManager.removeEditListeners();\n\n this.#resizeAC = new AbortController();\n this.#eventBus._on(\"resize\", this.#setPosition.bind(this), {\n signal: this.#resizeAC.signal,\n });\n\n try {\n await this.#overlayManager.open(this.#dialog);\n this.#setPosition();\n } catch (ex) {\n this.#close();\n throw ex;\n }\n }\n\n #setPosition() {\n if (!this.#currentEditor) {\n return;\n }\n const dialog = this.#dialog;\n const { style } = dialog;\n const {\n x: containerX,\n y: containerY,\n width: containerW,\n height: containerH,\n } = this.#container.getBoundingClientRect();\n const { innerWidth: windowW, innerHeight: windowH } = window;\n const { width: dialogW, height: dialogH } = dialog.getBoundingClientRect();\n const { x, y, width, height } = this.#currentEditor.getClientDimensions();\n const MARGIN = 10;\n const isLTR = this.#uiManager.direction === \"ltr\";\n\n const xs = Math.max(x, containerX);\n const xe = Math.min(x + width, containerX + containerW);\n const ys = Math.max(y, containerY);\n const ye = Math.min(y + height, containerY + containerH);\n this.#rectElement.setAttribute(\"width\", `${(xe - xs) / windowW}`);\n this.#rectElement.setAttribute(\"height\", `${(ye - ys) / windowH}`);\n this.#rectElement.setAttribute(\"x\", `${xs / windowW}`);\n this.#rectElement.setAttribute(\"y\", `${ys / windowH}`);\n\n let left = null;\n let top = Math.max(y, 0);\n top += Math.min(windowH - (top + dialogH), 0);\n\n if (isLTR) {\n // Prefer to position the dialog \"after\" (so on the right) the editor.\n if (x + width + MARGIN + dialogW < windowW) {\n left = x + width + MARGIN;\n } else if (x > dialogW + MARGIN) {\n left = x - dialogW - MARGIN;\n }\n } else if (x > dialogW + MARGIN) {\n left = x - dialogW - MARGIN;\n } else if (x + width + MARGIN + dialogW < windowW) {\n left = x + width + MARGIN;\n }\n\n if (left === null) {\n top = null;\n left = Math.max(x, 0);\n left += Math.min(windowW - (left + dialogW), 0);\n if (y > dialogH + MARGIN) {\n top = y - dialogH - MARGIN;\n } else if (y + height + MARGIN + dialogH < windowH) {\n top = y + height + MARGIN;\n }\n }\n\n if (top !== null) {\n dialog.classList.add(\"positioned\");\n if (isLTR) {\n style.left = `${left}px`;\n } else {\n style.right = `${windowW - left - dialogW}px`;\n }\n style.top = `${top}px`;\n } else {\n dialog.classList.remove(\"positioned\");\n style.left = \"\";\n style.top = \"\";\n }\n }\n\n #finish() {\n this.#overlayManager.closeIfActive(this.#dialog);\n }\n\n #close() {\n this.#currentEditor._reportTelemetry(\n this.#telemetryData || {\n action: \"alt_text_cancel\",\n alt_text_keyboard: !this.#hasUsedPointer,\n }\n );\n this.#telemetryData = null;\n\n this.#removeOnClickListeners();\n this.#uiManager?.addEditListeners();\n this.#resizeAC?.abort();\n this.#resizeAC = null;\n this.#currentEditor.altTextFinish();\n this.#currentEditor = null;\n this.#uiManager = null;\n }\n\n #updateUIState() {\n this.#textarea.disabled = this.#optionDecorative.checked;\n }\n\n #save() {\n const altText = this.#textarea.value.trim();\n const decorative = this.#optionDecorative.checked;\n this.#currentEditor.altTextData = {\n altText,\n decorative,\n };\n this.#telemetryData = {\n action: \"alt_text_save\",\n alt_text_description: !!altText,\n alt_text_edit:\n !!this.#previousAltText && this.#previousAltText !== altText,\n alt_text_decorative: decorative,\n alt_text_keyboard: !this.#hasUsedPointer,\n };\n this.#finish();\n }\n\n #onClick(evt) {\n if (evt.detail === 0) {\n return; // The keyboard was used.\n }\n this.#hasUsedPointer = true;\n this.#removeOnClickListeners();\n }\n\n #removeOnClickListeners() {\n this.#clickAC?.abort();\n this.#clickAC = null;\n }\n\n destroy() {\n this.#uiManager = null; // Avoid re-adding the edit listeners.\n this.#finish();\n this.#svgElement?.remove();\n this.#svgElement = this.#rectElement = null;\n }\n}\n\nexport { AltTextManager };\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(\"./event_utils.js\").EventBus} EventBus */\n\nimport { AnnotationEditorParamsType } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} AnnotationEditorParamsOptions\n * @property {HTMLInputElement} editorFreeTextFontSize\n * @property {HTMLInputElement} editorFreeTextColor\n * @property {HTMLInputElement} editorInkColor\n * @property {HTMLInputElement} editorInkThickness\n * @property {HTMLInputElement} editorInkOpacity\n * @property {HTMLButtonElement} editorStampAddImage\n * @property {HTMLInputElement} editorFreeHighlightThickness\n * @property {HTMLButtonElement} editorHighlightShowAll\n * @property {HTMLButtonElement} editorSignatureAddSignature\n */\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 /**\n * @param {AnnotationEditorParamsOptions} options\n */\n #bindListeners({\n editorFreeTextFontSize,\n editorFreeTextColor,\n editorInkColor,\n editorInkThickness,\n editorInkOpacity,\n editorStampAddImage,\n editorFreeHighlightThickness,\n editorHighlightShowAll,\n editorSignatureAddSignature,\n }) {\n const { eventBus } = this;\n\n const dispatchEvent = (typeStr, value) => {\n eventBus.dispatch(\"switchannotationeditorparams\", {\n source: this,\n type: AnnotationEditorParamsType[typeStr],\n value,\n });\n };\n editorFreeTextFontSize.addEventListener(\"input\", function () {\n dispatchEvent(\"FREETEXT_SIZE\", this.valueAsNumber);\n });\n editorFreeTextColor.addEventListener(\"input\", function () {\n dispatchEvent(\"FREETEXT_COLOR\", this.value);\n });\n editorInkColor.addEventListener(\"input\", function () {\n dispatchEvent(\"INK_COLOR\", this.value);\n });\n editorInkThickness.addEventListener(\"input\", function () {\n dispatchEvent(\"INK_THICKNESS\", this.valueAsNumber);\n });\n editorInkOpacity.addEventListener(\"input\", function () {\n dispatchEvent(\"INK_OPACITY\", this.valueAsNumber);\n });\n editorStampAddImage.addEventListener(\"click\", () => {\n eventBus.dispatch(\"reporttelemetry\", {\n source: this,\n details: {\n type: \"editing\",\n data: { action: \"pdfjs.image.add_image_click\" },\n },\n });\n dispatchEvent(\"CREATE\");\n });\n editorFreeHighlightThickness.addEventListener(\"input\", function () {\n dispatchEvent(\"HIGHLIGHT_THICKNESS\", this.valueAsNumber);\n });\n editorHighlightShowAll.addEventListener(\"click\", function () {\n const checked = this.getAttribute(\"aria-pressed\") === \"true\";\n this.setAttribute(\"aria-pressed\", !checked);\n dispatchEvent(\"HIGHLIGHT_SHOW_ALL\", !checked);\n });\n editorSignatureAddSignature.addEventListener(\"click\", () => {\n dispatchEvent(\"CREATE\");\n });\n\n 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 case AnnotationEditorParamsType.HIGHLIGHT_COLOR:\n eventBus.dispatch(\"mainhighlightcolorpickerupdatecolor\", {\n source: this,\n value,\n });\n break;\n case AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:\n editorFreeHighlightThickness.value = value;\n break;\n case AnnotationEditorParamsType.HIGHLIGHT_FREE:\n editorFreeHighlightThickness.disabled = !value;\n break;\n case AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:\n editorHighlightShowAll.setAttribute(\"aria-pressed\", value);\n break;\n }\n }\n });\n }\n}\n\nexport { AnnotationEditorParams };\n","/* Copyright 2024 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// Used to compare floats: there is no exact equality due to rounding errors.\nconst PRECISION = 1e-1;\n\nclass CaretBrowsingMode {\n #mainContainer;\n\n #toolBarHeight = 0;\n\n #viewerContainer;\n\n constructor(abortSignal, mainContainer, viewerContainer, toolbarContainer) {\n this.#mainContainer = mainContainer;\n this.#viewerContainer = viewerContainer;\n\n if (!toolbarContainer) {\n return;\n }\n this.#toolBarHeight = toolbarContainer.getBoundingClientRect().height;\n\n const toolbarObserver = new ResizeObserver(entries => {\n for (const entry of entries) {\n if (entry.target === toolbarContainer) {\n this.#toolBarHeight = Math.floor(entry.borderBoxSize[0].blockSize);\n break;\n }\n }\n });\n toolbarObserver.observe(toolbarContainer);\n\n abortSignal.addEventListener(\"abort\", () => toolbarObserver.disconnect(), {\n once: true,\n });\n }\n\n /**\n * Return true if the two rectangles are on the same line.\n * @param {DOMRect} rect1\n * @param {DOMRect} rect2\n * @returns {boolean}\n */\n #isOnSameLine(rect1, rect2) {\n const top1 = rect1.y;\n const bot1 = rect1.bottom;\n const mid1 = rect1.y + rect1.height / 2;\n\n const top2 = rect2.y;\n const bot2 = rect2.bottom;\n const mid2 = rect2.y + rect2.height / 2;\n\n return (top1 <= mid2 && mid2 <= bot1) || (top2 <= mid1 && mid1 <= bot2);\n }\n\n /**\n * Return `true` if the rectangle is:\n * - under the caret when `isUp === false`.\n * - over the caret when `isUp === true`.\n * @param {DOMRect} rect\n * @param {number} x\n * @param {number} y\n * @param {boolean} isUp\n * @returns {boolean}\n */\n #isUnderOver(rect, x, y, isUp) {\n const midY = rect.y + rect.height / 2;\n return (\n (isUp ? y >= midY : y <= midY) &&\n rect.x - PRECISION <= x &&\n x <= rect.right + PRECISION\n );\n }\n\n /**\n * Check if the rectangle is visible.\n * @param {DOMRect} rect\n * @returns {boolean}\n */\n #isVisible(rect) {\n return (\n rect.top >= this.#toolBarHeight &&\n rect.left >= 0 &&\n rect.bottom <=\n (window.innerHeight || document.documentElement.clientHeight) &&\n rect.right <= (window.innerWidth || document.documentElement.clientWidth)\n );\n }\n\n /**\n * Get the position of the caret.\n * @param {Selection} selection\n * @param {boolean} isUp\n * @returns {Array<number>}\n */\n #getCaretPosition(selection, isUp) {\n const { focusNode, focusOffset } = selection;\n const range = document.createRange();\n range.setStart(focusNode, focusOffset);\n range.setEnd(focusNode, focusOffset);\n const rect = range.getBoundingClientRect();\n\n return [rect.x, isUp ? rect.top : rect.bottom];\n }\n\n static #caretPositionFromPoint(x, y) {\n if (\n (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) &&\n !document.caretPositionFromPoint\n ) {\n const { startContainer: offsetNode, startOffset: offset } =\n document.caretRangeFromPoint(x, y);\n return { offsetNode, offset };\n }\n return document.caretPositionFromPoint(x, y);\n }\n\n #setCaretPositionHelper(selection, caretX, select, element, rect) {\n rect ||= element.getBoundingClientRect();\n if (caretX <= rect.x + PRECISION) {\n if (select) {\n selection.extend(element.firstChild, 0);\n } else {\n selection.setPosition(element.firstChild, 0);\n }\n return;\n }\n if (rect.right - PRECISION <= caretX) {\n const { lastChild } = element;\n if (select) {\n selection.extend(lastChild, lastChild.length);\n } else {\n selection.setPosition(lastChild, lastChild.length);\n }\n return;\n }\n\n const midY = rect.y + rect.height / 2;\n let caretPosition = CaretBrowsingMode.#caretPositionFromPoint(caretX, midY);\n let parentElement = caretPosition.offsetNode?.parentElement;\n if (parentElement && parentElement !== element) {\n // There is an element on top of the one in the text layer, so we\n // need to hide all the elements (except the one in the text layer)\n // at this position in order to get the correct caret position.\n const elementsAtPoint = document.elementsFromPoint(caretX, midY);\n const savedVisibilities = [];\n for (const el of elementsAtPoint) {\n if (el === element) {\n break;\n }\n const { style } = el;\n savedVisibilities.push([el, style.visibility]);\n style.visibility = \"hidden\";\n }\n caretPosition = CaretBrowsingMode.#caretPositionFromPoint(caretX, midY);\n parentElement = caretPosition.offsetNode?.parentElement;\n for (const [el, visibility] of savedVisibilities) {\n el.style.visibility = visibility;\n }\n }\n if (parentElement !== element) {\n // The element targeted by caretPositionFromPoint isn't in the text\n // layer.\n if (select) {\n selection.extend(element.firstChild, 0);\n } else {\n selection.setPosition(element.firstChild, 0);\n }\n return;\n }\n if (select) {\n selection.extend(caretPosition.offsetNode, caretPosition.offset);\n } else {\n selection.setPosition(caretPosition.offsetNode, caretPosition.offset);\n }\n }\n\n /**\n * Set the caret position or extend the selection (it depends on the select\n * parameter).\n * @param {boolean} select\n * @param {Selection} selection\n * @param {Element} newLineElement\n * @param {DOMRect} newLineElementRect\n * @param {number} caretX\n */\n #setCaretPosition(\n select,\n selection,\n newLineElement,\n newLineElementRect,\n caretX\n ) {\n if (this.#isVisible(newLineElementRect)) {\n this.#setCaretPositionHelper(\n selection,\n caretX,\n select,\n newLineElement,\n newLineElementRect\n );\n return;\n }\n this.#mainContainer.addEventListener(\n \"scrollend\",\n this.#setCaretPositionHelper.bind(\n this,\n selection,\n caretX,\n select,\n newLineElement,\n null\n ),\n { once: true }\n );\n newLineElement.scrollIntoView();\n }\n\n /**\n * Get the node on the next page.\n * @param {Element} textLayer\n * @param {boolean} isUp\n * @returns {Node}\n */\n #getNodeOnNextPage(textLayer, isUp) {\n while (true) {\n const page = textLayer.closest(\".page\");\n const pageNumber = parseInt(page.getAttribute(\"data-page-number\"));\n const nextPage = isUp ? pageNumber - 1 : pageNumber + 1;\n textLayer = this.#viewerContainer.querySelector(\n `.page[data-page-number=\"${nextPage}\"] .textLayer`\n );\n if (!textLayer) {\n return null;\n }\n const walker = document.createTreeWalker(textLayer, NodeFilter.SHOW_TEXT);\n const node = isUp ? walker.lastChild() : walker.firstChild();\n if (node) {\n return node;\n }\n }\n }\n\n /**\n * Move the caret in the given direction.\n * @param {boolean} isUp\n * @param {boolean} select\n */\n moveCaret(isUp, select) {\n const selection = document.getSelection();\n if (selection.rangeCount === 0) {\n return;\n }\n const { focusNode } = selection;\n const focusElement =\n focusNode.nodeType !== Node.ELEMENT_NODE\n ? focusNode.parentElement\n : focusNode;\n const root = focusElement.closest(\".textLayer\");\n if (!root) {\n return;\n }\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n walker.currentNode = focusNode;\n\n // Move to the next element which is not on the same line as the focus\n // element.\n const focusRect = focusElement.getBoundingClientRect();\n let newLineElement = null;\n const nodeIterator = (\n isUp ? walker.previousSibling : walker.nextSibling\n ).bind(walker);\n while (nodeIterator()) {\n const element = walker.currentNode.parentElement;\n if (!this.#isOnSameLine(focusRect, element.getBoundingClientRect())) {\n newLineElement = element;\n break;\n }\n }\n\n if (!newLineElement) {\n // Need to find the next line on the next page.\n const node = this.#getNodeOnNextPage(root, isUp);\n if (!node) {\n return;\n }\n if (select) {\n const lastNode =\n (isUp ? walker.firstChild() : walker.lastChild()) || focusNode;\n selection.extend(lastNode, isUp ? 0 : lastNode.length);\n const range = document.createRange();\n range.setStart(node, isUp ? node.length : 0);\n range.setEnd(node, isUp ? node.length : 0);\n selection.addRange(range);\n return;\n }\n const [caretX] = this.#getCaretPosition(selection, isUp);\n const { parentElement } = node;\n this.#setCaretPosition(\n select,\n selection,\n parentElement,\n parentElement.getBoundingClientRect(),\n caretX\n );\n return;\n }\n\n // We've a candidate for the next line now we want to find the first element\n // which is under/over the caret.\n const [caretX, caretY] = this.#getCaretPosition(selection, isUp);\n const newLineElementRect = newLineElement.getBoundingClientRect();\n\n // Maybe the element on the new line is a valid candidate.\n if (this.#isUnderOver(newLineElementRect, caretX, caretY, isUp)) {\n this.#setCaretPosition(\n select,\n selection,\n newLineElement,\n newLineElementRect,\n caretX\n );\n return;\n }\n\n while (nodeIterator()) {\n // Search an element on the same line as newLineElement\n // which could be under/over the caret.\n const element = walker.currentNode.parentElement;\n const elementRect = element.getBoundingClientRect();\n if (!this.#isOnSameLine(newLineElementRect, elementRect)) {\n break;\n }\n if (this.#isUnderOver(elementRect, caretX, caretY, isUp)) {\n // We found the element.\n this.#setCaretPosition(select, selection, element, elementRect, caretX);\n return;\n }\n }\n\n // No element has been found so just put the caret on the element on the new\n // line.\n this.#setCaretPosition(\n select,\n selection,\n newLineElement,\n newLineElementRect,\n caretX\n );\n }\n}\n\nexport { CaretBrowsingMode };\n","/* Copyright 2025 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 { noContextMenu, stopEvent } from \"pdfjs-lib\";\n\n// Timeout before ending resize operation.\nconst RESIZE_TIMEOUT = 400; // ms\n\n/**\n * Viewer control to display a sidebar with resizer functionality.\n */\nclass Sidebar {\n #initialWidth = 0;\n\n #width = 0;\n\n #coefficient;\n\n #resizeTimeout = null;\n\n #resizer;\n\n #isResizerOnTheLeft;\n\n #isKeyboardResizing = false;\n\n #resizeObserver;\n\n #prevX = 0;\n\n /**\n * @typedef {Object} SidebarElements\n * @property {HTMLElement} sidebar - The sidebar element.\n * @property {HTMLElement} resizer - The sidebar resizer element.\n * @property {HTMLElement} toggleButton - The button used to toggle the\n * sidebar.\n */\n\n /**\n * Create a sidebar with resizer functionality.\n * @param {SidebarElements} sidebarElements\n * @param {boolean} ltr\n * @param {boolean} isResizerOnTheLeft\n */\n constructor({ sidebar, resizer, toggleButton }, ltr, isResizerOnTheLeft) {\n this._sidebar = sidebar;\n this.#coefficient = ltr === isResizerOnTheLeft ? -1 : 1;\n this.#resizer = resizer;\n this.#isResizerOnTheLeft = isResizerOnTheLeft;\n\n const style = window.getComputedStyle(sidebar);\n this.#initialWidth = this.#width = parseFloat(\n style.getPropertyValue(\"--sidebar-width\")\n );\n resizer.ariaValueMin =\n parseFloat(style.getPropertyValue(\"--sidebar-min-width\")) || 0;\n resizer.ariaValueMax =\n parseFloat(style.getPropertyValue(\"--sidebar-max-width\")) || Infinity;\n resizer.ariaValueNow = this.#width;\n\n this.#makeSidebarResizable();\n toggleButton.addEventListener(\"click\", this.toggle.bind(this));\n this._isOpen = false;\n sidebar.hidden = true;\n\n this.#resizeObserver = new ResizeObserver(\n ([\n {\n borderBoxSize: [{ inlineSize }],\n },\n ]) => {\n if (!isNaN(this.#prevX)) {\n this.#prevX += this.#coefficient * (inlineSize - this.#width);\n }\n this.#setWidth(inlineSize);\n }\n );\n this.#resizeObserver.observe(sidebar);\n }\n\n #makeSidebarResizable() {\n const sidebarStyle = this._sidebar.style;\n let pointerMoveAC;\n const cancelResize = () => {\n this.#resizeTimeout = null;\n this._sidebar.classList.remove(\"resizing\");\n pointerMoveAC?.abort();\n pointerMoveAC = null;\n this.#isKeyboardResizing = false;\n this.onStopResizing();\n this.#prevX = NaN;\n };\n this.#resizer.addEventListener(\"pointerdown\", e => {\n if (pointerMoveAC) {\n cancelResize();\n return;\n }\n this.onStartResizing();\n const { clientX } = e;\n stopEvent(e);\n this.#prevX = clientX;\n pointerMoveAC = new AbortController();\n const { signal } = pointerMoveAC;\n const sidebar = this._sidebar;\n sidebar.classList.add(\"resizing\");\n const parentStyle = sidebar.parentElement.style;\n parentStyle.minWidth = 0;\n window.addEventListener(\"contextmenu\", noContextMenu, { signal });\n window.addEventListener(\n \"pointermove\",\n ev => {\n if (!pointerMoveAC || Math.abs(ev.clientX - this.#prevX) < 1) {\n return;\n }\n stopEvent(ev);\n sidebarStyle.width = `${Math.round(this.#width + this.#coefficient * (ev.clientX - this.#prevX))}px`;\n },\n { signal, capture: true }\n );\n window.addEventListener(\"blur\", cancelResize, { signal });\n window.addEventListener(\n \"pointerup\",\n ev => {\n if (pointerMoveAC) {\n cancelResize();\n stopEvent(ev);\n }\n },\n { signal }\n );\n });\n this.#resizer.addEventListener(\"keydown\", e => {\n const { key } = e;\n const isArrowLeft = key === \"ArrowLeft\";\n if (isArrowLeft || key === \"ArrowRight\") {\n if (!this.#isKeyboardResizing) {\n this._sidebar.classList.add(\"resizing\");\n this.#isKeyboardResizing = true;\n this.onStartResizing();\n }\n\n const base = e.ctrlKey || e.metaKey ? 10 : 1;\n const dx = base * (isArrowLeft ? -1 : 1);\n clearTimeout(this.#resizeTimeout);\n this.#resizeTimeout = setTimeout(cancelResize, RESIZE_TIMEOUT);\n sidebarStyle.width = `${Math.round(this.#width + this.#coefficient * dx)}px`;\n stopEvent(e);\n }\n });\n }\n\n #setWidth(newWidth) {\n this.#width = newWidth;\n this.#resizer.ariaValueNow = Math.round(newWidth);\n if (this.#isResizerOnTheLeft) {\n this._sidebar.parentElement.style.insetInlineStart = `${(this.#initialWidth - newWidth).toFixed(3)}px`;\n }\n this.onResizing(newWidth);\n }\n\n /**\n * Get the current width of the sidebar in pixels.\n * @returns {number}\n */\n get width() {\n return this.#width;\n }\n\n /**\n * Set the width of the sidebar in pixels.\n * @param {number} newWidth\n */\n set width(newWidth) {\n this._sidebar.style.width = `${newWidth}px`;\n }\n\n /**\n * Callback to be executed when the user starts resizing the sidebar.\n */\n onStartResizing() {}\n\n /**\n * Callback to be executed when the user stops resizing the sidebar.\n */\n onStopResizing() {}\n\n /**\n * Callback to be executed when the sidebar is being resized.\n * @param {number} newWidth - The new width of the sidebar in pixels.\n */\n onResizing(_newWidth) {}\n\n /**\n * Toggle the sidebar's visibility.\n * @param {boolean} [visibility] - The visibility state to set.\n */\n toggle(visibility = !this._isOpen) {\n this._sidebar.hidden = !(this._isOpen = visibility);\n }\n\n destroy() {\n this.#resizeObserver?.disconnect();\n this.#resizeObserver = null;\n }\n}\n\nexport { Sidebar };\n","/* Copyright 2025 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 AnnotationEditorType,\n applyOpacity,\n CSSConstants,\n findContrastColor,\n MathClamp,\n noContextMenu,\n PDFDateString,\n renderRichText,\n shadow,\n stopEvent,\n Util,\n} from \"pdfjs-lib\";\nimport { binarySearchFirstItem } from \"./ui_utils.js\";\nimport { Sidebar } from \"./sidebar.js\";\n\nclass CommentManager {\n #dialog;\n\n #popup;\n\n #sidebar;\n\n static #hasForcedColors = null;\n\n constructor(\n commentDialog,\n sidebar,\n eventBus,\n linkService,\n overlayManager,\n ltr,\n hasForcedColors\n ) {\n const dateFormat = new Intl.DateTimeFormat(undefined, {\n dateStyle: \"long\",\n });\n this.dialogElement = commentDialog.dialog;\n this.#dialog = new CommentDialog(\n commentDialog,\n overlayManager,\n eventBus,\n ltr\n );\n this.#popup = new CommentPopup(\n eventBus,\n dateFormat,\n ltr,\n this.dialogElement\n );\n this.#sidebar = new CommentSidebar(\n sidebar,\n eventBus,\n linkService,\n this.#popup,\n dateFormat,\n ltr\n );\n this.#popup.sidebar = this.#sidebar;\n CommentManager.#hasForcedColors = hasForcedColors;\n }\n\n setSidebarUiManager(uiManager) {\n this.#sidebar.setUIManager(uiManager);\n }\n\n showSidebar(annotations) {\n this.#sidebar.show(annotations);\n }\n\n hideSidebar() {\n this.#sidebar.hide();\n }\n\n removeComments(ids) {\n this.#sidebar.removeComments(ids);\n }\n\n selectComment(id) {\n this.#sidebar.selectComment(null, id);\n }\n\n addComment(annotation) {\n this.#sidebar.addComment(annotation);\n }\n\n updateComment(annotation) {\n this.#sidebar.updateComment(annotation);\n }\n\n toggleCommentPopup(editor, isSelected, visibility, isEditable) {\n if (isSelected) {\n this.selectComment(editor.uid);\n }\n this.#popup.toggle(editor, isSelected, visibility, isEditable);\n }\n\n destroyPopup() {\n this.#popup.destroy();\n }\n\n updatePopupColor(editor) {\n this.#popup.updateColor(editor);\n }\n\n showDialog(uiManager, editor, posX, posY, options) {\n return this.#dialog.open(uiManager, editor, posX, posY, options);\n }\n\n makeCommentColor(color, opacity) {\n return CommentManager._makeCommentColor(color, opacity);\n }\n\n static _makeCommentColor(color, opacity) {\n return this.#hasForcedColors\n ? null\n : findContrastColor(\n applyOpacity(...color, opacity ?? 1),\n CSSConstants.commentForegroundColor\n );\n }\n\n destroy() {\n this.#dialog.destroy();\n this.#sidebar.hide();\n this.#popup.destroy();\n }\n}\n\nclass CommentSidebar extends Sidebar {\n #annotations = null;\n\n #eventBus;\n\n #boundCommentClick = this.#commentClick.bind(this);\n\n #boundCommentKeydown = this.#commentKeydown.bind(this);\n\n #closeButton;\n\n #commentsList;\n\n #commentCount;\n\n #dateFormat;\n\n #sidebarTitle;\n\n #learnMoreUrl;\n\n #linkService;\n\n #popup;\n\n #elementsToAnnotations = null;\n\n #idsToElements = null;\n\n #uiManager = null;\n\n constructor(\n {\n learnMoreUrl,\n sidebar,\n sidebarResizer,\n commentsList,\n commentCount,\n sidebarTitle,\n closeButton,\n commentToolbarButton,\n },\n eventBus,\n linkService,\n popup,\n dateFormat,\n ltr\n ) {\n super(\n { sidebar, resizer: sidebarResizer, toggleButton: commentToolbarButton },\n ltr,\n /* isResizerOnTheLeft = */ true\n );\n this.#sidebarTitle = sidebarTitle;\n this.#commentsList = commentsList;\n this.#commentCount = commentCount;\n this.#learnMoreUrl = learnMoreUrl;\n this.#linkService = linkService;\n this.#closeButton = closeButton;\n this.#popup = popup;\n this.#dateFormat = dateFormat;\n this.#eventBus = eventBus;\n\n closeButton.addEventListener(\"click\", () => {\n eventBus.dispatch(\"switchannotationeditormode\", {\n source: this,\n mode: AnnotationEditorType.NONE,\n });\n });\n const keyDownCallback = e => {\n if (e.key === \"ArrowDown\" || e.key === \"Home\" || e.key === \"F6\") {\n this.#commentsList.firstElementChild.focus();\n stopEvent(e);\n } else if (e.key === \"ArrowUp\" || e.key === \"End\") {\n this.#commentsList.lastElementChild.focus();\n stopEvent(e);\n }\n };\n commentToolbarButton.addEventListener(\"keydown\", keyDownCallback);\n sidebar.addEventListener(\"keydown\", keyDownCallback);\n }\n\n setUIManager(uiManager) {\n this.#uiManager = uiManager;\n }\n\n show(annotations) {\n this.#elementsToAnnotations = new WeakMap();\n this.#idsToElements = new Map();\n this.#annotations = annotations;\n annotations.sort(this.#sortComments.bind(this));\n if (annotations.length !== 0) {\n const fragment = document.createDocumentFragment();\n for (const annotation of annotations) {\n fragment.append(this.#createCommentElement(annotation));\n }\n\n this.#setCommentsCount(fragment);\n this.#commentsList.append(fragment);\n } else {\n this.#setCommentsCount();\n }\n this._sidebar.hidden = false;\n this.#eventBus.dispatch(\"reporttelemetry\", {\n source: this,\n details: {\n type: \"commentSidebar\",\n data: { numberOfAnnotations: annotations.length },\n },\n });\n }\n\n hide() {\n this._sidebar.hidden = true;\n this.#commentsList.replaceChildren();\n this.#elementsToAnnotations = null;\n this.#idsToElements = null;\n this.#annotations = null;\n }\n\n removeComments(ids) {\n if (ids.length === 0 || !this.#idsToElements) {\n return;\n }\n if (\n new Set(this.#idsToElements.keys()).difference(new Set(ids)).size === 0\n ) {\n this.#removeAll();\n return;\n }\n for (const id of ids) {\n this.#removeComment(id);\n }\n }\n\n focusComment(id) {\n const element = this.#idsToElements.get(id);\n if (!element) {\n return;\n }\n this._sidebar.scrollTop = element.offsetTop - this._sidebar.offsetTop;\n for (const el of this.#commentsList.children) {\n el.classList.toggle(\"selected\", el === element);\n }\n }\n\n updateComment(annotation) {\n if (!this.#idsToElements) {\n return;\n }\n const {\n id,\n creationDate,\n modificationDate,\n richText,\n contentsObj,\n popupRef,\n } = annotation;\n\n if (!popupRef || (!richText && !contentsObj?.str)) {\n this.#removeComment(id);\n }\n\n const element = this.#idsToElements.get(id);\n if (!element) {\n return;\n }\n const prevAnnotation = this.#elementsToAnnotations.get(element);\n let index = binarySearchFirstItem(\n this.#annotations,\n a => this.#sortComments(a, prevAnnotation) >= 0\n );\n if (index >= this.#annotations.length) {\n return;\n }\n\n this.#setDate(element.firstElementChild, modificationDate || creationDate);\n this.#setText(element.lastElementChild, richText, contentsObj);\n\n this.#annotations.splice(index, 1);\n index = binarySearchFirstItem(\n this.#annotations,\n a => this.#sortComments(a, annotation) >= 0\n );\n this.#annotations.splice(index, 0, annotation);\n if (index >= this.#commentsList.children.length) {\n this.#commentsList.append(element);\n } else {\n this.#commentsList.insertBefore(\n element,\n this.#commentsList.children[index]\n );\n }\n }\n\n #removeComment(id) {\n const element = this.#idsToElements?.get(id);\n if (!element) {\n return;\n }\n const annotation = this.#elementsToAnnotations.get(element);\n const index = binarySearchFirstItem(\n this.#annotations,\n a => this.#sortComments(a, annotation) >= 0\n );\n if (index >= this.#annotations.length) {\n return;\n }\n this.#annotations.splice(index, 1);\n element.remove();\n this.#idsToElements.delete(id);\n this.#setCommentsCount();\n }\n\n #removeAll() {\n this.#commentsList.replaceChildren();\n this.#elementsToAnnotations = new WeakMap();\n this.#idsToElements.clear();\n this.#annotations.length = 0;\n this.#setCommentsCount();\n }\n\n selectComment(element, id = null) {\n if (!this.#idsToElements) {\n return;\n }\n const hasNoElement = !element;\n element ||= this.#idsToElements.get(id);\n for (const el of this.#commentsList.children) {\n el.classList.toggle(\"selected\", el === element);\n }\n if (hasNoElement) {\n element?.scrollIntoView({ behavior: \"instant\", block: \"center\" });\n }\n }\n\n addComment(annotation) {\n if (this.#idsToElements?.has(annotation.id)) {\n return;\n }\n const { popupRef, contentsObj } = annotation;\n if (!popupRef || !contentsObj?.str) {\n return;\n }\n const commentItem = this.#createCommentElement(annotation);\n if (this.#annotations.length === 0) {\n this.#commentsList.replaceChildren(commentItem);\n this.#annotations.push(annotation);\n this.#setCommentsCount();\n return;\n }\n const index = binarySearchFirstItem(\n this.#annotations,\n a => this.#sortComments(a, annotation) >= 0\n );\n this.#annotations.splice(index, 0, annotation);\n if (index >= this.#commentsList.children.length) {\n this.#commentsList.append(commentItem);\n } else {\n this.#commentsList.insertBefore(\n commentItem,\n this.#commentsList.children[index]\n );\n }\n this.#setCommentsCount();\n }\n\n #setCommentsCount(container = this.#commentsList) {\n const count = this.#idsToElements.size;\n this.#sidebarTitle.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({ count })\n );\n this.#commentCount.textContent = count;\n if (count === 0) {\n container.append(this.#createZeroCommentElement());\n }\n }\n\n #createZeroCommentElement() {\n const commentItem = document.createElement(\"li\");\n commentItem.classList.add(\"sidebarComment\", \"noComments\");\n const textDiv = document.createElement(\"div\");\n textDiv.className = \"sidebarCommentText\";\n textDiv.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-comments-sidebar-no-comments1\"\n );\n commentItem.append(textDiv);\n if (this.#learnMoreUrl) {\n const a = document.createElement(\"a\");\n a.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-comments-sidebar-no-comments-link\"\n );\n a.href = this.#learnMoreUrl;\n a.target = \"_blank\";\n a.rel = \"noopener noreferrer\";\n commentItem.append(a);\n }\n return commentItem;\n }\n\n #setDate(element, date) {\n date = PDFDateString.toDateObject(date);\n element.dateTime = date.toISOString();\n element.textContent = this.#dateFormat.format(date);\n }\n\n #setText(element, richText, contentsObj) {\n element.replaceChildren();\n const html =\n richText?.str && (!contentsObj?.str || richText.str === contentsObj.str)\n ? richText.html\n : contentsObj?.str;\n renderRichText(\n {\n html,\n dir: contentsObj?.dir || \"auto\",\n className: \"richText\",\n },\n element\n );\n }\n\n #createCommentElement(annotation) {\n const {\n id,\n creationDate,\n modificationDate,\n richText,\n contentsObj,\n color,\n opacity,\n } = annotation;\n const commentItem = document.createElement(\"li\");\n commentItem.role = \"button\";\n commentItem.className = \"sidebarComment\";\n commentItem.tabIndex = -1;\n commentItem.style.backgroundColor =\n (color && CommentManager._makeCommentColor(color, opacity)) || \"\";\n const dateDiv = document.createElement(\"time\");\n this.#setDate(dateDiv, modificationDate || creationDate);\n\n const textDiv = document.createElement(\"div\");\n textDiv.className = \"sidebarCommentText\";\n this.#setText(textDiv, richText, contentsObj);\n\n commentItem.append(dateDiv, textDiv);\n commentItem.addEventListener(\"click\", this.#boundCommentClick);\n commentItem.addEventListener(\"keydown\", this.#boundCommentKeydown);\n\n this.#elementsToAnnotations.set(commentItem, annotation);\n this.#idsToElements.set(id, commentItem);\n return commentItem;\n }\n\n async #commentClick({ currentTarget }) {\n if (currentTarget.classList.contains(\"selected\")) {\n currentTarget.classList.remove(\"selected\");\n this.#popup._hide();\n return;\n }\n const annotation = this.#elementsToAnnotations.get(currentTarget);\n if (!annotation) {\n return;\n }\n this.#popup._hide();\n const { id, pageIndex, rect } = annotation;\n const pageNumber = pageIndex + 1;\n const pageVisiblePromise =\n this.#uiManager?.waitForEditorsRendered(pageNumber);\n this.#linkService?.goToXY(pageNumber, rect[0], rect[3], {\n center: \"both\",\n });\n this.selectComment(currentTarget);\n await pageVisiblePromise;\n this.#uiManager?.selectComment(pageIndex, id);\n }\n\n #commentKeydown(e) {\n const { key, currentTarget } = e;\n switch (key) {\n case \"ArrowDown\":\n (\n currentTarget.nextElementSibling ||\n this.#commentsList.firstElementChild\n ).focus();\n stopEvent(e);\n break;\n case \"ArrowUp\":\n (\n currentTarget.previousElementSibling ||\n this.#commentsList.lastElementChild\n ).focus();\n stopEvent(e);\n break;\n case \"Home\":\n this.#commentsList.firstElementChild.focus();\n stopEvent(e);\n break;\n case \"End\":\n this.#commentsList.lastElementChild.focus();\n stopEvent(e);\n break;\n case \"Enter\":\n case \" \":\n this.#commentClick(e);\n stopEvent(e);\n break;\n case \"ShiftTab\":\n this.#closeButton.focus();\n stopEvent(e);\n break;\n }\n }\n\n #sortComments(a, b) {\n const dateA = PDFDateString.toDateObject(\n a.modificationDate || a.creationDate\n );\n const dateB = PDFDateString.toDateObject(\n b.modificationDate || b.creationDate\n );\n if (dateA !== dateB) {\n if (dateA !== null && dateB !== null) {\n return dateB - dateA;\n }\n return dateA !== null ? -1 : 1;\n }\n if (a.pageIndex !== b.pageIndex) {\n return a.pageIndex - b.pageIndex;\n }\n if (a.rect[3] !== b.rect[3]) {\n return b.rect[3] - a.rect[3];\n }\n if (a.rect[0] !== b.rect[0]) {\n return a.rect[0] - b.rect[0];\n }\n if (a.rect[1] !== b.rect[1]) {\n return b.rect[1] - a.rect[1];\n }\n if (a.rect[2] !== b.rect[2]) {\n return a.rect[2] - b.rect[2];\n }\n return a.id.localeCompare(b.id);\n }\n}\n\nclass CommentDialog {\n #dialog;\n\n #editor;\n\n #overlayManager;\n\n #previousText = \"\";\n\n #commentText = \"\";\n\n #textInput;\n\n #title;\n\n #saveButton;\n\n #uiManager;\n\n #prevDragX = 0;\n\n #prevDragY = 0;\n\n #dialogX = 0;\n\n #dialogY = 0;\n\n #isLTR;\n\n #eventBus;\n\n constructor(\n { dialog, toolbar, title, textInput, cancelButton, saveButton },\n overlayManager,\n eventBus,\n ltr\n ) {\n this.#dialog = dialog;\n this.#textInput = textInput;\n this.#overlayManager = overlayManager;\n this.#eventBus = eventBus;\n this.#saveButton = saveButton;\n this.#title = title;\n this.#isLTR = ltr;\n\n const finishBound = this.#finish.bind(this);\n dialog.addEventListener(\"close\", finishBound);\n dialog.addEventListener(\"contextmenu\", e => {\n if (e.target !== this.#textInput) {\n e.preventDefault();\n }\n });\n cancelButton.addEventListener(\"click\", finishBound);\n saveButton.addEventListener(\"click\", this.#save.bind(this));\n\n textInput.addEventListener(\"input\", () => {\n saveButton.disabled = textInput.value === this.#previousText;\n });\n textInput.addEventListener(\"keydown\", e => {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.key === \"Enter\" &&\n !saveButton.disabled\n ) {\n this.#save();\n }\n });\n\n // Make the dialog draggable.\n let pointerMoveAC;\n const cancelDrag = () => {\n dialog.classList.remove(\"dragging\");\n pointerMoveAC?.abort();\n pointerMoveAC = null;\n };\n toolbar.addEventListener(\"pointerdown\", e => {\n if (pointerMoveAC) {\n cancelDrag();\n return;\n }\n const { clientX, clientY } = e;\n stopEvent(e);\n this.#prevDragX = clientX;\n this.#prevDragY = clientY;\n pointerMoveAC = new AbortController();\n const { signal } = pointerMoveAC;\n const { innerHeight, innerWidth } = window;\n dialog.classList.add(\"dragging\");\n window.addEventListener(\n \"pointermove\",\n ev => {\n if (!pointerMoveAC) {\n return;\n }\n const { clientX: x, clientY: y } = ev;\n this.#setPosition(\n this.#dialogX + (x - this.#prevDragX) / innerWidth,\n this.#dialogY + (y - this.#prevDragY) / innerHeight\n );\n this.#prevDragX = x;\n this.#prevDragY = y;\n stopEvent(ev);\n },\n { signal }\n );\n window.addEventListener(\"blur\", cancelDrag, { signal });\n window.addEventListener(\n \"pointerup\",\n ev => {\n if (pointerMoveAC) {\n cancelDrag();\n stopEvent(ev);\n }\n },\n { signal }\n );\n });\n\n overlayManager.register(dialog);\n }\n\n async open(uiManager, editor, posX, posY, options) {\n if (editor) {\n this.#uiManager = uiManager;\n this.#editor = editor;\n }\n const {\n contentsObj: { str },\n color,\n opacity,\n } = editor.getData();\n const { style: dialogStyle } = this.#dialog;\n if (color) {\n dialogStyle.backgroundColor = CommentManager._makeCommentColor(\n color,\n opacity\n );\n dialogStyle.borderColor = Util.makeHexColor(...color);\n } else {\n dialogStyle.backgroundColor = dialogStyle.borderColor = \"\";\n }\n this.#commentText = str || \"\";\n const textInput = this.#textInput;\n textInput.value = this.#previousText = this.#commentText;\n if (str) {\n this.#title.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-edit-comment-dialog-title-when-editing\"\n );\n this.#saveButton.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-edit-comment-dialog-save-button-when-editing\"\n );\n } else {\n this.#title.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-edit-comment-dialog-title-when-adding\"\n );\n this.#saveButton.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-edit-comment-dialog-save-button-when-adding\"\n );\n }\n if (options?.height) {\n textInput.style.height = `${options.height}px`;\n }\n this.#uiManager?.removeEditListeners();\n this.#saveButton.disabled = true;\n const parentDimensions = options?.parentDimensions;\n const { innerHeight, innerWidth } = window;\n if (editor.hasDefaultPopupPosition()) {\n const { dialogWidth, dialogHeight } = this._dialogDimensions;\n if (parentDimensions) {\n if (\n this.#isLTR &&\n posX + dialogWidth >\n Math.min(parentDimensions.x + parentDimensions.width, innerWidth)\n ) {\n const buttonWidth = this.#editor.commentButtonWidth;\n posX -= dialogWidth - buttonWidth * parentDimensions.width;\n } else if (!this.#isLTR) {\n const buttonWidth =\n this.#editor.commentButtonWidth * parentDimensions.width;\n if (posX - dialogWidth < Math.max(0, parentDimensions.x)) {\n posX = Math.max(0, posX);\n } else {\n posX -= dialogWidth - buttonWidth;\n }\n }\n }\n const height = Math.max(dialogHeight, options?.height || 0);\n if (posY + height > innerHeight) {\n posY = innerHeight - height;\n }\n if (posY < 0) {\n posY = 0;\n }\n }\n\n posX = MathClamp(posX / innerWidth, 0, 1);\n posY = MathClamp(posY / innerHeight, 0, 1);\n this.#setPosition(posX, posY);\n\n await this.#overlayManager.open(this.#dialog);\n textInput.focus();\n }\n\n async #save() {\n this.#editor.comment = this.#textInput.value;\n this.#finish();\n }\n\n get _dialogDimensions() {\n const dialog = this.#dialog;\n const { style } = dialog;\n style.opacity = \"0\";\n style.display = \"block\";\n const { width, height } = dialog.getBoundingClientRect();\n style.opacity = style.display = \"\";\n return shadow(this, \"_dialogDimensions\", {\n dialogWidth: width,\n dialogHeight: height,\n });\n }\n\n #setPosition(x, y) {\n this.#dialogX = x;\n this.#dialogY = y;\n const { style } = this.#dialog;\n style.left = `${100 * x}%`;\n style.top = `${100 * y}%`;\n }\n\n #finish() {\n if (!this.#editor) {\n return;\n }\n const edited = this.#textInput.value !== this.#commentText;\n this.#eventBus.dispatch(\"reporttelemetry\", {\n source: this,\n details: {\n type: \"comment\",\n data: {\n edited,\n },\n },\n });\n\n this.#editor?.focusCommentButton();\n this.#editor = null;\n this.#textInput.value = this.#previousText = this.#commentText = \"\";\n this.#overlayManager.closeIfActive(this.#dialog);\n this.#textInput.style.height = \"\";\n this.#uiManager?.addEditListeners();\n this.#uiManager = null;\n }\n\n destroy() {\n this.#uiManager = null;\n this.#editor = null;\n this.#finish();\n }\n}\n\nclass CommentPopup {\n #buttonsContainer = null;\n\n #eventBus;\n\n #commentDialog;\n\n #dateFormat;\n\n #editor = null;\n\n #isLTR;\n\n #container = null;\n\n #text = null;\n\n #time = null;\n\n #prevDragX = 0;\n\n #prevDragY = 0;\n\n #posX = 0;\n\n #posY = 0;\n\n #previousFocusedElement = null;\n\n #selected = false;\n\n #visible = false;\n\n constructor(eventBus, dateFormat, ltr, commentDialog) {\n this.#eventBus = eventBus;\n this.#dateFormat = dateFormat;\n this.#isLTR = ltr;\n this.#commentDialog = commentDialog;\n this.sidebar = null;\n }\n\n get _popupWidth() {\n const container = this.#createPopup();\n const { style } = container;\n style.opacity = \"0\";\n style.display = \"block\";\n document.body.append(container);\n const width = container.getBoundingClientRect().width;\n container.remove();\n style.opacity = style.display = \"\";\n return shadow(this, \"_popupWidth\", width);\n }\n\n #createPopup() {\n if (this.#container) {\n return this.#container;\n }\n const container = (this.#container = document.createElement(\"div\"));\n container.className = \"commentPopup\";\n container.id = \"commentPopup\";\n container.tabIndex = -1;\n container.role = \"dialog\";\n container.ariaModal = \"false\";\n container.addEventListener(\"contextmenu\", noContextMenu);\n container.addEventListener(\"keydown\", e => {\n if (e.key === \"Escape\") {\n this.toggle(this.#editor, true, false);\n this.#previousFocusedElement?.focus();\n stopEvent(e);\n }\n });\n container.addEventListener(\"click\", () => {\n container.focus();\n });\n\n const top = document.createElement(\"div\");\n top.className = \"commentPopupTop\";\n const time = (this.#time = document.createElement(\"time\"));\n time.className = \"commentPopupTime\";\n\n const buttons = (this.#buttonsContainer = document.createElement(\"div\"));\n buttons.className = \"commentPopupButtons\";\n const edit = document.createElement(\"button\");\n edit.classList.add(\"commentPopupEdit\", \"toolbarButton\");\n edit.tabIndex = 0;\n edit.setAttribute(\"data-l10n-id\", \"pdfjs-editor-edit-comment-popup-button\");\n edit.ariaHasPopup = \"dialog\";\n edit.ariaControlsElements = [this.#commentDialog];\n const editLabel = document.createElement(\"span\");\n editLabel.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-edit-comment-popup-button-label\"\n );\n edit.append(editLabel);\n edit.addEventListener(\"click\", () => {\n const editor = this.#editor;\n const height = parseFloat(getComputedStyle(this.#text).height);\n this.toggle(editor, /* isSelected */ true, /* visibility */ false);\n editor.editComment({\n height,\n });\n });\n edit.addEventListener(\"contextmenu\", noContextMenu);\n\n const del = document.createElement(\"button\");\n del.classList.add(\"commentPopupDelete\", \"toolbarButton\");\n del.tabIndex = 0;\n del.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-delete-comment-popup-button\"\n );\n const delLabel = document.createElement(\"span\");\n delLabel.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-delete-comment-popup-button-label\"\n );\n del.append(delLabel);\n del.addEventListener(\"click\", () => {\n this.#eventBus.dispatch(\"reporttelemetry\", {\n source: this,\n details: {\n type: \"comment\",\n data: {\n deleted: true,\n },\n },\n });\n const editor = this.#editor;\n const savedData = editor.comment;\n this.destroy();\n if (savedData?.text) {\n editor._uiManager.deleteComment(editor, savedData);\n } else {\n editor.comment = null;\n }\n editor.focus();\n });\n del.addEventListener(\"contextmenu\", noContextMenu);\n buttons.append(edit, del);\n\n top.append(time, buttons);\n\n const separator = document.createElement(\"hr\");\n\n const text = (this.#text = document.createElement(\"div\"));\n text.className = \"commentPopupText\";\n container.append(top, separator, text);\n\n // Make the dialog draggable.\n let pointerMoveAC;\n const cancelDrag = () => {\n container.classList.remove(\"dragging\");\n pointerMoveAC?.abort();\n pointerMoveAC = null;\n };\n top.addEventListener(\"pointerdown\", e => {\n if (pointerMoveAC) {\n cancelDrag();\n return;\n }\n const { target, clientX, clientY } = e;\n if (buttons.contains(target)) {\n return;\n }\n stopEvent(e);\n const { width: parentWidth, height: parentHeight } =\n this.#editor.parentBoundingClientRect;\n this.#prevDragX = clientX;\n this.#prevDragY = clientY;\n pointerMoveAC = new AbortController();\n const { signal } = pointerMoveAC;\n container.classList.add(\"dragging\");\n window.addEventListener(\n \"pointermove\",\n ev => {\n if (!pointerMoveAC) {\n return; // Not dragging.\n }\n const { clientX: x, clientY: y } = ev;\n this.#setPosition(\n this.#posX + (x - this.#prevDragX) / parentWidth,\n this.#posY + (y - this.#prevDragY) / parentHeight,\n /* correctPosition = */ false\n );\n this.#prevDragX = x;\n this.#prevDragY = y;\n stopEvent(ev);\n },\n { signal }\n );\n window.addEventListener(\"blur\", cancelDrag, { signal });\n window.addEventListener(\n \"pointerup\",\n ev => {\n if (pointerMoveAC) {\n cancelDrag();\n stopEvent(ev);\n }\n },\n { signal }\n );\n });\n\n return container;\n }\n\n updateColor(editor) {\n if (this.#editor !== editor || !this.#visible) {\n return;\n }\n const { color, opacity } = editor.getData();\n this.#container.style.backgroundColor =\n (color && CommentManager._makeCommentColor(color, opacity)) || \"\";\n }\n\n _hide(editor) {\n const container = this.#createPopup();\n\n container.classList.toggle(\"hidden\", true);\n container.classList.toggle(\"selected\", false);\n (editor || this.#editor)?.setCommentButtonStates({\n selected: false,\n hasPopup: false,\n });\n this.#editor = null;\n this.#selected = false;\n this.#visible = false;\n this.#text.replaceChildren();\n this.sidebar.selectComment(null);\n }\n\n toggle(editor, isSelected, visibility = undefined, isEditable = true) {\n if (!editor) {\n this.destroy();\n return;\n }\n\n if (isSelected) {\n visibility ??=\n this.#editor === editor ? !this.#selected || !this.#visible : true;\n } else {\n if (this.#selected) {\n return;\n }\n visibility ??= !this.#visible;\n }\n\n if (!visibility) {\n this._hide(editor);\n return;\n }\n\n this.#visible = true;\n if (this.#editor !== editor) {\n this.#editor?.setCommentButtonStates({\n selected: false,\n hasPopup: false,\n });\n }\n\n const container = this.#createPopup();\n this.#buttonsContainer.classList.toggle(\"hidden\", !isEditable);\n container.classList.toggle(\"hidden\", false);\n container.classList.toggle(\"selected\", isSelected);\n this.#selected = isSelected;\n this.#editor = editor;\n editor.setCommentButtonStates({\n selected: isSelected,\n hasPopup: true,\n });\n\n const {\n contentsObj,\n richText,\n creationDate,\n modificationDate,\n color,\n opacity,\n } = editor.getData();\n container.style.backgroundColor =\n (color && CommentManager._makeCommentColor(color, opacity)) || \"\";\n this.#text.replaceChildren();\n const html =\n richText?.str && (!contentsObj?.str || richText.str === contentsObj.str)\n ? richText.html\n : contentsObj?.str;\n if (html) {\n renderRichText(\n {\n html,\n dir: contentsObj?.dir || \"auto\",\n className: \"richText\",\n },\n this.#text\n );\n }\n this.#time.textContent = this.#dateFormat.format(\n PDFDateString.toDateObject(modificationDate || creationDate)\n );\n this.#setPosition(\n ...editor.commentPopupPosition,\n /* correctPosition = */ editor.hasDefaultPopupPosition()\n );\n editor.elementBeforePopup.after(container);\n container.addEventListener(\n \"focus\",\n ({ relatedTarget }) => {\n this.#previousFocusedElement = relatedTarget;\n },\n { once: true }\n );\n if (isSelected) {\n setTimeout(() => container.focus(), 0);\n }\n }\n\n #setPosition(x, y, correctPosition) {\n if (!correctPosition) {\n this.#editor.commentPopupPosition = [x, y];\n } else {\n const parentRect = this.#editor.parentBoundingClientRect;\n const widthRatio = this._popupWidth / parentRect.width;\n if (\n (this.#isLTR && x + widthRatio > 1) ||\n (!this.#isLTR && x - widthRatio >= 0)\n ) {\n const buttonWidth = this.#editor.commentButtonWidth;\n x -= widthRatio - buttonWidth;\n }\n const margin = 0.01;\n if (this.#isLTR) {\n x = Math.max(x, -parentRect.x / parentRect.width + margin);\n } else {\n x = Math.min(\n x,\n (window.innerWidth - parentRect.x) / parentRect.width -\n widthRatio -\n margin\n );\n }\n }\n this.#posX = x;\n this.#posY = y;\n const { style } = this.#container;\n style.left = `${100 * x}%`;\n style.top = `${100 * y}%`;\n }\n\n destroy() {\n this._hide();\n this.#container?.remove();\n this.#container = this.#text = this.#time = null;\n this.#prevDragX = this.#prevDragY = Infinity;\n this.#posX = this.#posY = 0;\n this.#previousFocusedElement = null;\n }\n}\n\nexport { CommentManager };\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 { isPdfFile } from \"pdfjs-lib\";\n\nclass BaseDownloadManager {\n #openBlobUrls = new WeakMap();\n\n constructor() {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n this.constructor === BaseDownloadManager\n ) {\n throw new Error(\"Cannot initialize BaseDownloadManager.\");\n }\n }\n\n _triggerDownload(blobUrl, originalUrl, filename, isAttachment = false) {\n throw new Error(\"Not implemented: _triggerDownload\");\n }\n\n _getOpenDataUrl(blobUrl, filename, dest = null) {\n throw new Error(\"Not implemented: _getOpenDataUrl\");\n }\n\n /**\n * @param {Uint8Array} data\n * @param {string} filename\n * @param {string} [contentType]\n */\n downloadData(data, filename, contentType) {\n const blobUrl = URL.createObjectURL(\n new Blob([data], { type: contentType })\n );\n\n this._triggerDownload(\n blobUrl,\n /* originalUrl = */ blobUrl,\n filename,\n /* isAttachment = */ true\n );\n }\n\n /**\n * @param {Uint8Array} data\n * @param {string} filename\n * @param {string | null} [dest]\n * @returns {boolean} Indicating if the data was opened.\n */\n openOrDownloadData(data, filename, dest = null) {\n const isPdfData = isPdfFile(filename);\n const contentType = isPdfData ? \"application/pdf\" : \"\";\n\n if (isPdfData) {\n const blobUrl = this.#openBlobUrls.getOrInsertComputed(data, () =>\n URL.createObjectURL(new Blob([data], { type: contentType }))\n );\n try {\n const viewerUrl = this._getOpenDataUrl(blobUrl, filename, dest);\n\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(data);\n }\n }\n\n this.downloadData(data, filename, contentType);\n return false;\n }\n\n /**\n * @param {Uint8Array} data\n * @param {string} url\n * @param {string} filename\n */\n download(data, url, filename) {\n const blobUrl = data\n ? URL.createObjectURL(new Blob([data], { type: \"application/pdf\" }))\n : null;\n\n this._triggerDownload(blobUrl, /* originalUrl = */ url, filename);\n }\n}\n\nexport { BaseDownloadManager };\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 { BaseDownloadManager } from \"./base_download_manager.js\";\nimport { createValidAbsoluteUrl } 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\nclass DownloadManager extends BaseDownloadManager {\n _triggerDownload(blobUrl, originalUrl, filename, isAttachment = false) {\n if (!blobUrl && !isAttachment) {\n // Fallback to downloading non-attachments by their URL.\n if (!createValidAbsoluteUrl(originalUrl, \"http://example.com\")) {\n throw new Error(`_triggerDownload - not a valid URL: ${originalUrl}`);\n }\n blobUrl = originalUrl + \"#pdfjs.action=download\";\n }\n\n const a = document.createElement(\"a\");\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 _getOpenDataUrl(blobUrl, filename, dest = null) {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"COMPONENTS\")) {\n throw new Error(\"Opening data is not supported in `COMPONENTS` builds.\");\n }\n // The current URL is the viewer, let's use it and append the file.\n let url = \"?file=\" + encodeURIComponent(blobUrl + \"#\" + filename);\n if (dest) {\n url += `#${escape(dest)}`;\n }\n return url;\n }\n}\n\nexport { DownloadManager };\n","/* Copyright 2024 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 { noContextMenu } from \"pdfjs-lib\";\n\nclass EditorUndoBar {\n #closeButton = null;\n\n #container;\n\n #eventBus = null;\n\n #focusTimeout = null;\n\n #initController = null;\n\n isOpen = false;\n\n #message;\n\n #showController = null;\n\n #undoButton;\n\n static #l10nMessages = Object.freeze({\n highlight: \"pdfjs-editor-undo-bar-message-highlight\",\n freetext: \"pdfjs-editor-undo-bar-message-freetext\",\n stamp: \"pdfjs-editor-undo-bar-message-stamp\",\n ink: \"pdfjs-editor-undo-bar-message-ink\",\n signature: \"pdfjs-editor-undo-bar-message-signature\",\n comment: \"pdfjs-editor-undo-bar-message-comment\",\n _multiple: \"pdfjs-editor-undo-bar-message-multiple\",\n });\n\n constructor({ container, message, undoButton, closeButton }, eventBus) {\n this.#container = container;\n this.#message = message;\n this.#undoButton = undoButton;\n this.#closeButton = closeButton;\n this.#eventBus = eventBus;\n }\n\n destroy() {\n this.#initController?.abort();\n this.#initController = null;\n\n this.hide();\n }\n\n show(undoAction, messageData) {\n if (!this.#initController) {\n this.#initController = new AbortController();\n const opts = { signal: this.#initController.signal };\n const boundHide = this.hide.bind(this);\n\n this.#container.addEventListener(\"contextmenu\", noContextMenu, opts);\n this.#closeButton.addEventListener(\"click\", boundHide, opts);\n this.#eventBus._on(\"beforeprint\", boundHide, opts);\n this.#eventBus._on(\"download\", boundHide, opts);\n }\n\n this.hide();\n\n if (typeof messageData === \"string\") {\n this.#message.setAttribute(\n \"data-l10n-id\",\n EditorUndoBar.#l10nMessages[messageData]\n );\n } else {\n this.#message.setAttribute(\n \"data-l10n-id\",\n EditorUndoBar.#l10nMessages._multiple\n );\n this.#message.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({ count: messageData })\n );\n }\n this.isOpen = true;\n this.#container.hidden = false;\n\n this.#showController = new AbortController();\n\n this.#undoButton.addEventListener(\n \"click\",\n () => {\n undoAction();\n this.hide();\n },\n { signal: this.#showController.signal }\n );\n\n // Without the setTimeout, VoiceOver will read out the document title\n // instead of the popup label.\n this.#focusTimeout = setTimeout(() => {\n this.#container.focus();\n this.#focusTimeout = null;\n }, 100);\n }\n\n hide() {\n if (!this.isOpen) {\n return;\n }\n this.isOpen = false;\n this.#container.hidden = true;\n\n this.#showController?.abort();\n this.#showController = null;\n\n if (this.#focusTimeout) {\n clearTimeout(this.#focusTimeout);\n this.#focusTimeout = null;\n }\n }\n}\n\nexport { EditorUndoBar };\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 dialog.addEventListener(\"cancel\", ({ target }) => {\n if (this.#active === target) {\n this.#active = null;\n }\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 * 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 /**\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 closeIfActive(dialog) {\n if (this.#active === dialog) {\n await this.close(dialog);\n }\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\n/** @typedef {import(\"./overlay_manager.js\").OverlayManager} OverlayManager */\n\nimport { 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 {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, 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._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 await this.#activeCapability?.promise;\n this.#activeCapability = Promise.withResolvers();\n\n try {\n await this.overlayManager.open(this.dialog);\n } catch (ex) {\n this.#activeCapability.resolve();\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.setAttribute(\n \"data-l10n-id\",\n passwordIncorrect ? \"pdfjs-password-invalid\" : \"pdfjs-password-label\"\n );\n }\n\n async close() {\n this.overlayManager.closeIfActive(this.dialog);\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 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\";\nimport { stopEvent } from \"pdfjs-lib\";\n\nconst TREEITEM_SELECTED_CLASS = \"selected\";\n\nclass BaseTreeViewer {\n constructor(options) {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n this.constructor === BaseTreeViewer\n ) {\n throw new Error(\"Cannot initialize BaseTreeViewer.\");\n }\n this.container = options.container;\n this.eventBus = options.eventBus;\n this._l10n = options.l10n;\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.replaceChildren();\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(\"withNesting\");\n }\n\n /**\n * @protected\n */\n _dispatchEvent(count) {\n throw new Error(\"Not implemented: _dispatchEvent\");\n }\n\n /**\n * @protected\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 * @param {HTMLDivElement} div\n * @param {boolean|object} [hidden]\n * @protected\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 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 // Pause translation when collapsing/expanding the subtree.\n this._l10n.pause();\n\n this._lastToggleIsShow = show;\n for (const toggler of root.querySelectorAll(\".treeItemToggler\")) {\n toggler.classList.toggle(\"treeItemsHidden\", !show);\n }\n this._l10n.resume();\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(\"withNesting\");\n this._lastToggleIsShow = !fragment.querySelector(\".treeItemsHidden\");\n this.container.addEventListener(\"click\", e => {\n const { target } = e;\n if (!target.classList.contains(\"treeItemToggler\")) {\n return;\n }\n stopEvent(e);\n target.classList.toggle(\"treeItemsHidden\");\n if (e.shiftKey) {\n const shouldShowAll = !target.classList.contains(\"treeItemsHidden\");\n this._toggleTreeItem(target.parentNode, shouldShowAll);\n }\n });\n }\n // Pause translation when inserting the tree into the DOM.\n this._l10n.pause();\n this.container.append(fragment);\n this._l10n.resume();\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 // Pause translation when expanding the treeItem.\n this._l10n.pause();\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._l10n.resume();\n\n this._updateCurrentTreeItem(treeItem);\n\n treeItem.scrollIntoView({\n behavior: \"instant\",\n block: \"center\",\n inline: \"center\",\n container: \"nearest\",\n });\n }\n}\n\nexport { BaseTreeViewer };\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(\"./event_utils.js\").EventBus} EventBus */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./download_manager.js\").DownloadManager} DownloadManager */\n\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 * @property {boolean} [keepRenderedCapability]\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 = Promise.withResolvers();\n }\n this._pendingDispatchEvent = false;\n }\n\n /**\n * @protected\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 * @protected\n */\n _bindLink(element, { content, description, filename }) {\n if (description) {\n element.title = description;\n }\n element.onclick = () => {\n this.downloadManager.openOrDownloadData(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\n const fragment = document.createDocumentFragment();\n const ul = document.createElement(\"ul\");\n fragment.append(ul);\n let attachmentsCount = 0;\n for (const name in attachments) {\n const item = attachments[name];\n const li = document.createElement(\"li\");\n ul.append(li);\n const element = document.createElement(\"a\");\n li.append(element);\n this._bindLink(element, item);\n element.textContent = this._normalizeTextContent(item.filename);\n\n attachmentsCount++;\n }\n\n this._finishRendering(fragment, attachmentsCount);\n }\n\n /**\n * Used to append FileAttachment annotations to the sidebar.\n */\n #appendAttachment(item) {\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 (item.filename === name) {\n return; // Ignore the new attachment if it already exists.\n }\n }\n attachments[item.filename] = item;\n\n this.render({\n attachments,\n keepRenderedCapability: true,\n });\n });\n }\n}\n\nexport { PDFAttachmentViewer };\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\nimport { stopEvent } from \"pdfjs-lib\";\n\n// Class name of element which can be grabbed.\nconst CSS_CLASS_GRAB = \"grab-to-pan-grab\";\n\n/**\n * @typedef {Object} GrabToPanOptions\n * @property {HTMLElement} element\n */\n\nclass GrabToPan {\n #activateAC = null;\n\n #mouseDownAC = null;\n\n #scrollAC = null;\n\n /**\n * Construct a GrabToPan instance for a given HTML element.\n * @param {GrabToPanOptions} options\n */\n constructor({ element }) {\n this.element = element;\n this.document = element.ownerDocument;\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.#activateAC) {\n this.#activateAC = new AbortController();\n\n this.element.addEventListener(\"mousedown\", this.#onMouseDown.bind(this), {\n capture: true,\n signal: this.#activateAC.signal,\n });\n this.element.classList.add(CSS_CLASS_GRAB);\n }\n }\n\n /**\n * Removes all events. Any pending pan session is immediately stopped.\n */\n deactivate() {\n if (this.#activateAC) {\n this.#activateAC.abort();\n this.#activateAC = null;\n\n this.#endPan();\n this.element.classList.remove(CSS_CLASS_GRAB);\n }\n }\n\n toggle() {\n if (this.#activateAC) {\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 {\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\n this.#mouseDownAC = new AbortController();\n const boundEndPan = this.#endPan.bind(this),\n mouseOpts = { capture: true, signal: this.#mouseDownAC.signal };\n\n this.document.addEventListener(\n \"mousemove\",\n this.#onMouseMove.bind(this),\n mouseOpts\n );\n this.document.addEventListener(\"mouseup\", boundEndPan, mouseOpts);\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.#scrollAC = new AbortController();\n\n this.element.addEventListener(\"scroll\", boundEndPan, {\n capture: true,\n signal: this.#scrollAC.signal,\n });\n stopEvent(event);\n\n const focusedElement = document.activeElement;\n if (focusedElement && !focusedElement.contains(event.target)) {\n focusedElement.blur();\n }\n }\n\n #onMouseMove(event) {\n this.#scrollAC?.abort();\n this.#scrollAC = null;\n\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 this.element.scrollTo({\n top: this.scrollTopStart - yDiff,\n left: this.scrollLeftStart - xDiff,\n behavior: \"instant\",\n });\n\n if (!this.overlay.parentNode) {\n document.body.append(this.overlay);\n }\n }\n\n #endPan() {\n this.#mouseDownAC?.abort();\n this.#mouseDownAC = null;\n this.#scrollAC?.abort();\n this.#scrollAC = null;\n // Note: ChildNode.remove doesn't throw if the parentNode is undefined.\n this.overlay.remove();\n }\n}\n\nexport { GrabToPan };\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.js\").EventBus} EventBus */\n\nimport { AnnotationEditorType, shadow } from \"pdfjs-lib\";\nimport { CursorTool, PresentationModeState } from \"./ui_utils.js\";\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 #active = CursorTool.SELECT;\n\n #prevActive = null;\n\n /**\n * @param {PDFCursorToolsOptions} options\n */\n constructor({ container, eventBus, cursorToolOnLoad = CursorTool.SELECT }) {\n this.container = container;\n this.eventBus = eventBus;\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.#prevActive !== null) {\n // Cursor tools cannot be used in PresentationMode/AnnotationEditor.\n return;\n }\n this.#switchTool(tool);\n }\n\n #switchTool(tool, disabled = false) {\n if (tool === this.#active) {\n if (this.#prevActive !== null) {\n // Ensure that the `disabled`-attribute of the buttons will be updated.\n this.eventBus.dispatch(\"cursortoolchanged\", {\n source: this,\n tool,\n disabled,\n });\n }\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.eventBus.dispatch(\"cursortoolchanged\", {\n source: this,\n tool,\n disabled,\n });\n }\n\n #addEventListeners() {\n this.eventBus._on(\"switchcursortool\", evt => {\n if (!evt.reset) {\n this.switchTool(evt.tool);\n } else if (this.#prevActive !== null) {\n annotationEditorMode = AnnotationEditorType.NONE;\n presentationModeState = PresentationModeState.NORMAL;\n\n enableActive();\n }\n });\n\n let annotationEditorMode = AnnotationEditorType.NONE,\n presentationModeState = PresentationModeState.NORMAL;\n\n const disableActive = () => {\n this.#prevActive ??= this.#active; // Keep track of the first one.\n this.#switchTool(CursorTool.SELECT, /* disabled = */ true);\n };\n const enableActive = () => {\n if (\n this.#prevActive !== null &&\n annotationEditorMode === AnnotationEditorType.NONE &&\n presentationModeState === PresentationModeState.NORMAL\n ) {\n this.#switchTool(this.#prevActive);\n this.#prevActive = null;\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 /**\n * @private\n */\n get _handTool() {\n return shadow(\n this,\n \"_handTool\",\n new GrabToPan({\n element: this.container,\n })\n );\n }\n}\n\nexport { PDFCursorTools };\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(\"./event_utils.js\").EventBus} EventBus */\n/** @typedef {import(\"./overlay_manager.js\").OverlayManager} OverlayManager */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/api.js\").PDFDocumentProxy} PDFDocumentProxy */\n\nimport { getPageSizeInches, isPortraitOrientation } from \"./ui_utils.js\";\nimport { PDFDateString } from \"pdfjs-lib\";\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. The names,\n// which are l10n-ids, should be lowercase.\n// See https://en.wikipedia.org/wiki/Paper_size\nconst US_PAGE_NAMES = {\n \"8.5x11\": \"pdfjs-document-properties-page-size-name-letter\",\n \"8.5x14\": \"pdfjs-document-properties-page-size-name-legal\",\n};\nconst METRIC_PAGE_NAMES = {\n \"297x420\": \"pdfjs-document-properties-page-size-name-a-three\",\n \"210x297\": \"pdfjs-document-properties-page-size-name-a-four\",\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 {L10n} 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 titleLookup\n ) {\n this.dialog = dialog;\n this.fields = fields;\n this.overlayManager = overlayManager;\n this.l10n = l10n;\n this._fileNameLookup = fileNameLookup;\n this._titleLookup = titleLookup;\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\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, metadata, /* contentDispositionFilename, */ contentLength },\n pdfPage,\n ] = await Promise.all([\n this.pdfDocument.getMetadata(),\n this.pdfDocument.getPage(currentPageNumber),\n ]);\n\n const [\n fileName,\n fileSize,\n title,\n creationDate,\n modificationDate,\n pageSize,\n isLinearized,\n ] = await Promise.all([\n this._fileNameLookup(),\n this.#parseFileSize(contentLength),\n this._titleLookup(),\n this.#parseDate(metadata?.get(\"xmp:createdate\"), info.CreationDate),\n this.#parseDate(metadata?.get(\"xmp:modifydate\"), info.ModDate),\n this.#parsePageSize(getPageSizeInches(pdfPage), pagesRotation),\n this.#parseLinearization(info.IsLinearized),\n ]);\n\n this.#fieldData = Object.freeze({\n fileName,\n fileSize,\n title,\n author: metadata?.get(\"dc:creator\")?.join(\"\\n\") || info.Author,\n subject: metadata?.get(\"dc:subject\")?.join(\"\\n\") || info.Subject,\n keywords: metadata?.get(\"pdf:keywords\") || info.Keywords,\n creationDate,\n modificationDate,\n creator: metadata?.get(\"xmp:creatortool\") || info.Creator,\n producer: metadata?.get(\"pdf: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();\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 = Promise.withResolvers();\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 \"-\".\n */\n #updateUI() {\n if (this.#fieldData && this.overlayManager.active !== this.dialog) {\n // Don't bother updating the dialog if it's already been closed,\n // unless it's being reset (i.e. `this.#fieldData === null`),\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 = content || content === 0 ? content : \"-\";\n }\n }\n\n async #parseFileSize(b = 0) {\n const kb = b / 1024,\n mb = kb / 1024;\n return kb\n ? this.l10n.get(\n mb >= 1\n ? \"pdfjs-document-properties-size-mb\"\n : \"pdfjs-document-properties-size-kb\",\n { mb, kb, b }\n )\n : undefined;\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 nonMetric = NON_METRIC_LOCALES.includes(this.l10n.getLanguage());\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 nameId =\n getPageName(sizeInches, isPortrait, US_PAGE_NAMES) ||\n getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES);\n\n if (\n !nameId &&\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 nameId = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES);\n if (nameId) {\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 nonMetric ? sizeInches : sizeMillimeters,\n this.l10n.get(\n nonMetric\n ? \"pdfjs-document-properties-page-size-unit-inches\"\n : \"pdfjs-document-properties-page-size-unit-millimeters\"\n ),\n nameId && this.l10n.get(nameId),\n this.l10n.get(\n isPortrait\n ? \"pdfjs-document-properties-page-size-orientation-portrait\"\n : \"pdfjs-document-properties-page-size-orientation-landscape\"\n ),\n ]);\n\n return this.l10n.get(\n name\n ? \"pdfjs-document-properties-page-size-dimension-name-string\"\n : \"pdfjs-document-properties-page-size-dimension-string\",\n { width, height, unit, name, orientation }\n );\n }\n\n async #parseDate(metadataDate, infoDate) {\n const dateObj =\n Date.parse(metadataDate) || PDFDateString.toDateObject(infoDate);\n return dateObj\n ? this.l10n.get(\"pdfjs-document-properties-date-time-string\", {\n dateObj: dateObj.valueOf(),\n })\n : undefined;\n }\n\n #parseLinearization(isLinearized) {\n return this.l10n.get(\n isLinearized\n ? \"pdfjs-document-properties-linearized-yes\"\n : \"pdfjs-document-properties-linearized-no\"\n );\n }\n}\n\nexport { PDFDocumentProperties };\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\nimport { FeatureTest } from \"pdfjs-lib\";\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\nlet NormalizeWithNFKC;\nfunction getNormalizeWithNFKC() {\n if (\n (typeof PDFJSDev === \"undefined\" && FeatureTest.platform.isFirefox) ||\n (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\"))\n ) {\n // The `NormalizeWithNFKC` string is generated with the for loop below.\n // Because of a small difference between Chrome and Firefox, the string is\n // only hardcoded for Firefox, and Chrome (or others) will generate it at\n // runtime.\n // In order to detect if the string is up to date, a check is performed in\n // the loop below, and if a difference is detected, an error is thrown.\n /* eslint-disable no-irregular-whitespace */\n NormalizeWithNFKC ||= `\\xA0¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩`;\n }\n\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"TESTING\") ||\n (!PDFJSDev.test(\"MOZCENTRAL\") && !NormalizeWithNFKC)\n ) {\n const ranges = [];\n const range = [];\n const diacriticsRegex = /^\\p{M}$/u;\n // Some chars must be replaced by their NFKC counterpart during a search.\n for (let i = 0; i < 65536; i++) {\n if (i >= 0xd800 && i <= 0xdfff) {\n continue; // Skip surrogates since they're not valid Unicode scalar values.\n }\n const c = String.fromCharCode(i);\n if (c.normalize(\"NFKC\") !== c && !diacriticsRegex.test(c)) {\n if (range.length !== 2) {\n range[0] = range[1] = i;\n continue;\n }\n if (range[1] + 1 !== i) {\n if (range[0] === range[1]) {\n ranges.push(String.fromCharCode(range[0]));\n } else {\n ranges.push(\n `${String.fromCharCode(range[0])}-${String.fromCharCode(\n range[1]\n )}`\n );\n }\n range[0] = range[1] = i;\n } else {\n range[1] = i;\n }\n }\n }\n\n const rangesStr = ranges.join(\"\");\n if (!NormalizeWithNFKC) {\n NormalizeWithNFKC = rangesStr;\n } else if (rangesStr !== NormalizeWithNFKC) {\n for (let i = 1; i < rangesStr.length; i++) {\n if (rangesStr[i] !== NormalizeWithNFKC[i]) {\n console.log(\n `Difference at index ${i}: ` +\n `U+${rangesStr.charCodeAt(i).toString(16).toUpperCase().padStart(4, \"0\")}` +\n `!== U+${NormalizeWithNFKC.charCodeAt(i)\n .toString(16)\n .toUpperCase()\n .padStart(4, \"0\")}`\n );\n break;\n }\n }\n throw new Error(\n \"getNormalizeWithNFKC - update the `NormalizeWithNFKC` string.\"\n );\n }\n }\n return NormalizeWithNFKC;\n}\n\nexport { CharacterType, getCharacterType, getNormalizeWithNFKC };\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(\"./pdf_link_service.js\").PDFLinkService} PDFLinkService */\n\nimport { binarySearchFirstItem, scrollIntoView } from \"./ui_utils.js\";\nimport { getCharacterType, getNormalizeWithNFKC } 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\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 = /([+^$|])|(\\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, options = {}) {\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 const hasSyllables = syllablePositions.length > 0;\n const ignoreDashEOL = options.ignoreDashEOL ?? false;\n\n let normalizationRegex;\n if (!hasSyllables && noSyllablesRegExp) {\n normalizationRegex = noSyllablesRegExp;\n } else if (hasSyllables && 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 = getNormalizeWithNFKC();\n\n // 3040-309F: Hiragana\n // 30A0-30FF: Katakana\n const CJK = \"(?:\\\\p{Ideographic}|[\\u3040-\\u30FF])\";\n const HKDiacritics = \"(?:\\u3099|\\u309A)\";\n const BrokenWord = `\\\\p{Ll}-\\\\n(?=\\\\p{Ll})|\\\\p{Lu}-\\\\n(?=\\\\p{L})`;\n\n const regexps = [\n /* p1 */ `[${replace}]`,\n /* p2 */ `[${toNormalizeWithNFKC}]`,\n /* p3 */ `${HKDiacritics}\\\\n`,\n /* p4 */ \"\\\\p{M}+(?:-\\\\n)?\",\n /* p5 */ `${BrokenWord}`,\n /* p6 */ \"\\\\S-\\\\n\",\n /* p7 */ `${CJK}\\\\n`,\n /* p8 */ \"\\\\n\",\n /* p9 */ hasSyllables\n ? FIRST_CHAR_SYLLABLES_REG_EXP\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 \"\\\\u0000\",\n ];\n normalizationRegex = new RegExp(\n regexps.map(r => `(${r})`).join(\"|\"),\n \"gum\"\n );\n\n if (hasSyllables) {\n withSyllablesRegExp = normalizationRegex;\n } else {\n noSyllablesRegExp = normalizationRegex;\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, p9, 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 (p6)` 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 if (ignoreDashEOL) {\n // Keep the - but remove the EOL.\n shiftOrigin += 1;\n eol += 1;\n return p5.slice(0, -1);\n }\n // In \"X-\\ny\", \"-\\n\" is removed because an hyphen at the end of a line\n // between two letters is likely here to mark a break 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 // A - following a non-space character that is not detected as the\n // hyphen breaking a word in two lines needs to be preserved. It could\n // be, for example, in a compound word or in a date.\n // Only remove the newline.\n shiftOrigin += 1;\n eol += 1;\n return p6.slice(0, -1);\n }\n\n if (p7) {\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 = p7.length - 1;\n positions.push(i - shift + len, shift);\n shiftOrigin += 1;\n eol += 1;\n return p7.slice(0, -1);\n }\n\n if (p8) {\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 // p9\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 p9;\n }\n );\n\n positions.push(normalized.length, shift);\n const starts = new Uint32Array(positions.length >> 1);\n const shifts = new Int32Array(positions.length >> 1);\n for (let i = 0, ii = positions.length; i < ii; i += 2) {\n starts[i >> 1] = positions[i];\n shifts[i >> 1] = positions[i + 1];\n }\n\n return [normalized, [starts, shifts], 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 [starts, shifts] = diffs;\n // First char in the new string.\n const start = pos;\n // Last char in the new string.\n const end = pos + len - 1;\n let i = binarySearchFirstItem(starts, x => x >= start);\n if (starts[i] > start) {\n --i;\n }\n\n let j = binarySearchFirstItem(starts, x => x >= end, i);\n if (starts[j] > end) {\n --j;\n }\n\n // First char in the old string.\n const oldStart = start + shifts[i];\n\n // Last char in the old string.\n const oldEnd = end + shifts[j];\n const oldLen = oldEnd + 1 - oldStart;\n\n return [oldStart, oldLen];\n}\n\n/**\n * @typedef {Object} PDFFindControllerOptions\n * @property {PDFLinkService} 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 #state = null;\n\n #updateMatchesCountOnProgress = true;\n\n #visitedPagesCount = 0;\n\n #copiedExtractTextPromises = null;\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 /**\n * Callback used to check if a `pageNumber` is currently visible.\n * @type {function}\n */\n this.onIsPageVisible = null;\n\n this.#reset();\n eventBus._on(\"find\", this.#onFind.bind(this));\n eventBus._on(\"findbarclose\", this.#onFindBarClose.bind(this));\n eventBus._on(\"pagesedited\", this.#onPagesEdited.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 /**\n * @typedef {Object} PDFFindControllerScrollMatchIntoViewParams\n * @property {HTMLElement} element\n * @property {number} selectedLeft\n * @property {number} pageIndex\n * @property {number} matchIndex\n */\n\n /**\n * Scroll the current match into view.\n * @param {PDFFindControllerScrollMatchIntoViewParams}\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 const spot = {\n top: MATCH_SCROLL_OFFSET_TOP,\n left: selectedLeft,\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 this.#copiedExtractTextPromises = null;\n\n this._firstPageCapability = Promise.withResolvers();\n }\n\n /**\n * @type {string|Array} The (current) normalized search query.\n */\n get #query() {\n const { query } = this.#state;\n if (typeof query === \"string\") {\n if (query !== this._rawQuery) {\n this._rawQuery = query;\n [this._normalizedQuery] = normalize(query);\n }\n return this._normalizedQuery;\n }\n // We don't bother caching the normalized search query in the Array-case,\n // since this code-path is *essentially* unused in the default viewer.\n return (query || []).filter(q => !!q).map(q => normalize(q)[0]);\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 const newQuery = state.query,\n prevQuery = this.#state.query;\n const newType = typeof newQuery,\n prevType = typeof prevQuery;\n\n if (newType !== prevType) {\n return true;\n }\n if (newType === \"string\") {\n if (newQuery !== prevQuery) {\n return true;\n }\n } else if (\n /* isArray && */ JSON.stringify(newQuery) !== JSON.stringify(prevQuery)\n ) {\n return true;\n }\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 return (\n pageNumber >= 1 &&\n pageNumber <= linkService.pagesCount &&\n pageNumber !== linkService.page &&\n !(this.onIsPageVisible?.(pageNumber) ?? true)\n );\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 #convertToRegExpString(query, hasDiacritics) {\n const { matchDiacritics } = this.#state;\n let isUnicode = false;\n const addExtraWhitespaces = (original, fixed) => {\n if (original === query) {\n return fixed;\n }\n if (query.startsWith(original)) {\n return `${fixed}[ ]*`;\n }\n if (query.endsWith(original)) {\n return `[ ]*${fixed}`;\n }\n return `[ ]*${fixed}[ ]*`;\n };\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 interfere with regexp syntax.\n return addExtraWhitespaces(p1, RegExp.escape(p1));\n }\n if (p2) {\n // Allow whitespaces around group of punctuation signs.\n return addExtraWhitespaces(p2, RegExp.escape(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 if (!this.#state) {\n return;\n }\n const query = this.#query;\n if (query.length === 0) {\n return; // Do nothing: the matches should be wiped out already.\n }\n const pageContent = this._pageContents[pageIndex];\n const matcherResult = this.match(query, pageContent, pageIndex);\n\n const matches = (this._pageMatches[pageIndex] = []);\n const matchesLength = (this._pageMatchesLength[pageIndex] = []);\n const diffs = this._pageDiffs[pageIndex];\n\n matcherResult?.forEach(({ index, length }) => {\n const [matchPos, matchLen] = getOriginalIndex(diffs, index, length);\n if (matchLen) {\n matches.push(matchPos);\n matchesLength.push(matchLen);\n }\n });\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 = matches.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 /**\n * @typedef {Object} FindMatch\n * @property {number} index - The start of the matched text in the page's\n * string contents.\n * @property {number} length - The length of the matched text.\n */\n\n /**\n * @param {string | string[]} query - The search query.\n * @param {string} pageContent - The text content of the page to search in.\n * @param {number} pageIndex - The index of the page that is being processed.\n * @returns {FindMatch[] | undefined} An array of matches in the provided\n * page.\n */\n match(query, pageContent, pageIndex) {\n const hasDiacritics = this._hasDiacritics[pageIndex];\n\n let isUnicode = false;\n if (typeof query === \"string\") {\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 query = query\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 if (!query) {\n // The query can be empty because some chars like diacritics could have\n // been stripped out.\n return undefined;\n }\n\n const { caseSensitive, entireWord } = this.#state;\n const flags = `g${isUnicode ? \"u\" : \"\"}${caseSensitive ? \"\" : \"i\"}`;\n query = new RegExp(query, flags);\n\n const matches = [];\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 matches.push({ index: match.index, length: match[0].length });\n }\n return matches;\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 deferred = Promise.resolve();\n const textOptions = { disableNormalization: true };\n const pdfDoc = this._pdfDocument;\n for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) {\n const { promise, resolve } = Promise.withResolvers();\n this._extractTextPromises[i] = promise;\n\n deferred = deferred.then(async () => {\n if (pdfDoc !== this._pdfDocument) {\n resolve();\n return;\n }\n await pdfDoc\n .getPage(i + 1)\n .then(pdfPage => pdfPage.getTextContent(textOptions))\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 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 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 const query = this.#query;\n if (query.length === 0) {\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 #onPagesEdited({ pagesMapper, type, pageNumbers }) {\n if (this._extractTextPromises.length === 0) {\n return;\n }\n\n if (type === \"copy\") {\n this.#copiedExtractTextPromises = new Map();\n for (const pageNum of pageNumbers) {\n this.#copiedExtractTextPromises.set(\n pageNum,\n this._extractTextPromises[pageNum - 1]\n );\n }\n return;\n }\n\n this.#onFindBarClose();\n this._dirtyMatch = true;\n const prevTextPromises = this._extractTextPromises;\n const extractTextPromises = (this._extractTextPromises.length = []);\n for (let i = 1, ii = pagesMapper.length; i <= ii; i++) {\n const prevPageNumber = pagesMapper.getPrevPageNumber(i);\n if (prevPageNumber < 0) {\n extractTextPromises.push(\n this.#copiedExtractTextPromises?.get(-prevPageNumber) ||\n Promise.resolve()\n );\n continue;\n }\n extractTextPromises.push(\n prevTextPromises[prevPageNumber - 1] || Promise.resolve()\n );\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 entireWord: this.#state?.entireWord ?? null,\n matchesCount: this.#requestMatchesCount(),\n rawQuery: this.#state?.query ?? null,\n });\n }\n}\n\nexport { FindState, getOriginalIndex, normalize, PDFFindController };\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\";\nimport { toggleExpandedBtn } from \"./ui_utils.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 #mainContainer;\n\n #resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this));\n\n opened = false;\n\n constructor(options, mainContainer, eventBus) {\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.#mainContainer = mainContainer;\n\n const checkedInputs = new Map([\n [this.highlightAll, \"highlightallchange\"],\n [this.caseSensitive, \"casesensitivitychange\"],\n [this.entireWord, \"entirewordchange\"],\n [this.matchDiacritics, \"diacriticmatchingchange\"],\n ]);\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\", ({ keyCode, shiftKey, target }) => {\n switch (keyCode) {\n case 13: // Enter\n if (target === this.findField) {\n this.dispatchEvent(\"again\", shiftKey);\n } else if (checkedInputs.has(target)) {\n target.checked = !target.checked;\n this.dispatchEvent(/* evtName = */ checkedInputs.get(target));\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 this.findNextButton.addEventListener(\"click\", () => {\n this.dispatchEvent(\"again\", false);\n });\n\n for (const [elem, evtName] of checkedInputs) {\n elem.addEventListener(\"click\", () => {\n this.dispatchEvent(evtName);\n });\n }\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 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 const { findField, findMsg } = this;\n let findMsgId = \"\",\n 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 findMsgId = \"pdfjs-find-not-found\";\n status = \"notFound\";\n break;\n case FindState.WRAPPED:\n findMsgId = previous\n ? \"pdfjs-find-reached-top\"\n : \"pdfjs-find-reached-bottom\";\n break;\n }\n findField.setAttribute(\"data-status\", status);\n findField.setAttribute(\"aria-invalid\", state === FindState.NOT_FOUND);\n\n findMsg.setAttribute(\"data-status\", status);\n if (findMsgId) {\n findMsg.setAttribute(\"data-l10n-id\", findMsgId);\n } else {\n findMsg.removeAttribute(\"data-l10n-id\");\n findMsg.textContent = \"\";\n }\n\n this.updateResultsCount(matchesCount);\n }\n\n updateResultsCount({ current = 0, total = 0 } = {}) {\n const { findResultsCount } = this;\n\n if (total > 0) {\n const limit = MATCHES_COUNT_LIMIT;\n\n findResultsCount.setAttribute(\n \"data-l10n-id\",\n total > limit\n ? \"pdfjs-find-match-count-limit\"\n : \"pdfjs-find-match-count\"\n );\n findResultsCount.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({ limit, current, total })\n );\n } else {\n findResultsCount.removeAttribute(\"data-l10n-id\");\n findResultsCount.textContent = \"\";\n }\n }\n\n open() {\n if (!this.opened) {\n // Potentially update the findbar layout, row vs column, when:\n // - The width of the viewer itself changes.\n // - The width of the findbar changes, by toggling the visibility\n // (or localization) of find count/status messages.\n this.#resizeObserver.observe(this.#mainContainer);\n this.#resizeObserver.observe(this.bar);\n\n this.opened = true;\n toggleExpandedBtn(this.toggleButton, true, this.bar);\n }\n this.findField.select();\n this.findField.focus();\n }\n\n close() {\n if (!this.opened) {\n return;\n }\n this.#resizeObserver.disconnect();\n\n this.opened = false;\n toggleExpandedBtn(this.toggleButton, false, this.bar);\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 #resizeObserverCallback() {\n const { bar } = this;\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 bar.classList.remove(\"wrapContainers\");\n\n const findbarHeight = bar.clientHeight;\n const inputContainerHeight = 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 bar.classList.add(\"wrapContainers\");\n }\n }\n}\n\nexport { PDFFindBar };\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(\"./pdf_link_service.js\").PDFLinkService} PDFLinkService */\n\nimport { isValidRotation, parseQueryString } from \"./ui_utils.js\";\nimport { updateUrlHash } from \"pdfjs-lib\";\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 {PDFLinkService} 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 #eventAbortController = null;\n\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 // 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 #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 { href, protocol } = document.location;\n if (protocol !== \"file:\") {\n newUrl = updateUrlHash(href, destination.hash);\n }\n }\n if (shouldReplace) {\n window.history.replaceState(newState, \"\", newUrl);\n } else {\n window.history.pushState(newState, \"\", newUrl);\n }\n }\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 #isValidPage(val) {\n return (\n Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount\n );\n }\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 #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 #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 #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 #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 #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 #bindEvents() {\n if (this.#eventAbortController) {\n return; // The event listeners were already added.\n }\n this.#eventAbortController = new AbortController();\n const { signal } = this.#eventAbortController;\n\n this.eventBus._on(\"updateviewarea\", this.#updateViewarea.bind(this), {\n signal,\n });\n window.addEventListener(\"popstate\", this.#popState.bind(this), { signal });\n window.addEventListener(\"pagehide\", this.#pageHide.bind(this), { signal });\n }\n\n #unbindEvents() {\n this.#eventAbortController?.abort();\n this.#eventAbortController = 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\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/optional_content_config.js\").OptionalContentConfig} OptionalContentConfig */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/api.js\").PDFDocumentProxy} PDFDocumentProxy */\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 */\n\n/**\n * @typedef {Object} PDFLayerViewerRenderParameters\n * @property {OptionalContentConfig|null} optionalContentConfig - An\n * {OptionalContentConfig} instance.\n * @property {PDFDocumentProxy} pdfDocument - A {PDFDocument} instance.\n */\n\nclass PDFLayerViewer extends BaseTreeViewer {\n constructor(options) {\n super(options);\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\n this._optionalContentVisibility?.clear();\n this._optionalContentVisibility = null;\n }\n\n /**\n * @protected\n */\n _dispatchEvent(layersCount) {\n this.eventBus.dispatch(\"layersloaded\", {\n source: this,\n layersCount,\n });\n }\n\n /**\n * @protected\n */\n _bindLink(element, { groupId, input }) {\n const setVisibility = () => {\n const visible = input.checked;\n this._optionalContentConfig.setVisibility(groupId, visible);\n\n const cached = this._optionalContentVisibility.get(groupId);\n if (cached) {\n cached.visible = visible;\n }\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 _setNestedName(element, { name = null }) {\n if (typeof name === \"string\") {\n element.textContent = this._normalizeTextContent(name);\n return;\n }\n element.setAttribute(\"data-l10n-id\", \"pdfjs-additional-layers\");\n element.style.fontStyle = \"italic\";\n // Trigger translation manually, since translation is paused when\n // the final layer-tree is appended to the DOM.\n this._l10n.translateOnce(element);\n }\n\n /**\n * @protected\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._optionalContentVisibility = new Map();\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 const label = document.createElement(\"label\");\n const input = document.createElement(\"input\");\n label.append(\n input,\n document.createTextNode(this._normalizeTextContent(group.name))\n );\n this._bindLink(element, { groupId, input });\n input.type = \"checkbox\";\n input.checked = group.visible;\n\n this._optionalContentVisibility.set(groupId, {\n input,\n visible: input.checked,\n });\n\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({ intent: \"display\" }));\n\n if (pdfDocument !== this._pdfDocument) {\n return; // The document was closed while the optional content resolved.\n }\n if (promise) {\n // Ensure that the UI displays the correct state (e.g. with RBGroups).\n for (const [groupId, cached] of this._optionalContentVisibility) {\n const group = optionalContentConfig.getGroup(groupId);\n\n if (group && cached.visible !== group.visible) {\n cached.input.checked = cached.visible = !cached.visible;\n }\n }\n return;\n }\n this.eventBus.dispatch(\"optionalcontentconfig\", {\n source: this,\n promise: Promise.resolve(optionalContentConfig),\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\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./download_manager.js\").DownloadManager} DownloadManager */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/api.js\").PDFDocumentProxy} PDFDocumentProxy */\n\nimport { BaseTreeViewer } from \"./base_tree_viewer.js\";\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 {PDFLinkService} 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 {PDFDocumentProxy} 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 this._currentOutlineItemCapability?.resolve(\n /* enabled = */ this._isPagesLoaded\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 this._currentOutlineItemCapability?.resolve(/* enabled = */ false);\n this._currentOutlineItemCapability = null;\n }\n\n /**\n * @protected\n */\n _dispatchEvent(outlineCount) {\n this._currentOutlineItemCapability = Promise.withResolvers();\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 * @protected\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 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 * @protected\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 = Promise.withResolvers();\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 (destRef && typeof destRef === \"object\") {\n // The page reference must be available, since the current method\n // won't be invoked until all pages have been loaded.\n pageNumber = pdfDocument.cachedPageNumber(destRef);\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\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n/** @typedef {import(\"./pdf_viewer.js\").PDFViewer} PDFViewer */\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 #fullscreenChangeAbortController = null;\n\n #windowAbortController = 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 {\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 = {\n mode: AnnotationEditorType.NONE,\n };\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 document.getSelection().empty();\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 = {\n mode: this.#args.annotationEditorMode,\n };\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 if (this.#windowAbortController) {\n return;\n }\n this.#windowAbortController = new AbortController();\n const { signal } = this.#windowAbortController;\n\n const touchSwipeBind = this.#touchSwipe.bind(this);\n\n window.addEventListener(\"mousemove\", this.#showControls.bind(this), {\n signal,\n });\n window.addEventListener(\"mousedown\", this.#mouseDown.bind(this), {\n signal,\n });\n window.addEventListener(\"wheel\", this.#mouseWheel.bind(this), {\n passive: false,\n signal,\n });\n window.addEventListener(\"keydown\", this.#resetMouseScrollState.bind(this), {\n signal,\n });\n window.addEventListener(\"contextmenu\", this.#contextMenu.bind(this), {\n signal,\n });\n window.addEventListener(\"touchstart\", touchSwipeBind, { signal });\n window.addEventListener(\"touchmove\", touchSwipeBind, { signal });\n window.addEventListener(\"touchend\", touchSwipeBind, { signal });\n }\n\n #removeWindowListeners() {\n this.#windowAbortController?.abort();\n this.#windowAbortController = null;\n }\n\n #addFullscreenChangeListeners() {\n if (this.#fullscreenChangeAbortController) {\n return;\n }\n this.#fullscreenChangeAbortController = new AbortController();\n\n window.addEventListener(\n \"fullscreenchange\",\n () => {\n if (/* isFullscreen = */ document.fullscreenElement) {\n this.#enter();\n } else {\n this.#exit();\n }\n },\n { signal: this.#fullscreenChangeAbortController.signal }\n );\n }\n\n #removeFullscreenChangeListeners() {\n this.#fullscreenChangeAbortController?.abort();\n this.#fullscreenChangeAbortController = null;\n }\n}\n\nexport { PDFPresentationMode };\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/annotation_storage\").AnnotationStorage} AnnotationStorage */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"./pdf_link_service.js\").PDFLinkService} PDFLinkService */\n\nimport { XfaLayer } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} XfaLayerBuilderOptions\n * @property {PDFPageProxy} pdfPage\n * @property {AnnotationStorage} [annotationStorage]\n * @property {PDFLinkService} linkService\n * @property {Object} [xfaHtml]\n */\n\n/**\n * @typedef {Object} XfaLayerBuilderRenderOptions\n * @property {PageViewport} viewport\n * @property {string} [intent] - The default value is \"display\".\n */\n\nclass XfaLayerBuilder {\n /**\n * @param {XfaLayerBuilderOptions} options\n */\n constructor({\n pdfPage,\n annotationStorage = null,\n linkService,\n xfaHtml = null,\n }) {\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 {XfaLayerBuilderRenderOptions} viewport\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 this.div = document.createElement(\"div\");\n parameters.div = this.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 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 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\nclass BasePrintServiceFactory {\n constructor() {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n throw new Error(\"Cannot initialize BasePrintServiceFactory.\");\n }\n }\n\n static initGlobals(app) {}\n\n static get supportsPrinting() {\n throw new Error(\"Not implemented: supportsPrinting\");\n }\n\n static createPrintService(params) {\n throw new Error(\"Not implemented: createPrintService\");\n }\n}\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 pdfPage: null,\n annotationStorage: pdfDocument.annotationStorage,\n linkService,\n xfaHtml: xfaPage,\n });\n const viewport = getXfaPageViewport(xfaPage, { scale });\n\n builder.render({ viewport, intent: \"print\" });\n page.append(builder.div);\n }\n}\n\nexport { BasePrintServiceFactory, getXfaHtmlForPrinting };\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 AnnotationMode,\n PixelsPerInch,\n RenderingCancelledException,\n shadow,\n} from \"pdfjs-lib\";\nimport {\n BasePrintServiceFactory,\n getXfaHtmlForPrinting,\n} from \"./print_utils.js\";\n\nlet activeService = null;\nlet dialog = null;\nlet overlayManager = null;\nlet viewerApp = { initialized: false };\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 canvas: scratchCanvas,\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 const renderTask = pdfPage.render(renderContext);\n\n return renderTask.promise.catch(reason => {\n if (!(reason instanceof RenderingCancelledException)) {\n console.error(reason);\n }\n throw reason;\n });\n });\n}\n\nclass PDFPrintService {\n constructor({\n pdfDocument,\n pagesOverview,\n printContainer,\n printResolution,\n printAnnotationStoragePromise = null,\n }) {\n this.pdfDocument = pdfDocument;\n this.pagesOverview = pagesOverview;\n this.printContainer = printContainer;\n this._printResolution = printResolution || 150;\n this._optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({\n intent: \"print\",\n });\n this._printAnnotationStoragePromise =\n printAnnotationStoragePromise || Promise.resolve();\n this.currentPage = -1;\n // The temporary canvas where renderPage paints one page at a time.\n this.scratchCanvas = document.createElement(\"canvas\");\n }\n\n layout() {\n this.throwIfInactive();\n\n const body = document.querySelector(\"body\");\n body.setAttribute(\"data-pdfjsprinting\", true);\n\n const { width, height } = this.pagesOverview[0];\n const hasEqualPageSizes = this.pagesOverview.every(\n size => size.width === width && size.height === height\n );\n if (!hasEqualPageSizes) {\n console.warn(\n \"Not all pages have the same size. The printed 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, the next stylesheet\n // will be ignored and the user has to select the correct paper size in\n // the UI if wanted.\n this.pageStyleSheet = document.createElement(\"style\");\n this.pageStyleSheet.textContent = `@page { size: ${width}pt ${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 overlayManager.closeIfActive(dialog);\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);\n resolve();\n return;\n }\n const index = this.currentPage;\n renderProgress(index, pageCount);\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 this.scratchCanvas.toBlob(blob => {\n img.src = URL.createObjectURL(blob);\n });\n\n const wrapper = document.createElement(\"div\");\n wrapper.className = \"printedPage\";\n wrapper.append(img);\n this.printContainer.append(wrapper);\n\n const { promise, resolve, reject } = Promise.withResolvers();\n img.onload = resolve;\n img.onerror = reject;\n\n promise\n .catch(() => {\n // Avoid \"Uncaught promise\" messages in the console.\n })\n .then(() => {\n URL.revokeObjectURL(img.src);\n });\n return promise;\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 if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n // eslint-disable-next-line no-unsafe-finally\n throw new Error(\"window.print() is not supported\");\n }\n console.error(\"Expected print service to be initialized.\");\n ensureOverlay().then(function () {\n overlayManager.closeIfActive(dialog);\n });\n } else {\n const activeServiceOnEntry = activeService;\n activeService\n .renderPages()\n .then(() => activeServiceOnEntry.performPrint())\n .catch(() => {\n // Ignore any error messages.\n })\n .then(() => {\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\n // aborting this print request while the pages were being generated)\n // would be aborted.\n if (activeServiceOnEntry.active) {\n abort();\n }\n });\n }\n }\n};\n\nfunction dispatchEvent(eventType) {\n const event = new CustomEvent(eventType, {\n bubbles: false,\n cancelable: false,\n detail: \"custom\",\n });\n window.dispatchEvent(event);\n}\n\nfunction abort() {\n if (activeService) {\n activeService.destroy();\n dispatchEvent(\"afterprint\");\n }\n}\n\nfunction renderProgress(index, total) {\n if (typeof PDFJSDev === \"undefined\" && window.isGECKOVIEW) {\n return;\n }\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 progressPerc.setAttribute(\"data-l10n-args\", JSON.stringify({ progress }));\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 (typeof PDFJSDev === \"undefined\" && window.isGECKOVIEW) {\n return Promise.reject(\n new Error(\"ensureOverlay not implemented in GECKOVIEW development mode.\")\n );\n }\n if (!overlayPromise) {\n overlayManager = viewerApp.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\nclass PDFPrintServiceFactory extends BasePrintServiceFactory {\n static initGlobals(app) {\n viewerApp = app;\n }\n\n static get supportsPrinting() {\n return shadow(this, \"supportsPrinting\", true);\n }\n\n static createPrintService(params) {\n if (activeService) {\n throw new Error(\"The print service is created and active.\");\n }\n return (activeService = new PDFPrintService(params));\n }\n}\n\nexport { PDFPrintServiceFactory };\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 RenderingStates = {\n INITIAL: 0,\n RUNNING: 1,\n PAUSED: 2,\n FINISHED: 3,\n};\n\nclass RenderableView {\n /**\n * Unique ID for rendering queue.\n * @type {string}\n */\n renderingId = \"\";\n\n /**\n * @type {import(\"../src/display/api\").RenderTask | null}\n */\n renderTask = null;\n\n /**\n * @type {function | null}\n */\n resume = null;\n\n constructor() {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n this.constructor === RenderableView\n ) {\n throw new Error(\"Cannot initialize RenderableView.\");\n }\n }\n\n /**\n * @type {number}\n */\n get renderingState() {\n throw new Error(\"Abstract getter `renderingState` accessed\");\n }\n\n /**\n * @param {number} state\n */\n set renderingState(state) {\n throw new Error(\"Abstract setter `renderingState` accessed\");\n }\n\n /**\n * @returns {Promise} Resolved on draw completion.\n */\n async draw() {\n throw new Error(\"Not implemented: draw\");\n }\n}\n\nexport { RenderableView, RenderingStates };\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(\"./pdf_viewer\").PDFViewer} PDFViewer */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_thumbnail_viewer\").PDFThumbnailViewer} PDFThumbnailViewer */\n/** @typedef {import(\"./renderable_view\").RenderableView} RenderableView */\n\nimport { RenderingCancelledException } from \"pdfjs-lib\";\nimport { RenderingStates } from \"./renderable_view.js\";\n\nconst CLEANUP_TIMEOUT = 30000;\n\n/**\n * Controls rendering of the views for pages and thumbnails.\n */\nclass PDFRenderingQueue {\n #highestPriorityPage = null;\n\n #idleTimeout = null;\n\n #pdfThumbnailViewer = null;\n\n #pdfViewer = null;\n\n isThumbnailViewEnabled = false;\n\n onIdle = null;\n\n printing = false;\n\n constructor() {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n Object.defineProperty(this, \"hasViewer\", {\n value: () => !!this.#pdfViewer,\n });\n }\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 {RenderableView} view\n * @returns {boolean}\n */\n isHighestPriority(view) {\n return this.#highestPriorityPage === view.renderingId;\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 * @param {boolean} [ignoreDetailViews]\n */\n getHighestPriority(\n visible,\n views,\n scrolledDown,\n preRenderExtra = false,\n ignoreDetailViews = false\n ) {\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. zoomed-in partial views of visible pages, unless `ignoreDetailViews`\n * 3. 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\n if (!ignoreDetailViews) {\n for (let i = 0; i < numVisible; i++) {\n const { detailView } = visibleViews[i].view;\n if (detailView && !this.isViewFinished(detailView)) {\n return detailView;\n }\n }\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 {RenderableView} 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 {RenderableView} 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 } from \"./ui_utils.js\";\nimport { RenderingStates } from \"./renderable_view.js\";\nimport { 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\n * scripting bundle.\n * @property {Object} [externalServices] - 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} [docProperties] - The function that is used to lookup\n * the necessary document properties.\n */\n\nclass PDFScriptingManager {\n #closeCapability = null;\n\n #destroyCapability = null;\n\n #docProperties = null;\n\n #eventAbortController = null;\n\n #eventBus = null;\n\n #externalServices = null;\n\n #pdfDocument = null;\n\n #pdfViewer = null;\n\n #ready = false;\n\n #scripting = null;\n\n #willPrintCapability = null;\n\n /**\n * @param {PDFScriptingManagerOptions} options\n */\n constructor({ eventBus, externalServices = null, docProperties = null }) {\n this.#eventBus = eventBus;\n this.#externalServices = externalServices;\n this.#docProperties = docProperties;\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n Object.defineProperty(this, \"sandboxTrip\", {\n value: () =>\n setTimeout(\n () =>\n this.#scripting?.dispatchEventInSandbox({\n name: \"sandboxtripbegin\",\n }),\n 0\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.#initScripting();\n } catch (error) {\n console.error(\"setDocument:\", error);\n\n await this.#destroyScripting();\n return;\n }\n const eventBus = this.#eventBus;\n\n this.#eventAbortController = new AbortController();\n const { signal } = this.#eventAbortController;\n\n eventBus._on(\n \"updatefromsandbox\",\n event => {\n if (event?.source === window) {\n this.#updateFromSandbox(event.detail);\n }\n },\n { signal }\n );\n eventBus._on(\n \"dispatcheventinsandbox\",\n event => {\n this.#scripting?.dispatchEventInSandbox(event.detail);\n },\n { signal }\n );\n\n eventBus._on(\n \"pagechanging\",\n ({ 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 { signal }\n );\n eventBus._on(\n \"pagerendered\",\n ({ 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 { signal }\n );\n eventBus._on(\n \"pagesdestroy\",\n async () => {\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 { signal }\n );\n\n try {\n const docProperties = await this.#docProperties(pdfDocument);\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 eventBus.dispatch(\"sandboxcreated\", { source: this });\n } catch (error) {\n console.error(\"setDocument:\", error);\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() {\n return this.#scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"WillSave\",\n });\n }\n\n async dispatchDidSave() {\n return this.#scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"DidSave\",\n });\n }\n\n async dispatchWillPrint() {\n if (!this.#scripting) {\n return;\n }\n await this.#willPrintCapability?.promise;\n this.#willPrintCapability = Promise.withResolvers();\n try {\n await this.#scripting.dispatchEventInSandbox({\n id: \"doc\",\n name: \"WillPrint\",\n });\n } catch (ex) {\n this.#willPrintCapability.resolve();\n this.#willPrintCapability = null;\n throw ex;\n }\n\n await this.#willPrintCapability.promise;\n }\n\n async dispatchDidPrint() {\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 _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 async #updateFromSandbox(detail) {\n const pdfViewer = this.#pdfViewer;\n // Ignore some events, see below, that don't make sense in PresentationMode.\n const isInPresentationMode =\n pdfViewer.isInPresentationMode || pdfViewer.isChangingPresentationMode;\n\n const { id, siblings, command, value } = detail;\n if (!id) {\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"TESTING\") &&\n command === \"sandboxTripEnd\"\n ) {\n window.setTimeout(() => {\n window.dispatchEvent(new CustomEvent(\"sandboxtripend\"));\n }, 0);\n return;\n }\n\n switch (command) {\n case \"clear\":\n console.clear();\n break;\n case \"error\":\n console.error(value);\n break;\n case \"layout\":\n if (!isInPresentationMode) {\n const modes = apiPageLayoutToViewerModes(value);\n pdfViewer.spreadMode = modes.spreadMode;\n }\n break;\n case \"page-num\":\n pdfViewer.currentPageNumber = value + 1;\n break;\n case \"print\":\n await 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 pdfViewer.currentScaleValue = value;\n }\n break;\n case \"SaveAs\":\n this.#eventBus.dispatch(\"download\", { source: this });\n break;\n case \"FirstPage\":\n pdfViewer.currentPageNumber = 1;\n break;\n case \"LastPage\":\n pdfViewer.currentPageNumber = pdfViewer.pagesCount;\n break;\n case \"NextPage\":\n pdfViewer.nextPage();\n break;\n case \"PrevPage\":\n pdfViewer.previousPage();\n break;\n case \"ZoomViewIn\":\n if (!isInPresentationMode) {\n pdfViewer.increaseScale();\n }\n break;\n case \"ZoomViewOut\":\n if (!isInPresentationMode) {\n pdfViewer.decreaseScale();\n }\n break;\n case \"WillPrintFinished\":\n this.#willPrintCapability?.resolve();\n this.#willPrintCapability = null;\n break;\n }\n return;\n }\n\n if (isInPresentationMode && detail.focus) {\n return;\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 async #dispatchPageOpen(pageNumber, initialize = false) {\n const pdfDocument = this.#pdfDocument,\n visitedPages = this._visitedPages;\n\n if (initialize) {\n this.#closeCapability = Promise.withResolvers();\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 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 #initScripting() {\n this.#destroyCapability = Promise.withResolvers();\n\n if (this.#scripting) {\n throw new Error(\"#initScripting: Scripting already exists.\");\n }\n return this.#externalServices.createScripting();\n }\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(() => {\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 {}\n\n this.#willPrintCapability?.reject(new Error(\"Scripting destroyed.\"));\n this.#willPrintCapability = null;\n\n this.#eventAbortController?.abort();\n this.#eventAbortController = null;\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 2024 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 * This class manages the interaction of extracting the text content of the page\n * and passing it back to the external service.\n */\nclass PdfTextExtractor {\n /** @type {PDFViewer} */\n #pdfViewer;\n\n #externalServices;\n\n /**\n * @type {?Promise<string>}\n */\n #textPromise;\n\n #pendingRequests = new Set();\n\n constructor(externalServices) {\n this.#externalServices = externalServices;\n\n window.addEventListener(\"requestTextContent\", ({ detail }) => {\n this.extractTextContent(detail.requestId);\n });\n }\n\n /**\n * The PDF viewer is required to get the page text.\n *\n * @param {PDFViewer | null}\n */\n setViewer(pdfViewer) {\n this.#pdfViewer = pdfViewer;\n if (this.#pdfViewer && this.#pendingRequests.size) {\n // Handle any pending requests that came in while things were loading.\n for (const pendingRequest of this.#pendingRequests) {\n this.extractTextContent(pendingRequest);\n }\n this.#pendingRequests.clear();\n }\n }\n\n /**\n * Builds up all of the text from a PDF.\n *\n * @param {number} requestId\n */\n async extractTextContent(requestId) {\n if (!this.#pdfViewer) {\n this.#pendingRequests.add(requestId);\n return;\n }\n\n if (!this.#textPromise) {\n const textPromise = (this.#textPromise = this.#pdfViewer.getAllText());\n\n // After the text resolves, cache the text for a little bit in case\n // multiple consumers call it.\n textPromise.then(() => {\n setTimeout(() => {\n if (this.#textPromise === textPromise) {\n this.#textPromise = null;\n }\n }, 5000);\n });\n }\n\n this.#externalServices.reportText({\n text: await this.#textPromise,\n requestId,\n });\n }\n}\n\nexport { PdfTextExtractor };\n","/* Copyright 2025 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 { noContextMenu, stopEvent } from \"pdfjs-lib\";\n\nclass Menu {\n #triggeringButton;\n\n #menu;\n\n #menuItems;\n\n #openMenuAC = null;\n\n #menuAC = new AbortController();\n\n #lastIndex = -1;\n\n #onFocusOutBound = this.#onFocusOut.bind(this);\n\n /**\n * Create a menu for the given button.\n * @param {HTMLElement} menuContainer\n * @param {HTMLElement} triggeringButton\n * @param {Array<HTMLElement>|null} menuItems\n */\n constructor(menuContainer, triggeringButton, menuItems) {\n this.#menu = menuContainer;\n this.#triggeringButton = triggeringButton;\n if (Array.isArray(menuItems)) {\n this.#menuItems = menuItems;\n } else {\n this.#menuItems = [];\n for (const button of this.#menu.querySelectorAll(\"button\")) {\n this.#menuItems.push(button);\n }\n }\n this.#setUpMenu();\n }\n\n /**\n * Close the menu.\n */\n #closeMenu() {\n if (!this.#openMenuAC) {\n return;\n }\n const menu = this.#menu;\n this.#triggeringButton.ariaExpanded = \"false\";\n this.#openMenuAC.abort();\n this.#openMenuAC = null;\n if (menu.contains(document.activeElement)) {\n // If the menu is closed while focused, focus the actions button.\n setTimeout(() => {\n if (!menu.contains(document.activeElement)) {\n this.#triggeringButton.focus();\n }\n }, 0);\n }\n this.#lastIndex = -1;\n }\n\n /**\n * Open the menu.\n */\n #openMenu() {\n if (this.#openMenuAC) {\n return;\n }\n\n const menu = this.#menu;\n this.#triggeringButton.ariaExpanded = \"true\";\n this.#openMenuAC = new AbortController();\n const signal = AbortSignal.any([\n this.#menuAC.signal,\n this.#openMenuAC.signal,\n ]);\n window.addEventListener(\n \"pointerdown\",\n ({ target }) => {\n if (\n !this.#triggeringButton.contains(target) &&\n !menu.contains(target)\n ) {\n this.#closeMenu();\n }\n },\n { signal }\n );\n const closeMenu = this.#closeMenu.bind(this);\n window.addEventListener(\"blur\", closeMenu, { signal });\n menu.addEventListener(\"focusout\", this.#onFocusOutBound, { signal });\n }\n\n #onFocusOut({ relatedTarget }) {\n if (\n !this.#triggeringButton.contains(relatedTarget) &&\n !this.#menu.contains(relatedTarget)\n ) {\n this.#closeMenu();\n }\n }\n\n /**\n * Set up the menu.\n */\n #setUpMenu() {\n this.#triggeringButton.addEventListener(\"click\", e => {\n if (this.#openMenuAC) {\n this.#closeMenu();\n return;\n }\n\n this.#openMenu();\n });\n this.#triggeringButton.addEventListener(\"focusout\", this.#onFocusOutBound);\n\n const { signal } = this.#menuAC;\n\n this.#menu.addEventListener(\n \"keydown\",\n e => {\n switch (e.key) {\n case \"Escape\":\n this.#closeMenu();\n stopEvent(e);\n break;\n case \"ArrowDown\":\n this.#goToNextItem(e.target, true);\n stopEvent(e);\n break;\n case \"ArrowUp\":\n this.#goToNextItem(e.target, false);\n stopEvent(e);\n break;\n case \"Home\":\n this.#menuItems\n .find(\n item => !item.disabled && !item.classList.contains(\"hidden\")\n )\n ?.focus();\n stopEvent(e);\n break;\n case \"End\":\n this.#menuItems\n .findLast(\n item => !item.disabled && !item.classList.contains(\"hidden\")\n )\n ?.focus();\n stopEvent(e);\n break;\n default:\n const { key } = e;\n if (!/^\\p{L}$/u.test(key)) {\n // It isn't a single letter, so ignore it.\n break;\n }\n const char = key.toLocaleLowerCase();\n this.#goToNextItem(e.target, true, item =>\n item.textContent.trim().toLowerCase().startsWith(char)\n );\n stopEvent(e);\n break;\n }\n },\n { signal, capture: true }\n );\n this.#menu.addEventListener(\"contextmenu\", noContextMenu, { signal });\n this.#menu.addEventListener(\"click\", this.#closeMenu.bind(this), {\n signal,\n capture: true,\n });\n this.#triggeringButton.addEventListener(\n \"keydown\",\n e => {\n switch (e.key) {\n case \" \":\n case \"Enter\":\n case \"ArrowDown\":\n case \"Home\":\n stopEvent(e);\n if (!this.#openMenuAC) {\n this.#openMenu();\n }\n this.#menuItems\n .find(\n item => !item.disabled && !item.classList.contains(\"hidden\")\n )\n ?.focus();\n break;\n case \"ArrowUp\":\n case \"End\":\n stopEvent(e);\n if (!this.#openMenuAC) {\n this.#openMenu();\n }\n this.#menuItems\n .findLast(\n item => !item.disabled && !item.classList.contains(\"hidden\")\n )\n ?.focus();\n break;\n case \"Escape\":\n this.#closeMenu();\n stopEvent(e);\n break;\n }\n },\n { signal }\n );\n }\n\n /**\n * Go to the next/previous menu item.\n * @param {HTMLElement} element\n * @param {boolean} forward\n */\n #goToNextItem(element, forward, check = () => true) {\n const index =\n this.#lastIndex === -1\n ? this.#menuItems.indexOf(element)\n : this.#lastIndex;\n const len = this.#menuItems.length;\n const increment = forward ? 1 : len - 1;\n for (\n let i = (index + increment) % len;\n i !== index;\n i = (i + increment) % len\n ) {\n const menuItem = this.#menuItems[i];\n if (\n !menuItem.disabled &&\n !menuItem.classList.contains(\"hidden\") &&\n check(menuItem)\n ) {\n menuItem.focus();\n this.#lastIndex = i;\n break;\n }\n }\n }\n\n destroy() {\n this.#closeMenu();\n this.#menuAC?.abort();\n this.#menuAC = null;\n }\n}\n\nexport { Menu };\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/optional_content_config\").OptionalContentConfig} OptionalContentConfig */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n\nimport {\n FeatureTest,\n OutputScale,\n RenderingCancelledException,\n} from \"pdfjs-lib\";\nimport { RenderableView, RenderingStates } from \"./renderable_view.js\";\nimport { AppOptions } from \"./app_options.js\";\n\nconst DRAW_UPSCALE_FACTOR = 2; // See comment in `PDFThumbnailView.draw` below.\nconst MAX_NUM_SCALING_STEPS = 3;\nconst THUMBNAIL_WIDTH = 126; // px\n\n/**\n * @typedef {Object} PDFThumbnailViewOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\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 {PDFLinkService} linkService - The navigation/linking service.\n * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.\n * @property {number} [maxCanvasPixels] - The maximum supported canvas size in\n * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for\n * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).\n * @property {number} [maxCanvasDim] - The maximum supported canvas dimension,\n * in either width or height. Use `-1` for no limit.\n * The default value is 32767.\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 getCanvas(width, height) {\n let tempCanvas;\n if (FeatureTest.isOffscreenCanvasSupported) {\n tempCanvas = new OffscreenCanvas(width, height);\n } else {\n tempCanvas = document.createElement(\"canvas\");\n tempCanvas.width = width;\n tempCanvas.height = height;\n }\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, ctx];\n }\n}\n\nclass PDFThumbnailView extends RenderableView {\n #renderingState = RenderingStates.INITIAL;\n\n /**\n * @param {PDFThumbnailViewOptions} options\n */\n constructor({\n container,\n eventBus,\n id,\n defaultViewport,\n optionalContentConfigPromise,\n linkService,\n renderingQueue,\n maxCanvasPixels,\n maxCanvasDim,\n pageColors,\n enableSplitMerge = false,\n }) {\n super();\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.maxCanvasPixels = maxCanvasPixels ?? AppOptions.get(\"maxCanvasPixels\");\n this.maxCanvasDim = maxCanvasDim || AppOptions.get(\"maxCanvasDim\");\n this.pageColors = pageColors || null;\n\n this.eventBus = eventBus;\n this.linkService = linkService;\n this.renderingQueue = renderingQueue;\n\n this.placeholder = null;\n\n const thumbnailContainer = (this.div = document.createElement(\"div\"));\n thumbnailContainer.className = \"thumbnail\";\n thumbnailContainer.setAttribute(\"page-number\", id);\n\n const imageContainer = (this.imageContainer =\n document.createElement(\"div\"));\n thumbnailContainer.append(imageContainer);\n imageContainer.classList.add(\n \"thumbnailImageContainer\",\n \"missingThumbnailImage\"\n );\n imageContainer.role = \"button\";\n imageContainer.tabIndex = -1;\n imageContainer.draggable = false;\n imageContainer.setAttribute(\"page-number\", id);\n imageContainer.setAttribute(\"data-l10n-id\", \"pdfjs-thumb-page-title1\");\n imageContainer.setAttribute(\"data-l10n-args\", this.#getPageL10nArgs(true));\n\n const image = (this.image = document.createElement(\"img\"));\n imageContainer.append(image);\n\n if (enableSplitMerge) {\n const checkbox = (this.checkbox = document.createElement(\"input\"));\n checkbox.type = \"checkbox\";\n checkbox.tabIndex = -1;\n checkbox.setAttribute(\"data-l10n-id\", \"pdfjs-thumb-page-checkbox1\");\n checkbox.setAttribute(\"data-l10n-args\", this.#getPageL10nArgs());\n thumbnailContainer.append(checkbox);\n this.pasteButton = null;\n }\n\n this.#updateDims();\n\n container.append(thumbnailContainer);\n }\n\n clone(container, id) {\n const thumbnailView = new PDFThumbnailView({\n container,\n id,\n eventBus: this.eventBus,\n defaultViewport: this.viewport,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n linkService: this.linkService,\n renderingQueue: this.renderingQueue,\n maxCanvasPixels: this.maxCanvasPixels,\n maxCanvasDim: this.maxCanvasDim,\n pageColors: this.pageColors,\n enableSplitMerge: !!this.checkbox,\n });\n thumbnailView.setPdfPage(this.pdfPage);\n const { imageContainer } = this;\n if (!imageContainer.classList.contains(\"missingThumbnailImage\")) {\n thumbnailView.image.replaceWith(this.image.cloneNode(true));\n thumbnailView.imageContainer.classList.remove(\"missingThumbnailImage\");\n }\n return thumbnailView;\n }\n\n addPasteButton(pasteCallback) {\n if (this.pasteButton) {\n return;\n }\n const pasteButton = (this.pasteButton = document.createElement(\"button\"));\n pasteButton.classList.add(\"thumbnailPasteButton\", \"viewsManagerButton\");\n pasteButton.tabIndex = 0;\n const span = document.createElement(\"span\");\n span.setAttribute(\"data-l10n-id\", \"pdfjs-views-manager-paste-button-label\");\n pasteButton.append(span);\n pasteButton.addEventListener(\"click\", () => {\n pasteCallback(this.id);\n });\n\n this.imageContainer.after(pasteButton);\n }\n\n toggleSelected(isSelected) {\n if (this.checkbox) {\n this.checkbox.checked = isSelected;\n }\n }\n\n updateId(newId) {\n this.id = newId;\n this.renderingId = `thumbnail${newId}`;\n this.div.setAttribute(\"page-number\", newId);\n this.imageContainer.setAttribute(\"page-number\", newId);\n // TODO: do we set the page label ?\n this.setPageLabel(this.pageLabel);\n }\n\n #updateDims() {\n const { width, height } = this.viewport;\n const ratio = width / height;\n\n const canvasWidth = (this.canvasWidth = THUMBNAIL_WIDTH);\n const canvasHeight = (this.canvasHeight = (canvasWidth / ratio) | 0);\n this.scale = canvasWidth / width;\n\n this.imageContainer.style.height = `${canvasHeight}px`;\n }\n\n get renderingState() {\n return this.#renderingState;\n }\n\n set renderingState(state) {\n this.#renderingState = state;\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 this.#updateDims();\n\n const { image, imageContainer } = this;\n const url = image.src;\n if (url) {\n URL.revokeObjectURL(url);\n image.src = \"\";\n imageContainer.removeAttribute(\"data-l10n-id\");\n imageContainer.removeAttribute(\"data-l10n-args\");\n imageContainer.classList.add(\"missingThumbnailImage\");\n }\n }\n\n destroy() {\n this.reset();\n this.toggleCurrent(false);\n this.div.remove();\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 toggleCurrent(isCurrent) {\n const { imageContainer } = this;\n if (isCurrent) {\n imageContainer.ariaCurrent = \"page\";\n imageContainer.tabIndex = 0;\n if (this.checkbox) {\n this.checkbox.tabIndex = 0;\n }\n } else {\n imageContainer.ariaCurrent = false;\n imageContainer.tabIndex = -1;\n if (this.checkbox) {\n this.checkbox.tabIndex = -1;\n }\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 if (this.renderTask) {\n this.renderTask.cancel();\n this.renderTask = null;\n }\n this.resume = null;\n }\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 outputScale = new OutputScale();\n const width = upscaleFactor * this.canvasWidth,\n height = upscaleFactor * this.canvasHeight;\n\n outputScale.limitCanvas(\n width,\n height,\n this.maxCanvasPixels,\n this.maxCanvasDim\n );\n // Because of: https://bugzilla.mozilla.org/show_bug.cgi?id=2003060\n // we need use a HTMLCanvasElement here.\n const canvas = document.createElement(\"canvas\");\n canvas.width = (width * outputScale.sx) | 0;\n canvas.height = (height * outputScale.sy) | 0;\n\n const transform = outputScale.scaled\n ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]\n : null;\n\n return { canvas, transform };\n }\n\n async #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 const { imageContainer, image } = this;\n const { promise, resolve } = Promise.withResolvers();\n reducedCanvas.toBlob(resolve);\n const blob = await promise;\n image.src = URL.createObjectURL(blob);\n image.setAttribute(\"data-l10n-id\", \"pdfjs-thumb-page-canvas\");\n image.setAttribute(\"data-l10n-args\", this.#getPageL10nArgs());\n imageContainer.classList.remove(\"missingThumbnailImage\");\n if (!FeatureTest.isOffscreenCanvasSupported) {\n // Clean up the canvas element since it is no longer needed.\n reducedCanvas.width = reducedCanvas.height = 0;\n }\n }\n\n async draw() {\n if (this.renderingState !== RenderingStates.INITIAL) {\n console.error(\"Must be in new state before drawing\");\n return;\n }\n const { pageColors, pdfPage } = this;\n\n if (!pdfPage) {\n this.renderingState = RenderingStates.FINISHED;\n throw new Error(\"pdfPage is not loaded\");\n }\n\n this.renderingState = RenderingStates.RUNNING;\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 { canvas, transform } = 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 canvas,\n transform,\n viewport: drawViewport,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n pageColors,\n };\n const renderTask = (this.renderTask = pdfPage.render(renderContext));\n renderTask.onContinue = renderContinueCallback;\n\n let error = null;\n try {\n await renderTask.promise;\n } catch (e) {\n if (e instanceof RenderingCancelledException) {\n return;\n }\n error = e;\n } finally {\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 this.renderingState = RenderingStates.FINISHED;\n\n await this.#convertCanvasToImage(canvas);\n\n this.eventBus.dispatch(\"thumbnailrendered\", {\n source: this,\n pageNumber: this.id,\n pdfPage,\n });\n\n if (error) {\n throw error;\n }\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 #getReducedImageDims(canvas) {\n const width = canvas.width << MAX_NUM_SCALING_STEPS,\n height = canvas.height << MAX_NUM_SCALING_STEPS;\n\n const outputScale = new OutputScale();\n // Here we're not actually \"rendering\" to the canvas and the `OutputScale`\n // is thus only used to limit the canvas size, hence the identity scale.\n outputScale.sx = outputScale.sy = 1;\n\n outputScale.limitCanvas(\n width,\n height,\n this.maxCanvasPixels,\n this.maxCanvasDim\n );\n return [(width * outputScale.sx) | 0, (height * outputScale.sy) | 0];\n }\n\n #reduceImage(img) {\n const { canvas } = this.#getPageDrawContext(1);\n const ctx = canvas.getContext(\"2d\", {\n alpha: false,\n willReadFrequently: false,\n });\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, reducedHeight] = this.#getReducedImageDims(canvas);\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 #getPageL10nArgs(hasTotal = false) {\n return JSON.stringify({\n page: this.pageLabel ?? this.id,\n total: hasTotal ? this.linkService.pagesCount : undefined,\n });\n }\n\n /**\n * @param {string|null} label\n */\n setPageLabel(label) {\n this.pageLabel = typeof label === \"string\" ? label : null;\n this.imageContainer.setAttribute(\n \"data-l10n-args\",\n this.#getPageL10nArgs(true)\n );\n this.image.setAttribute(\"data-l10n-args\", this.#getPageL10nArgs());\n this.checkbox?.setAttribute(\"data-l10n-args\", this.#getPageL10nArgs());\n }\n}\n\nexport { PDFThumbnailView };\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(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n/** @typedef {import(\"./pdf_link_service.js\").PDFLinkService} PDFLinkService */\n\nimport {\n binarySearchFirstItem,\n getVisibleElements,\n isValidRotation,\n watchScroll,\n} from \"./ui_utils.js\";\nimport { MathClamp, noContextMenu, stopEvent } from \"pdfjs-lib\";\nimport { Menu } from \"./menu.js\";\nimport { PDFThumbnailView } from \"./pdf_thumbnail_view.js\";\nimport { RenderingStates } from \"./renderable_view.js\";\n\nconst SCROLL_OPTIONS = {\n behavior: \"instant\",\n block: \"nearest\",\n inline: \"nearest\",\n container: \"nearest\",\n};\n\n// This value is based on the one used in Firefox.\n// See\n// https://searchfox.org/firefox-main/rev/04cf27582307a9c351e991c740828d54cf786b76/dom/events/EventStateManager.cpp#2675-2698\n// This threshold is used to distinguish between a click and a drag.\nconst DRAG_THRESHOLD_IN_PIXELS = 5;\nconst PIXELS_TO_SCROLL_WHEN_DRAGGING = 20;\nconst SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT = 15;\n\n/**\n * @typedef {Object} PDFThumbnailViewerOptions\n * @property {HTMLDivElement} container - The container for the thumbnail\n * elements.\n * @property {EventBus} eventBus - The application event bus.\n * @property {PDFLinkService} linkService - The navigation/linking service.\n * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.\n * @property {number} [maxCanvasPixels] - The maximum supported canvas size in\n * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for\n * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).\n * @property {number} [maxCanvasDim] - The maximum supported canvas dimension,\n * in either width or height. Use `-1` for no limit.\n * The default value is 32767.\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 {AbortSignal} [abortSignal] - The AbortSignal for the window\n * events.\n * @property {boolean} [enableHWA] - Enables hardware acceleration for\n * rendering. The default value is `false`.\n * @property {boolean} [enableSplitMerge] - Enables split and merge features.\n * The default value is `false`.\n * @property {Object} [manageMenu] - The menu elements to manage saving edited\n * PDF.\n * @property {HTMLButtonElement} addFileButton - The button that opens a dialog\n * to add a PDF file to merge with the current one.\n\n/**\n * Viewer control to display thumbnails for pages in a PDF document.\n */\nclass PDFThumbnailViewer {\n static #draggingScaleFactor = 0;\n\n #enableSplitMerge = false;\n\n #dragAC = null;\n\n #draggedContainer = null;\n\n #thumbnailsPositions = null;\n\n #lastDraggedOverIndex = NaN;\n\n #selectedPages = null;\n\n #draggedImageX = 0;\n\n #draggedImageY = 0;\n\n #draggedImageWidth = 0;\n\n #draggedImageHeight = 0;\n\n #draggedImageOffsetX = 0;\n\n #draggedImageOffsetY = 0;\n\n #dragMarker = null;\n\n #pageNumberToRemove = NaN;\n\n #currentScrollBottom = 0;\n\n #currentScrollTop = 0;\n\n #pagesMapper = null;\n\n #manageSaveAsButton = null;\n\n #manageDeleteButton = null;\n\n #manageCopyButton = null;\n\n #manageCutButton = null;\n\n #copiedThumbnails = null;\n\n #copiedPageNumbers = null;\n\n #isCut = false;\n\n #isOneColumnView = false;\n\n #scrollableContainerWidth = 0;\n\n #scrollableContainerHeight = 0;\n\n /**\n * @param {PDFThumbnailViewerOptions} options\n */\n constructor({\n container,\n eventBus,\n linkService,\n renderingQueue,\n maxCanvasPixels,\n maxCanvasDim,\n pageColors,\n abortSignal,\n enableHWA,\n enableSplitMerge,\n manageMenu,\n addFileButton,\n }) {\n this.scrollableContainer = container.parentElement;\n this.container = container;\n this.eventBus = eventBus;\n this.linkService = linkService;\n this.renderingQueue = renderingQueue;\n this.maxCanvasPixels = maxCanvasPixels;\n this.maxCanvasDim = maxCanvasDim;\n this.pageColors = pageColors || null;\n this.enableHWA = enableHWA || false;\n this.#enableSplitMerge = enableSplitMerge || false;\n // TODO: uncomment when the \"add file\" feature is implemented.\n // this.#addFileButton = addFileButton;\n\n if (this.#enableSplitMerge && manageMenu) {\n const { button, menu, copy, cut, delete: del, saveAs } = manageMenu;\n this.eventBus.on(\n \"pagesloaded\",\n () => {\n button.disabled = false;\n },\n { once: true }\n );\n\n this._manageMenu = new Menu(menu, button, [copy, cut, del, saveAs]);\n this.#manageSaveAsButton = saveAs;\n saveAs.addEventListener(\"click\", () => {\n this.eventBus.dispatch(\"savepageseditedpdf\", {\n source: this,\n data: this.#pagesMapper.getPageMappingForSaving(),\n });\n });\n this.#manageDeleteButton = del;\n del.addEventListener(\"click\", this.#deletePages.bind(this));\n this.#manageCopyButton = copy;\n copy.addEventListener(\"click\", this.#copyPages.bind(this));\n this.#manageCutButton = cut;\n cut.addEventListener(\"click\", this.#cutPages.bind(this));\n\n this.#toggleMenuEntries(false);\n button.disabled = true;\n } else {\n manageMenu.button.hidden = true;\n }\n\n this.scroll = watchScroll(\n this.scrollableContainer,\n this.#scrollUpdated.bind(this),\n abortSignal\n );\n this.#resetView();\n this.#addEventListeners();\n }\n\n #scrollUpdated() {\n this.renderingQueue.renderHighestPriority();\n }\n\n getThumbnail(index) {\n return this._thumbnails[index];\n }\n\n #getVisibleThumbs() {\n return getVisibleElements({\n scrollEl: this.scrollableContainer,\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 if (pageNumber !== this._currentPageNumber) {\n const prevThumbnailView = this._thumbnails[this._currentPageNumber - 1];\n prevThumbnailView?.toggleCurrent(/* isCurrent = */ false);\n thumbnailView.toggleCurrent(/* isCurrent = */ true);\n this._currentPageNumber = pageNumber;\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 thumbnailView.div.scrollIntoView(SCROLL_OPTIONS);\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 }\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 this.#pagesMapper = pdfDocument.pagesMapper;\n const firstPagePromise = pdfDocument.getPage(1);\n const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({\n intent: \"display\",\n });\n\n firstPagePromise\n .then(firstPdfPage => {\n const pagesCount = pdfDocument.numPages;\n const viewport = firstPdfPage.getViewport({ scale: 1 });\n const fragment = document.createDocumentFragment();\n\n for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n const thumbnail = new PDFThumbnailView({\n container: fragment,\n eventBus: this.eventBus,\n id: pageNum,\n defaultViewport: viewport.clone(),\n optionalContentConfigPromise,\n linkService: this.linkService,\n renderingQueue: this.renderingQueue,\n maxCanvasPixels: this.maxCanvasPixels,\n maxCanvasDim: this.maxCanvasDim,\n pageColors: this.pageColors,\n enableHWA: this.enableHWA,\n enableSplitMerge: this.#enableSplitMerge,\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.toggleCurrent(/* isCurrent = */ true);\n this.container.append(fragment);\n })\n .catch(reason => {\n console.error(\"Unable to initialize thumbnail viewer\", reason);\n });\n }\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 /* preRenderExtra */ false,\n /* ignoreDetailViews */ true\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 static #getScaleFactor(image) {\n return (PDFThumbnailViewer.#draggingScaleFactor ||= parseFloat(\n getComputedStyle(image).getPropertyValue(\"--thumbnail-dragging-scale\")\n ));\n }\n\n #updateThumbnails(currentPageNumber) {\n let newCurrentPageNumber = 0;\n const pagesMapper = this.#pagesMapper;\n this.container.replaceChildren();\n const prevThumbnails = this._thumbnails;\n const newThumbnails = (this._thumbnails = []);\n const fragment = document.createDocumentFragment();\n const isCut = this.#isCut;\n const oldThumbnails = new Set(prevThumbnails);\n for (let i = 1, ii = pagesMapper.pagesNumber; i <= ii; i++) {\n const prevPageNumber = pagesMapper.getPrevPageNumber(i);\n if (prevPageNumber < 0) {\n let thumbnail = this.#copiedThumbnails.get(-prevPageNumber);\n oldThumbnails.delete(thumbnail);\n thumbnail.checkbox.checked = false;\n if (isCut) {\n thumbnail.updateId(i);\n fragment.append(thumbnail.div);\n } else {\n thumbnail = thumbnail.clone(fragment, i);\n }\n newThumbnails.push(thumbnail);\n continue;\n }\n if (prevPageNumber === currentPageNumber) {\n newCurrentPageNumber = i;\n }\n const newThumbnail = prevThumbnails[prevPageNumber - 1];\n newThumbnails.push(newThumbnail);\n newThumbnail.updateId(i);\n oldThumbnails.delete(newThumbnail);\n newThumbnail.checkbox.checked = false;\n fragment.append(newThumbnail.div);\n }\n this.container.append(fragment);\n for (const oldThumbnail of oldThumbnails) {\n oldThumbnail.destroy();\n }\n return newCurrentPageNumber;\n }\n\n #onStartDragging(draggedThumbnail) {\n this.#currentScrollTop = this.scrollableContainer.scrollTop;\n this.#currentScrollBottom =\n this.#currentScrollTop + this.scrollableContainer.clientHeight;\n this.#dragAC = new AbortController();\n this.container.classList.add(\"isDragging\");\n const startPageNumber = parseInt(\n draggedThumbnail.getAttribute(\"page-number\"),\n 10\n );\n this.#lastDraggedOverIndex = startPageNumber - 1;\n if (!this.#selectedPages?.has(startPageNumber)) {\n this.#pageNumberToRemove = startPageNumber;\n this.#selectPage(startPageNumber, true);\n }\n\n for (const selected of this.#selectedPages) {\n const thumbnail = this._thumbnails[selected - 1];\n const placeholder = (thumbnail.placeholder =\n document.createElement(\"div\"));\n placeholder.classList.add(\"thumbnailImageContainer\", \"placeholder\");\n const { div, imageContainer } = thumbnail;\n div.classList.add(\"isDragging\");\n placeholder.style.height = getComputedStyle(imageContainer).height;\n imageContainer.after(placeholder);\n if (selected !== startPageNumber) {\n imageContainer.classList.add(\"hidden\");\n continue;\n }\n if (this.#selectedPages.size === 1) {\n imageContainer.classList.add(\"draggingThumbnail\");\n this.#draggedContainer = imageContainer;\n continue;\n }\n // For multiple selected thumbnails, only the one being dragged is shown\n // (with the dragging style), while the others are hidden.\n const draggedContainer = (this.#draggedContainer =\n document.createElement(\"div\"));\n draggedContainer.classList.add(\n \"draggingThumbnail\",\n \"thumbnailImageContainer\",\n \"multiple\"\n );\n draggedContainer.style.height = getComputedStyle(imageContainer).height;\n imageContainer.replaceWith(draggedContainer);\n imageContainer.classList.remove(\"thumbnailImageContainer\");\n draggedContainer.append(imageContainer);\n draggedContainer.setAttribute(\n \"data-multiple-count\",\n this.#selectedPages.size\n );\n }\n }\n\n #onStopDragging(isDropping = false) {\n const draggedContainer = this.#draggedContainer;\n this.#draggedContainer = null;\n const lastDraggedOverIndex = this.#lastDraggedOverIndex;\n this.#lastDraggedOverIndex = NaN;\n this.#dragMarker?.remove();\n this.#dragMarker = null;\n this.#dragAC.abort();\n this.#dragAC = null;\n\n this.container.classList.remove(\"isDragging\");\n for (const selected of this.#selectedPages) {\n const thumbnail = this._thumbnails[selected - 1];\n const { div, placeholder, imageContainer } = thumbnail;\n placeholder.remove();\n imageContainer.classList.remove(\"draggingThumbnail\", \"hidden\");\n div.classList.remove(\"isDragging\");\n }\n\n if (draggedContainer.classList.contains(\"multiple\")) {\n // Restore the dragged image to its thumbnail.\n const originalImageContainer = draggedContainer.firstElementChild;\n draggedContainer.replaceWith(originalImageContainer);\n originalImageContainer.classList.add(\"thumbnailImageContainer\");\n } else {\n draggedContainer.style.translate = \"\";\n }\n\n const selectedPages = this.#selectedPages;\n if (\n !isNaN(lastDraggedOverIndex) &&\n isDropping &&\n !(\n selectedPages.size === 1 &&\n (selectedPages.has(lastDraggedOverIndex + 1) ||\n selectedPages.has(lastDraggedOverIndex + 2))\n )\n ) {\n this._thumbnails[this._currentPageNumber - 1]?.toggleCurrent(\n /* isCurrent = */ false\n );\n this._currentPageNumber = -1;\n\n const newIndex = lastDraggedOverIndex + 1;\n const pagesToMove = Array.from(selectedPages).sort((a, b) => a - b);\n const pagesMapper = this.#pagesMapper;\n let currentPageNumber = isNaN(this.#pageNumberToRemove)\n ? pagesToMove[0]\n : this.#pageNumberToRemove;\n\n pagesMapper.movePages(selectedPages, pagesToMove, newIndex);\n\n currentPageNumber = this.#updateThumbnails(currentPageNumber);\n this.#computeThumbnailsPosition();\n\n selectedPages.clear();\n this.#pageNumberToRemove = NaN;\n this.#updateMenuEntries();\n\n this.eventBus.dispatch(\"pagesedited\", {\n source: this,\n pagesMapper,\n type: \"move\",\n });\n\n setTimeout(() => {\n this.forceRendering();\n this.linkService.goToPage(currentPageNumber);\n }, 0);\n }\n\n if (!isNaN(this.#pageNumberToRemove)) {\n this.#selectPage(this.#pageNumberToRemove, false);\n this.#pageNumberToRemove = NaN;\n }\n }\n\n #clearSelection() {\n for (const pageNumber of this.#selectedPages) {\n this._thumbnails[pageNumber - 1].toggleSelected(false);\n }\n this.#selectedPages.clear();\n }\n\n #copyPages(clearSelection = true) {\n const pageNumbersToCopy = (this.#copiedPageNumbers = Uint32Array.from(\n this.#selectedPages\n ).sort((a, b) => a - b));\n const pagesMapper = this.#pagesMapper;\n pagesMapper.copyPages(pageNumbersToCopy);\n this.#copiedThumbnails ||= new Map();\n for (const pageNumber of pageNumbersToCopy) {\n this.#copiedThumbnails.set(pageNumber, this._thumbnails[pageNumber - 1]);\n }\n this.eventBus.dispatch(\"pagesedited\", {\n source: this,\n pagesMapper,\n pageNumbers: pageNumbersToCopy,\n type: \"copy\",\n });\n if (clearSelection) {\n this.#clearSelection();\n }\n for (const thumbnail of this._thumbnails) {\n thumbnail.addPasteButton(this.#pastePages.bind(this));\n }\n this.container.classList.add(\"pasteMode\");\n this.#toggleMenuEntries(false);\n }\n\n #cutPages() {\n this.#isCut = true;\n this.#copyPages(false);\n this.#deletePages(/* type = */ \"cut\");\n }\n\n #pastePages(index) {\n this.container.classList.remove(\"pasteMode\");\n this.#toggleMenuEntries(true);\n\n const pagesMapper = this.#pagesMapper;\n let currentPageNumber = this.#copiedPageNumbers.includes(\n this._currentPageNumber\n )\n ? 0\n : this._currentPageNumber;\n\n pagesMapper.pastePages(index);\n currentPageNumber = this.#updateThumbnails(currentPageNumber);\n\n this.eventBus.dispatch(\"pagesedited\", {\n source: this,\n pagesMapper,\n hasBeenCut: this.#isCut,\n type: \"paste\",\n });\n\n this.#copiedThumbnails = null;\n this.#isCut = false;\n this.#updateMenuEntries();\n\n setTimeout(() => {\n this.forceRendering();\n this.linkService.goToPage(currentPageNumber || 1);\n }, 0);\n }\n\n #deletePages(type = \"delete\") {\n const selectedPages = this.#selectedPages;\n if (selectedPages.size === 0) {\n return;\n }\n const pagesMapper = this.#pagesMapper;\n let currentPageNumber = selectedPages.has(this._currentPageNumber)\n ? 0\n : this._currentPageNumber;\n const pagesToDelete = Uint32Array.from(selectedPages).sort((a, b) => a - b);\n\n pagesMapper.deletePages(pagesToDelete);\n currentPageNumber = this.#updateThumbnails(currentPageNumber);\n selectedPages.clear();\n this.#updateMenuEntries();\n\n this.eventBus.dispatch(\"pagesedited\", {\n source: this,\n pagesMapper,\n pageNumbers: pagesToDelete,\n type,\n });\n\n setTimeout(() => {\n this.forceRendering();\n this.linkService.goToPage(currentPageNumber || 1);\n }, 0);\n }\n\n #updateMenuEntries() {\n this.#manageSaveAsButton.disabled = !this.#pagesMapper.hasBeenAltered();\n this.#manageDeleteButton.disabled =\n this.#manageCopyButton.disabled =\n this.#manageCutButton.disabled =\n !this.#selectedPages?.size;\n }\n\n #toggleMenuEntries(enable) {\n this.#manageSaveAsButton.disabled =\n this.#manageDeleteButton.disabled =\n this.#manageCopyButton.disabled =\n this.#manageCutButton.disabled =\n !enable;\n }\n\n #moveDraggedContainer(dx, dy) {\n if (this.#isOneColumnView) {\n dx = 0;\n }\n if (\n this.#draggedImageX + dx < 0 ||\n this.#draggedImageX + this.#draggedImageWidth + dx >\n this.#scrollableContainerWidth\n ) {\n dx = 0;\n }\n if (\n this.#draggedImageY + dy < 0 ||\n this.#draggedImageY + this.#draggedImageHeight + dy >\n this.#scrollableContainerHeight\n ) {\n dy = 0;\n }\n\n this.#draggedImageX += dx;\n this.#draggedImageY += dy;\n this.#draggedImageOffsetX += dx;\n this.#draggedImageOffsetY += dy;\n this.#draggedContainer.style.translate = `${this.#draggedImageOffsetX}px ${this.#draggedImageOffsetY}px`;\n if (\n this.#draggedImageY + this.#draggedImageHeight >\n this.#currentScrollBottom\n ) {\n this.scrollableContainer.scrollTop = Math.min(\n this.scrollableContainer.scrollTop + PIXELS_TO_SCROLL_WHEN_DRAGGING,\n this.#scrollableContainerHeight\n );\n } else if (this.#draggedImageY < this.#currentScrollTop) {\n this.scrollableContainer.scrollTop = Math.max(\n this.scrollableContainer.scrollTop - PIXELS_TO_SCROLL_WHEN_DRAGGING,\n 0\n );\n }\n\n const positionData = this.#findClosestThumbnail(\n this.#draggedImageX + this.#draggedImageWidth / 2,\n this.#draggedImageY + this.#draggedImageHeight / 2\n );\n if (!positionData) {\n return;\n }\n let dragMarker = this.#dragMarker;\n if (!dragMarker) {\n dragMarker = this.#dragMarker = document.createElement(\"div\");\n dragMarker.className = \"dragMarker\";\n this.container.firstChild.before(dragMarker);\n }\n\n const [index, space] = positionData;\n const dragMarkerStyle = dragMarker.style;\n const { bbox, x: xPos } = this.#thumbnailsPositions;\n let x, y, width, height;\n if (index < 0) {\n if (xPos.length === 1) {\n y = bbox[1] - SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT;\n x = bbox[4];\n width = bbox[2];\n } else {\n y = bbox[1];\n x = bbox[0] - SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT;\n height = bbox[3];\n }\n } else if (xPos.length === 1) {\n y = bbox[index * 4 + 1] + bbox[index * 4 + 3] + space;\n x = bbox[index * 4];\n width = bbox[index * 4 + 2];\n } else {\n y = bbox[index * 4 + 1];\n x = bbox[index * 4] + bbox[index * 4 + 2] + space;\n height = bbox[index * 4 + 3];\n }\n dragMarkerStyle.translate = `${x}px ${y}px`;\n dragMarkerStyle.width = width ? `${width}px` : \"\";\n dragMarkerStyle.height = height ? `${height}px` : \"\";\n }\n\n #computeThumbnailsPosition() {\n // Collect the center of each thumbnail.\n // This is used to determine the closest thumbnail when dragging.\n // TODO: handle the RTL case.\n const positionsX = [];\n const positionsY = [];\n const positionsLastX = [];\n const bbox = new Float32Array(this._thumbnails.length * 4);\n let prevX = -Infinity;\n let prevY = -Infinity;\n let reminder = -1;\n let firstRightX;\n let lastRightX;\n let firstBottomY;\n for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {\n const { div } = this._thumbnails[i];\n const {\n offsetTop: y,\n offsetLeft: x,\n offsetWidth: w,\n offsetHeight: h,\n } = div;\n if (w === 0) {\n // The thumbnail view isn't visible.\n return;\n }\n bbox[i * 4] = x;\n bbox[i * 4 + 1] = y;\n bbox[i * 4 + 2] = w;\n bbox[i * 4 + 3] = h;\n if (x > prevX) {\n prevX = x + w / 2;\n firstRightX ??= prevX + w;\n positionsX.push(prevX);\n }\n if (reminder > 0 && i >= ii - reminder) {\n const cx = x + w / 2;\n positionsLastX.push(cx);\n lastRightX ??= cx + w;\n }\n if (y > prevY) {\n if (reminder === -1 && positionsX.length > 1) {\n reminder = ii % positionsX.length;\n }\n prevY = y + h / 2;\n firstBottomY ??= prevY + h;\n positionsY.push(prevY);\n }\n }\n const space =\n positionsX.length > 1\n ? (positionsX[1] - firstRightX) / 2\n : (positionsY[1] - firstBottomY) / 2;\n this.#thumbnailsPositions = {\n x: positionsX,\n y: positionsY,\n lastX: positionsLastX,\n space,\n lastSpace: (positionsLastX.at(-1) - lastRightX) / 2,\n bbox,\n };\n this.#isOneColumnView = positionsX.length === 1;\n ({\n clientWidth: this.#scrollableContainerWidth,\n scrollHeight: this.#scrollableContainerHeight,\n } = this.scrollableContainer);\n }\n\n #addEventListeners() {\n this.eventBus.on(\"resize\", ({ source }) => {\n if (source.thumbnailsView === this.container) {\n this.#computeThumbnailsPosition();\n }\n });\n this.container.addEventListener(\"keydown\", e => {\n const { target } = e;\n const isCheckbox =\n target instanceof HTMLInputElement && target.type === \"checkbox\";\n\n switch (e.key) {\n case \"ArrowLeft\":\n this.#goToNextItem(target, false, true, isCheckbox);\n stopEvent(e);\n break;\n case \"ArrowRight\":\n this.#goToNextItem(target, true, true, isCheckbox);\n stopEvent(e);\n break;\n case \"ArrowDown\":\n this.#goToNextItem(target, true, false, isCheckbox);\n stopEvent(e);\n break;\n case \"ArrowUp\":\n this.#goToNextItem(target, false, false, isCheckbox);\n stopEvent(e);\n break;\n case \"Home\":\n this.#focusThumbnailElement(this._thumbnails[0], isCheckbox);\n stopEvent(e);\n break;\n case \"End\":\n this.#focusThumbnailElement(this._thumbnails.at(-1), isCheckbox);\n stopEvent(e);\n break;\n case \"Enter\":\n case \" \":\n if (!isCheckbox) {\n this.#goToPage(e);\n }\n // For checkboxes, let the default behavior handle toggling\n break;\n case \"c\":\n if (\n this.#enableSplitMerge &&\n (e.ctrlKey || e.metaKey) &&\n this.#selectedPages?.size\n ) {\n this.#copyPages();\n stopEvent(e);\n }\n break;\n case \"x\":\n if (\n this.#enableSplitMerge &&\n (e.ctrlKey || e.metaKey) &&\n this.#selectedPages?.size\n ) {\n this.#cutPages();\n stopEvent(e);\n }\n break;\n case \"Delete\":\n case \"Backspace\":\n if (this.#enableSplitMerge && this.#selectedPages?.size) {\n this.#deletePages();\n stopEvent(e);\n }\n break;\n }\n });\n this.container.addEventListener(\"click\", e => {\n const { target } = e;\n if (target instanceof HTMLInputElement) {\n const pageNumber = parseInt(\n target.parentElement.getAttribute(\"page-number\"),\n 10\n );\n this.#selectPage(pageNumber, target.checked);\n return;\n }\n this.#goToPage(e);\n });\n this.#addDragListeners();\n }\n\n #selectPage(pageNumber, checked) {\n const set = (this.#selectedPages ??= new Set());\n if (checked) {\n set.add(pageNumber);\n } else {\n set.delete(pageNumber);\n }\n this.#updateMenuEntries();\n }\n\n #addDragListeners() {\n if (!this.#enableSplitMerge) {\n return;\n }\n this.container.addEventListener(\"pointerdown\", e => {\n const {\n target: draggedImage,\n clientX: clickX,\n clientY: clickY,\n pointerId: dragPointerId,\n } = e;\n if (\n e.button !== 0 || // Skip right click.\n this.#pagesMapper.copiedPageNumbers?.length > 0 ||\n !isNaN(this.#lastDraggedOverIndex) ||\n !draggedImage.classList.contains(\"thumbnailImageContainer\")\n ) {\n // We're already handling a drag, or the target is not draggable.\n return;\n }\n\n const thumbnail = draggedImage.parentElement;\n const pointerDownAC = new AbortController();\n const { signal: pointerDownSignal } = pointerDownAC;\n let prevDragX = clickX;\n let prevDragY = clickY;\n let prevScrollTop = this.scrollableContainer.scrollTop;\n\n // When dragging, the thumbnail is scaled down. To keep the cursor at the\n // same position on the thumbnail, we need to adjust the offset\n // accordingly.\n const scaleFactor = PDFThumbnailViewer.#getScaleFactor(draggedImage);\n this.#draggedImageOffsetY =\n ((scaleFactor - 1) * e.layerY + draggedImage.offsetTop) / scaleFactor;\n\n if (this.#isOneColumnView) {\n this.#draggedImageOffsetX =\n draggedImage.offsetLeft +\n ((scaleFactor - 1) * 0.5 * draggedImage.offsetWidth) / scaleFactor;\n } else {\n this.#draggedImageOffsetX =\n ((scaleFactor - 1) * e.layerX + draggedImage.offsetLeft) /\n scaleFactor;\n }\n this.#draggedImageX = thumbnail.offsetLeft + this.#draggedImageOffsetX;\n this.#draggedImageY = thumbnail.offsetTop + this.#draggedImageOffsetY;\n this.#draggedImageWidth = draggedImage.offsetWidth / scaleFactor;\n this.#draggedImageHeight = draggedImage.offsetHeight / scaleFactor;\n\n this.container.addEventListener(\n \"pointermove\",\n ev => {\n const { clientX: x, clientY: y, pointerId } = ev;\n if (isNaN(this.#lastDraggedOverIndex)) {\n if (\n pointerId !== dragPointerId ||\n (Math.abs(x - clickX) <= DRAG_THRESHOLD_IN_PIXELS &&\n Math.abs(y - clickY) <= DRAG_THRESHOLD_IN_PIXELS)\n ) {\n // Not enough movement to be considered a drag.\n return;\n }\n\n // First movement while dragging.\n this.#onStartDragging(thumbnail);\n const stopDragging = (_e, isDropping = false) => {\n this.#onStopDragging(isDropping);\n pointerDownAC.abort();\n };\n const { signal } = this.#dragAC;\n window.addEventListener(\n \"touchmove\",\n stopEvent /* Prevent the container from scrolling */,\n { passive: false, signal }\n );\n window.addEventListener(\"contextmenu\", noContextMenu, { signal });\n this.scrollableContainer.addEventListener(\n \"scrollend\",\n () => {\n const {\n scrollableContainer: { clientHeight, scrollTop },\n } = this;\n this.#currentScrollTop = scrollTop;\n this.#currentScrollBottom = scrollTop + clientHeight;\n const dy = scrollTop - prevScrollTop;\n prevScrollTop = scrollTop;\n this.#moveDraggedContainer(0, dy);\n },\n { passive: true, signal }\n );\n window.addEventListener(\n \"pointerup\",\n upEv => {\n if (upEv.pointerId !== dragPointerId) {\n return;\n }\n // Prevent the subsequent click event after pointerup.\n window.addEventListener(\"click\", stopEvent, {\n capture: true,\n once: true,\n signal,\n });\n stopEvent(upEv);\n stopDragging(upEv, /* isDropping = */ true);\n },\n { signal }\n );\n window.addEventListener(\"blur\", stopDragging, { signal });\n window.addEventListener(\"pointercancel\", stopDragging, { signal });\n window.addEventListener(\"wheel\", stopEvent, {\n passive: false,\n signal,\n });\n window.addEventListener(\n \"keydown\",\n kEv => {\n if (\n kEv.key === \"Escape\" &&\n !isNaN(this.#lastDraggedOverIndex)\n ) {\n stopDragging(kEv);\n }\n },\n { signal }\n );\n }\n\n const dx = x - prevDragX;\n const dy = y - prevDragY;\n prevDragX = x;\n prevDragY = y;\n this.#moveDraggedContainer(dx, dy);\n },\n { passive: true, signal: pointerDownSignal }\n );\n window.addEventListener(\n \"pointerup\",\n ({ pointerId }) => {\n if (pointerId !== dragPointerId) {\n return;\n }\n pointerDownAC.abort();\n },\n { signal: pointerDownSignal }\n );\n window.addEventListener(\"dragstart\", stopEvent, {\n capture: true,\n signal: pointerDownSignal,\n });\n });\n }\n\n #goToPage(e) {\n const { target } = e;\n if (target.classList.contains(\"thumbnailImageContainer\")) {\n const pageNumber = parseInt(\n target.parentElement.getAttribute(\"page-number\"),\n 10\n );\n this.linkService.goToPage(pageNumber);\n stopEvent(e);\n }\n }\n\n /**\n * Focus either the checkbox or image of a thumbnail.\n * @param {PDFThumbnailView} thumbnail\n * @param {boolean} focusCheckbox - If true, focus checkbox; otherwise focus\n * image\n */\n #focusThumbnailElement(thumbnail, focusCheckbox) {\n if (focusCheckbox && thumbnail.checkbox) {\n thumbnail.checkbox.focus();\n } else {\n thumbnail.imageContainer.focus();\n }\n }\n\n /**\n * Go to the next/previous menu item.\n * @param {HTMLElement} element\n * @param {boolean} forward\n * @param {boolean} horizontal\n * @param {boolean} navigateCheckboxes - If true, focus checkboxes;\n * otherwise focus images\n */\n #goToNextItem(element, forward, horizontal, navigateCheckboxes = false) {\n let currentPageNumber = parseInt(\n element.parentElement.getAttribute(\"page-number\"),\n 10\n );\n if (isNaN(currentPageNumber)) {\n currentPageNumber = this._currentPageNumber;\n }\n\n const increment = forward ? 1 : -1;\n let nextThumbnail;\n if (horizontal) {\n const nextPageNumber = MathClamp(\n currentPageNumber + increment,\n 1,\n this._thumbnails.length + 1\n );\n nextThumbnail = this._thumbnails[nextPageNumber - 1];\n } else {\n const currentThumbnail = this._thumbnails[currentPageNumber - 1];\n const { x: currentX, y: currentY } =\n currentThumbnail.div.getBoundingClientRect();\n let firstWithDifferentY;\n for (\n let i = currentPageNumber - 1 + increment;\n i >= 0 && i < this._thumbnails.length;\n i += increment\n ) {\n const thumbnail = this._thumbnails[i];\n const { x, y } = thumbnail.div.getBoundingClientRect();\n if (!firstWithDifferentY && y !== currentY) {\n firstWithDifferentY = thumbnail;\n }\n if (x === currentX) {\n nextThumbnail = thumbnail;\n break;\n }\n }\n if (!nextThumbnail) {\n nextThumbnail = firstWithDifferentY;\n }\n }\n if (nextThumbnail) {\n this.#focusThumbnailElement(nextThumbnail, navigateCheckboxes);\n }\n }\n\n // Given the drag center (x, y), find the drop slot index: the drag marker\n // will be placed after thumbnail[index], or before all thumbnails if index\n // is -1. Returns null when the drop slot hasn't changed (no marker update\n // needed), or [index, space] where space is the gap (in px) between\n // thumbnails at that slot, used to position the marker.\n //\n // positionsX holds the x-center of each column, positionsY the y-center of\n // each row. positionsLastX holds the x-centers for an incomplete last row\n // (when the total number of thumbnails is not a multiple of the column\n // count).\n #findClosestThumbnail(x, y) {\n if (!this.#thumbnailsPositions) {\n this.#computeThumbnailsPosition();\n }\n const {\n x: positionsX,\n y: positionsY,\n lastX: positionsLastX,\n space: spaceBetweenThumbnails,\n lastSpace: lastSpaceBetweenThumbnails,\n } = this.#thumbnailsPositions;\n const lastDraggedOverIndex = this.#lastDraggedOverIndex;\n\n // Fast-path: reconstruct the row/col of the previous drop slot and check\n // whether (x, y) still falls inside the same cell's bounds.\n let xPos = lastDraggedOverIndex % positionsX.length;\n let yPos = Math.floor(lastDraggedOverIndex / positionsX.length);\n let xArray = yPos === positionsY.length - 1 ? positionsLastX : positionsX;\n if (\n positionsY[yPos] <= y &&\n y < (positionsY[yPos + 1] ?? Infinity) &&\n xArray[xPos] <= x &&\n x < (xArray[xPos + 1] ?? Infinity)\n ) {\n // Fast-path: we're still in the same thumbnail.\n return null;\n }\n\n let index;\n // binarySearchFirstItem returns the first row index whose center is below\n // y, i.e. the first i such that positionsY[i] > y.\n yPos = binarySearchFirstItem(positionsY, cy => y < cy);\n if (this.#isOneColumnView) {\n // In a single column the drop slot is simply the row boundary: the marker\n // goes after row (yPos - 1), meaning before row yPos. index = -1 when y\n // is above the first thumbnail's center (drop before thumbnail 0).\n index = yPos - 1;\n } else {\n // Grid layout: first pick the nearest row, then the nearest column.\n\n if (yPos === positionsY.length) {\n // y is below the last row's center — clamp to the last row.\n yPos = positionsY.length - 1;\n } else {\n // Choose between the row just above (yPos - 1) and the row at yPos by\n // comparing distances, so the marker snaps to whichever row center is\n // closer to y.\n const dist1 = Math.abs(positionsY[yPos - 1] - y);\n const dist2 = Math.abs(positionsY[yPos] - y);\n yPos = dist1 < dist2 ? yPos - 1 : yPos;\n }\n // The last row may be incomplete, so use its own x-center array.\n xArray =\n yPos === positionsY.length - 1 && positionsLastX.length > 0\n ? positionsLastX\n : positionsX;\n // Find the column: the first column whose center is to the right of x,\n // minus 1, gives the column the cursor is in (or -1 if before column 0).\n xPos = binarySearchFirstItem(xArray, cx => x < cx) - 1;\n if (yPos < 0) {\n // y is above the first row: force drop before the very first thumbnail.\n if (xPos <= 0) {\n xPos = -1;\n }\n yPos = 0;\n }\n // Convert (row, col) to a flat thumbnail index, clamped to\n // [-1, length-1].\n index = MathClamp(\n yPos * positionsX.length + xPos,\n -1,\n this._thumbnails.length - 1\n );\n }\n if (index === lastDraggedOverIndex) {\n // No change.\n return null;\n }\n this.#lastDraggedOverIndex = index;\n // Use the last-row gap when the drop slot is in the incomplete last row.\n const space =\n yPos === positionsY.length - 1 && positionsLastX.length > 0 && xPos >= 0\n ? lastSpaceBetweenThumbnails\n : spaceBetweenThumbnails;\n\n return [index, space];\n }\n}\n\nexport { PDFThumbnailViewer };\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// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/annotation_layer.js\").AnnotationLayer} AnnotationLayer */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/struct_tree_layer_builder.js\").StructTreeLayerBuilder} StructTreeLayerBuilder */\n\nimport { AnnotationEditorLayer } from \"pdfjs-lib\";\nimport { GenericL10n } from \"web-null_l10n\";\n\n/**\n * @typedef {Object} AnnotationEditorLayerBuilderOptions\n * @property {AnnotationEditorUIManager} [uiManager]\n * @property {number} pageIndex\n * @property {L10n} [l10n]\n * @property {StructTreeLayerBuilder} [structTreeLayer]\n * @property {TextAccessibilityManager} [accessibilityManager]\n * @property {AnnotationLayer} [annotationLayer]\n * @property {TextLayer} [textLayer]\n * @property {DrawLayer} [drawLayer]\n * @property {function} [onAppend]\n * @property {AnnotationEditorLayer} [clonedFrom]\n */\n\n/**\n * @typedef {Object} AnnotationEditorLayerBuilderRenderOptions\n * @property {PageViewport} viewport\n * @property {string} [intent] - The default value is \"display\".\n */\n\nclass AnnotationEditorLayerBuilder {\n #annotationLayer = null;\n\n #drawLayer = null;\n\n #onAppend = null;\n\n #structTreeLayer = null;\n\n #textLayer = null;\n\n #uiManager;\n\n #clonedFrom = null;\n\n /**\n * @param {AnnotationEditorLayerBuilderOptions} options\n */\n constructor(options) {\n this.pageIndex = options.pageIndex;\n this.accessibilityManager = options.accessibilityManager;\n this.l10n = options.l10n;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this.l10n ||= new GenericL10n();\n }\n this.annotationEditorLayer = null;\n this.div = null;\n this._cancelled = false;\n this.#uiManager = options.uiManager;\n this.#annotationLayer = options.annotationLayer || null;\n this.#textLayer = options.textLayer || null;\n this.#drawLayer = options.drawLayer || null;\n this.#onAppend = options.onAppend || null;\n this.#structTreeLayer = options.structTreeLayer || null;\n this.#clonedFrom = options.clonedFrom || null;\n }\n\n updatePageIndex(newPageIndex) {\n this.pageIndex = newPageIndex;\n this.annotationEditorLayer?.updatePageIndex(newPageIndex);\n }\n\n /**\n * @param {AnnotationEditorLayerBuilderRenderOptions} options\n * @returns {Promise<void>}\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.hidden = true;\n div.dir = this.#uiManager.direction;\n this.#onAppend?.(div);\n\n this.annotationEditorLayer = new AnnotationEditorLayer({\n uiManager: this.#uiManager,\n div,\n structTreeLayer: this.#structTreeLayer,\n accessibilityManager: this.accessibilityManager,\n pageIndex: this.pageIndex,\n l10n: this.l10n,\n viewport: clonedViewport,\n annotationLayer: this.#annotationLayer,\n textLayer: this.#textLayer,\n drawLayer: this.#drawLayer,\n });\n\n this.annotationEditorLayer.setClonedFrom(\n this.#clonedFrom?.annotationEditorLayer\n );\n this.#clonedFrom = null;\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.annotationEditorLayer.destroy();\n }\n\n hide() {\n if (!this.div) {\n return;\n }\n this.annotationEditorLayer.pause(/* on */ true);\n this.div.hidden = true;\n }\n\n show() {\n if (!this.div || this.annotationEditorLayer.isInvisible) {\n return;\n }\n this.div.hidden = false;\n this.annotationEditorLayer.pause(/* on */ 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// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/annotation_storage\").AnnotationStorage} AnnotationStorage */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./struct_tree_layer_builder.js\").StructTreeLayerBuilder} StructTreeLayerBuilder */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/editor/tools.js\").AnnotationEditorUIManager} AnnotationEditorUIManager */\n/** @typedef {import(\"./comment_manager.js\").CommentManager} CommentManager */\n/** @typedef {import(\"./pdf_link_service.js\").PDFLinkService} PDFLinkService */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./base_download_manager.js\").BaseDownloadManager} BaseDownloadManager */\n\nimport {\n AnnotationLayer,\n AnnotationType,\n setLayerDimensions,\n Util,\n} from \"pdfjs-lib\";\nimport { PresentationModeState } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} AnnotationLayerBuilderOptions\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 {PDFLinkService} linkService\n * @property {BaseDownloadManager} [downloadManager]\n * @property {boolean} [enableComment]\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 * @property {AnnotationEditorUIManager} [annotationEditorUIManager]\n * @property {function} [onAppend]\n * @property {CommentManager} [commentManager]\n */\n\n/**\n * @typedef {Object} AnnotationLayerBuilderRenderOptions\n * @property {PageViewport} viewport\n * @property {string} [intent] - The default value is \"display\".\n * @property {StructTreeLayerBuilder} [structTreeLayer]\n */\n\nclass AnnotationLayerBuilder {\n #annotations = null;\n\n #commentManager = null;\n\n #externalHide = false;\n\n #onAppend = null;\n\n #eventAbortController = null;\n\n #linksInjected = false;\n\n /**\n * @param {AnnotationLayerBuilderOptions} options\n */\n constructor({\n pdfPage,\n linkService,\n downloadManager,\n annotationStorage = null,\n imageResourcesPath = \"\",\n renderForms = true,\n enableComment = false,\n commentManager = null,\n enableScripting = false,\n hasJSActionsPromise = null,\n fieldObjectsPromise = null,\n annotationCanvasMap = null,\n accessibilityManager = null,\n annotationEditorUIManager = null,\n onAppend = null,\n }) {\n this.pdfPage = pdfPage;\n this.linkService = linkService;\n this.downloadManager = downloadManager;\n this.imageResourcesPath = imageResourcesPath;\n this.renderForms = renderForms;\n this.annotationStorage = annotationStorage;\n this.enableComment = enableComment;\n this.#commentManager = commentManager;\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 this._annotationEditorUIManager = annotationEditorUIManager;\n this.#onAppend = onAppend;\n\n this.annotationLayer = null;\n this.div = null;\n this._cancelled = false;\n this._eventBus = linkService.eventBus;\n }\n\n /**\n * @param {AnnotationLayerBuilderRenderOptions} options\n * @returns {Promise<void>} A promise that is resolved when rendering of the\n * annotations is complete.\n */\n async render({ viewport, intent = \"display\", structTreeLayer = null }) {\n if (this.div) {\n if (this._cancelled || !this.annotationLayer) {\n return;\n }\n // If an annotationLayer already exists, refresh its children's\n // transformation matrices.\n this.annotationLayer.update({\n viewport: viewport.clone({ dontFlip: true }),\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\n // Create an annotation layer div and render the annotations\n // if there is at least one annotation.\n const div = (this.div = document.createElement(\"div\"));\n div.className = \"annotationLayer\";\n this.#onAppend?.(div);\n this.#initAnnotationLayer(viewport, structTreeLayer);\n\n if (annotations.length === 0) {\n this.#annotations = annotations;\n setLayerDimensions(this.div, viewport);\n return;\n }\n\n await this.annotationLayer.render({\n annotations,\n imageResourcesPath: this.imageResourcesPath,\n renderForms: this.renderForms,\n downloadManager: this.downloadManager,\n enableComment: this.enableComment,\n enableScripting: this.enableScripting,\n hasJSActions,\n fieldObjects,\n });\n\n this.#annotations = annotations;\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.#eventAbortController) {\n this.#eventAbortController = new AbortController();\n\n this._eventBus?._on(\n \"presentationmodechanged\",\n evt => {\n this.#updatePresentationModeState(evt.state);\n },\n { signal: this.#eventAbortController.signal }\n );\n }\n }\n\n #initAnnotationLayer(viewport, structTreeLayer) {\n this.annotationLayer = new AnnotationLayer({\n div: this.div,\n accessibilityManager: this._accessibilityManager,\n annotationCanvasMap: this._annotationCanvasMap,\n annotationEditorUIManager: this._annotationEditorUIManager,\n annotationStorage: this.annotationStorage,\n page: this.pdfPage,\n viewport: viewport.clone({ dontFlip: true }),\n structTreeLayer,\n commentManager: this.#commentManager,\n linkService: this.linkService,\n });\n }\n\n cancel() {\n this._cancelled = true;\n\n this.#eventAbortController?.abort();\n this.#eventAbortController = null;\n }\n\n hide(internal = false) {\n this.#externalHide = !internal;\n if (!this.div) {\n return;\n }\n this.div.hidden = true;\n }\n\n hasEditableAnnotations() {\n return !!this.annotationLayer?.hasEditableAnnotations();\n }\n\n /**\n * @param {Array<Object>} inferredLinks\n * @returns {Promise<void>} A promise that is resolved when the inferred links\n * are added to the annotation layer.\n */\n async injectLinkAnnotations(inferredLinks) {\n if (this.#annotations === null) {\n throw new Error(\n \"`render` method must be called before `injectLinkAnnotations`.\"\n );\n }\n if (this._cancelled || this.#linksInjected) {\n return;\n }\n this.#linksInjected = true;\n\n const newLinks = this.#annotations.length\n ? this.#checkInferredLinks(inferredLinks)\n : inferredLinks;\n\n if (!newLinks.length) {\n return;\n }\n\n await this.annotationLayer.addLinkAnnotations(newLinks);\n // Don't show the annotation layer if it was explicitly hidden previously.\n if (!this.#externalHide) {\n this.div.hidden = false;\n }\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 #checkInferredLinks(inferredLinks) {\n function annotationRects(annot) {\n if (!annot.quadPoints) {\n return [annot.rect];\n }\n const rects = [];\n for (let i = 2, ii = annot.quadPoints.length; i < ii; i += 8) {\n const trX = annot.quadPoints[i];\n const trY = annot.quadPoints[i + 1];\n const blX = annot.quadPoints[i + 2];\n const blY = annot.quadPoints[i + 3];\n rects.push([blX, blY, trX, trY]);\n }\n return rects;\n }\n\n function intersectAnnotations(annot1, annot2) {\n const intersections = [];\n const annot1Rects = annotationRects(annot1);\n const annot2Rects = annotationRects(annot2);\n for (const rect1 of annot1Rects) {\n for (const rect2 of annot2Rects) {\n const intersection = Util.intersect(rect1, rect2);\n if (intersection) {\n intersections.push(intersection);\n }\n }\n }\n return intersections;\n }\n\n function areaRects(rects) {\n let totalArea = 0;\n for (const rect of rects) {\n totalArea += Math.abs((rect[2] - rect[0]) * (rect[3] - rect[1]));\n }\n return totalArea;\n }\n\n return inferredLinks.filter(link => {\n let linkAreaRects;\n\n for (const annotation of this.#annotations) {\n if (\n annotation.annotationType !== AnnotationType.LINK ||\n !annotation.url\n ) {\n continue;\n }\n // TODO: Add a test case to verify that we can find the intersection\n // between two annotations with quadPoints properly.\n const intersections = intersectAnnotations(annotation, link);\n\n if (intersections.length === 0) {\n continue;\n }\n linkAreaRects ??= areaRects(annotationRects(link));\n\n if (\n areaRects(intersections) / linkAreaRects >\n 0.5 /* If the overlap is more than 50%. */\n ) {\n return false;\n }\n }\n return true;\n });\n }\n}\n\nexport { AnnotationLayerBuilder };\n","/* Copyright 2025 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 { AnnotationType, createValidAbsoluteUrl, Util } from \"pdfjs-lib\";\nimport { getOriginalIndex, normalize } from \"./pdf_find_controller.js\";\n\nfunction DOMRectToPDF({ width, height, left, top }, pdfPageView) {\n if (width === 0 || height === 0) {\n return null;\n }\n\n const pageBox = pdfPageView.textLayer.div.getBoundingClientRect();\n const bottomLeft = pdfPageView.getPagePoint(\n left - pageBox.left,\n top - pageBox.top\n );\n const topRight = pdfPageView.getPagePoint(\n left - pageBox.left + width,\n top - pageBox.top + height\n );\n\n return Util.normalizeRect([\n bottomLeft[0],\n bottomLeft[1],\n topRight[0],\n topRight[1],\n ]);\n}\n\nfunction calculateLinkPosition(range, pdfPageView) {\n const rangeRects = range.getClientRects();\n if (rangeRects.length === 1) {\n return { rect: DOMRectToPDF(rangeRects[0], pdfPageView) };\n }\n\n const rect = [Infinity, Infinity, -Infinity, -Infinity];\n const quadPoints = [];\n let i = 0;\n for (const domRect of rangeRects) {\n const normalized = DOMRectToPDF(domRect, pdfPageView);\n if (normalized === null) {\n continue;\n }\n\n quadPoints[i] = quadPoints[i + 4] = normalized[0];\n quadPoints[i + 1] = quadPoints[i + 3] = normalized[3];\n quadPoints[i + 2] = quadPoints[i + 6] = normalized[2];\n quadPoints[i + 5] = quadPoints[i + 7] = normalized[1];\n\n Util.rectBoundingBox(...normalized, rect);\n i += 8;\n }\n return { quadPoints, rect };\n}\n\n/**\n * Given a DOM node `container` and an index into its text contents `offset`,\n * returns a pair consisting of text node that the `offset` actually points\n * to, together with the offset relative to that text node.\n * When the offset points at the boundary between two node, the result will\n * point to the first text node in depth-first traversal order.\n *\n * For example, given this DOM:\n * <p>abc<span>def</span>ghi</p>\n *\n * textPosition(p, 0) -> [#text \"abc\", 0] (before `a`)\n * textPosition(p, 2) -> [#text \"abc\", 2] (between `b` and `c`)\n * textPosition(p, 3) -> [#text \"abc\", 3] (after `c`)\n * textPosition(p, 5) -> [#text \"def\", 2] (between `e` and `f`)\n * textPosition(p, 6) -> [#text \"def\", 3] (after `f`)\n */\nfunction textPosition(container, offset) {\n let currentContainer = container;\n do {\n if (currentContainer.nodeType === Node.TEXT_NODE) {\n const currentLength = currentContainer.textContent.length;\n if (offset <= currentLength) {\n return [currentContainer, offset];\n }\n offset -= currentLength;\n } else if (currentContainer.firstChild) {\n currentContainer = currentContainer.firstChild;\n continue;\n }\n\n while (!currentContainer.nextSibling && currentContainer !== container) {\n currentContainer = currentContainer.parentNode;\n }\n if (currentContainer !== container) {\n currentContainer = currentContainer.nextSibling;\n }\n } while (currentContainer !== container);\n throw new Error(\"Offset is bigger than container's contents length.\");\n}\n\nfunction createLinkAnnotation({ url, index, length }, pdfPageView, id) {\n const highlighter = pdfPageView._textHighlighter;\n const [{ begin, end }] = highlighter._convertMatches([index], [length]);\n\n const range = new Range();\n range.setStart(\n ...textPosition(highlighter.textDivs[begin.divIdx], begin.offset)\n );\n range.setEnd(...textPosition(highlighter.textDivs[end.divIdx], end.offset));\n\n return {\n id: `inferred_link_${id}`,\n unsafeUrl: url,\n url,\n annotationType: AnnotationType.LINK,\n rotation: 0,\n ...calculateLinkPosition(range, pdfPageView),\n // Populated in the annotationLayer to avoid unnecessary object creation,\n // since most inferred links overlap existing LinkAnnotations:\n borderStyle: null,\n };\n}\n\nclass Autolinker {\n static #index = 0;\n\n static #regex;\n\n static #numericTLDRegex;\n\n static findLinks(text) {\n // Regex can be tested and verified at https://regex101.com/r/rXoLiT/2.\n this.#regex ??=\n /\\b(?:https?:\\/\\/|mailto:|www\\.)(?:[\\S--[\\p{P}<>]]|\\/|[\\S--[\\[\\]]]+[\\S--[\\p{P}<>]])+|(?=\\p{L})[\\S--[@\\p{Ps}\\p{Pe}<>]]+@([\\S--[[\\p{P}--\\-]<>]]+(?:\\.[\\S--[[\\p{P}--\\-]<>]]+)+)/gmv;\n\n const [normalizedText, diffs] = normalize(text, { ignoreDashEOL: true });\n const matches = normalizedText.matchAll(this.#regex);\n const links = [];\n for (const match of matches) {\n const [url, emailDomain] = match;\n let raw;\n if (\n url.startsWith(\"www.\") ||\n url.startsWith(\"http://\") ||\n url.startsWith(\"https://\")\n ) {\n raw = url;\n } else if (emailDomain) {\n const hostname = URL.parse(`http://${emailDomain}`)?.hostname;\n if (!hostname) {\n continue;\n }\n this.#numericTLDRegex ??= /\\.\\d+$/;\n if (this.#numericTLDRegex.test(hostname)) {\n // Skip emails with a numeric TLD as domain.\n continue;\n }\n }\n raw ??= url.startsWith(\"mailto:\") ? url : `mailto:${url}`;\n\n const absoluteURL = createValidAbsoluteUrl(raw, null, {\n addDefaultProtocol: true,\n });\n if (absoluteURL) {\n const [index, length] = getOriginalIndex(\n diffs,\n match.index,\n url.length\n );\n links.push({ url: absoluteURL.href, index, length });\n }\n }\n return links;\n }\n\n static processLinks(pdfPageView) {\n return this.findLinks(\n pdfPageView._textHighlighter.textContentItemsStr.join(\"\\n\")\n ).map(link => createLinkAnnotation(link, pdfPageView, this.#index++));\n }\n}\n\nexport { Autolinker };\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 { RenderableView, RenderingStates } from \"./renderable_view.js\";\nimport { RenderingCancelledException } from \"pdfjs-lib\";\n\nclass BasePDFPageView extends RenderableView {\n #loadingId = null;\n\n #renderError = null;\n\n #renderingState = RenderingStates.INITIAL;\n\n #showCanvas = null;\n\n #startTime = 0;\n\n #tempCanvas = null;\n\n canvas = null;\n\n /** @type {null | HTMLDivElement} */\n div = null;\n\n enableOptimizedPartialRendering = false;\n\n eventBus = null;\n\n id = null;\n\n pageColors = null;\n\n recordedBBoxes = null;\n\n renderingQueue = null;\n\n constructor(options) {\n super();\n this.eventBus = options.eventBus;\n this.id = options.id;\n this.pageColors = options.pageColors || null;\n this.renderingQueue = options.renderingQueue;\n this.enableOptimizedPartialRendering =\n options.enableOptimizedPartialRendering ?? false;\n this.minDurationToUpdateCanvas = options.minDurationToUpdateCanvas ?? 500;\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 // Display the canvas as it has been drawn.\n this.#startTime = 0;\n this.#showCanvas?.(false);\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 this.#startTime = Date.now();\n break;\n case RenderingStates.INITIAL:\n case RenderingStates.FINISHED:\n this.div.classList.remove(\"loadingIcon\", \"loading\");\n this.#startTime = 0;\n break;\n }\n }\n\n _createCanvas(onShow, hideUntilComplete = false) {\n const { pageColors } = this;\n const hasHCM = !!(pageColors?.background && pageColors?.foreground);\n const prevCanvas = this.canvas;\n\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\n // have a final flash we just display it once all the drawing is done.\n const updateOnFirstShow = !prevCanvas && !hasHCM && !hideUntilComplete;\n\n let canvas = (this.canvas = document.createElement(\"canvas\"));\n\n this.#showCanvas = isLastShow => {\n if (updateOnFirstShow) {\n let tempCanvas = this.#tempCanvas;\n if (!isLastShow && this.minDurationToUpdateCanvas > 0) {\n // We draw on the canvas at 60fps (in using `requestAnimationFrame`),\n // so if the canvas is large, updating it at 60fps can be a way too\n // much and can cause some serious performance issues.\n // To avoid that we only update the canvas every\n // `this.#minDurationToUpdateCanvas` ms.\n\n if (Date.now() - this.#startTime < this.minDurationToUpdateCanvas) {\n return;\n }\n if (!tempCanvas) {\n tempCanvas = this.#tempCanvas = canvas;\n canvas = this.canvas = canvas.cloneNode(false);\n onShow(canvas);\n }\n }\n\n if (tempCanvas) {\n const ctx = canvas.getContext(\"2d\", {\n alpha: false,\n });\n ctx.drawImage(tempCanvas, 0, 0);\n if (isLastShow) {\n this.#resetTempCanvas();\n } else {\n this.#startTime = Date.now();\n }\n return;\n }\n\n // Don't add the canvas until the first draw callback, or until\n // drawing is complete when `!this.renderingQueue`, to prevent black\n // flickering.\n onShow(canvas);\n this.#showCanvas = null;\n return;\n }\n if (!isLastShow) {\n return;\n }\n\n if (prevCanvas) {\n prevCanvas.replaceWith(canvas);\n prevCanvas.width = prevCanvas.height = 0;\n } else {\n onShow(canvas);\n }\n };\n\n return { canvas, prevCanvas };\n }\n\n #renderContinueCallback = cont => {\n this.#showCanvas?.(false);\n if (this.renderingQueue && !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 _resetCanvas() {\n const { canvas } = this;\n if (!canvas) {\n return;\n }\n canvas.remove();\n canvas.width = canvas.height = 0;\n this.canvas = null;\n this.#resetTempCanvas();\n }\n\n #resetTempCanvas() {\n if (this.#tempCanvas) {\n this.#tempCanvas.width = this.#tempCanvas.height = 0;\n this.#tempCanvas = null;\n }\n }\n\n async _drawCanvas(options, onCancel, onFinish) {\n const renderTask = (this.renderTask = this.pdfPage.render(options));\n renderTask.onContinue = this.#renderContinueCallback;\n renderTask.onError = error => {\n if (error instanceof RenderingCancelledException) {\n onCancel();\n this.#renderError = null;\n }\n };\n\n let error = null;\n try {\n await renderTask.promise;\n this.#showCanvas?.(true);\n } catch (e) {\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 (e instanceof RenderingCancelledException) {\n return;\n }\n error = e;\n\n this.#showCanvas?.(true);\n } finally {\n this.#renderError = error;\n\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 if (this.enableOptimizedPartialRendering) {\n this.recordedBBoxes ??= renderTask.recordedBBoxes;\n }\n }\n }\n this.renderingState = RenderingStates.FINISHED;\n\n onFinish(renderTask);\n\n if (error) {\n throw error;\n }\n }\n\n cancelRendering({ cancelExtraDelay = 0 } = {}) {\n if (this.renderTask) {\n this.renderTask.cancel(cancelExtraDelay);\n this.renderTask = null;\n }\n this.resume = null;\n }\n\n dispatchPageRender() {\n this.eventBus.dispatch(\"pagerender\", {\n source: this,\n pageNumber: this.id,\n });\n }\n\n dispatchPageRendered(cssTransform, isDetailView) {\n this.eventBus.dispatch(\"pagerendered\", {\n source: this,\n pageNumber: this.id,\n cssTransform,\n isDetailView,\n timestamp: performance.now(),\n error: this.#renderError,\n });\n }\n}\n\nexport { BasePDFPageView };\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 { DrawLayer } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} DrawLayerBuilderRenderOptions\n * @property {string} [intent] - The default value is \"display\".\n */\n\nclass DrawLayerBuilder {\n #drawLayer = null;\n\n /**\n * @param {DrawLayerBuilderRenderOptions} options\n * @returns {Promise<void>}\n */\n async render({ intent = \"display\" }) {\n if (intent !== \"display\" || this.#drawLayer || this._cancelled) {\n return;\n }\n this.#drawLayer = new DrawLayer();\n }\n\n cancel() {\n this._cancelled = true;\n\n if (!this.#drawLayer) {\n return;\n }\n this.#drawLayer.destroy();\n this.#drawLayer = null;\n }\n\n setParent(parent) {\n this.#drawLayer?.setParent(parent);\n }\n\n getDrawLayer() {\n return this.#drawLayer;\n }\n}\n\nexport { DrawLayerBuilder };\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 { BasePDFPageView } from \"./base_pdf_page_view.js\";\nimport { OutputScale } from \"pdfjs-lib\";\nimport { RenderingStates } from \"./renderable_view.js\";\n\nclass PDFPageDetailView extends BasePDFPageView {\n #detailArea = null;\n\n /**\n * @type {boolean} True when the last rendering attempt of the view was\n * cancelled due to a `.reset()` call. This will happen when\n * the visible area changes so much during the rendering that\n * we need to cancel the rendering and start over.\n */\n renderingCancelled = false;\n\n constructor({ pageView }) {\n super(pageView);\n\n this.pageView = pageView;\n this.renderingId = \"detail\" + this.id;\n\n this.div = pageView.div;\n }\n\n setPdfPage(pdfPage) {\n this.pageView.setPdfPage(pdfPage);\n }\n\n get pdfPage() {\n return this.pageView.pdfPage;\n }\n\n get renderingState() {\n return super.renderingState;\n }\n\n set renderingState(state) {\n this.renderingCancelled = false;\n super.renderingState = state;\n }\n\n reset({ keepCanvas = false } = {}) {\n const renderingCancelled =\n this.renderingCancelled ||\n this.renderingState === RenderingStates.RUNNING ||\n this.renderingState === RenderingStates.PAUSED;\n this.cancelRendering();\n this.renderingState = RenderingStates.INITIAL;\n this.renderingCancelled = renderingCancelled;\n\n if (!keepCanvas) {\n this._resetCanvas();\n }\n }\n\n #shouldRenderDifferentArea(visibleArea) {\n if (!this.#detailArea) {\n return true;\n }\n\n const minDetailX = this.#detailArea.minX;\n const minDetailY = this.#detailArea.minY;\n const maxDetailX = this.#detailArea.width + minDetailX;\n const maxDetailY = this.#detailArea.height + minDetailY;\n\n if (\n visibleArea.minX < minDetailX ||\n visibleArea.minY < minDetailY ||\n visibleArea.maxX > maxDetailX ||\n visibleArea.maxY > maxDetailY\n ) {\n return true;\n }\n\n const {\n width: maxWidth,\n height: maxHeight,\n scale,\n } = this.pageView.viewport;\n\n if (this.#detailArea.scale !== scale) {\n return true;\n }\n\n const paddingLeftSize = visibleArea.minX - minDetailX;\n const paddingRightSize = maxDetailX - visibleArea.maxX;\n const paddingTopSize = visibleArea.minY - minDetailY;\n const paddingBottomSize = maxDetailY - visibleArea.maxY;\n\n // If the user is moving in any direction such that the remaining area\n // rendered outside of the screen is less than MOVEMENT_THRESHOLD of the\n // padding we render on each side, trigger a re-render. This is so that if\n // the user then keeps scrolling in that direction, we have a chance of\n // finishing rendering the new detail before they get past the rendered\n // area.\n\n const MOVEMENT_THRESHOLD = 0.5;\n const ratio = (1 + MOVEMENT_THRESHOLD) / MOVEMENT_THRESHOLD;\n\n if (\n (minDetailX > 0 && paddingRightSize / paddingLeftSize > ratio) ||\n (maxDetailX < maxWidth && paddingLeftSize / paddingRightSize > ratio) ||\n (minDetailY > 0 && paddingBottomSize / paddingTopSize > ratio) ||\n (maxDetailY < maxHeight && paddingTopSize / paddingBottomSize > ratio)\n ) {\n return true;\n }\n\n return false;\n }\n\n update({ visibleArea = null, underlyingViewUpdated = false } = {}) {\n if (underlyingViewUpdated) {\n this.cancelRendering();\n this.renderingState = RenderingStates.INITIAL;\n return;\n }\n\n if (!this.#shouldRenderDifferentArea(visibleArea)) {\n return;\n }\n\n const { viewport, maxCanvasPixels, capCanvasAreaFactor } = this.pageView;\n\n const visibleWidth = visibleArea.maxX - visibleArea.minX;\n const visibleHeight = visibleArea.maxY - visibleArea.minY;\n\n // \"overflowScale\" represents which percentage of the width and of the\n // height the detail area extends outside of the visible area. We want to\n // draw a larger area so that we don't have to constantly re-draw while\n // scrolling. The detail area's dimensions thus become\n // visibleLength * (2 * overflowScale + 1).\n // We default to adding a whole height/length of detail area on each side,\n // but we can reduce it to make sure that we stay within the maxCanvasPixels\n // limit.\n const visiblePixels =\n visibleWidth * visibleHeight * OutputScale.pixelRatio ** 2;\n const maxDetailToVisibleLinearRatio = Math.sqrt(\n OutputScale.capPixels(maxCanvasPixels, capCanvasAreaFactor) /\n visiblePixels\n );\n const maxOverflowScale = (maxDetailToVisibleLinearRatio - 1) / 2;\n let overflowScale = Math.min(1, maxOverflowScale);\n if (overflowScale < 0) {\n overflowScale = 0;\n // In this case, we render a detail view that is exactly as big as the\n // visible area, but we ignore the .maxCanvasPixels limit.\n // TODO: We should probably instead give up and not render the detail view\n // in this case. It's quite rare to hit it though, because usually\n // .maxCanvasPixels will at least have enough pixels to cover the visible\n // screen.\n }\n\n const overflowWidth = visibleWidth * overflowScale;\n const overflowHeight = visibleHeight * overflowScale;\n\n const minX = Math.max(0, visibleArea.minX - overflowWidth);\n const maxX = Math.min(viewport.width, visibleArea.maxX + overflowWidth);\n const minY = Math.max(0, visibleArea.minY - overflowHeight);\n const maxY = Math.min(viewport.height, visibleArea.maxY + overflowHeight);\n const width = maxX - minX;\n const height = maxY - minY;\n\n this.#detailArea = { minX, minY, width, height, scale: viewport.scale };\n\n this.reset({ keepCanvas: true });\n }\n\n _getRenderingContext(canvas, transform) {\n const baseContext = this.pageView._getRenderingContext(\n canvas,\n transform,\n false\n );\n const recordedBBoxes = this.pdfPage.recordedBBoxes;\n\n if (!recordedBBoxes || !this.enableOptimizedPartialRendering) {\n return baseContext;\n }\n\n const {\n viewport: { width: vWidth, height: vHeight },\n } = this.pageView;\n const {\n width: aWidth,\n height: aHeight,\n minX: aMinX,\n minY: aMinY,\n } = this.#detailArea;\n\n const detailMinX = aMinX / vWidth;\n const detailMinY = aMinY / vHeight;\n const detailMaxX = (aMinX + aWidth) / vWidth;\n const detailMaxY = (aMinY + aHeight) / vHeight;\n\n return {\n ...baseContext,\n operationsFilter(index) {\n if (recordedBBoxes.isEmpty(index)) {\n return false;\n }\n return (\n recordedBBoxes.minX(index) <= detailMaxX &&\n recordedBBoxes.maxX(index) >= detailMinX &&\n recordedBBoxes.minY(index) <= detailMaxY &&\n recordedBBoxes.maxY(index) >= detailMinY\n );\n },\n };\n }\n\n async draw() {\n // The PDFPageView might have already dropped this PDFPageDetailView. In\n // that case, simply do nothing.\n if (this.pageView.detailView !== this) {\n return undefined;\n }\n\n // If there is already the lower resolution canvas behind,\n // we don't show the new one until when it's fully ready.\n const hideUntilComplete =\n this.pageView.renderingState === RenderingStates.FINISHED ||\n this.renderingState === RenderingStates.FINISHED;\n\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, viewport } = this.pageView;\n\n if (!pdfPage) {\n this.renderingState = RenderingStates.FINISHED;\n throw new Error(\"pdfPage is not loaded\");\n }\n\n this.renderingState = RenderingStates.RUNNING;\n\n const canvasWrapper = this.pageView._ensureCanvasWrapper();\n\n const { canvas, prevCanvas } = this._createCanvas(newCanvas => {\n // If there is already the background canvas, inject this new canvas\n // after it. We cannot simply use .append because all canvases must\n // be before the SVG elements used for drawings.\n if (canvasWrapper.firstElementChild?.tagName === \"CANVAS\") {\n canvasWrapper.firstElementChild.after(newCanvas);\n } else {\n canvasWrapper.prepend(newCanvas);\n }\n }, hideUntilComplete);\n canvas.ariaHidden = true;\n if (this.enableOptimizedPartialRendering) {\n canvas.className = \"detailView\";\n }\n\n const { width, height } = viewport;\n\n const area = this.#detailArea;\n\n const { pixelRatio } = OutputScale;\n const transform = [\n pixelRatio,\n 0,\n 0,\n pixelRatio,\n -area.minX * pixelRatio,\n -area.minY * pixelRatio,\n ];\n\n canvas.width = area.width * pixelRatio;\n canvas.height = area.height * pixelRatio;\n const { style } = canvas;\n style.width = `${(area.width * 100) / width}%`;\n style.height = `${(area.height * 100) / height}%`;\n style.top = `${(area.minY * 100) / height}%`;\n style.left = `${(area.minX * 100) / width}%`;\n\n const renderingPromise = this._drawCanvas(\n this._getRenderingContext(canvas, transform),\n () => {\n // If the rendering is cancelled, keep the old canvas visible.\n this.canvas?.remove();\n this.canvas = prevCanvas;\n },\n () => {\n this.dispatchPageRendered(\n /* cssTransform */ false,\n /* isDetailView */ true\n );\n }\n );\n\n div.setAttribute(\"data-loaded\", true);\n\n this.dispatchPageRender();\n\n return renderingPromise;\n }\n}\n\nexport { PDFPageDetailView };\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\nimport { FeatureTest, makeMap, shadow } from \"pdfjs-lib\";\nimport { removeNullCharacters } from \"./ui_utils.js\";\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: \"rowgroup\",\n TBody: \"rowgroup\",\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 MathMLElements = new Set([\n \"math\",\n \"merror\",\n \"mfrac\",\n \"mi\",\n \"mmultiscripts\",\n \"mn\",\n \"mo\",\n \"mover\",\n \"mpadded\",\n \"mprescripts\",\n \"mroot\",\n \"mrow\",\n \"ms\",\n \"mspace\",\n \"msqrt\",\n \"mstyle\",\n \"msub\",\n \"msubsup\",\n \"msup\",\n \"mtable\",\n \"mtd\",\n \"mtext\",\n \"mtr\",\n \"munder\",\n \"munderover\",\n \"semantics\",\n]);\nconst MathMLNamespace = \"http://www.w3.org/1998/Math/MathML\";\n\nclass MathMLSanitizer {\n static get sanitizer() {\n // From https://w3c.github.io/mathml-docs/mathml-safe-list.\n\n return shadow(\n this,\n \"sanitizer\",\n FeatureTest.isSanitizerSupported\n ? // eslint-disable-next-line no-undef\n new Sanitizer({\n elements: [...MathMLElements].map(name => ({\n name,\n namespace: MathMLNamespace,\n })),\n replaceWithChildrenElements: [\n {\n name: \"maction\",\n namespace: MathMLNamespace,\n },\n ],\n attributes: [\n \"dir\",\n \"displaystyle\",\n \"mathbackground\",\n \"mathcolor\",\n \"mathsize\",\n \"scriptlevel\",\n \"encoding\",\n \"display\",\n \"linethickness\",\n \"intent\",\n \"arg\",\n \"form\",\n \"fence\",\n \"separator\",\n \"lspace\",\n \"rspace\",\n \"stretchy\",\n \"symmetric\",\n \"maxsize\",\n \"minsize\",\n \"largeop\",\n \"movablelimits\",\n \"width\",\n \"height\",\n \"depth\",\n \"voffset\",\n \"accent\",\n \"accentunder\",\n \"columnspan\",\n \"rowspan\",\n ],\n comments: false,\n })\n : null\n );\n }\n}\n\nconst HEADING_PATTERN = /^H(\\d+)$/;\n\n/**\n * @typedef {Object} StructTreeLayerBuilderOptions\n * @property {PDFPageProxy} pdfPage\n * @property {Object} rawDims\n */\n\nclass StructTreeLayerBuilder {\n #promise;\n\n #treeDom = null;\n\n #treePromise;\n\n #elementAttributes = new Map();\n\n #rawDims;\n\n #elementsToAddToTextLayer = null;\n\n #elementsToHideInTextLayer = null;\n\n #elementsToStealFromTextLayer = null;\n\n /**\n * @param {StructTreeLayerBuilderOptions} options\n */\n constructor(pdfPage, rawDims) {\n this.#promise = pdfPage.getStructTree();\n this.#rawDims = rawDims;\n }\n\n /**\n * @returns {Promise<void>}\n */\n async render() {\n if (this.#treePromise) {\n return this.#treePromise;\n }\n const { promise, resolve, reject } = Promise.withResolvers();\n this.#treePromise = promise;\n\n try {\n this.#treeDom = this.#walk(await this.#promise);\n } catch (ex) {\n reject(ex);\n }\n this.#promise = null;\n\n this.#treeDom?.classList.add(\"structTree\");\n resolve(this.#treeDom);\n\n return promise;\n }\n\n async getAriaAttributes(annotationId) {\n try {\n await this.render();\n return this.#elementAttributes.get(annotationId);\n } catch {\n // If the structTree cannot be fetched, parsed, and/or rendered,\n // ensure that e.g. the AnnotationLayer won't break completely.\n }\n return null;\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 const { alt, id, lang } = structElement;\n if (alt !== undefined) {\n // Don't add the label in the struct tree layer but on the annotation\n // in the annotation layer.\n let added = false;\n const label = removeNullCharacters(alt);\n for (const child of structElement.children) {\n if (child.type === \"annotation\") {\n this.#elementAttributes\n .getOrInsertComputed(child.id, makeMap)\n .set(\"aria-label\", label);\n added = true;\n }\n }\n if (!added) {\n htmlElement.setAttribute(\"aria-label\", label);\n }\n }\n if (id !== undefined) {\n htmlElement.setAttribute(\"aria-owns\", id);\n }\n if (lang !== undefined) {\n htmlElement.setAttribute(\n \"lang\",\n removeNullCharacters(lang, /* replaceInvisible = */ true)\n );\n }\n }\n\n #addImageInTextLayer(node, element) {\n const { alt, bbox, children } = node;\n const child = children?.[0];\n if (!this.#rawDims || !alt || !bbox || child?.type !== \"content\") {\n return false;\n }\n\n const { id } = child;\n if (!id) {\n return false;\n }\n\n // We cannot add the created element to the text layer immediately, as the\n // text layer might not be ready yet. Instead, we store the element and add\n // it later in `addElementsToTextLayer`.\n\n element.setAttribute(\"aria-owns\", id);\n const img = document.createElement(\"span\");\n (this.#elementsToAddToTextLayer ||= new Map()).set(id, img);\n img.setAttribute(\"role\", \"img\");\n img.setAttribute(\"aria-label\", removeNullCharacters(alt));\n\n const { pageHeight, pageX, pageY } = this.#rawDims;\n const calc = \"calc(var(--total-scale-factor) *\";\n const { style } = img;\n style.width = `${calc}${bbox[2] - bbox[0]}px)`;\n style.height = `${calc}${bbox[3] - bbox[1]}px)`;\n style.left = `${calc}${bbox[0] - pageX}px)`;\n style.top = `${calc}${pageHeight - bbox[3] + pageY}px)`;\n\n return true;\n }\n\n updateTextLayer() {\n if (this.#elementsToAddToTextLayer) {\n for (const [id, img] of this.#elementsToAddToTextLayer) {\n document.getElementById(id)?.append(img);\n }\n this.#elementsToAddToTextLayer.clear();\n this.#elementsToAddToTextLayer = null;\n }\n if (this.#elementsToHideInTextLayer) {\n for (const id of this.#elementsToHideInTextLayer) {\n const elem = document.getElementById(id);\n if (elem) {\n elem.ariaHidden = true;\n }\n }\n this.#elementsToHideInTextLayer.length = 0;\n this.#elementsToHideInTextLayer = null;\n }\n if (this.#elementsToStealFromTextLayer) {\n for (\n let i = 0, ii = this.#elementsToStealFromTextLayer.length;\n i < ii;\n i += 2\n ) {\n const element = this.#elementsToStealFromTextLayer[i];\n const ids = this.#elementsToStealFromTextLayer[i + 1];\n let textContent = \"\";\n for (const id of ids) {\n const elem = document.getElementById(id);\n if (elem) {\n textContent += elem.textContent.trim() || \"\";\n // Aria-hide the element in order to avoid duplicate reading of the\n // math content by screen readers.\n elem.ariaHidden = \"true\";\n }\n }\n if (textContent) {\n element.textContent = textContent;\n }\n }\n this.#elementsToStealFromTextLayer.length = 0;\n this.#elementsToStealFromTextLayer = null;\n }\n }\n\n #walk(node, parentNodes = []) {\n if (!node) {\n return null;\n }\n\n let element;\n if (\"role\" in node) {\n const { role } = node;\n if (MathMLElements.has(role)) {\n element = document.createElementNS(MathMLNamespace, role);\n const ids = [];\n (this.#elementsToStealFromTextLayer ||= []).push(element, ids);\n for (const { type, id } of node.children || []) {\n if (type === \"content\" && id) {\n ids.push(id);\n }\n }\n } else {\n element = document.createElement(\"span\");\n }\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(\n \"role\",\n role === \"TH\" &&\n parentNodes.at(-1)?.role === \"TR\" &&\n parentNodes.at(-2)?.role === \"TBody\"\n ? \"rowheader\" // TH inside TR itself in TBody is a rowheader.\n : PDF_ROLE_TO_HTML_ROLE[role]\n );\n }\n if (role === \"Figure\" && this.#addImageInTextLayer(node, element)) {\n return element;\n }\n if (role === \"Formula\") {\n if (node.mathML && MathMLSanitizer.sanitizer) {\n element.setHTML(node.mathML, {\n sanitizer: MathMLSanitizer.sanitizer,\n });\n // Hide all the corresponding content elements in the text layer in\n // order to avoid screen readers reading both the MathML and the\n // text content.\n for (const { id } of node.children || []) {\n if (!id) {\n continue;\n }\n (this.#elementsToHideInTextLayer ||= []).push(id);\n }\n // For now, we don't want to keep the alt text if there's valid\n // MathML (see https://github.com/w3c/mathml-aam/issues/37).\n // TODO: Revisit this decision in the future.\n delete node.alt;\n }\n if (\n !node.mathML &&\n node.children.length === 1 &&\n node.children[0].role !== \"math\"\n ) {\n element = document.createElementNS(MathMLNamespace, \"math\");\n delete node.alt;\n }\n }\n }\n\n element ||= document.createElement(\"span\");\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 parentNodes.push(node);\n for (const kid of node.children) {\n element.append(this.#walk(kid, parentNodes));\n }\n parentNodes.pop();\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 * @returns {string|null} The id in the struct tree if any.\n */\n addPointerInTextLayer(element, isRemovable) {\n const { id } = element;\n if (!id) {\n return null;\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 null;\n }\n\n if (isRemovable) {\n this.removePointerInTextLayer(element);\n }\n\n const children = this.#textChildren;\n if (!children || children.length === 0) {\n return null;\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 const child = children[nodeIndex];\n this.#addIdToAriaOwns(id, child);\n this.#textNodes.set(id, nodeIndex);\n\n const parent = child.parentNode;\n return parent?.classList.contains(\"markedContent\") ? parent.id : null;\n }\n\n /**\n * Move a div in the DOM in order to respect the visual order.\n * @param {HTMLDivElement} element\n * @returns {string|null} The id in the struct tree if any.\n */\n moveElementInDOM(container, element, contentElement, isRemovable) {\n const id = this.addPointerInTextLayer(contentElement, isRemovable);\n\n if (!container.hasChildNodes()) {\n container.append(element);\n return id;\n }\n\n const children = Array.from(container.childNodes).filter(\n node => node !== element\n );\n\n if (children.length === 0) {\n return id;\n }\n\n const index = binarySearchFirstItem(\n children,\n node =>\n TextAccessibilityManager.#compareElementPositions(element, node) < 0\n );\n\n if (index === 0) {\n children[0].before(element);\n } else {\n children[index - 1].after(element);\n }\n\n return id;\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 #eventAbortController = null;\n\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.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\n if (!this.#eventAbortController) {\n this.#eventAbortController = new AbortController();\n\n this.eventBus._on(\n \"updatetextlayermatches\",\n evt => {\n if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) {\n this._updateMatches();\n }\n },\n { signal: this.#eventAbortController.signal }\n );\n }\n this._updateMatches();\n }\n\n disable() {\n if (!this.enabled) {\n return;\n }\n this.enabled = false;\n\n this.#eventAbortController?.abort();\n this.#eventAbortController = 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\n if (className.includes(\"selected\")) {\n const { left } = span.getClientRects()[0];\n const parentLeft = div.getBoundingClientRect().left;\n return left - parentLeft;\n }\n return 0;\n }\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 let lastDivIdx = -1;\n let lastOffset = -1;\n for (let i = i0; i < i1; i++) {\n const match = matches[i];\n const begin = match.begin;\n if (begin.divIdx === lastDivIdx && begin.offset === lastOffset) {\n // It's possible to be in this situation if we searched for a 'f' and we\n // have a ligature 'ff' in the text. The 'ff' has to be highlighted two\n // times.\n continue;\n }\n lastDivIdx = begin.divIdx;\n lastOffset = begin.offset;\n\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/** @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(\"./text_highlighter\").TextHighlighter} TextHighlighter */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n\nimport { normalizeUnicode, stopEvent, TextLayer } from \"pdfjs-lib\";\nimport { removeNullCharacters } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} TextLayerBuilderOptions\n * @property {PDFPageProxy} pdfPage\n * @property {TextHighlighter} [highlighter] - Optional object that will handle\n * highlighting text from the find controller.\n * @property {TextAccessibilityManager} [accessibilityManager]\n * @property {boolean} [enablePermissions]\n * @property {function} [onAppend]\n */\n\n/**\n * @typedef {Object} TextLayerBuilderRenderOptions\n * @property {PageViewport} viewport\n * @property {Object} [textContentParams]\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 #enablePermissions = false;\n\n #onAppend = null;\n\n #renderingDone = false;\n\n #textLayer = null;\n\n static #textLayers = new Map();\n\n static #selectionChangeAbortController = null;\n\n /**\n * @param {TextLayerBuilderOptions} options\n */\n constructor({\n pdfPage,\n highlighter = null,\n accessibilityManager = null,\n enablePermissions = false,\n onAppend = null,\n }) {\n this.pdfPage = pdfPage;\n this.highlighter = highlighter;\n this.accessibilityManager = accessibilityManager;\n this.#enablePermissions = enablePermissions === true;\n this.#onAppend = onAppend;\n\n this.div = document.createElement(\"div\");\n this.div.tabIndex = 0;\n this.div.className = \"textLayer\";\n }\n\n /**\n * Renders the text layer.\n * @param {TextLayerBuilderRenderOptions} options\n * @returns {Promise<void>}\n */\n async render({ viewport, textContentParams = null }) {\n if (this.#renderingDone && this.#textLayer) {\n this.#textLayer.update({\n viewport,\n onBefore: this.hide.bind(this),\n });\n this.show();\n return;\n }\n\n this.cancel();\n this.#textLayer = new TextLayer({\n textContentSource: this.pdfPage.streamTextContent(\n textContentParams || {\n includeMarkedContent: true,\n disableNormalization: true,\n }\n ),\n container: this.div,\n viewport,\n });\n\n const { textDivs, textContentItemsStr } = this.#textLayer;\n this.highlighter?.setTextMapping(textDivs, textContentItemsStr);\n this.accessibilityManager?.setTextMapping(textDivs);\n\n await this.#textLayer.render();\n this.#renderingDone = true;\n\n const endOfContent = document.createElement(\"div\");\n endOfContent.className = \"endOfContent\";\n this.div.append(endOfContent);\n\n this.#bindMouse(endOfContent);\n // Ensure that the textLayer is appended to the DOM *before* handling\n // e.g. a pending search operation.\n this.#onAppend?.(this.div);\n this.highlighter?.enable();\n this.accessibilityManager?.enable();\n }\n\n hide() {\n if (!this.div.hidden && this.#renderingDone) {\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 this.#textLayer?.cancel();\n this.#textLayer = null;\n\n this.highlighter?.disable();\n this.accessibilityManager?.disable();\n TextLayerBuilder.#removeGlobalSelectionListener(this.div);\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(end) {\n const { div } = this;\n\n div.addEventListener(\"mousedown\", () => {\n div.classList.add(\"selecting\");\n });\n\n div.addEventListener(\"copy\", event => {\n if (!this.#enablePermissions) {\n const selection = document.getSelection();\n event.clipboardData.setData(\n \"text/plain\",\n removeNullCharacters(normalizeUnicode(selection.toString()))\n );\n }\n stopEvent(event);\n });\n\n TextLayerBuilder.#textLayers.set(div, end);\n TextLayerBuilder.#enableGlobalSelectionListener();\n }\n\n static #removeGlobalSelectionListener(textLayerDiv) {\n this.#textLayers.delete(textLayerDiv);\n\n if (this.#textLayers.size === 0) {\n this.#selectionChangeAbortController?.abort();\n this.#selectionChangeAbortController = null;\n }\n }\n\n static #enableGlobalSelectionListener() {\n if (this.#selectionChangeAbortController) {\n // document-level event listeners already installed\n return;\n }\n this.#selectionChangeAbortController = new AbortController();\n const { signal } = this.#selectionChangeAbortController;\n\n const reset = (end, textLayer) => {\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n textLayer.append(end);\n end.style.width = \"\";\n end.style.height = \"\";\n }\n textLayer.classList.remove(\"selecting\");\n };\n\n let isPointerDown = false;\n document.addEventListener(\n \"pointerdown\",\n () => {\n isPointerDown = true;\n },\n { signal }\n );\n document.addEventListener(\n \"pointerup\",\n () => {\n isPointerDown = false;\n this.#textLayers.forEach(reset);\n },\n { signal }\n );\n window.addEventListener(\n \"blur\",\n () => {\n isPointerDown = false;\n this.#textLayers.forEach(reset);\n },\n { signal }\n );\n document.addEventListener(\n \"keyup\",\n () => {\n if (!isPointerDown) {\n this.#textLayers.forEach(reset);\n }\n },\n { signal }\n );\n\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n // eslint-disable-next-line no-var\n var isFirefox, prevRange;\n }\n\n document.addEventListener(\n \"selectionchange\",\n () => {\n const selection = document.getSelection();\n if (selection.rangeCount === 0) {\n this.#textLayers.forEach(reset);\n return;\n }\n\n // Even though the spec says that .rangeCount should be 0 or 1, Firefox\n // creates multiple ranges when selecting across multiple pages.\n // Make sure to collect all the .textLayer elements where the selection\n // is happening.\n const activeTextLayers = new Set();\n for (let i = 0; i < selection.rangeCount; i++) {\n const range = selection.getRangeAt(i);\n for (const textLayerDiv of this.#textLayers.keys()) {\n if (\n !activeTextLayers.has(textLayerDiv) &&\n range.intersectsNode(textLayerDiv)\n ) {\n activeTextLayers.add(textLayerDiv);\n }\n }\n }\n\n for (const [textLayerDiv, endDiv] of this.#textLayers) {\n if (activeTextLayers.has(textLayerDiv)) {\n textLayerDiv.classList.add(\"selecting\");\n } else {\n reset(endDiv, textLayerDiv);\n }\n }\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n return;\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"CHROME\")) {\n isFirefox ??=\n getComputedStyle(\n this.#textLayers.values().next().value\n ).getPropertyValue(\"-moz-user-select\") === \"none\";\n\n if (isFirefox) {\n return;\n }\n }\n // In non-Firefox browsers, when hovering over an empty space (thus,\n // on .endOfContent), the selection will expand to cover all the\n // text between the current selection and .endOfContent. By moving\n // .endOfContent to right after (or before, depending on which side\n // of the selection the user is moving), we limit the selection jump\n // to at most cover the enteirety of the <span> where the selection\n // is being modified.\n const range = selection.getRangeAt(0);\n const modifyStart =\n prevRange &&\n (range.compareBoundaryPoints(Range.END_TO_END, prevRange) === 0 ||\n range.compareBoundaryPoints(Range.START_TO_END, prevRange) === 0);\n let anchor = modifyStart ? range.startContainer : range.endContainer;\n if (anchor.nodeType === Node.TEXT_NODE) {\n anchor = anchor.parentNode;\n }\n if (anchor.classList?.contains(\"highlight\")) {\n anchor = anchor.parentNode;\n }\n if (!modifyStart && range.endOffset === 0) {\n do {\n while (!anchor.previousSibling) {\n anchor = anchor.parentNode;\n }\n anchor = anchor.previousSibling;\n } while (!anchor.childNodes.length);\n }\n\n const parentTextLayer = anchor.parentElement?.closest(\".textLayer\");\n const endDiv = this.#textLayers.get(parentTextLayer);\n if (endDiv) {\n endDiv.style.width = parentTextLayer.style.width;\n endDiv.style.height = parentTextLayer.style.height;\n endDiv.style.userSelect = \"text\";\n anchor.parentElement.insertBefore(\n endDiv,\n modifyStart ? anchor : anchor.nextSibling\n );\n }\n\n prevRange = range.cloneRange();\n },\n { signal }\n );\n }\n}\n\nexport { TextLayerBuilder };\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// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n/** @typedef {import(\"./comment_manager.js\").CommentManager} CommentManager */\n/** @typedef {import(\"./l10n.js\").L10n} L10n */\n\nimport {\n AbortException,\n AnnotationMode,\n OutputScale,\n PixelsPerInch,\n setLayerDimensions,\n shadow,\n} from \"pdfjs-lib\";\nimport {\n approximateFraction,\n calcRound,\n DEFAULT_SCALE,\n floorToDivide,\n TextLayerMode,\n} from \"./ui_utils.js\";\nimport { AnnotationEditorLayerBuilder } from \"./annotation_editor_layer_builder.js\";\nimport { AnnotationLayerBuilder } from \"./annotation_layer_builder.js\";\nimport { AppOptions } from \"./app_options.js\";\nimport { Autolinker } from \"./autolinker.js\";\nimport { BasePDFPageView } from \"./base_pdf_page_view.js\";\nimport { DrawLayerBuilder } from \"./draw_layer_builder.js\";\nimport { GenericL10n } from \"web-null_l10n\";\nimport { PDFPageDetailView } from \"./pdf_page_detail_view.js\";\nimport { RenderingStates } from \"./renderable_view.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 {number} [maxCanvasPixels] - The maximum supported canvas size in\n * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for\n * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).\n * @property {number} [maxCanvasDim] - The maximum supported canvas dimension,\n * in either width or height. Use `-1` for no limit.\n * The default value is 32767.\n * @property {number} [capCanvasAreaFactor] - Cap the canvas area to the\n * viewport increased by the value in percent. Use `-1` for no limit.\n * The default value is 200%.\n * @property {boolean} [enableDetailCanvas] - When enabled, if the rendered\n * pages would need a canvas that is larger than `maxCanvasPixels` or\n * `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one,\n * that only renders the part of the page that is close to the viewport.\n * The default value is `true`.\n * @property {boolean} [enableOptimizedPartialRendering] - When enabled, PDF\n * rendering will keep track of which areas of the page each PDF operation\n * affects. Then, when rendering a partial page (if `enableDetailCanvas` is\n * enabled), it will only run through the operations that affect that portion.\n * 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 * @property {L10n} [l10n] - Localization service.\n * @property {Object} [layerProperties] - The object that is used to lookup\n * the necessary layer-properties.\n * @property {boolean} [enableAutoLinking] - Enable creation of hyperlinks from\n * text that look like URLs. The default value is `true`.\n * @property {CommentManager} [commentManager] - The comment manager instance.\n * @property {PDFPageView} [clonedFrom] - The page view that is cloned\n * to.\n */\n\nconst DEFAULT_LAYER_PROPERTIES =\n typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"COMPONENTS\")\n ? null\n : {\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\nconst LAYERS_ORDER = new Map([\n [\"canvasWrapper\", 0],\n [\"textLayer\", 1],\n [\"annotationLayer\", 2],\n [\"annotationEditorLayer\", 3],\n [\"xfaLayer\", 3],\n]);\n\nclass PDFPageView extends BasePDFPageView {\n #annotationMode = AnnotationMode.ENABLE_FORMS;\n\n #canvasWrapper = null;\n\n #commentManager = null;\n\n #enableAutoLinking = true;\n\n #hasRestrictedScaling = false;\n\n #isEditing = false;\n\n #layerProperties = null;\n\n #needsRestrictedScaling = false;\n\n #originalViewport = null;\n\n #previousRotation = null;\n\n #scaleRoundX = 1;\n\n #scaleRoundY = 1;\n\n #textLayerMode = TextLayerMode.ENABLE;\n\n #userUnit = 1;\n\n #useThumbnailCanvas = {\n directDrawing: true,\n initialOptionalContent: true,\n regularAnnotations: true,\n };\n\n #layers = [null, null, null, null];\n\n #clonedFrom = null;\n\n /**\n * @param {PDFPageViewOptions} options\n */\n constructor(options) {\n super(options);\n\n const { container, defaultViewport } = options;\n\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.#textLayerMode = options.textLayerMode ?? TextLayerMode.ENABLE;\n this.#annotationMode =\n options.annotationMode ?? AnnotationMode.ENABLE_FORMS;\n this.imageResourcesPath = options.imageResourcesPath || \"\";\n this.enableDetailCanvas = options.enableDetailCanvas ?? true;\n this.maxCanvasPixels =\n options.maxCanvasPixels ?? AppOptions.get(\"maxCanvasPixels\");\n this.maxCanvasDim = options.maxCanvasDim || AppOptions.get(\"maxCanvasDim\");\n this.capCanvasAreaFactor =\n options.capCanvasAreaFactor ?? AppOptions.get(\"capCanvasAreaFactor\");\n this.#enableAutoLinking = options.enableAutoLinking !== false;\n this.#commentManager = options.commentManager || null;\n this.#clonedFrom = options.clonedFrom || null;\n\n this.l10n = options.l10n;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this.l10n ||= new GenericL10n();\n }\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this._isStandalone = !this.renderingQueue?.hasViewer();\n this._container = container;\n }\n\n this._annotationCanvasMap = null;\n\n this.annotationLayer = null;\n this.annotationEditorLayer = null;\n this.textLayer = null;\n this.xfaLayer = null;\n this.structTreeLayer = null;\n this.drawLayer = null;\n\n this.detailView = 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 div.setAttribute(\"data-l10n-id\", \"pdfjs-page-landmark\");\n div.setAttribute(\"data-l10n-args\", JSON.stringify({ page: this.id }));\n this.div = div;\n this.#setDimensions();\n container?.append(div);\n\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"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 if (this.pageColors?.background) {\n container?.style.setProperty(\n \"--page-bg-color\",\n this.pageColors.background\n );\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 // Ensure that Fluent is connected in e.g. the COMPONENTS build.\n if (!options.l10n) {\n this.l10n.translate(this.div);\n }\n }\n }\n\n clone(id) {\n const clone = new PDFPageView({\n container: null,\n eventBus: this.eventBus,\n pagesColors: this.pageColors,\n renderingQueue: this.renderingQueue,\n enableOptimizedPartialRendering: this.enableOptimizedPartialRendering,\n minDurationToUpdateCanvas: this.minDurationToUpdateCanvas,\n defaultViewport: this.viewport,\n id,\n layerProperties: this.#layerProperties,\n scale: this.scale,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n textLayerMode: this.#textLayerMode,\n annotationMode: this.#annotationMode,\n imageResourcesPath: this.imageResourcesPath,\n enableDetailCanvas: this.enableDetailCanvas,\n maxCanvasPixels: this.maxCanvasPixels,\n maxCanvasDim: this.maxCanvasDim,\n capCanvasAreaFactor: this.capCanvasAreaFactor,\n enableAutoLinking: this.#enableAutoLinking,\n commentManager: this.#commentManager,\n l10n: this.l10n,\n clonedFrom: this,\n });\n clone.setPdfPage(this.pdfPage);\n return clone;\n }\n\n #addLayer(div, name) {\n const pos = LAYERS_ORDER.get(name);\n const oldDiv = this.#layers[pos];\n this.#layers[pos] = div;\n if (oldDiv) {\n oldDiv.replaceWith(div);\n return;\n }\n for (let i = pos - 1; i >= 0; i--) {\n const layer = this.#layers[i];\n if (layer) {\n layer.after(div);\n return;\n }\n }\n this.div.prepend(div);\n }\n\n #setDimensions() {\n const { div, viewport } = this;\n\n if (viewport.userUnit !== this.#userUnit) {\n if (viewport.userUnit !== 1) {\n div.style.setProperty(\"--user-unit\", viewport.userUnit);\n } else {\n div.style.removeProperty(\"--user-unit\");\n }\n this.#userUnit = viewport.userUnit;\n }\n if (this.pdfPage) {\n if (this.#previousRotation === viewport.rotation) {\n return;\n }\n this.#previousRotation = viewport.rotation;\n }\n\n setLayerDimensions(\n div,\n viewport,\n /* mustFlip = */ true,\n /* mustRotate = */ false\n );\n }\n\n updatePageNumber(newPageNumber) {\n if (this.id === newPageNumber) {\n return;\n }\n this.id = newPageNumber;\n this.renderingId = `page${newPageNumber}`;\n if (this.pdfPage) {\n this.pdfPage.pageNumber = newPageNumber;\n }\n // TODO: do we set the page label ?\n this.setPageLabel(this.pageLabel);\n const { div } = this;\n div.setAttribute(\"data-page-number\", newPageNumber);\n div.setAttribute(\"data-l10n-args\", JSON.stringify({ page: newPageNumber }));\n this._textHighlighter.pageIdx = newPageNumber - 1;\n // Don't update the page index for the draw layer, since it's just used as\n // an identifier.\n this.annotationEditorLayer?.updatePageIndex(newPageNumber - 1);\n }\n\n setPdfPage(pdfPage) {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this._isStandalone &&\n (this.pageColors?.foreground === \"CanvasText\" ||\n this.pageColors?.background === \"Canvas\")\n ) {\n this._container?.style.setProperty(\n \"--hcm-highlight-filter\",\n pdfPage.filterFactory.addHighlightHCMFilter(\n \"highlight\",\n \"CanvasText\",\n \"Canvas\",\n \"HighlightText\",\n \"Highlight\"\n )\n );\n this._container?.style.setProperty(\n \"--hcm-highlight-selected-filter\",\n pdfPage.filterFactory.addHighlightHCMFilter(\n \"highlight_selected\",\n \"CanvasText\",\n \"Canvas\",\n \"HighlightText\",\n \"Highlight\"\n )\n );\n }\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 deleteMe(isCut) {\n if (isCut) {\n this.div.remove();\n return;\n }\n this.destroy();\n this.#layerProperties.annotationEditorUIManager?.deletePage(this.id);\n }\n\n hasEditableAnnotations() {\n return !!this.annotationLayer?.hasEditableAnnotations();\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 #dispatchLayerRendered(name, error) {\n this.eventBus.dispatch(name, {\n source: this,\n pageNumber: this.id,\n error,\n });\n }\n\n async #renderAnnotationLayer() {\n let error = null;\n try {\n await this.annotationLayer.render({\n viewport: this.viewport,\n intent: \"display\",\n structTreeLayer: this.structTreeLayer,\n });\n } catch (ex) {\n console.error(\"#renderAnnotationLayer:\", ex);\n error = ex;\n } finally {\n this.#dispatchLayerRendered(\"annotationlayerrendered\", error);\n }\n }\n\n async #renderAnnotationEditorLayer() {\n let error = null;\n try {\n await this.annotationEditorLayer.render({\n viewport: this.viewport,\n intent: \"display\",\n });\n } catch (ex) {\n console.error(\"#renderAnnotationEditorLayer:\", ex);\n error = ex;\n } finally {\n this.#dispatchLayerRendered(\"annotationeditorlayerrendered\", error);\n }\n }\n\n async #renderDrawLayer() {\n try {\n await this.drawLayer.render({\n intent: \"display\",\n });\n } catch (ex) {\n console.error(\"#renderDrawLayer:\", ex);\n }\n }\n\n async #renderXfaLayer() {\n let error = null;\n try {\n const result = await this.xfaLayer.render({\n viewport: this.viewport,\n intent: \"display\",\n });\n if (result?.textDivs && this._textHighlighter) {\n // Given that the following method fetches the text asynchronously we\n // can invoke it *before* appending the xfaLayer to the DOM (below),\n // since a pending search-highlight/scroll operation thus won't run\n // until after the xfaLayer is available in the viewer.\n this.#buildXfaTextContentItems(result.textDivs);\n }\n } catch (ex) {\n console.error(\"#renderXfaLayer:\", ex);\n error = ex;\n } finally {\n if (this.xfaLayer?.div) {\n // Pause translation when inserting the xfaLayer in the DOM.\n this.l10n.pause();\n this.#addLayer(this.xfaLayer.div, \"xfaLayer\");\n this.l10n.resume();\n }\n this.#dispatchLayerRendered(\"xfalayerrendered\", error);\n }\n }\n\n async #renderTextLayer() {\n if (!this.textLayer) {\n return;\n }\n let error = null;\n try {\n await this.textLayer.render({\n viewport: this.viewport,\n });\n } catch (ex) {\n if (ex instanceof AbortException) {\n return;\n }\n console.error(\"#renderTextLayer:\", ex);\n error = ex;\n }\n this.#dispatchLayerRendered(\"textlayerrendered\", error);\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\n const treeDom = await this.structTreeLayer?.render();\n if (treeDom) {\n this.l10n.pause();\n this.structTreeLayer?.updateTextLayer();\n if (this.canvas && treeDom.parentNode !== this.canvas) {\n // Pause translation when inserting the structTree in the DOM.\n this.canvas.append(treeDom);\n }\n this.l10n.resume();\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 async #injectLinkAnnotations(textLayerPromise) {\n let error = null;\n try {\n await textLayerPromise;\n\n if (!this.annotationLayer) {\n return; // Rendering was cancelled while the textLayerPromise resolved.\n }\n await this.annotationLayer.injectLinkAnnotations(\n Autolinker.processLinks(this)\n );\n } catch (ex) {\n console.error(\"#injectLinkAnnotations:\", ex);\n error = ex;\n }\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n this.#dispatchLayerRendered(\"linkannotationsadded\", error);\n }\n }\n\n _resetCanvas() {\n super._resetCanvas();\n this.#originalViewport = null;\n }\n\n reset({\n keepAnnotationLayer = false,\n keepAnnotationEditorLayer = false,\n keepXfaLayer = false,\n keepTextLayer = false,\n keepCanvasWrapper = false,\n preserveDetailViewState = false,\n } = {}) {\n const keepPdfBugGroups = this.pdfPage?._pdfBug ?? 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 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 canvasWrapperNode = (keepCanvasWrapper && this.#canvasWrapper) || null;\n for (let i = childNodes.length - 1; i >= 0; i--) {\n const node = childNodes[i];\n switch (node) {\n case annotationLayerNode:\n case annotationEditorLayerNode:\n case xfaLayerNode:\n case textLayerNode:\n case canvasWrapperNode:\n continue;\n }\n if (keepPdfBugGroups && node.classList.contains(\"pdfBugGroupsLayer\")) {\n continue;\n }\n node.remove();\n const layerIndex = this.#layers.indexOf(node);\n if (layerIndex >= 0) {\n this.#layers[layerIndex] = null;\n }\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 (!keepCanvasWrapper && this.#canvasWrapper) {\n this.#canvasWrapper = null;\n this._resetCanvas();\n }\n\n if (!preserveDetailViewState) {\n this.detailView?.reset({ keepCanvas: keepCanvasWrapper });\n\n // If we are keeping the canvas around we must also keep the `detailView`\n // object, so that next time we need a detail view we'll update the\n // existing canvas rather than creating a new one.\n if (!keepCanvasWrapper) {\n this.detailView = null;\n }\n }\n }\n\n toggleEditingMode(isEditing) {\n // The page can be invisible, consequently there's no annotation layer and\n // we can't know if there are editable annotations.\n // So to avoid any issue when the page is rendered the #isEditing flag must\n // be set.\n this.#isEditing = isEditing;\n if (!this.hasEditableAnnotations()) {\n return;\n }\n this.reset({\n keepAnnotationLayer: true,\n keepAnnotationEditorLayer: true,\n keepXfaLayer: true,\n keepTextLayer: true,\n keepCanvasWrapper: true,\n });\n }\n\n updateVisibleArea(visibleArea) {\n if (this.enableDetailCanvas) {\n if (\n this.#needsRestrictedScaling &&\n this.maxCanvasPixels > 0 &&\n visibleArea\n ) {\n this.detailView ??= new PDFPageDetailView({\n pageView: this,\n enableOptimizedPartialRendering: this.enableOptimizedPartialRendering,\n });\n this.detailView.update({ visibleArea });\n } else if (this.detailView) {\n this.detailView.reset();\n this.detailView = null;\n }\n }\n }\n\n /**\n * @typedef {Object} PDFPageViewUpdateParameters\n * @property {number} [scale] The new scale, if specified.\n * @property {number} [rotation] The new rotation, if specified.\n * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise]\n * A promise that is resolved with an {@link OptionalContentConfig}\n * instance. The default value is `null`.\n * @property {number} [drawingDelay]\n */\n\n /**\n * Update e.g. the scale and/or rotation of the page.\n * @param {PDFPageViewUpdateParameters} params\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 this.#useThumbnailCanvas.directDrawing = true;\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\" || PDFJSDev.test(\"GENERIC\")) &&\n this._isStandalone\n ) {\n this._container?.style.setProperty(\"--scale-factor\", this.viewport.scale);\n }\n\n this.#computeScale();\n\n if (this.canvas) {\n const onlyCssZoom =\n this.#hasRestrictedScaling && this.#needsRestrictedScaling;\n const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000;\n\n if (postponeDrawing || onlyCssZoom) {\n if (\n postponeDrawing &&\n !onlyCssZoom &&\n this.renderingState !== RenderingStates.FINISHED\n ) {\n this.cancelRendering({\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 // Ensure that the thumbnails won't become partially (or fully) blank,\n // if the sidebar is opened before the actual rendering is done.\n this.#useThumbnailCanvas.directDrawing = false;\n }\n\n this.cssTransform({\n redrawAnnotationLayer: true,\n redrawAnnotationEditorLayer: true,\n redrawXfaLayer: true,\n redrawTextLayer: !postponeDrawing,\n hideTextLayer: postponeDrawing,\n });\n\n // The \"pagerendered\"-event will be dispatched once the actual\n // rendering is done, hence don't dispatch it here as well.\n if (!postponeDrawing) {\n this.detailView?.update({ underlyingViewUpdated: true });\n\n this.dispatchPageRendered(\n /* cssTransform */ true,\n /* isDetailView */ false\n );\n }\n return;\n }\n }\n this.cssTransform({});\n this.reset({\n keepAnnotationLayer: true,\n keepAnnotationEditorLayer: true,\n keepXfaLayer: true,\n keepTextLayer: true,\n keepCanvasWrapper: true,\n // It will be reset by the .update call below\n preserveDetailViewState: true,\n });\n\n this.detailView?.update({ underlyingViewUpdated: true });\n }\n\n #computeScale() {\n const { width, height } = this.viewport;\n const outputScale = (this.outputScale = new OutputScale());\n\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this.maxCanvasPixels === 0\n ) {\n const invScale = 1 / this.scale;\n // Use a scale that makes the canvas have the originally intended size\n // of the page.\n outputScale.sx *= invScale;\n outputScale.sy *= invScale;\n this.#needsRestrictedScaling = true;\n } else {\n this.#needsRestrictedScaling = outputScale.limitCanvas(\n width,\n height,\n this.maxCanvasPixels,\n this.maxCanvasDim,\n this.capCanvasAreaFactor\n );\n if (this.#needsRestrictedScaling && this.enableDetailCanvas) {\n // If we are going to have a high-res detail view, further reduce\n // the canvas resolution to improve rendering performance.\n // When enableOptimizedPartialRendering is enabled the factor can be\n // higher since less data will be rendered and it's more acceptable to\n // have a lower quality (the canvas is exposed less time to the user).\n const factor = this.enableOptimizedPartialRendering ? 4 : 2;\n outputScale.sx /= factor;\n outputScale.sy /= factor;\n }\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 super.cancelRendering({ cancelExtraDelay });\n\n if (this.textLayer && (!keepTextLayer || !this.textLayer.div)) {\n this.textLayer.cancel();\n this.textLayer = 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 (this.structTreeLayer && !this.textLayer) {\n this.structTreeLayer = null;\n }\n if (\n this.annotationEditorLayer &&\n (!keepAnnotationEditorLayer || !this.annotationEditorLayer.div)\n ) {\n if (this.drawLayer) {\n this.drawLayer.cancel();\n this.drawLayer = null;\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 redrawAnnotationLayer = false,\n redrawAnnotationEditorLayer = false,\n redrawXfaLayer = false,\n redrawTextLayer = false,\n hideTextLayer = false,\n }) {\n const { canvas } = this;\n if (!canvas) {\n return;\n }\n\n const originalViewport = this.#originalViewport;\n if (this.viewport !== originalViewport) {\n // The canvas may have been originally rotated; rotate relative to that.\n const relativeRotation =\n (360 + this.viewport.rotation - originalViewport.rotation) % 360;\n if (relativeRotation === 90 || relativeRotation === 270) {\n const { width, height } = this.viewport;\n // Scale x and y because of the rotation.\n const scaleX = height / width;\n const scaleY = width / height;\n canvas.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX},${scaleY})`;\n } else {\n canvas.style.transform =\n relativeRotation === 0 ? \"\" : `rotate(${relativeRotation}deg)`;\n }\n }\n\n if (redrawAnnotationLayer && this.annotationLayer) {\n this.#renderAnnotationLayer();\n }\n if (redrawAnnotationEditorLayer && this.annotationEditorLayer) {\n if (this.drawLayer) {\n this.#renderDrawLayer();\n }\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 // Wrap the canvas so that if it has a CSS transform for high DPI the\n // overflow will be hidden in Firefox.\n _ensureCanvasWrapper() {\n let canvasWrapper = this.#canvasWrapper;\n if (!canvasWrapper) {\n canvasWrapper = this.#canvasWrapper = document.createElement(\"div\");\n canvasWrapper.classList.add(\"canvasWrapper\");\n this.#addLayer(canvasWrapper, \"canvasWrapper\");\n }\n return canvasWrapper;\n }\n\n _getRenderingContext(canvas, transform, recordOperations) {\n return {\n canvas,\n transform,\n viewport: this.viewport,\n annotationMode: this.#annotationMode,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n annotationCanvasMap: this._annotationCanvasMap,\n pageColors: this.pageColors,\n isEditing: this.#isEditing,\n recordOperations,\n };\n }\n\n async 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, l10n, pdfPage, viewport } = this;\n\n if (!pdfPage) {\n this.renderingState = RenderingStates.FINISHED;\n throw new Error(\"pdfPage is not loaded\");\n }\n\n this.renderingState = RenderingStates.RUNNING;\n\n const canvasWrapper = this._ensureCanvasWrapper();\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 pdfPage,\n highlighter: this._textHighlighter,\n accessibilityManager: this._accessibilityManager,\n enablePermissions:\n this.#textLayerMode === TextLayerMode.ENABLE_PERMISSIONS,\n onAppend: textLayerDiv => {\n // Pause translation when inserting the textLayer in the DOM.\n this.l10n.pause();\n this.#addLayer(textLayerDiv, \"textLayer\");\n this.l10n.resume();\n },\n });\n }\n\n if (\n !this.annotationLayer &&\n this.#annotationMode !== AnnotationMode.DISABLE\n ) {\n const {\n annotationStorage,\n annotationEditorUIManager,\n downloadManager,\n enableComment,\n enableScripting,\n fieldObjectsPromise,\n hasJSActionsPromise,\n linkService,\n } = this.#layerProperties;\n\n this._annotationCanvasMap ||= new Map();\n this.annotationLayer = new AnnotationLayerBuilder({\n pdfPage,\n annotationStorage,\n imageResourcesPath: this.imageResourcesPath,\n renderForms: this.#annotationMode === AnnotationMode.ENABLE_FORMS,\n linkService,\n downloadManager,\n enableComment,\n enableScripting,\n hasJSActionsPromise,\n fieldObjectsPromise,\n annotationCanvasMap: this._annotationCanvasMap,\n accessibilityManager: this._accessibilityManager,\n annotationEditorUIManager,\n commentManager: this.#commentManager,\n onAppend: annotationLayerDiv => {\n this.#addLayer(annotationLayerDiv, \"annotationLayer\");\n },\n });\n }\n\n const { width, height } = viewport;\n this.#originalViewport = viewport;\n\n const { canvas, prevCanvas } = this._createCanvas(newCanvas => {\n // Always inject the canvas as the first element in the wrapper.\n canvasWrapper.prepend(newCanvas);\n });\n canvas.setAttribute(\"role\", \"presentation\");\n\n if (!this.outputScale) {\n this.#computeScale();\n }\n const { outputScale } = this;\n this.#hasRestrictedScaling = this.#needsRestrictedScaling;\n\n const sfx = approximateFraction(outputScale.sx);\n const sfy = approximateFraction(outputScale.sy);\n\n const canvasWidth = (canvas.width = floorToDivide(\n calcRound(width * outputScale.sx),\n sfx[0]\n ));\n const canvasHeight = (canvas.height = floorToDivide(\n calcRound(height * outputScale.sy),\n sfy[0]\n ));\n const pageWidth = floorToDivide(calcRound(width), sfx[1]);\n const pageHeight = floorToDivide(calcRound(height), sfy[1]);\n outputScale.sx = canvasWidth / pageWidth;\n outputScale.sy = canvasHeight / pageHeight;\n\n if (this.#scaleRoundX !== sfx[1]) {\n div.style.setProperty(\"--scale-round-x\", `${sfx[1]}px`);\n this.#scaleRoundX = sfx[1];\n }\n if (this.#scaleRoundY !== sfy[1]) {\n div.style.setProperty(\"--scale-round-y\", `${sfy[1]}px`);\n this.#scaleRoundY = sfy[1];\n }\n\n const recordBBoxes =\n this.enableOptimizedPartialRendering &&\n this.#hasRestrictedScaling &&\n !this.recordedBBoxes;\n\n // Rendering area\n const transform = outputScale.scaled\n ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]\n : null;\n const resultPromise = this._drawCanvas(\n this._getRenderingContext(canvas, transform, recordBBoxes),\n () => {\n prevCanvas?.remove();\n this._resetCanvas();\n },\n renderTask => {\n // Ensure that the thumbnails won't become partially (or fully) blank,\n // for documents that contain interactive form elements.\n this.#useThumbnailCanvas.regularAnnotations =\n !renderTask.separateAnnots;\n\n this.dispatchPageRendered(\n /* cssTransform */ false,\n /* isDetailView */ false\n );\n }\n ).then(async () => {\n if (this.renderingState !== RenderingStates.FINISHED) {\n // The rendering has been cancelled.\n return;\n }\n this.structTreeLayer ||= new StructTreeLayerBuilder(\n pdfPage,\n viewport.rawDims\n );\n\n const textLayerPromise = this.#renderTextLayer();\n\n if (this.annotationLayer) {\n await this.#renderAnnotationLayer();\n\n if (this.#enableAutoLinking && this.annotationLayer && this.textLayer) {\n await this.#injectLinkAnnotations(textLayerPromise);\n }\n }\n\n const { annotationEditorUIManager } = this.#layerProperties;\n\n if (!annotationEditorUIManager) {\n return;\n }\n this.drawLayer ||= new DrawLayerBuilder();\n await this.#renderDrawLayer();\n this.drawLayer.setParent(canvasWrapper);\n\n if (\n this.annotationLayer ||\n this.#annotationMode === AnnotationMode.DISABLE\n ) {\n this.annotationEditorLayer ||= new AnnotationEditorLayerBuilder({\n uiManager: annotationEditorUIManager,\n pageIndex: this.id - 1,\n l10n,\n structTreeLayer: this.structTreeLayer,\n accessibilityManager: this._accessibilityManager,\n annotationLayer: this.annotationLayer?.annotationLayer,\n textLayer: this.textLayer,\n drawLayer: this.drawLayer.getDrawLayer(),\n clonedFrom: this.#clonedFrom?.annotationEditorLayer,\n onAppend: annotationEditorLayerDiv => {\n this.#addLayer(annotationEditorLayerDiv, \"annotationEditorLayer\");\n },\n });\n this.#clonedFrom = null;\n this.#renderAnnotationEditorLayer();\n }\n });\n\n if (pdfPage.isPureXfa) {\n if (!this.xfaLayer) {\n const { annotationStorage, linkService } = this.#layerProperties;\n\n this.xfaLayer = new XfaLayerBuilder({\n pdfPage,\n annotationStorage,\n linkService,\n });\n }\n this.#renderXfaLayer();\n }\n\n div.setAttribute(\"data-loaded\", true);\n\n this.dispatchPageRender();\n\n return resultPromise;\n }\n\n /**\n * @param {string|null} label\n */\n setPageLabel(label) {\n this.pageLabel = typeof label === \"string\" ? label : null;\n\n this.div.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({ page: this.pageLabel ?? this.id })\n );\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 { directDrawing, initialOptionalContent, regularAnnotations } =\n this.#useThumbnailCanvas;\n return directDrawing && initialOptionalContent && regularAnnotations\n ? this.canvas\n : null;\n }\n}\n\nexport { PDFPageView };\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// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_find_controller\").PDFFindController} PDFFindController */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_scripting_manager\").PDFScriptingManager} PDFScriptingManager */\n/** @typedef {import(\"./pdf_link_service.js\").PDFLinkService} PDFLinkService */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./base_download_manager.js\").BaseDownloadManager} BaseDownloadManager */\n/** @typedef {import(\"./l10n.js\").L10n} L10n */\n\nimport {\n AnnotationEditorType,\n AnnotationEditorUIManager,\n AnnotationMode,\n makeArr,\n MathClamp,\n PermissionFlag,\n PixelsPerInch,\n shadow,\n stopEvent,\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 removeNullCharacters,\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 { GenericL10n } from \"web-null_l10n\";\nimport { PDFPageView } from \"./pdf_page_view.js\";\nimport { PDFRenderingQueue } from \"./pdf_rendering_queue.js\";\nimport { RenderingStates } from \"./renderable_view.js\";\nimport { SimpleLinkService } from \"./pdf_link_service.js\";\n\nconst DEFAULT_CACHE_SIZE = 10;\n\nconst PagesCountLimit = {\n FORCE_SCROLL_MODE_PAGE: 10000,\n FORCE_LAZY_PAGE_INIT: 5000,\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 {PDFLinkService} [linkService] - The navigation/linking service.\n * @property {BaseDownloadManager} [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} [annotationEditorHighlightColors] - A comma separated list\n * of colors to propose to highlight some text in the pdf.\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 {number} [maxCanvasPixels] - The maximum supported canvas size in\n * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for\n * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).\n * @property {number} [maxCanvasDim] - The maximum supported canvas dimension,\n * in either width or height. Use `-1` for no limit.\n * The default value is 32767.\n * @property {number} [capCanvasAreaFactor] - Cap the canvas area to the\n * viewport increased by the value in percent. Use `-1` for no limit.\n * The default value is 200%.\n * @property {boolean} [enableDetailCanvas] - When enabled, if the rendered\n * pages would need a canvas that is larger than `maxCanvasPixels` or\n * `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one,\n * that only renders the part of the page that is close to the viewport.\n * The default value is `true`.\n * @property {boolean} [enableOptimizedPartialRendering] - When enabled, PDF\n * rendering will keep track of which areas of the page each PDF operation\n * affects. Then, when rendering a partial page (if `enableDetailCanvas` is\n * enabled), it will only run through the operations that affect that portion.\n * @property {L10n} [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 * @property {boolean} [enableHWA] - Enables hardware acceleration for\n * rendering. The default value is `false`.\n * @property {boolean} [supportsPinchToZoom] - Enable zooming on pinch gesture.\n * The default value is `true`.\n * @property {boolean} [enableAutoLinking] - Enable creation of hyperlinks from\n * text that look like URLs. The default value is `true`.\n * @property {number} [minDurationToUpdateCanvas] - Minimum duration to wait\n * before updating the canvas. The default value is `500`.\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 #altTextManager = null;\n\n #annotationEditorHighlightColors = null;\n\n #annotationEditorMode = AnnotationEditorType.NONE;\n\n #annotationEditorUIManager = null;\n\n #annotationMode = AnnotationMode.ENABLE_FORMS;\n\n #commentManager = null;\n\n #containerTopLeft = null;\n\n #editorUndoBar = null;\n\n #enableHWA = false;\n\n #enableHighlightFloatingButton = false;\n\n #enablePermissions = false;\n\n #enableUpdatedAddImage = false;\n\n #enableNewAltTextWhenAddingImage = false;\n\n #enableAutoLinking = true;\n\n #eventAbortController = null;\n\n #minDurationToUpdateCanvas = 0;\n\n #mlManager = null;\n\n #printingAllowed = true;\n\n #scrollTimeoutId = null;\n\n #switchAnnotationEditorModeAC = null;\n\n #switchAnnotationEditorModeTimeoutId = null;\n\n #getAllTextInProgress = false;\n\n #hiddenCopyElement = null;\n\n #interruptCopyCondition = false;\n\n #previousContainerHeight = 0;\n\n #resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this));\n\n #scrollModePageState = null;\n\n #scaleTimeoutId = null;\n\n #signatureManager = null;\n\n #supportsPinchToZoom = true;\n\n #textLayerMode = TextLayerMode.ENABLE;\n\n #viewerAlert = null;\n\n #copiedPageViews = 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\n this.container = options.container;\n this.viewer = options.viewer || options.container.firstElementChild;\n this.#viewerAlert = options.viewerAlert || null;\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\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.#altTextManager = options.altTextManager || null;\n this.#commentManager = options.commentManager || null;\n this.#signatureManager = options.signatureManager || null;\n this.#editorUndoBar = options.editorUndoBar || null;\n\n if (this.findController) {\n this.findController.onIsPageVisible = pageNumber =>\n this._getVisiblePages().ids.has(pageNumber);\n }\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.#annotationEditorHighlightColors =\n options.annotationEditorHighlightColors || null;\n this.#enableHighlightFloatingButton =\n options.enableHighlightFloatingButton === true;\n this.#enableUpdatedAddImage = options.enableUpdatedAddImage === true;\n this.#enableNewAltTextWhenAddingImage =\n options.enableNewAltTextWhenAddingImage === true;\n this.imageResourcesPath = options.imageResourcesPath || \"\";\n this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this.removePageBorders = options.removePageBorders || false;\n }\n this.maxCanvasPixels = options.maxCanvasPixels;\n this.maxCanvasDim = options.maxCanvasDim;\n this.capCanvasAreaFactor = options.capCanvasAreaFactor;\n this.enableDetailCanvas = options.enableDetailCanvas ?? true;\n this.enableOptimizedPartialRendering =\n options.enableOptimizedPartialRendering ?? false;\n this.l10n = options.l10n;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this.l10n ||= new GenericL10n();\n }\n this.#enablePermissions = options.enablePermissions || false;\n this.pageColors = options.pageColors || null;\n this.#mlManager = options.mlManager || null;\n this.#enableHWA = options.enableHWA || false;\n this.#supportsPinchToZoom = options.supportsPinchToZoom !== false;\n this.#enableAutoLinking = options.enableAutoLinking !== false;\n this.#minDurationToUpdateCanvas = options.minDurationToUpdateCanvas ?? 500;\n\n this.defaultRenderingQueue = !options.renderingQueue;\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this.defaultRenderingQueue\n ) {\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 const { abortSignal } = options;\n abortSignal?.addEventListener(\n \"abort\",\n () => {\n this.#resizeObserver.disconnect();\n this.#resizeObserver = null;\n },\n { once: true }\n );\n\n this.scroll = watchScroll(\n this.container,\n this._scrollUpdate.bind(this),\n abortSignal\n );\n this.presentationModeState = PresentationModeState.UNKNOWN;\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 // Trigger API-cleanup, once thumbnail rendering has finished,\n // if the relevant pageView is *not* cached in the buffer.\n this.eventBus._on(\"thumbnailrendered\", ({ pageNumber, pdfPage }) => {\n const pageView = this._pages[pageNumber - 1];\n if (!this.#buffer.has(pageView)) {\n pdfPage?.cleanup();\n }\n });\n\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n !options.l10n\n ) {\n // Ensure that Fluent is connected in e.g. the COMPONENTS build.\n this.l10n.translate(this.container);\n }\n }\n\n get printingAllowed() {\n return this.#printingAllowed;\n }\n\n get pagesCount() {\n return this._pages.length;\n }\n\n getPageView(index) {\n return this._pages[index];\n }\n\n getCachedPageViews() {\n return new Set(this.#buffer);\n }\n\n /**\n * @type {boolean} - True if all {PDFPageView} objects are initialized.\n */\n get pageViewsReady() {\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(pageView => pageView?.pdfPage);\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 get _layerProperties() {\n const self = this;\n return shadow(this, \"_layerProperties\", {\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 enableComment() {\n return !!self.#commentManager;\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 this.#printingAllowed = true;\n this.eventBus.dispatch(\"printingallowed\", {\n source: this,\n isAllowed: this.#printingAllowed,\n });\n\n return params;\n }\n\n this.#printingAllowed =\n permissions.includes(PermissionFlag.PRINT_HIGH_QUALITY) ||\n permissions.includes(PermissionFlag.PRINT);\n this.eventBus.dispatch(\"printingallowed\", {\n source: this,\n isAllowed: this.#printingAllowed,\n });\n\n if (\n !permissions.includes(PermissionFlag.COPY) &&\n this.#textLayerMode === TextLayerMode.ENABLE\n ) {\n params.textLayerMode = TextLayerMode.ENABLE_PERMISSIONS;\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 async #onePageRenderedOrForceFetch(signal) {\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;\n }\n\n // Handle the window/tab becoming inactive *after* rendering has started;\n // fixes (another part of) bug 1746213.\n const hiddenCapability = Promise.withResolvers(),\n ac = new AbortController();\n document.addEventListener(\n \"visibilitychange\",\n () => {\n if (document.visibilityState === \"hidden\") {\n hiddenCapability.resolve();\n }\n },\n { signal: AbortSignal.any([signal, ac.signal]) }\n );\n\n await Promise.race([\n this._onePageRenderedCapability.promise,\n hiddenCapability.promise,\n ]);\n ac.abort(); // Remove the \"visibilitychange\" listener immediately.\n }\n\n async getAllText() {\n const texts = [];\n const buffer = [];\n for (\n let pageNum = 1, pagesCount = this.pdfDocument.numPages;\n pageNum <= pagesCount;\n ++pageNum\n ) {\n if (this.#interruptCopyCondition) {\n return null;\n }\n buffer.length = 0;\n const page = await this.pdfDocument.getPage(pageNum);\n // By default getTextContent pass disableNormalization equals to false\n // which is fine because we want a normalized string.\n const { items } = await page.getTextContent();\n for (const item of items) {\n if (item.str) {\n buffer.push(item.str);\n }\n if (item.hasEOL) {\n buffer.push(\"\\n\");\n }\n }\n texts.push(removeNullCharacters(buffer.join(\"\")));\n }\n\n return texts.join(\"\\n\");\n }\n\n #copyCallback(textLayerMode, event) {\n const selection = document.getSelection();\n const { focusNode, anchorNode } = selection;\n if (\n anchorNode &&\n focusNode &&\n selection.containsNode(this.#hiddenCopyElement)\n ) {\n // About the condition above:\n // - having non-null anchorNode and focusNode are here to guaranty that\n // we have at least a kind of selection.\n // - this.#hiddenCopyElement is an invisible element which is impossible\n // to select manually (its display is none) but ctrl+A will select all\n // including this element so having it in the selection means that all\n // has been selected.\n\n if (\n this.#getAllTextInProgress ||\n textLayerMode === TextLayerMode.ENABLE_PERMISSIONS\n ) {\n stopEvent(event);\n return;\n }\n this.#getAllTextInProgress = true;\n\n // TODO: if all the pages are rendered we don't need to wait for\n // getAllText and we could just get text from the Selection object.\n\n // Select all the document.\n const { classList } = this.viewer;\n classList.add(\"copyAll\");\n\n const ac = new AbortController();\n window.addEventListener(\n \"keydown\",\n ev => (this.#interruptCopyCondition = ev.key === \"Escape\"),\n { signal: ac.signal }\n );\n\n this.getAllText()\n .then(async text => {\n if (text !== null) {\n await navigator.clipboard.writeText(text);\n }\n })\n .catch(reason => {\n console.warn(\n `Something goes wrong when extracting the text: ${reason.message}`\n );\n })\n .finally(() => {\n this.#getAllTextInProgress = false;\n this.#interruptCopyCondition = false;\n ac.abort();\n classList.remove(\"copyAll\");\n });\n\n stopEvent(event);\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 this.#annotationEditorUIManager?.destroy();\n this.#annotationEditorUIManager = null;\n\n this.#annotationEditorMode = AnnotationEditorType.NONE;\n\n this.#printingAllowed = true;\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 intent: \"display\",\n });\n const permissionsPromise = this.#enablePermissions\n ? pdfDocument.getPermissions()\n : Promise.resolve();\n\n const { eventBus, pageColors, viewer } = this;\n\n this.#eventAbortController = new AbortController();\n const { signal } = this.#eventAbortController;\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 eventBus.dispatch(\"scrollmodechanged\", { source: this, mode });\n }\n\n this._pagesCapability.promise.then(\n () => {\n eventBus.dispatch(\"pagesloaded\", { source: this, pagesCount });\n },\n () => {\n /* Prevent \"Uncaught (in promise)\"-messages in the console. */\n }\n );\n\n const 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 eventBus._on(\"pagerender\", onBeforeDraw, { signal });\n\n const onAfterDraw = evt => {\n if (evt.cssTransform || evt.isDetailView) {\n return;\n }\n this._onePageRenderedCapability.resolve({ timestamp: evt.timestamp });\n\n eventBus._off(\"pagerendered\", onAfterDraw); // Remove immediately.\n };\n eventBus._on(\"pagerendered\", onAfterDraw, { signal });\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 (textLayerMode !== TextLayerMode.DISABLE) {\n const element = (this.#hiddenCopyElement =\n document.createElement(\"div\"));\n element.id = \"hiddenCopyElement\";\n viewer.before(element);\n }\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 viewer,\n this.#viewerAlert,\n this.#altTextManager,\n this.#commentManager,\n this.#signatureManager,\n eventBus,\n pdfDocument,\n pageColors,\n this.#annotationEditorHighlightColors,\n this.#enableHighlightFloatingButton,\n this.#enableUpdatedAddImage,\n this.#enableNewAltTextWhenAddingImage,\n this.#mlManager,\n this.#editorUndoBar,\n this.#supportsPinchToZoom\n );\n eventBus.dispatch(\"annotationeditoruimanager\", {\n source: this,\n uiManager: this.#annotationEditorUIManager,\n });\n if (mode !== AnnotationEditorType.NONE) {\n this.#preloadEditingData(mode);\n this.#annotationEditorUIManager.updateMode(mode);\n }\n } else {\n console.error(`Invalid AnnotationEditor mode: ${mode}`);\n }\n }\n\n const viewerElement =\n this._scrollMode === ScrollMode.PAGE ? null : 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 viewer.style.setProperty(\"--scale-factor\", viewport.scale);\n\n if (pageColors?.background) {\n viewer.style.setProperty(\"--page-bg-color\", pageColors.background);\n }\n if (\n pageColors?.foreground === \"CanvasText\" ||\n pageColors?.background === \"Canvas\"\n ) {\n viewer.style.setProperty(\n \"--hcm-highlight-filter\",\n pdfDocument.filterFactory.addHighlightHCMFilter(\n \"highlight\",\n \"CanvasText\",\n \"Canvas\",\n \"HighlightText\",\n \"Highlight\"\n )\n );\n viewer.style.setProperty(\n \"--hcm-highlight-selected-filter\",\n pdfDocument.filterFactory.addHighlightHCMFilter(\n \"highlight_selected\",\n \"CanvasText\",\n \"Canvas\",\n \"HighlightText\",\n \"ButtonText\"\n )\n );\n }\n\n for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n const pageView = new PDFPageView({\n container: viewerElement,\n 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 maxCanvasPixels: this.maxCanvasPixels,\n maxCanvasDim: this.maxCanvasDim,\n capCanvasAreaFactor: this.capCanvasAreaFactor,\n enableDetailCanvas: this.enableDetailCanvas,\n enableOptimizedPartialRendering:\n this.enableOptimizedPartialRendering,\n pageColors,\n l10n: this.l10n,\n layerProperties: this._layerProperties,\n enableHWA: this.#enableHWA,\n enableAutoLinking: this.#enableAutoLinking,\n minDurationToUpdateCanvas: this.#minDurationToUpdateCanvas,\n commentManager: this.#commentManager,\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 this._pages[0]?.setPdfPage(firstPdfPage);\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 eventBus._on(\n \"annotationeditorlayerrendered\",\n evt => {\n if (this.#annotationEditorUIManager) {\n // Ensure that the Editor buttons, in the toolbar, are updated.\n eventBus.dispatch(\"annotationeditormodechanged\", {\n source: this,\n mode: this.#annotationEditorMode,\n });\n }\n },\n { once: true, signal }\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(signal).then(async () => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the first page rendered.\n }\n this.findController?.setDocument(pdfDocument); // Enable searching.\n this._scriptingManager?.setDocument(pdfDocument); // Enable scripting.\n\n if (this.#hiddenCopyElement) {\n document.addEventListener(\n \"copy\",\n this.#copyCallback.bind(this, textLayerMode),\n { signal }\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 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 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 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 onPagesEdited({ pagesMapper, type, hasBeenCut, pageNumbers }) {\n if (type === \"copy\") {\n this.#copiedPageViews = new Map();\n for (const pageNum of pageNumbers) {\n this.#copiedPageViews.set(pageNum, this._pages[pageNum - 1]);\n }\n return;\n }\n\n const isCut = type === \"cut\";\n if (isCut || type === \"delete\") {\n for (const pageNum of pageNumbers) {\n this._pages[pageNum - 1].deleteMe(isCut);\n }\n }\n\n this._currentPageNumber = 0;\n const prevPages = this._pages;\n const newPages = (this._pages = []);\n for (let i = 1, ii = pagesMapper.pagesNumber; i <= ii; i++) {\n const prevPageNumber = pagesMapper.getPrevPageNumber(i);\n if (prevPageNumber < 0) {\n let page = this.#copiedPageViews.get(-prevPageNumber);\n if (hasBeenCut) {\n page.updatePageNumber(i);\n } else {\n page = page.clone(i);\n }\n newPages.push(page);\n continue;\n }\n const page = prevPages[prevPageNumber - 1];\n newPages.push(page);\n page.updatePageNumber(i);\n }\n\n if (!isCut) {\n this.#copiedPageViews = null;\n }\n\n const viewerElement =\n this._scrollMode === ScrollMode.PAGE ? null : this.viewer;\n if (viewerElement) {\n viewerElement.replaceChildren();\n const fragment = document.createDocumentFragment();\n for (let i = 0, ii = pagesMapper.pagesNumber; i < ii; i++) {\n const { div } = newPages[i];\n div.setAttribute(\"data-page-number\", i + 1);\n fragment.append(div);\n }\n viewerElement.append(fragment);\n }\n\n setTimeout(() => {\n this.forceRendering();\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 = Promise.withResolvers();\n this._onePageRenderedCapability = Promise.withResolvers();\n this._pagesCapability = Promise.withResolvers();\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 this.#eventAbortController?.abort();\n this.#eventAbortController = 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\n this.#hiddenCopyElement?.remove();\n this.#hiddenCopyElement = null;\n\n this.#cleanupTimeouts();\n this.#cleanupSwitchAnnotationEditorMode();\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\n if (this.#scrollTimeoutId) {\n clearTimeout(this.#scrollTimeoutId);\n }\n this.#scrollTimeoutId = setTimeout(() => {\n this.#scrollTimeoutId = null;\n this.update();\n }, 100);\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, origin = null }\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 const previousScale = this._currentScale;\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 if (Array.isArray(origin)) {\n // If the origin of the scaling transform is specified, preserve its\n // location on screen. If not specified, scaling will fix the top-left\n // corner of the visible PDF area.\n const scaleDiff = newScale / previousScale - 1;\n const [top, left] = this.containerTopLeft;\n this.container.scrollLeft += (origin[0] - left) * scaleDiff;\n this.container.scrollTop += (origin[1] - top) * scaleDiff;\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 * @property {string} [center] - Center the view on the specified coordinates.\n * The default value is `null`. Possible values are: `null` (don't center),\n * `horizontal`, `vertical` and `both`.\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 center = null,\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 (center) {\n if (center === \"both\" || center === \"vertical\") {\n top -=\n (this.container.clientHeight -\n Math.abs(boundingRect[1][1] - boundingRect[0][1])) /\n 2;\n }\n if (center === \"both\" || center === \"horizontal\") {\n left -=\n (this.container.clientWidth -\n Math.abs(boundingRect[1][0] - boundingRect[0][0])) /\n 2;\n }\n } else 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 for (const { view, visibleArea } of visiblePages) {\n view.updateVisibleArea(visibleArea);\n }\n for (const view of this.#buffer) {\n if (!visible.ids.has(view.id)) {\n view.updateVisibleArea(null);\n }\n }\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 currentPageNumber = 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 === currentPageNumber && isSimpleLayout) {\n stillFullyVisible = true;\n break;\n }\n }\n this._setCurrentPageNumber(\n stillFullyVisible ? this._currentPageNumber : 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 #switchToEditAnnotationMode() {\n const visible = this._getVisiblePages();\n const pagesToRefresh = [];\n const { ids, views } = visible;\n for (const page of views) {\n const { view } = page;\n if (!view.hasEditableAnnotations()) {\n ids.delete(view.id);\n continue;\n }\n pagesToRefresh.push(page);\n }\n\n if (pagesToRefresh.length === 0) {\n return null;\n }\n this.renderingQueue.renderHighestPriority({\n first: pagesToRefresh[0],\n last: pagesToRefresh.at(-1),\n views: pagesToRefresh,\n ids,\n });\n\n return ids;\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 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 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 ignoreDetailViews =\n // If we are zooming, do not re-render the detail views. Re-renders on\n // zoom happen with a delay, and once the rendering happens it will also\n // trigger rendering of the detail views.\n this.#scaleTimeoutId !== null ||\n // If we are scrolling and the rendering of a detail view was just\n // cancelled, it's because the user is scrolling too quickly and so\n // we constantly need to re-render a different area.\n // Don't attempt to re-render it: this will be done once the user\n // stops scrolling.\n (this.#scrollTimeoutId !== null &&\n visiblePages.views.some(page => page.detailView?.renderingCancelled));\n\n const pageView = this.renderingQueue.getHighestPriority(\n visiblePages,\n this._pages,\n scrollAhead,\n preRenderExtra,\n ignoreDetailViews\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 let initialOrientation;\n return this._pages.map(pageView => {\n const viewport = pageView.pdfPage.getViewport({ scale: 1 });\n const orientation = isPortraitOrientation(viewport);\n if (initialOrientation === undefined) {\n initialOrientation = orientation;\n } else if (\n this.enablePrintAutoRotate &&\n orientation !== initialOrientation\n ) {\n // Rotate to fit the initial orientation.\n return {\n width: viewport.height,\n height: viewport.width,\n rotation: (viewport.rotation - 90) % 360,\n };\n }\n return {\n width: viewport.width,\n height: viewport.height,\n rotation: viewport.rotation,\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({ intent: \"display\" });\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 (\n typeof PDFJSDev === \"undefined\"\n ? window.isGECKOVIEW\n : PDFJSDev.test(\"GECKOVIEW\")\n ) {\n // NOTE: Always ignore the pageLayout in GeckoView since there's\n // no UI available to change Scroll/Spread modes for the user.\n return;\n }\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 (\n typeof PDFJSDev === \"undefined\"\n ? window.isGECKOVIEW\n : PDFJSDev.test(\"GECKOVIEW\")\n ) {\n // NOTE: Always ignore the pageLayout in GeckoView since there's\n // no UI available to change Scroll/Spread modes for the user.\n return;\n }\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 #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 pageLayout.getOrInsertComputed(y, makeArr).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 * @property {Array} [origin] x and y coordinates of the scale\n * transformation origin.\n */\n\n /**\n * Changes the current zoom level by the specified amount.\n * @param {ChangeScaleOptions} [options]\n */\n updateScale({ drawingDelay, scaleFactor = null, steps = null, origin }) {\n if (steps === null && scaleFactor === null) {\n throw new Error(\n \"Invalid updateScale options: either `steps` or `scaleFactor` must be provided.\"\n );\n }\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 if (steps) {\n const delta = steps > 0 ? DEFAULT_SCALE_DELTA : 1 / DEFAULT_SCALE_DELTA;\n const round = steps > 0 ? Math.ceil : Math.floor;\n steps = Math.abs(steps);\n do {\n newScale = round((newScale * delta).toFixed(2) * 10) / 10;\n } while (--steps > 0);\n }\n newScale = MathClamp(newScale, MIN_SCALE, MAX_SCALE);\n this.#setScale(newScale, { noScroll: false, drawingDelay, origin });\n }\n\n /**\n * Increase the current zoom level one, or more, times.\n * @param {ChangeScaleOptions} [options]\n */\n increaseScale(options = {}) {\n this.updateScale({ ...options, steps: options.steps ?? 1 });\n }\n\n /**\n * Decrease the current zoom level one, or more, times.\n * @param {ChangeScaleOptions} [options]\n */\n decreaseScale(options = {}) {\n this.updateScale({ ...options, steps: -(options.steps ?? 1) });\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 #cleanupTimeouts() {\n if (this.#scaleTimeoutId !== null) {\n clearTimeout(this.#scaleTimeoutId);\n this.#scaleTimeoutId = null;\n }\n if (this.#scrollTimeoutId !== null) {\n clearTimeout(this.#scrollTimeoutId);\n this.#scrollTimeoutId = null;\n }\n }\n\n #cleanupSwitchAnnotationEditorMode() {\n this.#switchAnnotationEditorModeAC?.abort();\n this.#switchAnnotationEditorModeAC = null;\n\n if (this.#switchAnnotationEditorModeTimeoutId !== null) {\n clearTimeout(this.#switchAnnotationEditorModeTimeoutId);\n this.#switchAnnotationEditorModeTimeoutId = null;\n }\n }\n\n #preloadEditingData(mode) {\n switch (mode) {\n case AnnotationEditorType.STAMP:\n this.#mlManager?.loadModel(\"altText\");\n break;\n case AnnotationEditorType.SIGNATURE:\n // Start to load the signature data.\n this.#signatureManager?.loadSignatures();\n break;\n }\n }\n\n get annotationEditorMode() {\n return this.#annotationEditorUIManager\n ? this.#annotationEditorMode\n : AnnotationEditorType.DISABLE;\n }\n\n /**\n * @typedef {Object} AnnotationEditorModeOptions\n * @property {number} mode - The editor mode (none, FreeText, ink, ...).\n * @property {string|null} [editId] - ID of the existing annotation to edit.\n * @property {boolean} [isFromKeyboard] - True if the mode change is due to a\n * keyboard action.\n * @property {boolean} [mustEnterInEditMode] - True if the editor must enter\n * edit mode.\n * @property {boolean} [editComment] - True if the editor must enter\n * comment edit mode.\n */\n\n /**\n * @param {AnnotationEditorModeOptions} options\n */\n set annotationEditorMode({\n mode,\n editId = null,\n isFromKeyboard = false,\n mustEnterInEditMode = false,\n editComment = false,\n }) {\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.#preloadEditingData(mode);\n\n const { eventBus, pdfDocument } = this;\n const updater = async () => {\n this.#cleanupSwitchAnnotationEditorMode();\n this.#annotationEditorMode = mode;\n await this.#annotationEditorUIManager.updateMode(\n mode,\n editId,\n /* isFromUser = */ true,\n isFromKeyboard,\n mustEnterInEditMode,\n editComment\n );\n if (\n mode !== this.#annotationEditorMode ||\n pdfDocument !== this.pdfDocument\n ) {\n // Since `updateMode` is async, the active mode could have changed.\n return;\n }\n eventBus.dispatch(\"annotationeditormodechanged\", {\n source: this,\n mode,\n });\n };\n\n if (\n mode === AnnotationEditorType.NONE ||\n this.#annotationEditorMode === AnnotationEditorType.NONE\n ) {\n const isEditing = mode !== AnnotationEditorType.NONE;\n if (!isEditing) {\n this.pdfDocument.annotationStorage.resetModifiedIds();\n }\n // We need to cleanup whatever pages being rendered.\n this.cleanup();\n for (const pageView of this._pages) {\n pageView.toggleEditingMode(isEditing);\n }\n // We must call #switchToEditAnnotationMode unconditionally to ensure that\n // page is rendered if it's useful or not.\n const idsToRefresh = this.#switchToEditAnnotationMode();\n if (isEditing && idsToRefresh) {\n // We're editing so we must switch to editing mode when the rendering is\n // done.\n this.#cleanupSwitchAnnotationEditorMode();\n this.#switchAnnotationEditorModeAC = new AbortController();\n const signal = AbortSignal.any([\n this.#eventAbortController.signal,\n this.#switchAnnotationEditorModeAC.signal,\n ]);\n\n eventBus._on(\n \"pagerendered\",\n ({ pageNumber }) => {\n idsToRefresh.delete(pageNumber);\n if (idsToRefresh.size === 0) {\n this.#switchAnnotationEditorModeTimeoutId = setTimeout(\n updater,\n 0\n );\n }\n },\n { signal }\n );\n return;\n }\n }\n updater();\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 this.#cleanupTimeouts();\n\n if (!noUpdate) {\n this.update();\n }\n }\n}\n\nexport { PagesCountLimit, PDFPageViewBuffer, PDFViewer };\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(\"./event_utils.js\").EventBus} EventBus */\n\nimport {\n CursorTool,\n ScrollMode,\n SpreadMode,\n toggleCheckedBtn,\n toggleExpandedBtn,\n} 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} imageAltTextSettingsButton - Button for opening\n * the image alt-text settings dialog.\n * @property {HTMLButtonElement} documentPropertiesButton - Button for opening\n * the document properties dialog.\n */\n\nclass SecondaryToolbar {\n #opts;\n\n /**\n * @param {SecondaryToolbarOptions} options\n * @param {EventBus} eventBus\n */\n constructor(options, eventBus) {\n this.#opts = options;\n const 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.imageAltTextSettingsButton,\n eventName: \"imagealttextsettings\",\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 buttons.push({\n element: options.openFileButton,\n eventName: \"openfile\",\n close: true,\n });\n }\n\n this.eventBus = eventBus;\n this.opened = false;\n\n // Bind the event listeners for click, cursor tool, and scroll/spread mode\n // actions.\n this.#bindListeners(buttons);\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(\"switchcursortool\", { source: this, reset: true });\n this.#scrollModeChanged({ mode: ScrollMode.VERTICAL });\n this.#spreadModeChanged({ mode: SpreadMode.NONE });\n }\n\n #updateUIState() {\n const {\n firstPageButton,\n lastPageButton,\n pageRotateCwButton,\n pageRotateCcwButton,\n } = this.#opts;\n\n firstPageButton.disabled = this.pageNumber <= 1;\n lastPageButton.disabled = this.pageNumber >= this.pagesCount;\n pageRotateCwButton.disabled = this.pagesCount === 0;\n pageRotateCcwButton.disabled = this.pagesCount === 0;\n }\n\n #bindListeners(buttons) {\n const { eventBus } = this;\n const { toggleButton } = this.#opts;\n // Button to toggle the visibility of the secondary toolbar.\n toggleButton.addEventListener(\"click\", this.toggle.bind(this));\n\n // All items within the secondary toolbar.\n for (const { element, eventName, close, eventDetails } of buttons) {\n element.addEventListener(\"click\", evt => {\n if (eventName !== null) {\n eventBus.dispatch(eventName, { source: this, ...eventDetails });\n }\n if (close) {\n this.close();\n }\n eventBus.dispatch(\"reporttelemetry\", {\n source: this,\n details: {\n type: \"buttons\",\n data: { id: element.id },\n },\n });\n });\n }\n\n eventBus._on(\"cursortoolchanged\", this.#cursorToolChanged.bind(this));\n eventBus._on(\"scrollmodechanged\", this.#scrollModeChanged.bind(this));\n eventBus._on(\"spreadmodechanged\", this.#spreadModeChanged.bind(this));\n }\n\n #cursorToolChanged({ tool, disabled }) {\n const { cursorSelectToolButton, cursorHandToolButton } = this.#opts;\n\n toggleCheckedBtn(cursorSelectToolButton, tool === CursorTool.SELECT);\n toggleCheckedBtn(cursorHandToolButton, tool === CursorTool.HAND);\n\n cursorSelectToolButton.disabled = disabled;\n cursorHandToolButton.disabled = disabled;\n }\n\n #scrollModeChanged({ mode }) {\n const {\n scrollPageButton,\n scrollVerticalButton,\n scrollHorizontalButton,\n scrollWrappedButton,\n spreadNoneButton,\n spreadOddButton,\n spreadEvenButton,\n } = this.#opts;\n\n toggleCheckedBtn(scrollPageButton, mode === ScrollMode.PAGE);\n toggleCheckedBtn(scrollVerticalButton, mode === ScrollMode.VERTICAL);\n toggleCheckedBtn(scrollHorizontalButton, mode === ScrollMode.HORIZONTAL);\n toggleCheckedBtn(scrollWrappedButton, mode === ScrollMode.WRAPPED);\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 const isHorizontal = mode === ScrollMode.HORIZONTAL;\n spreadNoneButton.disabled = isHorizontal;\n spreadOddButton.disabled = isHorizontal;\n spreadEvenButton.disabled = isHorizontal;\n }\n\n #spreadModeChanged({ mode }) {\n const { spreadNoneButton, spreadOddButton, spreadEvenButton } = this.#opts;\n\n toggleCheckedBtn(spreadNoneButton, mode === SpreadMode.NONE);\n toggleCheckedBtn(spreadOddButton, mode === SpreadMode.ODD);\n toggleCheckedBtn(spreadEvenButton, mode === SpreadMode.EVEN);\n }\n\n open() {\n if (this.opened) {\n return;\n }\n this.opened = true;\n\n const { toggleButton, toolbar } = this.#opts;\n toggleExpandedBtn(toggleButton, true, toolbar);\n }\n\n close() {\n if (!this.opened) {\n return;\n }\n this.opened = false;\n\n const { toggleButton, toolbar } = this.#opts;\n toggleExpandedBtn(toggleButton, false, toolbar);\n }\n\n toggle() {\n if (this.opened) {\n this.close();\n } else {\n this.open();\n }\n }\n}\n\nexport { SecondaryToolbar };\n","/* Copyright 2025 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 AnnotationEditorParamsType,\n DOMSVGFactory,\n noContextMenu,\n SignatureExtractor,\n stopEvent,\n SupportedImageMimeTypes,\n} from \"pdfjs-lib\";\n\n// Default height of the added signature in page coordinates.\nconst DEFAULT_HEIGHT_IN_PAGE = 40;\n\nclass SignatureManager {\n #addButton;\n\n #tabsToAltText = null;\n\n #clearButton;\n\n #clearDescription;\n\n #currentEditor;\n\n #description;\n\n #dialog;\n\n #drawCurves = null;\n\n #drawPlaceholder;\n\n #drawPath = null;\n\n #drawPathString = \"\";\n\n #drawPoints = null;\n\n #drawSVG;\n\n #drawThickness;\n\n #errorBar;\n\n #errorDescription;\n\n #errorTitle;\n\n #extractedSignatureData = null;\n\n #imagePath = null;\n\n #imagePicker;\n\n #imagePickerLink;\n\n #imagePlaceholder;\n\n #imageSVG;\n\n #saveCheckbox;\n\n #saveContainer;\n\n #tabButtons;\n\n #addSignatureToolbarButton;\n\n #loadSignaturesPromise = null;\n\n #typeInput;\n\n #currentTab = null;\n\n #currentTabAC = null;\n\n #hasDescriptionChanged = false;\n\n #eventBus;\n\n #isStorageFull = false;\n\n #l10n;\n\n #overlayManager;\n\n #editDescriptionDialog;\n\n #signatureStorage;\n\n #uiManager = null;\n\n static #l10nDescription = null;\n\n constructor(\n {\n dialog,\n panels,\n typeButton,\n typeInput,\n drawButton,\n drawPlaceholder,\n drawSVG,\n drawThickness,\n imageButton,\n imageSVG,\n imagePlaceholder,\n imagePicker,\n imagePickerLink,\n description,\n clearButton,\n cancelButton,\n addButton,\n errorCloseButton,\n errorBar,\n errorTitle,\n errorDescription,\n saveCheckbox,\n saveContainer,\n },\n editSignatureElements,\n addSignatureToolbarButton,\n overlayManager,\n l10n,\n signatureStorage,\n eventBus\n ) {\n this.#addButton = addButton;\n this.#clearButton = clearButton;\n this.#clearDescription = description.lastElementChild;\n this.#description = description.firstElementChild;\n this.#dialog = dialog;\n this.#drawSVG = drawSVG;\n this.#drawPlaceholder = drawPlaceholder;\n this.#drawThickness = drawThickness;\n this.#errorBar = errorBar;\n this.#errorTitle = errorTitle;\n this.#errorDescription = errorDescription;\n this.#imageSVG = imageSVG;\n this.#imagePlaceholder = imagePlaceholder;\n this.#imagePicker = imagePicker;\n this.#imagePickerLink = imagePickerLink;\n this.#overlayManager = overlayManager;\n this.#saveCheckbox = saveCheckbox;\n this.#saveContainer = saveContainer;\n this.#addSignatureToolbarButton = addSignatureToolbarButton;\n this.#typeInput = typeInput;\n this.#l10n = l10n;\n this.#signatureStorage = signatureStorage;\n this.#eventBus = eventBus;\n this.#editDescriptionDialog = new EditDescriptionDialog(\n editSignatureElements,\n overlayManager\n );\n\n SignatureManager.#l10nDescription ||= Object.freeze({\n signature: \"pdfjs-editor-add-signature-description-default-when-drawing\",\n errorUploadTitle: \"pdfjs-editor-add-signature-image-upload-error-title\",\n errorUploadDescription:\n \"pdfjs-editor-add-signature-image-upload-error-description\",\n errorNoDataTitle: \"pdfjs-editor-add-signature-image-no-data-error-title\",\n errorNoDataDescription:\n \"pdfjs-editor-add-signature-image-no-data-error-description\",\n });\n\n dialog.addEventListener(\"close\", this.#close.bind(this));\n dialog.addEventListener(\"contextmenu\", e => {\n const { target } = e;\n if (target !== this.#typeInput && target !== this.#description) {\n e.preventDefault();\n }\n });\n dialog.addEventListener(\"drop\", e => {\n stopEvent(e);\n });\n cancelButton.addEventListener(\"click\", this.#cancel.bind(this));\n addButton.addEventListener(\"click\", this.#add.bind(this));\n clearButton.addEventListener(\n \"click\",\n () => {\n this.#reportTelemetry({\n type: \"signature\",\n action: \"pdfjs.signature.clear\",\n data: {\n type: this.#currentTab,\n },\n });\n this.#initTab(null);\n },\n { passive: true }\n );\n this.#description.addEventListener(\n \"input\",\n () => {\n this.#clearDescription.disabled = this.#description.value === \"\";\n },\n { passive: true }\n );\n this.#clearDescription.addEventListener(\n \"click\",\n () => {\n this.#description.value = \"\";\n this.#clearDescription.disabled = true;\n },\n { passive: true }\n );\n errorCloseButton.addEventListener(\n \"click\",\n () => {\n errorBar.hidden = true;\n },\n { passive: true }\n );\n\n this.#initTabButtons(typeButton, drawButton, imageButton, panels);\n imagePicker.accept = SupportedImageMimeTypes.join(\",\");\n\n eventBus._on(\"storedsignatureschanged\", this.#signaturesChanged.bind(this));\n\n overlayManager.register(dialog);\n }\n\n #initTabButtons(typeButton, drawButton, imageButton, panels) {\n const buttons = (this.#tabButtons = new Map([\n [\"type\", typeButton],\n [\"draw\", drawButton],\n [\"image\", imageButton],\n ]));\n const tabCallback = e => {\n for (const [name, button] of buttons) {\n if (button === e.target) {\n button.setAttribute(\"aria-selected\", true);\n button.setAttribute(\"tabindex\", 0);\n panels.setAttribute(\"data-selected\", name);\n this.#initTab(name);\n } else {\n button.setAttribute(\"aria-selected\", false);\n // Only the active tab is focusable: the others can be\n // reached by keyboard navigation (left/right arrows).\n button.setAttribute(\"tabindex\", -1);\n }\n }\n };\n\n const buttonsArray = Array.from(buttons.values());\n for (let i = 0, ii = buttonsArray.length; i < ii; i++) {\n const button = buttonsArray[i];\n button.addEventListener(\"click\", tabCallback, { passive: true });\n button.addEventListener(\n \"keydown\",\n ({ key }) => {\n if (key !== \"ArrowLeft\" && key !== \"ArrowRight\") {\n return;\n }\n buttonsArray[i + (key === \"ArrowLeft\" ? -1 : 1)]?.focus();\n },\n { passive: true }\n );\n }\n }\n\n #resetCommon() {\n this.#hasDescriptionChanged = false;\n this.#description.value = \"\";\n if (this.#currentTab) {\n this.#tabsToAltText.get(this.#currentTab).value = \"\";\n }\n }\n\n #resetTab(name) {\n switch (name) {\n case \"type\":\n this.#typeInput.value = \"\";\n break;\n case \"draw\":\n this.#drawCurves = null;\n this.#drawPoints = null;\n this.#drawPathString = \"\";\n this.#drawPath?.remove();\n this.#drawPath = null;\n this.#drawPlaceholder.hidden = false;\n this.#drawThickness.value = 1;\n break;\n case \"image\":\n this.#imagePlaceholder.hidden = false;\n this.#imagePath?.remove();\n this.#imagePath = null;\n break;\n }\n }\n\n #initTab(name) {\n if (name && this.#currentTab === name) {\n return;\n }\n if (this.#currentTab) {\n this.#tabsToAltText.get(this.#currentTab).value = this.#description.value;\n }\n if (name) {\n this.#currentTab = name;\n }\n\n this.#errorBar.hidden = true;\n const reset = !name;\n if (reset) {\n this.#resetCommon();\n } else {\n this.#description.value = this.#tabsToAltText.get(this.#currentTab).value;\n }\n this.#clearDescription.disabled = this.#description.value === \"\";\n this.#currentTabAC?.abort();\n this.#currentTabAC = new AbortController();\n switch (this.#currentTab) {\n case \"type\":\n this.#initTypeTab(reset);\n break;\n case \"draw\":\n this.#initDrawTab(reset);\n break;\n case \"image\":\n this.#initImageTab(reset);\n break;\n }\n }\n\n #disableButtons(value) {\n if (!value || !this.#isStorageFull) {\n this.#saveCheckbox.disabled = !value;\n }\n this.#clearButton.disabled =\n this.#addButton.disabled =\n this.#description.disabled =\n !value;\n }\n\n #initTypeTab(reset) {\n if (reset) {\n this.#resetTab(\"type\");\n }\n\n this.#disableButtons(this.#typeInput.value);\n\n const { signal } = this.#currentTabAC;\n const options = { passive: true, signal };\n this.#typeInput.addEventListener(\n \"input\",\n () => {\n const { value } = this.#typeInput;\n if (!this.#hasDescriptionChanged) {\n this.#tabsToAltText.get(\"type\").default = this.#description.value =\n value;\n this.#clearDescription.disabled = value === \"\";\n }\n this.#disableButtons(value);\n },\n options\n );\n this.#description.addEventListener(\n \"input\",\n () => {\n this.#hasDescriptionChanged =\n this.#typeInput.value !== this.#description.value;\n },\n options\n );\n }\n\n #initDrawTab(reset) {\n if (reset) {\n this.#resetTab(\"draw\");\n }\n\n this.#disableButtons(this.#drawPath);\n\n const { signal } = this.#currentTabAC;\n const options = { signal };\n let currentPointerId = NaN;\n const drawCallback = e => {\n const { pointerId } = e;\n if (!isNaN(currentPointerId) && currentPointerId !== pointerId) {\n return;\n }\n currentPointerId = pointerId;\n e.preventDefault();\n this.#drawSVG.setPointerCapture(pointerId);\n\n const { width: drawWidth, height: drawHeight } =\n this.#drawSVG.getBoundingClientRect();\n let { offsetX, offsetY } = e;\n offsetX = Math.round(offsetX);\n offsetY = Math.round(offsetY);\n if (e.target === this.#drawPlaceholder) {\n this.#drawPlaceholder.hidden = true;\n }\n if (!this.#drawCurves) {\n this.#drawCurves = {\n width: drawWidth,\n height: drawHeight,\n thickness: parseInt(this.#drawThickness.value),\n curves: [],\n };\n this.#disableButtons(true);\n\n const svgFactory = new DOMSVGFactory();\n const path = (this.#drawPath = svgFactory.createElement(\"path\"));\n path.setAttribute(\"stroke-width\", this.#drawThickness.value);\n this.#drawSVG.append(path);\n this.#drawSVG.addEventListener(\"pointerdown\", drawCallback, options);\n this.#drawPlaceholder.removeEventListener(\"pointerdown\", drawCallback);\n if (this.#description.value === \"\") {\n this.#l10n\n .get(SignatureManager.#l10nDescription.signature)\n .then(description => {\n this.#tabsToAltText.get(\"draw\").default = description;\n this.#description.value ||= description;\n this.#clearDescription.disabled = this.#description.value === \"\";\n });\n }\n }\n\n this.#drawPoints = [offsetX, offsetY];\n this.#drawCurves.curves.push({ points: this.#drawPoints });\n this.#drawPathString += `M ${offsetX} ${offsetY}`;\n this.#drawPath.setAttribute(\"d\", this.#drawPathString);\n\n const finishDrawAC = new AbortController();\n const listenerDrawOptions = {\n signal: AbortSignal.any([signal, finishDrawAC.signal]),\n };\n this.#drawSVG.addEventListener(\n \"contextmenu\",\n noContextMenu,\n listenerDrawOptions\n );\n this.#drawSVG.addEventListener(\n \"pointermove\",\n evt => {\n evt.preventDefault();\n let { offsetX: x, offsetY: y } = evt;\n x = Math.round(x);\n y = Math.round(y);\n const drawPoints = this.#drawPoints;\n if (\n x < 0 ||\n y < 0 ||\n x > drawWidth ||\n y > drawHeight ||\n (x === drawPoints.at(-2) && y === drawPoints.at(-1))\n ) {\n return;\n }\n if (drawPoints.length >= 4) {\n const [x1, y1, x2, y2] = drawPoints.slice(-4);\n this.#drawPathString += `C${(x1 + 5 * x2) / 6} ${(y1 + 5 * y2) / 6} ${(5 * x2 + x) / 6} ${(5 * y2 + y) / 6} ${(x2 + x) / 2} ${(y2 + y) / 2}`;\n } else {\n this.#drawPathString += `L${x} ${y}`;\n }\n drawPoints.push(x, y);\n this.#drawPath.setAttribute(\"d\", this.#drawPathString);\n },\n listenerDrawOptions\n );\n this.#drawSVG.addEventListener(\n \"pointerup\",\n evt => {\n const { pointerId: pId } = evt;\n if (!isNaN(currentPointerId) && currentPointerId !== pId) {\n return;\n }\n currentPointerId = NaN;\n evt.preventDefault();\n this.#drawSVG.releasePointerCapture(pId);\n finishDrawAC.abort();\n if (this.#drawPoints.length === 2) {\n this.#drawPathString += `L${this.#drawPoints[0]} ${this.#drawPoints[1]}`;\n this.#drawPath.setAttribute(\"d\", this.#drawPathString);\n }\n },\n listenerDrawOptions\n );\n };\n if (this.#drawCurves) {\n this.#drawSVG.addEventListener(\"pointerdown\", drawCallback, options);\n } else {\n this.#drawPlaceholder.addEventListener(\n \"pointerdown\",\n drawCallback,\n options\n );\n }\n this.#drawThickness.addEventListener(\n \"input\",\n () => {\n const { value: thickness } = this.#drawThickness;\n this.#drawThickness.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({ thickness })\n );\n if (!this.#drawCurves) {\n return;\n }\n this.#drawPath.setAttribute(\"stroke-width\", thickness);\n this.#drawCurves.thickness = thickness;\n },\n options\n );\n }\n\n #showError(type) {\n this.#errorTitle.setAttribute(\n \"data-l10n-id\",\n SignatureManager.#l10nDescription[`error${type}Title`]\n );\n this.#errorDescription.setAttribute(\n \"data-l10n-id\",\n SignatureManager.#l10nDescription[`error${type}Description`]\n );\n this.#errorBar.hidden = false;\n }\n\n #initImageTab(reset) {\n if (reset) {\n this.#resetTab(\"image\");\n }\n\n this.#disableButtons(this.#imagePath);\n\n const { signal } = this.#currentTabAC;\n const options = { signal };\n const passiveOptions = { passive: true, signal };\n this.#imagePickerLink.addEventListener(\n \"keydown\",\n e => {\n const { key } = e;\n if (key === \"Enter\" || key === \" \") {\n stopEvent(e);\n this.#imagePicker.click();\n }\n },\n options\n );\n this.#imagePicker.addEventListener(\n \"click\",\n () => {\n this.#dialog.classList.toggle(\"waiting\", true);\n },\n passiveOptions\n );\n this.#imagePicker.addEventListener(\n \"change\",\n async () => {\n const file = this.#imagePicker.files?.[0];\n if (!file || !SupportedImageMimeTypes.includes(file.type)) {\n this.#showError(\"Upload\");\n this.#dialog.classList.toggle(\"waiting\", false);\n return;\n }\n await this.#extractSignature(file);\n },\n passiveOptions\n );\n this.#imagePicker.addEventListener(\n \"cancel\",\n () => {\n this.#dialog.classList.toggle(\"waiting\", false);\n },\n passiveOptions\n );\n this.#imagePlaceholder.addEventListener(\n \"dragover\",\n e => {\n const { dataTransfer } = e;\n for (const { type } of dataTransfer.items) {\n if (!SupportedImageMimeTypes.includes(type)) {\n continue;\n }\n dataTransfer.dropEffect =\n dataTransfer.effectAllowed === \"copy\" ? \"copy\" : \"move\";\n stopEvent(e);\n return;\n }\n dataTransfer.dropEffect = \"none\";\n },\n options\n );\n this.#imagePlaceholder.addEventListener(\n \"drop\",\n e => {\n const {\n dataTransfer: { files },\n } = e;\n if (!files?.length) {\n return;\n }\n for (const file of files) {\n if (SupportedImageMimeTypes.includes(file.type)) {\n this.#extractSignature(file);\n break;\n }\n }\n stopEvent(e);\n this.#dialog.classList.toggle(\"waiting\", true);\n },\n options\n );\n }\n\n async #extractSignature(file) {\n let data;\n try {\n data = await this.#uiManager.imageManager.getFromFile(file);\n } catch (e) {\n console.error(\"SignatureManager.#extractSignature.\", e);\n }\n if (!data) {\n this.#showError(\"Upload\");\n this.#dialog.classList.toggle(\"waiting\", false);\n return;\n }\n\n const lineData = (this.#extractedSignatureData =\n this.#currentEditor.getFromImage(data.bitmap));\n if (!lineData) {\n this.#showError(\"NoData\");\n this.#dialog.classList.toggle(\"waiting\", false);\n return;\n }\n const { outline } = lineData;\n\n this.#imagePlaceholder.hidden = true;\n this.#disableButtons(true);\n\n const svgFactory = new DOMSVGFactory();\n const path = (this.#imagePath = svgFactory.createElement(\"path\"));\n this.#imageSVG.setAttribute(\"viewBox\", outline.viewBox);\n this.#imageSVG.setAttribute(\"preserveAspectRatio\", \"xMidYMid meet\");\n this.#imageSVG.append(path);\n path.setAttribute(\"d\", outline.toSVGPath());\n this.#tabsToAltText.get(\"image\").default = file.name;\n if (this.#description.value === \"\") {\n this.#description.value = file.name || \"\";\n this.#clearDescription.disabled = this.#description.value === \"\";\n }\n\n this.#dialog.classList.toggle(\"waiting\", false);\n }\n\n #getOutlineForType() {\n return this.#currentEditor.getFromText(\n this.#typeInput.value,\n window.getComputedStyle(this.#typeInput)\n );\n }\n\n #getOutlineForDraw() {\n const { width, height } = this.#drawSVG.getBoundingClientRect();\n return this.#currentEditor.getDrawnSignature(\n this.#drawCurves,\n width,\n height\n );\n }\n\n #reportTelemetry(data) {\n this.#eventBus.dispatch(\"reporttelemetry\", {\n source: this,\n details: {\n type: \"editing\",\n data,\n },\n });\n }\n\n #addToolbarButton(signatureData, uuid, description) {\n const { curves, areContours, thickness, width, height } = signatureData;\n const maxDim = Math.max(width, height);\n const outlineData = SignatureExtractor.processDrawnLines({\n lines: {\n curves,\n thickness,\n width,\n height,\n },\n pageWidth: maxDim,\n pageHeight: maxDim,\n rotation: 0,\n innerMargin: 0,\n mustSmooth: false,\n areContours,\n });\n if (!outlineData) {\n return;\n }\n\n const { outline } = outlineData;\n const svgFactory = new DOMSVGFactory();\n\n const div = document.createElement(\"div\");\n const button = document.createElement(\"button\");\n\n button.addEventListener(\"click\", () => {\n this.#eventBus.dispatch(\"switchannotationeditorparams\", {\n source: this,\n type: AnnotationEditorParamsType.CREATE,\n value: {\n signatureData: {\n lines: {\n curves,\n thickness,\n width,\n height,\n },\n mustSmooth: false,\n areContours,\n description,\n uuid,\n heightInPage: DEFAULT_HEIGHT_IN_PAGE,\n },\n },\n });\n });\n div.append(button);\n div.classList.add(\"toolbarAddSignatureButtonContainer\");\n\n const svg = svgFactory.create(1, 1, true);\n button.append(svg);\n\n const span = document.createElement(\"span\");\n span.ariaHidden = true;\n button.append(span);\n\n button.classList.add(\"toolbarAddSignatureButton\");\n button.type = \"button\";\n span.textContent = description;\n button.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-add-saved-signature-button\"\n );\n button.setAttribute(\"data-l10n-args\", JSON.stringify({ description }));\n button.tabIndex = 0;\n\n const path = svgFactory.createElement(\"path\");\n svg.append(path);\n svg.setAttribute(\"viewBox\", outline.viewBox);\n svg.setAttribute(\"preserveAspectRatio\", \"xMidYMid meet\");\n if (areContours) {\n path.classList.add(\"contours\");\n }\n path.setAttribute(\"d\", outline.toSVGPath());\n\n const deleteButton = document.createElement(\"button\");\n div.append(deleteButton);\n deleteButton.classList.add(\"toolbarButton\", \"deleteButton\");\n deleteButton.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-delete-signature-button1\"\n );\n deleteButton.type = \"button\";\n deleteButton.tabIndex = 0;\n deleteButton.addEventListener(\"click\", async () => {\n if (await this.#signatureStorage.delete(uuid)) {\n div.remove();\n this.#reportTelemetry({\n type: \"signature\",\n action: \"pdfjs.signature.delete_saved\",\n data: {\n savedCount: await this.#signatureStorage.size(),\n },\n });\n }\n });\n const deleteSpan = document.createElement(\"span\");\n deleteButton.append(deleteSpan);\n deleteSpan.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-delete-signature-button-label1\"\n );\n\n this.#addSignatureToolbarButton.before(div);\n }\n\n async #signaturesChanged() {\n const parent = this.#addSignatureToolbarButton.parentElement;\n while (parent.firstElementChild !== this.#addSignatureToolbarButton) {\n parent.firstElementChild.remove();\n }\n this.#loadSignaturesPromise = null;\n await this.loadSignatures(/* reload = */ true);\n }\n\n getSignature(params) {\n return this.open(params);\n }\n\n async loadSignatures(reload = false) {\n if (\n !this.#addSignatureToolbarButton ||\n (!reload && this.#addSignatureToolbarButton.previousElementSibling) ||\n !this.#signatureStorage\n ) {\n return;\n }\n\n if (!this.#loadSignaturesPromise) {\n // The first call of loadSignatures() starts loading the signatures.\n // The second one will wait until the signatures are loaded in the DOM.\n this.#loadSignaturesPromise = this.#signatureStorage\n .getAll()\n .then(async signatures => [\n signatures,\n await Promise.all(\n Array.from(signatures.values(), ({ signatureData }) =>\n SignatureExtractor.decompressSignature(signatureData)\n )\n ),\n ]);\n if (!reload) {\n return;\n }\n }\n const [signatures, signaturesData] = await this.#loadSignaturesPromise;\n this.#loadSignaturesPromise = null;\n\n let i = 0;\n for (const [uuid, { description }] of signatures) {\n const data = signaturesData[i++];\n if (!data) {\n continue;\n }\n data.curves = data.outlines.map(points => ({ points }));\n delete data.outlines;\n this.#addToolbarButton(data, uuid, description);\n }\n }\n\n async renderEditButton(editor) {\n const button = document.createElement(\"button\");\n button.classList.add(\"altText\", \"editDescription\");\n button.tabIndex = 0;\n if (editor.description) {\n button.title = editor.description;\n }\n const span = document.createElement(\"span\");\n button.append(span);\n span.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-add-signature-edit-button-label\"\n );\n button.addEventListener(\n \"click\",\n () => {\n this.#editDescriptionDialog.open(editor);\n },\n { passive: true }\n );\n return button;\n }\n\n async open({ uiManager, editor }) {\n this.#tabsToAltText ||= new Map(\n this.#tabButtons.keys().map(name => [name, { value: \"\", default: \"\" }])\n );\n this.#uiManager = uiManager;\n this.#currentEditor = editor;\n this.#uiManager.removeEditListeners();\n\n const isStorageFull = (this.#isStorageFull =\n await this.#signatureStorage.isFull());\n this.#saveContainer.classList.toggle(\"fullStorage\", isStorageFull);\n this.#saveCheckbox.checked = !isStorageFull;\n\n await this.#overlayManager.open(this.#dialog);\n\n const tabType = this.#tabButtons.get(\"type\");\n tabType.focus();\n tabType.click();\n }\n\n #cancel() {\n this.#finish();\n }\n\n #finish() {\n this.#overlayManager.closeIfActive(this.#dialog);\n }\n\n #close() {\n if (this.#currentEditor._drawId === null) {\n this.#currentEditor.remove();\n }\n this.#uiManager?.addEditListeners();\n this.#currentTabAC?.abort();\n this.#currentTabAC = null;\n this.#uiManager = null;\n this.#currentEditor = null;\n\n this.#resetCommon();\n for (const [name] of this.#tabButtons) {\n this.#resetTab(name);\n }\n this.#disableButtons(false);\n this.#currentTab = null;\n this.#tabsToAltText = null;\n }\n\n async #add() {\n let data;\n const type = this.#currentTab;\n switch (type) {\n case \"type\":\n data = this.#getOutlineForType();\n break;\n case \"draw\":\n data = this.#getOutlineForDraw();\n break;\n case \"image\":\n data = this.#extractedSignatureData;\n break;\n }\n let uuid = null;\n const description = this.#description.value;\n if (this.#saveCheckbox.checked) {\n const { newCurves, areContours, thickness, width, height } = data;\n const signatureData = await SignatureExtractor.compressSignature({\n outlines: newCurves,\n areContours,\n thickness,\n width,\n height,\n });\n uuid = await this.#signatureStorage.create({\n description,\n signatureData,\n });\n if (uuid) {\n this.#addToolbarButton(\n {\n curves: newCurves.map(points => ({ points })),\n areContours,\n thickness,\n width,\n height,\n },\n uuid,\n description\n );\n } else {\n console.warn(\"SignatureManager.add: cannot save the signature.\");\n }\n }\n\n const altText = this.#tabsToAltText.get(type);\n this.#reportTelemetry({\n type: \"signature\",\n action: \"pdfjs.signature.created\",\n data: {\n type,\n saved: !!uuid,\n savedCount: await this.#signatureStorage.size(),\n descriptionChanged: description !== altText.default,\n },\n });\n\n this.#currentEditor.addSignature(\n data,\n DEFAULT_HEIGHT_IN_PAGE,\n this.#description.value,\n uuid\n );\n\n this.#finish();\n }\n\n destroy() {\n this.#uiManager = null;\n this.#finish();\n }\n}\n\nclass EditDescriptionDialog {\n #currentEditor;\n\n #previousDescription;\n\n #description;\n\n #dialog;\n\n #overlayManager;\n\n #signatureSVG;\n\n #uiManager;\n\n constructor(\n { dialog, description, cancelButton, updateButton, editSignatureView },\n overlayManager\n ) {\n const descriptionInput = (this.#description =\n description.firstElementChild);\n this.#signatureSVG = editSignatureView;\n this.#dialog = dialog;\n this.#overlayManager = overlayManager;\n\n dialog.addEventListener(\"close\", this.#close.bind(this));\n dialog.addEventListener(\"contextmenu\", e => {\n if (e.target !== this.#description) {\n e.preventDefault();\n }\n });\n cancelButton.addEventListener(\"click\", this.#cancel.bind(this));\n updateButton.addEventListener(\"click\", this.#update.bind(this));\n\n const clearDescription = description.lastElementChild;\n clearDescription.addEventListener(\"click\", () => {\n descriptionInput.value = \"\";\n clearDescription.disabled = true;\n updateButton.disabled = this.#previousDescription === \"\";\n });\n descriptionInput.addEventListener(\n \"input\",\n () => {\n const { value } = descriptionInput;\n clearDescription.disabled = value === \"\";\n updateButton.disabled = value === this.#previousDescription;\n editSignatureView.setAttribute(\"aria-label\", value);\n },\n { passive: true }\n );\n\n overlayManager.register(dialog);\n }\n\n async open(editor) {\n this.#uiManager = editor._uiManager;\n this.#currentEditor = editor;\n this.#previousDescription = this.#description.value = editor.description;\n this.#description.dispatchEvent(new Event(\"input\"));\n this.#uiManager.removeEditListeners();\n const { areContours, outline } = editor.getSignaturePreview();\n const svgFactory = new DOMSVGFactory();\n const path = svgFactory.createElement(\"path\");\n this.#signatureSVG.append(path);\n this.#signatureSVG.setAttribute(\"viewBox\", outline.viewBox);\n path.setAttribute(\"d\", outline.toSVGPath());\n if (areContours) {\n path.classList.add(\"contours\");\n }\n\n await this.#overlayManager.open(this.#dialog);\n }\n\n async #update() {\n // The description has been changed because the button isn't disabled.\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.signature.edit_description\",\n data: {\n hasBeenChanged: true,\n },\n });\n this.#currentEditor.description = this.#description.value;\n this.#finish();\n }\n\n #cancel() {\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.signature.edit_description\",\n data: {\n hasBeenChanged: false,\n },\n });\n this.#finish();\n }\n\n #finish() {\n this.#overlayManager.closeIfActive(this.#dialog);\n }\n\n #close() {\n this.#uiManager?.addEditListeners();\n this.#uiManager = null;\n this.#currentEditor = null;\n this.#signatureSVG.firstElementChild.remove();\n }\n}\n\nexport { SignatureManager };\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\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n\nimport { AnnotationEditorType, ColorPicker, noContextMenu } from \"pdfjs-lib\";\nimport {\n DEFAULT_SCALE,\n DEFAULT_SCALE_VALUE,\n MAX_SCALE,\n MIN_SCALE,\n toggleExpandedBtn,\n} from \"./ui_utils.js\";\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} editorFreeTextButton - Button to switch to\n * FreeText editing.\n * @property {HTMLButtonElement} download - Button to download the document.\n */\n\nclass Toolbar {\n #colorPicker = null;\n\n #opts;\n\n /**\n * @param {ToolbarOptions} options\n * @param {EventBus} eventBus\n * @param {number} toolbarDensity - The toolbar density value.\n * The possible values are:\n * - 0 (default) - The regular toolbar size.\n * - 1 (compact) - The small toolbar size.\n * - 2 (touch) - The large toolbar size.\n */\n constructor(options, eventBus, toolbarDensity = 0) {\n this.#opts = options;\n this.eventBus = eventBus;\n const 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.editorCommentButton,\n eventName: \"switchannotationeditormode\",\n eventDetails: {\n get mode() {\n const { classList } = options.editorCommentButton;\n return classList.contains(\"toggled\")\n ? AnnotationEditorType.NONE\n : AnnotationEditorType.POPUP;\n },\n },\n },\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.editorHighlightButton,\n eventName: \"switchannotationeditormode\",\n eventDetails: {\n get mode() {\n const { classList } = options.editorHighlightButton;\n return classList.contains(\"toggled\")\n ? AnnotationEditorType.NONE\n : AnnotationEditorType.HIGHLIGHT;\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 element: options.editorStampButton,\n eventName: \"switchannotationeditormode\",\n eventDetails: {\n get mode() {\n const { classList } = options.editorStampButton;\n return classList.contains(\"toggled\")\n ? AnnotationEditorType.NONE\n : AnnotationEditorType.STAMP;\n },\n },\n telemetry: {\n type: \"editing\",\n data: { action: \"pdfjs.image.icon_click\" },\n },\n },\n {\n element: options.editorSignatureButton,\n eventName: \"switchannotationeditormode\",\n eventDetails: {\n get mode() {\n const { classList } = options.editorSignatureButton;\n return classList.contains(\"toggled\")\n ? AnnotationEditorType.NONE\n : AnnotationEditorType.SIGNATURE;\n },\n },\n },\n ];\n\n // Bind the event listeners for click and various other actions.\n this.#bindListeners(buttons);\n\n this.#updateToolbarDensity({ value: toolbarDensity });\n this.reset();\n }\n\n #updateToolbarDensity({ value }) {\n let name = \"normal\";\n switch (value) {\n case 1:\n name = \"compact\";\n break;\n case 2:\n name = \"touch\";\n break;\n }\n document.documentElement.setAttribute(\"data-toolbar-density\", name);\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.#colorPicker = null;\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.#editorModeChanged({ mode: AnnotationEditorType.DISABLE });\n }\n\n #bindListeners(buttons) {\n const { eventBus } = this;\n const {\n editorHighlightColorPicker,\n editorHighlightButton,\n pageNumber,\n scaleSelect,\n } = this.#opts;\n const self = this;\n\n // The buttons within the toolbar.\n for (const { element, eventName, eventDetails, telemetry } of buttons) {\n element.addEventListener(\"click\", evt => {\n if (eventName !== null) {\n eventBus.dispatch(eventName, {\n source: this,\n ...eventDetails,\n // evt.detail is the number of clicks.\n isFromKeyboard: evt.detail === 0,\n });\n }\n if (telemetry) {\n eventBus.dispatch(\"reporttelemetry\", {\n source: this,\n details: telemetry,\n });\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 eventBus.dispatch(\"pagenumberchanged\", {\n source: self,\n value: this.value,\n });\n });\n eventBus._on(\"pagesedited\", ({ pagesMapper }) => {\n const pagesCount = pagesMapper.pagesNumber;\n if (pagesCount !== this.pagesCount) {\n this.setPagesCount(pagesCount, this.hasPageLabels);\n }\n });\n\n scaleSelect.addEventListener(\"change\", function () {\n if (this.value === \"custom\") {\n return;\n }\n 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 ({ 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 = noContextMenu;\n\n eventBus._on(\n \"annotationeditormodechanged\",\n this.#editorModeChanged.bind(this)\n );\n eventBus._on(\"showannotationeditorui\", ({ mode }) => {\n switch (mode) {\n case AnnotationEditorType.HIGHLIGHT:\n editorHighlightButton.click();\n break;\n }\n });\n eventBus._on(\"toolbardensity\", this.#updateToolbarDensity.bind(this));\n\n if (editorHighlightColorPicker) {\n eventBus._on(\"annotationeditoruimanager\", ({ uiManager }) => {\n const cp = (this.#colorPicker = new ColorPicker({ uiManager }));\n uiManager.setMainHighlightColorPicker(cp);\n editorHighlightColorPicker.append(cp.renderMainDropdown());\n });\n\n eventBus._on(\"mainhighlightcolorpickerupdatecolor\", ({ value }) => {\n this.#colorPicker?.updateColor(value);\n });\n }\n }\n\n #editorModeChanged({ mode }) {\n const {\n editorCommentButton,\n editorCommentParamsToolbar,\n editorFreeTextButton,\n editorFreeTextParamsToolbar,\n editorHighlightButton,\n editorHighlightParamsToolbar,\n editorInkButton,\n editorInkParamsToolbar,\n editorStampButton,\n editorStampParamsToolbar,\n editorSignatureButton,\n editorSignatureParamsToolbar,\n } = this.#opts;\n\n toggleExpandedBtn(\n editorCommentButton,\n mode === AnnotationEditorType.POPUP,\n editorCommentParamsToolbar\n );\n toggleExpandedBtn(\n editorFreeTextButton,\n mode === AnnotationEditorType.FREETEXT,\n editorFreeTextParamsToolbar\n );\n toggleExpandedBtn(\n editorHighlightButton,\n mode === AnnotationEditorType.HIGHLIGHT,\n editorHighlightParamsToolbar\n );\n toggleExpandedBtn(\n editorInkButton,\n mode === AnnotationEditorType.INK,\n editorInkParamsToolbar\n );\n toggleExpandedBtn(\n editorStampButton,\n mode === AnnotationEditorType.STAMP,\n editorStampParamsToolbar\n );\n toggleExpandedBtn(\n editorSignatureButton,\n mode === AnnotationEditorType.SIGNATURE,\n editorSignatureParamsToolbar\n );\n\n editorCommentButton.disabled =\n editorFreeTextButton.disabled =\n editorHighlightButton.disabled =\n editorInkButton.disabled =\n editorStampButton.disabled =\n editorSignatureButton.disabled =\n mode === AnnotationEditorType.DISABLE;\n }\n\n #updateUIState(resetNumPages = false) {\n const { pageNumber, pagesCount, pageScaleValue, pageScale } = this;\n const opts = this.#opts;\n\n if (resetNumPages) {\n if (this.hasPageLabels) {\n opts.pageNumber.type = \"text\";\n\n opts.numPages.setAttribute(\"data-l10n-id\", \"pdfjs-page-of-pages\");\n } else {\n opts.pageNumber.type = \"number\";\n\n opts.numPages.setAttribute(\"data-l10n-id\", \"pdfjs-of-pages\");\n opts.numPages.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({ pagesCount })\n );\n }\n opts.pageNumber.max = pagesCount;\n }\n\n if (this.hasPageLabels) {\n opts.pageNumber.value = this.pageLabel;\n\n opts.numPages.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({ pageNumber, pagesCount })\n );\n } else {\n opts.pageNumber.value = pageNumber;\n }\n\n opts.previous.disabled = pageNumber <= 1;\n opts.next.disabled = pageNumber >= pagesCount;\n\n opts.zoomOut.disabled = pageScale <= MIN_SCALE;\n opts.zoomIn.disabled = pageScale >= MAX_SCALE;\n\n let predefinedValueFound = false;\n for (const option of opts.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 opts.customScaleOption.selected = true;\n opts.customScaleOption.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({\n scale: Math.round(pageScale * 10000) / 100,\n })\n );\n }\n }\n\n updateLoadingIndicatorState(loading = false) {\n const { pageNumber } = this.#opts;\n pageNumber.classList.toggle(\"loading\", loading);\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 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\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n\nimport {\n docStyle,\n PresentationModeState,\n SidebarView,\n toggleExpandedBtn,\n toggleSelectedBtn,\n} from \"./ui_utils.js\";\nimport { Menu } from \"./menu.js\";\nimport { Sidebar } from \"./sidebar.js\";\n\nconst SIDEBAR_WIDTH_VAR = \"--viewsManager-width\";\nconst SIDEBAR_RESIZING_CLASS = \"viewsManagerResizing\";\nconst UI_NOTIFICATION_CLASS = \"pdfSidebarNotification\";\n\n/**\n * @typedef {Object} PDFSidebarOptions\n * @property {PDFSidebarElements} elements - The DOM elements.\n * @property {EventBus} eventBus - The application event bus.\n * @property {L10n} 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 {HTMLDivElement} resizer - The DOM element that can be dragged in\n * order to adjust the width of 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 {HTMLButtonElement} currentOutlineItemButton - The button used to\n * find the current outline item.\n */\n\nclass ViewsManager extends Sidebar {\n static #l10nDescription = null;\n\n #hasAnimations = !window.matchMedia(\"(prefers-reduced-motion: reduce)\")\n .matches;\n\n /**\n * @param {PDFSidebarOptions} options\n */\n constructor({\n elements: {\n outerContainer,\n sidebarContainer,\n toggleButton,\n resizer,\n thumbnailButton,\n outlineButton,\n attachmentsButton,\n layersButton,\n thumbnailsView,\n outlinesView,\n attachmentsView,\n layersView,\n viewsManagerAddFileButton,\n viewsManagerCurrentOutlineButton,\n viewsManagerSelectorButton,\n viewsManagerSelectorOptions,\n viewsManagerHeaderLabel,\n viewsManagerStatus,\n },\n eventBus,\n l10n,\n }) {\n super(\n {\n sidebar: sidebarContainer,\n resizer,\n toggleButton,\n },\n l10n.getDirection() === \"ltr\",\n /* isResizerOnTheLeft = */ false\n );\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 this.onUpdateThumbnails = null;\n\n this.outerContainer = outerContainer;\n this.sidebarContainer = sidebarContainer;\n this.toggleButton = toggleButton;\n this.resizer = resizer;\n\n this.thumbnailButton = thumbnailButton;\n this.outlineButton = outlineButton;\n this.attachmentsButton = attachmentsButton;\n this.layersButton = layersButton;\n\n this.thumbnailsView = thumbnailsView;\n this.outlinesView = outlinesView;\n this.attachmentsView = attachmentsView;\n this.layersView = layersView;\n\n this.viewsManagerAddFileButton = viewsManagerAddFileButton;\n this.viewsManagerCurrentOutlineButton = viewsManagerCurrentOutlineButton;\n this.viewsManagerHeaderLabel = viewsManagerHeaderLabel;\n this.viewsManagerStatus = viewsManagerStatus;\n\n this.eventBus = eventBus;\n\n this.menu = new Menu(\n viewsManagerSelectorOptions,\n viewsManagerSelectorButton,\n [thumbnailButton, outlineButton, attachmentsButton, layersButton]\n );\n\n ViewsManager.#l10nDescription ||= Object.freeze({\n pagesTitle: \"pdfjs-views-manager-pages-title\",\n outlinesTitle: \"pdfjs-views-manager-outlines-title\",\n attachmentsTitle: \"pdfjs-views-manager-attachments-title\",\n layersTitle: \"pdfjs-views-manager-layers-title\",\n notificationButton: \"pdfjs-toggle-views-manager-notification-button\",\n toggleButton: \"pdfjs-toggle-views-manager-button\",\n });\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 =\n this.attachmentsButton.disabled =\n this.layersButton.disabled =\n false;\n this.viewsManagerCurrentOutlineButton.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 forceRendering = false;\n let titleL10nId = null;\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 titleL10nId = \"pagesTitle\";\n if (this.isOpen && isViewChanged) {\n forceRendering = true;\n }\n break;\n case SidebarView.OUTLINE:\n titleL10nId = \"outlinesTitle\";\n if (this.outlineButton.disabled) {\n return;\n }\n break;\n case SidebarView.ATTACHMENTS:\n titleL10nId = \"attachmentsTitle\";\n if (this.attachmentsButton.disabled) {\n return;\n }\n break;\n case SidebarView.LAYERS:\n titleL10nId = \"layersTitle\";\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\n this.viewsManagerStatus.hidden = view !== SidebarView.THUMBS;\n this.viewsManagerAddFileButton.hidden = view !== SidebarView.THUMBS;\n this.viewsManagerCurrentOutlineButton.hidden = view !== SidebarView.OUTLINE;\n this.viewsManagerHeaderLabel.setAttribute(\n \"data-l10n-id\",\n ViewsManager.#l10nDescription[titleL10nId] || \"\"\n );\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 // Update the CSS classes (and aria attributes), for all buttons and views.\n toggleSelectedBtn(\n this.thumbnailButton,\n view === SidebarView.THUMBS,\n this.thumbnailsView\n );\n toggleSelectedBtn(\n this.outlineButton,\n view === SidebarView.OUTLINE,\n this.outlinesView\n );\n toggleSelectedBtn(\n this.attachmentsButton,\n view === SidebarView.ATTACHMENTS,\n this.attachmentsView\n );\n toggleSelectedBtn(\n this.layersButton,\n view === SidebarView.LAYERS,\n this.layersView\n );\n\n if (forceOpen && !this.isOpen) {\n this.open();\n return; // Opening will trigger rendering and dispatch the event.\n }\n if (forceRendering) {\n this.onUpdateThumbnails();\n this.onToggled();\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.onResizing(this.width);\n this._sidebar.hidden = false;\n toggleExpandedBtn(this.toggleButton, true);\n this.switchView(this.active);\n\n if (this.#hasAnimations) {\n // Changing `hidden` above may cause a reflow which would prevent the\n // CSS transition from being applied correctly, so we need to delay\n // adding the relevant CSS classes.\n queueMicrotask(() => {\n this.outerContainer.classList.add(\n \"viewsManagerMoving\",\n \"viewsManagerOpen\"\n );\n });\n } else {\n this.outerContainer.classList.add(\"viewsManagerOpen\");\n this.eventBus.dispatch(\"resize\", { source: this });\n }\n if (this.active === SidebarView.THUMBS) {\n this.onUpdateThumbnails();\n }\n this.onToggled();\n this.#dispatchEvent();\n\n this.#hideUINotification();\n }\n\n close(evt = null) {\n if (!this.isOpen) {\n return;\n }\n this.isOpen = false;\n this._sidebar.hidden = true;\n toggleExpandedBtn(this.toggleButton, false);\n\n this.outerContainer.classList.add(\"viewsManagerMoving\");\n this.outerContainer.classList.remove(\"viewsManagerOpen\");\n\n this.onToggled();\n this.#dispatchEvent();\n\n if (evt?.detail > 0) {\n // Remove focus from the toggleButton if it's clicked (see issue 17361).\n this.toggleButton.blur();\n }\n }\n\n toggle(evt = null) {\n super.toggle();\n if (this.isOpen) {\n this.close(evt);\n } else {\n this.open();\n }\n }\n\n #dispatchEvent() {\n if (this.isInitialViewSet) {\n this.isInitialEventDispatched ||= true;\n }\n\n this.eventBus.dispatch(\"sidebarviewchanged\", {\n source: this,\n view: this.visibleView,\n });\n }\n\n #showUINotification() {\n this.toggleButton.setAttribute(\n \"data-l10n-id\",\n ViewsManager.#l10nDescription.notificationButton\n );\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(\n \"data-l10n-id\",\n ViewsManager.#l10nDescription.toggleButton\n );\n }\n }\n\n #addEventListeners() {\n const { eventBus, outerContainer } = this;\n\n if (this.#hasAnimations) {\n this.sidebarContainer.addEventListener(\"transitionend\", evt => {\n if (evt.target === this.sidebarContainer) {\n outerContainer.classList.remove(\"viewsManagerMoving\");\n // Ensure that rendering is triggered after opening/closing the\n // sidebar.\n eventBus.dispatch(\"resize\", { source: this });\n }\n });\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 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 eventBus.dispatch(\"resetlayers\", { source: this });\n });\n\n // Buttons for view-specific options.\n this.viewsManagerCurrentOutlineButton.addEventListener(\"click\", () => {\n 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 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.viewsManagerCurrentOutlineButton.disabled = !enabled;\n });\n });\n\n eventBus._on(\"attachmentsloaded\", evt => {\n onTreeLoaded(\n evt.attachmentsCount,\n this.attachmentsButton,\n SidebarView.ATTACHMENTS\n );\n });\n\n 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 eventBus._on(\"presentationmodechanged\", evt => {\n if (\n evt.state === PresentationModeState.NORMAL &&\n this.visibleView === SidebarView.THUMBS\n ) {\n this.onUpdateThumbnails();\n }\n });\n }\n\n onStartResizing() {\n this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);\n }\n\n onStopResizing() {\n this.eventBus.dispatch(\"resize\", { source: this });\n this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);\n }\n\n onResizing(newWidth) {\n docStyle.setProperty(SIDEBAR_WIDTH_VAR, `${newWidth}px`);\n }\n}\n\nexport { ViewsManager };\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/api.js\").PDFDocumentProxy} PDFDocumentProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/api.js\").PDFDocumentLoadingTask} PDFDocumentLoadingTask */\n\nimport {\n animationStarted,\n apiPageLayoutToViewerModes,\n apiPageModeToSidebarView,\n AutoPrintRegExp,\n CursorTool,\n DEFAULT_SCALE_VALUE,\n docStyle,\n getActiveOrFocusedElement,\n isValidRotation,\n isValidScrollMode,\n isValidSpreadMode,\n normalizeWheelEventDirection,\n parseQueryString,\n ProgressBar,\n ScrollMode,\n SidebarView,\n SpreadMode,\n TextLayerMode,\n} from \"./ui_utils.js\";\nimport {\n AnnotationEditorType,\n build,\n FeatureTest,\n getDocument,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n GlobalWorkerOptions,\n InvalidPDFException,\n isDataScheme,\n isPdfFile,\n OutputScale,\n PDFWorker,\n ResponseException,\n shadow,\n stopEvent,\n TouchManager,\n updateUrlHash,\n version,\n} from \"pdfjs-lib\";\nimport { AppOptions, OptionKind } from \"./app_options.js\";\nimport { EventBus, FirefoxEventBus } from \"./event_utils.js\";\nimport { ExternalServices, initCom, MLManager } from \"web-external_services\";\nimport {\n ImageAltTextSettings,\n NewAltTextManager,\n} from \"web-new_alt_text_manager\";\nimport { LinkTarget, PDFLinkService } from \"./pdf_link_service.js\";\nimport { AltTextManager } from \"web-alt_text_manager\";\nimport { AnnotationEditorParams } from \"web-annotation_editor_params\";\nimport { CaretBrowsingMode } from \"./caret_browsing.js\";\nimport { CommentManager } from \"./comment_manager.js\";\nimport { DownloadManager } from \"web-download_manager\";\nimport { EditorUndoBar } from \"./editor_undo_bar.js\";\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 { PDFPrintServiceFactory } from \"web-print_service\";\nimport { PDFRenderingQueue } from \"./pdf_rendering_queue.js\";\nimport { PDFScriptingManager } from \"./pdf_scripting_manager.js\";\nimport { PdfTextExtractor } from \"./pdf_text_extractor.js\";\nimport { PDFThumbnailViewer } from \"web-pdf_thumbnail_viewer\";\nimport { PDFViewer } from \"./pdf_viewer.js\";\nimport { Preferences } from \"web-preferences\";\nimport { RenderingStates } from \"./renderable_view.js\";\nimport { SecondaryToolbar } from \"web-secondary_toolbar\";\nimport { SignatureManager } from \"web-signature_manager\";\nimport { Toolbar } from \"web-toolbar\";\nimport { ViewHistory } from \"./view_history.js\";\nimport { ViewsManager } from \"web-views_manager\";\n\nconst FORCE_PAGES_LOADED_TIMEOUT = 10000; // ms\n\nconst ViewOnLoad = {\n UNKNOWN: -1,\n PREVIOUS: 0, // Default value.\n INITIAL: 1,\n};\n\nconst PDFViewerApplication = {\n initialBookmark: document.location.hash.substring(1),\n _initializedCapability: {\n ...Promise.withResolvers(),\n settled: false,\n },\n appConfig: null,\n /** @type {PDFDocumentProxy} */\n pdfDocument: null,\n /** @type {PDFDocumentLoadingTask} */\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 {PdfTextExtractor|null} */\n pdfTextExtractor: null,\n /** @type {PDFHistory} */\n pdfHistory: null,\n /** @type {ViewsManager} */\n viewsManager: 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: new Preferences(),\n /** @type {Toolbar} */\n toolbar: null,\n /** @type {SecondaryToolbar} */\n secondaryToolbar: null,\n /** @type {EventBus} */\n eventBus: null,\n /** @type {L10n} */\n l10n: null,\n /** @type {AnnotationEditorParams} */\n annotationEditorParams: null,\n /** @type {ImageAltTextSettings} */\n imageAltTextSettings: null,\n isInitialViewSet: false,\n isViewerEmbedded: window.parent !== window,\n url: \"\",\n baseUrl: \"\",\n mlManager: null,\n _downloadUrl: \"\",\n _eventBusAbortController: null,\n _windowAbortController: null,\n _globalAbortController: new AbortController(),\n documentInfo: null,\n metadata: null,\n _contentDispositionFilename: null,\n _contentLength: null,\n _saveInProgress: false,\n _wheelUnusedTicks: 0,\n _wheelUnusedFactor: 1,\n _touchManager: null,\n _touchUnusedTicks: 0,\n _touchUnusedFactor: 1,\n _PDFBug: null,\n _hasAnnotationEditors: false,\n _title: document.title,\n _printAnnotationStoragePromise: null,\n _isCtrlKeyDown: false,\n _caretBrowsing: null,\n _isScrolling: false,\n editorUndoBar: null,\n _printPermissionPromise: null,\n\n // Called once when the document is loaded.\n async initialize(appConfig) {\n this.appConfig = appConfig;\n\n // Ensure that `Preferences`, and indirectly `AppOptions`, have initialized\n // before creating e.g. the various viewer components.\n try {\n await this.preferences.initializedPromise;\n } catch (ex) {\n console.error(\"initialize:\", ex);\n }\n if (AppOptions.get(\"pdfBugEnabled\")) {\n await this._parseHashParams();\n }\n\n let mode;\n switch (AppOptions.get(\"viewerCssTheme\")) {\n case 1:\n mode = \"light\";\n break;\n case 2:\n mode = \"dark\";\n break;\n }\n if (mode) {\n docStyle.setProperty(\"color-scheme\", mode);\n }\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n if (AppOptions.get(\"enableFakeMLManager\")) {\n this.mlManager =\n MLManager.getFakeMLManager?.({\n enableGuessAltText: AppOptions.get(\"enableGuessAltText\"),\n enableAltTextModelDownload: AppOptions.get(\n \"enableAltTextModelDownload\"\n ),\n }) || null;\n }\n } else if (PDFJSDev.test(\"MOZCENTRAL\")) {\n if (AppOptions.get(\"enableAltText\")) {\n // We want to load the image-to-text AI engine as soon as possible.\n this.mlManager = new MLManager({\n enableGuessAltText: AppOptions.get(\"enableGuessAltText\"),\n enableAltTextModelDownload: AppOptions.get(\n \"enableAltTextModelDownload\"\n ),\n altTextLearnMoreUrl: AppOptions.get(\"altTextLearnMoreUrl\"),\n });\n }\n }\n\n // Ensure that the `L10n`-instance has been initialized before creating\n // e.g. the various viewer components.\n this.l10n = await this.externalServices.createL10n();\n document.getElementsByTagName(\"html\")[0].dir = this.l10n.getDirection();\n // Connect Fluent, when necessary, and translate what we already have.\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n this.l10n.translate(appConfig.appContainer || document.documentElement);\n }\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 this.pdfTextExtractor = new PdfTextExtractor(this.externalServices);\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 this._initializedCapability.settled = true;\n this._initializedCapability.resolve();\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 const loadPDFBug = async () => {\n if (this._PDFBug) {\n return;\n }\n const { PDFBug } =\n typeof PDFJSDev === \"undefined\"\n ? await import(AppOptions.get(\"debuggerSrc\")) // eslint-disable-line no-unsanitized/method\n : await __raw_import__(AppOptions.get(\"debuggerSrc\"));\n\n this._PDFBug = PDFBug;\n };\n\n // Parameters that need to be handled manually.\n if (params.get(\"disableworker\") === \"true\") {\n try {\n GlobalWorkerOptions.workerSrc ||= AppOptions.get(\"workerSrc\");\n\n typeof PDFJSDev === \"undefined\" // eslint-disable-line no-unused-expressions\n ? await import(\"pdfjs/pdf.worker.js\")\n : await __raw_import__(PDFWorker.workerSrc);\n\n // Ensure that the \"fake\" worker won't be ignored.\n AppOptions.set(\"workerPort\", null);\n } catch (ex) {\n console.error(\"_parseHashParams:\", ex);\n }\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();\n this._PDFBug.loadCSS();\n } catch (ex) {\n console.error(\"_parseHashParams:\", ex);\n }\n break;\n }\n }\n if (params.has(\"pdfbug\")) {\n const enabled = params.get(\"pdfbug\").split(\",\");\n try {\n await loadPDFBug();\n this._PDFBug.init(mainContainer, enabled);\n } catch (ex) {\n console.error(\"_parseHashParams:\", ex);\n }\n\n const debugOpts = { pdfBug: true, fontExtraProperties: true };\n if (globalThis.StepperManager?.enabled) {\n debugOpts.minDurationToUpdateCanvas = 0;\n }\n AppOptions.setAll(debugOpts);\n }\n // It is not possible to change locale for the (various) extension builds.\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n params.has(\"locale\")\n ) {\n AppOptions.set(\"localeProperties\", { lang: params.get(\"locale\") });\n }\n\n // Parameters that can be handled automatically.\n const opts = {\n disableAutoFetch: x => x === \"true\",\n disableFontFace: x => x === \"true\",\n disableHistory: x => x === \"true\",\n disableRange: x => x === \"true\",\n disableStream: x => x === \"true\",\n verbosity: x => x | 0,\n };\n\n // Set some specific preferences for tests.\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n Object.assign(opts, {\n capCanvasAreaFactor: x => parseInt(x),\n docBaseUrl: x => x,\n enableAltText: x => x === \"true\",\n enableAutoLinking: x => x === \"true\",\n enableComment: x => x === \"true\",\n enableFakeMLManager: x => x === \"true\",\n enableGuessAltText: x => x === \"true\",\n enablePermissions: x => x === \"true\",\n enableSplitMerge: x => x === \"true\",\n enableUpdatedAddImage: x => x === \"true\",\n highlightEditorColors: x => x,\n maxCanvasPixels: x => parseInt(x),\n spreadModeOnLoad: x => parseInt(x),\n supportsCaretBrowsingMode: x => x === \"true\",\n viewerCssTheme: x => parseInt(x),\n forcePageColors: x => x === \"true\",\n pageColorsBackground: x => x,\n pageColorsForeground: x => x,\n sidebarViewOnLoad: x => parseInt(x),\n });\n }\n\n for (const name in opts) {\n const check = opts[name],\n key = name.toLowerCase();\n\n if (params.has(key)) {\n AppOptions.set(name, check(params.get(key)));\n }\n }\n },\n\n /**\n * @private\n */\n async _initializeViewerComponents() {\n const { appConfig, externalServices, l10n, mlManager } = this;\n const abortSignal = this._globalAbortController.signal;\n\n const eventBus =\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n ? new FirefoxEventBus(\n AppOptions.get(\"allowedGlobalEvents\"),\n externalServices,\n AppOptions.get(\"isInAutomation\")\n )\n : new EventBus();\n this.eventBus = AppOptions.eventBus = eventBus;\n\n mlManager?.setEventBus(eventBus, abortSignal);\n\n const overlayManager = (this.overlayManager = new OverlayManager());\n\n const renderingQueue = (this.pdfRenderingQueue = new PDFRenderingQueue());\n renderingQueue.onIdle = this._cleanup.bind(this);\n\n const linkService = (this.pdfLinkService = new PDFLinkService({\n eventBus,\n externalLinkTarget: AppOptions.get(\"externalLinkTarget\"),\n externalLinkRel: AppOptions.get(\"externalLinkRel\"),\n ignoreDestinationZoom: AppOptions.get(\"ignoreDestinationZoom\"),\n }));\n\n const downloadManager = (this.downloadManager = new DownloadManager());\n\n const findController = (this.findController = new PDFFindController({\n linkService,\n eventBus,\n updateMatchesCountOnProgress:\n typeof PDFJSDev === \"undefined\"\n ? !window.isGECKOVIEW\n : !PDFJSDev.test(\"GECKOVIEW\"),\n }));\n\n const pdfScriptingManager = (this.pdfScriptingManager =\n new PDFScriptingManager({\n eventBus,\n externalServices,\n docProperties: this._scriptingDocProperties.bind(this),\n }));\n\n const container = appConfig.mainContainer,\n viewer = appConfig.viewerContainer;\n const annotationEditorMode = AppOptions.get(\"annotationEditorMode\");\n const hasForcedColors =\n AppOptions.get(\"forcePageColors\") ||\n window.matchMedia(\"(forced-colors: active)\").matches;\n const pageColors = hasForcedColors\n ? {\n background: AppOptions.get(\"pageColorsBackground\"),\n foreground: AppOptions.get(\"pageColorsForeground\"),\n }\n : null;\n\n let altTextManager;\n if (AppOptions.get(\"enableUpdatedAddImage\")) {\n altTextManager = appConfig.newAltTextDialog\n ? new NewAltTextManager(\n appConfig.newAltTextDialog,\n overlayManager,\n eventBus\n )\n : null;\n } else {\n altTextManager = appConfig.altTextDialog\n ? new AltTextManager(\n appConfig.altTextDialog,\n container,\n overlayManager,\n eventBus\n )\n : null;\n }\n\n if (appConfig.editorUndoBar) {\n this.editorUndoBar = new EditorUndoBar(appConfig.editorUndoBar, eventBus);\n }\n\n const signatureManager =\n AppOptions.get(\"enableSignatureEditor\") && appConfig.addSignatureDialog\n ? new SignatureManager(\n appConfig.addSignatureDialog,\n appConfig.editSignatureDialog,\n appConfig.annotationEditorParams?.editorSignatureAddSignature ||\n null,\n overlayManager,\n l10n,\n externalServices.createSignatureStorage(eventBus, abortSignal),\n eventBus\n )\n : null;\n\n const ltr = appConfig.viewerContainer\n ? getComputedStyle(appConfig.viewerContainer).direction === \"ltr\"\n : true;\n const commentManager =\n AppOptions.get(\"enableComment\") && appConfig.editCommentDialog\n ? new CommentManager(\n appConfig.editCommentDialog,\n {\n learnMoreUrl: AppOptions.get(\"commentLearnMoreUrl\"),\n sidebar:\n appConfig.annotationEditorParams?.editorCommentsSidebar || null,\n sidebarResizer:\n appConfig.annotationEditorParams\n ?.editorCommentsSidebarResizer || null,\n commentsList:\n appConfig.annotationEditorParams?.editorCommentsSidebarList ||\n null,\n commentCount:\n appConfig.annotationEditorParams?.editorCommentsSidebarCount ||\n null,\n sidebarTitle:\n appConfig.annotationEditorParams?.editorCommentsSidebarTitle ||\n null,\n closeButton:\n appConfig.annotationEditorParams\n ?.editorCommentsSidebarCloseButton || null,\n commentToolbarButton:\n appConfig.toolbar?.editorCommentButton || null,\n },\n eventBus,\n linkService,\n overlayManager,\n ltr,\n hasForcedColors\n )\n : null;\n\n const enableHWA = AppOptions.get(\"enableHWA\"),\n maxCanvasPixels = AppOptions.get(\"maxCanvasPixels\"),\n maxCanvasDim = AppOptions.get(\"maxCanvasDim\"),\n capCanvasAreaFactor = AppOptions.get(\"capCanvasAreaFactor\");\n const pdfViewer = (this.pdfViewer = new PDFViewer({\n container,\n viewer,\n viewerAlert: appConfig.viewerAlert,\n eventBus,\n renderingQueue,\n linkService,\n downloadManager,\n altTextManager,\n commentManager,\n signatureManager,\n editorUndoBar: this.editorUndoBar,\n findController,\n scriptingManager:\n AppOptions.get(\"enableScripting\") && pdfScriptingManager,\n l10n,\n textLayerMode: AppOptions.get(\"textLayerMode\"),\n annotationMode: AppOptions.get(\"annotationMode\"),\n annotationEditorMode,\n annotationEditorHighlightColors: AppOptions.get(\"highlightEditorColors\"),\n enableHighlightFloatingButton: AppOptions.get(\n \"enableHighlightFloatingButton\"\n ),\n enableUpdatedAddImage: AppOptions.get(\"enableUpdatedAddImage\"),\n enableNewAltTextWhenAddingImage: AppOptions.get(\n \"enableNewAltTextWhenAddingImage\"\n ),\n imageResourcesPath: AppOptions.get(\"imageResourcesPath\"),\n enablePrintAutoRotate: AppOptions.get(\"enablePrintAutoRotate\"),\n maxCanvasPixels,\n maxCanvasDim,\n capCanvasAreaFactor,\n enableDetailCanvas: AppOptions.get(\"enableDetailCanvas\"),\n enablePermissions: AppOptions.get(\"enablePermissions\"),\n enableOptimizedPartialRendering: AppOptions.get(\n \"enableOptimizedPartialRendering\"\n ),\n pageColors,\n mlManager,\n abortSignal,\n enableHWA,\n supportsPinchToZoom: this.supportsPinchToZoom,\n enableAutoLinking: AppOptions.get(\"enableAutoLinking\"),\n minDurationToUpdateCanvas: AppOptions.get(\"minDurationToUpdateCanvas\"),\n }));\n\n renderingQueue.setViewer(pdfViewer);\n linkService.setViewer(pdfViewer);\n pdfScriptingManager.setViewer(pdfViewer);\n\n if (appConfig.viewsManager?.thumbnailsView) {\n this.pdfThumbnailViewer = new PDFThumbnailViewer({\n container: appConfig.viewsManager.thumbnailsView,\n eventBus,\n renderingQueue,\n linkService,\n maxCanvasPixels,\n maxCanvasDim,\n pageColors,\n abortSignal,\n enableHWA,\n enableSplitMerge: AppOptions.get(\"enableSplitMerge\"),\n manageMenu: appConfig.viewsManager.manageMenu,\n addFileButton: appConfig.viewsManager.viewsManagerAddFileButton,\n });\n renderingQueue.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,\n eventBus,\n });\n linkService.setHistory(this.pdfHistory);\n }\n\n if (!this.supportsIntegratedFind && appConfig.findBar) {\n this.findBar = new PDFFindBar(\n appConfig.findBar,\n appConfig.principalContainer,\n eventBus\n );\n }\n\n if (appConfig.annotationEditorParams) {\n if (annotationEditorMode !== AnnotationEditorType.DISABLE) {\n const editorSignatureButton = appConfig.toolbar?.editorSignatureButton;\n if (editorSignatureButton && AppOptions.get(\"enableSignatureEditor\")) {\n editorSignatureButton.parentElement.hidden = false;\n }\n const editorCommentButton = appConfig.toolbar?.editorCommentButton;\n if (editorCommentButton && AppOptions.get(\"enableComment\")) {\n editorCommentButton.parentElement.hidden = false;\n }\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 (mlManager && appConfig.secondaryToolbar?.imageAltTextSettingsButton) {\n this.imageAltTextSettings = new ImageAltTextSettings(\n appConfig.altTextSettingsDialog,\n overlayManager,\n eventBus,\n mlManager\n );\n }\n\n if (appConfig.documentProperties) {\n this.pdfDocumentProperties = new PDFDocumentProperties(\n appConfig.documentProperties,\n overlayManager,\n eventBus,\n l10n,\n /* fileNameLookup = */ () => this._docFilename,\n /* titleLookup = */ () => this._docTitle\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 if (\n typeof PDFJSDev === \"undefined\"\n ? window.isGECKOVIEW\n : PDFJSDev.test(\"GECKOVIEW\")\n ) {\n const nimbusData = JSON.parse(\n AppOptions.get(\"nimbusDataStr\") || \"null\"\n );\n this.toolbar = new Toolbar(appConfig.toolbar, eventBus, nimbusData);\n } else {\n this.toolbar = new Toolbar(\n appConfig.toolbar,\n eventBus,\n AppOptions.get(\"toolbarDensity\")\n );\n }\n }\n\n if (appConfig.secondaryToolbar) {\n if (AppOptions.get(\"enableAltText\")) {\n appConfig.secondaryToolbar.imageAltTextSettingsButton?.classList.remove(\n \"hidden\"\n );\n appConfig.secondaryToolbar.imageAltTextSettingsSeparator?.classList.remove(\n \"hidden\"\n );\n }\n\n this.secondaryToolbar = new SecondaryToolbar(\n appConfig.secondaryToolbar,\n eventBus\n );\n }\n\n if (\n this.supportsFullscreen &&\n appConfig.secondaryToolbar?.presentationModeButton\n ) {\n this.pdfPresentationMode = new PDFPresentationMode({\n container,\n pdfViewer,\n eventBus,\n });\n }\n\n if (appConfig.passwordOverlay) {\n this.passwordPrompt = new PasswordPrompt(\n appConfig.passwordOverlay,\n overlayManager,\n this.isViewerEmbedded\n );\n }\n\n if (appConfig.viewsManager?.outlinesView) {\n this.pdfOutlineViewer = new PDFOutlineViewer({\n container: appConfig.viewsManager.outlinesView,\n eventBus,\n l10n,\n linkService,\n downloadManager,\n });\n }\n\n if (appConfig.viewsManager?.attachmentsView) {\n this.pdfAttachmentViewer = new PDFAttachmentViewer({\n container: appConfig.viewsManager.attachmentsView,\n eventBus,\n l10n,\n downloadManager,\n });\n }\n\n if (appConfig.viewsManager?.layersView) {\n this.pdfLayerViewer = new PDFLayerViewer({\n container: appConfig.viewsManager.layersView,\n eventBus,\n l10n,\n });\n }\n\n if (appConfig.viewsManager) {\n this.viewsManager = new ViewsManager({\n elements: appConfig.viewsManager,\n eventBus,\n l10n,\n });\n this.viewsManager.onToggled = this.forceRendering.bind(this);\n this.viewsManager.onUpdateThumbnails = () => {\n // Use the rendered pages to set the corresponding thumbnail images.\n for (const pageView of pdfViewer.getCachedPageViews()) {\n if (pageView.renderingState === RenderingStates.FINISHED) {\n this.pdfThumbnailViewer\n .getThumbnail(pageView.id - 1)\n ?.setImage(pageView);\n }\n }\n this.pdfThumbnailViewer.scrollThumbnailIntoView(\n pdfViewer.currentPageNumber\n );\n };\n }\n },\n\n async run(config) {\n await this.initialize(config);\n\n const { appConfig, eventBus } = this;\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 try {\n file = new URL(file).href;\n } catch {\n file = encodeURIComponent(file).replaceAll(\"%2F\", \"/\");\n }\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 = (this._openFileInput = document.createElement(\"input\"));\n fileInput.id = \"fileInput\";\n fileInput.hidden = true;\n fileInput.type = \"file\";\n fileInput.value = null;\n document.body.append(fileInput);\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 for (const item of evt.dataTransfer.items) {\n if (item.type === \"application/pdf\") {\n evt.dataTransfer.dropEffect =\n evt.dataTransfer.effectAllowed === \"copy\" ? \"copy\" : \"move\";\n stopEvent(evt);\n return;\n }\n }\n });\n appConfig.mainContainer.addEventListener(\"drop\", function (evt) {\n if (evt.dataTransfer.files?.[0].type !== \"application/pdf\") {\n return;\n }\n stopEvent(evt);\n eventBus.dispatch(\"fileinputchange\", {\n source: this,\n fileInput: evt.dataTransfer,\n });\n });\n }\n\n if (!AppOptions.get(\"supportsDocumentFonts\")) {\n AppOptions.set(\"disableFontFace\", true);\n this.l10n.get(\"pdfjs-web-fonts-disabled\").then(msg => {\n console.warn(msg);\n });\n }\n\n const togglePrintingButtons = visible => {\n appConfig.toolbar?.print?.classList.toggle(\"hidden\", !visible);\n appConfig.secondaryToolbar?.printButton.classList.toggle(\n \"hidden\",\n !visible\n );\n };\n if (!this.supportsPrinting) {\n togglePrintingButtons(false);\n } else {\n eventBus.on(\"printingallowed\", ({ isAllowed }) =>\n togglePrintingButtons(isAllowed)\n );\n }\n\n if (!this.supportsFullscreen) {\n appConfig.secondaryToolbar?.presentationModeButton.classList.add(\n \"hidden\"\n );\n }\n\n if (this.supportsIntegratedFind) {\n appConfig.findBar?.toggleButton?.classList.add(\"hidden\");\n }\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n if (file) {\n this.open({ url: file });\n } else {\n this._hideViewBookmark();\n }\n } else if (PDFJSDev.test(\"MOZCENTRAL || CHROME\")) {\n this.setTitleUsingUrl(file, /* downloadUrl = */ file);\n\n this.externalServices.initPassiveLoading();\n } else {\n throw new Error(\"Not implemented: run\");\n }\n },\n\n get externalServices() {\n return shadow(this, \"externalServices\", new ExternalServices());\n },\n\n get initialized() {\n return this._initializedCapability.settled;\n },\n\n get initializedPromise() {\n return this._initializedCapability.promise;\n },\n\n updateZoom(steps, scaleFactor, origin) {\n if (this.pdfViewer.isInPresentationMode) {\n return;\n }\n this.pdfViewer.updateScale({\n drawingDelay: AppOptions.get(\"defaultZoomDelay\"),\n steps,\n scaleFactor,\n origin,\n });\n },\n\n zoomIn() {\n this.updateZoom(1);\n },\n\n zoomOut() {\n this.updateZoom(-1);\n },\n\n zoomReset() {\n if (this.pdfViewer.isInPresentationMode) {\n return;\n }\n this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;\n },\n\n touchPinchCallback(origin, prevDistance, distance) {\n if (this.supportsPinchToZoom) {\n const newScaleFactor = this._accumulateFactor(\n this.pdfViewer.currentScale,\n distance / prevDistance,\n \"_touchUnusedFactor\"\n );\n this.updateZoom(null, newScaleFactor, origin);\n } else {\n const PIXELS_PER_LINE_SCALE = 30;\n const ticks = this._accumulateTicks(\n (distance - prevDistance) / PIXELS_PER_LINE_SCALE,\n \"_touchUnusedTicks\"\n );\n this.updateZoom(ticks, null, origin);\n }\n },\n\n touchPinchEndCallback() {\n this._touchUnusedTicks = 0;\n this._touchUnusedFactor = 1;\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 shadow(\n this,\n \"supportsPrinting\",\n AppOptions.get(\"supportsPrinting\") &&\n PDFPrintServiceFactory.supportsPrinting\n );\n },\n\n get supportsFullscreen() {\n return shadow(this, \"supportsFullscreen\", document.fullscreenEnabled);\n },\n\n get supportsPinchToZoom() {\n return shadow(\n this,\n \"supportsPinchToZoom\",\n AppOptions.get(\"supportsPinchToZoom\")\n );\n },\n\n get supportsIntegratedFind() {\n return shadow(\n this,\n \"supportsIntegratedFind\",\n AppOptions.get(\"supportsIntegratedFind\")\n );\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 supportsMouseWheelZoomCtrlKey() {\n return shadow(\n this,\n \"supportsMouseWheelZoomCtrlKey\",\n AppOptions.get(\"supportsMouseWheelZoomCtrlKey\")\n );\n },\n\n get supportsMouseWheelZoomMetaKey() {\n return shadow(\n this,\n \"supportsMouseWheelZoomMetaKey\",\n AppOptions.get(\"supportsMouseWheelZoomMetaKey\")\n );\n },\n\n get supportsCaretBrowsingMode() {\n return AppOptions.get(\"supportsCaretBrowsingMode\");\n },\n\n moveCaret(isUp, select) {\n this._caretBrowsing ||= new CaretBrowsingMode(\n this._globalAbortController.signal,\n this.appConfig.mainContainer,\n this.appConfig.viewerContainer,\n this.appConfig.toolbar?.container\n );\n this._caretBrowsing.moveCaret(isUp, select);\n },\n\n setTitleUsingUrl(url = \"\", downloadUrl = null) {\n this.url = url;\n this.baseUrl =\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n ? updateUrlHash(url, \"\", /* allowRel = */ true)\n : updateUrlHash(url, \"\");\n if (downloadUrl) {\n this._downloadUrl =\n // eslint-disable-next-line no-nested-ternary\n downloadUrl === url\n ? this.baseUrl\n : typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n ? updateUrlHash(downloadUrl, \"\", /* allowRel = */ true)\n : updateUrlHash(downloadUrl, \"\");\n }\n if (isDataScheme(url)) {\n this._hideViewBookmark();\n } else if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"MOZCENTRAL || CHROME\")\n ) {\n AppOptions.set(\"docBaseUrl\", this.baseUrl);\n }\n\n let title = getPdfFilenameFromUrl(url, \"\");\n if (!title) {\n try {\n title = decodeURIComponent(getFilenameFromUrl(url));\n } catch {\n // decodeURIComponent may throw URIError.\n }\n }\n this.setTitle(title || url); // Always fallback to the raw URL.\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 get _docTitle() {\n const { documentInfo, metadata } = this;\n\n const title = metadata?.get(\"dc:title\");\n if (title) {\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 (title !== \"Untitled\" && !/[\\uFFF0-\\uFFFF]/g.test(title)) {\n return title;\n }\n }\n return documentInfo.Title;\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\" ||\n PDFJSDev.test(\"GENERIC && !TESTING\")) &&\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 {\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 this.pdfTextExtractor?.setViewer(null);\n }\n this.pdfLinkService.externalLinkEnabled = true;\n this.store = null;\n this.isInitialViewSet = 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(\n this.pdfScriptingManager.destroyPromise,\n this.passwordPrompt.close()\n );\n\n this.setTitle();\n this.viewsManager?.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 (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 (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n if (args.data && isPdfFile(args.filename)) {\n this._contentDispositionFilename = args.filename;\n }\n } else if (args.url) {\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\n // Set the necessary API parameters, using all the available options.\n const apiParams = AppOptions.getAll(OptionKind.API);\n const loadingTask = getDocument({\n ...apiParams,\n ...args,\n });\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 = evt => this.progress(evt.percent);\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 = \"pdfjs-loading-error\";\n if (reason instanceof InvalidPDFException) {\n key = \"pdfjs-invalid-file-error\";\n } else if (reason instanceof ResponseException) {\n key = reason.missing\n ? \"pdfjs-missing-file-error\"\n : \"pdfjs-unexpected-response-error\";\n }\n return this._documentError(key, { message: reason.message }).then(\n () => {\n throw reason;\n }\n );\n }\n );\n },\n\n async download() {\n let data;\n try {\n data = await (this.pdfDocument\n ? this.pdfDocument.getData()\n : this.pdfLoadingTask.getData());\n } catch {\n // When the PDF document isn't ready, simply download using the URL.\n }\n this.downloadManager.download(data, this._downloadUrl, this._docFilename);\n },\n\n async save() {\n if (this._saveInProgress) {\n return;\n }\n this._saveInProgress = true;\n await this.pdfScriptingManager.dispatchWillSave();\n\n try {\n const data = await this.pdfDocument.saveDocument();\n this.downloadManager.download(data, this._downloadUrl, this._docFilename);\n } catch (reason) {\n // When the PDF document isn't ready, fallback to a \"regular\" download.\n console.error(`Error when saving the document:`, reason);\n await this.download();\n } finally {\n await this.pdfScriptingManager.dispatchDidSave();\n this._saveInProgress = false;\n }\n\n const editorStats = this.pdfDocument?.annotationStorage.editorStats;\n if (editorStats) {\n this.externalServices.reportTelemetry({\n type: \"editing\",\n data: {\n type: \"save\",\n stats: editorStats,\n },\n });\n }\n },\n\n async downloadOrSave() {\n // In the Firefox case, this method MUST always trigger a download.\n // When the user is closing a modified and unsaved document, we display a\n // prompt asking for saving or not. In case they save, we must wait for\n // saving to complete before closing the tab.\n // So in case this function does not trigger a download, we must trigger a\n // a message and change PdfjsChild.sys.mjs to take it into account.\n const { classList } = this.appConfig.appContainer;\n classList.add(\"wait\");\n await (this.pdfDocument?.annotationStorage.size > 0\n ? this.save()\n : this.download());\n classList.remove(\"wait\");\n },\n\n /**\n * Report the error; used for errors affecting loading and/or parsing of\n * the entire PDF document.\n */\n async _documentError(key, moreInfo = null) {\n this._unblockDocumentLoadEvent();\n\n const message = await this._otherError(\n key || \"pdfjs-loading-error\",\n moreInfo\n );\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} key - The localization key for the error.\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 * @returns {string} A (localized) error message that is human readable.\n */\n async _otherError(key, moreInfo = null) {\n const message = await this.l10n.get(key);\n\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 return message;\n },\n\n progress(percent) {\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 (!this.loadingBar || 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 this._printPermissionPromise = new Promise(resolve => {\n this.eventBus.on(\n \"printingallowed\",\n ({ isAllowed }) => {\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"MOZCENTRAL\") &&\n !isAllowed\n ) {\n window.print = () => {\n console.warn(\"Printing is not allowed.\");\n };\n }\n resolve(isAllowed);\n },\n { once: true }\n );\n });\n\n pdfDocument.getDownloadInfo().then(({ length }) => {\n this._contentLength = length; // Ensure that the correct length is used.\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(() => {\n /* Avoid breaking initial rendering; ignoring errors. */\n });\n const pageModePromise = pdfDocument.getPageMode().catch(() => {\n /* Avoid breaking initial rendering; ignoring errors. */\n });\n const openActionPromise = pdfDocument.getOpenAction().catch(() => {\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 = updateUrlHash(location, \"\");\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 this.pdfTextExtractor.setViewer(pdfViewer);\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 });\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 // 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 this.setInitialView(hash, {\n rotation,\n sidebarView,\n scrollMode,\n spreadMode,\n });\n this.eventBus.dispatch(\"documentinit\", { source: this });\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._documentError(\"pdfjs-loading-error\", { message: reason.message });\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, jsActions] = await Promise.all([\n openActionPromise,\n this.pdfViewer.enableScripting ? null : pdfDocument.getJSActions(),\n ]);\n\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the auto print data resolved.\n }\n let triggerAutoPrint = openAction?.action === \"Print\";\n\n if (jsActions) {\n console.warn(\"Warning: JavaScript support is not enabled\");\n\n // Hack to support auto printing.\n for (const name in jsActions) {\n if (triggerAutoPrint) {\n break;\n }\n switch (name) {\n case \"WillClose\":\n case \"WillSave\":\n case \"DidSave\":\n case \"WillPrint\":\n case \"DidPrint\":\n continue;\n }\n triggerAutoPrint = jsActions[name].some(js => AutoPrintRegExp.test(js));\n }\n }\n\n if (triggerAutoPrint) {\n this.triggerPrinting();\n }\n },\n\n /**\n * @private\n */\n async _initializeMetadata(pdfDocument) {\n const {\n info,\n metadata,\n contentDispositionFilename,\n contentLength,\n hasStructTree,\n } = await pdfDocument.getMetadata();\n\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the metadata resolved.\n }\n this.externalServices.reportTelemetry({\n type: \"taggedPDF\",\n data: hasStructTree,\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 `${(metadata?.get(\"pdf:producer\") || info.Producer || \"-\").trim()} / ` +\n `${(metadata?.get(\"xmp:creatortool\") || info.Creator || \"-\").trim()}` +\n `] (PDF.js: ${version || \"?\"} [${build || \"?\"}])`\n );\n const pdfTitle = this._docTitle;\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 },\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.viewsManager?.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 this.pdfDocument.cleanup(\n /* keepLoadedFonts = */ AppOptions.get(\"fontExtraProperties\")\n );\n },\n\n forceRendering() {\n this.pdfRenderingQueue.printing = !!this.printService;\n this.pdfRenderingQueue.isThumbnailViewEnabled =\n this.viewsManager?.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(() => this.pdfDocument?.annotationStorage.print);\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 || !this.pdfViewer.printingAllowed) {\n this._otherError(\"pdfjs-printing-not-supported\");\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(\"pdfjs-printing-not-ready\").then(msg => {\n // eslint-disable-next-line no-alert\n window.alert(msg);\n });\n return;\n }\n\n this.printService = PDFPrintServiceFactory.createPrintService({\n pdfDocument: this.pdfDocument,\n pagesOverview: this.pdfViewer.getPagesOverview(),\n printContainer: this.appConfig.printContainer,\n printResolution: AppOptions.get(\"printResolution\"),\n printAnnotationStoragePromise: this._printAnnotationStoragePromise,\n });\n this.forceRendering();\n // Disable the editor-indicator during printing (fixes bug 1790552).\n this.setTitle();\n\n this.printService.layout();\n\n if (this._hasAnnotationEditors) {\n this.externalServices.reportTelemetry({\n type: \"editing\",\n data: {\n type: \"print\",\n stats: this.pdfDocument?.annotationStorage.editorStats,\n },\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 async triggerPrinting() {\n if (this.supportsPrinting && (await this._printPermissionPromise)) {\n window.print();\n }\n },\n\n bindEvents() {\n if (this._eventBusAbortController) {\n return;\n }\n const ac = (this._eventBusAbortController = new AbortController());\n const opts = { signal: ac.signal };\n\n const {\n eventBus,\n externalServices,\n pdfDocumentProperties,\n pdfViewer,\n preferences,\n } = this;\n\n eventBus._on(\"resize\", onResize.bind(this), opts);\n eventBus._on(\"hashchange\", onHashchange.bind(this), opts);\n eventBus._on(\"beforeprint\", this.beforePrint.bind(this), opts);\n eventBus._on(\"afterprint\", this.afterPrint.bind(this), opts);\n eventBus._on(\"pagerender\", onPageRender.bind(this), opts);\n eventBus._on(\"pagerendered\", onPageRendered.bind(this), opts);\n eventBus._on(\"updateviewarea\", onUpdateViewarea.bind(this), opts);\n eventBus._on(\"pagechanging\", onPageChanging.bind(this), opts);\n eventBus._on(\"scalechanging\", onScaleChanging.bind(this), opts);\n eventBus._on(\"rotationchanging\", onRotationChanging.bind(this), opts);\n eventBus._on(\"sidebarviewchanged\", onSidebarViewChanged.bind(this), opts);\n eventBus._on(\"pagemode\", onPageMode.bind(this), opts);\n eventBus._on(\"namedaction\", onNamedAction.bind(this), opts);\n eventBus._on(\n \"presentationmodechanged\",\n evt => (pdfViewer.presentationModeState = evt.state),\n opts\n );\n eventBus._on(\n \"presentationmode\",\n this.requestPresentationMode.bind(this),\n opts\n );\n eventBus._on(\n \"switchannotationeditormode\",\n evt => (pdfViewer.annotationEditorMode = evt),\n opts\n );\n eventBus._on(\"print\", this.triggerPrinting.bind(this), opts);\n eventBus._on(\"download\", this.downloadOrSave.bind(this), opts);\n eventBus._on(\"firstpage\", () => (this.page = 1), opts);\n eventBus._on(\"lastpage\", () => (this.page = this.pagesCount), opts);\n eventBus._on(\"nextpage\", () => pdfViewer.nextPage(), opts);\n eventBus._on(\"previouspage\", () => pdfViewer.previousPage(), opts);\n eventBus._on(\"zoomin\", this.zoomIn.bind(this), opts);\n eventBus._on(\"zoomout\", this.zoomOut.bind(this), opts);\n eventBus._on(\"zoomreset\", this.zoomReset.bind(this), opts);\n eventBus._on(\"pagenumberchanged\", onPageNumberChanged.bind(this), opts);\n eventBus._on(\n \"scalechanged\",\n evt => (pdfViewer.currentScaleValue = evt.value),\n opts\n );\n eventBus._on(\"rotatecw\", this.rotatePages.bind(this, 90), opts);\n eventBus._on(\"rotateccw\", this.rotatePages.bind(this, -90), opts);\n eventBus._on(\n \"optionalcontentconfig\",\n evt => (pdfViewer.optionalContentConfigPromise = evt.promise),\n opts\n );\n eventBus._on(\n \"switchscrollmode\",\n evt => (pdfViewer.scrollMode = evt.mode),\n opts\n );\n eventBus._on(\n \"scrollmodechanged\",\n onViewerModesChanged.bind(this, \"scrollMode\"),\n opts\n );\n eventBus._on(\n \"switchspreadmode\",\n evt => (pdfViewer.spreadMode = evt.mode),\n opts\n );\n eventBus._on(\n \"spreadmodechanged\",\n onViewerModesChanged.bind(this, \"spreadMode\"),\n opts\n );\n eventBus._on(\n \"imagealttextsettings\",\n onImageAltTextSettings.bind(this),\n opts\n );\n eventBus._on(\n \"documentproperties\",\n () => pdfDocumentProperties?.open(),\n opts\n );\n eventBus._on(\"findfromurlhash\", onFindFromUrlHash.bind(this), opts);\n eventBus._on(\n \"updatefindmatchescount\",\n onUpdateFindMatchesCount.bind(this),\n opts\n );\n eventBus._on(\n \"updatefindcontrolstate\",\n onUpdateFindControlState.bind(this),\n opts\n );\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n eventBus._on(\"fileinputchange\", onFileInputChange.bind(this), opts);\n eventBus._on(\"openfile\", onOpenFile.bind(this), opts);\n }\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n eventBus._on(\n \"annotationeditorstateschanged\",\n evt => externalServices.updateEditorStates(evt),\n opts\n );\n eventBus._on(\n \"reporttelemetry\",\n evt => externalServices.reportTelemetry(evt.details),\n opts\n );\n }\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"TESTING || MOZCENTRAL\")\n ) {\n eventBus._on(\n \"setpreference\",\n evt => preferences.set(evt.name, evt.value),\n opts\n );\n }\n eventBus._on(\"pagesedited\", this.onPagesEdited.bind(this), opts);\n eventBus._on(\n \"savepageseditedpdf\",\n this.onSavePagesEditedPDF.bind(this),\n opts\n );\n },\n\n bindWindowEvents() {\n if (this._windowAbortController) {\n return;\n }\n this._windowAbortController = new AbortController();\n\n const {\n eventBus,\n appConfig: { mainContainer },\n pdfViewer,\n _windowAbortController: { signal },\n } = this;\n\n this._touchManager = new TouchManager({\n container: window,\n isPinchingDisabled: () => pdfViewer.isInPresentationMode,\n isPinchingStopped: () => this.overlayManager?.active,\n onPinching: this.touchPinchCallback.bind(this),\n onPinchEnd: this.touchPinchEndCallback.bind(this),\n signal,\n });\n\n function addWindowResolutionChange(evt = null) {\n if (evt) {\n pdfViewer.refresh();\n }\n const mediaQueryList = window.matchMedia(\n `(resolution: ${OutputScale.pixelRatio}dppx)`\n );\n mediaQueryList.addEventListener(\"change\", addWindowResolutionChange, {\n once: true,\n signal,\n });\n }\n addWindowResolutionChange();\n\n window.addEventListener(\"wheel\", onWheel.bind(this), {\n passive: false,\n signal,\n });\n window.addEventListener(\"click\", onClick.bind(this), { signal });\n window.addEventListener(\"keydown\", onKeyDown.bind(this), { signal });\n window.addEventListener(\"keyup\", onKeyUp.bind(this), { signal });\n window.addEventListener(\n \"resize\",\n () => eventBus.dispatch(\"resize\", { source: window }),\n { signal }\n );\n window.addEventListener(\n \"hashchange\",\n () => {\n eventBus.dispatch(\"hashchange\", {\n source: window,\n hash: document.location.hash.substring(1),\n });\n },\n { signal }\n );\n window.addEventListener(\n \"beforeprint\",\n () => eventBus.dispatch(\"beforeprint\", { source: window }),\n { signal }\n );\n window.addEventListener(\n \"afterprint\",\n () => eventBus.dispatch(\"afterprint\", { source: window }),\n { signal }\n );\n window.addEventListener(\n \"updatefromsandbox\",\n evt => {\n eventBus.dispatch(\"updatefromsandbox\", {\n source: window,\n detail: evt.detail,\n });\n },\n { signal }\n );\n\n if (\n (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) &&\n !(\"onscrollend\" in document.documentElement)\n ) {\n return;\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n // Using the values lastScrollTop and lastScrollLeft is a workaround to\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1881974.\n // TODO: remove them once the bug is fixed.\n ({ scrollTop: this._lastScrollTop, scrollLeft: this._lastScrollLeft } =\n mainContainer);\n }\n\n let scrollendTimeoutID, scrollAbortController;\n const scrollend = () => {\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n ({ scrollTop: this._lastScrollTop, scrollLeft: this._lastScrollLeft } =\n mainContainer);\n }\n clearTimeout(scrollendTimeoutID);\n if (this._isScrolling) {\n scrollAbortController.abort();\n scrollAbortController = null;\n this._isScrolling = false;\n }\n };\n const scroll = () => {\n if (this._isCtrlKeyDown) {\n return;\n }\n if (\n (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) &&\n this._lastScrollTop === mainContainer.scrollTop &&\n this._lastScrollLeft === mainContainer.scrollLeft\n ) {\n return;\n }\n\n if (!this._isScrolling) {\n scrollAbortController = new AbortController();\n const abortSignal = AbortSignal.any([\n scrollAbortController.signal,\n signal,\n ]);\n\n mainContainer.addEventListener(\"scrollend\", scrollend, {\n signal: abortSignal,\n });\n mainContainer.addEventListener(\"blur\", scrollend, {\n signal: abortSignal,\n });\n this._isScrolling = true;\n }\n clearTimeout(scrollendTimeoutID);\n // Why 100 ? Because of:\n // https://developer.chrome.com/blog/scrollend-a-new-javascript-event\n // Maybe we could find a better value... ideally the `scrollend` event\n // should be correctly fired.\n scrollendTimeoutID = setTimeout(scrollend, 100);\n };\n mainContainer.addEventListener(\"scroll\", scroll, {\n passive: true,\n signal,\n });\n },\n\n unbindEvents() {\n this._eventBusAbortController?.abort();\n this._eventBusAbortController = null;\n },\n\n unbindWindowEvents() {\n this._windowAbortController?.abort();\n this._windowAbortController = null;\n this._touchManager = null;\n },\n\n /**\n * @ignore\n */\n async testingClose() {\n this.unbindEvents();\n this.unbindWindowEvents();\n\n this._globalAbortController?.abort();\n this._globalAbortController = null;\n\n this.findBar?.close();\n\n await Promise.all([this.l10n?.destroy(), this.close()]);\n },\n\n onPagesEdited(data) {\n this.pdfViewer.onPagesEdited(data);\n },\n\n async onSavePagesEditedPDF({ data: extractParams }) {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n return;\n }\n if (!this.pdfDocument) {\n return;\n }\n const modifiedPdfBytes = await this.pdfDocument.extractPages(extractParams);\n if (!modifiedPdfBytes) {\n console.error(\n \"Something wrong happened when saving the edited PDF.\\nPlease file a bug.\"\n );\n return;\n }\n this.downloadManager.download(\n modifiedPdfBytes,\n this._downloadUrl,\n this._docFilename\n );\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 /**\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\ninitCom(PDFViewerApplication);\nPDFPrintServiceFactory.initGlobals(PDFViewerApplication);\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n const HOSTED_VIEWER_ORIGINS = new Set([\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 const viewerOrigin = URL.parse(window.location)?.origin || \"null\";\n if (HOSTED_VIEWER_ORIGINS.has(viewerOrigin)) {\n // Hosted or local viewer, allow for any file locations\n return;\n }\n const fileOrigin = URL.parse(file, window.location)?.origin;\n if (fileOrigin === viewerOrigin) {\n return;\n }\n const ex = new Error(\"file origin does not match viewer's\");\n\n PDFViewerApplication._documentError(\"pdfjs-loading-error\", {\n message: ex.message,\n });\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 throw ex;\n };\n\n // eslint-disable-next-line no-var\n var onFileInputChange = function (evt) {\n if (this.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 this.open({\n url: URL.createObjectURL(file),\n originalUrl: encodeURIComponent(file.name),\n });\n };\n\n // eslint-disable-next-line no-var\n var onOpenFile = function (evt) {\n this._openFileInput?.click();\n };\n}\n\nfunction onPageRender({ 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 === this.page) {\n this.toolbar?.updateLoadingIndicatorState(true);\n }\n}\n\nfunction onPageRendered({ pageNumber, isDetailView, 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 === this.page) {\n this.toolbar?.updateLoadingIndicatorState(false);\n }\n\n // Use the rendered page to set the corresponding thumbnail image.\n if (!isDetailView && this.viewsManager?.visibleView === SidebarView.THUMBS) {\n const pageView = this.pdfViewer.getPageView(/* index = */ pageNumber - 1);\n const thumbnailView = this.pdfThumbnailViewer?.getThumbnail(\n /* index = */ pageNumber - 1\n );\n if (pageView) {\n thumbnailView?.setImage(pageView);\n }\n }\n\n if (error) {\n this._otherError(\"pdfjs-rendering-error\", error);\n }\n}\n\nfunction onPageMode({ 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 this.viewsManager?.switchView(view, /* forceOpen = */ true);\n}\n\nfunction onNamedAction(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 this.appConfig.toolbar?.pageNumber.select();\n break;\n\n case \"Find\":\n if (!this.supportsIntegratedFind) {\n this.findBar?.toggle();\n }\n break;\n\n case \"Print\":\n this.triggerPrinting();\n break;\n\n case \"SaveAs\":\n this.downloadOrSave();\n break;\n }\n}\n\nfunction onSidebarViewChanged({ view }) {\n this.pdfRenderingQueue.isThumbnailViewEnabled = view === SidebarView.THUMBS;\n\n if (this.isInitialViewSet) {\n // Only update the storage when the document has been loaded *and* rendered.\n this.store?.set(\"sidebarView\", view).catch(() => {\n // Unable to write to storage.\n });\n }\n}\n\nfunction onUpdateViewarea({ location }) {\n if (this.isInitialViewSet) {\n // Only update the storage when the document has been loaded *and* rendered.\n this.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 (this.appConfig.secondaryToolbar) {\n this.appConfig.secondaryToolbar.viewBookmarkButton.href =\n this.pdfLinkService.getAnchorUrl(location.pdfOpenParams);\n }\n}\n\nfunction onViewerModesChanged(name, evt) {\n if (this.isInitialViewSet && !this.pdfViewer.isInPresentationMode) {\n // Only update the storage when the document has been loaded *and* rendered.\n this.store?.set(name, evt.mode).catch(() => {\n // Unable to write to storage.\n });\n }\n}\n\nfunction onResize() {\n const { pdfDocument, pdfViewer, pdfRenderingQueue } = this;\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 onHashchange(evt) {\n const hash = evt.hash;\n if (!hash) {\n return;\n }\n if (!this.isInitialViewSet) {\n this.initialBookmark = hash;\n } else if (!this.pdfHistory?.popStateInProgress) {\n this.pdfLinkService.setHash(hash);\n }\n}\n\nfunction onPageNumberChanged(evt) {\n const { pdfViewer } = this;\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 this.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 this.toolbar?.setPageNumber(\n pdfViewer.currentPageNumber,\n pdfViewer.currentPageLabel\n );\n }\n}\n\nfunction onImageAltTextSettings() {\n this.imageAltTextSettings?.open({\n enableGuessAltText: AppOptions.get(\"enableGuessAltText\"),\n enableNewAltTextWhenAddingImage: AppOptions.get(\n \"enableNewAltTextWhenAddingImage\"\n ),\n });\n}\n\nfunction onFindFromUrlHash(evt) {\n this.eventBus.dispatch(\"find\", {\n source: evt.source,\n type: \"\",\n query: evt.query,\n caseSensitive: false,\n entireWord: false,\n highlightAll: true,\n findPrevious: false,\n matchDiacritics: true,\n });\n}\n\nfunction onUpdateFindMatchesCount({ matchesCount }) {\n if (this.supportsIntegratedFind) {\n this.externalServices.updateFindMatchesCount(matchesCount);\n } else {\n this.findBar?.updateResultsCount(matchesCount);\n }\n}\n\nfunction onUpdateFindControlState({\n state,\n previous,\n entireWord,\n matchesCount,\n rawQuery,\n}) {\n if (this.supportsIntegratedFind) {\n this.externalServices.updateFindControlState({\n result: state,\n findPrevious: previous,\n entireWord,\n matchesCount,\n rawQuery,\n });\n } else {\n this.findBar?.updateUIState(state, previous, matchesCount);\n }\n}\n\nfunction onScaleChanging(evt) {\n this.toolbar?.setPageScale(evt.presetValue, evt.scale);\n\n this.pdfViewer.update();\n}\n\nfunction onRotationChanging(evt) {\n if (this.pdfThumbnailViewer) {\n this.pdfThumbnailViewer.pagesRotation = evt.pagesRotation;\n }\n\n this.forceRendering();\n // Ensure that the active page doesn't change during rotation.\n this.pdfViewer.currentPageNumber = evt.pageNumber;\n}\n\nfunction onPageChanging({ pageNumber, pageLabel }) {\n this.toolbar?.setPageNumber(pageNumber, pageLabel);\n this.secondaryToolbar?.setPageNumber(pageNumber);\n\n if (this.viewsManager?.visibleView === SidebarView.THUMBS) {\n this.pdfThumbnailViewer?.scrollThumbnailIntoView(pageNumber);\n }\n\n // Show/hide the loading indicator in the page number input element.\n const currentPage = this.pdfViewer.getPageView(/* index = */ pageNumber - 1);\n this.toolbar?.updateLoadingIndicatorState(\n currentPage?.renderingState === RenderingStates.RUNNING\n );\n}\n\nfunction onWheel(evt) {\n const {\n pdfViewer,\n supportsMouseWheelZoomCtrlKey,\n supportsMouseWheelZoomMetaKey,\n supportsPinchToZoom,\n } = this;\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 !this._isCtrlKeyDown &&\n deltaMode === WheelEvent.DOM_DELTA_PIXEL &&\n evt.deltaX === 0 &&\n (Math.abs(scaleFactor - 1) < 0.05 || isBuiltInMac) &&\n evt.deltaZ === 0;\n const origin = [evt.clientX, evt.clientY];\n\n if (\n isPinchToZoom ||\n (evt.ctrlKey && supportsMouseWheelZoomCtrlKey) ||\n (evt.metaKey && supportsMouseWheelZoomMetaKey)\n ) {\n // Only zoom the pages, not the entire viewer.\n evt.preventDefault();\n // NOTE: this check must be placed *after* preventDefault.\n if (\n this._isScrolling ||\n document.visibilityState === \"hidden\" ||\n this.overlayManager.active\n ) {\n return;\n }\n\n if (isPinchToZoom && supportsPinchToZoom) {\n scaleFactor = this._accumulateFactor(\n pdfViewer.currentScale,\n scaleFactor,\n \"_wheelUnusedFactor\"\n );\n this.updateZoom(null, scaleFactor, origin);\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 //\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 =\n Math.abs(delta) >= 1\n ? Math.sign(delta)\n : this._accumulateTicks(delta, \"_wheelUnusedTicks\");\n } else {\n // pixel-based devices\n const PIXELS_PER_LINE_SCALE = 30;\n ticks = this._accumulateTicks(\n delta / PIXELS_PER_LINE_SCALE,\n \"_wheelUnusedTicks\"\n );\n }\n\n this.updateZoom(ticks, null, origin);\n }\n }\n}\n\nfunction closeSecondaryToolbar({ target }) {\n if (!this.secondaryToolbar?.isOpen) {\n return;\n }\n const { toolbar, secondaryToolbar } = this.appConfig;\n if (\n this.pdfViewer.containsElement(target) ||\n (toolbar?.container.contains(target) &&\n !secondaryToolbar?.toolbar.contains(target) &&\n // TODO: change the `contains` for an equality check when the bug:\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1921984\n // is fixed.\n !secondaryToolbar?.toggleButton.contains(target))\n ) {\n this.secondaryToolbar.close();\n }\n}\n\nfunction closeEditorUndoBar(evt) {\n if (!this.editorUndoBar?.isOpen) {\n return;\n }\n if (this.appConfig.secondaryToolbar?.toolbar.contains(evt.target)) {\n this.editorUndoBar.hide();\n }\n}\n\nfunction onClick(evt) {\n closeSecondaryToolbar.call(this, evt);\n closeEditorUndoBar.call(this, evt);\n}\n\nfunction onKeyUp(evt) {\n // evt.ctrlKey is false hence we use evt.key.\n if (evt.key === \"Control\") {\n this._isCtrlKeyDown = false;\n }\n}\n\nfunction onKeyDown(evt) {\n this._isCtrlKeyDown = evt.key === \"Control\";\n\n if (\n this.editorUndoBar?.isOpen &&\n evt.keyCode !== 9 &&\n evt.keyCode !== 16 &&\n !(\n (evt.keyCode === 13 || evt.keyCode === 32) &&\n getActiveOrFocusedElement() === this.appConfig.editorUndoBar.undoButton\n )\n ) {\n // Hide undo bar on keypress except for Shift, Tab, Shift+Tab.\n // Also avoid hiding if the undo button is triggered.\n this.editorUndoBar.hide();\n }\n\n if (this.overlayManager.active) {\n return;\n }\n const { eventBus, pdfViewer } = this;\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 (!this.supportsIntegratedFind && !evt.shiftKey) {\n this.findBar?.open();\n handled = true;\n }\n break;\n case 71: // g\n if (!this.supportsIntegratedFind) {\n const { state } = this.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 this.zoomIn();\n handled = true;\n break;\n case 173: // FF/Mac '-'\n case 109: // FF '-'\n case 189: // Chrome '-'\n this.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(() => {\n // ... and resetting the scale after browser adjusts its scale\n this.zoomReset();\n });\n handled = false;\n }\n break;\n\n case 38: // up arrow\n if (isViewerInPresentationMode || this.page > 1) {\n this.page = 1;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n case 40: // down arrow\n if (isViewerInPresentationMode || this.page < this.pagesCount) {\n this.page = this.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 this.requestPresentationMode();\n handled = true;\n this.externalServices.reportTelemetry({\n type: \"buttons\",\n data: { id: \"presentationModeKeyboard\" },\n });\n break;\n case 71: // g\n // focuses input#pageNumber field\n if (this.appConfig.toolbar) {\n this.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 (curElementTagName === \"BUTTON\" && evt.keyCode === /* Space = */ 32) ||\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 if (this.supportsCaretBrowsingMode) {\n this.moveCaret(/* isUp = */ true, /* select = */ false);\n handled = true;\n break;\n }\n /* falls through */\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 if (this.supportsCaretBrowsingMode) {\n return;\n }\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 (this.secondaryToolbar?.isOpen) {\n this.secondaryToolbar.close();\n handled = true;\n }\n if (!this.supportsIntegratedFind && this.findBar?.opened) {\n this.findBar.close();\n handled = true;\n }\n break;\n case 40: // down arrow\n if (this.supportsCaretBrowsingMode) {\n this.moveCaret(/* isUp = */ false, /* select = */ false);\n handled = true;\n break;\n }\n /* falls through */\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 32: // spacebar\n if (!isViewerInPresentationMode) {\n turnOnlyIfPageFit = true;\n }\n turnPage = 1;\n break;\n case 39: // right arrow\n if (this.supportsCaretBrowsingMode) {\n return;\n }\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 || this.page > 1) {\n this.page = 1;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n case 35: // end\n if (isViewerInPresentationMode || this.page < this.pagesCount) {\n this.page = this.pagesCount;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n\n case 83: // 's'\n this.pdfCursorTools?.switchTool(CursorTool.SELECT);\n break;\n case 72: // 'h'\n this.pdfCursorTools?.switchTool(CursorTool.HAND);\n break;\n\n case 82: // 'r'\n this.rotatePages(90);\n break;\n\n case 115: // F4\n this.viewsManager?.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 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 38: // up arrow\n this.moveCaret(/* isUp = */ true, /* select = */ true);\n handled = true;\n break;\n case 40: // down arrow\n this.moveCaret(/* isUp = */ false, /* select = */ true);\n handled = true;\n break;\n case 82: // 'r'\n this.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\nexport { PDFViewerApplication };\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 { ScrollMode, SpreadMode } from \"./ui_utils.js\";\nimport { AppOptions } from \"./app_options.js\";\nimport { LinkTarget } from \"./pdf_link_service.js\";\nimport { PDFViewerApplication } from \"./app.js\";\nimport { RenderingStates } from \"./renderable_view.js\";\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 principalContainer: document.getElementById(\"mainContainer\"),\n mainContainer: document.getElementById(\"viewerContainer\"),\n viewerContainer: document.getElementById(\"viewer\"),\n viewerAlert: document.getElementById(\"viewer-alert\"),\n toolbar: {\n container: document.getElementById(\"toolbarContainer\"),\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(\"zoomInButton\"),\n zoomOut: document.getElementById(\"zoomOutButton\"),\n print: document.getElementById(\"printButton\"),\n editorCommentButton: document.getElementById(\"editorCommentButton\"),\n editorCommentParamsToolbar: document.getElementById(\n \"editorCommentParamsToolbar\"\n ),\n editorFreeTextButton: document.getElementById(\"editorFreeTextButton\"),\n editorFreeTextParamsToolbar: document.getElementById(\n \"editorFreeTextParamsToolbar\"\n ),\n editorHighlightButton: document.getElementById(\"editorHighlightButton\"),\n editorHighlightParamsToolbar: document.getElementById(\n \"editorHighlightParamsToolbar\"\n ),\n editorHighlightColorPicker: document.getElementById(\n \"editorHighlightColorPicker\"\n ),\n editorInkButton: document.getElementById(\"editorInkButton\"),\n editorInkParamsToolbar: document.getElementById(\"editorInkParamsToolbar\"),\n editorStampButton: document.getElementById(\"editorStampButton\"),\n editorStampParamsToolbar: document.getElementById(\n \"editorStampParamsToolbar\"\n ),\n editorSignatureButton: document.getElementById(\"editorSignatureButton\"),\n editorSignatureParamsToolbar: document.getElementById(\n \"editorSignatureParamsToolbar\"\n ),\n download: document.getElementById(\"downloadButton\"),\n },\n secondaryToolbar: {\n toolbar: document.getElementById(\"secondaryToolbar\"),\n toggleButton: document.getElementById(\"secondaryToolbarToggleButton\"),\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 imageAltTextSettingsButton: document.getElementById(\n \"imageAltTextSettings\"\n ),\n imageAltTextSettingsSeparator: document.getElementById(\n \"imageAltTextSettingsSeparator\"\n ),\n documentPropertiesButton: document.getElementById(\"documentProperties\"),\n },\n viewsManager: {\n outerContainer: document.getElementById(\"outerContainer\"),\n toggleButton: document.getElementById(\"viewsManagerToggleButton\"),\n sidebarContainer: document.getElementById(\"viewsManager\"),\n resizer: document.getElementById(\"viewsManagerResizer\"),\n thumbnailButton: document.getElementById(\"thumbnailsViewMenu\"),\n outlineButton: document.getElementById(\"outlinesViewMenu\"),\n attachmentsButton: document.getElementById(\"attachmentsViewMenu\"),\n layersButton: document.getElementById(\"layersViewMenu\"),\n viewsManagerSelectorButton: document.getElementById(\n \"viewsManagerSelectorButton\"\n ),\n viewsManagerSelectorOptions: document.getElementById(\n \"viewsManagerSelectorOptions\"\n ),\n thumbnailsView: document.getElementById(\"thumbnailsView\"),\n outlinesView: document.getElementById(\"outlinesView\"),\n attachmentsView: document.getElementById(\"attachmentsView\"),\n layersView: document.getElementById(\"layersView\"),\n viewsManagerAddFileButton: document.getElementById(\n \"viewsManagerAddFileButton\"\n ),\n viewsManagerCurrentOutlineButton: document.getElementById(\n \"viewsManagerCurrentOutlineButton\"\n ),\n viewsManagerHeaderLabel: document.getElementById(\n \"viewsManagerHeaderLabel\"\n ),\n viewsManagerStatus: document.getElementById(\"viewsManagerStatus\"),\n manageMenu: {\n button: document.getElementById(\"viewsManagerStatusActionButton\"),\n menu: document.getElementById(\"viewsManagerStatusActionOptions\"),\n copy: document.getElementById(\"viewsManagerStatusActionCopy\"),\n cut: document.getElementById(\"viewsManagerStatusActionCut\"),\n delete: document.getElementById(\"viewsManagerStatusActionDelete\"),\n saveAs: document.getElementById(\"viewsManagerStatusActionSaveAs\"),\n },\n },\n findBar: {\n bar: document.getElementById(\"findbar\"),\n toggleButton: document.getElementById(\"viewFindButton\"),\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(\"findPreviousButton\"),\n findNextButton: document.getElementById(\"findNextButton\"),\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 altTextDialog: {\n dialog: document.getElementById(\"altTextDialog\"),\n optionDescription: document.getElementById(\"descriptionButton\"),\n optionDecorative: document.getElementById(\"decorativeButton\"),\n textarea: document.getElementById(\"descriptionTextarea\"),\n cancelButton: document.getElementById(\"altTextCancel\"),\n saveButton: document.getElementById(\"altTextSave\"),\n },\n newAltTextDialog: {\n dialog: document.getElementById(\"newAltTextDialog\"),\n title: document.getElementById(\"newAltTextTitle\"),\n descriptionContainer: document.getElementById(\n \"newAltTextDescriptionContainer\"\n ),\n textarea: document.getElementById(\"newAltTextDescriptionTextarea\"),\n disclaimer: document.getElementById(\"newAltTextDisclaimer\"),\n learnMore: document.getElementById(\"newAltTextLearnMore\"),\n imagePreview: document.getElementById(\"newAltTextImagePreview\"),\n createAutomatically: document.getElementById(\n \"newAltTextCreateAutomatically\"\n ),\n createAutomaticallyButton: document.getElementById(\n \"newAltTextCreateAutomaticallyButton\"\n ),\n downloadModel: document.getElementById(\"newAltTextDownloadModel\"),\n downloadModelDescription: document.getElementById(\n \"newAltTextDownloadModelDescription\"\n ),\n error: document.getElementById(\"newAltTextError\"),\n errorCloseButton: document.getElementById(\"newAltTextCloseButton\"),\n cancelButton: document.getElementById(\"newAltTextCancel\"),\n notNowButton: document.getElementById(\"newAltTextNotNow\"),\n saveButton: document.getElementById(\"newAltTextSave\"),\n },\n altTextSettingsDialog: {\n dialog: document.getElementById(\"altTextSettingsDialog\"),\n createModelButton: document.getElementById(\"createModelButton\"),\n learnMore: document.getElementById(\"altTextSettingsLearnMore\"),\n showAltTextDialogButton: document.getElementById(\n \"showAltTextDialogButton\"\n ),\n altTextSettingsCloseButton: document.getElementById(\n \"altTextSettingsCloseButton\"\n ),\n closeButton: document.getElementById(\"altTextSettingsCloseButton\"),\n },\n addSignatureDialog: {\n dialog: document.getElementById(\"addSignatureDialog\"),\n panels: document.getElementById(\"addSignatureActionContainer\"),\n typeButton: document.getElementById(\"addSignatureTypeButton\"),\n typeInput: document.getElementById(\"addSignatureTypeInput\"),\n drawButton: document.getElementById(\"addSignatureDrawButton\"),\n drawSVG: document.getElementById(\"addSignatureDraw\"),\n drawPlaceholder: document.getElementById(\"addSignatureDrawPlaceholder\"),\n drawThickness: document.getElementById(\"addSignatureDrawThickness\"),\n imageButton: document.getElementById(\"addSignatureImageButton\"),\n imageSVG: document.getElementById(\"addSignatureImage\"),\n imagePlaceholder: document.getElementById(\"addSignatureImagePlaceholder\"),\n imagePicker: document.getElementById(\"addSignatureFilePicker\"),\n imagePickerLink: document.getElementById(\"addSignatureImageBrowse\"),\n description: document.getElementById(\"addSignatureDescription\"),\n clearButton: document.getElementById(\"clearSignatureButton\"),\n saveContainer: document.getElementById(\"addSignatureSaveContainer\"),\n saveCheckbox: document.getElementById(\"addSignatureSaveCheckbox\"),\n errorBar: document.getElementById(\"addSignatureError\"),\n errorTitle: document.getElementById(\"addSignatureErrorTitle\"),\n errorDescription: document.getElementById(\"addSignatureErrorDescription\"),\n errorCloseButton: document.getElementById(\"addSignatureErrorCloseButton\"),\n cancelButton: document.getElementById(\"addSignatureCancelButton\"),\n addButton: document.getElementById(\"addSignatureAddButton\"),\n },\n editSignatureDialog: {\n dialog: document.getElementById(\"editSignatureDescriptionDialog\"),\n description: document.getElementById(\"editSignatureDescription\"),\n editSignatureView: document.getElementById(\"editSignatureView\"),\n cancelButton: document.getElementById(\"editSignatureCancelButton\"),\n updateButton: document.getElementById(\"editSignatureUpdateButton\"),\n },\n annotationEditorParams: {\n editorCommentsSidebar: document.getElementById(\"editorCommentsSidebar\"),\n editorCommentsSidebarCount: document.getElementById(\n \"editorCommentsSidebarCount\"\n ),\n editorCommentsSidebarTitle: document.getElementById(\n \"editorCommentsSidebarTitle\"\n ),\n editorCommentsSidebarCloseButton: document.getElementById(\n \"editorCommentsSidebarCloseButton\"\n ),\n editorCommentsSidebarList: document.getElementById(\n \"editorCommentsSidebarList\"\n ),\n editorCommentsSidebarResizer: document.getElementById(\n \"editorCommentsSidebarResizer\"\n ),\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 editorStampAddImage: document.getElementById(\"editorStampAddImage\"),\n editorSignatureAddSignature: document.getElementById(\n \"editorSignatureAddSignature\"\n ),\n editorFreeHighlightThickness: document.getElementById(\n \"editorFreeHighlightThickness\"\n ),\n editorHighlightShowAll: document.getElementById(\"editorHighlightShowAll\"),\n },\n printContainer: document.getElementById(\"printContainer\"),\n editorUndoBar: {\n container: document.getElementById(\"editorUndoBar\"),\n message: document.getElementById(\"editorUndoBarMessage\"),\n undoButton: document.getElementById(\"editorUndoBarUndoButton\"),\n closeButton: document.getElementById(\"editorUndoBarCloseButton\"),\n },\n editCommentDialog: {\n dialog: document.getElementById(\"commentManagerDialog\"),\n toolbar: document.getElementById(\"commentManagerToolbar\"),\n title: document.getElementById(\"commentManagerTitle\"),\n textInput: document.getElementById(\"commentManagerTextInput\"),\n cancelButton: document.getElementById(\"commentManagerCancelButton\"),\n saveButton: document.getElementById(\"commentManagerSaveButton\"),\n },\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 = new CustomEvent(\"webviewerloaded\", {\n bubbles: true,\n cancelable: true,\n detail: {\n source: window,\n },\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":["AbortException","AnnotationEditorLayer","AnnotationEditorParamsType","AnnotationEditorType","AnnotationEditorUIManager","AnnotationLayer","AnnotationMode","AnnotationType","applyOpacity","build","ColorPicker","createValidAbsoluteUrl","CSSConstants","DOMSVGFactory","DrawLayer","FeatureTest","fetchData","findContrastColor","getDocument","getFilenameFromUrl","getPdfFilenameFromUrl","getRGB","getUuid","getXfaPageViewport","GlobalWorkerOptions","ImageKind","InvalidPDFException","isDataScheme","isPdfFile","isValidExplicitDest","makeArr","makeMap","makeObj","MathClamp","noContextMenu","normalizeUnicode","OPS","OutputScale","PasswordResponses","PDFDataRangeTransport","PDFDateString","PDFWorker","PermissionFlag","PixelsPerInch","RenderingCancelledException","renderRichText","ResponseException","setLayerDimensions","shadow","SignatureExtractor","stopEvent","SupportedImageMimeTypes","TextLayer","TouchManager","updateUrlHash","Util","VerbosityLevel","version","XfaLayer","globalThis","pdfjsLib","DEFAULT_SCALE_VALUE","DEFAULT_SCALE","DEFAULT_SCALE_DELTA","MIN_SCALE","MAX_SCALE","UNKNOWN_SCALE","MAX_AUTO_SCALE","SCROLLBAR_PADDING","VERTICAL_PADDING","PresentationModeState","UNKNOWN","NORMAL","CHANGING","FULLSCREEN","SidebarView","NONE","THUMBS","OUTLINE","ATTACHMENTS","LAYERS","TextLayerMode","DISABLE","ENABLE","ENABLE_PERMISSIONS","ScrollMode","VERTICAL","HORIZONTAL","WRAPPED","PAGE","SpreadMode","ODD","EVEN","CursorTool","SELECT","HAND","ZOOM","AutoPrintRegExp","scrollIntoView","element","spot","scrollMatches","parent","offsetParent","console","error","offsetY","offsetTop","clientTop","offsetX","offsetLeft","clientLeft","clientHeight","scrollHeight","clientWidth","scrollWidth","classList","contains","getComputedStyle","overflow","top","undefined","left","elementWidth","getBoundingClientRect","width","padding","scrollLeft","scrollTop","watchScroll","viewAreaElement","callback","abortSignal","debounceScroll","evt","rAF","window","requestAnimationFrame","viewAreaElementScrolled","currentX","lastX","state","right","currentY","lastY","down","_eventHandler","addEventListener","useCapture","signal","cancelAnimationFrame","once","parseQueryString","query","params","Map","key","value","URLSearchParams","set","toLowerCase","InvisibleCharsRegExp","removeNullCharacters","str","replaceInvisible","test","replaceAll","m","binarySearchFirstItem","items","condition","start","minIndex","maxIndex","length","currentIndex","currentItem","approximateFraction","x","Math","floor","xinv","limit","x_","a","b","c","d","p","q","result","floorToDivide","div","getPageSizeInches","view","userUnit","rotate","x1","y1","x2","y2","changeOrientation","height","backtrackBeforeAllVisibleElements","index","views","elt","pageTop","i","getVisibleElements","scrollEl","sortByVisibility","horizontal","rtl","bottom","isElementBottomAfterViewTop","elementBottom","isElementNextAfterViewHorizontally","elementLeft","elementRight","visible","ids","Set","numViews","firstVisibleElementInd","lastEdge","currentWidth","currentHeight","viewWidth","viewHeight","viewRight","viewBottom","minY","max","minX","hiddenHeight","hiddenWidth","fractionHeight","fractionWidth","percent","push","id","y","visibleArea","maxX","min","maxY","widthPercent","add","first","last","at","sort","pc","abs","normalizeWheelEventDirection","delta","hypot","deltaX","deltaY","angle","atan2","PI","normalizeWheelEventDelta","deltaMode","MOUSE_PIXELS_PER_LINE","MOUSE_LINES_PER_PAGE","WheelEvent","DOM_DELTA_PIXEL","DOM_DELTA_LINE","isValidRotation","Number","isInteger","isValidScrollMode","mode","Object","values","includes","isValidSpreadMode","isPortraitOrientation","size","animationStarted","Promise","resolve","docStyle","document","documentElement","style","ProgressBar","disableAutoFetchTimeout","constructor","bar","val","isNaN","remove","setProperty","setWidth","viewer","container","parentNode","scrollbarWidth","offsetWidth","setDisableAutoFetch","delay","clearTimeout","show","setTimeout","hide","getActiveOrFocusedElement","curRoot","curActiveOrFocused","activeElement","querySelector","shadowRoot","apiPageLayoutToViewerModes","layout","scrollMode","spreadMode","apiPageModeToSidebarView","toggleCheckedBtn","button","toggle","setAttribute","toggleSelectedBtn","toggleExpandedBtn","calcRound","e","createElement","fround","compatParams","maxTouchPoints","platform","userAgent","navigator","isAndroid","isIOS","OptionKind","BROWSER","VIEWER","API","WORKER","EVENT_DISPATCH","PREFERENCE","Type","BOOLEAN","NUMBER","OBJECT","STRING","UNDEFINED","defaultOptions","allowedGlobalEvents","kind","canvasMaxAreaInBytes","isInAutomation","localeProperties","lang","language","maxCanvasDim","nimbusDataStr","supportsCaretBrowsingMode","supportsDocumentFonts","supportsIntegratedFind","supportsMouseWheelZoomCtrlKey","supportsMouseWheelZoomMetaKey","supportsPinchToZoom","supportsPrinting","toolbarDensity","altTextLearnMoreUrl","annotationEditorMode","annotationMode","capCanvasAreaFactor","commentLearnMoreUrl","cursorToolOnLoad","debuggerSrc","defaultZoomDelay","defaultZoomValue","disableHistory","disablePageLabels","enableAltText","enableAltTextModelDownload","enableAutoLinking","enableComment","enableDetailCanvas","enableGuessAltText","enableHighlightFloatingButton","enableNewAltTextWhenAddingImage","enableOptimizedPartialRendering","enablePermissions","enablePrintAutoRotate","enableScripting","enableSignatureEditor","enableSplitMerge","enableUpdatedAddImage","externalLinkRel","externalLinkTarget","highlightEditorColors","historyUpdateUrl","ignoreDestinationZoom","imageResourcesPath","maxCanvasPixels","minDurationToUpdateCanvas","forcePageColors","pageColorsBackground","pageColorsForeground","pdfBugEnabled","printResolution","sidebarViewOnLoad","scrollModeOnLoad","spreadModeOnLoad","textLayerMode","viewerCssTheme","viewOnLoad","cMapPacked","cMapUrl","disableAutoFetch","disableFontFace","disableRange","disableStream","docBaseUrl","enableHWA","enableXfa","fontExtraProperties","iccUrl","isEvalSupported","isOffscreenCanvasSupported","maxImageSize","pdfBug","standardFontDataUrl","useSystemFonts","type","verbosity","wasmUrl","workerPort","workerSrc","defaultUrl","sandboxBundleSrc","enableFakeMLManager","disablePreferences","AppOptions","eventBus","opts","name","_hasInvokedSet","_checkDisablePreferences","get","warn","getAll","defaultOnly","options","create","defaultOpt","setAll","prefs","events","userOpt","toUpperCase","dispatch","source","DEFAULT_LINK_REL","LinkTarget","SELF","BLANK","PARENT","TOP","PDFLinkService","externalLinkEnabled","_ignoreDestinationZoom","baseUrl","pdfDocument","pdfViewer","pdfHistory","setDocument","setViewer","setHistory","pagesCount","pagesMapper","pagesNumber","page","currentPageNumber","rotation","pagesRotation","isInPresentationMode","goToDestination","dest","namedDest","explicitDest","pageNumber","getDestination","Array","isArray","destRef","cachedPageNumber","getPageIndex","pushCurrentPosition","scrollPageIntoView","destArray","ac","AbortController","_on","textLayer","focus","abort","goToPage","pageLabelToPageNumber","pushPage","goToXY","addLinkAttributes","link","url","newWindow","Error","target","rel","href","title","onclick","targetStr","getDestinationHash","getAnchorUrl","escape","JSON","stringify","anchor","setHash","hash","has","phrase","match","zoomArgs","split","zoomArg","zoomArgNumber","parseFloat","allowNegativeOffset","unescape","parse","toString","executeNamedAction","action","back","forward","nextPage","previousPage","executeSetOCGState","optionalContentConfig","optionalContentConfigPromise","setOCGState","SimpleLinkService","WaitOnType","EVENT","TIMEOUT","waitOnEventOrTimeout","promise","withResolvers","handler","timeout","evtMethod","EventBus","bind","listeners","on","eventName","listener","external","off","_off","data","eventListeners","externalListeners","slice","rmAbort","AbortSignal","aborted","onAbort","removeEventListener","ii","splice","FirefoxEventBus","externalServices","globalEventNames","BaseExternalServices","updateFindControlState","updateFindMatchesCount","initPassiveLoading","reportTelemetry","reportText","createL10n","createScripting","createSignatureStorage","updateEditorStates","dispatchGlobalEvent","_event","BasePreferences","defaults","freeze","initializedPromise","_readFromStorage","then","browserPrefs","_writeToStorage","prefObj","reset","FluentType","valueOf","FluentNone","scope","FluentNumber","nf","memoizeIntlObject","Intl","NumberFormat","format","err","reportError","FluentDateTime","supportsValue","Date","_Temporal","Temporal","Instant","PlainDateTime","PlainDate","PlainMonthDay","PlainTime","PlainYearMonth","calendar","calendarId","Symbol","toPrimitive","hint","toNumber","getTime","epochMilliseconds","toZonedDateTime","TypeError","dtf","DateTimeFormat","toISOString","MAX_PLACEABLES","FSI","PDI","selector","category","PluralRules","select","getDefault","variants","star","resolvePattern","RangeError","getArguments","args","positional","named","arg","resolveExpression","expr","minimumFractionDigits","precision","resolveVariableReference","resolveMessageReference","resolveTermReference","resolveFunctionReference","resolveSelectExpression","prototype","hasOwnProperty","call","ReferenceError","attr","message","bundle","_messages","attribute","attributes","term","_terms","resolved","func","_functions","sel","variant","resolveComplexPattern","ptn","dirty","useIsolating","_useIsolating","elem","_transform","placeables","delete","join","Scope","errors","WeakSet","ctor","cache","_intls","locales","allowed","unwrapped","opt","entries","NUMBER_ALLOWED","DATETIME_ALLOWED","DATETIME","getMemoizerForLocale","stringLocale","memoizer","FluentBundle","functions","transform","v","hasMessage","getMessage","addResource","res","allowOverrides","body","entry","startsWith","formatPattern","pattern","RE_MESSAGE_START","RE_ATTRIBUTE_START","RE_VARIANT_START","RE_NUMBER_LITERAL","RE_IDENTIFIER","RE_REFERENCE","RE_FUNCTION_NAME","RE_TEXT_RUN","RE_STRING_RUN","RE_STRING_ESCAPE","RE_UNICODE_ESCAPE","RE_LEADING_NEWLINES","RE_TRAILING_SPACES","RE_BLANK_LINES","RE_INDENT","TOKEN_BRACE_OPEN","TOKEN_BRACE_CLOSE","TOKEN_BRACKET_OPEN","TOKEN_BRACKET_CLOSE","TOKEN_PAREN_OPEN","TOKEN_ARROW","TOKEN_COLON","TOKEN_COMMA","TOKEN_BLANK","FluentResource","lastIndex","cursor","next","exec","parseMessage","SyntaxError","re","consumeChar","char","errorClass","consumeToken","match1","parsePattern","parseAttributes","keys","attrs","parsePatternElements","Infinity","indent","parseIndent","trim","elements","commonIndent","parsePlaceable","lastElement","baked","Indent","parseInlineExpression","parseVariants","sigil","parseArguments","parseLiteral","parseArgument","count","parseVariantKey","parseNumberLiteral","parseStringLiteral","fraction","parseEscapeSequence","codepoint4","codepoint6","codepoint","parseInt","String","fromCodePoint","makeIndent","text","replace","blank","reOverlay","TEXT_LEVEL_ELEMENTS","LOCALIZABLE_ATTRIBUTES","global","area","input","menuitem","menu","optgroup","option","track","img","textarea","th","description","label","textbox","translateElement","translation","localName","namespaceURI","textContent","templateElement","ownerDocument","createElementNS","innerHTML","overlayChildNodes","content","overlayAttributes","fromFragment","toElement","childNode","childNodes","nodeType","TEXT_NODE","hasAttribute","sanitized","getNodeForNamedElement","replaceChild","isElementAllowed","createSanitizedElement","createTextNodeFromTextContent","appendChild","fromElement","explicitlyAllowed","getAttribute","map","from","isAttrNameLocalizable","removeAttribute","sourceElement","translatedChild","childName","sourceChild","removeChild","clone","cloneNode","shallowPopulateUsing","createTextNode","attrName","elemName","CachedIterable","iterable","CachedSyncIterable","iterator","cached","cur","touchNext","idx","done","CachedAsyncIterable","asyncIterator","default","Localization","resourceIds","generateBundles","onChange","addResourceIds","eager","removeResourceIds","filter","r","formatWithFallback","method","translations","hasAtLeastOneBundle","bundles","missingIds","keysFromBundle","locale","formatMessages","messageFromBundle","formatValues","valueFromBundle","formatValue","handleEvent","formatted","attrNames","messageErrors","forEach","L10NID_ATTR_NAME","L10NARGS_ATTR_NAME","L10N_ELEMENT_QUERY","DOMLocalization","roots","pendingrAF","pendingElements","windowElement","mutationObserver","observerConfig","characterData","childList","subtree","attributeFilter","translateRoots","setAttributes","getAttributes","connectRoot","newRoot","root","defaultView","MutationObserver","mutations","translateMutations","observe","disconnectRoot","pauseObserving","clear","resumeObserving","all","translateFragment","takeRecords","disconnect","mutation","addedNode","addedNodes","ELEMENT_NODE","childElementCount","getTranslatables","translateElements","frag","getKeysForElement","applyTranslations","nodes","querySelectorAll","L10n","dir","l10n","isRTL","fixupLangCode","_setL10n","getLanguage","getDirection","fallback","messages","translate","translateOnce","ex","destroy","pause","resume","#fixupLangCode","langCode","PARTIAL_LANG_CODES","en","es","fy","ga","gu","hi","hy","nb","ne","nn","pa","pt","sv","zh","#isRTL","shortCode","GenericL10n","PLATFORM","isLinux","isMac","isWindows","createBundle","resource","generateBundlesFallback","#generateBundles","defaultLang","baseLang","baseURL","paths","getPaths","langs","shortLang","bundlePromise","createBundleFallback","#createBundle","path","URL","#getPaths","substring","lastIndexOf","#generateBundlesFallback","#createBundleFallback","docProperties","info","metadata","contentDispositionFilename","contentLength","getMetadata","filesize","getDownloadInfo","filename","getRaw","authors","numPages","GenericScripting","_ready","reject","sandbox","pdfjsSandbox","QuickJSSandbox","catch","createSandbox","dispatchEventInSandbox","event","dispatchEvent","destroySandbox","nukeSandbox","KEY_STORAGE","SignatureStorage","signatures","save","#save","localStorage","setItem","fromEntries","getItem","isFull","uuid","initCom","app","Preferences","ExternalServices","MLManager","isEnabledFor","_name","deleteModel","_service","isReady","guess","_data","toggleService","_enabled","NewAltTextManager","boundCancel","cancel","createAutomaticallyButton","currentEditor","cancelButton","descriptionContainer","dialog","disclaimer","downloadModel","downloadModelDescription","firstTime","guessedAltText","hasAI","isEditing","imagePreview","imageData","isAILoading","wasAILoading","learnMore","notNowButton","overlayManager","uiManager","previousAltText","saveButton","errorCloseButton","close","preventDefault","toggleError","checked","_reportTelemetry","status","isAltTextEnabled","mlManager","disabled","setProgress","setPreference","setPref","toggleGuessAltText","toggleLoading","toggleTitleAndDisclaimer","ctrlKey","metaKey","register","topic","#setPref","#toggleLoading","#toggleError","#toggleGuessAltText","isInitial","mlGuessAltText","toggleNotNow","#toggleNotNow","toggleAI","#toggleAI","#toggleTitleAndDisclaimer","hidden","#mlGuessAltText","addAltText","hasError","altText","#addAltText","#setProgress","detail","finished","total","totalLoaded","ONE_MEGA_BYTES","totalSize","ariaValueMax","round","downloadedSize","ariaValueNow","editAltText","editor","hasAltTextData","altTextFinish","hasProgress","isAltTextEnabledPromise","removeEditListeners","altTextData","AI_MAX_IMAGE_DIMENSION","MAX_PREVIEW_DIMENSION","canvas","copyCanvas","append","open","#cancel","alt_text_type","flow","alt_text_modal","finish","#finish","closeIfActive","#close","firstElementChild","addEditListeners","setSelected","extractWords","#extractWords","decorative","guessedWords","words","total_words","words_removed","difference","words_added","ImageAltTextSettings","createModelButton","showAltTextDialogButton","closeButton","togglePref","download","#reportTelemetry","details","#download","isFromUI","#delete","#togglePref","AltTextManager","clickAC","hasUsedPointer","optionDescription","optionDecorative","resizeAC","svgElement","rectElement","telemetryData","onUpdateUIState","updateUIState","createSVGElement","#createSVGElement","svgFactory","svg","defs","mask","rect","clickOpts","onClick","setPosition","#setPosition","containerX","containerY","containerW","containerH","innerWidth","windowW","innerHeight","windowH","dialogW","dialogH","getClientDimensions","MARGIN","isLTR","direction","xs","xe","ys","ye","alt_text_keyboard","removeOnClickListeners","#updateUIState","alt_text_description","alt_text_edit","alt_text_decorative","#onClick","#removeOnClickListeners","AnnotationEditorParams","bindListeners","#bindListeners","editorFreeTextFontSize","editorFreeTextColor","editorInkColor","editorInkThickness","editorInkOpacity","editorStampAddImage","editorFreeHighlightThickness","editorHighlightShowAll","editorSignatureAddSignature","typeStr","valueAsNumber","FREETEXT_SIZE","FREETEXT_COLOR","INK_COLOR","INK_THICKNESS","INK_OPACITY","HIGHLIGHT_COLOR","HIGHLIGHT_THICKNESS","HIGHLIGHT_FREE","HIGHLIGHT_SHOW_ALL","PRECISION","CaretBrowsingMode","mainContainer","toolBarHeight","viewerContainer","toolbarContainer","toolbarObserver","ResizeObserver","borderBoxSize","blockSize","isOnSameLine","#isOnSameLine","rect1","rect2","top1","bot1","mid1","top2","bot2","mid2","isUnderOver","#isUnderOver","isUp","midY","isVisible","#isVisible","getCaretPosition","#getCaretPosition","selection","focusNode","focusOffset","range","createRange","setStart","setEnd","caretPositionFromPoint","#caretPositionFromPoint","startContainer","offsetNode","startOffset","offset","caretRangeFromPoint","setCaretPositionHelper","#setCaretPositionHelper","caretX","extend","firstChild","lastChild","caretPosition","parentElement","elementsAtPoint","elementsFromPoint","savedVisibilities","el","visibility","setCaretPosition","#setCaretPosition","newLineElement","newLineElementRect","getNodeOnNextPage","#getNodeOnNextPage","closest","walker","createTreeWalker","NodeFilter","SHOW_TEXT","node","moveCaret","getSelection","rangeCount","focusElement","Node","currentNode","focusRect","nodeIterator","previousSibling","nextSibling","lastNode","addRange","caretY","elementRect","RESIZE_TIMEOUT","Sidebar","initialWidth","coefficient","resizeTimeout","resizer","isResizerOnTheLeft","isKeyboardResizing","resizeObserver","prevX","sidebar","toggleButton","ltr","_sidebar","getPropertyValue","ariaValueMin","makeSidebarResizable","_isOpen","inlineSize","#makeSidebarResizable","sidebarStyle","pointerMoveAC","cancelResize","onStopResizing","NaN","onStartResizing","clientX","parentStyle","minWidth","ev","capture","isArrowLeft","base","dx","#setWidth","newWidth","insetInlineStart","toFixed","onResizing","_newWidth","CommentManager","popup","hasForcedColors","commentDialog","linkService","dateFormat","dateStyle","dialogElement","CommentDialog","CommentPopup","CommentSidebar","setSidebarUiManager","setUIManager","showSidebar","annotations","hideSidebar","removeComments","selectComment","addComment","annotation","updateComment","toggleCommentPopup","isSelected","isEditable","uid","destroyPopup","updatePopupColor","updateColor","showDialog","posX","posY","makeCommentColor","color","opacity","_makeCommentColor","commentForegroundColor","boundCommentClick","commentClick","boundCommentKeydown","commentKeydown","commentsList","commentCount","sidebarTitle","learnMoreUrl","elementsToAnnotations","idsToElements","sidebarResizer","commentToolbarButton","keyDownCallback","lastElementChild","WeakMap","sortComments","fragment","createDocumentFragment","createCommentElement","setCommentsCount","numberOfAnnotations","replaceChildren","removeAll","removeComment","focusComment","children","creationDate","modificationDate","richText","contentsObj","popupRef","prevAnnotation","setDate","setText","insertBefore","#removeComment","#removeAll","hasNoElement","behavior","block","commentItem","#setCommentsCount","createZeroCommentElement","#createZeroCommentElement","textDiv","className","#setDate","date","toDateObject","dateTime","#setText","html","#createCommentElement","role","tabIndex","backgroundColor","dateDiv","#commentClick","currentTarget","_hide","pageIndex","pageVisiblePromise","waitForEditorsRendered","center","#commentKeydown","nextElementSibling","previousElementSibling","#sortComments","dateA","dateB","localeCompare","previousText","commentText","textInput","prevDragX","prevDragY","dialogX","dialogY","toolbar","finishBound","cancelDrag","clientY","getData","dialogStyle","borderColor","makeHexColor","parentDimensions","hasDefaultPopupPosition","dialogWidth","dialogHeight","_dialogDimensions","buttonWidth","commentButtonWidth","comment","display","edited","focusCommentButton","buttonsContainer","time","previousFocusedElement","selected","_popupWidth","createPopup","#createPopup","ariaModal","buttons","edit","ariaHasPopup","ariaControlsElements","editLabel","editComment","del","delLabel","deleted","savedData","_uiManager","deleteComment","separator","parentWidth","parentHeight","parentBoundingClientRect","setCommentButtonStates","hasPopup","commentPopupPosition","elementBeforePopup","after","relatedTarget","correctPosition","parentRect","widthRatio","margin","BaseDownloadManager","openBlobUrls","_triggerDownload","blobUrl","originalUrl","isAttachment","_getOpenDataUrl","downloadData","contentType","createObjectURL","Blob","openOrDownloadData","isPdfData","getOrInsertComputed","viewerUrl","revokeObjectURL","DownloadManager","click","encodeURIComponent","EditorUndoBar","focusTimeout","initController","isOpen","showController","undoButton","l10nMessages","highlight","freetext","stamp","ink","signature","_multiple","undoAction","messageData","boundHide","OverlayManager","overlays","active","canForceClose","showModal","PasswordPrompt","activeCapability","updateCallback","reason","isViewerEmbedded","submitButton","_isViewerEmbedded","verify","keyCode","passwordIncorrect","INCORRECT_PASSWORD","#verify","password","invokeCallback","#invokeCallback","setUpdateCallback","TREEITEM_SELECTED_CLASS","BaseTreeViewer","_l10n","_pdfDocument","_lastToggleIsShow","_currentTreeItem","_dispatchEvent","_bindLink","_normalizeTextContent","_addToggleButton","toggler","prepend","_toggleTreeItem","_toggleAllTreeItems","_finishRendering","hasAnyNesting","shiftKey","shouldShowAll","render","_updateCurrentTreeItem","treeItem","_scrollToCurrentTreeItem","inline","PDFAttachmentViewer","downloadManager","appendAttachment","keepRenderedCapability","_attachments","_renderedCapability","_pendingDispatchEvent","attachmentsCount","attachments","ul","item","li","#appendAttachment","renderedPromise","CSS_CLASS_GRAB","GrabToPan","activateAC","mouseDownAC","scrollAC","overlay","activate","onMouseDown","deactivate","endPan","ignoreTarget","matches","#onMouseDown","originalTarget","tagName","scrollLeftStart","scrollTopStart","clientXStart","clientYStart","boundEndPan","mouseOpts","onMouseMove","focusedElement","blur","#onMouseMove","xDiff","yDiff","scrollTo","#endPan","PDFCursorTools","prevActive","addEventListeners","switchTool","activeTool","tool","#switchTool","disableActiveTool","_handTool","#addEventListeners","presentationModeState","enableActive","disableActive","NON_METRIC_LOCALES","US_PAGE_NAMES","METRIC_PAGE_NAMES","getPageName","isPortrait","pageNames","PDFDocumentProperties","fieldData","fields","fileNameLookup","titleLookup","_fileNameLookup","_titleLookup","_currentPageNumber","_pagesRotation","_dataAvailableCapability","updateUI","pdfPage","getPage","fileName","fileSize","pageSize","isLinearized","parseFileSize","parseDate","CreationDate","ModDate","parsePageSize","parseLinearization","IsLinearized","author","Author","subject","Subject","keywords","Keywords","creator","Creator","producer","Producer","PDFFormatVersion","pageCount","linearized","assign","#reset","#updateUI","#parseFileSize","kb","mb","#parsePageSize","pageSizeInches","nonMetric","sizeInches","sizeMillimeters","nameId","exactMillimeters","intMillimeters","unit","orientation","#parseDate","metadataDate","infoDate","dateObj","#parseLinearization","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","getCharacterType","NormalizeWithNFKC","getNormalizeWithNFKC","ranges","diacriticsRegex","fromCharCode","normalize","rangesStr","log","charCodeAt","padStart","FindState","FOUND","NOT_FOUND","PENDING","FIND_TIMEOUT","MATCH_SCROLL_OFFSET_TOP","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","syllablePositions","len","hasSyllables","ignoreDashEOL","normalizationRegex","toNormalizeWithNFKC","CJK","HKDiacritics","BrokenWord","regexps","RegExp","rawDiacriticsPositions","normalized","positions","rawDiacriticsIndex","syllableIndex","shift","shiftOrigin","eol","hasDiacritics","p1","p2","p3","p4","p5","p6","p7","p8","p9","replacement","jj","j","charAt","hasTrailingDashEOL","endsWith","newCharLen","starts","Uint32Array","shifts","Int32Array","getOriginalIndex","diffs","pos","end","oldStart","oldEnd","oldLen","PDFFindController","updateMatchesCountOnProgress","visitedPagesCount","copiedExtractTextPromises","_linkService","_eventBus","onIsPageVisible","onFind","onFindBarClose","onPagesEdited","highlightMatches","_highlightMatches","pageMatches","_pageMatches","pageMatchesLength","_pageMatchesLength","_selected","_firstPageCapability","#onFind","shouldDirtyMatch","_dirtyMatch","extractText","findbarClosed","pendingTimeout","_findTimeout","nextMatch","highlightAll","updateAllPages","scrollMatchIntoView","selectedLeft","matchIndex","_scrollMatches","matchIdx","pageIdx","_offset","wrapped","_extractTextPromises","_pageContents","_pageDiffs","_hasDiacritics","_matchesCountTotal","_pagesToSearch","_pendingFindMatches","_resumePageIdx","#query","_rawQuery","_normalizedQuery","#shouldDirtyMatch","newQuery","prevQuery","newType","prevType","isEntireWord","#isEntireWord","startIdx","convertToRegExpString","#convertToRegExpString","matchDiacritics","isUnicode","addExtraWhitespaces","original","fixed","trailingSpaces","calculateMatch","#calculateMatch","pageContent","matcherResult","matchesLength","matchPos","matchLen","updatePage","nextPageMatch","pageMatchesCount","updateUIResultsCount","reverse","isUnicodePart","queryPart","caseSensitive","entireWord","flags","#extractText","deferred","textOptions","disableNormalization","pdfDoc","getTextContent","strBuf","textItem","hasEOL","#updatePage","#updateAllPages","#nextMatch","previous","findPrevious","currentPageIndex","numPageMatches","updateMatch","advanceOffsetPage","matchesReady","#matchesReady","numMatches","#nextPageMatch","#advanceOffsetPage","#updateMatch","found","#onPagesEdited","pageNumbers","pageNum","prevTextPromises","extractTextPromises","prevPageNumber","getPrevPageNumber","#onFindBarClose","requestMatchesCount","#requestMatchesCount","current","#updateUIResultsCount","matchesCount","rawQuery","MATCHES_COUNT_LIMIT","PDFFindBar","resizeObserverCallback","opened","findField","highlightAllCheckbox","caseSensitiveCheckbox","matchDiacriticsCheckbox","entireWordCheckbox","findMsg","findResultsCount","findPreviousButton","findNextButton","checkedInputs","evtName","findPrev","findMsgId","updateResultsCount","#resizeObserverCallback","findbarHeight","inputContainerHeight","HASH_CHANGE_TIMEOUT","POSITION_UPDATED_THRESHOLD","UPDATE_VIEWAREA_TIMEOUT","getCurrentHash","location","PDFHistory","eventAbortController","_initialized","_fingerprint","_isPagesLoaded","initialize","fingerprint","resetHistory","updateUrl","reInitialized","_updateUrl","bindEvents","history","_popStateInProgress","_blockHashChange","_currentHash","_numPositionUpdates","_uid","_maxUid","_destination","_position","isValidState","parseCurrentHash","pushOrReplaceState","destination","updateInternalState","_initialRotation","_initialBookmark","pageHide","unbindEvents","_updateViewareaTimeout","isValidPage","forceReplace","isDestHashesEqual","isDestArraysEqual","tryPushCurrentPosition","popStateInProgress","initialBookmark","initialRotation","#pushOrReplaceState","shouldReplace","newState","newUrl","protocol","replaceState","pushState","#tryPushCurrentPosition","temporary","position","#isValidPage","#isValidState","checkReload","perfEntry","performance","getEntriesByType","#updateInternalState","removeTemporary","#parseCurrentHash","checkNameddest","nameddest","updateViewarea","#updateViewarea","pdfOpenParams","popState","#popState","newHash","hashChanged","#pageHide","#bindEvents","#unbindEvents","destHash","pushHash","firstDest","secondDest","isEntryEqual","second","PDFLayerViewer","updateLayers","_optionalContentConfig","_optionalContentVisibility","layersCount","groupId","setVisibility","_setNestedName","fontStyle","groups","getOrder","queue","levelData","itemsDiv","order","group","getGroup","#updateLayers","getOptionalContentConfig","intent","PDFOutlineViewer","_currentOutlineItem","_currentOutlineItemCapability","_sidebarView","_outline","_pageNumberToDestHashCapability","outlineCount","loadingParams","currentOutlineItemPromise","attachment","_setStyles","bold","italic","fontWeight","totalCount","nestedCount","nestedItems","outline","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","PDFPresentationMode","fullscreenChangeAbortController","windowAbortController","contextMenuOpen","mouseScrollTimeStamp","mouseScrollDelta","touchSwipeState","request","requestFullscreen","addFullscreenChangeListeners","notifyStateChange","scaleValue","currentScaleValue","pageViewsReady","hasEqualPageSizes","removeFullscreenChangeListeners","mouseWheel","#mouseWheel","currentTime","now","storedTime","resetMouseScrollState","totalDelta","success","#notifyStateChange","enter","#enter","addWindowListeners","showControls","empty","exit","#exit","removeWindowListeners","hideControls","mouseDown","#mouseDown","contextMenu","#contextMenu","#showControls","controlsTimeout","#hideControls","#resetMouseScrollState","touchSwipe","#touchSwipe","touches","startX","pageX","startY","pageY","endX","endY","dy","absAngle","#addWindowListeners","touchSwipeBind","passive","#removeWindowListeners","#addFullscreenChangeListeners","fullscreenElement","#removeFullscreenChangeListeners","XfaLayerBuilder","annotationStorage","xfaHtml","_cancelled","viewport","parameters","dontFlip","getXfa","textDivs","update","BasePrintServiceFactory","initGlobals","createPrintService","getXfaHtmlForPrinting","printContainer","allXfaHtml","scale","PDF_TO_CSS_UNITS","xfaPage","builder","activeService","viewerApp","initialized","renderPage","activeServiceOnEntry","printAnnotationStoragePromise","scratchCanvas","PRINT_UNITS","PDF","ctx","getContext","fillStyle","fillRect","restore","printAnnotationStorage","renderContext","getViewport","ENABLE_STORAGE","renderTask","PDFPrintService","pagesOverview","_printResolution","_optionalContentConfigPromise","_printAnnotationStoragePromise","currentPage","throwIfInactive","every","pageStyleSheet","ensureOverlay","renderPages","isPureXfa","renderNextPage","renderProgress","useRenderedPage","toBlob","blob","src","wrapper","onload","onerror","performPrint","print","eventType","CustomEvent","bubbles","cancelable","getElementById","progress","progressBar","progressPerc","altKey","chrome","opera","stopImmediatePropagation","stopPropagationIfNeeded","overlayPromise","PDFPrintServiceFactory","RenderingStates","INITIAL","RUNNING","PAUSED","FINISHED","RenderableView","renderingId","renderingState","draw","CLEANUP_TIMEOUT","PDFRenderingQueue","highestPriorityPage","idleTimeout","pdfThumbnailViewer","isThumbnailViewEnabled","onIdle","printing","defineProperty","setThumbnailViewer","isHighestPriority","renderHighestPriority","currentlyVisiblePages","forceRendering","getHighestPriority","scrolledDown","preRenderExtra","ignoreDetailViews","visibleViews","numVisible","isViewFinished","detailView","firstId","lastId","visibleIds","holeId","holeView","preRenderIndex","preRenderView","renderView","finally","PDFScriptingManager","closeCapability","destroyCapability","ready","scripting","willPrintCapability","destroyScripting","objects","calculationOrder","docActions","getFieldObjects","getCalculationOrderIds","getJSActions","initScripting","updateFromSandbox","dispatchPageClose","dispatchPageOpen","_pageOpenPending","appInfo","docInfo","actions","dispatchWillSave","dispatchDidSave","dispatchWillPrint","dispatchDidPrint","destroyPromise","_visitedPages","#updateFromSandbox","isChangingPresentationMode","siblings","command","modes","pagesPromise","increaseScale","decreaseScale","elementId","setValue","#dispatchPageOpen","visitedPages","pageView","getPageView","actionsPromise","#dispatchPageClose","#initScripting","#destroyScripting","race","PdfTextExtractor","textPromise","pendingRequests","extractTextContent","requestId","pendingRequest","getAllText","Menu","triggeringButton","menuItems","openMenuAC","menuAC","onFocusOutBound","onFocusOut","menuContainer","setUpMenu","closeMenu","#closeMenu","ariaExpanded","openMenu","#openMenu","any","#onFocusOut","#setUpMenu","goToNextItem","find","findLast","toLocaleLowerCase","#goToNextItem","check","indexOf","increment","menuItem","DRAW_UPSCALE_FACTOR","MAX_NUM_SCALING_STEPS","THUMBNAIL_WIDTH","TempImageFactory","getCanvas","tempCanvas","OffscreenCanvas","alpha","PDFThumbnailView","defaultViewport","renderingQueue","pageColors","pageLabel","pdfPageRotate","placeholder","thumbnailContainer","imageContainer","draggable","getPageL10nArgs","image","checkbox","pasteButton","updateDims","thumbnailView","setPdfPage","replaceWith","addPasteButton","pasteCallback","span","toggleSelected","updateId","newId","setPageLabel","#updateDims","ratio","canvasWidth","canvasHeight","totalRotation","cancelRendering","toggleCurrent","isCurrent","ariaCurrent","getPageDrawContext","#getPageDrawContext","upscaleFactor","outputScale","limitCanvas","sx","sy","scaled","convertCanvasToImage","#convertCanvasToImage","reducedCanvas","reduceImage","drawViewport","renderContinueCallback","cont","onContinue","setImage","thumbnailCanvas","getReducedImageDims","#getReducedImageDims","#reduceImage","willReadFrequently","drawImage","reducedWidth","reducedHeight","reducedImage","reducedImageCtx","#getPageL10nArgs","hasTotal","SCROLL_OPTIONS","DRAG_THRESHOLD_IN_PIXELS","PIXELS_TO_SCROLL_WHEN_DRAGGING","SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT","PDFThumbnailViewer","draggingScaleFactor","dragAC","draggedContainer","thumbnailsPositions","lastDraggedOverIndex","selectedPages","draggedImageX","draggedImageY","draggedImageWidth","draggedImageHeight","draggedImageOffsetX","draggedImageOffsetY","dragMarker","pageNumberToRemove","currentScrollBottom","currentScrollTop","manageSaveAsButton","manageDeleteButton","manageCopyButton","manageCutButton","copiedThumbnails","copiedPageNumbers","isCut","isOneColumnView","scrollableContainerWidth","scrollableContainerHeight","manageMenu","addFileButton","scrollableContainer","copy","cut","saveAs","_manageMenu","getPageMappingForSaving","deletePages","copyPages","cutPages","toggleMenuEntries","scroll","scrollUpdated","resetView","#scrollUpdated","getThumbnail","_thumbnails","getVisibleThumbs","#getVisibleThumbs","scrollThumbnailIntoView","prevThumbnailView","shouldScroll","updateArgs","thumbnail","cleanup","#resetView","_pageLabels","firstPagePromise","firstPdfPage","#cancelRendering","setPageLabels","labels","ensurePdfPageLoaded","#ensurePdfPageLoaded","thumbView","getScrollAhead","#getScrollAhead","visibleThumbs","scrollAhead","getScaleFactor","#getScaleFactor","updateThumbnails","#updateThumbnails","newCurrentPageNumber","prevThumbnails","newThumbnails","oldThumbnails","newThumbnail","oldThumbnail","onStartDragging","#onStartDragging","draggedThumbnail","startPageNumber","selectPage","onStopDragging","#onStopDragging","isDropping","originalImageContainer","newIndex","pagesToMove","movePages","computeThumbnailsPosition","updateMenuEntries","clearSelection","#clearSelection","#copyPages","pageNumbersToCopy","pastePages","#cutPages","#pastePages","hasBeenCut","#deletePages","pagesToDelete","#updateMenuEntries","hasBeenAltered","#toggleMenuEntries","enable","moveDraggedContainer","#moveDraggedContainer","positionData","findClosestThumbnail","before","space","dragMarkerStyle","bbox","xPos","#computeThumbnailsPosition","positionsX","positionsY","positionsLastX","Float32Array","prevY","reminder","firstRightX","lastRightX","firstBottomY","w","offsetHeight","h","cx","lastSpace","thumbnailsView","isCheckbox","HTMLInputElement","focusThumbnailElement","addDragListeners","#selectPage","#addDragListeners","draggedImage","clickX","clickY","pointerId","dragPointerId","pointerDownAC","pointerDownSignal","prevScrollTop","scaleFactor","layerY","layerX","stopDragging","_e","upEv","kEv","#goToPage","#focusThumbnailElement","focusCheckbox","navigateCheckboxes","nextThumbnail","nextPageNumber","currentThumbnail","firstWithDifferentY","#findClosestThumbnail","spaceBetweenThumbnails","lastSpaceBetweenThumbnails","yPos","xArray","cy","dist1","dist2","AnnotationEditorLayerBuilder","annotationLayer","drawLayer","onAppend","structTreeLayer","clonedFrom","accessibilityManager","annotationEditorLayer","updatePageIndex","newPageIndex","clonedViewport","setClonedFrom","isInvisible","AnnotationLayerBuilder","commentManager","externalHide","linksInjected","renderForms","hasJSActionsPromise","fieldObjectsPromise","annotationCanvasMap","annotationEditorUIManager","_hasJSActionsPromise","_fieldObjectsPromise","_annotationCanvasMap","_accessibilityManager","_annotationEditorUIManager","hasJSActions","fieldObjects","getAnnotations","initAnnotationLayer","updatePresentationModeState","#initAnnotationLayer","internal","hasEditableAnnotations","injectLinkAnnotations","inferredLinks","newLinks","checkInferredLinks","addLinkAnnotations","#updatePresentationModeState","disableFormElements","section","inert","#checkInferredLinks","annotationRects","annot","quadPoints","rects","trX","trY","blX","blY","intersectAnnotations","annot1","annot2","intersections","annot1Rects","annot2Rects","intersection","intersect","areaRects","totalArea","linkAreaRects","annotationType","LINK","DOMRectToPDF","pdfPageView","pageBox","bottomLeft","getPagePoint","topRight","normalizeRect","calculateLinkPosition","rangeRects","getClientRects","domRect","rectBoundingBox","textPosition","currentContainer","currentLength","createLinkAnnotation","highlighter","_textHighlighter","begin","_convertMatches","Range","divIdx","unsafeUrl","borderStyle","Autolinker","regex","numericTLDRegex","findLinks","normalizedText","matchAll","links","emailDomain","raw","hostname","absoluteURL","addDefaultProtocol","processLinks","textContentItemsStr","BasePDFPageView","loadingId","renderError","showCanvas","startTime","recordedBBoxes","_createCanvas","onShow","hideUntilComplete","hasHCM","background","foreground","prevCanvas","updateOnFirstShow","isLastShow","resetTempCanvas","_resetCanvas","#resetTempCanvas","_drawCanvas","onCancel","onFinish","onError","cancelExtraDelay","dispatchPageRender","dispatchPageRendered","cssTransform","isDetailView","timestamp","DrawLayerBuilder","setParent","getDrawLayer","PDFPageDetailView","detailArea","renderingCancelled","keepCanvas","shouldRenderDifferentArea","#shouldRenderDifferentArea","minDetailX","minDetailY","maxDetailX","maxDetailY","maxWidth","maxHeight","paddingLeftSize","paddingRightSize","paddingTopSize","paddingBottomSize","MOVEMENT_THRESHOLD","underlyingViewUpdated","visibleWidth","visibleHeight","visiblePixels","pixelRatio","maxDetailToVisibleLinearRatio","sqrt","capPixels","maxOverflowScale","overflowScale","overflowWidth","overflowHeight","_getRenderingContext","baseContext","vWidth","vHeight","aWidth","aHeight","aMinX","aMinY","detailMinX","detailMinY","detailMaxX","detailMaxY","operationsFilter","isEmpty","canvasWrapper","_ensureCanvasWrapper","newCanvas","ariaHidden","renderingPromise","PDF_ROLE_TO_HTML_ROLE","Document","DocumentFragment","Part","Sect","Div","Aside","NonStruct","P","H","Title","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","MathMLElements","MathMLNamespace","MathMLSanitizer","sanitizer","isSanitizerSupported","Sanitizer","namespace","replaceWithChildrenElements","comments","HEADING_PATTERN","StructTreeLayerBuilder","treeDom","treePromise","elementAttributes","rawDims","elementsToAddToTextLayer","elementsToHideInTextLayer","elementsToStealFromTextLayer","getStructTree","walk","getAriaAttributes","annotationId","#setAttributes","structElement","htmlElement","alt","added","child","addImageInTextLayer","#addImageInTextLayer","pageHeight","calc","updateTextLayer","#walk","parentNodes","mathML","setHTML","kid","pop","TextAccessibilityManager","enabled","textChildren","textNodes","waitingElements","setTextMapping","compareElementPositions","#compareElementPositions","e1","e2","centerX1","centerX2","nodeIndex","addIdToAriaOwns","isRemovable","addPointerInTextLayer","disable","removePointerInTextLayer","owns","#addIdToAriaOwns","moveElementInDOM","contentElement","hasChildNodes","TextHighlighter","findController","divs","texts","_updateMatches","iIndex","mm","_renderMatches","isSelectedPage","selectedMatchIdx","prevEnd","infinity","beginText","appendTextToDiv","fromOffset","toOffset","parentLeft","i0","i1","lastDivIdx","lastOffset","highlightSuffix","n0","n1","clearedUntilDivIdx","n","TextLayerBuilder","renderingDone","textLayers","selectionChangeAbortController","textContentParams","onBefore","textContentSource","streamTextContent","includeMarkedContent","endOfContent","bindMouse","removeGlobalSelectionListener","#bindMouse","clipboardData","setData","enableGlobalSelectionListener","#removeGlobalSelectionListener","textLayerDiv","#enableGlobalSelectionListener","isPointerDown","isFirefox","prevRange","activeTextLayers","getRangeAt","intersectsNode","endDiv","modifyStart","compareBoundaryPoints","END_TO_END","START_TO_END","endContainer","endOffset","parentTextLayer","userSelect","cloneRange","DEFAULT_LAYER_PROPERTIES","LAYERS_ORDER","PDFPageView","ENABLE_FORMS","hasRestrictedScaling","layerProperties","needsRestrictedScaling","originalViewport","previousRotation","scaleRoundX","scaleRoundY","useThumbnailCanvas","directDrawing","initialOptionalContent","regularAnnotations","layers","_isStandalone","hasViewer","_container","xfaLayer","setDimensions","hasInitialVisibility","pagesColors","addLayer","#addLayer","oldDiv","layer","#setDimensions","removeProperty","updatePageNumber","newPageNumber","filterFactory","addHighlightHCMFilter","deleteMe","deletePage","dispatchLayerRendered","#dispatchLayerRendered","renderAnnotationLayer","#renderAnnotationLayer","renderAnnotationEditorLayer","#renderAnnotationEditorLayer","renderDrawLayer","#renderDrawLayer","renderXfaLayer","#renderXfaLayer","buildXfaTextContentItems","renderTextLayer","#renderTextLayer","renderStructTreeLayer","#renderStructTreeLayer","#buildXfaTextContentItems","#injectLinkAnnotations","textLayerPromise","keepAnnotationLayer","keepAnnotationEditorLayer","keepXfaLayer","keepTextLayer","keepCanvasWrapper","preserveDetailViewState","keepPdfBugGroups","_pdfBug","annotationLayerNode","annotationEditorLayerNode","xfaLayerNode","textLayerNode","canvasWrapperNode","layerIndex","toggleEditingMode","updateVisibleArea","drawingDelay","computeScale","onlyCssZoom","postponeDrawing","redrawAnnotationLayer","redrawAnnotationEditorLayer","redrawXfaLayer","redrawTextLayer","hideTextLayer","#computeScale","invScale","factor","relativeRotation","scaleX","scaleY","convertToPdfPoint","recordOperations","annotationLayerDiv","sfx","sfy","pageWidth","recordBBoxes","resultPromise","separateAnnots","annotationEditorLayerDiv","DEFAULT_CACHE_SIZE","PagesCountLimit","FORCE_SCROLL_MODE_PAGE","FORCE_LAZY_PAGE_INIT","PAUSE_EAGER_PAGE_INIT","isValidAnnotationEditorMode","PDFPageViewBuffer","buf","destroyFirstView","resize","newSize","idsToKeep","#destroyFirstView","firstView","PDFViewer","buffer","altTextManager","annotationEditorHighlightColors","containerTopLeft","editorUndoBar","printingAllowed","scrollTimeoutId","switchAnnotationEditorModeAC","switchAnnotationEditorModeTimeoutId","getAllTextInProgress","hiddenCopyElement","interruptCopyCondition","previousContainerHeight","scrollModePageState","scaleTimeoutId","signatureManager","viewerAlert","copiedPageViews","viewerVersion","_getVisiblePages","_scriptingManager","scriptingManager","removePageBorders","defaultRenderingQueue","_scrollUpdate","_resetView","updateContainerHeightCss","_pages","getCachedPageViews","_setCurrentPageNumber","resetCurrentPageView","currentPageLabel","currentScale","_currentScale","setScale","noScroll","_currentScaleValue","refresh","onePageRendered","_onePageRenderedCapability","_pagesCapability","_layerProperties","self","initializePermissions","#initializePermissions","permissions","isAllowed","PRINT_HIGH_QUALITY","PRINT","COPY","MODIFY_CONTENTS","MODIFY_ANNOTATIONS","FILL_INTERACTIVE_FORMS","onePageRenderedOrForceFetch","#onePageRenderedOrForceFetch","visibilityState","hiddenCapability","copyCallback","#copyCallback","anchorNode","containsNode","clipboard","writeText","_cancelRendering","permissionsPromise","getPermissions","_scrollMode","onBeforeDraw","onAfterDraw","preloadEditingData","updateMode","viewerElement","ensurePageViewVisible","_spreadMode","_updateSpreadMode","getPagesLeft","Language","prevPages","newPages","_location","_previousScrollMode","previousPageNumber","scrollDown","pages","_updateScrollMode","cleanupTimeouts","cleanupSwitchAnnotationEditorMode","#ensurePageViewVisible","pageIndexSet","parity","spread","dummyPage","#scrollIntoView","pageSpot","isSameScale","#isSameScale","newScale","setScaleUpdatePages","#setScaleUpdatePages","newValue","preset","origin","presetValue","previousScale","scaleDiff","pageWidthScaleFactor","#pageWidthScaleFactor","#setScale","hPadding","vPadding","pageWidthScale","pageHeightScale","horizontalScale","#resetCurrentPageView","widthScale","heightScale","boundingRect","convertToViewportPoint","_updateLocation","firstPage","normalizedScaleValue","currentPageView","topLeft","intLeft","intTop","visiblePages","numVisiblePages","newCacheSize","isSimpleLayout","stillFullyVisible","switchToEditAnnotationMode","#switchToEditAnnotationMode","pagesToRefresh","containsElement","_isContainerRtl","isHorizontalScrollbarEnabled","isVerticalScrollbarEnabled","some","firstPageView","getPagesOverview","initialOrientation","getPageAdvance","#getPageAdvance","pageLayout","yArray","currentId","expectedId","advance","updateScale","steps","ceil","#updateContainerHeightCss","#cleanupTimeouts","#cleanupSwitchAnnotationEditorMode","#preloadEditingData","STAMP","loadModel","SIGNATURE","loadSignatures","editId","isFromKeyboard","mustEnterInEditMode","updater","resetModifiedIds","idsToRefresh","noUpdate","SecondaryToolbar","presentationModeButton","printButton","downloadButton","viewBookmarkButton","firstPageButton","lastPageButton","pageRotateCwButton","pageRotateCcwButton","cursorSelectToolButton","eventDetails","cursorHandToolButton","scrollPageButton","scrollVerticalButton","scrollHorizontalButton","scrollWrappedButton","spreadNoneButton","spreadOddButton","spreadEvenButton","imageAltTextSettingsButton","documentPropertiesButton","openFileButton","setPageNumber","setPagesCount","scrollModeChanged","spreadModeChanged","cursorToolChanged","#cursorToolChanged","#scrollModeChanged","forceScrollModePage","isHorizontal","#spreadModeChanged","DEFAULT_HEIGHT_IN_PAGE","SignatureManager","addButton","tabsToAltText","clearButton","clearDescription","drawCurves","drawPlaceholder","drawPath","drawPathString","drawPoints","drawSVG","drawThickness","errorBar","errorDescription","errorTitle","extractedSignatureData","imagePath","imagePicker","imagePickerLink","imagePlaceholder","imageSVG","saveCheckbox","saveContainer","tabButtons","addSignatureToolbarButton","loadSignaturesPromise","typeInput","currentTab","currentTabAC","hasDescriptionChanged","isStorageFull","editDescriptionDialog","signatureStorage","l10nDescription","panels","typeButton","drawButton","imageButton","editSignatureElements","EditDescriptionDialog","errorUploadTitle","errorUploadDescription","errorNoDataTitle","errorNoDataDescription","initTab","initTabButtons","accept","signaturesChanged","#initTabButtons","tabCallback","buttonsArray","resetCommon","#resetCommon","resetTab","#resetTab","#initTab","initTypeTab","initDrawTab","initImageTab","disableButtons","#disableButtons","#initTypeTab","#initDrawTab","currentPointerId","drawCallback","setPointerCapture","drawWidth","drawHeight","thickness","curves","points","finishDrawAC","listenerDrawOptions","pId","releasePointerCapture","showError","#showError","#initImageTab","passiveOptions","file","files","extractSignature","dataTransfer","dropEffect","effectAllowed","#extractSignature","imageManager","getFromFile","lineData","getFromImage","bitmap","viewBox","toSVGPath","getOutlineForType","#getOutlineForType","getFromText","getOutlineForDraw","#getOutlineForDraw","getDrawnSignature","addToolbarButton","#addToolbarButton","signatureData","areContours","maxDim","outlineData","processDrawnLines","lines","innerMargin","mustSmooth","CREATE","heightInPage","deleteButton","savedCount","deleteSpan","#signaturesChanged","getSignature","reload","decompressSignature","signaturesData","outlines","renderEditButton","tabType","_drawId","#add","newCurves","compressSignature","saved","descriptionChanged","addSignature","previousDescription","signatureSVG","updateButton","editSignatureView","descriptionInput","Event","getSignaturePreview","#update","hasBeenChanged","Toolbar","colorPicker","zoomIn","zoomOut","editorCommentButton","POPUP","editorFreeTextButton","FREETEXT","editorHighlightButton","HIGHLIGHT","editorInkButton","INK","editorStampButton","telemetry","editorSignatureButton","updateToolbarDensity","#updateToolbarDensity","hasPageLabels","setPageScale","pageScaleValue","pageScale","updateLoadingIndicatorState","editorModeChanged","editorHighlightColorPicker","scaleSelect","oncontextmenu","cp","setMainHighlightColorPicker","renderMainDropdown","#editorModeChanged","editorCommentParamsToolbar","editorFreeTextParamsToolbar","editorHighlightParamsToolbar","editorInkParamsToolbar","editorStampParamsToolbar","editorSignatureParamsToolbar","resetNumPages","predefinedValueFound","customScaleOption","loading","DEFAULT_VIEW_HISTORY_CACHE_SIZE","ViewHistory","cacheSize","_initializedPromise","databaseStr","database","branch","setMultiple","properties","defaultValue","getMultiple","SIDEBAR_WIDTH_VAR","SIDEBAR_RESIZING_CLASS","UI_NOTIFICATION_CLASS","ViewsManager","hasAnimations","matchMedia","outerContainer","sidebarContainer","thumbnailButton","outlineButton","attachmentsButton","layersButton","outlinesView","attachmentsView","layersView","viewsManagerAddFileButton","viewsManagerCurrentOutlineButton","viewsManagerSelectorButton","viewsManagerSelectorOptions","viewsManagerHeaderLabel","viewsManagerStatus","isInitialViewSet","isInitialEventDispatched","onToggled","onUpdateThumbnails","pagesTitle","outlinesTitle","attachmentsTitle","layersTitle","notificationButton","hideUINotification","switchView","visibleView","setInitialView","forceOpen","isViewChanged","titleL10nId","queueMicrotask","#dispatchEvent","showUINotification","#showUINotification","#hideUINotification","onTreeLoaded","FORCE_PAGES_LOADED_TIMEOUT","ViewOnLoad","PREVIOUS","PDFViewerApplication","_initializedCapability","settled","appConfig","pdfLoadingTask","printService","pdfRenderingQueue","pdfPresentationMode","pdfDocumentProperties","pdfLinkService","pdfTextExtractor","viewsManager","pdfOutlineViewer","pdfAttachmentViewer","pdfLayerViewer","pdfCursorTools","pdfScriptingManager","store","preferences","secondaryToolbar","annotationEditorParams","imageAltTextSettings","_downloadUrl","_eventBusAbortController","_windowAbortController","_globalAbortController","documentInfo","_contentDispositionFilename","_contentLength","_saveInProgress","_wheelUnusedTicks","_wheelUnusedFactor","_touchManager","_touchUnusedTicks","_touchUnusedFactor","_PDFBug","_hasAnnotationEditors","_title","_isCtrlKeyDown","_caretBrowsing","_isScrolling","_printPermissionPromise","_parseHashParams","getElementsByTagName","appContainer","_initializeViewerComponents","bindWindowEvents","loadPDFBug","PDFBug","loadCSS","init","debugOpts","StepperManager","setEventBus","_cleanup","_scriptingDocProperties","newAltTextDialog","altTextDialog","addSignatureDialog","editSignatureDialog","editCommentDialog","editorCommentsSidebar","editorCommentsSidebarResizer","editorCommentsSidebarList","editorCommentsSidebarCount","editorCommentsSidebarTitle","editorCommentsSidebarCloseButton","findBar","principalContainer","altTextSettingsDialog","documentProperties","_docFilename","_docTitle","imageAltTextSettingsSeparator","supportsFullscreen","passwordOverlay","passwordPrompt","run","config","queryString","search","validateFileURL","fileInput","_openFileInput","msg","togglePrintingButtons","_hideViewBookmark","updateZoom","zoomReset","touchPinchCallback","prevDistance","distance","newScaleFactor","_accumulateFactor","PIXELS_PER_LINE_SCALE","ticks","_accumulateTicks","touchPinchEndCallback","fullscreenEnabled","loadingBar","barElement","setTitleUsingUrl","downloadUrl","decodeURIComponent","setTitle","editorIndicator","_unblockDocumentLoadEvent","_annotationStorageModified","promises","workerParams","apiParams","loadingTask","onPassword","onProgress","load","missing","_documentError","saveDocument","editorStats","stats","downloadOrSave","moreInfo","_otherError","moreInfoText","stack","lineNumber","pageLayoutPromise","getPageLayout","pageModePromise","getPageMode","openActionPromise","getOpenAction","storedPromise","fingerprints","zoom","sidebarView","_initializeAnnotationStorageCallbacks","timeStamp","stored","pageMode","openAction","_initializePdfHistory","initialDest","_initializeAutoPrint","getOutline","getAttachments","_initializePageLabels","_initializeMetadata","jsActions","triggerAutoPrint","js","triggerPrinting","hasStructTree","pdfTitle","IsXFAPresent","IsAcroFormPresent","IsSignaturesPresent","getPageLabels","numLabels","standardLabels","emptyLabels","onSetModified","beforeUnload","onResetModified","onAnnotationEditor","storedHash","setRotation","setViewerModes","beforePrint","alert","afterPrint","resetModified","rotatePages","requestPresentationMode","onResize","onHashchange","onPageRender","onPageRendered","onUpdateViewarea","onPageChanging","onScaleChanging","onRotationChanging","onSidebarViewChanged","onPageMode","onNamedAction","onPageNumberChanged","onViewerModesChanged","onImageAltTextSettings","onFindFromUrlHash","onUpdateFindMatchesCount","onUpdateFindControlState","onFileInputChange","onOpenFile","onSavePagesEditedPDF","isPinchingDisabled","isPinchingStopped","onPinching","onPinchEnd","addWindowResolutionChange","mediaQueryList","onWheel","onKeyDown","onKeyUp","_lastScrollTop","_lastScrollLeft","scrollendTimeoutID","scrollAbortController","scrollend","unbindWindowEvents","testingClose","extractParams","modifiedPdfBytes","extractPages","prop","wholeTicks","trunc","newFactor","blockUnblockOnload","scriptingReady","HOSTED_VIEWER_ORIGINS","viewerOrigin","fileOrigin","exp","isBuiltInMac","isPinchToZoom","deltaZ","DOM_DELTA_PAGE","sign","closeSecondaryToolbar","closeEditorUndoBar","isViewerInPresentationMode","handled","ensureViewerFocused","cmd","curElement","curElementTagName","isContentEditable","turnPage","turnOnlyIfPageFit","returnValue","AppConstants","PDFViewerApplicationConstants","PDFViewerApplicationOptions","getViewerConfiguration","createAutomatically","altTextSettingsCloseButton","webViewerLoad","readyState"],"sourceRoot":""} |