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B,MAAM,EAAEjT;IACV;EACF,CAAC,CAAC;EACF,IAAI;IAIF9B,MAAM,CAAC8K,QAAQ,CAAC8uB,aAAa,CAACD,KAAK,CAAC;EACtC,CAAC,CAAC,OAAO9D,EAAE,EAAE;IAGX31B,OAAO,CAACC,KAAK,CAAC,oBAAoB01B,EAAE,EAAE,CAAC;IACvC/qB,QAAQ,CAAC8uB,aAAa,CAACD,KAAK,CAAC;EAC/B;EAEFqsD,oBAAoB,CAACiE,GAAG,CAACC,MAAM,CAAC;AAClC;AAIAp/E,QAAQ,CAACwnF,kBAAkB,GAAG,IAAI,CAAC;AAEnC,IACExnF,QAAQ,CAACmrF,UAAU,KAAK,aAAa,IACrCnrF,QAAQ,CAACmrF,UAAU,KAAK,UAAU,EAClC;EACAD,aAAa,CAAC,CAAC;AACjB,CAAC,MAAM;EACLlrF,QAAQ,CAACrI,gBAAgB,CAAC,kBAAkB,EAAEuzF,aAAa,EAAE,IAAI,CAAC;AACpE","sources":["webpack://pdf.js/webpack/bootstrap","webpack://pdf.js/webpack/runtime/define property getters","webpack://pdf.js/webpack/runtime/hasOwnProperty shorthand","webpack://pdf.js/./web/ui_utils.js","webpack://pdf.js/./web/app_options.js","webpack://pdf.js/./web/pdf_link_service.js","webpack://pdf.js/./web/pdfjs.js","webpack://pdf.js/./web/event_utils.js","webpack://pdf.js/./web/external_services.js","webpack://pdf.js/./web/preferences.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/types.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/resolver.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/scope.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/builtins.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/memoizer.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/bundle.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/resource.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/index.js","webpack://pdf.js/./node_modules/@fluent/dom/esm/overlay.js","webpack://pdf.js/./node_modules/cached-iterable/src/cached_iterable.mjs","webpack://pdf.js/./node_modules/cached-iterable/src/cached_sync_iterable.mjs","webpack://pdf.js/./node_modules/cached-iterable/src/cached_async_iterable.mjs","webpack://pdf.js/./node_modules/cached-iterable/src/index.mjs","webpack://pdf.js/./node_modules/@fluent/dom/esm/localization.js","webpack://pdf.js/./node_modules/@fluent/dom/esm/dom_localization.js","webpack://pdf.js/./node_modules/@fluent/dom/esm/index.js","webpack://pdf.js/./web/l10n.js","webpack://pdf.js/./web/genericl10n.js","webpack://pdf.js/./web/generic_scripting.js","webpack://pdf.js/./web/genericcom.js","webpack://pdf.js/./web/new_alt_text_manager.js","webpack://pdf.js/./web/alt_text_manager.js","webpack://pdf.js/./web/annotation_editor_params.js","webpack://pdf.js/./web/caret_browsing.js","webpack://pdf.js/./web/download_manager.js","webpack://pdf.js/./web/overlay_manager.js","webpack://pdf.js/./web/password_prompt.js","webpack://pdf.js/./web/base_tree_viewer.js","webpack://pdf.js/./web/pdf_attachment_viewer.js","webpack://pdf.js/./web/grab_to_pan.js","webpack://pdf.js/./web/pdf_cursor_tools.js","webpack://pdf.js/./web/pdf_document_properties.js","webpack://pdf.js/./web/pdf_find_utils.js","webpack://pdf.js/./web/pdf_find_controller.js","webpack://pdf.js/./web/pdf_find_bar.js","webpack://pdf.js/./web/pdf_history.js","webpack://pdf.js/./web/pdf_layer_viewer.js","webpack://pdf.js/./web/pdf_outline_viewer.js","webpack://pdf.js/./web/pdf_presentation_mode.js","webpack://pdf.js/./web/xfa_layer_builder.js","webpack://pdf.js/./web/print_utils.js","webpack://pdf.js/./web/pdf_print_service.js","webpack://pdf.js/./web/pdf_rendering_queue.js","webpack://pdf.js/./web/pdf_scripting_manager.js","webpack://pdf.js/./web/pdf_sidebar.js","webpack://pdf.js/./web/pdf_thumbnail_view.js","webpack://pdf.js/./web/pdf_thumbnail_viewer.js","webpack://pdf.js/./web/annotation_editor_layer_builder.js","webpack://pdf.js/./web/annotation_layer_builder.js","webpack://pdf.js/./web/draw_layer_builder.js","webpack://pdf.js/./web/struct_tree_layer_builder.js","webpack://pdf.js/./web/text_accessibility.js","webpack://pdf.js/./web/text_highlighter.js","webpack://pdf.js/./web/text_layer_builder.js","webpack://pdf.js/./web/pdf_page_view.js","webpack://pdf.js/./web/pdf_viewer.js","webpack://pdf.js/./web/secondary_toolbar.js","webpack://pdf.js/./web/toolbar.js","webpack://pdf.js/./web/view_history.js","webpack://pdf.js/./web/app.js","webpack://pdf.js/./web/viewer.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst DEFAULT_SCALE_VALUE = \"auto\";\nconst DEFAULT_SCALE = 1.0;\nconst DEFAULT_SCALE_DELTA = 1.1;\nconst MIN_SCALE = 0.1;\nconst MAX_SCALE = 10.0;\nconst UNKNOWN_SCALE = 0;\nconst MAX_AUTO_SCALE = 1.25;\nconst SCROLLBAR_PADDING = 40;\nconst VERTICAL_PADDING = 5;\n\nconst RenderingStates = {\n INITIAL: 0,\n RUNNING: 1,\n PAUSED: 2,\n FINISHED: 3,\n};\n\nconst PresentationModeState = {\n UNKNOWN: 0,\n NORMAL: 1,\n CHANGING: 2,\n FULLSCREEN: 3,\n};\n\nconst SidebarView = {\n UNKNOWN: -1,\n NONE: 0,\n THUMBS: 1, // Default value.\n OUTLINE: 2,\n ATTACHMENTS: 3,\n LAYERS: 4,\n};\n\nconst 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 offsetX += spot.left;\n parent.scrollLeft = offsetX;\n }\n }\n parent.scrollTop = offsetY;\n}\n\n/**\n * Helper function to start monitoring the scroll event and converting them into\n * PDF.js friendly one: with scroll debounce and scroll direction.\n */\nfunction watchScroll(viewAreaElement, callback, 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 hiddenHeight =\n Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom);\n const hiddenWidth =\n Math.max(0, left - currentWidth) + Math.max(0, viewRight - right);\n\n const fractionHeight = (viewHeight - hiddenHeight) / viewHeight,\n fractionWidth = (viewWidth - hiddenWidth) / viewWidth;\n const percent = (fractionHeight * fractionWidth * 100) | 0;\n\n visible.push({\n id: view.id,\n x: currentWidth,\n y: currentHeight,\n view,\n percent,\n widthPercent: (fractionWidth * 100) | 0,\n });\n ids.add(view.id);\n }\n\n const first = visible[0],\n last = visible.at(-1);\n\n if (sortByVisibility) {\n visible.sort(function (a, b) {\n const pc = a.percent - b.percent;\n if (Math.abs(pc) > 0.001) {\n return -pc;\n }\n return a.id - b.id; // ensure stability\n });\n }\n return { first, last, views: visible, ids };\n}\n\nfunction normalizeWheelEventDirection(evt) {\n let delta = Math.hypot(evt.deltaX, evt.deltaY);\n const angle = Math.atan2(evt.deltaY, evt.deltaX);\n if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {\n // All that is left-up oriented has to change the sign.\n delta = -delta;\n }\n return delta;\n}\n\nfunction normalizeWheelEventDelta(evt) {\n const deltaMode = evt.deltaMode; // Avoid being affected by bug 1392460.\n let delta = normalizeWheelEventDirection(evt);\n\n const MOUSE_PIXELS_PER_LINE = 30;\n const MOUSE_LINES_PER_PAGE = 30;\n\n // Converts delta to per-page units\n if (deltaMode === WheelEvent.DOM_DELTA_PIXEL) {\n delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;\n } else if (deltaMode === WheelEvent.DOM_DELTA_LINE) {\n delta /= MOUSE_LINES_PER_PAGE;\n }\n return delta;\n}\n\nfunction isValidRotation(angle) {\n return Number.isInteger(angle) && angle % 90 === 0;\n}\n\nfunction isValidScrollMode(mode) {\n return (\n Number.isInteger(mode) &&\n Object.values(ScrollMode).includes(mode) &&\n mode !== ScrollMode.UNKNOWN\n );\n}\n\nfunction isValidSpreadMode(mode) {\n return (\n Number.isInteger(mode) &&\n Object.values(SpreadMode).includes(mode) &&\n mode !== SpreadMode.UNKNOWN\n );\n}\n\nfunction isPortraitOrientation(size) {\n return size.width <= size.height;\n}\n\n/**\n * Promise that is resolved when DOM window becomes visible.\n */\nconst animationStarted = new Promise(function (resolve) {\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"LIB\") &&\n typeof window === \"undefined\"\n ) {\n // Prevent \"ReferenceError: window is not defined\" errors when running the\n // unit-tests in Node.js environments.\n setTimeout(resolve, 20);\n return;\n }\n window.requestAnimationFrame(resolve);\n});\n\nconst docStyle =\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"LIB\") &&\n typeof document === \"undefined\"\n ? null\n : document.documentElement.style;\n\nfunction clamp(v, min, max) {\n return Math.min(Math.max(v, min), max);\n}\n\nclass ProgressBar {\n #classList = null;\n\n #disableAutoFetchTimeout = null;\n\n #percent = 0;\n\n #style = null;\n\n #visible = true;\n\n constructor(bar) {\n this.#classList = bar.classList;\n this.#style = bar.style;\n }\n\n get percent() {\n return this.#percent;\n }\n\n set percent(val) {\n this.#percent = clamp(val, 0, 100);\n\n if (isNaN(val)) {\n this.#classList.add(\"indeterminate\");\n return;\n }\n this.#classList.remove(\"indeterminate\");\n\n this.#style.setProperty(\"--progressBar-percent\", `${this.#percent}%`);\n }\n\n setWidth(viewer) {\n if (!viewer) {\n return;\n }\n const container = viewer.parentNode;\n const scrollbarWidth = container.offsetWidth - viewer.offsetWidth;\n if (scrollbarWidth > 0) {\n this.#style.setProperty(\n \"--progressBar-end-offset\",\n `${scrollbarWidth}px`\n );\n }\n }\n\n setDisableAutoFetch(delay = /* ms = */ 5000) {\n if (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\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 typeof navigator === \"undefined\"\n ) {\n globalThis.navigator = Object.create(null);\n }\n const userAgent = navigator.userAgent || \"\";\n const platform = navigator.platform || \"\";\n const maxTouchPoints = navigator.maxTouchPoints || 1;\n\n const isAndroid = /Android/.test(userAgent);\n const isIOS =\n /\\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) ||\n (platform === \"MacIntel\" && maxTouchPoints > 1);\n\n // Limit canvas size to 5 mega-pixels on mobile.\n // Support: Android, iOS\n (function () {\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 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 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 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 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 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 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: \"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F\",\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 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 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: typeof PDFJSDev === \"undefined\" ? document.URL.split(\"#\", 1)[0] : \"\",\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 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\n workerPort: {\n /** @type {Object} */\n value: null,\n kind: OptionKind.WORKER,\n },\n workerSrc: {\n /** @type {string} */\n value:\n // eslint-disable-next-line no-nested-ternary\n typeof PDFJSDev === \"undefined\"\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.viewerCssTheme = {\n /** @type {number} */\n value: typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\") ? 2 : 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\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 2015 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { parseQueryString } 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: <page-ref> </XYZ|/FitXXX> <args..>\n const [destRef] = explicitDest;\n\n if (destRef && typeof destRef === \"object\") {\n pageNumber = this.pdfDocument.cachedPageNumber(destRef);\n\n if (!pageNumber) {\n // Fetch the page reference if it's not yet available. This could\n // only occur during loading, before all pages have been resolved.\n try {\n pageNumber = (await this.pdfDocument.getPageIndex(destRef)) + 1;\n } catch {\n console.error(\n `goToDestination: \"${destRef}\" is not a valid page reference, for dest=\"${dest}\".`\n );\n return;\n }\n }\n } else if (Number.isInteger(destRef)) {\n pageNumber = destRef + 1;\n }\n if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {\n console.error(\n `goToDestination: \"${pageNumber}\" is not a valid page number, for dest=\"${dest}\".`\n );\n return;\n }\n\n if (this.pdfHistory) {\n // Update the browser history before scrolling the new destination into\n // view, to be able to accurately capture the current document position.\n this.pdfHistory.pushCurrentPosition();\n this.pdfHistory.push({ namedDest, explicitDest, pageNumber });\n }\n\n this.pdfViewer.scrollPageIntoView({\n pageNumber,\n destArray: explicitDest,\n ignoreDestinationZoom: this._ignoreDestinationZoom,\n });\n }\n\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 * Adds various attributes (href, title, target, rel) to hyperlinks.\n * @param {HTMLAnchorElement} link\n * @param {string} url\n * @param {boolean} [newWindow]\n */\n addLinkAttributes(link, url, newWindow = false) {\n if (!url || typeof url !== \"string\") {\n throw new Error('A valid \"url\" parameter must provided.');\n }\n const target = newWindow ? LinkTarget.BLANK : this.externalLinkTarget,\n rel = this.externalLinkRel;\n\n if (this.externalLinkEnabled) {\n link.href = link.title = url;\n } else {\n link.href = \"\";\n link.title = `Disabled: ${url}`;\n link.onclick = () => false;\n }\n\n let targetStr = \"\"; // LinkTarget.NONE\n switch (target) {\n case LinkTarget.NONE:\n break;\n case LinkTarget.SELF:\n targetStr = \"_self\";\n break;\n case LinkTarget.BLANK:\n targetStr = \"_blank\";\n break;\n case LinkTarget.PARENT:\n targetStr = \"_parent\";\n break;\n case LinkTarget.TOP:\n targetStr = \"_top\";\n break;\n }\n link.target = targetStr;\n\n link.rel = typeof rel === \"string\" ? rel : DEFAULT_LINK_REL;\n }\n\n /**\n * @param {string|Array} dest - The PDF destination object.\n * @returns {string} The hyperlink to the PDF object.\n */\n getDestinationHash(dest) {\n if (typeof dest === \"string\") {\n if (dest.length > 0) {\n return this.getAnchorUrl(\"#\" + escape(dest));\n }\n } else if (Array.isArray(dest)) {\n const str = JSON.stringify(dest);\n if (str.length > 0) {\n return this.getAnchorUrl(\"#\" + escape(str));\n }\n }\n return this.getAnchorUrl(\"\");\n }\n\n /**\n * Prefix the full url on anchor links to make sure that links are resolved\n * relative to the current URL instead of the one defined in <base href>.\n * @param {string} anchor - The anchor hash, including the #.\n * @returns {string} The hyperlink to the PDF object.\n */\n getAnchorUrl(anchor) {\n return this.baseUrl ? this.baseUrl + anchor : anchor;\n }\n\n /**\n * @param {string} hash\n */\n setHash(hash) {\n if (!this.pdfDocument) {\n return;\n }\n let pageNumber, dest;\n if (hash.includes(\"=\")) {\n const params = parseQueryString(hash);\n if (params.has(\"search\")) {\n const query = params.get(\"search\").replaceAll('\"', \"\"),\n phrase = params.get(\"phrase\") === \"true\";\n\n this.eventBus.dispatch(\"findfromurlhash\", {\n source: this,\n query: phrase ? query : query.match(/\\S+/g),\n });\n }\n // borrowing syntax from \"Parameters for Opening PDF Files\"\n if (params.has(\"page\")) {\n pageNumber = params.get(\"page\") | 0 || 1;\n }\n if (params.has(\"zoom\")) {\n // Build the destination array.\n const zoomArgs = params.get(\"zoom\").split(\",\"); // scale,left,top\n const zoomArg = zoomArgs[0];\n const zoomArgNumber = parseFloat(zoomArg);\n\n if (!zoomArg.includes(\"Fit\")) {\n // If the zoomArg is a number, it has to get divided by 100. If it's\n // a string, it should stay as it is.\n dest = [\n null,\n { name: \"XYZ\" },\n zoomArgs.length > 1 ? zoomArgs[1] | 0 : null,\n zoomArgs.length > 2 ? zoomArgs[2] | 0 : null,\n zoomArgNumber ? zoomArgNumber / 100 : zoomArg,\n ];\n } else if (zoomArg === \"Fit\" || zoomArg === \"FitB\") {\n dest = [null, { name: zoomArg }];\n } else if (\n zoomArg === \"FitH\" ||\n zoomArg === \"FitBH\" ||\n zoomArg === \"FitV\" ||\n zoomArg === \"FitBV\"\n ) {\n dest = [\n null,\n { name: zoomArg },\n zoomArgs.length > 1 ? zoomArgs[1] | 0 : null,\n ];\n } else if (zoomArg === \"FitR\") {\n if (zoomArgs.length !== 5) {\n console.error(\n 'PDFLinkService.setHash: Not enough parameters for \"FitR\".'\n );\n } else {\n dest = [\n null,\n { name: zoomArg },\n zoomArgs[1] | 0,\n zoomArgs[2] | 0,\n zoomArgs[3] | 0,\n zoomArgs[4] | 0,\n ];\n }\n } else {\n console.error(\n `PDFLinkService.setHash: \"${zoomArg}\" is not a valid zoom value.`\n );\n }\n }\n if (dest) {\n this.pdfViewer.scrollPageIntoView({\n pageNumber: pageNumber || this.page,\n destArray: dest,\n allowNegativeOffset: true,\n });\n } else if (pageNumber) {\n this.page = pageNumber; // simple page\n }\n if (params.has(\"pagemode\")) {\n this.eventBus.dispatch(\"pagemode\", {\n source: this,\n mode: params.get(\"pagemode\"),\n });\n }\n // Ensure that this parameter is *always* handled last, in order to\n // guarantee that it won't be overridden (e.g. by the \"page\" parameter).\n if (params.has(\"nameddest\")) {\n this.goToDestination(params.get(\"nameddest\"));\n }\n\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n return;\n }\n // Support opening of PDF attachments in the Firefox PDF Viewer,\n // which uses a couple of non-standard hash parameters; refer to\n // `DownloadManager.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\" || PDFLinkService.#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 static #isValidExplicitDest(dest) {\n if (!Array.isArray(dest) || dest.length < 2) {\n return false;\n }\n const [page, zoom, ...args] = dest;\n if (\n !(\n typeof page === \"object\" &&\n Number.isInteger(page?.num) &&\n Number.isInteger(page?.gen)\n ) &&\n !Number.isInteger(page)\n ) {\n return false;\n }\n if (!(typeof zoom === \"object\" && typeof zoom?.name === \"string\")) {\n return false;\n }\n const argsLen = args.length;\n let allowNull = true;\n switch (zoom.name) {\n case \"XYZ\":\n if (argsLen < 2 || argsLen > 3) {\n return false;\n }\n break;\n case \"Fit\":\n case \"FitB\":\n return argsLen === 0;\n case \"FitH\":\n case \"FitBH\":\n case \"FitV\":\n case \"FitBV\":\n if (argsLen > 1) {\n return false;\n }\n break;\n case \"FitR\":\n if (argsLen !== 4) {\n return false;\n }\n allowNull = false;\n break;\n default:\n return false;\n }\n for (const arg of args) {\n if (!(typeof arg === \"number\" || (allowNull && arg === null))) {\n return false;\n }\n }\n return true;\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 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 build,\n CMapCompressionType,\n ColorPicker,\n createValidAbsoluteUrl,\n DOMSVGFactory,\n DrawLayer,\n FeatureTest,\n fetchData,\n getDocument,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n getXfaPageViewport,\n GlobalWorkerOptions,\n ImageKind,\n InvalidPDFException,\n isDataScheme,\n isPdfFile,\n MissingPDFException,\n noContextMenu,\n normalizeUnicode,\n OPS,\n OutputScale,\n PasswordResponses,\n PDFDataRangeTransport,\n PDFDateString,\n PDFWorker,\n PermissionFlag,\n PixelsPerInch,\n RenderingCancelledException,\n setLayerDimensions,\n shadow,\n TextLayer,\n UnexpectedResponseException,\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 build,\n CMapCompressionType,\n ColorPicker,\n createValidAbsoluteUrl,\n DOMSVGFactory,\n DrawLayer,\n FeatureTest,\n fetchData,\n getDocument,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n getXfaPageViewport,\n GlobalWorkerOptions,\n ImageKind,\n InvalidPDFException,\n isDataScheme,\n isPdfFile,\n MissingPDFException,\n noContextMenu,\n normalizeUnicode,\n OPS,\n OutputScale,\n PasswordResponses,\n PDFDataRangeTransport,\n PDFDateString,\n PDFWorker,\n PermissionFlag,\n PixelsPerInch,\n RenderingCancelledException,\n setLayerDimensions,\n shadow,\n TextLayer,\n UnexpectedResponseException,\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\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 build-in pdf viewer.\n */\nclass FirefoxEventBus extends EventBus {\n #externalServices;\n\n #globalEventNames;\n\n #isInAutomation;\n\n constructor(globalEventNames, externalServices, isInAutomation) {\n super();\n this.#globalEventNames = globalEventNames;\n this.#externalServices = externalServices;\n this.#isInAutomation = isInAutomation;\n }\n\n dispatch(eventName, data) {\n if (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: FirefoxEventBus.dispatch\");\n }\n super.dispatch(eventName, data);\n\n if (this.#isInAutomation) {\n const detail = Object.create(null);\n if (data) {\n for (const key in data) {\n const value = data[key];\n if (key === \"source\") {\n if (value === window || value === document) {\n return; // No need to re-dispatch (already) global events.\n }\n continue; // Ignore the `source` property.\n }\n detail[key] = value;\n }\n }\n const event = new CustomEvent(eventName, {\n bubbles: true,\n cancelable: true,\n detail,\n });\n document.dispatchEvent(event);\n }\n\n if (this.#globalEventNames?.has(eventName)) {\n this.#externalServices.dispatchGlobalEvent({\n eventName,\n detail: data,\n });\n }\n }\n}\n\nexport { EventBus, FirefoxEventBus, waitOnEventOrTimeout, WaitOnType };\n","/* Copyright 2024 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces.js\").IL10n} IL10n */\n\nclass BaseExternalServices {\n constructor() {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n this.constructor === BaseExternalServices\n ) {\n throw new Error(\"Cannot initialize BaseExternalServices.\");\n }\n }\n\n updateFindControlState(data) {}\n\n updateFindMatchesCount(data) {}\n\n initPassiveLoading() {}\n\n reportTelemetry(data) {}\n\n /**\n * @returns {Promise<IL10n>}\n */\n async createL10n() {\n throw new Error(\"Not implemented: createL10n\");\n }\n\n createScripting() {\n throw new Error(\"Not implemented: createScripting\");\n }\n\n updateEditorStates(data) {\n throw new Error(\"Not implemented: updateEditorStates\");\n }\n\n dispatchGlobalEvent(_event) {}\n}\n\nexport { BaseExternalServices };\n","/* Copyright 2013 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AppOptions, OptionKind } from \"./app_options.js\";\n\n/**\n * BasePreferences - Abstract base class for storing persistent settings.\n * Used for settings that should be applied to all opened documents,\n * or every time the viewer is loaded.\n */\nclass BasePreferences {\n #defaults = Object.freeze(\n typeof PDFJSDev === \"undefined\"\n ? AppOptions.getAll(OptionKind.PREFERENCE, /* defaultOnly = */ true)\n : PDFJSDev.eval(\"DEFAULT_PREFERENCES\")\n );\n\n #initializedPromise = null;\n\n constructor() {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n this.constructor === BasePreferences\n ) {\n throw new Error(\"Cannot initialize BasePreferences.\");\n }\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")) {\n Object.defineProperty(this, \"defaults\", {\n get() {\n return this.#defaults;\n },\n });\n }\n\n this.#initializedPromise = this._readFromStorage(this.#defaults).then(\n ({ browserPrefs, prefs }) => {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n AppOptions._checkDisablePreferences()\n ) {\n return;\n }\n AppOptions.setAll({ ...browserPrefs, ...prefs }, /* prefs = */ true);\n }\n );\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n window.addEventListener(\n \"updatedPreference\",\n async ({ detail: { name, value } }) => {\n await this.#initializedPromise;\n AppOptions.setAll({ [name]: value }, /* prefs = */ true);\n }\n );\n }\n }\n\n /**\n * Stub function for writing preferences to storage.\n * @param {Object} prefObj The preferences that should be written to storage.\n * @returns {Promise} A promise that is resolved when the preference values\n * have been written.\n */\n async _writeToStorage(prefObj) {\n throw new Error(\"Not implemented: _writeToStorage\");\n }\n\n /**\n * Stub function for reading preferences from storage.\n * @param {Object} prefObj The preferences that should be read from storage.\n * @returns {Promise} A promise that is resolved with an {Object} containing\n * the preferences that have been read.\n */\n async _readFromStorage(prefObj) {\n throw new Error(\"Not implemented: _readFromStorage\");\n }\n\n /**\n * Reset the preferences to their default values and update storage.\n * @returns {Promise} A promise that is resolved when the preference values\n * have been reset.\n */\n async reset() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Please use `about:config` to change preferences.\");\n }\n await this.#initializedPromise;\n AppOptions.setAll(this.#defaults, /* prefs = */ true);\n\n await this._writeToStorage(this.#defaults);\n }\n\n /**\n * Set the value of a preference.\n * @param {string} name The name of the preference that should be changed.\n * @param {boolean|number|string} value The new value of the preference.\n * @returns {Promise} A promise that is resolved when the value has been set,\n * provided that the preference exists and the types match.\n */\n async set(name, value) {\n await this.#initializedPromise;\n AppOptions.setAll({ [name]: value }, /* prefs = */ true);\n\n await this._writeToStorage(\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n ? { [name]: AppOptions.get(name) }\n : AppOptions.getAll(OptionKind.PREFERENCE)\n );\n }\n\n /**\n * Get the value of a preference.\n * @param {string} name The name of the preference whose value is requested.\n * @returns {Promise} A promise resolved with a {boolean|number|string}\n * containing the value of the preference.\n */\n async get(name) {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: get\");\n }\n await this.#initializedPromise;\n return AppOptions.get(name);\n }\n\n get initializedPromise() {\n return this.#initializedPromise;\n }\n}\n\nexport { BasePreferences };\n","/**\n * The `FluentType` class is the base of Fluent's type system.\n *\n * Fluent types wrap JavaScript values and store additional configuration for\n * them, which can then be used in the `toString` method together with a proper\n * `Intl` formatter.\n */\nexport class FluentType {\n /**\n * Create a `FluentType` instance.\n *\n * @param value The JavaScript value to wrap.\n */\n constructor(value) {\n this.value = value;\n }\n /**\n * Unwrap the raw value stored by this `FluentType`.\n */\n valueOf() {\n return this.value;\n }\n}\n/**\n * A `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 `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 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 return this.value.toString(10);\n }\n }\n}\n/**\n * A `FluentType` representing a date and time.\n *\n * A `FluentDateTime` instance stores the number value of the date it\n * represents, 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 /**\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 super(value);\n this.opts = opts;\n }\n /**\n * Format this `FluentDateTime` to a string.\n */\n toString(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 return new Date(this.value).toISOString();\n }\n }\n}\n","/* global Intl */\n/**\n * @overview\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 (arg instanceof Date) {\n return new FluentDateTime(arg.getTime());\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 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 `FluentValues` representing the\n * positional arguments, and an object of named `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.valueOf(), {\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 `FluentValues` representing the\n * positional arguments, and an object of named `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) {\n return new FluentDateTime(arg.valueOf(), {\n ...arg.opts,\n ...values(opts, DATETIME_ALLOWED),\n });\n }\n if (arg instanceof FluentNumber) {\n return new FluentDateTime(arg.valueOf(), {\n ...values(opts, DATETIME_ALLOWED),\n });\n }\n throw new TypeError(\"Invalid argument to DATETIME\");\n}\n","const cache = new Map();\nexport function getMemoizerForLocale(locales) {\n const stringLocale = Array.isArray(locales) ? locales.join(\" \") : locales;\n let memoizer = cache.get(stringLocale);\n if (memoizer === undefined) {\n memoizer = new Map();\n cache.set(stringLocale, memoizer);\n }\n return memoizer;\n}\n","import { resolveComplexPattern } from \"./resolver.js\";\nimport { Scope } from \"./scope.js\";\nimport { FluentNone } from \"./types.js\";\nimport { NUMBER, DATETIME } from \"./builtins.js\";\nimport { getMemoizerForLocale } from \"./memoizer.js\";\n/**\n * Message bundles are single-language stores of translation resources. They are\n * responsible for formatting message values and attributes to strings.\n */\nexport class FluentBundle {\n /**\n * Create an instance of `FluentBundle`.\n *\n * @example\n * ```js\n * let bundle = new FluentBundle([\"en-US\", \"en\"]);\n *\n * let bundle = new FluentBundle(locales, {useIsolating: false});\n *\n * let bundle = new FluentBundle(locales, {\n * useIsolating: true,\n * functions: {\n * NODE_ENV: () => process.env.NODE_ENV\n * }\n * });\n * ```\n *\n * @param locales - Used to instantiate `Intl` formatters used by translations.\n * @param options - Optional configuration for the bundle.\n */\n constructor(locales, { functions, useIsolating = true, transform = (v) => v, } = {}) {\n /** @ignore */\n this._terms = new Map();\n /** @ignore */\n this._messages = new Map();\n this.locales = Array.isArray(locales) ? locales : [locales];\n this._functions = {\n NUMBER,\n DATETIME,\n ...functions,\n };\n this._useIsolating = useIsolating;\n this._transform = transform;\n this._intls = getMemoizerForLocale(locales);\n }\n /**\n * Check if a message is present in the bundle.\n *\n * @param id - The identifier of the message to check.\n */\n hasMessage(id) {\n return this._messages.has(id);\n }\n /**\n * Return a raw unformatted message object from the bundle.\n *\n * Raw messages are `{value, attributes}` shapes containing translation units\n * called `Patterns`. `Patterns` are implementation-specific; they should be\n * treated as black boxes and formatted with `FluentBundle.formatPattern`.\n *\n * @param id - The identifier of the message to check.\n */\n getMessage(id) {\n return this._messages.get(id);\n }\n /**\n * Add a translation resource to the bundle.\n *\n * @example\n * ```js\n * let res = new FluentResource(\"foo = Foo\");\n * bundle.addResource(res);\n * bundle.getMessage(\"foo\");\n * // → {value: .., attributes: {..}}\n * ```\n *\n * @param res\n * @param options\n */\n addResource(res, { allowOverrides = false, } = {}) {\n const errors = [];\n for (let i = 0; i < res.body.length; i++) {\n let entry = res.body[i];\n if (entry.id.startsWith(\"-\")) {\n // Identifiers starting with a dash (-) define terms. Terms are private\n // and cannot be retrieved from FluentBundle.\n if (allowOverrides === false && this._terms.has(entry.id)) {\n errors.push(new Error(`Attempt to override an existing term: \"${entry.id}\"`));\n continue;\n }\n this._terms.set(entry.id, entry);\n }\n else {\n if (allowOverrides === false && this._messages.has(entry.id)) {\n errors.push(new Error(`Attempt to override an existing message: \"${entry.id}\"`));\n continue;\n }\n this._messages.set(entry.id, entry);\n }\n }\n return errors;\n }\n /**\n * Format a `Pattern` to a string.\n *\n * Format a raw `Pattern` into a string. `args` will be used to resolve\n * references to variables passed as arguments to the translation.\n *\n * In case of errors `formatPattern` will try to salvage as much of the\n * translation as possible and will still return a string. For performance\n * reasons, the encountered errors are not returned but instead are appended\n * to the `errors` array passed as the third argument.\n *\n * If `errors` is omitted, the first encountered error will be thrown.\n *\n * @example\n * ```js\n * let errors = [];\n * bundle.addResource(\n * new FluentResource(\"hello = Hello, {$name}!\"));\n *\n * let hello = bundle.getMessage(\"hello\");\n * if (hello.value) {\n * bundle.formatPattern(hello.value, {name: \"Jane\"}, errors);\n * // Returns \"Hello, Jane!\" and `errors` is empty.\n *\n * bundle.formatPattern(hello.value, undefined, errors);\n * // Returns \"Hello, {$name}!\" and `errors` is now:\n * // [<ReferenceError: Unknown variable: name>]\n * }\n * ```\n */\n formatPattern(pattern, args = null, errors = null) {\n // Resolve a simple pattern without creating a scope. No error handling is\n // required; by definition simple patterns don't have placeables.\n if (typeof pattern === \"string\") {\n return this._transform(pattern);\n }\n // Resolve a complex pattern.\n let scope = new Scope(this, errors, args);\n try {\n let value = resolveComplexPattern(scope, pattern);\n return value.toString(scope);\n }\n catch (err) {\n if (scope.errors && err instanceof Error) {\n scope.errors.push(err);\n return new FluentNone().toString(scope);\n }\n throw err;\n }\n }\n}\n","// This regex is used to iterate through the beginnings of messages and terms.\n// With the /m flag, the ^ matches at the beginning of every line.\nconst RE_MESSAGE_START = /^(-?[a-zA-Z][\\w-]*) *= */gm;\n// Both Attributes and Variants are parsed in while loops. These regexes are\n// used to break out of them.\nconst RE_ATTRIBUTE_START = /\\.([a-zA-Z][\\w-]*) *= */y;\nconst RE_VARIANT_START = /\\*?\\[/y;\nconst RE_NUMBER_LITERAL = /(-?[0-9]+(?:\\.([0-9]+))?)/y;\nconst RE_IDENTIFIER = /([a-zA-Z][\\w-]*)/y;\nconst RE_REFERENCE = /([$-])?([a-zA-Z][\\w-]*)(?:\\.([a-zA-Z][\\w-]*))?/y;\nconst RE_FUNCTION_NAME = /^[A-Z][A-Z0-9_-]*$/;\n// A \"run\" is a sequence of text or string literal characters which don't\n// require any special handling. For TextElements such special characters are: {\n// (starts a placeable), and line breaks which require additional logic to check\n// if the next line is indented. For StringLiterals they are: \\ (starts an\n// escape sequence), \" (ends the literal), and line breaks which are not allowed\n// in StringLiterals. Note that string runs may be empty; text runs may not.\nconst RE_TEXT_RUN = /([^{}\\n\\r]+)/y;\nconst RE_STRING_RUN = /([^\\\\\"\\n\\r]*)/y;\n// Escape sequences.\nconst RE_STRING_ESCAPE = /\\\\([\\\\\"])/y;\nconst RE_UNICODE_ESCAPE = /\\\\u([a-fA-F0-9]{4})|\\\\U([a-fA-F0-9]{6})/y;\n// Used for trimming TextElements and indents.\nconst RE_LEADING_NEWLINES = /^\\n+/;\nconst RE_TRAILING_SPACES = / +$/;\n// Used in makeIndent to strip spaces from blank lines and normalize CRLF to LF.\nconst RE_BLANK_LINES = / *\\r?\\n/g;\n// Used in makeIndent to measure the indentation.\nconst RE_INDENT = /( *)$/;\n// Common tokens.\nconst TOKEN_BRACE_OPEN = /{\\s*/y;\nconst TOKEN_BRACE_CLOSE = /\\s*}/y;\nconst TOKEN_BRACKET_OPEN = /\\[\\s*/y;\nconst TOKEN_BRACKET_CLOSE = /\\s*] */y;\nconst TOKEN_PAREN_OPEN = /\\s*\\(\\s*/y;\nconst TOKEN_ARROW = /\\s*->\\s*/y;\nconst TOKEN_COLON = /\\s*:\\s*/y;\n// Note the optional comma. As a deviation from the Fluent EBNF, the parser\n// doesn't enforce commas between call arguments.\nconst TOKEN_COMMA = /\\s*,?\\s*/y;\nconst TOKEN_BLANK = /\\s+/y;\n/**\n * Fluent Resource is a structure storing parsed localization entries.\n */\nexport class FluentResource {\n constructor(source) {\n this.body = [];\n RE_MESSAGE_START.lastIndex = 0;\n let cursor = 0;\n // Iterate over the beginnings of messages and terms to efficiently skip\n // comments and recover from errors.\n while (true) {\n let next = RE_MESSAGE_START.exec(source);\n if (next === null) {\n break;\n }\n cursor = RE_MESSAGE_START.lastIndex;\n try {\n this.body.push(parseMessage(next[1]));\n }\n catch (err) {\n if (err instanceof SyntaxError) {\n // Don't report any Fluent syntax errors. Skip directly to the\n // beginning of the next message or term.\n continue;\n }\n throw err;\n }\n }\n // The parser implementation is inlined below for performance reasons,\n // as well as for convenience of accessing `source` and `cursor`.\n // The parser focuses on minimizing the number of false negatives at the\n // expense of increasing the risk of false positives. In other words, it\n // aims at parsing valid Fluent messages with a success rate of 100%, but it\n // may also parse a few invalid messages which the reference parser would\n // reject. The parser doesn't perform any validation and may produce entries\n // which wouldn't make sense in the real world. For best results users are\n // advised to validate translations with the fluent-syntax parser\n // pre-runtime.\n // The parser makes an extensive use of sticky regexes which can be anchored\n // to any offset of the source string without slicing it. Errors are thrown\n // to bail out of parsing of ill-formed messages.\n function test(re) {\n re.lastIndex = cursor;\n return re.test(source);\n }\n // Advance the cursor by the char if it matches. May be used as a predicate\n // (was the match found?) or, if errorClass is passed, as an assertion.\n function consumeChar(char, errorClass) {\n if (source[cursor] === char) {\n cursor++;\n return true;\n }\n if (errorClass) {\n throw new errorClass(`Expected ${char}`);\n }\n return false;\n }\n // Advance the cursor by the token if it matches. May be used as a predicate\n // (was the match found?) or, if errorClass is passed, as an assertion.\n function consumeToken(re, errorClass) {\n if (test(re)) {\n cursor = re.lastIndex;\n return true;\n }\n if (errorClass) {\n throw new errorClass(`Expected ${re.toString()}`);\n }\n return false;\n }\n // Execute a regex, advance the cursor, and return all capture groups.\n function match(re) {\n re.lastIndex = cursor;\n let result = re.exec(source);\n if (result === null) {\n throw new SyntaxError(`Expected ${re.toString()}`);\n }\n cursor = re.lastIndex;\n return result;\n }\n // Execute a regex, advance the cursor, and return the capture group.\n function match1(re) {\n return match(re)[1];\n }\n function parseMessage(id) {\n let value = parsePattern();\n let attributes = parseAttributes();\n if (value === null && Object.keys(attributes).length === 0) {\n throw new SyntaxError(\"Expected message value or attributes\");\n }\n return { id, value, attributes };\n }\n function parseAttributes() {\n let attrs = Object.create(null);\n while (test(RE_ATTRIBUTE_START)) {\n let name = match1(RE_ATTRIBUTE_START);\n let value = parsePattern();\n if (value === null) {\n throw new SyntaxError(\"Expected attribute value\");\n }\n attrs[name] = value;\n }\n return attrs;\n }\n function parsePattern() {\n let first;\n // First try to parse any simple text on the same line as the id.\n if (test(RE_TEXT_RUN)) {\n first = match1(RE_TEXT_RUN);\n }\n // If there's a placeable on the first line, parse a complex pattern.\n if (source[cursor] === \"{\" || source[cursor] === \"}\") {\n // Re-use the text parsed above, if possible.\n return parsePatternElements(first ? [first] : [], Infinity);\n }\n // RE_TEXT_VALUE stops at newlines. Only continue parsing the pattern if\n // what comes after the newline is indented.\n let indent = parseIndent();\n if (indent) {\n if (first) {\n // If there's text on the first line, the blank block is part of the\n // translation content in its entirety.\n return parsePatternElements([first, indent], indent.length);\n }\n // Otherwise, we're dealing with a block pattern, i.e. a pattern which\n // starts on a new line. Discrad the leading newlines but keep the\n // inline indent; it will be used by the dedentation logic.\n indent.value = trim(indent.value, RE_LEADING_NEWLINES);\n return parsePatternElements([indent], indent.length);\n }\n if (first) {\n // It was just a simple inline text after all.\n return trim(first, RE_TRAILING_SPACES);\n }\n return null;\n }\n // Parse a complex pattern as an array of elements.\n function parsePatternElements(elements = [], commonIndent) {\n while (true) {\n if (test(RE_TEXT_RUN)) {\n elements.push(match1(RE_TEXT_RUN));\n continue;\n }\n if (source[cursor] === \"{\") {\n elements.push(parsePlaceable());\n continue;\n }\n if (source[cursor] === \"}\") {\n throw new SyntaxError(\"Unbalanced closing brace\");\n }\n let indent = parseIndent();\n if (indent) {\n elements.push(indent);\n commonIndent = Math.min(commonIndent, indent.length);\n continue;\n }\n break;\n }\n let lastIndex = elements.length - 1;\n let lastElement = elements[lastIndex];\n // Trim the trailing spaces in the last element if it's a TextElement.\n if (typeof lastElement === \"string\") {\n elements[lastIndex] = trim(lastElement, RE_TRAILING_SPACES);\n }\n let baked = [];\n for (let element of elements) {\n if (element instanceof Indent) {\n // Dedent indented lines by the maximum common indent.\n element = element.value.slice(0, element.value.length - commonIndent);\n }\n if (element) {\n baked.push(element);\n }\n }\n return baked;\n }\n function parsePlaceable() {\n consumeToken(TOKEN_BRACE_OPEN, SyntaxError);\n let selector = parseInlineExpression();\n if (consumeToken(TOKEN_BRACE_CLOSE)) {\n return selector;\n }\n if (consumeToken(TOKEN_ARROW)) {\n let variants = parseVariants();\n consumeToken(TOKEN_BRACE_CLOSE, SyntaxError);\n return {\n type: \"select\",\n selector,\n ...variants,\n };\n }\n throw new SyntaxError(\"Unclosed placeable\");\n }\n function parseInlineExpression() {\n if (source[cursor] === \"{\") {\n // It's a nested placeable.\n return parsePlaceable();\n }\n if (test(RE_REFERENCE)) {\n let [, sigil, name, attr = null] = match(RE_REFERENCE);\n if (sigil === \"$\") {\n return { type: \"var\", name };\n }\n if (consumeToken(TOKEN_PAREN_OPEN)) {\n let args = parseArguments();\n if (sigil === \"-\") {\n // A parameterized term: -term(...).\n return { type: \"term\", name, attr, args };\n }\n if (RE_FUNCTION_NAME.test(name)) {\n return { type: \"func\", name, args };\n }\n throw new SyntaxError(\"Function names must be all upper-case\");\n }\n if (sigil === \"-\") {\n // A non-parameterized term: -term.\n return {\n type: \"term\",\n name,\n attr,\n args: [],\n };\n }\n return { type: \"mesg\", name, attr };\n }\n return parseLiteral();\n }\n function parseArguments() {\n let args = [];\n while (true) {\n switch (source[cursor]) {\n case \")\": // End of the argument list.\n cursor++;\n return args;\n case undefined: // EOF\n throw new SyntaxError(\"Unclosed argument list\");\n }\n args.push(parseArgument());\n // Commas between arguments are treated as whitespace.\n consumeToken(TOKEN_COMMA);\n }\n }\n function parseArgument() {\n let expr = parseInlineExpression();\n if (expr.type !== \"mesg\") {\n return expr;\n }\n if (consumeToken(TOKEN_COLON)) {\n // The reference is the beginning of a named argument.\n return {\n type: \"narg\",\n name: expr.name,\n value: parseLiteral(),\n };\n }\n // It's a regular message reference.\n return expr;\n }\n function parseVariants() {\n let variants = [];\n let count = 0;\n let star;\n while (test(RE_VARIANT_START)) {\n if (consumeChar(\"*\")) {\n star = count;\n }\n let key = parseVariantKey();\n let value = parsePattern();\n if (value === null) {\n throw new SyntaxError(\"Expected variant value\");\n }\n variants[count++] = { key, value };\n }\n if (count === 0) {\n return null;\n }\n if (star === undefined) {\n throw new SyntaxError(\"Expected default variant\");\n }\n return { variants, star };\n }\n function parseVariantKey() {\n consumeToken(TOKEN_BRACKET_OPEN, SyntaxError);\n let key;\n if (test(RE_NUMBER_LITERAL)) {\n key = parseNumberLiteral();\n }\n else {\n key = {\n type: \"str\",\n value: match1(RE_IDENTIFIER),\n };\n }\n consumeToken(TOKEN_BRACKET_CLOSE, SyntaxError);\n return key;\n }\n function parseLiteral() {\n if (test(RE_NUMBER_LITERAL)) {\n return parseNumberLiteral();\n }\n if (source[cursor] === '\"') {\n return parseStringLiteral();\n }\n throw new SyntaxError(\"Invalid expression\");\n }\n function parseNumberLiteral() {\n let [, value, fraction = \"\"] = match(RE_NUMBER_LITERAL);\n let precision = fraction.length;\n return {\n type: \"num\",\n value: parseFloat(value),\n precision,\n };\n }\n function parseStringLiteral() {\n consumeChar('\"', SyntaxError);\n let value = \"\";\n while (true) {\n value += match1(RE_STRING_RUN);\n if (source[cursor] === \"\\\\\") {\n value += parseEscapeSequence();\n continue;\n }\n if (consumeChar('\"')) {\n return { type: \"str\", value };\n }\n // We've reached an EOL of EOF.\n throw new SyntaxError(\"Unclosed string literal\");\n }\n }\n // Unescape known escape sequences.\n function parseEscapeSequence() {\n if (test(RE_STRING_ESCAPE)) {\n return match1(RE_STRING_ESCAPE);\n }\n if (test(RE_UNICODE_ESCAPE)) {\n let [, codepoint4, codepoint6] = match(RE_UNICODE_ESCAPE);\n let codepoint = parseInt(codepoint4 || codepoint6, 16);\n return codepoint <= 0xd7ff || 0xe000 <= codepoint\n ? // It's a Unicode scalar value.\n String.fromCodePoint(codepoint)\n : // Lonely surrogates can cause trouble when the parsing result is\n // saved using UTF-8. Use U+FFFD REPLACEMENT CHARACTER instead.\n \"<22>\";\n }\n throw new SyntaxError(\"Unknown escape sequence\");\n }\n // Parse blank space. Return it if it looks like indent before a pattern\n // line. Skip it othwerwise.\n function parseIndent() {\n let start = cursor;\n consumeToken(TOKEN_BLANK);\n // Check the first non-blank character after the indent.\n switch (source[cursor]) {\n case \".\":\n case \"[\":\n case \"*\":\n case \"}\":\n case undefined: // EOF\n // A special character. End the Pattern.\n return false;\n case \"{\":\n // Placeables don't require indentation (in EBNF: block-placeable).\n // Continue the Pattern.\n return makeIndent(source.slice(start, cursor));\n }\n // If the first character on the line is not one of the special characters\n // listed above, it's a regular text character. Check if there's at least\n // one space of indent before it.\n if (source[cursor - 1] === \" \") {\n // It's an indented text character (in EBNF: indented-char). Continue\n // the Pattern.\n return makeIndent(source.slice(start, cursor));\n }\n // A not-indented text character is likely the identifier of the next\n // message. End the Pattern.\n return false;\n }\n // Trim blanks in text according to the given regex.\n function trim(text, re) {\n return text.replace(re, \"\");\n }\n // Normalize a blank block and extract the indent details.\n function makeIndent(blank) {\n let value = blank.replace(RE_BLANK_LINES, \"\\n\");\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\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 * @module fluent\n * @overview\n *\n * `fluent` is a JavaScript implementation of Project Fluent, a localization\n * framework designed to unleash the expressive power of the natural language.\n *\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-label\", \"aria-valuetext\"],\n a: [\"download\"],\n area: [\"download\", \"alt\"],\n // value is special-cased in isAttrNameLocalizable\n input: [\"alt\", \"placeholder\"],\n menuitem: [\"label\"],\n menu: [\"label\"],\n optgroup: [\"label\"],\n option: [\"label\"],\n track: [\"label\"],\n img: [\"alt\"],\n textarea: [\"placeholder\"],\n th: [\"abbr\"],\n },\n \"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul\": {\n global: [\n \"accesskey\",\n \"aria-label\",\n \"aria-valuetext\",\n \"label\",\n \"title\",\n \"tooltiptext\",\n ],\n description: [\"value\"],\n key: [\"key\", \"keycode\"],\n label: [\"value\"],\n textbox: [\"placeholder\", \"value\"],\n },\n};\n/**\n * Translate an element.\n *\n * Translate the element's text content and attributes. Some HTML markup is\n * allowed in the translation. The element's children with the data-l10n-name\n * attribute will be treated as arguments to the translation. If the\n * translation defines the same children, their attributes and text contents\n * will be used for translating the matching source child.\n *\n * @param {Element} element\n * @param {Object} translation\n * @private\n */\nexport default function translateElement(element, translation) {\n const { value } = translation;\n if (typeof value === \"string\") {\n if (element.localName === \"title\" &&\n element.namespaceURI === \"http://www.w3.org/1999/xhtml\") {\n // A special case for the HTML title element whose content must be text.\n element.textContent = value;\n }\n else if (!reOverlay.test(value)) {\n // If the translation doesn't contain any markup skip the overlay logic.\n element.textContent = value;\n }\n else {\n // Else parse the translation's HTML using an inert template element,\n // sanitize it and replace the element's content.\n const templateElement = element.ownerDocument.createElementNS(\"http://www.w3.org/1999/xhtml\", \"template\");\n templateElement.innerHTML = value;\n overlayChildNodes(templateElement.content, element);\n }\n }\n // Even if the translation doesn't define any localizable attributes, run\n // overlayAttributes to remove any localizable attributes set by previous\n // translations.\n overlayAttributes(translation, element);\n}\n/**\n * Replace child nodes of an element with child nodes of another element.\n *\n * The contents of the target element will be cleared and fully replaced with\n * sanitized contents of the source element.\n *\n * @param {DocumentFragment} fromFragment - The source of children to overlay.\n * @param {Element} toElement - The target of the overlay.\n * @private\n */\nfunction overlayChildNodes(fromFragment, toElement) {\n for (const childNode of fromFragment.childNodes) {\n if (childNode.nodeType === childNode.TEXT_NODE) {\n // Keep the translated text node.\n continue;\n }\n if (childNode.hasAttribute(\"data-l10n-name\")) {\n const sanitized = getNodeForNamedElement(toElement, childNode);\n fromFragment.replaceChild(sanitized, childNode);\n continue;\n }\n if (isElementAllowed(childNode)) {\n const sanitized = createSanitizedElement(childNode);\n fromFragment.replaceChild(sanitized, childNode);\n continue;\n }\n console.warn(`An element of forbidden type \"${childNode.localName}\" was found in ` +\n \"the translation. Only safe text-level elements and elements with \" +\n \"data-l10n-name are allowed.\");\n // If all else fails, replace the element with its text content.\n fromFragment.replaceChild(createTextNodeFromTextContent(childNode), childNode);\n }\n toElement.textContent = \"\";\n toElement.appendChild(fromFragment);\n}\nfunction hasAttribute(attributes, name) {\n if (!attributes) {\n return false;\n }\n for (let attr of attributes) {\n if (attr.name === name) {\n return true;\n }\n }\n return false;\n}\n/**\n * Transplant localizable attributes of an element to another element.\n *\n * Any localizable attributes already set on the target element will be\n * cleared.\n *\n * @param {Element|Object} fromElement - The source of child nodes to overlay.\n * @param {Element} toElement - The target of the overlay.\n * @private\n */\nfunction overlayAttributes(fromElement, toElement) {\n const explicitlyAllowed = toElement.hasAttribute(\"data-l10n-attrs\")\n ? toElement\n .getAttribute(\"data-l10n-attrs\")\n .split(\",\")\n .map(i => i.trim())\n : null;\n // Remove existing localizable attributes if they\n // will not be used in the new translation.\n for (const attr of Array.from(toElement.attributes)) {\n if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) &&\n !hasAttribute(fromElement.attributes, attr.name)) {\n toElement.removeAttribute(attr.name);\n }\n }\n // fromElement might be a {value, attributes} object as returned by\n // Localization.messageFromBundle. In which case attributes may be null to\n // save GC cycles.\n if (!fromElement.attributes) {\n return;\n }\n // Set localizable attributes.\n for (const attr of Array.from(fromElement.attributes)) {\n if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) &&\n toElement.getAttribute(attr.name) !== attr.value) {\n toElement.setAttribute(attr.name, attr.value);\n }\n }\n}\n/**\n * Sanitize a child element created by the translation.\n *\n * Try to find a corresponding child in sourceElement and use it as the base\n * for the sanitization. This will preserve functional attribtues defined on\n * the child element in the source HTML.\n *\n * @param {Element} sourceElement - The source for data-l10n-name lookups.\n * @param {Element} translatedChild - The translated child to be sanitized.\n * @returns {Element}\n * @private\n */\nfunction getNodeForNamedElement(sourceElement, translatedChild) {\n const childName = translatedChild.getAttribute(\"data-l10n-name\");\n const sourceChild = sourceElement.querySelector(`[data-l10n-name=\"${childName}\"]`);\n if (!sourceChild) {\n console.warn(`An element named \"${childName}\" wasn't found in the source.`);\n return createTextNodeFromTextContent(translatedChild);\n }\n if (sourceChild.localName !== translatedChild.localName) {\n console.warn(`An element named \"${childName}\" was found in the translation ` +\n `but its type ${translatedChild.localName} didn't match the ` +\n `element found in the source (${sourceChild.localName}).`);\n return createTextNodeFromTextContent(translatedChild);\n }\n // Remove it from sourceElement so that the translation cannot use\n // the same reference name again.\n sourceElement.removeChild(sourceChild);\n // We can't currently guarantee that a translation won't remove\n // sourceChild from the element completely, which could break the app if\n // it relies on an event handler attached to the sourceChild. Let's make\n // this limitation explicit for now by breaking the identitiy of the\n // sourceChild by cloning it. This will destroy all event handlers\n // attached to sourceChild via addEventListener and via on<name>\n // properties.\n const clone = sourceChild.cloneNode(false);\n return shallowPopulateUsing(translatedChild, clone);\n}\n/**\n * Sanitize an allowed element.\n *\n * Text-level elements allowed in translations may only use safe attributes\n * and will have any nested markup stripped to text content.\n *\n * @param {Element} element - The element to be sanitized.\n * @returns {Element}\n * @private\n */\nfunction createSanitizedElement(element) {\n // Start with an empty element of the same type to remove nested children\n // and non-localizable attributes defined by the translation.\n const clone = element.ownerDocument.createElement(element.localName);\n return shallowPopulateUsing(element, clone);\n}\n/**\n * Convert an element to a text node.\n *\n * @param {Element} element - The element to be sanitized.\n * @returns {Node}\n * @private\n */\nfunction createTextNodeFromTextContent(element) {\n return element.ownerDocument.createTextNode(element.textContent);\n}\n/**\n * Check if element is allowed in the translation.\n *\n * This method is used by the sanitizer when the translation markup contains\n * an element which is not present in the source code.\n *\n * @param {Element} element\n * @returns {boolean}\n * @private\n */\nfunction isElementAllowed(element) {\n const allowed = TEXT_LEVEL_ELEMENTS[element.namespaceURI];\n return allowed && allowed.includes(element.localName);\n}\n/**\n * Check if attribute is allowed for the given element.\n *\n * This method is used by the sanitizer when the translation markup contains\n * DOM attributes, or when the translation has traits which map to DOM\n * attributes.\n *\n * `explicitlyAllowed` can be passed as a list of attributes explicitly\n * allowed on this element.\n *\n * @param {string} name\n * @param {Element} element\n * @param {Array} explicitlyAllowed\n * @returns {boolean}\n * @private\n */\nfunction isAttrNameLocalizable(name, element, explicitlyAllowed = null) {\n if (explicitlyAllowed && explicitlyAllowed.includes(name)) {\n return true;\n }\n const allowed = LOCALIZABLE_ATTRIBUTES[element.namespaceURI];\n if (!allowed) {\n return false;\n }\n const attrName = name.toLowerCase();\n const elemName = element.localName;\n // Is it a globally safe attribute?\n if (allowed.global.includes(attrName)) {\n return true;\n }\n // Are there no allowed attributes for this element?\n if (!allowed[elemName]) {\n return false;\n }\n // Is it allowed on this element?\n if (allowed[elemName].includes(attrName)) {\n return true;\n }\n // Special case for value on HTML inputs with type button, reset, submit\n if (element.namespaceURI === \"http://www.w3.org/1999/xhtml\" &&\n elemName === \"input\" &&\n attrName === \"value\") {\n const type = element.type.toLowerCase();\n if (type === \"submit\" || type === \"button\" || type === \"reset\") {\n return true;\n }\n }\n return false;\n}\n/**\n * Helper to set textContent and localizable attributes on an element.\n *\n * @param {Element} fromElement\n * @param {Element} toElement\n * @returns {Element}\n * @private\n */\nfunction shallowPopulateUsing(fromElement, toElement) {\n toElement.textContent = fromElement.textContent;\n overlayAttributes(fromElement, toElement);\n return toElement;\n}\n","/*\n * Base CachedIterable class.\n */\nexport default class CachedIterable extends Array {\n /**\n * Create a `CachedIterable` instance from an iterable or, if another\n * instance of `CachedIterable` is passed, return it without any\n * modifications.\n *\n * @param {Iterable} iterable\n * @returns {CachedIterable}\n */\n static from(iterable) {\n if (iterable instanceof this) {\n return iterable;\n }\n\n return new this(iterable);\n }\n}\n","import CachedIterable from \"./cached_iterable.mjs\";\n\n/*\n * CachedSyncIterable caches the elements yielded by an iterable.\n *\n * It can be used to iterate over an iterable many times without depleting the\n * iterable.\n */\nexport default class CachedSyncIterable extends CachedIterable {\n /**\n * Create an `CachedSyncIterable` instance.\n *\n * @param {Iterable} iterable\n * @returns {CachedSyncIterable}\n */\n constructor(iterable) {\n super();\n\n if (Symbol.iterator in Object(iterable)) {\n this.iterator = iterable[Symbol.iterator]();\n } else {\n throw new TypeError(\"Argument must implement the iteration protocol.\");\n }\n }\n\n [Symbol.iterator]() {\n const cached = this;\n let cur = 0;\n\n return {\n next() {\n if (cached.length <= cur) {\n cached.push(cached.iterator.next());\n }\n return cached[cur++];\n }\n };\n }\n\n /**\n * This method allows user to consume the next element from the iterator\n * into the cache.\n *\n * @param {number} count - number of elements to consume\n */\n touchNext(count = 1) {\n let idx = 0;\n while (idx++ < count) {\n const last = this[this.length - 1];\n if (last && last.done) {\n break;\n }\n this.push(this.iterator.next());\n }\n // Return the last cached {value, done} object to allow the calling\n // code to decide if it needs to call touchNext again.\n return this[this.length - 1];\n }\n}\n","import CachedIterable from \"./cached_iterable.mjs\";\n\n/*\n * CachedAsyncIterable caches the elements yielded by an async iterable.\n *\n * It can be used to iterate over an iterable many times without depleting the\n * iterable.\n */\nexport default class CachedAsyncIterable extends CachedIterable {\n /**\n * Create an `CachedAsyncIterable` instance.\n *\n * @param {Iterable} iterable\n * @returns {CachedAsyncIterable}\n */\n constructor(iterable) {\n super();\n\n if (Symbol.asyncIterator in Object(iterable)) {\n this.iterator = iterable[Symbol.asyncIterator]();\n } else if (Symbol.iterator in Object(iterable)) {\n this.iterator = iterable[Symbol.iterator]();\n } else {\n throw new TypeError(\"Argument must implement the iteration protocol.\");\n }\n }\n\n /**\n * Asynchronous iterator caching the yielded elements.\n *\n * Elements yielded by the original iterable will be cached and available\n * synchronously. Returns an async generator object implementing the\n * iterator protocol over the elements of the original (async or sync)\n * iterable.\n */\n [Symbol.asyncIterator]() {\n const cached = this;\n let cur = 0;\n\n return {\n async next() {\n if (cached.length <= cur) {\n cached.push(cached.iterator.next());\n }\n return cached[cur++];\n }\n };\n }\n\n /**\n * This method allows user to consume the next element from the iterator\n * into the cache.\n *\n * @param {number} count - number of elements to consume\n */\n async touchNext(count = 1) {\n let idx = 0;\n while (idx++ < count) {\n const last = this[this.length - 1];\n if (last && (await last).done) {\n break;\n }\n this.push(this.iterator.next());\n }\n // Return the last cached {value, done} object to allow the calling\n // code to decide if it needs to call touchNext again.\n return this[this.length - 1];\n }\n}\n","export {default as CachedSyncIterable} from \"./cached_sync_iterable.mjs\";\nexport {default as CachedAsyncIterable} from \"./cached_async_iterable.mjs\";\n","/* eslint no-console: [\"error\", { allow: [\"warn\", \"error\"] }] */\n/* global console */\nimport { CachedAsyncIterable } from \"cached-iterable\";\n/**\n * The `Localization` class is a central high-level API for vanilla\n * JavaScript use of Fluent.\n * It combines language negotiation, FluentBundle and I/O to\n * provide a scriptable API to format translations.\n */\nexport default class Localization {\n /**\n * @param {Array<String>} resourceIds - List of resource IDs\n * @param {Function} generateBundles - Function that returns a\n * generator over FluentBundles\n *\n * @returns {Localization}\n */\n constructor(resourceIds = [], generateBundles) {\n this.resourceIds = resourceIds;\n this.generateBundles = generateBundles;\n this.onChange(true);\n }\n addResourceIds(resourceIds, eager = false) {\n this.resourceIds.push(...resourceIds);\n this.onChange(eager);\n return this.resourceIds.length;\n }\n removeResourceIds(resourceIds) {\n this.resourceIds = this.resourceIds.filter(r => !resourceIds.includes(r));\n this.onChange();\n return this.resourceIds.length;\n }\n /**\n * Format translations and handle fallback if needed.\n *\n * Format translations for `keys` from `FluentBundle` instances on this\n * DOMLocalization. In case of errors, fetch the next context in the\n * fallback chain.\n *\n * @param {Array<Object>} keys - Translation keys to format.\n * @param {Function} method - Formatting function.\n * @returns {Promise<Array<string|Object>>}\n * @private\n */\n async formatWithFallback(keys, method) {\n const translations = [];\n let hasAtLeastOneBundle = false;\n for await (const bundle of this.bundles) {\n hasAtLeastOneBundle = true;\n const missingIds = keysFromBundle(method, bundle, keys, translations);\n if (missingIds.size === 0) {\n break;\n }\n if (typeof console !== \"undefined\") {\n const locale = bundle.locales[0];\n const ids = Array.from(missingIds).join(\", \");\n console.warn(`[fluent] Missing translations in ${locale}: ${ids}`);\n }\n }\n if (!hasAtLeastOneBundle && typeof console !== \"undefined\") {\n // eslint-disable-next-line max-len\n console.warn(`[fluent] Request for keys failed because no resource bundles got generated.\n keys: ${JSON.stringify(keys)}.\n resourceIds: ${JSON.stringify(this.resourceIds)}.`);\n }\n return translations;\n }\n /**\n * Format translations into `{value, attributes}` objects.\n *\n * The fallback logic is the same as in `formatValues`\n * but it returns `{value, attributes}` objects\n * which are suitable for the translation of DOM elements.\n *\n * Returns a Promise resolving to an array of the translation strings.\n *\n * @example\n * ```js\n * docL10n.formatMessages([\n * {id: 'hello', args: { who: 'Mary' }},\n * {id: 'welcome'}\n * ]).then(console.log);\n *\n * // [\n * // { value: 'Hello, Mary!', attributes: null },\n * // {\n * // value: 'Welcome!',\n * // attributes: [ { name: \"title\", value: 'Hello' } ]\n * // }\n * // ]\n * ```\n *\n * @param {Array<Object>} keys\n * @returns {Promise<Array<{value: string, attributes: Object}>>}\n * @private\n */\n formatMessages(keys) {\n return this.formatWithFallback(keys, messageFromBundle);\n }\n /**\n * Retrieve translations corresponding to the passed keys.\n *\n * A generalized version of `DOMLocalization.formatValue`. Keys must\n * be `{id, args}` objects.\n *\n * Returns a Promise resolving to an array of the translation strings.\n *\n * @example\n * ```js\n * docL10n.formatValues([\n * {id: 'hello', args: { who: 'Mary' }},\n * {id: 'hello', args: { who: 'John' }},\n * {id: 'welcome'}\n * ]).then(console.log);\n *\n * // ['Hello, Mary!', 'Hello, John!', 'Welcome!']\n * ```\n *\n * @param {Array<Object>} keys\n * @returns {Promise<Array<string>>}\n */\n formatValues(keys) {\n return this.formatWithFallback(keys, valueFromBundle);\n }\n /**\n * Retrieve the translation corresponding to the `id` identifier.\n *\n * If passed, `args` is a simple hash object with a list of variables that\n * will be interpolated in the value of the translation.\n *\n * Returns a Promise resolving to the translation string.\n *\n * Use this sparingly for one-off messages which don't need to be\n * retranslated when the user changes their language preferences, e.g. in\n * notifications.\n *\n * @example\n * ```js\n * docL10n.formatValue(\n * 'hello', { who: 'world' }\n * ).then(console.log);\n *\n * // 'Hello, world!'\n * ```\n *\n * @param {string} id - Identifier of the translation to format\n * @param {Object} [args] - Optional external arguments\n * @returns {Promise<string>}\n */\n async formatValue(id, args) {\n const [val] = await this.formatValues([{ id, args }]);\n return val;\n }\n handleEvent() {\n this.onChange();\n }\n /**\n * This method should be called when there's a reason to believe\n * that language negotiation or available resources changed.\n */\n onChange(eager = false) {\n this.bundles = CachedAsyncIterable.from(this.generateBundles(this.resourceIds));\n if (eager) {\n this.bundles.touchNext(2);\n }\n }\n}\n/**\n * Format the value of a message into a string or `null`.\n *\n * This function is passed as a method to `keysFromBundle` and resolve\n * a value of a single L10n Entity using provided `FluentBundle`.\n *\n * If the message doesn't have a value, return `null`.\n *\n * @param {FluentBundle} bundle\n * @param {Array<Error>} errors\n * @param {Object} message\n * @param {Object} args\n * @returns {string|null}\n * @private\n */\nfunction valueFromBundle(bundle, errors, message, args) {\n if (message.value) {\n return bundle.formatPattern(message.value, args, errors);\n }\n return null;\n}\n/**\n * Format all public values of a message into a {value, attributes} object.\n *\n * This function is passed as a method to `keysFromBundle` and resolve\n * a single L10n Entity using provided `FluentBundle`.\n *\n * The function will return an object with a value and attributes of the\n * entity.\n *\n * @param {FluentBundle} bundle\n * @param {Array<Error>} errors\n * @param {Object} message\n * @param {Object} args\n * @returns {Object}\n * @private\n */\nfunction messageFromBundle(bundle, errors, message, args) {\n const formatted = {\n value: null,\n attributes: null,\n };\n if (message.value) {\n formatted.value = bundle.formatPattern(message.value, args, errors);\n }\n let attrNames = Object.keys(message.attributes);\n if (attrNames.length > 0) {\n formatted.attributes = new Array(attrNames.length);\n for (let [i, name] of attrNames.entries()) {\n let value = bundle.formatPattern(message.attributes[name], args, errors);\n formatted.attributes[i] = { name, value };\n }\n }\n return formatted;\n}\n/**\n * This function is an inner function for `Localization.formatWithFallback`.\n *\n * It takes a `FluentBundle`, list of l10n-ids and a method to be used for\n * key resolution (either `valueFromBundle` or `messageFromBundle`) and\n * optionally a value returned from `keysFromBundle` executed against\n * another `FluentBundle`.\n *\n * The idea here is that if the previous `FluentBundle` did not resolve\n * all keys, we're calling this function with the next context to resolve\n * the remaining ones.\n *\n * In the function, we loop over `keys` and check if we have the `prev`\n * passed and if it has an error entry for the position we're in.\n *\n * If it doesn't, it means that we have a good translation for this key and\n * we return it. If it does, we'll try to resolve the key using the passed\n * `FluentBundle`.\n *\n * In the end, we fill the translations array, and return the Set with\n * missing ids.\n *\n * See `Localization.formatWithFallback` for more info on how this is used.\n *\n * @param {Function} method\n * @param {FluentBundle} bundle\n * @param {Array<string>} keys\n * @param {{Array<{value: string, attributes: Object}>}} translations\n *\n * @returns {Set<string>}\n * @private\n */\nfunction keysFromBundle(method, bundle, keys, translations) {\n const messageErrors = [];\n const missingIds = new Set();\n keys.forEach(({ id, args }, i) => {\n if (translations[i] !== undefined) {\n return;\n }\n let message = bundle.getMessage(id);\n if (message) {\n messageErrors.length = 0;\n translations[i] = method(bundle, messageErrors, message, args);\n if (messageErrors.length > 0 && typeof console !== \"undefined\") {\n const locale = bundle.locales[0];\n const errors = messageErrors.join(\", \");\n // eslint-disable-next-line max-len\n console.warn(`[fluent][resolver] errors in ${locale}/${id}: ${errors}.`);\n }\n }\n else {\n missingIds.add(id);\n }\n });\n return missingIds;\n}\n","import translateElement from \"./overlay.js\";\nimport Localization from \"./localization.js\";\nconst L10NID_ATTR_NAME = \"data-l10n-id\";\nconst L10NARGS_ATTR_NAME = \"data-l10n-args\";\nconst L10N_ELEMENT_QUERY = `[${L10NID_ATTR_NAME}]`;\n/**\n * The `DOMLocalization` class is responsible for fetching resources and\n * formatting translations.\n *\n * It implements the fallback strategy in case of errors encountered during the\n * formatting of translations and methods for observing DOM\n * trees with a `MutationObserver`.\n */\nexport default class DOMLocalization extends Localization {\n /**\n * @param {Array<String>} resourceIds - List of resource IDs\n * @param {Function} generateBundles - Function that returns a\n * generator over FluentBundles\n * @returns {DOMLocalization}\n */\n constructor(resourceIds, generateBundles) {\n super(resourceIds, generateBundles);\n // A Set of DOM trees observed by the `MutationObserver`.\n this.roots = new Set();\n // requestAnimationFrame handler.\n this.pendingrAF = null;\n // list of elements pending for translation.\n this.pendingElements = new Set();\n this.windowElement = null;\n this.mutationObserver = null;\n this.observerConfig = {\n attributes: true,\n characterData: false,\n childList: true,\n subtree: true,\n attributeFilter: [L10NID_ATTR_NAME, L10NARGS_ATTR_NAME],\n };\n }\n onChange(eager = false) {\n super.onChange(eager);\n if (this.roots) {\n this.translateRoots();\n }\n }\n /**\n * Set the `data-l10n-id` and `data-l10n-args` attributes on DOM elements.\n * FluentDOM makes use of mutation observers to detect changes\n * to `data-l10n-*` attributes and translate elements asynchronously.\n * `setAttributes` is a convenience method which allows to translate\n * DOM elements declaratively.\n *\n * You should always prefer to use `data-l10n-id` on elements (statically in\n * HTML or dynamically via `setAttributes`) over manually retrieving\n * translations with `format`. The use of attributes ensures that the\n * elements can be retranslated when the user changes their language\n * preferences.\n *\n * ```javascript\n * localization.setAttributes(\n * document.querySelector('#welcome'), 'hello', { who: 'world' }\n * );\n * ```\n *\n * This will set the following attributes on the `#welcome` element.\n * The MutationObserver will pick up this change and will localize the element\n * asynchronously.\n *\n * ```html\n * <p id='welcome'\n * data-l10n-id='hello'\n * data-l10n-args='{\"who\": \"world\"}'>\n * </p>\n * ```\n *\n * @param {Element} element - Element to set attributes on\n * @param {string} id - l10n-id string\n * @param {Object<string, string>} args - KVP list of l10n arguments\n * @returns {Element}\n */\n setAttributes(element, id, args) {\n element.setAttribute(L10NID_ATTR_NAME, id);\n if (args) {\n element.setAttribute(L10NARGS_ATTR_NAME, JSON.stringify(args));\n }\n else {\n element.removeAttribute(L10NARGS_ATTR_NAME);\n }\n return element;\n }\n /**\n * Get the `data-l10n-*` attributes from DOM elements.\n *\n * ```javascript\n * localization.getAttributes(\n * document.querySelector('#welcome')\n * );\n * // -> { id: 'hello', args: { who: 'world' } }\n * ```\n *\n * @param {Element} element - HTML element\n * @returns {{id: string, args: Object}}\n */\n getAttributes(element) {\n return {\n id: element.getAttribute(L10NID_ATTR_NAME),\n args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null),\n };\n }\n /**\n * Add `newRoot` to the list of roots managed by this `DOMLocalization`.\n *\n * Additionally, if this `DOMLocalization` has an observer, start observing\n * `newRoot` in order to translate mutations in it.\n *\n * @param {Element} 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} 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 {DOMFragment} frag - Element or DocumentFragment to be translated\n * @returns {Promise}\n */\n translateFragment(frag) {\n return this.translateElements(this.getTranslatables(frag));\n }\n /**\n * Translate a list of DOM elements asynchronously using this\n * `DOMLocalization` object.\n *\n * Manually trigger the translation (or re-translation) of a list of elements.\n * Use the `data-l10n-id` and `data-l10n-args` attributes to mark up the DOM\n * with information about which translations to use.\n *\n * Returns a `Promise` that gets resolved once the translation is complete.\n *\n * @param {Array<Element>} elements - List of elements to be translated\n * @returns {Promise}\n */\n async translateElements(elements) {\n if (!elements.length) {\n return undefined;\n }\n const keys = elements.map(this.getKeysForElement);\n const translations = await this.formatMessages(keys);\n return this.applyTranslations(elements, translations);\n }\n /**\n * Applies translations onto elements.\n *\n * @param {Array<Element>} elements\n * @param {Array<Object>} translations\n * @private\n */\n applyTranslations(elements, translations) {\n this.pauseObserving();\n for (let i = 0; i < elements.length; i++) {\n if (translations[i] !== undefined) {\n translateElement(elements[i], translations[i]);\n }\n }\n this.resumeObserving();\n }\n /**\n * Collects all translatable child elements of the element.\n *\n * @param {Element} element\n * @returns {Array<Element>}\n * @private\n */\n getTranslatables(element) {\n const nodes = Array.from(element.querySelectorAll(L10N_ELEMENT_QUERY));\n if (typeof element.hasAttribute === \"function\" &&\n element.hasAttribute(L10NID_ATTR_NAME)) {\n nodes.push(element);\n }\n return nodes;\n }\n /**\n * Get the `data-l10n-*` attributes from DOM elements as a two-element\n * array.\n *\n * @param {Element} element\n * @returns {Object}\n * @private\n */\n getKeysForElement(element) {\n return {\n id: element.getAttribute(L10NID_ATTR_NAME),\n args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null),\n };\n }\n}\n","export { default as DOMLocalization } from \"./dom_localization.js\";\nexport { default as Localization } from \"./localization.js\";\n","/* Copyright 2023 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @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 = new Set();\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.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 for (const element of this.#elements) {\n this.#l10n.disconnectRoot(element);\n }\n this.#elements.clear();\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 { FluentBundle, FluentResource } from \"fluent-bundle\";\nimport { DOMLocalization } from \"fluent-dom\";\nimport { fetchData } from \"pdfjs-lib\";\nimport { L10n } from \"./l10n.js\";\n\nfunction createBundle(lang, text) {\n const resource = new FluentResource(text);\n const bundle = new FluentBundle(lang);\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 for (const lang of langs) {\n const bundle = await this.#createBundle(lang, baseURL, paths);\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 { baseURL: href.replace(/[^/]*$/, \"\") || \"./\", paths };\n } catch {}\n return { baseURL: \"./\", paths: Object.create(null) };\n }\n\n static async *#generateBundlesFallback(lang) {\n yield this.#createBundleFallback(lang);\n }\n\n static async #createBundleFallback(lang) {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n throw new Error(\"Not implemented: #createBundleFallback\");\n }\n const text =\n typeof PDFJSDev === \"undefined\"\n ? await fetchData(\n new URL(\"../l10n/en-US/viewer.ftl\", window.location.href),\n /* type = */ \"text\"\n )\n : PDFJSDev.eval(\"DEFAULT_FTL\");\n\n return createBundle(lang, text);\n }\n}\n\nexport { GenericL10n };\n","/* Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getPdfFilenameFromUrl } from \"pdfjs-lib\";\n\nasync function docProperties(pdfDocument) {\n const url = \"\",\n baseUrl = url.split(\"#\", 1)[0];\n // eslint-disable-next-line prefer-const\n let { info, metadata, contentDispositionFilename, contentLength } =\n await pdfDocument.getMetadata();\n\n if (!contentLength) {\n const { length } = await pdfDocument.getDownloadInfo();\n contentLength = length;\n }\n\n return {\n ...info,\n baseURL: baseUrl,\n filesize: contentLength,\n filename: contentDispositionFilename || getPdfFilenameFromUrl(url),\n metadata: metadata?.getRaw(),\n authors: metadata?.get(\"dc:creator\"),\n numPages: pdfDocument.numPages,\n URL: url,\n };\n}\n\nclass GenericScripting {\n constructor(sandboxBundleSrc) {\n this._ready = new Promise((resolve, reject) => {\n const sandbox =\n typeof PDFJSDev === \"undefined\"\n ? import(sandboxBundleSrc) // eslint-disable-line no-unsanitized/method\n : __non_webpack_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 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AppOptions } from \"./app_options.js\";\nimport { BaseExternalServices } from \"./external_services.js\";\nimport { BasePreferences } from \"./preferences.js\";\nimport { GenericL10n } from \"./genericl10n.js\";\nimport { GenericScripting } from \"./generic_scripting.js\";\n\nif (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"GENERIC\")) {\n throw new Error(\n 'Module \"pdfjs-web/genericcom\" shall not be used outside GENERIC build.'\n );\n}\n\nfunction initCom(app) {}\n\nclass Preferences extends BasePreferences {\n async _writeToStorage(prefObj) {\n localStorage.setItem(\"pdfjs.preferences\", JSON.stringify(prefObj));\n }\n\n async _readFromStorage(prefObj) {\n return { prefs: JSON.parse(localStorage.getItem(\"pdfjs.preferences\")) };\n }\n}\n\nclass ExternalServices extends BaseExternalServices {\n async createL10n() {\n return new GenericL10n(AppOptions.get(\"localeProperties\")?.lang);\n }\n\n createScripting() {\n return new GenericScripting(AppOptions.get(\"sandboxBundleSrc\"));\n }\n}\n\nclass MLManager {\n async isEnabledFor(_name) {\n return false;\n }\n\n async deleteModel(_service) {\n return null;\n }\n\n isReady(_name) {\n return false;\n }\n\n guess(_data) {}\n\n toggleService(_name, _enabled) {}\n\n static getFakeMLManager(options) {\n return new FakeMLManager(options);\n }\n}\n\nclass FakeMLManager {\n eventBus = null;\n\n hasProgress = false;\n\n constructor({ enableGuessAltText, enableAltTextModelDownload }) {\n this.enableGuessAltText = enableGuessAltText;\n this.enableAltTextModelDownload = enableAltTextModelDownload;\n }\n\n setEventBus(eventBus, abortSignal) {\n this.eventBus = eventBus;\n }\n\n async isEnabledFor(_name) {\n return this.enableGuessAltText;\n }\n\n async deleteModel(_name) {\n this.enableAltTextModelDownload = false;\n return null;\n }\n\n async loadModel(_name) {}\n\n async downloadModel(_name) {\n // Simulate downloading the model but with progress.\n // The progress can be seen in the new alt-text dialog.\n this.hasProgress = true;\n\n const { promise, resolve } = Promise.withResolvers();\n const total = 1e8;\n const end = 1.5 * total;\n const increment = 5e6;\n let loaded = 0;\n const id = setInterval(() => {\n loaded += increment;\n if (loaded <= end) {\n this.eventBus.dispatch(\"loadaiengineprogress\", {\n source: this,\n detail: {\n total,\n totalLoaded: loaded,\n finished: loaded + increment >= end,\n },\n });\n return;\n }\n clearInterval(id);\n this.hasProgress = false;\n this.enableAltTextModelDownload = true;\n resolve(true);\n }, 900);\n return promise;\n }\n\n isReady(_name) {\n return this.enableAltTextModelDownload;\n }\n\n guess({ request: { data } }) {\n return new Promise(resolve => {\n setTimeout(() => {\n resolve(data ? { output: \"Fake alt text\" } : { error: true });\n }, 3000);\n });\n }\n\n toggleService(_name, enabled) {\n this.enableGuessAltText = enabled;\n }\n}\n\nexport { ExternalServices, initCom, MLManager, Preferences };\n","/* Copyright 2024 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { noContextMenu } from \"pdfjs-lib\";\n\nclass NewAltTextManager {\n #boundCancel = this.#cancel.bind(this);\n\n #createAutomaticallyButton;\n\n #currentEditor = null;\n\n #cancelButton;\n\n #descriptionContainer;\n\n #dialog;\n\n #disclaimer;\n\n #downloadModel;\n\n #downloadModelDescription;\n\n #eventBus;\n\n #firstTime = false;\n\n #guessedAltText;\n\n #hasAI = null;\n\n #isEditing = null;\n\n #imagePreview;\n\n #imageData;\n\n #isAILoading = false;\n\n #wasAILoading = false;\n\n #learnMore;\n\n #notNowButton;\n\n #overlayManager;\n\n #textarea;\n\n #title;\n\n #uiManager;\n\n #previousAltText = null;\n\n constructor(\n {\n descriptionContainer,\n dialog,\n imagePreview,\n cancelButton,\n disclaimer,\n notNowButton,\n saveButton,\n textarea,\n learnMore,\n errorCloseButton,\n createAutomaticallyButton,\n downloadModel,\n downloadModelDescription,\n title,\n },\n overlayManager,\n eventBus\n ) {\n this.#cancelButton = cancelButton;\n this.#createAutomaticallyButton = createAutomaticallyButton;\n this.#descriptionContainer = descriptionContainer;\n this.#dialog = dialog;\n this.#disclaimer = disclaimer;\n this.#notNowButton = notNowButton;\n this.#imagePreview = imagePreview;\n this.#textarea = textarea;\n this.#learnMore = learnMore;\n this.#title = title;\n this.#downloadModel = downloadModel;\n this.#downloadModelDescription = downloadModelDescription;\n this.#overlayManager = overlayManager;\n this.#eventBus = eventBus;\n\n dialog.addEventListener(\"close\", this.#close.bind(this));\n dialog.addEventListener(\"contextmenu\", event => {\n if (event.target !== this.#textarea) {\n event.preventDefault();\n }\n });\n cancelButton.addEventListener(\"click\", this.#boundCancel);\n notNowButton.addEventListener(\"click\", this.#boundCancel);\n saveButton.addEventListener(\"click\", this.#save.bind(this));\n errorCloseButton.addEventListener(\"click\", () => {\n this.#toggleError(false);\n });\n createAutomaticallyButton.addEventListener(\"click\", async () => {\n const checked =\n createAutomaticallyButton.getAttribute(\"aria-pressed\") !== \"true\";\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.image.alt_text.ai_generation_check\",\n data: { status: checked },\n });\n\n if (this.#uiManager) {\n this.#uiManager.setPreference(\"enableGuessAltText\", checked);\n await this.#uiManager.mlManager.toggleService(\"altText\", checked);\n }\n this.#toggleGuessAltText(checked, /* isInitial = */ false);\n });\n textarea.addEventListener(\"focus\", () => {\n this.#wasAILoading = this.#isAILoading;\n this.#toggleLoading(false);\n this.#toggleTitleAndDisclaimer();\n });\n textarea.addEventListener(\"blur\", () => {\n if (!textarea.value) {\n this.#toggleLoading(this.#wasAILoading);\n }\n this.#toggleTitleAndDisclaimer();\n });\n textarea.addEventListener(\"input\", () => {\n this.#toggleTitleAndDisclaimer();\n });\n\n eventBus._on(\"enableguessalttext\", ({ value }) => {\n this.#toggleGuessAltText(value, /* isInitial = */ false);\n });\n\n this.#overlayManager.register(dialog);\n\n this.#learnMore.addEventListener(\"click\", () => {\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.image.alt_text.info\",\n data: { topic: \"alt_text\" },\n });\n });\n }\n\n #toggleLoading(value) {\n if (!this.#uiManager || this.#isAILoading === value) {\n return;\n }\n this.#isAILoading = value;\n this.#descriptionContainer.classList.toggle(\"loading\", value);\n }\n\n #toggleError(value) {\n if (!this.#uiManager) {\n return;\n }\n this.#dialog.classList.toggle(\"error\", value);\n }\n\n async #toggleGuessAltText(value, isInitial = false) {\n if (!this.#uiManager) {\n return;\n }\n this.#dialog.classList.toggle(\"aiDisabled\", !value);\n this.#createAutomaticallyButton.setAttribute(\"aria-pressed\", value);\n\n if (value) {\n const { altTextLearnMoreUrl } = this.#uiManager.mlManager;\n if (altTextLearnMoreUrl) {\n this.#learnMore.href = altTextLearnMoreUrl;\n }\n this.#mlGuessAltText(isInitial);\n } else {\n this.#toggleLoading(false);\n this.#isAILoading = false;\n this.#toggleTitleAndDisclaimer();\n }\n }\n\n #toggleNotNow() {\n this.#notNowButton.classList.toggle(\"hidden\", !this.#firstTime);\n this.#cancelButton.classList.toggle(\"hidden\", this.#firstTime);\n }\n\n #toggleAI(value) {\n if (!this.#uiManager || this.#hasAI === value) {\n return;\n }\n this.#hasAI = value;\n this.#dialog.classList.toggle(\"noAi\", !value);\n this.#toggleTitleAndDisclaimer();\n }\n\n #toggleTitleAndDisclaimer() {\n // Disclaimer is visible when the AI is loading or the user didn't change\n // the guessed alt text.\n const visible =\n this.#isAILoading ||\n (this.#guessedAltText && this.#guessedAltText === this.#textarea.value);\n this.#disclaimer.hidden = !visible;\n\n // The title changes depending if the text area is empty or not.\n const isEditing = this.#isAILoading || !!this.#textarea.value;\n if (this.#isEditing === isEditing) {\n return;\n }\n this.#isEditing = isEditing;\n this.#title.setAttribute(\n \"data-l10n-id\",\n isEditing\n ? \"pdfjs-editor-new-alt-text-dialog-edit-label\"\n : \"pdfjs-editor-new-alt-text-dialog-add-label\"\n );\n }\n\n async #mlGuessAltText(isInitial) {\n if (this.#isAILoading) {\n // We're still loading the previous guess.\n return;\n }\n\n if (this.#textarea.value) {\n // The user has already set an alt text.\n return;\n }\n\n if (isInitial && this.#previousAltText !== null) {\n // The user has already set an alt text (empty or not).\n return;\n }\n\n this.#guessedAltText = this.#currentEditor.guessedAltText;\n if (this.#previousAltText === null && this.#guessedAltText) {\n // We have a guessed alt text and the user didn't change it.\n this.#addAltText(this.#guessedAltText);\n return;\n }\n\n this.#toggleLoading(true);\n this.#toggleTitleAndDisclaimer();\n\n let hasError = false;\n try {\n // When calling #mlGuessAltText we don't wait for it, so we must take care\n // that the alt text dialog can have been closed before the response is.\n\n const altText = await this.#currentEditor.mlGuessAltText(\n this.#imageData,\n /* updateAltTextData = */ false\n );\n if (altText) {\n this.#guessedAltText = altText;\n this.#wasAILoading = this.#isAILoading;\n if (this.#isAILoading) {\n this.#addAltText(altText);\n }\n }\n } catch (e) {\n console.error(e);\n hasError = true;\n }\n\n this.#toggleLoading(false);\n this.#toggleTitleAndDisclaimer();\n\n if (hasError && this.#uiManager) {\n this.#toggleError(true);\n }\n }\n\n #addAltText(altText) {\n if (!this.#uiManager || this.#textarea.value) {\n return;\n }\n this.#textarea.value = altText;\n this.#toggleTitleAndDisclaimer();\n }\n\n #setProgress() {\n // Show the download model progress.\n this.#downloadModel.classList.toggle(\"hidden\", false);\n\n const callback = async ({ detail: { finished, total, totalLoaded } }) => {\n const ONE_MEGA_BYTES = 1e6;\n // totalLoaded can be greater than total if the download is compressed.\n // So we cheat to avoid any confusion.\n totalLoaded = Math.min(0.99 * total, totalLoaded);\n\n // Update the progress.\n const totalSize = (this.#downloadModelDescription.ariaValueMax =\n Math.round(total / ONE_MEGA_BYTES));\n const downloadedSize = (this.#downloadModelDescription.ariaValueNow =\n Math.round(totalLoaded / ONE_MEGA_BYTES));\n this.#downloadModelDescription.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({ totalSize, downloadedSize })\n );\n if (!finished) {\n return;\n }\n\n // We're done, remove the listener and hide the download model progress.\n this.#eventBus._off(\"loadaiengineprogress\", callback);\n this.#downloadModel.classList.toggle(\"hidden\", true);\n\n this.#toggleAI(true);\n if (!this.#uiManager) {\n return;\n }\n const { mlManager } = this.#uiManager;\n\n // The model has been downloaded, we can now enable the AI service.\n mlManager.toggleService(\"altText\", true);\n this.#toggleGuessAltText(\n await mlManager.isEnabledFor(\"altText\"),\n /* isInitial = */ true\n );\n };\n this.#eventBus._on(\"loadaiengineprogress\", callback);\n }\n\n async editAltText(uiManager, editor, firstTime) {\n if (this.#currentEditor || !editor) {\n return;\n }\n\n if (firstTime && editor.hasAltTextData()) {\n editor.altTextFinish();\n return;\n }\n\n this.#firstTime = firstTime;\n let { mlManager } = uiManager;\n let hasAI = !!mlManager;\n this.#toggleTitleAndDisclaimer();\n\n if (mlManager && !mlManager.isReady(\"altText\")) {\n hasAI = false;\n if (mlManager.hasProgress) {\n this.#setProgress();\n } else {\n mlManager = null;\n }\n } else {\n this.#downloadModel.classList.toggle(\"hidden\", true);\n }\n\n const isAltTextEnabledPromise = mlManager?.isEnabledFor(\"altText\");\n\n this.#currentEditor = editor;\n this.#uiManager = uiManager;\n this.#uiManager.removeEditListeners();\n\n ({ altText: this.#previousAltText } = editor.altTextData);\n this.#textarea.value = this.#previousAltText ?? \"\";\n\n // TODO: get this value from Firefox\n // (https://bugzilla.mozilla.org/show_bug.cgi?id=1908184)\n const AI_MAX_IMAGE_DIMENSION = 224;\n const MAX_PREVIEW_DIMENSION = 180;\n\n // The max dimension of the preview in the dialog is 180px, so we keep 224px\n // and rescale it thanks to css.\n\n let canvas, width, height;\n if (mlManager) {\n ({\n canvas,\n width,\n height,\n imageData: this.#imageData,\n } = editor.copyCanvas(\n AI_MAX_IMAGE_DIMENSION,\n MAX_PREVIEW_DIMENSION,\n /* createImageData = */ true\n ));\n if (hasAI) {\n this.#toggleGuessAltText(\n await isAltTextEnabledPromise,\n /* isInitial = */ true\n );\n }\n } else {\n ({ canvas, width, height } = editor.copyCanvas(\n AI_MAX_IMAGE_DIMENSION,\n MAX_PREVIEW_DIMENSION,\n /* createImageData = */ false\n ));\n }\n\n canvas.setAttribute(\"role\", \"presentation\");\n const { style } = canvas;\n style.width = `${width}px`;\n style.height = `${height}px`;\n this.#imagePreview.append(canvas);\n\n this.#toggleNotNow();\n this.#toggleAI(hasAI);\n this.#toggleError(false);\n\n try {\n await this.#overlayManager.open(this.#dialog);\n } catch (ex) {\n this.#close();\n throw ex;\n }\n }\n\n #cancel() {\n this.#currentEditor.altTextData = {\n cancel: true,\n };\n const altText = this.#textarea.value.trim();\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.image.alt_text.dismiss\",\n data: {\n alt_text_type: altText ? \"present\" : \"empty\",\n flow: this.#firstTime ? \"image_add\" : \"alt_text_edit\",\n },\n });\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.image.image_added\",\n data: { alt_text_modal: true, alt_text_type: \"skipped\" },\n });\n this.#finish();\n }\n\n #finish() {\n if (this.#overlayManager.active === this.#dialog) {\n this.#overlayManager.close(this.#dialog);\n }\n }\n\n #close() {\n const canvas = this.#imagePreview.firstChild;\n canvas.remove();\n canvas.width = canvas.height = 0;\n this.#imageData = null;\n\n this.#toggleLoading(false);\n\n this.#uiManager?.addEditListeners();\n this.#currentEditor.altTextFinish();\n this.#uiManager?.setSelected(this.#currentEditor);\n this.#currentEditor = null;\n this.#uiManager = null;\n }\n\n #save() {\n const altText = this.#textarea.value.trim();\n this.#currentEditor.altTextData = {\n altText,\n decorative: false,\n };\n this.#currentEditor.altTextData.guessedAltText = this.#guessedAltText;\n\n if (this.#guessedAltText && this.#guessedAltText !== altText) {\n const guessedWords = new Set(this.#guessedAltText.split(/\\s+/));\n const words = new Set(altText.split(/\\s+/));\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.image.alt_text.user_edit\",\n data: {\n total_words: guessedWords.size,\n words_removed: guessedWords.difference(words).size,\n words_added: words.difference(guessedWords).size,\n },\n });\n }\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.image.image_added\",\n data: {\n alt_text_modal: true,\n alt_text_type: altText ? \"present\" : \"empty\",\n },\n });\n\n this.#currentEditor._reportTelemetry({\n action: \"pdfjs.image.alt_text.save\",\n data: {\n alt_text_type: altText ? \"present\" : \"empty\",\n flow: this.#firstTime ? \"image_add\" : \"alt_text_edit\",\n },\n });\n\n this.#finish();\n }\n\n destroy() {\n this.#uiManager = null; // Avoid re-adding the edit listeners.\n this.#finish();\n }\n}\n\nclass ImageAltTextSettings {\n #aiModelSettings;\n\n #createModelButton;\n\n #downloadModelButton;\n\n #dialog;\n\n #eventBus;\n\n #mlManager;\n\n #overlayManager;\n\n #showAltTextDialogButton;\n\n constructor(\n {\n dialog,\n createModelButton,\n aiModelSettings,\n learnMore,\n closeButton,\n deleteModelButton,\n downloadModelButton,\n showAltTextDialogButton,\n },\n overlayManager,\n eventBus,\n mlManager\n ) {\n this.#dialog = dialog;\n this.#aiModelSettings = aiModelSettings;\n this.#createModelButton = createModelButton;\n this.#downloadModelButton = downloadModelButton;\n this.#showAltTextDialogButton = showAltTextDialogButton;\n this.#overlayManager = overlayManager;\n this.#eventBus = eventBus;\n this.#mlManager = mlManager;\n\n const { altTextLearnMoreUrl } = mlManager;\n if (altTextLearnMoreUrl) {\n learnMore.href = altTextLearnMoreUrl;\n }\n\n dialog.addEventListener(\"contextmenu\", noContextMenu);\n\n createModelButton.addEventListener(\"click\", async e => {\n const checked = this.#togglePref(\"enableGuessAltText\", e);\n await mlManager.toggleService(\"altText\", checked);\n this.#reportTelemetry({\n type: \"stamp\",\n action: \"pdfjs.image.alt_text.settings_ai_generation_check\",\n data: { status: checked },\n });\n });\n\n showAltTextDialogButton.addEventListener(\"click\", e => {\n const checked = this.#togglePref(\"enableNewAltTextWhenAddingImage\", e);\n this.#reportTelemetry({\n type: \"stamp\",\n action: \"pdfjs.image.alt_text.settings_edit_alt_text_check\",\n data: { status: checked },\n });\n });\n\n deleteModelButton.addEventListener(\"click\", this.#delete.bind(this, true));\n downloadModelButton.addEventListener(\n \"click\",\n this.#download.bind(this, true)\n );\n\n closeButton.addEventListener(\"click\", this.#finish.bind(this));\n\n learnMore.addEventListener(\"click\", () => {\n this.#reportTelemetry({\n type: \"stamp\",\n action: \"pdfjs.image.alt_text.info\",\n data: { topic: \"ai_generation\" },\n });\n });\n\n eventBus._on(\"enablealttextmodeldownload\", ({ value }) => {\n if (value) {\n this.#download(false);\n } else {\n this.#delete(false);\n }\n });\n\n this.#overlayManager.register(dialog);\n }\n\n #reportTelemetry(data) {\n this.#eventBus.dispatch(\"reporttelemetry\", {\n source: this,\n details: {\n type: \"editing\",\n data,\n },\n });\n }\n\n async #download(isFromUI = false) {\n if (isFromUI) {\n this.#downloadModelButton.disabled = true;\n const span = this.#downloadModelButton.firstChild;\n span.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-alt-text-settings-downloading-model-button\"\n );\n\n await this.#mlManager.downloadModel(\"altText\");\n\n span.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-editor-alt-text-settings-download-model-button\"\n );\n\n this.#createModelButton.disabled = false;\n this.#setPref(\"enableGuessAltText\", true);\n this.#mlManager.toggleService(\"altText\", true);\n this.#setPref(\"enableAltTextModelDownload\", true);\n this.#downloadModelButton.disabled = false;\n }\n\n this.#aiModelSettings.classList.toggle(\"download\", false);\n this.#createModelButton.setAttribute(\"aria-pressed\", true);\n }\n\n async #delete(isFromUI = false) {\n if (isFromUI) {\n await this.#mlManager.deleteModel(\"altText\");\n this.#setPref(\"enableGuessAltText\", false);\n this.#setPref(\"enableAltTextModelDownload\", false);\n }\n\n this.#aiModelSettings.classList.toggle(\"download\", true);\n this.#createModelButton.disabled = true;\n this.#createModelButton.setAttribute(\"aria-pressed\", false);\n }\n\n async open({ enableGuessAltText, enableNewAltTextWhenAddingImage }) {\n const { enableAltTextModelDownload } = this.#mlManager;\n this.#createModelButton.disabled = !enableAltTextModelDownload;\n this.#createModelButton.setAttribute(\n \"aria-pressed\",\n enableAltTextModelDownload && enableGuessAltText\n );\n this.#showAltTextDialogButton.setAttribute(\n \"aria-pressed\",\n enableNewAltTextWhenAddingImage\n );\n this.#aiModelSettings.classList.toggle(\n \"download\",\n !enableAltTextModelDownload\n );\n\n await this.#overlayManager.open(this.#dialog);\n this.#reportTelemetry({\n type: \"stamp\",\n action: \"pdfjs.image.alt_text.settings_displayed\",\n });\n }\n\n #togglePref(name, { target }) {\n const checked = target.getAttribute(\"aria-pressed\") !== \"true\";\n this.#setPref(name, checked);\n target.setAttribute(\"aria-pressed\", checked);\n return checked;\n }\n\n #setPref(name, value) {\n this.#eventBus.dispatch(\"setpreference\", {\n source: this,\n name,\n value,\n });\n }\n\n #finish() {\n if (this.#overlayManager.active === this.#dialog) {\n this.#overlayManager.close(this.#dialog);\n }\n }\n}\n\nexport { ImageAltTextSettings, NewAltTextManager };\n","/* Copyright 2023 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DOMSVGFactory, shadow } from \"pdfjs-lib\";\n\nclass AltTextManager {\n #boundUpdateUIState = this.#updateUIState.bind(this);\n\n #boundSetPosition = this.#setPosition.bind(this);\n\n #boundOnClick = this.#onClick.bind(this);\n\n #currentEditor = null;\n\n #cancelButton;\n\n #dialog;\n\n #eventBus;\n\n #hasUsedPointer = false;\n\n #optionDescription;\n\n #optionDecorative;\n\n #overlayManager;\n\n #saveButton;\n\n #textarea;\n\n #uiManager;\n\n #previousAltText = null;\n\n #svgElement = null;\n\n #rectElement = null;\n\n #container;\n\n #telemetryData = null;\n\n constructor(\n {\n dialog,\n optionDescription,\n optionDecorative,\n textarea,\n cancelButton,\n saveButton,\n },\n container,\n overlayManager,\n eventBus\n ) {\n this.#dialog = dialog;\n this.#optionDescription = optionDescription;\n this.#optionDecorative = optionDecorative;\n this.#textarea = textarea;\n this.#cancelButton = cancelButton;\n this.#saveButton = saveButton;\n this.#overlayManager = overlayManager;\n this.#eventBus = eventBus;\n this.#container = container;\n\n dialog.addEventListener(\"close\", this.#close.bind(this));\n dialog.addEventListener(\"contextmenu\", event => {\n if (event.target !== this.#textarea) {\n event.preventDefault();\n }\n });\n cancelButton.addEventListener(\"click\", this.#finish.bind(this));\n saveButton.addEventListener(\"click\", this.#save.bind(this));\n optionDescription.addEventListener(\"change\", this.#boundUpdateUIState);\n optionDecorative.addEventListener(\"change\", this.#boundUpdateUIState);\n\n this.#overlayManager.register(dialog);\n }\n\n get _elements() {\n return shadow(this, \"_elements\", [\n this.#optionDescription,\n this.#optionDecorative,\n this.#textarea,\n this.#saveButton,\n this.#cancelButton,\n ]);\n }\n\n #createSVGElement() {\n if (this.#svgElement) {\n return;\n }\n\n // We create a mask to add to the dialog backdrop: the idea is to have a\n // darken background everywhere except on the editor to clearly see the\n // picture to describe.\n\n const svgFactory = new DOMSVGFactory();\n const svg = (this.#svgElement = svgFactory.createElement(\"svg\"));\n svg.setAttribute(\"width\", \"0\");\n svg.setAttribute(\"height\", \"0\");\n const defs = svgFactory.createElement(\"defs\");\n svg.append(defs);\n const mask = svgFactory.createElement(\"mask\");\n defs.append(mask);\n mask.setAttribute(\"id\", \"alttext-manager-mask\");\n mask.setAttribute(\"maskContentUnits\", \"objectBoundingBox\");\n let rect = svgFactory.createElement(\"rect\");\n mask.append(rect);\n rect.setAttribute(\"fill\", \"white\");\n rect.setAttribute(\"width\", \"1\");\n rect.setAttribute(\"height\", \"1\");\n rect.setAttribute(\"x\", \"0\");\n rect.setAttribute(\"y\", \"0\");\n\n rect = this.#rectElement = svgFactory.createElement(\"rect\");\n mask.append(rect);\n rect.setAttribute(\"fill\", \"black\");\n this.#dialog.append(svg);\n }\n\n async editAltText(uiManager, editor) {\n if (this.#currentEditor || !editor) {\n return;\n }\n\n this.#createSVGElement();\n\n this.#hasUsedPointer = false;\n for (const element of this._elements) {\n element.addEventListener(\"click\", this.#boundOnClick);\n }\n\n const { altText, decorative } = editor.altTextData;\n if (decorative === true) {\n this.#optionDecorative.checked = true;\n this.#optionDescription.checked = false;\n } else {\n this.#optionDecorative.checked = false;\n this.#optionDescription.checked = true;\n }\n this.#previousAltText = this.#textarea.value = altText?.trim() || \"\";\n this.#updateUIState();\n\n this.#currentEditor = editor;\n this.#uiManager = uiManager;\n this.#uiManager.removeEditListeners();\n this.#eventBus._on(\"resize\", this.#boundSetPosition);\n\n try {\n await this.#overlayManager.open(this.#dialog);\n this.#setPosition();\n } catch (ex) {\n this.#close();\n throw ex;\n }\n }\n\n #setPosition() {\n if (!this.#currentEditor) {\n return;\n }\n const dialog = this.#dialog;\n const { style } = dialog;\n const {\n x: containerX,\n y: containerY,\n width: containerW,\n height: containerH,\n } = this.#container.getBoundingClientRect();\n const { innerWidth: windowW, innerHeight: windowH } = window;\n const { width: dialogW, height: dialogH } = dialog.getBoundingClientRect();\n const { x, y, width, height } = this.#currentEditor.getClientDimensions();\n const MARGIN = 10;\n const isLTR = this.#uiManager.direction === \"ltr\";\n\n const xs = Math.max(x, containerX);\n const xe = Math.min(x + width, containerX + containerW);\n const ys = Math.max(y, containerY);\n const ye = Math.min(y + height, containerY + containerH);\n this.#rectElement.setAttribute(\"width\", `${(xe - xs) / windowW}`);\n this.#rectElement.setAttribute(\"height\", `${(ye - ys) / windowH}`);\n this.#rectElement.setAttribute(\"x\", `${xs / windowW}`);\n this.#rectElement.setAttribute(\"y\", `${ys / windowH}`);\n\n let left = null;\n let top = Math.max(y, 0);\n top += Math.min(windowH - (top + dialogH), 0);\n\n if (isLTR) {\n // Prefer to position the dialog \"after\" (so on the right) the editor.\n if (x + width + MARGIN + dialogW < windowW) {\n left = x + width + MARGIN;\n } else if (x > dialogW + MARGIN) {\n left = x - dialogW - MARGIN;\n }\n } else if (x > dialogW + MARGIN) {\n left = x - dialogW - MARGIN;\n } else if (x + width + MARGIN + dialogW < windowW) {\n left = x + width + MARGIN;\n }\n\n if (left === null) {\n top = null;\n left = Math.max(x, 0);\n left += Math.min(windowW - (left + dialogW), 0);\n if (y > dialogH + MARGIN) {\n top = y - dialogH - MARGIN;\n } else if (y + height + MARGIN + dialogH < windowH) {\n top = y + height + MARGIN;\n }\n }\n\n if (top !== null) {\n dialog.classList.add(\"positioned\");\n if (isLTR) {\n style.left = `${left}px`;\n } else {\n style.right = `${windowW - left - dialogW}px`;\n }\n style.top = `${top}px`;\n } else {\n dialog.classList.remove(\"positioned\");\n style.left = \"\";\n style.top = \"\";\n }\n }\n\n #finish() {\n if (this.#overlayManager.active === this.#dialog) {\n this.#overlayManager.close(this.#dialog);\n }\n }\n\n #close() {\n this.#currentEditor._reportTelemetry(\n this.#telemetryData || {\n action: \"alt_text_cancel\",\n alt_text_keyboard: !this.#hasUsedPointer,\n }\n );\n this.#telemetryData = null;\n\n this.#removeOnClickListeners();\n this.#uiManager?.addEditListeners();\n this.#eventBus._off(\"resize\", this.#boundSetPosition);\n this.#currentEditor.altTextFinish();\n this.#currentEditor = null;\n this.#uiManager = null;\n }\n\n #updateUIState() {\n this.#textarea.disabled = this.#optionDecorative.checked;\n }\n\n #save() {\n const altText = this.#textarea.value.trim();\n const decorative = this.#optionDecorative.checked;\n this.#currentEditor.altTextData = {\n altText,\n decorative,\n };\n this.#telemetryData = {\n action: \"alt_text_save\",\n alt_text_description: !!altText,\n alt_text_edit:\n !!this.#previousAltText && this.#previousAltText !== altText,\n alt_text_decorative: decorative,\n alt_text_keyboard: !this.#hasUsedPointer,\n };\n this.#finish();\n }\n\n #onClick(evt) {\n if (evt.detail === 0) {\n return; // The keyboard was used.\n }\n this.#hasUsedPointer = true;\n this.#removeOnClickListeners();\n }\n\n #removeOnClickListeners() {\n for (const element of this._elements) {\n element.removeEventListener(\"click\", this.#boundOnClick);\n }\n }\n\n destroy() {\n this.#uiManager = null; // Avoid re-adding the edit listeners.\n this.#finish();\n this.#svgElement?.remove();\n this.#svgElement = this.#rectElement = null;\n }\n}\n\nexport { AltTextManager };\n","/* Copyright 2022 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n\nimport { AnnotationEditorParamsType } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} AnnotationEditorParamsOptions\n * @property {HTMLInputElement} editorFreeTextFontSize\n * @property {HTMLInputElement} editorFreeTextColor\n * @property {HTMLInputElement} editorInkColor\n * @property {HTMLInputElement} editorInkThickness\n * @property {HTMLInputElement} editorInkOpacity\n * @property {HTMLButtonElement} editorStampAddImage\n * @property {HTMLInputElement} editorFreeHighlightThickness\n * @property {HTMLButtonElement} editorHighlightShowAll\n */\n\nclass AnnotationEditorParams {\n /**\n * @param {AnnotationEditorParamsOptions} options\n * @param {EventBus} eventBus\n */\n constructor(options, eventBus) {\n this.eventBus = eventBus;\n this.#bindListeners(options);\n }\n\n /**\n * @param {AnnotationEditorParamsOptions} options\n */\n #bindListeners({\n editorFreeTextFontSize,\n editorFreeTextColor,\n editorInkColor,\n editorInkThickness,\n editorInkOpacity,\n editorStampAddImage,\n editorFreeHighlightThickness,\n editorHighlightShowAll,\n }) {\n const dispatchEvent = (typeStr, value) => {\n this.eventBus.dispatch(\"switchannotationeditorparams\", {\n source: this,\n type: AnnotationEditorParamsType[typeStr],\n value,\n });\n };\n editorFreeTextFontSize.addEventListener(\"input\", function () {\n dispatchEvent(\"FREETEXT_SIZE\", this.valueAsNumber);\n });\n editorFreeTextColor.addEventListener(\"input\", function () {\n dispatchEvent(\"FREETEXT_COLOR\", this.value);\n });\n editorInkColor.addEventListener(\"input\", function () {\n dispatchEvent(\"INK_COLOR\", this.value);\n });\n editorInkThickness.addEventListener(\"input\", function () {\n dispatchEvent(\"INK_THICKNESS\", this.valueAsNumber);\n });\n editorInkOpacity.addEventListener(\"input\", function () {\n dispatchEvent(\"INK_OPACITY\", this.valueAsNumber);\n });\n editorStampAddImage.addEventListener(\"click\", () => {\n this.eventBus.dispatch(\"reporttelemetry\", {\n source: this,\n details: {\n type: \"editing\",\n data: { action: \"pdfjs.image.add_image_click\" },\n },\n });\n dispatchEvent(\"CREATE\");\n });\n editorFreeHighlightThickness.addEventListener(\"input\", function () {\n dispatchEvent(\"HIGHLIGHT_THICKNESS\", this.valueAsNumber);\n });\n editorHighlightShowAll.addEventListener(\"click\", function () {\n const checked = this.getAttribute(\"aria-pressed\") === \"true\";\n this.setAttribute(\"aria-pressed\", !checked);\n dispatchEvent(\"HIGHLIGHT_SHOW_ALL\", !checked);\n });\n\n this.eventBus._on(\"annotationeditorparamschanged\", evt => {\n for (const [type, value] of evt.details) {\n switch (type) {\n case AnnotationEditorParamsType.FREETEXT_SIZE:\n editorFreeTextFontSize.value = value;\n break;\n case AnnotationEditorParamsType.FREETEXT_COLOR:\n editorFreeTextColor.value = value;\n break;\n case AnnotationEditorParamsType.INK_COLOR:\n editorInkColor.value = value;\n break;\n case AnnotationEditorParamsType.INK_THICKNESS:\n editorInkThickness.value = value;\n break;\n case AnnotationEditorParamsType.INK_OPACITY:\n editorInkOpacity.value = value;\n break;\n case AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:\n editorFreeHighlightThickness.value = value;\n break;\n case AnnotationEditorParamsType.HIGHLIGHT_FREE:\n editorFreeHighlightThickness.disabled = !value;\n break;\n case AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:\n editorHighlightShowAll.setAttribute(\"aria-pressed\", value);\n break;\n }\n }\n });\n }\n}\n\nexport { AnnotationEditorParams };\n","/* Copyright 2024 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Used to compare floats: there is no exact equality due to rounding errors.\nconst PRECISION = 1e-1;\n\nclass CaretBrowsingMode {\n #mainContainer;\n\n #toolBarHeight = 0;\n\n #viewerContainer;\n\n constructor(abortSignal, mainContainer, viewerContainer, toolbarContainer) {\n this.#mainContainer = mainContainer;\n this.#viewerContainer = viewerContainer;\n\n if (!toolbarContainer) {\n return;\n }\n this.#toolBarHeight = toolbarContainer.getBoundingClientRect().height;\n\n const toolbarObserver = new ResizeObserver(entries => {\n for (const entry of entries) {\n if (entry.target === toolbarContainer) {\n this.#toolBarHeight = Math.floor(entry.borderBoxSize[0].blockSize);\n break;\n }\n }\n });\n toolbarObserver.observe(toolbarContainer);\n\n abortSignal.addEventListener(\"abort\", () => toolbarObserver.disconnect(), {\n once: true,\n });\n }\n\n /**\n * Return true if the two rectangles are on the same line.\n * @param {DOMRect} rect1\n * @param {DOMRect} rect2\n * @returns {boolean}\n */\n #isOnSameLine(rect1, rect2) {\n const top1 = rect1.y;\n const bot1 = rect1.bottom;\n const mid1 = rect1.y + rect1.height / 2;\n\n const top2 = rect2.y;\n const bot2 = rect2.bottom;\n const mid2 = rect2.y + rect2.height / 2;\n\n return (top1 <= mid2 && mid2 <= bot1) || (top2 <= mid1 && mid1 <= bot2);\n }\n\n /**\n * Return `true` if the rectangle is:\n * - under the caret when `isUp === false`.\n * - over the caret when `isUp === true`.\n * @param {DOMRect} rect\n * @param {number} x\n * @param {number} y\n * @param {boolean} isUp\n * @returns {boolean}\n */\n #isUnderOver(rect, x, y, isUp) {\n const midY = rect.y + rect.height / 2;\n return (\n (isUp ? y >= midY : y <= midY) &&\n rect.x - PRECISION <= x &&\n x <= rect.right + PRECISION\n );\n }\n\n /**\n * Check if the rectangle is visible.\n * @param {DOMRect} rect\n * @returns {boolean}\n */\n #isVisible(rect) {\n return (\n rect.top >= this.#toolBarHeight &&\n rect.left >= 0 &&\n rect.bottom <=\n (window.innerHeight || document.documentElement.clientHeight) &&\n rect.right <= (window.innerWidth || document.documentElement.clientWidth)\n );\n }\n\n /**\n * Get the position of the caret.\n * @param {Selection} selection\n * @param {boolean} isUp\n * @returns {Array<number>}\n */\n #getCaretPosition(selection, isUp) {\n const { focusNode, focusOffset } = selection;\n const range = document.createRange();\n range.setStart(focusNode, focusOffset);\n range.setEnd(focusNode, focusOffset);\n const rect = range.getBoundingClientRect();\n\n return [rect.x, isUp ? rect.top : rect.bottom];\n }\n\n static #caretPositionFromPoint(x, y) {\n if (\n (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) &&\n !document.caretPositionFromPoint\n ) {\n const { startContainer: offsetNode, startOffset: offset } =\n document.caretRangeFromPoint(x, y);\n return { offsetNode, offset };\n }\n return document.caretPositionFromPoint(x, y);\n }\n\n #setCaretPositionHelper(selection, caretX, select, element, rect) {\n rect ||= element.getBoundingClientRect();\n if (caretX <= rect.x + PRECISION) {\n if (select) {\n selection.extend(element.firstChild, 0);\n } else {\n selection.setPosition(element.firstChild, 0);\n }\n return;\n }\n if (rect.right - PRECISION <= caretX) {\n const { lastChild } = element;\n if (select) {\n selection.extend(lastChild, lastChild.length);\n } else {\n selection.setPosition(lastChild, lastChild.length);\n }\n return;\n }\n\n const midY = rect.y + rect.height / 2;\n let caretPosition = CaretBrowsingMode.#caretPositionFromPoint(caretX, midY);\n let parentElement = caretPosition.offsetNode?.parentElement;\n if (parentElement && parentElement !== element) {\n // There is an element on top of the one in the text layer, so we\n // need to hide all the elements (except the one in the text layer)\n // at this position in order to get the correct caret position.\n const elementsAtPoint = document.elementsFromPoint(caretX, midY);\n const savedVisibilities = [];\n for (const el of elementsAtPoint) {\n if (el === element) {\n break;\n }\n const { style } = el;\n savedVisibilities.push([el, style.visibility]);\n style.visibility = \"hidden\";\n }\n caretPosition = CaretBrowsingMode.#caretPositionFromPoint(caretX, midY);\n parentElement = caretPosition.offsetNode?.parentElement;\n for (const [el, visibility] of savedVisibilities) {\n el.style.visibility = visibility;\n }\n }\n if (parentElement !== element) {\n // The element targeted by caretPositionFromPoint isn't in the text\n // layer.\n if (select) {\n selection.extend(element.firstChild, 0);\n } else {\n selection.setPosition(element.firstChild, 0);\n }\n return;\n }\n if (select) {\n selection.extend(caretPosition.offsetNode, caretPosition.offset);\n } else {\n selection.setPosition(caretPosition.offsetNode, caretPosition.offset);\n }\n }\n\n /**\n * Set the caret position or extend the selection (it depends on the select\n * parameter).\n * @param {boolean} select\n * @param {Selection} selection\n * @param {Element} newLineElement\n * @param {DOMRect} newLineElementRect\n * @param {number} caretX\n */\n #setCaretPosition(\n select,\n selection,\n newLineElement,\n newLineElementRect,\n caretX\n ) {\n if (this.#isVisible(newLineElementRect)) {\n this.#setCaretPositionHelper(\n selection,\n caretX,\n select,\n newLineElement,\n newLineElementRect\n );\n return;\n }\n this.#mainContainer.addEventListener(\n \"scrollend\",\n this.#setCaretPositionHelper.bind(\n this,\n selection,\n caretX,\n select,\n newLineElement,\n null\n ),\n { once: true }\n );\n newLineElement.scrollIntoView();\n }\n\n /**\n * Get the node on the next page.\n * @param {Element} textLayer\n * @param {boolean} isUp\n * @returns {Node}\n */\n #getNodeOnNextPage(textLayer, isUp) {\n while (true) {\n const page = textLayer.closest(\".page\");\n const pageNumber = parseInt(page.getAttribute(\"data-page-number\"));\n const nextPage = isUp ? pageNumber - 1 : pageNumber + 1;\n textLayer = this.#viewerContainer.querySelector(\n `.page[data-page-number=\"${nextPage}\"] .textLayer`\n );\n if (!textLayer) {\n return null;\n }\n const walker = document.createTreeWalker(textLayer, NodeFilter.SHOW_TEXT);\n const node = isUp ? walker.lastChild() : walker.firstChild();\n if (node) {\n return node;\n }\n }\n }\n\n /**\n * Move the caret in the given direction.\n * @param {boolean} isUp\n * @param {boolean} select\n */\n moveCaret(isUp, select) {\n const selection = document.getSelection();\n if (selection.rangeCount === 0) {\n return;\n }\n const { focusNode } = selection;\n const focusElement =\n focusNode.nodeType !== Node.ELEMENT_NODE\n ? focusNode.parentElement\n : focusNode;\n const root = focusElement.closest(\".textLayer\");\n if (!root) {\n return;\n }\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n walker.currentNode = focusNode;\n\n // Move to the next element which is not on the same line as the focus\n // element.\n const focusRect = focusElement.getBoundingClientRect();\n let newLineElement = null;\n const nodeIterator = (\n isUp ? walker.previousSibling : walker.nextSibling\n ).bind(walker);\n while (nodeIterator()) {\n const element = walker.currentNode.parentElement;\n if (!this.#isOnSameLine(focusRect, element.getBoundingClientRect())) {\n newLineElement = element;\n break;\n }\n }\n\n if (!newLineElement) {\n // Need to find the next line on the next page.\n const node = this.#getNodeOnNextPage(root, isUp);\n if (!node) {\n return;\n }\n if (select) {\n const lastNode =\n (isUp ? walker.firstChild() : walker.lastChild()) || focusNode;\n selection.extend(lastNode, isUp ? 0 : lastNode.length);\n const range = document.createRange();\n range.setStart(node, isUp ? node.length : 0);\n range.setEnd(node, isUp ? node.length : 0);\n selection.addRange(range);\n return;\n }\n const [caretX] = this.#getCaretPosition(selection, isUp);\n const { parentElement } = node;\n this.#setCaretPosition(\n select,\n selection,\n parentElement,\n parentElement.getBoundingClientRect(),\n caretX\n );\n return;\n }\n\n // We've a candidate for the next line now we want to find the first element\n // which is under/over the caret.\n const [caretX, caretY] = this.#getCaretPosition(selection, isUp);\n const newLineElementRect = newLineElement.getBoundingClientRect();\n\n // Maybe the element on the new line is a valid candidate.\n if (this.#isUnderOver(newLineElementRect, caretX, caretY, isUp)) {\n this.#setCaretPosition(\n select,\n selection,\n newLineElement,\n newLineElementRect,\n caretX\n );\n return;\n }\n\n while (nodeIterator()) {\n // Search an element on the same line as newLineElement\n // which could be under/over the caret.\n const element = walker.currentNode.parentElement;\n const elementRect = element.getBoundingClientRect();\n if (!this.#isOnSameLine(newLineElementRect, elementRect)) {\n break;\n }\n if (this.#isUnderOver(elementRect, caretX, caretY, isUp)) {\n // We found the element.\n this.#setCaretPosition(select, selection, element, elementRect, caretX);\n return;\n }\n }\n\n // No element has been found so just put the caret on the element on the new\n // line.\n this.#setCaretPosition(\n select,\n selection,\n newLineElement,\n newLineElementRect,\n caretX\n );\n }\n}\n\nexport { CaretBrowsingMode };\n","/* Copyright 2013 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces\").IDownloadManager} IDownloadManager */\n\nimport { createValidAbsoluteUrl, isPdfFile } from \"pdfjs-lib\";\n\nif (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"CHROME || GENERIC\")) {\n throw new Error(\n 'Module \"pdfjs-web/download_manager\" shall not be used ' +\n \"outside CHROME and GENERIC builds.\"\n );\n}\n\nfunction download(blobUrl, filename) {\n const a = document.createElement(\"a\");\n if (!a.click) {\n throw new Error('DownloadManager: \"a.click()\" is not supported.');\n }\n a.href = blobUrl;\n a.target = \"_parent\";\n // Use a.download if available. This increases the likelihood that\n // the file is downloaded instead of opened by another PDF plugin.\n if (\"download\" in a) {\n a.download = filename;\n }\n // <a> must be in the document for recent Firefox versions,\n // otherwise .click() is ignored.\n (document.body || document.documentElement).append(a);\n a.click();\n a.remove();\n}\n\n/**\n * @implements {IDownloadManager}\n */\nclass DownloadManager {\n #openBlobUrls = new WeakMap();\n\n 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 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nclass OverlayManager {\n #overlays = new WeakMap();\n\n #active = null;\n\n get active() {\n return this.#active;\n }\n\n /**\n * @param {HTMLDialogElement} dialog - The overlay's DOM element.\n * @param {boolean} [canForceClose] - Indicates if opening the overlay closes\n * an active overlay. The default is `false`.\n * @returns {Promise} A promise that is resolved when the overlay has been\n * registered.\n */\n async register(dialog, canForceClose = false) {\n if (typeof dialog !== \"object\") {\n throw new Error(\"Not enough parameters.\");\n } else if (this.#overlays.has(dialog)) {\n throw new Error(\"The overlay is already registered.\");\n }\n this.#overlays.set(dialog, { canForceClose });\n\n dialog.addEventListener(\"cancel\", evt => {\n this.#active = null;\n });\n }\n\n /**\n * @param {HTMLDialogElement} dialog - The overlay's DOM element.\n * @returns {Promise} A promise that is resolved when the overlay has been\n * opened.\n */\n async open(dialog) {\n if (!this.#overlays.has(dialog)) {\n throw new Error(\"The overlay does not exist.\");\n } else if (this.#active) {\n if (this.#active === dialog) {\n throw new Error(\"The overlay is already active.\");\n } else if (this.#overlays.get(dialog).canForceClose) {\n await this.close();\n } else {\n throw new Error(\"Another overlay is currently active.\");\n }\n }\n this.#active = dialog;\n dialog.showModal();\n }\n\n /**\n * @param {HTMLDialogElement} dialog - The overlay's DOM element.\n * @returns {Promise} A promise that is resolved when the overlay has been\n * closed.\n */\n async close(dialog = this.#active) {\n if (!this.#overlays.has(dialog)) {\n throw new Error(\"The overlay does not exist.\");\n } else if (!this.#active) {\n throw new Error(\"The overlay is currently not active.\");\n } else if (this.#active !== dialog) {\n throw new Error(\"Another overlay is currently active.\");\n }\n dialog.close();\n this.#active = null;\n }\n}\n\nexport { OverlayManager };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./overlay_manager.js\").OverlayManager} OverlayManager */\n\nimport { PasswordResponses } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} PasswordPromptOptions\n * @property {HTMLDialogElement} dialog - The overlay's DOM element.\n * @property {HTMLParagraphElement} label - Label containing instructions for\n * entering the password.\n * @property {HTMLInputElement} input - Input field for entering the password.\n * @property {HTMLButtonElement} submitButton - Button for submitting the\n * password.\n * @property {HTMLButtonElement} cancelButton - Button for cancelling password\n * entry.\n */\n\nclass PasswordPrompt {\n #activeCapability = null;\n\n #updateCallback = null;\n\n #reason = null;\n\n /**\n * @param {PasswordPromptOptions} options\n * @param {OverlayManager} overlayManager - Manager for the viewer overlays.\n * @param {boolean} [isViewerEmbedded] - If the viewer is embedded, in e.g.\n * an <iframe> or an <object>. The default value is `false`.\n */\n constructor(options, overlayManager, isViewerEmbedded = false) {\n this.dialog = options.dialog;\n this.label = options.label;\n this.input = options.input;\n this.submitButton = options.submitButton;\n this.cancelButton = options.cancelButton;\n this.overlayManager = overlayManager;\n this._isViewerEmbedded = isViewerEmbedded;\n\n // Attach the event listeners.\n this.submitButton.addEventListener(\"click\", this.#verify.bind(this));\n this.cancelButton.addEventListener(\"click\", this.close.bind(this));\n this.input.addEventListener(\"keydown\", e => {\n if (e.keyCode === /* Enter = */ 13) {\n this.#verify();\n }\n });\n\n this.overlayManager.register(this.dialog, /* canForceClose = */ true);\n\n this.dialog.addEventListener(\"close\", this.#cancel.bind(this));\n }\n\n async open() {\n await this.#activeCapability?.promise;\n this.#activeCapability = Promise.withResolvers();\n\n try {\n await this.overlayManager.open(this.dialog);\n } catch (ex) {\n this.#activeCapability.resolve();\n throw ex;\n }\n\n const passwordIncorrect =\n this.#reason === PasswordResponses.INCORRECT_PASSWORD;\n\n if (!this._isViewerEmbedded || passwordIncorrect) {\n this.input.focus();\n }\n this.label.setAttribute(\n \"data-l10n-id\",\n passwordIncorrect ? \"pdfjs-password-invalid\" : \"pdfjs-password-label\"\n );\n }\n\n async close() {\n if (this.overlayManager.active === this.dialog) {\n this.overlayManager.close(this.dialog);\n }\n }\n\n #verify() {\n const password = this.input.value;\n if (password?.length > 0) {\n this.#invokeCallback(password);\n }\n }\n\n #cancel() {\n this.#invokeCallback(new Error(\"PasswordPrompt cancelled.\"));\n this.#activeCapability.resolve();\n }\n\n #invokeCallback(password) {\n if (!this.#updateCallback) {\n return; // Ensure that the callback is only invoked once.\n }\n this.close();\n this.input.value = \"\";\n\n this.#updateCallback(password);\n this.#updateCallback = null;\n }\n\n async setUpdateCallback(updateCallback, reason) {\n if (this.#activeCapability) {\n await this.#activeCapability.promise;\n }\n this.#updateCallback = updateCallback;\n this.#reason = reason;\n }\n}\n\nexport { PasswordPrompt };\n","/* Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { removeNullCharacters } from \"./ui_utils.js\";\n\nconst TREEITEM_OFFSET_TOP = -100; // px\nconst TREEITEM_SELECTED_CLASS = \"selected\";\n\nclass BaseTreeViewer {\n constructor(options) {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n this.constructor === BaseTreeViewer\n ) {\n throw new Error(\"Cannot initialize BaseTreeViewer.\");\n }\n this.container = options.container;\n this.eventBus = options.eventBus;\n this._l10n = options.l10n;\n\n this.reset();\n }\n\n reset() {\n this._pdfDocument = null;\n this._lastToggleIsShow = true;\n this._currentTreeItem = null;\n\n // Remove the tree from the DOM.\n this.container.textContent = \"\";\n // Ensure that the left (right in RTL locales) margin is always reset,\n // to prevent incorrect tree alignment if a new document is opened.\n this.container.classList.remove(\"treeWithDeepNesting\");\n }\n\n /**\n * @protected\n */\n _dispatchEvent(count) {\n throw new Error(\"Not implemented: _dispatchEvent\");\n }\n\n /**\n * @protected\n */\n _bindLink(element, params) {\n throw new Error(\"Not implemented: _bindLink\");\n }\n\n /**\n * @private\n */\n _normalizeTextContent(str) {\n // Chars in range [0x01-0x1F] will be replaced with a white space\n // and 0x00 by \"\".\n return (\n removeNullCharacters(str, /* replaceInvisible */ true) ||\n /* en dash = */ \"\\u2013\"\n );\n }\n\n /**\n * Prepend a button before a tree item which allows the user to collapse or\n * expand all tree items at that level; see `_toggleTreeItem`.\n * @param {HTMLDivElement} div\n * @param {boolean|object} [hidden]\n * @protected\n */\n _addToggleButton(div, hidden = false) {\n const toggler = document.createElement(\"div\");\n toggler.className = \"treeItemToggler\";\n if (hidden) {\n toggler.classList.add(\"treeItemsHidden\");\n }\n toggler.onclick = evt => {\n evt.stopPropagation();\n toggler.classList.toggle(\"treeItemsHidden\");\n\n if (evt.shiftKey) {\n const shouldShowAll = !toggler.classList.contains(\"treeItemsHidden\");\n this._toggleTreeItem(div, shouldShowAll);\n }\n };\n div.prepend(toggler);\n }\n\n /**\n * Collapse or expand the subtree of a tree item.\n *\n * @param {Element} root - the root of the item (sub)tree.\n * @param {boolean} show - whether to show the item (sub)tree. If false,\n * the item subtree rooted at `root` will be collapsed.\n * @private\n */\n _toggleTreeItem(root, show = false) {\n // Pause translation when collapsing/expanding the subtree.\n this._l10n.pause();\n\n this._lastToggleIsShow = show;\n for (const toggler of root.querySelectorAll(\".treeItemToggler\")) {\n toggler.classList.toggle(\"treeItemsHidden\", !show);\n }\n this._l10n.resume();\n }\n\n /**\n * Collapse or expand all subtrees of the `container`.\n * @private\n */\n _toggleAllTreeItems() {\n this._toggleTreeItem(this.container, !this._lastToggleIsShow);\n }\n\n /**\n * @private\n */\n _finishRendering(fragment, count, hasAnyNesting = false) {\n if (hasAnyNesting) {\n this.container.classList.add(\"treeWithDeepNesting\");\n\n this._lastToggleIsShow = !fragment.querySelector(\".treeItemsHidden\");\n }\n // Pause translation when inserting the tree into the DOM.\n this._l10n.pause();\n this.container.append(fragment);\n this._l10n.resume();\n\n this._dispatchEvent(count);\n }\n\n render(params) {\n throw new Error(\"Not implemented: render\");\n }\n\n /**\n * @private\n */\n _updateCurrentTreeItem(treeItem = null) {\n if (this._currentTreeItem) {\n // Ensure that the current treeItem-selection is always removed.\n this._currentTreeItem.classList.remove(TREEITEM_SELECTED_CLASS);\n this._currentTreeItem = null;\n }\n if (treeItem) {\n treeItem.classList.add(TREEITEM_SELECTED_CLASS);\n this._currentTreeItem = treeItem;\n }\n }\n\n /**\n * @private\n */\n _scrollToCurrentTreeItem(treeItem) {\n if (!treeItem) {\n return;\n }\n // Pause translation when expanding the treeItem.\n this._l10n.pause();\n // Ensure that the treeItem is *fully* expanded, such that it will first of\n // all be visible and secondly that scrolling it into view works correctly.\n let currentNode = treeItem.parentNode;\n while (currentNode && currentNode !== this.container) {\n if (currentNode.classList.contains(\"treeItem\")) {\n const toggler = currentNode.firstElementChild;\n toggler?.classList.remove(\"treeItemsHidden\");\n }\n currentNode = currentNode.parentNode;\n }\n this._l10n.resume();\n\n this._updateCurrentTreeItem(treeItem);\n\n this.container.scrollTo(\n treeItem.offsetLeft,\n treeItem.offsetTop + TREEITEM_OFFSET_TOP\n );\n }\n}\n\nexport { BaseTreeViewer };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./download_manager.js\").DownloadManager} DownloadManager */\n\nimport { BaseTreeViewer } from \"./base_tree_viewer.js\";\nimport { waitOnEventOrTimeout } from \"./event_utils.js\";\n\n/**\n * @typedef {Object} PDFAttachmentViewerOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {DownloadManager} downloadManager - The download manager.\n */\n\n/**\n * @typedef {Object} PDFAttachmentViewerRenderParameters\n * @property {Object|null} attachments - A lookup table of attachment objects.\n * @property {boolean} [keepRenderedCapability]\n */\n\nclass PDFAttachmentViewer extends BaseTreeViewer {\n /**\n * @param {PDFAttachmentViewerOptions} options\n */\n constructor(options) {\n super(options);\n this.downloadManager = options.downloadManager;\n\n this.eventBus._on(\n \"fileattachmentannotation\",\n this.#appendAttachment.bind(this)\n );\n }\n\n reset(keepRenderedCapability = false) {\n super.reset();\n this._attachments = null;\n\n if (!keepRenderedCapability) {\n // The only situation in which the `_renderedCapability` should *not* be\n // replaced is when appending FileAttachment annotations.\n this._renderedCapability = Promise.withResolvers();\n }\n this._pendingDispatchEvent = false;\n }\n\n /**\n * @protected\n */\n async _dispatchEvent(attachmentsCount) {\n this._renderedCapability.resolve();\n\n if (attachmentsCount === 0 && !this._pendingDispatchEvent) {\n // Delay the event when no \"regular\" attachments exist, to allow time for\n // parsing of any FileAttachment annotations that may be present on the\n // *initially* rendered page; this reduces the likelihood of temporarily\n // disabling the attachmentsView when the `PDFSidebar` handles the event.\n this._pendingDispatchEvent = true;\n\n await waitOnEventOrTimeout({\n target: this.eventBus,\n name: \"annotationlayerrendered\",\n delay: 1000,\n });\n\n if (!this._pendingDispatchEvent) {\n return; // There was already another `_dispatchEvent`-call`.\n }\n }\n this._pendingDispatchEvent = false;\n\n this.eventBus.dispatch(\"attachmentsloaded\", {\n source: this,\n attachmentsCount,\n });\n }\n\n /**\n * @protected\n */\n _bindLink(element, { content, description, filename }) {\n if (description) {\n element.title = description;\n }\n element.onclick = () => {\n this.downloadManager.openOrDownloadData(content, filename);\n return false;\n };\n }\n\n /**\n * @param {PDFAttachmentViewerRenderParameters} params\n */\n render({ attachments, keepRenderedCapability = false }) {\n if (this._attachments) {\n this.reset(keepRenderedCapability);\n }\n this._attachments = attachments || null;\n\n if (!attachments) {\n this._dispatchEvent(/* attachmentsCount = */ 0);\n return;\n }\n\n const fragment = document.createDocumentFragment();\n let attachmentsCount = 0;\n for (const name in attachments) {\n const item = attachments[name];\n\n const div = document.createElement(\"div\");\n div.className = \"treeItem\";\n\n const element = document.createElement(\"a\");\n this._bindLink(element, item);\n element.textContent = this._normalizeTextContent(item.filename);\n\n div.append(element);\n\n fragment.append(div);\n attachmentsCount++;\n }\n\n this._finishRendering(fragment, attachmentsCount);\n }\n\n /**\n * Used to append FileAttachment annotations to the sidebar.\n */\n #appendAttachment(item) {\n const renderedPromise = this._renderedCapability.promise;\n\n renderedPromise.then(() => {\n if (renderedPromise !== this._renderedCapability.promise) {\n return; // The FileAttachment annotation belongs to a previous document.\n }\n const attachments = this._attachments || Object.create(null);\n\n for (const name in attachments) {\n if (item.filename === name) {\n return; // Ignore the new attachment if it already exists.\n }\n }\n attachments[item.filename] = item;\n\n this.render({\n attachments,\n keepRenderedCapability: true,\n });\n });\n }\n}\n\nexport { PDFAttachmentViewer };\n","/* Copyright 2013 Rob Wu <rob@robwu.nl>\n * https://github.com/Rob--W/grab-to-pan.js\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Class name of element which can be grabbed.\nconst CSS_CLASS_GRAB = \"grab-to-pan-grab\";\n\n/**\n * @typedef {Object} GrabToPanOptions\n * @property {HTMLElement} element\n */\n\nclass GrabToPan {\n /**\n * Construct a GrabToPan instance for a given HTML element.\n * @param {GrabToPanOptions} options\n */\n constructor({ element }) {\n this.element = element;\n this.document = element.ownerDocument;\n\n // Bind the contexts to ensure that `this` always points to\n // the GrabToPan instance.\n this.activate = this.activate.bind(this);\n this.deactivate = this.deactivate.bind(this);\n this.toggle = this.toggle.bind(this);\n this._onMouseDown = this.#onMouseDown.bind(this);\n this._onMouseMove = this.#onMouseMove.bind(this);\n this._endPan = this.#endPan.bind(this);\n\n // This overlay will be inserted in the document when the mouse moves during\n // a grab operation, to ensure that the cursor has the desired appearance.\n const overlay = (this.overlay = document.createElement(\"div\"));\n overlay.className = \"grab-to-pan-grabbing\";\n }\n\n /**\n * Bind a mousedown event to the element to enable grab-detection.\n */\n activate() {\n if (!this.active) {\n this.active = true;\n this.element.addEventListener(\"mousedown\", this._onMouseDown, true);\n this.element.classList.add(CSS_CLASS_GRAB);\n }\n }\n\n /**\n * Removes all events. Any pending pan session is immediately stopped.\n */\n deactivate() {\n if (this.active) {\n this.active = false;\n this.element.removeEventListener(\"mousedown\", this._onMouseDown, true);\n this._endPan();\n this.element.classList.remove(CSS_CLASS_GRAB);\n }\n }\n\n toggle() {\n if (this.active) {\n this.deactivate();\n } else {\n this.activate();\n }\n }\n\n /**\n * Whether to not pan if the target element is clicked.\n * Override this method to change the default behaviour.\n *\n * @param {Element} node - The target of the event.\n * @returns {boolean} Whether to not react to the click event.\n */\n ignoreTarget(node) {\n // Check whether the clicked element is, a child of, an input element/link.\n return node.matches(\n \"a[href], a[href] *, input, textarea, button, button *, select, option\"\n );\n }\n\n #onMouseDown(event) {\n if (event.button !== 0 || this.ignoreTarget(event.target)) {\n return;\n }\n if (event.originalTarget) {\n try {\n // eslint-disable-next-line no-unused-expressions\n event.originalTarget.tagName;\n } catch {\n // Mozilla-specific: element is a scrollbar (XUL element)\n return;\n }\n }\n\n this.scrollLeftStart = this.element.scrollLeft;\n this.scrollTopStart = this.element.scrollTop;\n this.clientXStart = event.clientX;\n this.clientYStart = event.clientY;\n this.document.addEventListener(\"mousemove\", this._onMouseMove, true);\n this.document.addEventListener(\"mouseup\", this._endPan, true);\n // When a scroll event occurs before a mousemove, assume that the user\n // dragged a scrollbar (necessary for Opera Presto, Safari and IE)\n // (not needed for Chrome/Firefox)\n this.element.addEventListener(\"scroll\", this._endPan, true);\n event.preventDefault();\n event.stopPropagation();\n\n const focusedElement = document.activeElement;\n if (focusedElement && !focusedElement.contains(event.target)) {\n focusedElement.blur();\n }\n }\n\n #onMouseMove(event) {\n this.element.removeEventListener(\"scroll\", this._endPan, true);\n if (!(event.buttons & 1)) {\n // The left mouse button is released.\n this._endPan();\n return;\n }\n const xDiff = event.clientX - this.clientXStart;\n const yDiff = event.clientY - this.clientYStart;\n this.element.scrollTo({\n top: this.scrollTopStart - yDiff,\n left: this.scrollLeftStart - xDiff,\n behavior: \"instant\",\n });\n\n if (!this.overlay.parentNode) {\n document.body.append(this.overlay);\n }\n }\n\n #endPan() {\n this.element.removeEventListener(\"scroll\", this._endPan, true);\n this.document.removeEventListener(\"mousemove\", this._onMouseMove, true);\n this.document.removeEventListener(\"mouseup\", this._endPan, true);\n // Note: ChildNode.remove doesn't throw if the parentNode is undefined.\n this.overlay.remove();\n }\n}\n\nexport { GrabToPan };\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n\nimport { AnnotationEditorType, shadow } from \"pdfjs-lib\";\nimport { CursorTool, PresentationModeState } from \"./ui_utils.js\";\nimport { GrabToPan } from \"./grab_to_pan.js\";\n\n/**\n * @typedef {Object} PDFCursorToolsOptions\n * @property {HTMLDivElement} container - The document container.\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} [cursorToolOnLoad] - The cursor tool that will be enabled\n * on load; the constants from {CursorTool} should be used. The default value\n * is `CursorTool.SELECT`.\n */\n\nclass PDFCursorTools {\n #active = CursorTool.SELECT;\n\n #prevActive = null;\n\n /**\n * @param {PDFCursorToolsOptions} options\n */\n constructor({ container, eventBus, cursorToolOnLoad = CursorTool.SELECT }) {\n this.container = container;\n this.eventBus = eventBus;\n\n this.#addEventListeners();\n\n // Defer the initial `switchTool` call, to give other viewer components\n // time to initialize *and* register 'cursortoolchanged' event listeners.\n Promise.resolve().then(() => {\n this.switchTool(cursorToolOnLoad);\n });\n }\n\n /**\n * @type {number} One of the values in {CursorTool}.\n */\n get activeTool() {\n return this.#active;\n }\n\n /**\n * @param {number} tool - The cursor mode that should be switched to,\n * must be one of the values in {CursorTool}.\n */\n switchTool(tool) {\n if (this.#prevActive !== null) {\n // Cursor tools cannot be used in PresentationMode/AnnotationEditor.\n return;\n }\n this.#switchTool(tool);\n }\n\n #switchTool(tool, disabled = false) {\n if (tool === this.#active) {\n if (this.#prevActive !== null) {\n // Ensure that the `disabled`-attribute of the buttons will be updated.\n this.eventBus.dispatch(\"cursortoolchanged\", {\n source: this,\n tool,\n disabled,\n });\n }\n return; // The requested tool is already active.\n }\n\n const disableActiveTool = () => {\n switch (this.#active) {\n case CursorTool.SELECT:\n break;\n case CursorTool.HAND:\n this._handTool.deactivate();\n break;\n case CursorTool.ZOOM:\n /* falls through */\n }\n };\n\n // Enable the new cursor tool.\n switch (tool) {\n case CursorTool.SELECT:\n disableActiveTool();\n break;\n case CursorTool.HAND:\n disableActiveTool();\n this._handTool.activate();\n break;\n case CursorTool.ZOOM:\n /* falls through */\n default:\n console.error(`switchTool: \"${tool}\" is an unsupported value.`);\n return;\n }\n // Update the active tool *after* it has been validated above,\n // in order to prevent setting it to an invalid state.\n this.#active = tool;\n\n this.eventBus.dispatch(\"cursortoolchanged\", {\n source: this,\n tool,\n disabled,\n });\n }\n\n #addEventListeners() {\n this.eventBus._on(\"switchcursortool\", evt => {\n if (!evt.reset) {\n this.switchTool(evt.tool);\n } else if (this.#prevActive !== null) {\n annotationEditorMode = AnnotationEditorType.NONE;\n presentationModeState = PresentationModeState.NORMAL;\n\n enableActive();\n }\n });\n\n let annotationEditorMode = AnnotationEditorType.NONE,\n presentationModeState = PresentationModeState.NORMAL;\n\n const disableActive = () => {\n this.#prevActive ??= this.#active; // Keep track of the first one.\n this.#switchTool(CursorTool.SELECT, /* disabled = */ true);\n };\n const enableActive = () => {\n if (\n this.#prevActive !== null &&\n annotationEditorMode === AnnotationEditorType.NONE &&\n presentationModeState === PresentationModeState.NORMAL\n ) {\n this.#switchTool(this.#prevActive);\n this.#prevActive = null;\n }\n };\n\n this.eventBus._on(\"annotationeditormodechanged\", ({ mode }) => {\n annotationEditorMode = mode;\n\n if (mode === AnnotationEditorType.NONE) {\n enableActive();\n } else {\n disableActive();\n }\n });\n\n this.eventBus._on(\"presentationmodechanged\", ({ state }) => {\n presentationModeState = state;\n\n if (state === PresentationModeState.NORMAL) {\n enableActive();\n } else if (state === PresentationModeState.FULLSCREEN) {\n disableActive();\n }\n });\n }\n\n /**\n * @private\n */\n get _handTool() {\n return shadow(\n this,\n \"_handTool\",\n new GrabToPan({\n element: this.container,\n })\n );\n }\n}\n\nexport { PDFCursorTools };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces.js\").IL10n} IL10n */\n/** @typedef {import(\"./overlay_manager.js\").OverlayManager} OverlayManager */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/api.js\").PDFDocumentProxy} PDFDocumentProxy */\n\nimport { getPageSizeInches, isPortraitOrientation } from \"./ui_utils.js\";\nimport { PDFDateString } from \"pdfjs-lib\";\n\n// See https://en.wikibooks.org/wiki/Lentis/Conversion_to_the_Metric_Standard_in_the_United_States\nconst NON_METRIC_LOCALES = [\"en-us\", \"en-lr\", \"my\"];\n\n// Should use the format: `width x height`, in portrait orientation. The names,\n// which are l10n-ids, should be lowercase.\n// See https://en.wikipedia.org/wiki/Paper_size\nconst US_PAGE_NAMES = {\n \"8.5x11\": \"pdfjs-document-properties-page-size-name-letter\",\n \"8.5x14\": \"pdfjs-document-properties-page-size-name-legal\",\n};\nconst METRIC_PAGE_NAMES = {\n \"297x420\": \"pdfjs-document-properties-page-size-name-a-three\",\n \"210x297\": \"pdfjs-document-properties-page-size-name-a-four\",\n};\n\nfunction getPageName(size, isPortrait, pageNames) {\n const width = isPortrait ? size.width : size.height;\n const height = isPortrait ? size.height : size.width;\n\n return pageNames[`${width}x${height}`];\n}\n\n/**\n * @typedef {Object} PDFDocumentPropertiesOptions\n * @property {HTMLDialogElement} dialog - The overlay's DOM element.\n * @property {Object} fields - Names and elements of the overlay's fields.\n * @property {HTMLButtonElement} closeButton - Button for closing the overlay.\n */\n\nclass PDFDocumentProperties {\n #fieldData = null;\n\n /**\n * @param {PDFDocumentPropertiesOptions} options\n * @param {OverlayManager} overlayManager - Manager for the viewer overlays.\n * @param {EventBus} eventBus - The application event bus.\n * @param {IL10n} l10n - Localization service.\n * @param {function} fileNameLookup - The function that is used to lookup\n * the document fileName.\n */\n constructor(\n { dialog, fields, closeButton },\n overlayManager,\n eventBus,\n l10n,\n fileNameLookup\n ) {\n this.dialog = dialog;\n this.fields = fields;\n this.overlayManager = overlayManager;\n this.l10n = l10n;\n this._fileNameLookup = fileNameLookup;\n\n this.#reset();\n // Bind the event listener for the Close button.\n closeButton.addEventListener(\"click\", this.close.bind(this));\n\n this.overlayManager.register(this.dialog);\n\n eventBus._on(\"pagechanging\", evt => {\n this._currentPageNumber = evt.pageNumber;\n });\n eventBus._on(\"rotationchanging\", evt => {\n this._pagesRotation = evt.pagesRotation;\n });\n }\n\n /**\n * Open the document properties overlay.\n */\n async open() {\n await Promise.all([\n this.overlayManager.open(this.dialog),\n this._dataAvailableCapability.promise,\n ]);\n const currentPageNumber = this._currentPageNumber;\n const pagesRotation = this._pagesRotation;\n\n // If the document properties were previously fetched (for this PDF file),\n // just update the dialog immediately to avoid redundant lookups.\n if (\n this.#fieldData &&\n currentPageNumber === this.#fieldData._currentPageNumber &&\n pagesRotation === this.#fieldData._pagesRotation\n ) {\n this.#updateUI();\n return;\n }\n\n // Get the document properties.\n const {\n info,\n /* metadata, */\n /* contentDispositionFilename, */\n contentLength,\n } = await this.pdfDocument.getMetadata();\n\n const [\n fileName,\n fileSize,\n creationDate,\n modificationDate,\n pageSize,\n isLinearized,\n ] = await Promise.all([\n this._fileNameLookup(),\n this.#parseFileSize(contentLength),\n this.#parseDate(info.CreationDate),\n this.#parseDate(info.ModDate),\n // eslint-disable-next-line arrow-body-style\n this.pdfDocument.getPage(currentPageNumber).then(pdfPage => {\n return this.#parsePageSize(getPageSizeInches(pdfPage), pagesRotation);\n }),\n this.#parseLinearization(info.IsLinearized),\n ]);\n\n this.#fieldData = Object.freeze({\n fileName,\n fileSize,\n title: info.Title,\n author: info.Author,\n subject: info.Subject,\n keywords: info.Keywords,\n creationDate,\n modificationDate,\n creator: info.Creator,\n producer: info.Producer,\n version: info.PDFFormatVersion,\n pageCount: this.pdfDocument.numPages,\n pageSize,\n linearized: isLinearized,\n _currentPageNumber: currentPageNumber,\n _pagesRotation: pagesRotation,\n });\n this.#updateUI();\n\n // Get the correct fileSize, since it may not have been available\n // or could potentially be wrong.\n const { length } = await this.pdfDocument.getDownloadInfo();\n if (contentLength === length) {\n return; // The fileSize has already been correctly set.\n }\n const data = Object.assign(Object.create(null), this.#fieldData);\n data.fileSize = await this.#parseFileSize(length);\n\n this.#fieldData = Object.freeze(data);\n this.#updateUI();\n }\n\n /**\n * Close the document properties overlay.\n */\n async close() {\n this.overlayManager.close(this.dialog);\n }\n\n /**\n * Set a reference to the PDF document in order to populate the dialog fields\n * with the document properties. Note that the dialog will contain no\n * information if this method is not called.\n *\n * @param {PDFDocumentProxy} pdfDocument - A reference to the PDF document.\n */\n setDocument(pdfDocument) {\n if (this.pdfDocument) {\n this.#reset();\n this.#updateUI();\n }\n if (!pdfDocument) {\n return;\n }\n this.pdfDocument = pdfDocument;\n\n this._dataAvailableCapability.resolve();\n }\n\n #reset() {\n this.pdfDocument = null;\n\n this.#fieldData = null;\n this._dataAvailableCapability = Promise.withResolvers();\n this._currentPageNumber = 1;\n this._pagesRotation = 0;\n }\n\n /**\n * Always updates all of the dialog fields, to prevent inconsistent UI state.\n * NOTE: If the contents of a particular field is neither a non-empty string,\n * nor a number, it will fall back to \"-\".\n */\n #updateUI() {\n if (this.#fieldData && this.overlayManager.active !== this.dialog) {\n // Don't bother updating the dialog if it's already been closed,\n // unless it's being reset (i.e. `this.#fieldData === null`),\n // since it will be updated the next time `this.open` is called.\n return;\n }\n for (const id in this.fields) {\n const content = this.#fieldData?.[id];\n this.fields[id].textContent = content || content === 0 ? content : \"-\";\n }\n }\n\n async #parseFileSize(b = 0) {\n const kb = b / 1024,\n mb = kb / 1024;\n return kb\n ? this.l10n.get(\n mb >= 1\n ? \"pdfjs-document-properties-size-mb\"\n : \"pdfjs-document-properties-size-kb\",\n { mb, kb, b }\n )\n : undefined;\n }\n\n async #parsePageSize(pageSizeInches, pagesRotation) {\n if (!pageSizeInches) {\n return undefined;\n }\n // Take the viewer rotation into account as well; compare with Adobe Reader.\n if (pagesRotation % 180 !== 0) {\n pageSizeInches = {\n width: pageSizeInches.height,\n height: pageSizeInches.width,\n };\n }\n const isPortrait = isPortraitOrientation(pageSizeInches),\n nonMetric = NON_METRIC_LOCALES.includes(this.l10n.getLanguage());\n\n let sizeInches = {\n width: Math.round(pageSizeInches.width * 100) / 100,\n height: Math.round(pageSizeInches.height * 100) / 100,\n };\n // 1in == 25.4mm; no need to round to 2 decimals for millimeters.\n let sizeMillimeters = {\n width: Math.round(pageSizeInches.width * 25.4 * 10) / 10,\n height: Math.round(pageSizeInches.height * 25.4 * 10) / 10,\n };\n\n let nameId =\n getPageName(sizeInches, isPortrait, US_PAGE_NAMES) ||\n getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES);\n\n if (\n !nameId &&\n !(\n Number.isInteger(sizeMillimeters.width) &&\n Number.isInteger(sizeMillimeters.height)\n )\n ) {\n // Attempt to improve the page name detection by falling back to fuzzy\n // matching of the metric dimensions, to account for e.g. rounding errors\n // and/or PDF files that define the page sizes in an imprecise manner.\n const exactMillimeters = {\n width: pageSizeInches.width * 25.4,\n height: pageSizeInches.height * 25.4,\n };\n const intMillimeters = {\n width: Math.round(sizeMillimeters.width),\n height: Math.round(sizeMillimeters.height),\n };\n\n // Try to avoid false positives, by only considering \"small\" differences.\n if (\n Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 &&\n Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1\n ) {\n nameId = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES);\n if (nameId) {\n // Update *both* sizes, computed above, to ensure that the displayed\n // dimensions always correspond to the detected page name.\n sizeInches = {\n width: Math.round((intMillimeters.width / 25.4) * 100) / 100,\n height: Math.round((intMillimeters.height / 25.4) * 100) / 100,\n };\n sizeMillimeters = intMillimeters;\n }\n }\n }\n\n const [{ width, height }, unit, name, orientation] = await Promise.all([\n nonMetric ? sizeInches : sizeMillimeters,\n this.l10n.get(\n nonMetric\n ? \"pdfjs-document-properties-page-size-unit-inches\"\n : \"pdfjs-document-properties-page-size-unit-millimeters\"\n ),\n nameId && this.l10n.get(nameId),\n this.l10n.get(\n isPortrait\n ? \"pdfjs-document-properties-page-size-orientation-portrait\"\n : \"pdfjs-document-properties-page-size-orientation-landscape\"\n ),\n ]);\n\n return this.l10n.get(\n name\n ? \"pdfjs-document-properties-page-size-dimension-name-string\"\n : \"pdfjs-document-properties-page-size-dimension-string\",\n { width, height, unit, name, orientation }\n );\n }\n\n async #parseDate(inputDate) {\n const dateObj = PDFDateString.toDateObject(inputDate);\n return dateObj\n ? this.l10n.get(\"pdfjs-document-properties-date-time-string\", {\n dateObj: dateObj.valueOf(),\n })\n : undefined;\n }\n\n #parseLinearization(isLinearized) {\n return this.l10n.get(\n isLinearized\n ? \"pdfjs-document-properties-linearized-yes\"\n : \"pdfjs-document-properties-linearized-no\"\n );\n }\n}\n\nexport { PDFDocumentProperties };\n","/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\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\nconst MATCH_SCROLL_OFFSET_LEFT = -400; // px\n\nconst CHARACTERS_TO_NORMALIZE = {\n \"\\u2010\": \"-\", // Hyphen\n \"\\u2018\": \"'\", // Left single quotation mark\n \"\\u2019\": \"'\", // Right single quotation mark\n \"\\u201A\": \"'\", // Single low-9 quotation mark\n \"\\u201B\": \"'\", // Single high-reversed-9 quotation mark\n \"\\u201C\": '\"', // Left double quotation mark\n \"\\u201D\": '\"', // Right double quotation mark\n \"\\u201E\": '\"', // Double low-9 quotation mark\n \"\\u201F\": '\"', // Double high-reversed-9 quotation mark\n \"\\u00BC\": \"1/4\", // Vulgar fraction one quarter\n \"\\u00BD\": \"1/2\", // Vulgar fraction one half\n \"\\u00BE\": \"3/4\", // Vulgar fraction three quarters\n};\n\n// These diacritics aren't considered as combining diacritics\n// when searching in a document:\n// https://searchfox.org/mozilla-central/source/intl/unicharutil/util/is_combining_diacritic.py.\n// The combining class definitions can be found:\n// https://www.unicode.org/reports/tr44/#Canonical_Combining_Class_Values\n// Category 0 corresponds to [^\\p{Mn}].\nconst DIACRITICS_EXCEPTION = new Set([\n // UNICODE_COMBINING_CLASS_KANA_VOICING\n // https://www.compart.com/fr/unicode/combining/8\n 0x3099, 0x309a,\n // UNICODE_COMBINING_CLASS_VIRAMA (under 0xFFFF)\n // https://www.compart.com/fr/unicode/combining/9\n 0x094d, 0x09cd, 0x0a4d, 0x0acd, 0x0b4d, 0x0bcd, 0x0c4d, 0x0ccd, 0x0d3b,\n 0x0d3c, 0x0d4d, 0x0dca, 0x0e3a, 0x0eba, 0x0f84, 0x1039, 0x103a, 0x1714,\n 0x1734, 0x17d2, 0x1a60, 0x1b44, 0x1baa, 0x1bab, 0x1bf2, 0x1bf3, 0x2d7f,\n 0xa806, 0xa82c, 0xa8c4, 0xa953, 0xa9c0, 0xaaf6, 0xabed,\n // 91\n // https://www.compart.com/fr/unicode/combining/91\n 0x0c56,\n // 129\n // https://www.compart.com/fr/unicode/combining/129\n 0x0f71,\n // 130\n // https://www.compart.com/fr/unicode/combining/130\n 0x0f72, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f80,\n // 132\n // https://www.compart.com/fr/unicode/combining/132\n 0x0f74,\n]);\nlet DIACRITICS_EXCEPTION_STR; // Lazily initialized, see below.\n\nconst DIACRITICS_REG_EXP = /\\p{M}+/gu;\nconst SPECIAL_CHARS_REG_EXP =\n /([.*+?^${}()|[\\]\\\\])|(\\p{P})|(\\s+)|(\\p{M})|(\\p{L})/gu;\nconst NOT_DIACRITIC_FROM_END_REG_EXP = /([^\\p{M}])\\p{M}*$/u;\nconst NOT_DIACRITIC_FROM_START_REG_EXP = /^\\p{M}*([^\\p{M}])/u;\n\n// The range [AC00-D7AF] corresponds to the Hangul syllables.\n// The few other chars are some CJK Compatibility Ideographs.\nconst SYLLABLES_REG_EXP = /[\\uAC00-\\uD7AF\\uFA6C\\uFACF-\\uFAD1\\uFAD5-\\uFAD7]+/g;\nconst SYLLABLES_LENGTHS = new Map();\n// When decomposed (in using NFD) the above syllables will start\n// with one of the chars in this regexp.\nconst FIRST_CHAR_SYLLABLES_REG_EXP =\n \"[\\\\u1100-\\\\u1112\\\\ud7a4-\\\\ud7af\\\\ud84a\\\\ud84c\\\\ud850\\\\ud854\\\\ud857\\\\ud85f]\";\n\nconst NFKC_CHARS_TO_NORMALIZE = new Map();\n\nlet noSyllablesRegExp = null;\nlet withSyllablesRegExp = null;\n\nfunction normalize(text) {\n // The diacritics in the text or in the query can be composed or not.\n // So we use a decomposed text using NFD (and the same for the query)\n // in order to be sure that diacritics are in the same order.\n\n // Collect syllables length and positions.\n const syllablePositions = [];\n let m;\n while ((m = SYLLABLES_REG_EXP.exec(text)) !== null) {\n let { index } = m;\n for (const char of m[0]) {\n let len = SYLLABLES_LENGTHS.get(char);\n if (!len) {\n len = char.normalize(\"NFD\").length;\n SYLLABLES_LENGTHS.set(char, len);\n }\n syllablePositions.push([len, index++]);\n }\n }\n\n let normalizationRegex;\n if (syllablePositions.length === 0 && noSyllablesRegExp) {\n normalizationRegex = noSyllablesRegExp;\n } else if (syllablePositions.length > 0 && withSyllablesRegExp) {\n normalizationRegex = withSyllablesRegExp;\n } else {\n // Compile the regular expression for text normalization once.\n const replace = Object.keys(CHARACTERS_TO_NORMALIZE).join(\"\");\n const toNormalizeWithNFKC = getNormalizeWithNFKC();\n\n // 3040-309F: Hiragana\n // 30A0-30FF: Katakana\n const CJK = \"(?:\\\\p{Ideographic}|[\\u3040-\\u30FF])\";\n const HKDiacritics = \"(?:\\u3099|\\u309A)\";\n const CompoundWord = \"\\\\p{Ll}-\\\\n\\\\p{Lu}\";\n const regexp = `([${replace}])|([${toNormalizeWithNFKC}])|(${HKDiacritics}\\\\n)|(\\\\p{M}+(?:-\\\\n)?)|(${CompoundWord})|(\\\\S-\\\\n)|(${CJK}\\\\n)|(\\\\n)`;\n\n if (syllablePositions.length === 0) {\n // Most of the syllables belong to Hangul so there are no need\n // to search for them in a non-Hangul document.\n // We use the \\0 in order to have the same number of groups.\n normalizationRegex = noSyllablesRegExp = new RegExp(\n regexp + \"|(\\\\u0000)\",\n \"gum\"\n );\n } else {\n normalizationRegex = withSyllablesRegExp = new RegExp(\n regexp + `|(${FIRST_CHAR_SYLLABLES_REG_EXP})`,\n \"gum\"\n );\n }\n }\n\n // The goal of this function is to normalize the string and\n // be able to get from an index in the new string the\n // corresponding index in the old string.\n // For example if we have: abCd12ef456gh where C is replaced by ccc\n // and numbers replaced by nothing (it's the case for diacritics), then\n // we'll obtain the normalized string: abcccdefgh.\n // So here the reverse map is: [0,1,2,2,2,3,6,7,11,12].\n\n // The goal is to obtain the array: [[0, 0], [3, -1], [4, -2],\n // [6, 0], [8, 3]].\n // which can be used like this:\n // - let say that i is the index in new string and j the index\n // the old string.\n // - if i is in [0; 3[ then j = i + 0\n // - if i is in [3; 4[ then j = i - 1\n // - if i is in [4; 6[ then j = i - 2\n // ...\n // Thanks to a binary search it's easy to know where is i and what's the\n // shift.\n // Let say that the last entry in the array is [x, s] and we have a\n // substitution at index y (old string) which will replace o chars by n chars.\n // Firstly, if o === n, then no need to add a new entry: the shift is\n // the same.\n // Secondly, if o < n, then we push the n - o elements:\n // [y - (s - 1), s - 1], [y - (s - 2), s - 2], ...\n // Thirdly, if o > n, then we push the element: [y - (s - n), o + s - n]\n\n // Collect diacritics length and positions.\n const rawDiacriticsPositions = [];\n while ((m = DIACRITICS_REG_EXP.exec(text)) !== null) {\n rawDiacriticsPositions.push([m[0].length, m.index]);\n }\n\n let normalized = text.normalize(\"NFD\");\n const positions = [[0, 0]];\n let rawDiacriticsIndex = 0;\n let syllableIndex = 0;\n let shift = 0;\n let shiftOrigin = 0;\n let eol = 0;\n let hasDiacritics = false;\n\n normalized = normalized.replace(\n normalizationRegex,\n (match, p1, p2, p3, p4, p5, p6, p7, p8, 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 // Compound word with a line break after the hyphen.\n positions.push([i - shift + 3, 1 + shift]);\n shift += 1;\n shiftOrigin += 1;\n eol += 1;\n return p5.replace(\"\\n\", \"\");\n }\n\n if (p6) {\n // \"X-\\n\" is removed because an hyphen at the end of a line\n // with not a space before is likely here to mark a break\n // in a word.\n // If X is encoded with UTF-32 then it can have a length greater than 1.\n // The \\n isn't in the original text so here y = i, n = X.len - 2 and\n // o = X.len - 1.\n const len = p6.length - 2;\n positions.push([i - shift + len, 1 + shift]);\n shift += 1;\n shiftOrigin += 1;\n eol += 1;\n return p6.slice(0, -2);\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 // p8\n if (i + eol === syllablePositions[syllableIndex]?.[1]) {\n // A syllable (1 char) is replaced with several chars (n) so\n // newCharsLen = n - 1.\n const newCharLen = syllablePositions[syllableIndex][0] - 1;\n ++syllableIndex;\n for (let j = 1; j <= newCharLen; j++) {\n positions.push([i - (shift - j), shift - j]);\n }\n shift -= newCharLen;\n shiftOrigin += newCharLen;\n }\n return p9;\n }\n );\n\n positions.push([normalized.length, shift]);\n\n return [normalized, positions, hasDiacritics];\n}\n\n// Determine the original, non-normalized, match index such that highlighting of\n// search results is correct in the `textLayer` for strings containing e.g. \"½\"\n// characters; essentially \"inverting\" the result of the `normalize` function.\nfunction getOriginalIndex(diffs, pos, len) {\n if (!diffs) {\n return [pos, len];\n }\n\n // 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(diffs, x => x[0] >= start);\n if (diffs[i][0] > start) {\n --i;\n }\n\n let j = binarySearchFirstItem(diffs, x => x[0] >= end, i);\n if (diffs[j][0] > end) {\n --j;\n }\n\n // First char in the old string.\n const oldStart = start + diffs[i][1];\n\n // Last char in the old string.\n const oldEnd = end + diffs[j][1];\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\n const spot = {\n top: MATCH_SCROLL_OFFSET_TOP,\n left: selectedLeft + MATCH_SCROLL_OFFSET_LEFT,\n };\n scrollIntoView(element, spot, /* scrollMatches = */ true);\n }\n\n #reset() {\n this._highlightMatches = false;\n this._scrollMatches = false;\n this._pdfDocument = null;\n this._pageMatches = [];\n this._pageMatchesLength = [];\n this.#visitedPagesCount = 0;\n this.#state = null;\n // Currently selected match.\n this._selected = {\n pageIdx: -1,\n matchIdx: -1,\n };\n // Where the find algorithm currently is in the document.\n this._offset = {\n pageIdx: null,\n matchIdx: null,\n wrapped: false,\n };\n this._extractTextPromises = [];\n this._pageContents = []; // Stores the normalized text for each page.\n this._pageDiffs = [];\n this._hasDiacritics = [];\n this._matchesCountTotal = 0;\n this._pagesToSearch = null;\n this._pendingFindMatches = new Set();\n this._resumePageIdx = null;\n this._dirtyMatch = false;\n clearTimeout(this._findTimeout);\n this._findTimeout = null;\n\n this._firstPageCapability = 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 interfer with regexp syntax.\n return `[ ]*\\\\${p1}[ ]*`;\n }\n if (p2) {\n // Allow whitespaces around punctuation signs.\n return `[ ]*${p2}[ ]*`;\n }\n if (p3) {\n // Replace spaces by \\s+ to be sure to match any spaces.\n return \"[ ]+\";\n }\n if (matchDiacritics) {\n return p4 || p5;\n }\n\n if (p4) {\n // Diacritics are removed with few exceptions.\n return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : \"\";\n }\n\n // A letter has been matched and it can be followed by any diacritics\n // in normalized text.\n if (hasDiacritics) {\n isUnicode = true;\n return `${p5}\\\\p{M}*`;\n }\n return p5;\n }\n );\n\n const trailingSpaces = \"[ ]*\";\n if (query.endsWith(trailingSpaces)) {\n // The [ ]* has been added in order to help to match \"foo . bar\" but\n // it doesn't make sense to match some whitespaces after the dot\n // when it's the last character.\n query = query.slice(0, query.length - trailingSpaces.length);\n }\n\n if (matchDiacritics) {\n // aX must not match aXY.\n if (hasDiacritics) {\n DIACRITICS_EXCEPTION_STR ||= String.fromCharCode(\n ...DIACRITICS_EXCEPTION\n );\n\n isUnicode = true;\n query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\\\p{M}]|$)`;\n }\n }\n\n return [isUnicode, query];\n }\n\n #calculateMatch(pageIndex) {\n 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 for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) {\n const { promise, resolve } = Promise.withResolvers();\n this._extractTextPromises[i] = promise;\n\n // eslint-disable-next-line arrow-body-style\n deferred = deferred.then(() => {\n return this._pdfDocument\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, PDFFindController };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FindState } from \"./pdf_find_controller.js\";\nimport { toggleExpandedBtn } from \"./ui_utils.js\";\n\nconst MATCHES_COUNT_LIMIT = 1000;\n\n/**\n * Creates a \"search bar\" given a set of DOM elements that act as controls\n * for searching or for setting search preferences in the UI. This object\n * also sets up the appropriate events for the controls. Actual searching\n * is done by PDFFindController.\n */\nclass PDFFindBar {\n #mainContainer;\n\n #resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this));\n\n constructor(options, mainContainer, eventBus) {\n this.opened = false;\n\n this.bar = options.bar;\n this.toggleButton = options.toggleButton;\n this.findField = options.findField;\n this.highlightAll = options.highlightAllCheckbox;\n this.caseSensitive = options.caseSensitiveCheckbox;\n this.matchDiacritics = options.matchDiacriticsCheckbox;\n this.entireWord = options.entireWordCheckbox;\n this.findMsg = options.findMsg;\n this.findResultsCount = options.findResultsCount;\n this.findPreviousButton = options.findPreviousButton;\n this.findNextButton = options.findNextButton;\n this.eventBus = eventBus;\n this.#mainContainer = mainContainer;\n\n // Add event listeners to the DOM elements.\n this.toggleButton.addEventListener(\"click\", () => {\n this.toggle();\n });\n\n this.findField.addEventListener(\"input\", () => {\n this.dispatchEvent(\"\");\n });\n\n this.bar.addEventListener(\"keydown\", e => {\n switch (e.keyCode) {\n case 13: // Enter\n if (e.target === this.findField) {\n this.dispatchEvent(\"again\", e.shiftKey);\n }\n break;\n case 27: // Escape\n this.close();\n break;\n }\n });\n\n this.findPreviousButton.addEventListener(\"click\", () => {\n this.dispatchEvent(\"again\", true);\n });\n\n this.findNextButton.addEventListener(\"click\", () => {\n this.dispatchEvent(\"again\", false);\n });\n\n this.highlightAll.addEventListener(\"click\", () => {\n this.dispatchEvent(\"highlightallchange\");\n });\n\n this.caseSensitive.addEventListener(\"click\", () => {\n this.dispatchEvent(\"casesensitivitychange\");\n });\n\n this.entireWord.addEventListener(\"click\", () => {\n this.dispatchEvent(\"entirewordchange\");\n });\n\n this.matchDiacritics.addEventListener(\"click\", () => {\n this.dispatchEvent(\"diacriticmatchingchange\");\n });\n }\n\n reset() {\n this.updateUIState();\n }\n\n dispatchEvent(type, findPrev = false) {\n this.eventBus.dispatch(\"find\", {\n source: this,\n type,\n query: this.findField.value,\n caseSensitive: this.caseSensitive.checked,\n entireWord: this.entireWord.checked,\n highlightAll: this.highlightAll.checked,\n findPrevious: findPrev,\n matchDiacritics: this.matchDiacritics.checked,\n });\n }\n\n updateUIState(state, previous, matchesCount) {\n const { findField, findMsg } = this;\n let findMsgId = \"\",\n status = \"\";\n\n switch (state) {\n case FindState.FOUND:\n break;\n case FindState.PENDING:\n status = \"pending\";\n break;\n case FindState.NOT_FOUND:\n findMsgId = \"pdfjs-find-not-found\";\n status = \"notFound\";\n break;\n case FindState.WRAPPED:\n findMsgId = previous\n ? \"pdfjs-find-reached-top\"\n : \"pdfjs-find-reached-bottom\";\n break;\n }\n findField.setAttribute(\"data-status\", status);\n findField.setAttribute(\"aria-invalid\", state === FindState.NOT_FOUND);\n\n findMsg.setAttribute(\"data-status\", status);\n if (findMsgId) {\n findMsg.setAttribute(\"data-l10n-id\", findMsgId);\n } else {\n findMsg.removeAttribute(\"data-l10n-id\");\n findMsg.textContent = \"\";\n }\n\n this.updateResultsCount(matchesCount);\n }\n\n updateResultsCount({ current = 0, total = 0 } = {}) {\n const { findResultsCount } = this;\n\n if (total > 0) {\n const limit = MATCHES_COUNT_LIMIT;\n\n findResultsCount.setAttribute(\n \"data-l10n-id\",\n total > limit\n ? \"pdfjs-find-match-count-limit\"\n : \"pdfjs-find-match-count\"\n );\n findResultsCount.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({ limit, current, total })\n );\n } else {\n findResultsCount.removeAttribute(\"data-l10n-id\");\n findResultsCount.textContent = \"\";\n }\n }\n\n open() {\n if (!this.opened) {\n // Potentially update the findbar layout, row vs column, when:\n // - The width of the viewer itself changes.\n // - The width of the findbar changes, by toggling the visibility\n // (or localization) of find count/status messages.\n this.#resizeObserver.observe(this.#mainContainer);\n this.#resizeObserver.observe(this.bar);\n\n this.opened = true;\n toggleExpandedBtn(this.toggleButton, true, this.bar);\n }\n this.findField.select();\n this.findField.focus();\n }\n\n close() {\n if (!this.opened) {\n return;\n }\n this.#resizeObserver.disconnect();\n\n this.opened = false;\n toggleExpandedBtn(this.toggleButton, false, this.bar);\n\n this.eventBus.dispatch(\"findbarclose\", { source: this });\n }\n\n toggle() {\n if (this.opened) {\n this.close();\n } else {\n this.open();\n }\n }\n\n #resizeObserverCallback() {\n const { bar } = this;\n // The find bar has an absolute position and thus the browser extends\n // its width to the maximum possible width once the find bar does not fit\n // entirely within the window anymore (and its elements are automatically\n // wrapped). Here we detect and fix that.\n bar.classList.remove(\"wrapContainers\");\n\n const findbarHeight = bar.clientHeight;\n const inputContainerHeight = bar.firstElementChild.clientHeight;\n\n if (findbarHeight > inputContainerHeight) {\n // The findbar is taller than the input container, which means that\n // the browser wrapped some of the elements. For a consistent look,\n // wrap all of them to adjust the width of the find bar.\n bar.classList.add(\"wrapContainers\");\n }\n }\n}\n\nexport { PDFFindBar };\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { isValidRotation, parseQueryString } from \"./ui_utils.js\";\nimport { waitOnEventOrTimeout } from \"./event_utils.js\";\n\n// Heuristic value used when force-resetting `this._blockHashChange`.\nconst HASH_CHANGE_TIMEOUT = 1000; // milliseconds\n// Heuristic value used when adding the current position to the browser history.\nconst POSITION_UPDATED_THRESHOLD = 50;\n// Heuristic value used when adding a temporary position to the browser history.\nconst UPDATE_VIEWAREA_TIMEOUT = 1000; // milliseconds\n\n/**\n * @typedef {Object} PDFHistoryOptions\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {EventBus} eventBus - The application event bus.\n */\n\n/**\n * @typedef {Object} InitializeParameters\n * @property {string} fingerprint - The PDF document's unique fingerprint.\n * @property {boolean} [resetHistory] - Reset the browsing history.\n * @property {boolean} [updateUrl] - Attempt to update the document URL, with\n * the current hash, when pushing/replacing browser history entries.\n */\n\n/**\n * @typedef {Object} PushParameters\n * @property {string} [namedDest] - The named destination. If absent, a\n * stringified version of `explicitDest` is used.\n * @property {Array} explicitDest - The explicit destination array.\n * @property {number} pageNumber - The page to which the destination points.\n */\n\nfunction getCurrentHash() {\n return document.location.hash;\n}\n\nclass PDFHistory {\n #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 baseUrl = document.location.href.split(\"#\", 1)[0];\n // Prevent errors in Firefox.\n if (!baseUrl.startsWith(\"file://\")) {\n newUrl = `${baseUrl}#${destination.hash}`;\n }\n }\n if (shouldReplace) {\n window.history.replaceState(newState, \"\", newUrl);\n } else {\n window.history.pushState(newState, \"\", newUrl);\n }\n }\n\n #tryPushCurrentPosition(temporary = false) {\n if (!this._position) {\n return;\n }\n let position = this._position;\n if (temporary) {\n position = Object.assign(Object.create(null), this._position);\n position.temporary = true;\n }\n\n if (!this._destination) {\n this.#pushOrReplaceState(position);\n return;\n }\n if (this._destination.temporary) {\n // Always replace a previous *temporary* position.\n this.#pushOrReplaceState(position, /* forceReplace = */ true);\n return;\n }\n if (this._destination.hash === position.hash) {\n return; // The current document position has not changed.\n }\n if (\n !this._destination.page &&\n (POSITION_UPDATED_THRESHOLD <= 0 ||\n this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)\n ) {\n // `this._destination` was set through the user changing the hash of\n // the document. Do not add `this._position` to the browser history,\n // to avoid \"flooding\" it with lots of (nearly) identical entries,\n // since we cannot ensure that the document position has changed.\n return;\n }\n\n let forceReplace = false;\n if (\n this._destination.page >= position.first &&\n this._destination.page <= position.page\n ) {\n // When the `page` of `this._destination` is still visible, do not\n // update the browsing history when `this._destination` either:\n // - contains an internal destination, since in this case we\n // cannot ensure that the document position has actually changed.\n // - was set through the user changing the hash of the document.\n if (this._destination.dest !== undefined || !this._destination.first) {\n return;\n }\n // To avoid \"flooding\" the browser history, replace the current entry.\n forceReplace = true;\n }\n this.#pushOrReplaceState(position, forceReplace);\n }\n\n #isValidPage(val) {\n return (\n Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount\n );\n }\n\n #isValidState(state, checkReload = false) {\n if (!state) {\n return false;\n }\n if (state.fingerprint !== this._fingerprint) {\n if (checkReload) {\n // Potentially accept the history entry, even if the fingerprints don't\n // match, when the viewer was reloaded (see issue 6847).\n if (\n typeof state.fingerprint !== \"string\" ||\n state.fingerprint.length !== this._fingerprint.length\n ) {\n return false;\n }\n const [perfEntry] = performance.getEntriesByType(\"navigation\");\n if (perfEntry?.type !== \"reload\") {\n return false;\n }\n } else {\n // This should only occur in viewers with support for opening more than\n // one PDF document, e.g. the GENERIC viewer.\n return false;\n }\n }\n if (!Number.isInteger(state.uid) || state.uid < 0) {\n return false;\n }\n if (state.destination === null || typeof state.destination !== \"object\") {\n return false;\n }\n return true;\n }\n\n #updateInternalState(destination, uid, removeTemporary = false) {\n if (this._updateViewareaTimeout) {\n // When updating `this._destination`, make sure that we always wait for\n // the next 'updateviewarea' event before (potentially) attempting to\n // push the current position to the browser history.\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n if (removeTemporary && destination?.temporary) {\n // When the `destination` comes from the browser history,\n // we no longer treat it as a *temporary* position.\n delete destination.temporary;\n }\n this._destination = destination;\n this._uid = uid;\n this._maxUid = Math.max(this._maxUid, uid);\n // This should always be reset when `this._destination` is updated.\n this._numPositionUpdates = 0;\n }\n\n #parseCurrentHash(checkNameddest = false) {\n const hash = unescape(getCurrentHash()).substring(1);\n const params = parseQueryString(hash);\n\n const nameddest = params.get(\"nameddest\") || \"\";\n let page = params.get(\"page\") | 0;\n\n if (!this.#isValidPage(page) || (checkNameddest && nameddest.length > 0)) {\n page = null;\n }\n return { hash, page, rotation: this.linkService.rotation };\n }\n\n #updateViewarea({ location }) {\n if (this._updateViewareaTimeout) {\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n\n this._position = {\n hash: location.pdfOpenParams.substring(1),\n page: this.linkService.page,\n first: location.pageNumber,\n rotation: location.rotation,\n };\n\n if (this._popStateInProgress) {\n return;\n }\n\n if (\n POSITION_UPDATED_THRESHOLD > 0 &&\n this._isPagesLoaded &&\n this._destination &&\n !this._destination.page\n ) {\n // If the current destination was set through the user changing the hash\n // of the document, we will usually not try to push the current position\n // to the browser history; see `this.#tryPushCurrentPosition()`.\n //\n // To prevent `this.#tryPushCurrentPosition()` from effectively being\n // reduced to a no-op in this case, we will assume that the position\n // *did* in fact change if the 'updateviewarea' event was dispatched\n // more than `POSITION_UPDATED_THRESHOLD` times.\n this._numPositionUpdates++;\n }\n\n if (UPDATE_VIEWAREA_TIMEOUT > 0) {\n // When closing the browser, a 'pagehide' event will be dispatched which\n // *should* allow us to push the current position to the browser history.\n // In practice, it seems that the event is arriving too late in order for\n // the session history to be successfully updated.\n // (For additional details, please refer to the discussion in\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1153393.)\n //\n // To workaround this we attempt to *temporarily* add the current position\n // to the browser history only when the viewer is *idle*,\n // i.e. when scrolling and/or zooming does not occur.\n //\n // PLEASE NOTE: It's absolutely imperative that the browser history is\n // *not* updated too often, since that would render the viewer more or\n // less unusable. Hence the use of a timeout to delay the update until\n // the viewer has been idle for `UPDATE_VIEWAREA_TIMEOUT` milliseconds.\n this._updateViewareaTimeout = setTimeout(() => {\n if (!this._popStateInProgress) {\n this.#tryPushCurrentPosition(/* temporary = */ true);\n }\n this._updateViewareaTimeout = null;\n }, UPDATE_VIEWAREA_TIMEOUT);\n }\n }\n\n #popState({ state }) {\n const newHash = getCurrentHash(),\n hashChanged = this._currentHash !== newHash;\n this._currentHash = newHash;\n\n if (\n (typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"CHROME\") &&\n state?.chromecomState &&\n !this.#isValidState(state)) ||\n !state\n ) {\n // This case corresponds to the user changing the hash of the document.\n this._uid++;\n\n const { hash, page, rotation } = this.#parseCurrentHash();\n this.#pushOrReplaceState(\n { hash, page, rotation },\n /* forceReplace = */ true\n );\n return;\n }\n if (!this.#isValidState(state)) {\n // This should only occur in viewers with support for opening more than\n // one PDF document, e.g. the GENERIC viewer.\n return;\n }\n\n // Prevent the browser history from updating until the new destination,\n // as stored in the browser history, has been scrolled into view.\n this._popStateInProgress = true;\n\n if (hashChanged) {\n // When the hash changed, implying that the 'popstate' event will be\n // followed by a 'hashchange' event, then we do *not* want to update the\n // browser history when handling the 'hashchange' event (in web/app.js)\n // since that would *overwrite* the new destination navigated to below.\n //\n // To avoid accidentally disabling all future user-initiated hash changes,\n // if there's e.g. another 'hashchange' listener that stops the event\n // propagation, we make sure to always force-reset `this._blockHashChange`\n // after `HASH_CHANGE_TIMEOUT` milliseconds have passed.\n this._blockHashChange++;\n waitOnEventOrTimeout({\n target: window,\n name: \"hashchange\",\n delay: HASH_CHANGE_TIMEOUT,\n }).then(() => {\n this._blockHashChange--;\n });\n }\n\n // Navigate to the new destination.\n const destination = state.destination;\n this.#updateInternalState(\n destination,\n state.uid,\n /* removeTemporary = */ true\n );\n\n if (isValidRotation(destination.rotation)) {\n this.linkService.rotation = destination.rotation;\n }\n if (destination.dest) {\n this.linkService.goToDestination(destination.dest);\n } else if (destination.hash) {\n this.linkService.setHash(destination.hash);\n } else if (destination.page) {\n // Fallback case; shouldn't be necessary, but better safe than sorry.\n this.linkService.page = destination.page;\n }\n\n // Since `PDFLinkService.goToDestination` is asynchronous, we thus defer the\n // resetting of `this._popStateInProgress` slightly.\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n\n #pageHide() {\n // Attempt to push the `this._position` into the browser history when\n // navigating away from the document. This is *only* done if the history\n // is empty/temporary, since otherwise an existing browser history entry\n // will end up being overwritten (given that new entries cannot be pushed\n // into the browser history when the 'unload' event has already fired).\n if (!this._destination || this._destination.temporary) {\n this.#tryPushCurrentPosition();\n }\n }\n\n #bindEvents() {\n if (this.#eventAbortController) {\n return; // The event listeners were already added.\n }\n this.#eventAbortController = new AbortController();\n const { signal } = this.#eventAbortController;\n\n this.eventBus._on(\"updateviewarea\", this.#updateViewarea.bind(this), {\n signal,\n });\n window.addEventListener(\"popstate\", this.#popState.bind(this), { signal });\n window.addEventListener(\"pagehide\", this.#pageHide.bind(this), { signal });\n }\n\n #unbindEvents() {\n this.#eventAbortController?.abort();\n this.#eventAbortController = null;\n }\n}\n\nfunction isDestHashesEqual(destHash, pushHash) {\n if (typeof destHash !== \"string\" || typeof pushHash !== \"string\") {\n return false;\n }\n if (destHash === pushHash) {\n return true;\n }\n const nameddest = parseQueryString(destHash).get(\"nameddest\");\n if (nameddest === pushHash) {\n return true;\n }\n return false;\n}\n\nfunction isDestArraysEqual(firstDest, secondDest) {\n function isEntryEqual(first, second) {\n if (typeof first !== typeof second) {\n return false;\n }\n if (Array.isArray(first) || Array.isArray(second)) {\n return false;\n }\n if (first !== null && typeof first === \"object\" && second !== null) {\n if (Object.keys(first).length !== Object.keys(second).length) {\n return false;\n }\n for (const key in first) {\n if (!isEntryEqual(first[key], second[key])) {\n return false;\n }\n }\n return true;\n }\n return first === second || (Number.isNaN(first) && Number.isNaN(second));\n }\n\n if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) {\n return false;\n }\n if (firstDest.length !== secondDest.length) {\n return false;\n }\n for (let i = 0, ii = firstDest.length; i < ii; i++) {\n if (!isEntryEqual(firstDest[i], secondDest[i])) {\n return false;\n }\n }\n return true;\n}\n\nexport { isDestArraysEqual, isDestHashesEqual, PDFHistory };\n","/* Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/optional_content_config.js\").OptionalContentConfig} OptionalContentConfig */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/api.js\").PDFDocumentProxy} PDFDocumentProxy */\n\nimport { BaseTreeViewer } from \"./base_tree_viewer.js\";\n\n/**\n * @typedef {Object} PDFLayerViewerOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n */\n\n/**\n * @typedef {Object} PDFLayerViewerRenderParameters\n * @property {OptionalContentConfig|null} optionalContentConfig - An\n * {OptionalContentConfig} instance.\n * @property {PDFDocumentProxy} pdfDocument - A {PDFDocument} instance.\n */\n\nclass PDFLayerViewer extends BaseTreeViewer {\n constructor(options) {\n super(options);\n\n this.eventBus._on(\"optionalcontentconfigchanged\", evt => {\n this.#updateLayers(evt.promise);\n });\n this.eventBus._on(\"resetlayers\", () => {\n this.#updateLayers();\n });\n this.eventBus._on(\"togglelayerstree\", this._toggleAllTreeItems.bind(this));\n }\n\n reset() {\n super.reset();\n this._optionalContentConfig = null;\n\n this._optionalContentVisibility?.clear();\n this._optionalContentVisibility = null;\n }\n\n /**\n * @protected\n */\n _dispatchEvent(layersCount) {\n this.eventBus.dispatch(\"layersloaded\", {\n source: this,\n layersCount,\n });\n }\n\n /**\n * @protected\n */\n _bindLink(element, { groupId, input }) {\n const setVisibility = () => {\n const visible = input.checked;\n this._optionalContentConfig.setVisibility(groupId, visible);\n\n const cached = this._optionalContentVisibility.get(groupId);\n if (cached) {\n cached.visible = visible;\n }\n\n this.eventBus.dispatch(\"optionalcontentconfig\", {\n source: this,\n promise: Promise.resolve(this._optionalContentConfig),\n });\n };\n\n element.onclick = evt => {\n if (evt.target === input) {\n setVisibility();\n return true;\n } else if (evt.target !== element) {\n return true; // The target is the \"label\", which is handled above.\n }\n input.checked = !input.checked;\n setVisibility();\n return false;\n };\n }\n\n /**\n * @private\n */\n _setNestedName(element, { name = null }) {\n if (typeof name === \"string\") {\n element.textContent = this._normalizeTextContent(name);\n return;\n }\n element.setAttribute(\"data-l10n-id\", \"pdfjs-additional-layers\");\n element.style.fontStyle = \"italic\";\n // Trigger translation manually, since translation is paused when\n // the final layer-tree is appended to the DOM.\n this._l10n.translateOnce(element);\n }\n\n /**\n * @protected\n */\n _addToggleButton(div, { name = null }) {\n super._addToggleButton(div, /* hidden = */ name === null);\n }\n\n /**\n * @private\n */\n _toggleAllTreeItems() {\n if (!this._optionalContentConfig) {\n return;\n }\n super._toggleAllTreeItems();\n }\n\n /**\n * @param {PDFLayerViewerRenderParameters} params\n */\n render({ optionalContentConfig, pdfDocument }) {\n if (this._optionalContentConfig) {\n this.reset();\n }\n this._optionalContentConfig = optionalContentConfig || null;\n this._pdfDocument = pdfDocument || null;\n\n const groups = optionalContentConfig?.getOrder();\n if (!groups) {\n this._dispatchEvent(/* layersCount = */ 0);\n return;\n }\n this._optionalContentVisibility = new Map();\n\n const fragment = document.createDocumentFragment(),\n queue = [{ parent: fragment, groups }];\n let layersCount = 0,\n hasAnyNesting = false;\n while (queue.length > 0) {\n const levelData = queue.shift();\n for (const groupId of levelData.groups) {\n const div = document.createElement(\"div\");\n div.className = \"treeItem\";\n\n const element = document.createElement(\"a\");\n div.append(element);\n\n if (typeof groupId === \"object\") {\n hasAnyNesting = true;\n this._addToggleButton(div, groupId);\n this._setNestedName(element, groupId);\n\n const itemsDiv = document.createElement(\"div\");\n itemsDiv.className = \"treeItems\";\n div.append(itemsDiv);\n\n queue.push({ parent: itemsDiv, groups: groupId.order });\n } else {\n const group = optionalContentConfig.getGroup(groupId);\n\n const input = document.createElement(\"input\");\n this._bindLink(element, { groupId, input });\n input.type = \"checkbox\";\n input.checked = group.visible;\n\n this._optionalContentVisibility.set(groupId, {\n input,\n visible: input.checked,\n });\n\n const label = document.createElement(\"label\");\n label.textContent = this._normalizeTextContent(group.name);\n\n label.append(input);\n element.append(label);\n layersCount++;\n }\n\n levelData.parent.append(div);\n }\n }\n\n this._finishRendering(fragment, layersCount, hasAnyNesting);\n }\n\n async #updateLayers(promise = null) {\n if (!this._optionalContentConfig) {\n return;\n }\n const pdfDocument = this._pdfDocument;\n const optionalContentConfig = await (promise ||\n pdfDocument.getOptionalContentConfig({ intent: \"display\" }));\n\n if (pdfDocument !== this._pdfDocument) {\n return; // The document was closed while the optional content resolved.\n }\n if (promise) {\n // Ensure that the UI displays the correct state (e.g. with RBGroups).\n for (const [groupId, cached] of this._optionalContentVisibility) {\n const group = optionalContentConfig.getGroup(groupId);\n\n if (group && cached.visible !== group.visible) {\n cached.input.checked = cached.visible = !cached.visible;\n }\n }\n return;\n }\n this.eventBus.dispatch(\"optionalcontentconfig\", {\n source: this,\n promise: Promise.resolve(optionalContentConfig),\n });\n\n // Reset the sidebarView to the new state.\n this.render({\n optionalContentConfig,\n pdfDocument: this._pdfDocument,\n });\n }\n}\n\nexport { PDFLayerViewer };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./download_manager.js\").DownloadManager} DownloadManager */\n/** @typedef {import(\"./interfaces.js\").IPDFLinkService} IPDFLinkService */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/api.js\").PDFDocumentProxy} PDFDocumentProxy */\n\nimport { BaseTreeViewer } from \"./base_tree_viewer.js\";\nimport { SidebarView } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} PDFOutlineViewerOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {DownloadManager} downloadManager - The download manager.\n */\n\n/**\n * @typedef {Object} PDFOutlineViewerRenderParameters\n * @property {Array|null} outline - An array of outline objects.\n * @property {PDFDocumentProxy} pdfDocument - A {PDFDocument} instance.\n */\n\nclass PDFOutlineViewer extends BaseTreeViewer {\n /**\n * @param {PDFOutlineViewerOptions} options\n */\n constructor(options) {\n super(options);\n this.linkService = options.linkService;\n this.downloadManager = options.downloadManager;\n\n this.eventBus._on(\"toggleoutlinetree\", this._toggleAllTreeItems.bind(this));\n this.eventBus._on(\n \"currentoutlineitem\",\n this._currentOutlineItem.bind(this)\n );\n\n this.eventBus._on(\"pagechanging\", evt => {\n this._currentPageNumber = evt.pageNumber;\n });\n this.eventBus._on(\"pagesloaded\", evt => {\n this._isPagesLoaded = !!evt.pagesCount;\n\n // If the capability is still pending, see the `_dispatchEvent`-method,\n // we know that the `currentOutlineItem`-button can be enabled here.\n this._currentOutlineItemCapability?.resolve(\n /* enabled = */ this._isPagesLoaded\n );\n });\n this.eventBus._on(\"sidebarviewchanged\", evt => {\n this._sidebarView = evt.view;\n });\n }\n\n reset() {\n super.reset();\n this._outline = null;\n\n this._pageNumberToDestHashCapability = null;\n this._currentPageNumber = 1;\n this._isPagesLoaded = null;\n\n this._currentOutlineItemCapability?.resolve(/* enabled = */ false);\n this._currentOutlineItemCapability = null;\n }\n\n /**\n * @protected\n */\n _dispatchEvent(outlineCount) {\n this._currentOutlineItemCapability = Promise.withResolvers();\n if (\n outlineCount === 0 ||\n this._pdfDocument?.loadingParams.disableAutoFetch\n ) {\n this._currentOutlineItemCapability.resolve(/* enabled = */ false);\n } else if (this._isPagesLoaded !== null) {\n this._currentOutlineItemCapability.resolve(\n /* enabled = */ this._isPagesLoaded\n );\n }\n\n this.eventBus.dispatch(\"outlineloaded\", {\n source: this,\n outlineCount,\n currentOutlineItemPromise: this._currentOutlineItemCapability.promise,\n });\n }\n\n /**\n * @protected\n */\n _bindLink(\n element,\n { url, newWindow, action, attachment, dest, setOCGState }\n ) {\n const { linkService } = this;\n\n if (url) {\n linkService.addLinkAttributes(element, url, newWindow);\n return;\n }\n if (action) {\n element.href = linkService.getAnchorUrl(\"\");\n element.onclick = () => {\n linkService.executeNamedAction(action);\n return false;\n };\n return;\n }\n if (attachment) {\n element.href = linkService.getAnchorUrl(\"\");\n element.onclick = () => {\n this.downloadManager.openOrDownloadData(\n attachment.content,\n attachment.filename\n );\n return false;\n };\n return;\n }\n if (setOCGState) {\n element.href = linkService.getAnchorUrl(\"\");\n element.onclick = () => {\n linkService.executeSetOCGState(setOCGState);\n return false;\n };\n return;\n }\n\n element.href = linkService.getDestinationHash(dest);\n element.onclick = evt => {\n this._updateCurrentTreeItem(evt.target.parentNode);\n\n if (dest) {\n linkService.goToDestination(dest);\n }\n return false;\n };\n }\n\n /**\n * @private\n */\n _setStyles(element, { bold, italic }) {\n if (bold) {\n element.style.fontWeight = \"bold\";\n }\n if (italic) {\n element.style.fontStyle = \"italic\";\n }\n }\n\n /**\n * @protected\n */\n _addToggleButton(div, { count, items }) {\n let hidden = false;\n if (count < 0) {\n let totalCount = items.length;\n if (totalCount > 0) {\n const queue = [...items];\n while (queue.length > 0) {\n const { count: nestedCount, items: nestedItems } = queue.shift();\n if (nestedCount > 0 && nestedItems.length > 0) {\n totalCount += nestedItems.length;\n queue.push(...nestedItems);\n }\n }\n }\n if (Math.abs(count) === totalCount) {\n hidden = true;\n }\n }\n super._addToggleButton(div, hidden);\n }\n\n /**\n * @private\n */\n _toggleAllTreeItems() {\n if (!this._outline) {\n return;\n }\n super._toggleAllTreeItems();\n }\n\n /**\n * @param {PDFOutlineViewerRenderParameters} params\n */\n render({ outline, pdfDocument }) {\n if (this._outline) {\n this.reset();\n }\n this._outline = outline || null;\n this._pdfDocument = pdfDocument || null;\n\n if (!outline) {\n this._dispatchEvent(/* outlineCount = */ 0);\n return;\n }\n\n const fragment = document.createDocumentFragment();\n const queue = [{ parent: fragment, items: outline }];\n let outlineCount = 0,\n hasAnyNesting = false;\n while (queue.length > 0) {\n const levelData = queue.shift();\n for (const item of levelData.items) {\n const div = document.createElement(\"div\");\n div.className = \"treeItem\";\n\n const element = document.createElement(\"a\");\n this._bindLink(element, item);\n this._setStyles(element, item);\n element.textContent = this._normalizeTextContent(item.title);\n\n div.append(element);\n\n if (item.items.length > 0) {\n hasAnyNesting = true;\n this._addToggleButton(div, item);\n\n const itemsDiv = document.createElement(\"div\");\n itemsDiv.className = \"treeItems\";\n div.append(itemsDiv);\n\n queue.push({ parent: itemsDiv, items: item.items });\n }\n\n levelData.parent.append(div);\n outlineCount++;\n }\n }\n\n this._finishRendering(fragment, outlineCount, hasAnyNesting);\n }\n\n /**\n * Find/highlight the current outline item, corresponding to the active page.\n * @private\n */\n async _currentOutlineItem() {\n if (!this._isPagesLoaded) {\n throw new Error(\"_currentOutlineItem: All pages have not been loaded.\");\n }\n if (!this._outline || !this._pdfDocument) {\n return;\n }\n\n const pageNumberToDestHash = await this._getPageNumberToDestHash(\n this._pdfDocument\n );\n if (!pageNumberToDestHash) {\n return;\n }\n this._updateCurrentTreeItem(/* treeItem = */ null);\n\n if (this._sidebarView !== SidebarView.OUTLINE) {\n return; // The outline view is no longer visible, hence do nothing.\n }\n // When there is no destination on the current page, always check the\n // previous ones in (reverse) order.\n for (let i = this._currentPageNumber; i > 0; i--) {\n const destHash = pageNumberToDestHash.get(i);\n if (!destHash) {\n continue;\n }\n const linkElement = this.container.querySelector(`a[href=\"${destHash}\"]`);\n if (!linkElement) {\n continue;\n }\n this._scrollToCurrentTreeItem(linkElement.parentNode);\n break;\n }\n }\n\n /**\n * To (significantly) simplify the overall implementation, we will only\n * consider *one* destination per page when finding/highlighting the current\n * outline item (similar to e.g. Adobe Reader); more specifically, we choose\n * the *first* outline item at the *lowest* level of the outline tree.\n * @private\n */\n async _getPageNumberToDestHash(pdfDocument) {\n if (this._pageNumberToDestHashCapability) {\n return this._pageNumberToDestHashCapability.promise;\n }\n this._pageNumberToDestHashCapability = Promise.withResolvers();\n\n const pageNumberToDestHash = new Map(),\n pageNumberNesting = new Map();\n const queue = [{ nesting: 0, items: this._outline }];\n while (queue.length > 0) {\n const levelData = queue.shift(),\n currentNesting = levelData.nesting;\n for (const { dest, items } of levelData.items) {\n let explicitDest, pageNumber;\n if (typeof dest === \"string\") {\n explicitDest = await pdfDocument.getDestination(dest);\n\n if (pdfDocument !== this._pdfDocument) {\n return null; // The document was closed while the data resolved.\n }\n } else {\n explicitDest = dest;\n }\n if (Array.isArray(explicitDest)) {\n const [destRef] = explicitDest;\n\n if (destRef && typeof destRef === \"object\") {\n // The page reference must be available, since the current method\n // won't be invoked until all pages have been loaded.\n pageNumber = pdfDocument.cachedPageNumber(destRef);\n } else if (Number.isInteger(destRef)) {\n pageNumber = destRef + 1;\n }\n\n if (\n Number.isInteger(pageNumber) &&\n (!pageNumberToDestHash.has(pageNumber) ||\n currentNesting > pageNumberNesting.get(pageNumber))\n ) {\n const destHash = this.linkService.getDestinationHash(dest);\n pageNumberToDestHash.set(pageNumber, destHash);\n pageNumberNesting.set(pageNumber, currentNesting);\n }\n }\n\n if (items.length > 0) {\n queue.push({ nesting: currentNesting + 1, items });\n }\n }\n }\n\n this._pageNumberToDestHashCapability.resolve(\n pageNumberToDestHash.size > 0 ? pageNumberToDestHash : null\n );\n return this._pageNumberToDestHashCapability.promise;\n }\n}\n\nexport { PDFOutlineViewer };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n/** @typedef {import(\"./pdf_viewer.js\").PDFViewer} PDFViewer */\n\nimport {\n normalizeWheelEventDelta,\n PresentationModeState,\n ScrollMode,\n SpreadMode,\n} from \"./ui_utils.js\";\nimport { AnnotationEditorType } from \"pdfjs-lib\";\n\nconst DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms\nconst ACTIVE_SELECTOR = \"pdfPresentationMode\";\nconst CONTROLS_SELECTOR = \"pdfPresentationModeControls\";\nconst MOUSE_SCROLL_COOLDOWN_TIME = 50; // in ms\nconst PAGE_SWITCH_THRESHOLD = 0.1;\n\n// Number of CSS pixels for a movement to count as a swipe.\nconst SWIPE_MIN_DISTANCE_THRESHOLD = 50;\n\n// Swipe angle deviation from the x or y axis before it is not\n// considered a swipe in that direction any more.\nconst SWIPE_ANGLE_THRESHOLD = Math.PI / 6;\n\n/**\n * @typedef {Object} PDFPresentationModeOptions\n * @property {HTMLDivElement} container - The container for the viewer element.\n * @property {PDFViewer} pdfViewer - The document viewer.\n * @property {EventBus} eventBus - The application event bus.\n */\n\nclass PDFPresentationMode {\n #state = PresentationModeState.UNKNOWN;\n\n #args = null;\n\n #fullscreenChangeAbortController = null;\n\n #windowAbortController = null;\n\n /**\n * @param {PDFPresentationModeOptions} options\n */\n constructor({ container, pdfViewer, eventBus }) {\n this.container = container;\n this.pdfViewer = pdfViewer;\n this.eventBus = eventBus;\n\n this.contextMenuOpen = false;\n this.mouseScrollTimeStamp = 0;\n this.mouseScrollDelta = 0;\n this.touchSwipeState = null;\n }\n\n /**\n * Request the browser to enter fullscreen mode.\n * @returns {Promise<boolean>} Indicating if the request was successful.\n */\n async request() {\n const { container, pdfViewer } = this;\n\n if (this.active || !pdfViewer.pagesCount || !container.requestFullscreen) {\n return false;\n }\n this.#addFullscreenChangeListeners();\n this.#notifyStateChange(PresentationModeState.CHANGING);\n\n const promise = container.requestFullscreen();\n\n this.#args = {\n pageNumber: pdfViewer.currentPageNumber,\n scaleValue: pdfViewer.currentScaleValue,\n scrollMode: pdfViewer.scrollMode,\n spreadMode: null,\n annotationEditorMode: null,\n };\n\n if (\n pdfViewer.spreadMode !== SpreadMode.NONE &&\n !(pdfViewer.pageViewsReady && pdfViewer.hasEqualPageSizes)\n ) {\n console.warn(\n \"Ignoring Spread modes when entering PresentationMode, \" +\n \"since the document may contain varying page sizes.\"\n );\n this.#args.spreadMode = pdfViewer.spreadMode;\n }\n if (pdfViewer.annotationEditorMode !== AnnotationEditorType.DISABLE) {\n this.#args.annotationEditorMode = pdfViewer.annotationEditorMode;\n }\n\n try {\n await promise;\n pdfViewer.focus(); // Fixes bug 1787456.\n return true;\n } catch {\n this.#removeFullscreenChangeListeners();\n this.#notifyStateChange(PresentationModeState.NORMAL);\n }\n return false;\n }\n\n get active() {\n return (\n this.#state === PresentationModeState.CHANGING ||\n this.#state === PresentationModeState.FULLSCREEN\n );\n }\n\n #mouseWheel(evt) {\n if (!this.active) {\n return;\n }\n evt.preventDefault();\n\n const delta = normalizeWheelEventDelta(evt);\n const currentTime = Date.now();\n const storedTime = this.mouseScrollTimeStamp;\n\n // If we've already switched page, avoid accidentally switching again.\n if (\n currentTime > storedTime &&\n currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME\n ) {\n return;\n }\n // If the scroll direction changed, reset the accumulated scroll delta.\n if (\n (this.mouseScrollDelta > 0 && delta < 0) ||\n (this.mouseScrollDelta < 0 && delta > 0)\n ) {\n this.#resetMouseScrollState();\n }\n this.mouseScrollDelta += delta;\n\n if (Math.abs(this.mouseScrollDelta) >= PAGE_SWITCH_THRESHOLD) {\n const totalDelta = this.mouseScrollDelta;\n this.#resetMouseScrollState();\n const success =\n totalDelta > 0\n ? this.pdfViewer.previousPage()\n : this.pdfViewer.nextPage();\n if (success) {\n this.mouseScrollTimeStamp = currentTime;\n }\n }\n }\n\n #notifyStateChange(state) {\n this.#state = state;\n\n this.eventBus.dispatch(\"presentationmodechanged\", { source: this, state });\n }\n\n #enter() {\n this.#notifyStateChange(PresentationModeState.FULLSCREEN);\n this.container.classList.add(ACTIVE_SELECTOR);\n\n // Ensure that the correct page is scrolled into view when entering\n // Presentation Mode, by waiting until fullscreen mode in enabled.\n setTimeout(() => {\n this.pdfViewer.scrollMode = ScrollMode.PAGE;\n if (this.#args.spreadMode !== null) {\n this.pdfViewer.spreadMode = SpreadMode.NONE;\n }\n this.pdfViewer.currentPageNumber = this.#args.pageNumber;\n this.pdfViewer.currentScaleValue = \"page-fit\";\n\n if (this.#args.annotationEditorMode !== null) {\n this.pdfViewer.annotationEditorMode = {\n mode: AnnotationEditorType.NONE,\n };\n }\n }, 0);\n\n this.#addWindowListeners();\n this.#showControls();\n this.contextMenuOpen = false;\n\n // Text selection is disabled in Presentation Mode, thus it's not possible\n // for the user to deselect text that is selected (e.g. with \"Select all\")\n // when entering Presentation Mode, hence we remove any active selection.\n document.getSelection().empty();\n }\n\n #exit() {\n const pageNumber = this.pdfViewer.currentPageNumber;\n this.container.classList.remove(ACTIVE_SELECTOR);\n\n // Ensure that the correct page is scrolled into view when exiting\n // Presentation Mode, by waiting until fullscreen mode is disabled.\n setTimeout(() => {\n this.#removeFullscreenChangeListeners();\n this.#notifyStateChange(PresentationModeState.NORMAL);\n\n this.pdfViewer.scrollMode = this.#args.scrollMode;\n if (this.#args.spreadMode !== null) {\n this.pdfViewer.spreadMode = this.#args.spreadMode;\n }\n this.pdfViewer.currentScaleValue = this.#args.scaleValue;\n this.pdfViewer.currentPageNumber = pageNumber;\n\n if (this.#args.annotationEditorMode !== null) {\n this.pdfViewer.annotationEditorMode = {\n mode: this.#args.annotationEditorMode,\n };\n }\n this.#args = null;\n }, 0);\n\n this.#removeWindowListeners();\n this.#hideControls();\n this.#resetMouseScrollState();\n this.contextMenuOpen = false;\n }\n\n #mouseDown(evt) {\n if (this.contextMenuOpen) {\n this.contextMenuOpen = false;\n evt.preventDefault();\n return;\n }\n if (evt.button !== 0) {\n return;\n }\n // Enable clicking of links in presentation mode. Note: only links\n // pointing to destinations in the current PDF document work.\n if (\n evt.target.href &&\n evt.target.parentNode?.hasAttribute(\"data-internal-link\")\n ) {\n return;\n }\n // Unless an internal link was clicked, advance one page.\n evt.preventDefault();\n\n if (evt.shiftKey) {\n this.pdfViewer.previousPage();\n } else {\n this.pdfViewer.nextPage();\n }\n }\n\n #contextMenu() {\n this.contextMenuOpen = true;\n }\n\n #showControls() {\n if (this.controlsTimeout) {\n clearTimeout(this.controlsTimeout);\n } else {\n this.container.classList.add(CONTROLS_SELECTOR);\n }\n this.controlsTimeout = setTimeout(() => {\n this.container.classList.remove(CONTROLS_SELECTOR);\n delete this.controlsTimeout;\n }, DELAY_BEFORE_HIDING_CONTROLS);\n }\n\n #hideControls() {\n if (!this.controlsTimeout) {\n return;\n }\n clearTimeout(this.controlsTimeout);\n this.container.classList.remove(CONTROLS_SELECTOR);\n delete this.controlsTimeout;\n }\n\n /**\n * Resets the properties used for tracking mouse scrolling events.\n */\n #resetMouseScrollState() {\n this.mouseScrollTimeStamp = 0;\n this.mouseScrollDelta = 0;\n }\n\n #touchSwipe(evt) {\n if (!this.active) {\n return;\n }\n if (evt.touches.length > 1) {\n // Multiple touch points detected; cancel the swipe.\n this.touchSwipeState = null;\n return;\n }\n\n switch (evt.type) {\n case \"touchstart\":\n this.touchSwipeState = {\n startX: evt.touches[0].pageX,\n startY: evt.touches[0].pageY,\n endX: evt.touches[0].pageX,\n endY: evt.touches[0].pageY,\n };\n break;\n case \"touchmove\":\n if (this.touchSwipeState === null) {\n return;\n }\n this.touchSwipeState.endX = evt.touches[0].pageX;\n this.touchSwipeState.endY = evt.touches[0].pageY;\n // Avoid the swipe from triggering browser gestures (Chrome in\n // particular has some sort of swipe gesture in fullscreen mode).\n evt.preventDefault();\n break;\n case \"touchend\":\n if (this.touchSwipeState === null) {\n return;\n }\n let delta = 0;\n const dx = this.touchSwipeState.endX - this.touchSwipeState.startX;\n const dy = this.touchSwipeState.endY - this.touchSwipeState.startY;\n const absAngle = Math.abs(Math.atan2(dy, dx));\n if (\n Math.abs(dx) > SWIPE_MIN_DISTANCE_THRESHOLD &&\n (absAngle <= SWIPE_ANGLE_THRESHOLD ||\n absAngle >= Math.PI - SWIPE_ANGLE_THRESHOLD)\n ) {\n // Horizontal swipe.\n delta = dx;\n } else if (\n Math.abs(dy) > SWIPE_MIN_DISTANCE_THRESHOLD &&\n Math.abs(absAngle - Math.PI / 2) <= SWIPE_ANGLE_THRESHOLD\n ) {\n // Vertical swipe.\n delta = dy;\n }\n if (delta > 0) {\n this.pdfViewer.previousPage();\n } else if (delta < 0) {\n this.pdfViewer.nextPage();\n }\n break;\n }\n }\n\n #addWindowListeners() {\n if (this.#windowAbortController) {\n return;\n }\n this.#windowAbortController = new AbortController();\n const { signal } = this.#windowAbortController;\n\n const touchSwipeBind = this.#touchSwipe.bind(this);\n\n window.addEventListener(\"mousemove\", this.#showControls.bind(this), {\n signal,\n });\n window.addEventListener(\"mousedown\", this.#mouseDown.bind(this), {\n signal,\n });\n window.addEventListener(\"wheel\", this.#mouseWheel.bind(this), {\n passive: false,\n signal,\n });\n window.addEventListener(\"keydown\", this.#resetMouseScrollState.bind(this), {\n signal,\n });\n window.addEventListener(\"contextmenu\", this.#contextMenu.bind(this), {\n signal,\n });\n window.addEventListener(\"touchstart\", touchSwipeBind, { signal });\n window.addEventListener(\"touchmove\", touchSwipeBind, { signal });\n window.addEventListener(\"touchend\", touchSwipeBind, { signal });\n }\n\n #removeWindowListeners() {\n this.#windowAbortController?.abort();\n this.#windowAbortController = null;\n }\n\n #addFullscreenChangeListeners() {\n if (this.#fullscreenChangeAbortController) {\n return;\n }\n this.#fullscreenChangeAbortController = new AbortController();\n\n window.addEventListener(\n \"fullscreenchange\",\n () => {\n if (/* isFullscreen = */ document.fullscreenElement) {\n this.#enter();\n } else {\n this.#exit();\n }\n },\n { signal: this.#fullscreenChangeAbortController.signal }\n );\n }\n\n #removeFullscreenChangeListeners() {\n this.#fullscreenChangeAbortController?.abort();\n this.#fullscreenChangeAbortController = null;\n }\n}\n\nexport { PDFPresentationMode };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/annotation_storage\").AnnotationStorage} AnnotationStorage */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"./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\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 {PageViewport} viewport\n * @param {string} intent (default value is 'display')\n * @returns {Promise<Object | void>} A promise that is resolved when rendering\n * of the XFA layer is complete. The first rendering will return an object\n * with a `textDivs` property that can be used with the TextHighlighter.\n */\n async render(viewport, intent = \"display\") {\n if (intent === \"print\") {\n const parameters = {\n viewport: viewport.clone({ dontFlip: true }),\n div: this.div,\n xfaHtml: this.xfaHtml,\n annotationStorage: this.annotationStorage,\n linkService: this.linkService,\n intent,\n };\n\n // Create an xfa layer div and render the form\n this.div = document.createElement(\"div\");\n parameters.div = this.div;\n\n return XfaLayer.render(parameters);\n }\n\n // intent === \"display\"\n const xfaHtml = await this.pdfPage.getXfa();\n if (this._cancelled || !xfaHtml) {\n return { textDivs: [] };\n }\n\n const parameters = {\n viewport: viewport.clone({ dontFlip: true }),\n div: this.div,\n xfaHtml,\n annotationStorage: this.annotationStorage,\n linkService: this.linkService,\n intent,\n };\n\n if (this.div) {\n return XfaLayer.update(parameters);\n }\n // Create an xfa layer div and render the form\n this.div = document.createElement(\"div\");\n parameters.div = this.div;\n\n return XfaLayer.render(parameters);\n }\n\n cancel() {\n this._cancelled = true;\n }\n\n hide() {\n if (!this.div) {\n return;\n }\n this.div.hidden = true;\n }\n}\n\nexport { XfaLayerBuilder };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getXfaPageViewport, PixelsPerInch } from \"pdfjs-lib\";\nimport { SimpleLinkService } from \"./pdf_link_service.js\";\nimport { XfaLayerBuilder } from \"./xfa_layer_builder.js\";\n\nfunction getXfaHtmlForPrinting(printContainer, pdfDocument) {\n const xfaHtml = pdfDocument.allXfaHtml;\n const linkService = new SimpleLinkService();\n const scale = Math.round(PixelsPerInch.PDF_TO_CSS_UNITS * 100) / 100;\n\n for (const xfaPage of xfaHtml.children) {\n const page = document.createElement(\"div\");\n page.className = \"xfaPrintedPage\";\n printContainer.append(page);\n\n const builder = new XfaLayerBuilder({\n pdfPage: null,\n annotationStorage: pdfDocument.annotationStorage,\n linkService,\n xfaHtml: xfaPage,\n });\n const viewport = getXfaPageViewport(xfaPage, { scale });\n\n builder.render(viewport, \"print\");\n page.append(builder.div);\n }\n}\n\nexport { getXfaHtmlForPrinting };\n","/* Copyright 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./interfaces.js\").IPDFPrintServiceFactory} IPDFPrintServiceFactory */\n\nimport {\n AnnotationMode,\n PixelsPerInch,\n RenderingCancelledException,\n shadow,\n} from \"pdfjs-lib\";\nimport { getXfaHtmlForPrinting } from \"./print_utils.js\";\n\nlet activeService = null;\nlet dialog = null;\nlet overlayManager = null;\nlet viewerApp = { initialized: false };\n\n// Renders the page to the canvas of the given print service, and returns\n// the suggested dimensions of the output page.\nfunction renderPage(\n activeServiceOnEntry,\n pdfDocument,\n pageNumber,\n size,\n printResolution,\n optionalContentConfigPromise,\n printAnnotationStoragePromise\n) {\n const scratchCanvas = activeService.scratchCanvas;\n\n // The size of the canvas in pixels for printing.\n const PRINT_UNITS = printResolution / PixelsPerInch.PDF;\n scratchCanvas.width = Math.floor(size.width * PRINT_UNITS);\n scratchCanvas.height = Math.floor(size.height * PRINT_UNITS);\n\n const ctx = scratchCanvas.getContext(\"2d\");\n ctx.save();\n ctx.fillStyle = \"rgb(255, 255, 255)\";\n ctx.fillRect(0, 0, scratchCanvas.width, scratchCanvas.height);\n ctx.restore();\n\n return Promise.all([\n pdfDocument.getPage(pageNumber),\n printAnnotationStoragePromise,\n ]).then(function ([pdfPage, printAnnotationStorage]) {\n const renderContext = {\n canvasContext: ctx,\n transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],\n viewport: pdfPage.getViewport({ scale: 1, rotation: size.rotation }),\n intent: \"print\",\n annotationMode: AnnotationMode.ENABLE_STORAGE,\n optionalContentConfigPromise,\n printAnnotationStorage,\n };\n const renderTask = pdfPage.render(renderContext);\n\n return renderTask.promise.catch(reason => {\n if (!(reason instanceof RenderingCancelledException)) {\n console.error(reason);\n }\n throw reason;\n });\n });\n}\n\nclass PDFPrintService {\n constructor({\n pdfDocument,\n pagesOverview,\n printContainer,\n printResolution,\n printAnnotationStoragePromise = null,\n }) {\n this.pdfDocument = pdfDocument;\n this.pagesOverview = pagesOverview;\n this.printContainer = printContainer;\n this._printResolution = printResolution || 150;\n this._optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({\n intent: \"print\",\n });\n this._printAnnotationStoragePromise =\n printAnnotationStoragePromise || Promise.resolve();\n this.currentPage = -1;\n // The temporary canvas where renderPage paints one page at a time.\n this.scratchCanvas = document.createElement(\"canvas\");\n }\n\n layout() {\n this.throwIfInactive();\n\n const body = document.querySelector(\"body\");\n body.setAttribute(\"data-pdfjsprinting\", true);\n\n const { width, height } = this.pagesOverview[0];\n const hasEqualPageSizes = this.pagesOverview.every(\n size => size.width === width && size.height === height\n );\n if (!hasEqualPageSizes) {\n console.warn(\n \"Not all pages have the same size. The printed result may be incorrect!\"\n );\n }\n\n // Insert a @page + size rule to make sure that the page size is correctly\n // set. Note that we assume that all pages have the same size, because\n // variable-size pages are not supported yet (e.g. in Chrome & Firefox).\n // TODO(robwu): Use named pages when size calculation bugs get resolved\n // (e.g. https://crbug.com/355116) AND when support for named pages is\n // added (http://www.w3.org/TR/css3-page/#using-named-pages).\n // In browsers where @page + size is not supported, the next stylesheet\n // will be ignored and the user has to select the correct paper size in\n // the UI if wanted.\n this.pageStyleSheet = document.createElement(\"style\");\n this.pageStyleSheet.textContent = `@page { size: ${width}pt ${height}pt;}`;\n body.append(this.pageStyleSheet);\n }\n\n destroy() {\n if (activeService !== this) {\n // |activeService| cannot be replaced without calling destroy() first,\n // so if it differs then an external consumer has a stale reference to us.\n return;\n }\n this.printContainer.textContent = \"\";\n\n const body = document.querySelector(\"body\");\n body.removeAttribute(\"data-pdfjsprinting\");\n\n if (this.pageStyleSheet) {\n this.pageStyleSheet.remove();\n this.pageStyleSheet = null;\n }\n this.scratchCanvas.width = this.scratchCanvas.height = 0;\n this.scratchCanvas = null;\n activeService = null;\n ensureOverlay().then(function () {\n if (overlayManager.active === dialog) {\n overlayManager.close(dialog);\n }\n });\n }\n\n renderPages() {\n if (this.pdfDocument.isPureXfa) {\n getXfaHtmlForPrinting(this.printContainer, this.pdfDocument);\n return Promise.resolve();\n }\n\n const pageCount = this.pagesOverview.length;\n const renderNextPage = (resolve, reject) => {\n this.throwIfInactive();\n if (++this.currentPage >= pageCount) {\n renderProgress(pageCount, pageCount);\n resolve();\n return;\n }\n const index = this.currentPage;\n renderProgress(index, pageCount);\n renderPage(\n this,\n this.pdfDocument,\n /* pageNumber = */ index + 1,\n this.pagesOverview[index],\n this._printResolution,\n this._optionalContentConfigPromise,\n this._printAnnotationStoragePromise\n )\n .then(this.useRenderedPage.bind(this))\n .then(function () {\n renderNextPage(resolve, reject);\n }, reject);\n };\n return new Promise(renderNextPage);\n }\n\n useRenderedPage() {\n this.throwIfInactive();\n const img = document.createElement(\"img\");\n this.scratchCanvas.toBlob(blob => {\n img.src = URL.createObjectURL(blob);\n });\n\n const wrapper = document.createElement(\"div\");\n wrapper.className = \"printedPage\";\n wrapper.append(img);\n this.printContainer.append(wrapper);\n\n const { promise, resolve, reject } = Promise.withResolvers();\n img.onload = resolve;\n img.onerror = reject;\n\n promise\n .catch(() => {\n // Avoid \"Uncaught promise\" messages in the console.\n })\n .then(() => {\n URL.revokeObjectURL(img.src);\n });\n return promise;\n }\n\n performPrint() {\n this.throwIfInactive();\n return new Promise(resolve => {\n // Push window.print in the macrotask queue to avoid being affected by\n // the deprecation of running print() code in a microtask, see\n // https://github.com/mozilla/pdf.js/issues/7547.\n setTimeout(() => {\n if (!this.active) {\n resolve();\n return;\n }\n print.call(window);\n // Delay promise resolution in case print() was not synchronous.\n setTimeout(resolve, 20); // Tidy-up.\n }, 0);\n });\n }\n\n get active() {\n return this === activeService;\n }\n\n throwIfInactive() {\n if (!this.active) {\n throw new Error(\"This print request was cancelled or completed.\");\n }\n }\n}\n\nconst print = window.print;\nwindow.print = function () {\n if (activeService) {\n console.warn(\"Ignored window.print() because of a pending print job.\");\n return;\n }\n ensureOverlay().then(function () {\n if (activeService) {\n overlayManager.open(dialog);\n }\n });\n\n try {\n dispatchEvent(\"beforeprint\");\n } finally {\n if (!activeService) {\n console.error(\"Expected print service to be initialized.\");\n ensureOverlay().then(function () {\n if (overlayManager.active === dialog) {\n overlayManager.close(dialog);\n }\n });\n return; // eslint-disable-line no-unsafe-finally\n }\n const activeServiceOnEntry = activeService;\n activeService\n .renderPages()\n .then(function () {\n return activeServiceOnEntry.performPrint();\n })\n .catch(function () {\n // Ignore any error messages.\n })\n .then(function () {\n // aborts acts on the \"active\" print request, so we need to check\n // whether the print request (activeServiceOnEntry) is still active.\n // Without the check, an unrelated print request (created after aborting\n // this print request while the pages were being generated) would be\n // aborted.\n if (activeServiceOnEntry.active) {\n abort();\n }\n });\n }\n};\n\nfunction dispatchEvent(eventType) {\n const event = new CustomEvent(eventType, {\n bubbles: false,\n cancelable: false,\n detail: \"custom\",\n });\n window.dispatchEvent(event);\n}\n\nfunction abort() {\n if (activeService) {\n activeService.destroy();\n dispatchEvent(\"afterprint\");\n }\n}\n\nfunction renderProgress(index, total) {\n if (typeof PDFJSDev === \"undefined\" && window.isGECKOVIEW) {\n return;\n }\n dialog ||= document.getElementById(\"printServiceDialog\");\n const progress = Math.round((100 * index) / total);\n const progressBar = dialog.querySelector(\"progress\");\n const progressPerc = dialog.querySelector(\".relative-progress\");\n progressBar.value = progress;\n progressPerc.setAttribute(\"data-l10n-args\", JSON.stringify({ progress }));\n}\n\nwindow.addEventListener(\n \"keydown\",\n function (event) {\n // Intercept Cmd/Ctrl + P in all browsers.\n // Also intercept Cmd/Ctrl + Shift + P in Chrome and Opera\n if (\n event.keyCode === /* P= */ 80 &&\n (event.ctrlKey || event.metaKey) &&\n !event.altKey &&\n (!event.shiftKey || window.chrome || window.opera)\n ) {\n window.print();\n\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n },\n true\n);\n\nif (\"onbeforeprint\" in window) {\n // Do not propagate before/afterprint events when they are not triggered\n // from within this polyfill. (FF / Chrome 63+).\n const stopPropagationIfNeeded = function (event) {\n if (event.detail !== \"custom\") {\n event.stopImmediatePropagation();\n }\n };\n window.addEventListener(\"beforeprint\", stopPropagationIfNeeded);\n window.addEventListener(\"afterprint\", stopPropagationIfNeeded);\n}\n\nlet overlayPromise;\nfunction ensureOverlay() {\n if (typeof PDFJSDev === \"undefined\" && window.isGECKOVIEW) {\n return Promise.reject(\n new Error(\"ensureOverlay not implemented in GECKOVIEW development mode.\")\n );\n }\n if (!overlayPromise) {\n overlayManager = viewerApp.overlayManager;\n if (!overlayManager) {\n throw new Error(\"The overlay manager has not yet been initialized.\");\n }\n dialog ||= document.getElementById(\"printServiceDialog\");\n\n overlayPromise = overlayManager.register(\n dialog,\n /* canForceClose = */ true\n );\n\n document.getElementById(\"printCancel\").onclick = abort;\n dialog.addEventListener(\"close\", abort);\n }\n return overlayPromise;\n}\n\n/**\n * @implements {IPDFPrintServiceFactory}\n */\nclass PDFPrintServiceFactory {\n static initGlobals(app) {\n viewerApp = app;\n }\n\n static get supportsPrinting() {\n return shadow(this, \"supportsPrinting\", true);\n }\n\n static createPrintService(params) {\n if (activeService) {\n throw new Error(\"The print service is created and active.\");\n }\n return (activeService = new PDFPrintService(params));\n }\n}\n\nexport { PDFPrintServiceFactory };\n","/* Copyright 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 */\n getHighestPriority(visible, views, scrolledDown, preRenderExtra = false) {\n /**\n * The state has changed. Figure out which page has the highest priority to\n * render next (if any).\n *\n * Priority:\n * 1. visible pages\n * 2. if last scrolled down, the page after the visible pages, or\n * if last scrolled up, the page before the visible pages\n */\n const visibleViews = visible.views,\n numVisible = visibleViews.length;\n\n if (numVisible === 0) {\n return null;\n }\n for (let i = 0; i < numVisible; i++) {\n const view = visibleViews[i].view;\n if (!this.isViewFinished(view)) {\n return view;\n }\n }\n const firstId = visible.first.id,\n lastId = visible.last.id;\n\n // All the visible views have rendered; try to handle any \"holes\" in the\n // page layout (can happen e.g. with spreadModes at higher zoom levels).\n if (lastId - firstId + 1 > numVisible) {\n const visibleIds = visible.ids;\n for (let i = 1, ii = lastId - firstId; i < ii; i++) {\n const holeId = scrolledDown ? firstId + i : lastId - i;\n if (visibleIds.has(holeId)) {\n continue;\n }\n const holeView = views[holeId - 1];\n if (!this.isViewFinished(holeView)) {\n return holeView;\n }\n }\n }\n\n // All the visible views have rendered; try to render next/previous page.\n // (IDs start at 1, so no need to add 1 when `scrolledDown === true`.)\n let preRenderIndex = scrolledDown ? lastId : firstId - 2;\n let preRenderView = views[preRenderIndex];\n\n if (preRenderView && !this.isViewFinished(preRenderView)) {\n return preRenderView;\n }\n if (preRenderExtra) {\n preRenderIndex += scrolledDown ? 1 : -1;\n preRenderView = views[preRenderIndex];\n\n if (preRenderView && !this.isViewFinished(preRenderView)) {\n return preRenderView;\n }\n }\n // Everything that needs to be rendered has been.\n return null;\n }\n\n /**\n * @param {IRenderableView} view\n * @returns {boolean}\n */\n isViewFinished(view) {\n return view.renderingState === RenderingStates.FINISHED;\n }\n\n /**\n * Render a page or thumbnail view. This calls the appropriate function\n * based on the views state. If the view is already rendered it will return\n * `false`.\n *\n * @param {IRenderableView} view\n */\n renderView(view) {\n switch (view.renderingState) {\n case RenderingStates.FINISHED:\n return false;\n case RenderingStates.PAUSED:\n this.highestPriorityPage = view.renderingId;\n view.resume();\n break;\n case RenderingStates.RUNNING:\n this.highestPriorityPage = view.renderingId;\n break;\n case RenderingStates.INITIAL:\n this.highestPriorityPage = view.renderingId;\n view\n .draw()\n .finally(() => {\n this.renderHighestPriority();\n })\n .catch(reason => {\n if (reason instanceof RenderingCancelledException) {\n return;\n }\n console.error(`renderView: \"${reason}\"`);\n });\n break;\n }\n return true;\n }\n}\n\nexport { PDFRenderingQueue };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n\nimport { apiPageLayoutToViewerModes, RenderingStates } from \"./ui_utils.js\";\nimport { 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.message}\".`);\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.message}\".`);\n\n await this.#destroyScripting();\n return;\n }\n\n await this.#scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"Open\",\n });\n await this.#dispatchPageOpen(\n this.#pdfViewer.currentPageNumber,\n /* initialize = */ true\n );\n\n // Defer this slightly, to ensure that scripting is *fully* initialized.\n Promise.resolve().then(() => {\n if (pdfDocument === this.#pdfDocument) {\n this.#ready = true;\n }\n });\n }\n\n async dispatchWillSave() {\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 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces.js\").IL10n} IL10n */\n\nimport {\n docStyle,\n PresentationModeState,\n SidebarView,\n toggleCheckedBtn,\n toggleExpandedBtn,\n} from \"./ui_utils.js\";\n\nconst SIDEBAR_WIDTH_VAR = \"--sidebar-width\";\nconst SIDEBAR_MIN_WIDTH = 200; // pixels\nconst SIDEBAR_RESIZING_CLASS = \"sidebarResizing\";\nconst UI_NOTIFICATION_CLASS = \"pdfSidebarNotification\";\n\n/**\n * @typedef {Object} PDFSidebarOptions\n * @property {PDFSidebarElements} elements - The DOM elements.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IL10n} l10n - The localization service.\n */\n\n/**\n * @typedef {Object} PDFSidebarElements\n * @property {HTMLDivElement} outerContainer - The outer container\n * (encasing both the viewer and sidebar elements).\n * @property {HTMLDivElement} sidebarContainer - The sidebar container\n * (in which the views are placed).\n * @property {HTMLButtonElement} toggleButton - The button used for\n * opening/closing the sidebar.\n * @property {HTMLDivElement} resizer - The DOM element that can be dragged in\n * order to adjust the width of the sidebar.\n * @property {HTMLButtonElement} thumbnailButton - The button used to show\n * the thumbnail view.\n * @property {HTMLButtonElement} outlineButton - The button used to show\n * the outline view.\n * @property {HTMLButtonElement} attachmentsButton - The button used to show\n * the attachments view.\n * @property {HTMLButtonElement} layersButton - The button used to show\n * the layers view.\n * @property {HTMLDivElement} thumbnailView - The container in which\n * the thumbnails are placed.\n * @property {HTMLDivElement} outlineView - The container in which\n * the outline is placed.\n * @property {HTMLDivElement} attachmentsView - The container in which\n * the attachments are placed.\n * @property {HTMLDivElement} layersView - The container in which\n * the layers are placed.\n * @property {HTMLButtonElement} currentOutlineItemButton - The button used to\n * find the current outline item.\n */\n\nclass PDFSidebar {\n #isRTL = false;\n\n #mouseAC = null;\n\n #outerContainerWidth = null;\n\n #width = null;\n\n /**\n * @param {PDFSidebarOptions} options\n */\n constructor({ elements, eventBus, l10n }) {\n this.isOpen = false;\n this.active = SidebarView.THUMBS;\n this.isInitialViewSet = false;\n this.isInitialEventDispatched = false;\n\n /**\n * Callback used when the sidebar has been opened/closed, to ensure that\n * the viewers (PDFViewer/PDFThumbnailViewer) are updated correctly.\n */\n this.onToggled = null;\n this.onUpdateThumbnails = null;\n\n this.outerContainer = elements.outerContainer;\n this.sidebarContainer = elements.sidebarContainer;\n this.toggleButton = elements.toggleButton;\n this.resizer = elements.resizer;\n\n this.thumbnailButton = elements.thumbnailButton;\n this.outlineButton = elements.outlineButton;\n this.attachmentsButton = elements.attachmentsButton;\n this.layersButton = elements.layersButton;\n\n this.thumbnailView = elements.thumbnailView;\n this.outlineView = elements.outlineView;\n this.attachmentsView = elements.attachmentsView;\n this.layersView = elements.layersView;\n\n this._currentOutlineItemButton = elements.currentOutlineItemButton;\n\n this.eventBus = eventBus;\n\n this.#isRTL = l10n.getDirection() === \"rtl\";\n this.#addEventListeners();\n }\n\n reset() {\n this.isInitialViewSet = false;\n this.isInitialEventDispatched = false;\n\n this.#hideUINotification(/* reset = */ true);\n this.switchView(SidebarView.THUMBS);\n\n this.outlineButton.disabled = false;\n this.attachmentsButton.disabled = false;\n this.layersButton.disabled = false;\n this._currentOutlineItemButton.disabled = true;\n }\n\n /**\n * @type {number} One of the values in {SidebarView}.\n */\n get visibleView() {\n return this.isOpen ? this.active : SidebarView.NONE;\n }\n\n /**\n * @param {number} view - The sidebar view that should become visible,\n * must be one of the values in {SidebarView}.\n */\n setInitialView(view = SidebarView.NONE) {\n if (this.isInitialViewSet) {\n return;\n }\n this.isInitialViewSet = true;\n\n // If the user has already manually opened the sidebar, immediately closing\n // it would be bad UX; also ignore the \"unknown\" sidebar view value.\n if (view === SidebarView.NONE || view === SidebarView.UNKNOWN) {\n this.#dispatchEvent();\n return;\n }\n this.switchView(view, /* forceOpen = */ true);\n\n // Prevent dispatching two back-to-back \"sidebarviewchanged\" events,\n // since `this.switchView` dispatched the event if the view changed.\n if (!this.isInitialEventDispatched) {\n this.#dispatchEvent();\n }\n }\n\n /**\n * @param {number} view - The sidebar view that should be switched to,\n * must be one of the values in {SidebarView}.\n * @param {boolean} [forceOpen] - Ensure that the sidebar is open.\n * The default value is `false`.\n */\n switchView(view, forceOpen = false) {\n const isViewChanged = view !== this.active;\n let forceRendering = false;\n\n switch (view) {\n case SidebarView.NONE:\n if (this.isOpen) {\n this.close();\n }\n return; // Closing will trigger rendering and dispatch the event.\n case SidebarView.THUMBS:\n if (this.isOpen && isViewChanged) {\n forceRendering = true;\n }\n break;\n case SidebarView.OUTLINE:\n if (this.outlineButton.disabled) {\n return;\n }\n break;\n case SidebarView.ATTACHMENTS:\n if (this.attachmentsButton.disabled) {\n return;\n }\n break;\n case SidebarView.LAYERS:\n if (this.layersButton.disabled) {\n return;\n }\n break;\n default:\n console.error(`PDFSidebar.switchView: \"${view}\" is not a valid view.`);\n return;\n }\n // Update the active view *after* it has been validated above,\n // in order to prevent setting it to an invalid state.\n this.active = view;\n\n // Update the CSS classes (and aria attributes), for all buttons and views.\n toggleCheckedBtn(\n this.thumbnailButton,\n view === SidebarView.THUMBS,\n this.thumbnailView\n );\n toggleCheckedBtn(\n this.outlineButton,\n view === SidebarView.OUTLINE,\n this.outlineView\n );\n toggleCheckedBtn(\n this.attachmentsButton,\n view === SidebarView.ATTACHMENTS,\n this.attachmentsView\n );\n toggleCheckedBtn(\n this.layersButton,\n view === SidebarView.LAYERS,\n this.layersView\n );\n\n if (forceOpen && !this.isOpen) {\n this.open();\n return; // Opening will trigger rendering and dispatch the event.\n }\n if (forceRendering) {\n this.onUpdateThumbnails();\n this.onToggled();\n }\n if (isViewChanged) {\n this.#dispatchEvent();\n }\n }\n\n open() {\n if (this.isOpen) {\n return;\n }\n this.isOpen = true;\n toggleExpandedBtn(this.toggleButton, true);\n\n this.outerContainer.classList.add(\"sidebarMoving\", \"sidebarOpen\");\n\n if (this.active === SidebarView.THUMBS) {\n this.onUpdateThumbnails();\n }\n this.onToggled();\n this.#dispatchEvent();\n\n this.#hideUINotification();\n }\n\n close(evt = null) {\n if (!this.isOpen) {\n return;\n }\n this.isOpen = false;\n toggleExpandedBtn(this.toggleButton, false);\n\n this.outerContainer.classList.add(\"sidebarMoving\");\n this.outerContainer.classList.remove(\"sidebarOpen\");\n\n this.onToggled();\n this.#dispatchEvent();\n\n if (evt?.detail > 0) {\n // Remove focus from the toggleButton if it's clicked (see issue 17361).\n this.toggleButton.blur();\n }\n }\n\n toggle(evt = null) {\n if (this.isOpen) {\n this.close(evt);\n } else {\n this.open();\n }\n }\n\n #dispatchEvent() {\n if (this.isInitialViewSet) {\n this.isInitialEventDispatched ||= true;\n }\n\n this.eventBus.dispatch(\"sidebarviewchanged\", {\n source: this,\n view: this.visibleView,\n });\n }\n\n #showUINotification() {\n this.toggleButton.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-toggle-sidebar-notification-button\"\n );\n\n if (!this.isOpen) {\n // Only show the notification on the `toggleButton` if the sidebar is\n // currently closed, to avoid unnecessarily bothering the user.\n this.toggleButton.classList.add(UI_NOTIFICATION_CLASS);\n }\n }\n\n #hideUINotification(reset = false) {\n if (this.isOpen || reset) {\n // Only hide the notification on the `toggleButton` if the sidebar is\n // currently open, or when the current PDF document is being closed.\n this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS);\n }\n\n if (reset) {\n this.toggleButton.setAttribute(\n \"data-l10n-id\",\n \"pdfjs-toggle-sidebar-button\"\n );\n }\n }\n\n #addEventListeners() {\n const { eventBus, outerContainer } = this;\n\n this.sidebarContainer.addEventListener(\"transitionend\", evt => {\n if (evt.target === this.sidebarContainer) {\n outerContainer.classList.remove(\"sidebarMoving\");\n // Ensure that rendering is triggered after opening/closing the sidebar.\n eventBus.dispatch(\"resize\", { source: this });\n }\n });\n\n this.toggleButton.addEventListener(\"click\", evt => {\n this.toggle(evt);\n });\n\n // Buttons for switching views.\n this.thumbnailButton.addEventListener(\"click\", () => {\n this.switchView(SidebarView.THUMBS);\n });\n\n this.outlineButton.addEventListener(\"click\", () => {\n this.switchView(SidebarView.OUTLINE);\n });\n this.outlineButton.addEventListener(\"dblclick\", () => {\n eventBus.dispatch(\"toggleoutlinetree\", { source: this });\n });\n\n this.attachmentsButton.addEventListener(\"click\", () => {\n this.switchView(SidebarView.ATTACHMENTS);\n });\n\n this.layersButton.addEventListener(\"click\", () => {\n this.switchView(SidebarView.LAYERS);\n });\n this.layersButton.addEventListener(\"dblclick\", () => {\n eventBus.dispatch(\"resetlayers\", { source: this });\n });\n\n // Buttons for view-specific options.\n this._currentOutlineItemButton.addEventListener(\"click\", () => {\n eventBus.dispatch(\"currentoutlineitem\", { source: this });\n });\n\n // Disable/enable views.\n const onTreeLoaded = (count, button, view) => {\n button.disabled = !count;\n\n if (count) {\n this.#showUINotification();\n } else if (this.active === view) {\n // If the `view` was opened by the user during document load,\n // switch away from it if it turns out to be empty.\n this.switchView(SidebarView.THUMBS);\n }\n };\n\n eventBus._on(\"outlineloaded\", evt => {\n onTreeLoaded(evt.outlineCount, this.outlineButton, SidebarView.OUTLINE);\n\n evt.currentOutlineItemPromise.then(enabled => {\n if (!this.isInitialViewSet) {\n return;\n }\n this._currentOutlineItemButton.disabled = !enabled;\n });\n });\n\n eventBus._on(\"attachmentsloaded\", evt => {\n onTreeLoaded(\n evt.attachmentsCount,\n this.attachmentsButton,\n SidebarView.ATTACHMENTS\n );\n });\n\n eventBus._on(\"layersloaded\", evt => {\n onTreeLoaded(evt.layersCount, this.layersButton, SidebarView.LAYERS);\n });\n\n // Update the thumbnailViewer, if visible, when exiting presentation mode.\n eventBus._on(\"presentationmodechanged\", evt => {\n if (\n evt.state === PresentationModeState.NORMAL &&\n this.visibleView === SidebarView.THUMBS\n ) {\n this.onUpdateThumbnails();\n }\n });\n\n // Handle resizing of the sidebar.\n this.resizer.addEventListener(\"mousedown\", evt => {\n if (evt.button !== 0) {\n return;\n }\n // Disable the `transition-duration` rules when sidebar resizing begins,\n // in order to improve responsiveness and to avoid visual glitches.\n outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);\n\n this.#mouseAC = new AbortController();\n const opts = { signal: this.#mouseAC.signal };\n\n window.addEventListener(\"mousemove\", this.#mouseMove.bind(this), opts);\n window.addEventListener(\"mouseup\", this.#mouseUp.bind(this), opts);\n window.addEventListener(\"blur\", this.#mouseUp.bind(this), opts);\n });\n\n eventBus._on(\"resize\", evt => {\n // When the *entire* viewer is resized, such that it becomes narrower,\n // ensure that the sidebar doesn't end up being too wide.\n if (evt.source !== window) {\n return;\n }\n // Always reset the cached width when the viewer is resized.\n this.#outerContainerWidth = null;\n\n if (!this.#width) {\n // The sidebar hasn't been resized, hence no need to adjust its width.\n return;\n }\n // NOTE: If the sidebar is closed, we don't need to worry about\n // visual glitches nor ensure that rendering is triggered.\n if (!this.isOpen) {\n this.#updateWidth(this.#width);\n return;\n }\n outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);\n const updated = this.#updateWidth(this.#width);\n\n Promise.resolve().then(() => {\n outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);\n // Trigger rendering if the sidebar width changed, to avoid\n // depending on the order in which 'resize' events are handled.\n if (updated) {\n eventBus.dispatch(\"resize\", { source: this });\n }\n });\n });\n }\n\n /**\n * @type {number}\n */\n get outerContainerWidth() {\n return (this.#outerContainerWidth ||= this.outerContainer.clientWidth);\n }\n\n /**\n * returns {boolean} Indicating if the sidebar width was updated.\n */\n #updateWidth(width = 0) {\n // Prevent the sidebar from becoming too narrow, or from occupying more\n // than half of the available viewer width.\n const maxWidth = Math.floor(this.outerContainerWidth / 2);\n if (width > maxWidth) {\n width = maxWidth;\n }\n if (width < SIDEBAR_MIN_WIDTH) {\n width = SIDEBAR_MIN_WIDTH;\n }\n // Only update the UI when the sidebar width did in fact change.\n if (width === this.#width) {\n return false;\n }\n this.#width = width;\n\n docStyle.setProperty(SIDEBAR_WIDTH_VAR, `${width}px`);\n return true;\n }\n\n #mouseMove(evt) {\n let width = evt.clientX;\n // For sidebar resizing to work correctly in RTL mode, invert the width.\n if (this.#isRTL) {\n width = this.outerContainerWidth - width;\n }\n this.#updateWidth(width);\n }\n\n #mouseUp(evt) {\n // Re-enable the `transition-duration` rules when sidebar resizing ends...\n this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);\n // ... and ensure that rendering will always be triggered.\n this.eventBus.dispatch(\"resize\", { source: this });\n\n this.#mouseAC?.abort();\n this.#mouseAC = null;\n }\n}\n\nexport { PDFSidebar };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/optional_content_config\").OptionalContentConfig} OptionalContentConfig */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n/** @typedef {import(\"./interfaces\").IRenderableView} IRenderableView */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n\nimport { OutputScale, RenderingCancelledException } from \"pdfjs-lib\";\nimport { RenderingStates } from \"./ui_utils.js\";\n\nconst DRAW_UPSCALE_FACTOR = 2; // See comment in `PDFThumbnailView.draw` below.\nconst MAX_NUM_SCALING_STEPS = 3;\nconst THUMBNAIL_WIDTH = 98; // px\n\n/**\n * @typedef {Object} PDFThumbnailViewOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} id - The thumbnail's unique ID (normally its number).\n * @property {PageViewport} defaultViewport - The page viewport.\n * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -\n * A promise that is resolved with an {@link OptionalContentConfig} instance.\n * The default value is `null`.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.\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 */\n\nclass TempImageFactory {\n static #tempCanvas = null;\n\n static getCanvas(width, height) {\n const tempCanvas = (this.#tempCanvas ||= document.createElement(\"canvas\"));\n tempCanvas.width = width;\n tempCanvas.height = height;\n\n // Since this is a temporary canvas, we need to fill it with a white\n // background ourselves. `#getPageDrawContext` uses CSS rules for this.\n const ctx = tempCanvas.getContext(\"2d\", { alpha: false });\n ctx.save();\n ctx.fillStyle = \"rgb(255, 255, 255)\";\n ctx.fillRect(0, 0, width, height);\n ctx.restore();\n return [tempCanvas, tempCanvas.getContext(\"2d\")];\n }\n\n static destroyCanvas() {\n const tempCanvas = this.#tempCanvas;\n if (tempCanvas) {\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n tempCanvas.width = 0;\n tempCanvas.height = 0;\n }\n this.#tempCanvas = null;\n }\n}\n\n/**\n * @implements {IRenderableView}\n */\nclass PDFThumbnailView {\n /**\n * @param {PDFThumbnailViewOptions} options\n */\n constructor({\n container,\n eventBus,\n id,\n defaultViewport,\n optionalContentConfigPromise,\n linkService,\n renderingQueue,\n pageColors,\n enableHWA,\n }) {\n this.id = id;\n this.renderingId = \"thumbnail\" + id;\n this.pageLabel = null;\n\n this.pdfPage = null;\n this.rotation = 0;\n this.viewport = defaultViewport;\n this.pdfPageRotate = defaultViewport.rotation;\n this._optionalContentConfigPromise = optionalContentConfigPromise || null;\n this.pageColors = pageColors || null;\n this.enableHWA = enableHWA || false;\n\n this.eventBus = eventBus;\n this.linkService = linkService;\n this.renderingQueue = renderingQueue;\n\n this.renderTask = null;\n this.renderingState = RenderingStates.INITIAL;\n this.resume = null;\n\n const anchor = document.createElement(\"a\");\n anchor.href = linkService.getAnchorUrl(\"#page=\" + id);\n anchor.setAttribute(\"data-l10n-id\", \"pdfjs-thumb-page-title\");\n anchor.setAttribute(\"data-l10n-args\", this.#pageL10nArgs);\n anchor.onclick = function () {\n linkService.goToPage(id);\n return false;\n };\n this.anchor = anchor;\n\n const div = document.createElement(\"div\");\n div.className = \"thumbnail\";\n div.setAttribute(\"data-page-number\", this.id);\n this.div = div;\n this.#updateDims();\n\n const img = document.createElement(\"div\");\n img.className = \"thumbnailImage\";\n this._placeholderImg = img;\n\n div.append(img);\n anchor.append(div);\n container.append(anchor);\n }\n\n #updateDims() {\n const { width, height } = this.viewport;\n const ratio = width / height;\n\n this.canvasWidth = THUMBNAIL_WIDTH;\n this.canvasHeight = (this.canvasWidth / ratio) | 0;\n this.scale = this.canvasWidth / width;\n\n const { style } = this.div;\n style.setProperty(\"--thumbnail-width\", `${this.canvasWidth}px`);\n style.setProperty(\"--thumbnail-height\", `${this.canvasHeight}px`);\n }\n\n setPdfPage(pdfPage) {\n this.pdfPage = pdfPage;\n this.pdfPageRotate = pdfPage.rotate;\n const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = pdfPage.getViewport({ scale: 1, rotation: totalRotation });\n this.reset();\n }\n\n reset() {\n this.cancelRendering();\n this.renderingState = RenderingStates.INITIAL;\n\n this.div.removeAttribute(\"data-loaded\");\n this.image?.replaceWith(this._placeholderImg);\n this.#updateDims();\n\n if (this.image) {\n this.image.removeAttribute(\"src\");\n delete this.image;\n }\n }\n\n update({ rotation = null }) {\n if (typeof rotation === \"number\") {\n this.rotation = rotation; // The rotation may be zero.\n }\n const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = this.viewport.clone({\n scale: 1,\n rotation: totalRotation,\n });\n this.reset();\n }\n\n /**\n * PLEASE NOTE: Most likely you want to use the `this.reset()` method,\n * rather than calling this one directly.\n */\n cancelRendering() {\n if (this.renderTask) {\n this.renderTask.cancel();\n this.renderTask = null;\n }\n this.resume = null;\n }\n\n #getPageDrawContext(upscaleFactor = 1, enableHWA = this.enableHWA) {\n // Keep the no-thumbnail outline visible, i.e. `data-loaded === false`,\n // until rendering/image conversion is complete, to avoid display issues.\n const canvas = document.createElement(\"canvas\");\n const ctx = canvas.getContext(\"2d\", {\n alpha: false,\n willReadFrequently: !enableHWA,\n });\n const outputScale = new OutputScale();\n\n canvas.width = (upscaleFactor * this.canvasWidth * outputScale.sx) | 0;\n canvas.height = (upscaleFactor * this.canvasHeight * outputScale.sy) | 0;\n\n const transform = outputScale.scaled\n ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]\n : null;\n\n return { ctx, canvas, transform };\n }\n\n #convertCanvasToImage(canvas) {\n if (this.renderingState !== RenderingStates.FINISHED) {\n throw new Error(\"#convertCanvasToImage: Rendering has not finished.\");\n }\n const reducedCanvas = this.#reduceImage(canvas);\n\n const image = document.createElement(\"img\");\n image.className = \"thumbnailImage\";\n image.setAttribute(\"data-l10n-id\", \"pdfjs-thumb-page-canvas\");\n image.setAttribute(\"data-l10n-args\", this.#pageL10nArgs);\n image.src = reducedCanvas.toDataURL();\n this.image = image;\n\n this.div.setAttribute(\"data-loaded\", true);\n this._placeholderImg.replaceWith(image);\n\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n reducedCanvas.width = 0;\n reducedCanvas.height = 0;\n }\n\n async #finishRenderTask(renderTask, canvas, error = null) {\n // The renderTask may have been replaced by a new one, so only remove\n // the reference to the renderTask if it matches the one that is\n // triggering this callback.\n if (renderTask === this.renderTask) {\n this.renderTask = null;\n }\n\n if (error instanceof RenderingCancelledException) {\n return;\n }\n this.renderingState = RenderingStates.FINISHED;\n this.#convertCanvasToImage(canvas);\n\n if (error) {\n throw error;\n }\n }\n\n async draw() {\n if (this.renderingState !== RenderingStates.INITIAL) {\n console.error(\"Must be in new state before drawing\");\n return undefined;\n }\n const { pdfPage } = this;\n\n if (!pdfPage) {\n this.renderingState = RenderingStates.FINISHED;\n throw new Error(\"pdfPage is not loaded\");\n }\n\n this.renderingState = RenderingStates.RUNNING;\n\n // Render the thumbnail at a larger size and downsize the canvas (similar\n // to `setImage`), to improve consistency between thumbnails created by\n // the `draw` and `setImage` methods (fixes issue 8233).\n // NOTE: To primarily avoid increasing memory usage too much, but also to\n // reduce downsizing overhead, we purposely limit the up-scaling factor.\n const { ctx, canvas, transform } =\n this.#getPageDrawContext(DRAW_UPSCALE_FACTOR);\n const drawViewport = this.viewport.clone({\n scale: DRAW_UPSCALE_FACTOR * this.scale,\n });\n const renderContinueCallback = cont => {\n if (!this.renderingQueue.isHighestPriority(this)) {\n this.renderingState = RenderingStates.PAUSED;\n this.resume = () => {\n this.renderingState = RenderingStates.RUNNING;\n cont();\n };\n return;\n }\n cont();\n };\n\n const renderContext = {\n canvasContext: ctx,\n transform,\n viewport: drawViewport,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n pageColors: this.pageColors,\n };\n const renderTask = (this.renderTask = pdfPage.render(renderContext));\n renderTask.onContinue = renderContinueCallback;\n\n const resultPromise = renderTask.promise.then(\n () => this.#finishRenderTask(renderTask, canvas),\n error => this.#finishRenderTask(renderTask, canvas, error)\n );\n resultPromise.finally(() => {\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n canvas.width = 0;\n canvas.height = 0;\n\n this.eventBus.dispatch(\"thumbnailrendered\", {\n source: this,\n pageNumber: this.id,\n pdfPage: this.pdfPage,\n });\n });\n\n return resultPromise;\n }\n\n setImage(pageView) {\n if (this.renderingState !== RenderingStates.INITIAL) {\n return;\n }\n const { thumbnailCanvas: canvas, pdfPage, scale } = pageView;\n if (!canvas) {\n return;\n }\n if (!this.pdfPage) {\n this.setPdfPage(pdfPage);\n }\n if (scale < this.scale) {\n // Avoid upscaling the image, since that makes the thumbnail look blurry.\n return;\n }\n this.renderingState = RenderingStates.FINISHED;\n this.#convertCanvasToImage(canvas);\n }\n\n #reduceImage(img) {\n const { ctx, canvas } = this.#getPageDrawContext(1, true);\n\n if (img.width <= 2 * canvas.width) {\n ctx.drawImage(\n img,\n 0,\n 0,\n img.width,\n img.height,\n 0,\n 0,\n canvas.width,\n canvas.height\n );\n return canvas;\n }\n // drawImage does an awful job of rescaling the image, doing it gradually.\n let reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS;\n let reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS;\n const [reducedImage, reducedImageCtx] = TempImageFactory.getCanvas(\n reducedWidth,\n reducedHeight\n );\n\n while (reducedWidth > img.width || reducedHeight > img.height) {\n reducedWidth >>= 1;\n reducedHeight >>= 1;\n }\n reducedImageCtx.drawImage(\n img,\n 0,\n 0,\n img.width,\n img.height,\n 0,\n 0,\n reducedWidth,\n reducedHeight\n );\n while (reducedWidth > 2 * canvas.width) {\n reducedImageCtx.drawImage(\n reducedImage,\n 0,\n 0,\n reducedWidth,\n reducedHeight,\n 0,\n 0,\n reducedWidth >> 1,\n reducedHeight >> 1\n );\n reducedWidth >>= 1;\n reducedHeight >>= 1;\n }\n ctx.drawImage(\n reducedImage,\n 0,\n 0,\n reducedWidth,\n reducedHeight,\n 0,\n 0,\n canvas.width,\n canvas.height\n );\n return canvas;\n }\n\n get #pageL10nArgs() {\n return JSON.stringify({ page: this.pageLabel ?? this.id });\n }\n\n /**\n * @param {string|null} label\n */\n setPageLabel(label) {\n this.pageLabel = typeof label === \"string\" ? label : null;\n\n this.anchor.setAttribute(\"data-l10n-args\", this.#pageL10nArgs);\n\n if (this.renderingState !== RenderingStates.FINISHED) {\n return;\n }\n this.image?.setAttribute(\"data-l10n-args\", this.#pageL10nArgs);\n }\n}\n\nexport { PDFThumbnailView, TempImageFactory };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFDocumentProxy} PDFDocumentProxy */\n/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n\nimport {\n getVisibleElements,\n isValidRotation,\n RenderingStates,\n scrollIntoView,\n watchScroll,\n} from \"./ui_utils.js\";\nimport { PDFThumbnailView, TempImageFactory } from \"./pdf_thumbnail_view.js\";\n\nconst THUMBNAIL_SCROLL_MARGIN = -19;\nconst THUMBNAIL_SELECTED_CLASS = \"selected\";\n\n/**\n * @typedef {Object} PDFThumbnailViewerOptions\n * @property {HTMLDivElement} container - The container for the thumbnail\n * elements.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.\n * @property {Object} [pageColors] - Overwrites background and foreground colors\n * with user defined ones in order to improve readability in high contrast\n * mode.\n * @property {AbortSignal} [abortSignal] - The AbortSignal for the window\n * events.\n * @property {boolean} [enableHWA] - Enables hardware acceleration for\n * rendering. The default value is `false`.\n */\n\n/**\n * Viewer control to display thumbnails for pages in a PDF document.\n */\nclass PDFThumbnailViewer {\n /**\n * @param {PDFThumbnailViewerOptions} options\n */\n constructor({\n container,\n eventBus,\n linkService,\n renderingQueue,\n pageColors,\n abortSignal,\n enableHWA,\n }) {\n this.container = container;\n this.eventBus = eventBus;\n this.linkService = linkService;\n this.renderingQueue = renderingQueue;\n this.pageColors = pageColors || null;\n this.enableHWA = enableHWA || false;\n\n this.scroll = watchScroll(\n this.container,\n this.#scrollUpdated.bind(this),\n abortSignal\n );\n this.#resetView();\n }\n\n #scrollUpdated() {\n this.renderingQueue.renderHighestPriority();\n }\n\n getThumbnail(index) {\n return this._thumbnails[index];\n }\n\n #getVisibleThumbs() {\n return getVisibleElements({\n scrollEl: this.container,\n views: this._thumbnails,\n });\n }\n\n scrollThumbnailIntoView(pageNumber) {\n if (!this.pdfDocument) {\n return;\n }\n const thumbnailView = this._thumbnails[pageNumber - 1];\n\n if (!thumbnailView) {\n console.error('scrollThumbnailIntoView: Invalid \"pageNumber\" parameter.');\n return;\n }\n\n if (pageNumber !== this._currentPageNumber) {\n const prevThumbnailView = this._thumbnails[this._currentPageNumber - 1];\n // Remove the highlight from the previous thumbnail...\n prevThumbnailView.div.classList.remove(THUMBNAIL_SELECTED_CLASS);\n // ... and add the highlight to the new thumbnail.\n thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);\n }\n const { first, last, views } = this.#getVisibleThumbs();\n\n // If the thumbnail isn't currently visible, scroll it into view.\n if (views.length > 0) {\n let shouldScroll = false;\n if (pageNumber <= first.id || pageNumber >= last.id) {\n shouldScroll = true;\n } else {\n for (const { id, percent } of views) {\n if (id !== pageNumber) {\n continue;\n }\n shouldScroll = percent < 100;\n break;\n }\n }\n if (shouldScroll) {\n scrollIntoView(thumbnailView.div, { top: THUMBNAIL_SCROLL_MARGIN });\n }\n }\n\n this._currentPageNumber = pageNumber;\n }\n\n get pagesRotation() {\n return this._pagesRotation;\n }\n\n set pagesRotation(rotation) {\n if (!isValidRotation(rotation)) {\n throw new Error(\"Invalid thumbnails rotation angle.\");\n }\n if (!this.pdfDocument) {\n return;\n }\n if (this._pagesRotation === rotation) {\n return; // The rotation didn't change.\n }\n this._pagesRotation = rotation;\n\n const updateArgs = { rotation };\n for (const thumbnail of this._thumbnails) {\n thumbnail.update(updateArgs);\n }\n }\n\n cleanup() {\n for (const thumbnail of this._thumbnails) {\n if (thumbnail.renderingState !== RenderingStates.FINISHED) {\n thumbnail.reset();\n }\n }\n TempImageFactory.destroyCanvas();\n }\n\n #resetView() {\n this._thumbnails = [];\n this._currentPageNumber = 1;\n this._pageLabels = null;\n this._pagesRotation = 0;\n\n // Remove the thumbnails from the DOM.\n this.container.textContent = \"\";\n }\n\n /**\n * @param {PDFDocumentProxy} pdfDocument\n */\n setDocument(pdfDocument) {\n if (this.pdfDocument) {\n this.#cancelRendering();\n this.#resetView();\n }\n\n this.pdfDocument = pdfDocument;\n if (!pdfDocument) {\n return;\n }\n const firstPagePromise = pdfDocument.getPage(1);\n const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({\n intent: \"display\",\n });\n\n firstPagePromise\n .then(firstPdfPage => {\n const pagesCount = pdfDocument.numPages;\n const viewport = firstPdfPage.getViewport({ scale: 1 });\n\n for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n const thumbnail = new PDFThumbnailView({\n container: this.container,\n eventBus: this.eventBus,\n id: pageNum,\n defaultViewport: viewport.clone(),\n optionalContentConfigPromise,\n linkService: this.linkService,\n renderingQueue: this.renderingQueue,\n pageColors: this.pageColors,\n enableHWA: this.enableHWA,\n });\n this._thumbnails.push(thumbnail);\n }\n // Set the first `pdfPage` immediately, since it's already loaded,\n // rather than having to repeat the `PDFDocumentProxy.getPage` call in\n // the `this.#ensurePdfPageLoaded` method before rendering can start.\n this._thumbnails[0]?.setPdfPage(firstPdfPage);\n\n // Ensure that the current thumbnail is always highlighted on load.\n const thumbnailView = this._thumbnails[this._currentPageNumber - 1];\n thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);\n })\n .catch(reason => {\n console.error(\"Unable to initialize thumbnail viewer\", reason);\n });\n }\n\n #cancelRendering() {\n for (const thumbnail of this._thumbnails) {\n thumbnail.cancelRendering();\n }\n }\n\n /**\n * @param {Array|null} labels\n */\n setPageLabels(labels) {\n if (!this.pdfDocument) {\n return;\n }\n if (!labels) {\n this._pageLabels = null;\n } else if (\n !(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)\n ) {\n this._pageLabels = null;\n console.error(\"PDFThumbnailViewer_setPageLabels: Invalid page labels.\");\n } else {\n this._pageLabels = labels;\n }\n // Update all the `PDFThumbnailView` instances.\n for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {\n this._thumbnails[i].setPageLabel(this._pageLabels?.[i] ?? null);\n }\n }\n\n /**\n * @param {PDFThumbnailView} thumbView\n * @returns {Promise<PDFPageProxy | null>}\n */\n async #ensurePdfPageLoaded(thumbView) {\n if (thumbView.pdfPage) {\n return thumbView.pdfPage;\n }\n try {\n const pdfPage = await this.pdfDocument.getPage(thumbView.id);\n if (!thumbView.pdfPage) {\n thumbView.setPdfPage(pdfPage);\n }\n return pdfPage;\n } catch (reason) {\n console.error(\"Unable to get page for thumb view\", reason);\n return null; // Page error -- there is nothing that can be done.\n }\n }\n\n #getScrollAhead(visible) {\n if (visible.first?.id === 1) {\n return true;\n } else if (visible.last?.id === this._thumbnails.length) {\n return false;\n }\n return this.scroll.down;\n }\n\n forceRendering() {\n const visibleThumbs = this.#getVisibleThumbs();\n const scrollAhead = this.#getScrollAhead(visibleThumbs);\n const thumbView = this.renderingQueue.getHighestPriority(\n visibleThumbs,\n this._thumbnails,\n scrollAhead\n );\n if (thumbView) {\n this.#ensurePdfPageLoaded(thumbView).then(() => {\n this.renderingQueue.renderView(thumbView);\n });\n return true;\n }\n return false;\n }\n}\n\nexport { PDFThumbnailViewer };\n","/* Copyright 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\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 {PageViewport} viewport\n * @param {string} intent (default value is 'display')\n */\n async render(viewport, intent = \"display\") {\n if (intent !== \"display\") {\n return;\n }\n\n if (this._cancelled) {\n return;\n }\n\n const clonedViewport = viewport.clone({ dontFlip: true });\n if (this.div) {\n this.annotationEditorLayer.update({ viewport: clonedViewport });\n this.show();\n return;\n }\n\n // Create an AnnotationEditor layer div\n const div = (this.div = document.createElement(\"div\"));\n div.className = \"annotationEditorLayer\";\n div.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.div.hidden = true;\n }\n\n show() {\n if (!this.div || this.annotationEditorLayer.isInvisible) {\n return;\n }\n this.div.hidden = false;\n }\n}\n\nexport { AnnotationEditorLayerBuilder };\n","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n// 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(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/editor/tools.js\").AnnotationEditorUIManager} AnnotationEditorUIManager */\n\nimport { AnnotationLayer } 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} [enableScripting]\n * @property {Promise<boolean>} [hasJSActionsPromise]\n * @property {Promise<Object<string, Array<Object>> | null>}\n * [fieldObjectsPromise]\n * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]\n * @property {TextAccessibilityManager} [accessibilityManager]\n * @property {AnnotationEditorUIManager} [annotationEditorUIManager]\n * @property {function} [onAppend]\n */\n\nclass AnnotationLayerBuilder {\n #onAppend = null;\n\n #eventAbortController = null;\n\n /**\n * @param {AnnotationLayerBuilderOptions} options\n */\n constructor({\n pdfPage,\n linkService,\n downloadManager,\n annotationStorage = null,\n imageResourcesPath = \"\",\n renderForms = true,\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.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 {PageViewport} viewport\n * @param {Object} options\n * @param {string} intent (default value is 'display')\n * @returns {Promise<void>} A promise that is resolved when rendering of the\n * annotations is complete.\n */\n async render(viewport, options, intent = \"display\") {\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.hide();\n return;\n }\n\n this.annotationLayer = new AnnotationLayer({\n 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: options?.structTreeLayer || null,\n });\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 enableScripting: this.enableScripting,\n hasJSActions,\n fieldObjects,\n });\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 cancel() {\n this._cancelled = true;\n\n this.#eventAbortController?.abort();\n this.#eventAbortController = null;\n }\n\n hide() {\n if (!this.div) {\n return;\n }\n this.div.hidden = true;\n }\n\n hasEditableAnnotations() {\n return !!this.annotationLayer?.hasEditableAnnotations();\n }\n\n #updatePresentationModeState(state) {\n if (!this.div) {\n return;\n }\n let disableFormElements = false;\n\n switch (state) {\n case PresentationModeState.FULLSCREEN:\n disableFormElements = true;\n break;\n case PresentationModeState.NORMAL:\n break;\n default:\n return;\n }\n for (const section of this.div.childNodes) {\n if (section.hasAttribute(\"data-internal-link\")) {\n continue;\n }\n section.inert = disableFormElements;\n }\n }\n}\n\nexport { AnnotationLayerBuilder };\n","/* Copyright 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\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 {string} intent (default value is 'display')\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 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 { removeNullCharacters } from \"./ui_utils.js\";\n\nconst PDF_ROLE_TO_HTML_ROLE = {\n // Document level structure types\n Document: null, // There's a \"document\" role, but it doesn't make sense here.\n DocumentFragment: null,\n // Grouping level structure types\n Part: \"group\",\n Sect: \"group\", // XXX: There's a \"section\" role, but it's abstract.\n Div: \"group\",\n Aside: \"note\",\n NonStruct: \"none\",\n // Block level structure types\n P: null,\n // H<n>,\n H: \"heading\",\n Title: null,\n FENote: \"note\",\n // Sub-block level structure type\n Sub: \"group\",\n // General inline level structure types\n Lbl: null,\n Span: null,\n Em: null,\n Strong: null,\n Link: \"link\",\n Annot: \"note\",\n Form: \"form\",\n // Ruby and Warichu structure types\n Ruby: null,\n RB: null,\n RT: null,\n RP: null,\n Warichu: null,\n WT: null,\n WP: null,\n // List standard structure types\n L: \"list\",\n LI: \"listitem\",\n LBody: null,\n // Table standard structure types\n Table: \"table\",\n TR: \"row\",\n TH: \"columnheader\",\n TD: \"cell\",\n THead: \"columnheader\",\n TBody: null,\n TFoot: null,\n // Standard structure type Caption\n Caption: null,\n // Standard structure type Figure\n Figure: \"figure\",\n // Standard structure type Formula\n Formula: null,\n // standard structure type Artifact\n Artifact: null,\n};\n\nconst HEADING_PATTERN = /^H(\\d+)$/;\n\nclass StructTreeLayerBuilder {\n #promise;\n\n #treeDom = null;\n\n #treePromise;\n\n #elementAttributes = new Map();\n\n #rawDims;\n\n #elementsToAddToTextLayer = null;\n\n constructor(pdfPage, rawDims) {\n this.#promise = pdfPage.getStructTree();\n this.#rawDims = rawDims;\n }\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 await this.render();\n return this.#elementAttributes.get(annotationId);\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(--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] = \"<span>Item 0</span>\" and texts[0] = \"Item 0\";\n *\n * @param {Array<Node>} divs\n * @param {Array<string>} texts\n */\n setTextMapping(divs, texts) {\n this.textDivs = divs;\n this.textContentItemsStr = texts;\n }\n\n /**\n * Start listening for events to update the highlighter and check if there are\n * any current matches that need be highlighted.\n */\n enable() {\n if (!this.textDivs || !this.textContentItemsStr) {\n throw new Error(\"Text divs and strings have not been set.\");\n }\n if (this.enabled) {\n throw new Error(\"TextHighlighter is already enabled.\");\n }\n this.enabled = true;\n\n if (!this.#eventAbortController) {\n this.#eventAbortController = new AbortController();\n\n this.eventBus._on(\n \"updatetextlayermatches\",\n evt => {\n if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) {\n this._updateMatches();\n }\n },\n { signal: this.#eventAbortController.signal }\n );\n }\n this._updateMatches();\n }\n\n disable() {\n if (!this.enabled) {\n return;\n }\n this.enabled = false;\n\n this.#eventAbortController?.abort();\n this.#eventAbortController = null;\n\n this._updateMatches(/* reset = */ true);\n }\n\n _convertMatches(matches, matchesLength) {\n // Early exit if there is nothing to convert.\n if (!matches) {\n return [];\n }\n const { textContentItemsStr } = this;\n\n let i = 0,\n iIndex = 0;\n const end = textContentItemsStr.length - 1;\n const result = [];\n\n for (let m = 0, mm = matches.length; m < mm; m++) {\n // Calculate the start position.\n let matchIdx = matches[m];\n\n // Loop over the divIdxs.\n while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) {\n iIndex += textContentItemsStr[i].length;\n i++;\n }\n\n if (i === textContentItemsStr.length) {\n console.error(\"Could not find a matching mapping\");\n }\n\n const match = {\n begin: {\n divIdx: i,\n offset: matchIdx - iIndex,\n },\n };\n\n // Calculate the end position.\n matchIdx += matchesLength[m];\n\n // Somewhat the same array as above, but use > instead of >= to get\n // the end position right.\n while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) {\n iIndex += textContentItemsStr[i].length;\n i++;\n }\n\n match.end = {\n divIdx: i,\n offset: matchIdx - iIndex,\n };\n result.push(match);\n }\n return result;\n }\n\n _renderMatches(matches) {\n // Early exit if there is nothing to render.\n if (matches.length === 0) {\n return;\n }\n const { findController, pageIdx } = this;\n const { textContentItemsStr, textDivs } = this;\n\n const isSelectedPage = pageIdx === findController.selected.pageIdx;\n const selectedMatchIdx = findController.selected.matchIdx;\n const highlightAll = findController.state.highlightAll;\n let prevEnd = null;\n const infinity = {\n divIdx: -1,\n offset: undefined,\n };\n\n function beginText(begin, className) {\n const divIdx = begin.divIdx;\n textDivs[divIdx].textContent = \"\";\n return appendTextToDiv(divIdx, 0, begin.offset, className);\n }\n\n function appendTextToDiv(divIdx, fromOffset, toOffset, className) {\n let div = textDivs[divIdx];\n if (div.nodeType === Node.TEXT_NODE) {\n const span = document.createElement(\"span\");\n div.before(span);\n span.append(div);\n textDivs[divIdx] = span;\n div = span;\n }\n const content = textContentItemsStr[divIdx].substring(\n fromOffset,\n toOffset\n );\n const node = document.createTextNode(content);\n if (className) {\n const span = document.createElement(\"span\");\n span.className = `${className} appended`;\n span.append(node);\n div.append(span);\n return className.includes(\"selected\") ? span.offsetLeft : 0;\n }\n div.append(node);\n return 0;\n }\n\n let i0 = selectedMatchIdx,\n i1 = i0 + 1;\n if (highlightAll) {\n i0 = 0;\n i1 = matches.length;\n } else if (!isSelectedPage) {\n // Not highlighting all and this isn't the selected page, so do nothing.\n return;\n }\n\n 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, 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 {function} [onAppend]\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 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 {PageViewport} viewport\n * @param {Object} [textContentParams]\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 event.preventDefault();\n event.stopPropagation();\n });\n\n TextLayerBuilder.#textLayers.set(div, end);\n TextLayerBuilder.#enableGlobalSelectionListener();\n }\n\n static #removeGlobalSelectionListener(textLayerDiv) {\n this.#textLayers.delete(textLayerDiv);\n\n if (this.#textLayers.size === 0) {\n this.#selectionChangeAbortController?.abort();\n this.#selectionChangeAbortController = null;\n }\n }\n\n static #enableGlobalSelectionListener() {\n if (this.#selectionChangeAbortController) {\n // document-level event listeners already installed\n return;\n }\n this.#selectionChangeAbortController = new AbortController();\n const { signal } = this.#selectionChangeAbortController;\n\n const reset = (end, textLayer) => {\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n textLayer.append(end);\n end.style.width = \"\";\n end.style.height = \"\";\n }\n textLayer.classList.remove(\"selecting\");\n };\n\n let isPointerDown = false;\n document.addEventListener(\n \"pointerdown\",\n () => {\n isPointerDown = true;\n },\n { signal }\n );\n document.addEventListener(\n \"pointerup\",\n () => {\n isPointerDown = false;\n this.#textLayers.forEach(reset);\n },\n { signal }\n );\n window.addEventListener(\n \"blur\",\n () => {\n isPointerDown = false;\n this.#textLayers.forEach(reset);\n },\n { signal }\n );\n document.addEventListener(\n \"keyup\",\n () => {\n if (!isPointerDown) {\n this.#textLayers.forEach(reset);\n }\n },\n { signal }\n );\n\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n // eslint-disable-next-line no-var\n var isFirefox, prevRange;\n }\n\n document.addEventListener(\n \"selectionchange\",\n () => {\n const selection = document.getSelection();\n if (selection.rangeCount === 0) {\n this.#textLayers.forEach(reset);\n return;\n }\n\n // Even though the spec says that .rangeCount should be 0 or 1, Firefox\n // creates multiple ranges when selecting across multiple pages.\n // Make sure to collect all the .textLayer elements where the selection\n // is happening.\n const activeTextLayers = new Set();\n for (let i = 0; i < selection.rangeCount; i++) {\n const range = selection.getRangeAt(i);\n for (const textLayerDiv of this.#textLayers.keys()) {\n if (\n !activeTextLayers.has(textLayerDiv) &&\n range.intersectsNode(textLayerDiv)\n ) {\n activeTextLayers.add(textLayerDiv);\n }\n }\n }\n\n for (const [textLayerDiv, endDiv] of this.#textLayers) {\n if (activeTextLayers.has(textLayerDiv)) {\n textLayerDiv.classList.add(\"selecting\");\n } else {\n reset(endDiv, textLayerDiv);\n }\n }\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n return;\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"CHROME\")) {\n isFirefox ??=\n getComputedStyle(\n this.#textLayers.values().next().value\n ).getPropertyValue(\"-moz-user-select\") === \"none\";\n\n if (isFirefox) {\n return;\n }\n }\n // In non-Firefox browsers, when hovering over an empty space (thus,\n // on .endOfContent), the selection will expand to cover all the\n // text between the current selection and .endOfContent. By moving\n // .endOfContent to right after (or before, depending on which side\n // of the selection the user is moving), we limit the selection jump\n // to at most cover the enteirety of the <span> where the selection\n // is being modified.\n const range = selection.getRangeAt(0);\n const modifyStart =\n prevRange &&\n (range.compareBoundaryPoints(Range.END_TO_END, prevRange) === 0 ||\n range.compareBoundaryPoints(Range.START_TO_END, prevRange) === 0);\n let anchor = modifyStart ? range.startContainer : range.endContainer;\n if (anchor.nodeType === Node.TEXT_NODE) {\n anchor = anchor.parentNode;\n }\n\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 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 RenderingCancelledException,\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 { DrawLayerBuilder } from \"./draw_layer_builder.js\";\nimport { GenericL10n } from \"web-null_l10n\";\nimport { SimpleLinkService } from \"./pdf_link_service.js\";\nimport { StructTreeLayerBuilder } from \"./struct_tree_layer_builder.js\";\nimport { TextAccessibilityManager } from \"./text_accessibility.js\";\nimport { TextHighlighter } from \"./text_highlighter.js\";\nimport { TextLayerBuilder } from \"./text_layer_builder.js\";\nimport { XfaLayerBuilder } from \"./xfa_layer_builder.js\";\n\n/**\n * @typedef {Object} PDFPageViewOptions\n * @property {HTMLDivElement} [container] - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} id - The page unique ID (normally its number).\n * @property {number} [scale] - The page scale display.\n * @property {PageViewport} defaultViewport - The page viewport.\n * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -\n * A promise that is resolved with an {@link OptionalContentConfig} instance.\n * The default value is `null`.\n * @property {PDFRenderingQueue} [renderingQueue] - The rendering queue object.\n * @property {number} [textLayerMode] - Controls if the text layer used for\n * selection and searching is created. The constants from {TextLayerMode}\n * should be used. The default value is `TextLayerMode.ENABLE`.\n * @property {number} [annotationMode] - Controls if the annotation layer is\n * created, and if interactive form elements or `AnnotationStorage`-data are\n * being rendered. The constants from {@link AnnotationMode} should be used;\n * see also {@link RenderParameters} and {@link GetOperatorListParameters}.\n * The default value is `AnnotationMode.ENABLE_FORMS`.\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n * for annotation icons. Include trailing slash.\n * @property {number} [maxCanvasPixels] - The maximum supported canvas size in\n * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for\n * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).\n * @property {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} [enableHWA] - Enables hardware acceleration for\n * rendering. The default value is `false`.\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 {\n #annotationMode = AnnotationMode.ENABLE_FORMS;\n\n #enableHWA = false;\n\n #hasRestrictedScaling = false;\n\n #isEditing = false;\n\n #layerProperties = null;\n\n #loadingId = null;\n\n #previousRotation = null;\n\n #scaleRoundX = 1;\n\n #scaleRoundY = 1;\n\n #renderError = null;\n\n #renderingState = RenderingStates.INITIAL;\n\n #textLayerMode = TextLayerMode.ENABLE;\n\n #useThumbnailCanvas = {\n directDrawing: true,\n initialOptionalContent: true,\n regularAnnotations: true,\n };\n\n #viewportMap = new WeakMap();\n\n #layers = [null, null, null, null];\n\n /**\n * @param {PDFPageViewOptions} options\n */\n constructor(options) {\n const container = options.container;\n const defaultViewport = options.defaultViewport;\n\n this.id = options.id;\n this.renderingId = \"page\" + this.id;\n this.#layerProperties = options.layerProperties || DEFAULT_LAYER_PROPERTIES;\n\n this.pdfPage = null;\n this.pageLabel = null;\n this.rotation = 0;\n this.scale = options.scale || DEFAULT_SCALE;\n this.viewport = defaultViewport;\n this.pdfPageRotate = defaultViewport.rotation;\n this._optionalContentConfigPromise =\n options.optionalContentConfigPromise || null;\n this.#textLayerMode = options.textLayerMode ?? TextLayerMode.ENABLE;\n this.#annotationMode =\n options.annotationMode ?? AnnotationMode.ENABLE_FORMS;\n this.imageResourcesPath = options.imageResourcesPath || \"\";\n this.maxCanvasPixels =\n options.maxCanvasPixels ?? AppOptions.get(\"maxCanvasPixels\");\n this.pageColors = options.pageColors || null;\n this.#enableHWA = options.enableHWA || false;\n\n this.eventBus = options.eventBus;\n this.renderingQueue = options.renderingQueue;\n this.l10n = options.l10n;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this.l10n ||= new GenericL10n();\n }\n\n this.renderTask = null;\n this.resume = null;\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.zoomLayer = null;\n this.xfaLayer = null;\n this.structTreeLayer = null;\n this.drawLayer = 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 get renderingState() {\n return this.#renderingState;\n }\n\n set renderingState(state) {\n if (state === this.#renderingState) {\n return;\n }\n this.#renderingState = state;\n\n if (this.#loadingId) {\n clearTimeout(this.#loadingId);\n this.#loadingId = null;\n }\n\n switch (state) {\n case RenderingStates.PAUSED:\n this.div.classList.remove(\"loading\");\n break;\n case RenderingStates.RUNNING:\n this.div.classList.add(\"loadingIcon\");\n this.#loadingId = setTimeout(() => {\n // Adding the loading class is slightly postponed in order to not have\n // it with loadingIcon.\n // If we don't do that the visibility of the background is changed but\n // the transition isn't triggered.\n this.div.classList.add(\"loading\");\n this.#loadingId = null;\n }, 0);\n break;\n case RenderingStates.INITIAL:\n case RenderingStates.FINISHED:\n this.div.classList.remove(\"loadingIcon\", \"loading\");\n break;\n }\n }\n\n #setDimensions() {\n const { viewport } = this;\n if (this.pdfPage) {\n if (this.#previousRotation === viewport.rotation) {\n return;\n }\n this.#previousRotation = viewport.rotation;\n }\n\n setLayerDimensions(\n this.div,\n viewport,\n /* mustFlip = */ true,\n /* mustRotate = */ false\n );\n }\n\n setPdfPage(pdfPage) {\n 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 this.viewport,\n { structTreeLayer: this.structTreeLayer },\n \"display\"\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(this.viewport, \"display\");\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(\"display\");\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(this.viewport, \"display\");\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\n let error = null;\n try {\n await this.textLayer.render(this.viewport);\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 /**\n * @private\n */\n _resetZoomLayer(removeFromDOM = false) {\n if (!this.zoomLayer) {\n return;\n }\n const zoomLayerCanvas = this.zoomLayer.firstChild;\n this.#viewportMap.delete(zoomLayerCanvas);\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n zoomLayerCanvas.width = 0;\n zoomLayerCanvas.height = 0;\n\n if (removeFromDOM) {\n // Note: `ChildNode.remove` doesn't throw if the parent node is undefined.\n this.zoomLayer.remove();\n }\n this.zoomLayer = null;\n }\n\n reset({\n keepZoomLayer = false,\n keepAnnotationLayer = false,\n keepAnnotationEditorLayer = false,\n keepXfaLayer = false,\n keepTextLayer = false,\n } = {}) {\n this.cancelRendering({\n keepAnnotationLayer,\n keepAnnotationEditorLayer,\n keepXfaLayer,\n keepTextLayer,\n });\n this.renderingState = RenderingStates.INITIAL;\n\n const div = this.div;\n\n const childNodes = div.childNodes,\n zoomLayerNode = (keepZoomLayer && this.zoomLayer) || null,\n annotationLayerNode =\n (keepAnnotationLayer && this.annotationLayer?.div) || null,\n annotationEditorLayerNode =\n (keepAnnotationEditorLayer && this.annotationEditorLayer?.div) || null,\n xfaLayerNode = (keepXfaLayer && this.xfaLayer?.div) || null,\n textLayerNode = (keepTextLayer && this.textLayer?.div) || null;\n for (let i = childNodes.length - 1; i >= 0; i--) {\n const node = childNodes[i];\n switch (node) {\n case zoomLayerNode:\n case annotationLayerNode:\n case annotationEditorLayerNode:\n case xfaLayerNode:\n case textLayerNode:\n continue;\n }\n node.remove();\n 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 (!zoomLayerNode) {\n if (this.canvas) {\n this.#viewportMap.delete(this.canvas);\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n this.canvas.width = 0;\n this.canvas.height = 0;\n delete this.canvas;\n }\n this._resetZoomLayer();\n }\n }\n\n toggleEditingMode(isEditing) {\n if (!this.hasEditableAnnotations()) {\n return;\n }\n this.#isEditing = isEditing;\n this.reset({\n keepZoomLayer: true,\n keepAnnotationLayer: true,\n keepAnnotationEditorLayer: true,\n keepXfaLayer: true,\n keepTextLayer: true,\n });\n }\n\n /**\n * @typedef {Object} PDFPageViewUpdateParameters\n * @property {number} [scale] The new scale, if specified.\n * @property {number} [rotation] The new rotation, if specified.\n * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise]\n * A promise that is resolved with an {@link OptionalContentConfig}\n * instance. The default value is `null`.\n * @property {number} [drawingDelay]\n */\n\n /**\n * Update e.g. the scale and/or rotation of the page.\n * @param {PDFPageViewUpdateParameters} params\n */\n update({\n scale = 0,\n rotation = null,\n optionalContentConfigPromise = null,\n drawingDelay = -1,\n }) {\n this.scale = scale || this.scale;\n if (typeof rotation === \"number\") {\n this.rotation = rotation; // The rotation may be zero.\n }\n if (optionalContentConfigPromise instanceof Promise) {\n this._optionalContentConfigPromise = optionalContentConfigPromise;\n\n // Ensure that the thumbnails always display the *initial* document state,\n // for documents with optional content.\n optionalContentConfigPromise.then(optionalContentConfig => {\n if (\n optionalContentConfigPromise !== this._optionalContentConfigPromise\n ) {\n return;\n }\n this.#useThumbnailCanvas.initialOptionalContent =\n optionalContentConfig.hasInitialVisibility;\n });\n }\n this.#useThumbnailCanvas.directDrawing = true;\n\n const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = this.viewport.clone({\n scale: this.scale * PixelsPerInch.PDF_TO_CSS_UNITS,\n rotation: totalRotation,\n });\n this.#setDimensions();\n\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this._isStandalone\n ) {\n this._container?.style.setProperty(\"--scale-factor\", this.viewport.scale);\n }\n\n if (this.canvas) {\n let onlyCssZoom = false;\n if (this.#hasRestrictedScaling) {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this.maxCanvasPixels === 0\n ) {\n onlyCssZoom = true;\n } else if (this.maxCanvasPixels > 0) {\n const { width, height } = this.viewport;\n const { sx, sy } = this.outputScale;\n onlyCssZoom =\n ((Math.floor(width) * sx) | 0) * ((Math.floor(height) * sy) | 0) >\n this.maxCanvasPixels;\n }\n }\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 keepZoomLayer: true,\n keepAnnotationLayer: true,\n keepAnnotationEditorLayer: true,\n keepXfaLayer: true,\n keepTextLayer: true,\n cancelExtraDelay: drawingDelay,\n });\n // It isn't really finished, but once we have finished\n // to postpone, we'll call this.reset(...) which will set\n // the rendering state to INITIAL, hence the next call to\n // PDFViewer.update() will trigger a redraw (if it's mandatory).\n this.renderingState = RenderingStates.FINISHED;\n // 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 target: this.canvas,\n redrawAnnotationLayer: true,\n redrawAnnotationEditorLayer: true,\n redrawXfaLayer: true,\n redrawTextLayer: !postponeDrawing,\n hideTextLayer: postponeDrawing,\n });\n\n if (postponeDrawing) {\n // The \"pagerendered\"-event will be dispatched once the actual\n // rendering is done, hence don't dispatch it here as well.\n return;\n }\n this.eventBus.dispatch(\"pagerendered\", {\n source: this,\n pageNumber: this.id,\n cssTransform: true,\n timestamp: performance.now(),\n error: this.#renderError,\n });\n return;\n }\n if (!this.zoomLayer && !this.canvas.hidden) {\n this.zoomLayer = this.canvas.parentNode;\n this.zoomLayer.style.position = \"absolute\";\n }\n }\n if (this.zoomLayer) {\n this.cssTransform({ target: this.zoomLayer.firstChild });\n }\n this.reset({\n keepZoomLayer: true,\n keepAnnotationLayer: true,\n keepAnnotationEditorLayer: true,\n keepXfaLayer: true,\n keepTextLayer: true,\n });\n }\n\n /**\n * PLEASE NOTE: Most likely you want to use the `this.reset()` method,\n * rather than calling this one directly.\n */\n cancelRendering({\n keepAnnotationLayer = false,\n keepAnnotationEditorLayer = false,\n keepXfaLayer = false,\n keepTextLayer = false,\n cancelExtraDelay = 0,\n } = {}) {\n if (this.renderTask) {\n this.renderTask.cancel(cancelExtraDelay);\n this.renderTask = null;\n }\n this.resume = null;\n\n if (this.textLayer && (!keepTextLayer || !this.textLayer.div)) {\n this.textLayer.cancel();\n this.textLayer = null;\n }\n if (\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 target,\n redrawAnnotationLayer = false,\n redrawAnnotationEditorLayer = false,\n redrawXfaLayer = false,\n redrawTextLayer = false,\n hideTextLayer = false,\n }) {\n // Scale target (canvas), its wrapper and page container.\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n !(target instanceof HTMLCanvasElement)\n ) {\n throw new Error(\"Expected `target` to be a canvas.\");\n }\n if (!target.hasAttribute(\"zooming\")) {\n target.setAttribute(\"zooming\", true);\n const { style } = target;\n style.width = style.height = \"\";\n }\n\n const originalViewport = this.#viewportMap.get(target);\n if (this.viewport !== originalViewport) {\n // The canvas may have been originally rotated; rotate relative to that.\n const relativeRotation =\n this.viewport.rotation - originalViewport.rotation;\n const absRotation = Math.abs(relativeRotation);\n let scaleX = 1,\n scaleY = 1;\n if (absRotation === 90 || absRotation === 270) {\n const { width, height } = this.viewport;\n // Scale x and y because of the rotation.\n scaleX = height / width;\n scaleY = width / height;\n }\n target.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX}, ${scaleY})`;\n }\n\n if (redrawAnnotationLayer && this.annotationLayer) {\n this.#renderAnnotationLayer();\n }\n if (redrawAnnotationEditorLayer && this.annotationEditorLayer) {\n 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 async #finishRenderTask(renderTask, error = null) {\n // The renderTask may have been replaced by a new one, so only remove\n // the reference to the renderTask if it matches the one that is\n // triggering this callback.\n if (renderTask === this.renderTask) {\n this.renderTask = null;\n }\n\n if (error instanceof RenderingCancelledException) {\n this.#renderError = null;\n return;\n }\n this.#renderError = error;\n\n this.renderingState = RenderingStates.FINISHED;\n this._resetZoomLayer(/* removeFromDOM = */ true);\n\n // Ensure that the thumbnails won't become partially (or fully) blank,\n // for documents that contain interactive form elements.\n this.#useThumbnailCanvas.regularAnnotations = !renderTask.separateAnnots;\n\n this.eventBus.dispatch(\"pagerendered\", {\n source: this,\n pageNumber: this.id,\n cssTransform: false,\n timestamp: performance.now(),\n error: this.#renderError,\n });\n\n if (error) {\n throw error;\n }\n }\n\n 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, pageColors, 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 // Wrap the canvas so that if it has a CSS transform for high DPI the\n // overflow will be hidden in Firefox.\n const canvasWrapper = document.createElement(\"div\");\n canvasWrapper.classList.add(\"canvasWrapper\");\n this.#addLayer(canvasWrapper, \"canvasWrapper\");\n\n if (\n !this.textLayer &&\n this.#textLayerMode !== TextLayerMode.DISABLE &&\n !pdfPage.isPureXfa\n ) {\n this._accessibilityManager ||= new TextAccessibilityManager();\n\n this.textLayer = new TextLayerBuilder({\n 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 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 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 renderContinueCallback = cont => {\n 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 const { width, height } = viewport;\n const canvas = document.createElement(\"canvas\");\n canvas.setAttribute(\"role\", \"presentation\");\n\n // Keep the canvas hidden until the first draw callback, or until drawing\n // is complete when `!this.renderingQueue`, to prevent black flickering.\n canvas.hidden = true;\n const hasHCM = !!(pageColors?.background && pageColors?.foreground);\n\n let showCanvas = isLastShow => {\n // In HCM, a final filter is applied on the canvas which means that\n // before it's applied we've normal colors. Consequently, to avoid to have\n // a final flash we just display it once all the drawing is done.\n if (!hasHCM || isLastShow) {\n canvas.hidden = false;\n showCanvas = null; // Only invoke the function once.\n }\n };\n canvasWrapper.append(canvas);\n this.canvas = canvas;\n\n const ctx = canvas.getContext(\"2d\", {\n alpha: false,\n willReadFrequently: !this.#enableHWA,\n });\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.#hasRestrictedScaling = true;\n } else if (this.maxCanvasPixels > 0) {\n const pixelsInViewport = width * height;\n const maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport);\n if (outputScale.sx > maxScale || outputScale.sy > maxScale) {\n outputScale.sx = maxScale;\n outputScale.sy = maxScale;\n this.#hasRestrictedScaling = true;\n } else {\n this.#hasRestrictedScaling = false;\n }\n }\n 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 // Add the viewport so it's known what it was originally drawn with.\n this.#viewportMap.set(canvas, viewport);\n\n // Rendering area\n const transform = outputScale.scaled\n ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]\n : null;\n const renderContext = {\n canvasContext: ctx,\n transform,\n viewport,\n annotationMode: this.#annotationMode,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n annotationCanvasMap: this._annotationCanvasMap,\n pageColors,\n isEditing: this.#isEditing,\n };\n const renderTask = (this.renderTask = pdfPage.render(renderContext));\n renderTask.onContinue = renderContinueCallback;\n\n const resultPromise = renderTask.promise.then(\n async () => {\n showCanvas?.(true);\n await this.#finishRenderTask(renderTask);\n\n this.structTreeLayer ||= new StructTreeLayerBuilder(\n pdfPage,\n viewport.rawDims\n );\n\n this.#renderTextLayer();\n\n if (this.annotationLayer) {\n await this.#renderAnnotationLayer();\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 error => {\n // When zooming with a `drawingDelay` set, avoid temporarily showing\n // a black canvas if rendering was cancelled before the `onContinue`-\n // callback had been invoked at least once.\n if (!(error instanceof RenderingCancelledException)) {\n showCanvas?.(true);\n }\n return this.#finishRenderTask(renderTask, error);\n }\n );\n\n if (pdfPage.isPureXfa) {\n if (!this.xfaLayer) {\n const { annotationStorage, linkService } = this.#layerProperties;\n\n this.xfaLayer = new XfaLayerBuilder({\n pdfPage,\n annotationStorage,\n linkService,\n });\n }\n this.#renderXfaLayer();\n }\n\n div.setAttribute(\"data-loaded\", true);\n\n this.eventBus.dispatch(\"pagerender\", {\n source: this,\n pageNumber: this.id,\n });\n return resultPromise;\n }\n\n /**\n * @param {string|null} label\n */\n setPageLabel(label) {\n this.pageLabel = typeof label === \"string\" ? label : null;\n\n this.div.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({ page: this.pageLabel ?? this.id })\n );\n\n if (this.pageLabel !== null) {\n this.div.setAttribute(\"data-page-label\", this.pageLabel);\n } else {\n this.div.removeAttribute(\"data-page-label\");\n }\n }\n\n /**\n * For use by the `PDFThumbnailView.setImage`-method.\n * @ignore\n */\n get thumbnailCanvas() {\n const { directDrawing, initialOptionalContent, regularAnnotations } =\n this.#useThumbnailCanvas;\n return directDrawing && initialOptionalContent && regularAnnotations\n ? this.canvas\n : null;\n }\n}\n\nexport { PDFPageView };\n","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFDocumentProxy} PDFDocumentProxy */\n/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/optional_content_config\").OptionalContentConfig} OptionalContentConfig */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @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 PermissionFlag,\n PixelsPerInch,\n shadow,\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 {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 */\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 #containerTopLeft = null;\n\n #enableHWA = false;\n\n #enableHighlightFloatingButton = false;\n\n #enablePermissions = false;\n\n #enableUpdatedAddImage = false;\n\n #enableNewAltTextWhenAddingImage = false;\n\n #eventAbortController = null;\n\n #mlManager = 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 #textLayerMode = TextLayerMode.ENABLE;\n\n /**\n * @param {PDFViewerOptions} options\n */\n constructor(options) {\n const viewerVersion =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : null;\n if (version !== viewerVersion) {\n throw new Error(\n `The API version \"${version}\" does not match the Viewer version \"${viewerVersion}\".`\n );\n }\n this.container = options.container;\n this.viewer = options.viewer || options.container.firstElementChild;\n\n if (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\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.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\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 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 enableScripting() {\n return !!self._scriptingManager;\n },\n get fieldObjectsPromise() {\n return self.pdfDocument?.getFieldObjects();\n },\n get findController() {\n return self.findController;\n },\n get hasJSActionsPromise() {\n return self.pdfDocument?.hasJSActions();\n },\n get linkService() {\n return self.linkService;\n },\n });\n }\n\n /**\n * Currently only *some* permissions are supported.\n * @returns {Object}\n */\n #initializePermissions(permissions) {\n const params = {\n annotationEditorMode: this.#annotationEditorMode,\n annotationMode: this.#annotationMode,\n textLayerMode: this.#textLayerMode,\n };\n if (!permissions) {\n return params;\n }\n\n if (\n !permissions.includes(PermissionFlag.COPY) &&\n this.#textLayerMode === TextLayerMode.ENABLE\n ) {\n params.textLayerMode = TextLayerMode.ENABLE_PERMISSIONS;\n }\n\n if (!permissions.includes(PermissionFlag.MODIFY_CONTENTS)) {\n params.annotationEditorMode = AnnotationEditorType.DISABLE;\n }\n\n if (\n !permissions.includes(PermissionFlag.MODIFY_ANNOTATIONS) &&\n !permissions.includes(PermissionFlag.FILL_INTERACTIVE_FORMS) &&\n this.#annotationMode === AnnotationMode.ENABLE_FORMS\n ) {\n params.annotationMode = AnnotationMode.ENABLE;\n }\n\n return params;\n }\n\n async #onePageRenderedOrForceFetch(signal) {\n // Unless the viewer *and* its pages are visible, rendering won't start and\n // `this._onePageRenderedCapability` thus won't be resolved.\n // To ensure that automatic printing, on document load, still works even in\n // those cases we force-allow fetching of all pages when:\n // - The current window/tab is inactive, which will prevent rendering since\n // `requestAnimationFrame` is being used; fixes bug 1746213.\n // - The viewer is hidden in the DOM, e.g. in a `display: none` <iframe>\n // element; fixes bug 1618621.\n // - The viewer is visible, but none of the pages are (e.g. if the\n // viewer is very small); fixes bug 1618955.\n if (\n document.visibilityState === \"hidden\" ||\n !this.container.offsetParent ||\n this._getVisiblePages().views.length === 0\n ) {\n return;\n }\n\n // Handle the window/tab becoming inactive *after* rendering has started;\n // fixes (another part of) bug 1746213.\n const hiddenCapability = Promise.withResolvers();\n function onVisibilityChange() {\n if (document.visibilityState === \"hidden\") {\n hiddenCapability.resolve();\n }\n }\n document.addEventListener(\"visibilitychange\", onVisibilityChange, {\n signal,\n });\n\n await Promise.race([\n this._onePageRenderedCapability.promise,\n hiddenCapability.promise,\n ]);\n // Ensure that the \"visibilitychange\" listener is removed immediately.\n document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n }\n\n async getAllText() {\n const texts = [];\n const buffer = [];\n for (\n let pageNum = 1, pagesCount = this.pdfDocument.numPages;\n pageNum <= pagesCount;\n ++pageNum\n ) {\n if (this.#interruptCopyCondition) {\n return null;\n }\n buffer.length = 0;\n const page = await this.pdfDocument.getPage(pageNum);\n // By default getTextContent pass disableNormalization equals to false\n // which is fine because we want a normalized string.\n const { items } = await page.getTextContent();\n for (const item of items) {\n if (item.str) {\n buffer.push(item.str);\n }\n if (item.hasEOL) {\n buffer.push(\"\\n\");\n }\n }\n texts.push(removeNullCharacters(buffer.join(\"\")));\n }\n\n return texts.join(\"\\n\");\n }\n\n #copyCallback(textLayerMode, event) {\n const selection = document.getSelection();\n const { focusNode, anchorNode } = selection;\n if (\n anchorNode &&\n focusNode &&\n selection.containsNode(this.#hiddenCopyElement)\n ) {\n // About the condition above:\n // - having non-null anchorNode and focusNode are here to guaranty that\n // we have at least a kind of selection.\n // - this.#hiddenCopyElement is an invisible element which is impossible\n // to select manually (its display is none) but ctrl+A will select all\n // including this element so having it in the selection means that all\n // has been selected.\n\n if (\n this.#getAllTextInProgress ||\n textLayerMode === TextLayerMode.ENABLE_PERMISSIONS\n ) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n this.#getAllTextInProgress = true;\n\n // TODO: if all the pages are rendered we don't need to wait for\n // getAllText and we could just get text from the Selection object.\n\n // Select all the document.\n const { classList } = this.viewer;\n classList.add(\"copyAll\");\n\n const ac = new AbortController();\n window.addEventListener(\n \"keydown\",\n ev => (this.#interruptCopyCondition = ev.key === \"Escape\"),\n { signal: ac.signal }\n );\n\n this.getAllText()\n .then(async text => {\n if (text !== null) {\n await navigator.clipboard.writeText(text);\n }\n })\n .catch(reason => {\n console.warn(\n `Something goes wrong when extracting the text: ${reason.message}`\n );\n })\n .finally(() => {\n this.#getAllTextInProgress = false;\n this.#interruptCopyCondition = false;\n ac.abort();\n classList.remove(\"copyAll\");\n });\n\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * @param {PDFDocumentProxy} pdfDocument\n */\n setDocument(pdfDocument) {\n if (this.pdfDocument) {\n this.eventBus.dispatch(\"pagesdestroy\", { source: this });\n\n this._cancelRendering();\n this._resetView();\n\n this.findController?.setDocument(null);\n this._scriptingManager?.setDocument(null);\n\n this.#annotationEditorUIManager?.destroy();\n this.#annotationEditorUIManager = null;\n }\n\n this.pdfDocument = pdfDocument;\n if (!pdfDocument) {\n return;\n }\n const pagesCount = pdfDocument.numPages;\n const firstPagePromise = pdfDocument.getPage(1);\n // Rendering (potentially) depends on this, hence fetching it immediately.\n const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({\n intent: \"display\",\n });\n const permissionsPromise = this.#enablePermissions\n ? pdfDocument.getPermissions()\n : Promise.resolve();\n\n const { eventBus, pageColors, viewer } = this;\n\n this.#eventAbortController = new AbortController();\n const { signal } = this.#eventAbortController;\n\n // Given that browsers don't handle huge amounts of DOM-elements very well,\n // enforce usage of PAGE-scrolling when loading *very* long/large documents.\n if (pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {\n console.warn(\n \"Forcing PAGE-scrolling for performance reasons, given the length of the document.\"\n );\n const mode = (this._scrollMode = ScrollMode.PAGE);\n eventBus.dispatch(\"scrollmodechanged\", { source: this, mode });\n }\n\n this._pagesCapability.promise.then(\n () => {\n eventBus.dispatch(\"pagesloaded\", { source: this, pagesCount });\n },\n () => {\n /* Prevent \"Uncaught (in promise)\"-messages in the console. */\n }\n );\n\n const onBeforeDraw = evt => {\n const pageView = this._pages[evt.pageNumber - 1];\n if (!pageView) {\n return;\n }\n // Add the page to the buffer at the start of drawing. That way it can be\n // evicted from the buffer and destroyed even if we pause its rendering.\n this.#buffer.push(pageView);\n };\n eventBus._on(\"pagerender\", onBeforeDraw, { signal });\n\n const onAfterDraw = evt => {\n if (evt.cssTransform) {\n return;\n }\n this._onePageRenderedCapability.resolve({ timestamp: evt.timestamp });\n\n eventBus._off(\"pagerendered\", onAfterDraw); // Remove immediately.\n };\n eventBus._on(\"pagerendered\", onAfterDraw, { signal });\n\n // Fetch a single page so we can get a viewport that will be the default\n // viewport for all pages\n Promise.all([firstPagePromise, permissionsPromise])\n .then(([firstPdfPage, permissions]) => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the first page resolved.\n }\n this._firstPageCapability.resolve(firstPdfPage);\n this._optionalContentConfigPromise = optionalContentConfigPromise;\n\n const { annotationEditorMode, annotationMode, textLayerMode } =\n this.#initializePermissions(permissions);\n\n if (textLayerMode !== TextLayerMode.DISABLE) {\n const element = (this.#hiddenCopyElement =\n document.createElement(\"div\"));\n element.id = \"hiddenCopyElement\";\n viewer.before(element);\n }\n\n if (\n ((typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) ||\n typeof AbortSignal.any === \"function\") &&\n annotationEditorMode !== AnnotationEditorType.DISABLE\n ) {\n const mode = annotationEditorMode;\n\n if (pdfDocument.isPureXfa) {\n console.warn(\"Warning: XFA-editing is not implemented.\");\n } else if (isValidAnnotationEditorMode(mode)) {\n this.#annotationEditorUIManager = new AnnotationEditorUIManager(\n this.container,\n viewer,\n this.#altTextManager,\n eventBus,\n pdfDocument,\n pageColors,\n this.#annotationEditorHighlightColors,\n this.#enableHighlightFloatingButton,\n this.#enableUpdatedAddImage,\n this.#enableNewAltTextWhenAddingImage,\n this.#mlManager\n );\n eventBus.dispatch(\"annotationeditoruimanager\", {\n source: this,\n uiManager: this.#annotationEditorUIManager,\n });\n if (mode !== AnnotationEditorType.NONE) {\n if (mode === AnnotationEditorType.STAMP) {\n this.#mlManager?.loadModel(\"altText\");\n }\n this.#annotationEditorUIManager.updateMode(mode);\n }\n } else {\n console.error(`Invalid AnnotationEditor mode: ${mode}`);\n }\n }\n\n const viewerElement =\n this._scrollMode === ScrollMode.PAGE ? null : viewer;\n const scale = this.currentScale;\n const viewport = firstPdfPage.getViewport({\n scale: scale * PixelsPerInch.PDF_TO_CSS_UNITS,\n });\n // Ensure that the various layers always get the correct initial size,\n // see issue 15795.\n viewer.style.setProperty(\"--scale-factor\", viewport.scale);\n\n if (pageColors?.background) {\n viewer.style.setProperty(\"--page-bg-color\", pageColors.background);\n }\n if (\n pageColors?.foreground === \"CanvasText\" ||\n pageColors?.background === \"Canvas\"\n ) {\n viewer.style.setProperty(\n \"--hcm-highlight-filter\",\n pdfDocument.filterFactory.addHighlightHCMFilter(\n \"highlight\",\n \"CanvasText\",\n \"Canvas\",\n \"HighlightText\",\n \"Highlight\"\n )\n );\n viewer.style.setProperty(\n \"--hcm-highlight-selected-filter\",\n pdfDocument.filterFactory.addHighlightHCMFilter(\n \"highlight_selected\",\n \"CanvasText\",\n \"Canvas\",\n \"HighlightText\",\n \"ButtonText\"\n )\n );\n }\n\n for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n const pageView = new PDFPageView({\n container: viewerElement,\n eventBus,\n id: pageNum,\n scale,\n defaultViewport: viewport.clone(),\n optionalContentConfigPromise,\n renderingQueue: this.renderingQueue,\n textLayerMode,\n annotationMode,\n imageResourcesPath: this.imageResourcesPath,\n maxCanvasPixels: this.maxCanvasPixels,\n pageColors,\n l10n: this.l10n,\n layerProperties: this._layerProperties,\n enableHWA: this.#enableHWA,\n });\n this._pages.push(pageView);\n }\n // Set the first `pdfPage` immediately, since it's already loaded,\n // rather than having to repeat the `PDFDocumentProxy.getPage` call in\n // the `this.#ensurePdfPageLoaded` method before rendering can start.\n this._pages[0]?.setPdfPage(firstPdfPage);\n\n if (this._scrollMode === ScrollMode.PAGE) {\n // Ensure that the current page becomes visible on document load.\n this.#ensurePageViewVisible();\n } else if (this._spreadMode !== SpreadMode.NONE) {\n this._updateSpreadMode();\n }\n\n // Fetch all the pages since the viewport is needed before printing\n // starts to create the correct size canvas. Wait until one page is\n // rendered so we don't tie up too many resources early on.\n this.#onePageRenderedOrForceFetch(signal).then(async () => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the first page rendered.\n }\n this.findController?.setDocument(pdfDocument); // Enable searching.\n this._scriptingManager?.setDocument(pdfDocument); // Enable scripting.\n\n if (this.#hiddenCopyElement) {\n document.addEventListener(\n \"copy\",\n this.#copyCallback.bind(this, textLayerMode),\n { signal }\n );\n }\n\n if (this.#annotationEditorUIManager) {\n // Ensure that the Editor buttons, in the toolbar, are updated.\n eventBus.dispatch(\"annotationeditormodechanged\", {\n source: this,\n mode: this.#annotationEditorMode,\n });\n }\n\n // In addition to 'disableAutoFetch' being set, also attempt to reduce\n // resource usage when loading *very* long/large documents.\n if (\n pdfDocument.loadingParams.disableAutoFetch ||\n pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT\n ) {\n // XXX: Printing is semi-broken with auto fetch disabled.\n this._pagesCapability.resolve();\n return;\n }\n let getPagesLeft = pagesCount - 1; // The first page was already loaded.\n\n if (getPagesLeft <= 0) {\n this._pagesCapability.resolve();\n return;\n }\n for (let pageNum = 2; pageNum <= pagesCount; ++pageNum) {\n const promise = pdfDocument.getPage(pageNum).then(\n pdfPage => {\n const pageView = this._pages[pageNum - 1];\n if (!pageView.pdfPage) {\n pageView.setPdfPage(pdfPage);\n }\n if (--getPagesLeft === 0) {\n this._pagesCapability.resolve();\n }\n },\n reason => {\n console.error(\n `Unable to get page ${pageNum} to initialize viewer`,\n reason\n );\n if (--getPagesLeft === 0) {\n this._pagesCapability.resolve();\n }\n }\n );\n\n if (pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0) {\n await promise;\n }\n }\n });\n\n eventBus.dispatch(\"pagesinit\", { source: this });\n\n pdfDocument.getMetadata().then(({ info }) => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the metadata resolved.\n }\n if (info.Language) {\n viewer.lang = info.Language;\n }\n });\n\n if (this.defaultRenderingQueue) {\n this.update();\n }\n })\n .catch(reason => {\n console.error(\"Unable to initialize viewer\", reason);\n\n this._pagesCapability.reject(reason);\n });\n }\n\n /**\n * @param {Array|null} labels\n */\n setPageLabels(labels) {\n if (!this.pdfDocument) {\n return;\n }\n if (!labels) {\n this._pageLabels = null;\n } else if (\n !(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)\n ) {\n this._pageLabels = null;\n console.error(`setPageLabels: Invalid page labels.`);\n } else {\n this._pageLabels = labels;\n }\n // Update all the `PDFPageView` instances.\n for (let i = 0, ii = this._pages.length; i < ii; i++) {\n this._pages[i].setPageLabel(this._pageLabels?.[i] ?? null);\n }\n }\n\n _resetView() {\n this._pages = [];\n this._currentPageNumber = 1;\n this._currentScale = UNKNOWN_SCALE;\n this._currentScaleValue = null;\n this._pageLabels = null;\n this.#buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);\n this._location = null;\n this._pagesRotation = 0;\n this._optionalContentConfigPromise = null;\n this._firstPageCapability = Promise.withResolvers();\n this._onePageRenderedCapability = Promise.withResolvers();\n this._pagesCapability = Promise.withResolvers();\n this._scrollMode = ScrollMode.VERTICAL;\n this._previousScrollMode = ScrollMode.UNKNOWN;\n this._spreadMode = SpreadMode.NONE;\n\n this.#scrollModePageState = {\n previousPageNumber: 1,\n scrollDown: true,\n pages: [],\n };\n\n this.#eventAbortController?.abort();\n this.#eventAbortController = null;\n\n // Remove the pages from the DOM...\n this.viewer.textContent = \"\";\n // ... and reset the Scroll mode CSS class(es) afterwards.\n this._updateScrollMode();\n\n this.viewer.removeAttribute(\"lang\");\n\n this.#hiddenCopyElement?.remove();\n this.#hiddenCopyElement = null;\n\n this.#cleanupSwitchAnnotationEditorMode();\n }\n\n #ensurePageViewVisible() {\n if (this._scrollMode !== ScrollMode.PAGE) {\n throw new Error(\"#ensurePageViewVisible: Invalid scrollMode value.\");\n }\n const pageNumber = this._currentPageNumber,\n state = this.#scrollModePageState,\n viewer = this.viewer;\n\n // Temporarily remove all the pages from the DOM...\n viewer.textContent = \"\";\n // ... and clear out the active ones.\n state.pages.length = 0;\n\n if (this._spreadMode === SpreadMode.NONE && !this.isInPresentationMode) {\n // Finally, append the new page to the viewer.\n const pageView = this._pages[pageNumber - 1];\n viewer.append(pageView.div);\n\n state.pages.push(pageView);\n } else {\n const pageIndexSet = new Set(),\n parity = this._spreadMode - 1;\n\n // Determine the pageIndices in the new spread.\n if (parity === -1) {\n // PresentationMode is active, with `SpreadMode.NONE` set.\n pageIndexSet.add(pageNumber - 1);\n } else if (pageNumber % 2 !== parity) {\n // Left-hand side page.\n pageIndexSet.add(pageNumber - 1);\n pageIndexSet.add(pageNumber);\n } else {\n // Right-hand side page.\n pageIndexSet.add(pageNumber - 2);\n pageIndexSet.add(pageNumber - 1);\n }\n\n // Finally, append the new pages to the viewer and apply the spreadMode.\n const spread = document.createElement(\"div\");\n spread.className = \"spread\";\n\n if (this.isInPresentationMode) {\n const dummyPage = document.createElement(\"div\");\n dummyPage.className = \"dummyPage\";\n spread.append(dummyPage);\n }\n\n for (const i of pageIndexSet) {\n const pageView = this._pages[i];\n if (!pageView) {\n continue;\n }\n spread.append(pageView.div);\n\n state.pages.push(pageView);\n }\n viewer.append(spread);\n }\n\n state.scrollDown = pageNumber >= state.previousPageNumber;\n state.previousPageNumber = pageNumber;\n }\n\n _scrollUpdate() {\n if (this.pagesCount === 0) {\n return;\n }\n this.update();\n }\n\n #scrollIntoView(pageView, pageSpot = null) {\n const { div, id } = pageView;\n\n // Ensure that `this._currentPageNumber` is correct, when `#scrollIntoView`\n // is called directly (and not from `#resetCurrentPageView`).\n if (this._currentPageNumber !== id) {\n this._setCurrentPageNumber(id);\n }\n if (this._scrollMode === ScrollMode.PAGE) {\n this.#ensurePageViewVisible();\n // Ensure that rendering always occurs, to avoid showing a blank page,\n // even if the current position doesn't change when the page is scrolled.\n this.update();\n }\n\n if (!pageSpot && !this.isInPresentationMode) {\n const left = div.offsetLeft + div.clientLeft,\n right = left + div.clientWidth;\n const { scrollLeft, clientWidth } = this.container;\n if (\n this._scrollMode === ScrollMode.HORIZONTAL ||\n left < scrollLeft ||\n right > scrollLeft + clientWidth\n ) {\n pageSpot = { left: 0, top: 0 };\n }\n }\n scrollIntoView(div, pageSpot);\n\n // Ensure that the correct *initial* document position is set, when any\n // OpenParameters are used, for documents with non-default Scroll/Spread\n // modes (fixes issue 15695). This is necessary since the scroll-handler\n // invokes the `update`-method asynchronously, and `this._location` could\n // thus be wrong when the initial zooming occurs in the default viewer.\n if (!this._currentScaleValue && this._location) {\n this._location = null;\n }\n }\n\n /**\n * Prevent unnecessary re-rendering of all pages when the scale changes\n * only because of limited numerical precision.\n */\n #isSameScale(newScale) {\n return (\n newScale === this._currentScale ||\n Math.abs(newScale - this._currentScale) < 1e-15\n );\n }\n\n #setScaleUpdatePages(\n newScale,\n newValue,\n { noScroll = false, preset = false, drawingDelay = -1, origin = null }\n ) {\n this._currentScaleValue = newValue.toString();\n\n if (this.#isSameScale(newScale)) {\n if (preset) {\n this.eventBus.dispatch(\"scalechanging\", {\n source: this,\n scale: newScale,\n presetValue: newValue,\n });\n }\n return;\n }\n\n this.viewer.style.setProperty(\n \"--scale-factor\",\n newScale * PixelsPerInch.PDF_TO_CSS_UNITS\n );\n\n const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000;\n this.refresh(true, {\n scale: newScale,\n drawingDelay: postponeDrawing ? drawingDelay : -1,\n });\n\n if (postponeDrawing) {\n this.#scaleTimeoutId = setTimeout(() => {\n this.#scaleTimeoutId = null;\n this.refresh();\n }, drawingDelay);\n }\n\n const previousScale = this._currentScale;\n this._currentScale = newScale;\n\n if (!noScroll) {\n let page = this._currentPageNumber,\n dest;\n if (\n this._location &&\n !(this.isInPresentationMode || this.isChangingPresentationMode)\n ) {\n page = this._location.pageNumber;\n dest = [\n null,\n { name: \"XYZ\" },\n this._location.left,\n this._location.top,\n null,\n ];\n }\n this.scrollPageIntoView({\n pageNumber: page,\n destArray: dest,\n allowNegativeOffset: true,\n });\n if (Array.isArray(origin)) {\n // If the origin of the scaling transform is specified, preserve its\n // location on screen. If not specified, scaling will fix the top-left\n // corner of the visible PDF area.\n const scaleDiff = newScale / previousScale - 1;\n const [top, left] = this.containerTopLeft;\n this.container.scrollLeft += (origin[0] - left) * scaleDiff;\n this.container.scrollTop += (origin[1] - top) * scaleDiff;\n }\n }\n\n this.eventBus.dispatch(\"scalechanging\", {\n source: this,\n scale: newScale,\n presetValue: preset ? newValue : undefined,\n });\n\n if (this.defaultRenderingQueue) {\n this.update();\n }\n }\n\n get #pageWidthScaleFactor() {\n if (\n this._spreadMode !== SpreadMode.NONE &&\n this._scrollMode !== ScrollMode.HORIZONTAL\n ) {\n return 2;\n }\n return 1;\n }\n\n #setScale(value, options) {\n let scale = parseFloat(value);\n\n if (scale > 0) {\n options.preset = false;\n this.#setScaleUpdatePages(scale, value, options);\n } else {\n const currentPage = this._pages[this._currentPageNumber - 1];\n if (!currentPage) {\n return;\n }\n let hPadding = SCROLLBAR_PADDING,\n vPadding = VERTICAL_PADDING;\n\n if (this.isInPresentationMode) {\n // Pages have a 2px (transparent) border in PresentationMode, see\n // the `web/pdf_viewer.css` file.\n hPadding = vPadding = 4; // 2 * 2px\n if (this._spreadMode !== SpreadMode.NONE) {\n // Account for two pages being visible in PresentationMode, thus\n // \"doubling\" the total border width.\n hPadding *= 2;\n }\n } else if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this.removePageBorders\n ) {\n hPadding = vPadding = 0;\n } else if (this._scrollMode === ScrollMode.HORIZONTAL) {\n [hPadding, vPadding] = [vPadding, hPadding]; // Swap the padding values.\n }\n const pageWidthScale =\n (((this.container.clientWidth - hPadding) / currentPage.width) *\n currentPage.scale) /\n this.#pageWidthScaleFactor;\n const pageHeightScale =\n ((this.container.clientHeight - vPadding) / currentPage.height) *\n currentPage.scale;\n switch (value) {\n case \"page-actual\":\n scale = 1;\n break;\n case \"page-width\":\n scale = pageWidthScale;\n break;\n case \"page-height\":\n scale = pageHeightScale;\n break;\n case \"page-fit\":\n scale = Math.min(pageWidthScale, pageHeightScale);\n break;\n case \"auto\":\n // For pages in landscape mode, fit the page height to the viewer\n // *unless* the page would thus become too wide to fit horizontally.\n const horizontalScale = isPortraitOrientation(currentPage)\n ? pageWidthScale\n : Math.min(pageHeightScale, pageWidthScale);\n scale = Math.min(MAX_AUTO_SCALE, horizontalScale);\n break;\n default:\n console.error(`#setScale: \"${value}\" is an unknown zoom value.`);\n return;\n }\n options.preset = true;\n this.#setScaleUpdatePages(scale, value, options);\n }\n }\n\n /**\n * Refreshes page view: scrolls to the current page and updates the scale.\n */\n #resetCurrentPageView() {\n const pageView = this._pages[this._currentPageNumber - 1];\n\n if (this.isInPresentationMode) {\n // Fixes the case when PDF has different page sizes.\n this.#setScale(this._currentScaleValue, { noScroll: true });\n }\n this.#scrollIntoView(pageView);\n }\n\n /**\n * @param {string} label - The page label.\n * @returns {number|null} The page number corresponding to the page label,\n * or `null` when no page labels exist and/or the input is invalid.\n */\n pageLabelToPageNumber(label) {\n if (!this._pageLabels) {\n return null;\n }\n const i = this._pageLabels.indexOf(label);\n if (i < 0) {\n return null;\n }\n return i + 1;\n }\n\n /**\n * @typedef {Object} ScrollPageIntoViewParameters\n * @property {number} pageNumber - The page number.\n * @property {Array} [destArray] - The original PDF destination array, in the\n * format: <page-ref> </XYZ|/FitXXX> <args..>\n * @property {boolean} [allowNegativeOffset] - Allow negative page offsets.\n * The default value is `false`.\n * @property {boolean} [ignoreDestinationZoom] - Ignore the zoom argument in\n * the destination array. The default value is `false`.\n */\n\n /**\n * Scrolls page into view.\n * @param {ScrollPageIntoViewParameters} params\n */\n scrollPageIntoView({\n pageNumber,\n destArray = null,\n allowNegativeOffset = false,\n ignoreDestinationZoom = false,\n }) {\n if (!this.pdfDocument) {\n return;\n }\n const pageView =\n Number.isInteger(pageNumber) && this._pages[pageNumber - 1];\n if (!pageView) {\n console.error(\n `scrollPageIntoView: \"${pageNumber}\" is not a valid pageNumber parameter.`\n );\n return;\n }\n\n if (this.isInPresentationMode || !destArray) {\n this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n return;\n }\n let x = 0,\n y = 0;\n let width = 0,\n height = 0,\n widthScale,\n heightScale;\n const changeOrientation = pageView.rotation % 180 !== 0;\n const pageWidth =\n (changeOrientation ? pageView.height : pageView.width) /\n pageView.scale /\n PixelsPerInch.PDF_TO_CSS_UNITS;\n const pageHeight =\n (changeOrientation ? pageView.width : pageView.height) /\n pageView.scale /\n PixelsPerInch.PDF_TO_CSS_UNITS;\n let scale = 0;\n switch (destArray[1].name) {\n case \"XYZ\":\n x = destArray[2];\n y = destArray[3];\n scale = destArray[4];\n // If x and/or y coordinates are not supplied, default to\n // _top_ left of the page (not the obvious bottom left,\n // since aligning the bottom of the intended page with the\n // top of the window is rarely helpful).\n x = x !== null ? x : 0;\n y = y !== null ? y : pageHeight;\n break;\n case \"Fit\":\n case \"FitB\":\n scale = \"page-fit\";\n break;\n case \"FitH\":\n case \"FitBH\":\n y = destArray[2];\n scale = \"page-width\";\n // According to the PDF spec, section 12.3.2.2, a `null` value in the\n // parameter should maintain the position relative to the new page.\n if (y === null && this._location) {\n x = this._location.left;\n y = this._location.top;\n } else if (typeof y !== \"number\" || y < 0) {\n // The \"top\" value isn't optional, according to the spec, however some\n // bad PDF generators will pretend that it is (fixes bug 1663390).\n y = pageHeight;\n }\n break;\n case \"FitV\":\n case \"FitBV\":\n x = destArray[2];\n width = pageWidth;\n height = pageHeight;\n scale = \"page-height\";\n break;\n case \"FitR\":\n x = destArray[2];\n y = destArray[3];\n width = destArray[4] - x;\n height = destArray[5] - y;\n let hPadding = SCROLLBAR_PADDING,\n vPadding = VERTICAL_PADDING;\n\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this.removePageBorders\n ) {\n hPadding = vPadding = 0;\n }\n widthScale =\n (this.container.clientWidth - hPadding) /\n width /\n PixelsPerInch.PDF_TO_CSS_UNITS;\n heightScale =\n (this.container.clientHeight - vPadding) /\n height /\n PixelsPerInch.PDF_TO_CSS_UNITS;\n scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));\n break;\n default:\n console.error(\n `scrollPageIntoView: \"${destArray[1].name}\" is not a valid destination type.`\n );\n return;\n }\n\n if (!ignoreDestinationZoom) {\n if (scale && scale !== this._currentScale) {\n this.currentScaleValue = scale;\n } else if (this._currentScale === UNKNOWN_SCALE) {\n this.currentScaleValue = DEFAULT_SCALE_VALUE;\n }\n }\n\n if (scale === \"page-fit\" && !destArray[4]) {\n this.#scrollIntoView(pageView);\n return;\n }\n\n const boundingRect = [\n pageView.viewport.convertToViewportPoint(x, y),\n pageView.viewport.convertToViewportPoint(x + width, y + height),\n ];\n let left = Math.min(boundingRect[0][0], boundingRect[1][0]);\n let top = Math.min(boundingRect[0][1], boundingRect[1][1]);\n\n if (!allowNegativeOffset) {\n // Some bad PDF generators will create destinations with e.g. top values\n // that exceeds the page height. Ensure that offsets are not negative,\n // to prevent a previous page from becoming visible (fixes bug 874482).\n left = Math.max(left, 0);\n top = Math.max(top, 0);\n }\n this.#scrollIntoView(pageView, /* pageSpot = */ { left, top });\n }\n\n _updateLocation(firstPage) {\n const currentScale = this._currentScale;\n const currentScaleValue = this._currentScaleValue;\n const normalizedScaleValue =\n parseFloat(currentScaleValue) === currentScale\n ? Math.round(currentScale * 10000) / 100\n : currentScaleValue;\n\n const pageNumber = firstPage.id;\n const currentPageView = this._pages[pageNumber - 1];\n const container = this.container;\n const topLeft = currentPageView.getPagePoint(\n container.scrollLeft - firstPage.x,\n container.scrollTop - firstPage.y\n );\n const intLeft = Math.round(topLeft[0]);\n const intTop = Math.round(topLeft[1]);\n\n let pdfOpenParams = `#page=${pageNumber}`;\n if (!this.isInPresentationMode) {\n pdfOpenParams += `&zoom=${normalizedScaleValue},${intLeft},${intTop}`;\n }\n\n this._location = {\n pageNumber,\n scale: normalizedScaleValue,\n top: intTop,\n left: intLeft,\n rotation: this._pagesRotation,\n pdfOpenParams,\n };\n }\n\n update() {\n const visible = this._getVisiblePages();\n const visiblePages = visible.views,\n numVisiblePages = visiblePages.length;\n\n if (numVisiblePages === 0) {\n return;\n }\n const newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1);\n this.#buffer.resize(newCacheSize, visible.ids);\n\n this.renderingQueue.renderHighestPriority(visible);\n\n const isSimpleLayout =\n this._spreadMode === SpreadMode.NONE &&\n (this._scrollMode === ScrollMode.PAGE ||\n this._scrollMode === ScrollMode.VERTICAL);\n const currentId = this._currentPageNumber;\n let stillFullyVisible = false;\n\n for (const page of visiblePages) {\n if (page.percent < 100) {\n break;\n }\n if (page.id === currentId && isSimpleLayout) {\n stillFullyVisible = true;\n break;\n }\n }\n this._setCurrentPageNumber(\n stillFullyVisible ? currentId : visiblePages[0].id\n );\n\n this._updateLocation(visible.first);\n this.eventBus.dispatch(\"updateviewarea\", {\n source: this,\n location: this._location,\n });\n }\n\n #switchToEditAnnotationMode() {\n const visible = this._getVisiblePages();\n const pagesToRefresh = [];\n const { ids, views } = visible;\n for (const page of views) {\n const { view } = page;\n if (!view.hasEditableAnnotations()) {\n ids.delete(view.id);\n continue;\n }\n pagesToRefresh.push(page);\n }\n\n if (pagesToRefresh.length === 0) {\n return null;\n }\n this.renderingQueue.renderHighestPriority({\n first: pagesToRefresh[0],\n last: pagesToRefresh.at(-1),\n views: pagesToRefresh,\n ids,\n });\n\n return ids;\n }\n\n containsElement(element) {\n return this.container.contains(element);\n }\n\n focus() {\n this.container.focus();\n }\n\n get _isContainerRtl() {\n return getComputedStyle(this.container).direction === \"rtl\";\n }\n\n get isInPresentationMode() {\n return this.presentationModeState === PresentationModeState.FULLSCREEN;\n }\n\n get isChangingPresentationMode() {\n return this.presentationModeState === PresentationModeState.CHANGING;\n }\n\n get isHorizontalScrollbarEnabled() {\n return this.isInPresentationMode\n ? false\n : this.container.scrollWidth > this.container.clientWidth;\n }\n\n get isVerticalScrollbarEnabled() {\n return this.isInPresentationMode\n ? false\n : this.container.scrollHeight > this.container.clientHeight;\n }\n\n _getVisiblePages() {\n const views =\n this._scrollMode === ScrollMode.PAGE\n ? this.#scrollModePageState.pages\n : this._pages,\n horizontal = this._scrollMode === ScrollMode.HORIZONTAL,\n rtl = horizontal && this._isContainerRtl;\n\n return getVisibleElements({\n scrollEl: this.container,\n views,\n sortByVisibility: true,\n horizontal,\n rtl,\n });\n }\n\n cleanup() {\n for (const pageView of this._pages) {\n if (pageView.renderingState !== RenderingStates.FINISHED) {\n pageView.reset();\n }\n }\n }\n\n /**\n * @private\n */\n _cancelRendering() {\n for (const pageView of this._pages) {\n pageView.cancelRendering();\n }\n }\n\n /**\n * @param {PDFPageView} pageView\n * @returns {Promise<PDFPageProxy | null>}\n */\n async #ensurePdfPageLoaded(pageView) {\n if (pageView.pdfPage) {\n return pageView.pdfPage;\n }\n try {\n const pdfPage = await this.pdfDocument.getPage(pageView.id);\n if (!pageView.pdfPage) {\n pageView.setPdfPage(pdfPage);\n }\n return pdfPage;\n } catch (reason) {\n console.error(\"Unable to get page for page view\", reason);\n return null; // Page error -- there is nothing that can be done.\n }\n }\n\n #getScrollAhead(visible) {\n if (visible.first?.id === 1) {\n return true;\n } else if (visible.last?.id === this.pagesCount) {\n return false;\n }\n switch (this._scrollMode) {\n case ScrollMode.PAGE:\n return this.#scrollModePageState.scrollDown;\n case ScrollMode.HORIZONTAL:\n return this.scroll.right;\n }\n return this.scroll.down;\n }\n\n forceRendering(currentlyVisiblePages) {\n const visiblePages = currentlyVisiblePages || this._getVisiblePages();\n const scrollAhead = this.#getScrollAhead(visiblePages);\n const preRenderExtra =\n this._spreadMode !== SpreadMode.NONE &&\n this._scrollMode !== ScrollMode.HORIZONTAL;\n\n const pageView = this.renderingQueue.getHighestPriority(\n visiblePages,\n this._pages,\n scrollAhead,\n preRenderExtra\n );\n\n if (pageView) {\n this.#ensurePdfPageLoaded(pageView).then(() => {\n this.renderingQueue.renderView(pageView);\n });\n return true;\n }\n return false;\n }\n\n /**\n * @type {boolean} Whether all pages of the PDF document have identical\n * widths and heights.\n */\n get hasEqualPageSizes() {\n const firstPageView = this._pages[0];\n for (let i = 1, ii = this._pages.length; i < ii; ++i) {\n const pageView = this._pages[i];\n if (\n pageView.width !== firstPageView.width ||\n pageView.height !== firstPageView.height\n ) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Returns sizes of the pages.\n * @returns {Array} Array of objects with width/height/rotation fields.\n */\n getPagesOverview() {\n let initialOrientation;\n return this._pages.map(pageView => {\n const viewport = pageView.pdfPage.getViewport({ scale: 1 });\n const orientation = isPortraitOrientation(viewport);\n if (initialOrientation === undefined) {\n initialOrientation = orientation;\n } else if (\n this.enablePrintAutoRotate &&\n orientation !== initialOrientation\n ) {\n // Rotate to fit the initial orientation.\n return {\n width: viewport.height,\n height: viewport.width,\n rotation: (viewport.rotation - 90) % 360,\n };\n }\n return {\n width: viewport.width,\n height: viewport.height,\n rotation: viewport.rotation,\n };\n });\n }\n\n /**\n * @type {Promise<OptionalContentConfig | null>}\n */\n get optionalContentConfigPromise() {\n if (!this.pdfDocument) {\n return Promise.resolve(null);\n }\n if (!this._optionalContentConfigPromise) {\n console.error(\"optionalContentConfigPromise: Not initialized yet.\");\n // Prevent issues if the getter is accessed *before* the `onePageRendered`\n // promise has resolved; won't (normally) happen in the default viewer.\n return this.pdfDocument.getOptionalContentConfig({ intent: \"display\" });\n }\n return this._optionalContentConfigPromise;\n }\n\n /**\n * @param {Promise<OptionalContentConfig>} promise - A promise that is\n * resolved with an {@link OptionalContentConfig} instance.\n */\n set optionalContentConfigPromise(promise) {\n if (!(promise instanceof Promise)) {\n throw new Error(`Invalid optionalContentConfigPromise: ${promise}`);\n }\n if (!this.pdfDocument) {\n return;\n }\n if (!this._optionalContentConfigPromise) {\n // Ignore the setter *before* the `onePageRendered` promise has resolved,\n // since it'll be overwritten anyway; won't happen in the default viewer.\n return;\n }\n this._optionalContentConfigPromise = promise;\n\n this.refresh(false, { optionalContentConfigPromise: promise });\n\n this.eventBus.dispatch(\"optionalcontentconfigchanged\", {\n source: this,\n promise,\n });\n }\n\n /**\n * @type {number} One of the values in {ScrollMode}.\n */\n get scrollMode() {\n return this._scrollMode;\n }\n\n /**\n * @param {number} mode - The direction in which the document pages should be\n * laid out within the scrolling container.\n * The constants from {ScrollMode} should be used.\n */\n set scrollMode(mode) {\n if (\n typeof PDFJSDev === \"undefined\"\n ? window.isGECKOVIEW\n : PDFJSDev.test(\"GECKOVIEW\")\n ) {\n // NOTE: Always ignore the pageLayout in GeckoView since there's\n // no UI available to change Scroll/Spread modes for the user.\n return;\n }\n if (this._scrollMode === mode) {\n return; // The Scroll mode didn't change.\n }\n if (!isValidScrollMode(mode)) {\n throw new Error(`Invalid scroll mode: ${mode}`);\n }\n if (this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {\n return; // Disabled for performance reasons.\n }\n this._previousScrollMode = this._scrollMode;\n\n this._scrollMode = mode;\n this.eventBus.dispatch(\"scrollmodechanged\", { source: this, mode });\n\n this._updateScrollMode(/* pageNumber = */ this._currentPageNumber);\n }\n\n _updateScrollMode(pageNumber = null) {\n const scrollMode = this._scrollMode,\n viewer = this.viewer;\n\n viewer.classList.toggle(\n \"scrollHorizontal\",\n scrollMode === ScrollMode.HORIZONTAL\n );\n viewer.classList.toggle(\"scrollWrapped\", scrollMode === ScrollMode.WRAPPED);\n\n if (!this.pdfDocument || !pageNumber) {\n return;\n }\n\n if (scrollMode === ScrollMode.PAGE) {\n this.#ensurePageViewVisible();\n } else if (this._previousScrollMode === ScrollMode.PAGE) {\n // Ensure that the current spreadMode is still applied correctly when\n // the *previous* scrollMode was `ScrollMode.PAGE`.\n this._updateSpreadMode();\n }\n // Non-numeric scale values can be sensitive to the scroll orientation.\n // Call this before re-scrolling to the current page, to ensure that any\n // changes in scale don't move the current page.\n if (this._currentScaleValue && isNaN(this._currentScaleValue)) {\n this.#setScale(this._currentScaleValue, { noScroll: true });\n }\n this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n this.update();\n }\n\n /**\n * @type {number} One of the values in {SpreadMode}.\n */\n get spreadMode() {\n return this._spreadMode;\n }\n\n /**\n * @param {number} mode - Group the pages in spreads, starting with odd- or\n * even-number pages (unless `SpreadMode.NONE` is used).\n * The constants from {SpreadMode} should be used.\n */\n set spreadMode(mode) {\n if (\n typeof PDFJSDev === \"undefined\"\n ? window.isGECKOVIEW\n : PDFJSDev.test(\"GECKOVIEW\")\n ) {\n // NOTE: Always ignore the pageLayout in GeckoView since there's\n // no UI available to change Scroll/Spread modes for the user.\n return;\n }\n if (this._spreadMode === mode) {\n return; // The Spread mode didn't change.\n }\n if (!isValidSpreadMode(mode)) {\n throw new Error(`Invalid spread mode: ${mode}`);\n }\n this._spreadMode = mode;\n this.eventBus.dispatch(\"spreadmodechanged\", { source: this, mode });\n\n this._updateSpreadMode(/* pageNumber = */ this._currentPageNumber);\n }\n\n _updateSpreadMode(pageNumber = null) {\n if (!this.pdfDocument) {\n return;\n }\n const viewer = this.viewer,\n pages = this._pages;\n\n if (this._scrollMode === ScrollMode.PAGE) {\n this.#ensurePageViewVisible();\n } else {\n // Temporarily remove all the pages from the DOM.\n viewer.textContent = \"\";\n\n if (this._spreadMode === SpreadMode.NONE) {\n for (const pageView of this._pages) {\n viewer.append(pageView.div);\n }\n } else {\n const parity = this._spreadMode - 1;\n let spread = null;\n for (let i = 0, ii = pages.length; i < ii; ++i) {\n if (spread === null) {\n spread = document.createElement(\"div\");\n spread.className = \"spread\";\n viewer.append(spread);\n } else if (i % 2 === parity) {\n spread = spread.cloneNode(false);\n viewer.append(spread);\n }\n spread.append(pages[i].div);\n }\n }\n }\n\n if (!pageNumber) {\n return;\n }\n // Non-numeric scale values can be sensitive to the scroll orientation.\n // Call this before re-scrolling to the current page, to ensure that any\n // changes in scale don't move the current page.\n if (this._currentScaleValue && isNaN(this._currentScaleValue)) {\n this.#setScale(this._currentScaleValue, { noScroll: true });\n }\n this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n this.update();\n }\n\n /**\n * @private\n */\n _getPageAdvance(currentPageNumber, previous = false) {\n switch (this._scrollMode) {\n case ScrollMode.WRAPPED: {\n const { views } = this._getVisiblePages(),\n pageLayout = new Map();\n\n // Determine the current (visible) page layout.\n for (const { id, y, percent, widthPercent } of views) {\n if (percent === 0 || widthPercent < 100) {\n continue;\n }\n let yArray = pageLayout.get(y);\n if (!yArray) {\n pageLayout.set(y, (yArray ||= []));\n }\n yArray.push(id);\n }\n // Find the row of the current page.\n for (const yArray of pageLayout.values()) {\n const currentIndex = yArray.indexOf(currentPageNumber);\n if (currentIndex === -1) {\n continue;\n }\n const numPages = yArray.length;\n if (numPages === 1) {\n break;\n }\n // Handle documents with varying page sizes.\n if (previous) {\n for (let i = currentIndex - 1, ii = 0; i >= ii; i--) {\n const currentId = yArray[i],\n expectedId = yArray[i + 1] - 1;\n if (currentId < expectedId) {\n return currentPageNumber - expectedId;\n }\n }\n } else {\n for (let i = currentIndex + 1, ii = numPages; i < ii; i++) {\n const currentId = yArray[i],\n expectedId = yArray[i - 1] + 1;\n if (currentId > expectedId) {\n return expectedId - currentPageNumber;\n }\n }\n }\n // The current row is \"complete\", advance to the previous/next one.\n if (previous) {\n const firstId = yArray[0];\n if (firstId < currentPageNumber) {\n return currentPageNumber - firstId + 1;\n }\n } else {\n const lastId = yArray[numPages - 1];\n if (lastId > currentPageNumber) {\n return lastId - currentPageNumber + 1;\n }\n }\n break;\n }\n break;\n }\n case ScrollMode.HORIZONTAL: {\n break;\n }\n case ScrollMode.PAGE:\n case ScrollMode.VERTICAL: {\n if (this._spreadMode === SpreadMode.NONE) {\n break; // Normal vertical scrolling.\n }\n const parity = this._spreadMode - 1;\n\n if (previous && currentPageNumber % 2 !== parity) {\n break; // Left-hand side page.\n } else if (!previous && currentPageNumber % 2 === parity) {\n break; // Right-hand side page.\n }\n const { views } = this._getVisiblePages(),\n expectedId = previous ? currentPageNumber - 1 : currentPageNumber + 1;\n\n for (const { id, percent, widthPercent } of views) {\n if (id !== expectedId) {\n continue;\n }\n if (percent > 0 && widthPercent === 100) {\n return 2;\n }\n break;\n }\n break;\n }\n }\n return 1;\n }\n\n /**\n * Go to the next page, taking scroll/spread-modes into account.\n * @returns {boolean} Whether navigation occurred.\n */\n nextPage() {\n const currentPageNumber = this._currentPageNumber,\n pagesCount = this.pagesCount;\n\n if (currentPageNumber >= pagesCount) {\n return false;\n }\n const advance =\n this._getPageAdvance(currentPageNumber, /* previous = */ false) || 1;\n\n this.currentPageNumber = Math.min(currentPageNumber + advance, pagesCount);\n return true;\n }\n\n /**\n * Go to the previous page, taking scroll/spread-modes into account.\n * @returns {boolean} Whether navigation occurred.\n */\n previousPage() {\n const currentPageNumber = this._currentPageNumber;\n\n if (currentPageNumber <= 1) {\n return false;\n }\n const advance =\n this._getPageAdvance(currentPageNumber, /* previous = */ true) || 1;\n\n this.currentPageNumber = Math.max(currentPageNumber - advance, 1);\n return true;\n }\n\n /**\n * @typedef {Object} ChangeScaleOptions\n * @property {number} [drawingDelay]\n * @property {number} [scaleFactor]\n * @property {number} [steps]\n * @property {Array} [origin] x and y coordinates of the scale\n * transformation origin.\n */\n\n /**\n * Changes the current zoom level by the specified amount.\n * @param {ChangeScaleOptions} [options]\n */\n updateScale({ drawingDelay, scaleFactor = null, steps = null, origin }) {\n if (steps === null && scaleFactor === null) {\n throw new Error(\n \"Invalid updateScale options: either `steps` or `scaleFactor` must be provided.\"\n );\n }\n if (!this.pdfDocument) {\n return;\n }\n let newScale = this._currentScale;\n if (scaleFactor > 0 && scaleFactor !== 1) {\n newScale = Math.round(newScale * scaleFactor * 100) / 100;\n } else if (steps) {\n const delta = steps > 0 ? DEFAULT_SCALE_DELTA : 1 / DEFAULT_SCALE_DELTA;\n const round = steps > 0 ? Math.ceil : Math.floor;\n steps = Math.abs(steps);\n do {\n newScale = round((newScale * delta).toFixed(2) * 10) / 10;\n } while (--steps > 0);\n }\n newScale = Math.max(MIN_SCALE, Math.min(MAX_SCALE, newScale));\n this.#setScale(newScale, { noScroll: false, drawingDelay, origin });\n }\n\n /**\n * Increase the current zoom level one, or more, times.\n * @param {ChangeScaleOptions} [options]\n */\n increaseScale(options = {}) {\n this.updateScale({ ...options, steps: options.steps ?? 1 });\n }\n\n /**\n * Decrease the current zoom level one, or more, times.\n * @param {ChangeScaleOptions} [options]\n */\n decreaseScale(options = {}) {\n this.updateScale({ ...options, steps: -(options.steps ?? 1) });\n }\n\n #updateContainerHeightCss(height = this.container.clientHeight) {\n if (height !== this.#previousContainerHeight) {\n this.#previousContainerHeight = height;\n docStyle.setProperty(\"--viewer-container-height\", `${height}px`);\n }\n }\n\n #resizeObserverCallback(entries) {\n for (const entry of entries) {\n if (entry.target === this.container) {\n this.#updateContainerHeightCss(\n Math.floor(entry.borderBoxSize[0].blockSize)\n );\n this.#containerTopLeft = null;\n break;\n }\n }\n }\n\n get containerTopLeft() {\n return (this.#containerTopLeft ||= [\n this.container.offsetTop,\n this.container.offsetLeft,\n ]);\n }\n\n #cleanupSwitchAnnotationEditorMode() {\n this.#switchAnnotationEditorModeAC?.abort();\n this.#switchAnnotationEditorModeAC = null;\n\n if (this.#switchAnnotationEditorModeTimeoutId !== null) {\n clearTimeout(this.#switchAnnotationEditorModeTimeoutId);\n this.#switchAnnotationEditorModeTimeoutId = null;\n }\n }\n\n get annotationEditorMode() {\n return this.#annotationEditorUIManager\n ? this.#annotationEditorMode\n : AnnotationEditorType.DISABLE;\n }\n\n /**\n * @typedef {Object} AnnotationEditorModeOptions\n * @property {number} mode - The editor mode (none, FreeText, ink, ...).\n * @property {string|null} [editId] - ID of the existing annotation to edit.\n * @property {boolean} [isFromKeyboard] - True if the mode change is due to a\n * keyboard action.\n */\n\n /**\n * @param {AnnotationEditorModeOptions} options\n */\n set annotationEditorMode({ mode, editId = null, isFromKeyboard = false }) {\n if (!this.#annotationEditorUIManager) {\n throw new Error(`The AnnotationEditor is not enabled.`);\n }\n if (this.#annotationEditorMode === mode) {\n return; // The AnnotationEditor mode didn't change.\n }\n if (!isValidAnnotationEditorMode(mode)) {\n throw new Error(`Invalid AnnotationEditor mode: ${mode}`);\n }\n if (!this.pdfDocument) {\n return;\n }\n if (mode === AnnotationEditorType.STAMP) {\n this.#mlManager?.loadModel(\"altText\");\n }\n\n const { eventBus } = this;\n const updater = () => {\n this.#cleanupSwitchAnnotationEditorMode();\n this.#annotationEditorMode = mode;\n this.#annotationEditorUIManager.updateMode(mode, editId, isFromKeyboard);\n eventBus.dispatch(\"annotationeditormodechanged\", {\n source: this,\n mode,\n });\n };\n\n if (\n mode === AnnotationEditorType.NONE ||\n this.#annotationEditorMode === AnnotationEditorType.NONE\n ) {\n const isEditing = mode !== AnnotationEditorType.NONE;\n if (!isEditing) {\n this.pdfDocument.annotationStorage.resetModifiedIds();\n }\n for (const pageView of this._pages) {\n pageView.toggleEditingMode(isEditing);\n }\n // We must call #switchToEditAnnotationMode unconditionally to ensure that\n // page is rendered if it's useful or not.\n const idsToRefresh = this.#switchToEditAnnotationMode();\n if (isEditing && idsToRefresh) {\n // We're editing so we must switch to editing mode when the rendering is\n // done.\n this.#cleanupSwitchAnnotationEditorMode();\n this.#switchAnnotationEditorModeAC = new AbortController();\n const signal = AbortSignal.any([\n this.#eventAbortController.signal,\n this.#switchAnnotationEditorModeAC.signal,\n ]);\n\n eventBus._on(\n \"pagerendered\",\n ({ pageNumber }) => {\n idsToRefresh.delete(pageNumber);\n if (idsToRefresh.size === 0) {\n this.#switchAnnotationEditorModeTimeoutId = setTimeout(\n updater,\n 0\n );\n }\n },\n { signal }\n );\n return;\n }\n }\n updater();\n }\n\n refresh(noUpdate = false, updateArgs = Object.create(null)) {\n if (!this.pdfDocument) {\n return;\n }\n for (const pageView of this._pages) {\n pageView.update(updateArgs);\n }\n if (this.#scaleTimeoutId !== null) {\n clearTimeout(this.#scaleTimeoutId);\n this.#scaleTimeoutId = null;\n }\n if (!noUpdate) {\n this.update();\n }\n }\n}\n\nexport { PagesCountLimit, PDFPageViewBuffer, PDFViewer };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n\nimport {\n CursorTool,\n ScrollMode,\n SpreadMode,\n toggleCheckedBtn,\n toggleExpandedBtn,\n} from \"./ui_utils.js\";\nimport { PagesCountLimit } from \"./pdf_viewer.js\";\n\n/**\n * @typedef {Object} SecondaryToolbarOptions\n * @property {HTMLDivElement} toolbar - Container for the secondary toolbar.\n * @property {HTMLButtonElement} toggleButton - Button to toggle the visibility\n * of the secondary toolbar.\n * @property {HTMLButtonElement} presentationModeButton - Button for entering\n * presentation mode.\n * @property {HTMLButtonElement} openFileButton - Button to open a file.\n * @property {HTMLButtonElement} printButton - Button to print the document.\n * @property {HTMLButtonElement} downloadButton - Button to download the\n * document.\n * @property {HTMLAnchorElement} viewBookmarkButton - Button to obtain a\n * bookmark link to the current location in the document.\n * @property {HTMLButtonElement} firstPageButton - Button to go to the first\n * page in the document.\n * @property {HTMLButtonElement} lastPageButton - Button to go to the last page\n * in the document.\n * @property {HTMLButtonElement} pageRotateCwButton - Button to rotate the pages\n * clockwise.\n * @property {HTMLButtonElement} pageRotateCcwButton - Button to rotate the\n * pages counterclockwise.\n * @property {HTMLButtonElement} cursorSelectToolButton - Button to enable the\n * select tool.\n * @property {HTMLButtonElement} cursorHandToolButton - Button to enable the\n * hand tool.\n * @property {HTMLButtonElement} imageAltTextSettingsButton - Button for opening\n * the image alt-text settings dialog.\n * @property {HTMLButtonElement} documentPropertiesButton - Button for opening\n * the document properties dialog.\n */\n\nclass SecondaryToolbar {\n #opts;\n\n /**\n * @param {SecondaryToolbarOptions} options\n * @param {EventBus} eventBus\n */\n constructor(options, eventBus) {\n this.#opts = options;\n const buttons = [\n {\n element: options.presentationModeButton,\n eventName: \"presentationmode\",\n close: true,\n },\n { element: options.printButton, eventName: \"print\", close: true },\n { element: options.downloadButton, eventName: \"download\", close: true },\n { element: options.viewBookmarkButton, eventName: null, close: true },\n { element: options.firstPageButton, eventName: \"firstpage\", close: true },\n { element: options.lastPageButton, eventName: \"lastpage\", close: true },\n {\n element: options.pageRotateCwButton,\n eventName: \"rotatecw\",\n close: false,\n },\n {\n element: options.pageRotateCcwButton,\n eventName: \"rotateccw\",\n close: false,\n },\n {\n element: options.cursorSelectToolButton,\n eventName: \"switchcursortool\",\n eventDetails: { tool: CursorTool.SELECT },\n close: true,\n },\n {\n element: options.cursorHandToolButton,\n eventName: \"switchcursortool\",\n eventDetails: { tool: CursorTool.HAND },\n close: true,\n },\n {\n element: options.scrollPageButton,\n eventName: \"switchscrollmode\",\n eventDetails: { mode: ScrollMode.PAGE },\n close: true,\n },\n {\n element: options.scrollVerticalButton,\n eventName: \"switchscrollmode\",\n eventDetails: { mode: ScrollMode.VERTICAL },\n close: true,\n },\n {\n element: options.scrollHorizontalButton,\n eventName: \"switchscrollmode\",\n eventDetails: { mode: ScrollMode.HORIZONTAL },\n close: true,\n },\n {\n element: options.scrollWrappedButton,\n eventName: \"switchscrollmode\",\n eventDetails: { mode: ScrollMode.WRAPPED },\n close: true,\n },\n {\n element: options.spreadNoneButton,\n eventName: \"switchspreadmode\",\n eventDetails: { mode: SpreadMode.NONE },\n close: true,\n },\n {\n element: options.spreadOddButton,\n eventName: \"switchspreadmode\",\n eventDetails: { mode: SpreadMode.ODD },\n close: true,\n },\n {\n element: options.spreadEvenButton,\n eventName: \"switchspreadmode\",\n eventDetails: { mode: SpreadMode.EVEN },\n close: true,\n },\n {\n element: options.imageAltTextSettingsButton,\n eventName: \"imagealttextsettings\",\n close: true,\n },\n {\n element: options.documentPropertiesButton,\n eventName: \"documentproperties\",\n close: true,\n },\n ];\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n buttons.push({\n element: options.openFileButton,\n eventName: \"openfile\",\n close: true,\n });\n }\n\n this.eventBus = eventBus;\n this.opened = false;\n\n // Bind the event listeners for click, cursor tool, and scroll/spread mode\n // actions.\n this.#bindListeners(buttons);\n\n this.reset();\n }\n\n /**\n * @type {boolean}\n */\n get isOpen() {\n return this.opened;\n }\n\n setPageNumber(pageNumber) {\n this.pageNumber = pageNumber;\n this.#updateUIState();\n }\n\n setPagesCount(pagesCount) {\n this.pagesCount = pagesCount;\n this.#updateUIState();\n }\n\n reset() {\n this.pageNumber = 0;\n this.pagesCount = 0;\n this.#updateUIState();\n\n // Reset the Scroll/Spread buttons too, since they're document specific.\n this.eventBus.dispatch(\"switchcursortool\", { source: this, reset: true });\n this.#scrollModeChanged({ mode: ScrollMode.VERTICAL });\n this.#spreadModeChanged({ mode: SpreadMode.NONE });\n }\n\n #updateUIState() {\n const {\n firstPageButton,\n lastPageButton,\n pageRotateCwButton,\n pageRotateCcwButton,\n } = this.#opts;\n\n firstPageButton.disabled = this.pageNumber <= 1;\n lastPageButton.disabled = this.pageNumber >= this.pagesCount;\n pageRotateCwButton.disabled = this.pagesCount === 0;\n pageRotateCcwButton.disabled = this.pagesCount === 0;\n }\n\n #bindListeners(buttons) {\n const { eventBus } = this;\n const { toggleButton } = this.#opts;\n // Button to toggle the visibility of the secondary toolbar.\n toggleButton.addEventListener(\"click\", this.toggle.bind(this));\n\n // All items within the secondary toolbar.\n for (const { element, eventName, close, eventDetails } of buttons) {\n element.addEventListener(\"click\", evt => {\n if (eventName !== null) {\n eventBus.dispatch(eventName, { source: this, ...eventDetails });\n }\n if (close) {\n this.close();\n }\n eventBus.dispatch(\"reporttelemetry\", {\n source: this,\n details: {\n type: \"buttons\",\n data: { id: element.id },\n },\n });\n });\n }\n\n eventBus._on(\"cursortoolchanged\", this.#cursorToolChanged.bind(this));\n eventBus._on(\"scrollmodechanged\", this.#scrollModeChanged.bind(this));\n eventBus._on(\"spreadmodechanged\", this.#spreadModeChanged.bind(this));\n }\n\n #cursorToolChanged({ tool, disabled }) {\n const { cursorSelectToolButton, cursorHandToolButton } = this.#opts;\n\n toggleCheckedBtn(cursorSelectToolButton, tool === CursorTool.SELECT);\n toggleCheckedBtn(cursorHandToolButton, tool === CursorTool.HAND);\n\n cursorSelectToolButton.disabled = disabled;\n cursorHandToolButton.disabled = disabled;\n }\n\n #scrollModeChanged({ mode }) {\n const {\n scrollPageButton,\n scrollVerticalButton,\n scrollHorizontalButton,\n scrollWrappedButton,\n spreadNoneButton,\n spreadOddButton,\n spreadEvenButton,\n } = this.#opts;\n\n toggleCheckedBtn(scrollPageButton, mode === ScrollMode.PAGE);\n toggleCheckedBtn(scrollVerticalButton, mode === ScrollMode.VERTICAL);\n toggleCheckedBtn(scrollHorizontalButton, mode === ScrollMode.HORIZONTAL);\n toggleCheckedBtn(scrollWrappedButton, mode === ScrollMode.WRAPPED);\n\n // Permanently *disable* the Scroll buttons when PAGE-scrolling is being\n // enforced for *very* long/large documents; please see the `BaseViewer`.\n const forceScrollModePage =\n this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE;\n scrollPageButton.disabled = forceScrollModePage;\n scrollVerticalButton.disabled = forceScrollModePage;\n scrollHorizontalButton.disabled = forceScrollModePage;\n scrollWrappedButton.disabled = forceScrollModePage;\n\n // Temporarily *disable* the Spread buttons when horizontal scrolling is\n // enabled, since the non-default Spread modes doesn't affect the layout.\n const isHorizontal = mode === ScrollMode.HORIZONTAL;\n spreadNoneButton.disabled = isHorizontal;\n spreadOddButton.disabled = isHorizontal;\n spreadEvenButton.disabled = isHorizontal;\n }\n\n #spreadModeChanged({ mode }) {\n const { spreadNoneButton, spreadOddButton, spreadEvenButton } = this.#opts;\n\n toggleCheckedBtn(spreadNoneButton, mode === SpreadMode.NONE);\n toggleCheckedBtn(spreadOddButton, mode === SpreadMode.ODD);\n toggleCheckedBtn(spreadEvenButton, mode === SpreadMode.EVEN);\n }\n\n open() {\n if (this.opened) {\n return;\n }\n this.opened = true;\n\n const { toggleButton, toolbar } = this.#opts;\n toggleExpandedBtn(toggleButton, true, toolbar);\n }\n\n close() {\n if (!this.opened) {\n return;\n }\n this.opened = false;\n\n const { toggleButton, toolbar } = this.#opts;\n toggleExpandedBtn(toggleButton, false, toolbar);\n }\n\n toggle() {\n if (this.opened) {\n this.close();\n } else {\n this.open();\n }\n }\n}\n\nexport { SecondaryToolbar };\n","/* Copyright 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n\nimport { AnnotationEditorType, ColorPicker, noContextMenu } from \"pdfjs-lib\";\nimport {\n DEFAULT_SCALE,\n DEFAULT_SCALE_VALUE,\n MAX_SCALE,\n MIN_SCALE,\n toggleExpandedBtn,\n} from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} ToolbarOptions\n * @property {HTMLDivElement} container - Container for the secondary toolbar.\n * @property {HTMLSpanElement} numPages - Label that contains number of pages.\n * @property {HTMLInputElement} pageNumber - Control for display and user input\n * of the current page number.\n * @property {HTMLSelectElement} scaleSelect - Scale selection control.\n * Its width is adjusted, when necessary, on UI localization.\n * @property {HTMLOptionElement} customScaleOption - The item used to display\n * a non-predefined scale.\n * @property {HTMLButtonElement} previous - Button to go to the previous page.\n * @property {HTMLButtonElement} next - Button to go to the next page.\n * @property {HTMLButtonElement} zoomIn - Button to zoom in the pages.\n * @property {HTMLButtonElement} zoomOut - Button to zoom out the pages.\n * @property {HTMLButtonElement} editorFreeTextButton - Button to switch to\n * FreeText editing.\n * @property {HTMLButtonElement} download - Button to download the document.\n */\n\nclass Toolbar {\n #opts;\n\n /**\n * @param {ToolbarOptions} options\n * @param {EventBus} eventBus\n * @param {number} toolbarDensity - The toolbar density value.\n * The possible values are:\n * - 0 (default) - The regular toolbar size.\n * - 1 (compact) - The small toolbar size.\n * - 2 (touch) - The large toolbar size.\n */\n constructor(options, eventBus, toolbarDensity = 0) {\n this.#opts = options;\n this.eventBus = eventBus;\n const buttons = [\n { element: options.previous, eventName: \"previouspage\" },\n { element: options.next, eventName: \"nextpage\" },\n { element: options.zoomIn, eventName: \"zoomin\" },\n { element: options.zoomOut, eventName: \"zoomout\" },\n { element: options.print, eventName: \"print\" },\n { element: options.download, eventName: \"download\" },\n {\n element: options.editorFreeTextButton,\n eventName: \"switchannotationeditormode\",\n eventDetails: {\n get mode() {\n const { classList } = options.editorFreeTextButton;\n return classList.contains(\"toggled\")\n ? AnnotationEditorType.NONE\n : AnnotationEditorType.FREETEXT;\n },\n },\n },\n {\n element: options.editorHighlightButton,\n eventName: \"switchannotationeditormode\",\n eventDetails: {\n get mode() {\n const { classList } = options.editorHighlightButton;\n return classList.contains(\"toggled\")\n ? AnnotationEditorType.NONE\n : AnnotationEditorType.HIGHLIGHT;\n },\n },\n },\n {\n element: options.editorInkButton,\n eventName: \"switchannotationeditormode\",\n eventDetails: {\n get mode() {\n const { classList } = options.editorInkButton;\n return classList.contains(\"toggled\")\n ? AnnotationEditorType.NONE\n : AnnotationEditorType.INK;\n },\n },\n },\n {\n element: options.editorStampButton,\n eventName: \"switchannotationeditormode\",\n eventDetails: {\n get mode() {\n const { classList } = options.editorStampButton;\n return classList.contains(\"toggled\")\n ? AnnotationEditorType.NONE\n : AnnotationEditorType.STAMP;\n },\n },\n telemetry: {\n type: \"editing\",\n data: { action: \"pdfjs.image.icon_click\" },\n },\n },\n ];\n\n // Bind the event listeners for click and various other actions.\n this.#bindListeners(buttons);\n\n this.#updateToolbarDensity({ value: toolbarDensity });\n this.reset();\n }\n\n #updateToolbarDensity({ value }) {\n let name = \"normal\";\n switch (value) {\n case 1:\n name = \"compact\";\n break;\n case 2:\n name = \"touch\";\n break;\n }\n document.documentElement.setAttribute(\"data-toolbar-density\", name);\n }\n\n #setAnnotationEditorUIManager(uiManager, parentContainer) {\n const colorPicker = new ColorPicker({ uiManager });\n uiManager.setMainHighlightColorPicker(colorPicker);\n parentContainer.append(colorPicker.renderMainDropdown());\n }\n\n setPageNumber(pageNumber, pageLabel) {\n this.pageNumber = pageNumber;\n this.pageLabel = pageLabel;\n this.#updateUIState(false);\n }\n\n setPagesCount(pagesCount, hasPageLabels) {\n this.pagesCount = pagesCount;\n this.hasPageLabels = hasPageLabels;\n this.#updateUIState(true);\n }\n\n setPageScale(pageScaleValue, pageScale) {\n this.pageScaleValue = (pageScaleValue || pageScale).toString();\n this.pageScale = pageScale;\n this.#updateUIState(false);\n }\n\n reset() {\n this.pageNumber = 0;\n this.pageLabel = null;\n this.hasPageLabels = false;\n this.pagesCount = 0;\n this.pageScaleValue = DEFAULT_SCALE_VALUE;\n this.pageScale = DEFAULT_SCALE;\n this.#updateUIState(true);\n this.updateLoadingIndicatorState();\n\n // Reset the Editor buttons too, since they're document specific.\n this.#editorModeChanged({ mode: AnnotationEditorType.DISABLE });\n }\n\n #bindListeners(buttons) {\n const { eventBus } = this;\n const {\n editorHighlightColorPicker,\n editorHighlightButton,\n pageNumber,\n scaleSelect,\n } = this.#opts;\n const self = this;\n\n // The buttons within the toolbar.\n for (const { element, eventName, eventDetails, telemetry } of buttons) {\n element.addEventListener(\"click\", evt => {\n if (eventName !== null) {\n eventBus.dispatch(eventName, {\n source: this,\n ...eventDetails,\n // evt.detail is the number of clicks.\n isFromKeyboard: evt.detail === 0,\n });\n }\n if (telemetry) {\n eventBus.dispatch(\"reporttelemetry\", {\n source: this,\n details: telemetry,\n });\n }\n });\n }\n // The non-button elements within the toolbar.\n pageNumber.addEventListener(\"click\", function () {\n this.select();\n });\n pageNumber.addEventListener(\"change\", function () {\n eventBus.dispatch(\"pagenumberchanged\", {\n source: self,\n value: this.value,\n });\n });\n\n scaleSelect.addEventListener(\"change\", function () {\n if (this.value === \"custom\") {\n return;\n }\n eventBus.dispatch(\"scalechanged\", {\n source: self,\n value: this.value,\n });\n });\n // Here we depend on browsers dispatching the \"click\" event *after* the\n // \"change\" event, when the <select>-element changes.\n scaleSelect.addEventListener(\"click\", function ({ target }) {\n // Remove focus when an <option>-element was *clicked*, to improve the UX\n // for mouse users (fixes bug 1300525 and issue 4923).\n if (\n this.value === self.pageScaleValue &&\n target.tagName.toUpperCase() === \"OPTION\"\n ) {\n this.blur();\n }\n });\n // Suppress context menus for some controls.\n scaleSelect.oncontextmenu = noContextMenu;\n\n eventBus._on(\n \"annotationeditormodechanged\",\n this.#editorModeChanged.bind(this)\n );\n eventBus._on(\"showannotationeditorui\", ({ mode }) => {\n switch (mode) {\n case AnnotationEditorType.HIGHLIGHT:\n editorHighlightButton.click();\n break;\n }\n });\n eventBus._on(\"toolbardensity\", this.#updateToolbarDensity.bind(this));\n\n if (editorHighlightColorPicker) {\n eventBus._on(\n \"annotationeditoruimanager\",\n ({ uiManager }) => {\n this.#setAnnotationEditorUIManager(\n uiManager,\n editorHighlightColorPicker\n );\n },\n // Once the color picker has been added, we don't want to add it again.\n { once: true }\n );\n }\n }\n\n #editorModeChanged({ mode }) {\n const {\n editorFreeTextButton,\n editorFreeTextParamsToolbar,\n editorHighlightButton,\n editorHighlightParamsToolbar,\n editorInkButton,\n editorInkParamsToolbar,\n editorStampButton,\n editorStampParamsToolbar,\n } = this.#opts;\n\n toggleExpandedBtn(\n editorFreeTextButton,\n mode === AnnotationEditorType.FREETEXT,\n editorFreeTextParamsToolbar\n );\n toggleExpandedBtn(\n editorHighlightButton,\n mode === AnnotationEditorType.HIGHLIGHT,\n editorHighlightParamsToolbar\n );\n toggleExpandedBtn(\n editorInkButton,\n mode === AnnotationEditorType.INK,\n editorInkParamsToolbar\n );\n toggleExpandedBtn(\n editorStampButton,\n mode === AnnotationEditorType.STAMP,\n editorStampParamsToolbar\n );\n\n const isDisable = mode === AnnotationEditorType.DISABLE;\n editorFreeTextButton.disabled = isDisable;\n editorHighlightButton.disabled = isDisable;\n editorInkButton.disabled = isDisable;\n editorStampButton.disabled = isDisable;\n }\n\n #updateUIState(resetNumPages = false) {\n const { pageNumber, pagesCount, pageScaleValue, pageScale } = this;\n const opts = this.#opts;\n\n if (resetNumPages) {\n if (this.hasPageLabels) {\n opts.pageNumber.type = \"text\";\n\n opts.numPages.setAttribute(\"data-l10n-id\", \"pdfjs-page-of-pages\");\n } else {\n opts.pageNumber.type = \"number\";\n\n opts.numPages.setAttribute(\"data-l10n-id\", \"pdfjs-of-pages\");\n opts.numPages.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({ pagesCount })\n );\n }\n opts.pageNumber.max = pagesCount;\n }\n\n if (this.hasPageLabels) {\n opts.pageNumber.value = this.pageLabel;\n\n opts.numPages.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({ pageNumber, pagesCount })\n );\n } else {\n opts.pageNumber.value = pageNumber;\n }\n\n opts.previous.disabled = pageNumber <= 1;\n opts.next.disabled = pageNumber >= pagesCount;\n\n opts.zoomOut.disabled = pageScale <= MIN_SCALE;\n opts.zoomIn.disabled = pageScale >= MAX_SCALE;\n\n let predefinedValueFound = false;\n for (const option of opts.scaleSelect.options) {\n if (option.value !== pageScaleValue) {\n option.selected = false;\n continue;\n }\n option.selected = true;\n predefinedValueFound = true;\n }\n if (!predefinedValueFound) {\n opts.customScaleOption.selected = true;\n opts.customScaleOption.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({\n scale: Math.round(pageScale * 10000) / 100,\n })\n );\n }\n }\n\n updateLoadingIndicatorState(loading = false) {\n const { pageNumber } = this.#opts;\n pageNumber.classList.toggle(\"loading\", loading);\n }\n}\n\nexport { Toolbar };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20;\n\n/**\n * View History - This is a utility for saving various view parameters for\n * recently opened files.\n *\n * The way that the view parameters are stored depends on how PDF.js is built,\n * for 'gulp <flag>' the following cases exist:\n * - MOZCENTRAL - uses sessionStorage.\n * - GENERIC or CHROME - uses localStorage, if it is available.\n */\nclass ViewHistory {\n constructor(fingerprint, cacheSize = DEFAULT_VIEW_HISTORY_CACHE_SIZE) {\n this.fingerprint = fingerprint;\n this.cacheSize = cacheSize;\n\n this._initializedPromise = this._readFromStorage().then(databaseStr => {\n const database = JSON.parse(databaseStr || \"{}\");\n let index = -1;\n if (!Array.isArray(database.files)) {\n database.files = [];\n } else {\n while (database.files.length >= this.cacheSize) {\n database.files.shift();\n }\n\n for (let i = 0, ii = database.files.length; i < ii; i++) {\n const branch = database.files[i];\n if (branch.fingerprint === this.fingerprint) {\n index = i;\n break;\n }\n }\n }\n if (index === -1) {\n index = database.files.push({ fingerprint: this.fingerprint }) - 1;\n }\n this.file = database.files[index];\n this.database = database;\n });\n }\n\n async _writeToStorage() {\n const databaseStr = JSON.stringify(this.database);\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n sessionStorage.setItem(\"pdfjs.history\", databaseStr);\n return;\n }\n localStorage.setItem(\"pdfjs.history\", databaseStr);\n }\n\n async _readFromStorage() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n return sessionStorage.getItem(\"pdfjs.history\");\n }\n return localStorage.getItem(\"pdfjs.history\");\n }\n\n async set(name, val) {\n await this._initializedPromise;\n this.file[name] = val;\n return this._writeToStorage();\n }\n\n async setMultiple(properties) {\n await this._initializedPromise;\n for (const name in properties) {\n this.file[name] = properties[name];\n }\n return this._writeToStorage();\n }\n\n async get(name, defaultValue) {\n await this._initializedPromise;\n const val = this.file[name];\n return val !== undefined ? val : defaultValue;\n }\n\n async getMultiple(properties) {\n await this._initializedPromise;\n const values = Object.create(null);\n\n for (const name in properties) {\n const val = this.file[name];\n values[name] = val !== undefined ? val : properties[name];\n }\n return values;\n }\n}\n\nexport { ViewHistory };\n","/* Copyright 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.js\").IL10n} IL10n */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/api.js\").PDFDocumentProxy} PDFDocumentProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/api.js\").PDFDocumentLoadingTask} PDFDocumentLoadingTask */\n\nimport {\n animationStarted,\n apiPageLayoutToViewerModes,\n apiPageModeToSidebarView,\n AutoPrintRegExp,\n CursorTool,\n DEFAULT_SCALE_VALUE,\n getActiveOrFocusedElement,\n isValidRotation,\n isValidScrollMode,\n isValidSpreadMode,\n normalizeWheelEventDirection,\n parseQueryString,\n ProgressBar,\n RenderingStates,\n ScrollMode,\n SidebarView,\n SpreadMode,\n TextLayerMode,\n} from \"./ui_utils.js\";\nimport {\n AnnotationEditorType,\n build,\n FeatureTest,\n getDocument,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n GlobalWorkerOptions,\n InvalidPDFException,\n isDataScheme,\n isPdfFile,\n MissingPDFException,\n PDFWorker,\n shadow,\n UnexpectedResponseException,\n version,\n} from \"pdfjs-lib\";\nimport { AppOptions, OptionKind } from \"./app_options.js\";\nimport { EventBus, FirefoxEventBus } from \"./event_utils.js\";\nimport { ExternalServices, initCom, MLManager } from \"web-external_services\";\nimport {\n ImageAltTextSettings,\n NewAltTextManager,\n} from \"web-new_alt_text_manager\";\nimport { LinkTarget, PDFLinkService } from \"./pdf_link_service.js\";\nimport { AltTextManager } from \"web-alt_text_manager\";\nimport { AnnotationEditorParams } from \"web-annotation_editor_params\";\nimport { CaretBrowsingMode } from \"./caret_browsing.js\";\nimport { DownloadManager } from \"web-download_manager\";\nimport { OverlayManager } from \"./overlay_manager.js\";\nimport { PasswordPrompt } from \"./password_prompt.js\";\nimport { PDFAttachmentViewer } from \"web-pdf_attachment_viewer\";\nimport { PDFCursorTools } from \"web-pdf_cursor_tools\";\nimport { PDFDocumentProperties } from \"web-pdf_document_properties\";\nimport { PDFFindBar } from \"web-pdf_find_bar\";\nimport { PDFFindController } from \"./pdf_find_controller.js\";\nimport { PDFHistory } from \"./pdf_history.js\";\nimport { PDFLayerViewer } from \"web-pdf_layer_viewer\";\nimport { PDFOutlineViewer } from \"web-pdf_outline_viewer\";\nimport { PDFPresentationMode } from \"web-pdf_presentation_mode\";\nimport { PDFPrintServiceFactory } from \"web-print_service\";\nimport { PDFRenderingQueue } from \"./pdf_rendering_queue.js\";\nimport { PDFScriptingManager } from \"./pdf_scripting_manager.js\";\nimport { PDFSidebar } from \"web-pdf_sidebar\";\nimport { PDFThumbnailViewer } from \"web-pdf_thumbnail_viewer\";\nimport { PDFViewer } from \"./pdf_viewer.js\";\nimport { Preferences } from \"web-preferences\";\nimport { SecondaryToolbar } from \"web-secondary_toolbar\";\nimport { Toolbar } from \"web-toolbar\";\nimport { ViewHistory } from \"./view_history.js\";\n\nconst FORCE_PAGES_LOADED_TIMEOUT = 10000; // ms\n\nconst ViewOnLoad = {\n UNKNOWN: -1,\n PREVIOUS: 0, // Default value.\n INITIAL: 1,\n};\n\nconst PDFViewerApplication = {\n initialBookmark: document.location.hash.substring(1),\n _initializedCapability: {\n ...Promise.withResolvers(),\n settled: false,\n },\n appConfig: null,\n /** @type {PDFDocumentProxy} */\n pdfDocument: null,\n /** @type {PDFDocumentLoadingTask} */\n pdfLoadingTask: null,\n printService: null,\n /** @type {PDFViewer} */\n pdfViewer: null,\n /** @type {PDFThumbnailViewer} */\n pdfThumbnailViewer: null,\n /** @type {PDFRenderingQueue} */\n pdfRenderingQueue: null,\n /** @type {PDFPresentationMode} */\n pdfPresentationMode: null,\n /** @type {PDFDocumentProperties} */\n pdfDocumentProperties: null,\n /** @type {PDFLinkService} */\n pdfLinkService: null,\n /** @type {PDFHistory} */\n pdfHistory: null,\n /** @type {PDFSidebar} */\n pdfSidebar: null,\n /** @type {PDFOutlineViewer} */\n pdfOutlineViewer: null,\n /** @type {PDFAttachmentViewer} */\n pdfAttachmentViewer: null,\n /** @type {PDFLayerViewer} */\n pdfLayerViewer: null,\n /** @type {PDFCursorTools} */\n pdfCursorTools: null,\n /** @type {PDFScriptingManager} */\n pdfScriptingManager: null,\n /** @type {ViewHistory} */\n store: null,\n /** @type {DownloadManager} */\n downloadManager: null,\n /** @type {OverlayManager} */\n overlayManager: null,\n /** @type {Preferences} */\n preferences: new Preferences(),\n /** @type {Toolbar} */\n toolbar: null,\n /** @type {SecondaryToolbar} */\n secondaryToolbar: null,\n /** @type {EventBus} */\n eventBus: null,\n /** @type {IL10n} */\n l10n: null,\n /** @type {AnnotationEditorParams} */\n annotationEditorParams: null,\n /** @type {ImageAltTextSettings} */\n imageAltTextSettings: null,\n isInitialViewSet: false,\n isViewerEmbedded: window.parent !== window,\n url: \"\",\n baseUrl: \"\",\n mlManager: null,\n _downloadUrl: \"\",\n _eventBusAbortController: null,\n _windowAbortController: null,\n _globalAbortController: new AbortController(),\n documentInfo: null,\n metadata: null,\n _contentDispositionFilename: null,\n _contentLength: null,\n _saveInProgress: false,\n _wheelUnusedTicks: 0,\n _wheelUnusedFactor: 1,\n _touchUnusedTicks: 0,\n _touchUnusedFactor: 1,\n _PDFBug: null,\n _hasAnnotationEditors: false,\n _title: document.title,\n _printAnnotationStoragePromise: null,\n _touchInfo: null,\n _isCtrlKeyDown: false,\n _caretBrowsing: null,\n _isScrolling: false,\n\n // Called once when the document is loaded.\n async initialize(appConfig) {\n this.appConfig = appConfig;\n\n // Ensure that `Preferences`, and indirectly `AppOptions`, have initialized\n // before creating e.g. the various viewer components.\n try {\n await this.preferences.initializedPromise;\n } catch (ex) {\n console.error(`initialize: \"${ex.message}\".`);\n }\n if (AppOptions.get(\"pdfBugEnabled\")) {\n await this._parseHashParams();\n }\n\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n let mode;\n switch (AppOptions.get(\"viewerCssTheme\")) {\n case 1:\n mode = \"is-light\";\n break;\n case 2:\n mode = \"is-dark\";\n break;\n }\n if (mode) {\n document.documentElement.classList.add(mode);\n }\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n if (AppOptions.get(\"enableFakeMLManager\")) {\n this.mlManager =\n MLManager.getFakeMLManager?.({\n enableGuessAltText: AppOptions.get(\"enableGuessAltText\"),\n enableAltTextModelDownload: AppOptions.get(\n \"enableAltTextModelDownload\"\n ),\n }) || null;\n }\n }\n } else if (AppOptions.get(\"enableAltText\")) {\n // We want to load the image-to-text AI engine as soon as possible.\n this.mlManager = new MLManager({\n enableGuessAltText: AppOptions.get(\"enableGuessAltText\"),\n enableAltTextModelDownload: AppOptions.get(\n \"enableAltTextModelDownload\"\n ),\n altTextLearnMoreUrl: AppOptions.get(\"altTextLearnMoreUrl\"),\n });\n }\n\n // Ensure that the `L10n`-instance has been initialized before creating\n // e.g. the various viewer components.\n this.l10n = await this.externalServices.createL10n();\n document.getElementsByTagName(\"html\")[0].dir = this.l10n.getDirection();\n // Connect Fluent, when necessary, and translate what we already have.\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n this.l10n.translate(appConfig.appContainer || document.documentElement);\n }\n\n if (\n this.isViewerEmbedded &&\n AppOptions.get(\"externalLinkTarget\") === LinkTarget.NONE\n ) {\n // Prevent external links from \"replacing\" the viewer,\n // when it's embedded in e.g. an <iframe> or an <object>.\n AppOptions.set(\"externalLinkTarget\", LinkTarget.TOP);\n }\n await this._initializeViewerComponents();\n\n // Bind the various event handlers *after* the viewer has been\n // initialized, to prevent errors if an event arrives too soon.\n this.bindEvents();\n this.bindWindowEvents();\n\n this._initializedCapability.settled = true;\n this._initializedCapability.resolve();\n },\n\n /**\n * Potentially parse special debugging flags in the hash section of the URL.\n * @private\n */\n async _parseHashParams() {\n const hash = document.location.hash.substring(1);\n if (!hash) {\n return;\n }\n const { mainContainer, viewerContainer } = this.appConfig,\n params = parseQueryString(hash);\n\n const loadPDFBug = async () => {\n if (this._PDFBug) {\n return;\n }\n const { PDFBug } =\n typeof PDFJSDev === \"undefined\"\n ? await import(AppOptions.get(\"debuggerSrc\")) // eslint-disable-line no-unsanitized/method\n : await __non_webpack_import__(AppOptions.get(\"debuggerSrc\"));\n\n this._PDFBug = PDFBug;\n };\n\n // Parameters that need to be handled manually.\n if (params.get(\"disableworker\") === \"true\") {\n try {\n GlobalWorkerOptions.workerSrc ||= AppOptions.get(\"workerSrc\");\n\n if (typeof PDFJSDev === \"undefined\") {\n globalThis.pdfjsWorker = await import(\"pdfjs/pdf.worker.js\");\n } else {\n await __non_webpack_import__(PDFWorker.workerSrc);\n }\n } catch (ex) {\n console.error(`_parseHashParams: \"${ex.message}\".`);\n }\n }\n if (params.has(\"textlayer\")) {\n switch (params.get(\"textlayer\")) {\n case \"off\":\n AppOptions.set(\"textLayerMode\", TextLayerMode.DISABLE);\n break;\n case \"visible\":\n case \"shadow\":\n case \"hover\":\n viewerContainer.classList.add(`textLayer-${params.get(\"textlayer\")}`);\n try {\n await loadPDFBug();\n this._PDFBug.loadCSS();\n } catch (ex) {\n console.error(`_parseHashParams: \"${ex.message}\".`);\n }\n break;\n }\n }\n if (params.has(\"pdfbug\")) {\n AppOptions.setAll({ pdfBug: true, fontExtraProperties: true });\n\n const enabled = params.get(\"pdfbug\").split(\",\");\n try {\n await loadPDFBug();\n this._PDFBug.init(mainContainer, enabled);\n } catch (ex) {\n console.error(`_parseHashParams: \"${ex.message}\".`);\n }\n }\n // It is not possible to change locale for the (various) extension builds.\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n params.has(\"locale\")\n ) {\n AppOptions.set(\"localeProperties\", { lang: params.get(\"locale\") });\n }\n\n // Parameters that can be handled automatically.\n const opts = {\n disableAutoFetch: x => x === \"true\",\n disableFontFace: x => x === \"true\",\n disableHistory: x => x === \"true\",\n disableRange: x => x === \"true\",\n disableStream: x => x === \"true\",\n verbosity: x => x | 0,\n };\n\n // Set some specific preferences for tests.\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n Object.assign(opts, {\n enableAltText: x => x === \"true\",\n enableFakeMLManager: x => x === \"true\",\n enableGuessAltText: x => x === \"true\",\n enableUpdatedAddImage: x => x === \"true\",\n highlightEditorColors: x => x,\n maxCanvasPixels: x => parseInt(x),\n spreadModeOnLoad: x => parseInt(x),\n supportsCaretBrowsingMode: x => x === \"true\",\n });\n }\n\n for (const name in opts) {\n const check = opts[name],\n key = name.toLowerCase();\n\n if (params.has(key)) {\n AppOptions.set(name, check(params.get(key)));\n }\n }\n },\n\n /**\n * @private\n */\n async _initializeViewerComponents() {\n const { appConfig, externalServices, l10n } = this;\n\n const eventBus =\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n ? new FirefoxEventBus(\n AppOptions.get(\"allowedGlobalEvents\"),\n externalServices,\n AppOptions.get(\"isInAutomation\")\n )\n : new EventBus();\n this.eventBus = AppOptions.eventBus = eventBus;\n this.mlManager?.setEventBus(eventBus, this._globalAbortController.signal);\n\n this.overlayManager = new OverlayManager();\n\n const pdfRenderingQueue = new PDFRenderingQueue();\n pdfRenderingQueue.onIdle = this._cleanup.bind(this);\n this.pdfRenderingQueue = pdfRenderingQueue;\n\n const pdfLinkService = new PDFLinkService({\n eventBus,\n externalLinkTarget: AppOptions.get(\"externalLinkTarget\"),\n externalLinkRel: AppOptions.get(\"externalLinkRel\"),\n ignoreDestinationZoom: AppOptions.get(\"ignoreDestinationZoom\"),\n });\n this.pdfLinkService = pdfLinkService;\n\n const downloadManager = (this.downloadManager = new DownloadManager());\n\n const findController = new PDFFindController({\n linkService: pdfLinkService,\n eventBus,\n updateMatchesCountOnProgress:\n typeof PDFJSDev === \"undefined\"\n ? !window.isGECKOVIEW\n : !PDFJSDev.test(\"GECKOVIEW\"),\n });\n this.findController = findController;\n\n const pdfScriptingManager = new PDFScriptingManager({\n eventBus,\n externalServices,\n docProperties: this._scriptingDocProperties.bind(this),\n });\n this.pdfScriptingManager = pdfScriptingManager;\n\n const container = appConfig.mainContainer,\n viewer = appConfig.viewerContainer;\n const annotationEditorMode = AppOptions.get(\"annotationEditorMode\");\n const pageColors =\n AppOptions.get(\"forcePageColors\") ||\n window.matchMedia(\"(forced-colors: active)\").matches\n ? {\n background: AppOptions.get(\"pageColorsBackground\"),\n foreground: AppOptions.get(\"pageColorsForeground\"),\n }\n : null;\n let altTextManager;\n if (AppOptions.get(\"enableUpdatedAddImage\")) {\n altTextManager = appConfig.newAltTextDialog\n ? new NewAltTextManager(\n appConfig.newAltTextDialog,\n this.overlayManager,\n eventBus\n )\n : null;\n } else {\n altTextManager = appConfig.altTextDialog\n ? new AltTextManager(\n appConfig.altTextDialog,\n container,\n this.overlayManager,\n eventBus\n )\n : null;\n }\n\n const enableHWA = AppOptions.get(\"enableHWA\");\n const pdfViewer = new PDFViewer({\n container,\n viewer,\n eventBus,\n renderingQueue: pdfRenderingQueue,\n linkService: pdfLinkService,\n downloadManager,\n altTextManager,\n findController,\n scriptingManager:\n AppOptions.get(\"enableScripting\") && pdfScriptingManager,\n l10n,\n textLayerMode: AppOptions.get(\"textLayerMode\"),\n annotationMode: AppOptions.get(\"annotationMode\"),\n annotationEditorMode,\n annotationEditorHighlightColors: AppOptions.get(\"highlightEditorColors\"),\n enableHighlightFloatingButton: AppOptions.get(\n \"enableHighlightFloatingButton\"\n ),\n enableUpdatedAddImage: AppOptions.get(\"enableUpdatedAddImage\"),\n enableNewAltTextWhenAddingImage: AppOptions.get(\n \"enableNewAltTextWhenAddingImage\"\n ),\n imageResourcesPath: AppOptions.get(\"imageResourcesPath\"),\n enablePrintAutoRotate: AppOptions.get(\"enablePrintAutoRotate\"),\n maxCanvasPixels: AppOptions.get(\"maxCanvasPixels\"),\n enablePermissions: AppOptions.get(\"enablePermissions\"),\n pageColors,\n mlManager: this.mlManager,\n abortSignal: this._globalAbortController.signal,\n enableHWA,\n });\n this.pdfViewer = pdfViewer;\n\n pdfRenderingQueue.setViewer(pdfViewer);\n pdfLinkService.setViewer(pdfViewer);\n pdfScriptingManager.setViewer(pdfViewer);\n\n if (appConfig.sidebar?.thumbnailView) {\n this.pdfThumbnailViewer = new PDFThumbnailViewer({\n container: appConfig.sidebar.thumbnailView,\n eventBus,\n renderingQueue: pdfRenderingQueue,\n linkService: pdfLinkService,\n pageColors,\n abortSignal: this._globalAbortController.signal,\n enableHWA,\n });\n pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);\n }\n\n // The browsing history is only enabled when the viewer is standalone,\n // i.e. not when it is embedded in a web page.\n if (!this.isViewerEmbedded && !AppOptions.get(\"disableHistory\")) {\n this.pdfHistory = new PDFHistory({\n linkService: pdfLinkService,\n eventBus,\n });\n pdfLinkService.setHistory(this.pdfHistory);\n }\n\n if (!this.supportsIntegratedFind && appConfig.findBar) {\n this.findBar = new PDFFindBar(\n appConfig.findBar,\n appConfig.principalContainer,\n eventBus\n );\n }\n\n if (appConfig.annotationEditorParams) {\n if (\n ((typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) ||\n typeof AbortSignal.any === \"function\") &&\n annotationEditorMode !== AnnotationEditorType.DISABLE\n ) {\n this.annotationEditorParams = new AnnotationEditorParams(\n appConfig.annotationEditorParams,\n eventBus\n );\n } else {\n for (const id of [\"editorModeButtons\", \"editorModeSeparator\"]) {\n document.getElementById(id)?.classList.add(\"hidden\");\n }\n }\n }\n\n if (\n this.mlManager &&\n appConfig.secondaryToolbar?.imageAltTextSettingsButton\n ) {\n this.imageAltTextSettings = new ImageAltTextSettings(\n appConfig.altTextSettingsDialog,\n this.overlayManager,\n eventBus,\n this.mlManager\n );\n }\n\n if (appConfig.documentProperties) {\n this.pdfDocumentProperties = new PDFDocumentProperties(\n appConfig.documentProperties,\n this.overlayManager,\n eventBus,\n l10n,\n /* fileNameLookup = */ () => this._docFilename\n );\n }\n\n // NOTE: The cursor-tools are unlikely to be helpful/useful in GeckoView,\n // in particular the `HandTool` which basically simulates touch scrolling.\n if (appConfig.secondaryToolbar?.cursorHandToolButton) {\n this.pdfCursorTools = new PDFCursorTools({\n container,\n eventBus,\n cursorToolOnLoad: AppOptions.get(\"cursorToolOnLoad\"),\n });\n }\n\n if (appConfig.toolbar) {\n if (\n typeof PDFJSDev === \"undefined\"\n ? window.isGECKOVIEW\n : PDFJSDev.test(\"GECKOVIEW\")\n ) {\n const nimbusData = JSON.parse(\n AppOptions.get(\"nimbusDataStr\") || \"null\"\n );\n this.toolbar = new Toolbar(appConfig.toolbar, eventBus, nimbusData);\n } else {\n this.toolbar = new Toolbar(\n appConfig.toolbar,\n eventBus,\n AppOptions.get(\"toolbarDensity\")\n );\n }\n }\n\n if (appConfig.secondaryToolbar) {\n if (AppOptions.get(\"enableAltText\")) {\n appConfig.secondaryToolbar.imageAltTextSettingsButton?.classList.remove(\n \"hidden\"\n );\n appConfig.secondaryToolbar.imageAltTextSettingsSeparator?.classList.remove(\n \"hidden\"\n );\n }\n\n this.secondaryToolbar = new SecondaryToolbar(\n appConfig.secondaryToolbar,\n eventBus\n );\n }\n\n if (\n this.supportsFullscreen &&\n appConfig.secondaryToolbar?.presentationModeButton\n ) {\n this.pdfPresentationMode = new PDFPresentationMode({\n container,\n pdfViewer,\n eventBus,\n });\n }\n\n if (appConfig.passwordOverlay) {\n this.passwordPrompt = new PasswordPrompt(\n appConfig.passwordOverlay,\n this.overlayManager,\n this.isViewerEmbedded\n );\n }\n\n if (appConfig.sidebar?.outlineView) {\n this.pdfOutlineViewer = new PDFOutlineViewer({\n container: appConfig.sidebar.outlineView,\n eventBus,\n l10n,\n linkService: pdfLinkService,\n downloadManager,\n });\n }\n\n if (appConfig.sidebar?.attachmentsView) {\n this.pdfAttachmentViewer = new PDFAttachmentViewer({\n container: appConfig.sidebar.attachmentsView,\n eventBus,\n l10n,\n downloadManager,\n });\n }\n\n if (appConfig.sidebar?.layersView) {\n this.pdfLayerViewer = new PDFLayerViewer({\n container: appConfig.sidebar.layersView,\n eventBus,\n l10n,\n });\n }\n\n if (appConfig.sidebar) {\n this.pdfSidebar = new PDFSidebar({\n elements: appConfig.sidebar,\n eventBus,\n l10n,\n });\n this.pdfSidebar.onToggled = this.forceRendering.bind(this);\n this.pdfSidebar.onUpdateThumbnails = () => {\n // Use the rendered pages to set the corresponding thumbnail images.\n for (const pageView of pdfViewer.getCachedPageViews()) {\n if (pageView.renderingState === RenderingStates.FINISHED) {\n this.pdfThumbnailViewer\n .getThumbnail(pageView.id - 1)\n ?.setImage(pageView);\n }\n }\n this.pdfThumbnailViewer.scrollThumbnailIntoView(\n pdfViewer.currentPageNumber\n );\n };\n }\n },\n\n async run(config) {\n await this.initialize(config);\n\n const { appConfig, eventBus } = this;\n let file;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n const queryString = document.location.search.substring(1);\n const params = parseQueryString(queryString);\n file = params.get(\"file\") ?? AppOptions.get(\"defaultUrl\");\n validateFileURL(file);\n } else if (PDFJSDev.test(\"MOZCENTRAL\")) {\n file = window.location.href;\n } else if (PDFJSDev.test(\"CHROME\")) {\n file = AppOptions.get(\"defaultUrl\");\n }\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n const fileInput = (this._openFileInput = document.createElement(\"input\"));\n fileInput.id = \"fileInput\";\n fileInput.hidden = true;\n fileInput.type = \"file\";\n fileInput.value = null;\n document.body.append(fileInput);\n\n fileInput.addEventListener(\"change\", function (evt) {\n const { files } = evt.target;\n if (!files || files.length === 0) {\n return;\n }\n eventBus.dispatch(\"fileinputchange\", {\n source: this,\n fileInput: evt.target,\n });\n });\n\n // Enable dragging-and-dropping a new PDF file onto the viewerContainer.\n appConfig.mainContainer.addEventListener(\"dragover\", function (evt) {\n for (const item of evt.dataTransfer.items) {\n if (item.type === \"application/pdf\") {\n evt.dataTransfer.dropEffect =\n evt.dataTransfer.effectAllowed === \"copy\" ? \"copy\" : \"move\";\n evt.preventDefault();\n evt.stopPropagation();\n return;\n }\n }\n });\n appConfig.mainContainer.addEventListener(\"drop\", function (evt) {\n if (evt.dataTransfer.files?.[0].type !== \"application/pdf\") {\n return;\n }\n evt.preventDefault();\n evt.stopPropagation();\n eventBus.dispatch(\"fileinputchange\", {\n source: this,\n fileInput: evt.dataTransfer,\n });\n });\n }\n\n if (!AppOptions.get(\"supportsDocumentFonts\")) {\n AppOptions.set(\"disableFontFace\", true);\n this.l10n.get(\"pdfjs-web-fonts-disabled\").then(msg => {\n console.warn(msg);\n });\n }\n\n if (!this.supportsPrinting) {\n appConfig.toolbar?.print?.classList.add(\"hidden\");\n appConfig.secondaryToolbar?.printButton.classList.add(\"hidden\");\n }\n\n if (!this.supportsFullscreen) {\n appConfig.secondaryToolbar?.presentationModeButton.classList.add(\n \"hidden\"\n );\n }\n\n if (this.supportsIntegratedFind) {\n appConfig.findBar?.toggleButton?.classList.add(\"hidden\");\n }\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n if (file) {\n this.open({ url: file });\n } else {\n this._hideViewBookmark();\n }\n } else if (PDFJSDev.test(\"MOZCENTRAL || CHROME\")) {\n this.setTitleUsingUrl(file, /* downloadUrl = */ file);\n\n this.externalServices.initPassiveLoading();\n } else {\n throw new Error(\"Not implemented: run\");\n }\n },\n\n get externalServices() {\n return shadow(this, \"externalServices\", new ExternalServices());\n },\n\n get initialized() {\n return this._initializedCapability.settled;\n },\n\n get initializedPromise() {\n return this._initializedCapability.promise;\n },\n\n updateZoom(steps, scaleFactor, origin) {\n if (this.pdfViewer.isInPresentationMode) {\n return;\n }\n this.pdfViewer.updateScale({\n drawingDelay: AppOptions.get(\"defaultZoomDelay\"),\n steps,\n scaleFactor,\n origin,\n });\n },\n\n zoomIn() {\n this.updateZoom(1);\n },\n\n zoomOut() {\n this.updateZoom(-1);\n },\n\n zoomReset() {\n if (this.pdfViewer.isInPresentationMode) {\n return;\n }\n this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;\n },\n\n get pagesCount() {\n return this.pdfDocument ? this.pdfDocument.numPages : 0;\n },\n\n get page() {\n return this.pdfViewer.currentPageNumber;\n },\n\n set page(val) {\n this.pdfViewer.currentPageNumber = val;\n },\n\n get supportsPrinting() {\n return PDFPrintServiceFactory.supportsPrinting;\n },\n\n get supportsFullscreen() {\n return shadow(this, \"supportsFullscreen\", document.fullscreenEnabled);\n },\n\n get supportsPinchToZoom() {\n return shadow(\n this,\n \"supportsPinchToZoom\",\n AppOptions.get(\"supportsPinchToZoom\")\n );\n },\n\n get supportsIntegratedFind() {\n return shadow(\n this,\n \"supportsIntegratedFind\",\n AppOptions.get(\"supportsIntegratedFind\")\n );\n },\n\n get loadingBar() {\n const barElement = document.getElementById(\"loadingBar\");\n const bar = barElement ? new ProgressBar(barElement) : null;\n return shadow(this, \"loadingBar\", bar);\n },\n\n get supportsMouseWheelZoomCtrlKey() {\n return shadow(\n this,\n \"supportsMouseWheelZoomCtrlKey\",\n AppOptions.get(\"supportsMouseWheelZoomCtrlKey\")\n );\n },\n\n get supportsMouseWheelZoomMetaKey() {\n return shadow(\n this,\n \"supportsMouseWheelZoomMetaKey\",\n AppOptions.get(\"supportsMouseWheelZoomMetaKey\")\n );\n },\n\n get supportsCaretBrowsingMode() {\n return AppOptions.get(\"supportsCaretBrowsingMode\");\n },\n\n moveCaret(isUp, select) {\n this._caretBrowsing ||= new CaretBrowsingMode(\n this._globalAbortController.signal,\n this.appConfig.mainContainer,\n this.appConfig.viewerContainer,\n this.appConfig.toolbar?.container\n );\n this._caretBrowsing.moveCaret(isUp, select);\n },\n\n setTitleUsingUrl(url = \"\", downloadUrl = null) {\n this.url = url;\n this.baseUrl = url.split(\"#\", 1)[0];\n if (downloadUrl) {\n this._downloadUrl =\n downloadUrl === url ? this.baseUrl : downloadUrl.split(\"#\", 1)[0];\n }\n if (isDataScheme(url)) {\n this._hideViewBookmark();\n } else if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"MOZCENTRAL || CHROME\")\n ) {\n AppOptions.set(\"docBaseUrl\", this.baseUrl);\n }\n\n let title = getPdfFilenameFromUrl(url, \"\");\n if (!title) {\n try {\n title = decodeURIComponent(getFilenameFromUrl(url));\n } catch {\n // decodeURIComponent may throw URIError.\n }\n }\n this.setTitle(title || url); // Always fallback to the raw URL.\n },\n\n setTitle(title = this._title) {\n this._title = title;\n\n if (this.isViewerEmbedded) {\n // Embedded PDF viewers should not be changing their parent page's title.\n return;\n }\n const editorIndicator =\n this._hasAnnotationEditors && !this.pdfRenderingQueue.printing;\n document.title = `${editorIndicator ? \"* \" : \"\"}${title}`;\n },\n\n get _docFilename() {\n // Use `this.url` instead of `this.baseUrl` to perform filename detection\n // based on the reference fragment as ultimate fallback if needed.\n return this._contentDispositionFilename || getPdfFilenameFromUrl(this.url);\n },\n\n /**\n * @private\n */\n _hideViewBookmark() {\n const { secondaryToolbar } = this.appConfig;\n // URL does not reflect proper document location - hiding some buttons.\n secondaryToolbar?.viewBookmarkButton.classList.add(\"hidden\");\n\n // Avoid displaying multiple consecutive separators in the secondaryToolbar.\n if (secondaryToolbar?.presentationModeButton.classList.contains(\"hidden\")) {\n document.getElementById(\"viewBookmarkSeparator\")?.classList.add(\"hidden\");\n }\n },\n\n /**\n * Closes opened PDF document.\n * @returns {Promise} - Returns the promise, which is resolved when all\n * destruction is completed.\n */\n async close() {\n this._unblockDocumentLoadEvent();\n this._hideViewBookmark();\n\n if (!this.pdfLoadingTask) {\n return;\n }\n if (\n (typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"GENERIC && !TESTING\")) &&\n this.pdfDocument?.annotationStorage.size > 0 &&\n this._annotationStorageModified\n ) {\n try {\n // Trigger saving, to prevent data loss in forms; see issue 12257.\n await this.save();\n } catch {\n // Ignoring errors, to ensure that document closing won't break.\n }\n }\n const promises = [];\n\n promises.push(this.pdfLoadingTask.destroy());\n this.pdfLoadingTask = null;\n\n if (this.pdfDocument) {\n this.pdfDocument = null;\n\n this.pdfThumbnailViewer?.setDocument(null);\n this.pdfViewer.setDocument(null);\n this.pdfLinkService.setDocument(null);\n this.pdfDocumentProperties?.setDocument(null);\n }\n this.pdfLinkService.externalLinkEnabled = true;\n this.store = null;\n this.isInitialViewSet = false;\n this.url = \"\";\n this.baseUrl = \"\";\n this._downloadUrl = \"\";\n this.documentInfo = null;\n this.metadata = null;\n this._contentDispositionFilename = null;\n this._contentLength = null;\n this._saveInProgress = false;\n this._hasAnnotationEditors = false;\n\n promises.push(\n this.pdfScriptingManager.destroyPromise,\n this.passwordPrompt.close()\n );\n\n this.setTitle();\n this.pdfSidebar?.reset();\n this.pdfOutlineViewer?.reset();\n this.pdfAttachmentViewer?.reset();\n this.pdfLayerViewer?.reset();\n\n this.pdfHistory?.reset();\n this.findBar?.reset();\n this.toolbar?.reset();\n this.secondaryToolbar?.reset();\n this._PDFBug?.cleanup();\n\n await Promise.all(promises);\n },\n\n /**\n * Opens a new PDF document.\n * @param {Object} args - Accepts any/all of the properties from\n * {@link DocumentInitParameters}, and also a `originalUrl` string.\n * @returns {Promise} - Promise that is resolved when the document is opened.\n */\n async open(args) {\n if (this.pdfLoadingTask) {\n // We need to destroy already opened document.\n await this.close();\n }\n // Set the necessary global worker parameters, using the available options.\n const workerParams = AppOptions.getAll(OptionKind.WORKER);\n Object.assign(GlobalWorkerOptions, workerParams);\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n if (args.data && isPdfFile(args.filename)) {\n this._contentDispositionFilename = args.filename;\n }\n } else if (args.url) {\n // The Firefox built-in viewer always calls `setTitleUsingUrl`, before\n // `initPassiveLoading`, and it never provides an `originalUrl` here.\n this.setTitleUsingUrl(\n args.originalUrl || args.url,\n /* downloadUrl = */ args.url\n );\n }\n\n // Set the necessary API parameters, using all the available options.\n const apiParams = AppOptions.getAll(OptionKind.API);\n const loadingTask = getDocument({\n ...apiParams,\n ...args,\n });\n this.pdfLoadingTask = loadingTask;\n\n loadingTask.onPassword = (updateCallback, reason) => {\n if (this.isViewerEmbedded) {\n // The load event can't be triggered until the password is entered, so\n // if the viewer is in an iframe and its visibility depends on the\n // onload callback then the viewer never shows (bug 1801341).\n this._unblockDocumentLoadEvent();\n }\n\n this.pdfLinkService.externalLinkEnabled = false;\n this.passwordPrompt.setUpdateCallback(updateCallback, reason);\n this.passwordPrompt.open();\n };\n\n loadingTask.onProgress = ({ loaded, total }) => {\n this.progress(loaded / total);\n };\n\n return loadingTask.promise.then(\n pdfDocument => {\n this.load(pdfDocument);\n },\n reason => {\n if (loadingTask !== this.pdfLoadingTask) {\n return undefined; // Ignore errors for previously opened PDF files.\n }\n\n let key = \"pdfjs-loading-error\";\n if (reason instanceof InvalidPDFException) {\n key = \"pdfjs-invalid-file-error\";\n } else if (reason instanceof MissingPDFException) {\n key = \"pdfjs-missing-file-error\";\n } else if (reason instanceof UnexpectedResponseException) {\n key = \"pdfjs-unexpected-response-error\";\n }\n return this._documentError(key, { message: reason.message }).then(\n () => {\n throw reason;\n }\n );\n }\n );\n },\n\n async download() {\n let data;\n try {\n data = await this.pdfDocument.getData();\n } catch {\n // When the PDF document isn't ready, simply download using the URL.\n }\n this.downloadManager.download(data, this._downloadUrl, this._docFilename);\n },\n\n async save() {\n if (this._saveInProgress) {\n return;\n }\n this._saveInProgress = true;\n await this.pdfScriptingManager.dispatchWillSave();\n\n try {\n const data = await this.pdfDocument.saveDocument();\n this.downloadManager.download(data, this._downloadUrl, this._docFilename);\n } catch (reason) {\n // When the PDF document isn't ready, fallback to a \"regular\" download.\n console.error(`Error when saving the document: ${reason.message}`);\n await this.download();\n } finally {\n await this.pdfScriptingManager.dispatchDidSave();\n this._saveInProgress = false;\n }\n\n if (this._hasAnnotationEditors) {\n this.externalServices.reportTelemetry({\n type: \"editing\",\n data: {\n type: \"save\",\n stats: this.pdfDocument?.annotationStorage.editorStats,\n },\n });\n }\n },\n\n async downloadOrSave() {\n // In the Firefox case, this method MUST always trigger a download.\n // When the user is closing a modified and unsaved document, we display a\n // prompt asking for saving or not. In case they save, we must wait for\n // saving to complete before closing the tab.\n // So in case this function does not trigger a download, we must trigger a\n // a message and change PdfjsChild.sys.mjs to take it into account.\n const { classList } = this.appConfig.appContainer;\n classList.add(\"wait\");\n await (this.pdfDocument?.annotationStorage.size > 0\n ? this.save()\n : this.download());\n classList.remove(\"wait\");\n },\n\n /**\n * Report the error; used for errors affecting loading and/or parsing of\n * the entire PDF document.\n */\n async _documentError(key, moreInfo = null) {\n this._unblockDocumentLoadEvent();\n\n const message = await this._otherError(\n key || \"pdfjs-loading-error\",\n moreInfo\n );\n\n this.eventBus.dispatch(\"documenterror\", {\n source: this,\n message,\n reason: moreInfo?.message ?? null,\n });\n },\n\n /**\n * Report the error; used for errors affecting e.g. only a single page.\n * @param {string} key - The localization key for the error.\n * @param {Object} [moreInfo] - Further information about the error that is\n * more technical. Should have a 'message' and\n * optionally a 'stack' property.\n * @returns {string} A (localized) error message that is human readable.\n */\n async _otherError(key, moreInfo = null) {\n const message = await this.l10n.get(key);\n\n const moreInfoText = [`PDF.js v${version || \"?\"} (build: ${build || \"?\"})`];\n if (moreInfo) {\n moreInfoText.push(`Message: ${moreInfo.message}`);\n\n if (moreInfo.stack) {\n moreInfoText.push(`Stack: ${moreInfo.stack}`);\n } else {\n if (moreInfo.filename) {\n moreInfoText.push(`File: ${moreInfo.filename}`);\n }\n if (moreInfo.lineNumber) {\n moreInfoText.push(`Line: ${moreInfo.lineNumber}`);\n }\n }\n }\n\n console.error(`${message}\\n\\n${moreInfoText.join(\"\\n\")}`);\n return message;\n },\n\n progress(level) {\n const percent = Math.round(level * 100);\n // When we transition from full request to range requests, it's possible\n // that we discard some of the loaded data. This can cause the loading\n // bar to move backwards. So prevent this by only updating the bar if it\n // increases.\n if (!this.loadingBar || percent <= this.loadingBar.percent) {\n return;\n }\n this.loadingBar.percent = percent;\n\n // When disableAutoFetch is enabled, it's not uncommon for the entire file\n // to never be fetched (depends on e.g. the file structure). In this case\n // the loading bar will not be completely filled, nor will it be hidden.\n // To prevent displaying a partially filled loading bar permanently, we\n // hide it when no data has been loaded during a certain amount of time.\n if (\n this.pdfDocument?.loadingParams.disableAutoFetch ??\n AppOptions.get(\"disableAutoFetch\")\n ) {\n this.loadingBar.setDisableAutoFetch();\n }\n },\n\n load(pdfDocument) {\n this.pdfDocument = pdfDocument;\n\n pdfDocument.getDownloadInfo().then(({ length }) => {\n this._contentLength = length; // Ensure that the correct length is used.\n this.loadingBar?.hide();\n\n firstPagePromise.then(() => {\n this.eventBus.dispatch(\"documentloaded\", { source: this });\n });\n });\n\n // Since the `setInitialView` call below depends on this being resolved,\n // fetch it early to avoid delaying initial rendering of the PDF document.\n const pageLayoutPromise = pdfDocument.getPageLayout().catch(() => {\n /* Avoid breaking initial rendering; ignoring errors. */\n });\n const pageModePromise = pdfDocument.getPageMode().catch(() => {\n /* Avoid breaking initial rendering; ignoring errors. */\n });\n const openActionPromise = pdfDocument.getOpenAction().catch(() => {\n /* Avoid breaking initial rendering; ignoring errors. */\n });\n\n this.toolbar?.setPagesCount(pdfDocument.numPages, false);\n this.secondaryToolbar?.setPagesCount(pdfDocument.numPages);\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")) {\n const baseUrl = location.href.split(\"#\", 1)[0];\n // Ignore \"data:\"-URLs for performance reasons, even though it may cause\n // internal links to not work perfectly in all cases (see bug 1803050).\n this.pdfLinkService.setDocument(\n pdfDocument,\n isDataScheme(baseUrl) ? null : baseUrl\n );\n } else {\n this.pdfLinkService.setDocument(pdfDocument);\n }\n this.pdfDocumentProperties?.setDocument(pdfDocument);\n\n const pdfViewer = this.pdfViewer;\n pdfViewer.setDocument(pdfDocument);\n const { firstPagePromise, onePageRendered, pagesPromise } = pdfViewer;\n\n this.pdfThumbnailViewer?.setDocument(pdfDocument);\n\n const storedPromise = (this.store = new ViewHistory(\n pdfDocument.fingerprints[0]\n ))\n .getMultiple({\n page: null,\n zoom: DEFAULT_SCALE_VALUE,\n scrollLeft: \"0\",\n scrollTop: \"0\",\n rotation: null,\n sidebarView: SidebarView.UNKNOWN,\n scrollMode: ScrollMode.UNKNOWN,\n spreadMode: SpreadMode.UNKNOWN,\n })\n .catch(() => {\n /* Unable to read from storage; ignoring errors. */\n });\n\n firstPagePromise.then(pdfPage => {\n this.loadingBar?.setWidth(this.appConfig.viewerContainer);\n this._initializeAnnotationStorageCallbacks(pdfDocument);\n\n Promise.all([\n animationStarted,\n storedPromise,\n pageLayoutPromise,\n pageModePromise,\n openActionPromise,\n ])\n .then(async ([timeStamp, stored, pageLayout, pageMode, openAction]) => {\n const viewOnLoad = AppOptions.get(\"viewOnLoad\");\n\n this._initializePdfHistory({\n fingerprint: pdfDocument.fingerprints[0],\n viewOnLoad,\n initialDest: openAction?.dest,\n });\n const initialBookmark = this.initialBookmark;\n\n // Initialize the default values, from user preferences.\n const zoom = AppOptions.get(\"defaultZoomValue\");\n let hash = zoom ? `zoom=${zoom}` : null;\n\n let rotation = null;\n let sidebarView = AppOptions.get(\"sidebarViewOnLoad\");\n let scrollMode = AppOptions.get(\"scrollModeOnLoad\");\n let spreadMode = AppOptions.get(\"spreadModeOnLoad\");\n\n if (stored?.page && viewOnLoad !== ViewOnLoad.INITIAL) {\n hash =\n `page=${stored.page}&zoom=${zoom || stored.zoom},` +\n `${stored.scrollLeft},${stored.scrollTop}`;\n\n rotation = parseInt(stored.rotation, 10);\n // Always let user preference take precedence over the view history.\n if (sidebarView === SidebarView.UNKNOWN) {\n sidebarView = stored.sidebarView | 0;\n }\n if (scrollMode === ScrollMode.UNKNOWN) {\n scrollMode = stored.scrollMode | 0;\n }\n if (spreadMode === SpreadMode.UNKNOWN) {\n spreadMode = stored.spreadMode | 0;\n }\n }\n // Always let the user preference/view history take precedence.\n if (pageMode && sidebarView === SidebarView.UNKNOWN) {\n sidebarView = apiPageModeToSidebarView(pageMode);\n }\n if (\n pageLayout &&\n scrollMode === ScrollMode.UNKNOWN &&\n spreadMode === SpreadMode.UNKNOWN\n ) {\n const modes = apiPageLayoutToViewerModes(pageLayout);\n // TODO: Try to improve page-switching when using the mouse-wheel\n // and/or arrow-keys before allowing the document to control this.\n // scrollMode = modes.scrollMode;\n spreadMode = modes.spreadMode;\n }\n\n this.setInitialView(hash, {\n rotation,\n sidebarView,\n scrollMode,\n spreadMode,\n });\n this.eventBus.dispatch(\"documentinit\", { source: this });\n // Make all navigation keys work on document load,\n // unless the viewer is embedded in a web page.\n if (!this.isViewerEmbedded) {\n pdfViewer.focus();\n }\n\n // For documents with different page sizes, once all pages are\n // resolved, ensure that the correct location becomes visible on load.\n // (To reduce the risk, in very large and/or slow loading documents,\n // that the location changes *after* the user has started interacting\n // with the viewer, wait for either `pagesPromise` or a timeout.)\n await Promise.race([\n pagesPromise,\n new Promise(resolve => {\n setTimeout(resolve, FORCE_PAGES_LOADED_TIMEOUT);\n }),\n ]);\n if (!initialBookmark && !hash) {\n return;\n }\n if (pdfViewer.hasEqualPageSizes) {\n return;\n }\n this.initialBookmark = initialBookmark;\n\n // eslint-disable-next-line no-self-assign\n pdfViewer.currentScaleValue = pdfViewer.currentScaleValue;\n // Re-apply the initial document location.\n this.setInitialView(hash);\n })\n .catch(() => {\n // Ensure that the document is always completely initialized,\n // even if there are any errors thrown above.\n this.setInitialView();\n })\n .then(function () {\n // At this point, rendering of the initial page(s) should always have\n // started (and may even have completed).\n // To prevent any future issues, e.g. the document being completely\n // blank on load, always trigger rendering here.\n pdfViewer.update();\n });\n });\n\n pagesPromise.then(\n () => {\n this._unblockDocumentLoadEvent();\n\n this._initializeAutoPrint(pdfDocument, openActionPromise);\n },\n reason => {\n this._documentError(\"pdfjs-loading-error\", { message: reason.message });\n }\n );\n\n onePageRendered.then(data => {\n this.externalServices.reportTelemetry({\n type: \"pageInfo\",\n timestamp: data.timestamp,\n });\n\n if (this.pdfOutlineViewer) {\n pdfDocument.getOutline().then(outline => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the outline resolved.\n }\n this.pdfOutlineViewer.render({ outline, pdfDocument });\n });\n }\n if (this.pdfAttachmentViewer) {\n pdfDocument.getAttachments().then(attachments => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the attachments resolved.\n }\n this.pdfAttachmentViewer.render({ attachments });\n });\n }\n if (this.pdfLayerViewer) {\n // Ensure that the layers accurately reflects the current state in the\n // viewer itself, rather than the default state provided by the API.\n pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the layers resolved.\n }\n this.pdfLayerViewer.render({ optionalContentConfig, pdfDocument });\n });\n }\n });\n\n this._initializePageLabels(pdfDocument);\n this._initializeMetadata(pdfDocument);\n },\n\n /**\n * @private\n */\n async _scriptingDocProperties(pdfDocument) {\n if (!this.documentInfo) {\n // It should be *extremely* rare for metadata to not have been resolved\n // when this code runs, but ensure that we handle that case here.\n await new Promise(resolve => {\n this.eventBus._on(\"metadataloaded\", resolve, { once: true });\n });\n if (pdfDocument !== this.pdfDocument) {\n return null; // The document was closed while the metadata resolved.\n }\n }\n if (!this._contentLength) {\n // Always waiting for the entire PDF document to be loaded will, most\n // likely, delay sandbox-creation too much in the general case for all\n // PDF documents which are not provided as binary data to the API.\n // Hence we'll simply have to trust that the `contentLength` (as provided\n // by the server), when it exists, is accurate enough here.\n await new Promise(resolve => {\n this.eventBus._on(\"documentloaded\", resolve, { once: true });\n });\n if (pdfDocument !== this.pdfDocument) {\n return null; // The document was closed while the downloadInfo resolved.\n }\n }\n\n return {\n ...this.documentInfo,\n baseURL: this.baseUrl,\n filesize: this._contentLength,\n filename: this._docFilename,\n metadata: this.metadata?.getRaw(),\n authors: this.metadata?.get(\"dc:creator\"),\n numPages: this.pagesCount,\n URL: this.url,\n };\n },\n\n /**\n * @private\n */\n async _initializeAutoPrint(pdfDocument, openActionPromise) {\n const [openAction, jsActions] = await Promise.all([\n openActionPromise,\n this.pdfViewer.enableScripting ? null : pdfDocument.getJSActions(),\n ]);\n\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the auto print data resolved.\n }\n let triggerAutoPrint = openAction?.action === \"Print\";\n\n if (jsActions) {\n console.warn(\"Warning: JavaScript support is not enabled\");\n\n // Hack to support auto printing.\n for (const name in jsActions) {\n if (triggerAutoPrint) {\n break;\n }\n switch (name) {\n case \"WillClose\":\n case \"WillSave\":\n case \"DidSave\":\n case \"WillPrint\":\n case \"DidPrint\":\n continue;\n }\n triggerAutoPrint = jsActions[name].some(js => AutoPrintRegExp.test(js));\n }\n }\n\n if (triggerAutoPrint) {\n this.triggerPrinting();\n }\n },\n\n /**\n * @private\n */\n async _initializeMetadata(pdfDocument) {\n const { info, metadata, contentDispositionFilename, contentLength } =\n await pdfDocument.getMetadata();\n\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the metadata resolved.\n }\n this.documentInfo = info;\n this.metadata = metadata;\n this._contentDispositionFilename ??= contentDispositionFilename;\n this._contentLength ??= contentLength; // See `getDownloadInfo`-call above.\n\n // Provides some basic debug information\n console.log(\n `PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` +\n `${(info.Producer || \"-\").trim()} / ${(info.Creator || \"-\").trim()}] ` +\n `(PDF.js: ${version || \"?\"} [${build || \"?\"}])`\n );\n let pdfTitle = info.Title;\n\n const metadataTitle = metadata?.get(\"dc:title\");\n if (metadataTitle) {\n // Ghostscript can produce invalid 'dc:title' Metadata entries:\n // - The title may be \"Untitled\" (fixes bug 1031612).\n // - The title may contain incorrectly encoded characters, which thus\n // looks broken, hence we ignore the Metadata entry when it contains\n // characters from the Specials Unicode block (fixes bug 1605526).\n if (\n metadataTitle !== \"Untitled\" &&\n !/[\\uFFF0-\\uFFFF]/g.test(metadataTitle)\n ) {\n pdfTitle = metadataTitle;\n }\n }\n if (pdfTitle) {\n this.setTitle(\n `${pdfTitle} - ${this._contentDispositionFilename || this._title}`\n );\n } else if (this._contentDispositionFilename) {\n this.setTitle(this._contentDispositionFilename);\n }\n\n if (\n info.IsXFAPresent &&\n !info.IsAcroFormPresent &&\n !pdfDocument.isPureXfa\n ) {\n if (pdfDocument.loadingParams.enableXfa) {\n console.warn(\"Warning: XFA Foreground documents are not supported\");\n } else {\n console.warn(\"Warning: XFA support is not enabled\");\n }\n } else if (\n (info.IsAcroFormPresent || info.IsXFAPresent) &&\n !this.pdfViewer.renderForms\n ) {\n console.warn(\"Warning: Interactive form support is not enabled\");\n }\n\n if (info.IsSignaturesPresent) {\n console.warn(\"Warning: Digital signatures validation is not supported\");\n }\n\n this.eventBus.dispatch(\"metadataloaded\", { source: this });\n },\n\n /**\n * @private\n */\n async _initializePageLabels(pdfDocument) {\n if (\n typeof PDFJSDev === \"undefined\"\n ? window.isGECKOVIEW\n : PDFJSDev.test(\"GECKOVIEW\")\n ) {\n return;\n }\n const labels = await pdfDocument.getPageLabels();\n\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the page labels resolved.\n }\n if (!labels || AppOptions.get(\"disablePageLabels\")) {\n return;\n }\n const numLabels = labels.length;\n // Ignore page labels that correspond to standard page numbering,\n // or page labels that are all empty.\n let standardLabels = 0,\n emptyLabels = 0;\n for (let i = 0; i < numLabels; i++) {\n const label = labels[i];\n if (label === (i + 1).toString()) {\n standardLabels++;\n } else if (label === \"\") {\n emptyLabels++;\n } else {\n break;\n }\n }\n if (standardLabels >= numLabels || emptyLabels >= numLabels) {\n return;\n }\n const { pdfViewer, pdfThumbnailViewer, toolbar } = this;\n\n pdfViewer.setPageLabels(labels);\n pdfThumbnailViewer?.setPageLabels(labels);\n\n // Changing toolbar page display to use labels and we need to set\n // the label of the current page.\n toolbar?.setPagesCount(numLabels, true);\n toolbar?.setPageNumber(\n pdfViewer.currentPageNumber,\n pdfViewer.currentPageLabel\n );\n },\n\n /**\n * @private\n */\n _initializePdfHistory({ fingerprint, viewOnLoad, initialDest = null }) {\n if (!this.pdfHistory) {\n return;\n }\n this.pdfHistory.initialize({\n fingerprint,\n resetHistory: viewOnLoad === ViewOnLoad.INITIAL,\n updateUrl: AppOptions.get(\"historyUpdateUrl\"),\n });\n\n if (this.pdfHistory.initialBookmark) {\n this.initialBookmark = this.pdfHistory.initialBookmark;\n\n this.initialRotation = this.pdfHistory.initialRotation;\n }\n\n // Always let the browser history/document hash take precedence.\n if (\n initialDest &&\n !this.initialBookmark &&\n viewOnLoad === ViewOnLoad.UNKNOWN\n ) {\n this.initialBookmark = JSON.stringify(initialDest);\n // TODO: Re-factor the `PDFHistory` initialization to remove this hack\n // that's currently necessary to prevent weird initial history state.\n this.pdfHistory.push({ explicitDest: initialDest, pageNumber: null });\n }\n },\n\n /**\n * @private\n */\n _initializeAnnotationStorageCallbacks(pdfDocument) {\n if (pdfDocument !== this.pdfDocument) {\n return;\n }\n const { annotationStorage } = pdfDocument;\n\n annotationStorage.onSetModified = () => {\n window.addEventListener(\"beforeunload\", beforeUnload);\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this._annotationStorageModified = true;\n }\n };\n annotationStorage.onResetModified = () => {\n window.removeEventListener(\"beforeunload\", beforeUnload);\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n delete this._annotationStorageModified;\n }\n };\n annotationStorage.onAnnotationEditor = typeStr => {\n this._hasAnnotationEditors = !!typeStr;\n this.setTitle();\n };\n },\n\n setInitialView(\n storedHash,\n { rotation, sidebarView, scrollMode, spreadMode } = {}\n ) {\n const setRotation = angle => {\n if (isValidRotation(angle)) {\n this.pdfViewer.pagesRotation = angle;\n }\n };\n const setViewerModes = (scroll, spread) => {\n if (isValidScrollMode(scroll)) {\n this.pdfViewer.scrollMode = scroll;\n }\n if (isValidSpreadMode(spread)) {\n this.pdfViewer.spreadMode = spread;\n }\n };\n this.isInitialViewSet = true;\n this.pdfSidebar?.setInitialView(sidebarView);\n\n setViewerModes(scrollMode, spreadMode);\n\n if (this.initialBookmark) {\n setRotation(this.initialRotation);\n delete this.initialRotation;\n\n this.pdfLinkService.setHash(this.initialBookmark);\n this.initialBookmark = null;\n } else if (storedHash) {\n setRotation(rotation);\n\n this.pdfLinkService.setHash(storedHash);\n }\n\n // Ensure that the correct page number is displayed in the UI,\n // even if the active page didn't change during document load.\n this.toolbar?.setPageNumber(\n this.pdfViewer.currentPageNumber,\n this.pdfViewer.currentPageLabel\n );\n this.secondaryToolbar?.setPageNumber(this.pdfViewer.currentPageNumber);\n\n if (!this.pdfViewer.currentScaleValue) {\n // Scale was not initialized: invalid bookmark or scale was not specified.\n // Setting the default one.\n this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;\n }\n },\n\n /**\n * @private\n */\n _cleanup() {\n if (!this.pdfDocument) {\n return; // run cleanup when document is loaded\n }\n this.pdfViewer.cleanup();\n this.pdfThumbnailViewer?.cleanup();\n\n this.pdfDocument.cleanup(\n /* keepLoadedFonts = */ AppOptions.get(\"fontExtraProperties\")\n );\n },\n\n forceRendering() {\n this.pdfRenderingQueue.printing = !!this.printService;\n this.pdfRenderingQueue.isThumbnailViewEnabled =\n this.pdfSidebar?.visibleView === SidebarView.THUMBS;\n this.pdfRenderingQueue.renderHighestPriority();\n },\n\n beforePrint() {\n this._printAnnotationStoragePromise = this.pdfScriptingManager\n .dispatchWillPrint()\n .catch(() => {\n /* Avoid breaking printing; ignoring errors. */\n })\n .then(() => this.pdfDocument?.annotationStorage.print);\n\n if (this.printService) {\n // There is no way to suppress beforePrint/afterPrint events,\n // but PDFPrintService may generate double events -- this will ignore\n // the second event that will be coming from native window.print().\n return;\n }\n\n if (!this.supportsPrinting) {\n this._otherError(\"pdfjs-printing-not-supported\");\n return;\n }\n\n // The beforePrint is a sync method and we need to know layout before\n // returning from this method. Ensure that we can get sizes of the pages.\n if (!this.pdfViewer.pageViewsReady) {\n this.l10n.get(\"pdfjs-printing-not-ready\").then(msg => {\n // eslint-disable-next-line no-alert\n window.alert(msg);\n });\n return;\n }\n\n this.printService = PDFPrintServiceFactory.createPrintService({\n pdfDocument: this.pdfDocument,\n pagesOverview: this.pdfViewer.getPagesOverview(),\n printContainer: this.appConfig.printContainer,\n printResolution: AppOptions.get(\"printResolution\"),\n printAnnotationStoragePromise: this._printAnnotationStoragePromise,\n });\n this.forceRendering();\n // Disable the editor-indicator during printing (fixes bug 1790552).\n this.setTitle();\n\n this.printService.layout();\n\n if (this._hasAnnotationEditors) {\n this.externalServices.reportTelemetry({\n type: \"editing\",\n data: {\n type: \"print\",\n stats: this.pdfDocument?.annotationStorage.editorStats,\n },\n });\n }\n },\n\n afterPrint() {\n if (this._printAnnotationStoragePromise) {\n this._printAnnotationStoragePromise.then(() => {\n this.pdfScriptingManager.dispatchDidPrint();\n });\n this._printAnnotationStoragePromise = null;\n }\n\n if (this.printService) {\n this.printService.destroy();\n this.printService = null;\n\n this.pdfDocument?.annotationStorage.resetModified();\n }\n this.forceRendering();\n // Re-enable the editor-indicator after printing (fixes bug 1790552).\n this.setTitle();\n },\n\n rotatePages(delta) {\n this.pdfViewer.pagesRotation += delta;\n // Note that the thumbnail viewer is updated, and rendering is triggered,\n // in the 'rotationchanging' event handler.\n },\n\n requestPresentationMode() {\n this.pdfPresentationMode?.request();\n },\n\n triggerPrinting() {\n if (this.supportsPrinting) {\n window.print();\n }\n },\n\n bindEvents() {\n if (this._eventBusAbortController) {\n return;\n }\n this._eventBusAbortController = new AbortController();\n\n const {\n eventBus,\n externalServices,\n pdfDocumentProperties,\n pdfViewer,\n preferences,\n _eventBusAbortController: { signal },\n } = this;\n\n eventBus._on(\"resize\", onResize.bind(this), { signal });\n eventBus._on(\"hashchange\", onHashchange.bind(this), { signal });\n eventBus._on(\"beforeprint\", this.beforePrint.bind(this), { signal });\n eventBus._on(\"afterprint\", this.afterPrint.bind(this), { signal });\n eventBus._on(\"pagerender\", onPageRender.bind(this), { signal });\n eventBus._on(\"pagerendered\", onPageRendered.bind(this), { signal });\n eventBus._on(\"updateviewarea\", onUpdateViewarea.bind(this), { signal });\n eventBus._on(\"pagechanging\", onPageChanging.bind(this), { signal });\n eventBus._on(\"scalechanging\", onScaleChanging.bind(this), { signal });\n eventBus._on(\"rotationchanging\", onRotationChanging.bind(this), { signal });\n eventBus._on(\"sidebarviewchanged\", onSidebarViewChanged.bind(this), {\n signal,\n });\n eventBus._on(\"pagemode\", onPageMode.bind(this), { signal });\n eventBus._on(\"namedaction\", onNamedAction.bind(this), { signal });\n eventBus._on(\n \"presentationmodechanged\",\n evt => (pdfViewer.presentationModeState = evt.state),\n { signal }\n );\n eventBus._on(\"presentationmode\", this.requestPresentationMode.bind(this), {\n signal,\n });\n eventBus._on(\n \"switchannotationeditormode\",\n evt => (pdfViewer.annotationEditorMode = evt),\n { signal }\n );\n eventBus._on(\"print\", this.triggerPrinting.bind(this), { signal });\n eventBus._on(\"download\", this.downloadOrSave.bind(this), { signal });\n eventBus._on(\"firstpage\", () => (this.page = 1), { signal });\n eventBus._on(\"lastpage\", () => (this.page = this.pagesCount), { signal });\n eventBus._on(\"nextpage\", () => pdfViewer.nextPage(), { signal });\n eventBus._on(\"previouspage\", () => pdfViewer.previousPage(), { signal });\n eventBus._on(\"zoomin\", this.zoomIn.bind(this), { signal });\n eventBus._on(\"zoomout\", this.zoomOut.bind(this), { signal });\n eventBus._on(\"zoomreset\", this.zoomReset.bind(this), { signal });\n eventBus._on(\"pagenumberchanged\", onPageNumberChanged.bind(this), {\n signal,\n });\n eventBus._on(\n \"scalechanged\",\n evt => (pdfViewer.currentScaleValue = evt.value),\n { signal }\n );\n eventBus._on(\"rotatecw\", this.rotatePages.bind(this, 90), { signal });\n eventBus._on(\"rotateccw\", this.rotatePages.bind(this, -90), { signal });\n eventBus._on(\n \"optionalcontentconfig\",\n evt => (pdfViewer.optionalContentConfigPromise = evt.promise),\n { signal }\n );\n eventBus._on(\"switchscrollmode\", evt => (pdfViewer.scrollMode = evt.mode), {\n signal,\n });\n eventBus._on(\n \"scrollmodechanged\",\n onViewerModesChanged.bind(this, \"scrollMode\"),\n { signal }\n );\n eventBus._on(\"switchspreadmode\", evt => (pdfViewer.spreadMode = evt.mode), {\n signal,\n });\n eventBus._on(\n \"spreadmodechanged\",\n onViewerModesChanged.bind(this, \"spreadMode\"),\n { signal }\n );\n eventBus._on(\"imagealttextsettings\", onImageAltTextSettings.bind(this), {\n signal,\n });\n eventBus._on(\"documentproperties\", () => pdfDocumentProperties?.open(), {\n signal,\n });\n eventBus._on(\"findfromurlhash\", onFindFromUrlHash.bind(this), { signal });\n eventBus._on(\n \"updatefindmatchescount\",\n onUpdateFindMatchesCount.bind(this),\n { signal }\n );\n eventBus._on(\n \"updatefindcontrolstate\",\n onUpdateFindControlState.bind(this),\n { signal }\n );\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n eventBus._on(\"fileinputchange\", onFileInputChange.bind(this), { signal });\n eventBus._on(\"openfile\", onOpenFile.bind(this), { signal });\n }\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n eventBus._on(\n \"annotationeditorstateschanged\",\n evt => externalServices.updateEditorStates(evt),\n { signal }\n );\n eventBus._on(\n \"reporttelemetry\",\n evt => externalServices.reportTelemetry(evt.details),\n { signal }\n );\n }\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"TESTING || MOZCENTRAL\")\n ) {\n eventBus._on(\n \"setpreference\",\n evt => preferences.set(evt.name, evt.value),\n { signal }\n );\n }\n },\n\n bindWindowEvents() {\n if (this._windowAbortController) {\n return;\n }\n this._windowAbortController = new AbortController();\n\n const {\n eventBus,\n appConfig: { mainContainer },\n pdfViewer,\n _windowAbortController: { signal },\n } = this;\n\n function addWindowResolutionChange(evt = null) {\n if (evt) {\n pdfViewer.refresh();\n }\n const mediaQueryList = window.matchMedia(\n `(resolution: ${window.devicePixelRatio || 1}dppx)`\n );\n mediaQueryList.addEventListener(\"change\", addWindowResolutionChange, {\n once: true,\n signal,\n });\n }\n addWindowResolutionChange();\n\n window.addEventListener(\"wheel\", onWheel.bind(this), {\n passive: false,\n signal,\n });\n window.addEventListener(\"touchstart\", onTouchStart.bind(this), {\n passive: false,\n signal,\n });\n window.addEventListener(\"touchmove\", onTouchMove.bind(this), {\n passive: false,\n signal,\n });\n window.addEventListener(\"touchend\", onTouchEnd.bind(this), {\n passive: false,\n signal,\n });\n window.addEventListener(\"click\", onClick.bind(this), { signal });\n window.addEventListener(\"keydown\", onKeyDown.bind(this), { signal });\n window.addEventListener(\"keyup\", onKeyUp.bind(this), { signal });\n window.addEventListener(\n \"resize\",\n () => eventBus.dispatch(\"resize\", { source: window }),\n { signal }\n );\n window.addEventListener(\n \"hashchange\",\n () => {\n eventBus.dispatch(\"hashchange\", {\n source: window,\n hash: document.location.hash.substring(1),\n });\n },\n { signal }\n );\n window.addEventListener(\n \"beforeprint\",\n () => eventBus.dispatch(\"beforeprint\", { source: window }),\n { signal }\n );\n window.addEventListener(\n \"afterprint\",\n () => eventBus.dispatch(\"afterprint\", { source: window }),\n { signal }\n );\n window.addEventListener(\n \"updatefromsandbox\",\n evt => {\n eventBus.dispatch(\"updatefromsandbox\", {\n source: window,\n detail: evt.detail,\n });\n },\n { signal }\n );\n\n if (\n (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) &&\n !(\"onscrollend\" in document.documentElement)\n ) {\n return;\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n // Using the values lastScrollTop and lastScrollLeft is a workaround to\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1881974.\n // TODO: remove them once the bug is fixed.\n ({ scrollTop: this._lastScrollTop, scrollLeft: this._lastScrollLeft } =\n mainContainer);\n }\n\n const scrollend = () => {\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n ({ scrollTop: this._lastScrollTop, scrollLeft: this._lastScrollLeft } =\n mainContainer);\n }\n\n this._isScrolling = false;\n mainContainer.addEventListener(\"scroll\", scroll, {\n passive: true,\n signal,\n });\n mainContainer.removeEventListener(\"scrollend\", scrollend);\n mainContainer.removeEventListener(\"blur\", scrollend);\n };\n const scroll = () => {\n if (this._isCtrlKeyDown) {\n return;\n }\n if (\n (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) &&\n this._lastScrollTop === mainContainer.scrollTop &&\n this._lastScrollLeft === mainContainer.scrollLeft\n ) {\n return;\n }\n\n mainContainer.removeEventListener(\"scroll\", scroll, { passive: true });\n this._isScrolling = true;\n mainContainer.addEventListener(\"scrollend\", scrollend, { signal });\n mainContainer.addEventListener(\"blur\", scrollend, { signal });\n };\n mainContainer.addEventListener(\"scroll\", scroll, {\n passive: true,\n signal,\n });\n },\n\n unbindEvents() {\n this._eventBusAbortController?.abort();\n this._eventBusAbortController = null;\n },\n\n unbindWindowEvents() {\n this._windowAbortController?.abort();\n this._windowAbortController = null;\n },\n\n /**\n * @ignore\n */\n async testingClose() {\n this.unbindEvents();\n this.unbindWindowEvents();\n\n this._globalAbortController?.abort();\n this._globalAbortController = null;\n\n this.findBar?.close();\n\n await Promise.all([this.l10n?.destroy(), this.close()]);\n },\n\n _accumulateTicks(ticks, prop) {\n // If the direction changed, reset the accumulated ticks.\n if ((this[prop] > 0 && ticks < 0) || (this[prop] < 0 && ticks > 0)) {\n this[prop] = 0;\n }\n this[prop] += ticks;\n const wholeTicks = Math.trunc(this[prop]);\n this[prop] -= wholeTicks;\n return wholeTicks;\n },\n\n _accumulateFactor(previousScale, factor, prop) {\n if (factor === 1) {\n return 1;\n }\n // If the direction changed, reset the accumulated factor.\n if ((this[prop] > 1 && factor < 1) || (this[prop] < 1 && factor > 1)) {\n this[prop] = 1;\n }\n\n const newFactor =\n Math.floor(previousScale * factor * this[prop] * 100) /\n (100 * previousScale);\n this[prop] = factor / newFactor;\n\n return newFactor;\n },\n\n /**\n * Should be called *after* all pages have loaded, or if an error occurred,\n * to unblock the \"load\" event; see https://bugzilla.mozilla.org/show_bug.cgi?id=1618553\n * @private\n */\n _unblockDocumentLoadEvent() {\n document.blockUnblockOnload?.(false);\n\n // Ensure that this method is only ever run once.\n this._unblockDocumentLoadEvent = () => {};\n },\n\n /**\n * Used together with the integration-tests, to enable awaiting full\n * initialization of the scripting/sandbox.\n */\n get scriptingReady() {\n return this.pdfScriptingManager.ready;\n },\n};\n\ninitCom(PDFViewerApplication);\n\nif (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n PDFPrintServiceFactory.initGlobals(PDFViewerApplication);\n}\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n const HOSTED_VIEWER_ORIGINS = [\n \"null\",\n \"http://mozilla.github.io\",\n \"https://mozilla.github.io\",\n ];\n // eslint-disable-next-line no-var\n var validateFileURL = function (file) {\n if (!file) {\n return;\n }\n try {\n const viewerOrigin = new URL(window.location.href).origin || \"null\";\n if (HOSTED_VIEWER_ORIGINS.includes(viewerOrigin)) {\n // Hosted or local viewer, allow for any file locations\n return;\n }\n const fileOrigin = new URL(file, window.location.href).origin;\n // Removing of the following line will not guarantee that the viewer will\n // start accepting URLs from foreign origin -- CORS headers on the remote\n // server must be properly configured.\n if (fileOrigin !== viewerOrigin) {\n throw new Error(\"file origin does not match viewer's\");\n }\n } catch (ex) {\n PDFViewerApplication._documentError(\"pdfjs-loading-error\", {\n message: ex.message,\n });\n throw ex;\n }\n };\n\n // eslint-disable-next-line no-var\n var onFileInputChange = function (evt) {\n if (this.pdfViewer?.isInPresentationMode) {\n return; // Opening a new PDF file isn't supported in Presentation Mode.\n }\n const file = evt.fileInput.files[0];\n\n this.open({\n url: URL.createObjectURL(file),\n originalUrl: file.name,\n });\n };\n\n // eslint-disable-next-line no-var\n var onOpenFile = function (evt) {\n this._openFileInput?.click();\n };\n}\n\nfunction onPageRender({ pageNumber }) {\n // If the page is (the most) visible when it starts rendering,\n // ensure that the page number input loading indicator is displayed.\n if (pageNumber === this.page) {\n this.toolbar?.updateLoadingIndicatorState(true);\n }\n}\n\nfunction onPageRendered({ pageNumber, error }) {\n // If the page is still visible when it has finished rendering,\n // ensure that the page number input loading indicator is hidden.\n if (pageNumber === this.page) {\n this.toolbar?.updateLoadingIndicatorState(false);\n }\n\n // Use the rendered page to set the corresponding thumbnail image.\n if (this.pdfSidebar?.visibleView === SidebarView.THUMBS) {\n const pageView = this.pdfViewer.getPageView(/* index = */ pageNumber - 1);\n const thumbnailView = this.pdfThumbnailViewer?.getThumbnail(\n /* index = */ pageNumber - 1\n );\n if (pageView) {\n thumbnailView?.setImage(pageView);\n }\n }\n\n if (error) {\n this._otherError(\"pdfjs-rendering-error\", error);\n }\n}\n\nfunction onPageMode({ mode }) {\n // Handle the 'pagemode' hash parameter, see also `PDFLinkService_setHash`.\n let view;\n switch (mode) {\n case \"thumbs\":\n view = SidebarView.THUMBS;\n break;\n case \"bookmarks\":\n case \"outline\": // non-standard\n view = SidebarView.OUTLINE;\n break;\n case \"attachments\": // non-standard\n view = SidebarView.ATTACHMENTS;\n break;\n case \"layers\": // non-standard\n view = SidebarView.LAYERS;\n break;\n case \"none\":\n view = SidebarView.NONE;\n break;\n default:\n console.error('Invalid \"pagemode\" hash parameter: ' + mode);\n return;\n }\n this.pdfSidebar?.switchView(view, /* forceOpen = */ true);\n}\n\nfunction onNamedAction(evt) {\n // Processing a couple of named actions that might be useful, see also\n // `PDFLinkService.executeNamedAction`.\n switch (evt.action) {\n case \"GoToPage\":\n this.appConfig.toolbar?.pageNumber.select();\n break;\n\n case \"Find\":\n if (!this.supportsIntegratedFind) {\n this.findBar?.toggle();\n }\n break;\n\n case \"Print\":\n this.triggerPrinting();\n break;\n\n case \"SaveAs\":\n this.downloadOrSave();\n break;\n }\n}\n\nfunction onSidebarViewChanged({ view }) {\n this.pdfRenderingQueue.isThumbnailViewEnabled = view === SidebarView.THUMBS;\n\n if (this.isInitialViewSet) {\n // Only update the storage when the document has been loaded *and* rendered.\n this.store?.set(\"sidebarView\", view).catch(() => {\n // Unable to write to storage.\n });\n }\n}\n\nfunction onUpdateViewarea({ location }) {\n if (this.isInitialViewSet) {\n // Only update the storage when the document has been loaded *and* rendered.\n this.store\n ?.setMultiple({\n page: location.pageNumber,\n zoom: location.scale,\n scrollLeft: location.left,\n scrollTop: location.top,\n rotation: location.rotation,\n })\n .catch(() => {\n // Unable to write to storage.\n });\n }\n if (this.appConfig.secondaryToolbar) {\n this.appConfig.secondaryToolbar.viewBookmarkButton.href =\n this.pdfLinkService.getAnchorUrl(location.pdfOpenParams);\n }\n}\n\nfunction onViewerModesChanged(name, evt) {\n if (this.isInitialViewSet && !this.pdfViewer.isInPresentationMode) {\n // Only update the storage when the document has been loaded *and* rendered.\n this.store?.set(name, evt.mode).catch(() => {\n // Unable to write to storage.\n });\n }\n}\n\nfunction onResize() {\n const { pdfDocument, pdfViewer, pdfRenderingQueue } = this;\n\n if (pdfRenderingQueue.printing && window.matchMedia(\"print\").matches) {\n // Work-around issue 15324 by ignoring \"resize\" events during printing.\n return;\n }\n\n if (!pdfDocument) {\n return;\n }\n const currentScaleValue = pdfViewer.currentScaleValue;\n if (\n currentScaleValue === \"auto\" ||\n currentScaleValue === \"page-fit\" ||\n currentScaleValue === \"page-width\"\n ) {\n // Note: the scale is constant for 'page-actual'.\n pdfViewer.currentScaleValue = currentScaleValue;\n }\n pdfViewer.update();\n}\n\nfunction onHashchange(evt) {\n const hash = evt.hash;\n if (!hash) {\n return;\n }\n if (!this.isInitialViewSet) {\n this.initialBookmark = hash;\n } else if (!this.pdfHistory?.popStateInProgress) {\n this.pdfLinkService.setHash(hash);\n }\n}\n\nfunction onPageNumberChanged(evt) {\n const { pdfViewer } = this;\n // Note that for `<input type=\"number\">` HTML elements, an empty string will\n // be returned for non-number inputs; hence we simply do nothing in that case.\n if (evt.value !== \"\") {\n this.pdfLinkService.goToPage(evt.value);\n }\n\n // Ensure that the page number input displays the correct value, even if the\n // value entered by the user was invalid (e.g. a floating point number).\n if (\n evt.value !== pdfViewer.currentPageNumber.toString() &&\n evt.value !== pdfViewer.currentPageLabel\n ) {\n this.toolbar?.setPageNumber(\n pdfViewer.currentPageNumber,\n pdfViewer.currentPageLabel\n );\n }\n}\n\nfunction onImageAltTextSettings() {\n this.imageAltTextSettings?.open({\n enableGuessAltText: AppOptions.get(\"enableGuessAltText\"),\n enableNewAltTextWhenAddingImage: AppOptions.get(\n \"enableNewAltTextWhenAddingImage\"\n ),\n });\n}\n\nfunction onFindFromUrlHash(evt) {\n this.eventBus.dispatch(\"find\", {\n source: evt.source,\n type: \"\",\n query: evt.query,\n caseSensitive: false,\n entireWord: false,\n highlightAll: true,\n findPrevious: false,\n matchDiacritics: true,\n });\n}\n\nfunction onUpdateFindMatchesCount({ matchesCount }) {\n if (this.supportsIntegratedFind) {\n this.externalServices.updateFindMatchesCount(matchesCount);\n } else {\n this.findBar?.updateResultsCount(matchesCount);\n }\n}\n\nfunction onUpdateFindControlState({\n state,\n previous,\n entireWord,\n matchesCount,\n rawQuery,\n}) {\n if (this.supportsIntegratedFind) {\n this.externalServices.updateFindControlState({\n result: state,\n findPrevious: previous,\n entireWord,\n matchesCount,\n rawQuery,\n });\n } else {\n this.findBar?.updateUIState(state, previous, matchesCount);\n }\n}\n\nfunction onScaleChanging(evt) {\n this.toolbar?.setPageScale(evt.presetValue, evt.scale);\n\n this.pdfViewer.update();\n}\n\nfunction onRotationChanging(evt) {\n if (this.pdfThumbnailViewer) {\n this.pdfThumbnailViewer.pagesRotation = evt.pagesRotation;\n }\n\n this.forceRendering();\n // Ensure that the active page doesn't change during rotation.\n this.pdfViewer.currentPageNumber = evt.pageNumber;\n}\n\nfunction onPageChanging({ pageNumber, pageLabel }) {\n this.toolbar?.setPageNumber(pageNumber, pageLabel);\n this.secondaryToolbar?.setPageNumber(pageNumber);\n\n if (this.pdfSidebar?.visibleView === SidebarView.THUMBS) {\n this.pdfThumbnailViewer?.scrollThumbnailIntoView(pageNumber);\n }\n\n // Show/hide the loading indicator in the page number input element.\n const currentPage = this.pdfViewer.getPageView(/* index = */ pageNumber - 1);\n this.toolbar?.updateLoadingIndicatorState(\n currentPage?.renderingState === RenderingStates.RUNNING\n );\n}\n\nfunction onWheel(evt) {\n const {\n pdfViewer,\n supportsMouseWheelZoomCtrlKey,\n supportsMouseWheelZoomMetaKey,\n supportsPinchToZoom,\n } = this;\n\n if (pdfViewer.isInPresentationMode) {\n return;\n }\n\n // Pinch-to-zoom on a trackpad maps to a wheel event with ctrlKey set to true\n // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent#browser_compatibility\n // Hence if ctrlKey is true but ctrl key hasn't been pressed then we can\n // infer that we have a pinch-to-zoom.\n // But the ctrlKey could have been pressed outside of the browser window,\n // hence we try to do some magic to guess if the scaleFactor is likely coming\n // from a pinch-to-zoom or not.\n\n // It is important that we query deltaMode before delta{X,Y}, so that\n // Firefox doesn't switch to DOM_DELTA_PIXEL mode for compat with other\n // browsers, see https://bugzilla.mozilla.org/show_bug.cgi?id=1392460.\n const deltaMode = evt.deltaMode;\n\n // The following formula is a bit strange but it comes from:\n // https://searchfox.org/mozilla-central/rev/d62c4c4d5547064487006a1506287da394b64724/widget/InputData.cpp#618-626\n let scaleFactor = Math.exp(-evt.deltaY / 100);\n\n const isBuiltInMac =\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"MOZCENTRAL\") &&\n FeatureTest.platform.isMac;\n const isPinchToZoom =\n evt.ctrlKey &&\n !this._isCtrlKeyDown &&\n deltaMode === WheelEvent.DOM_DELTA_PIXEL &&\n evt.deltaX === 0 &&\n (Math.abs(scaleFactor - 1) < 0.05 || isBuiltInMac) &&\n evt.deltaZ === 0;\n const origin = [evt.clientX, evt.clientY];\n\n if (\n isPinchToZoom ||\n (evt.ctrlKey && supportsMouseWheelZoomCtrlKey) ||\n (evt.metaKey && supportsMouseWheelZoomMetaKey)\n ) {\n // Only zoom the pages, not the entire viewer.\n evt.preventDefault();\n // NOTE: this check must be placed *after* preventDefault.\n if (\n this._isScrolling ||\n document.visibilityState === \"hidden\" ||\n this.overlayManager.active\n ) {\n return;\n }\n\n if (isPinchToZoom && supportsPinchToZoom) {\n scaleFactor = this._accumulateFactor(\n pdfViewer.currentScale,\n scaleFactor,\n \"_wheelUnusedFactor\"\n );\n this.updateZoom(null, scaleFactor, origin);\n } else {\n const delta = normalizeWheelEventDirection(evt);\n\n let ticks = 0;\n if (\n deltaMode === WheelEvent.DOM_DELTA_LINE ||\n deltaMode === WheelEvent.DOM_DELTA_PAGE\n ) {\n // For line-based devices, use one tick per event, because different\n // OSs have different defaults for the number lines. But we generally\n // want one \"clicky\" roll of the wheel (which produces one event) to\n // adjust the zoom by one step.\n //\n // If we're getting fractional lines (I can't think of a scenario\n // this might actually happen), be safe and use the accumulator.\n ticks =\n Math.abs(delta) >= 1\n ? Math.sign(delta)\n : this._accumulateTicks(delta, \"_wheelUnusedTicks\");\n } else {\n // pixel-based devices\n const PIXELS_PER_LINE_SCALE = 30;\n ticks = this._accumulateTicks(\n delta / PIXELS_PER_LINE_SCALE,\n \"_wheelUnusedTicks\"\n );\n }\n\n this.updateZoom(ticks, null, origin);\n }\n }\n}\n\nfunction onTouchStart(evt) {\n if (this.pdfViewer.isInPresentationMode || evt.touches.length < 2) {\n return;\n }\n evt.preventDefault();\n\n if (evt.touches.length !== 2 || this.overlayManager.active) {\n this._touchInfo = null;\n return;\n }\n\n let [touch0, touch1] = evt.touches;\n if (touch0.identifier > touch1.identifier) {\n [touch0, touch1] = [touch1, touch0];\n }\n this._touchInfo = {\n touch0X: touch0.pageX,\n touch0Y: touch0.pageY,\n touch1X: touch1.pageX,\n touch1Y: touch1.pageY,\n };\n}\n\nfunction onTouchMove(evt) {\n if (!this._touchInfo || evt.touches.length !== 2) {\n return;\n }\n\n const { pdfViewer, _touchInfo, supportsPinchToZoom } = this;\n let [touch0, touch1] = evt.touches;\n if (touch0.identifier > touch1.identifier) {\n [touch0, touch1] = [touch1, touch0];\n }\n const { pageX: page0X, pageY: page0Y } = touch0;\n const { pageX: page1X, pageY: page1Y } = touch1;\n const {\n touch0X: pTouch0X,\n touch0Y: pTouch0Y,\n touch1X: pTouch1X,\n touch1Y: pTouch1Y,\n } = _touchInfo;\n\n if (\n Math.abs(pTouch0X - page0X) <= 1 &&\n Math.abs(pTouch0Y - page0Y) <= 1 &&\n Math.abs(pTouch1X - page1X) <= 1 &&\n Math.abs(pTouch1Y - page1Y) <= 1\n ) {\n // Touches are really too close and it's hard do some basic\n // geometry in order to guess something.\n return;\n }\n\n _touchInfo.touch0X = page0X;\n _touchInfo.touch0Y = page0Y;\n _touchInfo.touch1X = page1X;\n _touchInfo.touch1Y = page1Y;\n\n if (pTouch0X === page0X && pTouch0Y === page0Y) {\n // First touch is fixed, if the vectors are collinear then we've a pinch.\n const v1X = pTouch1X - page0X;\n const v1Y = pTouch1Y - page0Y;\n const v2X = page1X - page0X;\n const v2Y = page1Y - page0Y;\n const det = v1X * v2Y - v1Y * v2X;\n // 0.02 is approximatively sin(0.15deg).\n if (Math.abs(det) > 0.02 * Math.hypot(v1X, v1Y) * Math.hypot(v2X, v2Y)) {\n return;\n }\n } else if (pTouch1X === page1X && pTouch1Y === page1Y) {\n // Second touch is fixed, if the vectors are collinear then we've a pinch.\n const v1X = pTouch0X - page1X;\n const v1Y = pTouch0Y - page1Y;\n const v2X = page0X - page1X;\n const v2Y = page0Y - page1Y;\n const det = v1X * v2Y - v1Y * v2X;\n if (Math.abs(det) > 0.02 * Math.hypot(v1X, v1Y) * Math.hypot(v2X, v2Y)) {\n return;\n }\n } else {\n const diff0X = page0X - pTouch0X;\n const diff1X = page1X - pTouch1X;\n const diff0Y = page0Y - pTouch0Y;\n const diff1Y = page1Y - pTouch1Y;\n const dotProduct = diff0X * diff1X + diff0Y * diff1Y;\n if (dotProduct >= 0) {\n // The two touches go in almost the same direction.\n return;\n }\n }\n\n evt.preventDefault();\n\n const origin = [(page0X + page1X) / 2, (page0Y + page1Y) / 2];\n const distance = Math.hypot(page0X - page1X, page0Y - page1Y) || 1;\n const pDistance = Math.hypot(pTouch0X - pTouch1X, pTouch0Y - pTouch1Y) || 1;\n if (supportsPinchToZoom) {\n const newScaleFactor = this._accumulateFactor(\n pdfViewer.currentScale,\n distance / pDistance,\n \"_touchUnusedFactor\"\n );\n this.updateZoom(null, newScaleFactor, origin);\n } else {\n const PIXELS_PER_LINE_SCALE = 30;\n const ticks = this._accumulateTicks(\n (distance - pDistance) / PIXELS_PER_LINE_SCALE,\n \"_touchUnusedTicks\"\n );\n this.updateZoom(ticks, null, origin);\n }\n}\n\nfunction onTouchEnd(evt) {\n if (!this._touchInfo) {\n return;\n }\n\n evt.preventDefault();\n this._touchInfo = null;\n this._touchUnusedTicks = 0;\n this._touchUnusedFactor = 1;\n}\n\nfunction onClick(evt) {\n if (!this.secondaryToolbar?.isOpen) {\n return;\n }\n const appConfig = this.appConfig;\n if (\n this.pdfViewer.containsElement(evt.target) ||\n (appConfig.toolbar?.container.contains(evt.target) &&\n // TODO: change the `contains` for an equality check when the bug:\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1921984\n // is fixed.\n !appConfig.secondaryToolbar?.toggleButton.contains(evt.target))\n ) {\n this.secondaryToolbar.close();\n }\n}\n\nfunction onKeyUp(evt) {\n // evt.ctrlKey is false hence we use evt.key.\n if (evt.key === \"Control\") {\n this._isCtrlKeyDown = false;\n }\n}\n\nfunction onKeyDown(evt) {\n this._isCtrlKeyDown = evt.key === \"Control\";\n\n if (this.overlayManager.active) {\n return;\n }\n const { eventBus, pdfViewer } = this;\n const isViewerInPresentationMode = pdfViewer.isInPresentationMode;\n\n let handled = false,\n ensureViewerFocused = false;\n const cmd =\n (evt.ctrlKey ? 1 : 0) |\n (evt.altKey ? 2 : 0) |\n (evt.shiftKey ? 4 : 0) |\n (evt.metaKey ? 8 : 0);\n\n // First, handle the key bindings that are independent whether an input\n // control is selected or not.\n if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) {\n // either CTRL or META key with optional SHIFT.\n switch (evt.keyCode) {\n case 70: // f\n if (!this.supportsIntegratedFind && !evt.shiftKey) {\n this.findBar?.open();\n handled = true;\n }\n break;\n case 71: // g\n if (!this.supportsIntegratedFind) {\n const { state } = this.findController;\n if (state) {\n const newState = {\n source: window,\n type: \"again\",\n findPrevious: cmd === 5 || cmd === 12,\n };\n eventBus.dispatch(\"find\", { ...state, ...newState });\n }\n handled = true;\n }\n break;\n case 61: // FF/Mac '='\n case 107: // FF '+' and '='\n case 187: // Chrome '+'\n case 171: // FF with German keyboard\n this.zoomIn();\n handled = true;\n break;\n case 173: // FF/Mac '-'\n case 109: // FF '-'\n case 189: // Chrome '-'\n this.zoomOut();\n handled = true;\n break;\n case 48: // '0'\n case 96: // '0' on Numpad of Swedish keyboard\n if (!isViewerInPresentationMode) {\n // keeping it unhandled (to restore page zoom to 100%)\n setTimeout(() => {\n // ... and resetting the scale after browser adjusts its scale\n this.zoomReset();\n });\n handled = false;\n }\n break;\n\n case 38: // up arrow\n if (isViewerInPresentationMode || this.page > 1) {\n this.page = 1;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n case 40: // down arrow\n if (isViewerInPresentationMode || this.page < this.pagesCount) {\n this.page = this.pagesCount;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n }\n }\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC || CHROME\")) {\n // CTRL or META without shift\n if (cmd === 1 || cmd === 8) {\n switch (evt.keyCode) {\n case 83: // s\n eventBus.dispatch(\"download\", { source: window });\n handled = true;\n break;\n\n case 79: // o\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n eventBus.dispatch(\"openfile\", { source: window });\n handled = true;\n }\n break;\n }\n }\n }\n\n // CTRL+ALT or Option+Command\n if (cmd === 3 || cmd === 10) {\n switch (evt.keyCode) {\n case 80: // p\n this.requestPresentationMode();\n handled = true;\n this.externalServices.reportTelemetry({\n type: \"buttons\",\n data: { id: \"presentationModeKeyboard\" },\n });\n break;\n case 71: // g\n // focuses input#pageNumber field\n if (this.appConfig.toolbar) {\n this.appConfig.toolbar.pageNumber.select();\n handled = true;\n }\n break;\n }\n }\n\n if (handled) {\n if (ensureViewerFocused && !isViewerInPresentationMode) {\n pdfViewer.focus();\n }\n evt.preventDefault();\n return;\n }\n\n // Some shortcuts should not get handled if a control/input element\n // is selected.\n const curElement = getActiveOrFocusedElement();\n const curElementTagName = curElement?.tagName.toUpperCase();\n if (\n curElementTagName === \"INPUT\" ||\n curElementTagName === \"TEXTAREA\" ||\n curElementTagName === \"SELECT\" ||\n (curElementTagName === \"BUTTON\" &&\n (evt.keyCode === /* Enter = */ 13 || evt.keyCode === /* Space = */ 32)) ||\n curElement?.isContentEditable\n ) {\n // Make sure that the secondary toolbar is closed when Escape is pressed.\n if (evt.keyCode !== /* Esc = */ 27) {\n return;\n }\n }\n\n // No control key pressed at all.\n if (cmd === 0) {\n let turnPage = 0,\n turnOnlyIfPageFit = false;\n switch (evt.keyCode) {\n case 38: // up arrow\n if (this.supportsCaretBrowsingMode) {\n this.moveCaret(/* isUp = */ true, /* select = */ false);\n handled = true;\n break;\n }\n /* falls through */\n case 33: // pg up\n // vertical scrolling using arrow/pg keys\n if (pdfViewer.isVerticalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n turnPage = -1;\n break;\n case 8: // backspace\n if (!isViewerInPresentationMode) {\n turnOnlyIfPageFit = true;\n }\n turnPage = -1;\n break;\n case 37: // left arrow\n if (this.supportsCaretBrowsingMode) {\n return;\n }\n // horizontal scrolling using arrow keys\n if (pdfViewer.isHorizontalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n /* falls through */\n case 75: // 'k'\n case 80: // 'p'\n turnPage = -1;\n break;\n case 27: // esc key\n if (this.secondaryToolbar?.isOpen) {\n this.secondaryToolbar.close();\n handled = true;\n }\n if (!this.supportsIntegratedFind && this.findBar?.opened) {\n this.findBar.close();\n handled = true;\n }\n break;\n case 40: // down arrow\n if (this.supportsCaretBrowsingMode) {\n this.moveCaret(/* isUp = */ false, /* select = */ false);\n handled = true;\n break;\n }\n /* falls through */\n case 34: // pg down\n // vertical scrolling using arrow/pg keys\n if (pdfViewer.isVerticalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n turnPage = 1;\n break;\n case 13: // enter key\n case 32: // spacebar\n if (!isViewerInPresentationMode) {\n turnOnlyIfPageFit = true;\n }\n turnPage = 1;\n break;\n case 39: // right arrow\n if (this.supportsCaretBrowsingMode) {\n return;\n }\n // horizontal scrolling using arrow keys\n if (pdfViewer.isHorizontalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n /* falls through */\n case 74: // 'j'\n case 78: // 'n'\n turnPage = 1;\n break;\n\n case 36: // home\n if (isViewerInPresentationMode || this.page > 1) {\n this.page = 1;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n case 35: // end\n if (isViewerInPresentationMode || this.page < this.pagesCount) {\n this.page = this.pagesCount;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n\n case 83: // 's'\n this.pdfCursorTools?.switchTool(CursorTool.SELECT);\n break;\n case 72: // 'h'\n this.pdfCursorTools?.switchTool(CursorTool.HAND);\n break;\n\n case 82: // 'r'\n this.rotatePages(90);\n break;\n\n case 115: // F4\n this.pdfSidebar?.toggle();\n break;\n }\n\n if (\n turnPage !== 0 &&\n (!turnOnlyIfPageFit || pdfViewer.currentScaleValue === \"page-fit\")\n ) {\n if (turnPage > 0) {\n pdfViewer.nextPage();\n } else {\n pdfViewer.previousPage();\n }\n handled = true;\n }\n }\n\n // shift-key\n if (cmd === 4) {\n switch (evt.keyCode) {\n case 13: // enter key\n case 32: // spacebar\n if (\n !isViewerInPresentationMode &&\n pdfViewer.currentScaleValue !== \"page-fit\"\n ) {\n break;\n }\n pdfViewer.previousPage();\n\n handled = true;\n break;\n\n case 38: // up arrow\n this.moveCaret(/* isUp = */ true, /* select = */ true);\n handled = true;\n break;\n case 40: // down arrow\n this.moveCaret(/* isUp = */ false, /* select = */ true);\n handled = true;\n break;\n case 82: // 'r'\n this.rotatePages(-90);\n break;\n }\n }\n\n if (!handled && !isViewerInPresentationMode) {\n // 33=Page Up 34=Page Down 35=End 36=Home\n // 37=Left 38=Up 39=Right 40=Down\n // 32=Spacebar\n if (\n (evt.keyCode >= 33 && evt.keyCode <= 40) ||\n (evt.keyCode === 32 && curElementTagName !== \"BUTTON\")\n ) {\n ensureViewerFocused = true;\n }\n }\n\n if (ensureViewerFocused && !pdfViewer.containsElement(curElement)) {\n // The page container is not focused, but a page navigation key has been\n // pressed. Change the focus to the viewer container to make sure that\n // navigation by keyboard works as expected.\n pdfViewer.focus();\n }\n\n if (handled) {\n evt.preventDefault();\n }\n}\n\nfunction beforeUnload(evt) {\n evt.preventDefault();\n evt.returnValue = \"\";\n return false;\n}\n\nexport { PDFViewerApplication };\n","/* Copyright 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { RenderingStates, ScrollMode, SpreadMode } from \"./ui_utils.js\";\nimport { AppOptions } from \"./app_options.js\";\nimport { LinkTarget } from \"./pdf_link_service.js\";\nimport { PDFViewerApplication } from \"./app.js\";\n\n/* eslint-disable-next-line no-unused-vars */\nconst pdfjsVersion =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : void 0;\n/* eslint-disable-next-line no-unused-vars */\nconst pdfjsBuild =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_BUILD\") : void 0;\n\nconst AppConstants =\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n ? { LinkTarget, RenderingStates, ScrollMode, SpreadMode }\n : null;\n\nwindow.PDFViewerApplication = PDFViewerApplication;\nwindow.PDFViewerApplicationConstants = AppConstants;\nwindow.PDFViewerApplicationOptions = AppOptions;\n\nfunction getViewerConfiguration() {\n return {\n appContainer: document.body,\n principalContainer: document.getElementById(\"mainContainer\"),\n mainContainer: document.getElementById(\"viewerContainer\"),\n viewerContainer: document.getElementById(\"viewer\"),\n toolbar: {\n container: document.getElementById(\"toolbarContainer\"),\n numPages: document.getElementById(\"numPages\"),\n pageNumber: document.getElementById(\"pageNumber\"),\n scaleSelect: document.getElementById(\"scaleSelect\"),\n customScaleOption: document.getElementById(\"customScaleOption\"),\n previous: document.getElementById(\"previous\"),\n next: document.getElementById(\"next\"),\n zoomIn: document.getElementById(\"zoomInButton\"),\n zoomOut: document.getElementById(\"zoomOutButton\"),\n print: document.getElementById(\"printButton\"),\n editorFreeTextButton: document.getElementById(\"editorFreeTextButton\"),\n editorFreeTextParamsToolbar: document.getElementById(\n \"editorFreeTextParamsToolbar\"\n ),\n editorHighlightButton: document.getElementById(\"editorHighlightButton\"),\n editorHighlightParamsToolbar: document.getElementById(\n \"editorHighlightParamsToolbar\"\n ),\n editorHighlightColorPicker: document.getElementById(\n \"editorHighlightColorPicker\"\n ),\n editorInkButton: document.getElementById(\"editorInkButton\"),\n editorInkParamsToolbar: document.getElementById(\"editorInkParamsToolbar\"),\n editorStampButton: document.getElementById(\"editorStampButton\"),\n editorStampParamsToolbar: document.getElementById(\n \"editorStampParamsToolbar\"\n ),\n download: document.getElementById(\"downloadButton\"),\n },\n secondaryToolbar: {\n toolbar: document.getElementById(\"secondaryToolbar\"),\n toggleButton: document.getElementById(\"secondaryToolbarToggleButton\"),\n presentationModeButton: document.getElementById(\"presentationMode\"),\n openFileButton:\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n ? document.getElementById(\"secondaryOpenFile\")\n : null,\n printButton: document.getElementById(\"secondaryPrint\"),\n downloadButton: document.getElementById(\"secondaryDownload\"),\n viewBookmarkButton: document.getElementById(\"viewBookmark\"),\n firstPageButton: document.getElementById(\"firstPage\"),\n lastPageButton: document.getElementById(\"lastPage\"),\n pageRotateCwButton: document.getElementById(\"pageRotateCw\"),\n pageRotateCcwButton: document.getElementById(\"pageRotateCcw\"),\n cursorSelectToolButton: document.getElementById(\"cursorSelectTool\"),\n cursorHandToolButton: document.getElementById(\"cursorHandTool\"),\n scrollPageButton: document.getElementById(\"scrollPage\"),\n scrollVerticalButton: document.getElementById(\"scrollVertical\"),\n scrollHorizontalButton: document.getElementById(\"scrollHorizontal\"),\n scrollWrappedButton: document.getElementById(\"scrollWrapped\"),\n spreadNoneButton: document.getElementById(\"spreadNone\"),\n spreadOddButton: document.getElementById(\"spreadOdd\"),\n spreadEvenButton: document.getElementById(\"spreadEven\"),\n imageAltTextSettingsButton: document.getElementById(\n \"imageAltTextSettings\"\n ),\n imageAltTextSettingsSeparator: document.getElementById(\n \"imageAltTextSettingsSeparator\"\n ),\n documentPropertiesButton: document.getElementById(\"documentProperties\"),\n },\n sidebar: {\n // Divs (and sidebar button)\n outerContainer: document.getElementById(\"outerContainer\"),\n sidebarContainer: document.getElementById(\"sidebarContainer\"),\n toggleButton: document.getElementById(\"sidebarToggleButton\"),\n resizer: document.getElementById(\"sidebarResizer\"),\n // Buttons\n thumbnailButton: document.getElementById(\"viewThumbnail\"),\n outlineButton: document.getElementById(\"viewOutline\"),\n attachmentsButton: document.getElementById(\"viewAttachments\"),\n layersButton: document.getElementById(\"viewLayers\"),\n // Views\n thumbnailView: document.getElementById(\"thumbnailView\"),\n outlineView: document.getElementById(\"outlineView\"),\n attachmentsView: document.getElementById(\"attachmentsView\"),\n layersView: document.getElementById(\"layersView\"),\n // View-specific options\n currentOutlineItemButton: document.getElementById(\"currentOutlineItem\"),\n },\n findBar: {\n bar: document.getElementById(\"findbar\"),\n toggleButton: document.getElementById(\"viewFindButton\"),\n findField: document.getElementById(\"findInput\"),\n highlightAllCheckbox: document.getElementById(\"findHighlightAll\"),\n caseSensitiveCheckbox: document.getElementById(\"findMatchCase\"),\n matchDiacriticsCheckbox: document.getElementById(\"findMatchDiacritics\"),\n entireWordCheckbox: document.getElementById(\"findEntireWord\"),\n findMsg: document.getElementById(\"findMsg\"),\n findResultsCount: document.getElementById(\"findResultsCount\"),\n findPreviousButton: document.getElementById(\"findPreviousButton\"),\n findNextButton: document.getElementById(\"findNextButton\"),\n },\n passwordOverlay: {\n dialog: document.getElementById(\"passwordDialog\"),\n label: document.getElementById(\"passwordText\"),\n input: document.getElementById(\"password\"),\n submitButton: document.getElementById(\"passwordSubmit\"),\n cancelButton: document.getElementById(\"passwordCancel\"),\n },\n documentProperties: {\n dialog: document.getElementById(\"documentPropertiesDialog\"),\n closeButton: document.getElementById(\"documentPropertiesClose\"),\n fields: {\n fileName: document.getElementById(\"fileNameField\"),\n fileSize: document.getElementById(\"fileSizeField\"),\n title: document.getElementById(\"titleField\"),\n author: document.getElementById(\"authorField\"),\n subject: document.getElementById(\"subjectField\"),\n keywords: document.getElementById(\"keywordsField\"),\n creationDate: document.getElementById(\"creationDateField\"),\n modificationDate: document.getElementById(\"modificationDateField\"),\n creator: document.getElementById(\"creatorField\"),\n producer: document.getElementById(\"producerField\"),\n version: document.getElementById(\"versionField\"),\n pageCount: document.getElementById(\"pageCountField\"),\n pageSize: document.getElementById(\"pageSizeField\"),\n linearized: document.getElementById(\"linearizedField\"),\n },\n },\n altTextDialog: {\n dialog: document.getElementById(\"altTextDialog\"),\n optionDescription: document.getElementById(\"descriptionButton\"),\n optionDecorative: document.getElementById(\"decorativeButton\"),\n textarea: document.getElementById(\"descriptionTextarea\"),\n cancelButton: document.getElementById(\"altTextCancel\"),\n saveButton: document.getElementById(\"altTextSave\"),\n },\n newAltTextDialog: {\n dialog: document.getElementById(\"newAltTextDialog\"),\n title: document.getElementById(\"newAltTextTitle\"),\n descriptionContainer: document.getElementById(\n \"newAltTextDescriptionContainer\"\n ),\n textarea: document.getElementById(\"newAltTextDescriptionTextarea\"),\n disclaimer: document.getElementById(\"newAltTextDisclaimer\"),\n learnMore: document.getElementById(\"newAltTextLearnMore\"),\n imagePreview: document.getElementById(\"newAltTextImagePreview\"),\n createAutomatically: document.getElementById(\n \"newAltTextCreateAutomatically\"\n ),\n createAutomaticallyButton: document.getElementById(\n \"newAltTextCreateAutomaticallyButton\"\n ),\n downloadModel: document.getElementById(\"newAltTextDownloadModel\"),\n downloadModelDescription: document.getElementById(\n \"newAltTextDownloadModelDescription\"\n ),\n error: document.getElementById(\"newAltTextError\"),\n errorCloseButton: document.getElementById(\"newAltTextCloseButton\"),\n cancelButton: document.getElementById(\"newAltTextCancel\"),\n notNowButton: document.getElementById(\"newAltTextNotNow\"),\n saveButton: document.getElementById(\"newAltTextSave\"),\n },\n altTextSettingsDialog: {\n dialog: document.getElementById(\"altTextSettingsDialog\"),\n createModelButton: document.getElementById(\"createModelButton\"),\n aiModelSettings: document.getElementById(\"aiModelSettings\"),\n learnMore: document.getElementById(\"altTextSettingsLearnMore\"),\n deleteModelButton: document.getElementById(\"deleteModelButton\"),\n downloadModelButton: document.getElementById(\"downloadModelButton\"),\n showAltTextDialogButton: document.getElementById(\n \"showAltTextDialogButton\"\n ),\n altTextSettingsCloseButton: document.getElementById(\n \"altTextSettingsCloseButton\"\n ),\n closeButton: document.getElementById(\"altTextSettingsCloseButton\"),\n },\n annotationEditorParams: {\n editorFreeTextFontSize: document.getElementById(\"editorFreeTextFontSize\"),\n editorFreeTextColor: document.getElementById(\"editorFreeTextColor\"),\n editorInkColor: document.getElementById(\"editorInkColor\"),\n editorInkThickness: document.getElementById(\"editorInkThickness\"),\n editorInkOpacity: document.getElementById(\"editorInkOpacity\"),\n editorStampAddImage: document.getElementById(\"editorStampAddImage\"),\n editorFreeHighlightThickness: document.getElementById(\n \"editorFreeHighlightThickness\"\n ),\n editorHighlightShowAll: document.getElementById(\"editorHighlightShowAll\"),\n },\n printContainer: document.getElementById(\"printContainer\"),\n };\n}\n\nfunction webViewerLoad() {\n const config = getViewerConfiguration();\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"GENERIC\")) {\n // Give custom implementations of the default viewer a simpler way to\n // set various `AppOptions`, by dispatching an event once all viewer\n // files are loaded but *before* the viewer initialization has run.\n const event = new CustomEvent(\"webviewerloaded\", {\n bubbles: true,\n cancelable: true,\n detail: {\n source: window,\n },\n });\n try {\n // Attempt to dispatch the event at the embedding `document`,\n // in order to support cases where the viewer is embedded in\n // a *dynamically* created <iframe> element.\n parent.document.dispatchEvent(event);\n } catch (ex) {\n // The viewer could be in e.g. a cross-origin <iframe> element,\n // fallback to dispatching the event at the current `document`.\n console.error(`webviewerloaded: ${ex}`);\n document.dispatchEvent(event);\n }\n }\n PDFViewerApplication.run(config);\n}\n\n// Block the \"load\" event until all pages are loaded, to ensure that printing\n// works in Firefox; see https://bugzilla.mozilla.org/show_bug.cgi?id=1618553\ndocument.blockUnblockOnload?.(true);\n\nif (\n document.readyState === \"interactive\" ||\n document.readyState === \"complete\"\n) {\n webViewerLoad();\n} else {\n document.addEventListener(\"DOMContentLoaded\", webViewerLoad, true);\n}\n\nexport {\n PDFViewerApplication,\n AppConstants as PDFViewerApplicationConstants,\n AppOptions as PDFViewerApplicationOptions,\n};\n"],"names":["DEFAULT_SCALE_VALUE","DEFAULT_SCALE","DEFAULT_SCALE_DELTA","MIN_SCALE","MAX_SCALE","UNKNOWN_SCALE","MAX_AUTO_SCALE","SCROLLBAR_PADDING","VERTICAL_PADDING","RenderingStates","INITIAL","RUNNING","PAUSED","FINISHED","PresentationModeState","UNKNOWN","NORMAL","CHANGING","FULLSCREEN","SidebarView","NONE","THUMBS","OUTLINE","ATTACHMENTS","LAYERS","TextLayerMode","DISABLE","ENABLE","ENABLE_PERMISSIONS","ScrollMode","VERTICAL","HORIZONTAL","WRAPPED","PAGE","SpreadMode","ODD","EVEN","CursorTool","SELECT","HAND","ZOOM","AutoPrintRegExp","scrollIntoView","element","spot","scrollMatches","parent","offsetParent","console","error","offsetY","offsetTop","clientTop","offsetX","offsetLeft","clientLeft","clientHeight","scrollHeight","clientWidth","scrollWidth","classList","contains","getComputedStyle","overflow","top","undefined","left","scrollLeft","scrollTop","watchScroll","viewAreaElement","callback","abortSignal","debounceScroll","evt","rAF","window","requestAnimationFrame","viewAreaElementScrolled","currentX","lastX","state","right","currentY","lastY","down","_eventHandler","addEventListener","useCapture","signal","cancelAnimationFrame","once","parseQueryString","query","params","Map","key","value","URLSearchParams","set","toLowerCase","InvisibleCharsRegExp","removeNullCharacters","str","replaceInvisible","test","replaceAll","m","binarySearchFirstItem","items","condition","start","minIndex","maxIndex","length","currentIndex","currentItem","approximateFraction","x","Math","floor","xinv","limit","x_","a","b","c","d","p","q","result","floorToDivide","div","getPageSizeInches","view","userUnit","rotate","x1","y1","x2","y2","changeOrientation","width","height","backtrackBeforeAllVisibleElements","index","views","elt","pageTop","i","getVisibleElements","scrollEl","sortByVisibility","horizontal","rtl","bottom","isElementBottomAfterViewTop","elementBottom","isElementNextAfterViewHorizontally","elementLeft","elementRight","visible","ids","Set","numViews","firstVisibleElementInd","lastEdge","currentWidth","currentHeight","viewWidth","viewHeight","viewRight","viewBottom","hiddenHeight","max","hiddenWidth","fractionHeight","fractionWidth","percent","push","id","y","widthPercent","add","first","last","at","sort","pc","abs","normalizeWheelEventDirection","delta","hypot","deltaX","deltaY","angle","atan2","PI","normalizeWheelEventDelta","deltaMode","MOUSE_PIXELS_PER_LINE","MOUSE_LINES_PER_PAGE","WheelEvent","DOM_DELTA_PIXEL","DOM_DELTA_LINE","isValidRotation","Number","isInteger","isValidScrollMode","mode","Object","values","includes","isValidSpreadMode","isPortraitOrientation","size","animationStarted","Promise","resolve","docStyle","document","documentElement","style","clamp","v","min","ProgressBar","disableAutoFetchTimeout","constructor","bar","val","isNaN","remove","setProperty","setWidth","viewer","container","parentNode","scrollbarWidth","offsetWidth","setDisableAutoFetch","delay","clearTimeout","show","setTimeout","hide","getActiveOrFocusedElement","curRoot","curActiveOrFocused","activeElement","querySelector","shadowRoot","apiPageLayoutToViewerModes","layout","scrollMode","spreadMode","apiPageModeToSidebarView","toggleCheckedBtn","button","toggle","setAttribute","toggleExpandedBtn","calcRound","e","createElement","fround","compatParams","userAgent","navigator","platform","maxTouchPoints","isAndroid","isIOS","OptionKind","BROWSER","VIEWER","API","WORKER","EVENT_DISPATCH","PREFERENCE","Type","BOOLEAN","NUMBER","OBJECT","STRING","UNDEFINED","defaultOptions","allowedGlobalEvents","kind","canvasMaxAreaInBytes","isInAutomation","localeProperties","lang","language","nimbusDataStr","supportsCaretBrowsingMode","supportsDocumentFonts","supportsIntegratedFind","supportsMouseWheelZoomCtrlKey","supportsMouseWheelZoomMetaKey","supportsPinchToZoom","toolbarDensity","altTextLearnMoreUrl","annotationEditorMode","annotationMode","cursorToolOnLoad","debuggerSrc","defaultZoomDelay","defaultZoomValue","disableHistory","disablePageLabels","enableAltText","enableAltTextModelDownload","enableGuessAltText","enableHighlightFloatingButton","enableNewAltTextWhenAddingImage","enablePermissions","enablePrintAutoRotate","enableScripting","enableUpdatedAddImage","externalLinkRel","externalLinkTarget","highlightEditorColors","historyUpdateUrl","ignoreDestinationZoom","imageResourcesPath","maxCanvasPixels","forcePageColors","pageColorsBackground","pageColorsForeground","pdfBugEnabled","printResolution","sidebarViewOnLoad","scrollModeOnLoad","spreadModeOnLoad","textLayerMode","viewOnLoad","cMapPacked","cMapUrl","disableAutoFetch","disableFontFace","disableRange","disableStream","docBaseUrl","enableHWA","enableXfa","fontExtraProperties","isEvalSupported","isOffscreenCanvasSupported","maxImageSize","pdfBug","standardFontDataUrl","useSystemFonts","type","verbosity","workerPort","workerSrc","defaultUrl","sandboxBundleSrc","viewerCssTheme","enableFakeMLManager","disablePreferences","AppOptions","eventBus","opts","name","_hasInvokedSet","_checkDisablePreferences","get","warn","getAll","defaultOnly","options","create","defaultOpt","setAll","prefs","events","userOpt","toUpperCase","dispatch","source","DEFAULT_LINK_REL","LinkTarget","SELF","BLANK","PARENT","TOP","PDFLinkService","externalLinkEnabled","_ignoreDestinationZoom","baseUrl","pdfDocument","pdfViewer","pdfHistory","setDocument","setViewer","setHistory","pagesCount","numPages","page","currentPageNumber","rotation","pagesRotation","isInPresentationMode","goToDestination","dest","namedDest","explicitDest","pageNumber","getDestination","Array","isArray","destRef","cachedPageNumber","getPageIndex","pushCurrentPosition","scrollPageIntoView","destArray","goToPage","pageLabelToPageNumber","pushPage","addLinkAttributes","link","url","newWindow","Error","target","rel","href","title","onclick","targetStr","getDestinationHash","getAnchorUrl","escape","JSON","stringify","anchor","setHash","hash","has","phrase","match","zoomArgs","split","zoomArg","zoomArgNumber","parseFloat","allowNegativeOffset","unescape","parse","toString","isValidExplicitDest","executeNamedAction","action","back","forward","nextPage","previousPage","executeSetOCGState","optionalContentConfig","optionalContentConfigPromise","setOCGState","#isValidExplicitDest","zoom","args","num","gen","argsLen","allowNull","arg","SimpleLinkService","AbortException","AnnotationEditorLayer","AnnotationEditorParamsType","AnnotationEditorType","AnnotationEditorUIManager","AnnotationLayer","AnnotationMode","build","CMapCompressionType","ColorPicker","createValidAbsoluteUrl","DOMSVGFactory","DrawLayer","FeatureTest","fetchData","getDocument","getFilenameFromUrl","getPdfFilenameFromUrl","getXfaPageViewport","GlobalWorkerOptions","ImageKind","InvalidPDFException","isDataScheme","isPdfFile","MissingPDFException","noContextMenu","normalizeUnicode","OPS","OutputScale","PasswordResponses","PDFDataRangeTransport","PDFDateString","PDFWorker","PermissionFlag","PixelsPerInch","RenderingCancelledException","setLayerDimensions","shadow","TextLayer","UnexpectedResponseException","Util","VerbosityLevel","version","XfaLayer","globalThis","pdfjsLib","WaitOnType","EVENT","TIMEOUT","waitOnEventOrTimeout","promise","withResolvers","ac","AbortController","handler","abort","timeout","evtMethod","EventBus","bind","listeners","on","eventName","listener","_on","external","off","_off","data","eventListeners","externalListeners","slice","rmAbort","AbortSignal","aborted","onAbort","removeEventListener","ii","splice","FirefoxEventBus","externalServices","globalEventNames","BaseExternalServices","updateFindControlState","updateFindMatchesCount","initPassiveLoading","reportTelemetry","createL10n","createScripting","updateEditorStates","dispatchGlobalEvent","_event","BasePreferences","defaults","freeze","initializedPromise","_readFromStorage","then","browserPrefs","_writeToStorage","prefObj","reset","FluentType","valueOf","FluentNone","scope","FluentNumber","nf","memoizeIntlObject","Intl","NumberFormat","format","err","reportError","FluentDateTime","dtf","DateTimeFormat","Date","toISOString","MAX_PLACEABLES","FSI","PDI","selector","category","PluralRules","select","getDefault","variants","star","resolvePattern","RangeError","getArguments","positional","named","resolveExpression","expr","minimumFractionDigits","precision","resolveVariableReference","resolveMessageReference","resolveTermReference","resolveFunctionReference","resolveSelectExpression","prototype","hasOwnProperty","call","ReferenceError","getTime","TypeError","attr","message","bundle","_messages","attribute","attributes","term","_terms","resolved","func","_functions","sel","variant","resolveComplexPattern","ptn","dirty","useIsolating","_useIsolating","elem","_transform","placeables","delete","join","Scope","errors","WeakSet","ctor","cache","_intls","locales","allowed","unwrapped","opt","entries","NUMBER_ALLOWED","DATETIME_ALLOWED","DATETIME","getMemoizerForLocale","stringLocale","memoizer","FluentBundle","functions","transform","hasMessage","getMessage","addResource","res","allowOverrides","body","entry","startsWith","formatPattern","pattern","RE_MESSAGE_START","RE_ATTRIBUTE_START","RE_VARIANT_START","RE_NUMBER_LITERAL","RE_IDENTIFIER","RE_REFERENCE","RE_FUNCTION_NAME","RE_TEXT_RUN","RE_STRING_RUN","RE_STRING_ESCAPE","RE_UNICODE_ESCAPE","RE_LEADING_NEWLINES","RE_TRAILING_SPACES","RE_BLANK_LINES","RE_INDENT","TOKEN_BRACE_OPEN","TOKEN_BRACE_CLOSE","TOKEN_BRACKET_OPEN","TOKEN_BRACKET_CLOSE","TOKEN_PAREN_OPEN","TOKEN_ARROW","TOKEN_COLON","TOKEN_COMMA","TOKEN_BLANK","FluentResource","lastIndex","cursor","next","exec","parseMessage","SyntaxError","re","consumeChar","char","errorClass","consumeToken","match1","parsePattern","parseAttributes","keys","attrs","parsePatternElements","Infinity","indent","parseIndent","trim","elements","commonIndent","parsePlaceable","lastElement","baked","Indent","parseInlineExpression","parseVariants","sigil","parseArguments","parseLiteral","parseArgument","count","parseVariantKey","parseNumberLiteral","parseStringLiteral","fraction","parseEscapeSequence","codepoint4","codepoint6","codepoint","parseInt","String","fromCodePoint","makeIndent","text","replace","blank","reOverlay","TEXT_LEVEL_ELEMENTS","LOCALIZABLE_ATTRIBUTES","global","area","input","menuitem","menu","optgroup","option","track","img","textarea","th","description","label","textbox","translateElement","translation","localName","namespaceURI","textContent","templateElement","ownerDocument","createElementNS","innerHTML","overlayChildNodes","content","overlayAttributes","fromFragment","toElement","childNode","childNodes","nodeType","TEXT_NODE","hasAttribute","sanitized","getNodeForNamedElement","replaceChild","isElementAllowed","createSanitizedElement","createTextNodeFromTextContent","appendChild","fromElement","explicitlyAllowed","getAttribute","map","from","isAttrNameLocalizable","removeAttribute","sourceElement","translatedChild","childName","sourceChild","removeChild","clone","cloneNode","shallowPopulateUsing","createTextNode","attrName","elemName","CachedIterable","iterable","CachedSyncIterable","Symbol","iterator","cached","cur","touchNext","idx","done","CachedAsyncIterable","asyncIterator","default","Localization","resourceIds","generateBundles","onChange","addResourceIds","eager","removeResourceIds","filter","r","formatWithFallback","method","translations","hasAtLeastOneBundle","bundles","missingIds","keysFromBundle","locale","formatMessages","messageFromBundle","formatValues","valueFromBundle","formatValue","handleEvent","formatted","attrNames","messageErrors","forEach","L10NID_ATTR_NAME","L10NARGS_ATTR_NAME","L10N_ELEMENT_QUERY","DOMLocalization","roots","pendingrAF","pendingElements","windowElement","mutationObserver","observerConfig","characterData","childList","subtree","attributeFilter","translateRoots","setAttributes","getAttributes","connectRoot","newRoot","root","defaultView","MutationObserver","mutations","translateMutations","observe","disconnectRoot","pauseObserving","clear","resumeObserving","all","translateFragment","takeRecords","disconnect","mutation","addedNode","addedNodes","ELEMENT_NODE","childElementCount","getTranslatables","translateElements","frag","getKeysForElement","applyTranslations","nodes","querySelectorAll","L10n","dir","l10n","isRTL","fixupLangCode","_setL10n","getLanguage","getDirection","fallback","messages","translate","translateOnce","ex","destroy","pause","resume","#fixupLangCode","langCode","PARTIAL_LANG_CODES","en","es","fy","ga","gu","hi","hy","nb","ne","nn","pa","pt","sv","zh","#isRTL","shortCode","GenericL10n","createBundle","resource","generateBundlesFallback","#generateBundles","defaultLang","baseLang","baseURL","paths","getPaths","langs","shortLang","createBundleFallback","#createBundle","path","URL","#getPaths","#generateBundlesFallback","#createBundleFallback","docProperties","info","metadata","contentDispositionFilename","contentLength","getMetadata","getDownloadInfo","filesize","filename","getRaw","authors","GenericScripting","_ready","reject","sandbox","pdfjsSandbox","QuickJSSandbox","catch","createSandbox","dispatchEventInSandbox","event","dispatchEvent","destroySandbox","nukeSandbox","initCom","app","Preferences","localStorage","setItem","getItem","ExternalServices","MLManager","isEnabledFor","_name","deleteModel","_service","isReady","guess","_data","toggleService","_enabled","getFakeMLManager","FakeMLManager","hasProgress","setEventBus","loadModel","downloadModel","total","end","increment","loaded","setInterval","detail","totalLoaded","finished","clearInterval","request","output","enabled","NewAltTextManager","boundCancel","cancel","createAutomaticallyButton","currentEditor","cancelButton","descriptionContainer","dialog","disclaimer","downloadModelDescription","firstTime","guessedAltText","hasAI","isEditing","imagePreview","imageData","isAILoading","wasAILoading","learnMore","notNowButton","overlayManager","uiManager","previousAltText","saveButton","errorCloseButton","close","preventDefault","save","toggleError","checked","_reportTelemetry","status","setPreference","mlManager","toggleGuessAltText","toggleLoading","toggleTitleAndDisclaimer","register","topic","#toggleLoading","#toggleError","#toggleGuessAltText","isInitial","mlGuessAltText","toggleNotNow","#toggleNotNow","toggleAI","#toggleAI","#toggleTitleAndDisclaimer","hidden","#mlGuessAltText","addAltText","hasError","altText","#addAltText","setProgress","#setProgress","ONE_MEGA_BYTES","totalSize","ariaValueMax","round","downloadedSize","ariaValueNow","editAltText","editor","hasAltTextData","altTextFinish","isAltTextEnabledPromise","removeEditListeners","altTextData","AI_MAX_IMAGE_DIMENSION","MAX_PREVIEW_DIMENSION","canvas","copyCanvas","append","open","#cancel","alt_text_type","flow","alt_text_modal","finish","#finish","active","#close","firstChild","addEditListeners","setSelected","#save","decorative","guessedWords","words","total_words","words_removed","difference","words_added","ImageAltTextSettings","aiModelSettings","createModelButton","downloadModelButton","showAltTextDialogButton","closeButton","deleteModelButton","togglePref","download","#reportTelemetry","details","#download","isFromUI","disabled","span","setPref","#delete","#togglePref","#setPref","AltTextManager","boundUpdateUIState","updateUIState","boundSetPosition","setPosition","boundOnClick","onClick","hasUsedPointer","optionDescription","optionDecorative","svgElement","rectElement","telemetryData","_elements","createSVGElement","#createSVGElement","svgFactory","svg","defs","mask","rect","#setPosition","containerX","containerY","containerW","containerH","getBoundingClientRect","innerWidth","windowW","innerHeight","windowH","dialogW","dialogH","getClientDimensions","MARGIN","isLTR","direction","xs","xe","ys","ye","alt_text_keyboard","removeOnClickListeners","#updateUIState","alt_text_description","alt_text_edit","alt_text_decorative","#onClick","#removeOnClickListeners","AnnotationEditorParams","bindListeners","#bindListeners","editorFreeTextFontSize","editorFreeTextColor","editorInkColor","editorInkThickness","editorInkOpacity","editorStampAddImage","editorFreeHighlightThickness","editorHighlightShowAll","typeStr","valueAsNumber","FREETEXT_SIZE","FREETEXT_COLOR","INK_COLOR","INK_THICKNESS","INK_OPACITY","HIGHLIGHT_THICKNESS","HIGHLIGHT_FREE","HIGHLIGHT_SHOW_ALL","PRECISION","CaretBrowsingMode","mainContainer","toolBarHeight","viewerContainer","toolbarContainer","toolbarObserver","ResizeObserver","borderBoxSize","blockSize","isOnSameLine","#isOnSameLine","rect1","rect2","top1","bot1","mid1","top2","bot2","mid2","isUnderOver","#isUnderOver","isUp","midY","isVisible","#isVisible","getCaretPosition","#getCaretPosition","selection","focusNode","focusOffset","range","createRange","setStart","setEnd","caretPositionFromPoint","#caretPositionFromPoint","startContainer","offsetNode","startOffset","offset","caretRangeFromPoint","setCaretPositionHelper","#setCaretPositionHelper","caretX","extend","lastChild","caretPosition","parentElement","elementsAtPoint","elementsFromPoint","savedVisibilities","el","visibility","setCaretPosition","#setCaretPosition","newLineElement","newLineElementRect","getNodeOnNextPage","#getNodeOnNextPage","textLayer","closest","walker","createTreeWalker","NodeFilter","SHOW_TEXT","node","moveCaret","getSelection","rangeCount","focusElement","Node","currentNode","focusRect","nodeIterator","previousSibling","nextSibling","lastNode","addRange","caretY","elementRect","blobUrl","click","DownloadManager","openBlobUrls","WeakMap","downloadData","contentType","createObjectURL","Blob","openOrDownloadData","isPdfData","viewerUrl","encodeURIComponent","revokeObjectURL","OverlayManager","overlays","canForceClose","showModal","PasswordPrompt","activeCapability","updateCallback","reason","isViewerEmbedded","submitButton","_isViewerEmbedded","verify","keyCode","passwordIncorrect","INCORRECT_PASSWORD","focus","#verify","password","invokeCallback","#invokeCallback","setUpdateCallback","TREEITEM_OFFSET_TOP","TREEITEM_SELECTED_CLASS","BaseTreeViewer","_l10n","_pdfDocument","_lastToggleIsShow","_currentTreeItem","_dispatchEvent","_bindLink","_normalizeTextContent","_addToggleButton","toggler","className","stopPropagation","shiftKey","shouldShowAll","_toggleTreeItem","prepend","_toggleAllTreeItems","_finishRendering","fragment","hasAnyNesting","render","_updateCurrentTreeItem","treeItem","_scrollToCurrentTreeItem","firstElementChild","scrollTo","PDFAttachmentViewer","downloadManager","appendAttachment","keepRenderedCapability","_attachments","_renderedCapability","_pendingDispatchEvent","attachmentsCount","attachments","createDocumentFragment","item","#appendAttachment","renderedPromise","CSS_CLASS_GRAB","GrabToPan","activate","deactivate","_onMouseDown","onMouseDown","_onMouseMove","onMouseMove","_endPan","endPan","overlay","ignoreTarget","matches","#onMouseDown","originalTarget","tagName","scrollLeftStart","scrollTopStart","clientXStart","clientX","clientYStart","clientY","focusedElement","blur","#onMouseMove","buttons","xDiff","yDiff","behavior","#endPan","PDFCursorTools","prevActive","addEventListeners","switchTool","activeTool","tool","#switchTool","disableActiveTool","_handTool","#addEventListeners","presentationModeState","enableActive","disableActive","NON_METRIC_LOCALES","US_PAGE_NAMES","METRIC_PAGE_NAMES","getPageName","isPortrait","pageNames","PDFDocumentProperties","fieldData","fields","fileNameLookup","_fileNameLookup","_currentPageNumber","_pagesRotation","_dataAvailableCapability","updateUI","fileName","fileSize","creationDate","modificationDate","pageSize","isLinearized","parseFileSize","parseDate","CreationDate","ModDate","getPage","pdfPage","parsePageSize","parseLinearization","IsLinearized","Title","author","Author","subject","Subject","keywords","Keywords","creator","Creator","producer","Producer","PDFFormatVersion","pageCount","linearized","assign","#reset","#updateUI","#parseFileSize","kb","mb","#parsePageSize","pageSizeInches","nonMetric","sizeInches","sizeMillimeters","nameId","exactMillimeters","intMillimeters","unit","orientation","#parseDate","inputDate","dateObj","toDateObject","#parseLinearization","CharacterType","SPACE","ALPHA_LETTER","PUNCT","HAN_LETTER","KATAKANA_LETTER","HIRAGANA_LETTER","HALFWIDTH_KATAKANA_LETTER","THAI_LETTER","isAlphabeticalScript","charCode","isAscii","isAsciiAlpha","isAsciiDigit","isAsciiSpace","isHan","isKatakana","isHiragana","isHalfwidthKatakana","isThai","getCharacterType","NormalizeWithNFKC","getNormalizeWithNFKC","FindState","FOUND","NOT_FOUND","PENDING","FIND_TIMEOUT","MATCH_SCROLL_OFFSET_TOP","MATCH_SCROLL_OFFSET_LEFT","CHARACTERS_TO_NORMALIZE","DIACRITICS_EXCEPTION","DIACRITICS_EXCEPTION_STR","DIACRITICS_REG_EXP","SPECIAL_CHARS_REG_EXP","NOT_DIACRITIC_FROM_END_REG_EXP","NOT_DIACRITIC_FROM_START_REG_EXP","SYLLABLES_REG_EXP","SYLLABLES_LENGTHS","FIRST_CHAR_SYLLABLES_REG_EXP","NFKC_CHARS_TO_NORMALIZE","noSyllablesRegExp","withSyllablesRegExp","normalize","syllablePositions","len","normalizationRegex","toNormalizeWithNFKC","CJK","HKDiacritics","CompoundWord","regexp","RegExp","rawDiacriticsPositions","normalized","positions","rawDiacriticsIndex","syllableIndex","shift","shiftOrigin","eol","hasDiacritics","p1","p2","p3","p4","p5","p6","p7","p8","p9","replacement","jj","j","charAt","hasTrailingDashEOL","endsWith","newCharLen","getOriginalIndex","diffs","pos","oldStart","oldEnd","oldLen","PDFFindController","updateMatchesCountOnProgress","visitedPagesCount","linkService","_linkService","_eventBus","onIsPageVisible","onFind","onFindBarClose","highlightMatches","_highlightMatches","pageMatches","_pageMatches","pageMatchesLength","_pageMatchesLength","selected","_selected","_firstPageCapability","#onFind","shouldDirtyMatch","_dirtyMatch","extractText","findbarClosed","pendingTimeout","_findTimeout","nextMatch","highlightAll","updateAllPages","scrollMatchIntoView","selectedLeft","pageIndex","matchIndex","_scrollMatches","matchIdx","pageIdx","_offset","wrapped","_extractTextPromises","_pageContents","_pageDiffs","_hasDiacritics","_matchesCountTotal","_pagesToSearch","_pendingFindMatches","_resumePageIdx","#query","_rawQuery","_normalizedQuery","#shouldDirtyMatch","newQuery","prevQuery","newType","prevType","isEntireWord","#isEntireWord","startIdx","charCodeAt","convertToRegExpString","#convertToRegExpString","matchDiacritics","isUnicode","trailingSpaces","fromCharCode","calculateMatch","#calculateMatch","pageContent","matcherResult","matchesLength","matchPos","matchLen","updatePage","nextPageMatch","pageMatchesCount","updateUIResultsCount","reverse","isUnicodePart","queryPart","caseSensitive","entireWord","flags","#extractText","deferred","textOptions","disableNormalization","getTextContent","strBuf","textItem","hasEOL","#updatePage","#updateAllPages","#nextMatch","previous","findPrevious","currentPageIndex","numPageMatches","updateMatch","advanceOffsetPage","matchesReady","#matchesReady","numMatches","#nextPageMatch","#advanceOffsetPage","#updateMatch","found","#onFindBarClose","requestMatchesCount","#requestMatchesCount","current","#updateUIResultsCount","matchesCount","rawQuery","MATCHES_COUNT_LIMIT","PDFFindBar","resizeObserver","resizeObserverCallback","opened","toggleButton","findField","highlightAllCheckbox","caseSensitiveCheckbox","matchDiacriticsCheckbox","entireWordCheckbox","findMsg","findResultsCount","findPreviousButton","findNextButton","findPrev","findMsgId","updateResultsCount","#resizeObserverCallback","findbarHeight","inputContainerHeight","HASH_CHANGE_TIMEOUT","POSITION_UPDATED_THRESHOLD","UPDATE_VIEWAREA_TIMEOUT","getCurrentHash","location","PDFHistory","eventAbortController","_initialized","_fingerprint","_isPagesLoaded","initialize","fingerprint","resetHistory","updateUrl","reInitialized","_updateUrl","bindEvents","history","_popStateInProgress","_blockHashChange","_currentHash","_numPositionUpdates","_uid","_maxUid","_destination","_position","isValidState","parseCurrentHash","pushOrReplaceState","destination","updateInternalState","uid","_initialRotation","_initialBookmark","pageHide","unbindEvents","_updateViewareaTimeout","isValidPage","forceReplace","isDestHashesEqual","isDestArraysEqual","tryPushCurrentPosition","popStateInProgress","initialBookmark","initialRotation","#pushOrReplaceState","shouldReplace","newState","newUrl","replaceState","pushState","#tryPushCurrentPosition","temporary","position","#isValidPage","#isValidState","checkReload","perfEntry","performance","getEntriesByType","#updateInternalState","removeTemporary","#parseCurrentHash","checkNameddest","substring","nameddest","updateViewarea","#updateViewarea","pdfOpenParams","popState","#popState","newHash","hashChanged","#pageHide","#bindEvents","#unbindEvents","destHash","pushHash","firstDest","secondDest","isEntryEqual","second","PDFLayerViewer","updateLayers","_optionalContentConfig","_optionalContentVisibility","layersCount","groupId","setVisibility","_setNestedName","fontStyle","groups","getOrder","queue","levelData","itemsDiv","order","group","getGroup","#updateLayers","getOptionalContentConfig","intent","PDFOutlineViewer","_currentOutlineItem","_currentOutlineItemCapability","_sidebarView","_outline","_pageNumberToDestHashCapability","outlineCount","loadingParams","currentOutlineItemPromise","attachment","_setStyles","bold","italic","fontWeight","totalCount","nestedCount","nestedItems","outline","pageNumberToDestHash","_getPageNumberToDestHash","linkElement","pageNumberNesting","nesting","currentNesting","DELAY_BEFORE_HIDING_CONTROLS","ACTIVE_SELECTOR","CONTROLS_SELECTOR","MOUSE_SCROLL_COOLDOWN_TIME","PAGE_SWITCH_THRESHOLD","SWIPE_MIN_DISTANCE_THRESHOLD","SWIPE_ANGLE_THRESHOLD","PDFPresentationMode","fullscreenChangeAbortController","windowAbortController","contextMenuOpen","mouseScrollTimeStamp","mouseScrollDelta","touchSwipeState","requestFullscreen","addFullscreenChangeListeners","notifyStateChange","scaleValue","currentScaleValue","pageViewsReady","hasEqualPageSizes","removeFullscreenChangeListeners","mouseWheel","#mouseWheel","currentTime","now","storedTime","resetMouseScrollState","totalDelta","success","#notifyStateChange","enter","#enter","addWindowListeners","showControls","empty","exit","#exit","removeWindowListeners","hideControls","mouseDown","#mouseDown","contextMenu","#contextMenu","#showControls","controlsTimeout","#hideControls","#resetMouseScrollState","touchSwipe","#touchSwipe","touches","startX","pageX","startY","pageY","endX","endY","dx","dy","absAngle","#addWindowListeners","touchSwipeBind","passive","#removeWindowListeners","#addFullscreenChangeListeners","fullscreenElement","#removeFullscreenChangeListeners","XfaLayerBuilder","annotationStorage","xfaHtml","_cancelled","viewport","parameters","dontFlip","getXfa","textDivs","update","getXfaHtmlForPrinting","printContainer","allXfaHtml","scale","PDF_TO_CSS_UNITS","xfaPage","children","builder","activeService","viewerApp","initialized","renderPage","activeServiceOnEntry","printAnnotationStoragePromise","scratchCanvas","PRINT_UNITS","PDF","ctx","getContext","fillStyle","fillRect","restore","printAnnotationStorage","renderContext","canvasContext","getViewport","ENABLE_STORAGE","renderTask","PDFPrintService","pagesOverview","_printResolution","_optionalContentConfigPromise","_printAnnotationStoragePromise","currentPage","throwIfInactive","every","pageStyleSheet","ensureOverlay","renderPages","isPureXfa","renderNextPage","renderProgress","useRenderedPage","toBlob","blob","src","wrapper","onload","onerror","performPrint","print","eventType","CustomEvent","bubbles","cancelable","getElementById","progress","progressBar","progressPerc","ctrlKey","metaKey","altKey","chrome","opera","stopImmediatePropagation","stopPropagationIfNeeded","overlayPromise","PDFPrintServiceFactory","initGlobals","supportsPrinting","createPrintService","CLEANUP_TIMEOUT","PDFRenderingQueue","pdfThumbnailViewer","onIdle","highestPriorityPage","idleTimeout","printing","isThumbnailViewEnabled","defineProperty","setThumbnailViewer","isHighestPriority","renderingId","renderHighestPriority","currentlyVisiblePages","forceRendering","getHighestPriority","scrolledDown","preRenderExtra","visibleViews","numVisible","isViewFinished","firstId","lastId","visibleIds","holeId","holeView","preRenderIndex","preRenderView","renderingState","renderView","draw","finally","PDFScriptingManager","closeCapability","destroyCapability","ready","scripting","willPrintCapability","destroyScripting","objects","calculationOrder","docActions","getFieldObjects","getCalculationOrderIds","getJSActions","initScripting","updateFromSandbox","dispatchPageClose","dispatchPageOpen","_pageOpenPending","appInfo","docInfo","actions","dispatchWillSave","dispatchDidSave","dispatchWillPrint","dispatchDidPrint","destroyPromise","_visitedPages","#updateFromSandbox","isChangingPresentationMode","siblings","command","modes","pagesPromise","log","increaseScale","decreaseScale","elementId","setValue","#dispatchPageOpen","visitedPages","pageView","getPageView","actionsPromise","#dispatchPageClose","#initScripting","#destroyScripting","race","SIDEBAR_WIDTH_VAR","SIDEBAR_MIN_WIDTH","SIDEBAR_RESIZING_CLASS","UI_NOTIFICATION_CLASS","PDFSidebar","mouseAC","outerContainerWidth","isOpen","isInitialViewSet","isInitialEventDispatched","onToggled","onUpdateThumbnails","outerContainer","sidebarContainer","resizer","thumbnailButton","outlineButton","attachmentsButton","layersButton","thumbnailView","outlineView","attachmentsView","layersView","_currentOutlineItemButton","currentOutlineItemButton","hideUINotification","switchView","visibleView","setInitialView","forceOpen","isViewChanged","#dispatchEvent","showUINotification","#showUINotification","#hideUINotification","onTreeLoaded","mouseMove","mouseUp","updateWidth","updated","#updateWidth","maxWidth","#mouseMove","#mouseUp","DRAW_UPSCALE_FACTOR","MAX_NUM_SCALING_STEPS","THUMBNAIL_WIDTH","TempImageFactory","tempCanvas","getCanvas","alpha","destroyCanvas","PDFThumbnailView","defaultViewport","renderingQueue","pageColors","pageLabel","pdfPageRotate","pageL10nArgs","updateDims","_placeholderImg","#updateDims","ratio","canvasWidth","canvasHeight","setPdfPage","totalRotation","cancelRendering","image","replaceWith","getPageDrawContext","#getPageDrawContext","upscaleFactor","willReadFrequently","outputScale","sx","sy","scaled","convertCanvasToImage","#convertCanvasToImage","reducedCanvas","reduceImage","toDataURL","finishRenderTask","#finishRenderTask","drawViewport","renderContinueCallback","cont","onContinue","resultPromise","setImage","thumbnailCanvas","#reduceImage","drawImage","reducedWidth","reducedHeight","reducedImage","reducedImageCtx","#pageL10nArgs","setPageLabel","THUMBNAIL_SCROLL_MARGIN","THUMBNAIL_SELECTED_CLASS","PDFThumbnailViewer","scroll","scrollUpdated","resetView","#scrollUpdated","getThumbnail","_thumbnails","getVisibleThumbs","#getVisibleThumbs","scrollThumbnailIntoView","prevThumbnailView","shouldScroll","updateArgs","thumbnail","cleanup","#resetView","_pageLabels","firstPagePromise","firstPdfPage","pageNum","#cancelRendering","setPageLabels","labels","ensurePdfPageLoaded","#ensurePdfPageLoaded","thumbView","getScrollAhead","#getScrollAhead","visibleThumbs","scrollAhead","AnnotationEditorLayerBuilder","annotationLayer","drawLayer","onAppend","structTreeLayer","accessibilityManager","annotationEditorLayer","clonedViewport","annotations","isInvisible","AnnotationLayerBuilder","renderForms","hasJSActionsPromise","fieldObjectsPromise","annotationCanvasMap","annotationEditorUIManager","_hasJSActionsPromise","_fieldObjectsPromise","_annotationCanvasMap","_accessibilityManager","_annotationEditorUIManager","hasJSActions","fieldObjects","getAnnotations","updatePresentationModeState","hasEditableAnnotations","#updatePresentationModeState","disableFormElements","section","inert","DrawLayerBuilder","setParent","getDrawLayer","PDF_ROLE_TO_HTML_ROLE","Document","DocumentFragment","Part","Sect","Div","Aside","NonStruct","P","H","FENote","Sub","Lbl","Span","Em","Strong","Link","Annot","Form","Ruby","RB","RT","RP","Warichu","WT","WP","L","LI","LBody","Table","TR","TH","TD","THead","TBody","TFoot","Caption","Figure","Formula","Artifact","HEADING_PATTERN","StructTreeLayerBuilder","treeDom","treePromise","elementAttributes","rawDims","elementsToAddToTextLayer","getStructTree","walk","getAriaAttributes","annotationId","#setAttributes","structElement","htmlElement","alt","added","child","addImageInTextLayer","#addImageInTextLayer","bbox","pageHeight","calc","addElementsToTextLayer","#walk","role","kid","TextAccessibilityManager","textChildren","textNodes","waitingElements","setTextMapping","compareElementPositions","#compareElementPositions","e1","e2","centerX1","centerX2","enable","nodeIndex","addIdToAriaOwns","isRemovable","addPointerInTextLayer","disable","removePointerInTextLayer","owns","#addIdToAriaOwns","moveElementInDOM","contentElement","hasChildNodes","elementToCompare","before","after","TextHighlighter","findController","textContentItemsStr","divs","texts","_updateMatches","_convertMatches","iIndex","mm","begin","divIdx","_renderMatches","isSelectedPage","selectedMatchIdx","prevEnd","infinity","beginText","appendTextToDiv","fromOffset","toOffset","i0","i1","lastDivIdx","lastOffset","isSelected","highlightSuffix","n0","n1","clearedUntilDivIdx","n","TextLayerBuilder","renderingDone","textLayers","selectionChangeAbortController","highlighter","tabIndex","textContentParams","onBefore","textContentSource","streamTextContent","includeMarkedContent","endOfContent","bindMouse","removeGlobalSelectionListener","#bindMouse","clipboardData","setData","enableGlobalSelectionListener","#removeGlobalSelectionListener","textLayerDiv","#enableGlobalSelectionListener","isPointerDown","isFirefox","prevRange","activeTextLayers","getRangeAt","intersectsNode","endDiv","getPropertyValue","modifyStart","compareBoundaryPoints","Range","END_TO_END","START_TO_END","endContainer","parentTextLayer","insertBefore","cloneRange","DEFAULT_LAYER_PROPERTIES","LAYERS_ORDER","PDFPageView","ENABLE_FORMS","hasRestrictedScaling","layerProperties","loadingId","previousRotation","scaleRoundX","scaleRoundY","renderError","useThumbnailCanvas","directDrawing","initialOptionalContent","regularAnnotations","viewportMap","layers","_isStandalone","hasViewer","_container","zoomLayer","xfaLayer","setDimensions","background","hasInitialVisibility","addLayer","#addLayer","oldDiv","layer","#setDimensions","foreground","filterFactory","addHighlightHCMFilter","_textHighlighter","dispatchLayerRendered","#dispatchLayerRendered","renderAnnotationLayer","#renderAnnotationLayer","renderAnnotationEditorLayer","#renderAnnotationEditorLayer","renderDrawLayer","#renderDrawLayer","renderXfaLayer","#renderXfaLayer","buildXfaTextContentItems","renderTextLayer","#renderTextLayer","renderStructTreeLayer","#renderStructTreeLayer","#buildXfaTextContentItems","_resetZoomLayer","removeFromDOM","zoomLayerCanvas","keepZoomLayer","keepAnnotationLayer","keepAnnotationEditorLayer","keepXfaLayer","keepTextLayer","zoomLayerNode","annotationLayerNode","annotationEditorLayerNode","xfaLayerNode","textLayerNode","layerIndex","indexOf","toggleEditingMode","drawingDelay","onlyCssZoom","postponeDrawing","cancelExtraDelay","cssTransform","redrawAnnotationLayer","redrawAnnotationEditorLayer","redrawXfaLayer","redrawTextLayer","hideTextLayer","timestamp","originalViewport","relativeRotation","absRotation","scaleX","scaleY","getPagePoint","convertToPdfPoint","separateAnnots","canvasWrapper","annotationLayerDiv","showCanvas","hasHCM","isLastShow","invScale","pixelsInViewport","maxScale","sqrt","sfx","sfy","pageWidth","annotationEditorLayerDiv","DEFAULT_CACHE_SIZE","PagesCountLimit","FORCE_SCROLL_MODE_PAGE","FORCE_LAZY_PAGE_INIT","PAUSE_EAGER_PAGE_INIT","isValidAnnotationEditorMode","PDFPageViewBuffer","buf","destroyFirstView","resize","newSize","idsToKeep","#destroyFirstView","firstView","PDFViewer","buffer","altTextManager","annotationEditorHighlightColors","containerTopLeft","switchAnnotationEditorModeAC","switchAnnotationEditorModeTimeoutId","getAllTextInProgress","hiddenCopyElement","interruptCopyCondition","previousContainerHeight","scrollModePageState","scaleTimeoutId","viewerVersion","_getVisiblePages","_scriptingManager","scriptingManager","removePageBorders","defaultRenderingQueue","_scrollUpdate","_resetView","updateContainerHeightCss","_pages","getCachedPageViews","_setCurrentPageNumber","resetCurrentPageView","currentPageLabel","currentScale","_currentScale","setScale","noScroll","_currentScaleValue","refresh","onePageRendered","_onePageRenderedCapability","_pagesCapability","_layerProperties","self","initializePermissions","#initializePermissions","permissions","COPY","MODIFY_CONTENTS","MODIFY_ANNOTATIONS","FILL_INTERACTIVE_FORMS","onePageRenderedOrForceFetch","#onePageRenderedOrForceFetch","visibilityState","hiddenCapability","onVisibilityChange","getAllText","copyCallback","#copyCallback","anchorNode","containsNode","ev","clipboard","writeText","_cancelRendering","permissionsPromise","getPermissions","_scrollMode","onBeforeDraw","onAfterDraw","any","STAMP","updateMode","viewerElement","ensurePageViewVisible","_spreadMode","_updateSpreadMode","getPagesLeft","Language","_location","_previousScrollMode","previousPageNumber","scrollDown","pages","_updateScrollMode","cleanupSwitchAnnotationEditorMode","#ensurePageViewVisible","pageIndexSet","parity","spread","dummyPage","#scrollIntoView","pageSpot","isSameScale","#isSameScale","newScale","setScaleUpdatePages","#setScaleUpdatePages","newValue","preset","origin","presetValue","previousScale","scaleDiff","pageWidthScaleFactor","#pageWidthScaleFactor","#setScale","hPadding","vPadding","pageWidthScale","pageHeightScale","horizontalScale","#resetCurrentPageView","widthScale","heightScale","boundingRect","convertToViewportPoint","_updateLocation","firstPage","normalizedScaleValue","currentPageView","topLeft","intLeft","intTop","visiblePages","numVisiblePages","newCacheSize","isSimpleLayout","currentId","stillFullyVisible","switchToEditAnnotationMode","#switchToEditAnnotationMode","pagesToRefresh","containsElement","_isContainerRtl","isHorizontalScrollbarEnabled","isVerticalScrollbarEnabled","firstPageView","getPagesOverview","initialOrientation","_getPageAdvance","pageLayout","yArray","expectedId","advance","updateScale","scaleFactor","steps","ceil","toFixed","#updateContainerHeightCss","#cleanupSwitchAnnotationEditorMode","editId","isFromKeyboard","updater","resetModifiedIds","idsToRefresh","noUpdate","SecondaryToolbar","presentationModeButton","printButton","downloadButton","viewBookmarkButton","firstPageButton","lastPageButton","pageRotateCwButton","pageRotateCcwButton","cursorSelectToolButton","eventDetails","cursorHandToolButton","scrollPageButton","scrollVerticalButton","scrollHorizontalButton","scrollWrappedButton","spreadNoneButton","spreadOddButton","spreadEvenButton","imageAltTextSettingsButton","documentPropertiesButton","openFileButton","setPageNumber","setPagesCount","scrollModeChanged","spreadModeChanged","cursorToolChanged","#cursorToolChanged","#scrollModeChanged","forceScrollModePage","isHorizontal","#spreadModeChanged","toolbar","Toolbar","zoomIn","zoomOut","editorFreeTextButton","FREETEXT","editorHighlightButton","HIGHLIGHT","editorInkButton","INK","editorStampButton","telemetry","updateToolbarDensity","#updateToolbarDensity","setAnnotationEditorUIManager","#setAnnotationEditorUIManager","parentContainer","colorPicker","setMainHighlightColorPicker","renderMainDropdown","hasPageLabels","setPageScale","pageScaleValue","pageScale","updateLoadingIndicatorState","editorModeChanged","editorHighlightColorPicker","scaleSelect","oncontextmenu","#editorModeChanged","editorFreeTextParamsToolbar","editorHighlightParamsToolbar","editorInkParamsToolbar","editorStampParamsToolbar","isDisable","resetNumPages","predefinedValueFound","customScaleOption","loading","DEFAULT_VIEW_HISTORY_CACHE_SIZE","ViewHistory","cacheSize","_initializedPromise","databaseStr","database","files","branch","file","setMultiple","properties","defaultValue","getMultiple","FORCE_PAGES_LOADED_TIMEOUT","ViewOnLoad","PREVIOUS","PDFViewerApplication","_initializedCapability","settled","appConfig","pdfLoadingTask","printService","pdfRenderingQueue","pdfPresentationMode","pdfDocumentProperties","pdfLinkService","pdfSidebar","pdfOutlineViewer","pdfAttachmentViewer","pdfLayerViewer","pdfCursorTools","pdfScriptingManager","store","preferences","secondaryToolbar","annotationEditorParams","imageAltTextSettings","_downloadUrl","_eventBusAbortController","_windowAbortController","_globalAbortController","documentInfo","_contentDispositionFilename","_contentLength","_saveInProgress","_wheelUnusedTicks","_wheelUnusedFactor","_touchUnusedTicks","_touchUnusedFactor","_PDFBug","_hasAnnotationEditors","_title","_touchInfo","_isCtrlKeyDown","_caretBrowsing","_isScrolling","_parseHashParams","getElementsByTagName","appContainer","_initializeViewerComponents","bindWindowEvents","loadPDFBug","PDFBug","loadCSS","init","check","_cleanup","_scriptingDocProperties","matchMedia","newAltTextDialog","altTextDialog","sidebar","findBar","principalContainer","altTextSettingsDialog","documentProperties","_docFilename","imageAltTextSettingsSeparator","supportsFullscreen","passwordOverlay","passwordPrompt","run","config","queryString","search","validateFileURL","fileInput","_openFileInput","dataTransfer","dropEffect","effectAllowed","msg","_hideViewBookmark","updateZoom","zoomReset","fullscreenEnabled","loadingBar","barElement","setTitleUsingUrl","downloadUrl","decodeURIComponent","setTitle","editorIndicator","_unblockDocumentLoadEvent","_annotationStorageModified","promises","workerParams","originalUrl","apiParams","loadingTask","onPassword","onProgress","load","_documentError","getData","saveDocument","stats","editorStats","downloadOrSave","moreInfo","_otherError","moreInfoText","stack","lineNumber","level","pageLayoutPromise","getPageLayout","pageModePromise","getPageMode","openActionPromise","getOpenAction","storedPromise","fingerprints","sidebarView","_initializeAnnotationStorageCallbacks","timeStamp","stored","pageMode","openAction","_initializePdfHistory","initialDest","_initializeAutoPrint","getOutline","getAttachments","_initializePageLabels","_initializeMetadata","jsActions","triggerAutoPrint","some","js","triggerPrinting","pdfTitle","metadataTitle","IsXFAPresent","IsAcroFormPresent","IsSignaturesPresent","getPageLabels","numLabels","standardLabels","emptyLabels","onSetModified","beforeUnload","onResetModified","onAnnotationEditor","storedHash","setRotation","setViewerModes","beforePrint","alert","afterPrint","resetModified","rotatePages","requestPresentationMode","onResize","onHashchange","onPageRender","onPageRendered","onUpdateViewarea","onPageChanging","onScaleChanging","onRotationChanging","onSidebarViewChanged","onPageMode","onNamedAction","onPageNumberChanged","onViewerModesChanged","onImageAltTextSettings","onFindFromUrlHash","onUpdateFindMatchesCount","onUpdateFindControlState","onFileInputChange","onOpenFile","addWindowResolutionChange","mediaQueryList","devicePixelRatio","onWheel","onTouchStart","onTouchMove","onTouchEnd","onKeyDown","onKeyUp","_lastScrollTop","_lastScrollLeft","scrollend","unbindWindowEvents","testingClose","_accumulateTicks","ticks","prop","wholeTicks","trunc","_accumulateFactor","factor","newFactor","blockUnblockOnload","scriptingReady","HOSTED_VIEWER_ORIGINS","viewerOrigin","fileOrigin","exp","isBuiltInMac","isPinchToZoom","deltaZ","DOM_DELTA_PAGE","sign","PIXELS_PER_LINE_SCALE","touch0","touch1","identifier","touch0X","touch0Y","touch1X","touch1Y","page0X","page0Y","page1X","page1Y","pTouch0X","pTouch0Y","pTouch1X","pTouch1Y","v1X","v1Y","v2X","v2Y","det","diff0X","diff1X","diff0Y","diff1Y","dotProduct","distance","pDistance","newScaleFactor","isViewerInPresentationMode","handled","ensureViewerFocused","cmd","curElement","curElementTagName","isContentEditable","turnPage","turnOnlyIfPageFit","returnValue","pdfjsVersion","pdfjsBuild","AppConstants","PDFViewerApplicationConstants","PDFViewerApplicationOptions","getViewerConfiguration","createAutomatically","altTextSettingsCloseButton","webViewerLoad","readyState"],"sourceRoot":""} |