HOME


Mini Shell 1.0
Negocios La Pieza.DO | Registrate o Inicia Sesión

Inicie Sesión en su Cuenta de Negocios

Olvidó Contraseña?
DIR: /var/www/node-app/node_modules/pdfjs-dist/web/
Upload File :
Current File : //var/www/node-app/node_modules/pdfjs-dist/web/pdf_viewer.mjs.map
{"version":3,"file":"pdf_viewer.mjs","mappings":";;;;;;;;;;;;;;;;;;;;;;SAAA;SACA;;;;;UCDA;UACA;UACA;UACA;UACA,yCAAyC,wCAAwC;UACjF;UACA;UACA;;;;;UCPA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACeA,MAAMA,mBAAmB,GAAG,MAAM;AAClC,MAAMC,aAAa,GAAG,GAAG;AACzB,MAAMC,mBAAmB,GAAG,GAAG;AAC/B,MAAMC,SAAS,GAAG,GAAG;AACrB,MAAMC,SAAS,GAAG,IAAI;AACtB,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,cAAc,GAAG,IAAI;AAC3B,MAAMC,iBAAiB,GAAG,EAAE;AAC5B,MAAMC,gBAAgB,GAAG,CAAC;AAE1B,MAAMC,eAAe,GAAG;EACtBC,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE,CAAC;EACVC,MAAM,EAAE,CAAC;EACTC,QAAQ,EAAE;AACZ,CAAC;AAED,MAAMC,qBAAqB,GAAG;EAC5BC,OAAO,EAAE,CAAC;EACVC,MAAM,EAAE,CAAC;EACTC,QAAQ,EAAE,CAAC;EACXC,UAAU,EAAE;AACd,CAAC;AAED,MAAMC,WAAW,GAAG;EAClBJ,OAAO,EAAE,CAAC,CAAC;EACXK,IAAI,EAAE,CAAC;EACPC,MAAM,EAAE,CAAC;EACTC,OAAO,EAAE,CAAC;EACVC,WAAW,EAAE,CAAC;EACdC,MAAM,EAAE;AACV,CAAC;AAED,MAAMC,aAAa,GAAG;EACpBC,OAAO,EAAE,CAAC;EACVC,MAAM,EAAE,CAAC;EACTC,kBAAkB,EAAE;AACtB,CAAC;AAED,MAAMC,UAAU,GAA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AOA,CAAC8I,QAAQ,GAAG,KAAK,EAAEC,UAAU,GAAGtpD,MAAM,CAAC6e,MAAM,CAAC,IAAI,CAAC,EAAE;IAC1D,IAAI,CAAC,IAAI,CAACxU,WAAW,EAAE;MACrB;IACF;IACA,KAAK,MAAMkwC,QAAQ,IAAI,IAAI,CAACiF,MAAM,EAAE;MAClCjF,QAAQ,CAAC3+B,MAAM,CAAC0tC,UAAU,CAAC;IAC7B;IACA,IAAI,IAAI,CAAC,CAAC5K,cAAc,KAAK,IAAI,EAAE;MACjC38C,YAAY,CAAC,IAAI,CAAC,CAAC28C,cAAc,CAAC;MAClC,IAAI,CAAC,CAACA,cAAc,GAAG,IAAI;IAC7B;IACA,IAAI,CAAC2K,QAAQ,EAAE;MACb,IAAI,CAACztC,MAAM,CAAC,CAAC;IACf;EACF;AACF;;;AC7zEuD;AACX;AAE5C,MAAM2tC,mBAAmB,SAAS7L,SAAS,CAAC;EAC1C4B,UAAUA,CAAA,EAAG;IACX,KAAK,CAACA,UAAU,CAAC,CAAC;IAClB,IAAI,CAACkD,WAAW,GAAGpuD,UAAU,CAACI,IAAI;IAClC,IAAI,CAAC0uD,WAAW,GAAGzuD,UAAU,CAACd,IAAI;EACpC;EAGA,IAAIgP,UAAUA,CAAC5C,IAAI,EAAE,CAAC;EAEtB+jD,iBAAiBA,CAAA,EAAG,CAAC;EAGrB,IAAIlhD,UAAUA,CAAC7C,IAAI,EAAE,CAAC;EAEtBojD,iBAAiBA,CAAA,EAAG,CAAC;AACvB;;;ACnBwE;AAKzC;AAOR;AACgD;AACf;AACZ;AACG;AACD;AACG;AAC0B;AACT;AACtB;AAC4B;AACb;AACF;AAGzD,MAAMqG,YAAY,GACkB,QAAwC;AAE5E,MAAMC,UAAU,GACoB,WAAsC","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/pdf_find_utils.js","webpack://pdf.js/./web/pdf_find_controller.js","webpack://pdf.js/./web/pdf_link_service.js","webpack://pdf.js/./web/pdfjs.js","webpack://pdf.js/./web/annotation_layer_builder.js","webpack://pdf.js/./web/download_manager.js","webpack://pdf.js/./web/event_utils.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/types.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/resolver.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/scope.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/builtins.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/memoizer.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/bundle.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/resource.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/index.js","webpack://pdf.js/./node_modules/@fluent/dom/esm/overlay.js","webpack://pdf.js/./node_modules/cached-iterable/src/cached_iterable.mjs","webpack://pdf.js/./node_modules/cached-iterable/src/cached_sync_iterable.mjs","webpack://pdf.js/./node_modules/cached-iterable/src/cached_async_iterable.mjs","webpack://pdf.js/./node_modules/cached-iterable/src/index.mjs","webpack://pdf.js/./node_modules/@fluent/dom/esm/localization.js","webpack://pdf.js/./node_modules/@fluent/dom/esm/dom_localization.js","webpack://pdf.js/./node_modules/@fluent/dom/esm/index.js","webpack://pdf.js/./web/l10n.js","webpack://pdf.js/./web/genericl10n.js","webpack://pdf.js/./web/pdf_history.js","webpack://pdf.js/./web/annotation_editor_layer_builder.js","webpack://pdf.js/./web/app_options.js","webpack://pdf.js/./web/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/xfa_layer_builder.js","webpack://pdf.js/./web/pdf_page_view.js","webpack://pdf.js/./web/generic_scripting.js","webpack://pdf.js/./web/pdf_scripting_manager.js","webpack://pdf.js/./web/pdf_scripting_manager.component.js","webpack://pdf.js/./web/pdf_rendering_queue.js","webpack://pdf.js/./web/pdf_viewer.js","webpack://pdf.js/./web/pdf_single_page_viewer.js","webpack://pdf.js/./web/pdf_viewer.component.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","/* Copyright 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 * Scale factors for the canvas, necessary with HiDPI displays.\n */\nclass OutputScale {\n  constructor() {\n    const pixelRatio = window.devicePixelRatio || 1;\n\n    /**\n     * @type {number} Horizontal scale.\n     */\n    this.sx = pixelRatio;\n\n    /**\n     * @type {number} Vertical scale.\n     */\n    this.sy = pixelRatio;\n  }\n\n  /**\n   * @type {boolean} Returns `true` when scaling is required, `false` otherwise.\n   */\n  get scaled() {\n    return this.sx !== 1 || this.sy !== 1;\n  }\n}\n\n/**\n * Scrolls specified element into view of its parent.\n * @param {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&param2=...).\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\nexport {\n  animationStarted,\n  apiPageLayoutToViewerModes,\n  apiPageModeToSidebarView,\n  approximateFraction,\n  AutoPrintRegExp,\n  backtrackBeforeAllVisibleElements, // only exported for testing\n  binarySearchFirstItem,\n  CursorTool,\n  DEFAULT_SCALE,\n  DEFAULT_SCALE_DELTA,\n  DEFAULT_SCALE_VALUE,\n  docStyle,\n  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  OutputScale,\n  parseQueryString,\n  PresentationModeState,\n  ProgressBar,\n  removeNullCharacters,\n  RenderingStates,\n  SCROLLBAR_PADDING,\n  scrollIntoView,\n  ScrollMode,\n  SidebarView,\n  SpreadMode,\n  TextLayerMode,\n  toggleCheckedBtn,\n  toggleExpandedBtn,\n  UNKNOWN_SCALE,\n  VERTICAL_PADDING,\n  watchScroll,\n};\n","/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst CharacterType = {\n  SPACE: 0,\n  ALPHA_LETTER: 1,\n  PUNCT: 2,\n  HAN_LETTER: 3,\n  KATAKANA_LETTER: 4,\n  HIRAGANA_LETTER: 5,\n  HALFWIDTH_KATAKANA_LETTER: 6,\n  THAI_LETTER: 7,\n};\n\nfunction isAlphabeticalScript(charCode) {\n  return charCode < 0x2e80;\n}\n\nfunction isAscii(charCode) {\n  return (charCode & 0xff80) === 0;\n}\n\nfunction isAsciiAlpha(charCode) {\n  return (\n    (charCode >= /* a = */ 0x61 && charCode <= /* z = */ 0x7a) ||\n    (charCode >= /* A = */ 0x41 && charCode <= /* Z = */ 0x5a)\n  );\n}\n\nfunction isAsciiDigit(charCode) {\n  return charCode >= /* 0 = */ 0x30 && charCode <= /* 9 = */ 0x39;\n}\n\nfunction isAsciiSpace(charCode) {\n  return (\n    charCode === /* SPACE = */ 0x20 ||\n    charCode === /* TAB = */ 0x09 ||\n    charCode === /* CR = */ 0x0d ||\n    charCode === /* LF = */ 0x0a\n  );\n}\n\nfunction isHan(charCode) {\n  return (\n    (charCode >= 0x3400 && charCode <= 0x9fff) ||\n    (charCode >= 0xf900 && charCode <= 0xfaff)\n  );\n}\n\nfunction isKatakana(charCode) {\n  return charCode >= 0x30a0 && charCode <= 0x30ff;\n}\n\nfunction isHiragana(charCode) {\n  return charCode >= 0x3040 && charCode <= 0x309f;\n}\n\nfunction isHalfwidthKatakana(charCode) {\n  return charCode >= 0xff60 && charCode <= 0xff9f;\n}\n\nfunction isThai(charCode) {\n  return (charCode & 0xff80) === 0x0e00;\n}\n\n/**\n * This function is based on the word-break detection implemented in:\n * https://hg.mozilla.org/mozilla-central/file/tip/intl/lwbrk/WordBreaker.cpp\n */\nfunction getCharacterType(charCode) {\n  if (isAlphabeticalScript(charCode)) {\n    if (isAscii(charCode)) {\n      if (isAsciiSpace(charCode)) {\n        return CharacterType.SPACE;\n      } else if (\n        isAsciiAlpha(charCode) ||\n        isAsciiDigit(charCode) ||\n        charCode === /* UNDERSCORE = */ 0x5f\n      ) {\n        return CharacterType.ALPHA_LETTER;\n      }\n      return CharacterType.PUNCT;\n    } else if (isThai(charCode)) {\n      return CharacterType.THAI_LETTER;\n    } else if (charCode === /* NBSP = */ 0xa0) {\n      return CharacterType.SPACE;\n    }\n    return CharacterType.ALPHA_LETTER;\n  }\n\n  if (isHan(charCode)) {\n    return CharacterType.HAN_LETTER;\n  } else if (isKatakana(charCode)) {\n    return CharacterType.KATAKANA_LETTER;\n  } else if (isHiragana(charCode)) {\n    return CharacterType.HIRAGANA_LETTER;\n  } else if (isHalfwidthKatakana(charCode)) {\n    return CharacterType.HALFWIDTH_KATAKANA_LETTER;\n  }\n  return CharacterType.ALPHA_LETTER;\n}\n\nlet NormalizeWithNFKC;\nfunction getNormalizeWithNFKC() {\n  /* eslint-disable no-irregular-whitespace */\n  NormalizeWithNFKC ||= ` ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩`;\n\n  if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n    const ranges = [];\n    const range = [];\n    const diacriticsRegex = /^\\p{M}$/u;\n    // Some chars must be replaced by their NFKC counterpart during a search.\n    for (let i = 0; i < 65536; i++) {\n      const c = String.fromCharCode(i);\n      if (c.normalize(\"NFKC\") !== c && !diacriticsRegex.test(c)) {\n        if (range.length !== 2) {\n          range[0] = range[1] = i;\n          continue;\n        }\n        if (range[1] + 1 !== i) {\n          if (range[0] === range[1]) {\n            ranges.push(String.fromCharCode(range[0]));\n          } else {\n            ranges.push(\n              `${String.fromCharCode(range[0])}-${String.fromCharCode(\n                range[1]\n              )}`\n            );\n          }\n          range[0] = range[1] = i;\n        } else {\n          range[1] = i;\n        }\n      }\n    }\n    if (ranges.join(\"\") !== NormalizeWithNFKC) {\n      throw new Error(\n        \"getNormalizeWithNFKC - update the `NormalizeWithNFKC` string.\"\n      );\n    }\n  }\n  return NormalizeWithNFKC;\n}\n\nexport { CharacterType, getCharacterType, getNormalizeWithNFKC };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFDocumentProxy} PDFDocumentProxy */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { binarySearchFirstItem, scrollIntoView } from \"./ui_utils.js\";\nimport { getCharacterType, getNormalizeWithNFKC } from \"./pdf_find_utils.js\";\n\nconst FindState = {\n  FOUND: 0,\n  NOT_FOUND: 1,\n  WRAPPED: 2,\n  PENDING: 3,\n};\n\nconst FIND_TIMEOUT = 250; // ms\nconst MATCH_SCROLL_OFFSET_TOP = -50; // px\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 regexp = `([${replace}])|([${toNormalizeWithNFKC}])|(${HKDiacritics}\\\\n)|(\\\\p{M}+(?:-\\\\n)?)|(\\\\S-\\\\n)|(${CJK}\\\\n)|(\\\\n)`;\n\n    if (syllablePositions.length === 0) {\n      // Most of the syllables belong to Hangul so there are no need\n      // to search for them in a non-Hangul document.\n      // We use the \\0 in order to have the same number of groups.\n      normalizationRegex = noSyllablesRegExp = new RegExp(\n        regexp + \"|(\\\\u0000)\",\n        \"gum\"\n      );\n    } else {\n      normalizationRegex = withSyllablesRegExp = new RegExp(\n        regexp + `|(${FIRST_CHAR_SYLLABLES_REG_EXP})`,\n        \"gum\"\n      );\n    }\n  }\n\n  // The goal of this function is to normalize the string and\n  // be able to get from an index in the new string the\n  // corresponding index in the old string.\n  // For example if we have: abCd12ef456gh where C is replaced by ccc\n  // and numbers replaced by nothing (it's the case for diacritics), then\n  // we'll obtain the normalized string: abcccdefgh.\n  // So here the reverse map is: [0,1,2,2,2,3,6,7,11,12].\n\n  // The goal is to obtain the array: [[0, 0], [3, -1], [4, -2],\n  // [6, 0], [8, 3]].\n  // which can be used like this:\n  //  - let say that i is the index in new string and j the index\n  //    the old string.\n  //  - if i is in [0; 3[ then j = i + 0\n  //  - if i is in [3; 4[ then j = i - 1\n  //  - if i is in [4; 6[ then j = i - 2\n  //  ...\n  // Thanks to a binary search it's easy to know where is i and what's the\n  // shift.\n  // Let say that the last entry in the array is [x, s] and we have a\n  // substitution at index y (old string) which will replace o chars by n chars.\n  // Firstly, if o === n, then no need to add a new entry: the shift is\n  // the same.\n  // Secondly, if o < n, then we push the n - o elements:\n  // [y - (s - 1), s - 1], [y - (s - 2), s - 2], ...\n  // Thirdly, if o > n, then we push the element: [y - (s - n), o + s - n]\n\n  // Collect diacritics length and positions.\n  const rawDiacriticsPositions = [];\n  while ((m = DIACRITICS_REG_EXP.exec(text)) !== null) {\n    rawDiacriticsPositions.push([m[0].length, m.index]);\n  }\n\n  let normalized = text.normalize(\"NFD\");\n  const positions = [[0, 0]];\n  let rawDiacriticsIndex = 0;\n  let syllableIndex = 0;\n  let shift = 0;\n  let shiftOrigin = 0;\n  let eol = 0;\n  let hasDiacritics = false;\n\n  normalized = normalized.replace(\n    normalizationRegex,\n    (match, p1, p2, p3, p4, p5, p6, p7, p8, i) => {\n      i -= shiftOrigin;\n      if (p1) {\n        // Maybe fractions or quotations mark...\n        const replacement = CHARACTERS_TO_NORMALIZE[p1];\n        const jj = replacement.length;\n        for (let j = 1; j < jj; j++) {\n          positions.push([i - shift + j, shift - j]);\n        }\n        shift -= jj - 1;\n        return replacement;\n      }\n\n      if (p2) {\n        // Use the NFKC representation to normalize the char.\n        let replacement = NFKC_CHARS_TO_NORMALIZE.get(p2);\n        if (!replacement) {\n          replacement = p2.normalize(\"NFKC\");\n          NFKC_CHARS_TO_NORMALIZE.set(p2, replacement);\n        }\n        const jj = replacement.length;\n        for (let j = 1; j < jj; j++) {\n          positions.push([i - shift + j, shift - j]);\n        }\n        shift -= jj - 1;\n        return replacement;\n      }\n\n      if (p3) {\n        // We've a Katakana-Hiragana diacritic followed by a \\n so don't replace\n        // the \\n by a whitespace.\n        hasDiacritics = true;\n\n        // Diacritic.\n        if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) {\n          ++rawDiacriticsIndex;\n        } else {\n          // i is the position of the first diacritic\n          // so (i - 1) is the position for the letter before.\n          positions.push([i - 1 - shift + 1, shift - 1]);\n          shift -= 1;\n          shiftOrigin += 1;\n        }\n\n        // End-of-line.\n        positions.push([i - shift + 1, shift]);\n        shiftOrigin += 1;\n        eol += 1;\n\n        return p3.charAt(0);\n      }\n\n      if (p4) {\n        const hasTrailingDashEOL = p4.endsWith(\"\\n\");\n        const len = hasTrailingDashEOL ? p4.length - 2 : p4.length;\n\n        // Diacritics.\n        hasDiacritics = true;\n        let jj = len;\n        if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) {\n          jj -= rawDiacriticsPositions[rawDiacriticsIndex][0];\n          ++rawDiacriticsIndex;\n        }\n\n        for (let j = 1; j <= jj; j++) {\n          // i is the position of the first diacritic\n          // so (i - 1) is the position for the letter before.\n          positions.push([i - 1 - shift + j, shift - j]);\n        }\n        shift -= jj;\n        shiftOrigin += jj;\n\n        if (hasTrailingDashEOL) {\n          // Diacritics are followed by a -\\n.\n          // See comments in `if (p5)` block.\n          i += len - 1;\n          positions.push([i - shift + 1, 1 + shift]);\n          shift += 1;\n          shiftOrigin += 1;\n          eol += 1;\n          return p4.slice(0, len);\n        }\n\n        return p4;\n      }\n\n      if (p5) {\n        // \"X-\\n\" is removed because an hyphen at the end of a line\n        // with not a space before is likely here to mark a break\n        // in a word.\n        // If X is encoded with UTF-32 then it can have a length greater than 1.\n        // The \\n isn't in the original text so here y = i, n = X.len - 2 and\n        // o = X.len - 1.\n        const len = p5.length - 2;\n        positions.push([i - shift + len, 1 + shift]);\n        shift += 1;\n        shiftOrigin += 1;\n        eol += 1;\n        return p5.slice(0, -2);\n      }\n\n      if (p6) {\n        // An ideographic at the end of a line doesn't imply adding an extra\n        // white space.\n        // A CJK can be encoded in UTF-32, hence their length isn't always 1.\n        const len = p6.length - 1;\n        positions.push([i - shift + len, shift]);\n        shiftOrigin += 1;\n        eol += 1;\n        return p6.slice(0, -1);\n      }\n\n      if (p7) {\n        // eol is replaced by space: \"foo\\nbar\" is likely equivalent to\n        // \"foo bar\".\n        positions.push([i - shift + 1, shift - 1]);\n        shift -= 1;\n        shiftOrigin += 1;\n        eol += 1;\n        return \" \";\n      }\n\n      // p8\n      if (i + eol === syllablePositions[syllableIndex]?.[1]) {\n        // A syllable (1 char) is replaced with several chars (n) so\n        // newCharsLen = n - 1.\n        const newCharLen = syllablePositions[syllableIndex][0] - 1;\n        ++syllableIndex;\n        for (let j = 1; j <= newCharLen; j++) {\n          positions.push([i - (shift - j), shift - j]);\n        }\n        shift -= newCharLen;\n        shiftOrigin += newCharLen;\n      }\n      return p8;\n    }\n  );\n\n  positions.push([normalized.length, shift]);\n\n  return [normalized, positions, hasDiacritics];\n}\n\n// Determine the original, non-normalized, match index such that highlighting of\n// search results is correct in the `textLayer` for strings containing e.g. \"½\"\n// characters; essentially \"inverting\" the result of the `normalize` function.\nfunction getOriginalIndex(diffs, pos, len) {\n  if (!diffs) {\n    return [pos, len];\n  }\n\n  // 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 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  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  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 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 {string} intent (default value is 'display')\n   * @returns {Promise<void>} A promise that is resolved when rendering of the\n   *   annotations is complete.\n   */\n  async render(viewport, intent = \"display\") {\n    if (this.div) {\n      if (this._cancelled || !this.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    });\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 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 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","/**\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                        \"�\";\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// &amp;, &#0038;, &#x0026;.\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 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 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\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 {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  #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  }\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      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 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 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  #treeDom = undefined;\n\n  get renderingDone() {\n    return this.#treeDom !== undefined;\n  }\n\n  render(structTree) {\n    if (this.#treeDom !== undefined) {\n      return this.#treeDom;\n    }\n    const treeDom = this.#walk(structTree);\n    treeDom?.classList.add(\"structTree\");\n    return (this.#treeDom = treeDom);\n  }\n\n  hide() {\n    if (this.#treeDom && !this.#treeDom.hidden) {\n      this.#treeDom.hidden = true;\n    }\n  }\n\n  show() {\n    if (this.#treeDom?.hidden) {\n      this.#treeDom.hidden = false;\n    }\n  }\n\n  #setAttributes(structElement, htmlElement) {\n    const { alt, id, lang } = structElement;\n    if (alt !== undefined) {\n      htmlElement.setAttribute(\"aria-label\", removeNullCharacters(alt));\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  #walk(node) {\n    if (!node) {\n      return null;\n    }\n\n    const element = document.createElement(\"span\");\n    if (\"role\" in node) {\n      const { role } = node;\n      const match = role.match(HEADING_PATTERN);\n      if (match) {\n        element.setAttribute(\"role\", \"heading\");\n        element.setAttribute(\"aria-level\", match[1]);\n      } else if (PDF_ROLE_TO_HTML_ROLE[role]) {\n        element.setAttribute(\"role\", PDF_ROLE_TO_HTML_ROLE[role]);\n      }\n    }\n\n    this.#setAttributes(node, element);\n\n    if (node.children) {\n      if (node.children.length === 1 && \"id\" in node.children[0]) {\n        // Often there is only one content node so just set the values on the\n        // parent node to avoid creating an extra span.\n        this.#setAttributes(node.children[0], element);\n      } else {\n        for (const kid of node.children) {\n          element.append(this.#walk(kid));\n        }\n      }\n    }\n    return element;\n  }\n}\n\nexport { StructTreeLayerBuilder };\n","/* Copyright 2022 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { binarySearchFirstItem } from \"./ui_utils.js\";\n\n/**\n * This class aims to provide some methods:\n *  - to reorder elements in the DOM with respect to the visual order;\n *  - to create a link, using aria-owns, between spans in the textLayer and\n *    annotations in the annotationLayer. The goal is to help to know\n *    where the annotations are in the text flow.\n */\nclass TextAccessibilityManager {\n  #enabled = false;\n\n  #textChildren = null;\n\n  #textNodes = new Map();\n\n  #waitingElements = new Map();\n\n  setTextMapping(textDivs) {\n    this.#textChildren = textDivs;\n  }\n\n  /**\n   * Compare the positions of two elements, it must correspond to\n   * the visual ordering.\n   *\n   * @param {HTMLElement} e1\n   * @param {HTMLElement} e2\n   * @returns {number}\n   */\n  static #compareElementPositions(e1, e2) {\n    const rect1 = e1.getBoundingClientRect();\n    const rect2 = e2.getBoundingClientRect();\n\n    if (rect1.width === 0 && rect1.height === 0) {\n      return +1;\n    }\n\n    if (rect2.width === 0 && rect2.height === 0) {\n      return -1;\n    }\n\n    const top1 = rect1.y;\n    const bot1 = rect1.y + rect1.height;\n    const mid1 = rect1.y + rect1.height / 2;\n\n    const top2 = rect2.y;\n    const bot2 = rect2.y + rect2.height;\n    const mid2 = rect2.y + rect2.height / 2;\n\n    if (mid1 <= top2 && mid2 >= bot1) {\n      return -1;\n    }\n\n    if (mid2 <= top1 && mid1 >= bot2) {\n      return +1;\n    }\n\n    const centerX1 = rect1.x + rect1.width / 2;\n    const centerX2 = rect2.x + rect2.width / 2;\n\n    return centerX1 - centerX2;\n  }\n\n  /**\n   * Function called when the text layer has finished rendering.\n   */\n  enable() {\n    if (this.#enabled) {\n      throw new Error(\"TextAccessibilityManager is already enabled.\");\n    }\n    if (!this.#textChildren) {\n      throw new Error(\"Text divs and strings have not been set.\");\n    }\n\n    this.#enabled = true;\n    this.#textChildren = this.#textChildren.slice();\n    this.#textChildren.sort(TextAccessibilityManager.#compareElementPositions);\n\n    if (this.#textNodes.size > 0) {\n      // Some links have been made before this manager has been disabled, hence\n      // we restore them.\n      const textChildren = this.#textChildren;\n      for (const [id, nodeIndex] of this.#textNodes) {\n        const element = document.getElementById(id);\n        if (!element) {\n          // If the page was *fully* reset the element no longer exists, and it\n          // will be re-inserted later (i.e. when the annotationLayer renders).\n          this.#textNodes.delete(id);\n          continue;\n        }\n        this.#addIdToAriaOwns(id, textChildren[nodeIndex]);\n      }\n    }\n\n    for (const [element, isRemovable] of this.#waitingElements) {\n      this.addPointerInTextLayer(element, isRemovable);\n    }\n    this.#waitingElements.clear();\n  }\n\n  disable() {\n    if (!this.#enabled) {\n      return;\n    }\n\n    // Don't clear this.#textNodes which is used to rebuild the aria-owns\n    // in case it's re-enabled at some point.\n\n    this.#waitingElements.clear();\n    this.#textChildren = null;\n    this.#enabled = false;\n  }\n\n  /**\n   * Remove an aria-owns id from a node in the text layer.\n   * @param {HTMLElement} element\n   */\n  removePointerInTextLayer(element) {\n    if (!this.#enabled) {\n      this.#waitingElements.delete(element);\n      return;\n    }\n\n    const children = this.#textChildren;\n    if (!children || children.length === 0) {\n      return;\n    }\n\n    const { id } = element;\n    const nodeIndex = this.#textNodes.get(id);\n    if (nodeIndex === undefined) {\n      return;\n    }\n\n    const node = children[nodeIndex];\n\n    this.#textNodes.delete(id);\n    let owns = node.getAttribute(\"aria-owns\");\n    if (owns?.includes(id)) {\n      owns = owns\n        .split(\" \")\n        .filter(x => x !== id)\n        .join(\" \");\n      if (owns) {\n        node.setAttribute(\"aria-owns\", owns);\n      } else {\n        node.removeAttribute(\"aria-owns\");\n        node.setAttribute(\"role\", \"presentation\");\n      }\n    }\n  }\n\n  #addIdToAriaOwns(id, node) {\n    const owns = node.getAttribute(\"aria-owns\");\n    if (!owns?.includes(id)) {\n      node.setAttribute(\"aria-owns\", owns ? `${owns} ${id}` : id);\n    }\n    node.removeAttribute(\"role\");\n  }\n\n  /**\n   * Find the text node which is the nearest and add an aria-owns attribute\n   * in order to correctly position this editor in the text flow.\n   * @param {HTMLElement} element\n   * @param {boolean} isRemovable\n   * @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 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 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  PixelsPerInch,\n  RenderingCancelledException,\n  setLayerDimensions,\n  shadow,\n} from \"pdfjs-lib\";\nimport {\n  approximateFraction,\n  DEFAULT_SCALE,\n  floorToDivide,\n  OutputScale,\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  #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      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(this.viewport, \"display\");\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    this.structTreeLayer ||= new StructTreeLayerBuilder();\n\n    const tree = await (!this.structTreeLayer.renderingDone\n      ? this.pdfPage.getStructTree()\n      : null);\n    const treeDom = this.structTreeLayer?.render(tree);\n    if (treeDom) {\n      // Pause translation when inserting the structTree in the DOM.\n      this.l10n.pause();\n      this.canvas?.append(treeDom);\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 (this.structTreeLayer && !this.textLayer) {\n      this.structTreeLayer = null;\n    }\n    if (\n      this.annotationLayer &&\n      (!keepAnnotationLayer || !this.annotationLayer.div)\n    ) {\n      this.annotationLayer.cancel();\n      this.annotationLayer = null;\n      this._annotationCanvasMap = null;\n    }\n    if (\n      this.annotationEditorLayer &&\n      (!keepAnnotationEditorLayer || !this.annotationEditorLayer.div)\n    ) {\n      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    canvas.width = floorToDivide(width * outputScale.sx, sfx[0]);\n    canvas.height = floorToDivide(height * outputScale.sy, sfy[0]);\n    const { style } = canvas;\n    style.width = floorToDivide(width, sfx[1]) + \"px\";\n    style.height = floorToDivide(height, sfy[1]) + \"px\";\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.#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          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 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 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 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { docProperties, GenericScripting } from \"./generic_scripting.js\";\nimport { PDFScriptingManager } from \"./pdf_scripting_manager.js\";\n\nclass PDFScriptingManagerComponents extends PDFScriptingManager {\n  constructor(options) {\n    // The default viewer already handles adding/removing of DOM events,\n    // hence limit this to only the viewer components.\n    if (!options.externalServices) {\n      window.addEventListener(\"updatefromsandbox\", event => {\n        options.eventBus.dispatch(\"updatefromsandbox\", {\n          source: window,\n          detail: event.detail,\n        });\n      });\n    }\n\n    options.externalServices ||= {\n      createScripting: () => new GenericScripting(options.sandboxBundleSrc),\n    };\n    options.docProperties ||= pdfDocument => docProperties(pdfDocument);\n    super(options);\n  }\n}\n\nexport { PDFScriptingManagerComponents as PDFScriptingManager };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces\").IRenderableView} IRenderableView */\n/** @typedef {import(\"./pdf_viewer\").PDFViewer} PDFViewer */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_thumbnail_viewer\").PDFThumbnailViewer} PDFThumbnailViewer */\n\nimport { RenderingCancelledException } from \"pdfjs-lib\";\nimport { RenderingStates } from \"./ui_utils.js\";\n\nconst CLEANUP_TIMEOUT = 30000;\n\n/**\n * Controls rendering of the views for pages and thumbnails.\n */\nclass PDFRenderingQueue {\n  constructor() {\n    this.pdfViewer = null;\n    this.pdfThumbnailViewer = null;\n    this.onIdle = null;\n    this.highestPriorityPage = null;\n    /** @type {number} */\n    this.idleTimeout = null;\n    this.printing = false;\n    this.isThumbnailViewEnabled = false;\n\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      Object.defineProperty(this, \"hasViewer\", {\n        value: () => !!this.pdfViewer,\n      });\n    }\n  }\n\n  /**\n   * @param {PDFViewer} pdfViewer\n   */\n  setViewer(pdfViewer) {\n    this.pdfViewer = pdfViewer;\n  }\n\n  /**\n   * @param {PDFThumbnailViewer} pdfThumbnailViewer\n   */\n  setThumbnailViewer(pdfThumbnailViewer) {\n    this.pdfThumbnailViewer = pdfThumbnailViewer;\n  }\n\n  /**\n   * @param {IRenderableView} view\n   * @returns {boolean}\n   */\n  isHighestPriority(view) {\n    return this.highestPriorityPage === view.renderingId;\n  }\n\n  /**\n   * @param {Object} currentlyVisiblePages\n   */\n  renderHighestPriority(currentlyVisiblePages) {\n    if (this.idleTimeout) {\n      clearTimeout(this.idleTimeout);\n      this.idleTimeout = null;\n    }\n\n    // Pages have a higher priority than thumbnails, so check them first.\n    if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {\n      return;\n    }\n    // No pages needed rendering, so check thumbnails.\n    if (\n      this.isThumbnailViewEnabled &&\n      this.pdfThumbnailViewer?.forceRendering()\n    ) {\n      return;\n    }\n\n    if (this.printing) {\n      // If printing is currently ongoing do not reschedule cleanup.\n      return;\n    }\n\n    if (this.onIdle) {\n      this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);\n    }\n  }\n\n  /**\n   * @param {Object} visible\n   * @param {Array} views\n   * @param {boolean} scrolledDown\n   * @param {boolean} [preRenderExtra]\n   */\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 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  #onPageRenderedCallback = 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        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    if (this.#onPageRenderedCallback) {\n      this.eventBus._off(\"pagerendered\", this.#onPageRenderedCallback);\n      this.#onPageRenderedCallback = 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.#onPageRenderedCallback = ({ pageNumber }) => {\n          idsToRefresh.delete(pageNumber);\n          if (idsToRefresh.size === 0) {\n            this.#switchAnnotationEditorModeTimeoutId = setTimeout(updater, 0);\n          }\n        };\n        const { signal } = this.#eventAbortController;\n        eventBus._on(\"pagerendered\", this.#onPageRenderedCallback, { signal });\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 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\nimport { ScrollMode, SpreadMode } from \"./ui_utils.js\";\nimport { PDFViewer } from \"./pdf_viewer.js\";\n\nclass PDFSinglePageViewer extends PDFViewer {\n  _resetView() {\n    super._resetView();\n    this._scrollMode = ScrollMode.PAGE;\n    this._spreadMode = SpreadMode.NONE;\n  }\n\n  // eslint-disable-next-line accessor-pairs\n  set scrollMode(mode) {}\n\n  _updateScrollMode() {}\n\n  // eslint-disable-next-line accessor-pairs\n  set spreadMode(mode) {}\n\n  _updateSpreadMode() {}\n}\n\nexport { PDFSinglePageViewer };\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\nimport { FindState, PDFFindController } from \"./pdf_find_controller.js\";\nimport {\n  LinkTarget,\n  PDFLinkService,\n  SimpleLinkService,\n} from \"./pdf_link_service.js\";\nimport {\n  parseQueryString,\n  ProgressBar,\n  RenderingStates,\n  ScrollMode,\n  SpreadMode,\n} from \"./ui_utils.js\";\nimport { AnnotationLayerBuilder } from \"./annotation_layer_builder.js\";\nimport { DownloadManager } from \"./download_manager.js\";\nimport { EventBus } from \"./event_utils.js\";\nimport { GenericL10n } from \"./genericl10n.js\";\nimport { PDFHistory } from \"./pdf_history.js\";\nimport { PDFPageView } from \"./pdf_page_view.js\";\nimport { PDFScriptingManager } from \"./pdf_scripting_manager.component.js\";\nimport { PDFSinglePageViewer } from \"./pdf_single_page_viewer.js\";\nimport { PDFViewer } from \"./pdf_viewer.js\";\nimport { StructTreeLayerBuilder } from \"./struct_tree_layer_builder.js\";\nimport { TextLayerBuilder } from \"./text_layer_builder.js\";\nimport { XfaLayerBuilder } from \"./xfa_layer_builder.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\nexport {\n  AnnotationLayerBuilder,\n  DownloadManager,\n  EventBus,\n  FindState,\n  GenericL10n,\n  LinkTarget,\n  parseQueryString,\n  PDFFindController,\n  PDFHistory,\n  PDFLinkService,\n  PDFPageView,\n  PDFScriptingManager,\n  PDFSinglePageViewer,\n  PDFViewer,\n  ProgressBar,\n  RenderingStates,\n  ScrollMode,\n  SimpleLinkService,\n  SpreadMode,\n  StructTreeLayerBuilder,\n  TextLayerBuilder,\n  XfaLayerBuilder,\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","OutputScale","constructor","pixelRatio","window","devicePixelRatio","sx","sy","scaled","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","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","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","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","text","syllablePositions","exec","char","len","get","normalizationRegex","replace","keys","join","toNormalizeWithNFKC","CJK","HKDiacritics","regexp","RegExp","rawDiacriticsPositions","normalized","positions","rawDiacriticsIndex","syllableIndex","shift","shiftOrigin","eol","hasDiacritics","match","p1","p2","p3","p4","p5","p6","p7","p8","replacement","jj","j","charAt","hasTrailingDashEOL","endsWith","slice","newCharLen","getOriginalIndex","diffs","pos","end","oldStart","oldEnd","oldLen","PDFFindController","updateMatchesCountOnProgress","visitedPagesCount","linkService","eventBus","_linkService","_eventBus","onIsPageVisible","reset","_on","onFind","bind","onFindBarClose","highlightMatches","_highlightMatches","pageMatches","_pageMatches","pageMatchesLength","_pageMatchesLength","selected","_selected","setDocument","pdfDocument","_pdfDocument","_firstPageCapability","#onFind","type","shouldDirtyMatch","_dirtyMatch","updateUIState","promise","then","extractText","findbarClosed","pendingTimeout","_findTimeout","nextMatch","highlightAll","updateAllPages","scrollMatchIntoView","selectedLeft","pageIndex","matchIndex","_scrollMatches","matchIdx","pageIdx","#reset","_offset","wrapped","_extractTextPromises","_pageContents","_pageDiffs","_hasDiacritics","_matchesCountTotal","_pagesToSearch","_pendingFindMatches","_resumePageIdx","withResolvers","#query","_rawQuery","_normalizedQuery","filter","map","#shouldDirtyMatch","newQuery","prevQuery","newType","prevType","JSON","stringify","pageNumber","pagesCount","page","isEntireWord","#isEntireWord","content","startIdx","charCodeAt","convertToRegExpString","#convertToRegExpString","matchDiacritics","isUnicode","has","trailingSpaces","String","fromCharCode","calculateMatch","#calculateMatch","pageContent","matcherResult","matches","matchesLength","forEach","matchPos","matchLen","updatePage","nextPageMatch","pageMatchesCount","updateUIResultsCount","reverse","isUnicodePart","queryPart","caseSensitive","entireWord","flags","#extractText","deferred","textOptions","disableNormalization","ii","getPage","pdfPage","getTextContent","textContent","strBuf","textItem","hasEOL","reason","#updatePage","dispatch","source","#updateAllPages","#nextMatch","previous","findPrevious","currentPageIndex","numPages","delete","offset","numPageMatches","updateMatch","advanceOffsetPage","matchesReady","#matchesReady","numMatches","#nextPageMatch","#advanceOffsetPage","#updateMatch","found","previousPage","#onFindBarClose","requestMatchesCount","#requestMatchesCount","current","total","#updateUIResultsCount","matchesCount","#updateUIState","rawQuery","DEFAULT_LINK_REL","LinkTarget","SELF","BLANK","PARENT","TOP","PDFLinkService","externalLinkEnabled","externalLinkTarget","externalLinkRel","ignoreDestinationZoom","_ignoreDestinationZoom","baseUrl","pdfViewer","pdfHistory","setViewer","setHistory","currentPageNumber","rotation","pagesRotation","isInPresentationMode","goToDestination","dest","namedDest","explicitDest","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","anchor","setHash","hash","phrase","zoomArgs","split","zoomArg","zoomArgNumber","parseFloat","name","allowNegativeOffset","unescape","parse","toString","isValidExplicitDest","executeNamedAction","action","back","forward","nextPage","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","PasswordResponses","PDFDataRangeTransport","PDFDateString","PDFWorker","PermissionFlag","PixelsPerInch","RenderingCancelledException","setLayerDimensions","shadow","TextLayer","UnexpectedResponseException","Util","VerbosityLevel","version","XfaLayer","globalThis","pdfjsLib","AnnotationLayerBuilder","onAppend","eventAbortController","downloadManager","annotationStorage","imageResourcesPath","renderForms","enableScripting","hasJSActionsPromise","fieldObjectsPromise","annotationCanvasMap","accessibilityManager","annotationEditorUIManager","_hasJSActionsPromise","_fieldObjectsPromise","_annotationCanvasMap","_accessibilityManager","_annotationEditorUIManager","annotationLayer","_cancelled","render","viewport","intent","update","clone","dontFlip","annotations","hasJSActions","fieldObjects","all","getAnnotations","createElement","className","updatePresentationModeState","AbortController","cancel","abort","hidden","hasEditableAnnotations","#updatePresentationModeState","disableFormElements","section","childNodes","hasAttribute","inert","download","blobUrl","filename","click","body","append","DownloadManager","openBlobUrls","WeakMap","downloadData","data","contentType","URL","createObjectURL","Blob","openOrDownloadData","isPdfData","WaitOnType","EVENT","TIMEOUT","waitOnEventOrTimeout","ac","handler","timeout","evtMethod","EventBus","listeners","create","on","eventName","listener","options","external","off","_off","eventListeners","externalListeners","rmAbort","AbortSignal","aborted","onAbort","removeEventListener","splice","FirefoxEventBus","externalServices","globalEventNames","isInAutomation","FluentType","valueOf","FluentNone","scope","FluentNumber","opts","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","Scope","errors","WeakSet","ctor","cache","_intls","locales","allowed","unwrapped","opt","entries","NUMBER_ALLOWED","NUMBER","DATETIME_ALLOWED","DATETIME","getMemoizerForLocale","stringLocale","memoizer","FluentBundle","functions","transform","hasMessage","getMessage","addResource","res","allowOverrides","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","parseMessage","SyntaxError","re","consumeChar","errorClass","consumeToken","match1","parsePattern","parseAttributes","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","fromCodePoint","makeIndent","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","templateElement","ownerDocument","createElementNS","innerHTML","overlayChildNodes","overlayAttributes","fromFragment","toElement","childNode","nodeType","TEXT_NODE","sanitized","getNodeForNamedElement","replaceChild","isElementAllowed","createSanitizedElement","warn","createTextNodeFromTextContent","appendChild","fromElement","explicitlyAllowed","getAttribute","from","isAttrNameLocalizable","removeAttribute","sourceElement","translatedChild","childName","sourceChild","removeChild","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","r","formatWithFallback","method","translations","hasAtLeastOneBundle","bundles","missingIds","keysFromBundle","locale","formatMessages","messageFromBundle","formatValues","valueFromBundle","formatValue","handleEvent","formatted","attrNames","messageErrors","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","translateFragment","takeRecords","disconnect","mutation","addedNode","addedNodes","ELEMENT_NODE","childElementCount","getTranslatables","translateElements","frag","getKeysForElement","applyTranslations","nodes","querySelectorAll","L10n","dir","lang","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","#getPaths","#generateBundlesFallback","#createBundleFallback","HASH_CHANGE_TIMEOUT","POSITION_UPDATED_THRESHOLD","UPDATE_VIEWAREA_TIMEOUT","getCurrentHash","location","PDFHistory","_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","assign","#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","AnnotationEditorLayerBuilder","drawLayer","textLayer","uiManager","annotationEditorLayer","clonedViewport","direction","parameters","isInvisible","compatParams","userAgent","navigator","platform","maxTouchPoints","isAndroid","isIOS","OptionKind","BROWSER","VIEWER","API","WORKER","EVENT_DISPATCH","PREFERENCE","Type","BOOLEAN","OBJECT","STRING","UNDEFINED","defaultOptions","allowedGlobalEvents","kind","canvasMaxAreaInBytes","localeProperties","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","enableUpdatedAddImage","highlightEditorColors","historyUpdateUrl","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","verbosity","workerPort","workerSrc","defaultUrl","sandboxBundleSrc","viewerCssTheme","enableFakeMLManager","disablePreferences","AppOptions","_hasInvokedSet","_checkDisablePreferences","getAll","defaultOnly","defaultOpt","setAll","prefs","events","userOpt","toUpperCase","DrawLayerBuilder","setParent","getDrawLayer","PDF_ROLE_TO_HTML_ROLE","Document","DocumentFragment","Part","Sect","Div","Aside","NonStruct","P","H","Title","FENote","Sub","Lbl","Span","Em","Strong","Link","Annot","Form","Ruby","RB","RT","RP","Warichu","WT","WP","L","LI","LBody","Table","TR","TH","TD","THead","TBody","TFoot","Caption","Figure","Formula","Artifact","HEADING_PATTERN","StructTreeLayerBuilder","treeDom","renderingDone","structTree","walk","#setAttributes","structElement","htmlElement","alt","#walk","node","role","children","kid","TextAccessibilityManager","enabled","textChildren","textNodes","waitingElements","setTextMapping","textDivs","compareElementPositions","#compareElementPositions","e1","e2","rect1","getBoundingClientRect","rect2","top1","bot1","mid1","top2","bot2","mid2","centerX1","centerX2","enable","nodeIndex","getElementById","addIdToAriaOwns","isRemovable","addPointerInTextLayer","disable","removePointerInTextLayer","owns","#addIdToAriaOwns","child","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","Node","span","i0","i1","lastDivIdx","lastOffset","isSelected","highlightSuffix","n0","n1","clearedUntilDivIdx","n","TextLayerBuilder","textLayers","selectionChangeAbortController","highlighter","tabIndex","textContentParams","onBefore","textContentSource","streamTextContent","includeMarkedContent","endOfContent","bindMouse","removeGlobalSelectionListener","#bindMouse","event","selection","getSelection","clipboardData","setData","preventDefault","stopPropagation","enableGlobalSelectionListener","#removeGlobalSelectionListener","textLayerDiv","#enableGlobalSelectionListener","isPointerDown","isFirefox","prevRange","rangeCount","activeTextLayers","range","getRangeAt","intersectsNode","endDiv","getPropertyValue","modifyStart","compareBoundaryPoints","Range","END_TO_END","START_TO_END","startContainer","endContainer","parentTextLayer","parentElement","closest","insertBefore","nextSibling","cloneRange","XfaLayerBuilder","xfaHtml","getXfa","DEFAULT_LAYER_PROPERTIES","LAYERS_ORDER","PDFPageView","ENABLE_FORMS","hasRestrictedScaling","isEditing","layerProperties","loadingId","previousRotation","renderError","renderingState","useThumbnailCanvas","directDrawing","initialOptionalContent","regularAnnotations","viewportMap","layers","defaultViewport","renderingId","pageLabel","scale","pdfPageRotate","_optionalContentConfigPromise","pageColors","renderingQueue","renderTask","_isStandalone","hasViewer","_container","zoomLayer","xfaLayer","structTreeLayer","setDimensions","PDF_TO_CSS_UNITS","hasInitialVisibility","addLayer","#addLayer","oldDiv","replaceWith","layer","prepend","#setDimensions","setPdfPage","foreground","background","filterFactory","addHighlightHCMFilter","totalRotation","getViewport","cleanup","_textHighlighter","dispatchLayerRendered","#dispatchLayerRendered","renderAnnotationLayer","#renderAnnotationLayer","renderAnnotationEditorLayer","#renderAnnotationEditorLayer","renderDrawLayer","#renderDrawLayer","renderXfaLayer","#renderXfaLayer","buildXfaTextContentItems","renderTextLayer","#renderTextLayer","renderStructTreeLayer","#renderStructTreeLayer","tree","getStructTree","canvas","#buildXfaTextContentItems","item","_resetZoomLayer","removeFromDOM","zoomLayerCanvas","firstChild","keepZoomLayer","keepAnnotationLayer","keepAnnotationEditorLayer","keepXfaLayer","keepTextLayer","cancelRendering","zoomLayerNode","annotationLayerNode","annotationEditorLayerNode","xfaLayerNode","textLayerNode","layerIndex","indexOf","toggleEditingMode","drawingDelay","onlyCssZoom","outputScale","postponeDrawing","cancelExtraDelay","cssTransform","redrawAnnotationLayer","redrawAnnotationEditorLayer","redrawXfaLayer","redrawTextLayer","hideTextLayer","timestamp","now","originalViewport","relativeRotation","absRotation","scaleX","scaleY","getPagePoint","convertToPdfPoint","finishRenderTask","#finishRenderTask","separateAnnots","draw","canvasWrapper","isPureXfa","annotationLayerDiv","renderContinueCallback","cont","showCanvas","isHighestPriority","hasHCM","isLastShow","ctx","getContext","alpha","willReadFrequently","invScale","pixelsInViewport","maxScale","sqrt","sfx","sfy","renderContext","canvasContext","onContinue","resultPromise","annotationEditorLayerDiv","setPageLabel","thumbnailCanvas","docProperties","info","metadata","contentDispositionFilename","contentLength","getMetadata","getDownloadInfo","filesize","getRaw","authors","GenericScripting","_ready","reject","sandbox","pdfjsSandbox","QuickJSSandbox","catch","createSandbox","dispatchEventInSandbox","dispatchEvent","destroySandbox","nukeSandbox","PDFScriptingManager","closeCapability","destroyCapability","ready","scripting","willPrintCapability","destroyScripting","objects","calculationOrder","docActions","getFieldObjects","getCalculationOrderIds","getJSActions","initScripting","updateFromSandbox","detail","dispatchPageClose","dispatchPageOpen","_pageOpenPending","appInfo","docInfo","actions","dispatchWillSave","dispatchDidSave","dispatchWillPrint","dispatchDidPrint","destroyPromise","_visitedPages","#updateFromSandbox","isChangingPresentationMode","siblings","command","modes","pagesPromise","log","currentScaleValue","increaseScale","decreaseScale","focus","elementId","CustomEvent","setValue","#dispatchPageOpen","visitedPages","pageView","getPageView","actionsPromise","#dispatchPageClose","#initScripting","createScripting","#destroyScripting","race","PDFScriptingManagerComponents","CLEANUP_TIMEOUT","PDFRenderingQueue","pdfThumbnailViewer","onIdle","highestPriorityPage","idleTimeout","printing","isThumbnailViewEnabled","defineProperty","setThumbnailViewer","renderHighestPriority","currentlyVisiblePages","forceRendering","getHighestPriority","scrolledDown","preRenderExtra","visibleViews","numVisible","isViewFinished","firstId","lastId","visibleIds","holeId","holeView","preRenderIndex","preRenderView","renderView","finally","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","mlManager","onPageRenderedCallback","switchAnnotationEditorModeTimeoutId","getAllTextInProgress","hiddenCopyElement","interruptCopyCondition","previousContainerHeight","resizeObserver","ResizeObserver","resizeObserverCallback","scrollModePageState","scaleTimeoutId","viewerVersion","firstElementChild","tagName","_getVisiblePages","_scriptingManager","scriptingManager","removePageBorders","defaultRenderingQueue","scroll","_scrollUpdate","presentationModeState","_resetView","updateContainerHeightCss","_pages","getCachedPageViews","pageViewsReady","every","_currentPageNumber","_setCurrentPageNumber","resetCurrentPageView","_pageLabels","currentPageLabel","currentScale","_currentScale","setScale","noScroll","_currentScaleValue","_pagesRotation","refresh","firstPagePromise","onePageRendered","_onePageRenderedCapability","_pagesCapability","_layerProperties","self","initializePermissions","#initializePermissions","permissions","COPY","MODIFY_CONTENTS","MODIFY_ANNOTATIONS","FILL_INTERACTIVE_FORMS","onePageRenderedOrForceFetch","#onePageRenderedOrForceFetch","visibilityState","hiddenCapability","onVisibilityChange","getAllText","pageNum","copyCallback","#copyCallback","focusNode","anchorNode","containsNode","ev","clipboard","writeText","_cancelRendering","getOptionalContentConfig","permissionsPromise","getPermissions","_scrollMode","onBeforeDraw","onAfterDraw","firstPdfPage","any","STAMP","loadModel","updateMode","viewerElement","ensurePageViewVisible","_spreadMode","_updateSpreadMode","loadingParams","getPagesLeft","Language","setPageLabels","labels","_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","currentPage","hPadding","vPadding","pageWidthScale","pageHeightScale","horizontalScale","#resetCurrentPageView","widthScale","heightScale","pageWidth","pageHeight","boundingRect","convertToViewportPoint","_updateLocation","firstPage","normalizedScaleValue","round","currentPageView","topLeft","intLeft","intTop","visiblePages","numVisiblePages","newCacheSize","isSimpleLayout","currentId","stillFullyVisible","switchToEditAnnotationMode","#switchToEditAnnotationMode","pagesToRefresh","containsElement","_isContainerRtl","isHorizontalScrollbarEnabled","isVerticalScrollbarEnabled","ensurePdfPageLoaded","#ensurePdfPageLoaded","getScrollAhead","#getScrollAhead","scrollAhead","hasEqualPageSizes","firstPageView","getPagesOverview","initialOrientation","orientation","_getPageAdvance","pageLayout","yArray","expectedId","advance","updateScale","scaleFactor","steps","ceil","toFixed","#updateContainerHeightCss","#resizeObserverCallback","borderBoxSize","blockSize","#cleanupSwitchAnnotationEditorMode","editId","isFromKeyboard","updater","resetModifiedIds","idsToRefresh","noUpdate","updateArgs","PDFSinglePageViewer","pdfjsVersion","pdfjsBuild"],"sourceRoot":""}