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;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA,EAAE;UACF;UACA,sGAAsG;UACtG;UACA;UACA;UACA;UACA;UACA;UACA;UACA,GAAG;UACH;UACA;UACA;UACA;UACA;UACA,GAAG;UACH;UACA,EAAE;UACF;UACA;;;;;UChEA;UACA;UACA;UACA;UACA,yCAAyC,wCAAwC;UACjF;UACA;UACA;;;;;UCPA;;;;;SEAA;SACA;SACA;SACA","sources":["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/annotation_editor_layer_builder.js","webpack://pdf.js/web/annotation_layer_builder.js","webpack://pdf.js/web/app_options.js","webpack://pdf.js/web/download_manager.js","webpack://pdf.js/web/draw_layer_builder.js","webpack://pdf.js/web/event_utils.js","webpack://pdf.js/web/generic_scripting.js","webpack://pdf.js/web/genericl10n.js","webpack://pdf.js/web/l10n.js","webpack://pdf.js/web/l10n_utils.js","webpack://pdf.js/web/pdf_find_controller.js","webpack://pdf.js/web/pdf_find_utils.js","webpack://pdf.js/web/pdf_history.js","webpack://pdf.js/web/pdf_link_service.js","webpack://pdf.js/web/pdf_page_view.js","webpack://pdf.js/web/pdf_rendering_queue.js","webpack://pdf.js/web/pdf_scripting_manager.component.js","webpack://pdf.js/web/pdf_scripting_manager.js","webpack://pdf.js/web/pdf_single_page_viewer.js","webpack://pdf.js/web/pdf_viewer.component.js","webpack://pdf.js/web/pdf_viewer.js","webpack://pdf.js/web/pdfjs.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/ui_utils.js","webpack://pdf.js/web/xfa_layer_builder.js","webpack://pdf.js/webpack/bootstrap","webpack://pdf.js/webpack/runtime/async module","webpack://pdf.js/webpack/runtime/define property getters","webpack://pdf.js/webpack/runtime/hasOwnProperty shorthand","webpack://pdf.js/webpack/before-startup","webpack://pdf.js/webpack/startup","webpack://pdf.js/webpack/after-startup"],"sourcesContent":["/**\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            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     * @private\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     * @private\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 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 { NullL10n } from \"web-l10n_utils\";\n\n/**\n * @typedef {Object} AnnotationEditorLayerBuilderOptions\n * @property {AnnotationEditorUIManager} [uiManager]\n * @property {HTMLDivElement} pageDiv\n * @property {PDFPageProxy} pdfPage\n * @property {IL10n} [l10n]\n * @property {TextAccessibilityManager} [accessibilityManager]\n * @property {AnnotationLayer} [annotationLayer]\n * @property {TextLayer} [textLayer]\n * @property {DrawLayer} [drawLayer]\n */\n\nclass AnnotationEditorLayerBuilder {\n  #annotationLayer = null;\n\n  #drawLayer = null;\n\n  #textLayer = null;\n\n  #uiManager;\n\n  /**\n   * @param {AnnotationEditorLayerBuilderOptions} options\n   */\n  constructor(options) {\n    this.pageDiv = options.pageDiv;\n    this.pdfPage = options.pdfPage;\n    this.accessibilityManager = options.accessibilityManager;\n    this.l10n = options.l10n || NullL10n;\n    this.annotationEditorLayer = null;\n    this.div = null;\n    this._cancelled = false;\n    this.#uiManager = options.uiManager;\n    this.#annotationLayer = options.annotationLayer || null;\n    this.#textLayer = options.textLayer || null;\n    this.#drawLayer = options.drawLayer || 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.tabIndex = 0;\n    div.hidden = true;\n    div.dir = this.#uiManager.direction;\n    this.pageDiv.append(div);\n\n    this.annotationEditorLayer = new AnnotationEditorLayer({\n      uiManager: this.#uiManager,\n      div,\n      accessibilityManager: this.accessibilityManager,\n      pageIndex: this.pdfPage.pageNumber - 1,\n      l10n: this.l10n,\n      viewport: clonedViewport,\n      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.pageDiv = null;\n    this.annotationEditorLayer.destroy();\n    this.div.remove();\n  }\n\n  hide() {\n    if (!this.div) {\n      return;\n    }\n    this.div.hidden = true;\n  }\n\n  show() {\n    if (!this.div || this.annotationEditorLayer.isEmpty) {\n      return;\n    }\n    this.div.hidden = false;\n  }\n}\n\nexport { AnnotationEditorLayerBuilder };\n","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n// 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\nimport { AnnotationLayer } from \"pdfjs-lib\";\nimport { PresentationModeState } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} AnnotationLayerBuilderOptions\n * @property {HTMLDivElement} pageDiv\n * @property {PDFPageProxy} pdfPage\n * @property {AnnotationStorage} [annotationStorage]\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n *   for annotation icons. Include trailing slash.\n * @property {boolean} renderForms\n * @property {IPDFLinkService} linkService\n * @property {IDownloadManager} [downloadManager]\n * @property {boolean} [enableScripting]\n * @property {Promise<boolean>} [hasJSActionsPromise]\n * @property {Promise<Object<string, Array<Object>> | null>}\n *   [fieldObjectsPromise]\n * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]\n * @property {TextAccessibilityManager} [accessibilityManager]\n */\n\nclass AnnotationLayerBuilder {\n  #onPresentationModeChanged = null;\n\n  /**\n   * @param {AnnotationLayerBuilderOptions} options\n   */\n  constructor({\n    pageDiv,\n    pdfPage,\n    linkService,\n    downloadManager,\n    annotationStorage = null,\n    imageResourcesPath = \"\",\n    renderForms = true,\n    enableScripting = false,\n    hasJSActionsPromise = null,\n    fieldObjectsPromise = null,\n    annotationCanvasMap = null,\n    accessibilityManager = null,\n  }) {\n    this.pageDiv = pageDiv;\n    this.pdfPage = pdfPage;\n    this.linkService = linkService;\n    this.downloadManager = downloadManager;\n    this.imageResourcesPath = imageResourcesPath;\n    this.renderForms = renderForms;\n    this.annotationStorage = annotationStorage;\n    this.enableScripting = enableScripting;\n    this._hasJSActionsPromise = hasJSActionsPromise || Promise.resolve(false);\n    this._fieldObjectsPromise = fieldObjectsPromise || Promise.resolve(null);\n    this._annotationCanvasMap = annotationCanvasMap;\n    this._accessibilityManager = accessibilityManager;\n\n    this.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.pageDiv.append(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      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.#onPresentationModeChanged) {\n      this.#onPresentationModeChanged = evt => {\n        this.#updatePresentationModeState(evt.state);\n      };\n      this._eventBus?._on(\n        \"presentationmodechanged\",\n        this.#onPresentationModeChanged\n      );\n    }\n  }\n\n  cancel() {\n    this._cancelled = true;\n\n    if (this.#onPresentationModeChanged) {\n      this._eventBus?._off(\n        \"presentationmodechanged\",\n        this.#onPresentationModeChanged\n      );\n      this.#onPresentationModeChanged = null;\n    }\n  }\n\n  hide() {\n    if (!this.div) {\n      return;\n    }\n    this.div.hidden = true;\n  }\n\n  #updatePresentationModeState(state) {\n    if (!this.div) {\n      return;\n    }\n    let disableFormElements = false;\n\n    switch (state) {\n      case PresentationModeState.FULLSCREEN:\n        disableFormElements = true;\n        break;\n      case PresentationModeState.NORMAL:\n        break;\n      default:\n        return;\n    }\n    for (const section of this.div.childNodes) {\n      if (section.hasAttribute(\"data-internal-link\")) {\n        continue;\n      }\n      section.inert = disableFormElements;\n    }\n  }\n}\n\nexport { AnnotationLayerBuilder };\n","/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst compatibilityParams = Object.create(null);\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n  if (\n    typeof PDFJSDev !== \"undefined\" &&\n    PDFJSDev.test(\"LIB\") &&\n    typeof navigator === \"undefined\"\n  ) {\n    globalThis.navigator = Object.create(null);\n  }\n  const userAgent = navigator.userAgent || \"\";\n  const platform = navigator.platform || \"\";\n  const maxTouchPoints = navigator.maxTouchPoints || 1;\n\n  const isAndroid = /Android/.test(userAgent);\n  const isIOS =\n    /\\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) ||\n    (platform === \"MacIntel\" && maxTouchPoints > 1);\n\n  // Limit canvas size to 5 mega-pixels on mobile.\n  // Support: Android, iOS\n  (function checkCanvasSizeLimitation() {\n    if (isIOS || isAndroid) {\n      compatibilityParams.maxCanvasPixels = 5242880;\n    }\n  })();\n}\n\nconst OptionKind = {\n  BROWSER: 0x01,\n  VIEWER: 0x02,\n  API: 0x04,\n  WORKER: 0x08,\n  PREFERENCE: 0x80,\n};\n\n/**\n * NOTE: These options are used to generate the `default_preferences.json` file,\n *       see `OptionKind.PREFERENCE`, hence the values below must use only\n *       primitive types and cannot rely on any imported types.\n */\nconst defaultOptions = {\n  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  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\n  annotationEditorMode: {\n    /** @type {number} */\n    value: 0,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  annotationMode: {\n    /** @type {number} */\n    value: 2,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  cursorToolOnLoad: {\n    /** @type {number} */\n    value: 0,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  defaultZoomDelay: {\n    /** @type {number} */\n    value: 400,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  defaultZoomValue: {\n    /** @type {string} */\n    value: \"\",\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  disableHistory: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER,\n  },\n  disablePageLabels: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enableHighlightEditor: {\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  enablePermissions: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enablePrintAutoRotate: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enableScripting: {\n    /** @type {boolean} */\n    value: typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"CHROME\"),\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  externalLinkRel: {\n    /** @type {string} */\n    value: \"noopener noreferrer nofollow\",\n    kind: OptionKind.VIEWER,\n  },\n  externalLinkTarget: {\n    /** @type {number} */\n    value: 0,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  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: 16777216,\n    kind: OptionKind.VIEWER,\n  },\n  forcePageColors: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  pageColorsBackground: {\n    /** @type {string} */\n    value: \"Canvas\",\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  pageColorsForeground: {\n    /** @type {string} */\n    value: \"CanvasText\",\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  pdfBugEnabled: {\n    /** @type {boolean} */\n    value: typeof PDFJSDev === \"undefined\",\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: \"\",\n    kind: OptionKind.API,\n  },\n  enableXfa: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.API + OptionKind.PREFERENCE,\n  },\n  fontExtraProperties: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.API,\n  },\n  isEvalSupported: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.API,\n  },\n  isOffscreenCanvasSupported: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.API,\n  },\n  maxImageSize: {\n    /** @type {number} */\n    value: -1,\n    kind: OptionKind.API,\n  },\n  pdfBug: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.API,\n  },\n  standardFontDataUrl: {\n    /** @type {string} */\n    value:\n      // 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  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}\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  defaultOptions.locale = {\n    /** @type {string} */\n    value: navigator.language || \"en-US\",\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\nconst userOptions = Object.create(null);\n\nclass AppOptions {\n  constructor() {\n    throw new Error(\"Cannot initialize AppOptions.\");\n  }\n\n  static get(name) {\n    const userOption = userOptions[name];\n    if (userOption !== undefined) {\n      return userOption;\n    }\n    const defaultOption = defaultOptions[name];\n    if (defaultOption !== undefined) {\n      return compatibilityParams[name] ?? defaultOption.value;\n    }\n    return undefined;\n  }\n\n  static getAll(kind = null) {\n    const options = Object.create(null);\n    for (const name in defaultOptions) {\n      const defaultOption = defaultOptions[name];\n      if (kind) {\n        if (!(kind & defaultOption.kind)) {\n          continue;\n        }\n        if (\n          (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"LIB\")) &&\n          kind === OptionKind.PREFERENCE\n        ) {\n          if (defaultOption.kind & OptionKind.BROWSER) {\n            throw new Error(`Invalid kind for preference: ${name}`);\n          }\n          const value = defaultOption.value,\n            valueType = typeof value;\n\n          if (\n            valueType === \"boolean\" ||\n            valueType === \"string\" ||\n            (valueType === \"number\" && Number.isInteger(value))\n          ) {\n            options[name] = value;\n            continue;\n          }\n          throw new Error(`Invalid type for preference: ${name}`);\n        }\n      }\n      const userOption = userOptions[name];\n      options[name] =\n        userOption !== undefined\n          ? userOption\n          : compatibilityParams[name] ?? defaultOption.value;\n    }\n    return options;\n  }\n\n  static set(name, value) {\n    userOptions[name] = value;\n  }\n\n  static setAll(options, init = false) {\n    if ((typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) && init) {\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;\n      }\n      if (Object.keys(userOptions).length) {\n        console.warn(\n          \"setAll: The Preferences may override manually set AppOptions; \" +\n            'please use the \"disablePreferences\"-option in order to prevent that.'\n        );\n      }\n    }\n\n    for (const name in options) {\n      userOptions[name] = options[name];\n    }\n  }\n\n  static remove(name) {\n    delete userOptions[name];\n  }\n}\n\nexport { AppOptions, compatibilityParams, OptionKind };\n","/* Copyright 2013 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces\").IDownloadManager} IDownloadManager */\n\nimport { createValidAbsoluteUrl, isPdfFile } from \"pdfjs-lib\";\n\nif (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"CHROME || GENERIC\")) {\n  throw new Error(\n    'Module \"pdfjs-web/download_manager\" shall not be used ' +\n      \"outside CHROME and GENERIC builds.\"\n  );\n}\n\nfunction download(blobUrl, filename) {\n  const a = document.createElement(\"a\");\n  if (!a.click) {\n    throw new Error('DownloadManager: \"a.click()\" is not supported.');\n  }\n  a.href = blobUrl;\n  a.target = \"_parent\";\n  // Use a.download if available. This increases the likelihood that\n  // the file is downloaded instead of opened by another PDF plugin.\n  if (\"download\" in a) {\n    a.download = filename;\n  }\n  // <a> must be in the document for recent Firefox versions,\n  // otherwise .click() is ignored.\n  (document.body || document.documentElement).append(a);\n  a.click();\n  a.remove();\n}\n\n/**\n * @implements {IDownloadManager}\n */\nclass DownloadManager {\n  #openBlobUrls = new WeakMap();\n\n  downloadUrl(url, filename, _options) {\n    if (!createValidAbsoluteUrl(url, \"http://example.com\")) {\n      console.error(`downloadUrl - not a valid URL: ${url}`);\n      return; // restricted/invalid URL\n    }\n    download(url + \"#pdfjs.action=download\", filename);\n  }\n\n  downloadData(data, filename, contentType) {\n    const blobUrl = URL.createObjectURL(\n      new Blob([data], { type: contentType })\n    );\n    download(blobUrl, filename);\n  }\n\n  /**\n   * @returns {boolean} Indicating if the data was opened.\n   */\n  openOrDownloadData(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(blob, url, filename, _options) {\n    const blobUrl = URL.createObjectURL(blob);\n    download(blobUrl, filename);\n  }\n}\n\nexport { DownloadManager };\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 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst WaitOnType = {\n  EVENT: \"event\",\n  TIMEOUT: \"timeout\",\n};\n\n/**\n * @typedef {Object} WaitOnEventOrTimeoutParameters\n * @property {Object} target - The event target, can for example be:\n *   `window`, `document`, a DOM element, or an {EventBus} instance.\n * @property {string} name - The name of the event.\n * @property {number} delay - The delay, in milliseconds, after which the\n *   timeout occurs (if the event wasn't already dispatched).\n */\n\n/**\n * Allows waiting for an event or a timeout, whichever occurs first.\n * Can be used to ensure that an action always occurs, even when an event\n * arrives late or not at all.\n *\n * @param {WaitOnEventOrTimeoutParameters}\n * @returns {Promise} A promise that is resolved with a {WaitOnType} value.\n */\nfunction waitOnEventOrTimeout({ target, name, delay = 0 }) {\n  return new Promise(function (resolve, reject) {\n    if (\n      typeof target !== \"object\" ||\n      !(name && typeof name === \"string\") ||\n      !(Number.isInteger(delay) && delay >= 0)\n    ) {\n      throw new Error(\"waitOnEventOrTimeout - invalid parameters.\");\n    }\n\n    function handler(type) {\n      if (target instanceof EventBus) {\n        target._off(name, eventHandler);\n      } else {\n        target.removeEventListener(name, eventHandler);\n      }\n\n      if (timeout) {\n        clearTimeout(timeout);\n      }\n      resolve(type);\n    }\n\n    const eventHandler = handler.bind(null, WaitOnType.EVENT);\n    if (target instanceof EventBus) {\n      target._on(name, eventHandler);\n    } else {\n      target.addEventListener(name, eventHandler);\n    }\n\n    const timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);\n    const timeout = setTimeout(timeoutHandler, delay);\n  });\n}\n\n/**\n * Simple event bus for an application. Listeners are attached using the `on`\n * and `off` methods. To raise an event, the `dispatch` method shall be used.\n */\nclass EventBus {\n  #listeners = Object.create(null);\n\n  /**\n   * @param {string} eventName\n   * @param {function} listener\n   * @param {Object} [options]\n   */\n  on(eventName, listener, options = null) {\n    this._on(eventName, listener, {\n      external: true,\n      once: options?.once,\n    });\n  }\n\n  /**\n   * @param {string} eventName\n   * @param {function} listener\n   * @param {Object} [options]\n   */\n  off(eventName, listener, options = null) {\n    this._off(eventName, listener, {\n      external: true,\n      once: options?.once,\n    });\n  }\n\n  /**\n   * @param {string} eventName\n   * @param {Object} data\n   */\n  dispatch(eventName, data) {\n    const eventListeners = this.#listeners[eventName];\n    if (!eventListeners || eventListeners.length === 0) {\n      return;\n    }\n    let externalListeners;\n    // Making copy of the listeners array in case if it will be modified\n    // during dispatch.\n    for (const { listener, external, once } of eventListeners.slice(0)) {\n      if (once) {\n        this._off(eventName, listener);\n      }\n      if (external) {\n        (externalListeners ||= []).push(listener);\n        continue;\n      }\n      listener(data);\n    }\n    // Dispatch any \"external\" listeners *after* the internal ones, to give the\n    // viewer components time to handle events and update their state first.\n    if (externalListeners) {\n      for (const listener of externalListeners) {\n        listener(data);\n      }\n      externalListeners = null;\n    }\n  }\n\n  /**\n   * @ignore\n   */\n  _on(eventName, listener, options = null) {\n    const eventListeners = (this.#listeners[eventName] ||= []);\n    eventListeners.push({\n      listener,\n      external: options?.external === true,\n      once: options?.once === true,\n    });\n  }\n\n  /**\n   * @ignore\n   */\n  _off(eventName, listener, options = null) {\n    const eventListeners = this.#listeners[eventName];\n    if (!eventListeners) {\n      return;\n    }\n    for (let i = 0, ii = eventListeners.length; i < ii; i++) {\n      if (eventListeners[i].listener === listener) {\n        eventListeners.splice(i, 1);\n        return;\n      }\n    }\n  }\n}\n\n/**\n * NOTE: Only used to support various PDF viewer tests in `mozilla-central`.\n */\nclass AutomationEventBus extends EventBus {\n  dispatch(eventName, data) {\n    if (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"MOZCENTRAL\")) {\n      throw new Error(\"Not implemented: AutomationEventBus.dispatch\");\n    }\n    super.dispatch(eventName, data);\n\n    const 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\nexport { AutomationEventBus, EventBus, waitOnEventOrTimeout, WaitOnType };\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(\"#\")[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          : import(/* webpackIgnore: true */ sandboxBundleSrc);\n      sandbox\n        .then(pdfjsSandbox => {\n          resolve(pdfjsSandbox.QuickJSSandbox());\n        })\n        .catch(reject);\n    });\n  }\n\n  async createSandbox(data) {\n    const sandbox = await this._ready;\n    sandbox.create(data);\n  }\n\n  async dispatchEventInSandbox(event) {\n    const sandbox = await this._ready;\n    setTimeout(() => sandbox.dispatchEvent(event), 0);\n  }\n\n  async destroySandbox() {\n    const sandbox = await this._ready;\n    sandbox.nukeSandbox();\n  }\n}\n\nexport { docProperties, GenericScripting };\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\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\n/**\n * @implements {IL10n}\n */\nclass GenericL10n extends L10n {\n  constructor(lang) {\n    super({ lang });\n    this._setL10n(\n      new DOMLocalization(\n        [],\n        GenericL10n.#generateBundles.bind(\n          GenericL10n,\n          \"en-us\",\n          this.getLanguage()\n        )\n      )\n    );\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      }\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    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  static async #getPaths() {\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  }\n}\n\nexport { GenericL10n };\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  #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    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  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\nexport { L10n };\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(\"./interfaces\").IL10n} IL10n */\n\nimport { fetchData, shadow } from \"pdfjs-lib\";\nimport { FluentBundle, FluentResource } from \"fluent-bundle\";\nimport { DOMLocalization } from \"fluent-dom\";\nimport { L10n } from \"./l10n.js\";\n\n/**\n * @implements {IL10n}\n */\nclass ConstL10n extends L10n {\n  constructor(lang) {\n    super({ lang });\n    this._setL10n(\n      new DOMLocalization([], ConstL10n.#generateBundles.bind(ConstL10n, lang))\n    );\n  }\n\n  static async *#generateBundles(lang) {\n    const text =\n      typeof PDFJSDev === \"undefined\"\n        ? await fetchData(\n            new URL(`./locale/${lang}/viewer.ftl`, window.location.href),\n            /* type = */ \"text\"\n          )\n        : PDFJSDev.eval(\"DEFAULT_FTL\");\n\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    yield bundle;\n  }\n\n  static get instance() {\n    return shadow(this, \"instance\", new ConstL10n(\"en-us\"));\n  }\n}\n\n/**\n * No-op implementation of the localization service.\n * @implements {IL10n}\n */\nconst NullL10n = {\n  getLanguage() {\n    return ConstL10n.instance.getLanguage();\n  },\n\n  getDirection() {\n    return ConstL10n.instance.getDirection();\n  },\n\n  async get(ids, args = null, fallback) {\n    return ConstL10n.instance.get(ids, args, fallback);\n  },\n\n  async translate(element) {\n    return ConstL10n.instance.translate(element);\n  },\n\n  pause() {\n    return ConstL10n.instance.pause();\n  },\n\n  resume() {\n    return ConstL10n.instance.resume();\n  },\n};\n\nexport { NullL10n };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @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\";\nimport { PromiseCapability } from \"pdfjs-lib\";\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 = new PromiseCapability();\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  #calculateRegExpMatch(query, entireWord, pageIndex, pageContent) {\n    const matches = (this._pageMatches[pageIndex] = []);\n    const matchesLength = (this._pageMatchesLength[pageIndex] = []);\n    if (!query) {\n      // The query can be empty because some chars like diacritics could have\n      // been stripped out.\n      return;\n    }\n    const diffs = this._pageDiffs[pageIndex];\n    let match;\n    while ((match = query.exec(pageContent)) !== null) {\n      if (\n        entireWord &&\n        !this.#isEntireWord(pageContent, match.index, match[0].length)\n      ) {\n        continue;\n      }\n\n      const [matchPos, matchLen] = getOriginalIndex(\n        diffs,\n        match.index,\n        match[0].length\n      );\n\n      if (matchLen) {\n        matches.push(matchPos);\n        matchesLength.push(matchLen);\n      }\n    }\n  }\n\n  #convertToRegExpString(query, hasDiacritics) {\n    const { matchDiacritics } = this.#state;\n    let isUnicode = false;\n    query = query.replaceAll(\n      SPECIAL_CHARS_REG_EXP,\n      (\n        match,\n        p1 /* to escape */,\n        p2 /* punctuation */,\n        p3 /* whitespaces */,\n        p4 /* diacritics */,\n        p5 /* letters */\n      ) => {\n        // We don't need to use a \\s for whitespaces since all the different\n        // kind of whitespaces are replaced by a single \" \".\n\n        if (p1) {\n          // Escape characters like *+?... to not interfer with regexp syntax.\n          return `[ ]*\\\\${p1}[ ]*`;\n        }\n        if (p2) {\n          // Allow whitespaces around punctuation signs.\n          return `[ ]*${p2}[ ]*`;\n        }\n        if (p3) {\n          // Replace spaces by \\s+ to be sure to match any spaces.\n          return \"[ ]+\";\n        }\n        if (matchDiacritics) {\n          return p4 || p5;\n        }\n\n        if (p4) {\n          // Diacritics are removed with few exceptions.\n          return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : \"\";\n        }\n\n        // A letter has been matched and it can be followed by any diacritics\n        // in normalized text.\n        if (hasDiacritics) {\n          isUnicode = true;\n          return `${p5}\\\\p{M}*`;\n        }\n        return p5;\n      }\n    );\n\n    const trailingSpaces = \"[ ]*\";\n    if (query.endsWith(trailingSpaces)) {\n      // The [ ]* has been added in order to help to match \"foo . bar\" but\n      // it doesn't make sense to match some whitespaces after the dot\n      // when it's the last character.\n      query = query.slice(0, query.length - trailingSpaces.length);\n    }\n\n    if (matchDiacritics) {\n      // aX must not match aXY.\n      if (hasDiacritics) {\n        DIACRITICS_EXCEPTION_STR ||= String.fromCharCode(\n          ...DIACRITICS_EXCEPTION\n        );\n\n        isUnicode = true;\n        query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\\\p{M}]|$)`;\n      }\n    }\n\n    return [isUnicode, query];\n  }\n\n  #calculateMatch(pageIndex) {\n    let query = this.#query;\n    if (query.length === 0) {\n      return; // Do nothing: the matches should be wiped out already.\n    }\n    const { caseSensitive, entireWord } = this.#state;\n    const pageContent = this._pageContents[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\n    const flags = `g${isUnicode ? \"u\" : \"\"}${caseSensitive ? \"\" : \"i\"}`;\n    query = query ? new RegExp(query, flags) : null;\n\n    this.#calculateRegExpMatch(query, entireWord, pageIndex, pageContent);\n\n    // When `highlightAll` is set, ensure that the matches on previously\n    // rendered (and still active) pages are correctly highlighted.\n    if (this.#state.highlightAll) {\n      this.#updatePage(pageIndex);\n    }\n    if (this._resumePageIdx === pageIndex) {\n      this._resumePageIdx = null;\n      this.#nextPageMatch();\n    }\n\n    // Update the match count.\n    const pageMatchesCount = this._pageMatches[pageIndex].length;\n    this._matchesCountTotal += pageMatchesCount;\n    if (this.#updateMatchesCountOnProgress) {\n      if (pageMatchesCount > 0) {\n        this.#updateUIResultsCount();\n      }\n    } else if (++this.#visitedPagesCount === this._linkService.pagesCount) {\n      // For example, in GeckoView we want to have only the final update because\n      // the Java side provides only one object to update the counts.\n      this.#updateUIResultsCount();\n    }\n  }\n\n  #extractText() {\n    // Perform text extraction once if this method is called multiple times.\n    if (this._extractTextPromises.length > 0) {\n      return;\n    }\n\n    let promise = Promise.resolve();\n    const textOptions = { disableNormalization: true };\n    for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) {\n      const extractTextCapability = new PromiseCapability();\n      this._extractTextPromises[i] = extractTextCapability.promise;\n\n      promise = promise.then(() => {\n        return this._pdfDocument\n          .getPage(i + 1)\n          .then(pdfPage => {\n            return pdfPage.getTextContent(textOptions);\n          })\n          .then(\n            textContent => {\n              const strBuf = [];\n\n              for (const textItem of textContent.items) {\n                strBuf.push(textItem.str);\n                if (textItem.hasEOL) {\n                  strBuf.push(\"\\n\");\n                }\n              }\n\n              // Store the normalized page content (text items) as one string.\n              [\n                this._pageContents[i],\n                this._pageDiffs[i],\n                this._hasDiacritics[i],\n              ] = normalize(strBuf.join(\"\"));\n              extractTextCapability.resolve();\n            },\n            reason => {\n              console.error(\n                `Unable to get text content for page ${i + 1}`,\n                reason\n              );\n              // Page error -- assuming no text content.\n              this._pageContents[i] = \"\";\n              this._pageDiffs[i] = null;\n              this._hasDiacritics[i] = false;\n              extractTextCapability.resolve();\n            }\n          );\n      });\n    }\n  }\n\n  #updatePage(index) {\n    if (this._scrollMatches && this._selected.pageIdx === index) {\n      // If the page is selected, scroll the page into view, which triggers\n      // rendering the page, which adds the text layer. Once the text layer\n      // is built, it will attempt to scroll the selected match into view.\n      this._linkService.page = index + 1;\n    }\n\n    this._eventBus.dispatch(\"updatetextlayermatches\", {\n      source: this,\n      pageIndex: index,\n    });\n  }\n\n  #updateAllPages() {\n    this._eventBus.dispatch(\"updatetextlayermatches\", {\n      source: this,\n      pageIndex: -1,\n    });\n  }\n\n  #nextMatch() {\n    const previous = this.#state.findPrevious;\n    const currentPageIndex = this._linkService.page - 1;\n    const numPages = this._linkService.pagesCount;\n\n    this._highlightMatches = true;\n\n    if (this._dirtyMatch) {\n      // Need to recalculate the matches, reset everything.\n      this._dirtyMatch = false;\n      this._selected.pageIdx = this._selected.matchIdx = -1;\n      this._offset.pageIdx = currentPageIndex;\n      this._offset.matchIdx = null;\n      this._offset.wrapped = false;\n      this._resumePageIdx = null;\n      this._pageMatches.length = 0;\n      this._pageMatchesLength.length = 0;\n      this.#visitedPagesCount = 0;\n      this._matchesCountTotal = 0;\n\n      this.#updateAllPages(); // Wipe out any previously highlighted matches.\n\n      for (let i = 0; i < numPages; i++) {\n        // Start finding the matches as soon as the text is extracted.\n        if (this._pendingFindMatches.has(i)) {\n          continue;\n        }\n        this._pendingFindMatches.add(i);\n        this._extractTextPromises[i].then(() => {\n          this._pendingFindMatches.delete(i);\n          this.#calculateMatch(i);\n        });\n      }\n    }\n\n    // If there's no query there's no point in searching.\n    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      matchesCount: this.#requestMatchesCount(),\n      rawQuery: this.#state?.query ?? null,\n    });\n  }\n}\n\nexport { FindState, PDFFindController };\n","/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst CharacterType = {\n  SPACE: 0,\n  ALPHA_LETTER: 1,\n  PUNCT: 2,\n  HAN_LETTER: 3,\n  KATAKANA_LETTER: 4,\n  HIRAGANA_LETTER: 5,\n  HALFWIDTH_KATAKANA_LETTER: 6,\n  THAI_LETTER: 7,\n};\n\nfunction isAlphabeticalScript(charCode) {\n  return charCode < 0x2e80;\n}\n\nfunction isAscii(charCode) {\n  return (charCode & 0xff80) === 0;\n}\n\nfunction isAsciiAlpha(charCode) {\n  return (\n    (charCode >= /* a = */ 0x61 && charCode <= /* z = */ 0x7a) ||\n    (charCode >= /* A = */ 0x41 && charCode <= /* Z = */ 0x5a)\n  );\n}\n\nfunction isAsciiDigit(charCode) {\n  return charCode >= /* 0 = */ 0x30 && charCode <= /* 9 = */ 0x39;\n}\n\nfunction isAsciiSpace(charCode) {\n  return (\n    charCode === /* SPACE = */ 0x20 ||\n    charCode === /* TAB = */ 0x09 ||\n    charCode === /* CR = */ 0x0d ||\n    charCode === /* LF = */ 0x0a\n  );\n}\n\nfunction isHan(charCode) {\n  return (\n    (charCode >= 0x3400 && charCode <= 0x9fff) ||\n    (charCode >= 0xf900 && charCode <= 0xfaff)\n  );\n}\n\nfunction isKatakana(charCode) {\n  return charCode >= 0x30a0 && charCode <= 0x30ff;\n}\n\nfunction isHiragana(charCode) {\n  return charCode >= 0x3040 && charCode <= 0x309f;\n}\n\nfunction isHalfwidthKatakana(charCode) {\n  return charCode >= 0xff60 && charCode <= 0xff9f;\n}\n\nfunction isThai(charCode) {\n  return (charCode & 0xff80) === 0x0e00;\n}\n\n/**\n * This function is based on the word-break detection implemented in:\n * https://hg.mozilla.org/mozilla-central/file/tip/intl/lwbrk/WordBreaker.cpp\n */\nfunction getCharacterType(charCode) {\n  if (isAlphabeticalScript(charCode)) {\n    if (isAscii(charCode)) {\n      if (isAsciiSpace(charCode)) {\n        return CharacterType.SPACE;\n      } else if (\n        isAsciiAlpha(charCode) ||\n        isAsciiDigit(charCode) ||\n        charCode === /* UNDERSCORE = */ 0x5f\n      ) {\n        return CharacterType.ALPHA_LETTER;\n      }\n      return CharacterType.PUNCT;\n    } else if (isThai(charCode)) {\n      return CharacterType.THAI_LETTER;\n    } else if (charCode === /* NBSP = */ 0xa0) {\n      return CharacterType.SPACE;\n    }\n    return CharacterType.ALPHA_LETTER;\n  }\n\n  if (isHan(charCode)) {\n    return CharacterType.HAN_LETTER;\n  } else if (isKatakana(charCode)) {\n    return CharacterType.KATAKANA_LETTER;\n  } else if (isHiragana(charCode)) {\n    return CharacterType.HIRAGANA_LETTER;\n  } else if (isHalfwidthKatakana(charCode)) {\n    return CharacterType.HALFWIDTH_KATAKANA_LETTER;\n  }\n  return CharacterType.ALPHA_LETTER;\n}\n\nlet NormalizeWithNFKC;\nfunction getNormalizeWithNFKC() {\n  /* eslint-disable no-irregular-whitespace */\n  NormalizeWithNFKC ||= ` ¨ª¯²-µ¸-º¼-¾Ĳ-ĳĿ-ŀŉſǄ-ǌǱ-ǳʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕　〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ﬀ-ﬆﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ！-ﾾￂ-ￇￊ-ￏￒ-ￗￚ-ￜ￠-￦`;\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 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { isValidRotation, parseQueryString } from \"./ui_utils.js\";\nimport { waitOnEventOrTimeout } from \"./event_utils.js\";\n\n// Heuristic value used when force-resetting `this._blockHashChange`.\nconst HASH_CHANGE_TIMEOUT = 1000; // milliseconds\n// Heuristic value used when adding the current position to the browser history.\nconst POSITION_UPDATED_THRESHOLD = 50;\n// Heuristic value used when adding a temporary position to the browser history.\nconst UPDATE_VIEWAREA_TIMEOUT = 1000; // milliseconds\n\n/**\n * @typedef {Object} PDFHistoryOptions\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {EventBus} eventBus - The application event bus.\n */\n\n/**\n * @typedef {Object} InitializeParameters\n * @property {string} fingerprint - The PDF document's unique fingerprint.\n * @property {boolean} [resetHistory] - Reset the browsing history.\n * @property {boolean} [updateUrl] - Attempt to update the document URL, with\n *   the current hash, when pushing/replacing browser history entries.\n */\n\n/**\n * @typedef {Object} PushParameters\n * @property {string} [namedDest] - The named destination. If absent, a\n *   stringified version of `explicitDest` is used.\n * @property {Array} explicitDest - The explicit destination array.\n * @property {number} pageNumber - The page to which the destination points.\n */\n\nfunction getCurrentHash() {\n  return document.location.hash;\n}\n\nclass PDFHistory {\n  /**\n   * @param {PDFHistoryOptions} options\n   */\n  constructor({ linkService, eventBus }) {\n    this.linkService = linkService;\n    this.eventBus = eventBus;\n\n    this._initialized = false;\n    this._fingerprint = \"\";\n    this.reset();\n\n    this._boundEvents = null;\n    // Ensure that we don't miss a \"pagesinit\" event,\n    // by registering the listener immediately.\n    this.eventBus._on(\"pagesinit\", () => {\n      this._isPagesLoaded = false;\n\n      this.eventBus._on(\n        \"pagesloaded\",\n        evt => {\n          this._isPagesLoaded = !!evt.pagesCount;\n        },\n        { once: true }\n      );\n    });\n  }\n\n  /**\n   * Initialize the history for the PDF document, using either the current\n   * browser history entry or the document hash, whichever is present.\n   * @param {InitializeParameters} params\n   */\n  initialize({ fingerprint, resetHistory = false, updateUrl = false }) {\n    if (!fingerprint || typeof fingerprint !== \"string\") {\n      console.error(\n        'PDFHistory.initialize: The \"fingerprint\" must be a non-empty string.'\n      );\n      return;\n    }\n    // Ensure that any old state is always reset upon initialization.\n    if (this._initialized) {\n      this.reset();\n    }\n    const reInitialized =\n      this._fingerprint !== \"\" && this._fingerprint !== fingerprint;\n    this._fingerprint = fingerprint;\n    this._updateUrl = updateUrl === true;\n\n    this._initialized = true;\n    this._bindEvents();\n    const state = window.history.state;\n\n    this._popStateInProgress = false;\n    this._blockHashChange = 0;\n    this._currentHash = getCurrentHash();\n    this._numPositionUpdates = 0;\n\n    this._uid = this._maxUid = 0;\n    this._destination = null;\n    this._position = null;\n\n    if (!this._isValidState(state, /* checkReload = */ true) || resetHistory) {\n      const { hash, page, rotation } = this._parseCurrentHash(\n        /* checkNameddest = */ true\n      );\n\n      if (!hash || reInitialized || resetHistory) {\n        // Ensure that the browser history is reset on PDF document load.\n        this._pushOrReplaceState(null, /* forceReplace = */ true);\n        return;\n      }\n      // Ensure that the browser history is initialized correctly when\n      // the document hash is present on PDF document load.\n      this._pushOrReplaceState(\n        { hash, page, rotation },\n        /* forceReplace = */ true\n      );\n      return;\n    }\n\n    // The browser history contains a valid entry, ensure that the history is\n    // initialized correctly on PDF document load.\n    const destination = state.destination;\n    this._updateInternalState(\n      destination,\n      state.uid,\n      /* removeTemporary = */ true\n    );\n\n    if (destination.rotation !== undefined) {\n      this._initialRotation = destination.rotation;\n    }\n    if (destination.dest) {\n      this._initialBookmark = JSON.stringify(destination.dest);\n\n      // If the history is updated, e.g. through the user changing the hash,\n      // before the initial destination has become visible, then we do *not*\n      // want to potentially add `this._position` to the browser history.\n      this._destination.page = null;\n    } else if (destination.hash) {\n      this._initialBookmark = destination.hash;\n    } else if (destination.page) {\n      // Fallback case; shouldn't be necessary, but better safe than sorry.\n      this._initialBookmark = `page=${destination.page}`;\n    }\n  }\n\n  /**\n   * Reset the current `PDFHistory` instance, and consequently prevent any\n   * further updates and/or navigation of the browser history.\n   */\n  reset() {\n    if (this._initialized) {\n      this._pageHide(); // Simulate a 'pagehide' event when resetting.\n\n      this._initialized = false;\n      this._unbindEvents();\n    }\n    if (this._updateViewareaTimeout) {\n      clearTimeout(this._updateViewareaTimeout);\n      this._updateViewareaTimeout = null;\n    }\n    this._initialBookmark = null;\n    this._initialRotation = null;\n  }\n\n  /**\n   * Push an internal destination to the browser history.\n   * @param {PushParameters}\n   */\n  push({ namedDest = null, explicitDest, pageNumber }) {\n    if (!this._initialized) {\n      return;\n    }\n    if (namedDest && typeof namedDest !== \"string\") {\n      console.error(\n        \"PDFHistory.push: \" +\n          `\"${namedDest}\" is not a valid namedDest parameter.`\n      );\n      return;\n    } else if (!Array.isArray(explicitDest)) {\n      console.error(\n        \"PDFHistory.push: \" +\n          `\"${explicitDest}\" is not a valid explicitDest parameter.`\n      );\n      return;\n    } else if (!this._isValidPage(pageNumber)) {\n      // Allow an unset `pageNumber` if and only if the history is still empty;\n      // please refer to the `this._destination.page = null;` comment above.\n      if (pageNumber !== null || this._destination) {\n        console.error(\n          \"PDFHistory.push: \" +\n            `\"${pageNumber}\" is not a valid pageNumber parameter.`\n        );\n        return;\n      }\n    }\n\n    const hash = namedDest || JSON.stringify(explicitDest);\n    if (!hash) {\n      // The hash *should* never be undefined, but if that were to occur,\n      // avoid any possible issues by not updating the browser history.\n      return;\n    }\n\n    let forceReplace = false;\n    if (\n      this._destination &&\n      (isDestHashesEqual(this._destination.hash, hash) ||\n        isDestArraysEqual(this._destination.dest, explicitDest))\n    ) {\n      // When the new destination is identical to `this._destination`, and\n      // its `page` is undefined, replace the current browser history entry.\n      // NOTE: This can only occur if `this._destination` was set either:\n      //  - through the document hash being specified on load.\n      //  - through the user changing the hash of the document.\n      if (this._destination.page) {\n        return;\n      }\n      forceReplace = true;\n    }\n    if (this._popStateInProgress && !forceReplace) {\n      return;\n    }\n\n    this._pushOrReplaceState(\n      {\n        dest: explicitDest,\n        hash,\n        page: pageNumber,\n        rotation: this.linkService.rotation,\n      },\n      forceReplace\n    );\n\n    if (!this._popStateInProgress) {\n      // Prevent the browser history from updating while the new destination is\n      // being scrolled into view, to avoid potentially inconsistent state.\n      this._popStateInProgress = true;\n      // We defer the resetting of `this._popStateInProgress`, to account for\n      // e.g. zooming occurring when the new destination is being navigated to.\n      Promise.resolve().then(() => {\n        this._popStateInProgress = false;\n      });\n    }\n  }\n\n  /**\n   * Push a page to the browser history; generally the `push` method should be\n   * used instead.\n   * @param {number} pageNumber\n   */\n  pushPage(pageNumber) {\n    if (!this._initialized) {\n      return;\n    }\n    if (!this._isValidPage(pageNumber)) {\n      console.error(\n        `PDFHistory.pushPage: \"${pageNumber}\" is not a valid page number.`\n      );\n      return;\n    }\n\n    if (this._destination?.page === pageNumber) {\n      // When the new page is identical to the one in `this._destination`, we\n      // don't want to add a potential duplicate entry in the browser history.\n      return;\n    }\n    if (this._popStateInProgress) {\n      return;\n    }\n\n    this._pushOrReplaceState({\n      // Simulate an internal destination, for `this._tryPushCurrentPosition`:\n      dest: null,\n      hash: `page=${pageNumber}`,\n      page: pageNumber,\n      rotation: this.linkService.rotation,\n    });\n\n    if (!this._popStateInProgress) {\n      // Prevent the browser history from updating while the new page is\n      // being scrolled into view, to avoid potentially inconsistent state.\n      this._popStateInProgress = true;\n      // We defer the resetting of `this._popStateInProgress`, to account for\n      // e.g. zooming occurring when the new page is being navigated to.\n      Promise.resolve().then(() => {\n        this._popStateInProgress = false;\n      });\n    }\n  }\n\n  /**\n   * Push the current position to the browser history.\n   */\n  pushCurrentPosition() {\n    if (!this._initialized || this._popStateInProgress) {\n      return;\n    }\n    this._tryPushCurrentPosition();\n  }\n\n  /**\n   * Go back one step in the browser history.\n   * NOTE: Avoids navigating away from the document, useful for \"named actions\".\n   */\n  back() {\n    if (!this._initialized || this._popStateInProgress) {\n      return;\n    }\n    const state = window.history.state;\n    if (this._isValidState(state) && state.uid > 0) {\n      window.history.back();\n    }\n  }\n\n  /**\n   * Go forward one step in the browser history.\n   * NOTE: Avoids navigating away from the document, useful for \"named actions\".\n   */\n  forward() {\n    if (!this._initialized || this._popStateInProgress) {\n      return;\n    }\n    const state = window.history.state;\n    if (this._isValidState(state) && state.uid < this._maxUid) {\n      window.history.forward();\n    }\n  }\n\n  /**\n   * @type {boolean} Indicating if the user is currently moving through the\n   *   browser history, useful e.g. for skipping the next 'hashchange' event.\n   */\n  get popStateInProgress() {\n    return (\n      this._initialized &&\n      (this._popStateInProgress || this._blockHashChange > 0)\n    );\n  }\n\n  get initialBookmark() {\n    return this._initialized ? this._initialBookmark : null;\n  }\n\n  get initialRotation() {\n    return this._initialized ? this._initialRotation : null;\n  }\n\n  /**\n   * @private\n   */\n  _pushOrReplaceState(destination, forceReplace = false) {\n    const shouldReplace = forceReplace || !this._destination;\n    const newState = {\n      fingerprint: this._fingerprint,\n      uid: shouldReplace ? this._uid : this._uid + 1,\n      destination,\n    };\n\n    if (\n      typeof PDFJSDev !== \"undefined\" &&\n      PDFJSDev.test(\"CHROME\") &&\n      window.history.state?.chromecomState\n    ) {\n      // history.state.chromecomState is managed by chromecom.js.\n      newState.chromecomState = window.history.state.chromecomState;\n    }\n    this._updateInternalState(destination, newState.uid);\n\n    let newUrl;\n    if (this._updateUrl && destination?.hash) {\n      const baseUrl = document.location.href.split(\"#\")[0];\n      // Prevent errors in Firefox.\n      if (!baseUrl.startsWith(\"file://\")) {\n        newUrl = `${baseUrl}#${destination.hash}`;\n      }\n    }\n    if (shouldReplace) {\n      window.history.replaceState(newState, \"\", newUrl);\n    } else {\n      window.history.pushState(newState, \"\", newUrl);\n    }\n\n    if (\n      typeof PDFJSDev !== \"undefined\" &&\n      PDFJSDev.test(\"CHROME\") &&\n      top === window\n    ) {\n      // eslint-disable-next-line no-undef\n      chrome.runtime.sendMessage(\"showPageAction\");\n    }\n  }\n\n  /**\n   * @private\n   */\n  _tryPushCurrentPosition(temporary = false) {\n    if (!this._position) {\n      return;\n    }\n    let position = this._position;\n    if (temporary) {\n      position = Object.assign(Object.create(null), this._position);\n      position.temporary = true;\n    }\n\n    if (!this._destination) {\n      this._pushOrReplaceState(position);\n      return;\n    }\n    if (this._destination.temporary) {\n      // Always replace a previous *temporary* position.\n      this._pushOrReplaceState(position, /* forceReplace = */ true);\n      return;\n    }\n    if (this._destination.hash === position.hash) {\n      return; // The current document position has not changed.\n    }\n    if (\n      !this._destination.page &&\n      (POSITION_UPDATED_THRESHOLD <= 0 ||\n        this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)\n    ) {\n      // `this._destination` was set through the user changing the hash of\n      // the document. Do not add `this._position` to the browser history,\n      // to avoid \"flooding\" it with lots of (nearly) identical entries,\n      // since we cannot ensure that the document position has changed.\n      return;\n    }\n\n    let forceReplace = false;\n    if (\n      this._destination.page >= position.first &&\n      this._destination.page <= position.page\n    ) {\n      // When the `page` of `this._destination` is still visible, do not\n      // update the browsing history when `this._destination` either:\n      //  - contains an internal destination, since in this case we\n      //    cannot ensure that the document position has actually changed.\n      //  - was set through the user changing the hash of the document.\n      if (this._destination.dest !== undefined || !this._destination.first) {\n        return;\n      }\n      // To avoid \"flooding\" the browser history, replace the current entry.\n      forceReplace = true;\n    }\n    this._pushOrReplaceState(position, forceReplace);\n  }\n\n  /**\n   * @private\n   */\n  _isValidPage(val) {\n    return (\n      Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount\n    );\n  }\n\n  /**\n   * @private\n   */\n  _isValidState(state, checkReload = false) {\n    if (!state) {\n      return false;\n    }\n    if (state.fingerprint !== this._fingerprint) {\n      if (checkReload) {\n        // Potentially accept the history entry, even if the fingerprints don't\n        // match, when the viewer was reloaded (see issue 6847).\n        if (\n          typeof state.fingerprint !== \"string\" ||\n          state.fingerprint.length !== this._fingerprint.length\n        ) {\n          return false;\n        }\n        const [perfEntry] = performance.getEntriesByType(\"navigation\");\n        if (perfEntry?.type !== \"reload\") {\n          return false;\n        }\n      } else {\n        // This should only occur in viewers with support for opening more than\n        // one PDF document, e.g. the GENERIC viewer.\n        return false;\n      }\n    }\n    if (!Number.isInteger(state.uid) || state.uid < 0) {\n      return false;\n    }\n    if (state.destination === null || typeof state.destination !== \"object\") {\n      return false;\n    }\n    return true;\n  }\n\n  /**\n   * @private\n   */\n  _updateInternalState(destination, uid, removeTemporary = false) {\n    if (this._updateViewareaTimeout) {\n      // When updating `this._destination`, make sure that we always wait for\n      // the next 'updateviewarea' event before (potentially) attempting to\n      // push the current position to the browser history.\n      clearTimeout(this._updateViewareaTimeout);\n      this._updateViewareaTimeout = null;\n    }\n    if (removeTemporary && destination?.temporary) {\n      // When the `destination` comes from the browser history,\n      // we no longer treat it as a *temporary* position.\n      delete destination.temporary;\n    }\n    this._destination = destination;\n    this._uid = uid;\n    this._maxUid = Math.max(this._maxUid, uid);\n    // This should always be reset when `this._destination` is updated.\n    this._numPositionUpdates = 0;\n  }\n\n  /**\n   * @private\n   */\n  _parseCurrentHash(checkNameddest = false) {\n    const hash = unescape(getCurrentHash()).substring(1);\n    const params = parseQueryString(hash);\n\n    const nameddest = params.get(\"nameddest\") || \"\";\n    let page = params.get(\"page\") | 0;\n\n    if (!this._isValidPage(page) || (checkNameddest && nameddest.length > 0)) {\n      page = null;\n    }\n    return { hash, page, rotation: this.linkService.rotation };\n  }\n\n  /**\n   * @private\n   */\n  _updateViewarea({ location }) {\n    if (this._updateViewareaTimeout) {\n      clearTimeout(this._updateViewareaTimeout);\n      this._updateViewareaTimeout = null;\n    }\n\n    this._position = {\n      hash: location.pdfOpenParams.substring(1),\n      page: this.linkService.page,\n      first: location.pageNumber,\n      rotation: location.rotation,\n    };\n\n    if (this._popStateInProgress) {\n      return;\n    }\n\n    if (\n      POSITION_UPDATED_THRESHOLD > 0 &&\n      this._isPagesLoaded &&\n      this._destination &&\n      !this._destination.page\n    ) {\n      // If the current destination was set through the user changing the hash\n      // of the document, we will usually not try to push the current position\n      // to the browser history; see `this._tryPushCurrentPosition()`.\n      //\n      // To prevent `this._tryPushCurrentPosition()` from effectively being\n      // reduced to a no-op in this case, we will assume that the position\n      // *did* in fact change if the 'updateviewarea' event was dispatched\n      // more than `POSITION_UPDATED_THRESHOLD` times.\n      this._numPositionUpdates++;\n    }\n\n    if (UPDATE_VIEWAREA_TIMEOUT > 0) {\n      // When closing the browser, a 'pagehide' event will be dispatched which\n      // *should* allow us to push the current position to the browser history.\n      // In practice, it seems that the event is arriving too late in order for\n      // the session history to be successfully updated.\n      // (For additional details, please refer to the discussion in\n      //  https://bugzilla.mozilla.org/show_bug.cgi?id=1153393.)\n      //\n      // To workaround this we attempt to *temporarily* add the current position\n      // to the browser history only when the viewer is *idle*,\n      // i.e. when scrolling and/or zooming does not occur.\n      //\n      // PLEASE NOTE: It's absolutely imperative that the browser history is\n      // *not* updated too often, since that would render the viewer more or\n      // less unusable. Hence the use of a timeout to delay the update until\n      // the viewer has been idle for `UPDATE_VIEWAREA_TIMEOUT` milliseconds.\n      this._updateViewareaTimeout = setTimeout(() => {\n        if (!this._popStateInProgress) {\n          this._tryPushCurrentPosition(/* temporary = */ true);\n        }\n        this._updateViewareaTimeout = null;\n      }, UPDATE_VIEWAREA_TIMEOUT);\n    }\n  }\n\n  /**\n   * @private\n   */\n  _popState({ state }) {\n    const newHash = getCurrentHash(),\n      hashChanged = this._currentHash !== newHash;\n    this._currentHash = newHash;\n\n    if (\n      (typeof PDFJSDev !== \"undefined\" &&\n        PDFJSDev.test(\"CHROME\") &&\n        state?.chromecomState &&\n        !this._isValidState(state)) ||\n      !state\n    ) {\n      // This case corresponds to the user changing the hash of the document.\n      this._uid++;\n\n      const { hash, page, rotation } = this._parseCurrentHash();\n      this._pushOrReplaceState(\n        { hash, page, rotation },\n        /* forceReplace = */ true\n      );\n      return;\n    }\n    if (!this._isValidState(state)) {\n      // This should only occur in viewers with support for opening more than\n      // one PDF document, e.g. the GENERIC viewer.\n      return;\n    }\n\n    // Prevent the browser history from updating until the new destination,\n    // as stored in the browser history, has been scrolled into view.\n    this._popStateInProgress = true;\n\n    if (hashChanged) {\n      // When the hash changed, implying that the 'popstate' event will be\n      // followed by a 'hashchange' event, then we do *not* want to update the\n      // browser history when handling the 'hashchange' event (in web/app.js)\n      // since that would *overwrite* the new destination navigated to below.\n      //\n      // To avoid accidentally disabling all future user-initiated hash changes,\n      // if there's e.g. another 'hashchange' listener that stops the event\n      // propagation, we make sure to always force-reset `this._blockHashChange`\n      // after `HASH_CHANGE_TIMEOUT` milliseconds have passed.\n      this._blockHashChange++;\n      waitOnEventOrTimeout({\n        target: window,\n        name: \"hashchange\",\n        delay: HASH_CHANGE_TIMEOUT,\n      }).then(() => {\n        this._blockHashChange--;\n      });\n    }\n\n    // Navigate to the new destination.\n    const destination = state.destination;\n    this._updateInternalState(\n      destination,\n      state.uid,\n      /* removeTemporary = */ true\n    );\n\n    if (isValidRotation(destination.rotation)) {\n      this.linkService.rotation = destination.rotation;\n    }\n    if (destination.dest) {\n      this.linkService.goToDestination(destination.dest);\n    } else if (destination.hash) {\n      this.linkService.setHash(destination.hash);\n    } else if (destination.page) {\n      // Fallback case; shouldn't be necessary, but better safe than sorry.\n      this.linkService.page = destination.page;\n    }\n\n    // Since `PDFLinkService.goToDestination` is asynchronous, we thus defer the\n    // resetting of `this._popStateInProgress` slightly.\n    Promise.resolve().then(() => {\n      this._popStateInProgress = false;\n    });\n  }\n\n  /**\n   * @private\n   */\n  _pageHide() {\n    // Attempt to push the `this._position` into the browser history when\n    // navigating away from the document. This is *only* done if the history\n    // is empty/temporary, since otherwise an existing browser history entry\n    // will end up being overwritten (given that new entries cannot be pushed\n    // into the browser history when the 'unload' event has already fired).\n    if (!this._destination || this._destination.temporary) {\n      this._tryPushCurrentPosition();\n    }\n  }\n\n  /**\n   * @private\n   */\n  _bindEvents() {\n    if (this._boundEvents) {\n      return; // The event listeners were already added.\n    }\n    this._boundEvents = {\n      updateViewarea: this._updateViewarea.bind(this),\n      popState: this._popState.bind(this),\n      pageHide: this._pageHide.bind(this),\n    };\n\n    this.eventBus._on(\"updateviewarea\", this._boundEvents.updateViewarea);\n    window.addEventListener(\"popstate\", this._boundEvents.popState);\n    window.addEventListener(\"pagehide\", this._boundEvents.pageHide);\n  }\n\n  /**\n   * @private\n   */\n  _unbindEvents() {\n    if (!this._boundEvents) {\n      return; // The event listeners were already removed.\n    }\n    this.eventBus._off(\"updateviewarea\", this._boundEvents.updateViewarea);\n    window.removeEventListener(\"popstate\", this._boundEvents.popState);\n    window.removeEventListener(\"pagehide\", this._boundEvents.pageHide);\n\n    this._boundEvents = null;\n  }\n}\n\nfunction isDestHashesEqual(destHash, pushHash) {\n  if (typeof destHash !== \"string\" || typeof pushHash !== \"string\") {\n    return false;\n  }\n  if (destHash === pushHash) {\n    return true;\n  }\n  const nameddest = parseQueryString(destHash).get(\"nameddest\");\n  if (nameddest === pushHash) {\n    return true;\n  }\n  return false;\n}\n\nfunction isDestArraysEqual(firstDest, secondDest) {\n  function isEntryEqual(first, second) {\n    if (typeof first !== typeof second) {\n      return false;\n    }\n    if (Array.isArray(first) || Array.isArray(second)) {\n      return false;\n    }\n    if (first !== null && typeof first === \"object\" && second !== null) {\n      if (Object.keys(first).length !== Object.keys(second).length) {\n        return false;\n      }\n      for (const key in first) {\n        if (!isEntryEqual(first[key], second[key])) {\n          return false;\n        }\n      }\n      return true;\n    }\n    return first === second || (Number.isNaN(first) && Number.isNaN(second));\n  }\n\n  if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) {\n    return false;\n  }\n  if (firstDest.length !== secondDest.length) {\n    return false;\n  }\n  for (let i = 0, ii = firstDest.length; i < ii; i++) {\n    if (!isEntryEqual(firstDest[i], secondDest[i])) {\n      return false;\n    }\n  }\n  return true;\n}\n\nexport { isDestArraysEqual, isDestHashesEqual, PDFHistory };\n","/* Copyright 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} ExternalLinkParameters\n * @property {string} url - An absolute URL.\n * @property {LinkTarget} [target] - The link target. The default value is\n *   `LinkTarget.NONE`.\n * @property {string} [rel] - The link relationship. The default value is\n *   `DEFAULT_LINK_REL`.\n * @property {boolean} [enabled] - Whether the link should be enabled. The\n *   default value is true.\n */\n\n/**\n * Adds various attributes (href, title, target, rel) to hyperlinks.\n * @param {HTMLAnchorElement} link - The link element.\n * @param {ExternalLinkParameters} params\n */\nfunction addLinkAttributes(link, { url, target, rel, enabled = true } = {}) {\n  if (!url || typeof url !== \"string\") {\n    throw new Error('A valid \"url\" parameter must provided.');\n  }\n\n  if (enabled) {\n    link.href = link.title = url;\n  } else {\n    link.href = \"\";\n    link.title = `Disabled: ${url}`;\n    link.onclick = () => {\n      return false;\n    };\n  }\n\n  let targetStr = \"\"; // LinkTarget.NONE\n  switch (target) {\n    case LinkTarget.NONE:\n      break;\n    case LinkTarget.SELF:\n      targetStr = \"_self\";\n      break;\n    case LinkTarget.BLANK:\n      targetStr = \"_blank\";\n      break;\n    case LinkTarget.PARENT:\n      targetStr = \"_parent\";\n      break;\n    case LinkTarget.TOP:\n      targetStr = \"_top\";\n      break;\n  }\n  link.target = targetStr;\n\n  link.rel = typeof rel === \"string\" ? rel : DEFAULT_LINK_REL;\n}\n\n/**\n * @typedef {Object} PDFLinkServiceOptions\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} [externalLinkTarget] - Specifies the `target` attribute\n *   for external links. Must use one of the values from {LinkTarget}.\n *   Defaults to using no target.\n * @property {string} [externalLinkRel] - Specifies the `rel` attribute for\n *   external links. Defaults to stripping the referrer.\n * @property {boolean} [ignoreDestinationZoom] - Ignores the zoom argument,\n *   thus preserving the current zoom level in the viewer, when navigating\n *   to internal destinations. The default value is `false`.\n */\n\n/**\n * Performs navigation functions inside PDF, such as opening specified page,\n * or destination.\n * @implements {IPDFLinkService}\n */\nclass PDFLinkService {\n  #pagesRefCache = new Map();\n\n  /**\n   * @param {PDFLinkServiceOptions} options\n   */\n  constructor({\n    eventBus,\n    externalLinkTarget = null,\n    externalLinkRel = null,\n    ignoreDestinationZoom = false,\n  } = {}) {\n    this.eventBus = eventBus;\n    this.externalLinkTarget = externalLinkTarget;\n    this.externalLinkRel = externalLinkRel;\n    this.externalLinkEnabled = true;\n    this._ignoreDestinationZoom = ignoreDestinationZoom;\n\n    this.baseUrl = null;\n    this.pdfDocument = null;\n    this.pdfViewer = null;\n    this.pdfHistory = null;\n  }\n\n  setDocument(pdfDocument, baseUrl = null) {\n    this.baseUrl = baseUrl;\n    this.pdfDocument = pdfDocument;\n    this.#pagesRefCache.clear();\n  }\n\n  setViewer(pdfViewer) {\n    this.pdfViewer = pdfViewer;\n  }\n\n  setHistory(pdfHistory) {\n    this.pdfHistory = pdfHistory;\n  }\n\n  /**\n   * @type {number}\n   */\n  get pagesCount() {\n    return this.pdfDocument ? this.pdfDocument.numPages : 0;\n  }\n\n  /**\n   * @type {number}\n   */\n  get page() {\n    return this.pdfViewer.currentPageNumber;\n  }\n\n  /**\n   * @param {number} value\n   */\n  set page(value) {\n    this.pdfViewer.currentPageNumber = value;\n  }\n\n  /**\n   * @type {number}\n   */\n  get rotation() {\n    return this.pdfViewer.pagesRotation;\n  }\n\n  /**\n   * @param {number} value\n   */\n  set rotation(value) {\n    this.pdfViewer.pagesRotation = value;\n  }\n\n  /**\n   * @type {boolean}\n   */\n  get isInPresentationMode() {\n    return this.pdfViewer.isInPresentationMode;\n  }\n\n  #goToDestinationHelper(rawDest, namedDest = null, explicitDest) {\n    // Dest array looks like that: <page-ref> </XYZ|/FitXXX> <args..>\n    const destRef = explicitDest[0];\n    let pageNumber;\n\n    if (typeof destRef === \"object\" && destRef !== null) {\n      pageNumber = this._cachedPageNumber(destRef);\n\n      if (!pageNumber) {\n        // Fetch the page reference if it's not yet available. This could\n        // only occur during loading, before all pages have been resolved.\n        this.pdfDocument\n          .getPageIndex(destRef)\n          .then(pageIndex => {\n            this.cachePageRef(pageIndex + 1, destRef);\n            this.#goToDestinationHelper(rawDest, namedDest, explicitDest);\n          })\n          .catch(() => {\n            console.error(\n              `PDFLinkService.#goToDestinationHelper: \"${destRef}\" is not ` +\n                `a valid page reference, for dest=\"${rawDest}\".`\n            );\n          });\n        return;\n      }\n    } else if (Number.isInteger(destRef)) {\n      pageNumber = destRef + 1;\n    } else {\n      console.error(\n        `PDFLinkService.#goToDestinationHelper: \"${destRef}\" is not ` +\n          `a valid destination reference, for dest=\"${rawDest}\".`\n      );\n      return;\n    }\n    if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {\n      console.error(\n        `PDFLinkService.#goToDestinationHelper: \"${pageNumber}\" is not ` +\n          `a valid page number, for dest=\"${rawDest}\".`\n      );\n      return;\n    }\n\n    if (this.pdfHistory) {\n      // Update the browser history before scrolling the new destination into\n      // view, to be able to accurately capture the current document position.\n      this.pdfHistory.pushCurrentPosition();\n      this.pdfHistory.push({ namedDest, explicitDest, pageNumber });\n    }\n\n    this.pdfViewer.scrollPageIntoView({\n      pageNumber,\n      destArray: explicitDest,\n      ignoreDestinationZoom: this._ignoreDestinationZoom,\n    });\n  }\n\n  /**\n   * This method will, when available, also update the browser history.\n   *\n   * @param {string|Array} dest - The named, or explicit, PDF destination.\n   */\n  async goToDestination(dest) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    let namedDest, explicitDest;\n    if (typeof dest === \"string\") {\n      namedDest = dest;\n      explicitDest = await this.pdfDocument.getDestination(dest);\n    } else {\n      namedDest = null;\n      explicitDest = await dest;\n    }\n    if (!Array.isArray(explicitDest)) {\n      console.error(\n        `PDFLinkService.goToDestination: \"${explicitDest}\" is not ` +\n          `a valid destination array, for dest=\"${dest}\".`\n      );\n      return;\n    }\n    this.#goToDestinationHelper(dest, namedDest, explicitDest);\n  }\n\n  /**\n   * This method will, when available, also update the browser history.\n   *\n   * @param {number|string} val - The page number, or page label.\n   */\n  goToPage(val) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    const pageNumber =\n      (typeof val === \"string\" && this.pdfViewer.pageLabelToPageNumber(val)) ||\n      val | 0;\n    if (\n      !(\n        Number.isInteger(pageNumber) &&\n        pageNumber > 0 &&\n        pageNumber <= this.pagesCount\n      )\n    ) {\n      console.error(`PDFLinkService.goToPage: \"${val}\" is not a valid page.`);\n      return;\n    }\n\n    if (this.pdfHistory) {\n      // Update the browser history before scrolling the new page into view,\n      // to be able to accurately capture the current document position.\n      this.pdfHistory.pushCurrentPosition();\n      this.pdfHistory.pushPage(pageNumber);\n    }\n\n    this.pdfViewer.scrollPageIntoView({ pageNumber });\n  }\n\n  /**\n   * Wrapper around the `addLinkAttributes` helper function.\n   * @param {HTMLAnchorElement} link\n   * @param {string} url\n   * @param {boolean} [newWindow]\n   */\n  addLinkAttributes(link, url, newWindow = false) {\n    addLinkAttributes(link, {\n      url,\n      target: newWindow ? LinkTarget.BLANK : this.externalLinkTarget,\n      rel: this.externalLinkRel,\n      enabled: this.externalLinkEnabled,\n    });\n  }\n\n  /**\n   * @param {string|Array} dest - The PDF destination object.\n   * @returns {string} The hyperlink to the PDF object.\n   */\n  getDestinationHash(dest) {\n    if (typeof dest === \"string\") {\n      if (dest.length > 0) {\n        return this.getAnchorUrl(\"#\" + escape(dest));\n      }\n    } else if (Array.isArray(dest)) {\n      const str = JSON.stringify(dest);\n      if (str.length > 0) {\n        return this.getAnchorUrl(\"#\" + escape(str));\n      }\n    }\n    return this.getAnchorUrl(\"\");\n  }\n\n  /**\n   * Prefix the full url on anchor links to make sure that links are resolved\n   * relative to the current URL instead of the one defined in <base href>.\n   * @param {string} anchor - The anchor hash, including the #.\n   * @returns {string} The hyperlink to the PDF object.\n   */\n  getAnchorUrl(anchor) {\n    return this.baseUrl ? this.baseUrl + anchor : anchor;\n  }\n\n  /**\n   * @param {string} hash\n   */\n  setHash(hash) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    let pageNumber, dest;\n    if (hash.includes(\"=\")) {\n      const params = parseQueryString(hash);\n      if (params.has(\"search\")) {\n        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 (\n      typeof dest === \"string\" ||\n      PDFLinkService.#isValidExplicitDestination(dest)\n    ) {\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    // See PDF reference, table 8.45 - Named action\n    switch (action) {\n      case \"GoBack\":\n        this.pdfHistory?.back();\n        break;\n\n      case \"GoForward\":\n        this.pdfHistory?.forward();\n        break;\n\n      case \"NextPage\":\n        this.pdfViewer.nextPage();\n        break;\n\n      case \"PrevPage\":\n        this.pdfViewer.previousPage();\n        break;\n\n      case \"LastPage\":\n        this.page = this.pagesCount;\n        break;\n\n      case \"FirstPage\":\n        this.page = 1;\n        break;\n\n      default:\n        break; // No action according to spec\n    }\n\n    this.eventBus.dispatch(\"namedaction\", {\n      source: this,\n      action,\n    });\n  }\n\n  /**\n   * @param {Object} action\n   */\n  async executeSetOCGState(action) {\n    const pdfDocument = this.pdfDocument;\n    const optionalContentConfig =\n      await this.pdfViewer.optionalContentConfigPromise;\n\n    if (pdfDocument !== this.pdfDocument) {\n      return; // The document was closed while the optional content resolved.\n    }\n    let operator;\n\n    for (const elem of action.state) {\n      switch (elem) {\n        case \"ON\":\n        case \"OFF\":\n        case \"Toggle\":\n          operator = elem;\n          continue;\n      }\n      switch (operator) {\n        case \"ON\":\n          optionalContentConfig.setVisibility(elem, true);\n          break;\n        case \"OFF\":\n          optionalContentConfig.setVisibility(elem, false);\n          break;\n        case \"Toggle\":\n          const group = optionalContentConfig.getGroup(elem);\n          if (group) {\n            optionalContentConfig.setVisibility(elem, !group.visible);\n          }\n          break;\n      }\n    }\n\n    this.pdfViewer.optionalContentConfigPromise = Promise.resolve(\n      optionalContentConfig\n    );\n  }\n\n  /**\n   * @param {number} pageNum - page number.\n   * @param {Object} pageRef - reference to the page.\n   */\n  cachePageRef(pageNum, pageRef) {\n    if (!pageRef) {\n      return;\n    }\n    const refStr =\n      pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;\n    this.#pagesRefCache.set(refStr, pageNum);\n  }\n\n  /**\n   * @ignore\n   */\n  _cachedPageNumber(pageRef) {\n    if (!pageRef) {\n      return null;\n    }\n    const refStr =\n      pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;\n    return this.#pagesRefCache.get(refStr) || null;\n  }\n\n  static #isValidExplicitDestination(dest) {\n    if (!Array.isArray(dest)) {\n      return false;\n    }\n    const destLength = dest.length;\n    if (destLength < 2) {\n      return false;\n    }\n    const page = dest[0];\n    if (\n      !(\n        typeof page === \"object\" &&\n        Number.isInteger(page.num) &&\n        Number.isInteger(page.gen)\n      ) &&\n      !(Number.isInteger(page) && page >= 0)\n    ) {\n      return false;\n    }\n    const zoom = dest[1];\n    if (!(typeof zoom === \"object\" && typeof zoom.name === \"string\")) {\n      return false;\n    }\n    let allowNull = true;\n    switch (zoom.name) {\n      case \"XYZ\":\n        if (destLength !== 5) {\n          return false;\n        }\n        break;\n      case \"Fit\":\n      case \"FitB\":\n        return destLength === 2;\n      case \"FitH\":\n      case \"FitBH\":\n      case \"FitV\":\n      case \"FitBV\":\n        if (destLength !== 3) {\n          return false;\n        }\n        break;\n      case \"FitR\":\n        if (destLength !== 6) {\n          return false;\n        }\n        allowNull = false;\n        break;\n      default:\n        return false;\n    }\n    for (let i = 2; i < destLength; i++) {\n      const param = dest[i];\n      if (!(typeof param === \"number\" || (allowNull && param === null))) {\n        return false;\n      }\n    }\n    return true;\n  }\n}\n\n/**\n * @implements {IPDFLinkService}\n */\nclass SimpleLinkService {\n  constructor() {\n    this.externalLinkEnabled = true;\n  }\n\n  /**\n   * @type {number}\n   */\n  get pagesCount() {\n    return 0;\n  }\n\n  /**\n   * @type {number}\n   */\n  get page() {\n    return 0;\n  }\n\n  /**\n   * @param {number} value\n   */\n  set page(value) {}\n\n  /**\n   * @type {number}\n   */\n  get rotation() {\n    return 0;\n  }\n\n  /**\n   * @param {number} value\n   */\n  set rotation(value) {}\n\n  /**\n   * @type {boolean}\n   */\n  get isInPresentationMode() {\n    return false;\n  }\n\n  /**\n   * @param {string|Array} dest - The named, or explicit, PDF destination.\n   */\n  async goToDestination(dest) {}\n\n  /**\n   * @param {number|string} val - The page number, or page label.\n   */\n  goToPage(val) {}\n\n  /**\n   * @param {HTMLAnchorElement} link\n   * @param {string} url\n   * @param {boolean} [newWindow]\n   */\n  addLinkAttributes(link, url, newWindow = false) {\n    addLinkAttributes(link, { url, enabled: this.externalLinkEnabled });\n  }\n\n  /**\n   * @param dest - The PDF destination object.\n   * @returns {string} The hyperlink to the PDF object.\n   */\n  getDestinationHash(dest) {\n    return \"#\";\n  }\n\n  /**\n   * @param hash - The PDF parameters/hash.\n   * @returns {string} The hyperlink to the PDF object.\n   */\n  getAnchorUrl(hash) {\n    return \"#\";\n  }\n\n  /**\n   * @param {string} hash\n   */\n  setHash(hash) {}\n\n  /**\n   * @param {string} action\n   */\n  executeNamedAction(action) {}\n\n  /**\n   * @param {Object} action\n   */\n  executeSetOCGState(action) {}\n\n  /**\n   * @param {number} pageNum - page number.\n   * @param {Object} pageRef - reference to the page.\n   */\n  cachePageRef(pageNum, pageRef) {}\n}\n\nexport { LinkTarget, PDFLinkService, SimpleLinkService };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\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  OutputScale,\n  RenderingStates,\n  roundToDivide,\n  TextLayerMode,\n} from \"./ui_utils.js\";\nimport { AnnotationEditorLayerBuilder } from \"./annotation_editor_layer_builder.js\";\nimport { AnnotationLayerBuilder } from \"./annotation_layer_builder.js\";\nimport { compatibilityParams } from \"./app_options.js\";\nimport { DrawLayerBuilder } from \"./draw_layer_builder.js\";\nimport { NullL10n } from \"web-l10n_utils\";\nimport { SimpleLinkService } from \"./pdf_link_service.js\";\nimport { StructTreeLayerBuilder } from \"./struct_tree_layer_builder.js\";\nimport { TextAccessibilityManager } from \"./text_accessibility.js\";\nimport { TextHighlighter } from \"./text_highlighter.js\";\nimport { TextLayerBuilder } from \"./text_layer_builder.js\";\nimport { XfaLayerBuilder } from \"./xfa_layer_builder.js\";\n\n/**\n * @typedef {Object} PDFPageViewOptions\n * @property {HTMLDivElement} [container] - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} id - The page unique ID (normally its number).\n * @property {number} [scale] - The page scale display.\n * @property {PageViewport} defaultViewport - The page viewport.\n * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -\n *   A promise that is resolved with an {@link OptionalContentConfig} instance.\n *   The default value is `null`.\n * @property {PDFRenderingQueue} [renderingQueue] - The rendering queue object.\n * @property {number} [textLayerMode] - Controls if the text layer used for\n *   selection and searching is created. The constants from {TextLayerMode}\n *   should be used. The default value is `TextLayerMode.ENABLE`.\n * @property {number} [annotationMode] - Controls if the annotation layer is\n *   created, and if interactive form elements or `AnnotationStorage`-data are\n *   being rendered. The constants from {@link AnnotationMode} should be used;\n *   see also {@link RenderParameters} and {@link GetOperatorListParameters}.\n *   The default value is `AnnotationMode.ENABLE_FORMS`.\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n *   for annotation icons. Include trailing slash.\n * @property {boolean} [isOffscreenCanvasSupported] - Allows to use an\n *   OffscreenCanvas if needed.\n * @property {number} [maxCanvasPixels] - The maximum supported canvas size in\n *   total pixels, i.e. width * height. Use `-1` for no limit, or `0` for\n *   CSS-only zooming. The default value is 4096 * 4096 (16 mega-pixels).\n * @property {Object} [pageColors] - Overwrites background and foreground colors\n *   with user defined ones in order to improve readability in high contrast\n *   mode.\n * @property {IL10n} [l10n] - Localization service.\n * @property {Object} [layerProperties] - The object that is used to lookup\n *   the necessary layer-properties.\n */\n\nconst MAX_CANVAS_PIXELS = compatibilityParams.maxCanvasPixels || 16777216;\n\nconst DEFAULT_LAYER_PROPERTIES =\n  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\n/**\n * @implements {IRenderableView}\n */\nclass PDFPageView {\n  #annotationMode = AnnotationMode.ENABLE_FORMS;\n\n  #hasRestrictedScaling = 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  /**\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.isOffscreenCanvasSupported =\n      options.isOffscreenCanvasSupported ?? true;\n    this.maxCanvasPixels = options.maxCanvasPixels ?? MAX_CANVAS_PIXELS;\n    this.pageColors = options.pageColors || null;\n\n    this.eventBus = options.eventBus;\n    this.renderingQueue = options.renderingQueue;\n    this.l10n = options.l10n || NullL10n;\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 (this.l10n === NullL10n) {\n        this.l10n.translate(this.div);\n      }\n    }\n  }\n\n  get renderingState() {\n    return this.#renderingState;\n  }\n\n  set renderingState(state) {\n    if (state === this.#renderingState) {\n      return;\n    }\n    this.#renderingState = state;\n\n    if (this.#loadingId) {\n      clearTimeout(this.#loadingId);\n      this.#loadingId = null;\n    }\n\n    switch (state) {\n      case RenderingStates.PAUSED:\n        this.div.classList.remove(\"loading\");\n        break;\n      case RenderingStates.RUNNING:\n        this.div.classList.add(\"loadingIcon\");\n        this.#loadingId = setTimeout(() => {\n          // Adding the loading class is slightly postponed in order to not have\n          // it with loadingIcon.\n          // If we don't do that the visibility of the background is changed but\n          // the transition isn't triggered.\n          this.div.classList.add(\"loading\");\n          this.#loadingId = null;\n        }, 0);\n        break;\n      case RenderingStates.INITIAL:\n      case RenderingStates.FINISHED:\n        this.div.classList.remove(\"loadingIcon\", \"loading\");\n        break;\n    }\n  }\n\n  #setDimensions() {\n    const { viewport } = this;\n    if (this.pdfPage) {\n      if (this.#previousRotation === viewport.rotation) {\n        return;\n      }\n      this.#previousRotation = viewport.rotation;\n    }\n\n    setLayerDimensions(\n      this.div,\n      viewport,\n      /* mustFlip = */ true,\n      /* mustRotate = */ false\n    );\n  }\n\n  setPdfPage(pdfPage) {\n    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          \"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  get _textHighlighter() {\n    return shadow(\n      this,\n      \"_textHighlighter\",\n      new TextHighlighter({\n        pageIndex: this.id - 1,\n        eventBus: this.eventBus,\n        findController: this.#layerProperties.findController,\n      })\n    );\n  }\n\n  async #renderAnnotationLayer() {\n    let error = null;\n    try {\n      await this.annotationLayer.render(this.viewport, \"display\");\n    } catch (ex) {\n      console.error(`#renderAnnotationLayer: \"${ex}\".`);\n      error = ex;\n    } finally {\n      this.eventBus.dispatch(\"annotationlayerrendered\", {\n        source: this,\n        pageNumber: this.id,\n        error,\n      });\n    }\n  }\n\n  async #renderAnnotationEditorLayer() {\n    let error = null;\n    try {\n      await this.annotationEditorLayer.render(this.viewport, \"display\");\n    } catch (ex) {\n      console.error(`#renderAnnotationEditorLayer: \"${ex}\".`);\n      error = ex;\n    } finally {\n      this.eventBus.dispatch(\"annotationeditorlayerrendered\", {\n        source: this,\n        pageNumber: this.id,\n        error,\n      });\n    }\n  }\n\n  async #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.div.append(this.xfaLayer.div);\n        this.l10n.resume();\n      }\n\n      this.eventBus.dispatch(\"xfalayerrendered\", {\n        source: this,\n        pageNumber: this.id,\n        error,\n      });\n    }\n  }\n\n  async #renderTextLayer() {\n    const { pdfPage, textLayer, viewport } = this;\n    if (!textLayer) {\n      return;\n    }\n\n    let error = null;\n    try {\n      if (!textLayer.renderingDone) {\n        const readableStream = pdfPage.streamTextContent({\n          includeMarkedContent: true,\n          disableNormalization: true,\n        });\n        textLayer.setTextContentSource(readableStream);\n      }\n      await textLayer.render(viewport);\n    } catch (ex) {\n      if (ex instanceof AbortException) {\n        return;\n      }\n      console.error(`#renderTextLayer: \"${ex}\".`);\n      error = ex;\n    }\n\n    this.eventBus.dispatch(\"textlayerrendered\", {\n      source: this,\n      pageNumber: this.id,\n      numTextDivs: textLayer.numTextDivs,\n      error,\n    });\n\n    this.#renderStructTreeLayer();\n  }\n\n  /**\n   * The structure tree is currently only supported when the text layer is\n   * enabled and a canvas is used for rendering.\n   *\n   * The structure tree must be generated after the text layer for the\n   * aria-owns to work.\n   */\n  async #renderStructTreeLayer() {\n    if (!this.textLayer) {\n      return;\n    }\n    this.structTreeLayer ||= new StructTreeLayerBuilder();\n\n    const tree = await (!this.structTreeLayer.renderingDone\n      ? this.pdfPage.getStructTree()\n      : null);\n    const treeDom = this.structTreeLayer?.render(tree);\n    if (treeDom) {\n      // 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    }\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  /**\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 =\n        !onlyCssZoom && drawingDelay >= 0 && drawingDelay < 1000;\n\n      if (postponeDrawing || onlyCssZoom) {\n        if (\n          postponeDrawing &&\n          this.renderingState !== RenderingStates.FINISHED\n        ) {\n          this.cancelRendering({\n            keepZoomLayer: true,\n            keepAnnotationLayer: true,\n            keepAnnotationEditorLayer: true,\n            keepXfaLayer: true,\n            keepTextLayer: true,\n            cancelExtraDelay: drawingDelay,\n          });\n          // It isn't really finished, but once we have finished\n          // to postpone, we'll call this.reset(...) which will set\n          // the rendering state to INITIAL, hence the next call to\n          // PDFViewer.update() will trigger a redraw (if it's mandatory).\n          this.renderingState = RenderingStates.FINISHED;\n          // 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    div.append(canvasWrapper);\n\n    if (\n      !this.textLayer &&\n      this.#textLayerMode !== TextLayerMode.DISABLE &&\n      !pdfPage.isPureXfa\n    ) {\n      this._accessibilityManager ||= new TextAccessibilityManager();\n\n      this.textLayer = new TextLayerBuilder({\n        highlighter: this._textHighlighter,\n        accessibilityManager: this._accessibilityManager,\n        isOffscreenCanvasSupported: this.isOffscreenCanvasSupported,\n        enablePermissions:\n          this.#textLayerMode === TextLayerMode.ENABLE_PERMISSIONS,\n      });\n      this.textLayer.onAppend = textLayerDiv => {\n        // Pause translation when inserting the textLayer in the DOM.\n        this.l10n.pause();\n        this.div.append(textLayerDiv);\n        this.l10n.resume();\n      };\n    }\n\n    if (\n      !this.annotationLayer &&\n      this.#annotationMode !== AnnotationMode.DISABLE\n    ) {\n      const {\n        annotationStorage,\n        downloadManager,\n        enableScripting,\n        fieldObjectsPromise,\n        hasJSActionsPromise,\n        linkService,\n      } = this.#layerProperties;\n\n      this._annotationCanvasMap ||= new Map();\n      this.annotationLayer = new AnnotationLayerBuilder({\n        pageDiv: div,\n        pdfPage,\n        annotationStorage,\n        imageResourcesPath: this.imageResourcesPath,\n        renderForms: this.#annotationMode === AnnotationMode.ENABLE_FORMS,\n        linkService,\n        downloadManager,\n        enableScripting,\n        hasJSActionsPromise,\n        fieldObjectsPromise,\n        annotationCanvasMap: this._annotationCanvasMap,\n        accessibilityManager: this._accessibilityManager,\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\", { alpha: false });\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 = roundToDivide(width * outputScale.sx, sfx[0]);\n    canvas.height = roundToDivide(height * outputScale.sy, sfy[0]);\n    const { style } = canvas;\n    style.width = roundToDivide(width, sfx[1]) + \"px\";\n    style.height = roundToDivide(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    };\n    const renderTask = (this.renderTask = this.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\n        this.drawLayer ||= new DrawLayerBuilder({\n          pageIndex: this.id,\n        });\n        await this.#renderDrawLayer();\n        this.drawLayer.setParent(canvasWrapper);\n\n        if (!this.annotationEditorLayer) {\n          this.annotationEditorLayer = new AnnotationEditorLayerBuilder({\n            uiManager: annotationEditorUIManager,\n            pageDiv: div,\n            pdfPage,\n            l10n,\n            accessibilityManager: this._accessibilityManager,\n            annotationLayer: this.annotationLayer?.annotationLayer,\n            textLayer: this.textLayer,\n            drawLayer: this.drawLayer.getDrawLayer(),\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 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces\").IRenderableView} IRenderableView */\n/** @typedef {import(\"./pdf_viewer\").PDFViewer} PDFViewer */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_thumbnail_viewer\").PDFThumbnailViewer} PDFThumbnailViewer */\n\nimport { RenderingCancelledException } from \"pdfjs-lib\";\nimport { RenderingStates } from \"./ui_utils.js\";\n\nconst CLEANUP_TIMEOUT = 30000;\n\n/**\n * Controls rendering of the views for pages and thumbnails.\n */\nclass PDFRenderingQueue {\n  constructor() {\n    this.pdfViewer = null;\n    this.pdfThumbnailViewer = null;\n    this.onIdle = null;\n    this.highestPriorityPage = null;\n    /** @type {number} */\n    this.idleTimeout = null;\n    this.printing = false;\n    this.isThumbnailViewEnabled = false;\n\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      Object.defineProperty(this, \"hasViewer\", {\n        value: () => !!this.pdfViewer,\n      });\n    }\n  }\n\n  /**\n   * @param {PDFViewer} pdfViewer\n   */\n  setViewer(pdfViewer) {\n    this.pdfViewer = pdfViewer;\n  }\n\n  /**\n   * @param {PDFThumbnailViewer} pdfThumbnailViewer\n   */\n  setThumbnailViewer(pdfThumbnailViewer) {\n    this.pdfThumbnailViewer = pdfThumbnailViewer;\n  }\n\n  /**\n   * @param {IRenderableView} view\n   * @returns {boolean}\n   */\n  isHighestPriority(view) {\n    return this.highestPriorityPage === view.renderingId;\n  }\n\n  /**\n   * @param {Object} currentlyVisiblePages\n   */\n  renderHighestPriority(currentlyVisiblePages) {\n    if (this.idleTimeout) {\n      clearTimeout(this.idleTimeout);\n      this.idleTimeout = null;\n    }\n\n    // Pages have a higher priority than thumbnails, so check them first.\n    if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {\n      return;\n    }\n    // No pages needed rendering, so check thumbnails.\n    if (\n      this.isThumbnailViewEnabled &&\n      this.pdfThumbnailViewer?.forceRendering()\n    ) {\n      return;\n    }\n\n    if (this.printing) {\n      // If printing is currently ongoing do not reschedule cleanup.\n      return;\n    }\n\n    if (this.onIdle) {\n      this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);\n    }\n  }\n\n  /**\n   * @param {Object} visible\n   * @param {Array} views\n   * @param {boolean} scrolledDown\n   * @param {boolean} [preRenderExtra]\n   */\n  getHighestPriority(visible, views, scrolledDown, preRenderExtra = false) {\n    /**\n     * The state has changed. Figure out which page has the highest priority to\n     * render next (if any).\n     *\n     * Priority:\n     * 1. visible pages\n     * 2. if last scrolled down, the page after the visible pages, or\n     *    if last scrolled up, the page before the visible pages\n     */\n    const visibleViews = visible.views,\n      numVisible = visibleViews.length;\n\n    if (numVisible === 0) {\n      return null;\n    }\n    for (let i = 0; i < numVisible; i++) {\n      const view = visibleViews[i].view;\n      if (!this.isViewFinished(view)) {\n        return view;\n      }\n    }\n    const firstId = visible.first.id,\n      lastId = visible.last.id;\n\n    // All the visible views have rendered; try to handle any \"holes\" in the\n    // page layout (can happen e.g. with spreadModes at higher zoom levels).\n    if (lastId - firstId + 1 > numVisible) {\n      const visibleIds = visible.ids;\n      for (let i = 1, ii = lastId - firstId; i < ii; i++) {\n        const holeId = scrolledDown ? firstId + i : lastId - i;\n        if (visibleIds.has(holeId)) {\n          continue;\n        }\n        const holeView = views[holeId - 1];\n        if (!this.isViewFinished(holeView)) {\n          return holeView;\n        }\n      }\n    }\n\n    // All the visible views have rendered; try to render next/previous page.\n    // (IDs start at 1, so no need to add 1 when `scrolledDown === true`.)\n    let preRenderIndex = scrolledDown ? lastId : firstId - 2;\n    let preRenderView = views[preRenderIndex];\n\n    if (preRenderView && !this.isViewFinished(preRenderView)) {\n      return preRenderView;\n    }\n    if (preRenderExtra) {\n      preRenderIndex += scrolledDown ? 1 : -1;\n      preRenderView = views[preRenderIndex];\n\n      if (preRenderView && !this.isViewFinished(preRenderView)) {\n        return preRenderView;\n      }\n    }\n    // Everything that needs to be rendered has been.\n    return null;\n  }\n\n  /**\n   * @param {IRenderableView} view\n   * @returns {boolean}\n   */\n  isViewFinished(view) {\n    return view.renderingState === RenderingStates.FINISHED;\n  }\n\n  /**\n   * Render a page or thumbnail view. This calls the appropriate function\n   * based on the views state. If the view is already rendered it will return\n   * `false`.\n   *\n   * @param {IRenderableView} view\n   */\n  renderView(view) {\n    switch (view.renderingState) {\n      case RenderingStates.FINISHED:\n        return false;\n      case RenderingStates.PAUSED:\n        this.highestPriorityPage = view.renderingId;\n        view.resume();\n        break;\n      case RenderingStates.RUNNING:\n        this.highestPriorityPage = view.renderingId;\n        break;\n      case RenderingStates.INITIAL:\n        this.highestPriorityPage = view.renderingId;\n        view\n          .draw()\n          .finally(() => {\n            this.renderHighestPriority();\n          })\n          .catch(reason => {\n            if (reason instanceof RenderingCancelledException) {\n              return;\n            }\n            console.error(`renderView: \"${reason}\"`);\n          });\n        break;\n    }\n    return true;\n  }\n}\n\nexport { PDFRenderingQueue };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\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: () => {\n        return new GenericScripting(options.sandboxBundleSrc);\n      },\n    };\n    options.docProperties ||= pdfDocument => {\n      return docProperties(pdfDocument);\n    };\n    super(options);\n  }\n}\n\nexport { PDFScriptingManagerComponents as 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\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n\nimport { apiPageLayoutToViewerModes, RenderingStates } from \"./ui_utils.js\";\nimport { PromiseCapability, 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  #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\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\n    this._internalEvents.set(\"updatefromsandbox\", event => {\n      if (event?.source === window) {\n        this.#updateFromSandbox(event.detail);\n      }\n    });\n    this._internalEvents.set(\"dispatcheventinsandbox\", event => {\n      this.#scripting?.dispatchEventInSandbox(event.detail);\n    });\n\n    this._internalEvents.set(\"pagechanging\", ({ pageNumber, previous }) => {\n      if (pageNumber === previous) {\n        return; // The current page didn't change.\n      }\n      this.#dispatchPageClose(previous);\n      this.#dispatchPageOpen(pageNumber);\n    });\n    this._internalEvents.set(\"pagerendered\", ({ pageNumber }) => {\n      if (!this._pageOpenPending.has(pageNumber)) {\n        return; // No pending \"PageOpen\" event for the newly rendered page.\n      }\n      if (pageNumber !== this.#pdfViewer.currentPageNumber) {\n        return; // The newly rendered page is no longer the current one.\n      }\n      this.#dispatchPageOpen(pageNumber);\n    });\n    this._internalEvents.set(\"pagesdestroy\", async () => {\n      await this.#dispatchPageClose(this.#pdfViewer.currentPageNumber);\n\n      await this.#scripting?.dispatchEventInSandbox({\n        id: \"doc\",\n        name: \"WillClose\",\n      });\n\n      this.#closeCapability?.resolve();\n    });\n\n    for (const [name, listener] of this._internalEvents) {\n      this.#eventBus._on(name, listener);\n    }\n\n    try {\n      const docProperties = await this.#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      this.#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 = new PromiseCapability();\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 _internalEvents() {\n    return shadow(this, \"_internalEvents\", new Map());\n  }\n\n  /**\n   * @private\n   */\n  get _pageOpenPending() {\n    return shadow(this, \"_pageOpenPending\", new Set());\n  }\n\n  /**\n   * @private\n   */\n  get _visitedPages() {\n    return shadow(this, \"_visitedPages\", new Map());\n  }\n\n  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      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 = new PromiseCapability();\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 = new PromiseCapability();\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    for (const [name, listener] of this._internalEvents) {\n      this.#eventBus._off(name, listener);\n    }\n    this._internalEvents.clear();\n\n    this._pageOpenPending.clear();\n    this._visitedPages.clear();\n\n    this.#scripting = null;\n    this.#ready = false;\n\n    this.#destroyCapability?.resolve();\n  }\n}\n\nexport { PDFScriptingManager };\n","/* Copyright 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 { NullL10n } from \"./l10n_utils.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  NullL10n,\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","/* 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  PromiseCapability,\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 { NullL10n } from \"web-l10n_utils\";\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: 15000,\n  FORCE_LAZY_PAGE_INIT: 7500,\n  PAUSE_EAGER_PAGE_INIT: 250,\n};\n\nfunction isValidAnnotationEditorMode(mode) {\n  return (\n    Object.values(AnnotationEditorType).includes(mode) &&\n    mode !== AnnotationEditorType.DISABLE\n  );\n}\n\n/**\n * @typedef {Object} PDFViewerOptions\n * @property {HTMLDivElement} container - The container for the viewer element.\n * @property {HTMLDivElement} [viewer] - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IPDFLinkService} [linkService] - The navigation/linking service.\n * @property {IDownloadManager} [downloadManager] - The download manager\n *   component.\n * @property {PDFFindController} [findController] - The find controller\n *   component.\n * @property {PDFScriptingManager} [scriptingManager] - The scripting manager\n *   component.\n * @property {PDFRenderingQueue} [renderingQueue] - The rendering queue object.\n * @property {boolean} [removePageBorders] - Removes the border shadow around\n *   the pages. The default value is `false`.\n * @property {number} [textLayerMode] - Controls if the text layer used for\n *   selection and searching is created. The constants from {TextLayerMode}\n *   should be used. The default value is `TextLayerMode.ENABLE`.\n * @property {number} [annotationMode] - Controls if the annotation layer is\n *   created, and if interactive form elements or `AnnotationStorage`-data are\n *   being rendered. The constants from {@link AnnotationMode} should be used;\n *   see also {@link RenderParameters} and {@link GetOperatorListParameters}.\n *   The default value is `AnnotationMode.ENABLE_FORMS`.\n * @property {number} [annotationEditorMode] - Enables the creation and editing\n *   of new Annotations. The constants from {@link AnnotationEditorType} should\n *   be used. The default value is `AnnotationEditorType.NONE`.\n * @property {string} [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 {boolean} [isOffscreenCanvasSupported] - Allows to use an\n *   OffscreenCanvas if needed.\n * @property {number} [maxCanvasPixels] - The maximum supported canvas size in\n *   total pixels, i.e. width * height. Use `-1` for no limit, or `0` for\n *   CSS-only zooming. The default value is 4096 * 4096 (16 mega-pixels).\n * @property {IL10n} [l10n] - Localization service.\n * @property {boolean} [enablePermissions] - Enables PDF document permissions,\n *   when they exist. The default value is `false`.\n * @property {Object} [pageColors] - Overwrites background and foreground colors\n *   with user defined ones in order to improve readability in high contrast\n *   mode.\n */\n\nclass PDFPageViewBuffer {\n  // Here we rely on the fact that `Set`s preserve the insertion order.\n  #buf = new Set();\n\n  #size = 0;\n\n  constructor(size) {\n    this.#size = size;\n  }\n\n  push(view) {\n    const buf = this.#buf;\n    if (buf.has(view)) {\n      buf.delete(view); // Move the view to the \"end\" of the buffer.\n    }\n    buf.add(view);\n\n    if (buf.size > this.#size) {\n      this.#destroyFirstView();\n    }\n  }\n\n  /**\n   * After calling resize, the size of the buffer will be `newSize`.\n   * The optional parameter `idsToKeep` is, if present, a Set of page-ids to\n   * push to the back of the buffer, delaying their destruction. The size of\n   * `idsToKeep` has no impact on the final size of the buffer; if `idsToKeep`\n   * is larger than `newSize`, some of those pages will be destroyed anyway.\n   */\n  resize(newSize, idsToKeep = null) {\n    this.#size = newSize;\n\n    const buf = this.#buf;\n    if (idsToKeep) {\n      const ii = buf.size;\n      let i = 1;\n      for (const view of buf) {\n        if (idsToKeep.has(view.id)) {\n          buf.delete(view); // Move the view to the \"end\" of the buffer.\n          buf.add(view);\n        }\n        if (++i > ii) {\n          break;\n        }\n      }\n    }\n\n    while (buf.size > this.#size) {\n      this.#destroyFirstView();\n    }\n  }\n\n  has(view) {\n    return this.#buf.has(view);\n  }\n\n  [Symbol.iterator]() {\n    return this.#buf.keys();\n  }\n\n  #destroyFirstView() {\n    const firstView = this.#buf.keys().next().value;\n\n    firstView?.destroy();\n    this.#buf.delete(firstView);\n  }\n}\n\n/**\n * Simple viewer control to display PDF content/pages.\n */\nclass PDFViewer {\n  #buffer = null;\n\n  #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  #copyCallbackBound = null;\n\n  #enablePermissions = false;\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  #onVisibilityChange = 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.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.isOffscreenCanvasSupported =\n      options.isOffscreenCanvasSupported ?? true;\n    this.maxCanvasPixels = options.maxCanvasPixels;\n    this.l10n = options.l10n || NullL10n;\n    this.#enablePermissions = options.enablePermissions || false;\n    this.pageColors = options.pageColors || null;\n\n    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    this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this));\n    this.presentationModeState = PresentationModeState.UNKNOWN;\n    this._onBeforeDraw = this._onAfterDraw = null;\n    this._resetView();\n\n    if (\n      (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n      this.removePageBorders\n    ) {\n      this.viewer.classList.add(\"removePageBorders\");\n    }\n\n    this.#updateContainerHeightCss();\n\n    // 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      this.l10n === NullL10n\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 (\n      this._pagesCapability.settled &&\n      this._pages.every(pageView => pageView?.pdfPage)\n    );\n  }\n\n  /**\n   * @type {boolean}\n   */\n  get renderForms() {\n    return this.#annotationMode === AnnotationMode.ENABLE_FORMS;\n  }\n\n  /**\n   * @type {boolean}\n   */\n  get enableScripting() {\n    return !!this._scriptingManager;\n  }\n\n  /**\n   * @type {number}\n   */\n  get currentPageNumber() {\n    return this._currentPageNumber;\n  }\n\n  /**\n   * @param {number} val - The page number.\n   */\n  set currentPageNumber(val) {\n    if (!Number.isInteger(val)) {\n      throw new Error(\"Invalid page number.\");\n    }\n    if (!this.pdfDocument) {\n      return;\n    }\n    // The intent can be to just reset a scroll position and/or scale.\n    if (!this._setCurrentPageNumber(val, /* resetCurrentPageView = */ true)) {\n      console.error(`currentPageNumber: \"${val}\" is not a valid page.`);\n    }\n  }\n\n  /**\n   * @returns {boolean} Whether the pageNumber is valid (within bounds).\n   * @private\n   */\n  _setCurrentPageNumber(val, resetCurrentPageView = false) {\n    if (this._currentPageNumber === val) {\n      if (resetCurrentPageView) {\n        this.#resetCurrentPageView();\n      }\n      return true;\n    }\n\n    if (!(0 < val && val <= this.pagesCount)) {\n      return false;\n    }\n    const previous = this._currentPageNumber;\n    this._currentPageNumber = val;\n\n    this.eventBus.dispatch(\"pagechanging\", {\n      source: this,\n      pageNumber: val,\n      pageLabel: this._pageLabels?.[val - 1] ?? null,\n      previous,\n    });\n\n    if (resetCurrentPageView) {\n      this.#resetCurrentPageView();\n    }\n    return true;\n  }\n\n  /**\n   * @type {string|null} Returns the current page label, or `null` if no page\n   *   labels exist.\n   */\n  get currentPageLabel() {\n    return this._pageLabels?.[this._currentPageNumber - 1] ?? null;\n  }\n\n  /**\n   * @param {string} val - The page label.\n   */\n  set currentPageLabel(val) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    let page = val | 0; // Fallback page number.\n    if (this._pageLabels) {\n      const i = this._pageLabels.indexOf(val);\n      if (i >= 0) {\n        page = i + 1;\n      }\n    }\n    // The intent can be to just reset a scroll position and/or scale.\n    if (!this._setCurrentPageNumber(page, /* resetCurrentPageView = */ true)) {\n      console.error(`currentPageLabel: \"${val}\" is not a valid page.`);\n    }\n  }\n\n  /**\n   * @type {number}\n   */\n  get currentScale() {\n    return this._currentScale !== UNKNOWN_SCALE\n      ? this._currentScale\n      : DEFAULT_SCALE;\n  }\n\n  /**\n   * @param {number} val - Scale of the pages in percents.\n   */\n  set currentScale(val) {\n    if (isNaN(val)) {\n      throw new Error(\"Invalid numeric scale.\");\n    }\n    if (!this.pdfDocument) {\n      return;\n    }\n    this.#setScale(val, { noScroll: false });\n  }\n\n  /**\n   * @type {string}\n   */\n  get currentScaleValue() {\n    return this._currentScaleValue;\n  }\n\n  /**\n   * @param val - The scale of the pages (in percent or predefined value).\n   */\n  set currentScaleValue(val) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    this.#setScale(val, { noScroll: false });\n  }\n\n  /**\n   * @type {number}\n   */\n  get pagesRotation() {\n    return this._pagesRotation;\n  }\n\n  /**\n   * @param {number} rotation - The rotation of the pages (0, 90, 180, 270).\n   */\n  set pagesRotation(rotation) {\n    if (!isValidRotation(rotation)) {\n      throw new Error(\"Invalid pages rotation angle.\");\n    }\n    if (!this.pdfDocument) {\n      return;\n    }\n    // Normalize the rotation, by clamping it to the [0, 360) range.\n    rotation %= 360;\n    if (rotation < 0) {\n      rotation += 360;\n    }\n    if (this._pagesRotation === rotation) {\n      return; // The rotation didn't change.\n    }\n    this._pagesRotation = rotation;\n\n    const pageNumber = this._currentPageNumber;\n\n    this.refresh(true, { rotation });\n\n    // Prevent errors in case the rotation changes *before* the scale has been\n    // set to a non-default value.\n    if (this._currentScaleValue) {\n      this.#setScale(this._currentScaleValue, { noScroll: true });\n    }\n\n    this.eventBus.dispatch(\"rotationchanging\", {\n      source: this,\n      pagesRotation: rotation,\n      pageNumber,\n    });\n\n    if (this.defaultRenderingQueue) {\n      this.update();\n    }\n  }\n\n  get firstPagePromise() {\n    return this.pdfDocument ? this._firstPageCapability.promise : null;\n  }\n\n  get onePageRendered() {\n    return this.pdfDocument ? this._onePageRenderedCapability.promise : null;\n  }\n\n  get pagesPromise() {\n    return this.pdfDocument ? this._pagesCapability.promise : null;\n  }\n\n  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  #onePageRenderedOrForceFetch() {\n    // Unless the viewer *and* its pages are visible, rendering won't start and\n    // `this._onePageRenderedCapability` thus won't be resolved.\n    // To ensure that automatic printing, on document load, still works even in\n    // those cases we force-allow fetching of all pages when:\n    //  - The current window/tab is inactive, which will prevent rendering since\n    //    `requestAnimationFrame` is being used; fixes bug 1746213.\n    //  - The viewer is hidden in the DOM, e.g. in a `display: none` <iframe>\n    //    element; fixes bug 1618621.\n    //  - The viewer is visible, but none of the pages are (e.g. if the\n    //    viewer is very small); fixes bug 1618955.\n    if (\n      document.visibilityState === \"hidden\" ||\n      !this.container.offsetParent ||\n      this._getVisiblePages().views.length === 0\n    ) {\n      return Promise.resolve();\n    }\n\n    // Handle the window/tab becoming inactive *after* rendering has started;\n    // fixes (another part of) bug 1746213.\n    const visibilityChangePromise = new Promise(resolve => {\n      this.#onVisibilityChange = () => {\n        if (document.visibilityState !== \"hidden\") {\n          return;\n        }\n        resolve();\n\n        document.removeEventListener(\n          \"visibilitychange\",\n          this.#onVisibilityChange\n        );\n        this.#onVisibilityChange = null;\n      };\n      document.addEventListener(\"visibilitychange\", this.#onVisibilityChange);\n    });\n\n    return Promise.race([\n      this._onePageRenderedCapability.promise,\n      visibilityChangePromise,\n    ]);\n  }\n\n  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 savedCursor = this.container.style.cursor;\n      this.container.style.cursor = \"wait\";\n\n      const interruptCopy = ev =>\n        (this.#interruptCopyCondition = ev.key === \"Escape\");\n      window.addEventListener(\"keydown\", interruptCopy);\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          window.removeEventListener(\"keydown\", interruptCopy);\n          this.container.style.cursor = savedCursor;\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      if (this.#annotationEditorUIManager) {\n        this.#annotationEditorUIManager.destroy();\n        this.#annotationEditorUIManager = null;\n      }\n    }\n\n    this.pdfDocument = pdfDocument;\n    if (!pdfDocument) {\n      return;\n    }\n    const pagesCount = pdfDocument.numPages;\n    const firstPagePromise = pdfDocument.getPage(1);\n    // Rendering (potentially) depends on this, hence fetching it immediately.\n    const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();\n    const permissionsPromise = this.#enablePermissions\n      ? pdfDocument.getPermissions()\n      : Promise.resolve();\n\n    // Given that browsers don't handle huge amounts of DOM-elements very well,\n    // enforce usage of PAGE-scrolling when loading *very* long/large documents.\n    if (pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {\n      console.warn(\n        \"Forcing PAGE-scrolling for performance reasons, given the length of the document.\"\n      );\n      const mode = (this._scrollMode = ScrollMode.PAGE);\n      this.eventBus.dispatch(\"scrollmodechanged\", { source: this, mode });\n    }\n\n    this._pagesCapability.promise.then(\n      () => {\n        this.eventBus.dispatch(\"pagesloaded\", { source: this, pagesCount });\n      },\n      () => {\n        /* Prevent \"Uncaught (in promise)\"-messages in the console. */\n      }\n    );\n\n    this._onBeforeDraw = evt => {\n      const pageView = this._pages[evt.pageNumber - 1];\n      if (!pageView) {\n        return;\n      }\n      // Add the page to the buffer at the start of drawing. That way it can be\n      // evicted from the buffer and destroyed even if we pause its rendering.\n      this.#buffer.push(pageView);\n    };\n    this.eventBus._on(\"pagerender\", this._onBeforeDraw);\n\n    this._onAfterDraw = evt => {\n      if (evt.cssTransform || this._onePageRenderedCapability.settled) {\n        return;\n      }\n      this._onePageRenderedCapability.resolve({ timestamp: evt.timestamp });\n\n      this.eventBus._off(\"pagerendered\", this._onAfterDraw);\n      this._onAfterDraw = null;\n\n      if (this.#onVisibilityChange) {\n        document.removeEventListener(\n          \"visibilitychange\",\n          this.#onVisibilityChange\n        );\n        this.#onVisibilityChange = null;\n      }\n    };\n    this.eventBus._on(\"pagerendered\", this._onAfterDraw);\n\n    // Fetch a single page so we can get a viewport that will be the default\n    // viewport for all pages\n    Promise.all([firstPagePromise, permissionsPromise])\n      .then(([firstPdfPage, permissions]) => {\n        if (pdfDocument !== this.pdfDocument) {\n          return; // The document was closed while the first page resolved.\n        }\n        this._firstPageCapability.resolve(firstPdfPage);\n        this._optionalContentConfigPromise = optionalContentConfigPromise;\n\n        const { annotationEditorMode, annotationMode, textLayerMode } =\n          this.#initializePermissions(permissions);\n\n        if (textLayerMode !== TextLayerMode.DISABLE) {\n          const element = (this.#hiddenCopyElement =\n            document.createElement(\"div\"));\n          element.id = \"hiddenCopyElement\";\n          this.viewer.before(element);\n        }\n\n        if (annotationEditorMode !== AnnotationEditorType.DISABLE) {\n          const mode = annotationEditorMode;\n\n          if (pdfDocument.isPureXfa) {\n            console.warn(\"Warning: XFA-editing is not implemented.\");\n          } else if (isValidAnnotationEditorMode(mode)) {\n            this.#annotationEditorUIManager = new AnnotationEditorUIManager(\n              this.container,\n              this.viewer,\n              this.#altTextManager,\n              this.eventBus,\n              pdfDocument,\n              this.pageColors,\n              this.#annotationEditorHighlightColors\n            );\n            this.eventBus.dispatch(\"annotationeditoruimanager\", {\n              source: this,\n              uiManager: this.#annotationEditorUIManager,\n            });\n            if (mode !== AnnotationEditorType.NONE) {\n              this.#annotationEditorUIManager.updateMode(mode);\n            }\n          } else {\n            console.error(`Invalid AnnotationEditor mode: ${mode}`);\n          }\n        }\n\n        const viewerElement =\n          this._scrollMode === ScrollMode.PAGE ? null : this.viewer;\n        const scale = this.currentScale;\n        const viewport = firstPdfPage.getViewport({\n          scale: scale * PixelsPerInch.PDF_TO_CSS_UNITS,\n        });\n        // Ensure that the various layers always get the correct initial size,\n        // see issue 15795.\n        this.viewer.style.setProperty(\"--scale-factor\", viewport.scale);\n        if (\n          this.pageColors?.foreground === \"CanvasText\" ||\n          this.pageColors?.background === \"Canvas\"\n        ) {\n          this.viewer.style.setProperty(\n            \"--hcm-highlight-filter\",\n            pdfDocument.filterFactory.addHighlightHCMFilter(\n              \"CanvasText\",\n              \"Canvas\",\n              \"HighlightText\",\n              \"Highlight\"\n            )\n          );\n        }\n\n        for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n          const pageView = new PDFPageView({\n            container: viewerElement,\n            eventBus: this.eventBus,\n            id: pageNum,\n            scale,\n            defaultViewport: viewport.clone(),\n            optionalContentConfigPromise,\n            renderingQueue: this.renderingQueue,\n            textLayerMode,\n            annotationMode,\n            imageResourcesPath: this.imageResourcesPath,\n            isOffscreenCanvasSupported: this.isOffscreenCanvasSupported,\n            maxCanvasPixels: this.maxCanvasPixels,\n            pageColors: this.pageColors,\n            l10n: this.l10n,\n            layerProperties: this._layerProperties,\n          });\n          this._pages.push(pageView);\n        }\n        // Set the first `pdfPage` immediately, since it's already loaded,\n        // rather than having to repeat the `PDFDocumentProxy.getPage` call in\n        // the `this.#ensurePdfPageLoaded` method before rendering can start.\n        const firstPageView = this._pages[0];\n        if (firstPageView) {\n          firstPageView.setPdfPage(firstPdfPage);\n          this.linkService.cachePageRef(1, firstPdfPage.ref);\n        }\n\n        if (this._scrollMode === ScrollMode.PAGE) {\n          // Ensure that the current page becomes visible on document load.\n          this.#ensurePageViewVisible();\n        } else if (this._spreadMode !== SpreadMode.NONE) {\n          this._updateSpreadMode();\n        }\n\n        // Fetch all the pages since the viewport is needed before printing\n        // starts to create the correct size canvas. Wait until one page is\n        // rendered so we don't tie up too many resources early on.\n        this.#onePageRenderedOrForceFetch().then(async () => {\n          this.findController?.setDocument(pdfDocument); // Enable searching.\n          this._scriptingManager?.setDocument(pdfDocument); // Enable scripting.\n\n          if (this.#hiddenCopyElement) {\n            this.#copyCallbackBound = this.#copyCallback.bind(\n              this,\n              textLayerMode\n            );\n            document.addEventListener(\"copy\", this.#copyCallbackBound);\n          }\n\n          if (this.#annotationEditorUIManager) {\n            // Ensure that the Editor buttons, in the toolbar, are updated.\n            this.eventBus.dispatch(\"annotationeditormodechanged\", {\n              source: this,\n              mode: this.#annotationEditorMode,\n            });\n          }\n\n          // In addition to 'disableAutoFetch' being set, also attempt to reduce\n          // resource usage when loading *very* long/large documents.\n          if (\n            pdfDocument.loadingParams.disableAutoFetch ||\n            pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT\n          ) {\n            // XXX: Printing is semi-broken with auto fetch disabled.\n            this._pagesCapability.resolve();\n            return;\n          }\n          let getPagesLeft = pagesCount - 1; // The first page was already loaded.\n\n          if (getPagesLeft <= 0) {\n            this._pagesCapability.resolve();\n            return;\n          }\n          for (let pageNum = 2; pageNum <= pagesCount; ++pageNum) {\n            const promise = pdfDocument.getPage(pageNum).then(\n              pdfPage => {\n                const pageView = this._pages[pageNum - 1];\n                if (!pageView.pdfPage) {\n                  pageView.setPdfPage(pdfPage);\n                }\n                this.linkService.cachePageRef(pageNum, pdfPage.ref);\n                if (--getPagesLeft === 0) {\n                  this._pagesCapability.resolve();\n                }\n              },\n              reason => {\n                console.error(\n                  `Unable to get page ${pageNum} to initialize viewer`,\n                  reason\n                );\n                if (--getPagesLeft === 0) {\n                  this._pagesCapability.resolve();\n                }\n              }\n            );\n\n            if (pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0) {\n              await promise;\n            }\n          }\n        });\n\n        this.eventBus.dispatch(\"pagesinit\", { source: this });\n\n        pdfDocument.getMetadata().then(({ info }) => {\n          if (pdfDocument !== this.pdfDocument) {\n            return; // The document was closed while the metadata resolved.\n          }\n          if (info.Language) {\n            this.viewer.lang = info.Language;\n          }\n        });\n\n        if (this.defaultRenderingQueue) {\n          this.update();\n        }\n      })\n      .catch(reason => {\n        console.error(\"Unable to initialize viewer\", reason);\n\n        this._pagesCapability.reject(reason);\n      });\n  }\n\n  /**\n   * @param {Array|null} labels\n   */\n  setPageLabels(labels) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    if (!labels) {\n      this._pageLabels = null;\n    } else if (\n      !(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)\n    ) {\n      this._pageLabels = null;\n      console.error(`setPageLabels: Invalid page labels.`);\n    } else {\n      this._pageLabels = labels;\n    }\n    // Update all the `PDFPageView` instances.\n    for (let i = 0, ii = this._pages.length; i < ii; i++) {\n      this._pages[i].setPageLabel(this._pageLabels?.[i] ?? null);\n    }\n  }\n\n  _resetView() {\n    this._pages = [];\n    this._currentPageNumber = 1;\n    this._currentScale = UNKNOWN_SCALE;\n    this._currentScaleValue = null;\n    this._pageLabels = null;\n    this.#buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);\n    this._location = null;\n    this._pagesRotation = 0;\n    this._optionalContentConfigPromise = null;\n    this._firstPageCapability = new PromiseCapability();\n    this._onePageRenderedCapability = new PromiseCapability();\n    this._pagesCapability = new PromiseCapability();\n    this._scrollMode = ScrollMode.VERTICAL;\n    this._previousScrollMode = ScrollMode.UNKNOWN;\n    this._spreadMode = SpreadMode.NONE;\n\n    this.#scrollModePageState = {\n      previousPageNumber: 1,\n      scrollDown: true,\n      pages: [],\n    };\n\n    if (this._onBeforeDraw) {\n      this.eventBus._off(\"pagerender\", this._onBeforeDraw);\n      this._onBeforeDraw = null;\n    }\n    if (this._onAfterDraw) {\n      this.eventBus._off(\"pagerendered\", this._onAfterDraw);\n      this._onAfterDraw = null;\n    }\n    if (this.#onVisibilityChange) {\n      document.removeEventListener(\n        \"visibilitychange\",\n        this.#onVisibilityChange\n      );\n      this.#onVisibilityChange = null;\n    }\n    // Remove the pages from the DOM...\n    this.viewer.textContent = \"\";\n    // ... and reset the Scroll mode CSS class(es) afterwards.\n    this._updateScrollMode();\n\n    this.viewer.removeAttribute(\"lang\");\n\n    if (this.#hiddenCopyElement) {\n      document.removeEventListener(\"copy\", this.#copyCallbackBound);\n      this.#copyCallbackBound = null;\n\n      this.#hiddenCopyElement.remove();\n      this.#hiddenCopyElement = null;\n    }\n  }\n\n  #ensurePageViewVisible() {\n    if (this._scrollMode !== ScrollMode.PAGE) {\n      throw new Error(\"#ensurePageViewVisible: Invalid scrollMode value.\");\n    }\n    const pageNumber = this._currentPageNumber,\n      state = this.#scrollModePageState,\n      viewer = this.viewer;\n\n    // Temporarily remove all the pages from the DOM...\n    viewer.textContent = \"\";\n    // ... and clear out the active ones.\n    state.pages.length = 0;\n\n    if (this._spreadMode === SpreadMode.NONE && !this.isInPresentationMode) {\n      // Finally, append the new page to the viewer.\n      const pageView = this._pages[pageNumber - 1];\n      viewer.append(pageView.div);\n\n      state.pages.push(pageView);\n    } else {\n      const pageIndexSet = new Set(),\n        parity = this._spreadMode - 1;\n\n      // Determine the pageIndices in the new spread.\n      if (parity === -1) {\n        // PresentationMode is active, with `SpreadMode.NONE` set.\n        pageIndexSet.add(pageNumber - 1);\n      } else if (pageNumber % 2 !== parity) {\n        // Left-hand side page.\n        pageIndexSet.add(pageNumber - 1);\n        pageIndexSet.add(pageNumber);\n      } else {\n        // Right-hand side page.\n        pageIndexSet.add(pageNumber - 2);\n        pageIndexSet.add(pageNumber - 1);\n      }\n\n      // Finally, append the new pages to the viewer and apply the spreadMode.\n      const spread = document.createElement(\"div\");\n      spread.className = \"spread\";\n\n      if (this.isInPresentationMode) {\n        const dummyPage = document.createElement(\"div\");\n        dummyPage.className = \"dummyPage\";\n        spread.append(dummyPage);\n      }\n\n      for (const i of pageIndexSet) {\n        const pageView = this._pages[i];\n        if (!pageView) {\n          continue;\n        }\n        spread.append(pageView.div);\n\n        state.pages.push(pageView);\n      }\n      viewer.append(spread);\n    }\n\n    state.scrollDown = pageNumber >= state.previousPageNumber;\n    state.previousPageNumber = pageNumber;\n  }\n\n  _scrollUpdate() {\n    if (this.pagesCount === 0) {\n      return;\n    }\n    this.update();\n  }\n\n  #scrollIntoView(pageView, pageSpot = null) {\n    const { div, id } = pageView;\n\n    // Ensure that `this._currentPageNumber` is correct, when `#scrollIntoView`\n    // is called directly (and not from `#resetCurrentPageView`).\n    if (this._currentPageNumber !== id) {\n      this._setCurrentPageNumber(id);\n    }\n    if (this._scrollMode === ScrollMode.PAGE) {\n      this.#ensurePageViewVisible();\n      // Ensure that rendering always occurs, to avoid showing a blank page,\n      // even if the current position doesn't change when the page is scrolled.\n      this.update();\n    }\n\n    if (!pageSpot && !this.isInPresentationMode) {\n      const left = div.offsetLeft + div.clientLeft,\n        right = left + div.clientWidth;\n      const { scrollLeft, clientWidth } = this.container;\n      if (\n        this._scrollMode === ScrollMode.HORIZONTAL ||\n        left < scrollLeft ||\n        right > scrollLeft + clientWidth\n      ) {\n        pageSpot = { left: 0, top: 0 };\n      }\n    }\n    scrollIntoView(div, pageSpot);\n\n    // Ensure that the correct *initial* document position is set, when any\n    // OpenParameters are used, for documents with non-default Scroll/Spread\n    // modes (fixes issue 15695). This is necessary since the scroll-handler\n    // invokes the `update`-method asynchronously, and `this._location` could\n    // thus be wrong when the initial zooming occurs in the default viewer.\n    if (!this._currentScaleValue && this._location) {\n      this._location = null;\n    }\n  }\n\n  /**\n   * Prevent unnecessary re-rendering of all pages when the scale changes\n   * only because of limited numerical precision.\n   */\n  #isSameScale(newScale) {\n    return (\n      newScale === this._currentScale ||\n      Math.abs(newScale - this._currentScale) < 1e-15\n    );\n  }\n\n  #setScaleUpdatePages(\n    newScale,\n    newValue,\n    { noScroll = false, preset = false, drawingDelay = -1 }\n  ) {\n    this._currentScaleValue = newValue.toString();\n\n    if (this.#isSameScale(newScale)) {\n      if (preset) {\n        this.eventBus.dispatch(\"scalechanging\", {\n          source: this,\n          scale: newScale,\n          presetValue: newValue,\n        });\n      }\n      return;\n    }\n\n    this.viewer.style.setProperty(\n      \"--scale-factor\",\n      newScale * PixelsPerInch.PDF_TO_CSS_UNITS\n    );\n\n    const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000;\n    this.refresh(true, {\n      scale: newScale,\n      drawingDelay: postponeDrawing ? drawingDelay : -1,\n    });\n\n    if (postponeDrawing) {\n      this.#scaleTimeoutId = setTimeout(() => {\n        this.#scaleTimeoutId = null;\n        this.refresh();\n      }, drawingDelay);\n    }\n\n    this._currentScale = newScale;\n\n    if (!noScroll) {\n      let page = this._currentPageNumber,\n        dest;\n      if (\n        this._location &&\n        !(this.isInPresentationMode || this.isChangingPresentationMode)\n      ) {\n        page = this._location.pageNumber;\n        dest = [\n          null,\n          { name: \"XYZ\" },\n          this._location.left,\n          this._location.top,\n          null,\n        ];\n      }\n      this.scrollPageIntoView({\n        pageNumber: page,\n        destArray: dest,\n        allowNegativeOffset: true,\n      });\n    }\n\n    this.eventBus.dispatch(\"scalechanging\", {\n      source: this,\n      scale: newScale,\n      presetValue: preset ? newValue : undefined,\n    });\n\n    if (this.defaultRenderingQueue) {\n      this.update();\n    }\n  }\n\n  get #pageWidthScaleFactor() {\n    if (\n      this._spreadMode !== SpreadMode.NONE &&\n      this._scrollMode !== ScrollMode.HORIZONTAL\n    ) {\n      return 2;\n    }\n    return 1;\n  }\n\n  #setScale(value, options) {\n    let scale = parseFloat(value);\n\n    if (scale > 0) {\n      options.preset = false;\n      this.#setScaleUpdatePages(scale, value, options);\n    } else {\n      const currentPage = this._pages[this._currentPageNumber - 1];\n      if (!currentPage) {\n        return;\n      }\n      let hPadding = SCROLLBAR_PADDING,\n        vPadding = VERTICAL_PADDING;\n\n      if (this.isInPresentationMode) {\n        // Pages have a 2px (transparent) border in PresentationMode, see\n        // the `web/pdf_viewer.css` file.\n        hPadding = vPadding = 4; // 2 * 2px\n        if (this._spreadMode !== SpreadMode.NONE) {\n          // Account for two pages being visible in PresentationMode, thus\n          // \"doubling\" the total border width.\n          hPadding *= 2;\n        }\n      } else if (\n        (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n        this.removePageBorders\n      ) {\n        hPadding = vPadding = 0;\n      } else if (this._scrollMode === ScrollMode.HORIZONTAL) {\n        [hPadding, vPadding] = [vPadding, hPadding]; // Swap the padding values.\n      }\n      const pageWidthScale =\n        (((this.container.clientWidth - hPadding) / currentPage.width) *\n          currentPage.scale) /\n        this.#pageWidthScaleFactor;\n      const pageHeightScale =\n        ((this.container.clientHeight - vPadding) / currentPage.height) *\n        currentPage.scale;\n      switch (value) {\n        case \"page-actual\":\n          scale = 1;\n          break;\n        case \"page-width\":\n          scale = pageWidthScale;\n          break;\n        case \"page-height\":\n          scale = pageHeightScale;\n          break;\n        case \"page-fit\":\n          scale = Math.min(pageWidthScale, pageHeightScale);\n          break;\n        case \"auto\":\n          // For pages in landscape mode, fit the page height to the viewer\n          // *unless* the page would thus become too wide to fit horizontally.\n          const horizontalScale = isPortraitOrientation(currentPage)\n            ? pageWidthScale\n            : Math.min(pageHeightScale, pageWidthScale);\n          scale = Math.min(MAX_AUTO_SCALE, horizontalScale);\n          break;\n        default:\n          console.error(`#setScale: \"${value}\" is an unknown zoom value.`);\n          return;\n      }\n      options.preset = true;\n      this.#setScaleUpdatePages(scale, value, options);\n    }\n  }\n\n  /**\n   * Refreshes page view: scrolls to the current page and updates the scale.\n   */\n  #resetCurrentPageView() {\n    const pageView = this._pages[this._currentPageNumber - 1];\n\n    if (this.isInPresentationMode) {\n      // Fixes the case when PDF has different page sizes.\n      this.#setScale(this._currentScaleValue, { noScroll: true });\n    }\n    this.#scrollIntoView(pageView);\n  }\n\n  /**\n   * @param {string} label - The page label.\n   * @returns {number|null} The page number corresponding to the page label,\n   *   or `null` when no page labels exist and/or the input is invalid.\n   */\n  pageLabelToPageNumber(label) {\n    if (!this._pageLabels) {\n      return null;\n    }\n    const i = this._pageLabels.indexOf(label);\n    if (i < 0) {\n      return null;\n    }\n    return i + 1;\n  }\n\n  /**\n   * @typedef {Object} ScrollPageIntoViewParameters\n   * @property {number} pageNumber - The page number.\n   * @property {Array} [destArray] - The original PDF destination array, in the\n   *   format: <page-ref> </XYZ|/FitXXX> <args..>\n   * @property {boolean} [allowNegativeOffset] - Allow negative page offsets.\n   *   The default value is `false`.\n   * @property {boolean} [ignoreDestinationZoom] - Ignore the zoom argument in\n   *   the destination array. The default value is `false`.\n   */\n\n  /**\n   * Scrolls page into view.\n   * @param {ScrollPageIntoViewParameters} params\n   */\n  scrollPageIntoView({\n    pageNumber,\n    destArray = null,\n    allowNegativeOffset = false,\n    ignoreDestinationZoom = false,\n  }) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    const pageView =\n      Number.isInteger(pageNumber) && this._pages[pageNumber - 1];\n    if (!pageView) {\n      console.error(\n        `scrollPageIntoView: \"${pageNumber}\" is not a valid pageNumber parameter.`\n      );\n      return;\n    }\n\n    if (this.isInPresentationMode || !destArray) {\n      this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n      return;\n    }\n    let x = 0,\n      y = 0;\n    let width = 0,\n      height = 0,\n      widthScale,\n      heightScale;\n    const changeOrientation = pageView.rotation % 180 !== 0;\n    const pageWidth =\n      (changeOrientation ? pageView.height : pageView.width) /\n      pageView.scale /\n      PixelsPerInch.PDF_TO_CSS_UNITS;\n    const pageHeight =\n      (changeOrientation ? pageView.width : pageView.height) /\n      pageView.scale /\n      PixelsPerInch.PDF_TO_CSS_UNITS;\n    let scale = 0;\n    switch (destArray[1].name) {\n      case \"XYZ\":\n        x = destArray[2];\n        y = destArray[3];\n        scale = destArray[4];\n        // If x and/or y coordinates are not supplied, default to\n        // _top_ left of the page (not the obvious bottom left,\n        // since aligning the bottom of the intended page with the\n        // top of the window is rarely helpful).\n        x = x !== null ? x : 0;\n        y = y !== null ? y : pageHeight;\n        break;\n      case \"Fit\":\n      case \"FitB\":\n        scale = \"page-fit\";\n        break;\n      case \"FitH\":\n      case \"FitBH\":\n        y = destArray[2];\n        scale = \"page-width\";\n        // According to the PDF spec, section 12.3.2.2, a `null` value in the\n        // parameter should maintain the position relative to the new page.\n        if (y === null && this._location) {\n          x = this._location.left;\n          y = this._location.top;\n        } else if (typeof y !== \"number\" || y < 0) {\n          // The \"top\" value isn't optional, according to the spec, however some\n          // bad PDF generators will pretend that it is (fixes bug 1663390).\n          y = pageHeight;\n        }\n        break;\n      case \"FitV\":\n      case \"FitBV\":\n        x = destArray[2];\n        width = pageWidth;\n        height = pageHeight;\n        scale = \"page-height\";\n        break;\n      case \"FitR\":\n        x = destArray[2];\n        y = destArray[3];\n        width = destArray[4] - x;\n        height = destArray[5] - y;\n        let hPadding = SCROLLBAR_PADDING,\n          vPadding = VERTICAL_PADDING;\n\n        if (\n          (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n          this.removePageBorders\n        ) {\n          hPadding = vPadding = 0;\n        }\n        widthScale =\n          (this.container.clientWidth - hPadding) /\n          width /\n          PixelsPerInch.PDF_TO_CSS_UNITS;\n        heightScale =\n          (this.container.clientHeight - vPadding) /\n          height /\n          PixelsPerInch.PDF_TO_CSS_UNITS;\n        scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));\n        break;\n      default:\n        console.error(\n          `scrollPageIntoView: \"${destArray[1].name}\" is not a valid destination type.`\n        );\n        return;\n    }\n\n    if (!ignoreDestinationZoom) {\n      if (scale && scale !== this._currentScale) {\n        this.currentScaleValue = scale;\n      } else if (this._currentScale === UNKNOWN_SCALE) {\n        this.currentScaleValue = DEFAULT_SCALE_VALUE;\n      }\n    }\n\n    if (scale === \"page-fit\" && !destArray[4]) {\n      this.#scrollIntoView(pageView);\n      return;\n    }\n\n    const boundingRect = [\n      pageView.viewport.convertToViewportPoint(x, y),\n      pageView.viewport.convertToViewportPoint(x + width, y + height),\n    ];\n    let left = Math.min(boundingRect[0][0], boundingRect[1][0]);\n    let top = Math.min(boundingRect[0][1], boundingRect[1][1]);\n\n    if (!allowNegativeOffset) {\n      // Some bad PDF generators will create destinations with e.g. top values\n      // that exceeds the page height. Ensure that offsets are not negative,\n      // to prevent a previous page from becoming visible (fixes bug 874482).\n      left = Math.max(left, 0);\n      top = Math.max(top, 0);\n    }\n    this.#scrollIntoView(pageView, /* pageSpot = */ { left, top });\n  }\n\n  _updateLocation(firstPage) {\n    const currentScale = this._currentScale;\n    const currentScaleValue = this._currentScaleValue;\n    const normalizedScaleValue =\n      parseFloat(currentScaleValue) === currentScale\n        ? Math.round(currentScale * 10000) / 100\n        : currentScaleValue;\n\n    const pageNumber = firstPage.id;\n    const currentPageView = this._pages[pageNumber - 1];\n    const container = this.container;\n    const topLeft = currentPageView.getPagePoint(\n      container.scrollLeft - firstPage.x,\n      container.scrollTop - firstPage.y\n    );\n    const intLeft = Math.round(topLeft[0]);\n    const intTop = Math.round(topLeft[1]);\n\n    let pdfOpenParams = `#page=${pageNumber}`;\n    if (!this.isInPresentationMode) {\n      pdfOpenParams += `&zoom=${normalizedScaleValue},${intLeft},${intTop}`;\n    }\n\n    this._location = {\n      pageNumber,\n      scale: normalizedScaleValue,\n      top: intTop,\n      left: intLeft,\n      rotation: this._pagesRotation,\n      pdfOpenParams,\n    };\n  }\n\n  update() {\n    const visible = this._getVisiblePages();\n    const visiblePages = visible.views,\n      numVisiblePages = visiblePages.length;\n\n    if (numVisiblePages === 0) {\n      return;\n    }\n    const newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1);\n    this.#buffer.resize(newCacheSize, visible.ids);\n\n    this.renderingQueue.renderHighestPriority(visible);\n\n    const isSimpleLayout =\n      this._spreadMode === SpreadMode.NONE &&\n      (this._scrollMode === ScrollMode.PAGE ||\n        this._scrollMode === ScrollMode.VERTICAL);\n    const currentId = this._currentPageNumber;\n    let stillFullyVisible = false;\n\n    for (const page of visiblePages) {\n      if (page.percent < 100) {\n        break;\n      }\n      if (page.id === currentId && isSimpleLayout) {\n        stillFullyVisible = true;\n        break;\n      }\n    }\n    this._setCurrentPageNumber(\n      stillFullyVisible ? currentId : visiblePages[0].id\n    );\n\n    this._updateLocation(visible.first);\n    this.eventBus.dispatch(\"updateviewarea\", {\n      source: this,\n      location: this._location,\n    });\n  }\n\n  containsElement(element) {\n    return this.container.contains(element);\n  }\n\n  focus() {\n    this.container.focus();\n  }\n\n  get _isContainerRtl() {\n    return getComputedStyle(this.container).direction === \"rtl\";\n  }\n\n  get isInPresentationMode() {\n    return this.presentationModeState === PresentationModeState.FULLSCREEN;\n  }\n\n  get isChangingPresentationMode() {\n    return this.presentationModeState === PresentationModeState.CHANGING;\n  }\n\n  get isHorizontalScrollbarEnabled() {\n    return this.isInPresentationMode\n      ? false\n      : this.container.scrollWidth > this.container.clientWidth;\n  }\n\n  get isVerticalScrollbarEnabled() {\n    return this.isInPresentationMode\n      ? false\n      : this.container.scrollHeight > this.container.clientHeight;\n  }\n\n  _getVisiblePages() {\n    const views =\n        this._scrollMode === ScrollMode.PAGE\n          ? this.#scrollModePageState.pages\n          : this._pages,\n      horizontal = this._scrollMode === ScrollMode.HORIZONTAL,\n      rtl = horizontal && this._isContainerRtl;\n\n    return getVisibleElements({\n      scrollEl: this.container,\n      views,\n      sortByVisibility: true,\n      horizontal,\n      rtl,\n    });\n  }\n\n  cleanup() {\n    for (const pageView of this._pages) {\n      if (pageView.renderingState !== RenderingStates.FINISHED) {\n        pageView.reset();\n      }\n    }\n  }\n\n  /**\n   * @private\n   */\n  _cancelRendering() {\n    for (const pageView of this._pages) {\n      pageView.cancelRendering();\n    }\n  }\n\n  /**\n   * @param {PDFPageView} pageView\n   * @returns {Promise<PDFPageProxy | null>}\n   */\n  async #ensurePdfPageLoaded(pageView) {\n    if (pageView.pdfPage) {\n      return pageView.pdfPage;\n    }\n    try {\n      const pdfPage = await this.pdfDocument.getPage(pageView.id);\n      if (!pageView.pdfPage) {\n        pageView.setPdfPage(pdfPage);\n      }\n      if (!this.linkService._cachedPageNumber?.(pdfPage.ref)) {\n        this.linkService.cachePageRef(pageView.id, pdfPage.ref);\n      }\n      return pdfPage;\n    } catch (reason) {\n      console.error(\"Unable to get page for page view\", reason);\n      return null; // Page error -- there is nothing that can be done.\n    }\n  }\n\n  #getScrollAhead(visible) {\n    if (visible.first?.id === 1) {\n      return true;\n    } else if (visible.last?.id === this.pagesCount) {\n      return false;\n    }\n    switch (this._scrollMode) {\n      case ScrollMode.PAGE:\n        return this.#scrollModePageState.scrollDown;\n      case ScrollMode.HORIZONTAL:\n        return this.scroll.right;\n    }\n    return this.scroll.down;\n  }\n\n  forceRendering(currentlyVisiblePages) {\n    const visiblePages = currentlyVisiblePages || this._getVisiblePages();\n    const scrollAhead = this.#getScrollAhead(visiblePages);\n    const preRenderExtra =\n      this._spreadMode !== SpreadMode.NONE &&\n      this._scrollMode !== ScrollMode.HORIZONTAL;\n\n    const pageView = this.renderingQueue.getHighestPriority(\n      visiblePages,\n      this._pages,\n      scrollAhead,\n      preRenderExtra\n    );\n\n    if (pageView) {\n      this.#ensurePdfPageLoaded(pageView).then(() => {\n        this.renderingQueue.renderView(pageView);\n      });\n      return true;\n    }\n    return false;\n  }\n\n  /**\n   * @type {boolean} Whether all pages of the PDF document have identical\n   *   widths and heights.\n   */\n  get hasEqualPageSizes() {\n    const firstPageView = this._pages[0];\n    for (let i = 1, ii = this._pages.length; i < ii; ++i) {\n      const pageView = this._pages[i];\n      if (\n        pageView.width !== firstPageView.width ||\n        pageView.height !== firstPageView.height\n      ) {\n        return false;\n      }\n    }\n    return true;\n  }\n\n  /**\n   * Returns sizes of the pages.\n   * @returns {Array} Array of objects with width/height/rotation fields.\n   */\n  getPagesOverview() {\n    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();\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   */\n\n  /**\n   * Increase the current zoom level one, or more, times.\n   * @param {ChangeScaleOptions} [options]\n   */\n  increaseScale({ drawingDelay, scaleFactor, steps } = {}) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    let newScale = this._currentScale;\n    if (scaleFactor > 1) {\n      newScale = Math.round(newScale * scaleFactor * 100) / 100;\n    } else {\n      steps ??= 1;\n      do {\n        newScale =\n          Math.ceil((newScale * DEFAULT_SCALE_DELTA).toFixed(2) * 10) / 10;\n      } while (--steps > 0 && newScale < MAX_SCALE);\n    }\n    this.#setScale(Math.min(MAX_SCALE, newScale), {\n      noScroll: false,\n      drawingDelay,\n    });\n  }\n\n  /**\n   * Decrease the current zoom level one, or more, times.\n   * @param {ChangeScaleOptions} [options]\n   */\n  decreaseScale({ drawingDelay, scaleFactor, steps } = {}) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    let newScale = this._currentScale;\n    if (scaleFactor > 0 && scaleFactor < 1) {\n      newScale = Math.round(newScale * scaleFactor * 100) / 100;\n    } else {\n      steps ??= 1;\n      do {\n        newScale =\n          Math.floor((newScale / DEFAULT_SCALE_DELTA).toFixed(2) * 10) / 10;\n      } while (--steps > 0 && newScale > MIN_SCALE);\n    }\n    this.#setScale(Math.max(MIN_SCALE, newScale), {\n      noScroll: false,\n      drawingDelay,\n    });\n  }\n\n  #updateContainerHeightCss(height = this.container.clientHeight) {\n    if (height !== this.#previousContainerHeight) {\n      this.#previousContainerHeight = height;\n      docStyle.setProperty(\"--viewer-container-height\", `${height}px`);\n    }\n  }\n\n  #resizeObserverCallback(entries) {\n    for (const entry of entries) {\n      if (entry.target === this.container) {\n        this.#updateContainerHeightCss(\n          Math.floor(entry.borderBoxSize[0].blockSize)\n        );\n        this.#containerTopLeft = null;\n        break;\n      }\n    }\n  }\n\n  get containerTopLeft() {\n    return (this.#containerTopLeft ||= [\n      this.container.offsetTop,\n      this.container.offsetLeft,\n    ]);\n  }\n\n  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    this.#annotationEditorMode = mode;\n    this.eventBus.dispatch(\"annotationeditormodechanged\", {\n      source: this,\n      mode,\n    });\n\n    this.#annotationEditorUIManager.updateMode(mode, editId, isFromKeyboard);\n  }\n\n  // eslint-disable-next-line accessor-pairs\n  set annotationEditorParams({ type, value }) {\n    if (!this.#annotationEditorUIManager) {\n      throw new Error(`The AnnotationEditor is not enabled.`);\n    }\n    this.#annotationEditorUIManager.updateParams(type, value);\n  }\n\n  refresh(noUpdate = false, updateArgs = Object.create(null)) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    for (const pageView of this._pages) {\n      pageView.update(updateArgs);\n    }\n    if (this.#scaleTimeoutId !== null) {\n      clearTimeout(this.#scaleTimeoutId);\n      this.#scaleTimeoutId = null;\n    }\n    if (!noUpdate) {\n      this.update();\n    }\n  }\n}\n\nexport { PagesCountLimit, PDFPageViewBuffer, PDFViewer };\n","/* Copyright 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Ensure that the viewer waits for the library to complete loading,\n// to avoid breaking e.g. the standalone viewer components (see issue 17228).\nif (\n  (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n  !globalThis.pdfjsLib\n) {\n  await globalThis.pdfjsLibPromise;\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  Outliner,\n  PasswordResponses,\n  PDFDataRangeTransport,\n  PDFDateString,\n  PDFWorker,\n  PermissionFlag,\n  PixelsPerInch,\n  PromiseCapability,\n  RenderingCancelledException,\n  renderTextLayer,\n  setLayerDimensions,\n  shadow,\n  UnexpectedResponseException,\n  updateTextLayer,\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  Outliner,\n  PasswordResponses,\n  PDFDataRangeTransport,\n  PDFDateString,\n  PDFWorker,\n  PermissionFlag,\n  PixelsPerInch,\n  PromiseCapability,\n  RenderingCancelledException,\n  renderTextLayer,\n  setLayerDimensions,\n  shadow,\n  UnexpectedResponseException,\n  updateTextLayer,\n  Util,\n  VerbosityLevel,\n  version,\n  XfaLayer,\n};\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  /**\n   * @param {TextHighlighterOptions} options\n   */\n  constructor({ findController, eventBus, pageIndex }) {\n    this.findController = findController;\n    this.matches = [];\n    this.eventBus = eventBus;\n    this.pageIdx = pageIndex;\n    this._onUpdateTextLayerMatches = null;\n    this.textDivs = null;\n    this.textContentItemsStr = null;\n    this.enabled = false;\n  }\n\n  /**\n   * Store two arrays that will map DOM nodes to text they should contain.\n   * The arrays should be of equal length and the array element at each index\n   * should correspond to the other. e.g.\n   * `items[0] = \"<span>Item 0</span>\" and texts[0] = \"Item 0\";\n   *\n   * @param {Array<Node>} divs\n   * @param {Array<string>} texts\n   */\n  setTextMapping(divs, texts) {\n    this.textDivs = divs;\n    this.textContentItemsStr = texts;\n  }\n\n  /**\n   * Start listening for events to update the highlighter and check if there are\n   * any current matches that need be highlighted.\n   */\n  enable() {\n    if (!this.textDivs || !this.textContentItemsStr) {\n      throw new Error(\"Text divs and strings have not been set.\");\n    }\n    if (this.enabled) {\n      throw new Error(\"TextHighlighter is already enabled.\");\n    }\n    this.enabled = true;\n    if (!this._onUpdateTextLayerMatches) {\n      this._onUpdateTextLayerMatches = evt => {\n        if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) {\n          this._updateMatches();\n        }\n      };\n      this.eventBus._on(\n        \"updatetextlayermatches\",\n        this._onUpdateTextLayerMatches\n      );\n    }\n    this._updateMatches();\n  }\n\n  disable() {\n    if (!this.enabled) {\n      return;\n    }\n    this.enabled = false;\n    if (this._onUpdateTextLayerMatches) {\n      this.eventBus._off(\n        \"updatetextlayermatches\",\n        this._onUpdateTextLayerMatches\n      );\n      this._onUpdateTextLayerMatches = null;\n    }\n    this._updateMatches(/* reset = */ true);\n  }\n\n  _convertMatches(matches, matchesLength) {\n    // Early exit if there is nothing to convert.\n    if (!matches) {\n      return [];\n    }\n    const { textContentItemsStr } = this;\n\n    let i = 0,\n      iIndex = 0;\n    const end = textContentItemsStr.length - 1;\n    const result = [];\n\n    for (let m = 0, mm = matches.length; m < mm; m++) {\n      // Calculate the start position.\n      let matchIdx = matches[m];\n\n      // Loop over the divIdxs.\n      while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) {\n        iIndex += textContentItemsStr[i].length;\n        i++;\n      }\n\n      if (i === textContentItemsStr.length) {\n        console.error(\"Could not find a matching mapping\");\n      }\n\n      const match = {\n        begin: {\n          divIdx: i,\n          offset: matchIdx - iIndex,\n        },\n      };\n\n      // Calculate the end position.\n      matchIdx += matchesLength[m];\n\n      // Somewhat the same array as above, but use > instead of >= to get\n      // the end position right.\n      while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) {\n        iIndex += textContentItemsStr[i].length;\n        i++;\n      }\n\n      match.end = {\n        divIdx: i,\n        offset: matchIdx - iIndex,\n      };\n      result.push(match);\n    }\n    return result;\n  }\n\n  _renderMatches(matches) {\n    // Early exit if there is nothing to render.\n    if (matches.length === 0) {\n      return;\n    }\n    const { findController, pageIdx } = this;\n    const { textContentItemsStr, textDivs } = this;\n\n    const isSelectedPage = pageIdx === findController.selected.pageIdx;\n    const selectedMatchIdx = findController.selected.matchIdx;\n    const highlightAll = findController.state.highlightAll;\n    let prevEnd = null;\n    const infinity = {\n      divIdx: -1,\n      offset: undefined,\n    };\n\n    function beginText(begin, className) {\n      const divIdx = begin.divIdx;\n      textDivs[divIdx].textContent = \"\";\n      return appendTextToDiv(divIdx, 0, begin.offset, className);\n    }\n\n    function appendTextToDiv(divIdx, fromOffset, toOffset, className) {\n      let div = textDivs[divIdx];\n      if (div.nodeType === Node.TEXT_NODE) {\n        const span = document.createElement(\"span\");\n        div.before(span);\n        span.append(div);\n        textDivs[divIdx] = span;\n        div = span;\n      }\n      const content = textContentItemsStr[divIdx].substring(\n        fromOffset,\n        toOffset\n      );\n      const node = document.createTextNode(content);\n      if (className) {\n        const span = document.createElement(\"span\");\n        span.className = `${className} appended`;\n        span.append(node);\n        div.append(span);\n        return className.includes(\"selected\") ? span.offsetLeft : 0;\n      }\n      div.append(node);\n      return 0;\n    }\n\n    let i0 = selectedMatchIdx,\n      i1 = i0 + 1;\n    if (highlightAll) {\n      i0 = 0;\n      i1 = matches.length;\n    } else if (!isSelectedPage) {\n      // Not highlighting all and this isn't the selected page, so do nothing.\n      return;\n    }\n\n    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// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"../src/display/api\").TextContent} TextContent */\n/** @typedef {import(\"./text_highlighter\").TextHighlighter} TextHighlighter */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n\nimport { normalizeUnicode, renderTextLayer, updateTextLayer } from \"pdfjs-lib\";\nimport { removeNullCharacters } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} TextLayerBuilderOptions\n * @property {TextHighlighter} highlighter - Optional object that will handle\n *   highlighting text from the find controller.\n * @property {TextAccessibilityManager} [accessibilityManager]\n * @property {boolean} [isOffscreenCanvasSupported] - Allows to use an\n *   OffscreenCanvas if needed.\n */\n\n/**\n * The text layer builder provides text selection functionality for the PDF.\n * It does this by creating overlay divs over the PDF's text. These divs\n * contain text that matches the PDF text they are overlaying.\n */\nclass TextLayerBuilder {\n  #enablePermissions = false;\n\n  #rotation = 0;\n\n  #scale = 0;\n\n  #textContentSource = null;\n\n  constructor({\n    highlighter = null,\n    accessibilityManager = null,\n    isOffscreenCanvasSupported = true,\n    enablePermissions = false,\n  }) {\n    this.textContentItemsStr = [];\n    this.renderingDone = false;\n    this.textDivs = [];\n    this.textDivProperties = new WeakMap();\n    this.textLayerRenderTask = null;\n    this.highlighter = highlighter;\n    this.accessibilityManager = accessibilityManager;\n    this.isOffscreenCanvasSupported = isOffscreenCanvasSupported;\n    this.#enablePermissions = enablePermissions === true;\n\n    /**\n     * Callback used to attach the textLayer to the DOM.\n     * @type {function}\n     */\n    this.onAppend = null;\n\n    this.div = document.createElement(\"div\");\n    this.div.className = \"textLayer\";\n  }\n\n  #finishRendering() {\n    this.renderingDone = true;\n\n    const endOfContent = document.createElement(\"div\");\n    endOfContent.className = \"endOfContent\";\n    this.div.append(endOfContent);\n\n    this.#bindMouse();\n  }\n\n  get numTextDivs() {\n    return this.textDivs.length;\n  }\n\n  /**\n   * Renders the text layer.\n   * @param {PageViewport} viewport\n   */\n  async render(viewport) {\n    if (!this.#textContentSource) {\n      throw new Error('No \"textContentSource\" parameter specified.');\n    }\n\n    const scale = viewport.scale * (globalThis.devicePixelRatio || 1);\n    const { rotation } = viewport;\n    if (this.renderingDone) {\n      const mustRotate = rotation !== this.#rotation;\n      const mustRescale = scale !== this.#scale;\n      if (mustRotate || mustRescale) {\n        this.hide();\n        updateTextLayer({\n          container: this.div,\n          viewport,\n          textDivs: this.textDivs,\n          textDivProperties: this.textDivProperties,\n          isOffscreenCanvasSupported: this.isOffscreenCanvasSupported,\n          mustRescale,\n          mustRotate,\n        });\n        this.#scale = scale;\n        this.#rotation = rotation;\n      }\n      this.show();\n      return;\n    }\n\n    this.cancel();\n    this.highlighter?.setTextMapping(this.textDivs, this.textContentItemsStr);\n    this.accessibilityManager?.setTextMapping(this.textDivs);\n\n    this.textLayerRenderTask = renderTextLayer({\n      textContentSource: this.#textContentSource,\n      container: this.div,\n      viewport,\n      textDivs: this.textDivs,\n      textDivProperties: this.textDivProperties,\n      textContentItemsStr: this.textContentItemsStr,\n      isOffscreenCanvasSupported: this.isOffscreenCanvasSupported,\n    });\n\n    await this.textLayerRenderTask.promise;\n    this.#finishRendering();\n    this.#scale = scale;\n    this.#rotation = rotation;\n    // 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    if (this.textLayerRenderTask) {\n      this.textLayerRenderTask.cancel();\n      this.textLayerRenderTask = null;\n    }\n    this.highlighter?.disable();\n    this.accessibilityManager?.disable();\n    this.textContentItemsStr.length = 0;\n    this.textDivs.length = 0;\n    this.textDivProperties = new WeakMap();\n  }\n\n  /**\n   * @param {ReadableStream | TextContent} source\n   */\n  setTextContentSource(source) {\n    this.cancel();\n    this.#textContentSource = source;\n  }\n\n  /**\n   * Improves text selection by adding an additional div where the mouse was\n   * clicked. This reduces flickering of the content if the mouse is slowly\n   * dragged up or down.\n   */\n  #bindMouse() {\n    const { div } = this;\n\n    div.addEventListener(\"mousedown\", evt => {\n      const end = div.querySelector(\".endOfContent\");\n      if (!end) {\n        return;\n      }\n      if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n        // On non-Firefox browsers, the selection will feel better if the height\n        // of the `endOfContent` div is adjusted to start at mouse click\n        // location. This avoids flickering when the selection moves up.\n        // However it does not work when selection is started on empty space.\n        let adjustTop = evt.target !== div;\n        if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n          adjustTop &&=\n            getComputedStyle(end).getPropertyValue(\"-moz-user-select\") !==\n            \"none\";\n        }\n        if (adjustTop) {\n          const divBounds = div.getBoundingClientRect();\n          const r = Math.max(0, (evt.pageY - divBounds.top) / divBounds.height);\n          end.style.top = (r * 100).toFixed(2) + \"%\";\n        }\n      }\n      end.classList.add(\"active\");\n    });\n\n    div.addEventListener(\"mouseup\", () => {\n      const end = div.querySelector(\".endOfContent\");\n      if (!end) {\n        return;\n      }\n      if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n        end.style.top = \"\";\n      }\n      end.classList.remove(\"active\");\n    });\n\n    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}\n\nexport { TextLayerBuilder };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\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) {\n  const debounceScroll = function (evt) {\n    if (rAF) {\n      return;\n    }\n    // schedule an invocation of scroll for next animation frame.\n    rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {\n      rAF = null;\n\n      const currentX = viewAreaElement.scrollLeft;\n      const lastX = state.lastX;\n      if (currentX !== lastX) {\n        state.right = currentX > lastX;\n      }\n      state.lastX = currentX;\n      const currentY = viewAreaElement.scrollTop;\n      const lastY = state.lastY;\n      if (currentY !== lastY) {\n        state.down = currentY > lastY;\n      }\n      state.lastY = currentY;\n      callback(state);\n    });\n  };\n\n  const state = {\n    right: true,\n    down: true,\n    lastX: viewAreaElement.scrollLeft,\n    lastY: viewAreaElement.scrollTop,\n    _eventHandler: debounceScroll,\n  };\n\n  let rAF = null;\n  viewAreaElement.addEventListener(\"scroll\", debounceScroll, true);\n  return state;\n}\n\n/**\n * Helper function to parse query string (e.g. ?param1=value&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 InvisibleCharactersRegExp = /[\\x00-\\x1F]/g;\n\n/**\n * @param {string} str\n * @param {boolean} [replaceInvisible]\n */\nfunction removeNullCharacters(str, replaceInvisible = false) {\n  if (!InvisibleCharactersRegExp.test(str)) {\n    return str;\n  }\n  if (replaceInvisible) {\n    return str.replaceAll(InvisibleCharactersRegExp, m => {\n      return m === \"\\x00\" ? \"\" : \" \";\n    });\n  }\n  return str.replaceAll(\"\\x00\", \"\");\n}\n\n/**\n * Use binary search to find the index of the first item in a given array which\n * passes a given condition. The items are expected to be sorted in the sense\n * that if the condition is true for one item in the array, then it is also true\n * for all following items.\n *\n * @returns {number} Index of the first array element to pass the test,\n *                   or |items.length| if no such element exists.\n */\nfunction binarySearchFirstItem(items, condition, start = 0) {\n  let minIndex = start;\n  let maxIndex = items.length - 1;\n\n  if (maxIndex < 0 || !condition(items[maxIndex])) {\n    return items.length;\n  }\n  if (condition(items[minIndex])) {\n    return minIndex;\n  }\n\n  while (minIndex < maxIndex) {\n    const currentIndex = (minIndex + maxIndex) >> 1;\n    const currentItem = items[currentIndex];\n    if (condition(currentItem)) {\n      maxIndex = currentIndex;\n    } else {\n      minIndex = currentIndex + 1;\n    }\n  }\n  return minIndex; /* === maxIndex */\n}\n\n/**\n *  Approximates float number as a fraction using Farey sequence (max order\n *  of 8).\n *  @param {number} x - Positive float number.\n *  @returns {Array} Estimated fraction: the first array item is a numerator,\n *                   the second one is a denominator.\n */\nfunction approximateFraction(x) {\n  // Fast paths for int numbers or their inversions.\n  if (Math.floor(x) === x) {\n    return [x, 1];\n  }\n  const xinv = 1 / x;\n  const limit = 8;\n  if (xinv > limit) {\n    return [1, limit];\n  } else if (Math.floor(xinv) === xinv) {\n    return [1, xinv];\n  }\n\n  const x_ = x > 1 ? xinv : x;\n  // a/b and c/d are neighbours in Farey sequence.\n  let a = 0,\n    b = 1,\n    c = 1,\n    d = 1;\n  // Limiting search to order 8.\n  while (true) {\n    // Generating next term in sequence (order of q).\n    const p = a + c,\n      q = b + d;\n    if (q > limit) {\n      break;\n    }\n    if (x_ <= p / q) {\n      c = p;\n      d = q;\n    } else {\n      a = p;\n      b = q;\n    }\n  }\n  let result;\n  // Select closest of the neighbours to x.\n  if (x_ - a / b < c / d - x_) {\n    result = x_ === x ? [a, b] : [b, a];\n  } else {\n    result = x_ === x ? [c, d] : [d, c];\n  }\n  return result;\n}\n\nfunction roundToDivide(x, div) {\n  const r = x % div;\n  return r === 0 ? x : Math.round(x - r + div);\n}\n\n/**\n * @typedef {Object} GetPageSizeInchesParameters\n * @property {number[]} view\n * @property {number} userUnit\n * @property {number} rotate\n */\n\n/**\n * @typedef {Object} PageSize\n * @property {number} width - In inches.\n * @property {number} height - In inches.\n */\n\n/**\n * Gets the size of the specified page, converted from PDF units to inches.\n * @param {GetPageSizeInchesParameters} params\n * @returns {PageSize}\n */\nfunction getPageSizeInches({ view, userUnit, rotate }) {\n  const [x1, y1, x2, y2] = view;\n  // We need to take the page rotation into account as well.\n  const changeOrientation = rotate % 180 !== 0;\n\n  const width = ((x2 - x1) / 72) * userUnit;\n  const height = ((y2 - y1) / 72) * userUnit;\n\n  return {\n    width: changeOrientation ? height : width,\n    height: changeOrientation ? width : height,\n  };\n}\n\n/**\n * Helper function for getVisibleElements.\n *\n * @param {number} index - initial guess at the first visible element\n * @param {Array} views - array of pages, into which `index` is an index\n * @param {number} top - the top of the scroll pane\n * @returns {number} less than or equal to `index` that is definitely at or\n *   before the first visible element in `views`, but not by too much. (Usually,\n *   this will be the first element in the first partially visible row in\n *   `views`, although sometimes it goes back one row further.)\n */\nfunction backtrackBeforeAllVisibleElements(index, views, top) {\n  // binarySearchFirstItem's assumption is that the input is ordered, with only\n  // one index where the conditions flips from false to true: [false ...,\n  // true...]. With vertical scrolling and spreads, it is possible to have\n  // [false ..., true, false, true ...]. With wrapped scrolling we can have a\n  // similar sequence, with many more mixed true and false in the middle.\n  //\n  // So there is no guarantee that the binary search yields the index of the\n  // first visible element. It could have been any of the other visible elements\n  // that were preceded by a hidden element.\n\n  // Of course, if either this element or the previous (hidden) element is also\n  // the first element, there's nothing to worry about.\n  if (index < 2) {\n    return index;\n  }\n\n  // That aside, the possible cases are represented below.\n  //\n  //     ****  = fully hidden\n  //     A*B*  = mix of partially visible and/or hidden pages\n  //     CDEF  = fully visible\n  //\n  // (1) Binary search could have returned A, in which case we can stop.\n  // (2) Binary search could also have returned B, in which case we need to\n  // check the whole row.\n  // (3) Binary search could also have returned C, in which case we need to\n  // check the whole previous row.\n  //\n  // There's one other possibility:\n  //\n  //     ****  = fully hidden\n  //     ABCD  = mix of fully and/or partially visible pages\n  //\n  // (4) Binary search could only have returned A.\n\n  // Initially assume that we need to find the beginning of the current row\n  // (case 1, 2, or 4), which means finding a page that is above the current\n  // page's top. If the found page is partially visible, we're definitely not in\n  // case 3, and this assumption is correct.\n  let elt = views[index].div;\n  let pageTop = elt.offsetTop + elt.clientTop;\n\n  if (pageTop >= top) {\n    // The found page is fully visible, so we're actually either in case 3 or 4,\n    // and unfortunately we can't tell the difference between them without\n    // scanning the entire previous row, so we just conservatively assume that\n    // we do need to backtrack to that row. In both cases, the previous page is\n    // in the previous row, so use its top instead.\n    elt = views[index - 1].div;\n    pageTop = elt.offsetTop + elt.clientTop;\n  }\n\n  // Now we backtrack to the first page that still has its bottom below\n  // `pageTop`, which is the top of a page in the first visible row (unless\n  // we're in case 4, in which case it's the row before that).\n  // `index` is found by binary search, so the page at `index - 1` is\n  // invisible and we can start looking for potentially visible pages from\n  // `index - 2`. (However, if this loop terminates on its first iteration,\n  // which is the case when pages are stacked vertically, `index` should remain\n  // unchanged, so we use a distinct loop variable.)\n  for (let i = index - 2; i >= 0; --i) {\n    elt = views[i].div;\n    if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) {\n      // We have reached the previous row, so stop now.\n      // This loop is expected to terminate relatively quickly because the\n      // number of pages per row is expected to be small.\n      break;\n    }\n    index = i;\n  }\n  return index;\n}\n\n/**\n * @typedef {Object} GetVisibleElementsParameters\n * @property {HTMLElement} scrollEl - A container that can possibly scroll.\n * @property {Array} views - Objects with a `div` property that contains an\n *   HTMLElement, which should all be descendants of `scrollEl` satisfying the\n *   relevant layout assumptions.\n * @property {boolean} sortByVisibility - If `true`, the returned elements are\n *   sorted in descending order of the percent of their padding box that is\n *   visible. The default value is `false`.\n * @property {boolean} horizontal - If `true`, the elements are assumed to be\n *   laid out horizontally instead of vertically. The default value is `false`.\n * @property {boolean} rtl - If `true`, the `scrollEl` container is assumed to\n *   be in right-to-left mode. The default value is `false`.\n */\n\n/**\n * Generic helper to find out what elements are visible within a scroll pane.\n *\n * Well, pretty generic. There are some assumptions placed on the elements\n * referenced by `views`:\n *   - If `horizontal`, no left of any earlier element is to the right of the\n *     left of any later element.\n *   - Otherwise, `views` can be split into contiguous rows where, within a row,\n *     no top of any element is below the bottom of any other element, and\n *     between rows, no bottom of any element in an earlier row is below the\n *     top of any element in a later row.\n *\n * (Here, top, left, etc. all refer to the padding edge of the element in\n * question. For pages, that ends up being equivalent to the bounding box of the\n * rendering canvas. Earlier and later refer to index in `views`, not page\n * layout.)\n *\n * @param {GetVisibleElementsParameters} 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 (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  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  roundToDivide,\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 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","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","var webpackQueues = typeof Symbol === \"function\" ? Symbol(\"webpack queues\") : \"__webpack_queues__\";\nvar webpackExports = typeof Symbol === \"function\" ? Symbol(\"webpack exports\") : \"__webpack_exports__\";\nvar webpackError = typeof Symbol === \"function\" ? Symbol(\"webpack error\") : \"__webpack_error__\";\nvar resolveQueue = (queue) => {\n\tif(queue && queue.d < 1) {\n\t\tqueue.d = 1;\n\t\tqueue.forEach((fn) => (fn.r--));\n\t\tqueue.forEach((fn) => (fn.r-- ? fn.r++ : fn()));\n\t}\n}\nvar wrapDeps = (deps) => (deps.map((dep) => {\n\tif(dep !== null && typeof dep === \"object\") {\n\t\tif(dep[webpackQueues]) return dep;\n\t\tif(dep.then) {\n\t\t\tvar queue = [];\n\t\t\tqueue.d = 0;\n\t\t\tdep.then((r) => {\n\t\t\t\tobj[webpackExports] = r;\n\t\t\t\tresolveQueue(queue);\n\t\t\t}, (e) => {\n\t\t\t\tobj[webpackError] = e;\n\t\t\t\tresolveQueue(queue);\n\t\t\t});\n\t\t\tvar obj = {};\n\t\t\tobj[webpackQueues] = (fn) => (fn(queue));\n\t\t\treturn obj;\n\t\t}\n\t}\n\tvar ret = {};\n\tret[webpackQueues] = x => {};\n\tret[webpackExports] = dep;\n\treturn ret;\n}));\n__webpack_require__.a = (module, body, hasAwait) => {\n\tvar queue;\n\thasAwait && ((queue = []).d = -1);\n\tvar depQueues = new Set();\n\tvar exports = module.exports;\n\tvar currentDeps;\n\tvar outerResolve;\n\tvar reject;\n\tvar promise = new Promise((resolve, rej) => {\n\t\treject = rej;\n\t\touterResolve = resolve;\n\t});\n\tpromise[webpackExports] = exports;\n\tpromise[webpackQueues] = (fn) => (queue && fn(queue), depQueues.forEach(fn), promise[\"catch\"](x => {}));\n\tmodule.exports = promise;\n\tbody((deps) => {\n\t\tcurrentDeps = wrapDeps(deps);\n\t\tvar fn;\n\t\tvar getResult = () => (currentDeps.map((d) => {\n\t\t\tif(d[webpackError]) throw d[webpackError];\n\t\t\treturn d[webpackExports];\n\t\t}))\n\t\tvar promise = new Promise((resolve) => {\n\t\t\tfn = () => (resolve(getResult));\n\t\t\tfn.r = 0;\n\t\t\tvar fnQueue = (q) => (q !== queue && !depQueues.has(q) && (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn))));\n\t\t\tcurrentDeps.map((dep) => (dep[webpackQueues](fnQueue)));\n\t\t});\n\t\treturn fn.r ? promise : getResult();\n\t}, (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue)));\n\tqueue && queue.d < 0 && (queue.d = 0);\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))","","// startup\n// Load entry module and return exports\n// This entry module used 'module' so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(103);\n",""],"names":["FluentType","constructor","value","valueOf","FluentNone","toString","scope","FluentNumber","opts","nf","memoizeIntlObject","Intl","NumberFormat","format","err","reportError","FluentDateTime","dtf","DateTimeFormat","Date","toISOString","MAX_PLACEABLES","FSI","PDI","match","selector","key","category","PluralRules","select","getDefault","variants","star","resolvePattern","RangeError","getArguments","args","positional","named","Object","create","arg","type","name","resolveExpression","push","expr","minimumFractionDigits","precision","resolveVariableReference","resolveMessageReference","resolveTermReference","resolveFunctionReference","resolveSelectExpression","params","prototype","hasOwnProperty","call","ReferenceError","getTime","TypeError","attr","message","bundle","_messages","get","attribute","attributes","id","term","_terms","resolved","func","_functions","sel","variant","resolveComplexPattern","ptn","dirty","has","add","result","useIsolating","_useIsolating","length","elem","_transform","placeables","delete","join","Scope","errors","WeakSet","error","Error","ctor","cache","_intls","set","JSON","stringify","locales","values","allowed","unwrapped","opt","entries","includes","NUMBER_ALLOWED","NUMBER","DATETIME_ALLOWED","DATETIME","Map","getMemoizerForLocale","stringLocale","Array","isArray","memoizer","undefined","FluentBundle","functions","transform","v","hasMessage","getMessage","addResource","res","allowOverrides","i","body","entry","startsWith","formatPattern","pattern","RE_MESSAGE_START","RE_ATTRIBUTE_START","RE_VARIANT_START","RE_NUMBER_LITERAL","RE_IDENTIFIER","RE_REFERENCE","RE_FUNCTION_NAME","RE_TEXT_RUN","RE_STRING_RUN","RE_STRING_ESCAPE","RE_UNICODE_ESCAPE","RE_LEADING_NEWLINES","RE_TRAILING_SPACES","RE_BLANK_LINES","RE_INDENT","TOKEN_BRACE_OPEN","TOKEN_BRACE_CLOSE","TOKEN_BRACKET_OPEN","TOKEN_BRACKET_CLOSE","TOKEN_PAREN_OPEN","TOKEN_ARROW","TOKEN_COLON","TOKEN_COMMA","TOKEN_BLANK","FluentResource","source","lastIndex","cursor","next","exec","parseMessage","SyntaxError","test","re","consumeChar","char","errorClass","consumeToken","match1","parsePattern","parseAttributes","keys","attrs","first","parsePatternElements","Infinity","indent","parseIndent","trim","elements","commonIndent","parsePlaceable","Math","min","lastElement","baked","element","Indent","slice","parseInlineExpression","parseVariants","sigil","parseArguments","parseLiteral","parseArgument","count","parseVariantKey","parseNumberLiteral","parseStringLiteral","fraction","parseFloat","parseEscapeSequence","codepoint4","codepoint6","codepoint","parseInt","String","fromCodePoint","start","makeIndent","text","replace","blank","reOverlay","TEXT_LEVEL_ELEMENTS","LOCALIZABLE_ATTRIBUTES","global","a","area","input","menuitem","menu","optgroup","option","track","img","textarea","th","description","label","textbox","translateElement","translation","localName","namespaceURI","textContent","templateElement","ownerDocument","createElementNS","innerHTML","overlayChildNodes","content","overlayAttributes","fromFragment","toElement","childNode","childNodes","nodeType","TEXT_NODE","hasAttribute","sanitized","getNodeForNamedElement","replaceChild","isElementAllowed","createSanitizedElement","console","warn","createTextNodeFromTextContent","appendChild","fromElement","explicitlyAllowed","getAttribute","split","map","from","isAttrNameLocalizable","removeAttribute","setAttribute","sourceElement","translatedChild","childName","sourceChild","querySelector","removeChild","clone","cloneNode","shallowPopulateUsing","createElement","createTextNode","attrName","toLowerCase","elemName","CachedIterable","iterable","CachedSyncIterable","Symbol","iterator","cached","cur","touchNext","idx","last","done","CachedAsyncIterable","asyncIterator","default","Localization","resourceIds","generateBundles","onChange","addResourceIds","eager","removeResourceIds","filter","r","formatWithFallback","method","translations","hasAtLeastOneBundle","bundles","missingIds","keysFromBundle","size","locale","ids","formatMessages","messageFromBundle","formatValues","valueFromBundle","formatValue","val","handleEvent","formatted","attrNames","messageErrors","Set","forEach","L10NID_ATTR_NAME","L10NARGS_ATTR_NAME","L10N_ELEMENT_QUERY","DOMLocalization","roots","pendingrAF","pendingElements","windowElement","mutationObserver","observerConfig","characterData","childList","subtree","attributeFilter","translateRoots","setAttributes","getAttributes","parse","connectRoot","newRoot","root","contains","defaultView","MutationObserver","mutations","translateMutations","observe","disconnectRoot","pauseObserving","clear","resumeObserving","Promise","all","translateFragment","takeRecords","disconnect","mutation","target","addedNode","addedNodes","ELEMENT_NODE","childElementCount","getTranslatables","requestAnimationFrame","translateElements","frag","getKeysForElement","applyTranslations","nodes","querySelectorAll","AnnotationEditorLayer","NullL10n","AnnotationEditorLayerBuilder","annotationLayer","drawLayer","textLayer","uiManager","options","pageDiv","pdfPage","accessibilityManager","l10n","annotationEditorLayer","div","_cancelled","render","viewport","intent","clonedViewport","dontFlip","update","show","document","className","tabIndex","hidden","dir","direction","append","pageIndex","pageNumber","parameters","annotations","cancel","destroy","remove","hide","isEmpty","AnnotationLayer","PresentationModeState","AnnotationLayerBuilder","onPresentationModeChanged","linkService","downloadManager","annotationStorage","imageResourcesPath","renderForms","enableScripting","hasJSActionsPromise","fieldObjectsPromise","annotationCanvasMap","_hasJSActionsPromise","resolve","_fieldObjectsPromise","_annotationCanvasMap","_accessibilityManager","_eventBus","eventBus","hasJSActions","fieldObjects","getAnnotations","page","isInPresentationMode","updatePresentationModeState","FULLSCREEN","evt","state","_on","_off","disableFormElements","NORMAL","section","inert","compatibilityParams","userAgent","navigator","platform","maxTouchPoints","isAndroid","isIOS","checkCanvasSizeLimitation","maxCanvasPixels","OptionKind","BROWSER","VIEWER","API","WORKER","PREFERENCE","defaultOptions","canvasMaxAreaInBytes","kind","isInAutomation","supportsDocumentFonts","supportsIntegratedFind","supportsMouseWheelZoomCtrlKey","supportsMouseWheelZoomMetaKey","supportsPinchToZoom","annotationEditorMode","annotationMode","cursorToolOnLoad","defaultZoomDelay","defaultZoomValue","disableHistory","disablePageLabels","enableHighlightEditor","enablePermissions","enablePrintAutoRotate","externalLinkRel","externalLinkTarget","highlightEditorColors","historyUpdateUrl","ignoreDestinationZoom","forcePageColors","pageColorsBackground","pageColorsForeground","pdfBugEnabled","printResolution","sidebarViewOnLoad","scrollModeOnLoad","spreadModeOnLoad","textLayerMode","viewOnLoad","cMapPacked","cMapUrl","disableAutoFetch","disableFontFace","disableRange","disableStream","docBaseUrl","enableXfa","fontExtraProperties","isEvalSupported","isOffscreenCanvasSupported","maxImageSize","pdfBug","standardFontDataUrl","verbosity","workerPort","workerSrc","defaultUrl","sandboxBundleSrc","viewerCssTheme","disablePreferences","language","userOptions","AppOptions","userOption","defaultOption","getAll","setAll","init","createValidAbsoluteUrl","isPdfFile","download","blobUrl","filename","click","href","documentElement","DownloadManager","openBlobUrls","WeakMap","downloadUrl","url","_options","downloadData","data","contentType","URL","createObjectURL","Blob","openOrDownloadData","dest","isPdfData","blob","DrawLayer","DrawLayerBuilder","setParent","parent","getDrawLayer","WaitOnType","EVENT","TIMEOUT","waitOnEventOrTimeout","delay","reject","Number","isInteger","handler","EventBus","eventHandler","removeEventListener","timeout","clearTimeout","bind","addEventListener","timeoutHandler","setTimeout","listeners","on","eventName","listener","external","once","off","dispatch","eventListeners","externalListeners","ii","splice","AutomationEventBus","getPdfFilenameFromUrl","docProperties","pdfDocument","baseUrl","info","metadata","contentDispositionFilename","contentLength","getMetadata","getDownloadInfo","baseURL","filesize","getRaw","authors","numPages","GenericScripting","_ready","sandbox","__non_webpack_import__","then","pdfjsSandbox","QuickJSSandbox","catch","createSandbox","dispatchEventInSandbox","event","dispatchEvent","destroySandbox","nukeSandbox","fetchData","L10n","GenericL10n","lang","_setL10n","getLanguage","defaultLang","baseLang","paths","getPaths","langs","shortLang","createBundle","path","resource","isRTL","fixupLangCode","getDirection","fallback","messages","translate","pause","resume","langCode","PARTIAL_LANG_CODES","en","es","fy","ga","gu","hi","hy","nb","ne","nn","pa","pt","sv","zh","shortCode","shadow","ConstL10n","instance","binarySearchFirstItem","scrollIntoView","getCharacterType","getNormalizeWithNFKC","PromiseCapability","FindState","FOUND","NOT_FOUND","WRAPPED","PENDING","FIND_TIMEOUT","MATCH_SCROLL_OFFSET_TOP","MATCH_SCROLL_OFFSET_LEFT","CHARACTERS_TO_NORMALIZE","DIACRITICS_EXCEPTION","DIACRITICS_EXCEPTION_STR","DIACRITICS_REG_EXP","SPECIAL_CHARS_REG_EXP","NOT_DIACRITIC_FROM_END_REG_EXP","NOT_DIACRITIC_FROM_START_REG_EXP","SYLLABLES_REG_EXP","SYLLABLES_LENGTHS","FIRST_CHAR_SYLLABLES_REG_EXP","NFKC_CHARS_TO_NORMALIZE","noSyllablesRegExp","withSyllablesRegExp","normalize","syllablePositions","m","index","len","normalizationRegex","toNormalizeWithNFKC","CJK","HKDiacritics","regexp","RegExp","rawDiacriticsPositions","normalized","positions","rawDiacriticsIndex","syllableIndex","shift","shiftOrigin","eol","hasDiacritics","p1","p2","p3","p4","p5","p6","p7","p8","replacement","jj","j","charAt","hasTrailingDashEOL","endsWith","newCharLen","getOriginalIndex","diffs","pos","end","x","oldStart","oldEnd","oldLen","PDFFindController","updateMatchesCountOnProgress","visitedPagesCount","_linkService","onIsPageVisible","reset","onFind","onFindBarClose","highlightMatches","_highlightMatches","pageMatches","_pageMatches","pageMatchesLength","_pageMatchesLength","selected","_selected","setDocument","_pdfDocument","_firstPageCapability","shouldDirtyMatch","_dirtyMatch","updateUIState","promise","extractText","findbarClosed","pendingTimeout","_findTimeout","nextMatch","highlightAll","updateAllPages","scrollMatchIntoView","selectedLeft","matchIndex","_scrollMatches","matchIdx","pageIdx","spot","top","left","_offset","wrapped","_extractTextPromises","_pageContents","_pageDiffs","_hasDiacritics","_matchesCountTotal","_pagesToSearch","_pendingFindMatches","_resumePageIdx","query","_rawQuery","_normalizedQuery","q","newQuery","prevQuery","newType","prevType","pagesCount","isEntireWord","startIdx","charCodeAt","limit","calculateRegExpMatch","entireWord","pageContent","matches","matchesLength","matchPos","matchLen","convertToRegExpString","matchDiacritics","isUnicode","replaceAll","trailingSpaces","fromCharCode","calculateMatch","caseSensitive","sort","reverse","isUnicodePart","queryPart","flags","updatePage","nextPageMatch","pageMatchesCount","updateUIResultsCount","textOptions","disableNormalization","extractTextCapability","getPage","getTextContent","strBuf","textItem","items","str","hasEOL","reason","previous","findPrevious","currentPageIndex","offset","numPageMatches","updateMatch","advanceOffsetPage","matchesReady","numMatches","found","previousPage","requestMatchesCount","current","total","matchesCount","rawQuery","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","NormalizeWithNFKC","isValidRotation","parseQueryString","HASH_CHANGE_TIMEOUT","POSITION_UPDATED_THRESHOLD","UPDATE_VIEWAREA_TIMEOUT","getCurrentHash","location","hash","PDFHistory","_initialized","_fingerprint","_boundEvents","_isPagesLoaded","initialize","fingerprint","resetHistory","updateUrl","reInitialized","_updateUrl","_bindEvents","window","history","_popStateInProgress","_blockHashChange","_currentHash","_numPositionUpdates","_uid","_maxUid","_destination","_position","_isValidState","rotation","_parseCurrentHash","_pushOrReplaceState","destination","_updateInternalState","uid","_initialRotation","_initialBookmark","_pageHide","_unbindEvents","_updateViewareaTimeout","namedDest","explicitDest","_isValidPage","forceReplace","isDestHashesEqual","isDestArraysEqual","pushPage","pushCurrentPosition","_tryPushCurrentPosition","back","forward","popStateInProgress","initialBookmark","initialRotation","shouldReplace","newState","newUrl","replaceState","pushState","temporary","position","assign","checkReload","perfEntry","performance","getEntriesByType","removeTemporary","max","checkNameddest","unescape","substring","nameddest","_updateViewarea","pdfOpenParams","_popState","newHash","hashChanged","goToDestination","setHash","updateViewarea","popState","pageHide","destHash","pushHash","firstDest","secondDest","isEntryEqual","second","isNaN","DEFAULT_LINK_REL","LinkTarget","NONE","SELF","BLANK","PARENT","TOP","addLinkAttributes","link","rel","enabled","title","onclick","targetStr","PDFLinkService","pagesRefCache","externalLinkEnabled","_ignoreDestinationZoom","pdfViewer","pdfHistory","setViewer","setHistory","currentPageNumber","pagesRotation","goToDestinationHelper","rawDest","destRef","_cachedPageNumber","getPageIndex","cachePageRef","scrollPageIntoView","destArray","getDestination","goToPage","pageLabelToPageNumber","newWindow","getDestinationHash","getAnchorUrl","escape","anchor","phrase","zoomArgs","zoomArg","zoomArgNumber","allowNegativeOffset","mode","isValidExplicitDestination","executeNamedAction","action","nextPage","executeSetOCGState","optionalContentConfig","optionalContentConfigPromise","operator","setVisibility","group","getGroup","visible","pageNum","pageRef","refStr","gen","num","destLength","zoom","allowNull","param","SimpleLinkService","AbortException","AnnotationMode","PixelsPerInch","RenderingCancelledException","setLayerDimensions","approximateFraction","DEFAULT_SCALE","OutputScale","RenderingStates","roundToDivide","TextLayerMode","StructTreeLayerBuilder","TextAccessibilityManager","TextHighlighter","TextLayerBuilder","XfaLayerBuilder","MAX_CANVAS_PIXELS","DEFAULT_LAYER_PROPERTIES","annotationEditorUIManager","findController","PDFPageView","ENABLE_FORMS","hasRestrictedScaling","layerProperties","loadingId","previousRotation","renderError","renderingState","INITIAL","ENABLE","useThumbnailCanvas","directDrawing","initialOptionalContent","regularAnnotations","viewportMap","container","defaultViewport","renderingId","pageLabel","scale","pdfPageRotate","_optionalContentConfigPromise","pageColors","renderingQueue","renderTask","_isStandalone","hasViewer","_container","zoomLayer","xfaLayer","structTreeLayer","setDimensions","style","setProperty","PDF_TO_CSS_UNITS","hasInitialVisibility","PAUSED","classList","RUNNING","FINISHED","setPdfPage","foreground","background","filterFactory","addHighlightHCMFilter","rotate","totalRotation","getViewport","cleanup","_textHighlighter","renderAnnotationLayer","ex","renderAnnotationEditorLayer","renderDrawLayer","renderXfaLayer","textDivs","buildXfaTextContentItems","renderTextLayer","renderingDone","readableStream","streamTextContent","includeMarkedContent","setTextContentSource","numTextDivs","renderStructTreeLayer","tree","getStructTree","treeDom","canvas","item","setTextMapping","enable","_resetZoomLayer","removeFromDOM","zoomLayerCanvas","firstChild","width","height","keepZoomLayer","keepAnnotationLayer","keepAnnotationEditorLayer","keepXfaLayer","keepTextLayer","cancelRendering","zoomLayerNode","annotationLayerNode","annotationEditorLayerNode","xfaLayerNode","textLayerNode","node","drawingDelay","onlyCssZoom","sx","sy","outputScale","floor","postponeDrawing","cancelExtraDelay","cssTransform","redrawAnnotationLayer","redrawAnnotationEditorLayer","redrawXfaLayer","redrawTextLayer","hideTextLayer","timestamp","now","parentNode","disable","originalViewport","relativeRotation","absRotation","abs","scaleX","scaleY","getPagePoint","y","convertToPdfPoint","finishRenderTask","separateAnnots","draw","canvasWrapper","DISABLE","isPureXfa","highlighter","ENABLE_PERMISSIONS","onAppend","textLayerDiv","renderContinueCallback","cont","showCanvas","isHighestPriority","hasHCM","isLastShow","ctx","getContext","alpha","invScale","pixelsInViewport","maxScale","sqrt","sfx","sfy","scaled","renderContext","canvasContext","onContinue","resultPromise","setPageLabel","thumbnailCanvas","CLEANUP_TIMEOUT","PDFRenderingQueue","pdfThumbnailViewer","onIdle","highestPriorityPage","idleTimeout","printing","isThumbnailViewEnabled","defineProperty","setThumbnailViewer","view","renderHighestPriority","currentlyVisiblePages","forceRendering","getHighestPriority","views","scrolledDown","preRenderExtra","visibleViews","numVisible","isViewFinished","firstId","lastId","visibleIds","holeId","holeView","preRenderIndex","preRenderView","renderView","finally","PDFScriptingManager","PDFScriptingManagerComponents","externalServices","detail","createScripting","apiPageLayoutToViewerModes","closeCapability","destroyCapability","ready","scripting","willPrintCapability","destroyScripting","objects","calculationOrder","docActions","getFieldObjects","getCalculationOrderIds","getJSActions","initScripting","_internalEvents","updateFromSandbox","dispatchPageClose","dispatchPageOpen","_pageOpenPending","appInfo","docInfo","actions","dispatchWillSave","dispatchDidSave","dispatchWillPrint","dispatchDidPrint","destroyPromise","_visitedPages","isChangingPresentationMode","siblings","command","modes","spreadMode","pagesPromise","log","currentScaleValue","increaseScale","decreaseScale","focus","elementId","CustomEvent","setValue","visitedPages","pageView","getPageView","actionsPromise","race","ScrollMode","SpreadMode","PDFViewer","PDFSinglePageViewer","_resetView","_scrollMode","PAGE","_spreadMode","scrollMode","_updateScrollMode","_updateSpreadMode","ProgressBar","pdfjsVersion","pdfjsBuild","AnnotationEditorType","AnnotationEditorUIManager","PermissionFlag","version","DEFAULT_SCALE_DELTA","DEFAULT_SCALE_VALUE","docStyle","getVisibleElements","isPortraitOrientation","isValidScrollMode","isValidSpreadMode","MAX_AUTO_SCALE","MAX_SCALE","MIN_SCALE","removeNullCharacters","SCROLLBAR_PADDING","UNKNOWN_SCALE","VERTICAL_PADDING","watchScroll","DEFAULT_CACHE_SIZE","PagesCountLimit","FORCE_SCROLL_MODE_PAGE","FORCE_LAZY_PAGE_INIT","PAUSE_EAGER_PAGE_INIT","isValidAnnotationEditorMode","PDFPageViewBuffer","buf","destroyFirstView","resize","newSize","idsToKeep","firstView","buffer","altTextManager","annotationEditorHighlightColors","containerTopLeft","copyCallbackBound","getAllTextInProgress","hiddenCopyElement","interruptCopyCondition","previousContainerHeight","resizeObserver","ResizeObserver","resizeObserverCallback","scrollModePageState","onVisibilityChange","scaleTimeoutId","viewerVersion","viewer","firstElementChild","tagName","offsetParent","getComputedStyle","_getVisiblePages","_scriptingManager","scriptingManager","removePageBorders","defaultRenderingQueue","scroll","_scrollUpdate","presentationModeState","UNKNOWN","_onBeforeDraw","_onAfterDraw","updateContainerHeightCss","_pages","getCachedPageViews","pageViewsReady","_pagesCapability","settled","every","_currentPageNumber","_setCurrentPageNumber","resetCurrentPageView","_pageLabels","currentPageLabel","indexOf","currentScale","_currentScale","setScale","noScroll","_currentScaleValue","_pagesRotation","refresh","firstPagePromise","onePageRendered","_onePageRenderedCapability","_layerProperties","self","initializePermissions","permissions","COPY","MODIFY_CONTENTS","MODIFY_ANNOTATIONS","FILL_INTERACTIVE_FORMS","onePageRenderedOrForceFetch","visibilityState","visibilityChangePromise","getAllText","texts","copyCallback","selection","getSelection","focusNode","anchorNode","containsNode","preventDefault","stopPropagation","savedCursor","interruptCopy","ev","clipboard","writeText","_cancelRendering","getOptionalContentConfig","permissionsPromise","getPermissions","firstPdfPage","before","updateMode","viewerElement","firstPageView","ref","ensurePageViewVisible","loadingParams","getPagesLeft","Language","setPageLabels","labels","_location","VERTICAL","_previousScrollMode","previousPageNumber","scrollDown","pages","pageIndexSet","parity","spread","dummyPage","pageSpot","offsetLeft","clientLeft","right","clientWidth","scrollLeft","HORIZONTAL","isSameScale","newScale","setScaleUpdatePages","newValue","preset","presetValue","pageWidthScaleFactor","currentPage","hPadding","vPadding","pageWidthScale","pageHeightScale","clientHeight","horizontalScale","widthScale","heightScale","changeOrientation","pageWidth","pageHeight","boundingRect","convertToViewportPoint","_updateLocation","firstPage","normalizedScaleValue","round","currentPageView","topLeft","scrollTop","intLeft","intTop","visiblePages","numVisiblePages","newCacheSize","isSimpleLayout","currentId","stillFullyVisible","percent","containsElement","_isContainerRtl","CHANGING","isHorizontalScrollbarEnabled","scrollWidth","isVerticalScrollbarEnabled","scrollHeight","horizontal","rtl","scrollEl","sortByVisibility","ensurePdfPageLoaded","getScrollAhead","down","scrollAhead","hasEqualPageSizes","getPagesOverview","initialOrientation","orientation","toggle","_getPageAdvance","pageLayout","widthPercent","yArray","currentIndex","expectedId","advance","scaleFactor","steps","ceil","toFixed","borderBoxSize","blockSize","offsetTop","editId","isFromKeyboard","annotationEditorParams","updateParams","noUpdate","updateArgs","globalThis","pdfjsLib","pdfjsLibPromise","AnnotationEditorParamsType","build","CMapCompressionType","ColorPicker","DOMSVGFactory","FeatureTest","getDocument","getFilenameFromUrl","getXfaPageViewport","GlobalWorkerOptions","ImageKind","InvalidPDFException","isDataScheme","MissingPDFException","noContextMenu","normalizeUnicode","OPS","Outliner","PasswordResponses","PDFDataRangeTransport","PDFDateString","PDFWorker","UnexpectedResponseException","updateTextLayer","Util","VerbosityLevel","XfaLayer","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","structTree","walk","structElement","htmlElement","alt","role","children","kid","textChildren","textNodes","waitingElements","compareElementPositions","e1","e2","rect1","getBoundingClientRect","rect2","top1","bot1","mid1","top2","bot2","mid2","centerX1","centerX2","nodeIndex","getElementById","addIdToAriaOwns","isRemovable","addPointerInTextLayer","removePointerInTextLayer","owns","child","moveElementInDOM","contentElement","hasChildNodes","elementToCompare","after","_onUpdateTextLayerMatches","textContentItemsStr","divs","_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","textContentSource","textDivProperties","textLayerRenderTask","finishRendering","endOfContent","bindMouse","devicePixelRatio","mustRotate","mustRescale","adjustTop","getPropertyValue","divBounds","pageY","clipboardData","setData","SidebarView","THUMBS","OUTLINE","ATTACHMENTS","LAYERS","ODD","EVEN","CursorTool","SELECT","HAND","ZOOM","AutoPrintRegExp","pixelRatio","scrollMatches","offsetY","clientTop","offsetX","overflow","viewAreaElement","callback","debounceScroll","rAF","viewAreaElementScrolled","currentX","lastX","currentY","lastY","_eventHandler","URLSearchParams","InvisibleCharactersRegExp","replaceInvisible","condition","minIndex","maxIndex","currentItem","xinv","x_","b","c","d","p","getPageSizeInches","userUnit","x1","y1","x2","y2","backtrackBeforeAllVisibleElements","elt","pageTop","bottom","isElementBottomAfterViewTop","elementBottom","isElementNextAfterViewHorizontally","elementLeft","elementRight","numViews","firstVisibleElementInd","lastEdge","currentWidth","currentHeight","viewWidth","viewHeight","viewRight","viewBottom","hiddenHeight","hiddenWidth","fractionHeight","fractionWidth","at","pc","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","animationStarted","clamp","disableAutoFetchTimeout","bar","setWidth","scrollbarWidth","offsetWidth","setDisableAutoFetch","getActiveOrFocusedElement","curRoot","curActiveOrFocused","activeElement","shadowRoot","layout","apiPageModeToSidebarView","toggleCheckedBtn","button","toggleExpandedBtn","xfaHtml","getXfa"],"sourceRoot":""}