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;EAC1CgC,UAAUA,CAAA,EAAG;IACX,KAAK,CAACA,UAAU,CAAC,CAAC;IAClB,IAAI,CAACqD,WAAW,GAAGn4D,UAAU,CAACI,IAAI;IAClC,IAAI,CAACu4D,WAAW,GAAGt4D,UAAU,CAACd,IAAI;EACpC;EAGA,IAAIgP,UAAUA,CAAC1C,IAAI,EAAE,CAAC;EAEtB0tD,iBAAiBA,CAAA,EAAG,CAAC;EAGrB,IAAI/qD,UAAUA,CAAC3C,IAAI,EAAE,CAAC;EAEtB+sD,iBAAiBA,CAAA,EAAG,CAAC;AACvB;;;ACnBwE;AAKzC;AAOR;AACgD;AACf;AACZ;AACG;AACD;AACG;AAC0B;AACT;AACtB;AAC4B;AACb;AACF;AAEzD36D,UAAU,CAACwhE,WAAW,GAAG;EACvB17C,sBAAsB;EACtBsF,eAAe;EACfkB,QAAQ;EACR7Z,SAAS;EACTyxB,WAAW;EACXpjB,UAAU;EACV5a,gBAAgB;EAChBuR,iBAAiB;EACjByuB,UAAU;EACV/kB,cAAc;EACd8lC,WAAW;EACX8H,mBAAmB;EACnBwS,mBAAmB;EACnB1M,SAAS;EACTnmD,WAAW;EACX/N,eAAe;EACfoB,UAAU;EACV8jB,iBAAiB;EACjBzjB,UAAU;EACVg8C,sBAAsB;EACtB2F,gBAAgB;EAChB6C,eAAeA,EAAAA,eAAAA;AACjB,CAAC","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/pdf_find_utils.js","webpack://pdf.js/./web/pdf_find_controller.js","webpack://pdf.js/./web/pdf_link_service.js","webpack://pdf.js/./web/annotation_layer_builder.js","webpack://pdf.js/./web/download_manager.js","webpack://pdf.js/./web/event_utils.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/pdf_history.js","webpack://pdf.js/./web/annotation_editor_layer_builder.js","webpack://pdf.js/./web/app_options.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/xfa_layer_builder.js","webpack://pdf.js/./web/pdf_page_view.js","webpack://pdf.js/./web/generic_scripting.js","webpack://pdf.js/./web/pdf_scripting_manager.js","webpack://pdf.js/./web/pdf_scripting_manager.component.js","webpack://pdf.js/./web/pdf_rendering_queue.js","webpack://pdf.js/./web/pdf_viewer.js","webpack://pdf.js/./web/pdf_single_page_viewer.js","webpack://pdf.js/./web/pdf_viewer.component.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 build,\n ColorPicker,\n createValidAbsoluteUrl,\n DOMSVGFactory,\n DrawLayer,\n FeatureTest,\n fetchData,\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 MathClamp,\n noContextMenu,\n normalizeUnicode,\n OPS,\n OutputScale,\n PasswordResponses,\n PDFDataRangeTransport,\n PDFDateString,\n PDFWorker,\n PermissionFlag,\n PixelsPerInch,\n RenderingCancelledException,\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 build,\n ColorPicker,\n createValidAbsoluteUrl,\n DOMSVGFactory,\n DrawLayer,\n FeatureTest,\n fetchData,\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 MathClamp,\n noContextMenu,\n normalizeUnicode,\n OPS,\n OutputScale,\n PasswordResponses,\n PDFDataRangeTransport,\n PDFDateString,\n PDFWorker,\n PermissionFlag,\n PixelsPerInch,\n RenderingCancelledException,\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 RenderingStates = {\n INITIAL: 0,\n RUNNING: 1,\n PAUSED: 2,\n FINISHED: 3,\n};\n\nconst PresentationModeState = {\n UNKNOWN: 0,\n NORMAL: 1,\n CHANGING: 2,\n FULLSCREEN: 3,\n};\n\nconst SidebarView = {\n UNKNOWN: -1,\n NONE: 0,\n THUMBS: 1, // Default value.\n OUTLINE: 2,\n ATTACHMENTS: 3,\n LAYERS: 4,\n};\n\nconst 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 = MathClamp(val, 0, 100);\n\n if (isNaN(val)) {\n this.#classList.add(\"indeterminate\");\n return;\n }\n this.#classList.remove(\"indeterminate\");\n\n this.#style.setProperty(\"--progressBar-percent\", `${this.#percent}%`);\n }\n\n setWidth(viewer) {\n if (!viewer) {\n return;\n }\n const container = viewer.parentNode;\n const scrollbarWidth = container.offsetWidth - viewer.offsetWidth;\n if (scrollbarWidth > 0) {\n this.#style.setProperty(\n \"--progressBar-end-offset\",\n `${scrollbarWidth}px`\n );\n }\n }\n\n setDisableAutoFetch(delay = /* ms = */ 5000) {\n if (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 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 RenderingStates,\n SCROLLBAR_PADDING,\n scrollIntoView,\n ScrollMode,\n SidebarView,\n SpreadMode,\n TextLayerMode,\n toggleCheckedBtn,\n toggleExpandedBtn,\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\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 /* eslint-disable no-irregular-whitespace */\n NormalizeWithNFKC ||= ` ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩`;\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\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 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 if (ranges.join(\"\") !== NormalizeWithNFKC) {\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(\"./interfaces\").IPDFLinkService} IPDFLinkService */\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 =\n /([.*+?^${}()|[\\]\\\\])|(\\p{P})|(\\s+)|(\\p{M})|(\\p{L})/gu;\nconst NOT_DIACRITIC_FROM_END_REG_EXP = /([^\\p{M}])\\p{M}*$/u;\nconst NOT_DIACRITIC_FROM_START_REG_EXP = /^\\p{M}*([^\\p{M}])/u;\n\n// The range [AC00-D7AF] corresponds to the Hangul syllables.\n// The few other chars are some CJK Compatibility Ideographs.\nconst SYLLABLES_REG_EXP = /[\\uAC00-\\uD7AF\\uFA6C\\uFACF-\\uFAD1\\uFAD5-\\uFAD7]+/g;\nconst SYLLABLES_LENGTHS = new Map();\n// When decomposed (in using NFD) the above syllables will start\n// with one of the chars in this regexp.\nconst FIRST_CHAR_SYLLABLES_REG_EXP =\n \"[\\\\u1100-\\\\u1112\\\\ud7a4-\\\\ud7af\\\\ud84a\\\\ud84c\\\\ud850\\\\ud854\\\\ud857\\\\ud85f]\";\n\nconst NFKC_CHARS_TO_NORMALIZE = new Map();\n\nlet noSyllablesRegExp = null;\nlet withSyllablesRegExp = null;\n\nfunction normalize(text, 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 {IPDFLinkService} linkService - The navigation/linking service.\n * @property {EventBus} eventBus - The application event bus.\n * @property {boolean} [updateMatchesCountOnProgress] - True if the matches\n * count must be updated on progress or only when the last page is reached.\n * The default value is `true`.\n */\n\n/**\n * Provides search functionality to find a given string in a PDF document.\n */\nclass PDFFindController {\n #state = null;\n\n #updateMatchesCountOnProgress = true;\n\n #visitedPagesCount = 0;\n\n /**\n * @param {PDFFindControllerOptions} options\n */\n constructor({ linkService, eventBus, updateMatchesCountOnProgress = true }) {\n this._linkService = linkService;\n this._eventBus = eventBus;\n this.#updateMatchesCountOnProgress = updateMatchesCountOnProgress;\n\n /**\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 }\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\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 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 `[ ]*\\\\${p1}[ ]*`;\n }\n if (p2) {\n // Allow whitespaces around punctuation signs.\n return `[ ]*${p2}[ ]*`;\n }\n if (p3) {\n // Replace spaces by \\s+ to be sure to match any spaces.\n return \"[ ]+\";\n }\n if (matchDiacritics) {\n return p4 || p5;\n }\n\n if (p4) {\n // Diacritics are removed with few exceptions.\n return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : \"\";\n }\n\n // A letter has been matched and it can be followed by any diacritics\n // in normalized text.\n if (hasDiacritics) {\n isUnicode = true;\n return `${p5}\\\\p{M}*`;\n }\n return p5;\n }\n );\n\n const trailingSpaces = \"[ ]*\";\n if (query.endsWith(trailingSpaces)) {\n // The [ ]* has been added in order to help to match \"foo . bar\" but\n // it doesn't make sense to match some whitespaces after the dot\n // when it's the last character.\n query = query.slice(0, query.length - trailingSpaces.length);\n }\n\n if (matchDiacritics) {\n // aX must not match aXY.\n if (hasDiacritics) {\n DIACRITICS_EXCEPTION_STR ||= String.fromCharCode(\n ...DIACRITICS_EXCEPTION\n );\n\n isUnicode = true;\n query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\\\p{M}]|$)`;\n }\n }\n\n return [isUnicode, query];\n }\n\n #calculateMatch(pageIndex) {\n 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 #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 2015 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { 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 * @implements {IPDFLinkService}\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 ? this.pdfDocument.numPages : 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: \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 */\n goToXY(pageNumber, x, y) {\n this.pdfViewer.scrollPageIntoView({\n pageNumber,\n destArray: [null, { name: \"XYZ\" }, x, y],\n ignoreDestinationZoom: true,\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 .\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.openOrDownloadData` 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\n/**\n * @implements {IPDFLinkService}\n */\nclass SimpleLinkService extends PDFLinkService {\n setDocument(pdfDocument, baseUrl = null) {}\n}\n\nexport { LinkTarget, PDFLinkService, SimpleLinkService };\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/** @typedef {import(\"./interfaces\").IDownloadManager} IDownloadManager */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\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\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 {IPDFLinkService} linkService\n * @property {IDownloadManager} [downloadManager]\n * @property {boolean} [enableComment]\n * @property {boolean} [enableScripting]\n * @property {Promise} [hasJSActionsPromise]\n * @property {Promise> | null>}\n * [fieldObjectsPromise]\n * @property {Map} [annotationCanvasMap]\n * @property {TextAccessibilityManager} [accessibilityManager]\n * @property {AnnotationEditorUIManager} [annotationEditorUIManager]\n * @property {function} [onAppend]\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\n/**\n * @typedef {Object} InjectLinkAnnotationsOptions\n * @property {Array} inferredLinks\n * @property {PageViewport} viewport\n * @property {StructTreeLayerBuilder} [structTreeLayer]\n */\n\nclass AnnotationLayerBuilder {\n #annotations = 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 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.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} 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\n if (annotations.length === 0) {\n this.#annotations = annotations;\n\n this.hide(/* internal = */ true);\n return;\n }\n\n this.#initAnnotationLayer(viewport, structTreeLayer);\n\n await this.annotationLayer.render({\n annotations,\n imageResourcesPath: this.imageResourcesPath,\n renderForms: this.renderForms,\n linkService: this.linkService,\n downloadManager: this.downloadManager,\n annotationStorage: this.annotationStorage,\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 page: this.pdfPage,\n viewport: viewport.clone({ dontFlip: true }),\n structTreeLayer,\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 {InjectLinkAnnotationsOptions} options\n * @returns {Promise} A promise that is resolved when the inferred links\n * are added to the annotation layer.\n */\n async injectLinkAnnotations({\n inferredLinks,\n viewport,\n structTreeLayer = null,\n }) {\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 if (!this.annotationLayer) {\n this.#initAnnotationLayer(viewport, structTreeLayer);\n setLayerDimensions(this.div, viewport);\n }\n\n await this.annotationLayer.addLinkAnnotations(newLinks, this.linkService);\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 2013 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces\").IDownloadManager} IDownloadManager */\n\nimport { createValidAbsoluteUrl, isPdfFile } from \"pdfjs-lib\";\n\nif (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"CHROME || GENERIC\")) {\n throw new Error(\n 'Module \"pdfjs-web/download_manager\" shall not be used ' +\n \"outside CHROME and GENERIC builds.\"\n );\n}\n\nfunction download(blobUrl, filename) {\n const a = document.createElement(\"a\");\n if (!a.click) {\n throw new Error('DownloadManager: \"a.click()\" is not supported.');\n }\n a.href = blobUrl;\n a.target = \"_parent\";\n // Use a.download if available. This increases the likelihood that\n // the file is downloaded instead of opened by another PDF plugin.\n if (\"download\" in a) {\n a.download = filename;\n }\n // must be in the document for recent Firefox versions,\n // otherwise .click() is ignored.\n (document.body || document.documentElement).append(a);\n a.click();\n a.remove();\n}\n\n/**\n * @implements {IDownloadManager}\n */\nclass DownloadManager {\n #openBlobUrls = new WeakMap();\n\n downloadData(data, filename, contentType) {\n const blobUrl = URL.createObjectURL(\n new Blob([data], { type: contentType })\n );\n download(blobUrl, filename);\n }\n\n /**\n * @returns {boolean} Indicating if the data was opened.\n */\n openOrDownloadData(data, filename, dest = null) {\n const isPdfData = isPdfFile(filename);\n const contentType = isPdfData ? \"application/pdf\" : \"\";\n\n if (\n (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"COMPONENTS\")) &&\n isPdfData\n ) {\n let blobUrl = this.#openBlobUrls.get(data);\n if (!blobUrl) {\n blobUrl = URL.createObjectURL(new Blob([data], { type: contentType }));\n this.#openBlobUrls.set(data, blobUrl);\n }\n let viewerUrl;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n // The current URL is the viewer, let's use it and append the file.\n viewerUrl = \"?file=\" + encodeURIComponent(blobUrl + \"#\" + filename);\n } else if (PDFJSDev.test(\"CHROME\")) {\n // In the Chrome extension, the URL is rewritten using the history API\n // in viewer.js, so an absolute URL must be generated.\n viewerUrl =\n // eslint-disable-next-line no-undef\n chrome.runtime.getURL(\"/content/web/viewer.html\") +\n \"?file=\" +\n encodeURIComponent(blobUrl + \"#\" + filename);\n }\n if (dest) {\n viewerUrl += `#${escape(dest)}`;\n }\n\n try {\n window.open(viewerUrl);\n return true;\n } catch (ex) {\n console.error(\"openOrDownloadData:\", ex);\n // Release the `blobUrl`, since opening it failed, and fallback to\n // downloading the PDF file.\n URL.revokeObjectURL(blobUrl);\n this.#openBlobUrls.delete(data);\n }\n }\n\n this.downloadData(data, filename, contentType);\n return false;\n }\n\n download(data, url, filename) {\n let blobUrl;\n if (data) {\n blobUrl = URL.createObjectURL(\n new Blob([data], { type: \"application/pdf\" })\n );\n } else {\n if (!createValidAbsoluteUrl(url, \"http://example.com\")) {\n console.error(`download - not a valid URL: ${url}`);\n return;\n }\n blobUrl = url + \"#pdfjs.action=download\";\n }\n download(blobUrl, filename);\n }\n}\n\nexport { DownloadManager };\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","/**\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 * // []\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 \"�\";\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\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} 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} keys - Translation keys to format.\n * @param {Function} method - Formatting function.\n * @returns {Promise>}\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} keys\n * @returns {Promise>}\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} keys\n * @returns {Promise>}\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}\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} 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} 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} keys\n * @param {{Array<{value: string, attributes: Object}>}} translations\n *\n * @returns {Set}\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} 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 *

\n *

\n * ```\n *\n * @param {Element} element - Element to set attributes on\n * @param {string} id - l10n-id string\n * @param {Object} 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} 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} elements\n * @param {Array} 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}\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/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n\n/**\n * NOTE: The L10n-implementations should use lowercase language-codes\n * internally.\n * @implements {IL10n}\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\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\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\n/**\n * @implements {IL10n}\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 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { isValidRotation, parseQueryString } from \"./ui_utils.js\";\nimport { 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 {IPDFLinkService} linkService - The navigation/linking service.\n * @property {EventBus} eventBus - The application event bus.\n */\n\n/**\n * @typedef {Object} InitializeParameters\n * @property {string} fingerprint - The PDF document's unique fingerprint.\n * @property {boolean} [resetHistory] - Reset the browsing history.\n * @property {boolean} [updateUrl] - Attempt to update the document URL, with\n * the current hash, when pushing/replacing browser history entries.\n */\n\n/**\n * @typedef {Object} PushParameters\n * @property {string} [namedDest] - The named destination. If absent, a\n * stringified version of `explicitDest` is used.\n * @property {Array} explicitDest - The explicit destination array.\n * @property {number} pageNumber - The page to which the destination points.\n */\n\nfunction getCurrentHash() {\n return document.location.hash;\n}\n\nclass PDFHistory {\n #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 2022 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/editor/tools.js\").AnnotationEditorUIManager} AnnotationEditorUIManager */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n// 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 {PDFPageProxy} pdfPage\n * @property {IL10n} [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 */\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 /**\n * @param {AnnotationEditorLayerBuilderOptions} options\n */\n constructor(options) {\n this.pdfPage = options.pdfPage;\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 }\n\n /**\n * @param {AnnotationEditorLayerBuilderRenderOptions} options\n * @returns {Promise}\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.pdfPage.pageNumber - 1,\n l10n: this.l10n,\n viewport: clonedViewport,\n annotationLayer: this.#annotationLayer,\n textLayer: this.#textLayer,\n drawLayer: this.#drawLayer,\n });\n\n const parameters = {\n viewport: clonedViewport,\n div,\n annotations: null,\n intent,\n };\n\n this.annotationEditorLayer.render(parameters);\n this.show();\n }\n\n cancel() {\n this._cancelled = true;\n\n if (!this.div) {\n return;\n }\n this.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 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 (function () {\n if (isIOS || isAndroid) {\n compatParams.set(\"maxCanvasPixels\", 5242880);\n }\n })();\n\n // Don't use system fonts on Android (issue 18210).\n // Support: Android\n (function () {\n if (isAndroid) {\n compatParams.set(\"useSystemFonts\", false);\n }\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 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\" || PDFJSDev.test(\"TESTING\"),\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 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 || LIB\")) {\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 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 *

abcdefghi

\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 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}<>]])+|\\b[\\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 (URL.canParse(`http://${emailDomain}`)) {\n raw = url.startsWith(\"mailto:\") ? url : `mailto:${url}`;\n } else {\n continue;\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 { RenderingCancelledException } from \"pdfjs-lib\";\nimport { RenderingStates } from \"./ui_utils.js\";\n\nclass BasePDFPageView {\n #loadingId = null;\n\n #minDurationToUpdateCanvas = 0;\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 recordedGroups = null;\n\n renderingQueue = null;\n\n renderTask = null;\n\n resume = null;\n\n constructor(options) {\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.recordedGroups ??= renderTask.recordedGroups;\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} DrawLayerBuilderOptions\n * @property {number} pageIndex\n */\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 {DrawLayerBuilderOptions} options\n */\n constructor(options) {\n this.pageIndex = options.pageIndex;\n }\n\n /**\n * @param {DrawLayerBuilderRenderOptions} options\n * @returns {Promise}\n */\n async render({ intent = \"display\" }) {\n if (intent !== \"display\" || this.#drawLayer || this._cancelled) {\n return;\n }\n this.#drawLayer = new DrawLayer({\n pageIndex: this.pageIndex,\n });\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 \"./ui_utils.js\";\n\n/** @typedef {import(\"./interfaces\").IRenderableView} IRenderableView */\n\n/**\n * @implements {IRenderableView}\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(value) {\n this.renderingCancelled = false;\n super.renderingState = value;\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(canvas, transform);\n const recordedGroups = this.pdfPage.recordedGroups;\n\n if (!recordedGroups || !this.enableOptimizedPartialRendering) {\n return { ...baseContext, recordOperations: false };\n }\n\n // TODO: There is probably a better data structure for this.\n // The indexes are always checked in increasing order, so we can just try\n // to build a pre-sorted array which should have faster lookups.\n // Needs benchmarking.\n const filteredIndexes = new Set();\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 for (let i = 0, ii = recordedGroups.length; i < ii; i++) {\n const group = recordedGroups[i];\n if (\n group.minX <= detailMaxX &&\n group.maxX >= detailMinX &&\n group.minY <= detailMaxY &&\n group.maxY >= detailMinY\n ) {\n filteredIndexes.add(group.idx);\n group.dependencies.forEach(filteredIndexes.add, filteredIndexes);\n }\n }\n\n return {\n ...baseContext,\n recordOperations: false,\n filteredOperationIndexes: filteredIndexes,\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.setAttribute(\"aria-hidden\", \"true\");\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 { 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 H: \"heading\",\n Title: null,\n FENote: \"note\",\n // Sub-block level structure type\n Sub: \"group\",\n // General inline level structure types\n Lbl: null,\n Span: null,\n Em: null,\n Strong: null,\n Link: \"link\",\n Annot: \"note\",\n Form: \"form\",\n // Ruby and Warichu structure types\n Ruby: null,\n RB: null,\n RT: null,\n RP: null,\n Warichu: null,\n WT: null,\n WP: null,\n // List standard structure types\n L: \"list\",\n LI: \"listitem\",\n LBody: null,\n // Table standard structure types\n Table: \"table\",\n TR: \"row\",\n TH: \"columnheader\",\n TD: \"cell\",\n THead: \"columnheader\",\n TBody: null,\n TFoot: null,\n // Standard structure type Caption\n Caption: null,\n // Standard structure type Figure\n Figure: \"figure\",\n // Standard structure type Formula\n Formula: null,\n // standard structure type Artifact\n Artifact: null,\n};\n\nconst HEADING_PATTERN = /^H(\\d+)$/;\n\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 /**\n * @param {StructTreeLayerBuilderOptions} options\n */\n constructor(pdfPage, rawDims) {\n this.#promise = pdfPage.getStructTree();\n this.#rawDims = rawDims;\n }\n\n /**\n * @returns {Promise}\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 let attrs = this.#elementAttributes.get(child.id);\n if (!attrs) {\n attrs = new Map();\n this.#elementAttributes.set(child.id, attrs);\n }\n attrs.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 addElementsToTextLayer() {\n if (!this.#elementsToAddToTextLayer) {\n return;\n }\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\n #walk(node) {\n if (!node) {\n return null;\n }\n\n const element = document.createElement(\"span\");\n if (\"role\" in node) {\n const { role } = node;\n const match = role.match(HEADING_PATTERN);\n if (match) {\n element.setAttribute(\"role\", \"heading\");\n element.setAttribute(\"aria-level\", match[1]);\n } else if (PDF_ROLE_TO_HTML_ROLE[role]) {\n element.setAttribute(\"role\", PDF_ROLE_TO_HTML_ROLE[role]);\n }\n if (role === \"Figure\" && this.#addImageInTextLayer(node, element)) {\n return element;\n }\n }\n\n this.#setAttributes(node, element);\n\n if (node.children) {\n if (node.children.length === 1 && \"id\" in node.children[0]) {\n // Often there is only one content node so just set the values on the\n // parent node to avoid creating an extra span.\n this.#setAttributes(node.children[0], element);\n } else {\n for (const kid of node.children) {\n element.append(this.#walk(kid));\n }\n }\n }\n return element;\n }\n}\n\nexport { StructTreeLayerBuilder };\n","/* Copyright 2022 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { binarySearchFirstItem } from \"./ui_utils.js\";\n\n/**\n * This class aims to provide some methods:\n * - to reorder elements in the DOM with respect to the visual order;\n * - to create a link, using aria-owns, between spans in the textLayer and\n * annotations in the annotationLayer. The goal is to help to know\n * where the annotations are in the text flow.\n */\nclass TextAccessibilityManager {\n #enabled = false;\n\n #textChildren = null;\n\n #textNodes = new Map();\n\n #waitingElements = new Map();\n\n setTextMapping(textDivs) {\n this.#textChildren = textDivs;\n }\n\n /**\n * Compare the positions of two elements, it must correspond to\n * the visual ordering.\n *\n * @param {HTMLElement} e1\n * @param {HTMLElement} e2\n * @returns {number}\n */\n static #compareElementPositions(e1, e2) {\n const rect1 = e1.getBoundingClientRect();\n const rect2 = e2.getBoundingClientRect();\n\n if (rect1.width === 0 && rect1.height === 0) {\n return +1;\n }\n\n if (rect2.width === 0 && rect2.height === 0) {\n return -1;\n }\n\n const top1 = rect1.y;\n const bot1 = rect1.y + rect1.height;\n const mid1 = rect1.y + rect1.height / 2;\n\n const top2 = rect2.y;\n const bot2 = rect2.y + rect2.height;\n const mid2 = rect2.y + rect2.height / 2;\n\n if (mid1 <= top2 && mid2 >= bot1) {\n return -1;\n }\n\n if (mid2 <= top1 && mid1 >= bot2) {\n return +1;\n }\n\n const centerX1 = rect1.x + rect1.width / 2;\n const centerX2 = rect2.x + rect2.width / 2;\n\n return centerX1 - centerX2;\n }\n\n /**\n * Function called when the text layer has finished rendering.\n */\n enable() {\n if (this.#enabled) {\n throw new Error(\"TextAccessibilityManager is already enabled.\");\n }\n if (!this.#textChildren) {\n throw new Error(\"Text divs and strings have not been set.\");\n }\n\n this.#enabled = true;\n this.#textChildren = this.#textChildren.slice();\n this.#textChildren.sort(TextAccessibilityManager.#compareElementPositions);\n\n if (this.#textNodes.size > 0) {\n // Some links have been made before this manager has been disabled, hence\n // we restore them.\n const textChildren = this.#textChildren;\n for (const [id, nodeIndex] of this.#textNodes) {\n const element = document.getElementById(id);\n if (!element) {\n // If the page was *fully* reset the element no longer exists, and it\n // will be re-inserted later (i.e. when the annotationLayer renders).\n this.#textNodes.delete(id);\n continue;\n }\n this.#addIdToAriaOwns(id, textChildren[nodeIndex]);\n }\n }\n\n for (const [element, isRemovable] of this.#waitingElements) {\n this.addPointerInTextLayer(element, isRemovable);\n }\n this.#waitingElements.clear();\n }\n\n disable() {\n if (!this.#enabled) {\n return;\n }\n\n // Don't clear this.#textNodes which is used to rebuild the aria-owns\n // in case it's re-enabled at some point.\n\n this.#waitingElements.clear();\n this.#textChildren = null;\n this.#enabled = false;\n }\n\n /**\n * Remove an aria-owns id from a node in the text layer.\n * @param {HTMLElement} element\n */\n removePointerInTextLayer(element) {\n if (!this.#enabled) {\n this.#waitingElements.delete(element);\n return;\n }\n\n const children = this.#textChildren;\n if (!children || children.length === 0) {\n return;\n }\n\n const { id } = element;\n const nodeIndex = this.#textNodes.get(id);\n if (nodeIndex === undefined) {\n return;\n }\n\n const node = children[nodeIndex];\n\n this.#textNodes.delete(id);\n let owns = node.getAttribute(\"aria-owns\");\n if (owns?.includes(id)) {\n owns = owns\n .split(\" \")\n .filter(x => x !== id)\n .join(\" \");\n if (owns) {\n node.setAttribute(\"aria-owns\", owns);\n } else {\n node.removeAttribute(\"aria-owns\");\n node.setAttribute(\"role\", \"presentation\");\n }\n }\n }\n\n #addIdToAriaOwns(id, node) {\n const owns = node.getAttribute(\"aria-owns\");\n if (!owns?.includes(id)) {\n node.setAttribute(\"aria-owns\", owns ? `${owns} ${id}` : id);\n }\n node.removeAttribute(\"role\");\n }\n\n /**\n * Find the text node which is the nearest and add an aria-owns attribute\n * in order to correctly position this editor in the text flow.\n * @param {HTMLElement} element\n * @param {boolean} isRemovable\n * @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 elementToCompare = contentElement || element;\n const index = binarySearchFirstItem(\n children,\n node =>\n TextAccessibilityManager.#compareElementPositions(\n elementToCompare,\n node\n ) < 0\n );\n\n if (index === 0) {\n children[0].before(element);\n } else {\n children[index - 1].after(element);\n }\n\n 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] = \"Item 0\" and texts[0] = \"Item 0\";\n *\n * @param {Array} divs\n * @param {Array} 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}\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 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 (!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 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 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(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { XfaLayer } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} XfaLayerBuilderOptions\n * @property {PDFPageProxy} pdfPage\n * @property {AnnotationStorage} [annotationStorage]\n * @property {IPDFLinkService} 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} 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 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/optional_content_config\").OptionalContentConfig} OptionalContentConfig */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n/** @typedef {import(\"./interfaces\").IRenderableView} IRenderableView */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n\nimport {\n AbortException,\n AnnotationMode,\n OutputScale,\n PixelsPerInch,\n setLayerDimensions,\n shadow,\n} from \"pdfjs-lib\";\nimport {\n approximateFraction,\n calcRound,\n DEFAULT_SCALE,\n floorToDivide,\n RenderingStates,\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 { 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} [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 {IL10n} [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 */\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\n/**\n * @implements {IRenderableView}\n */\nclass PDFPageView extends BasePDFPageView {\n #annotationMode = AnnotationMode.ENABLE_FORMS;\n\n #canvasWrapper = 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 /**\n * @param {PDFPageViewOptions} options\n */\n constructor(options) {\n super(options);\n\n const container = options.container;\n const defaultViewport = options.defaultViewport;\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\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\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 #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 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 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?.addElementsToTextLayer();\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 inferredLinks: Autolinker.processLinks(this),\n viewport: this.viewport,\n structTreeLayer: this.structTreeLayer,\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} [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 }\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) {\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 this.enableOptimizedPartialRendering && !this.recordedGroups,\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 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 // 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),\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 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 pageIndex: this.id,\n });\n await this.#renderDrawLayer();\n this.drawLayer.setParent(canvasWrapper);\n\n this.annotationEditorLayer ||= new AnnotationEditorLayerBuilder({\n uiManager: annotationEditorUIManager,\n pdfPage,\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 onAppend: annotationEditorLayerDiv => {\n this.#addLayer(annotationEditorLayerDiv, \"annotationEditorLayer\");\n },\n });\n this.#renderAnnotationEditorLayer();\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 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 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n\nimport { apiPageLayoutToViewerModes, RenderingStates } from \"./ui_utils.js\";\nimport { 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 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 { docProperties, GenericScripting } from \"./generic_scripting.js\";\nimport { PDFScriptingManager } from \"./pdf_scripting_manager.js\";\n\nclass PDFScriptingManagerComponents extends PDFScriptingManager {\n constructor(options) {\n // The default viewer already handles adding/removing of DOM events,\n // hence limit this to only the viewer components.\n if (!options.externalServices) {\n window.addEventListener(\"updatefromsandbox\", event => {\n options.eventBus.dispatch(\"updatefromsandbox\", {\n source: window,\n detail: event.detail,\n });\n });\n }\n\n options.externalServices ||= {\n createScripting: () => new GenericScripting(options.sandboxBundleSrc),\n };\n options.docProperties ||= pdfDocument => docProperties(pdfDocument);\n super(options);\n }\n}\n\nexport { PDFScriptingManagerComponents as PDFScriptingManager };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces\").IRenderableView} IRenderableView */\n/** @typedef {import(\"./pdf_viewer\").PDFViewer} PDFViewer */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_thumbnail_viewer\").PDFThumbnailViewer} PDFThumbnailViewer */\n\nimport { RenderingCancelledException } from \"pdfjs-lib\";\nimport { RenderingStates } from \"./ui_utils.js\";\n\nconst CLEANUP_TIMEOUT = 30000;\n\n/**\n * Controls rendering of the views for pages and thumbnails.\n */\nclass PDFRenderingQueue {\n constructor() {\n this.pdfViewer = null;\n this.pdfThumbnailViewer = null;\n this.onIdle = null;\n this.highestPriorityPage = null;\n /** @type {number} */\n this.idleTimeout = null;\n this.printing = false;\n this.isThumbnailViewEnabled = false;\n\n 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 {IRenderableView} 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 {IRenderableView} view\n * @returns {boolean}\n */\n isViewFinished(view) {\n return view.renderingState === RenderingStates.FINISHED;\n }\n\n /**\n * Render a page or thumbnail view. This calls the appropriate function\n * based on the views state. If the view is already rendered it will return\n * `false`.\n *\n * @param {IRenderableView} view\n */\n renderView(view) {\n switch (view.renderingState) {\n case RenderingStates.FINISHED:\n return false;\n case RenderingStates.PAUSED:\n this.highestPriorityPage = view.renderingId;\n view.resume();\n break;\n case RenderingStates.RUNNING:\n this.highestPriorityPage = view.renderingId;\n break;\n case RenderingStates.INITIAL:\n this.highestPriorityPage = view.renderingId;\n view\n .draw()\n .finally(() => {\n this.renderHighestPriority();\n })\n .catch(reason => {\n if (reason instanceof RenderingCancelledException) {\n return;\n }\n console.error(\"renderView:\", reason);\n });\n break;\n }\n return true;\n }\n}\n\nexport { PDFRenderingQueue };\n","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFDocumentProxy} PDFDocumentProxy */\n/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/optional_content_config\").OptionalContentConfig} OptionalContentConfig */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IDownloadManager} IDownloadManager */\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n// 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\nimport {\n AnnotationEditorType,\n AnnotationEditorUIManager,\n AnnotationMode,\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 RenderingStates,\n SCROLLBAR_PADDING,\n scrollIntoView,\n ScrollMode,\n SpreadMode,\n TextLayerMode,\n UNKNOWN_SCALE,\n VERTICAL_PADDING,\n watchScroll,\n} from \"./ui_utils.js\";\nimport { GenericL10n } from \"web-null_l10n\";\nimport { PDFPageView } from \"./pdf_page_view.js\";\nimport { PDFRenderingQueue } from \"./pdf_rendering_queue.js\";\nimport { SimpleLinkService } from \"./pdf_link_service.js\";\n\nconst DEFAULT_CACHE_SIZE = 10;\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 {IPDFLinkService} [linkService] - The navigation/linking service.\n * @property {IDownloadManager} [downloadManager] - The download manager\n * component.\n * @property {PDFFindController} [findController] - The find controller\n * component.\n * @property {PDFScriptingManager} [scriptingManager] - The scripting manager\n * component.\n * @property {PDFRenderingQueue} [renderingQueue] - The rendering queue object.\n * @property {boolean} [removePageBorders] - Removes the border shadow around\n * the pages. The default value is `false`.\n * @property {number} [textLayerMode] - Controls if the text layer used for\n * selection and searching is created. The constants from {TextLayerMode}\n * should be used. The default value is `TextLayerMode.ENABLE`.\n * @property {number} [annotationMode] - Controls if the annotation layer is\n * created, and if interactive form elements or `AnnotationStorage`-data are\n * being rendered. The constants from {@link AnnotationMode} should be used;\n * see also {@link RenderParameters} and {@link GetOperatorListParameters}.\n * The default value is `AnnotationMode.ENABLE_FORMS`.\n * @property {number} [annotationEditorMode] - Enables the creation and editing\n * of new Annotations. The constants from {@link AnnotationEditorType} should\n * be used. The default value is `AnnotationEditorType.NONE`.\n * @property {string} [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 {IL10n} [l10n] - Localization service.\n * @property {boolean} [enablePermissions] - Enables PDF document permissions,\n * when they exist. The default value is `false`.\n * @property {Object} [pageColors] - Overwrites background and foreground colors\n * with user defined ones in order to improve readability in high contrast\n * mode.\n * @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 /**\n * @param {PDFViewerOptions} options\n */\n constructor(options) {\n const viewerVersion =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : null;\n if (version !== viewerVersion) {\n throw new Error(\n `The API version \"${version}\" does not match the Viewer version \"${viewerVersion}\".`\n );\n }\n this.container = options.container;\n this.viewer = options.viewer || options.container.firstElementChild;\n 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`