pdfjs-viewer-element 3.2.1 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/locale-DENudnjU.js +1 -0
- package/dist/paper-and-ink-w6df3wtN.js +1 -0
- package/dist/pdf-DRXGYF_W.js +1 -0
- package/dist/pdfjs-viewer-element.js +1 -1
- package/dist/viewer-00vA-OlL.js +1 -0
- package/dist/viewer-DVUWiHIQ.js +1 -0
- package/dist/viewer-gf2SDly8.js +1 -0
- package/package.json +2 -2
- package/dist/locale-ZlyOoh6p.js +0 -1
- package/dist/paper-and-ink-DgTYBeKf.js +0 -1
- package/dist/pdf-Db_S0hNt.js +0 -1
- package/dist/viewer-BDue30WQ.js +0 -1
- package/dist/viewer-D69caMA4.js +0 -1
- package/dist/viewer-asGZOfPa.js +0 -1
package/dist/viewer-D69caMA4.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e='/**\n * @licstart The following is the entire license notice for the\n * JavaScript code in this page\n *\n * Copyright 2024 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @licend The above is the entire license notice for the\n * JavaScript code in this page\n */\n\n/**\n * pdfjsVersion = 5.5.207\n * pdfjsBuild = 527964698\n */\n/******/ var __webpack_modules__ = ({\n\n/***/ 9306\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar isCallable = __webpack_require__(4901);\nvar tryToString = __webpack_require__(6823);\n\nvar $TypeError = TypeError;\n\n// `Assert: IsCallable(argument) is true`\nmodule.exports = function (argument) {\n if (isCallable(argument)) return argument;\n throw new $TypeError(tryToString(argument) + \' is not a function\');\n};\n\n\n/***/ },\n\n/***/ 6194\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar has = (__webpack_require__(2248).has);\n\n// Perform ? RequireInternalSlot(M, [[MapData]])\nmodule.exports = function (it) {\n has(it);\n return it;\n};\n\n\n/***/ },\n\n/***/ 3506\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar isPossiblePrototype = __webpack_require__(3925);\n\nvar $String = String;\nvar $TypeError = TypeError;\n\nmodule.exports = function (argument) {\n if (isPossiblePrototype(argument)) return argument;\n throw new $TypeError("Can\'t set " + $String(argument) + \' as a prototype\');\n};\n\n\n/***/ },\n\n/***/ 7080\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar has = (__webpack_require__(4402).has);\n\n// Perform ? RequireInternalSlot(M, [[SetData]])\nmodule.exports = function (it) {\n has(it);\n return it;\n};\n\n\n/***/ },\n\n/***/ 3463\n(module) {\n\n\nvar $TypeError = TypeError;\n\nmodule.exports = function (argument) {\n if (typeof argument == \'string\') return argument;\n throw new $TypeError(\'Argument is not a string\');\n};\n\n\n/***/ },\n\n/***/ 4328\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar WeakMapHelpers = __webpack_require__(4995);\n\nvar weakmap = new WeakMapHelpers.WeakMap();\nvar set = WeakMapHelpers.set;\nvar remove = WeakMapHelpers.remove;\n\nmodule.exports = function (key) {\n set(weakmap, key, 1);\n remove(weakmap, key);\n return key;\n};\n\n\n/***/ },\n\n/***/ 6557\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar has = (__webpack_require__(4995).has);\n\n// Perform ? RequireInternalSlot(M, [[WeakMapData]])\nmodule.exports = function (it) {\n has(it);\n return it;\n};\n\n\n/***/ },\n\n/***/ 679\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar isPrototypeOf = __webpack_require__(1625);\n\nvar $TypeError = TypeError;\n\nmodule.exports = function (it, Prototype) {\n if (isPrototypeOf(Prototype, it)) return it;\n throw new $TypeError(\'Incorrect invocation\');\n};\n\n\n/***/ },\n\n/***/ 8551\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar isObject = __webpack_require__(34);\n\nvar $String = String;\nvar $TypeError = TypeError;\n\n// `Assert: Type(argument) is Object`\nmodule.exports = function (argument) {\n if (isObject(argument)) return argument;\n throw new $TypeError($String(argument) + \' is not an object\');\n};\n\n\n/***/ },\n\n/***/ 7811\n(module) {\n\n\n// eslint-disable-next-line es/no-typed-arrays -- safe\nmodule.exports = typeof ArrayBuffer != \'undefined\' && typeof DataView != \'undefined\';\n\n\n/***/ },\n\n/***/ 7394\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar globalThis = __webpack_require__(4576);\nvar uncurryThisAccessor = __webpack_require__(6706);\nvar classof = __webpack_require__(2195);\n\nvar ArrayBuffer = globalThis.ArrayBuffer;\nvar TypeError = globalThis.TypeError;\n\n// Includes\n// - Perform ? RequireInternalSlot(O, [[ArrayBufferData]]).\n// - If IsSharedArrayBuffer(O) is true, throw a TypeError exception.\nmodule.exports = ArrayBuffer && uncurryThisAccessor(ArrayBuffer.prototype, \'byteLength\', \'get\') || function (O) {\n if (classof(O) !== \'ArrayBuffer\') throw new TypeError(\'ArrayBuffer expected\');\n return O.byteLength;\n};\n\n\n/***/ },\n\n/***/ 3238\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar globalThis = __webpack_require__(4576);\nvar NATIVE_ARRAY_BUFFER = __webpack_require__(7811);\nvar arrayBufferByteLength = __webpack_require__(7394);\n\nvar DataView = globalThis.DataView;\n\nmodule.exports = function (O) {\n if (!NATIVE_ARRAY_BUFFER || arrayBufferByteLength(O) !== 0) return false;\n try {\n // eslint-disable-next-line no-new -- thrower\n new DataView(O);\n return false;\n } catch (error) {\n return true;\n }\n};\n\n\n/***/ },\n\n/***/ 5169\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar isDetached = __webpack_require__(3238);\n\nvar $TypeError = TypeError;\n\nmodule.exports = function (it) {\n if (isDetached(it)) throw new $TypeError(\'ArrayBuffer is detached\');\n return it;\n};\n\n\n/***/ },\n\n/***/ 5636\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar globalThis = __webpack_require__(4576);\nvar uncurryThis = __webpack_require__(9504);\nvar uncurryThisAccessor = __webpack_require__(6706);\nvar toIndex = __webpack_require__(7696);\nvar notDetached = __webpack_require__(5169);\nvar arrayBufferByteLength = __webpack_require__(7394);\nvar detachTransferable = __webpack_require__(4483);\nvar PROPER_STRUCTURED_CLONE_TRANSFER = __webpack_require__(1548);\n\nvar structuredClone = globalThis.structuredClone;\nvar ArrayBuffer = globalThis.ArrayBuffer;\nvar DataView = globalThis.DataView;\nvar min = Math.min;\nvar ArrayBufferPrototype = ArrayBuffer.prototype;\nvar DataViewPrototype = DataView.prototype;\nvar slice = uncurryThis(ArrayBufferPrototype.slice);\nvar isResizable = uncurryThisAccessor(ArrayBufferPrototype, \'resizable\', \'get\');\nvar maxByteLength = uncurryThisAccessor(ArrayBufferPrototype, \'maxByteLength\', \'get\');\nvar getInt8 = uncurryThis(DataViewPrototype.getInt8);\nvar setInt8 = uncurryThis(DataViewPrototype.setInt8);\n\nmodule.exports = (PROPER_STRUCTURED_CLONE_TRANSFER || detachTransferable) && function (arrayBuffer, newLength, preserveResizability) {\n var byteLength = arrayBufferByteLength(arrayBuffer);\n var newByteLength = newLength === undefined ? byteLength : toIndex(newLength);\n var fixedLength = !isResizable || !isResizable(arrayBuffer);\n var newBuffer;\n notDetached(arrayBuffer);\n if (PROPER_STRUCTURED_CLONE_TRANSFER) {\n arrayBuffer = structuredClone(arrayBuffer, { transfer: [arrayBuffer] });\n if (byteLength === newByteLength && (preserveResizability || fixedLength)) return arrayBuffer;\n }\n if (byteLength >= newByteLength && (!preserveResizability || fixedLength)) {\n newBuffer = slice(arrayBuffer, 0, newByteLength);\n } else {\n var options = preserveResizability && !fixedLength && maxByteLength ? { maxByteLength: maxByteLength(arrayBuffer) } : undefined;\n newBuffer = new ArrayBuffer(newByteLength, options);\n var a = new DataView(arrayBuffer);\n var b = new DataView(newBuffer);\n var copyLength = min(newByteLength, byteLength);\n for (var i = 0; i < copyLength; i++) setInt8(b, i, getInt8(a, i));\n }\n if (!PROPER_STRUCTURED_CLONE_TRANSFER) detachTransferable(arrayBuffer);\n return newBuffer;\n};\n\n\n/***/ },\n\n/***/ 4644\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar NATIVE_ARRAY_BUFFER = __webpack_require__(7811);\nvar DESCRIPTORS = __webpack_require__(3724);\nvar globalThis = __webpack_require__(4576);\nvar isCallable = __webpack_require__(4901);\nvar isObject = __webpack_require__(34);\nvar hasOwn = __webpack_require__(9297);\nvar classof = __webpack_require__(6955);\nvar tryToString = __webpack_require__(6823);\nvar createNonEnumerableProperty = __webpack_require__(6699);\nvar defineBuiltIn = __webpack_require__(6840);\nvar defineBuiltInAccessor = __webpack_require__(2106);\nvar isPrototypeOf = __webpack_require__(1625);\nvar getPrototypeOf = __webpack_require__(2787);\nvar setPrototypeOf = __webpack_require__(2967);\nvar wellKnownSymbol = __webpack_require__(8227);\nvar uid = __webpack_require__(3392);\nvar InternalStateModule = __webpack_require__(1181);\n\nvar enforceInternalState = InternalStateModule.enforce;\nvar getInternalState = InternalStateModule.get;\nvar Int8Array = globalThis.Int8Array;\nvar Int8ArrayPrototype = Int8Array && Int8Array.prototype;\nvar Uint8ClampedArray = globalThis.Uint8ClampedArray;\nvar Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;\nvar TypedArray = Int8Array && getPrototypeOf(Int8Array);\nvar TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);\nvar ObjectPrototype = Object.prototype;\nvar TypeError = globalThis.TypeError;\n\nvar TO_STRING_TAG = wellKnownSymbol(\'toStringTag\');\nvar TYPED_ARRAY_TAG = uid(\'TYPED_ARRAY_TAG\');\nvar TYPED_ARRAY_CONSTRUCTOR = \'TypedArrayConstructor\';\n// Fixing native typed arrays in Opera Presto crashes the browser, see #595\nvar NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(globalThis.opera) !== \'Opera\';\nvar TYPED_ARRAY_TAG_REQUIRED = false;\nvar NAME, Constructor, Prototype;\n\nvar TypedArrayConstructorsList = {\n Int8Array: 1,\n Uint8Array: 1,\n Uint8ClampedArray: 1,\n Int16Array: 2,\n Uint16Array: 2,\n Int32Array: 4,\n Uint32Array: 4,\n Float32Array: 4,\n Float64Array: 8\n};\n\nvar BigIntArrayConstructorsList = {\n BigInt64Array: 8,\n BigUint64Array: 8\n};\n\nvar isView = function isView(it) {\n if (!isObject(it)) return false;\n var klass = classof(it);\n return klass === \'DataView\'\n || hasOwn(TypedArrayConstructorsList, klass)\n || hasOwn(BigIntArrayConstructorsList, klass);\n};\n\nvar getTypedArrayConstructor = function (it) {\n var proto = getPrototypeOf(it);\n if (!isObject(proto)) return;\n var state = getInternalState(proto);\n return (state && hasOwn(state, TYPED_ARRAY_CONSTRUCTOR)) ? state[TYPED_ARRAY_CONSTRUCTOR] : getTypedArrayConstructor(proto);\n};\n\nvar isTypedArray = function (it) {\n if (!isObject(it)) return false;\n var klass = classof(it);\n return hasOwn(TypedArrayConstructorsList, klass)\n || hasOwn(BigIntArrayConstructorsList, klass);\n};\n\nvar aTypedArray = function (it) {\n if (isTypedArray(it)) return it;\n throw new TypeError(\'Target is not a typed array\');\n};\n\nvar aTypedArrayConstructor = function (C) {\n if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C))) return C;\n throw new TypeError(tryToString(C) + \' is not a typed array constructor\');\n};\n\nvar exportTypedArrayMethod = function (KEY, property, forced, options) {\n if (!DESCRIPTORS) return;\n if (forced) for (var ARRAY in TypedArrayConstructorsList) {\n var TypedArrayConstructor = globalThis[ARRAY];\n if (TypedArrayConstructor && hasOwn(TypedArrayConstructor.prototype, KEY)) try {\n delete TypedArrayConstructor.prototype[KEY];\n } catch (error) {\n // old WebKit bug - some methods are non-configurable\n try {\n TypedArrayConstructor.prototype[KEY] = property;\n } catch (error2) { /* empty */ }\n }\n }\n if (!TypedArrayPrototype[KEY] || forced) {\n defineBuiltIn(TypedArrayPrototype, KEY, forced ? property\n : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property, options);\n }\n};\n\nvar exportTypedArrayStaticMethod = function (KEY, property, forced) {\n var ARRAY, TypedArrayConstructor;\n if (!DESCRIPTORS) return;\n if (setPrototypeOf) {\n if (forced) for (ARRAY in TypedArrayConstructorsList) {\n TypedArrayConstructor = globalThis[ARRAY];\n if (TypedArrayConstructor && hasOwn(TypedArrayConstructor, KEY)) try {\n delete TypedArrayConstructor[KEY];\n } catch (error) { /* empty */ }\n }\n if (!TypedArray[KEY] || forced) {\n // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable\n try {\n return defineBuiltIn(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property);\n } catch (error) { /* empty */ }\n } else return;\n }\n for (ARRAY in TypedArrayConstructorsList) {\n TypedArrayConstructor = globalThis[ARRAY];\n if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {\n defineBuiltIn(TypedArrayConstructor, KEY, property);\n }\n }\n};\n\nfor (NAME in TypedArrayConstructorsList) {\n Constructor = globalThis[NAME];\n Prototype = Constructor && Constructor.prototype;\n if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;\n else NATIVE_ARRAY_BUFFER_VIEWS = false;\n}\n\nfor (NAME in BigIntArrayConstructorsList) {\n Constructor = globalThis[NAME];\n Prototype = Constructor && Constructor.prototype;\n if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;\n}\n\n// WebKit bug - typed arrays constructors prototype is Object.prototype\nif (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) {\n // eslint-disable-next-line no-shadow -- safe\n TypedArray = function TypedArray() {\n throw new TypeError(\'Incorrect invocation\');\n };\n if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {\n if (globalThis[NAME]) setPrototypeOf(globalThis[NAME], TypedArray);\n }\n}\n\nif (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {\n TypedArrayPrototype = TypedArray.prototype;\n if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {\n if (globalThis[NAME]) setPrototypeOf(globalThis[NAME].prototype, TypedArrayPrototype);\n }\n}\n\n// WebKit bug - one more object in Uint8ClampedArray prototype chain\nif (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {\n setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);\n}\n\nif (DESCRIPTORS && !hasOwn(TypedArrayPrototype, TO_STRING_TAG)) {\n TYPED_ARRAY_TAG_REQUIRED = true;\n defineBuiltInAccessor(TypedArrayPrototype, TO_STRING_TAG, {\n configurable: true,\n get: function () {\n return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;\n }\n });\n for (NAME in TypedArrayConstructorsList) if (globalThis[NAME]) {\n createNonEnumerableProperty(globalThis[NAME], TYPED_ARRAY_TAG, NAME);\n }\n}\n\nmodule.exports = {\n NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,\n TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG,\n aTypedArray: aTypedArray,\n aTypedArrayConstructor: aTypedArrayConstructor,\n exportTypedArrayMethod: exportTypedArrayMethod,\n exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,\n getTypedArrayConstructor: getTypedArrayConstructor,\n isView: isView,\n isTypedArray: isTypedArray,\n TypedArray: TypedArray,\n TypedArrayPrototype: TypedArrayPrototype\n};\n\n\n/***/ },\n\n/***/ 9617\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar toIndexedObject = __webpack_require__(5397);\nvar toAbsoluteIndex = __webpack_require__(5610);\nvar lengthOfArrayLike = __webpack_require__(6198);\n\n// `Array.prototype.{ indexOf, includes }` methods implementation\nvar createMethod = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIndexedObject($this);\n var length = lengthOfArrayLike(O);\n if (length === 0) return !IS_INCLUDES && -1;\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare -- NaN check\n if (IS_INCLUDES && el !== el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare -- NaN check\n if (value !== value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) {\n if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.includes` method\n // https://tc39.es/ecma262/#sec-array.prototype.includes\n includes: createMethod(true),\n // `Array.prototype.indexOf` method\n // https://tc39.es/ecma262/#sec-array.prototype.indexof\n indexOf: createMethod(false)\n};\n\n\n/***/ },\n\n/***/ 4527\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar DESCRIPTORS = __webpack_require__(3724);\nvar isArray = __webpack_require__(4376);\n\nvar $TypeError = TypeError;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// Safari < 13 does not throw an error in this case\nvar SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {\n // makes no sense without proper strict mode support\n if (this !== undefined) return true;\n try {\n // eslint-disable-next-line es/no-object-defineproperty -- safe\n Object.defineProperty([], \'length\', { writable: false }).length = 1;\n } catch (error) {\n return error instanceof TypeError;\n }\n}();\n\nmodule.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {\n if (isArray(O) && !getOwnPropertyDescriptor(O, \'length\').writable) {\n throw new $TypeError(\'Cannot set read only .length\');\n } return O.length = length;\n} : function (O, length) {\n return O.length = length;\n};\n\n\n/***/ },\n\n/***/ 7680\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\n\nmodule.exports = uncurryThis([].slice);\n\n\n/***/ },\n\n/***/ 6319\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar anObject = __webpack_require__(8551);\nvar iteratorClose = __webpack_require__(9539);\n\n// call something on iterator step with safe closing on error\nmodule.exports = function (iterator, fn, value, ENTRIES) {\n try {\n return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);\n } catch (error) {\n iteratorClose(iterator, \'throw\', error);\n }\n};\n\n\n/***/ },\n\n/***/ 2195\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\n\nvar toString = uncurryThis({}.toString);\nvar stringSlice = uncurryThis(\'\'.slice);\n\nmodule.exports = function (it) {\n return stringSlice(toString(it), 8, -1);\n};\n\n\n/***/ },\n\n/***/ 6955\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar TO_STRING_TAG_SUPPORT = __webpack_require__(2140);\nvar isCallable = __webpack_require__(4901);\nvar classofRaw = __webpack_require__(2195);\nvar wellKnownSymbol = __webpack_require__(8227);\n\nvar TO_STRING_TAG = wellKnownSymbol(\'toStringTag\');\nvar $Object = Object;\n\n// ES3 wrong here\nvar CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === \'Arguments\';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (error) { /* empty */ }\n};\n\n// getting tag from ES6+ `Object.prototype.toString`\nmodule.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {\n var O, tag, result;\n return it === undefined ? \'Undefined\' : it === null ? \'Null\'\n // @@toStringTag case\n : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == \'string\' ? tag\n // builtinTag case\n : CORRECT_ARGUMENTS ? classofRaw(O)\n // ES3 arguments fallback\n : (result = classofRaw(O)) === \'Object\' && isCallable(O.callee) ? \'Arguments\' : result;\n};\n\n\n/***/ },\n\n/***/ 7740\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar hasOwn = __webpack_require__(9297);\nvar ownKeys = __webpack_require__(5031);\nvar getOwnPropertyDescriptorModule = __webpack_require__(7347);\nvar definePropertyModule = __webpack_require__(4913);\n\nmodule.exports = function (target, source, exceptions) {\n var keys = ownKeys(source);\n var defineProperty = definePropertyModule.f;\n var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {\n defineProperty(target, key, getOwnPropertyDescriptor(source, key));\n }\n }\n};\n\n\n/***/ },\n\n/***/ 2211\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar fails = __webpack_require__(9039);\n\nmodule.exports = !fails(function () {\n function F() { /* empty */ }\n F.prototype.constructor = null;\n // eslint-disable-next-line es/no-object-getprototypeof -- required for testing\n return Object.getPrototypeOf(new F()) !== F.prototype;\n});\n\n\n/***/ },\n\n/***/ 2529\n(module) {\n\n\n// `CreateIterResultObject` abstract operation\n// https://tc39.es/ecma262/#sec-createiterresultobject\nmodule.exports = function (value, done) {\n return { value: value, done: done };\n};\n\n\n/***/ },\n\n/***/ 6699\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar DESCRIPTORS = __webpack_require__(3724);\nvar definePropertyModule = __webpack_require__(4913);\nvar createPropertyDescriptor = __webpack_require__(6980);\n\nmodule.exports = DESCRIPTORS ? function (object, key, value) {\n return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n\n\n/***/ },\n\n/***/ 6980\n(module) {\n\n\nmodule.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n\n\n/***/ },\n\n/***/ 4659\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar DESCRIPTORS = __webpack_require__(3724);\nvar definePropertyModule = __webpack_require__(4913);\nvar createPropertyDescriptor = __webpack_require__(6980);\n\nmodule.exports = function (object, key, value) {\n if (DESCRIPTORS) definePropertyModule.f(object, key, createPropertyDescriptor(0, value));\n else object[key] = value;\n};\n\n\n/***/ },\n\n/***/ 2106\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar makeBuiltIn = __webpack_require__(283);\nvar defineProperty = __webpack_require__(4913);\n\nmodule.exports = function (target, name, descriptor) {\n if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });\n if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });\n return defineProperty.f(target, name, descriptor);\n};\n\n\n/***/ },\n\n/***/ 6840\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar isCallable = __webpack_require__(4901);\nvar definePropertyModule = __webpack_require__(4913);\nvar makeBuiltIn = __webpack_require__(283);\nvar defineGlobalProperty = __webpack_require__(9433);\n\nmodule.exports = function (O, key, value, options) {\n if (!options) options = {};\n var simple = options.enumerable;\n var name = options.name !== undefined ? options.name : key;\n if (isCallable(value)) makeBuiltIn(value, name, options);\n if (options.global) {\n if (simple) O[key] = value;\n else defineGlobalProperty(key, value);\n } else {\n try {\n if (!options.unsafe) delete O[key];\n else if (O[key]) simple = true;\n } catch (error) { /* empty */ }\n if (simple) O[key] = value;\n else definePropertyModule.f(O, key, {\n value: value,\n enumerable: false,\n configurable: !options.nonConfigurable,\n writable: !options.nonWritable\n });\n } return O;\n};\n\n\n/***/ },\n\n/***/ 6279\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar defineBuiltIn = __webpack_require__(6840);\n\nmodule.exports = function (target, src, options) {\n for (var key in src) defineBuiltIn(target, key, src[key], options);\n return target;\n};\n\n\n/***/ },\n\n/***/ 9433\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar globalThis = __webpack_require__(4576);\n\n// eslint-disable-next-line es/no-object-defineproperty -- safe\nvar defineProperty = Object.defineProperty;\n\nmodule.exports = function (key, value) {\n try {\n defineProperty(globalThis, key, { value: value, configurable: true, writable: true });\n } catch (error) {\n globalThis[key] = value;\n } return value;\n};\n\n\n/***/ },\n\n/***/ 3724\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar fails = __webpack_require__(9039);\n\n// Detect IE8\'s incomplete defineProperty implementation\nmodule.exports = !fails(function () {\n // eslint-disable-next-line es/no-object-defineproperty -- required for testing\n return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;\n});\n\n\n/***/ },\n\n/***/ 4483\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar globalThis = __webpack_require__(4576);\nvar getBuiltInNodeModule = __webpack_require__(9429);\nvar PROPER_STRUCTURED_CLONE_TRANSFER = __webpack_require__(1548);\n\nvar structuredClone = globalThis.structuredClone;\nvar $ArrayBuffer = globalThis.ArrayBuffer;\nvar $MessageChannel = globalThis.MessageChannel;\nvar detach = false;\nvar WorkerThreads, channel, buffer, $detach;\n\nif (PROPER_STRUCTURED_CLONE_TRANSFER) {\n detach = function (transferable) {\n structuredClone(transferable, { transfer: [transferable] });\n };\n} else if ($ArrayBuffer) try {\n if (!$MessageChannel) {\n WorkerThreads = getBuiltInNodeModule(\'worker_threads\');\n if (WorkerThreads) $MessageChannel = WorkerThreads.MessageChannel;\n }\n\n if ($MessageChannel) {\n channel = new $MessageChannel();\n buffer = new $ArrayBuffer(2);\n\n $detach = function (transferable) {\n channel.port1.postMessage(null, [transferable]);\n };\n\n if (buffer.byteLength === 2) {\n $detach(buffer);\n if (buffer.byteLength === 0) detach = $detach;\n }\n }\n} catch (error) { /* empty */ }\n\nmodule.exports = detach;\n\n\n/***/ },\n\n/***/ 4055\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar globalThis = __webpack_require__(4576);\nvar isObject = __webpack_require__(34);\n\nvar document = globalThis.document;\n// typeof document.createElement is \'object\' in old IE\nvar EXISTS = isObject(document) && isObject(document.createElement);\n\nmodule.exports = function (it) {\n return EXISTS ? document.createElement(it) : {};\n};\n\n\n/***/ },\n\n/***/ 6837\n(module) {\n\n\nvar $TypeError = TypeError;\nvar MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991\n\nmodule.exports = function (it) {\n if (it > MAX_SAFE_INTEGER) throw $TypeError(\'Maximum allowed index exceeded\');\n return it;\n};\n\n\n/***/ },\n\n/***/ 8727\n(module) {\n\n\n// IE8- don\'t enum bug keys\nmodule.exports = [\n \'constructor\',\n \'hasOwnProperty\',\n \'isPrototypeOf\',\n \'propertyIsEnumerable\',\n \'toLocaleString\',\n \'toString\',\n \'valueOf\'\n];\n\n\n/***/ },\n\n/***/ 6193\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar ENVIRONMENT = __webpack_require__(4215);\n\nmodule.exports = ENVIRONMENT === \'NODE\';\n\n\n/***/ },\n\n/***/ 2839\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar globalThis = __webpack_require__(4576);\n\nvar navigator = globalThis.navigator;\nvar userAgent = navigator && navigator.userAgent;\n\nmodule.exports = userAgent ? String(userAgent) : \'\';\n\n\n/***/ },\n\n/***/ 9519\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar globalThis = __webpack_require__(4576);\nvar userAgent = __webpack_require__(2839);\n\nvar process = globalThis.process;\nvar Deno = globalThis.Deno;\nvar versions = process && process.versions || Deno && Deno.version;\nvar v8 = versions && versions.v8;\nvar match, version;\n\nif (v8) {\n match = v8.split(\'.\');\n // in old Chrome, versions of V8 isn\'t V8 = Chrome / 10\n // but their correct versions are not interesting for us\n version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);\n}\n\n// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`\n// so check `userAgent` even if `.v8` exists, but 0\nif (!version && userAgent) {\n match = userAgent.match(/Edge\\/(\\d+)/);\n if (!match || match[1] >= 74) {\n match = userAgent.match(/Chrome\\/(\\d+)/);\n if (match) version = +match[1];\n }\n}\n\nmodule.exports = version;\n\n\n/***/ },\n\n/***/ 4215\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\n/* global Bun, Deno -- detection */\nvar globalThis = __webpack_require__(4576);\nvar userAgent = __webpack_require__(2839);\nvar classof = __webpack_require__(2195);\n\nvar userAgentStartsWith = function (string) {\n return userAgent.slice(0, string.length) === string;\n};\n\nmodule.exports = (function () {\n if (userAgentStartsWith(\'Bun/\')) return \'BUN\';\n if (userAgentStartsWith(\'Cloudflare-Workers\')) return \'CLOUDFLARE\';\n if (userAgentStartsWith(\'Deno/\')) return \'DENO\';\n if (userAgentStartsWith(\'Node.js/\')) return \'NODE\';\n if (globalThis.Bun && typeof Bun.version == \'string\') return \'BUN\';\n if (globalThis.Deno && typeof Deno.version == \'object\') return \'DENO\';\n if (classof(globalThis.process) === \'process\') return \'NODE\';\n if (globalThis.window && globalThis.document) return \'BROWSER\';\n return \'REST\';\n})();\n\n\n/***/ },\n\n/***/ 6518\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar globalThis = __webpack_require__(4576);\nvar getOwnPropertyDescriptor = (__webpack_require__(7347).f);\nvar createNonEnumerableProperty = __webpack_require__(6699);\nvar defineBuiltIn = __webpack_require__(6840);\nvar defineGlobalProperty = __webpack_require__(9433);\nvar copyConstructorProperties = __webpack_require__(7740);\nvar isForced = __webpack_require__(2796);\n\n/*\n options.target - name of the target object\n options.global - target is the global object\n options.stat - export as static methods of target\n options.proto - export as prototype methods of target\n options.real - real prototype method for the `pure` version\n options.forced - export even if the native feature is available\n options.bind - bind methods to the target, required for the `pure` version\n options.wrap - wrap constructors to preventing global pollution, required for the `pure` version\n options.unsafe - use the simple assignment of property instead of delete + defineProperty\n options.sham - add a flag to not completely full polyfills\n options.enumerable - export as enumerable property\n options.dontCallGetSet - prevent calling a getter on target\n options.name - the .name of the function if it does not match the key\n*/\nmodule.exports = function (options, source) {\n var TARGET = options.target;\n var GLOBAL = options.global;\n var STATIC = options.stat;\n var FORCED, target, key, targetProperty, sourceProperty, descriptor;\n if (GLOBAL) {\n target = globalThis;\n } else if (STATIC) {\n target = globalThis[TARGET] || defineGlobalProperty(TARGET, {});\n } else {\n target = globalThis[TARGET] && globalThis[TARGET].prototype;\n }\n if (target) for (key in source) {\n sourceProperty = source[key];\n if (options.dontCallGetSet) {\n descriptor = getOwnPropertyDescriptor(target, key);\n targetProperty = descriptor && descriptor.value;\n } else targetProperty = target[key];\n FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? \'.\' : \'#\') + key, options.forced);\n // contained in target\n if (!FORCED && targetProperty !== undefined) {\n if (typeof sourceProperty == typeof targetProperty) continue;\n copyConstructorProperties(sourceProperty, targetProperty);\n }\n // add a flag to not completely full polyfills\n if (options.sham || (targetProperty && targetProperty.sham)) {\n createNonEnumerableProperty(sourceProperty, \'sham\', true);\n }\n defineBuiltIn(target, key, sourceProperty, options);\n }\n};\n\n\n/***/ },\n\n/***/ 9039\n(module) {\n\n\nmodule.exports = function (exec) {\n try {\n return !!exec();\n } catch (error) {\n return true;\n }\n};\n\n\n/***/ },\n\n/***/ 8745\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar NATIVE_BIND = __webpack_require__(616);\n\nvar FunctionPrototype = Function.prototype;\nvar apply = FunctionPrototype.apply;\nvar call = FunctionPrototype.call;\n\n// eslint-disable-next-line es/no-function-prototype-bind, es/no-reflect -- safe\nmodule.exports = typeof Reflect == \'object\' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {\n return call.apply(apply, arguments);\n});\n\n\n/***/ },\n\n/***/ 6080\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(7476);\nvar aCallable = __webpack_require__(9306);\nvar NATIVE_BIND = __webpack_require__(616);\n\nvar bind = uncurryThis(uncurryThis.bind);\n\n// optional / simple context binding\nmodule.exports = function (fn, that) {\n aCallable(fn);\n return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n\n\n/***/ },\n\n/***/ 616\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar fails = __webpack_require__(9039);\n\nmodule.exports = !fails(function () {\n // eslint-disable-next-line es/no-function-prototype-bind -- safe\n var test = (function () { /* empty */ }).bind();\n // eslint-disable-next-line no-prototype-builtins -- safe\n return typeof test != \'function\' || test.hasOwnProperty(\'prototype\');\n});\n\n\n/***/ },\n\n/***/ 9565\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar NATIVE_BIND = __webpack_require__(616);\n\nvar call = Function.prototype.call;\n// eslint-disable-next-line es/no-function-prototype-bind -- safe\nmodule.exports = NATIVE_BIND ? call.bind(call) : function () {\n return call.apply(call, arguments);\n};\n\n\n/***/ },\n\n/***/ 350\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar DESCRIPTORS = __webpack_require__(3724);\nvar hasOwn = __webpack_require__(9297);\n\nvar FunctionPrototype = Function.prototype;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;\n\nvar EXISTS = hasOwn(FunctionPrototype, \'name\');\n// additional protection from minified / mangled / dropped function names\nvar PROPER = EXISTS && (function something() { /* empty */ }).name === \'something\';\nvar CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, \'name\').configurable));\n\nmodule.exports = {\n EXISTS: EXISTS,\n PROPER: PROPER,\n CONFIGURABLE: CONFIGURABLE\n};\n\n\n/***/ },\n\n/***/ 6706\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\nvar aCallable = __webpack_require__(9306);\n\nmodule.exports = function (object, key, method) {\n try {\n // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\n return uncurryThis(aCallable(Object.getOwnPropertyDescriptor(object, key)[method]));\n } catch (error) { /* empty */ }\n};\n\n\n/***/ },\n\n/***/ 7476\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar classofRaw = __webpack_require__(2195);\nvar uncurryThis = __webpack_require__(9504);\n\nmodule.exports = function (fn) {\n // Nashorn bug:\n // https://github.com/zloirock/core-js/issues/1128\n // https://github.com/zloirock/core-js/issues/1130\n if (classofRaw(fn) === \'Function\') return uncurryThis(fn);\n};\n\n\n/***/ },\n\n/***/ 9504\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar NATIVE_BIND = __webpack_require__(616);\n\nvar FunctionPrototype = Function.prototype;\nvar call = FunctionPrototype.call;\n// eslint-disable-next-line es/no-function-prototype-bind -- safe\nvar uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);\n\nmodule.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {\n return function () {\n return call.apply(fn, arguments);\n };\n};\n\n\n/***/ },\n\n/***/ 9429\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar globalThis = __webpack_require__(4576);\nvar IS_NODE = __webpack_require__(6193);\n\nmodule.exports = function (name) {\n if (IS_NODE) {\n try {\n return globalThis.process.getBuiltinModule(name);\n } catch (error) { /* empty */ }\n try {\n // eslint-disable-next-line no-new-func -- safe\n return Function(\'return require("\' + name + \'")\')();\n } catch (error) { /* empty */ }\n }\n};\n\n\n/***/ },\n\n/***/ 7751\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar globalThis = __webpack_require__(4576);\nvar isCallable = __webpack_require__(4901);\n\nvar aFunction = function (argument) {\n return isCallable(argument) ? argument : undefined;\n};\n\nmodule.exports = function (namespace, method) {\n return arguments.length < 2 ? aFunction(globalThis[namespace]) : globalThis[namespace] && globalThis[namespace][method];\n};\n\n\n/***/ },\n\n/***/ 1767\n(module) {\n\n\n// `GetIteratorDirect(obj)` abstract operation\n// https://tc39.es/ecma262/#sec-getiteratordirect\nmodule.exports = function (obj) {\n return {\n iterator: obj,\n next: obj.next,\n done: false\n };\n};\n\n\n/***/ },\n\n/***/ 851\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar classof = __webpack_require__(6955);\nvar getMethod = __webpack_require__(5966);\nvar isNullOrUndefined = __webpack_require__(4117);\nvar Iterators = __webpack_require__(6269);\nvar wellKnownSymbol = __webpack_require__(8227);\n\nvar ITERATOR = wellKnownSymbol(\'iterator\');\n\nmodule.exports = function (it) {\n if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR)\n || getMethod(it, \'@@iterator\')\n || Iterators[classof(it)];\n};\n\n\n/***/ },\n\n/***/ 81\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar call = __webpack_require__(9565);\nvar aCallable = __webpack_require__(9306);\nvar anObject = __webpack_require__(8551);\nvar tryToString = __webpack_require__(6823);\nvar getIteratorMethod = __webpack_require__(851);\n\nvar $TypeError = TypeError;\n\nmodule.exports = function (argument, usingIterator) {\n var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;\n if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));\n throw new $TypeError(tryToString(argument) + \' is not iterable\');\n};\n\n\n/***/ },\n\n/***/ 5966\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar aCallable = __webpack_require__(9306);\nvar isNullOrUndefined = __webpack_require__(4117);\n\n// `GetMethod` abstract operation\n// https://tc39.es/ecma262/#sec-getmethod\nmodule.exports = function (V, P) {\n var func = V[P];\n return isNullOrUndefined(func) ? undefined : aCallable(func);\n};\n\n\n/***/ },\n\n/***/ 3789\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar aCallable = __webpack_require__(9306);\nvar anObject = __webpack_require__(8551);\nvar call = __webpack_require__(9565);\nvar toIntegerOrInfinity = __webpack_require__(1291);\nvar getIteratorDirect = __webpack_require__(1767);\n\nvar INVALID_SIZE = \'Invalid size\';\nvar $RangeError = RangeError;\nvar $TypeError = TypeError;\nvar max = Math.max;\n\nvar SetRecord = function (set, intSize) {\n this.set = set;\n this.size = max(intSize, 0);\n this.has = aCallable(set.has);\n this.keys = aCallable(set.keys);\n};\n\nSetRecord.prototype = {\n getIterator: function () {\n return getIteratorDirect(anObject(call(this.keys, this.set)));\n },\n includes: function (it) {\n return call(this.has, this.set, it);\n }\n};\n\n// `GetSetRecord` abstract operation\n// https://tc39.es/proposal-set-methods/#sec-getsetrecord\nmodule.exports = function (obj) {\n anObject(obj);\n var numSize = +obj.size;\n // NOTE: If size is undefined, then numSize will be NaN\n // eslint-disable-next-line no-self-compare -- NaN check\n if (numSize !== numSize) throw new $TypeError(INVALID_SIZE);\n var intSize = toIntegerOrInfinity(numSize);\n if (intSize < 0) throw new $RangeError(INVALID_SIZE);\n return new SetRecord(obj, intSize);\n};\n\n\n/***/ },\n\n/***/ 4576\n(module) {\n\n\nvar check = function (it) {\n return it && it.Math === Math && it;\n};\n\n// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nmodule.exports =\n // eslint-disable-next-line es/no-global-this -- safe\n check(typeof globalThis == \'object\' && globalThis) ||\n check(typeof window == \'object\' && window) ||\n // eslint-disable-next-line no-restricted-globals -- safe\n check(typeof self == \'object\' && self) ||\n check(typeof global == \'object\' && global) ||\n check(typeof this == \'object\' && this) ||\n // eslint-disable-next-line no-new-func -- fallback\n (function () { return this; })() || Function(\'return this\')();\n\n\n/***/ },\n\n/***/ 9297\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\nvar toObject = __webpack_require__(8981);\n\nvar hasOwnProperty = uncurryThis({}.hasOwnProperty);\n\n// `HasOwnProperty` abstract operation\n// https://tc39.es/ecma262/#sec-hasownproperty\n// eslint-disable-next-line es/no-object-hasown -- safe\nmodule.exports = Object.hasOwn || function hasOwn(it, key) {\n return hasOwnProperty(toObject(it), key);\n};\n\n\n/***/ },\n\n/***/ 421\n(module) {\n\n\nmodule.exports = {};\n\n\n/***/ },\n\n/***/ 397\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar getBuiltIn = __webpack_require__(7751);\n\nmodule.exports = getBuiltIn(\'document\', \'documentElement\');\n\n\n/***/ },\n\n/***/ 5917\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar DESCRIPTORS = __webpack_require__(3724);\nvar fails = __webpack_require__(9039);\nvar createElement = __webpack_require__(4055);\n\n// Thanks to IE8 for its funny defineProperty\nmodule.exports = !DESCRIPTORS && !fails(function () {\n // eslint-disable-next-line es/no-object-defineproperty -- required for testing\n return Object.defineProperty(createElement(\'div\'), \'a\', {\n get: function () { return 7; }\n }).a !== 7;\n});\n\n\n/***/ },\n\n/***/ 7055\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\nvar fails = __webpack_require__(9039);\nvar classof = __webpack_require__(2195);\n\nvar $Object = Object;\nvar split = uncurryThis(\'\'.split);\n\n// fallback for non-array-like ES3 and non-enumerable old V8 strings\nmodule.exports = fails(function () {\n // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346\n // eslint-disable-next-line no-prototype-builtins -- safe\n return !$Object(\'z\').propertyIsEnumerable(0);\n}) ? function (it) {\n return classof(it) === \'String\' ? split(it, \'\') : $Object(it);\n} : $Object;\n\n\n/***/ },\n\n/***/ 3706\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\nvar isCallable = __webpack_require__(4901);\nvar store = __webpack_require__(7629);\n\nvar functionToString = uncurryThis(Function.toString);\n\n// this helper broken in `core-js@3.4.1-3.4.4`, so we can\'t use `shared` helper\nif (!isCallable(store.inspectSource)) {\n store.inspectSource = function (it) {\n return functionToString(it);\n };\n}\n\nmodule.exports = store.inspectSource;\n\n\n/***/ },\n\n/***/ 1181\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar NATIVE_WEAK_MAP = __webpack_require__(8622);\nvar globalThis = __webpack_require__(4576);\nvar isObject = __webpack_require__(34);\nvar createNonEnumerableProperty = __webpack_require__(6699);\nvar hasOwn = __webpack_require__(9297);\nvar shared = __webpack_require__(7629);\nvar sharedKey = __webpack_require__(6119);\nvar hiddenKeys = __webpack_require__(421);\n\nvar OBJECT_ALREADY_INITIALIZED = \'Object already initialized\';\nvar TypeError = globalThis.TypeError;\nvar WeakMap = globalThis.WeakMap;\nvar set, get, has;\n\nvar enforce = function (it) {\n return has(it) ? get(it) : set(it, {});\n};\n\nvar getterFor = function (TYPE) {\n return function (it) {\n var state;\n if (!isObject(it) || (state = get(it)).type !== TYPE) {\n throw new TypeError(\'Incompatible receiver, \' + TYPE + \' required\');\n } return state;\n };\n};\n\nif (NATIVE_WEAK_MAP || shared.state) {\n var store = shared.state || (shared.state = new WeakMap());\n /* eslint-disable no-self-assign -- prototype methods protection */\n store.get = store.get;\n store.has = store.has;\n store.set = store.set;\n /* eslint-enable no-self-assign -- prototype methods protection */\n set = function (it, metadata) {\n if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n store.set(it, metadata);\n return metadata;\n };\n get = function (it) {\n return store.get(it) || {};\n };\n has = function (it) {\n return store.has(it);\n };\n} else {\n var STATE = sharedKey(\'state\');\n hiddenKeys[STATE] = true;\n set = function (it, metadata) {\n if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n createNonEnumerableProperty(it, STATE, metadata);\n return metadata;\n };\n get = function (it) {\n return hasOwn(it, STATE) ? it[STATE] : {};\n };\n has = function (it) {\n return hasOwn(it, STATE);\n };\n}\n\nmodule.exports = {\n set: set,\n get: get,\n has: has,\n enforce: enforce,\n getterFor: getterFor\n};\n\n\n/***/ },\n\n/***/ 4209\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar wellKnownSymbol = __webpack_require__(8227);\nvar Iterators = __webpack_require__(6269);\n\nvar ITERATOR = wellKnownSymbol(\'iterator\');\nvar ArrayPrototype = Array.prototype;\n\n// check on default Array iterator\nmodule.exports = function (it) {\n return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);\n};\n\n\n/***/ },\n\n/***/ 4376\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar classof = __webpack_require__(2195);\n\n// `IsArray` abstract operation\n// https://tc39.es/ecma262/#sec-isarray\n// eslint-disable-next-line es/no-array-isarray -- safe\nmodule.exports = Array.isArray || function isArray(argument) {\n return classof(argument) === \'Array\';\n};\n\n\n/***/ },\n\n/***/ 1108\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar classof = __webpack_require__(6955);\n\nmodule.exports = function (it) {\n var klass = classof(it);\n return klass === \'BigInt64Array\' || klass === \'BigUint64Array\';\n};\n\n\n/***/ },\n\n/***/ 4901\n(module) {\n\n\n// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot\nvar documentAll = typeof document == \'object\' && document.all;\n\n// `IsCallable` abstract operation\n// https://tc39.es/ecma262/#sec-iscallable\n// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing\nmodule.exports = typeof documentAll == \'undefined\' && documentAll !== undefined ? function (argument) {\n return typeof argument == \'function\' || argument === documentAll;\n} : function (argument) {\n return typeof argument == \'function\';\n};\n\n\n/***/ },\n\n/***/ 2796\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar fails = __webpack_require__(9039);\nvar isCallable = __webpack_require__(4901);\n\nvar replacement = /#|\\.prototype\\./;\n\nvar isForced = function (feature, detection) {\n var value = data[normalize(feature)];\n return value === POLYFILL ? true\n : value === NATIVE ? false\n : isCallable(detection) ? fails(detection)\n : !!detection;\n};\n\nvar normalize = isForced.normalize = function (string) {\n return String(string).replace(replacement, \'.\').toLowerCase();\n};\n\nvar data = isForced.data = {};\nvar NATIVE = isForced.NATIVE = \'N\';\nvar POLYFILL = isForced.POLYFILL = \'P\';\n\nmodule.exports = isForced;\n\n\n/***/ },\n\n/***/ 4117\n(module) {\n\n\n// we can\'t use just `it == null` since of `document.all` special case\n// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec\nmodule.exports = function (it) {\n return it === null || it === undefined;\n};\n\n\n/***/ },\n\n/***/ 34\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar isCallable = __webpack_require__(4901);\n\nmodule.exports = function (it) {\n return typeof it == \'object\' ? it !== null : isCallable(it);\n};\n\n\n/***/ },\n\n/***/ 3925\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar isObject = __webpack_require__(34);\n\nmodule.exports = function (argument) {\n return isObject(argument) || argument === null;\n};\n\n\n/***/ },\n\n/***/ 6395\n(module) {\n\n\nmodule.exports = false;\n\n\n/***/ },\n\n/***/ 5810\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar isObject = __webpack_require__(34);\nvar getInternalState = (__webpack_require__(1181).get);\n\nmodule.exports = function isRawJSON(O) {\n if (!isObject(O)) return false;\n var state = getInternalState(O);\n return !!state && state.type === \'RawJSON\';\n};\n\n\n/***/ },\n\n/***/ 757\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar getBuiltIn = __webpack_require__(7751);\nvar isCallable = __webpack_require__(4901);\nvar isPrototypeOf = __webpack_require__(1625);\nvar USE_SYMBOL_AS_UID = __webpack_require__(7040);\n\nvar $Object = Object;\n\nmodule.exports = USE_SYMBOL_AS_UID ? function (it) {\n return typeof it == \'symbol\';\n} : function (it) {\n var $Symbol = getBuiltIn(\'Symbol\');\n return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));\n};\n\n\n/***/ },\n\n/***/ 507\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar call = __webpack_require__(9565);\n\nmodule.exports = function (record, fn, ITERATOR_INSTEAD_OF_RECORD) {\n var iterator = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator;\n var next = record.next;\n var step, result;\n while (!(step = call(next, iterator)).done) {\n result = fn(step.value);\n if (result !== undefined) return result;\n }\n};\n\n\n/***/ },\n\n/***/ 2652\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar bind = __webpack_require__(6080);\nvar call = __webpack_require__(9565);\nvar anObject = __webpack_require__(8551);\nvar tryToString = __webpack_require__(6823);\nvar isArrayIteratorMethod = __webpack_require__(4209);\nvar lengthOfArrayLike = __webpack_require__(6198);\nvar isPrototypeOf = __webpack_require__(1625);\nvar getIterator = __webpack_require__(81);\nvar getIteratorMethod = __webpack_require__(851);\nvar iteratorClose = __webpack_require__(9539);\n\nvar $TypeError = TypeError;\n\nvar Result = function (stopped, result) {\n this.stopped = stopped;\n this.result = result;\n};\n\nvar ResultPrototype = Result.prototype;\n\nmodule.exports = function (iterable, unboundFunction, options) {\n var that = options && options.that;\n var AS_ENTRIES = !!(options && options.AS_ENTRIES);\n var IS_RECORD = !!(options && options.IS_RECORD);\n var IS_ITERATOR = !!(options && options.IS_ITERATOR);\n var INTERRUPTED = !!(options && options.INTERRUPTED);\n var fn = bind(unboundFunction, that);\n var iterator, iterFn, index, length, result, next, step;\n\n var stop = function (condition) {\n if (iterator) iteratorClose(iterator, \'normal\');\n return new Result(true, condition);\n };\n\n var callFn = function (value) {\n if (AS_ENTRIES) {\n anObject(value);\n return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);\n } return INTERRUPTED ? fn(value, stop) : fn(value);\n };\n\n if (IS_RECORD) {\n iterator = iterable.iterator;\n } else if (IS_ITERATOR) {\n iterator = iterable;\n } else {\n iterFn = getIteratorMethod(iterable);\n if (!iterFn) throw new $TypeError(tryToString(iterable) + \' is not iterable\');\n // optimisation for array iterators\n if (isArrayIteratorMethod(iterFn)) {\n for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {\n result = callFn(iterable[index]);\n if (result && isPrototypeOf(ResultPrototype, result)) return result;\n } return new Result(false);\n }\n iterator = getIterator(iterable, iterFn);\n }\n\n next = IS_RECORD ? iterable.next : iterator.next;\n while (!(step = call(next, iterator)).done) {\n try {\n result = callFn(step.value);\n } catch (error) {\n iteratorClose(iterator, \'throw\', error);\n }\n if (typeof result == \'object\' && result && isPrototypeOf(ResultPrototype, result)) return result;\n } return new Result(false);\n};\n\n\n/***/ },\n\n/***/ 1385\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar iteratorClose = __webpack_require__(9539);\n\nmodule.exports = function (iters, kind, value) {\n for (var i = iters.length - 1; i >= 0; i--) {\n if (iters[i] === undefined) continue;\n try {\n value = iteratorClose(iters[i].iterator, kind, value);\n } catch (error) {\n kind = \'throw\';\n value = error;\n }\n }\n if (kind === \'throw\') throw value;\n return value;\n};\n\n\n/***/ },\n\n/***/ 9539\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar call = __webpack_require__(9565);\nvar anObject = __webpack_require__(8551);\nvar getMethod = __webpack_require__(5966);\n\nmodule.exports = function (iterator, kind, value) {\n var innerResult, innerError;\n anObject(iterator);\n try {\n innerResult = getMethod(iterator, \'return\');\n if (!innerResult) {\n if (kind === \'throw\') throw value;\n return value;\n }\n innerResult = call(innerResult, iterator);\n } catch (error) {\n innerError = true;\n innerResult = error;\n }\n if (kind === \'throw\') throw value;\n if (innerError) throw innerResult;\n anObject(innerResult);\n return value;\n};\n\n\n/***/ },\n\n/***/ 9462\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar call = __webpack_require__(9565);\nvar create = __webpack_require__(2360);\nvar createNonEnumerableProperty = __webpack_require__(6699);\nvar defineBuiltIns = __webpack_require__(6279);\nvar wellKnownSymbol = __webpack_require__(8227);\nvar InternalStateModule = __webpack_require__(1181);\nvar getMethod = __webpack_require__(5966);\nvar IteratorPrototype = (__webpack_require__(7657).IteratorPrototype);\nvar createIterResultObject = __webpack_require__(2529);\nvar iteratorClose = __webpack_require__(9539);\nvar iteratorCloseAll = __webpack_require__(1385);\n\nvar TO_STRING_TAG = wellKnownSymbol(\'toStringTag\');\nvar ITERATOR_HELPER = \'IteratorHelper\';\nvar WRAP_FOR_VALID_ITERATOR = \'WrapForValidIterator\';\nvar NORMAL = \'normal\';\nvar THROW = \'throw\';\nvar setInternalState = InternalStateModule.set;\n\nvar createIteratorProxyPrototype = function (IS_ITERATOR) {\n var getInternalState = InternalStateModule.getterFor(IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER);\n\n return defineBuiltIns(create(IteratorPrototype), {\n next: function next() {\n var state = getInternalState(this);\n // for simplification:\n // for `%WrapForValidIteratorPrototype%.next` or with `state.returnHandlerResult` our `nextHandler` returns `IterResultObject`\n // for `%IteratorHelperPrototype%.next` - just a value\n if (IS_ITERATOR) return state.nextHandler();\n if (state.done) return createIterResultObject(undefined, true);\n try {\n var result = state.nextHandler();\n return state.returnHandlerResult ? result : createIterResultObject(result, state.done);\n } catch (error) {\n state.done = true;\n throw error;\n }\n },\n \'return\': function () {\n var state = getInternalState(this);\n var iterator = state.iterator;\n state.done = true;\n if (IS_ITERATOR) {\n var returnMethod = getMethod(iterator, \'return\');\n return returnMethod ? call(returnMethod, iterator) : createIterResultObject(undefined, true);\n }\n if (state.inner) try {\n iteratorClose(state.inner.iterator, NORMAL);\n } catch (error) {\n return iteratorClose(iterator, THROW, error);\n }\n if (state.openIters) try {\n iteratorCloseAll(state.openIters, NORMAL);\n } catch (error) {\n return iteratorClose(iterator, THROW, error);\n }\n if (iterator) iteratorClose(iterator, NORMAL);\n return createIterResultObject(undefined, true);\n }\n });\n};\n\nvar WrapForValidIteratorPrototype = createIteratorProxyPrototype(true);\nvar IteratorHelperPrototype = createIteratorProxyPrototype(false);\n\ncreateNonEnumerableProperty(IteratorHelperPrototype, TO_STRING_TAG, \'Iterator Helper\');\n\nmodule.exports = function (nextHandler, IS_ITERATOR, RETURN_HANDLER_RESULT) {\n var IteratorProxy = function Iterator(record, state) {\n if (state) {\n state.iterator = record.iterator;\n state.next = record.next;\n } else state = record;\n state.type = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER;\n state.returnHandlerResult = !!RETURN_HANDLER_RESULT;\n state.nextHandler = nextHandler;\n state.counter = 0;\n state.done = false;\n setInternalState(this, state);\n };\n\n IteratorProxy.prototype = IS_ITERATOR ? WrapForValidIteratorPrototype : IteratorHelperPrototype;\n\n return IteratorProxy;\n};\n\n\n/***/ },\n\n/***/ 684\n(module) {\n\n\n// Should throw an error on invalid iterator\n// https://issues.chromium.org/issues/336839115\nmodule.exports = function (methodName, argument) {\n // eslint-disable-next-line es/no-iterator -- required for testing\n var method = typeof Iterator == \'function\' && Iterator.prototype[methodName];\n if (method) try {\n method.call({ next: null }, argument).next();\n } catch (error) {\n return true;\n }\n};\n\n\n/***/ },\n\n/***/ 4549\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar globalThis = __webpack_require__(4576);\n\n// https://github.com/tc39/ecma262/pull/3467\nmodule.exports = function (METHOD_NAME, ExpectedError) {\n var Iterator = globalThis.Iterator;\n var IteratorPrototype = Iterator && Iterator.prototype;\n var method = IteratorPrototype && IteratorPrototype[METHOD_NAME];\n\n var CLOSED = false;\n\n if (method) try {\n method.call({\n next: function () { return { done: true }; },\n \'return\': function () { CLOSED = true; }\n }, -1);\n } catch (error) {\n // https://bugs.webkit.org/show_bug.cgi?id=291195\n if (!(error instanceof ExpectedError)) CLOSED = false;\n }\n\n if (!CLOSED) return method;\n};\n\n\n/***/ },\n\n/***/ 7657\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar fails = __webpack_require__(9039);\nvar isCallable = __webpack_require__(4901);\nvar isObject = __webpack_require__(34);\nvar create = __webpack_require__(2360);\nvar getPrototypeOf = __webpack_require__(2787);\nvar defineBuiltIn = __webpack_require__(6840);\nvar wellKnownSymbol = __webpack_require__(8227);\nvar IS_PURE = __webpack_require__(6395);\n\nvar ITERATOR = wellKnownSymbol(\'iterator\');\nvar BUGGY_SAFARI_ITERATORS = false;\n\n// `%IteratorPrototype%` object\n// https://tc39.es/ecma262/#sec-%iteratorprototype%-object\nvar IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;\n\n/* eslint-disable es/no-array-prototype-keys -- safe */\nif ([].keys) {\n arrayIterator = [].keys();\n // Safari 8 has buggy iterators w/o `next`\n if (!(\'next\' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;\n else {\n PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));\n if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;\n }\n}\n\nvar NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () {\n var test = {};\n // FF44- legacy iterators case\n return IteratorPrototype[ITERATOR].call(test) !== test;\n});\n\nif (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};\nelse if (IS_PURE) IteratorPrototype = create(IteratorPrototype);\n\n// `%IteratorPrototype%[@@iterator]()` method\n// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator\nif (!isCallable(IteratorPrototype[ITERATOR])) {\n defineBuiltIn(IteratorPrototype, ITERATOR, function () {\n return this;\n });\n}\n\nmodule.exports = {\n IteratorPrototype: IteratorPrototype,\n BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS\n};\n\n\n/***/ },\n\n/***/ 6269\n(module) {\n\n\nmodule.exports = {};\n\n\n/***/ },\n\n/***/ 6198\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar toLength = __webpack_require__(8014);\n\n// `LengthOfArrayLike` abstract operation\n// https://tc39.es/ecma262/#sec-lengthofarraylike\nmodule.exports = function (obj) {\n return toLength(obj.length);\n};\n\n\n/***/ },\n\n/***/ 283\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\nvar fails = __webpack_require__(9039);\nvar isCallable = __webpack_require__(4901);\nvar hasOwn = __webpack_require__(9297);\nvar DESCRIPTORS = __webpack_require__(3724);\nvar CONFIGURABLE_FUNCTION_NAME = (__webpack_require__(350).CONFIGURABLE);\nvar inspectSource = __webpack_require__(3706);\nvar InternalStateModule = __webpack_require__(1181);\n\nvar enforceInternalState = InternalStateModule.enforce;\nvar getInternalState = InternalStateModule.get;\nvar $String = String;\n// eslint-disable-next-line es/no-object-defineproperty -- safe\nvar defineProperty = Object.defineProperty;\nvar stringSlice = uncurryThis(\'\'.slice);\nvar replace = uncurryThis(\'\'.replace);\nvar join = uncurryThis([].join);\n\nvar CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {\n return defineProperty(function () { /* empty */ }, \'length\', { value: 8 }).length !== 8;\n});\n\nvar TEMPLATE = String(String).split(\'String\');\n\nvar makeBuiltIn = module.exports = function (value, name, options) {\n if (stringSlice($String(name), 0, 7) === \'Symbol(\') {\n name = \'[\' + replace($String(name), /^Symbol\\(([^)]*)\\).*$/, \'$1\') + \']\';\n }\n if (options && options.getter) name = \'get \' + name;\n if (options && options.setter) name = \'set \' + name;\n if (!hasOwn(value, \'name\') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {\n if (DESCRIPTORS) defineProperty(value, \'name\', { value: name, configurable: true });\n else value.name = name;\n }\n if (CONFIGURABLE_LENGTH && options && hasOwn(options, \'arity\') && value.length !== options.arity) {\n defineProperty(value, \'length\', { value: options.arity });\n }\n try {\n if (options && hasOwn(options, \'constructor\') && options.constructor) {\n if (DESCRIPTORS) defineProperty(value, \'prototype\', { writable: false });\n // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable\n } else if (value.prototype) value.prototype = undefined;\n } catch (error) { /* empty */ }\n var state = enforceInternalState(value);\n if (!hasOwn(state, \'source\')) {\n state.source = join(TEMPLATE, typeof name == \'string\' ? name : \'\');\n } return value;\n};\n\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n// eslint-disable-next-line no-extend-native -- required\nFunction.prototype.toString = makeBuiltIn(function toString() {\n return isCallable(this) && getInternalState(this).source || inspectSource(this);\n}, \'toString\');\n\n\n/***/ },\n\n/***/ 2248\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\n\n// eslint-disable-next-line es/no-map -- safe\nvar MapPrototype = Map.prototype;\n\nmodule.exports = {\n // eslint-disable-next-line es/no-map -- safe\n Map: Map,\n set: uncurryThis(MapPrototype.set),\n get: uncurryThis(MapPrototype.get),\n has: uncurryThis(MapPrototype.has),\n remove: uncurryThis(MapPrototype[\'delete\']),\n proto: MapPrototype\n};\n\n\n/***/ },\n\n/***/ 741\n(module) {\n\n\nvar ceil = Math.ceil;\nvar floor = Math.floor;\n\n// `Math.trunc` method\n// https://tc39.es/ecma262/#sec-math.trunc\n// eslint-disable-next-line es/no-math-trunc -- safe\nmodule.exports = Math.trunc || function trunc(x) {\n var n = +x;\n return (n > 0 ? floor : ceil)(n);\n};\n\n\n/***/ },\n\n/***/ 7819\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\n/* eslint-disable es/no-json -- safe */\nvar fails = __webpack_require__(9039);\n\nmodule.exports = !fails(function () {\n var unsafeInt = \'9007199254740993\';\n // eslint-disable-next-line es/no-json-rawjson -- feature detection\n var raw = JSON.rawJSON(unsafeInt);\n // eslint-disable-next-line es/no-json-israwjson -- feature detection\n return !JSON.isRawJSON(raw) || JSON.stringify(raw) !== unsafeInt;\n});\n\n\n/***/ },\n\n/***/ 6043\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar aCallable = __webpack_require__(9306);\n\nvar $TypeError = TypeError;\n\nvar PromiseCapability = function (C) {\n var resolve, reject;\n this.promise = new C(function ($$resolve, $$reject) {\n if (resolve !== undefined || reject !== undefined) throw new $TypeError(\'Bad Promise constructor\');\n resolve = $$resolve;\n reject = $$reject;\n });\n this.resolve = aCallable(resolve);\n this.reject = aCallable(reject);\n};\n\n// `NewPromiseCapability` abstract operation\n// https://tc39.es/ecma262/#sec-newpromisecapability\nmodule.exports.f = function (C) {\n return new PromiseCapability(C);\n};\n\n\n/***/ },\n\n/***/ 2360\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\n/* global ActiveXObject -- old IE, WSH */\nvar anObject = __webpack_require__(8551);\nvar definePropertiesModule = __webpack_require__(6801);\nvar enumBugKeys = __webpack_require__(8727);\nvar hiddenKeys = __webpack_require__(421);\nvar html = __webpack_require__(397);\nvar documentCreateElement = __webpack_require__(4055);\nvar sharedKey = __webpack_require__(6119);\n\nvar GT = \'>\';\nvar LT = \'<\';\nvar PROTOTYPE = \'prototype\';\nvar SCRIPT = \'script\';\nvar IE_PROTO = sharedKey(\'IE_PROTO\');\n\nvar EmptyConstructor = function () { /* empty */ };\n\nvar scriptTag = function (content) {\n return LT + SCRIPT + GT + content + LT + \'/\' + SCRIPT + GT;\n};\n\n// Create object with fake `null` prototype: use ActiveX Object with cleared prototype\nvar NullProtoObjectViaActiveX = function (activeXDocument) {\n activeXDocument.write(scriptTag(\'\'));\n activeXDocument.close();\n var temp = activeXDocument.parentWindow.Object;\n // eslint-disable-next-line no-useless-assignment -- avoid memory leak\n activeXDocument = null;\n return temp;\n};\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar NullProtoObjectViaIFrame = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = documentCreateElement(\'iframe\');\n var JS = \'java\' + SCRIPT + \':\';\n var iframeDocument;\n iframe.style.display = \'none\';\n html.appendChild(iframe);\n // https://github.com/zloirock/core-js/issues/475\n iframe.src = String(JS);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(scriptTag(\'document.F=Object\'));\n iframeDocument.close();\n return iframeDocument.F;\n};\n\n// Check for document.domain and active x support\n// No need to use active x approach when document.domain is not set\n// see https://github.com/es-shims/es5-shim/issues/150\n// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346\n// avoid IE GC bug\nvar activeXDocument;\nvar NullProtoObject = function () {\n try {\n activeXDocument = new ActiveXObject(\'htmlfile\');\n } catch (error) { /* ignore */ }\n NullProtoObject = typeof document != \'undefined\'\n ? document.domain && activeXDocument\n ? NullProtoObjectViaActiveX(activeXDocument) // old IE\n : NullProtoObjectViaIFrame()\n : NullProtoObjectViaActiveX(activeXDocument); // WSH\n var length = enumBugKeys.length;\n while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];\n return NullProtoObject();\n};\n\nhiddenKeys[IE_PROTO] = true;\n\n// `Object.create` method\n// https://tc39.es/ecma262/#sec-object.create\n// eslint-disable-next-line es/no-object-create -- safe\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n EmptyConstructor[PROTOTYPE] = anObject(O);\n result = new EmptyConstructor();\n EmptyConstructor[PROTOTYPE] = null;\n // add "__proto__" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = NullProtoObject();\n return Properties === undefined ? result : definePropertiesModule.f(result, Properties);\n};\n\n\n/***/ },\n\n/***/ 6801\n(__unused_webpack_module, exports, __webpack_require__) {\n\n\nvar DESCRIPTORS = __webpack_require__(3724);\nvar V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(8686);\nvar definePropertyModule = __webpack_require__(4913);\nvar anObject = __webpack_require__(8551);\nvar toIndexedObject = __webpack_require__(5397);\nvar objectKeys = __webpack_require__(1072);\n\n// `Object.defineProperties` method\n// https://tc39.es/ecma262/#sec-object.defineproperties\n// eslint-disable-next-line es/no-object-defineproperties -- safe\nexports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var props = toIndexedObject(Properties);\n var keys = objectKeys(Properties);\n var length = keys.length;\n var index = 0;\n var key;\n while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);\n return O;\n};\n\n\n/***/ },\n\n/***/ 4913\n(__unused_webpack_module, exports, __webpack_require__) {\n\n\nvar DESCRIPTORS = __webpack_require__(3724);\nvar IE8_DOM_DEFINE = __webpack_require__(5917);\nvar V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(8686);\nvar anObject = __webpack_require__(8551);\nvar toPropertyKey = __webpack_require__(6969);\n\nvar $TypeError = TypeError;\n// eslint-disable-next-line es/no-object-defineproperty -- safe\nvar $defineProperty = Object.defineProperty;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar ENUMERABLE = \'enumerable\';\nvar CONFIGURABLE = \'configurable\';\nvar WRITABLE = \'writable\';\n\n// `Object.defineProperty` method\n// https://tc39.es/ecma262/#sec-object.defineproperty\nexports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPropertyKey(P);\n anObject(Attributes);\n if (typeof O === \'function\' && P === \'prototype\' && \'value\' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {\n var current = $getOwnPropertyDescriptor(O, P);\n if (current && current[WRITABLE]) {\n O[P] = Attributes.value;\n Attributes = {\n configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],\n enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],\n writable: false\n };\n }\n } return $defineProperty(O, P, Attributes);\n} : $defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPropertyKey(P);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return $defineProperty(O, P, Attributes);\n } catch (error) { /* empty */ }\n if (\'get\' in Attributes || \'set\' in Attributes) throw new $TypeError(\'Accessors not supported\');\n if (\'value\' in Attributes) O[P] = Attributes.value;\n return O;\n};\n\n\n/***/ },\n\n/***/ 7347\n(__unused_webpack_module, exports, __webpack_require__) {\n\n\nvar DESCRIPTORS = __webpack_require__(3724);\nvar call = __webpack_require__(9565);\nvar propertyIsEnumerableModule = __webpack_require__(8773);\nvar createPropertyDescriptor = __webpack_require__(6980);\nvar toIndexedObject = __webpack_require__(5397);\nvar toPropertyKey = __webpack_require__(6969);\nvar hasOwn = __webpack_require__(9297);\nvar IE8_DOM_DEFINE = __webpack_require__(5917);\n\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor\nexports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {\n O = toIndexedObject(O);\n P = toPropertyKey(P);\n if (IE8_DOM_DEFINE) try {\n return $getOwnPropertyDescriptor(O, P);\n } catch (error) { /* empty */ }\n if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);\n};\n\n\n/***/ },\n\n/***/ 8480\n(__unused_webpack_module, exports, __webpack_require__) {\n\n\nvar internalObjectKeys = __webpack_require__(1828);\nvar enumBugKeys = __webpack_require__(8727);\n\nvar hiddenKeys = enumBugKeys.concat(\'length\', \'prototype\');\n\n// `Object.getOwnPropertyNames` method\n// https://tc39.es/ecma262/#sec-object.getownpropertynames\n// eslint-disable-next-line es/no-object-getownpropertynames -- safe\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return internalObjectKeys(O, hiddenKeys);\n};\n\n\n/***/ },\n\n/***/ 3717\n(__unused_webpack_module, exports) {\n\n\n// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe\nexports.f = Object.getOwnPropertySymbols;\n\n\n/***/ },\n\n/***/ 2787\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar hasOwn = __webpack_require__(9297);\nvar isCallable = __webpack_require__(4901);\nvar toObject = __webpack_require__(8981);\nvar sharedKey = __webpack_require__(6119);\nvar CORRECT_PROTOTYPE_GETTER = __webpack_require__(2211);\n\nvar IE_PROTO = sharedKey(\'IE_PROTO\');\nvar $Object = Object;\nvar ObjectPrototype = $Object.prototype;\n\n// `Object.getPrototypeOf` method\n// https://tc39.es/ecma262/#sec-object.getprototypeof\n// eslint-disable-next-line es/no-object-getprototypeof -- safe\nmodule.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {\n var object = toObject(O);\n if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];\n var constructor = object.constructor;\n if (isCallable(constructor) && object instanceof constructor) {\n return constructor.prototype;\n } return object instanceof $Object ? ObjectPrototype : null;\n};\n\n\n/***/ },\n\n/***/ 1625\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\n\nmodule.exports = uncurryThis({}.isPrototypeOf);\n\n\n/***/ },\n\n/***/ 1828\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\nvar hasOwn = __webpack_require__(9297);\nvar toIndexedObject = __webpack_require__(5397);\nvar indexOf = (__webpack_require__(9617).indexOf);\nvar hiddenKeys = __webpack_require__(421);\n\nvar push = uncurryThis([].push);\n\nmodule.exports = function (object, names) {\n var O = toIndexedObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);\n // Don\'t enum bug & hidden keys\n while (names.length > i) if (hasOwn(O, key = names[i++])) {\n ~indexOf(result, key) || push(result, key);\n }\n return result;\n};\n\n\n/***/ },\n\n/***/ 1072\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar internalObjectKeys = __webpack_require__(1828);\nvar enumBugKeys = __webpack_require__(8727);\n\n// `Object.keys` method\n// https://tc39.es/ecma262/#sec-object.keys\n// eslint-disable-next-line es/no-object-keys -- safe\nmodule.exports = Object.keys || function keys(O) {\n return internalObjectKeys(O, enumBugKeys);\n};\n\n\n/***/ },\n\n/***/ 8773\n(__unused_webpack_module, exports) {\n\n\nvar $propertyIsEnumerable = {}.propertyIsEnumerable;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// Nashorn ~ JDK8 bug\nvar NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);\n\n// `Object.prototype.propertyIsEnumerable` method implementation\n// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable\nexports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {\n var descriptor = getOwnPropertyDescriptor(this, V);\n return !!descriptor && descriptor.enumerable;\n} : $propertyIsEnumerable;\n\n\n/***/ },\n\n/***/ 2967\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\n/* eslint-disable no-proto -- safe */\nvar uncurryThisAccessor = __webpack_require__(6706);\nvar isObject = __webpack_require__(34);\nvar requireObjectCoercible = __webpack_require__(7750);\nvar aPossiblePrototype = __webpack_require__(3506);\n\n// `Object.setPrototypeOf` method\n// https://tc39.es/ecma262/#sec-object.setprototypeof\n// Works with __proto__ only. Old v8 can\'t work with null proto objects.\n// eslint-disable-next-line es/no-object-setprototypeof -- safe\nmodule.exports = Object.setPrototypeOf || (\'__proto__\' in {} ? function () {\n var CORRECT_SETTER = false;\n var test = {};\n var setter;\n try {\n setter = uncurryThisAccessor(Object.prototype, \'__proto__\', \'set\');\n setter(test, []);\n CORRECT_SETTER = test instanceof Array;\n } catch (error) { /* empty */ }\n return function setPrototypeOf(O, proto) {\n requireObjectCoercible(O);\n aPossiblePrototype(proto);\n if (!isObject(O)) return O;\n if (CORRECT_SETTER) setter(O, proto);\n else O.__proto__ = proto;\n return O;\n };\n}() : undefined);\n\n\n/***/ },\n\n/***/ 4270\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar call = __webpack_require__(9565);\nvar isCallable = __webpack_require__(4901);\nvar isObject = __webpack_require__(34);\n\nvar $TypeError = TypeError;\n\n// `OrdinaryToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-ordinarytoprimitive\nmodule.exports = function (input, pref) {\n var fn, val;\n if (pref === \'string\' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;\n if (pref !== \'string\' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n throw new $TypeError("Can\'t convert object to primitive value");\n};\n\n\n/***/ },\n\n/***/ 5031\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar getBuiltIn = __webpack_require__(7751);\nvar uncurryThis = __webpack_require__(9504);\nvar getOwnPropertyNamesModule = __webpack_require__(8480);\nvar getOwnPropertySymbolsModule = __webpack_require__(3717);\nvar anObject = __webpack_require__(8551);\n\nvar concat = uncurryThis([].concat);\n\n// all object keys, includes non-enumerable and symbols\nmodule.exports = getBuiltIn(\'Reflect\', \'ownKeys\') || function ownKeys(it) {\n var keys = getOwnPropertyNamesModule.f(anObject(it));\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;\n};\n\n\n/***/ },\n\n/***/ 8235\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\nvar hasOwn = __webpack_require__(9297);\n\nvar $SyntaxError = SyntaxError;\nvar $parseInt = parseInt;\nvar fromCharCode = String.fromCharCode;\nvar at = uncurryThis(\'\'.charAt);\nvar slice = uncurryThis(\'\'.slice);\nvar exec = uncurryThis(/./.exec);\n\nvar codePoints = {\n \'\\\\"\': \'"\',\n \'\\\\\\\\\': \'\\\\\',\n \'\\\\/\': \'/\',\n \'\\\\b\': \'\\b\',\n \'\\\\f\': \'\\f\',\n \'\\\\n\': \'\\n\',\n \'\\\\r\': \'\\r\',\n \'\\\\t\': \'\\t\'\n};\n\nvar IS_4_HEX_DIGITS = /^[\\da-f]{4}$/i;\n// eslint-disable-next-line regexp/no-control-character -- safe\nvar IS_C0_CONTROL_CODE = /^[\\u0000-\\u001F]$/;\n\nmodule.exports = function (source, i) {\n var unterminated = true;\n var value = \'\';\n while (i < source.length) {\n var chr = at(source, i);\n if (chr === \'\\\\\') {\n var twoChars = slice(source, i, i + 2);\n if (hasOwn(codePoints, twoChars)) {\n value += codePoints[twoChars];\n i += 2;\n } else if (twoChars === \'\\\\u\') {\n i += 2;\n var fourHexDigits = slice(source, i, i + 4);\n if (!exec(IS_4_HEX_DIGITS, fourHexDigits)) throw new $SyntaxError(\'Bad Unicode escape at: \' + i);\n value += fromCharCode($parseInt(fourHexDigits, 16));\n i += 4;\n } else throw new $SyntaxError(\'Unknown escape sequence: "\' + twoChars + \'"\');\n } else if (chr === \'"\') {\n unterminated = false;\n i++;\n break;\n } else {\n if (exec(IS_C0_CONTROL_CODE, chr)) throw new $SyntaxError(\'Bad control character in string literal at: \' + i);\n value += chr;\n i++;\n }\n }\n if (unterminated) throw new $SyntaxError(\'Unterminated string at: \' + i);\n return { value: value, end: i };\n};\n\n\n/***/ },\n\n/***/ 7750\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar isNullOrUndefined = __webpack_require__(4117);\n\nvar $TypeError = TypeError;\n\n// `RequireObjectCoercible` abstract operation\n// https://tc39.es/ecma262/#sec-requireobjectcoercible\nmodule.exports = function (it) {\n if (isNullOrUndefined(it)) throw new $TypeError("Can\'t call method on " + it);\n return it;\n};\n\n\n/***/ },\n\n/***/ 9286\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar SetHelpers = __webpack_require__(4402);\nvar iterate = __webpack_require__(8469);\n\nvar Set = SetHelpers.Set;\nvar add = SetHelpers.add;\n\nmodule.exports = function (set) {\n var result = new Set();\n iterate(set, function (it) {\n add(result, it);\n });\n return result;\n};\n\n\n/***/ },\n\n/***/ 3440\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar aSet = __webpack_require__(7080);\nvar SetHelpers = __webpack_require__(4402);\nvar clone = __webpack_require__(9286);\nvar size = __webpack_require__(5170);\nvar getSetRecord = __webpack_require__(3789);\nvar iterateSet = __webpack_require__(8469);\nvar iterateSimple = __webpack_require__(507);\n\nvar has = SetHelpers.has;\nvar remove = SetHelpers.remove;\n\n// `Set.prototype.difference` method\n// https://tc39.es/ecma262/#sec-set.prototype.difference\nmodule.exports = function difference(other) {\n var O = aSet(this);\n var otherRec = getSetRecord(other);\n var result = clone(O);\n if (size(O) <= otherRec.size) iterateSet(O, function (e) {\n if (otherRec.includes(e)) remove(result, e);\n });\n else iterateSimple(otherRec.getIterator(), function (e) {\n if (has(result, e)) remove(result, e);\n });\n return result;\n};\n\n\n/***/ },\n\n/***/ 4402\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\n\n// eslint-disable-next-line es/no-set -- safe\nvar SetPrototype = Set.prototype;\n\nmodule.exports = {\n // eslint-disable-next-line es/no-set -- safe\n Set: Set,\n add: uncurryThis(SetPrototype.add),\n has: uncurryThis(SetPrototype.has),\n remove: uncurryThis(SetPrototype[\'delete\']),\n proto: SetPrototype\n};\n\n\n/***/ },\n\n/***/ 8750\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar aSet = __webpack_require__(7080);\nvar SetHelpers = __webpack_require__(4402);\nvar size = __webpack_require__(5170);\nvar getSetRecord = __webpack_require__(3789);\nvar iterateSet = __webpack_require__(8469);\nvar iterateSimple = __webpack_require__(507);\n\nvar Set = SetHelpers.Set;\nvar add = SetHelpers.add;\nvar has = SetHelpers.has;\n\n// `Set.prototype.intersection` method\n// https://tc39.es/ecma262/#sec-set.prototype.intersection\nmodule.exports = function intersection(other) {\n var O = aSet(this);\n var otherRec = getSetRecord(other);\n var result = new Set();\n\n if (size(O) > otherRec.size) {\n iterateSimple(otherRec.getIterator(), function (e) {\n if (has(O, e)) add(result, e);\n });\n } else {\n iterateSet(O, function (e) {\n if (otherRec.includes(e)) add(result, e);\n });\n }\n\n return result;\n};\n\n\n/***/ },\n\n/***/ 4449\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar aSet = __webpack_require__(7080);\nvar has = (__webpack_require__(4402).has);\nvar size = __webpack_require__(5170);\nvar getSetRecord = __webpack_require__(3789);\nvar iterateSet = __webpack_require__(8469);\nvar iterateSimple = __webpack_require__(507);\nvar iteratorClose = __webpack_require__(9539);\n\n// `Set.prototype.isDisjointFrom` method\n// https://tc39.es/ecma262/#sec-set.prototype.isdisjointfrom\nmodule.exports = function isDisjointFrom(other) {\n var O = aSet(this);\n var otherRec = getSetRecord(other);\n if (size(O) <= otherRec.size) return iterateSet(O, function (e) {\n if (otherRec.includes(e)) return false;\n }, true) !== false;\n var iterator = otherRec.getIterator();\n return iterateSimple(iterator, function (e) {\n if (has(O, e)) return iteratorClose(iterator, \'normal\', false);\n }) !== false;\n};\n\n\n/***/ },\n\n/***/ 3838\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar aSet = __webpack_require__(7080);\nvar size = __webpack_require__(5170);\nvar iterate = __webpack_require__(8469);\nvar getSetRecord = __webpack_require__(3789);\n\n// `Set.prototype.isSubsetOf` method\n// https://tc39.es/ecma262/#sec-set.prototype.issubsetof\nmodule.exports = function isSubsetOf(other) {\n var O = aSet(this);\n var otherRec = getSetRecord(other);\n if (size(O) > otherRec.size) return false;\n return iterate(O, function (e) {\n if (!otherRec.includes(e)) return false;\n }, true) !== false;\n};\n\n\n/***/ },\n\n/***/ 8527\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar aSet = __webpack_require__(7080);\nvar has = (__webpack_require__(4402).has);\nvar size = __webpack_require__(5170);\nvar getSetRecord = __webpack_require__(3789);\nvar iterateSimple = __webpack_require__(507);\nvar iteratorClose = __webpack_require__(9539);\n\n// `Set.prototype.isSupersetOf` method\n// https://tc39.es/ecma262/#sec-set.prototype.issupersetof\nmodule.exports = function isSupersetOf(other) {\n var O = aSet(this);\n var otherRec = getSetRecord(other);\n if (size(O) < otherRec.size) return false;\n var iterator = otherRec.getIterator();\n return iterateSimple(iterator, function (e) {\n if (!has(O, e)) return iteratorClose(iterator, \'normal\', false);\n }) !== false;\n};\n\n\n/***/ },\n\n/***/ 8469\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\nvar iterateSimple = __webpack_require__(507);\nvar SetHelpers = __webpack_require__(4402);\n\nvar Set = SetHelpers.Set;\nvar SetPrototype = SetHelpers.proto;\nvar forEach = uncurryThis(SetPrototype.forEach);\nvar keys = uncurryThis(SetPrototype.keys);\nvar next = keys(new Set()).next;\n\nmodule.exports = function (set, fn, interruptible) {\n return interruptible ? iterateSimple({ iterator: keys(set), next: next }, fn) : forEach(set, fn);\n};\n\n\n/***/ },\n\n/***/ 4916\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar getBuiltIn = __webpack_require__(7751);\n\nvar createSetLike = function (size) {\n return {\n size: size,\n has: function () {\n return false;\n },\n keys: function () {\n return {\n next: function () {\n return { done: true };\n }\n };\n }\n };\n};\n\nvar createSetLikeWithInfinitySize = function (size) {\n return {\n size: size,\n has: function () {\n return true;\n },\n keys: function () {\n throw new Error(\'e\');\n }\n };\n};\n\nmodule.exports = function (name, callback) {\n var Set = getBuiltIn(\'Set\');\n try {\n new Set()[name](createSetLike(0));\n try {\n // late spec change, early WebKit ~ Safari 17 implementation does not pass it\n // https://github.com/tc39/proposal-set-methods/pull/88\n // also covered engines with\n // https://bugs.webkit.org/show_bug.cgi?id=272679\n new Set()[name](createSetLike(-1));\n return false;\n } catch (error2) {\n if (!callback) return true;\n // early V8 implementation bug\n // https://issues.chromium.org/issues/351332634\n try {\n new Set()[name](createSetLikeWithInfinitySize(-Infinity));\n return false;\n } catch (error) {\n var set = new Set([1, 2]);\n return callback(set[name](createSetLikeWithInfinitySize(Infinity)));\n }\n }\n } catch (error) {\n return false;\n }\n};\n\n\n/***/ },\n\n/***/ 9835\n(module) {\n\n\n// Should get iterator record of a set-like object before cloning this\n// https://bugs.webkit.org/show_bug.cgi?id=289430\nmodule.exports = function (METHOD_NAME) {\n try {\n // eslint-disable-next-line es/no-set -- needed for test\n var baseSet = new Set();\n var setLike = {\n size: 0,\n has: function () { return true; },\n keys: function () {\n // eslint-disable-next-line es/no-object-defineproperty -- needed for test\n return Object.defineProperty({}, \'next\', {\n get: function () {\n baseSet.clear();\n baseSet.add(4);\n return function () {\n return { done: true };\n };\n }\n });\n }\n };\n var result = baseSet[METHOD_NAME](setLike);\n\n return result.size === 1 && result.values().next().value === 4;\n } catch (error) {\n return false;\n }\n};\n\n\n/***/ },\n\n/***/ 5170\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThisAccessor = __webpack_require__(6706);\nvar SetHelpers = __webpack_require__(4402);\n\nmodule.exports = uncurryThisAccessor(SetHelpers.proto, \'size\', \'get\') || function (set) {\n return set.size;\n};\n\n\n/***/ },\n\n/***/ 3650\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar aSet = __webpack_require__(7080);\nvar SetHelpers = __webpack_require__(4402);\nvar clone = __webpack_require__(9286);\nvar getSetRecord = __webpack_require__(3789);\nvar iterateSimple = __webpack_require__(507);\n\nvar add = SetHelpers.add;\nvar has = SetHelpers.has;\nvar remove = SetHelpers.remove;\n\n// `Set.prototype.symmetricDifference` method\n// https://tc39.es/ecma262/#sec-set.prototype.symmetricdifference\nmodule.exports = function symmetricDifference(other) {\n var O = aSet(this);\n var keysIter = getSetRecord(other).getIterator();\n var result = clone(O);\n iterateSimple(keysIter, function (e) {\n if (has(O, e)) remove(result, e);\n else add(result, e);\n });\n return result;\n};\n\n\n/***/ },\n\n/***/ 4204\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar aSet = __webpack_require__(7080);\nvar add = (__webpack_require__(4402).add);\nvar clone = __webpack_require__(9286);\nvar getSetRecord = __webpack_require__(3789);\nvar iterateSimple = __webpack_require__(507);\n\n// `Set.prototype.union` method\n// https://tc39.es/ecma262/#sec-set.prototype.union\nmodule.exports = function union(other) {\n var O = aSet(this);\n var keysIter = getSetRecord(other).getIterator();\n var result = clone(O);\n iterateSimple(keysIter, function (it) {\n add(result, it);\n });\n return result;\n};\n\n\n/***/ },\n\n/***/ 6119\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar shared = __webpack_require__(5745);\nvar uid = __webpack_require__(3392);\n\nvar keys = shared(\'keys\');\n\nmodule.exports = function (key) {\n return keys[key] || (keys[key] = uid(key));\n};\n\n\n/***/ },\n\n/***/ 7629\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar IS_PURE = __webpack_require__(6395);\nvar globalThis = __webpack_require__(4576);\nvar defineGlobalProperty = __webpack_require__(9433);\n\nvar SHARED = \'__core-js_shared__\';\nvar store = module.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});\n\n(store.versions || (store.versions = [])).push({\n version: \'3.48.0\',\n mode: IS_PURE ? \'pure\' : \'global\',\n copyright: \'© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.\',\n license: \'https://github.com/zloirock/core-js/blob/v3.48.0/LICENSE\',\n source: \'https://github.com/zloirock/core-js\'\n});\n\n\n/***/ },\n\n/***/ 5745\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar store = __webpack_require__(7629);\n\nmodule.exports = function (key, value) {\n return store[key] || (store[key] = value || {});\n};\n\n\n/***/ },\n\n/***/ 533\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\nvar toLength = __webpack_require__(8014);\nvar toString = __webpack_require__(655);\nvar $repeat = __webpack_require__(2333);\nvar requireObjectCoercible = __webpack_require__(7750);\n\nvar repeat = uncurryThis($repeat);\nvar stringSlice = uncurryThis(\'\'.slice);\nvar ceil = Math.ceil;\n\n// `String.prototype.{ padStart, padEnd }` methods implementation\nvar createMethod = function (IS_END) {\n return function ($this, maxLength, fillString) {\n var S = toString(requireObjectCoercible($this));\n var intMaxLength = toLength(maxLength);\n var stringLength = S.length;\n var fillStr = fillString === undefined ? \' \' : toString(fillString);\n var fillLen, stringFiller;\n if (intMaxLength <= stringLength || fillStr === \'\') return S;\n fillLen = intMaxLength - stringLength;\n stringFiller = repeat(fillStr, ceil(fillLen / fillStr.length));\n if (stringFiller.length > fillLen) stringFiller = stringSlice(stringFiller, 0, fillLen);\n return IS_END ? S + stringFiller : stringFiller + S;\n };\n};\n\nmodule.exports = {\n // `String.prototype.padStart` method\n // https://tc39.es/ecma262/#sec-string.prototype.padstart\n start: createMethod(false),\n // `String.prototype.padEnd` method\n // https://tc39.es/ecma262/#sec-string.prototype.padend\n end: createMethod(true)\n};\n\n\n/***/ },\n\n/***/ 2333\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar toIntegerOrInfinity = __webpack_require__(1291);\nvar toString = __webpack_require__(655);\nvar requireObjectCoercible = __webpack_require__(7750);\n\nvar $RangeError = RangeError;\n\n// `String.prototype.repeat` method implementation\n// https://tc39.es/ecma262/#sec-string.prototype.repeat\nmodule.exports = function repeat(count) {\n var str = toString(requireObjectCoercible(this));\n var result = \'\';\n var n = toIntegerOrInfinity(count);\n if (n < 0 || n === Infinity) throw new $RangeError(\'Wrong number of repetitions\');\n for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;\n return result;\n};\n\n\n/***/ },\n\n/***/ 1548\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar globalThis = __webpack_require__(4576);\nvar fails = __webpack_require__(9039);\nvar V8 = __webpack_require__(9519);\nvar ENVIRONMENT = __webpack_require__(4215);\n\nvar structuredClone = globalThis.structuredClone;\n\nmodule.exports = !!structuredClone && !fails(function () {\n // prevent V8 ArrayBufferDetaching protector cell invalidation and performance degradation\n // https://github.com/zloirock/core-js/issues/679\n if ((ENVIRONMENT === \'DENO\' && V8 > 92) || (ENVIRONMENT === \'NODE\' && V8 > 94) || (ENVIRONMENT === \'BROWSER\' && V8 > 97)) return false;\n var buffer = new ArrayBuffer(8);\n var clone = structuredClone(buffer, { transfer: [buffer] });\n return buffer.byteLength !== 0 || clone.byteLength !== 8;\n});\n\n\n/***/ },\n\n/***/ 4495\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\n/* eslint-disable es/no-symbol -- required for testing */\nvar V8_VERSION = __webpack_require__(9519);\nvar fails = __webpack_require__(9039);\nvar globalThis = __webpack_require__(4576);\n\nvar $String = globalThis.String;\n\n// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing\nmodule.exports = !!Object.getOwnPropertySymbols && !fails(function () {\n var symbol = Symbol(\'symbol detection\');\n // Chrome 38 Symbol has incorrect toString conversion\n // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances\n // nb: Do not call `String` directly to avoid this being optimized out to `symbol+\'\'` which will,\n // of course, fail.\n return !$String(symbol) || !(Object(symbol) instanceof Symbol) ||\n // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances\n !Symbol.sham && V8_VERSION && V8_VERSION < 41;\n});\n\n\n/***/ },\n\n/***/ 5610\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar toIntegerOrInfinity = __webpack_require__(1291);\n\nvar max = Math.max;\nvar min = Math.min;\n\n// Helper for a popular repeating case of the spec:\n// Let integer be ? ToInteger(index).\n// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).\nmodule.exports = function (index, length) {\n var integer = toIntegerOrInfinity(index);\n return integer < 0 ? max(integer + length, 0) : min(integer, length);\n};\n\n\n/***/ },\n\n/***/ 5854\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar toPrimitive = __webpack_require__(2777);\n\nvar $TypeError = TypeError;\n\n// `ToBigInt` abstract operation\n// https://tc39.es/ecma262/#sec-tobigint\nmodule.exports = function (argument) {\n var prim = toPrimitive(argument, \'number\');\n if (typeof prim == \'number\') throw new $TypeError("Can\'t convert number to bigint");\n // eslint-disable-next-line es/no-bigint -- safe\n return BigInt(prim);\n};\n\n\n/***/ },\n\n/***/ 7696\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar toIntegerOrInfinity = __webpack_require__(1291);\nvar toLength = __webpack_require__(8014);\n\nvar $RangeError = RangeError;\n\n// `ToIndex` abstract operation\n// https://tc39.es/ecma262/#sec-toindex\nmodule.exports = function (it) {\n if (it === undefined) return 0;\n var number = toIntegerOrInfinity(it);\n var length = toLength(number);\n if (number !== length) throw new $RangeError(\'Wrong length or index\');\n return length;\n};\n\n\n/***/ },\n\n/***/ 5397\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\n// toObject with fallback for non-array-like ES3 strings\nvar IndexedObject = __webpack_require__(7055);\nvar requireObjectCoercible = __webpack_require__(7750);\n\nmodule.exports = function (it) {\n return IndexedObject(requireObjectCoercible(it));\n};\n\n\n/***/ },\n\n/***/ 1291\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar trunc = __webpack_require__(741);\n\n// `ToIntegerOrInfinity` abstract operation\n// https://tc39.es/ecma262/#sec-tointegerorinfinity\nmodule.exports = function (argument) {\n var number = +argument;\n // eslint-disable-next-line no-self-compare -- NaN check\n return number !== number || number === 0 ? 0 : trunc(number);\n};\n\n\n/***/ },\n\n/***/ 8014\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar toIntegerOrInfinity = __webpack_require__(1291);\n\nvar min = Math.min;\n\n// `ToLength` abstract operation\n// https://tc39.es/ecma262/#sec-tolength\nmodule.exports = function (argument) {\n var len = toIntegerOrInfinity(argument);\n return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991\n};\n\n\n/***/ },\n\n/***/ 8981\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar requireObjectCoercible = __webpack_require__(7750);\n\nvar $Object = Object;\n\n// `ToObject` abstract operation\n// https://tc39.es/ecma262/#sec-toobject\nmodule.exports = function (argument) {\n return $Object(requireObjectCoercible(argument));\n};\n\n\n/***/ },\n\n/***/ 2777\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar call = __webpack_require__(9565);\nvar isObject = __webpack_require__(34);\nvar isSymbol = __webpack_require__(757);\nvar getMethod = __webpack_require__(5966);\nvar ordinaryToPrimitive = __webpack_require__(4270);\nvar wellKnownSymbol = __webpack_require__(8227);\n\nvar $TypeError = TypeError;\nvar TO_PRIMITIVE = wellKnownSymbol(\'toPrimitive\');\n\n// `ToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-toprimitive\nmodule.exports = function (input, pref) {\n if (!isObject(input) || isSymbol(input)) return input;\n var exoticToPrim = getMethod(input, TO_PRIMITIVE);\n var result;\n if (exoticToPrim) {\n if (pref === undefined) pref = \'default\';\n result = call(exoticToPrim, input, pref);\n if (!isObject(result) || isSymbol(result)) return result;\n throw new $TypeError("Can\'t convert object to primitive value");\n }\n if (pref === undefined) pref = \'number\';\n return ordinaryToPrimitive(input, pref);\n};\n\n\n/***/ },\n\n/***/ 6969\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar toPrimitive = __webpack_require__(2777);\nvar isSymbol = __webpack_require__(757);\n\n// `ToPropertyKey` abstract operation\n// https://tc39.es/ecma262/#sec-topropertykey\nmodule.exports = function (argument) {\n var key = toPrimitive(argument, \'string\');\n return isSymbol(key) ? key : key + \'\';\n};\n\n\n/***/ },\n\n/***/ 2140\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar wellKnownSymbol = __webpack_require__(8227);\n\nvar TO_STRING_TAG = wellKnownSymbol(\'toStringTag\');\nvar test = {};\n// eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation\ntest[TO_STRING_TAG] = \'z\';\n\nmodule.exports = String(test) === \'[object z]\';\n\n\n/***/ },\n\n/***/ 655\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar classof = __webpack_require__(6955);\n\nvar $String = String;\n\nmodule.exports = function (argument) {\n if (classof(argument) === \'Symbol\') throw new TypeError(\'Cannot convert a Symbol value to a string\');\n return $String(argument);\n};\n\n\n/***/ },\n\n/***/ 6823\n(module) {\n\n\nvar $String = String;\n\nmodule.exports = function (argument) {\n try {\n return $String(argument);\n } catch (error) {\n return \'Object\';\n }\n};\n\n\n/***/ },\n\n/***/ 3392\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\n\nvar id = 0;\nvar postfix = Math.random();\nvar toString = uncurryThis(1.1.toString);\n\nmodule.exports = function (key) {\n return \'Symbol(\' + (key === undefined ? \'\' : key) + \')_\' + toString(++id + postfix, 36);\n};\n\n\n/***/ },\n\n/***/ 7416\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar fails = __webpack_require__(9039);\nvar wellKnownSymbol = __webpack_require__(8227);\nvar DESCRIPTORS = __webpack_require__(3724);\nvar IS_PURE = __webpack_require__(6395);\n\nvar ITERATOR = wellKnownSymbol(\'iterator\');\n\nmodule.exports = !fails(function () {\n // eslint-disable-next-line unicorn/relative-url-style -- required for testing\n var url = new URL(\'b?a=1&b=2&c=3\', \'https://a\');\n var params = url.searchParams;\n var params2 = new URLSearchParams(\'a=1&a=2&b=3\');\n var result = \'\';\n url.pathname = \'c%20d\';\n params.forEach(function (value, key) {\n params[\'delete\'](\'b\');\n result += key + value;\n });\n params2[\'delete\'](\'a\', 2);\n // `undefined` case is a Chromium 117 bug\n // https://bugs.chromium.org/p/v8/issues/detail?id=14222\n params2[\'delete\'](\'b\', undefined);\n return (IS_PURE && (!url.toJSON || !params2.has(\'a\', 1) || params2.has(\'a\', 2) || !params2.has(\'a\', undefined) || params2.has(\'b\')))\n || (!params.size && (IS_PURE || !DESCRIPTORS))\n || !params.sort\n || url.href !== \'https://a/c%20d?a=1&c=3\'\n || params.get(\'c\') !== \'3\'\n || String(new URLSearchParams(\'?a=1\')) !== \'a=1\'\n || !params[ITERATOR]\n // throws in Edge\n || new URL(\'https://a@b\').username !== \'a\'\n || new URLSearchParams(new URLSearchParams(\'a=b\')).get(\'a\') !== \'b\'\n // not punycoded in Edge\n || new URL(\'https://тест\').host !== \'xn--e1aybc\'\n // not escaped in Chrome 62-\n || new URL(\'https://a#б\').hash !== \'#%D0%B1\'\n // fails in Chrome 66-\n || result !== \'a1c3\'\n // throws in Safari\n || new URL(\'https://x\', undefined).host !== \'x\';\n});\n\n\n/***/ },\n\n/***/ 7040\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\n/* eslint-disable es/no-symbol -- required for testing */\nvar NATIVE_SYMBOL = __webpack_require__(4495);\n\nmodule.exports = NATIVE_SYMBOL &&\n !Symbol.sham &&\n typeof Symbol.iterator == \'symbol\';\n\n\n/***/ },\n\n/***/ 8686\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar DESCRIPTORS = __webpack_require__(3724);\nvar fails = __webpack_require__(9039);\n\n// V8 ~ Chrome 36-\n// https://bugs.chromium.org/p/v8/issues/detail?id=3334\nmodule.exports = DESCRIPTORS && fails(function () {\n // eslint-disable-next-line es/no-object-defineproperty -- required for testing\n return Object.defineProperty(function () { /* empty */ }, \'prototype\', {\n value: 42,\n writable: false\n }).prototype !== 42;\n});\n\n\n/***/ },\n\n/***/ 2812\n(module) {\n\n\nvar $TypeError = TypeError;\n\nmodule.exports = function (passed, required) {\n if (passed < required) throw new $TypeError(\'Not enough arguments\');\n return passed;\n};\n\n\n/***/ },\n\n/***/ 8622\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar globalThis = __webpack_require__(4576);\nvar isCallable = __webpack_require__(4901);\n\nvar WeakMap = globalThis.WeakMap;\n\nmodule.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));\n\n\n/***/ },\n\n/***/ 4995\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar uncurryThis = __webpack_require__(9504);\n\n// eslint-disable-next-line es/no-weak-map -- safe\nvar WeakMapPrototype = WeakMap.prototype;\n\nmodule.exports = {\n // eslint-disable-next-line es/no-weak-map -- safe\n WeakMap: WeakMap,\n set: uncurryThis(WeakMapPrototype.set),\n get: uncurryThis(WeakMapPrototype.get),\n has: uncurryThis(WeakMapPrototype.has),\n remove: uncurryThis(WeakMapPrototype[\'delete\'])\n};\n\n\n/***/ },\n\n/***/ 8227\n(module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar globalThis = __webpack_require__(4576);\nvar shared = __webpack_require__(5745);\nvar hasOwn = __webpack_require__(9297);\nvar uid = __webpack_require__(3392);\nvar NATIVE_SYMBOL = __webpack_require__(4495);\nvar USE_SYMBOL_AS_UID = __webpack_require__(7040);\n\nvar Symbol = globalThis.Symbol;\nvar WellKnownSymbolsStore = shared(\'wks\');\nvar createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol[\'for\'] || Symbol : Symbol && Symbol.withoutSetter || uid;\n\nmodule.exports = function (name) {\n if (!hasOwn(WellKnownSymbolsStore, name)) {\n WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name)\n ? Symbol[name]\n : createWellKnownSymbol(\'Symbol.\' + name);\n } return WellKnownSymbolsStore[name];\n};\n\n\n/***/ },\n\n/***/ 7452\n(module) {\n\n\n// a string of all valid unicode whitespaces\nmodule.exports = \'\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u00A0\\u1680\\u2000\\u2001\\u2002\' +\n \'\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF\';\n\n\n/***/ },\n\n/***/ 6573\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar DESCRIPTORS = __webpack_require__(3724);\nvar defineBuiltInAccessor = __webpack_require__(2106);\nvar isDetached = __webpack_require__(3238);\n\nvar ArrayBufferPrototype = ArrayBuffer.prototype;\n\n// `ArrayBuffer.prototype.detached` getter\n// https://tc39.es/ecma262/#sec-get-arraybuffer.prototype.detached\nif (DESCRIPTORS && !(\'detached\' in ArrayBufferPrototype)) {\n defineBuiltInAccessor(ArrayBufferPrototype, \'detached\', {\n configurable: true,\n get: function detached() {\n return isDetached(this);\n }\n });\n}\n\n\n/***/ },\n\n/***/ 7936\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar $transfer = __webpack_require__(5636);\n\n// `ArrayBuffer.prototype.transferToFixedLength` method\n// https://tc39.es/ecma262/#sec-arraybuffer.prototype.transfertofixedlength\nif ($transfer) $({ target: \'ArrayBuffer\', proto: true }, {\n transferToFixedLength: function transferToFixedLength() {\n return $transfer(this, arguments.length ? arguments[0] : undefined, false);\n }\n});\n\n\n/***/ },\n\n/***/ 8100\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar $transfer = __webpack_require__(5636);\n\n// `ArrayBuffer.prototype.transfer` method\n// https://tc39.es/ecma262/#sec-arraybuffer.prototype.transfer\nif ($transfer) $({ target: \'ArrayBuffer\', proto: true }, {\n transfer: function transfer() {\n return $transfer(this, arguments.length ? arguments[0] : undefined, true);\n }\n});\n\n\n/***/ },\n\n/***/ 4114\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar toObject = __webpack_require__(8981);\nvar lengthOfArrayLike = __webpack_require__(6198);\nvar setArrayLength = __webpack_require__(4527);\nvar doesNotExceedSafeInteger = __webpack_require__(6837);\nvar fails = __webpack_require__(9039);\n\nvar INCORRECT_TO_LENGTH = fails(function () {\n return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;\n});\n\n// V8 <= 121 and Safari <= 15.4; FF < 23 throws InternalError\n// https://bugs.chromium.org/p/v8/issues/detail?id=12681\nvar properErrorOnNonWritableLength = function () {\n try {\n // eslint-disable-next-line es/no-object-defineproperty -- safe\n Object.defineProperty([], \'length\', { writable: false }).push();\n } catch (error) {\n return error instanceof TypeError;\n }\n};\n\nvar FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();\n\n// `Array.prototype.push` method\n// https://tc39.es/ecma262/#sec-array.prototype.push\n$({ target: \'Array\', proto: true, arity: 1, forced: FORCED }, {\n // eslint-disable-next-line no-unused-vars -- required for `.length`\n push: function push(item) {\n var O = toObject(this);\n var len = lengthOfArrayLike(O);\n var argCount = arguments.length;\n doesNotExceedSafeInteger(len + argCount);\n for (var i = 0; i < argCount; i++) {\n O[len] = arguments[i];\n len++;\n }\n setArrayLength(O, len);\n return len;\n }\n});\n\n\n/***/ },\n\n/***/ 8111\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar globalThis = __webpack_require__(4576);\nvar anInstance = __webpack_require__(679);\nvar anObject = __webpack_require__(8551);\nvar isCallable = __webpack_require__(4901);\nvar getPrototypeOf = __webpack_require__(2787);\nvar defineBuiltInAccessor = __webpack_require__(2106);\nvar createProperty = __webpack_require__(4659);\nvar fails = __webpack_require__(9039);\nvar hasOwn = __webpack_require__(9297);\nvar wellKnownSymbol = __webpack_require__(8227);\nvar IteratorPrototype = (__webpack_require__(7657).IteratorPrototype);\nvar DESCRIPTORS = __webpack_require__(3724);\nvar IS_PURE = __webpack_require__(6395);\n\nvar CONSTRUCTOR = \'constructor\';\nvar ITERATOR = \'Iterator\';\nvar TO_STRING_TAG = wellKnownSymbol(\'toStringTag\');\n\nvar $TypeError = TypeError;\nvar NativeIterator = globalThis[ITERATOR];\n\n// FF56- have non-standard global helper `Iterator`\nvar FORCED = IS_PURE\n || !isCallable(NativeIterator)\n || NativeIterator.prototype !== IteratorPrototype\n // FF44- non-standard `Iterator` passes previous tests\n || !fails(function () { NativeIterator({}); });\n\nvar IteratorConstructor = function Iterator() {\n anInstance(this, IteratorPrototype);\n if (getPrototypeOf(this) === IteratorPrototype) throw new $TypeError(\'Abstract class Iterator not directly constructable\');\n};\n\nvar defineIteratorPrototypeAccessor = function (key, value) {\n if (DESCRIPTORS) {\n defineBuiltInAccessor(IteratorPrototype, key, {\n configurable: true,\n get: function () {\n return value;\n },\n set: function (replacement) {\n anObject(this);\n if (this === IteratorPrototype) throw new $TypeError("You can\'t redefine this property");\n if (hasOwn(this, key)) this[key] = replacement;\n else createProperty(this, key, replacement);\n }\n });\n } else IteratorPrototype[key] = value;\n};\n\nif (!hasOwn(IteratorPrototype, TO_STRING_TAG)) defineIteratorPrototypeAccessor(TO_STRING_TAG, ITERATOR);\n\nif (FORCED || !hasOwn(IteratorPrototype, CONSTRUCTOR) || IteratorPrototype[CONSTRUCTOR] === Object) {\n defineIteratorPrototypeAccessor(CONSTRUCTOR, IteratorConstructor);\n}\n\nIteratorConstructor.prototype = IteratorPrototype;\n\n// `Iterator` constructor\n// https://tc39.es/ecma262/#sec-iterator\n$({ global: true, constructor: true, forced: FORCED }, {\n Iterator: IteratorConstructor\n});\n\n\n/***/ },\n\n/***/ 1148\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar call = __webpack_require__(9565);\nvar iterate = __webpack_require__(2652);\nvar aCallable = __webpack_require__(9306);\nvar anObject = __webpack_require__(8551);\nvar getIteratorDirect = __webpack_require__(1767);\nvar iteratorClose = __webpack_require__(9539);\nvar iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);\n\nvar everyWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError(\'every\', TypeError);\n\n// `Iterator.prototype.every` method\n// https://tc39.es/ecma262/#sec-iterator.prototype.every\n$({ target: \'Iterator\', proto: true, real: true, forced: everyWithoutClosingOnEarlyError }, {\n every: function every(predicate) {\n anObject(this);\n try {\n aCallable(predicate);\n } catch (error) {\n iteratorClose(this, \'throw\', error);\n }\n\n if (everyWithoutClosingOnEarlyError) return call(everyWithoutClosingOnEarlyError, this, predicate);\n\n var record = getIteratorDirect(this);\n var counter = 0;\n return !iterate(record, function (value, stop) {\n if (!predicate(value, counter++)) return stop();\n }, { IS_RECORD: true, INTERRUPTED: true }).stopped;\n }\n});\n\n\n/***/ },\n\n/***/ 2489\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar call = __webpack_require__(9565);\nvar aCallable = __webpack_require__(9306);\nvar anObject = __webpack_require__(8551);\nvar getIteratorDirect = __webpack_require__(1767);\nvar createIteratorProxy = __webpack_require__(9462);\nvar callWithSafeIterationClosing = __webpack_require__(6319);\nvar IS_PURE = __webpack_require__(6395);\nvar iteratorClose = __webpack_require__(9539);\nvar iteratorHelperThrowsOnInvalidIterator = __webpack_require__(684);\nvar iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);\n\nvar FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE && !iteratorHelperThrowsOnInvalidIterator(\'filter\', function () { /* empty */ });\nvar filterWithoutClosingOnEarlyError = !IS_PURE && !FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR\n && iteratorHelperWithoutClosingOnEarlyError(\'filter\', TypeError);\n\nvar FORCED = IS_PURE || FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR || filterWithoutClosingOnEarlyError;\n\nvar IteratorProxy = createIteratorProxy(function () {\n var iterator = this.iterator;\n var predicate = this.predicate;\n var next = this.next;\n var result, done, value;\n while (true) {\n result = anObject(call(next, iterator));\n done = this.done = !!result.done;\n if (done) return;\n value = result.value;\n if (callWithSafeIterationClosing(iterator, predicate, [value, this.counter++], true)) return value;\n }\n});\n\n// `Iterator.prototype.filter` method\n// https://tc39.es/ecma262/#sec-iterator.prototype.filter\n$({ target: \'Iterator\', proto: true, real: true, forced: FORCED }, {\n filter: function filter(predicate) {\n anObject(this);\n try {\n aCallable(predicate);\n } catch (error) {\n iteratorClose(this, \'throw\', error);\n }\n\n if (filterWithoutClosingOnEarlyError) return call(filterWithoutClosingOnEarlyError, this, predicate);\n\n return new IteratorProxy(getIteratorDirect(this), {\n predicate: predicate\n });\n }\n});\n\n\n/***/ },\n\n/***/ 116\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar call = __webpack_require__(9565);\nvar iterate = __webpack_require__(2652);\nvar aCallable = __webpack_require__(9306);\nvar anObject = __webpack_require__(8551);\nvar getIteratorDirect = __webpack_require__(1767);\nvar iteratorClose = __webpack_require__(9539);\nvar iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);\n\nvar findWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError(\'find\', TypeError);\n\n// `Iterator.prototype.find` method\n// https://tc39.es/ecma262/#sec-iterator.prototype.find\n$({ target: \'Iterator\', proto: true, real: true, forced: findWithoutClosingOnEarlyError }, {\n find: function find(predicate) {\n anObject(this);\n try {\n aCallable(predicate);\n } catch (error) {\n iteratorClose(this, \'throw\', error);\n }\n\n if (findWithoutClosingOnEarlyError) return call(findWithoutClosingOnEarlyError, this, predicate);\n\n var record = getIteratorDirect(this);\n var counter = 0;\n return iterate(record, function (value, stop) {\n if (predicate(value, counter++)) return stop(value);\n }, { IS_RECORD: true, INTERRUPTED: true }).result;\n }\n});\n\n\n/***/ },\n\n/***/ 7588\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar call = __webpack_require__(9565);\nvar iterate = __webpack_require__(2652);\nvar aCallable = __webpack_require__(9306);\nvar anObject = __webpack_require__(8551);\nvar getIteratorDirect = __webpack_require__(1767);\nvar iteratorClose = __webpack_require__(9539);\nvar iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);\n\nvar forEachWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError(\'forEach\', TypeError);\n\n// `Iterator.prototype.forEach` method\n// https://tc39.es/ecma262/#sec-iterator.prototype.foreach\n$({ target: \'Iterator\', proto: true, real: true, forced: forEachWithoutClosingOnEarlyError }, {\n forEach: function forEach(fn) {\n anObject(this);\n try {\n aCallable(fn);\n } catch (error) {\n iteratorClose(this, \'throw\', error);\n }\n\n if (forEachWithoutClosingOnEarlyError) return call(forEachWithoutClosingOnEarlyError, this, fn);\n\n var record = getIteratorDirect(this);\n var counter = 0;\n iterate(record, function (value) {\n fn(value, counter++);\n }, { IS_RECORD: true });\n }\n});\n\n\n/***/ },\n\n/***/ 1701\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar call = __webpack_require__(9565);\nvar aCallable = __webpack_require__(9306);\nvar anObject = __webpack_require__(8551);\nvar getIteratorDirect = __webpack_require__(1767);\nvar createIteratorProxy = __webpack_require__(9462);\nvar callWithSafeIterationClosing = __webpack_require__(6319);\nvar iteratorClose = __webpack_require__(9539);\nvar iteratorHelperThrowsOnInvalidIterator = __webpack_require__(684);\nvar iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);\nvar IS_PURE = __webpack_require__(6395);\n\nvar MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE && !iteratorHelperThrowsOnInvalidIterator(\'map\', function () { /* empty */ });\nvar mapWithoutClosingOnEarlyError = !IS_PURE && !MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR\n && iteratorHelperWithoutClosingOnEarlyError(\'map\', TypeError);\n\nvar FORCED = IS_PURE || MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || mapWithoutClosingOnEarlyError;\n\nvar IteratorProxy = createIteratorProxy(function () {\n var iterator = this.iterator;\n var result = anObject(call(this.next, iterator));\n var done = this.done = !!result.done;\n if (!done) return callWithSafeIterationClosing(iterator, this.mapper, [result.value, this.counter++], true);\n});\n\n// `Iterator.prototype.map` method\n// https://tc39.es/ecma262/#sec-iterator.prototype.map\n$({ target: \'Iterator\', proto: true, real: true, forced: FORCED }, {\n map: function map(mapper) {\n anObject(this);\n try {\n aCallable(mapper);\n } catch (error) {\n iteratorClose(this, \'throw\', error);\n }\n\n if (mapWithoutClosingOnEarlyError) return call(mapWithoutClosingOnEarlyError, this, mapper);\n\n return new IteratorProxy(getIteratorDirect(this), {\n mapper: mapper\n });\n }\n});\n\n\n/***/ },\n\n/***/ 3579\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar call = __webpack_require__(9565);\nvar iterate = __webpack_require__(2652);\nvar aCallable = __webpack_require__(9306);\nvar anObject = __webpack_require__(8551);\nvar getIteratorDirect = __webpack_require__(1767);\nvar iteratorClose = __webpack_require__(9539);\nvar iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);\n\nvar someWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError(\'some\', TypeError);\n\n// `Iterator.prototype.some` method\n// https://tc39.es/ecma262/#sec-iterator.prototype.some\n$({ target: \'Iterator\', proto: true, real: true, forced: someWithoutClosingOnEarlyError }, {\n some: function some(predicate) {\n anObject(this);\n try {\n aCallable(predicate);\n } catch (error) {\n iteratorClose(this, \'throw\', error);\n }\n\n if (someWithoutClosingOnEarlyError) return call(someWithoutClosingOnEarlyError, this, predicate);\n\n var record = getIteratorDirect(this);\n var counter = 0;\n return iterate(record, function (value, stop) {\n if (predicate(value, counter++)) return stop();\n }, { IS_RECORD: true, INTERRUPTED: true }).stopped;\n }\n});\n\n\n/***/ },\n\n/***/ 9112\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar DESCRIPTORS = __webpack_require__(3724);\nvar globalThis = __webpack_require__(4576);\nvar getBuiltIn = __webpack_require__(7751);\nvar uncurryThis = __webpack_require__(9504);\nvar call = __webpack_require__(9565);\nvar isCallable = __webpack_require__(4901);\nvar isObject = __webpack_require__(34);\nvar isArray = __webpack_require__(4376);\nvar hasOwn = __webpack_require__(9297);\nvar toString = __webpack_require__(655);\nvar lengthOfArrayLike = __webpack_require__(6198);\nvar createProperty = __webpack_require__(4659);\nvar fails = __webpack_require__(9039);\nvar parseJSONString = __webpack_require__(8235);\nvar NATIVE_SYMBOL = __webpack_require__(4495);\n\nvar JSON = globalThis.JSON;\nvar Number = globalThis.Number;\nvar SyntaxError = globalThis.SyntaxError;\nvar nativeParse = JSON && JSON.parse;\nvar enumerableOwnProperties = getBuiltIn(\'Object\', \'keys\');\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar at = uncurryThis(\'\'.charAt);\nvar slice = uncurryThis(\'\'.slice);\nvar exec = uncurryThis(/./.exec);\nvar push = uncurryThis([].push);\n\nvar IS_DIGIT = /^\\d$/;\nvar IS_NON_ZERO_DIGIT = /^[1-9]$/;\nvar IS_NUMBER_START = /^[\\d-]$/;\nvar IS_WHITESPACE = /^[\\t\\n\\r ]$/;\n\nvar PRIMITIVE = 0;\nvar OBJECT = 1;\n\nvar $parse = function (source, reviver) {\n source = toString(source);\n var context = new Context(source, 0, \'\');\n var root = context.parse();\n var value = root.value;\n var endIndex = context.skip(IS_WHITESPACE, root.end);\n if (endIndex < source.length) {\n throw new SyntaxError(\'Unexpected extra character: "\' + at(source, endIndex) + \'" after the parsed data at: \' + endIndex);\n }\n return isCallable(reviver) ? internalize({ \'\': value }, \'\', reviver, root) : value;\n};\n\nvar internalize = function (holder, name, reviver, node) {\n var val = holder[name];\n var unmodified = node && val === node.value;\n var context = unmodified && typeof node.source == \'string\' ? { source: node.source } : {};\n var elementRecordsLen, keys, len, i, P;\n if (isObject(val)) {\n var nodeIsArray = isArray(val);\n var nodes = unmodified ? node.nodes : nodeIsArray ? [] : {};\n if (nodeIsArray) {\n elementRecordsLen = nodes.length;\n len = lengthOfArrayLike(val);\n for (i = 0; i < len; i++) {\n internalizeProperty(val, i, internalize(val, \'\' + i, reviver, i < elementRecordsLen ? nodes[i] : undefined));\n }\n } else {\n keys = enumerableOwnProperties(val);\n len = lengthOfArrayLike(keys);\n for (i = 0; i < len; i++) {\n P = keys[i];\n internalizeProperty(val, P, internalize(val, P, reviver, hasOwn(nodes, P) ? nodes[P] : undefined));\n }\n }\n }\n return call(reviver, holder, name, val, context);\n};\n\nvar internalizeProperty = function (object, key, value) {\n if (DESCRIPTORS) {\n var descriptor = getOwnPropertyDescriptor(object, key);\n if (descriptor && !descriptor.configurable) return;\n }\n if (value === undefined) delete object[key];\n else createProperty(object, key, value);\n};\n\nvar Node = function (value, end, source, nodes) {\n this.value = value;\n this.end = end;\n this.source = source;\n this.nodes = nodes;\n};\n\nvar Context = function (source, index) {\n this.source = source;\n this.index = index;\n};\n\n// https://www.json.org/json-en.html\nContext.prototype = {\n fork: function (nextIndex) {\n return new Context(this.source, nextIndex);\n },\n parse: function () {\n var source = this.source;\n var i = this.skip(IS_WHITESPACE, this.index);\n var fork = this.fork(i);\n var chr = at(source, i);\n if (exec(IS_NUMBER_START, chr)) return fork.number();\n switch (chr) {\n case \'{\':\n return fork.object();\n case \'[\':\n return fork.array();\n case \'"\':\n return fork.string();\n case \'t\':\n return fork.keyword(true);\n case \'f\':\n return fork.keyword(false);\n case \'n\':\n return fork.keyword(null);\n } throw new SyntaxError(\'Unexpected character: "\' + chr + \'" at: \' + i);\n },\n node: function (type, value, start, end, nodes) {\n return new Node(value, end, type ? null : slice(this.source, start, end), nodes);\n },\n object: function () {\n var source = this.source;\n var i = this.index + 1;\n var expectKeypair = false;\n var object = {};\n var nodes = {};\n while (i < source.length) {\n i = this.until([\'"\', \'}\'], i);\n if (at(source, i) === \'}\' && !expectKeypair) {\n i++;\n break;\n }\n // Parsing the key\n var result = this.fork(i).string();\n var key = result.value;\n i = result.end;\n i = this.until([\':\'], i) + 1;\n // Parsing value\n i = this.skip(IS_WHITESPACE, i);\n result = this.fork(i).parse();\n createProperty(nodes, key, result);\n createProperty(object, key, result.value);\n i = this.until([\',\', \'}\'], result.end);\n var chr = at(source, i);\n if (chr === \',\') {\n expectKeypair = true;\n i++;\n } else if (chr === \'}\') {\n i++;\n break;\n }\n }\n return this.node(OBJECT, object, this.index, i, nodes);\n },\n array: function () {\n var source = this.source;\n var i = this.index + 1;\n var expectElement = false;\n var array = [];\n var nodes = [];\n while (i < source.length) {\n i = this.skip(IS_WHITESPACE, i);\n if (at(source, i) === \']\' && !expectElement) {\n i++;\n break;\n }\n var result = this.fork(i).parse();\n push(nodes, result);\n push(array, result.value);\n i = this.until([\',\', \']\'], result.end);\n if (at(source, i) === \',\') {\n expectElement = true;\n i++;\n } else if (at(source, i) === \']\') {\n i++;\n break;\n }\n }\n return this.node(OBJECT, array, this.index, i, nodes);\n },\n string: function () {\n var index = this.index;\n var parsed = parseJSONString(this.source, this.index + 1);\n return this.node(PRIMITIVE, parsed.value, index, parsed.end);\n },\n number: function () {\n var source = this.source;\n var startIndex = this.index;\n var i = startIndex;\n if (at(source, i) === \'-\') i++;\n if (at(source, i) === \'0\') i++;\n else if (exec(IS_NON_ZERO_DIGIT, at(source, i))) i = this.skip(IS_DIGIT, i + 1);\n else throw new SyntaxError(\'Failed to parse number at: \' + i);\n if (at(source, i) === \'.\') i = this.skip(IS_DIGIT, i + 1);\n if (at(source, i) === \'e\' || at(source, i) === \'E\') {\n i++;\n if (at(source, i) === \'+\' || at(source, i) === \'-\') i++;\n var exponentStartIndex = i;\n i = this.skip(IS_DIGIT, i);\n if (exponentStartIndex === i) throw new SyntaxError("Failed to parse number\'s exponent value at: " + i);\n }\n return this.node(PRIMITIVE, Number(slice(source, startIndex, i)), startIndex, i);\n },\n keyword: function (value) {\n var keyword = \'\' + value;\n var index = this.index;\n var endIndex = index + keyword.length;\n if (slice(this.source, index, endIndex) !== keyword) throw new SyntaxError(\'Failed to parse value at: \' + index);\n return this.node(PRIMITIVE, value, index, endIndex);\n },\n skip: function (regex, i) {\n var source = this.source;\n for (; i < source.length; i++) if (!exec(regex, at(source, i))) break;\n return i;\n },\n until: function (array, i) {\n i = this.skip(IS_WHITESPACE, i);\n var chr = at(this.source, i);\n for (var j = 0; j < array.length; j++) if (array[j] === chr) return i;\n throw new SyntaxError(\'Unexpected character: "\' + chr + \'" at: \' + i);\n }\n};\n\nvar NO_SOURCE_SUPPORT = fails(function () {\n var unsafeInt = \'9007199254740993\';\n var source;\n nativeParse(unsafeInt, function (key, value, context) {\n source = context.source;\n });\n return source !== unsafeInt;\n});\n\nvar PROPER_BASE_PARSE = NATIVE_SYMBOL && !fails(function () {\n // Safari 9 bug\n return 1 / nativeParse(\'-0 \\t\') !== -Infinity;\n});\n\n// `JSON.parse` method\n// https://tc39.es/ecma262/#sec-json.parse\n// https://github.com/tc39/proposal-json-parse-with-source\n$({ target: \'JSON\', stat: true, forced: NO_SOURCE_SUPPORT }, {\n parse: function parse(text, reviver) {\n return PROPER_BASE_PARSE && !isCallable(reviver) ? nativeParse(text) : $parse(text, reviver);\n }\n});\n\n\n/***/ },\n\n/***/ 3110\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar getBuiltIn = __webpack_require__(7751);\nvar apply = __webpack_require__(8745);\nvar call = __webpack_require__(9565);\nvar uncurryThis = __webpack_require__(9504);\nvar fails = __webpack_require__(9039);\nvar isArray = __webpack_require__(4376);\nvar isCallable = __webpack_require__(4901);\nvar isRawJSON = __webpack_require__(5810);\nvar isSymbol = __webpack_require__(757);\nvar classof = __webpack_require__(2195);\nvar toString = __webpack_require__(655);\nvar arraySlice = __webpack_require__(7680);\nvar parseJSONString = __webpack_require__(8235);\nvar uid = __webpack_require__(3392);\nvar NATIVE_SYMBOL = __webpack_require__(4495);\nvar NATIVE_RAW_JSON = __webpack_require__(7819);\n\nvar $String = String;\nvar $stringify = getBuiltIn(\'JSON\', \'stringify\');\nvar exec = uncurryThis(/./.exec);\nvar charAt = uncurryThis(\'\'.charAt);\nvar charCodeAt = uncurryThis(\'\'.charCodeAt);\nvar replace = uncurryThis(\'\'.replace);\nvar slice = uncurryThis(\'\'.slice);\nvar push = uncurryThis([].push);\nvar numberToString = uncurryThis(1.1.toString);\n\nvar surrogates = /[\\uD800-\\uDFFF]/g;\nvar lowSurrogates = /^[\\uD800-\\uDBFF]$/;\nvar hiSurrogates = /^[\\uDC00-\\uDFFF]$/;\n\nvar MARK = uid();\nvar MARK_LENGTH = MARK.length;\n\nvar WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {\n var symbol = getBuiltIn(\'Symbol\')(\'stringify detection\');\n // MS Edge converts symbol values to JSON as {}\n return $stringify([symbol]) !== \'[null]\'\n // WebKit converts symbol values to JSON as null\n || $stringify({ a: symbol }) !== \'{}\'\n // V8 throws on boxed symbols\n || $stringify(Object(symbol)) !== \'{}\';\n});\n\n// https://github.com/tc39/proposal-well-formed-stringify\nvar ILL_FORMED_UNICODE = fails(function () {\n return $stringify(\'\\uDF06\\uD834\') !== \'"\\\\udf06\\\\ud834"\'\n || $stringify(\'\\uDEAD\') !== \'"\\\\udead"\';\n});\n\nvar stringifyWithProperSymbolsConversion = WRONG_SYMBOLS_CONVERSION ? function (it, replacer) {\n var args = arraySlice(arguments);\n var $replacer = getReplacerFunction(replacer);\n if (!isCallable($replacer) && (it === undefined || isSymbol(it))) return; // IE8 returns string on undefined\n args[1] = function (key, value) {\n // some old implementations (like WebKit) could pass numbers as keys\n if (isCallable($replacer)) value = call($replacer, this, $String(key), value);\n if (!isSymbol(value)) return value;\n };\n return apply($stringify, null, args);\n} : $stringify;\n\nvar fixIllFormedJSON = function (match, offset, string) {\n var prev = charAt(string, offset - 1);\n var next = charAt(string, offset + 1);\n if ((exec(lowSurrogates, match) && !exec(hiSurrogates, next)) || (exec(hiSurrogates, match) && !exec(lowSurrogates, prev))) {\n return \'\\\\u\' + numberToString(charCodeAt(match, 0), 16);\n } return match;\n};\n\nvar getReplacerFunction = function (replacer) {\n if (isCallable(replacer)) return replacer;\n if (!isArray(replacer)) return;\n var rawLength = replacer.length;\n var keys = [];\n for (var i = 0; i < rawLength; i++) {\n var element = replacer[i];\n if (typeof element == \'string\') push(keys, element);\n else if (typeof element == \'number\' || classof(element) === \'Number\' || classof(element) === \'String\') push(keys, toString(element));\n }\n var keysLength = keys.length;\n var root = true;\n return function (key, value) {\n if (root) {\n root = false;\n return value;\n }\n if (isArray(this)) return value;\n for (var j = 0; j < keysLength; j++) if (keys[j] === key) return value;\n };\n};\n\n// `JSON.stringify` method\n// https://tc39.es/ecma262/#sec-json.stringify\n// https://github.com/tc39/proposal-json-parse-with-source\nif ($stringify) $({ target: \'JSON\', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE || !NATIVE_RAW_JSON }, {\n stringify: function stringify(text, replacer, space) {\n var replacerFunction = getReplacerFunction(replacer);\n var rawStrings = [];\n\n var json = stringifyWithProperSymbolsConversion(text, function (key, value) {\n // some old implementations (like WebKit) could pass numbers as keys\n var v = isCallable(replacerFunction) ? call(replacerFunction, this, $String(key), value) : value;\n return !NATIVE_RAW_JSON && isRawJSON(v) ? MARK + (push(rawStrings, v.rawJSON) - 1) : v;\n }, space);\n\n if (typeof json != \'string\') return json;\n\n if (ILL_FORMED_UNICODE) json = replace(json, surrogates, fixIllFormedJSON);\n\n if (NATIVE_RAW_JSON) return json;\n\n var result = \'\';\n var length = json.length;\n\n for (var i = 0; i < length; i++) {\n var chr = charAt(json, i);\n if (chr === \'"\') {\n var end = parseJSONString(json, ++i).end - 1;\n var string = slice(json, i, end);\n result += slice(string, 0, MARK_LENGTH) === MARK\n ? rawStrings[slice(string, MARK_LENGTH)]\n : \'"\' + string + \'"\';\n i = end;\n } else result += chr;\n }\n\n return result;\n }\n});\n\n\n/***/ },\n\n/***/ 2731\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar aCallable = __webpack_require__(9306);\nvar aMap = __webpack_require__(6194);\nvar MapHelpers = __webpack_require__(2248);\nvar IS_PURE = __webpack_require__(6395);\n\nvar get = MapHelpers.get;\nvar has = MapHelpers.has;\nvar set = MapHelpers.set;\n\n// `Map.prototype.getOrInsertComputed` method\n// https://github.com/tc39/proposal-upsert\n$({ target: \'Map\', proto: true, real: true, forced: IS_PURE }, {\n getOrInsertComputed: function getOrInsertComputed(key, callbackfn) {\n aMap(this);\n aCallable(callbackfn);\n if (has(this, key)) return get(this, key);\n // CanonicalizeKeyedCollectionKey\n if (key === 0 && 1 / key === -Infinity) key = 0;\n var value = callbackfn(key);\n set(this, key, value);\n return value;\n }\n});\n\n\n/***/ },\n\n/***/ 5367\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar aMap = __webpack_require__(6194);\nvar MapHelpers = __webpack_require__(2248);\nvar IS_PURE = __webpack_require__(6395);\n\nvar get = MapHelpers.get;\nvar has = MapHelpers.has;\nvar set = MapHelpers.set;\n\n// `Map.prototype.getOrInsert` method\n// https://github.com/tc39/proposal-upsert\n$({ target: \'Map\', proto: true, real: true, forced: IS_PURE }, {\n getOrInsert: function getOrInsert(key, value) {\n if (has(aMap(this), key)) return get(this, key);\n set(this, key, value);\n return value;\n }\n});\n\n\n/***/ },\n\n/***/ 4628\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar newPromiseCapabilityModule = __webpack_require__(6043);\n\n// `Promise.withResolvers` method\n// https://tc39.es/ecma262/#sec-promise.withResolvers\n$({ target: \'Promise\', stat: true }, {\n withResolvers: function withResolvers() {\n var promiseCapability = newPromiseCapabilityModule.f(this);\n return {\n promise: promiseCapability.promise,\n resolve: promiseCapability.resolve,\n reject: promiseCapability.reject\n };\n }\n});\n\n\n/***/ },\n\n/***/ 6069\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar uncurryThis = __webpack_require__(9504);\nvar aString = __webpack_require__(3463);\nvar hasOwn = __webpack_require__(9297);\nvar padStart = (__webpack_require__(533).start);\nvar WHITESPACES = __webpack_require__(7452);\n\nvar $Array = Array;\nvar $escape = RegExp.escape;\nvar charAt = uncurryThis(\'\'.charAt);\nvar charCodeAt = uncurryThis(\'\'.charCodeAt);\nvar numberToString = uncurryThis(1.1.toString);\nvar join = uncurryThis([].join);\nvar FIRST_DIGIT_OR_ASCII = /^[0-9a-z]/i;\nvar SYNTAX_SOLIDUS = /^[$()*+./?[\\\\\\]^{|}]/;\nvar OTHER_PUNCTUATORS_AND_WHITESPACES = RegExp(\'^[!"#%&\\\',\\\\-:;<=>@`~\' + WHITESPACES + \']\');\nvar exec = uncurryThis(FIRST_DIGIT_OR_ASCII.exec);\n\nvar ControlEscape = {\n \'\\u0009\': \'t\',\n \'\\u000A\': \'n\',\n \'\\u000B\': \'v\',\n \'\\u000C\': \'f\',\n \'\\u000D\': \'r\'\n};\n\nvar escapeChar = function (chr) {\n var hex = numberToString(charCodeAt(chr, 0), 16);\n return hex.length < 3 ? \'\\\\x\' + padStart(hex, 2, \'0\') : \'\\\\u\' + padStart(hex, 4, \'0\');\n};\n\n// Avoiding the use of polyfills of the previous iteration of this proposal\nvar FORCED = !$escape || $escape(\'ab\') !== \'\\\\x61b\';\n\n// `RegExp.escape` method\n// https://tc39.es/ecma262/#sec-regexp.escape\n$({ target: \'RegExp\', stat: true, forced: FORCED }, {\n escape: function escape(S) {\n aString(S);\n var length = S.length;\n var result = $Array(length);\n\n for (var i = 0; i < length; i++) {\n var chr = charAt(S, i);\n if (i === 0 && exec(FIRST_DIGIT_OR_ASCII, chr)) {\n result[i] = escapeChar(chr);\n } else if (hasOwn(ControlEscape, chr)) {\n result[i] = \'\\\\\' + ControlEscape[chr];\n } else if (exec(SYNTAX_SOLIDUS, chr)) {\n result[i] = \'\\\\\' + chr;\n } else if (exec(OTHER_PUNCTUATORS_AND_WHITESPACES, chr)) {\n result[i] = escapeChar(chr);\n } else {\n var charCode = charCodeAt(chr, 0);\n // single UTF-16 code unit\n if ((charCode & 0xF800) !== 0xD800) result[i] = chr;\n // unpaired surrogate\n else if (charCode >= 0xDC00 || i + 1 >= length || (charCodeAt(S, i + 1) & 0xFC00) !== 0xDC00) result[i] = escapeChar(chr);\n // surrogate pair\n else {\n result[i] = chr;\n result[++i] = charAt(S, i);\n }\n }\n }\n\n return join(result, \'\');\n }\n});\n\n\n/***/ },\n\n/***/ 7642\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar difference = __webpack_require__(3440);\nvar fails = __webpack_require__(9039);\nvar setMethodAcceptSetLike = __webpack_require__(4916);\n\nvar SET_LIKE_INCORRECT_BEHAVIOR = !setMethodAcceptSetLike(\'difference\', function (result) {\n return result.size === 0;\n});\n\nvar FORCED = SET_LIKE_INCORRECT_BEHAVIOR || fails(function () {\n // https://bugs.webkit.org/show_bug.cgi?id=288595\n var setLike = {\n size: 1,\n has: function () { return true; },\n keys: function () {\n var index = 0;\n return {\n next: function () {\n var done = index++ > 1;\n if (baseSet.has(1)) baseSet.clear();\n return { done: done, value: 2 };\n }\n };\n }\n };\n // eslint-disable-next-line es/no-set -- testing\n var baseSet = new Set([1, 2, 3, 4]);\n // eslint-disable-next-line es/no-set-prototype-difference -- testing\n return baseSet.difference(setLike).size !== 3;\n});\n\n// `Set.prototype.difference` method\n// https://tc39.es/ecma262/#sec-set.prototype.difference\n$({ target: \'Set\', proto: true, real: true, forced: FORCED }, {\n difference: difference\n});\n\n\n/***/ },\n\n/***/ 8004\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar fails = __webpack_require__(9039);\nvar intersection = __webpack_require__(8750);\nvar setMethodAcceptSetLike = __webpack_require__(4916);\n\nvar INCORRECT = !setMethodAcceptSetLike(\'intersection\', function (result) {\n return result.size === 2 && result.has(1) && result.has(2);\n}) || fails(function () {\n // eslint-disable-next-line es/no-array-from, es/no-set, es/no-set-prototype-intersection -- testing\n return String(Array.from(new Set([1, 2, 3]).intersection(new Set([3, 2])))) !== \'3,2\';\n});\n\n// `Set.prototype.intersection` method\n// https://tc39.es/ecma262/#sec-set.prototype.intersection\n$({ target: \'Set\', proto: true, real: true, forced: INCORRECT }, {\n intersection: intersection\n});\n\n\n/***/ },\n\n/***/ 3853\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar isDisjointFrom = __webpack_require__(4449);\nvar setMethodAcceptSetLike = __webpack_require__(4916);\n\nvar INCORRECT = !setMethodAcceptSetLike(\'isDisjointFrom\', function (result) {\n return !result;\n});\n\n// `Set.prototype.isDisjointFrom` method\n// https://tc39.es/ecma262/#sec-set.prototype.isdisjointfrom\n$({ target: \'Set\', proto: true, real: true, forced: INCORRECT }, {\n isDisjointFrom: isDisjointFrom\n});\n\n\n/***/ },\n\n/***/ 5876\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar isSubsetOf = __webpack_require__(3838);\nvar setMethodAcceptSetLike = __webpack_require__(4916);\n\nvar INCORRECT = !setMethodAcceptSetLike(\'isSubsetOf\', function (result) {\n return result;\n});\n\n// `Set.prototype.isSubsetOf` method\n// https://tc39.es/ecma262/#sec-set.prototype.issubsetof\n$({ target: \'Set\', proto: true, real: true, forced: INCORRECT }, {\n isSubsetOf: isSubsetOf\n});\n\n\n/***/ },\n\n/***/ 2475\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar isSupersetOf = __webpack_require__(8527);\nvar setMethodAcceptSetLike = __webpack_require__(4916);\n\nvar INCORRECT = !setMethodAcceptSetLike(\'isSupersetOf\', function (result) {\n return !result;\n});\n\n// `Set.prototype.isSupersetOf` method\n// https://tc39.es/ecma262/#sec-set.prototype.issupersetof\n$({ target: \'Set\', proto: true, real: true, forced: INCORRECT }, {\n isSupersetOf: isSupersetOf\n});\n\n\n/***/ },\n\n/***/ 5024\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar symmetricDifference = __webpack_require__(3650);\nvar setMethodGetKeysBeforeCloning = __webpack_require__(9835);\nvar setMethodAcceptSetLike = __webpack_require__(4916);\n\nvar FORCED = !setMethodAcceptSetLike(\'symmetricDifference\') || !setMethodGetKeysBeforeCloning(\'symmetricDifference\');\n\n// `Set.prototype.symmetricDifference` method\n// https://tc39.es/ecma262/#sec-set.prototype.symmetricdifference\n$({ target: \'Set\', proto: true, real: true, forced: FORCED }, {\n symmetricDifference: symmetricDifference\n});\n\n\n/***/ },\n\n/***/ 1698\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar union = __webpack_require__(4204);\nvar setMethodGetKeysBeforeCloning = __webpack_require__(9835);\nvar setMethodAcceptSetLike = __webpack_require__(4916);\n\nvar FORCED = !setMethodAcceptSetLike(\'union\') || !setMethodGetKeysBeforeCloning(\'union\');\n\n// `Set.prototype.union` method\n// https://tc39.es/ecma262/#sec-set.prototype.union\n$({ target: \'Set\', proto: true, real: true, forced: FORCED }, {\n union: union\n});\n\n\n/***/ },\n\n/***/ 9577\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar ArrayBufferViewCore = __webpack_require__(4644);\nvar isBigIntArray = __webpack_require__(1108);\nvar lengthOfArrayLike = __webpack_require__(6198);\nvar toIntegerOrInfinity = __webpack_require__(1291);\nvar toBigInt = __webpack_require__(5854);\n\nvar aTypedArray = ArrayBufferViewCore.aTypedArray;\nvar getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;\nvar exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;\n\nvar $RangeError = RangeError;\n\nvar PROPER_ORDER = function () {\n try {\n // eslint-disable-next-line no-throw-literal, es/no-typed-arrays, es/no-array-prototype-with -- required for testing\n new Int8Array(1)[\'with\'](2, { valueOf: function () { throw 8; } });\n } catch (error) {\n // some early implementations, like WebKit, does not follow the final semantic\n // https://github.com/tc39/proposal-change-array-by-copy/pull/86\n return error === 8;\n }\n}();\n\n// Bug in WebKit. It should truncate a negative fractional index to zero, but instead throws an error\nvar THROW_ON_NEGATIVE_FRACTIONAL_INDEX = PROPER_ORDER && function () {\n try {\n // eslint-disable-next-line es/no-typed-arrays, es/no-array-prototype-with -- required for testing\n new Int8Array(1)[\'with\'](-0.5, 1);\n } catch (error) {\n return true;\n }\n}();\n\n// `%TypedArray%.prototype.with` method\n// https://tc39.es/ecma262/#sec-%typedarray%.prototype.with\nexportTypedArrayMethod(\'with\', { \'with\': function (index, value) {\n var O = aTypedArray(this);\n var len = lengthOfArrayLike(O);\n var relativeIndex = toIntegerOrInfinity(index);\n var actualIndex = relativeIndex < 0 ? len + relativeIndex : relativeIndex;\n var numericValue = isBigIntArray(O) ? toBigInt(value) : +value;\n if (actualIndex >= len || actualIndex < 0) throw new $RangeError(\'Incorrect index\');\n var A = new (getTypedArrayConstructor(O))(len);\n var k = 0;\n for (; k < len; k++) A[k] = k === actualIndex ? numericValue : O[k];\n return A;\n} }[\'with\'], !PROPER_ORDER || THROW_ON_NEGATIVE_FRACTIONAL_INDEX);\n\n\n/***/ },\n\n/***/ 9452\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar aCallable = __webpack_require__(9306);\nvar aWeakMap = __webpack_require__(6557);\nvar aWeakKey = __webpack_require__(4328);\nvar WeakMapHelpers = __webpack_require__(4995);\nvar IS_PURE = __webpack_require__(6395);\n\nvar get = WeakMapHelpers.get;\nvar has = WeakMapHelpers.has;\nvar set = WeakMapHelpers.set;\n\nvar FORCED = IS_PURE || !function () {\n try {\n // eslint-disable-next-line es/no-weak-map, no-throw-literal -- testing\n if (WeakMap.prototype.getOrInsertComputed) new WeakMap().getOrInsertComputed(1, function () { throw 1; });\n } catch (error) {\n // FF144 Nightly - Beta 3 bug\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1988369\n return error instanceof TypeError;\n }\n}();\n\n// `WeakMap.prototype.getOrInsertComputed` method\n// https://github.com/tc39/proposal-upsert\n$({ target: \'WeakMap\', proto: true, real: true, forced: FORCED }, {\n getOrInsertComputed: function getOrInsertComputed(key, callbackfn) {\n aWeakMap(this);\n aWeakKey(key);\n aCallable(callbackfn);\n if (has(this, key)) return get(this, key);\n var value = callbackfn(key);\n set(this, key, value);\n return value;\n }\n});\n\n\n/***/ },\n\n/***/ 8454\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar aWeakMap = __webpack_require__(6557);\nvar WeakMapHelpers = __webpack_require__(4995);\nvar IS_PURE = __webpack_require__(6395);\n\nvar get = WeakMapHelpers.get;\nvar has = WeakMapHelpers.has;\nvar set = WeakMapHelpers.set;\n\n// `WeakMap.prototype.getOrInsert` method\n// https://github.com/tc39/proposal-upsert\n$({ target: \'WeakMap\', proto: true, real: true, forced: IS_PURE }, {\n getOrInsert: function getOrInsert(key, value) {\n if (has(aWeakMap(this), key)) return get(this, key);\n set(this, key, value);\n return value;\n }\n});\n\n\n/***/ },\n\n/***/ 4603\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar defineBuiltIn = __webpack_require__(6840);\nvar uncurryThis = __webpack_require__(9504);\nvar toString = __webpack_require__(655);\nvar validateArgumentsLength = __webpack_require__(2812);\n\nvar $URLSearchParams = URLSearchParams;\nvar URLSearchParamsPrototype = $URLSearchParams.prototype;\nvar append = uncurryThis(URLSearchParamsPrototype.append);\nvar $delete = uncurryThis(URLSearchParamsPrototype[\'delete\']);\nvar forEach = uncurryThis(URLSearchParamsPrototype.forEach);\nvar push = uncurryThis([].push);\nvar params = new $URLSearchParams(\'a=1&a=2&b=3\');\n\nparams[\'delete\'](\'a\', 1);\n// `undefined` case is a Chromium 117 bug\n// https://bugs.chromium.org/p/v8/issues/detail?id=14222\nparams[\'delete\'](\'b\', undefined);\n\nif (params + \'\' !== \'a=2\') {\n defineBuiltIn(URLSearchParamsPrototype, \'delete\', function (name /* , value */) {\n var length = arguments.length;\n var $value = length < 2 ? undefined : arguments[1];\n if (length && $value === undefined) return $delete(this, name);\n var entries = [];\n forEach(this, function (v, k) { // also validates `this`\n push(entries, { key: k, value: v });\n });\n validateArgumentsLength(length, 1);\n var key = toString(name);\n var value = toString($value);\n var index = 0;\n var dindex = 0;\n var found = false;\n var entriesLength = entries.length;\n var entry;\n while (index < entriesLength) {\n entry = entries[index++];\n if (found || entry.key === key) {\n found = true;\n $delete(this, entry.key);\n } else dindex++;\n }\n while (dindex < entriesLength) {\n entry = entries[dindex++];\n if (!(entry.key === key && entry.value === value)) append(this, entry.key, entry.value);\n }\n }, { enumerable: true, unsafe: true });\n}\n\n\n/***/ },\n\n/***/ 7566\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar defineBuiltIn = __webpack_require__(6840);\nvar uncurryThis = __webpack_require__(9504);\nvar toString = __webpack_require__(655);\nvar validateArgumentsLength = __webpack_require__(2812);\n\nvar $URLSearchParams = URLSearchParams;\nvar URLSearchParamsPrototype = $URLSearchParams.prototype;\nvar getAll = uncurryThis(URLSearchParamsPrototype.getAll);\nvar $has = uncurryThis(URLSearchParamsPrototype.has);\nvar params = new $URLSearchParams(\'a=1\');\n\n// `undefined` case is a Chromium 117 bug\n// https://bugs.chromium.org/p/v8/issues/detail?id=14222\nif (params.has(\'a\', 2) || !params.has(\'a\', undefined)) {\n defineBuiltIn(URLSearchParamsPrototype, \'has\', function has(name /* , value */) {\n var length = arguments.length;\n var $value = length < 2 ? undefined : arguments[1];\n if (length && $value === undefined) return $has(this, name);\n var values = getAll(this, name); // also validates `this`\n validateArgumentsLength(length, 1);\n var value = toString($value);\n var index = 0;\n while (index < values.length) {\n if (values[index++] === value) return true;\n } return false;\n }, { enumerable: true, unsafe: true });\n}\n\n\n/***/ },\n\n/***/ 8721\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar DESCRIPTORS = __webpack_require__(3724);\nvar uncurryThis = __webpack_require__(9504);\nvar defineBuiltInAccessor = __webpack_require__(2106);\n\nvar URLSearchParamsPrototype = URLSearchParams.prototype;\nvar forEach = uncurryThis(URLSearchParamsPrototype.forEach);\n\n// `URLSearchParams.prototype.size` getter\n// https://github.com/whatwg/url/pull/734\nif (DESCRIPTORS && !(\'size\' in URLSearchParamsPrototype)) {\n defineBuiltInAccessor(URLSearchParamsPrototype, \'size\', {\n get: function size() {\n var count = 0;\n forEach(this, function () { count++; });\n return count;\n },\n configurable: true,\n enumerable: true\n });\n}\n\n\n/***/ },\n\n/***/ 5781\n(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\n\nvar $ = __webpack_require__(6518);\nvar getBuiltIn = __webpack_require__(7751);\nvar validateArgumentsLength = __webpack_require__(2812);\nvar toString = __webpack_require__(655);\nvar USE_NATIVE_URL = __webpack_require__(7416);\n\nvar URL = getBuiltIn(\'URL\');\n\n// `URL.parse` method\n// https://url.spec.whatwg.org/#dom-url-canparse\n$({ target: \'URL\', stat: true, forced: !USE_NATIVE_URL }, {\n parse: function parse(url) {\n var length = validateArgumentsLength(arguments.length, 1);\n var urlString = toString(url);\n var base = length < 2 || arguments[1] === undefined ? undefined : toString(arguments[1]);\n try {\n return new URL(urlString, base);\n } catch (error) {\n return null;\n }\n }\n});\n\n\n/***/ }\n\n/******/ });\n/************************************************************************/\n/******/ // The module cache\n/******/ var __webpack_module_cache__ = {};\n/******/ \n/******/ // The require function\n/******/ function __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].call(module.exports, module, module.exports, __webpack_require__);\n/******/ \n/******/ \t// Return the exports of the module\n/******/ \treturn module.exports;\n/******/ }\n/******/ \n/************************************************************************/\n/******/ /* webpack/runtime/define property getters */\n/******/ (() => {\n/******/ \t// define getter functions for harmony exports\n/******/ \t__webpack_require__.d = (exports, definition) => {\n/******/ \t\tfor(var key in definition) {\n/******/ \t\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n/******/ \t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n/******/ \t\t\t}\n/******/ \t\t}\n/******/ \t};\n/******/ })();\n/******/ \n/******/ /* webpack/runtime/hasOwnProperty shorthand */\n/******/ (() => {\n/******/ \t__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))\n/******/ })();\n/******/ \n/************************************************************************/\nvar __webpack_exports__ = {};\n\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js\nvar es_array_push = __webpack_require__(4114);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.map.get-or-insert.js\nvar es_map_get_or_insert = __webpack_require__(5367);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.map.get-or-insert-computed.js\nvar es_map_get_or_insert_computed = __webpack_require__(2731);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.difference.v2.js\nvar es_set_difference_v2 = __webpack_require__(7642);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.intersection.v2.js\nvar es_set_intersection_v2 = __webpack_require__(8004);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.is-disjoint-from.v2.js\nvar es_set_is_disjoint_from_v2 = __webpack_require__(3853);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.is-subset-of.v2.js\nvar es_set_is_subset_of_v2 = __webpack_require__(5876);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.is-superset-of.v2.js\nvar es_set_is_superset_of_v2 = __webpack_require__(2475);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.symmetric-difference.v2.js\nvar es_set_symmetric_difference_v2 = __webpack_require__(5024);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.union.v2.js\nvar es_set_union_v2 = __webpack_require__(1698);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/web.url-search-params.delete.js\nvar web_url_search_params_delete = __webpack_require__(4603);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/web.url-search-params.has.js\nvar web_url_search_params_has = __webpack_require__(7566);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/web.url-search-params.size.js\nvar web_url_search_params_size = __webpack_require__(8721);\n;// ./web/pdfjs.js\nconst {\n AbortException,\n AnnotationEditorLayer,\n AnnotationEditorParamsType,\n AnnotationEditorType,\n AnnotationEditorUIManager,\n AnnotationLayer,\n AnnotationMode,\n AnnotationType,\n applyOpacity,\n build,\n ColorPicker,\n createValidAbsoluteUrl,\n CSSConstants,\n DOMSVGFactory,\n DrawLayer,\n FeatureTest,\n fetchData,\n findContrastColor,\n getDocument,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n getRGB,\n getUuid,\n getXfaPageViewport,\n GlobalWorkerOptions,\n ImageKind,\n InvalidPDFException,\n isDataScheme,\n isPdfFile,\n isValidExplicitDest,\n makeArr,\n makeMap,\n makeObj,\n MathClamp,\n noContextMenu,\n normalizeUnicode,\n OPS,\n OutputScale,\n PasswordResponses,\n PDFDataRangeTransport,\n PDFDateString,\n PDFWorker,\n PermissionFlag,\n PixelsPerInch,\n RenderingCancelledException,\n renderRichText,\n ResponseException,\n setLayerDimensions,\n shadow,\n SignatureExtractor,\n stopEvent,\n SupportedImageMimeTypes,\n TextLayer,\n TouchManager,\n updateUrlHash,\n Util,\n VerbosityLevel,\n version,\n XfaLayer\n} = globalThis.pdfjsLib;\n\n;// ./web/ui_utils.js\n\n\n\n\n\n\n\n\n\n\n\n\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;\nconst PresentationModeState = {\n UNKNOWN: 0,\n NORMAL: 1,\n CHANGING: 2,\n FULLSCREEN: 3\n};\nconst SidebarView = {\n UNKNOWN: -1,\n NONE: 0,\n THUMBS: 1,\n OUTLINE: 2,\n ATTACHMENTS: 3,\n LAYERS: 4\n};\nconst TextLayerMode = {\n DISABLE: 0,\n ENABLE: 1,\n ENABLE_PERMISSIONS: 2\n};\nconst ScrollMode = {\n UNKNOWN: -1,\n VERTICAL: 0,\n HORIZONTAL: 1,\n WRAPPED: 2,\n PAGE: 3\n};\nconst SpreadMode = {\n UNKNOWN: -1,\n NONE: 0,\n ODD: 1,\n EVEN: 2\n};\nconst CursorTool = {\n SELECT: 0,\n HAND: 1,\n ZOOM: 2\n};\nconst AutoPrintRegExp = /\\bprint\\s*\\(/;\nfunction scrollIntoView(element, spot, scrollMatches = false) {\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 (parent.clientHeight === parent.scrollHeight && parent.clientWidth === parent.scrollWidth || scrollMatches && (parent.classList.contains("markedContent") || getComputedStyle(parent).overflow === "hidden")) {\n offsetY += parent.offsetTop;\n offsetX += parent.offsetLeft;\n parent = parent.offsetParent;\n if (!parent) {\n return;\n }\n }\n if (spot) {\n if (spot.top !== undefined) {\n offsetY += spot.top;\n }\n if (spot.left !== undefined) {\n if (scrollMatches) {\n const elementWidth = element.getBoundingClientRect().width;\n const padding = MathClamp((parent.clientWidth - elementWidth) / 2, 20, 400);\n offsetX += spot.left - padding;\n } else {\n offsetX += spot.left;\n }\n parent.scrollLeft = offsetX;\n }\n }\n parent.scrollTop = offsetY;\n}\nfunction watchScroll(viewAreaElement, callback, abortSignal = undefined) {\n const debounceScroll = function (evt) {\n if (rAF) {\n return;\n }\n rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {\n rAF = null;\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 const state = {\n right: true,\n down: true,\n lastX: viewAreaElement.scrollLeft,\n lastY: viewAreaElement.scrollTop,\n _eventHandler: debounceScroll\n };\n let rAF = null;\n viewAreaElement.addEventListener("scroll", debounceScroll, {\n useCapture: true,\n signal: abortSignal\n });\n abortSignal?.addEventListener("abort", () => window.cancelAnimationFrame(rAF), {\n once: true\n });\n return state;\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}\nconst InvisibleCharsRegExp = /[\\x00-\\x1F]/g;\nfunction removeNullCharacters(str, replaceInvisible = false) {\n if (!InvisibleCharsRegExp.test(str)) {\n return str;\n }\n if (replaceInvisible) {\n return str.replaceAll(InvisibleCharsRegExp, m => m === "\\x00" ? "" : " ");\n }\n return str.replaceAll("\\x00", "");\n}\nfunction binarySearchFirstItem(items, condition, start = 0) {\n let minIndex = start;\n let maxIndex = items.length - 1;\n if (maxIndex < 0 || !condition(items[maxIndex])) {\n return items.length;\n }\n if (condition(items[minIndex])) {\n return minIndex;\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;\n}\nfunction approximateFraction(x) {\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 const x_ = x > 1 ? xinv : x;\n let a = 0,\n b = 1,\n c = 1,\n d = 1;\n while (true) {\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 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}\nfunction floorToDivide(x, div) {\n return x - x % div;\n}\nfunction getPageSizeInches({\n view,\n userUnit,\n rotate\n}) {\n const [x1, y1, x2, y2] = view;\n const changeOrientation = rotate % 180 !== 0;\n const width = (x2 - x1) / 72 * userUnit;\n const height = (y2 - y1) / 72 * userUnit;\n return {\n width: changeOrientation ? height : width,\n height: changeOrientation ? width : height\n };\n}\nfunction backtrackBeforeAllVisibleElements(index, views, top) {\n if (index < 2) {\n return index;\n }\n let elt = views[index].div;\n let pageTop = elt.offsetTop + elt.clientTop;\n if (pageTop >= top) {\n elt = views[index - 1].div;\n pageTop = elt.offsetTop + elt.clientTop;\n }\n for (let i = index - 2; i >= 0; --i) {\n elt = views[i].div;\n if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) {\n break;\n }\n index = i;\n }\n return index;\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 function isElementBottomAfterViewTop(view) {\n const element = view.div;\n const elementBottom = 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 const visible = [],\n ids = new Set(),\n numViews = views.length;\n let firstVisibleElementInd = binarySearchFirstItem(views, horizontal ? isElementNextAfterViewHorizontally : isElementBottomAfterViewTop);\n if (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews && !horizontal) {\n firstVisibleElementInd = backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top);\n }\n let lastEdge = horizontal ? right : -1;\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 if (lastEdge === -1) {\n if (viewBottom >= bottom) {\n lastEdge = viewBottom;\n }\n } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) {\n break;\n }\n if (viewBottom <= top || currentHeight >= bottom || viewRight <= left || currentWidth >= right) {\n continue;\n }\n const minY = Math.max(0, top - currentHeight);\n const minX = Math.max(0, left - currentWidth);\n const hiddenHeight = minY + Math.max(0, viewBottom - bottom);\n const hiddenWidth = minX + Math.max(0, viewRight - right);\n const fractionHeight = (viewHeight - hiddenHeight) / viewHeight,\n fractionWidth = (viewWidth - hiddenWidth) / viewWidth;\n const percent = fractionHeight * fractionWidth * 100 | 0;\n visible.push({\n id: view.id,\n x: currentWidth,\n y: currentHeight,\n visibleArea: percent === 100 ? null : {\n minX,\n minY,\n maxX: Math.min(viewRight, right) - currentWidth,\n maxY: Math.min(viewBottom, bottom) - currentHeight\n },\n view,\n percent,\n widthPercent: fractionWidth * 100 | 0\n });\n ids.add(view.id);\n }\n const first = visible[0],\n last = visible.at(-1);\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;\n });\n }\n return {\n first,\n last,\n views: visible,\n 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 delta = -delta;\n }\n return delta;\n}\nfunction normalizeWheelEventDelta(evt) {\n const deltaMode = evt.deltaMode;\n let delta = normalizeWheelEventDirection(evt);\n const MOUSE_PIXELS_PER_LINE = 30;\n const MOUSE_LINES_PER_PAGE = 30;\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}\nfunction isValidRotation(angle) {\n return Number.isInteger(angle) && angle % 90 === 0;\n}\nfunction isValidScrollMode(mode) {\n return Number.isInteger(mode) && Object.values(ScrollMode).includes(mode) && mode !== ScrollMode.UNKNOWN;\n}\nfunction isValidSpreadMode(mode) {\n return Number.isInteger(mode) && Object.values(SpreadMode).includes(mode) && mode !== SpreadMode.UNKNOWN;\n}\nfunction isPortraitOrientation(size) {\n return size.width <= size.height;\n}\nconst animationStarted = new Promise(function (resolve) {\n window.requestAnimationFrame(resolve);\n});\nconst docStyle = document.documentElement.style;\nclass ProgressBar {\n #classList = null;\n #disableAutoFetchTimeout = null;\n #percent = 0;\n #style = null;\n #visible = true;\n constructor(bar) {\n this.#classList = bar.classList;\n this.#style = bar.style;\n }\n get percent() {\n return this.#percent;\n }\n set percent(val) {\n this.#percent = val;\n if (isNaN(val)) {\n this.#classList.add("indeterminate");\n return;\n }\n this.#classList.remove("indeterminate");\n this.#style.setProperty("--progressBar-percent", `${this.#percent}%`);\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("--progressBar-end-offset", `${scrollbarWidth}px`);\n }\n }\n setDisableAutoFetch(delay = 5000) {\n if (this.#percent === 100 || isNaN(this.#percent)) {\n return;\n }\n if (this.#disableAutoFetchTimeout) {\n clearTimeout(this.#disableAutoFetchTimeout);\n }\n this.show();\n this.#disableAutoFetchTimeout = setTimeout(() => {\n this.#disableAutoFetchTimeout = null;\n this.hide();\n }, delay);\n }\n hide() {\n if (!this.#visible) {\n return;\n }\n this.#visible = false;\n this.#classList.add("hidden");\n }\n show() {\n if (this.#visible) {\n return;\n }\n this.#visible = true;\n this.#classList.remove("hidden");\n }\n}\nfunction getActiveOrFocusedElement() {\n let curRoot = document;\n let curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");\n while (curActiveOrFocused?.shadowRoot) {\n curRoot = curActiveOrFocused.shadowRoot;\n curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");\n }\n return curActiveOrFocused;\n}\nfunction apiPageLayoutToViewerModes(layout) {\n let scrollMode = ScrollMode.VERTICAL,\n spreadMode = SpreadMode.NONE;\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 case "TwoColumnLeft":\n spreadMode = SpreadMode.ODD;\n break;\n case "TwoPageRight":\n scrollMode = ScrollMode.PAGE;\n case "TwoColumnRight":\n spreadMode = SpreadMode.EVEN;\n break;\n }\n return {\n scrollMode,\n spreadMode\n };\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;\n}\nfunction toggleCheckedBtn(button, toggle, view = null) {\n button.classList.toggle("toggled", toggle);\n button.setAttribute("aria-checked", toggle);\n view?.classList.toggle("hidden", !toggle);\n}\nfunction toggleSelectedBtn(button, toggle, view = null) {\n button.classList.toggle("selected", toggle);\n button.setAttribute("aria-selected", toggle);\n view?.classList.toggle("hidden", !toggle);\n}\nfunction toggleExpandedBtn(button, toggle, view = null) {\n button.classList.toggle("toggled", toggle);\n button.setAttribute("aria-expanded", toggle);\n view?.classList.toggle("hidden", !toggle);\n}\nconst calcRound = function () {\n const e = document.createElement("div");\n e.style.width = "round(down, calc(1.6666666666666665 * 792px), 1px)";\n return e.style.width === "calc(1320px)" ? Math.fround : x => x;\n}();\n\n;// ./web/app_options.js\n\n\n{\n var compatParams = new Map();\n const {\n maxTouchPoints,\n platform,\n userAgent\n } = navigator;\n const isAndroid = /Android/.test(userAgent);\n const isIOS = /\\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1;\n if (isIOS || isAndroid) {\n compatParams.set("maxCanvasPixels", 5242880);\n }\n if (isAndroid) {\n compatParams.set("useSystemFonts", false);\n }\n}\nconst OptionKind = {\n BROWSER: 0x01,\n VIEWER: 0x02,\n API: 0x04,\n WORKER: 0x08,\n EVENT_DISPATCH: 0x10,\n PREFERENCE: 0x80\n};\nconst Type = {\n BOOLEAN: 0x01,\n NUMBER: 0x02,\n OBJECT: 0x04,\n STRING: 0x08,\n UNDEFINED: 0x10\n};\nconst defaultOptions = {\n allowedGlobalEvents: {\n value: null,\n kind: OptionKind.BROWSER\n },\n canvasMaxAreaInBytes: {\n value: -1,\n kind: OptionKind.BROWSER + OptionKind.API\n },\n isInAutomation: {\n value: false,\n kind: OptionKind.BROWSER\n },\n localeProperties: {\n value: {\n lang: navigator.language || "en-US"\n },\n kind: OptionKind.BROWSER\n },\n maxCanvasDim: {\n value: 32767,\n kind: OptionKind.BROWSER + OptionKind.VIEWER\n },\n nimbusDataStr: {\n value: "",\n kind: OptionKind.BROWSER\n },\n supportsCaretBrowsingMode: {\n value: false,\n kind: OptionKind.BROWSER\n },\n supportsDocumentFonts: {\n value: true,\n kind: OptionKind.BROWSER\n },\n supportsIntegratedFind: {\n value: false,\n kind: OptionKind.BROWSER\n },\n supportsMouseWheelZoomCtrlKey: {\n value: true,\n kind: OptionKind.BROWSER\n },\n supportsMouseWheelZoomMetaKey: {\n value: true,\n kind: OptionKind.BROWSER\n },\n supportsPinchToZoom: {\n value: true,\n kind: OptionKind.BROWSER\n },\n supportsPrinting: {\n value: true,\n kind: OptionKind.BROWSER\n },\n toolbarDensity: {\n value: 0,\n kind: OptionKind.BROWSER + OptionKind.EVENT_DISPATCH\n },\n altTextLearnMoreUrl: {\n value: "",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n annotationEditorMode: {\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n annotationMode: {\n value: 2,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n capCanvasAreaFactor: {\n value: 200,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n commentLearnMoreUrl: {\n value: "",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n cursorToolOnLoad: {\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n debuggerSrc: {\n value: "./debugger.mjs",\n kind: OptionKind.VIEWER\n },\n defaultZoomDelay: {\n value: 400,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n defaultZoomValue: {\n value: "",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n disableHistory: {\n value: false,\n kind: OptionKind.VIEWER\n },\n disablePageLabels: {\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n enableAltText: {\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n enableAltTextModelDownload: {\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE + OptionKind.EVENT_DISPATCH\n },\n enableAutoLinking: {\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n enableComment: {\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n enableDetailCanvas: {\n value: true,\n kind: OptionKind.VIEWER\n },\n enableGuessAltText: {\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE + OptionKind.EVENT_DISPATCH\n },\n enableHighlightFloatingButton: {\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n enableNewAltTextWhenAddingImage: {\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n enableOptimizedPartialRendering: {\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n enablePermissions: {\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n enablePrintAutoRotate: {\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n enableScripting: {\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n enableSignatureEditor: {\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n enableSplitMerge: {\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n enableUpdatedAddImage: {\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n externalLinkRel: {\n value: "noopener noreferrer nofollow",\n kind: OptionKind.VIEWER\n },\n externalLinkTarget: {\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n highlightEditorColors: {\n value: "yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F," + "yellow_HCM=#FFFFCC,green_HCM=#53FFBC,blue_HCM=#80EBFF,pink_HCM=#F6B8FF,red_HCM=#C50043",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n historyUpdateUrl: {\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n ignoreDestinationZoom: {\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n imageResourcesPath: {\n value: "./images/",\n kind: OptionKind.VIEWER\n },\n maxCanvasPixels: {\n value: 2 ** 25,\n kind: OptionKind.VIEWER\n },\n minDurationToUpdateCanvas: {\n value: 500,\n kind: OptionKind.VIEWER\n },\n forcePageColors: {\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n pageColorsBackground: {\n value: "Canvas",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n pageColorsForeground: {\n value: "CanvasText",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n pdfBugEnabled: {\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n printResolution: {\n value: 150,\n kind: OptionKind.VIEWER\n },\n sidebarViewOnLoad: {\n value: -1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n scrollModeOnLoad: {\n value: -1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n spreadModeOnLoad: {\n value: -1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n textLayerMode: {\n value: 1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n viewerCssTheme: {\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n viewOnLoad: {\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n cMapPacked: {\n value: true,\n kind: OptionKind.API\n },\n cMapUrl: {\n value: "../web/cmaps/",\n kind: OptionKind.API\n },\n disableAutoFetch: {\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE\n },\n disableFontFace: {\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE\n },\n disableRange: {\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE\n },\n disableStream: {\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE\n },\n docBaseUrl: {\n value: "",\n kind: OptionKind.API\n },\n enableHWA: {\n value: true,\n kind: OptionKind.API + OptionKind.VIEWER + OptionKind.PREFERENCE\n },\n enableXfa: {\n value: true,\n kind: OptionKind.API + OptionKind.PREFERENCE\n },\n fontExtraProperties: {\n value: false,\n kind: OptionKind.API\n },\n iccUrl: {\n value: "../web/iccs/",\n kind: OptionKind.API\n },\n isEvalSupported: {\n value: true,\n kind: OptionKind.API\n },\n isOffscreenCanvasSupported: {\n value: true,\n kind: OptionKind.API\n },\n maxImageSize: {\n value: -1,\n kind: OptionKind.API\n },\n pdfBug: {\n value: false,\n kind: OptionKind.API\n },\n standardFontDataUrl: {\n value: "../web/standard_fonts/",\n kind: OptionKind.API\n },\n useSystemFonts: {\n value: undefined,\n kind: OptionKind.API,\n type: Type.BOOLEAN + Type.UNDEFINED\n },\n verbosity: {\n value: 1,\n kind: OptionKind.API\n },\n wasmUrl: {\n value: "../web/wasm/",\n kind: OptionKind.API\n },\n workerPort: {\n value: null,\n kind: OptionKind.WORKER\n },\n workerSrc: {\n value: "../build/pdf.worker.mjs",\n kind: OptionKind.WORKER\n }\n};\n{\n defaultOptions.defaultUrl = {\n value: "compressed.tracemonkey-pldi-09.pdf",\n kind: OptionKind.VIEWER\n };\n defaultOptions.sandboxBundleSrc = {\n value: "../build/pdf.sandbox.mjs",\n kind: OptionKind.VIEWER\n };\n defaultOptions.enableFakeMLManager = {\n value: true,\n kind: OptionKind.VIEWER\n };\n}\n{\n defaultOptions.disablePreferences = {\n value: false,\n kind: OptionKind.VIEWER\n };\n}\nclass AppOptions {\n static eventBus;\n static #opts = new Map();\n static {\n for (const name in defaultOptions) {\n this.#opts.set(name, defaultOptions[name].value);\n }\n for (const [name, value] of compatParams) {\n this.#opts.set(name, value);\n }\n this._hasInvokedSet = false;\n this._checkDisablePreferences = () => {\n if (this.get("disablePreferences")) {\n return true;\n }\n if (this._hasInvokedSet) {\n console.warn("The Preferences may override manually set AppOptions; " + \'please use the "disablePreferences"-option to prevent that.\');\n }\n return false;\n };\n }\n static get(name) {\n return this.#opts.get(name);\n }\n static getAll(kind = null, defaultOnly = false) {\n const options = Object.create(null);\n for (const name in defaultOptions) {\n const defaultOpt = defaultOptions[name];\n if (kind && !(kind & defaultOpt.kind)) {\n continue;\n }\n options[name] = !defaultOnly ? this.#opts.get(name) : defaultOpt.value;\n }\n return options;\n }\n static set(name, value) {\n this.setAll({\n [name]: value\n });\n }\n static setAll(options, prefs = false) {\n this._hasInvokedSet ||= true;\n let events;\n for (const name in options) {\n const defaultOpt = defaultOptions[name],\n userOpt = options[name];\n if (!defaultOpt || !(typeof userOpt === typeof defaultOpt.value || Type[(typeof userOpt).toUpperCase()] & defaultOpt.type)) {\n continue;\n }\n const {\n kind\n } = defaultOpt;\n if (prefs && !(kind & OptionKind.BROWSER || kind & OptionKind.PREFERENCE)) {\n continue;\n }\n if (this.eventBus && kind & OptionKind.EVENT_DISPATCH) {\n (events ||= new Map()).set(name, userOpt);\n }\n this.#opts.set(name, userOpt);\n }\n if (events) {\n for (const [name, value] of events) {\n this.eventBus.dispatch(name.toLowerCase(), {\n source: this,\n value\n });\n }\n }\n }\n}\n\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.json.parse.js\nvar es_json_parse = __webpack_require__(9112);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.json.stringify.js\nvar es_json_stringify = __webpack_require__(3110);\n;// ./web/pdf_link_service.js\n\n\n\n\n\nconst DEFAULT_LINK_REL = "noopener noreferrer nofollow";\nconst LinkTarget = {\n NONE: 0,\n SELF: 1,\n BLANK: 2,\n PARENT: 3,\n TOP: 4\n};\nclass PDFLinkService {\n externalLinkEnabled = true;\n constructor({\n eventBus,\n externalLinkTarget = null,\n externalLinkRel = null,\n ignoreDestinationZoom = false\n } = {}) {\n this.eventBus = eventBus;\n this.externalLinkTarget = externalLinkTarget;\n this.externalLinkRel = externalLinkRel;\n this._ignoreDestinationZoom = ignoreDestinationZoom;\n this.baseUrl = null;\n this.pdfDocument = null;\n this.pdfViewer = null;\n this.pdfHistory = null;\n }\n setDocument(pdfDocument, baseUrl = null) {\n this.baseUrl = baseUrl;\n this.pdfDocument = pdfDocument;\n }\n setViewer(pdfViewer) {\n this.pdfViewer = pdfViewer;\n }\n setHistory(pdfHistory) {\n this.pdfHistory = pdfHistory;\n }\n get pagesCount() {\n return this.pdfDocument?.pagesMapper.pagesNumber || 0;\n }\n get page() {\n return this.pdfDocument ? this.pdfViewer.currentPageNumber : 1;\n }\n set page(value) {\n if (this.pdfDocument) {\n this.pdfViewer.currentPageNumber = value;\n }\n }\n get rotation() {\n return this.pdfDocument ? this.pdfViewer.pagesRotation : 0;\n }\n set rotation(value) {\n if (this.pdfDocument) {\n this.pdfViewer.pagesRotation = value;\n }\n }\n get isInPresentationMode() {\n return this.pdfDocument ? this.pdfViewer.isInPresentationMode : false;\n }\n async goToDestination(dest) {\n if (!this.pdfDocument) {\n return;\n }\n let namedDest, explicitDest, pageNumber;\n if (typeof dest === "string") {\n namedDest = dest;\n explicitDest = await this.pdfDocument.getDestination(dest);\n } else {\n namedDest = null;\n explicitDest = await dest;\n }\n if (!Array.isArray(explicitDest)) {\n console.error(`goToDestination: "${explicitDest}" is not a valid destination array, for dest="${dest}".`);\n return;\n }\n const [destRef] = explicitDest;\n if (destRef && typeof destRef === "object") {\n pageNumber = this.pdfDocument.cachedPageNumber(destRef);\n if (!pageNumber) {\n try {\n pageNumber = (await this.pdfDocument.getPageIndex(destRef)) + 1;\n } catch {\n console.error(`goToDestination: "${destRef}" is not a valid page reference, for dest="${dest}".`);\n return;\n }\n }\n } else if (Number.isInteger(destRef)) {\n pageNumber = destRef + 1;\n }\n if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {\n console.error(`goToDestination: "${pageNumber}" is not a valid page number, for dest="${dest}".`);\n return;\n }\n if (this.pdfHistory) {\n this.pdfHistory.pushCurrentPosition();\n this.pdfHistory.push({\n namedDest,\n explicitDest,\n pageNumber\n });\n }\n this.pdfViewer.scrollPageIntoView({\n pageNumber,\n destArray: explicitDest,\n ignoreDestinationZoom: this._ignoreDestinationZoom\n });\n const ac = new AbortController();\n this.eventBus._on("textlayerrendered", evt => {\n if (evt.pageNumber === pageNumber) {\n evt.source.textLayer.div.focus();\n ac.abort();\n }\n }, {\n signal: ac.signal\n });\n }\n goToPage(val) {\n if (!this.pdfDocument) {\n return;\n }\n const pageNumber = typeof val === "string" && this.pdfViewer.pageLabelToPageNumber(val) || val | 0;\n if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {\n console.error(`PDFLinkService.goToPage: "${val}" is not a valid page.`);\n return;\n }\n if (this.pdfHistory) {\n this.pdfHistory.pushCurrentPosition();\n this.pdfHistory.pushPage(pageNumber);\n }\n this.pdfViewer.scrollPageIntoView({\n pageNumber\n });\n }\n goToXY(pageNumber, x, y, options = {}) {\n this.pdfViewer.scrollPageIntoView({\n pageNumber,\n destArray: [null, {\n name: "XYZ"\n }, x, y],\n ignoreDestinationZoom: true,\n ...options\n });\n }\n addLinkAttributes(link, url, newWindow = false) {\n if (!url || typeof url !== "string") {\n throw new Error(\'A valid "url" parameter must provided.\');\n }\n const target = newWindow ? LinkTarget.BLANK : this.externalLinkTarget,\n rel = this.externalLinkRel;\n if (this.externalLinkEnabled) {\n link.href = link.title = url;\n } else {\n link.href = "";\n link.title = `Disabled: ${url}`;\n link.onclick = () => false;\n }\n let targetStr = "";\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 link.rel = typeof rel === "string" ? rel : DEFAULT_LINK_REL;\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 getAnchorUrl(anchor) {\n return this.baseUrl ? this.baseUrl + anchor : anchor;\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 this.eventBus.dispatch("findfromurlhash", {\n source: this,\n query: phrase ? query : query.match(/\\S+/g)\n });\n }\n if (params.has("page")) {\n pageNumber = params.get("page") | 0 || 1;\n }\n if (params.has("zoom")) {\n const zoomArgs = params.get("zoom").split(",");\n const zoomArg = zoomArgs[0];\n const zoomArgNumber = parseFloat(zoomArg);\n if (!zoomArg.includes("Fit")) {\n dest = [null, {\n name: "XYZ"\n }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, zoomArgs.length > 2 ? zoomArgs[2] | 0 : null, zoomArgNumber ? zoomArgNumber / 100 : zoomArg];\n } else if (zoomArg === "Fit" || zoomArg === "FitB") {\n dest = [null, {\n name: zoomArg\n }];\n } else if (zoomArg === "FitH" || zoomArg === "FitBH" || zoomArg === "FitV" || zoomArg === "FitBV") {\n dest = [null, {\n name: zoomArg\n }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null];\n } else if (zoomArg === "FitR") {\n if (zoomArgs.length !== 5) {\n console.error(\'PDFLinkService.setHash: Not enough parameters for "FitR".\');\n } else {\n dest = [null, {\n name: zoomArg\n }, zoomArgs[1] | 0, zoomArgs[2] | 0, zoomArgs[3] | 0, zoomArgs[4] | 0];\n }\n } else {\n console.error(`PDFLinkService.setHash: "${zoomArg}" is not a valid zoom value.`);\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;\n }\n if (params.has("pagemode")) {\n this.eventBus.dispatch("pagemode", {\n source: this,\n mode: params.get("pagemode")\n });\n }\n if (params.has("nameddest")) {\n this.goToDestination(params.get("nameddest"));\n }\n return;\n }\n dest = unescape(hash);\n try {\n dest = JSON.parse(dest);\n if (!Array.isArray(dest)) {\n dest = dest.toString();\n }\n } catch {}\n if (typeof dest === "string" || isValidExplicitDest(dest)) {\n this.goToDestination(dest);\n return;\n }\n console.error(`PDFLinkService.setHash: "${unescape(hash)}" is not a valid destination.`);\n }\n executeNamedAction(action) {\n if (!this.pdfDocument) {\n return;\n }\n switch (action) {\n case "GoBack":\n this.pdfHistory?.back();\n break;\n case "GoForward":\n this.pdfHistory?.forward();\n break;\n case "NextPage":\n this.pdfViewer.nextPage();\n break;\n case "PrevPage":\n this.pdfViewer.previousPage();\n break;\n case "LastPage":\n this.page = this.pagesCount;\n break;\n case "FirstPage":\n this.page = 1;\n break;\n default:\n break;\n }\n this.eventBus.dispatch("namedaction", {\n source: this,\n action\n });\n }\n async executeSetOCGState(action) {\n if (!this.pdfDocument) {\n return;\n }\n const pdfDocument = this.pdfDocument,\n optionalContentConfig = await this.pdfViewer.optionalContentConfigPromise;\n if (pdfDocument !== this.pdfDocument) {\n return;\n }\n optionalContentConfig.setOCGState(action);\n this.pdfViewer.optionalContentConfigPromise = Promise.resolve(optionalContentConfig);\n }\n}\nclass SimpleLinkService extends PDFLinkService {\n setDocument(pdfDocument, baseUrl = null) {}\n}\n\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.constructor.js\nvar es_iterator_constructor = __webpack_require__(8111);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.some.js\nvar es_iterator_some = __webpack_require__(3579);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.promise.with-resolvers.js\nvar es_promise_with_resolvers = __webpack_require__(4628);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/web.url.parse.js\nvar web_url_parse = __webpack_require__(5781);\n;// ./web/event_utils.js\n\n\nconst WaitOnType = {\n EVENT: "event",\n TIMEOUT: "timeout"\n};\nasync function waitOnEventOrTimeout({\n target,\n name,\n delay = 0\n}) {\n if (typeof target !== "object" || !(name && typeof name === "string") || !(Number.isInteger(delay) && delay >= 0)) {\n throw new Error("waitOnEventOrTimeout - invalid parameters.");\n }\n const {\n promise,\n resolve\n } = Promise.withResolvers();\n const ac = new AbortController();\n function handler(type) {\n ac.abort();\n clearTimeout(timeout);\n resolve(type);\n }\n const evtMethod = target instanceof EventBus ? "_on" : "addEventListener";\n target[evtMethod](name, handler.bind(null, WaitOnType.EVENT), {\n signal: ac.signal\n });\n const timeout = setTimeout(handler.bind(null, WaitOnType.TIMEOUT), delay);\n return promise;\n}\nclass EventBus {\n #listeners = Object.create(null);\n on(eventName, listener, options = null) {\n this._on(eventName, listener, {\n external: true,\n once: options?.once,\n signal: options?.signal\n });\n }\n off(eventName, listener, options = null) {\n this._off(eventName, listener);\n }\n dispatch(eventName, data) {\n const eventListeners = this.#listeners[eventName];\n if (!eventListeners || eventListeners.length === 0) {\n return;\n }\n let externalListeners;\n for (const {\n listener,\n external,\n once\n } 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 if (externalListeners) {\n for (const listener of externalListeners) {\n listener(data);\n }\n externalListeners = null;\n }\n }\n _on(eventName, listener, options = null) {\n let rmAbort = null;\n if (options?.signal instanceof AbortSignal) {\n const {\n signal\n } = options;\n if (signal.aborted) {\n console.error("Cannot use an `aborted` signal.");\n return;\n }\n const onAbort = () => this._off(eventName, listener);\n rmAbort = () => signal.removeEventListener("abort", onAbort);\n signal.addEventListener("abort", onAbort);\n }\n const eventListeners = this.#listeners[eventName] ||= [];\n eventListeners.push({\n listener,\n external: options?.external === true,\n once: options?.once === true,\n rmAbort\n });\n }\n _off(eventName, listener, options = null) {\n const eventListeners = this.#listeners[eventName];\n if (!eventListeners) {\n return;\n }\n for (let i = 0, ii = eventListeners.length; i < ii; i++) {\n const evt = eventListeners[i];\n if (evt.listener === listener) {\n evt.rmAbort?.();\n eventListeners.splice(i, 1);\n return;\n }\n }\n }\n}\nclass FirefoxEventBus extends EventBus {\n #externalServices;\n #globalEventNames;\n #isInAutomation;\n constructor(globalEventNames, externalServices, isInAutomation) {\n super();\n this.#globalEventNames = globalEventNames;\n this.#externalServices = externalServices;\n this.#isInAutomation = isInAutomation;\n }\n dispatch(eventName, data) {\n throw new Error("Not implemented: FirefoxEventBus.dispatch");\n }\n}\n\n;// ./web/external_services.js\nclass BaseExternalServices {\n updateFindControlState(data) {}\n updateFindMatchesCount(data) {}\n initPassiveLoading() {}\n reportTelemetry(data) {}\n reportText(data) {}\n async createL10n() {\n throw new Error("Not implemented: createL10n");\n }\n createScripting() {\n throw new Error("Not implemented: createScripting");\n }\n createSignatureStorage() {\n throw new Error("Not implemented: createSignatureStorage");\n }\n updateEditorStates(data) {\n throw new Error("Not implemented: updateEditorStates");\n }\n dispatchGlobalEvent(_event) {}\n}\n\n;// ./web/preferences.js\n\nclass BasePreferences {\n #defaults = Object.freeze(AppOptions.getAll(OptionKind.PREFERENCE, true));\n #initializedPromise = null;\n constructor() {\n this.#initializedPromise = this._readFromStorage(this.#defaults).then(({\n browserPrefs,\n prefs\n }) => {\n if (AppOptions._checkDisablePreferences()) {\n return;\n }\n AppOptions.setAll({\n ...browserPrefs,\n ...prefs\n }, true);\n });\n }\n async _writeToStorage(prefObj) {\n throw new Error("Not implemented: _writeToStorage");\n }\n async _readFromStorage(prefObj) {\n throw new Error("Not implemented: _readFromStorage");\n }\n async reset() {\n await this.#initializedPromise;\n AppOptions.setAll(this.#defaults, true);\n await this._writeToStorage(this.#defaults);\n }\n async set(name, value) {\n await this.#initializedPromise;\n AppOptions.setAll({\n [name]: value\n }, true);\n await this._writeToStorage(AppOptions.getAll(OptionKind.PREFERENCE));\n }\n async get(name) {\n await this.#initializedPromise;\n return AppOptions.get(name);\n }\n get defaults() {\n return this.#defaults;\n }\n get initializedPromise() {\n return this.#initializedPromise;\n }\n}\n\n;// ./node_modules/@fluent/bundle/esm/types.js\nclass FluentType {\n constructor(value) {\n this.value = value;\n }\n valueOf() {\n return this.value;\n }\n}\nclass FluentNone extends FluentType {\n constructor(value = "???") {\n super(value);\n }\n toString(scope) {\n return `{${this.value}}`;\n }\n}\nclass FluentNumber extends FluentType {\n constructor(value, opts = {}) {\n super(value);\n this.opts = opts;\n }\n toString(scope) {\n if (scope) {\n try {\n const nf = scope.memoizeIntlObject(Intl.NumberFormat, this.opts);\n return nf.format(this.value);\n } catch (err) {\n scope.reportError(err);\n }\n }\n return this.value.toString(10);\n }\n}\nclass FluentDateTime extends FluentType {\n static supportsValue(value) {\n if (typeof value === "number") return true;\n if (value instanceof Date) return true;\n if (value instanceof FluentType) return FluentDateTime.supportsValue(value.valueOf());\n if ("Temporal" in globalThis) {\n const _Temporal = globalThis.Temporal;\n if (value instanceof _Temporal.Instant || value instanceof _Temporal.PlainDateTime || value instanceof _Temporal.PlainDate || value instanceof _Temporal.PlainMonthDay || value instanceof _Temporal.PlainTime || value instanceof _Temporal.PlainYearMonth) {\n return true;\n }\n }\n return false;\n }\n constructor(value, opts = {}) {\n if (value instanceof FluentDateTime) {\n opts = {\n ...value.opts,\n ...opts\n };\n value = value.value;\n } else if (value instanceof FluentType) {\n value = value.valueOf();\n }\n if (typeof value === "object" && "calendarId" in value && opts.calendar === undefined) {\n opts = {\n ...opts,\n calendar: value.calendarId\n };\n }\n super(value);\n this.opts = opts;\n }\n [Symbol.toPrimitive](hint) {\n return hint === "string" ? this.toString() : this.toNumber();\n }\n toNumber() {\n const value = this.value;\n if (typeof value === "number") return value;\n if (value instanceof Date) return value.getTime();\n if ("epochMilliseconds" in value) {\n return value.epochMilliseconds;\n }\n if ("toZonedDateTime" in value) {\n return value.toZonedDateTime("UTC").epochMilliseconds;\n }\n throw new TypeError("Unwrapping a non-number value as a number");\n }\n toString(scope) {\n if (scope) {\n try {\n const dtf = scope.memoizeIntlObject(Intl.DateTimeFormat, this.opts);\n return dtf.format(this.value);\n } catch (err) {\n scope.reportError(err);\n }\n }\n if (typeof this.value === "number" || this.value instanceof Date) {\n return new Date(this.value).toISOString();\n }\n return this.value.toString();\n }\n}\n;// ./node_modules/@fluent/bundle/esm/resolver.js\n\n\nconst MAX_PLACEABLES = 100;\nconst FSI = "\\u2068";\nconst PDI = "\\u2069";\nfunction match(scope, selector, key) {\n if (key === selector) {\n return true;\n }\n if (key instanceof FluentNumber && selector instanceof FluentNumber && key.value === selector.value) {\n return true;\n }\n if (selector instanceof FluentNumber && typeof key === "string") {\n let category = scope.memoizeIntlObject(Intl.PluralRules, selector.opts).select(selector.value);\n if (key === category) {\n return true;\n }\n }\n return false;\n}\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}\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 } else {\n positional.push(resolveExpression(scope, arg));\n }\n }\n return {\n positional,\n named\n };\n}\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}\nfunction resolveVariableReference(scope, {\n name\n}) {\n let arg;\n if (scope.params) {\n if (Object.prototype.hasOwnProperty.call(scope.params, name)) {\n arg = scope.params[name];\n } else {\n return new FluentNone(`$${name}`);\n }\n } else if (scope.args && Object.prototype.hasOwnProperty.call(scope.args, name)) {\n arg = scope.args[name];\n } else {\n scope.reportError(new ReferenceError(`Unknown variable: $${name}`));\n return new FluentNone(`$${name}`);\n }\n if (arg instanceof FluentType) {\n return arg;\n }\n switch (typeof arg) {\n case "string":\n return arg;\n case "number":\n return new FluentNumber(arg);\n case "object":\n if (FluentDateTime.supportsValue(arg)) {\n return new FluentDateTime(arg);\n }\n default:\n scope.reportError(new TypeError(`Variable type not supported: $${name}, ${typeof arg}`));\n return new FluentNone(`$${name}`);\n }\n}\nfunction resolveMessageReference(scope, {\n name,\n attr\n}) {\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}\nfunction resolveTermReference(scope, {\n name,\n attr,\n args\n}) {\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 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}\nfunction resolveFunctionReference(scope, {\n name,\n args\n}) {\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 } catch (err) {\n scope.reportError(err);\n return new FluentNone(`${name}()`);\n }\n}\nfunction resolveSelectExpression(scope, {\n selector,\n variants,\n star\n}) {\n let sel = resolveExpression(scope, selector);\n if (sel instanceof FluentNone) {\n return getDefault(scope, variants, star);\n }\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}\nfunction resolveComplexPattern(scope, ptn) {\n if (scope.dirty.has(ptn)) {\n scope.reportError(new RangeError("Cyclic reference"));\n return new FluentNone();\n }\n scope.dirty.add(ptn);\n const result = [];\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 throw new RangeError(`Too many placeables expanded: ${scope.placeables}, ` + `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}\nfunction resolvePattern(scope, value) {\n if (typeof value === "string") {\n return scope.bundle._transform(value);\n }\n return resolveComplexPattern(scope, value);\n}\n;// ./node_modules/@fluent/bundle/esm/scope.js\n\n\nclass Scope {\n constructor(bundle, errors, args) {\n this.dirty = new WeakSet();\n this.params = null;\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;// ./node_modules/@fluent/bundle/esm/builtins.js\n\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 = ["unitDisplay", "currencyDisplay", "useGrouping", "minimumIntegerDigits", "minimumFractionDigits", "maximumFractionDigits", "minimumSignificantDigits", "maximumSignificantDigits"];\nfunction NUMBER(args, opts) {\n let arg = args[0];\n if (arg instanceof FluentNone) {\n return new FluentNone(`NUMBER(${arg.valueOf()})`);\n }\n if (arg instanceof FluentNumber) {\n return new FluentNumber(arg.valueOf(), {\n ...arg.opts,\n ...values(opts, NUMBER_ALLOWED)\n });\n }\n if (arg instanceof FluentDateTime) {\n return new FluentNumber(arg.toNumber(), {\n ...values(opts, NUMBER_ALLOWED)\n });\n }\n throw new TypeError("Invalid argument to NUMBER");\n}\nconst DATETIME_ALLOWED = ["dateStyle", "timeStyle", "fractionalSecondDigits", "dayPeriod", "hour12", "weekday", "era", "year", "month", "day", "hour", "minute", "second", "timeZoneName"];\nfunction DATETIME(args, opts) {\n let arg = args[0];\n if (arg instanceof FluentNone) {\n return new FluentNone(`DATETIME(${arg.valueOf()})`);\n }\n if (arg instanceof FluentDateTime || arg instanceof FluentNumber) {\n return new FluentDateTime(arg, values(opts, DATETIME_ALLOWED));\n }\n throw new TypeError("Invalid argument to DATETIME");\n}\n;// ./node_modules/@fluent/bundle/esm/memoizer.js\n\n\nconst cache = new Map();\nfunction 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;// ./node_modules/@fluent/bundle/esm/bundle.js\n\n\n\n\n\n\n\n\nclass FluentBundle {\n constructor(locales, {\n functions,\n useIsolating = true,\n transform = v => v\n } = {}) {\n this._terms = new Map();\n this._messages = new Map();\n this.locales = Array.isArray(locales) ? locales : [locales];\n this._functions = {\n NUMBER: NUMBER,\n DATETIME: DATETIME,\n ...functions\n };\n this._useIsolating = useIsolating;\n this._transform = transform;\n this._intls = getMemoizerForLocale(locales);\n }\n hasMessage(id) {\n return this._messages.has(id);\n }\n getMessage(id) {\n return this._messages.get(id);\n }\n addResource(res, {\n allowOverrides = false\n } = {}) {\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 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 } 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 formatPattern(pattern, args = null, errors = null) {\n if (typeof pattern === "string") {\n return this._transform(pattern);\n }\n let scope = new Scope(this, errors, args);\n try {\n let value = resolveComplexPattern(scope, pattern);\n return value.toString(scope);\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;// ./node_modules/@fluent/bundle/esm/resource.js\n\nconst RE_MESSAGE_START = /^(-?[a-zA-Z][\\w-]*) *= */gm;\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_-]*$/;\nconst RE_TEXT_RUN = /([^{}\\n\\r]+)/y;\nconst RE_STRING_RUN = /([^\\\\"\\n\\r]*)/y;\nconst RE_STRING_ESCAPE = /\\\\([\\\\"])/y;\nconst RE_UNICODE_ESCAPE = /\\\\u([a-fA-F0-9]{4})|\\\\U([a-fA-F0-9]{6})/y;\nconst RE_LEADING_NEWLINES = /^\\n+/;\nconst RE_TRAILING_SPACES = / +$/;\nconst RE_BLANK_LINES = / *\\r?\\n/g;\nconst RE_INDENT = /( *)$/;\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;\nconst TOKEN_COMMA = /\\s*,?\\s*/y;\nconst TOKEN_BLANK = /\\s+/y;\nclass FluentResource {\n constructor(source) {\n this.body = [];\n RE_MESSAGE_START.lastIndex = 0;\n let cursor = 0;\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 } catch (err) {\n if (err instanceof SyntaxError) {\n continue;\n }\n throw err;\n }\n }\n function test(re) {\n re.lastIndex = cursor;\n return re.test(source);\n }\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 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 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 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 {\n id,\n value,\n attributes\n };\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 if (test(RE_TEXT_RUN)) {\n first = match1(RE_TEXT_RUN);\n }\n if (source[cursor] === "{" || source[cursor] === "}") {\n return parsePatternElements(first ? [first] : [], Infinity);\n }\n let indent = parseIndent();\n if (indent) {\n if (first) {\n return parsePatternElements([first, indent], indent.length);\n }\n indent.value = trim(indent.value, RE_LEADING_NEWLINES);\n return parsePatternElements([indent], indent.length);\n }\n if (first) {\n return trim(first, RE_TRAILING_SPACES);\n }\n return null;\n }\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 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 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 return parsePlaceable();\n }\n if (test(RE_REFERENCE)) {\n let [, sigil, name, attr = null] = match(RE_REFERENCE);\n if (sigil === "$") {\n return {\n type: "var",\n name\n };\n }\n if (consumeToken(TOKEN_PAREN_OPEN)) {\n let args = parseArguments();\n if (sigil === "-") {\n return {\n type: "term",\n name,\n attr,\n args\n };\n }\n if (RE_FUNCTION_NAME.test(name)) {\n return {\n type: "func",\n name,\n args\n };\n }\n throw new SyntaxError("Function names must be all upper-case");\n }\n if (sigil === "-") {\n return {\n type: "term",\n name,\n attr,\n args: []\n };\n }\n return {\n type: "mesg",\n name,\n attr\n };\n }\n return parseLiteral();\n }\n function parseArguments() {\n let args = [];\n while (true) {\n switch (source[cursor]) {\n case ")":\n cursor++;\n return args;\n case undefined:\n throw new SyntaxError("Unclosed argument list");\n }\n args.push(parseArgument());\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 return {\n type: "narg",\n name: expr.name,\n value: parseLiteral()\n };\n }\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++] = {\n key,\n value\n };\n }\n if (count === 0) {\n return null;\n }\n if (star === undefined) {\n throw new SyntaxError("Expected default variant");\n }\n return {\n variants,\n star\n };\n }\n function parseVariantKey() {\n consumeToken(TOKEN_BRACKET_OPEN, SyntaxError);\n let key;\n if (test(RE_NUMBER_LITERAL)) {\n key = parseNumberLiteral();\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 {\n type: "str",\n value\n };\n }\n throw new SyntaxError("Unclosed string literal");\n }\n }\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 ? String.fromCodePoint(codepoint) : "�";\n }\n throw new SyntaxError("Unknown escape sequence");\n }\n function parseIndent() {\n let start = cursor;\n consumeToken(TOKEN_BLANK);\n switch (source[cursor]) {\n case ".":\n case "[":\n case "*":\n case "}":\n case undefined:\n return false;\n case "{":\n return makeIndent(source.slice(start, cursor));\n }\n if (source[cursor - 1] === " ") {\n return makeIndent(source.slice(start, cursor));\n }\n return false;\n }\n function trim(text, re) {\n return text.replace(re, "");\n }\n function makeIndent(blank) {\n let value = blank.replace(RE_BLANK_LINES, "\\n");\n let length = RE_INDENT.exec(blank)[1].length;\n return new Indent(value, length);\n }\n }\n}\nclass Indent {\n constructor(value, length) {\n this.value = value;\n this.length = length;\n }\n}\n;// ./node_modules/@fluent/bundle/esm/index.js\n\n\n\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.map.js\nvar es_iterator_map = __webpack_require__(1701);\n;// ./node_modules/@fluent/dom/esm/overlay.js\n\n\nconst reOverlay = /<|&#?\\w+;/;\nconst TEXT_LEVEL_ELEMENTS = {\n "http://www.w3.org/1999/xhtml": ["em", "strong", "small", "s", "cite", "q", "dfn", "abbr", "data", "time", "code", "var", "samp", "kbd", "sub", "sup", "i", "b", "u", "mark", "bdi", "bdo", "span", "br", "wbr"]\n};\nconst LOCALIZABLE_ATTRIBUTES = {\n "http://www.w3.org/1999/xhtml": {\n global: ["title", "aria-description", "aria-label", "aria-valuetext"],\n a: ["download"],\n area: ["download", "alt"],\n 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: ["accesskey", "aria-label", "aria-valuetext", "label", "title", "tooltiptext"],\n description: ["value"],\n key: ["key", "keycode"],\n label: ["value"],\n textbox: ["placeholder", "value"]\n }\n};\nfunction translateElement(element, translation) {\n const {\n value\n } = translation;\n if (typeof value === "string") {\n if (element.localName === "title" && element.namespaceURI === "http://www.w3.org/1999/xhtml") {\n element.textContent = value;\n } else if (!reOverlay.test(value)) {\n element.textContent = value;\n } else {\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 overlayAttributes(translation, element);\n}\nfunction overlayChildNodes(fromFragment, toElement) {\n for (const childNode of fromFragment.childNodes) {\n if (childNode.nodeType === childNode.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 ` + "the translation. Only safe text-level elements and elements with " + "data-l10n-name are allowed.");\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}\nfunction overlayAttributes(fromElement, toElement) {\n const explicitlyAllowed = toElement.hasAttribute("data-l10n-attrs") ? toElement.getAttribute("data-l10n-attrs").split(",").map(i => i.trim()) : null;\n for (const attr of Array.from(toElement.attributes)) {\n if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) && !hasAttribute(fromElement.attributes, attr.name)) {\n toElement.removeAttribute(attr.name);\n }\n }\n if (!fromElement.attributes) {\n return;\n }\n for (const attr of Array.from(fromElement.attributes)) {\n if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) && toElement.getAttribute(attr.name) !== attr.value) {\n toElement.setAttribute(attr.name, attr.value);\n }\n }\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 ` + `but its type ${translatedChild.localName} didn\'t match the ` + `element found in the source (${sourceChild.localName}).`);\n return createTextNodeFromTextContent(translatedChild);\n }\n sourceElement.removeChild(sourceChild);\n const clone = sourceChild.cloneNode(false);\n return shallowPopulateUsing(translatedChild, clone);\n}\nfunction createSanitizedElement(element) {\n const clone = element.ownerDocument.createElement(element.localName);\n return shallowPopulateUsing(element, clone);\n}\nfunction createTextNodeFromTextContent(element) {\n return element.ownerDocument.createTextNode(element.textContent);\n}\nfunction isElementAllowed(element) {\n const allowed = TEXT_LEVEL_ELEMENTS[element.namespaceURI];\n return allowed && allowed.includes(element.localName);\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 if (allowed.global.includes(attrName)) {\n return true;\n }\n if (!allowed[elemName]) {\n return false;\n }\n if (allowed[elemName].includes(attrName)) {\n return true;\n }\n if (element.namespaceURI === "http://www.w3.org/1999/xhtml" && elemName === "input" && 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}\nfunction shallowPopulateUsing(fromElement, toElement) {\n toElement.textContent = fromElement.textContent;\n overlayAttributes(fromElement, toElement);\n return toElement;\n}\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js\nvar es_iterator_filter = __webpack_require__(2489);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js\nvar es_iterator_for_each = __webpack_require__(7588);\n;// ./node_modules/cached-iterable/src/cached_iterable.mjs\nclass CachedIterable extends Array {\n static from(iterable) {\n if (iterable instanceof this) {\n return iterable;\n }\n return new this(iterable);\n }\n}\n;// ./node_modules/cached-iterable/src/cached_sync_iterable.mjs\n\n\nclass CachedSyncIterable extends CachedIterable {\n constructor(iterable) {\n super();\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 [Symbol.iterator]() {\n const cached = this;\n let cur = 0;\n return {\n next() {\n if (cached.length <= cur) {\n cached.push(cached.iterator.next());\n }\n return cached[cur++];\n }\n };\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 this[this.length - 1];\n }\n}\n;// ./node_modules/cached-iterable/src/cached_async_iterable.mjs\n\n\nclass CachedAsyncIterable extends CachedIterable {\n constructor(iterable) {\n super();\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 [Symbol.asyncIterator]() {\n const cached = this;\n let cur = 0;\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 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 this[this.length - 1];\n }\n}\n;// ./node_modules/cached-iterable/src/index.mjs\n\n\n;// ./node_modules/@fluent/dom/esm/localization.js\n\n\n\n\n\n\n\n\n\n\n\n\n\nclass Localization {\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 async formatWithFallback(keys, method) {\n const translations = [];\n let hasAtLeastOneBundle = false;\n for await (const bundle of this.bundles) {\n hasAtLeastOneBundle = true;\n const missingIds = keysFromBundle(method, bundle, keys, translations);\n if (missingIds.size === 0) {\n break;\n }\n if (typeof console !== "undefined") {\n const locale = bundle.locales[0];\n const ids = Array.from(missingIds).join(", ");\n console.warn(`[fluent] Missing translations in ${locale}: ${ids}`);\n }\n }\n if (!hasAtLeastOneBundle && typeof console !== "undefined") {\n console.warn(`[fluent] Request for keys failed because no resource bundles got generated.\n keys: ${JSON.stringify(keys)}.\n resourceIds: ${JSON.stringify(this.resourceIds)}.`);\n }\n return translations;\n }\n formatMessages(keys) {\n return this.formatWithFallback(keys, messageFromBundle);\n }\n formatValues(keys) {\n return this.formatWithFallback(keys, valueFromBundle);\n }\n async formatValue(id, args) {\n const [val] = await this.formatValues([{\n id,\n args\n }]);\n return val;\n }\n handleEvent() {\n this.onChange();\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}\nfunction valueFromBundle(bundle, errors, message, args) {\n if (message.value) {\n return bundle.formatPattern(message.value, args, errors);\n }\n return null;\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] = {\n name,\n value\n };\n }\n }\n return formatted;\n}\nfunction keysFromBundle(method, bundle, keys, translations) {\n const messageErrors = [];\n const missingIds = new Set();\n keys.forEach(({\n id,\n args\n }, i) => {\n if (translations[i] !== undefined) {\n return;\n }\n let message = bundle.getMessage(id);\n if (message) {\n messageErrors.length = 0;\n translations[i] = method(bundle, messageErrors, message, args);\n if (messageErrors.length > 0 && typeof console !== "undefined") {\n const locale = bundle.locales[0];\n const errors = messageErrors.join(", ");\n console.warn(`[fluent][resolver] errors in ${locale}/${id}: ${errors}.`);\n }\n } else {\n missingIds.add(id);\n }\n });\n return missingIds;\n}\n;// ./node_modules/@fluent/dom/esm/dom_localization.js\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst L10NID_ATTR_NAME = "data-l10n-id";\nconst L10NARGS_ATTR_NAME = "data-l10n-args";\nconst L10N_ELEMENT_QUERY = `[${L10NID_ATTR_NAME}]`;\nclass DOMLocalization extends Localization {\n constructor(resourceIds, generateBundles) {\n super(resourceIds, generateBundles);\n this.roots = new Set();\n this.pendingrAF = null;\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 setAttributes(element, id, args) {\n element.setAttribute(L10NID_ATTR_NAME, id);\n if (args) {\n element.setAttribute(L10NARGS_ATTR_NAME, JSON.stringify(args));\n } else {\n element.removeAttribute(L10NARGS_ATTR_NAME);\n }\n return element;\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 connectRoot(newRoot) {\n for (const root of this.roots) {\n if (root === newRoot || root.contains(newRoot) || 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 } 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 disconnectRoot(root) {\n this.roots.delete(root);\n this.pauseObserving();\n if (this.roots.size === 0) {\n this.mutationObserver = null;\n if (this.windowElement && this.pendingrAF) {\n this.windowElement.cancelAnimationFrame(this.pendingrAF);\n }\n this.windowElement = null;\n this.pendingrAF = null;\n this.pendingElements.clear();\n return true;\n }\n this.resumeObserving();\n return false;\n }\n translateRoots() {\n const roots = Array.from(this.roots);\n return Promise.all(roots.map(root => this.translateFragment(root)));\n }\n pauseObserving() {\n if (!this.mutationObserver) {\n return;\n }\n this.translateMutations(this.mutationObserver.takeRecords());\n this.mutationObserver.disconnect();\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 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 } else if (addedNode.hasAttribute(L10NID_ATTR_NAME)) {\n this.pendingElements.add(addedNode);\n }\n }\n }\n break;\n }\n }\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 translateFragment(frag) {\n return this.translateElements(this.getTranslatables(frag));\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 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 getTranslatables(element) {\n const nodes = Array.from(element.querySelectorAll(L10N_ELEMENT_QUERY));\n if (typeof element.hasAttribute === "function" && element.hasAttribute(L10NID_ATTR_NAME)) {\n nodes.push(element);\n }\n return nodes;\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;// ./node_modules/@fluent/dom/esm/index.js\n\n\n;// ./web/l10n.js\n\n\n\n\n\n\n\n\n\nclass L10n {\n #dir;\n #elements;\n #lang;\n #l10n;\n constructor({\n lang,\n isRTL\n }, l10n = null) {\n this.#lang = L10n.#fixupLangCode(lang);\n this.#l10n = l10n;\n this.#dir = isRTL ?? L10n.#isRTL(this.#lang) ? "rtl" : "ltr";\n }\n _setL10n(l10n) {\n this.#l10n = l10n;\n }\n getLanguage() {\n return this.#lang;\n }\n getDirection() {\n return this.#dir;\n }\n async get(ids, args = null, fallback) {\n if (Array.isArray(ids)) {\n ids = ids.map(id => ({\n id\n }));\n const messages = await this.#l10n.formatMessages(ids);\n return messages.map(message => message.value);\n }\n const messages = await this.#l10n.formatMessages([{\n id: ids,\n args\n }]);\n return messages[0]?.value || fallback;\n }\n async translate(element) {\n (this.#elements ||= new Set()).add(element);\n try {\n this.#l10n.connectRoot(element);\n await this.#l10n.translateRoots();\n } catch {}\n }\n async translateOnce(element) {\n try {\n await this.#l10n.translateElements([element]);\n } catch (ex) {\n console.error("translateOnce:", ex);\n }\n }\n async destroy() {\n if (this.#elements) {\n for (const element of this.#elements) {\n this.#l10n.disconnectRoot(element);\n }\n this.#elements.clear();\n this.#elements = null;\n }\n this.#l10n.pauseObserving();\n }\n pause() {\n this.#l10n.pauseObserving();\n }\n resume() {\n this.#l10n.resumeObserving();\n }\n static #fixupLangCode(langCode) {\n langCode = langCode?.toLowerCase() || "en-us";\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 static #isRTL(lang) {\n const shortCode = lang.split("-", 1)[0];\n return ["ar", "he", "fa", "ps", "ur"].includes(shortCode);\n }\n}\nconst GenericL10n = null;\n\n;// ./web/genericl10n.js\n\n\n\n\n\n\n\n\nfunction PLATFORM() {\n const {\n isAndroid,\n isLinux,\n isMac,\n isWindows\n } = FeatureTest.platform;\n if (isLinux) {\n return "linux";\n }\n if (isWindows) {\n return "windows";\n }\n if (isMac) {\n return "macos";\n }\n if (isAndroid) {\n return "android";\n }\n return "other";\n}\nfunction createBundle(lang, text) {\n const resource = new FluentResource(text);\n const bundle = new FluentBundle(lang, {\n functions: {\n PLATFORM\n }\n });\n const errors = bundle.addResource(resource);\n if (errors.length) {\n console.error("L10n errors", errors);\n }\n return bundle;\n}\nclass genericl10n_GenericL10n extends L10n {\n constructor(lang) {\n super({\n lang\n });\n const generateBundles = !lang ? genericl10n_GenericL10n.#generateBundlesFallback.bind(genericl10n_GenericL10n, this.getLanguage()) : genericl10n_GenericL10n.#generateBundles.bind(genericl10n_GenericL10n, "en-us", this.getLanguage());\n this._setL10n(new DOMLocalization([], generateBundles));\n }\n static async *#generateBundles(defaultLang, baseLang) {\n const {\n baseURL,\n paths\n } = await this.#getPaths();\n const langs = [baseLang];\n if (defaultLang !== baseLang) {\n const shortLang = baseLang.split("-", 1)[0];\n if (shortLang !== baseLang) {\n langs.push(shortLang);\n }\n langs.push(defaultLang);\n }\n const bundles = langs.map(lang => [lang, this.#createBundle(lang, baseURL, paths)]);\n for (const [lang, bundlePromise] of bundles) {\n const bundle = await bundlePromise;\n if (bundle) {\n yield bundle;\n } else if (lang === "en-us") {\n yield this.#createBundleFallback(lang);\n }\n }\n }\n 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, "text");\n return createBundle(lang, text);\n }\n static async #getPaths() {\n try {\n const {\n href\n } = document.querySelector(`link[type="application/l10n"]`);\n const paths = await fetchData(href, "json");\n return {\n baseURL: href.substring(0, href.lastIndexOf("/") + 1) || "./",\n paths\n };\n } catch {}\n return {\n baseURL: "./",\n paths: Object.create(null)\n };\n }\n static async *#generateBundlesFallback(lang) {\n yield this.#createBundleFallback(lang);\n }\n static async #createBundleFallback(lang) {\n const text = "pdfjs-previous-button =\\n .title = Previous Page\\npdfjs-previous-button-label = Previous\\npdfjs-next-button =\\n .title = Next Page\\npdfjs-next-button-label = Next\\npdfjs-page-input =\\n .title = Page\\npdfjs-of-pages = of { $pagesCount }\\npdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })\\npdfjs-zoom-out-button =\\n .title = Zoom Out\\npdfjs-zoom-out-button-label = Zoom Out\\npdfjs-zoom-in-button =\\n .title = Zoom In\\npdfjs-zoom-in-button-label = Zoom In\\npdfjs-zoom-select =\\n .title = Zoom\\npdfjs-presentation-mode-button =\\n .title = Switch to Presentation Mode\\npdfjs-presentation-mode-button-label = Presentation Mode\\npdfjs-open-file-button =\\n .title = Open File\\npdfjs-open-file-button-label = Open\\npdfjs-print-button =\\n .title = Print\\npdfjs-print-button-label = Print\\npdfjs-save-button =\\n .title = Save\\npdfjs-save-button-label = Save\\npdfjs-download-button =\\n .title = Download\\npdfjs-download-button-label = Download\\npdfjs-bookmark-button =\\n .title = Current Page (View URL from Current Page)\\npdfjs-bookmark-button-label = Current Page\\npdfjs-tools-button =\\n .title = Tools\\npdfjs-tools-button-label = Tools\\npdfjs-first-page-button =\\n .title = Go to First Page\\npdfjs-first-page-button-label = Go to First Page\\npdfjs-last-page-button =\\n .title = Go to Last Page\\npdfjs-last-page-button-label = Go to Last Page\\npdfjs-page-rotate-cw-button =\\n .title = Rotate Clockwise\\npdfjs-page-rotate-cw-button-label = Rotate Clockwise\\npdfjs-page-rotate-ccw-button =\\n .title = Rotate Counterclockwise\\npdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise\\npdfjs-cursor-text-select-tool-button =\\n .title = Enable Text Selection Tool\\npdfjs-cursor-text-select-tool-button-label = Text Selection Tool\\npdfjs-cursor-hand-tool-button =\\n .title = Enable Hand Tool\\npdfjs-cursor-hand-tool-button-label = Hand Tool\\npdfjs-scroll-page-button =\\n .title = Use Page Scrolling\\npdfjs-scroll-page-button-label = Page Scrolling\\npdfjs-scroll-vertical-button =\\n .title = Use Vertical Scrolling\\npdfjs-scroll-vertical-button-label = Vertical Scrolling\\npdfjs-scroll-horizontal-button =\\n .title = Use Horizontal Scrolling\\npdfjs-scroll-horizontal-button-label = Horizontal Scrolling\\npdfjs-scroll-wrapped-button =\\n .title = Use Wrapped Scrolling\\npdfjs-scroll-wrapped-button-label = Wrapped Scrolling\\npdfjs-spread-none-button =\\n .title = Do not join page spreads\\npdfjs-spread-none-button-label = No Spreads\\npdfjs-spread-odd-button =\\n .title = Join page spreads starting with odd-numbered pages\\npdfjs-spread-odd-button-label = Odd Spreads\\npdfjs-spread-even-button =\\n .title = Join page spreads starting with even-numbered pages\\npdfjs-spread-even-button-label = Even Spreads\\npdfjs-document-properties-button =\\n .title = Document Properties\\u2026\\npdfjs-document-properties-button-label = Document Properties\\u2026\\npdfjs-document-properties-file-name = File name:\\npdfjs-document-properties-file-size = File size:\\npdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes)\\npdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes)\\npdfjs-document-properties-title = Title:\\npdfjs-document-properties-author = Author:\\npdfjs-document-properties-subject = Subject:\\npdfjs-document-properties-keywords = Keywords:\\npdfjs-document-properties-creation-date = Creation Date:\\npdfjs-document-properties-modification-date = Modification Date:\\npdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: \\"short\\", timeStyle: \\"medium\\") }\\npdfjs-document-properties-creator = Creator:\\npdfjs-document-properties-producer = PDF Producer:\\npdfjs-document-properties-version = PDF Version:\\npdfjs-document-properties-page-count = Page Count:\\npdfjs-document-properties-page-size = Page Size:\\npdfjs-document-properties-page-size-unit-inches = in\\npdfjs-document-properties-page-size-unit-millimeters = mm\\npdfjs-document-properties-page-size-orientation-portrait = portrait\\npdfjs-document-properties-page-size-orientation-landscape = landscape\\npdfjs-document-properties-page-size-name-a-three = A3\\npdfjs-document-properties-page-size-name-a-four = A4\\npdfjs-document-properties-page-size-name-letter = Letter\\npdfjs-document-properties-page-size-name-legal = Legal\\npdfjs-document-properties-page-size-dimension-string = { $width } \\xD7 { $height } { $unit } ({ $orientation })\\npdfjs-document-properties-page-size-dimension-name-string = { $width } \\xD7 { $height } { $unit } ({ $name }, { $orientation })\\npdfjs-document-properties-linearized = Fast Web View:\\npdfjs-document-properties-linearized-yes = Yes\\npdfjs-document-properties-linearized-no = No\\npdfjs-document-properties-close-button = Close\\npdfjs-print-progress-message = Preparing document for printing\\u2026\\npdfjs-print-progress-percent = { $progress }%\\npdfjs-print-progress-close-button = Cancel\\npdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.\\npdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.\\npdfjs-current-outline-item-button =\\n .title = Find Current Outline Item\\npdfjs-current-outline-item-button-label = Current Outline Item\\npdfjs-findbar-button =\\n .title = Find in Document\\npdfjs-findbar-button-label = Find\\npdfjs-additional-layers = Additional Layers\\npdfjs-thumb-page-title1 =\\n .title = Page { $page } of { $total }\\npdfjs-thumb-page-canvas =\\n .aria-label = Thumbnail of Page { $page }\\npdfjs-thumb-page-checkbox1 =\\n .title = Select page { $page }\\npdfjs-find-input =\\n .title = Find\\n .placeholder = Find in document\\u2026\\npdfjs-find-previous-button =\\n .title = Find the previous occurrence of the phrase\\npdfjs-find-previous-button-label = Previous\\npdfjs-find-next-button =\\n .title = Find the next occurrence of the phrase\\npdfjs-find-next-button-label = Next\\npdfjs-find-highlight-checkbox = Highlight All\\npdfjs-find-match-case-checkbox-label = Match Case\\npdfjs-find-match-diacritics-checkbox-label = Match Diacritics\\npdfjs-find-entire-word-checkbox-label = Whole Words\\npdfjs-find-reached-top = Reached top of document, continued from bottom\\npdfjs-find-reached-bottom = Reached end of document, continued from top\\npdfjs-find-match-count =\\n { $total ->\\n [one] { $current } of { $total } match\\n *[other] { $current } of { $total } matches\\n }\\npdfjs-find-match-count-limit =\\n { $limit ->\\n [one] More than { $limit } match\\n *[other] More than { $limit } matches\\n }\\npdfjs-find-not-found = Phrase not found\\npdfjs-page-scale-width = Page Width\\npdfjs-page-scale-fit = Page Fit\\npdfjs-page-scale-auto = Automatic Zoom\\npdfjs-page-scale-actual = Actual Size\\npdfjs-page-scale-percent = { $scale }%\\npdfjs-page-landmark =\\n .aria-label = Page { $page }\\npdfjs-loading-error = An error occurred while loading the PDF.\\npdfjs-invalid-file-error = Invalid or corrupted PDF file.\\npdfjs-missing-file-error = Missing PDF file.\\npdfjs-unexpected-response-error = Unexpected server response.\\npdfjs-rendering-error = An error occurred while rendering the page.\\npdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: \\"short\\", timeStyle: \\"medium\\") }\\npdfjs-text-annotation-type =\\n .alt = [{ $type } Annotation]\\npdfjs-password-label = Enter the password to open this PDF file.\\npdfjs-password-invalid = Invalid password. Please try again.\\npdfjs-password-ok-button = OK\\npdfjs-password-cancel-button = Cancel\\npdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.\\npdfjs-editor-free-text-button =\\n .title = Text\\npdfjs-editor-color-picker-free-text-input =\\n .title = Change text color\\npdfjs-editor-free-text-button-label = Text\\npdfjs-editor-ink-button =\\n .title = Draw\\npdfjs-editor-color-picker-ink-input =\\n .title = Change drawing color\\npdfjs-editor-ink-button-label = Draw\\npdfjs-editor-stamp-button =\\n .title = Add or edit images\\npdfjs-editor-stamp-button-label = Add or edit images\\npdfjs-editor-highlight-button =\\n .title = Highlight\\npdfjs-editor-highlight-button-label = Highlight\\npdfjs-highlight-floating-button1 =\\n .title = Highlight\\n .aria-label = Highlight\\npdfjs-highlight-floating-button-label = Highlight\\npdfjs-comment-floating-button =\\n .title = Comment\\n .aria-label = Comment\\npdfjs-comment-floating-button-label = Comment\\npdfjs-editor-comment-button =\\n .title = Comment\\n .aria-label = Comment\\npdfjs-editor-comment-button-label = Comment\\npdfjs-editor-signature-button =\\n .title = Add signature\\npdfjs-editor-signature-button-label = Add signature\\npdfjs-editor-highlight-editor =\\n .aria-label = Highlight editor\\npdfjs-editor-ink-editor =\\n .aria-label = Drawing editor\\npdfjs-editor-signature-editor1 =\\n .aria-description = Signature editor: { $description }\\npdfjs-editor-stamp-editor =\\n .aria-label = Image editor\\npdfjs-editor-remove-ink-button =\\n .title = Remove drawing\\npdfjs-editor-remove-freetext-button =\\n .title = Remove text\\npdfjs-editor-remove-stamp-button =\\n .title = Remove image\\npdfjs-editor-remove-highlight-button =\\n .title = Remove highlight\\npdfjs-editor-remove-signature-button =\\n .title = Remove signature\\npdfjs-editor-free-text-color-input = Color\\npdfjs-editor-free-text-size-input = Size\\npdfjs-editor-ink-color-input = Color\\npdfjs-editor-ink-thickness-input = Thickness\\npdfjs-editor-ink-opacity-input = Opacity\\npdfjs-editor-stamp-add-image-button =\\n .title = Add image\\npdfjs-editor-stamp-add-image-button-label = Add image\\npdfjs-editor-free-highlight-thickness-input = Thickness\\npdfjs-editor-free-highlight-thickness-title =\\n .title = Change thickness when highlighting items other than text\\npdfjs-editor-add-signature-container =\\n .aria-label = Signature controls and saved signatures\\npdfjs-editor-signature-add-signature-button =\\n .title = Add new signature\\npdfjs-editor-signature-add-signature-button-label = Add new signature\\npdfjs-editor-add-saved-signature-button =\\n .title = Saved signature: { $description }\\npdfjs-free-text2 =\\n .aria-label = Text Editor\\n .default-content = Start typing\\u2026\\npdfjs-editor-comments-sidebar-title =\\n { $count ->\\n [one] Comment\\n *[other] Comments\\n }\\npdfjs-editor-comments-sidebar-close-button =\\n .title = Close the sidebar\\n .aria-label = Close the sidebar\\npdfjs-editor-comments-sidebar-close-button-label = Close the sidebar\\npdfjs-editor-comments-sidebar-no-comments1 = See something noteworthy? Highlight it and leave a comment.\\npdfjs-editor-comments-sidebar-no-comments-link = Learn more\\npdfjs-editor-alt-text-button =\\n .aria-label = Alt text\\npdfjs-editor-alt-text-button-label = Alt text\\npdfjs-editor-alt-text-edit-button =\\n .aria-label = Edit alt text\\npdfjs-editor-alt-text-dialog-label = Choose an option\\npdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can\\u2019t see the image or when it doesn\\u2019t load.\\npdfjs-editor-alt-text-add-description-label = Add a description\\npdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.\\npdfjs-editor-alt-text-mark-decorative-label = Mark as decorative\\npdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.\\npdfjs-editor-alt-text-cancel-button = Cancel\\npdfjs-editor-alt-text-save-button = Save\\npdfjs-editor-alt-text-decorative-tooltip = Marked as decorative\\npdfjs-editor-alt-text-textarea =\\n .placeholder = For example, \\u201CA young man sits down at a table to eat a meal\\u201D\\npdfjs-editor-resizer-top-left =\\n .aria-label = Top left corner \\u2014 resize\\npdfjs-editor-resizer-top-middle =\\n .aria-label = Top middle \\u2014 resize\\npdfjs-editor-resizer-top-right =\\n .aria-label = Top right corner \\u2014 resize\\npdfjs-editor-resizer-middle-right =\\n .aria-label = Middle right \\u2014 resize\\npdfjs-editor-resizer-bottom-right =\\n .aria-label = Bottom right corner \\u2014 resize\\npdfjs-editor-resizer-bottom-middle =\\n .aria-label = Bottom middle \\u2014 resize\\npdfjs-editor-resizer-bottom-left =\\n .aria-label = Bottom left corner \\u2014 resize\\npdfjs-editor-resizer-middle-left =\\n .aria-label = Middle left \\u2014 resize\\npdfjs-editor-highlight-colorpicker-label = Highlight color\\npdfjs-editor-colorpicker-button =\\n .title = Change color\\npdfjs-editor-colorpicker-dropdown =\\n .aria-label = Color choices\\npdfjs-editor-colorpicker-yellow =\\n .title = Yellow\\npdfjs-editor-colorpicker-green =\\n .title = Green\\npdfjs-editor-colorpicker-blue =\\n .title = Blue\\npdfjs-editor-colorpicker-pink =\\n .title = Pink\\npdfjs-editor-colorpicker-red =\\n .title = Red\\npdfjs-editor-highlight-show-all-button-label = Show all\\npdfjs-editor-highlight-show-all-button =\\n .title = Show all\\npdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description)\\npdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description)\\npdfjs-editor-new-alt-text-textarea =\\n .placeholder = Write your description here\\u2026\\npdfjs-editor-new-alt-text-description = Short description for people who can\\u2019t see the image or when the image doesn\\u2019t load.\\npdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate.\\npdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more\\npdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically\\npdfjs-editor-new-alt-text-not-now-button = Not now\\npdfjs-editor-new-alt-text-error-title = Couldn\\u2019t create alt text automatically\\npdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later.\\npdfjs-editor-new-alt-text-error-close-button = Close\\npdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\\n .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\\npdfjs-editor-new-alt-text-added-button =\\n .aria-label = Alt text added\\npdfjs-editor-new-alt-text-added-button-label = Alt text added\\npdfjs-editor-new-alt-text-missing-button =\\n .aria-label = Missing alt text\\npdfjs-editor-new-alt-text-missing-button-label = Missing alt text\\npdfjs-editor-new-alt-text-to-review-button =\\n .aria-label = Review alt text\\npdfjs-editor-new-alt-text-to-review-button-label = Review alt text\\npdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText }\\npdfjs-image-alt-text-settings-button =\\n .title = Image alt text settings\\npdfjs-image-alt-text-settings-button-label = Image alt text settings\\npdfjs-editor-alt-text-settings-dialog-label = Image alt text settings\\npdfjs-editor-alt-text-settings-automatic-title = Automatic alt text\\npdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically\\npdfjs-editor-alt-text-settings-create-model-description = Suggests descriptions to help people who can\\u2019t see the image or when the image doesn\\u2019t load.\\npdfjs-editor-alt-text-settings-editor-title = Alt text editor\\npdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image\\npdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text.\\npdfjs-editor-alt-text-settings-close-button = Close\\npdfjs-editor-highlight-added-alert = Highlight added\\npdfjs-editor-freetext-added-alert = Text added\\npdfjs-editor-ink-added-alert = Drawing added\\npdfjs-editor-stamp-added-alert = Image added\\npdfjs-editor-signature-added-alert = Signature added\\npdfjs-editor-undo-bar-message-highlight = Highlight removed\\npdfjs-editor-undo-bar-message-freetext = Text removed\\npdfjs-editor-undo-bar-message-ink = Drawing removed\\npdfjs-editor-undo-bar-message-stamp = Image removed\\npdfjs-editor-undo-bar-message-signature = Signature removed\\npdfjs-editor-undo-bar-message-comment = Comment removed\\npdfjs-editor-undo-bar-message-multiple =\\n { $count ->\\n [one] { $count } annotation removed\\n *[other] { $count } annotations removed\\n }\\npdfjs-editor-undo-bar-undo-button =\\n .title = Undo\\npdfjs-editor-undo-bar-undo-button-label = Undo\\npdfjs-editor-undo-bar-close-button =\\n .title = Close\\npdfjs-editor-undo-bar-close-button-label = Close\\npdfjs-editor-add-signature-dialog-label = This modal allows the user to create a signature to add to a PDF document. The user can edit the name (which also serves as the alt text), and optionally save the signature for repeated use.\\npdfjs-editor-add-signature-dialog-title = Add a signature\\npdfjs-editor-add-signature-type-button = Type\\n .title = Type\\npdfjs-editor-add-signature-draw-button = Draw\\n .title = Draw\\npdfjs-editor-add-signature-image-button = Image\\n .title = Image\\npdfjs-editor-add-signature-type-input =\\n .aria-label = Type your signature\\n .placeholder = Type your signature\\npdfjs-editor-add-signature-draw-placeholder = Draw your signature\\npdfjs-editor-add-signature-draw-thickness-range-label = Thickness\\npdfjs-editor-add-signature-draw-thickness-range =\\n .title = Drawing thickness: { $thickness }\\npdfjs-editor-add-signature-image-placeholder = Drag a file here to upload\\npdfjs-editor-add-signature-image-browse-link =\\n { PLATFORM() ->\\n [macos] Or choose image files\\n *[other] Or browse image files\\n }\\npdfjs-editor-add-signature-description-label = Description (alt text)\\npdfjs-editor-add-signature-description-input =\\n .title = Description (alt text)\\npdfjs-editor-add-signature-description-default-when-drawing = Signature\\npdfjs-editor-add-signature-clear-button-label = Clear signature\\npdfjs-editor-add-signature-clear-button =\\n .title = Clear signature\\npdfjs-editor-add-signature-save-checkbox = Save signature\\npdfjs-editor-add-signature-save-warning-message = You\\u2019ve reached the limit of 5 saved signatures. Remove one to save more.\\npdfjs-editor-add-signature-image-upload-error-title = Couldn\\u2019t upload image\\npdfjs-editor-add-signature-image-upload-error-description = Check your network connection or try another image.\\npdfjs-editor-add-signature-image-no-data-error-title = Can\\u2019t convert this image into a signature\\npdfjs-editor-add-signature-image-no-data-error-description = Please try uploading a different image.\\npdfjs-editor-add-signature-error-close-button = Close\\npdfjs-editor-add-signature-cancel-button = Cancel\\npdfjs-editor-add-signature-add-button = Add\\npdfjs-editor-delete-signature-button1 =\\n .title = Remove saved signature\\npdfjs-editor-delete-signature-button-label1 = Remove saved signature\\npdfjs-editor-add-signature-edit-button-label = Edit description\\npdfjs-editor-edit-signature-dialog-title = Edit description\\npdfjs-editor-edit-signature-update-button = Update\\npdfjs-show-comment-button =\\n .title = Show comment\\npdfjs-editor-edit-comment-popup-button-label = Edit comment\\npdfjs-editor-edit-comment-popup-button =\\n .title = Edit comment\\npdfjs-editor-delete-comment-popup-button-label = Remove comment\\npdfjs-editor-delete-comment-popup-button =\\n .title = Remove comment\\npdfjs-editor-edit-comment-dialog-title-when-editing = Edit comment\\npdfjs-editor-edit-comment-dialog-save-button-when-editing = Update\\npdfjs-editor-edit-comment-dialog-title-when-adding = Add comment\\npdfjs-editor-edit-comment-dialog-save-button-when-adding = Add\\npdfjs-editor-edit-comment-dialog-text-input =\\n .placeholder = Start typing\\u2026\\npdfjs-editor-edit-comment-dialog-cancel-button = Cancel\\npdfjs-editor-add-comment-button =\\n .title = Add comment\\npdfjs-toggle-views-manager-button1 =\\n .title = Manage pages\\npdfjs-toggle-views-manager-notification-button =\\n .title = Toggle Sidebar (document contains thumbnails/outline/attachments/layers)\\npdfjs-toggle-views-manager-button1-label = Manage pages\\npdfjs-views-manager-sidebar =\\n .aria-label = Sidebar\\npdfjs-views-manager-sidebar-resizer =\\n .aria-label = Sidebar resizer\\npdfjs-views-manager-view-selector-button =\\n .title = Views\\npdfjs-views-manager-view-selector-button-label = Views\\npdfjs-views-manager-pages-title = Pages\\npdfjs-views-manager-outlines-title = Document outline\\npdfjs-views-manager-attachments-title = Attachments\\npdfjs-views-manager-layers-title = Layers\\npdfjs-views-manager-pages-option-label = Pages\\npdfjs-views-manager-outlines-option-label = Document outline\\npdfjs-views-manager-attachments-option-label = Attachments\\npdfjs-views-manager-layers-option-label = Layers\\npdfjs-views-manager-add-file-button =\\n .title = Add file\\npdfjs-views-manager-add-file-button-label = Add file\\npdfjs-views-manager-pages-status-action-label =\\n { $count ->\\n [one] { $count } selected\\n *[other] { $count } selected\\n }\\npdfjs-views-manager-pages-status-none-action-label = Select pages\\npdfjs-views-manager-pages-status-action-button-label = Manage\\npdfjs-views-manager-pages-status-copy-button-label = Copy\\npdfjs-views-manager-pages-status-cut-button-label = Cut\\npdfjs-views-manager-pages-status-delete-button-label = Delete\\npdfjs-views-manager-pages-status-save-as-button-label = Save as\\u2026\\npdfjs-views-manager-status-undo-cut-label =\\n { $count ->\\n [one] 1 page cut\\n *[other] { $count } pages cut\\n }\\npdfjs-views-manager-pages-status-undo-copy-label =\\n { $count ->\\n [one] 1 page copied\\n *[other] { $count } pages copied\\n }\\npdfjs-views-manager-pages-status-undo-delete-label =\\n { $count ->\\n [one] 1 page deleted\\n *[other] { $count } pages deleted\\n }\\npdfjs-views-manager-pages-status-waiting-ready-label = Getting your file ready\\u2026\\npdfjs-views-manager-pages-status-waiting-uploading-label = Uploading file\\u2026\\npdfjs-views-manager-status-warning-cut-label = Couldn\\u2019t cut. Refresh page and try again.\\npdfjs-views-manager-status-warning-copy-label = Couldn\\u2019t copy. Refresh page and try again.\\npdfjs-views-manager-status-warning-delete-label = Couldn\\u2019t delete. Refresh page and try again.\\npdfjs-views-manager-status-warning-save-label = Couldn\\u2019t save. Refresh page and try again.\\npdfjs-views-manager-status-undo-button-label = Undo\\npdfjs-views-manager-status-close-button =\\n .title = Close\\npdfjs-views-manager-status-close-button-label = Close\\npdfjs-views-manager-paste-button-label = Paste";\n return createBundle(lang, text);\n }\n}\n\n;// ./web/generic_scripting.js\n/* unused harmony import specifier */ var generic_scripting_getPdfFilenameFromUrl;\n\nasync function docProperties(pdfDocument) {\n const url = "",\n baseUrl = "";\n const {\n info,\n metadata,\n contentDispositionFilename,\n contentLength\n } = await pdfDocument.getMetadata();\n return {\n ...info,\n baseURL: baseUrl,\n filesize: contentLength || (await pdfDocument.getDownloadInfo()).length,\n filename: contentDispositionFilename || generic_scripting_getPdfFilenameFromUrl(url),\n metadata: metadata?.getRaw(),\n authors: metadata?.get("dc:creator"),\n numPages: pdfDocument.numPages,\n URL: url\n };\n}\nclass GenericScripting {\n constructor(sandboxBundleSrc) {\n this._ready = new Promise((resolve, reject) => {\n const sandbox = import(\n /*webpackIgnore: true*/\n /*@vite-ignore*/\n sandboxBundleSrc);\n sandbox.then(pdfjsSandbox => {\n resolve(pdfjsSandbox.QuickJSSandbox());\n }).catch(reject);\n });\n }\n async createSandbox(data) {\n const sandbox = await this._ready;\n sandbox.create(data);\n }\n async dispatchEventInSandbox(event) {\n const sandbox = await this._ready;\n setTimeout(() => sandbox.dispatchEvent(event), 0);\n }\n async destroySandbox() {\n const sandbox = await this._ready;\n sandbox.nukeSandbox();\n }\n}\n\n;// ./web/generic_signature_storage.js\n\n\n\n\n\nconst KEY_STORAGE = "pdfjs.signature";\nclass SignatureStorage {\n #eventBus;\n #signatures = null;\n #signal = null;\n constructor(eventBus, signal) {\n this.#eventBus = eventBus;\n this.#signal = signal;\n }\n #save() {\n localStorage.setItem(KEY_STORAGE, JSON.stringify(Object.fromEntries(this.#signatures)));\n }\n async getAll() {\n if (this.#signal) {\n window.addEventListener("storage", ({\n key\n }) => {\n if (key === KEY_STORAGE) {\n this.#signatures = null;\n this.#eventBus?.dispatch("storedsignatureschanged", {\n source: this\n });\n }\n }, {\n signal: this.#signal\n });\n this.#signal = null;\n }\n if (!this.#signatures) {\n this.#signatures = new Map();\n const data = localStorage.getItem(KEY_STORAGE);\n if (data) {\n for (const [key, value] of Object.entries(JSON.parse(data))) {\n this.#signatures.set(key, value);\n }\n }\n }\n return this.#signatures;\n }\n async isFull() {\n return (await this.size()) === 5;\n }\n async size() {\n return (await this.getAll()).size;\n }\n async create(data) {\n if (await this.isFull()) {\n return null;\n }\n const uuid = getUuid();\n this.#signatures.set(uuid, data);\n this.#save();\n return uuid;\n }\n async delete(uuid) {\n const signatures = await this.getAll();\n if (!signatures.has(uuid)) {\n return false;\n }\n signatures.delete(uuid);\n this.#save();\n return true;\n }\n}\n\n;// ./web/genericcom.js\n\n\n\n\n\n\n\n\n\nfunction initCom(app) {}\nclass Preferences extends BasePreferences {\n async _writeToStorage(prefObj) {\n localStorage.setItem("pdfjs.preferences", JSON.stringify(prefObj));\n }\n async _readFromStorage(prefObj) {\n return {\n prefs: JSON.parse(localStorage.getItem("pdfjs.preferences"))\n };\n }\n}\nclass ExternalServices extends BaseExternalServices {\n async createL10n() {\n return new genericl10n_GenericL10n(AppOptions.get("localeProperties")?.lang);\n }\n createScripting() {\n return new GenericScripting(AppOptions.get("sandboxBundleSrc"));\n }\n createSignatureStorage(eventBus, signal) {\n return new SignatureStorage(eventBus, signal);\n }\n}\nclass MLManager {\n async isEnabledFor(_name) {\n return false;\n }\n async deleteModel(_service) {\n return null;\n }\n isReady(_name) {\n return false;\n }\n guess(_data) {}\n toggleService(_name, _enabled) {}\n}\n\n;// ./web/new_alt_text_manager.js\n\n\n\n\n\n\n\n\n\n\n\nclass NewAltTextManager {\n #boundCancel = this.#cancel.bind(this);\n #createAutomaticallyButton;\n #currentEditor = null;\n #cancelButton;\n #descriptionContainer;\n #dialog;\n #disclaimer;\n #downloadModel;\n #downloadModelDescription;\n #eventBus;\n #firstTime = false;\n #guessedAltText;\n #hasAI = null;\n #isEditing = null;\n #imagePreview;\n #imageData;\n #isAILoading = false;\n #wasAILoading = false;\n #learnMore;\n #notNowButton;\n #overlayManager;\n #textarea;\n #title;\n #uiManager;\n #previousAltText = null;\n constructor({\n descriptionContainer,\n dialog,\n imagePreview,\n cancelButton,\n disclaimer,\n notNowButton,\n saveButton,\n textarea,\n learnMore,\n errorCloseButton,\n createAutomaticallyButton,\n downloadModel,\n downloadModelDescription,\n title\n }, overlayManager, eventBus) {\n this.#cancelButton = cancelButton;\n this.#createAutomaticallyButton = createAutomaticallyButton;\n this.#descriptionContainer = descriptionContainer;\n this.#dialog = dialog;\n this.#disclaimer = disclaimer;\n this.#notNowButton = notNowButton;\n this.#imagePreview = imagePreview;\n this.#textarea = textarea;\n this.#learnMore = learnMore;\n this.#title = title;\n this.#downloadModel = downloadModel;\n this.#downloadModelDescription = downloadModelDescription;\n this.#overlayManager = overlayManager;\n this.#eventBus = eventBus;\n dialog.addEventListener("close", this.#close.bind(this));\n dialog.addEventListener("contextmenu", event => {\n if (event.target !== this.#textarea) {\n event.preventDefault();\n }\n });\n cancelButton.addEventListener("click", this.#boundCancel);\n notNowButton.addEventListener("click", this.#boundCancel);\n saveButton.addEventListener("click", this.#save.bind(this));\n errorCloseButton.addEventListener("click", () => {\n this.#toggleError(false);\n });\n createAutomaticallyButton.addEventListener("click", async () => {\n const checked = createAutomaticallyButton.getAttribute("aria-pressed") !== "true";\n this.#currentEditor._reportTelemetry({\n action: "pdfjs.image.alt_text.ai_generation_check",\n data: {\n status: checked\n }\n });\n if (this.#uiManager) {\n const isAltTextEnabled = await this.#uiManager.mlManager.isEnabledFor("altText");\n this.#createAutomaticallyButton.disabled = true;\n if (checked && !isAltTextEnabled) {\n this.#textarea.value = "";\n this.#setProgress();\n this.#uiManager.setPreference("enableGuessAltText", true);\n await this.#uiManager.mlManager.downloadModel("altText");\n this.#setPref("enableAltTextModelDownload", true);\n } else if (!checked && isAltTextEnabled) {\n this.#uiManager.setPreference("enableGuessAltText", false);\n await this.#uiManager.mlManager.deleteModel("altText");\n this.#setPref("enableAltTextModelDownload", false);\n }\n this.#createAutomaticallyButton.disabled = false;\n await this.#uiManager.mlManager.toggleService("altText", checked);\n }\n this.#toggleGuessAltText(checked, false);\n });\n textarea.addEventListener("focus", () => {\n this.#wasAILoading = this.#isAILoading;\n this.#toggleLoading(false);\n this.#toggleTitleAndDisclaimer();\n });\n textarea.addEventListener("blur", () => {\n if (!textarea.value) {\n this.#toggleLoading(this.#wasAILoading);\n }\n this.#toggleTitleAndDisclaimer();\n });\n textarea.addEventListener("input", () => {\n this.#toggleTitleAndDisclaimer();\n });\n textarea.addEventListener("keydown", e => {\n if ((e.ctrlKey || e.metaKey) && e.key === "Enter" && !saveButton.disabled) {\n this.#save();\n }\n });\n eventBus._on("enableguessalttext", ({\n value\n }) => {\n this.#toggleGuessAltText(value, false);\n });\n this.#overlayManager.register(dialog);\n this.#learnMore.addEventListener("click", () => {\n this.#currentEditor._reportTelemetry({\n action: "pdfjs.image.alt_text.info",\n data: {\n topic: "alt_text"\n }\n });\n });\n }\n #setPref(name, value) {\n this.#eventBus.dispatch("setpreference", {\n source: this,\n name,\n value\n });\n }\n #toggleLoading(value) {\n if (!this.#uiManager || this.#isAILoading === value) {\n return;\n }\n this.#isAILoading = value;\n this.#descriptionContainer.classList.toggle("loading", value);\n }\n #toggleError(value) {\n if (!this.#uiManager) {\n return;\n }\n this.#dialog.classList.toggle("error", value);\n }\n async #toggleGuessAltText(value, isInitial) {\n if (!this.#uiManager) {\n return;\n }\n this.#dialog.classList.toggle("aiDisabled", !value);\n this.#createAutomaticallyButton.setAttribute("aria-pressed", value);\n if (value) {\n const {\n altTextLearnMoreUrl\n } = this.#uiManager.mlManager;\n if (altTextLearnMoreUrl) {\n this.#learnMore.href = altTextLearnMoreUrl;\n }\n this.#mlGuessAltText(isInitial);\n } else {\n this.#toggleLoading(false);\n this.#isAILoading = false;\n this.#toggleTitleAndDisclaimer();\n }\n }\n #toggleNotNow() {\n this.#notNowButton.classList.toggle("hidden", !this.#firstTime);\n this.#cancelButton.classList.toggle("hidden", this.#firstTime);\n }\n #toggleAI(value) {\n if (!this.#uiManager || this.#hasAI === value) {\n return;\n }\n this.#hasAI = value;\n this.#dialog.classList.toggle("noAi", !value);\n this.#toggleTitleAndDisclaimer();\n }\n #toggleTitleAndDisclaimer() {\n const visible = this.#isAILoading || this.#guessedAltText && this.#guessedAltText === this.#textarea.value;\n this.#disclaimer.hidden = !visible;\n const isEditing = this.#isAILoading || !!this.#textarea.value;\n if (this.#isEditing === isEditing) {\n return;\n }\n this.#isEditing = isEditing;\n this.#title.setAttribute("data-l10n-id", isEditing ? "pdfjs-editor-new-alt-text-dialog-edit-label" : "pdfjs-editor-new-alt-text-dialog-add-label");\n }\n async #mlGuessAltText(isInitial) {\n if (this.#isAILoading) {\n return;\n }\n if (this.#textarea.value) {\n return;\n }\n if (isInitial && this.#previousAltText !== null) {\n return;\n }\n this.#guessedAltText = this.#currentEditor.guessedAltText;\n if (this.#previousAltText === null && this.#guessedAltText) {\n this.#addAltText(this.#guessedAltText);\n return;\n }\n this.#toggleLoading(true);\n this.#toggleTitleAndDisclaimer();\n let hasError = false;\n try {\n const altText = await this.#currentEditor.mlGuessAltText(this.#imageData, false);\n if (altText) {\n this.#guessedAltText = altText;\n this.#wasAILoading = this.#isAILoading;\n if (this.#isAILoading) {\n this.#addAltText(altText);\n }\n }\n } catch (e) {\n console.error(e);\n hasError = true;\n }\n this.#toggleLoading(false);\n this.#toggleTitleAndDisclaimer();\n if (hasError && this.#uiManager) {\n this.#toggleError(true);\n }\n }\n #addAltText(altText) {\n if (!this.#uiManager || this.#textarea.value) {\n return;\n }\n this.#textarea.value = altText;\n this.#toggleTitleAndDisclaimer();\n }\n #setProgress() {\n this.#downloadModel.classList.toggle("hidden", false);\n const callback = async ({\n detail: {\n finished,\n total,\n totalLoaded\n }\n }) => {\n const ONE_MEGA_BYTES = 1e6;\n totalLoaded = Math.min(0.99 * total, totalLoaded);\n const totalSize = this.#downloadModelDescription.ariaValueMax = Math.round(total / ONE_MEGA_BYTES);\n const downloadedSize = this.#downloadModelDescription.ariaValueNow = Math.round(totalLoaded / ONE_MEGA_BYTES);\n this.#downloadModelDescription.setAttribute("data-l10n-args", JSON.stringify({\n totalSize,\n downloadedSize\n }));\n if (!finished) {\n return;\n }\n this.#eventBus._off("loadaiengineprogress", callback);\n this.#downloadModel.classList.toggle("hidden", true);\n this.#toggleAI(true);\n if (!this.#uiManager) {\n return;\n }\n const {\n mlManager\n } = this.#uiManager;\n mlManager.toggleService("altText", true);\n this.#toggleGuessAltText(await mlManager.isEnabledFor("altText"), true);\n };\n this.#eventBus._on("loadaiengineprogress", callback);\n }\n async editAltText(uiManager, editor, firstTime) {\n if (this.#currentEditor || !editor) {\n return;\n }\n if (firstTime && editor.hasAltTextData()) {\n editor.altTextFinish();\n return;\n }\n this.#firstTime = firstTime;\n const {\n mlManager\n } = uiManager;\n const hasAI = !!mlManager;\n this.#toggleTitleAndDisclaimer();\n if (mlManager && !mlManager.isReady("altText")) {\n if (mlManager.hasProgress) {\n this.#setProgress();\n } else {\n this.#createAutomaticallyButton.setAttribute("aria-pressed", false);\n }\n } else {\n this.#downloadModel.classList.toggle("hidden", true);\n }\n const isAltTextEnabledPromise = mlManager?.isEnabledFor("altText");\n this.#currentEditor = editor;\n this.#uiManager = uiManager;\n this.#uiManager.removeEditListeners();\n ({\n altText: this.#previousAltText\n } = editor.altTextData);\n this.#textarea.value = this.#previousAltText ?? "";\n const AI_MAX_IMAGE_DIMENSION = 224;\n const MAX_PREVIEW_DIMENSION = 180;\n let canvas, width, height;\n if (mlManager) {\n ({\n canvas,\n width,\n height,\n imageData: this.#imageData\n } = editor.copyCanvas(AI_MAX_IMAGE_DIMENSION, MAX_PREVIEW_DIMENSION, true));\n if (hasAI) {\n this.#toggleGuessAltText(await isAltTextEnabledPromise, true);\n }\n } else {\n ({\n canvas,\n width,\n height\n } = editor.copyCanvas(AI_MAX_IMAGE_DIMENSION, MAX_PREVIEW_DIMENSION, false));\n }\n canvas.setAttribute("role", "presentation");\n const {\n style\n } = canvas;\n style.width = `${width}px`;\n style.height = `${height}px`;\n this.#imagePreview.append(canvas);\n this.#toggleNotNow();\n this.#toggleAI(hasAI);\n this.#toggleError(false);\n try {\n await this.#overlayManager.open(this.#dialog);\n } catch (ex) {\n this.#close();\n throw ex;\n }\n }\n #cancel() {\n this.#currentEditor.altTextData = {\n cancel: true\n };\n const altText = this.#textarea.value.trim();\n this.#currentEditor._reportTelemetry({\n action: "pdfjs.image.alt_text.dismiss",\n data: {\n alt_text_type: altText ? "present" : "empty",\n flow: this.#firstTime ? "image_add" : "alt_text_edit"\n }\n });\n this.#currentEditor._reportTelemetry({\n action: "pdfjs.image.image_added",\n data: {\n alt_text_modal: true,\n alt_text_type: "skipped"\n }\n });\n this.#finish();\n }\n #finish() {\n this.#overlayManager.closeIfActive(this.#dialog);\n }\n #close() {\n const canvas = this.#imagePreview.firstElementChild;\n canvas.remove();\n canvas.width = canvas.height = 0;\n this.#imageData = null;\n this.#toggleLoading(false);\n this.#uiManager?.addEditListeners();\n this.#currentEditor.altTextFinish();\n this.#uiManager?.setSelected(this.#currentEditor);\n this.#currentEditor = null;\n this.#uiManager = null;\n }\n #extractWords(text) {\n return new Set(text.toLowerCase().split(/[^\\p{L}\\p{N}]+/gu).filter(x => !!x));\n }\n #save() {\n const altText = this.#textarea.value.trim();\n this.#currentEditor.altTextData = {\n altText,\n decorative: false\n };\n this.#currentEditor.altTextData.guessedAltText = this.#guessedAltText;\n if (this.#guessedAltText && this.#guessedAltText !== altText) {\n const guessedWords = this.#extractWords(this.#guessedAltText);\n const words = this.#extractWords(altText);\n this.#currentEditor._reportTelemetry({\n action: "pdfjs.image.alt_text.user_edit",\n data: {\n total_words: guessedWords.size,\n words_removed: guessedWords.difference(words).size,\n words_added: words.difference(guessedWords).size\n }\n });\n }\n this.#currentEditor._reportTelemetry({\n action: "pdfjs.image.image_added",\n data: {\n alt_text_modal: true,\n alt_text_type: altText ? "present" : "empty"\n }\n });\n this.#currentEditor._reportTelemetry({\n action: "pdfjs.image.alt_text.save",\n data: {\n alt_text_type: altText ? "present" : "empty",\n flow: this.#firstTime ? "image_add" : "alt_text_edit"\n }\n });\n this.#finish();\n }\n destroy() {\n this.#uiManager = null;\n this.#finish();\n }\n}\nclass ImageAltTextSettings {\n #createModelButton;\n #dialog;\n #eventBus;\n #mlManager;\n #overlayManager;\n #showAltTextDialogButton;\n constructor({\n dialog,\n createModelButton,\n learnMore,\n closeButton,\n showAltTextDialogButton\n }, overlayManager, eventBus, mlManager) {\n this.#dialog = dialog;\n this.#createModelButton = createModelButton;\n this.#showAltTextDialogButton = showAltTextDialogButton;\n this.#overlayManager = overlayManager;\n this.#eventBus = eventBus;\n this.#mlManager = mlManager;\n const {\n altTextLearnMoreUrl\n } = mlManager;\n if (altTextLearnMoreUrl) {\n learnMore.href = altTextLearnMoreUrl;\n }\n dialog.addEventListener("contextmenu", noContextMenu);\n createModelButton.addEventListener("click", async e => {\n const checked = this.#togglePref("enableGuessAltText", e);\n await (checked ? this.#download(true) : this.#delete(true));\n await mlManager.toggleService("altText", checked);\n this.#reportTelemetry({\n type: "stamp",\n action: "pdfjs.image.alt_text.settings_ai_generation_check",\n data: {\n status: checked\n }\n });\n });\n showAltTextDialogButton.addEventListener("click", e => {\n const checked = this.#togglePref("enableNewAltTextWhenAddingImage", e);\n this.#reportTelemetry({\n type: "stamp",\n action: "pdfjs.image.alt_text.settings_edit_alt_text_check",\n data: {\n status: checked\n }\n });\n });\n closeButton.addEventListener("click", this.#finish.bind(this));\n learnMore.addEventListener("click", () => {\n this.#reportTelemetry({\n type: "stamp",\n action: "pdfjs.image.alt_text.info",\n data: {\n topic: "ai_generation"\n }\n });\n });\n eventBus._on("enablealttextmodeldownload", ({\n value\n }) => {\n if (value) {\n this.#download(false);\n } else {\n this.#delete(false);\n }\n });\n this.#overlayManager.register(dialog);\n }\n #reportTelemetry(data) {\n this.#eventBus.dispatch("reporttelemetry", {\n source: this,\n details: {\n type: "editing",\n data\n }\n });\n }\n async #download(isFromUI = false) {\n if (isFromUI) {\n await this.#mlManager.downloadModel("altText");\n this.#setPref("enableGuessAltText", true);\n this.#mlManager.toggleService("altText", true);\n this.#setPref("enableAltTextModelDownload", true);\n }\n }\n async #delete(isFromUI = false) {\n if (isFromUI) {\n await this.#mlManager.deleteModel("altText");\n this.#setPref("enableGuessAltText", false);\n this.#setPref("enableAltTextModelDownload", false);\n }\n this.#createModelButton.setAttribute("aria-pressed", false);\n }\n async open({\n enableGuessAltText,\n enableNewAltTextWhenAddingImage\n }) {\n const {\n enableAltTextModelDownload\n } = this.#mlManager;\n this.#createModelButton.setAttribute("aria-pressed", enableAltTextModelDownload && enableGuessAltText);\n this.#showAltTextDialogButton.setAttribute("aria-pressed", enableNewAltTextWhenAddingImage);\n await this.#overlayManager.open(this.#dialog);\n this.#reportTelemetry({\n type: "stamp",\n action: "pdfjs.image.alt_text.settings_displayed"\n });\n }\n #togglePref(name, {\n target\n }) {\n const checked = target.getAttribute("aria-pressed") !== "true";\n this.#setPref(name, checked);\n target.setAttribute("aria-pressed", checked);\n return checked;\n }\n #setPref(name, value) {\n this.#eventBus.dispatch("setpreference", {\n source: this,\n name,\n value\n });\n }\n #finish() {\n this.#overlayManager.closeIfActive(this.#dialog);\n }\n}\n\n;// ./web/alt_text_manager.js\n\nclass AltTextManager {\n #clickAC = null;\n #currentEditor = null;\n #cancelButton;\n #dialog;\n #eventBus;\n #hasUsedPointer = false;\n #optionDescription;\n #optionDecorative;\n #overlayManager;\n #saveButton;\n #textarea;\n #uiManager;\n #previousAltText = null;\n #resizeAC = null;\n #svgElement = null;\n #rectElement = null;\n #container;\n #telemetryData = null;\n constructor({\n dialog,\n optionDescription,\n optionDecorative,\n textarea,\n cancelButton,\n saveButton\n }, container, overlayManager, eventBus) {\n this.#dialog = dialog;\n this.#optionDescription = optionDescription;\n this.#optionDecorative = optionDecorative;\n this.#textarea = textarea;\n this.#cancelButton = cancelButton;\n this.#saveButton = saveButton;\n this.#overlayManager = overlayManager;\n this.#eventBus = eventBus;\n this.#container = container;\n const onUpdateUIState = this.#updateUIState.bind(this);\n dialog.addEventListener("close", this.#close.bind(this));\n dialog.addEventListener("contextmenu", event => {\n if (event.target !== this.#textarea) {\n event.preventDefault();\n }\n });\n cancelButton.addEventListener("click", this.#finish.bind(this));\n saveButton.addEventListener("click", this.#save.bind(this));\n optionDescription.addEventListener("change", onUpdateUIState);\n optionDecorative.addEventListener("change", onUpdateUIState);\n textarea.addEventListener("keydown", e => {\n if ((e.ctrlKey || e.metaKey) && e.key === "Enter" && !saveButton.disabled) {\n this.#save();\n }\n });\n this.#overlayManager.register(dialog);\n }\n #createSVGElement() {\n if (this.#svgElement) {\n return;\n }\n const svgFactory = new DOMSVGFactory();\n const svg = this.#svgElement = svgFactory.createElement("svg");\n svg.setAttribute("width", "0");\n svg.setAttribute("height", "0");\n const defs = svgFactory.createElement("defs");\n svg.append(defs);\n const mask = svgFactory.createElement("mask");\n defs.append(mask);\n mask.setAttribute("id", "alttext-manager-mask");\n mask.setAttribute("maskContentUnits", "objectBoundingBox");\n let rect = svgFactory.createElement("rect");\n mask.append(rect);\n rect.setAttribute("fill", "white");\n rect.setAttribute("width", "1");\n rect.setAttribute("height", "1");\n rect.setAttribute("x", "0");\n rect.setAttribute("y", "0");\n rect = this.#rectElement = svgFactory.createElement("rect");\n mask.append(rect);\n rect.setAttribute("fill", "black");\n this.#dialog.append(svg);\n }\n async editAltText(uiManager, editor) {\n if (this.#currentEditor || !editor) {\n return;\n }\n this.#createSVGElement();\n this.#hasUsedPointer = false;\n this.#clickAC = new AbortController();\n const clickOpts = {\n signal: this.#clickAC.signal\n },\n onClick = this.#onClick.bind(this);\n for (const element of [this.#optionDescription, this.#optionDecorative, this.#textarea, this.#saveButton, this.#cancelButton]) {\n element.addEventListener("click", onClick, clickOpts);\n }\n const {\n altText,\n decorative\n } = editor.altTextData;\n if (decorative === true) {\n this.#optionDecorative.checked = true;\n this.#optionDescription.checked = false;\n } else {\n this.#optionDecorative.checked = false;\n this.#optionDescription.checked = true;\n }\n this.#previousAltText = this.#textarea.value = altText?.trim() || "";\n this.#updateUIState();\n this.#currentEditor = editor;\n this.#uiManager = uiManager;\n this.#uiManager.removeEditListeners();\n this.#resizeAC = new AbortController();\n this.#eventBus._on("resize", this.#setPosition.bind(this), {\n signal: this.#resizeAC.signal\n });\n try {\n await this.#overlayManager.open(this.#dialog);\n this.#setPosition();\n } catch (ex) {\n this.#close();\n throw ex;\n }\n }\n #setPosition() {\n if (!this.#currentEditor) {\n return;\n }\n const dialog = this.#dialog;\n const {\n style\n } = dialog;\n const {\n x: containerX,\n y: containerY,\n width: containerW,\n height: containerH\n } = this.#container.getBoundingClientRect();\n const {\n innerWidth: windowW,\n innerHeight: windowH\n } = window;\n const {\n width: dialogW,\n height: dialogH\n } = dialog.getBoundingClientRect();\n const {\n x,\n y,\n width,\n height\n } = this.#currentEditor.getClientDimensions();\n const MARGIN = 10;\n const isLTR = this.#uiManager.direction === "ltr";\n const xs = Math.max(x, containerX);\n const xe = Math.min(x + width, containerX + containerW);\n const ys = Math.max(y, containerY);\n const ye = Math.min(y + height, containerY + containerH);\n this.#rectElement.setAttribute("width", `${(xe - xs) / windowW}`);\n this.#rectElement.setAttribute("height", `${(ye - ys) / windowH}`);\n this.#rectElement.setAttribute("x", `${xs / windowW}`);\n this.#rectElement.setAttribute("y", `${ys / windowH}`);\n let left = null;\n let top = Math.max(y, 0);\n top += Math.min(windowH - (top + dialogH), 0);\n if (isLTR) {\n if (x + width + MARGIN + dialogW < windowW) {\n left = x + width + MARGIN;\n } else if (x > dialogW + MARGIN) {\n left = x - dialogW - MARGIN;\n }\n } else if (x > dialogW + MARGIN) {\n left = x - dialogW - MARGIN;\n } else if (x + width + MARGIN + dialogW < windowW) {\n left = x + width + MARGIN;\n }\n if (left === null) {\n top = null;\n left = Math.max(x, 0);\n left += Math.min(windowW - (left + dialogW), 0);\n if (y > dialogH + MARGIN) {\n top = y - dialogH - MARGIN;\n } else if (y + height + MARGIN + dialogH < windowH) {\n top = y + height + MARGIN;\n }\n }\n if (top !== null) {\n dialog.classList.add("positioned");\n if (isLTR) {\n style.left = `${left}px`;\n } else {\n style.right = `${windowW - left - dialogW}px`;\n }\n style.top = `${top}px`;\n } else {\n dialog.classList.remove("positioned");\n style.left = "";\n style.top = "";\n }\n }\n #finish() {\n this.#overlayManager.closeIfActive(this.#dialog);\n }\n #close() {\n this.#currentEditor._reportTelemetry(this.#telemetryData || {\n action: "alt_text_cancel",\n alt_text_keyboard: !this.#hasUsedPointer\n });\n this.#telemetryData = null;\n this.#removeOnClickListeners();\n this.#uiManager?.addEditListeners();\n this.#resizeAC?.abort();\n this.#resizeAC = null;\n this.#currentEditor.altTextFinish();\n this.#currentEditor = null;\n this.#uiManager = null;\n }\n #updateUIState() {\n this.#textarea.disabled = this.#optionDecorative.checked;\n }\n #save() {\n const altText = this.#textarea.value.trim();\n const decorative = this.#optionDecorative.checked;\n this.#currentEditor.altTextData = {\n altText,\n decorative\n };\n this.#telemetryData = {\n action: "alt_text_save",\n alt_text_description: !!altText,\n alt_text_edit: !!this.#previousAltText && this.#previousAltText !== altText,\n alt_text_decorative: decorative,\n alt_text_keyboard: !this.#hasUsedPointer\n };\n this.#finish();\n }\n #onClick(evt) {\n if (evt.detail === 0) {\n return;\n }\n this.#hasUsedPointer = true;\n this.#removeOnClickListeners();\n }\n #removeOnClickListeners() {\n this.#clickAC?.abort();\n this.#clickAC = null;\n }\n destroy() {\n this.#uiManager = null;\n this.#finish();\n this.#svgElement?.remove();\n this.#svgElement = this.#rectElement = null;\n }\n}\n\n;// ./web/annotation_editor_params.js\n\nclass AnnotationEditorParams {\n constructor(options, eventBus) {\n this.eventBus = eventBus;\n this.#bindListeners(options);\n }\n #bindListeners({\n editorFreeTextFontSize,\n editorFreeTextColor,\n editorInkColor,\n editorInkThickness,\n editorInkOpacity,\n editorStampAddImage,\n editorFreeHighlightThickness,\n editorHighlightShowAll,\n editorSignatureAddSignature\n }) {\n const {\n eventBus\n } = this;\n const dispatchEvent = (typeStr, value) => {\n eventBus.dispatch("switchannotationeditorparams", {\n source: this,\n type: AnnotationEditorParamsType[typeStr],\n value\n });\n };\n editorFreeTextFontSize.addEventListener("input", function () {\n dispatchEvent("FREETEXT_SIZE", this.valueAsNumber);\n });\n editorFreeTextColor.addEventListener("input", function () {\n dispatchEvent("FREETEXT_COLOR", this.value);\n });\n editorInkColor.addEventListener("input", function () {\n dispatchEvent("INK_COLOR", this.value);\n });\n editorInkThickness.addEventListener("input", function () {\n dispatchEvent("INK_THICKNESS", this.valueAsNumber);\n });\n editorInkOpacity.addEventListener("input", function () {\n dispatchEvent("INK_OPACITY", this.valueAsNumber);\n });\n editorStampAddImage.addEventListener("click", () => {\n eventBus.dispatch("reporttelemetry", {\n source: this,\n details: {\n type: "editing",\n data: {\n action: "pdfjs.image.add_image_click"\n }\n }\n });\n dispatchEvent("CREATE");\n });\n editorFreeHighlightThickness.addEventListener("input", function () {\n dispatchEvent("HIGHLIGHT_THICKNESS", this.valueAsNumber);\n });\n editorHighlightShowAll.addEventListener("click", function () {\n const checked = this.getAttribute("aria-pressed") === "true";\n this.setAttribute("aria-pressed", !checked);\n dispatchEvent("HIGHLIGHT_SHOW_ALL", !checked);\n });\n editorSignatureAddSignature.addEventListener("click", () => {\n dispatchEvent("CREATE");\n });\n eventBus._on("annotationeditorparamschanged", evt => {\n for (const [type, value] of evt.details) {\n switch (type) {\n case AnnotationEditorParamsType.FREETEXT_SIZE:\n editorFreeTextFontSize.value = value;\n break;\n case AnnotationEditorParamsType.FREETEXT_COLOR:\n editorFreeTextColor.value = value;\n break;\n case AnnotationEditorParamsType.INK_COLOR:\n editorInkColor.value = value;\n break;\n case AnnotationEditorParamsType.INK_THICKNESS:\n editorInkThickness.value = value;\n break;\n case AnnotationEditorParamsType.INK_OPACITY:\n editorInkOpacity.value = value;\n break;\n case AnnotationEditorParamsType.HIGHLIGHT_COLOR:\n eventBus.dispatch("mainhighlightcolorpickerupdatecolor", {\n source: this,\n value\n });\n break;\n case AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:\n editorFreeHighlightThickness.value = value;\n break;\n case AnnotationEditorParamsType.HIGHLIGHT_FREE:\n editorFreeHighlightThickness.disabled = !value;\n break;\n case AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:\n editorHighlightShowAll.setAttribute("aria-pressed", value);\n break;\n }\n }\n });\n }\n}\n\n;// ./web/caret_browsing.js\n\nconst PRECISION = 1e-1;\nclass CaretBrowsingMode {\n #mainContainer;\n #toolBarHeight = 0;\n #viewerContainer;\n constructor(abortSignal, mainContainer, viewerContainer, toolbarContainer) {\n this.#mainContainer = mainContainer;\n this.#viewerContainer = viewerContainer;\n if (!toolbarContainer) {\n return;\n }\n this.#toolBarHeight = toolbarContainer.getBoundingClientRect().height;\n const toolbarObserver = new ResizeObserver(entries => {\n for (const entry of entries) {\n if (entry.target === toolbarContainer) {\n this.#toolBarHeight = Math.floor(entry.borderBoxSize[0].blockSize);\n break;\n }\n }\n });\n toolbarObserver.observe(toolbarContainer);\n abortSignal.addEventListener("abort", () => toolbarObserver.disconnect(), {\n once: true\n });\n }\n #isOnSameLine(rect1, rect2) {\n const top1 = rect1.y;\n const bot1 = rect1.bottom;\n const mid1 = rect1.y + rect1.height / 2;\n const top2 = rect2.y;\n const bot2 = rect2.bottom;\n const mid2 = rect2.y + rect2.height / 2;\n return top1 <= mid2 && mid2 <= bot1 || top2 <= mid1 && mid1 <= bot2;\n }\n #isUnderOver(rect, x, y, isUp) {\n const midY = rect.y + rect.height / 2;\n return (isUp ? y >= midY : y <= midY) && rect.x - PRECISION <= x && x <= rect.right + PRECISION;\n }\n #isVisible(rect) {\n return rect.top >= this.#toolBarHeight && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);\n }\n #getCaretPosition(selection, isUp) {\n const {\n focusNode,\n focusOffset\n } = selection;\n const range = document.createRange();\n range.setStart(focusNode, focusOffset);\n range.setEnd(focusNode, focusOffset);\n const rect = range.getBoundingClientRect();\n return [rect.x, isUp ? rect.top : rect.bottom];\n }\n static #caretPositionFromPoint(x, y) {\n if (!document.caretPositionFromPoint) {\n const {\n startContainer: offsetNode,\n startOffset: offset\n } = document.caretRangeFromPoint(x, y);\n return {\n offsetNode,\n offset\n };\n }\n return document.caretPositionFromPoint(x, y);\n }\n #setCaretPositionHelper(selection, caretX, select, element, rect) {\n rect ||= element.getBoundingClientRect();\n if (caretX <= rect.x + PRECISION) {\n if (select) {\n selection.extend(element.firstChild, 0);\n } else {\n selection.setPosition(element.firstChild, 0);\n }\n return;\n }\n if (rect.right - PRECISION <= caretX) {\n const {\n lastChild\n } = element;\n if (select) {\n selection.extend(lastChild, lastChild.length);\n } else {\n selection.setPosition(lastChild, lastChild.length);\n }\n return;\n }\n const midY = rect.y + rect.height / 2;\n let caretPosition = CaretBrowsingMode.#caretPositionFromPoint(caretX, midY);\n let parentElement = caretPosition.offsetNode?.parentElement;\n if (parentElement && parentElement !== element) {\n const elementsAtPoint = document.elementsFromPoint(caretX, midY);\n const savedVisibilities = [];\n for (const el of elementsAtPoint) {\n if (el === element) {\n break;\n }\n const {\n style\n } = el;\n savedVisibilities.push([el, style.visibility]);\n style.visibility = "hidden";\n }\n caretPosition = CaretBrowsingMode.#caretPositionFromPoint(caretX, midY);\n parentElement = caretPosition.offsetNode?.parentElement;\n for (const [el, visibility] of savedVisibilities) {\n el.style.visibility = visibility;\n }\n }\n if (parentElement !== element) {\n if (select) {\n selection.extend(element.firstChild, 0);\n } else {\n selection.setPosition(element.firstChild, 0);\n }\n return;\n }\n if (select) {\n selection.extend(caretPosition.offsetNode, caretPosition.offset);\n } else {\n selection.setPosition(caretPosition.offsetNode, caretPosition.offset);\n }\n }\n #setCaretPosition(select, selection, newLineElement, newLineElementRect, caretX) {\n if (this.#isVisible(newLineElementRect)) {\n this.#setCaretPositionHelper(selection, caretX, select, newLineElement, newLineElementRect);\n return;\n }\n this.#mainContainer.addEventListener("scrollend", this.#setCaretPositionHelper.bind(this, selection, caretX, select, newLineElement, null), {\n once: true\n });\n newLineElement.scrollIntoView();\n }\n #getNodeOnNextPage(textLayer, isUp) {\n while (true) {\n const page = textLayer.closest(".page");\n const pageNumber = parseInt(page.getAttribute("data-page-number"));\n const nextPage = isUp ? pageNumber - 1 : pageNumber + 1;\n textLayer = this.#viewerContainer.querySelector(`.page[data-page-number="${nextPage}"] .textLayer`);\n if (!textLayer) {\n return null;\n }\n const walker = document.createTreeWalker(textLayer, NodeFilter.SHOW_TEXT);\n const node = isUp ? walker.lastChild() : walker.firstChild();\n if (node) {\n return node;\n }\n }\n }\n moveCaret(isUp, select) {\n const selection = document.getSelection();\n if (selection.rangeCount === 0) {\n return;\n }\n const {\n focusNode\n } = selection;\n const focusElement = focusNode.nodeType !== Node.ELEMENT_NODE ? focusNode.parentElement : focusNode;\n const root = focusElement.closest(".textLayer");\n if (!root) {\n return;\n }\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n walker.currentNode = focusNode;\n const focusRect = focusElement.getBoundingClientRect();\n let newLineElement = null;\n const nodeIterator = (isUp ? walker.previousSibling : walker.nextSibling).bind(walker);\n while (nodeIterator()) {\n const element = walker.currentNode.parentElement;\n if (!this.#isOnSameLine(focusRect, element.getBoundingClientRect())) {\n newLineElement = element;\n break;\n }\n }\n if (!newLineElement) {\n const node = this.#getNodeOnNextPage(root, isUp);\n if (!node) {\n return;\n }\n if (select) {\n const lastNode = (isUp ? walker.firstChild() : walker.lastChild()) || focusNode;\n selection.extend(lastNode, isUp ? 0 : lastNode.length);\n const range = document.createRange();\n range.setStart(node, isUp ? node.length : 0);\n range.setEnd(node, isUp ? node.length : 0);\n selection.addRange(range);\n return;\n }\n const [caretX] = this.#getCaretPosition(selection, isUp);\n const {\n parentElement\n } = node;\n this.#setCaretPosition(select, selection, parentElement, parentElement.getBoundingClientRect(), caretX);\n return;\n }\n const [caretX, caretY] = this.#getCaretPosition(selection, isUp);\n const newLineElementRect = newLineElement.getBoundingClientRect();\n if (this.#isUnderOver(newLineElementRect, caretX, caretY, isUp)) {\n this.#setCaretPosition(select, selection, newLineElement, newLineElementRect, caretX);\n return;\n }\n while (nodeIterator()) {\n const element = walker.currentNode.parentElement;\n const elementRect = element.getBoundingClientRect();\n if (!this.#isOnSameLine(newLineElementRect, elementRect)) {\n break;\n }\n if (this.#isUnderOver(elementRect, caretX, caretY, isUp)) {\n this.#setCaretPosition(select, selection, element, elementRect, caretX);\n return;\n }\n }\n this.#setCaretPosition(select, selection, newLineElement, newLineElementRect, caretX);\n }\n}\n\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.weak-map.get-or-insert.js\nvar es_weak_map_get_or_insert = __webpack_require__(8454);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.weak-map.get-or-insert-computed.js\nvar es_weak_map_get_or_insert_computed = __webpack_require__(9452);\n;// ./web/sidebar.js\n\nconst RESIZE_TIMEOUT = 400;\nclass Sidebar {\n #initialWidth = 0;\n #width = 0;\n #coefficient;\n #resizeTimeout = null;\n #resizer;\n #isResizerOnTheLeft;\n #isKeyboardResizing = false;\n #resizeObserver;\n #prevX = 0;\n constructor({\n sidebar,\n resizer,\n toggleButton\n }, ltr, isResizerOnTheLeft) {\n this._sidebar = sidebar;\n this.#coefficient = ltr === isResizerOnTheLeft ? -1 : 1;\n this.#resizer = resizer;\n this.#isResizerOnTheLeft = isResizerOnTheLeft;\n const style = window.getComputedStyle(sidebar);\n this.#initialWidth = this.#width = parseFloat(style.getPropertyValue("--sidebar-width"));\n resizer.ariaValueMin = parseFloat(style.getPropertyValue("--sidebar-min-width")) || 0;\n resizer.ariaValueMax = parseFloat(style.getPropertyValue("--sidebar-max-width")) || Infinity;\n resizer.ariaValueNow = this.#width;\n this.#makeSidebarResizable();\n toggleButton.addEventListener("click", this.toggle.bind(this));\n this._isOpen = false;\n sidebar.hidden = true;\n this.#resizeObserver = new ResizeObserver(([{\n borderBoxSize: [{\n inlineSize\n }]\n }]) => {\n if (!isNaN(this.#prevX)) {\n this.#prevX += this.#coefficient * (inlineSize - this.#width);\n }\n this.#setWidth(inlineSize);\n });\n this.#resizeObserver.observe(sidebar);\n }\n #makeSidebarResizable() {\n const sidebarStyle = this._sidebar.style;\n let pointerMoveAC;\n const cancelResize = () => {\n this.#resizeTimeout = null;\n this._sidebar.classList.remove("resizing");\n pointerMoveAC?.abort();\n pointerMoveAC = null;\n this.#isKeyboardResizing = false;\n this.onStopResizing();\n this.#prevX = NaN;\n };\n this.#resizer.addEventListener("pointerdown", e => {\n if (pointerMoveAC) {\n cancelResize();\n return;\n }\n this.onStartResizing();\n const {\n clientX\n } = e;\n stopEvent(e);\n this.#prevX = clientX;\n pointerMoveAC = new AbortController();\n const {\n signal\n } = pointerMoveAC;\n const sidebar = this._sidebar;\n sidebar.classList.add("resizing");\n const parentStyle = sidebar.parentElement.style;\n parentStyle.minWidth = 0;\n window.addEventListener("contextmenu", noContextMenu, {\n signal\n });\n window.addEventListener("pointermove", ev => {\n if (!pointerMoveAC || Math.abs(ev.clientX - this.#prevX) < 1) {\n return;\n }\n stopEvent(ev);\n sidebarStyle.width = `${Math.round(this.#width + this.#coefficient * (ev.clientX - this.#prevX))}px`;\n }, {\n signal,\n capture: true\n });\n window.addEventListener("blur", cancelResize, {\n signal\n });\n window.addEventListener("pointerup", ev => {\n if (pointerMoveAC) {\n cancelResize();\n stopEvent(ev);\n }\n }, {\n signal\n });\n });\n this.#resizer.addEventListener("keydown", e => {\n const {\n key\n } = e;\n const isArrowLeft = key === "ArrowLeft";\n if (isArrowLeft || key === "ArrowRight") {\n if (!this.#isKeyboardResizing) {\n this._sidebar.classList.add("resizing");\n this.#isKeyboardResizing = true;\n this.onStartResizing();\n }\n const base = e.ctrlKey || e.metaKey ? 10 : 1;\n const dx = base * (isArrowLeft ? -1 : 1);\n clearTimeout(this.#resizeTimeout);\n this.#resizeTimeout = setTimeout(cancelResize, RESIZE_TIMEOUT);\n sidebarStyle.width = `${Math.round(this.#width + this.#coefficient * dx)}px`;\n stopEvent(e);\n }\n });\n }\n #setWidth(newWidth) {\n this.#width = newWidth;\n this.#resizer.ariaValueNow = Math.round(newWidth);\n if (this.#isResizerOnTheLeft) {\n this._sidebar.parentElement.style.insetInlineStart = `${(this.#initialWidth - newWidth).toFixed(3)}px`;\n }\n this.onResizing(newWidth);\n }\n get width() {\n return this.#width;\n }\n set width(newWidth) {\n this._sidebar.style.width = `${newWidth}px`;\n }\n onStartResizing() {}\n onStopResizing() {}\n onResizing(_newWidth) {}\n toggle(visibility = !this._isOpen) {\n this._sidebar.hidden = !(this._isOpen = visibility);\n }\n destroy() {\n this.#resizeObserver?.disconnect();\n this.#resizeObserver = null;\n }\n}\n\n;// ./web/comment_manager.js\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nclass CommentManager {\n #dialog;\n #popup;\n #sidebar;\n static #hasForcedColors = null;\n constructor(commentDialog, sidebar, eventBus, linkService, overlayManager, ltr, hasForcedColors) {\n const dateFormat = new Intl.DateTimeFormat(undefined, {\n dateStyle: "long"\n });\n this.dialogElement = commentDialog.dialog;\n this.#dialog = new CommentDialog(commentDialog, overlayManager, eventBus, ltr);\n this.#popup = new CommentPopup(eventBus, dateFormat, ltr, this.dialogElement);\n this.#sidebar = new CommentSidebar(sidebar, eventBus, linkService, this.#popup, dateFormat, ltr);\n this.#popup.sidebar = this.#sidebar;\n CommentManager.#hasForcedColors = hasForcedColors;\n }\n setSidebarUiManager(uiManager) {\n this.#sidebar.setUIManager(uiManager);\n }\n showSidebar(annotations) {\n this.#sidebar.show(annotations);\n }\n hideSidebar() {\n this.#sidebar.hide();\n }\n removeComments(ids) {\n this.#sidebar.removeComments(ids);\n }\n selectComment(id) {\n this.#sidebar.selectComment(null, id);\n }\n addComment(annotation) {\n this.#sidebar.addComment(annotation);\n }\n updateComment(annotation) {\n this.#sidebar.updateComment(annotation);\n }\n toggleCommentPopup(editor, isSelected, visibility, isEditable) {\n if (isSelected) {\n this.selectComment(editor.uid);\n }\n this.#popup.toggle(editor, isSelected, visibility, isEditable);\n }\n destroyPopup() {\n this.#popup.destroy();\n }\n updatePopupColor(editor) {\n this.#popup.updateColor(editor);\n }\n showDialog(uiManager, editor, posX, posY, options) {\n return this.#dialog.open(uiManager, editor, posX, posY, options);\n }\n makeCommentColor(color, opacity) {\n return CommentManager._makeCommentColor(color, opacity);\n }\n static _makeCommentColor(color, opacity) {\n return this.#hasForcedColors ? null : findContrastColor(applyOpacity(...color, opacity ?? 1), CSSConstants.commentForegroundColor);\n }\n destroy() {\n this.#dialog.destroy();\n this.#sidebar.hide();\n this.#popup.destroy();\n }\n}\nclass CommentSidebar extends Sidebar {\n #annotations = null;\n #eventBus;\n #boundCommentClick = this.#commentClick.bind(this);\n #boundCommentKeydown = this.#commentKeydown.bind(this);\n #closeButton;\n #commentsList;\n #commentCount;\n #dateFormat;\n #sidebarTitle;\n #learnMoreUrl;\n #linkService;\n #popup;\n #elementsToAnnotations = null;\n #idsToElements = null;\n #uiManager = null;\n constructor({\n learnMoreUrl,\n sidebar,\n sidebarResizer,\n commentsList,\n commentCount,\n sidebarTitle,\n closeButton,\n commentToolbarButton\n }, eventBus, linkService, popup, dateFormat, ltr) {\n super({\n sidebar,\n resizer: sidebarResizer,\n toggleButton: commentToolbarButton\n }, ltr, true);\n this.#sidebarTitle = sidebarTitle;\n this.#commentsList = commentsList;\n this.#commentCount = commentCount;\n this.#learnMoreUrl = learnMoreUrl;\n this.#linkService = linkService;\n this.#closeButton = closeButton;\n this.#popup = popup;\n this.#dateFormat = dateFormat;\n this.#eventBus = eventBus;\n closeButton.addEventListener("click", () => {\n eventBus.dispatch("switchannotationeditormode", {\n source: this,\n mode: AnnotationEditorType.NONE\n });\n });\n const keyDownCallback = e => {\n if (e.key === "ArrowDown" || e.key === "Home" || e.key === "F6") {\n this.#commentsList.firstElementChild.focus();\n stopEvent(e);\n } else if (e.key === "ArrowUp" || e.key === "End") {\n this.#commentsList.lastElementChild.focus();\n stopEvent(e);\n }\n };\n commentToolbarButton.addEventListener("keydown", keyDownCallback);\n sidebar.addEventListener("keydown", keyDownCallback);\n }\n setUIManager(uiManager) {\n this.#uiManager = uiManager;\n }\n show(annotations) {\n this.#elementsToAnnotations = new WeakMap();\n this.#idsToElements = new Map();\n this.#annotations = annotations;\n annotations.sort(this.#sortComments.bind(this));\n if (annotations.length !== 0) {\n const fragment = document.createDocumentFragment();\n for (const annotation of annotations) {\n fragment.append(this.#createCommentElement(annotation));\n }\n this.#setCommentsCount(fragment);\n this.#commentsList.append(fragment);\n } else {\n this.#setCommentsCount();\n }\n this._sidebar.hidden = false;\n this.#eventBus.dispatch("reporttelemetry", {\n source: this,\n details: {\n type: "commentSidebar",\n data: {\n numberOfAnnotations: annotations.length\n }\n }\n });\n }\n hide() {\n this._sidebar.hidden = true;\n this.#commentsList.replaceChildren();\n this.#elementsToAnnotations = null;\n this.#idsToElements = null;\n this.#annotations = null;\n }\n removeComments(ids) {\n if (ids.length === 0 || !this.#idsToElements) {\n return;\n }\n if (new Set(this.#idsToElements.keys()).difference(new Set(ids)).size === 0) {\n this.#removeAll();\n return;\n }\n for (const id of ids) {\n this.#removeComment(id);\n }\n }\n focusComment(id) {\n const element = this.#idsToElements.get(id);\n if (!element) {\n return;\n }\n this._sidebar.scrollTop = element.offsetTop - this._sidebar.offsetTop;\n for (const el of this.#commentsList.children) {\n el.classList.toggle("selected", el === element);\n }\n }\n updateComment(annotation) {\n if (!this.#idsToElements) {\n return;\n }\n const {\n id,\n creationDate,\n modificationDate,\n richText,\n contentsObj,\n popupRef\n } = annotation;\n if (!popupRef || !richText && !contentsObj?.str) {\n this.#removeComment(id);\n }\n const element = this.#idsToElements.get(id);\n if (!element) {\n return;\n }\n const prevAnnotation = this.#elementsToAnnotations.get(element);\n let index = binarySearchFirstItem(this.#annotations, a => this.#sortComments(a, prevAnnotation) >= 0);\n if (index >= this.#annotations.length) {\n return;\n }\n this.#setDate(element.firstElementChild, modificationDate || creationDate);\n this.#setText(element.lastElementChild, richText, contentsObj);\n this.#annotations.splice(index, 1);\n index = binarySearchFirstItem(this.#annotations, a => this.#sortComments(a, annotation) >= 0);\n this.#annotations.splice(index, 0, annotation);\n if (index >= this.#commentsList.children.length) {\n this.#commentsList.append(element);\n } else {\n this.#commentsList.insertBefore(element, this.#commentsList.children[index]);\n }\n }\n #removeComment(id) {\n const element = this.#idsToElements?.get(id);\n if (!element) {\n return;\n }\n const annotation = this.#elementsToAnnotations.get(element);\n const index = binarySearchFirstItem(this.#annotations, a => this.#sortComments(a, annotation) >= 0);\n if (index >= this.#annotations.length) {\n return;\n }\n this.#annotations.splice(index, 1);\n element.remove();\n this.#idsToElements.delete(id);\n this.#setCommentsCount();\n }\n #removeAll() {\n this.#commentsList.replaceChildren();\n this.#elementsToAnnotations = new WeakMap();\n this.#idsToElements.clear();\n this.#annotations.length = 0;\n this.#setCommentsCount();\n }\n selectComment(element, id = null) {\n if (!this.#idsToElements) {\n return;\n }\n const hasNoElement = !element;\n element ||= this.#idsToElements.get(id);\n for (const el of this.#commentsList.children) {\n el.classList.toggle("selected", el === element);\n }\n if (hasNoElement) {\n element?.scrollIntoView({\n behavior: "instant",\n block: "center"\n });\n }\n }\n addComment(annotation) {\n if (this.#idsToElements?.has(annotation.id)) {\n return;\n }\n const {\n popupRef,\n contentsObj\n } = annotation;\n if (!popupRef || !contentsObj?.str) {\n return;\n }\n const commentItem = this.#createCommentElement(annotation);\n if (this.#annotations.length === 0) {\n this.#commentsList.replaceChildren(commentItem);\n this.#annotations.push(annotation);\n this.#setCommentsCount();\n return;\n }\n const index = binarySearchFirstItem(this.#annotations, a => this.#sortComments(a, annotation) >= 0);\n this.#annotations.splice(index, 0, annotation);\n if (index >= this.#commentsList.children.length) {\n this.#commentsList.append(commentItem);\n } else {\n this.#commentsList.insertBefore(commentItem, this.#commentsList.children[index]);\n }\n this.#setCommentsCount();\n }\n #setCommentsCount(container = this.#commentsList) {\n const count = this.#idsToElements.size;\n this.#sidebarTitle.setAttribute("data-l10n-args", JSON.stringify({\n count\n }));\n this.#commentCount.textContent = count;\n if (count === 0) {\n container.append(this.#createZeroCommentElement());\n }\n }\n #createZeroCommentElement() {\n const commentItem = document.createElement("li");\n commentItem.classList.add("sidebarComment", "noComments");\n const textDiv = document.createElement("div");\n textDiv.className = "sidebarCommentText";\n textDiv.setAttribute("data-l10n-id", "pdfjs-editor-comments-sidebar-no-comments1");\n commentItem.append(textDiv);\n if (this.#learnMoreUrl) {\n const a = document.createElement("a");\n a.setAttribute("data-l10n-id", "pdfjs-editor-comments-sidebar-no-comments-link");\n a.href = this.#learnMoreUrl;\n a.target = "_blank";\n a.rel = "noopener noreferrer";\n commentItem.append(a);\n }\n return commentItem;\n }\n #setDate(element, date) {\n date = PDFDateString.toDateObject(date);\n element.dateTime = date.toISOString();\n element.textContent = this.#dateFormat.format(date);\n }\n #setText(element, richText, contentsObj) {\n element.replaceChildren();\n const html = richText?.str && (!contentsObj?.str || richText.str === contentsObj.str) ? richText.html : contentsObj?.str;\n renderRichText({\n html,\n dir: contentsObj?.dir || "auto",\n className: "richText"\n }, element);\n }\n #createCommentElement(annotation) {\n const {\n id,\n creationDate,\n modificationDate,\n richText,\n contentsObj,\n color,\n opacity\n } = annotation;\n const commentItem = document.createElement("li");\n commentItem.role = "button";\n commentItem.className = "sidebarComment";\n commentItem.tabIndex = -1;\n commentItem.style.backgroundColor = color && CommentManager._makeCommentColor(color, opacity) || "";\n const dateDiv = document.createElement("time");\n this.#setDate(dateDiv, modificationDate || creationDate);\n const textDiv = document.createElement("div");\n textDiv.className = "sidebarCommentText";\n this.#setText(textDiv, richText, contentsObj);\n commentItem.append(dateDiv, textDiv);\n commentItem.addEventListener("click", this.#boundCommentClick);\n commentItem.addEventListener("keydown", this.#boundCommentKeydown);\n this.#elementsToAnnotations.set(commentItem, annotation);\n this.#idsToElements.set(id, commentItem);\n return commentItem;\n }\n async #commentClick({\n currentTarget\n }) {\n if (currentTarget.classList.contains("selected")) {\n currentTarget.classList.remove("selected");\n this.#popup._hide();\n return;\n }\n const annotation = this.#elementsToAnnotations.get(currentTarget);\n if (!annotation) {\n return;\n }\n this.#popup._hide();\n const {\n id,\n pageIndex,\n rect\n } = annotation;\n const pageNumber = pageIndex + 1;\n const pageVisiblePromise = this.#uiManager?.waitForEditorsRendered(pageNumber);\n this.#linkService?.goToXY(pageNumber, rect[0], rect[3], {\n center: "both"\n });\n this.selectComment(currentTarget);\n await pageVisiblePromise;\n this.#uiManager?.selectComment(pageIndex, id);\n }\n #commentKeydown(e) {\n const {\n key,\n currentTarget\n } = e;\n switch (key) {\n case "ArrowDown":\n (currentTarget.nextElementSibling || this.#commentsList.firstElementChild).focus();\n stopEvent(e);\n break;\n case "ArrowUp":\n (currentTarget.previousElementSibling || this.#commentsList.lastElementChild).focus();\n stopEvent(e);\n break;\n case "Home":\n this.#commentsList.firstElementChild.focus();\n stopEvent(e);\n break;\n case "End":\n this.#commentsList.lastElementChild.focus();\n stopEvent(e);\n break;\n case "Enter":\n case " ":\n this.#commentClick(e);\n stopEvent(e);\n break;\n case "ShiftTab":\n this.#closeButton.focus();\n stopEvent(e);\n break;\n }\n }\n #sortComments(a, b) {\n const dateA = PDFDateString.toDateObject(a.modificationDate || a.creationDate);\n const dateB = PDFDateString.toDateObject(b.modificationDate || b.creationDate);\n if (dateA !== dateB) {\n if (dateA !== null && dateB !== null) {\n return dateB - dateA;\n }\n return dateA !== null ? -1 : 1;\n }\n if (a.pageIndex !== b.pageIndex) {\n return a.pageIndex - b.pageIndex;\n }\n if (a.rect[3] !== b.rect[3]) {\n return b.rect[3] - a.rect[3];\n }\n if (a.rect[0] !== b.rect[0]) {\n return a.rect[0] - b.rect[0];\n }\n if (a.rect[1] !== b.rect[1]) {\n return b.rect[1] - a.rect[1];\n }\n if (a.rect[2] !== b.rect[2]) {\n return a.rect[2] - b.rect[2];\n }\n return a.id.localeCompare(b.id);\n }\n}\nclass CommentDialog {\n #dialog;\n #editor;\n #overlayManager;\n #previousText = "";\n #commentText = "";\n #textInput;\n #title;\n #saveButton;\n #uiManager;\n #prevDragX = 0;\n #prevDragY = 0;\n #dialogX = 0;\n #dialogY = 0;\n #isLTR;\n #eventBus;\n constructor({\n dialog,\n toolbar,\n title,\n textInput,\n cancelButton,\n saveButton\n }, overlayManager, eventBus, ltr) {\n this.#dialog = dialog;\n this.#textInput = textInput;\n this.#overlayManager = overlayManager;\n this.#eventBus = eventBus;\n this.#saveButton = saveButton;\n this.#title = title;\n this.#isLTR = ltr;\n const finishBound = this.#finish.bind(this);\n dialog.addEventListener("close", finishBound);\n dialog.addEventListener("contextmenu", e => {\n if (e.target !== this.#textInput) {\n e.preventDefault();\n }\n });\n cancelButton.addEventListener("click", finishBound);\n saveButton.addEventListener("click", this.#save.bind(this));\n textInput.addEventListener("input", () => {\n saveButton.disabled = textInput.value === this.#previousText;\n });\n textInput.addEventListener("keydown", e => {\n if ((e.ctrlKey || e.metaKey) && e.key === "Enter" && !saveButton.disabled) {\n this.#save();\n }\n });\n let pointerMoveAC;\n const cancelDrag = () => {\n dialog.classList.remove("dragging");\n pointerMoveAC?.abort();\n pointerMoveAC = null;\n };\n toolbar.addEventListener("pointerdown", e => {\n if (pointerMoveAC) {\n cancelDrag();\n return;\n }\n const {\n clientX,\n clientY\n } = e;\n stopEvent(e);\n this.#prevDragX = clientX;\n this.#prevDragY = clientY;\n pointerMoveAC = new AbortController();\n const {\n signal\n } = pointerMoveAC;\n const {\n innerHeight,\n innerWidth\n } = window;\n dialog.classList.add("dragging");\n window.addEventListener("pointermove", ev => {\n if (!pointerMoveAC) {\n return;\n }\n const {\n clientX: x,\n clientY: y\n } = ev;\n this.#setPosition(this.#dialogX + (x - this.#prevDragX) / innerWidth, this.#dialogY + (y - this.#prevDragY) / innerHeight);\n this.#prevDragX = x;\n this.#prevDragY = y;\n stopEvent(ev);\n }, {\n signal\n });\n window.addEventListener("blur", cancelDrag, {\n signal\n });\n window.addEventListener("pointerup", ev => {\n if (pointerMoveAC) {\n cancelDrag();\n stopEvent(ev);\n }\n }, {\n signal\n });\n });\n overlayManager.register(dialog);\n }\n async open(uiManager, editor, posX, posY, options) {\n if (editor) {\n this.#uiManager = uiManager;\n this.#editor = editor;\n }\n const {\n contentsObj: {\n str\n },\n color,\n opacity\n } = editor.getData();\n const {\n style: dialogStyle\n } = this.#dialog;\n if (color) {\n dialogStyle.backgroundColor = CommentManager._makeCommentColor(color, opacity);\n dialogStyle.borderColor = Util.makeHexColor(...color);\n } else {\n dialogStyle.backgroundColor = dialogStyle.borderColor = "";\n }\n this.#commentText = str || "";\n const textInput = this.#textInput;\n textInput.value = this.#previousText = this.#commentText;\n if (str) {\n this.#title.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-dialog-title-when-editing");\n this.#saveButton.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-dialog-save-button-when-editing");\n } else {\n this.#title.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-dialog-title-when-adding");\n this.#saveButton.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-dialog-save-button-when-adding");\n }\n if (options?.height) {\n textInput.style.height = `${options.height}px`;\n }\n this.#uiManager?.removeEditListeners();\n this.#saveButton.disabled = true;\n const parentDimensions = options?.parentDimensions;\n const {\n innerHeight,\n innerWidth\n } = window;\n if (editor.hasDefaultPopupPosition()) {\n const {\n dialogWidth,\n dialogHeight\n } = this._dialogDimensions;\n if (parentDimensions) {\n if (this.#isLTR && posX + dialogWidth > Math.min(parentDimensions.x + parentDimensions.width, innerWidth)) {\n const buttonWidth = this.#editor.commentButtonWidth;\n posX -= dialogWidth - buttonWidth * parentDimensions.width;\n } else if (!this.#isLTR) {\n const buttonWidth = this.#editor.commentButtonWidth * parentDimensions.width;\n if (posX - dialogWidth < Math.max(0, parentDimensions.x)) {\n posX = Math.max(0, posX);\n } else {\n posX -= dialogWidth - buttonWidth;\n }\n }\n }\n const height = Math.max(dialogHeight, options?.height || 0);\n if (posY + height > innerHeight) {\n posY = innerHeight - height;\n }\n if (posY < 0) {\n posY = 0;\n }\n }\n posX = MathClamp(posX / innerWidth, 0, 1);\n posY = MathClamp(posY / innerHeight, 0, 1);\n this.#setPosition(posX, posY);\n await this.#overlayManager.open(this.#dialog);\n textInput.focus();\n }\n async #save() {\n this.#editor.comment = this.#textInput.value;\n this.#finish();\n }\n get _dialogDimensions() {\n const dialog = this.#dialog;\n const {\n style\n } = dialog;\n style.opacity = "0";\n style.display = "block";\n const {\n width,\n height\n } = dialog.getBoundingClientRect();\n style.opacity = style.display = "";\n return shadow(this, "_dialogDimensions", {\n dialogWidth: width,\n dialogHeight: height\n });\n }\n #setPosition(x, y) {\n this.#dialogX = x;\n this.#dialogY = y;\n const {\n style\n } = this.#dialog;\n style.left = `${100 * x}%`;\n style.top = `${100 * y}%`;\n }\n #finish() {\n if (!this.#editor) {\n return;\n }\n const edited = this.#textInput.value !== this.#commentText;\n this.#eventBus.dispatch("reporttelemetry", {\n source: this,\n details: {\n type: "comment",\n data: {\n edited\n }\n }\n });\n this.#editor?.focusCommentButton();\n this.#editor = null;\n this.#textInput.value = this.#previousText = this.#commentText = "";\n this.#overlayManager.closeIfActive(this.#dialog);\n this.#textInput.style.height = "";\n this.#uiManager?.addEditListeners();\n this.#uiManager = null;\n }\n destroy() {\n this.#uiManager = null;\n this.#editor = null;\n this.#finish();\n }\n}\nclass CommentPopup {\n #buttonsContainer = null;\n #eventBus;\n #commentDialog;\n #dateFormat;\n #editor = null;\n #isLTR;\n #container = null;\n #text = null;\n #time = null;\n #prevDragX = 0;\n #prevDragY = 0;\n #posX = 0;\n #posY = 0;\n #previousFocusedElement = null;\n #selected = false;\n #visible = false;\n constructor(eventBus, dateFormat, ltr, commentDialog) {\n this.#eventBus = eventBus;\n this.#dateFormat = dateFormat;\n this.#isLTR = ltr;\n this.#commentDialog = commentDialog;\n this.sidebar = null;\n }\n get _popupWidth() {\n const container = this.#createPopup();\n const {\n style\n } = container;\n style.opacity = "0";\n style.display = "block";\n document.body.append(container);\n const width = container.getBoundingClientRect().width;\n container.remove();\n style.opacity = style.display = "";\n return shadow(this, "_popupWidth", width);\n }\n #createPopup() {\n if (this.#container) {\n return this.#container;\n }\n const container = this.#container = document.createElement("div");\n container.className = "commentPopup";\n container.id = "commentPopup";\n container.tabIndex = -1;\n container.role = "dialog";\n container.ariaModal = "false";\n container.addEventListener("contextmenu", noContextMenu);\n container.addEventListener("keydown", e => {\n if (e.key === "Escape") {\n this.toggle(this.#editor, true, false);\n this.#previousFocusedElement?.focus();\n stopEvent(e);\n }\n });\n container.addEventListener("click", () => {\n container.focus();\n });\n const top = document.createElement("div");\n top.className = "commentPopupTop";\n const time = this.#time = document.createElement("time");\n time.className = "commentPopupTime";\n const buttons = this.#buttonsContainer = document.createElement("div");\n buttons.className = "commentPopupButtons";\n const edit = document.createElement("button");\n edit.classList.add("commentPopupEdit", "toolbarButton");\n edit.tabIndex = 0;\n edit.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-popup-button");\n edit.ariaHasPopup = "dialog";\n edit.ariaControlsElements = [this.#commentDialog];\n const editLabel = document.createElement("span");\n editLabel.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-popup-button-label");\n edit.append(editLabel);\n edit.addEventListener("click", () => {\n const editor = this.#editor;\n const height = parseFloat(getComputedStyle(this.#text).height);\n this.toggle(editor, true, false);\n editor.editComment({\n height\n });\n });\n edit.addEventListener("contextmenu", noContextMenu);\n const del = document.createElement("button");\n del.classList.add("commentPopupDelete", "toolbarButton");\n del.tabIndex = 0;\n del.setAttribute("data-l10n-id", "pdfjs-editor-delete-comment-popup-button");\n const delLabel = document.createElement("span");\n delLabel.setAttribute("data-l10n-id", "pdfjs-editor-delete-comment-popup-button-label");\n del.append(delLabel);\n del.addEventListener("click", () => {\n this.#eventBus.dispatch("reporttelemetry", {\n source: this,\n details: {\n type: "comment",\n data: {\n deleted: true\n }\n }\n });\n const editor = this.#editor;\n const savedData = editor.comment;\n this.destroy();\n if (savedData?.text) {\n editor._uiManager.deleteComment(editor, savedData);\n } else {\n editor.comment = null;\n }\n editor.focus();\n });\n del.addEventListener("contextmenu", noContextMenu);\n buttons.append(edit, del);\n top.append(time, buttons);\n const separator = document.createElement("hr");\n const text = this.#text = document.createElement("div");\n text.className = "commentPopupText";\n container.append(top, separator, text);\n let pointerMoveAC;\n const cancelDrag = () => {\n container.classList.remove("dragging");\n pointerMoveAC?.abort();\n pointerMoveAC = null;\n };\n top.addEventListener("pointerdown", e => {\n if (pointerMoveAC) {\n cancelDrag();\n return;\n }\n const {\n target,\n clientX,\n clientY\n } = e;\n if (buttons.contains(target)) {\n return;\n }\n stopEvent(e);\n const {\n width: parentWidth,\n height: parentHeight\n } = this.#editor.parentBoundingClientRect;\n this.#prevDragX = clientX;\n this.#prevDragY = clientY;\n pointerMoveAC = new AbortController();\n const {\n signal\n } = pointerMoveAC;\n container.classList.add("dragging");\n window.addEventListener("pointermove", ev => {\n if (!pointerMoveAC) {\n return;\n }\n const {\n clientX: x,\n clientY: y\n } = ev;\n this.#setPosition(this.#posX + (x - this.#prevDragX) / parentWidth, this.#posY + (y - this.#prevDragY) / parentHeight, false);\n this.#prevDragX = x;\n this.#prevDragY = y;\n stopEvent(ev);\n }, {\n signal\n });\n window.addEventListener("blur", cancelDrag, {\n signal\n });\n window.addEventListener("pointerup", ev => {\n if (pointerMoveAC) {\n cancelDrag();\n stopEvent(ev);\n }\n }, {\n signal\n });\n });\n return container;\n }\n updateColor(editor) {\n if (this.#editor !== editor || !this.#visible) {\n return;\n }\n const {\n color,\n opacity\n } = editor.getData();\n this.#container.style.backgroundColor = color && CommentManager._makeCommentColor(color, opacity) || "";\n }\n _hide(editor) {\n const container = this.#createPopup();\n container.classList.toggle("hidden", true);\n container.classList.toggle("selected", false);\n (editor || this.#editor)?.setCommentButtonStates({\n selected: false,\n hasPopup: false\n });\n this.#editor = null;\n this.#selected = false;\n this.#visible = false;\n this.#text.replaceChildren();\n this.sidebar.selectComment(null);\n }\n toggle(editor, isSelected, visibility = undefined, isEditable = true) {\n if (!editor) {\n this.destroy();\n return;\n }\n if (isSelected) {\n visibility ??= this.#editor === editor ? !this.#selected || !this.#visible : true;\n } else {\n if (this.#selected) {\n return;\n }\n visibility ??= !this.#visible;\n }\n if (!visibility) {\n this._hide(editor);\n return;\n }\n this.#visible = true;\n if (this.#editor !== editor) {\n this.#editor?.setCommentButtonStates({\n selected: false,\n hasPopup: false\n });\n }\n const container = this.#createPopup();\n this.#buttonsContainer.classList.toggle("hidden", !isEditable);\n container.classList.toggle("hidden", false);\n container.classList.toggle("selected", isSelected);\n this.#selected = isSelected;\n this.#editor = editor;\n editor.setCommentButtonStates({\n selected: isSelected,\n hasPopup: true\n });\n const {\n contentsObj,\n richText,\n creationDate,\n modificationDate,\n color,\n opacity\n } = editor.getData();\n container.style.backgroundColor = color && CommentManager._makeCommentColor(color, opacity) || "";\n this.#text.replaceChildren();\n const html = richText?.str && (!contentsObj?.str || richText.str === contentsObj.str) ? richText.html : contentsObj?.str;\n if (html) {\n renderRichText({\n html,\n dir: contentsObj?.dir || "auto",\n className: "richText"\n }, this.#text);\n }\n this.#time.textContent = this.#dateFormat.format(PDFDateString.toDateObject(modificationDate || creationDate));\n this.#setPosition(...editor.commentPopupPosition, editor.hasDefaultPopupPosition());\n editor.elementBeforePopup.after(container);\n container.addEventListener("focus", ({\n relatedTarget\n }) => {\n this.#previousFocusedElement = relatedTarget;\n }, {\n once: true\n });\n if (isSelected) {\n setTimeout(() => container.focus(), 0);\n }\n }\n #setPosition(x, y, correctPosition) {\n if (!correctPosition) {\n this.#editor.commentPopupPosition = [x, y];\n } else {\n const parentRect = this.#editor.parentBoundingClientRect;\n const widthRatio = this._popupWidth / parentRect.width;\n if (this.#isLTR && x + widthRatio > 1 || !this.#isLTR && x - widthRatio >= 0) {\n const buttonWidth = this.#editor.commentButtonWidth;\n x -= widthRatio - buttonWidth;\n }\n const margin = 0.01;\n if (this.#isLTR) {\n x = Math.max(x, -parentRect.x / parentRect.width + margin);\n } else {\n x = Math.min(x, (window.innerWidth - parentRect.x) / parentRect.width - widthRatio - margin);\n }\n }\n this.#posX = x;\n this.#posY = y;\n const {\n style\n } = this.#container;\n style.left = `${100 * x}%`;\n style.top = `${100 * y}%`;\n }\n destroy() {\n this._hide();\n this.#container?.remove();\n this.#container = this.#text = this.#time = null;\n this.#prevDragX = this.#prevDragY = Infinity;\n this.#posX = this.#posY = 0;\n this.#previousFocusedElement = null;\n }\n}\n\n;// ./web/base_download_manager.js\n\n\n\n\n\n\nclass BaseDownloadManager {\n #openBlobUrls = new WeakMap();\n _triggerDownload(blobUrl, originalUrl, filename, isAttachment = false) {\n throw new Error("Not implemented: _triggerDownload");\n }\n _getOpenDataUrl(blobUrl, filename, dest = null) {\n throw new Error("Not implemented: _getOpenDataUrl");\n }\n downloadData(data, filename, contentType) {\n const blobUrl = URL.createObjectURL(new Blob([data], {\n type: contentType\n }));\n this._triggerDownload(blobUrl, blobUrl, filename, true);\n }\n openOrDownloadData(data, filename, dest = null) {\n const isPdfData = isPdfFile(filename);\n const contentType = isPdfData ? "application/pdf" : "";\n if (isPdfData) {\n const blobUrl = this.#openBlobUrls.getOrInsertComputed(data, () => URL.createObjectURL(new Blob([data], {\n type: contentType\n })));\n try {\n const viewerUrl = this._getOpenDataUrl(blobUrl, filename, dest);\n window.open(viewerUrl);\n return true;\n } catch (ex) {\n console.error("openOrDownloadData:", ex);\n URL.revokeObjectURL(blobUrl);\n this.#openBlobUrls.delete(data);\n }\n }\n this.downloadData(data, filename, contentType);\n return false;\n }\n download(data, url, filename) {\n const blobUrl = data ? URL.createObjectURL(new Blob([data], {\n type: "application/pdf"\n })) : null;\n this._triggerDownload(blobUrl, url, filename);\n }\n}\n\n;// ./web/download_manager.js\n\n\nclass DownloadManager extends BaseDownloadManager {\n _triggerDownload(blobUrl, originalUrl, filename, isAttachment = false) {\n if (!blobUrl && !isAttachment) {\n if (!createValidAbsoluteUrl(originalUrl, "http://example.com")) {\n throw new Error(`_triggerDownload - not a valid URL: ${originalUrl}`);\n }\n blobUrl = originalUrl + "#pdfjs.action=download";\n }\n const a = document.createElement("a");\n a.href = blobUrl;\n a.target = "_parent";\n if ("download" in a) {\n a.download = filename;\n }\n (document.body || document.documentElement).append(a);\n a.click();\n a.remove();\n }\n _getOpenDataUrl(blobUrl, filename, dest = null) {\n let url = "?file=" + encodeURIComponent(blobUrl + "#" + filename);\n if (dest) {\n url += `#${escape(dest)}`;\n }\n return url;\n }\n}\n\n;// ./web/editor_undo_bar.js\n\n\nclass EditorUndoBar {\n #closeButton = null;\n #container;\n #eventBus = null;\n #focusTimeout = null;\n #initController = null;\n isOpen = false;\n #message;\n #showController = null;\n #undoButton;\n static #l10nMessages = Object.freeze({\n highlight: "pdfjs-editor-undo-bar-message-highlight",\n freetext: "pdfjs-editor-undo-bar-message-freetext",\n stamp: "pdfjs-editor-undo-bar-message-stamp",\n ink: "pdfjs-editor-undo-bar-message-ink",\n signature: "pdfjs-editor-undo-bar-message-signature",\n comment: "pdfjs-editor-undo-bar-message-comment",\n _multiple: "pdfjs-editor-undo-bar-message-multiple"\n });\n constructor({\n container,\n message,\n undoButton,\n closeButton\n }, eventBus) {\n this.#container = container;\n this.#message = message;\n this.#undoButton = undoButton;\n this.#closeButton = closeButton;\n this.#eventBus = eventBus;\n }\n destroy() {\n this.#initController?.abort();\n this.#initController = null;\n this.hide();\n }\n show(undoAction, messageData) {\n if (!this.#initController) {\n this.#initController = new AbortController();\n const opts = {\n signal: this.#initController.signal\n };\n const boundHide = this.hide.bind(this);\n this.#container.addEventListener("contextmenu", noContextMenu, opts);\n this.#closeButton.addEventListener("click", boundHide, opts);\n this.#eventBus._on("beforeprint", boundHide, opts);\n this.#eventBus._on("download", boundHide, opts);\n }\n this.hide();\n if (typeof messageData === "string") {\n this.#message.setAttribute("data-l10n-id", EditorUndoBar.#l10nMessages[messageData]);\n } else {\n this.#message.setAttribute("data-l10n-id", EditorUndoBar.#l10nMessages._multiple);\n this.#message.setAttribute("data-l10n-args", JSON.stringify({\n count: messageData\n }));\n }\n this.isOpen = true;\n this.#container.hidden = false;\n this.#showController = new AbortController();\n this.#undoButton.addEventListener("click", () => {\n undoAction();\n this.hide();\n }, {\n signal: this.#showController.signal\n });\n this.#focusTimeout = setTimeout(() => {\n this.#container.focus();\n this.#focusTimeout = null;\n }, 100);\n }\n hide() {\n if (!this.isOpen) {\n return;\n }\n this.isOpen = false;\n this.#container.hidden = true;\n this.#showController?.abort();\n this.#showController = null;\n if (this.#focusTimeout) {\n clearTimeout(this.#focusTimeout);\n this.#focusTimeout = null;\n }\n }\n}\n\n;// ./web/overlay_manager.js\n\n\nclass OverlayManager {\n #overlays = new WeakMap();\n #active = null;\n get active() {\n return this.#active;\n }\n async register(dialog, canForceClose = false) {\n if (typeof dialog !== "object") {\n throw new Error("Not enough parameters.");\n } else if (this.#overlays.has(dialog)) {\n throw new Error("The overlay is already registered.");\n }\n this.#overlays.set(dialog, {\n canForceClose\n });\n dialog.addEventListener("cancel", ({\n target\n }) => {\n if (this.#active === target) {\n this.#active = null;\n }\n });\n }\n async open(dialog) {\n if (!this.#overlays.has(dialog)) {\n throw new Error("The overlay does not exist.");\n } else if (this.#active) {\n if (this.#active === dialog) {\n throw new Error("The overlay is already active.");\n } else if (this.#overlays.get(dialog).canForceClose) {\n await this.close();\n } else {\n throw new Error("Another overlay is currently active.");\n }\n }\n this.#active = dialog;\n dialog.showModal();\n }\n async close(dialog = this.#active) {\n if (!this.#overlays.has(dialog)) {\n throw new Error("The overlay does not exist.");\n } else if (!this.#active) {\n throw new Error("The overlay is currently not active.");\n } else if (this.#active !== dialog) {\n throw new Error("Another overlay is currently active.");\n }\n dialog.close();\n this.#active = null;\n }\n async closeIfActive(dialog) {\n if (this.#active === dialog) {\n await this.close(dialog);\n }\n }\n}\n\n;// ./web/password_prompt.js\n\n\nclass PasswordPrompt {\n #activeCapability = null;\n #updateCallback = null;\n #reason = null;\n constructor(options, overlayManager, isViewerEmbedded = false) {\n this.dialog = options.dialog;\n this.label = options.label;\n this.input = options.input;\n this.submitButton = options.submitButton;\n this.cancelButton = options.cancelButton;\n this.overlayManager = overlayManager;\n this._isViewerEmbedded = isViewerEmbedded;\n this.submitButton.addEventListener("click", this.#verify.bind(this));\n this.cancelButton.addEventListener("click", this.close.bind(this));\n this.input.addEventListener("keydown", e => {\n if (e.keyCode === 13) {\n this.#verify();\n }\n });\n this.overlayManager.register(this.dialog, true);\n this.dialog.addEventListener("close", this.#cancel.bind(this));\n }\n async open() {\n await this.#activeCapability?.promise;\n this.#activeCapability = Promise.withResolvers();\n try {\n await this.overlayManager.open(this.dialog);\n } catch (ex) {\n this.#activeCapability.resolve();\n throw ex;\n }\n const passwordIncorrect = this.#reason === PasswordResponses.INCORRECT_PASSWORD;\n if (!this._isViewerEmbedded || passwordIncorrect) {\n this.input.focus();\n }\n this.label.setAttribute("data-l10n-id", passwordIncorrect ? "pdfjs-password-invalid" : "pdfjs-password-label");\n }\n async close() {\n this.overlayManager.closeIfActive(this.dialog);\n }\n #verify() {\n const password = this.input.value;\n if (password?.length > 0) {\n this.#invokeCallback(password);\n }\n }\n #cancel() {\n this.#invokeCallback(new Error("PasswordPrompt cancelled."));\n this.#activeCapability.resolve();\n }\n #invokeCallback(password) {\n if (!this.#updateCallback) {\n return;\n }\n this.close();\n this.input.value = "";\n this.#updateCallback(password);\n this.#updateCallback = null;\n }\n async setUpdateCallback(updateCallback, reason) {\n if (this.#activeCapability) {\n await this.#activeCapability.promise;\n }\n this.#updateCallback = updateCallback;\n this.#reason = reason;\n }\n}\n\n;// ./web/base_tree_viewer.js\n\n\nconst TREEITEM_SELECTED_CLASS = "selected";\nclass BaseTreeViewer {\n constructor(options) {\n this.container = options.container;\n this.eventBus = options.eventBus;\n this._l10n = options.l10n;\n this.reset();\n }\n reset() {\n this._pdfDocument = null;\n this._lastToggleIsShow = true;\n this._currentTreeItem = null;\n this.container.replaceChildren();\n this.container.classList.remove("withNesting");\n }\n _dispatchEvent(count) {\n throw new Error("Not implemented: _dispatchEvent");\n }\n _bindLink(element, params) {\n throw new Error("Not implemented: _bindLink");\n }\n _normalizeTextContent(str) {\n return removeNullCharacters(str, true) || "\\u2013";\n }\n _addToggleButton(div, hidden = false) {\n const toggler = document.createElement("div");\n toggler.className = "treeItemToggler";\n if (hidden) {\n toggler.classList.add("treeItemsHidden");\n }\n div.prepend(toggler);\n }\n _toggleTreeItem(root, show = false) {\n this._l10n.pause();\n this._lastToggleIsShow = show;\n for (const toggler of root.querySelectorAll(".treeItemToggler")) {\n toggler.classList.toggle("treeItemsHidden", !show);\n }\n this._l10n.resume();\n }\n _toggleAllTreeItems() {\n this._toggleTreeItem(this.container, !this._lastToggleIsShow);\n }\n _finishRendering(fragment, count, hasAnyNesting = false) {\n if (hasAnyNesting) {\n this.container.classList.add("withNesting");\n this._lastToggleIsShow = !fragment.querySelector(".treeItemsHidden");\n this.container.addEventListener("click", e => {\n const {\n target\n } = e;\n if (!target.classList.contains("treeItemToggler")) {\n return;\n }\n stopEvent(e);\n target.classList.toggle("treeItemsHidden");\n if (e.shiftKey) {\n const shouldShowAll = !target.classList.contains("treeItemsHidden");\n this._toggleTreeItem(target.parentNode, shouldShowAll);\n }\n });\n }\n this._l10n.pause();\n this.container.append(fragment);\n this._l10n.resume();\n this._dispatchEvent(count);\n }\n render(params) {\n throw new Error("Not implemented: render");\n }\n _updateCurrentTreeItem(treeItem = null) {\n if (this._currentTreeItem) {\n this._currentTreeItem.classList.remove(TREEITEM_SELECTED_CLASS);\n this._currentTreeItem = null;\n }\n if (treeItem) {\n treeItem.classList.add(TREEITEM_SELECTED_CLASS);\n this._currentTreeItem = treeItem;\n }\n }\n _scrollToCurrentTreeItem(treeItem) {\n if (!treeItem) {\n return;\n }\n this._l10n.pause();\n let currentNode = treeItem.parentNode;\n while (currentNode && currentNode !== this.container) {\n if (currentNode.classList.contains("treeItem")) {\n const toggler = currentNode.firstElementChild;\n toggler?.classList.remove("treeItemsHidden");\n }\n currentNode = currentNode.parentNode;\n }\n this._l10n.resume();\n this._updateCurrentTreeItem(treeItem);\n treeItem.scrollIntoView({\n behavior: "instant",\n block: "center",\n inline: "center",\n container: "nearest"\n });\n }\n}\n\n;// ./web/pdf_attachment_viewer.js\n\n\n\nclass PDFAttachmentViewer extends BaseTreeViewer {\n constructor(options) {\n super(options);\n this.downloadManager = options.downloadManager;\n this.eventBus._on("fileattachmentannotation", this.#appendAttachment.bind(this));\n }\n reset(keepRenderedCapability = false) {\n super.reset();\n this._attachments = null;\n if (!keepRenderedCapability) {\n this._renderedCapability = Promise.withResolvers();\n }\n this._pendingDispatchEvent = false;\n }\n async _dispatchEvent(attachmentsCount) {\n this._renderedCapability.resolve();\n if (attachmentsCount === 0 && !this._pendingDispatchEvent) {\n this._pendingDispatchEvent = true;\n await waitOnEventOrTimeout({\n target: this.eventBus,\n name: "annotationlayerrendered",\n delay: 1000\n });\n if (!this._pendingDispatchEvent) {\n return;\n }\n }\n this._pendingDispatchEvent = false;\n this.eventBus.dispatch("attachmentsloaded", {\n source: this,\n attachmentsCount\n });\n }\n _bindLink(element, {\n content,\n description,\n filename\n }) {\n if (description) {\n element.title = description;\n }\n element.onclick = () => {\n this.downloadManager.openOrDownloadData(content, filename);\n return false;\n };\n }\n render({\n attachments,\n keepRenderedCapability = false\n }) {\n if (this._attachments) {\n this.reset(keepRenderedCapability);\n }\n this._attachments = attachments || null;\n if (!attachments) {\n this._dispatchEvent(0);\n return;\n }\n const fragment = document.createDocumentFragment();\n const ul = document.createElement("ul");\n fragment.append(ul);\n let attachmentsCount = 0;\n for (const name in attachments) {\n const item = attachments[name];\n const li = document.createElement("li");\n ul.append(li);\n const element = document.createElement("a");\n li.append(element);\n this._bindLink(element, item);\n element.textContent = this._normalizeTextContent(item.filename);\n attachmentsCount++;\n }\n this._finishRendering(fragment, attachmentsCount);\n }\n #appendAttachment(item) {\n const renderedPromise = this._renderedCapability.promise;\n renderedPromise.then(() => {\n if (renderedPromise !== this._renderedCapability.promise) {\n return;\n }\n const attachments = this._attachments || Object.create(null);\n for (const name in attachments) {\n if (item.filename === name) {\n return;\n }\n }\n attachments[item.filename] = item;\n this.render({\n attachments,\n keepRenderedCapability: true\n });\n });\n }\n}\n\n;// ./web/grab_to_pan.js\n\nconst CSS_CLASS_GRAB = "grab-to-pan-grab";\nclass GrabToPan {\n #activateAC = null;\n #mouseDownAC = null;\n #scrollAC = null;\n constructor({\n element\n }) {\n this.element = element;\n this.document = element.ownerDocument;\n const overlay = this.overlay = document.createElement("div");\n overlay.className = "grab-to-pan-grabbing";\n }\n activate() {\n if (!this.#activateAC) {\n this.#activateAC = new AbortController();\n this.element.addEventListener("mousedown", this.#onMouseDown.bind(this), {\n capture: true,\n signal: this.#activateAC.signal\n });\n this.element.classList.add(CSS_CLASS_GRAB);\n }\n }\n deactivate() {\n if (this.#activateAC) {\n this.#activateAC.abort();\n this.#activateAC = null;\n this.#endPan();\n this.element.classList.remove(CSS_CLASS_GRAB);\n }\n }\n toggle() {\n if (this.#activateAC) {\n this.deactivate();\n } else {\n this.activate();\n }\n }\n ignoreTarget(node) {\n return node.matches("a[href], a[href] *, input, textarea, button, button *, select, option");\n }\n #onMouseDown(event) {\n if (event.button !== 0 || this.ignoreTarget(event.target)) {\n return;\n }\n if (event.originalTarget) {\n try {\n event.originalTarget.tagName;\n } catch {\n return;\n }\n }\n this.scrollLeftStart = this.element.scrollLeft;\n this.scrollTopStart = this.element.scrollTop;\n this.clientXStart = event.clientX;\n this.clientYStart = event.clientY;\n this.#mouseDownAC = new AbortController();\n const boundEndPan = this.#endPan.bind(this),\n mouseOpts = {\n capture: true,\n signal: this.#mouseDownAC.signal\n };\n this.document.addEventListener("mousemove", this.#onMouseMove.bind(this), mouseOpts);\n this.document.addEventListener("mouseup", boundEndPan, mouseOpts);\n this.#scrollAC = new AbortController();\n this.element.addEventListener("scroll", boundEndPan, {\n capture: true,\n signal: this.#scrollAC.signal\n });\n stopEvent(event);\n const focusedElement = document.activeElement;\n if (focusedElement && !focusedElement.contains(event.target)) {\n focusedElement.blur();\n }\n }\n #onMouseMove(event) {\n this.#scrollAC?.abort();\n this.#scrollAC = null;\n if (!(event.buttons & 1)) {\n this.#endPan();\n return;\n }\n const xDiff = event.clientX - this.clientXStart;\n const yDiff = event.clientY - this.clientYStart;\n this.element.scrollTo({\n top: this.scrollTopStart - yDiff,\n left: this.scrollLeftStart - xDiff,\n behavior: "instant"\n });\n if (!this.overlay.parentNode) {\n document.body.append(this.overlay);\n }\n }\n #endPan() {\n this.#mouseDownAC?.abort();\n this.#mouseDownAC = null;\n this.#scrollAC?.abort();\n this.#scrollAC = null;\n this.overlay.remove();\n }\n}\n\n;// ./web/pdf_cursor_tools.js\n\n\n\nclass PDFCursorTools {\n #active = CursorTool.SELECT;\n #prevActive = null;\n constructor({\n container,\n eventBus,\n cursorToolOnLoad = CursorTool.SELECT\n }) {\n this.container = container;\n this.eventBus = eventBus;\n this.#addEventListeners();\n Promise.resolve().then(() => {\n this.switchTool(cursorToolOnLoad);\n });\n }\n get activeTool() {\n return this.#active;\n }\n switchTool(tool) {\n if (this.#prevActive !== null) {\n return;\n }\n this.#switchTool(tool);\n }\n #switchTool(tool, disabled = false) {\n if (tool === this.#active) {\n if (this.#prevActive !== null) {\n this.eventBus.dispatch("cursortoolchanged", {\n source: this,\n tool,\n disabled\n });\n }\n return;\n }\n const disableActiveTool = () => {\n switch (this.#active) {\n case CursorTool.SELECT:\n break;\n case CursorTool.HAND:\n this._handTool.deactivate();\n break;\n case CursorTool.ZOOM:\n }\n };\n switch (tool) {\n case CursorTool.SELECT:\n disableActiveTool();\n break;\n case CursorTool.HAND:\n disableActiveTool();\n this._handTool.activate();\n break;\n case CursorTool.ZOOM:\n default:\n console.error(`switchTool: "${tool}" is an unsupported value.`);\n return;\n }\n this.#active = tool;\n this.eventBus.dispatch("cursortoolchanged", {\n source: this,\n tool,\n disabled\n });\n }\n #addEventListeners() {\n this.eventBus._on("switchcursortool", evt => {\n if (!evt.reset) {\n this.switchTool(evt.tool);\n } else if (this.#prevActive !== null) {\n annotationEditorMode = AnnotationEditorType.NONE;\n presentationModeState = PresentationModeState.NORMAL;\n enableActive();\n }\n });\n let annotationEditorMode = AnnotationEditorType.NONE,\n presentationModeState = PresentationModeState.NORMAL;\n const disableActive = () => {\n this.#prevActive ??= this.#active;\n this.#switchTool(CursorTool.SELECT, true);\n };\n const enableActive = () => {\n if (this.#prevActive !== null && annotationEditorMode === AnnotationEditorType.NONE && presentationModeState === PresentationModeState.NORMAL) {\n this.#switchTool(this.#prevActive);\n this.#prevActive = null;\n }\n };\n this.eventBus._on("annotationeditormodechanged", ({\n mode\n }) => {\n annotationEditorMode = mode;\n if (mode === AnnotationEditorType.NONE) {\n enableActive();\n } else {\n disableActive();\n }\n });\n this.eventBus._on("presentationmodechanged", ({\n state\n }) => {\n presentationModeState = state;\n if (state === PresentationModeState.NORMAL) {\n enableActive();\n } else if (state === PresentationModeState.FULLSCREEN) {\n disableActive();\n }\n });\n }\n get _handTool() {\n return shadow(this, "_handTool", new GrabToPan({\n element: this.container\n }));\n }\n}\n\n;// ./web/pdf_document_properties.js\n\n\n\nconst NON_METRIC_LOCALES = ["en-us", "en-lr", "my"];\nconst US_PAGE_NAMES = {\n "8.5x11": "pdfjs-document-properties-page-size-name-letter",\n "8.5x14": "pdfjs-document-properties-page-size-name-legal"\n};\nconst METRIC_PAGE_NAMES = {\n "297x420": "pdfjs-document-properties-page-size-name-a-three",\n "210x297": "pdfjs-document-properties-page-size-name-a-four"\n};\nfunction getPageName(size, isPortrait, pageNames) {\n const width = isPortrait ? size.width : size.height;\n const height = isPortrait ? size.height : size.width;\n return pageNames[`${width}x${height}`];\n}\nclass PDFDocumentProperties {\n #fieldData = null;\n constructor({\n dialog,\n fields,\n closeButton\n }, overlayManager, eventBus, l10n, fileNameLookup, titleLookup) {\n this.dialog = dialog;\n this.fields = fields;\n this.overlayManager = overlayManager;\n this.l10n = l10n;\n this._fileNameLookup = fileNameLookup;\n this._titleLookup = titleLookup;\n this.#reset();\n closeButton.addEventListener("click", this.close.bind(this));\n this.overlayManager.register(this.dialog);\n eventBus._on("pagechanging", evt => {\n this._currentPageNumber = evt.pageNumber;\n });\n eventBus._on("rotationchanging", evt => {\n this._pagesRotation = evt.pagesRotation;\n });\n }\n async open() {\n await Promise.all([this.overlayManager.open(this.dialog), this._dataAvailableCapability.promise]);\n const currentPageNumber = this._currentPageNumber;\n const pagesRotation = this._pagesRotation;\n if (this.#fieldData && currentPageNumber === this.#fieldData._currentPageNumber && pagesRotation === this.#fieldData._pagesRotation) {\n this.#updateUI();\n return;\n }\n const [{\n info,\n metadata,\n contentLength\n }, pdfPage] = await Promise.all([this.pdfDocument.getMetadata(), this.pdfDocument.getPage(currentPageNumber)]);\n const [fileName, fileSize, title, creationDate, modificationDate, pageSize, isLinearized] = await Promise.all([this._fileNameLookup(), this.#parseFileSize(contentLength), this._titleLookup(), this.#parseDate(metadata?.get("xmp:createdate"), info.CreationDate), this.#parseDate(metadata?.get("xmp:modifydate"), info.ModDate), this.#parsePageSize(getPageSizeInches(pdfPage), pagesRotation), this.#parseLinearization(info.IsLinearized)]);\n this.#fieldData = Object.freeze({\n fileName,\n fileSize,\n title,\n author: metadata?.get("dc:creator")?.join("\\n") || info.Author,\n subject: metadata?.get("dc:subject")?.join("\\n") || info.Subject,\n keywords: metadata?.get("pdf:keywords") || info.Keywords,\n creationDate,\n modificationDate,\n creator: metadata?.get("xmp:creatortool") || info.Creator,\n producer: metadata?.get("pdf:producer") || info.Producer,\n version: info.PDFFormatVersion,\n pageCount: this.pdfDocument.numPages,\n pageSize,\n linearized: isLinearized,\n _currentPageNumber: currentPageNumber,\n _pagesRotation: pagesRotation\n });\n this.#updateUI();\n const {\n length\n } = await this.pdfDocument.getDownloadInfo();\n if (contentLength === length) {\n return;\n }\n const data = Object.assign(Object.create(null), this.#fieldData);\n data.fileSize = await this.#parseFileSize(length);\n this.#fieldData = Object.freeze(data);\n this.#updateUI();\n }\n async close() {\n this.overlayManager.close(this.dialog);\n }\n setDocument(pdfDocument) {\n if (this.pdfDocument) {\n this.#reset();\n this.#updateUI();\n }\n if (!pdfDocument) {\n return;\n }\n this.pdfDocument = pdfDocument;\n this._dataAvailableCapability.resolve();\n }\n #reset() {\n this.pdfDocument = null;\n this.#fieldData = null;\n this._dataAvailableCapability = Promise.withResolvers();\n this._currentPageNumber = 1;\n this._pagesRotation = 0;\n }\n #updateUI() {\n if (this.#fieldData && this.overlayManager.active !== this.dialog) {\n return;\n }\n for (const id in this.fields) {\n const content = this.#fieldData?.[id];\n this.fields[id].textContent = content || content === 0 ? content : "-";\n }\n }\n async #parseFileSize(b = 0) {\n const kb = b / 1024,\n mb = kb / 1024;\n return kb ? this.l10n.get(mb >= 1 ? "pdfjs-document-properties-size-mb" : "pdfjs-document-properties-size-kb", {\n mb,\n kb,\n b\n }) : undefined;\n }\n async #parsePageSize(pageSizeInches, pagesRotation) {\n if (!pageSizeInches) {\n return undefined;\n }\n if (pagesRotation % 180 !== 0) {\n pageSizeInches = {\n width: pageSizeInches.height,\n height: pageSizeInches.width\n };\n }\n const isPortrait = isPortraitOrientation(pageSizeInches),\n nonMetric = NON_METRIC_LOCALES.includes(this.l10n.getLanguage());\n let sizeInches = {\n width: Math.round(pageSizeInches.width * 100) / 100,\n height: Math.round(pageSizeInches.height * 100) / 100\n };\n let sizeMillimeters = {\n width: Math.round(pageSizeInches.width * 25.4 * 10) / 10,\n height: Math.round(pageSizeInches.height * 25.4 * 10) / 10\n };\n let nameId = getPageName(sizeInches, isPortrait, US_PAGE_NAMES) || getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES);\n if (!nameId && !(Number.isInteger(sizeMillimeters.width) && Number.isInteger(sizeMillimeters.height))) {\n const exactMillimeters = {\n width: pageSizeInches.width * 25.4,\n height: pageSizeInches.height * 25.4\n };\n const intMillimeters = {\n width: Math.round(sizeMillimeters.width),\n height: Math.round(sizeMillimeters.height)\n };\n if (Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 && Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1) {\n nameId = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES);\n if (nameId) {\n sizeInches = {\n width: Math.round(intMillimeters.width / 25.4 * 100) / 100,\n height: Math.round(intMillimeters.height / 25.4 * 100) / 100\n };\n sizeMillimeters = intMillimeters;\n }\n }\n }\n const [{\n width,\n height\n }, unit, name, orientation] = await Promise.all([nonMetric ? sizeInches : sizeMillimeters, this.l10n.get(nonMetric ? "pdfjs-document-properties-page-size-unit-inches" : "pdfjs-document-properties-page-size-unit-millimeters"), nameId && this.l10n.get(nameId), this.l10n.get(isPortrait ? "pdfjs-document-properties-page-size-orientation-portrait" : "pdfjs-document-properties-page-size-orientation-landscape")]);\n return this.l10n.get(name ? "pdfjs-document-properties-page-size-dimension-name-string" : "pdfjs-document-properties-page-size-dimension-string", {\n width,\n height,\n unit,\n name,\n orientation\n });\n }\n async #parseDate(metadataDate, infoDate) {\n const dateObj = Date.parse(metadataDate) || PDFDateString.toDateObject(infoDate);\n return dateObj ? this.l10n.get("pdfjs-document-properties-date-time-string", {\n dateObj: dateObj.valueOf()\n }) : undefined;\n }\n #parseLinearization(isLinearized) {\n return this.l10n.get(isLinearized ? "pdfjs-document-properties-linearized-yes" : "pdfjs-document-properties-linearized-no");\n }\n}\n\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.detached.js\nvar es_array_buffer_detached = __webpack_require__(6573);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.transfer.js\nvar es_array_buffer_transfer = __webpack_require__(8100);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.transfer-to-fixed-length.js\nvar es_array_buffer_transfer_to_fixed_length = __webpack_require__(7936);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.escape.js\nvar es_regexp_escape = __webpack_require__(6069);\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.with.js\nvar es_typed_array_with = __webpack_require__(9577);\n;// ./web/pdf_find_utils.js\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};\nfunction isAlphabeticalScript(charCode) {\n return charCode < 0x2e80;\n}\nfunction isAscii(charCode) {\n return (charCode & 0xff80) === 0;\n}\nfunction isAsciiAlpha(charCode) {\n return charCode >= 0x61 && charCode <= 0x7a || charCode >= 0x41 && charCode <= 0x5a;\n}\nfunction isAsciiDigit(charCode) {\n return charCode >= 0x30 && charCode <= 0x39;\n}\nfunction isAsciiSpace(charCode) {\n return charCode === 0x20 || charCode === 0x09 || charCode === 0x0d || charCode === 0x0a;\n}\nfunction isHan(charCode) {\n return charCode >= 0x3400 && charCode <= 0x9fff || charCode >= 0xf900 && charCode <= 0xfaff;\n}\nfunction isKatakana(charCode) {\n return charCode >= 0x30a0 && charCode <= 0x30ff;\n}\nfunction isHiragana(charCode) {\n return charCode >= 0x3040 && charCode <= 0x309f;\n}\nfunction isHalfwidthKatakana(charCode) {\n return charCode >= 0xff60 && charCode <= 0xff9f;\n}\nfunction isThai(charCode) {\n return (charCode & 0xff80) === 0x0e00;\n}\nfunction getCharacterType(charCode) {\n if (isAlphabeticalScript(charCode)) {\n if (isAscii(charCode)) {\n if (isAsciiSpace(charCode)) {\n return CharacterType.SPACE;\n } else if (isAsciiAlpha(charCode) || isAsciiDigit(charCode) || charCode === 0x5f) {\n return CharacterType.ALPHA_LETTER;\n }\n return CharacterType.PUNCT;\n } else if (isThai(charCode)) {\n return CharacterType.THAI_LETTER;\n } else if (charCode === 0xa0) {\n return CharacterType.SPACE;\n }\n return CharacterType.ALPHA_LETTER;\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}\nlet NormalizeWithNFKC;\nfunction getNormalizeWithNFKC() {\n if (!NormalizeWithNFKC) {\n const ranges = [];\n const range = [];\n const diacriticsRegex = /^\\p{M}$/u;\n for (let i = 0; i < 65536; i++) {\n if (i >= 0xd800 && i <= 0xdfff) {\n continue;\n }\n const c = String.fromCharCode(i);\n if (c.normalize("NFKC") !== c && !diacriticsRegex.test(c)) {\n if (range.length !== 2) {\n range[0] = range[1] = i;\n continue;\n }\n if (range[1] + 1 !== i) {\n if (range[0] === range[1]) {\n ranges.push(String.fromCharCode(range[0]));\n } else {\n ranges.push(`${String.fromCharCode(range[0])}-${String.fromCharCode(range[1])}`);\n }\n range[0] = range[1] = i;\n } else {\n range[1] = i;\n }\n }\n }\n const rangesStr = ranges.join("");\n if (!NormalizeWithNFKC) {\n NormalizeWithNFKC = rangesStr;\n } else if (rangesStr !== NormalizeWithNFKC) {\n for (let i = 1; i < rangesStr.length; i++) {\n if (rangesStr[i] !== NormalizeWithNFKC[i]) {\n console.log(`Difference at index ${i}: ` + `U+${rangesStr.charCodeAt(i).toString(16).toUpperCase().padStart(4, "0")}` + `!== U+${NormalizeWithNFKC.charCodeAt(i).toString(16).toUpperCase().padStart(4, "0")}`);\n break;\n }\n }\n throw new Error("getNormalizeWithNFKC - update the `NormalizeWithNFKC` string.");\n }\n }\n return NormalizeWithNFKC;\n}\n\n;// ./web/pdf_find_controller.js\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst FindState = {\n FOUND: 0,\n NOT_FOUND: 1,\n WRAPPED: 2,\n PENDING: 3\n};\nconst FIND_TIMEOUT = 250;\nconst MATCH_SCROLL_OFFSET_TOP = -50;\nconst CHARACTERS_TO_NORMALIZE = {\n "\\u2010": "-",\n "\\u2018": "\'",\n "\\u2019": "\'",\n "\\u201A": "\'",\n "\\u201B": "\'",\n "\\u201C": \'"\',\n "\\u201D": \'"\',\n "\\u201E": \'"\',\n "\\u201F": \'"\',\n "\\u00BC": "1/4",\n "\\u00BD": "1/2",\n "\\u00BE": "3/4"\n};\nconst DIACRITICS_EXCEPTION = new Set([0x3099, 0x309a, 0x094d, 0x09cd, 0x0a4d, 0x0acd, 0x0b4d, 0x0bcd, 0x0c4d, 0x0ccd, 0x0d3b, 0x0d3c, 0x0d4d, 0x0dca, 0x0e3a, 0x0eba, 0x0f84, 0x1039, 0x103a, 0x1714, 0x1734, 0x17d2, 0x1a60, 0x1b44, 0x1baa, 0x1bab, 0x1bf2, 0x1bf3, 0x2d7f, 0xa806, 0xa82c, 0xa8c4, 0xa953, 0xa9c0, 0xaaf6, 0xabed, 0x0c56, 0x0f71, 0x0f72, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f80, 0x0f74]);\nlet DIACRITICS_EXCEPTION_STR;\nconst DIACRITICS_REG_EXP = /\\p{M}+/gu;\nconst SPECIAL_CHARS_REG_EXP = /([+^$|])|(\\p{P}+)|(\\s+)|(\\p{M})|(\\p{L})/gu;\nconst NOT_DIACRITIC_FROM_END_REG_EXP = /([^\\p{M}])\\p{M}*$/u;\nconst NOT_DIACRITIC_FROM_START_REG_EXP = /^\\p{M}*([^\\p{M}])/u;\nconst SYLLABLES_REG_EXP = /[\\uAC00-\\uD7AF\\uFA6C\\uFACF-\\uFAD1\\uFAD5-\\uFAD7]+/g;\nconst SYLLABLES_LENGTHS = new Map();\nconst FIRST_CHAR_SYLLABLES_REG_EXP = "[\\\\u1100-\\\\u1112\\\\ud7a4-\\\\ud7af\\\\ud84a\\\\ud84c\\\\ud850\\\\ud854\\\\ud857\\\\ud85f]";\nconst NFKC_CHARS_TO_NORMALIZE = new Map();\nlet noSyllablesRegExp = null;\nlet withSyllablesRegExp = null;\nfunction normalize(text, options = {}) {\n const syllablePositions = [];\n let m;\n while ((m = SYLLABLES_REG_EXP.exec(text)) !== null) {\n let {\n index\n } = 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 const hasSyllables = syllablePositions.length > 0;\n const ignoreDashEOL = options.ignoreDashEOL ?? false;\n let normalizationRegex;\n if (!hasSyllables && noSyllablesRegExp) {\n normalizationRegex = noSyllablesRegExp;\n } else if (hasSyllables && withSyllablesRegExp) {\n normalizationRegex = withSyllablesRegExp;\n } else {\n const replace = Object.keys(CHARACTERS_TO_NORMALIZE).join("");\n const toNormalizeWithNFKC = getNormalizeWithNFKC();\n const CJK = "(?:\\\\p{Ideographic}|[\\u3040-\\u30FF])";\n const HKDiacritics = "(?:\\u3099|\\u309A)";\n const BrokenWord = `\\\\p{Ll}-\\\\n(?=\\\\p{Ll})|\\\\p{Lu}-\\\\n(?=\\\\p{L})`;\n const regexps = [`[${replace}]`, `[${toNormalizeWithNFKC}]`, `${HKDiacritics}\\\\n`, "\\\\p{M}+(?:-\\\\n)?", `${BrokenWord}`, "\\\\S-\\\\n", `${CJK}\\\\n`, "\\\\n", hasSyllables ? FIRST_CHAR_SYLLABLES_REG_EXP : "\\\\u0000"];\n normalizationRegex = new RegExp(regexps.map(r => `(${r})`).join("|"), "gum");\n if (hasSyllables) {\n withSyllablesRegExp = normalizationRegex;\n } else {\n noSyllablesRegExp = normalizationRegex;\n }\n }\n const rawDiacriticsPositions = [];\n while ((m = DIACRITICS_REG_EXP.exec(text)) !== null) {\n rawDiacriticsPositions.push([m[0].length, m.index]);\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 normalized = normalized.replace(normalizationRegex, (match, p1, p2, p3, p4, p5, p6, p7, p8, p9, i) => {\n i -= shiftOrigin;\n if (p1) {\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 if (p2) {\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 if (p3) {\n hasDiacritics = true;\n if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) {\n ++rawDiacriticsIndex;\n } else {\n positions.push(i - 1 - shift + 1, shift - 1);\n shift -= 1;\n shiftOrigin += 1;\n }\n positions.push(i - shift + 1, shift);\n shiftOrigin += 1;\n eol += 1;\n return p3.charAt(0);\n }\n if (p4) {\n const hasTrailingDashEOL = p4.endsWith("\\n");\n const len = hasTrailingDashEOL ? p4.length - 2 : p4.length;\n hasDiacritics = true;\n let jj = len;\n if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) {\n jj -= rawDiacriticsPositions[rawDiacriticsIndex][0];\n ++rawDiacriticsIndex;\n }\n for (let j = 1; j <= jj; j++) {\n positions.push(i - 1 - shift + j, shift - j);\n }\n shift -= jj;\n shiftOrigin += jj;\n if (hasTrailingDashEOL) {\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 return p4;\n }\n if (p5) {\n if (ignoreDashEOL) {\n shiftOrigin += 1;\n eol += 1;\n return p5.slice(0, -1);\n }\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 if (p6) {\n shiftOrigin += 1;\n eol += 1;\n return p6.slice(0, -1);\n }\n if (p7) {\n const len = p7.length - 1;\n positions.push(i - shift + len, shift);\n shiftOrigin += 1;\n eol += 1;\n return p7.slice(0, -1);\n }\n if (p8) {\n positions.push(i - shift + 1, shift - 1);\n shift -= 1;\n shiftOrigin += 1;\n eol += 1;\n return " ";\n }\n if (i + eol === syllablePositions[syllableIndex]?.[1]) {\n const newCharLen = syllablePositions[syllableIndex][0] - 1;\n ++syllableIndex;\n for (let j = 1; j <= newCharLen; j++) {\n positions.push(i - (shift - j), shift - j);\n }\n shift -= newCharLen;\n shiftOrigin += newCharLen;\n }\n return p9;\n });\n positions.push(normalized.length, shift);\n const starts = new Uint32Array(positions.length >> 1);\n const shifts = new Int32Array(positions.length >> 1);\n for (let i = 0, ii = positions.length; i < ii; i += 2) {\n starts[i >> 1] = positions[i];\n shifts[i >> 1] = positions[i + 1];\n }\n return [normalized, [starts, shifts], hasDiacritics];\n}\nfunction getOriginalIndex(diffs, pos, len) {\n if (!diffs) {\n return [pos, len];\n }\n const [starts, shifts] = diffs;\n const start = pos;\n const end = pos + len - 1;\n let i = binarySearchFirstItem(starts, x => x >= start);\n if (starts[i] > start) {\n --i;\n }\n let j = binarySearchFirstItem(starts, x => x >= end, i);\n if (starts[j] > end) {\n --j;\n }\n const oldStart = start + shifts[i];\n const oldEnd = end + shifts[j];\n const oldLen = oldEnd + 1 - oldStart;\n return [oldStart, oldLen];\n}\nclass PDFFindController {\n #state = null;\n #updateMatchesCountOnProgress = true;\n #visitedPagesCount = 0;\n #copiedExtractTextPromises = null;\n constructor({\n linkService,\n eventBus,\n updateMatchesCountOnProgress = true\n }) {\n this._linkService = linkService;\n this._eventBus = eventBus;\n this.#updateMatchesCountOnProgress = updateMatchesCountOnProgress;\n this.onIsPageVisible = null;\n this.#reset();\n eventBus._on("find", this.#onFind.bind(this));\n eventBus._on("findbarclose", this.#onFindBarClose.bind(this));\n eventBus._on("pagesedited", this.#onPagesEdited.bind(this));\n }\n get highlightMatches() {\n return this._highlightMatches;\n }\n get pageMatches() {\n return this._pageMatches;\n }\n get pageMatchesLength() {\n return this._pageMatchesLength;\n }\n get selected() {\n return this._selected;\n }\n get state() {\n return this.#state;\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 #onFind(state) {\n if (!state) {\n return;\n }\n const pdfDocument = this._pdfDocument;\n const {\n type\n } = state;\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 this._firstPageCapability.promise.then(() => {\n if (!this._pdfDocument || pdfDocument && this._pdfDocument !== pdfDocument) {\n return;\n }\n this.#extractText();\n const findbarClosed = !this._highlightMatches;\n const pendingTimeout = !!this._findTimeout;\n if (this._findTimeout) {\n clearTimeout(this._findTimeout);\n this._findTimeout = null;\n }\n if (!type) {\n this._findTimeout = setTimeout(() => {\n this.#nextMatch();\n this._findTimeout = null;\n }, FIND_TIMEOUT);\n } else if (this._dirtyMatch) {\n this.#nextMatch();\n } else if (type === "again") {\n this.#nextMatch();\n if (findbarClosed && this.#state.highlightAll) {\n this.#updateAllPages();\n }\n } else if (type === "highlightallchange") {\n if (pendingTimeout) {\n this.#nextMatch();\n } else {\n this._highlightMatches = true;\n }\n this.#updateAllPages();\n } else {\n this.#nextMatch();\n }\n });\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;\n const spot = {\n top: MATCH_SCROLL_OFFSET_TOP,\n left: selectedLeft\n };\n scrollIntoView(element, spot, true);\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 this._selected = {\n pageIdx: -1,\n matchIdx: -1\n };\n this._offset = {\n pageIdx: null,\n matchIdx: null,\n wrapped: false\n };\n this._extractTextPromises = [];\n this._pageContents = [];\n this._pageDiffs = [];\n this._hasDiacritics = [];\n this._matchesCountTotal = 0;\n this._pagesToSearch = null;\n this._pendingFindMatches = new Set();\n this._resumePageIdx = null;\n this._dirtyMatch = false;\n clearTimeout(this._findTimeout);\n this._findTimeout = null;\n this.#copiedExtractTextPromises = null;\n this._firstPageCapability = Promise.withResolvers();\n }\n get #query() {\n const {\n query\n } = 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 return (query || []).filter(q => !!q).map(q => normalize(q)[0]);\n }\n #shouldDirtyMatch(state) {\n const newQuery = state.query,\n prevQuery = this.#state.query;\n const newType = typeof newQuery,\n prevType = typeof prevQuery;\n if (newType !== prevType) {\n return true;\n }\n if (newType === "string") {\n if (newQuery !== prevQuery) {\n return true;\n }\n } else if (JSON.stringify(newQuery) !== JSON.stringify(prevQuery)) {\n return true;\n }\n switch (state.type) {\n case "again":\n const pageNumber = this._selected.pageIdx + 1;\n const linkService = this._linkService;\n return pageNumber >= 1 && pageNumber <= linkService.pagesCount && pageNumber !== linkService.page && !(this.onIsPageVisible?.(pageNumber) ?? true);\n case "highlightallchange":\n return false;\n }\n return true;\n }\n #isEntireWord(content, startIdx, length) {\n let match = content.slice(0, startIdx).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 match = content.slice(startIdx + length).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 return true;\n }\n #convertToRegExpString(query, hasDiacritics) {\n const {\n matchDiacritics\n } = this.#state;\n let isUnicode = false;\n const addExtraWhitespaces = (original, fixed) => {\n if (original === query) {\n return fixed;\n }\n if (query.startsWith(original)) {\n return `${fixed}[ ]*`;\n }\n if (query.endsWith(original)) {\n return `[ ]*${fixed}`;\n }\n return `[ ]*${fixed}[ ]*`;\n };\n query = query.replaceAll(SPECIAL_CHARS_REG_EXP, (match, p1, p2, p3, p4, p5) => {\n if (p1) {\n return addExtraWhitespaces(p1, RegExp.escape(p1));\n }\n if (p2) {\n return addExtraWhitespaces(p2, RegExp.escape(p2));\n }\n if (p3) {\n return "[ ]+";\n }\n if (matchDiacritics) {\n return p4 || p5;\n }\n if (p4) {\n return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : "";\n }\n if (hasDiacritics) {\n isUnicode = true;\n return `${p5}\\\\p{M}*`;\n }\n return p5;\n });\n const trailingSpaces = "[ ]*";\n if (query.endsWith(trailingSpaces)) {\n query = query.slice(0, query.length - trailingSpaces.length);\n }\n if (matchDiacritics) {\n if (hasDiacritics) {\n DIACRITICS_EXCEPTION_STR ||= String.fromCharCode(...DIACRITICS_EXCEPTION);\n isUnicode = true;\n query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\\\p{M}]|$)`;\n }\n }\n return [isUnicode, query];\n }\n #calculateMatch(pageIndex) {\n if (!this.#state) {\n return;\n }\n const query = this.#query;\n if (query.length === 0) {\n return;\n }\n const pageContent = this._pageContents[pageIndex];\n const matcherResult = this.match(query, pageContent, pageIndex);\n const matches = this._pageMatches[pageIndex] = [];\n const matchesLength = this._pageMatchesLength[pageIndex] = [];\n const diffs = this._pageDiffs[pageIndex];\n matcherResult?.forEach(({\n index,\n length\n }) => {\n const [matchPos, matchLen] = getOriginalIndex(diffs, index, length);\n if (matchLen) {\n matches.push(matchPos);\n matchesLength.push(matchLen);\n }\n });\n if (this.#state.highlightAll) {\n this.#updatePage(pageIndex);\n }\n if (this._resumePageIdx === pageIndex) {\n this._resumePageIdx = null;\n this.#nextPageMatch();\n }\n const pageMatchesCount = matches.length;\n this._matchesCountTotal += pageMatchesCount;\n if (this.#updateMatchesCountOnProgress) {\n if (pageMatchesCount > 0) {\n this.#updateUIResultsCount();\n }\n } else if (++this.#visitedPagesCount === this._linkService.pagesCount) {\n this.#updateUIResultsCount();\n }\n }\n match(query, pageContent, pageIndex) {\n const hasDiacritics = this._hasDiacritics[pageIndex];\n let isUnicode = false;\n if (typeof query === "string") {\n [isUnicode, query] = this.#convertToRegExpString(query, hasDiacritics);\n } else {\n query = query.sort().reverse().map(q => {\n const [isUnicodePart, queryPart] = this.#convertToRegExpString(q, hasDiacritics);\n isUnicode ||= isUnicodePart;\n return `(${queryPart})`;\n }).join("|");\n }\n if (!query) {\n return undefined;\n }\n const {\n caseSensitive,\n entireWord\n } = this.#state;\n const flags = `g${isUnicode ? "u" : ""}${caseSensitive ? "" : "i"}`;\n query = new RegExp(query, flags);\n const matches = [];\n let match;\n while ((match = query.exec(pageContent)) !== null) {\n if (entireWord && !this.#isEntireWord(pageContent, match.index, match[0].length)) {\n continue;\n }\n matches.push({\n index: match.index,\n length: match[0].length\n });\n }\n return matches;\n }\n #extractText() {\n if (this._extractTextPromises.length > 0) {\n return;\n }\n let deferred = Promise.resolve();\n const textOptions = {\n disableNormalization: true\n };\n const pdfDoc = this._pdfDocument;\n for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) {\n const {\n promise,\n resolve\n } = Promise.withResolvers();\n this._extractTextPromises[i] = promise;\n deferred = deferred.then(async () => {\n if (pdfDoc !== this._pdfDocument) {\n resolve();\n return;\n }\n await pdfDoc.getPage(i + 1).then(pdfPage => pdfPage.getTextContent(textOptions)).then(textContent => {\n const strBuf = [];\n for (const textItem of textContent.items) {\n strBuf.push(textItem.str);\n if (textItem.hasEOL) {\n strBuf.push("\\n");\n }\n }\n [this._pageContents[i], this._pageDiffs[i], this._hasDiacritics[i]] = normalize(strBuf.join(""));\n resolve();\n }, reason => {\n console.error(`Unable to get text content for page ${i + 1}`, reason);\n this._pageContents[i] = "";\n this._pageDiffs[i] = null;\n this._hasDiacritics[i] = false;\n resolve();\n });\n });\n }\n }\n #updatePage(index) {\n if (this._scrollMatches && this._selected.pageIdx === index) {\n this._linkService.page = index + 1;\n }\n this._eventBus.dispatch("updatetextlayermatches", {\n source: this,\n pageIndex: index\n });\n }\n #updateAllPages() {\n this._eventBus.dispatch("updatetextlayermatches", {\n source: this,\n pageIndex: -1\n });\n }\n #nextMatch() {\n const previous = this.#state.findPrevious;\n const currentPageIndex = this._linkService.page - 1;\n const numPages = this._linkService.pagesCount;\n this._highlightMatches = true;\n if (this._dirtyMatch) {\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 this.#updateAllPages();\n for (let i = 0; i < numPages; i++) {\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 const query = this.#query;\n if (query.length === 0) {\n this.#updateUIState(FindState.FOUND);\n return;\n }\n if (this._resumePageIdx) {\n return;\n }\n const offset = this._offset;\n this._pagesToSearch = numPages;\n if (offset.matchIdx !== null) {\n const numPageMatches = this._pageMatches[offset.pageIdx].length;\n if (!previous && offset.matchIdx + 1 < numPageMatches || previous && offset.matchIdx > 0) {\n offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1;\n this.#updateMatch(true);\n return;\n }\n this.#advanceOffsetPage(previous);\n }\n this.#nextPageMatch();\n }\n #matchesReady(matches) {\n const offset = this._offset;\n const numMatches = matches.length;\n const previous = this.#state.findPrevious;\n if (numMatches) {\n offset.matchIdx = previous ? numMatches - 1 : 0;\n this.#updateMatch(true);\n return true;\n }\n this.#advanceOffsetPage(previous);\n if (offset.wrapped) {\n offset.matchIdx = null;\n if (this._pagesToSearch < 0) {\n this.#updateMatch(false);\n return true;\n }\n }\n return false;\n }\n #nextPageMatch() {\n if (this._resumePageIdx !== null) {\n console.error("There can only be one pending page.");\n }\n let matches = null;\n do {\n const pageIdx = this._offset.pageIdx;\n matches = this._pageMatches[pageIdx];\n if (!matches) {\n this._resumePageIdx = pageIdx;\n break;\n }\n } while (!this.#matchesReady(matches));\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 this._pagesToSearch--;\n if (offset.pageIdx >= numPages || offset.pageIdx < 0) {\n offset.pageIdx = previous ? numPages - 1 : 0;\n offset.wrapped = true;\n }\n }\n #updateMatch(found = false) {\n let state = FindState.NOT_FOUND;\n const wrapped = this._offset.wrapped;\n this._offset.wrapped = false;\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 if (previousPage !== -1 && previousPage !== this._selected.pageIdx) {\n this.#updatePage(previousPage);\n }\n }\n this.#updateUIState(state, this.#state.findPrevious);\n if (this._selected.pageIdx !== -1) {\n this._scrollMatches = true;\n this.#updatePage(this._selected.pageIdx);\n }\n }\n #onPagesEdited({\n pagesMapper,\n type,\n pageNumbers\n }) {\n if (this._extractTextPromises.length === 0) {\n return;\n }\n if (type === "copy") {\n this.#copiedExtractTextPromises = new Map();\n for (const pageNum of pageNumbers) {\n this.#copiedExtractTextPromises.set(pageNum, this._extractTextPromises[pageNum - 1]);\n }\n return;\n }\n this.#onFindBarClose();\n this._dirtyMatch = true;\n const prevTextPromises = this._extractTextPromises;\n const extractTextPromises = this._extractTextPromises.length = [];\n for (let i = 1, ii = pagesMapper.length; i <= ii; i++) {\n const prevPageNumber = pagesMapper.getPrevPageNumber(i);\n if (prevPageNumber < 0) {\n extractTextPromises.push(this.#copiedExtractTextPromises?.get(-prevPageNumber) || Promise.resolve());\n continue;\n }\n extractTextPromises.push(prevTextPromises[prevPageNumber - 1] || Promise.resolve());\n }\n }\n #onFindBarClose(evt) {\n const pdfDocument = this._pdfDocument;\n this._firstPageCapability.promise.then(() => {\n if (!this._pdfDocument || pdfDocument && this._pdfDocument !== pdfDocument) {\n return;\n }\n if (this._findTimeout) {\n clearTimeout(this._findTimeout);\n this._findTimeout = null;\n }\n if (this._resumePageIdx) {\n this._resumePageIdx = null;\n this._dirtyMatch = true;\n }\n this.#updateUIState(FindState.FOUND);\n this._highlightMatches = false;\n this.#updateAllPages();\n });\n }\n #requestMatchesCount() {\n const {\n pageIdx,\n matchIdx\n } = 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 if (current < 1 || current > total) {\n current = total = 0;\n }\n return {\n current,\n total\n };\n }\n #updateUIResultsCount() {\n this._eventBus.dispatch("updatefindmatchescount", {\n source: this,\n matchesCount: this.#requestMatchesCount()\n });\n }\n #updateUIState(state, previous = false) {\n if (!this.#updateMatchesCountOnProgress && (this.#visitedPagesCount !== this._linkService.pagesCount || state === FindState.PENDING)) {\n return;\n }\n this._eventBus.dispatch("updatefindcontrolstate", {\n source: this,\n state,\n previous,\n entireWord: this.#state?.entireWord ?? null,\n matchesCount: this.#requestMatchesCount(),\n rawQuery: this.#state?.query ?? null\n });\n }\n}\n\n;// ./web/pdf_find_bar.js\n\n\n\n\n\nconst MATCHES_COUNT_LIMIT = 1000;\nclass PDFFindBar {\n #mainContainer;\n #resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this));\n opened = false;\n constructor(options, mainContainer, eventBus) {\n this.bar = options.bar;\n this.toggleButton = options.toggleButton;\n this.findField = options.findField;\n this.highlightAll = options.highlightAllCheckbox;\n this.caseSensitive = options.caseSensitiveCheckbox;\n this.matchDiacritics = options.matchDiacriticsCheckbox;\n this.entireWord = options.entireWordCheckbox;\n this.findMsg = options.findMsg;\n this.findResultsCount = options.findResultsCount;\n this.findPreviousButton = options.findPreviousButton;\n this.findNextButton = options.findNextButton;\n this.eventBus = eventBus;\n this.#mainContainer = mainContainer;\n const checkedInputs = new Map([[this.highlightAll, "highlightallchange"], [this.caseSensitive, "casesensitivitychange"], [this.entireWord, "entirewordchange"], [this.matchDiacritics, "diacriticmatchingchange"]]);\n this.toggleButton.addEventListener("click", () => {\n this.toggle();\n });\n this.findField.addEventListener("input", () => {\n this.dispatchEvent("");\n });\n this.bar.addEventListener("keydown", ({\n keyCode,\n shiftKey,\n target\n }) => {\n switch (keyCode) {\n case 13:\n if (target === this.findField) {\n this.dispatchEvent("again", shiftKey);\n } else if (checkedInputs.has(target)) {\n target.checked = !target.checked;\n this.dispatchEvent(checkedInputs.get(target));\n }\n break;\n case 27:\n this.close();\n break;\n }\n });\n this.findPreviousButton.addEventListener("click", () => {\n this.dispatchEvent("again", true);\n });\n this.findNextButton.addEventListener("click", () => {\n this.dispatchEvent("again", false);\n });\n for (const [elem, evtName] of checkedInputs) {\n elem.addEventListener("click", () => {\n this.dispatchEvent(evtName);\n });\n }\n }\n reset() {\n this.updateUIState();\n }\n dispatchEvent(type, findPrev = false) {\n this.eventBus.dispatch("find", {\n source: this,\n type,\n query: this.findField.value,\n caseSensitive: this.caseSensitive.checked,\n entireWord: this.entireWord.checked,\n highlightAll: this.highlightAll.checked,\n findPrevious: findPrev,\n matchDiacritics: this.matchDiacritics.checked\n });\n }\n updateUIState(state, previous, matchesCount) {\n const {\n findField,\n findMsg\n } = this;\n let findMsgId = "",\n status = "";\n switch (state) {\n case FindState.FOUND:\n break;\n case FindState.PENDING:\n status = "pending";\n break;\n case FindState.NOT_FOUND:\n findMsgId = "pdfjs-find-not-found";\n status = "notFound";\n break;\n case FindState.WRAPPED:\n findMsgId = previous ? "pdfjs-find-reached-top" : "pdfjs-find-reached-bottom";\n break;\n }\n findField.setAttribute("data-status", status);\n findField.setAttribute("aria-invalid", state === FindState.NOT_FOUND);\n findMsg.setAttribute("data-status", status);\n if (findMsgId) {\n findMsg.setAttribute("data-l10n-id", findMsgId);\n } else {\n findMsg.removeAttribute("data-l10n-id");\n findMsg.textContent = "";\n }\n this.updateResultsCount(matchesCount);\n }\n updateResultsCount({\n current = 0,\n total = 0\n } = {}) {\n const {\n findResultsCount\n } = this;\n if (total > 0) {\n const limit = MATCHES_COUNT_LIMIT;\n findResultsCount.setAttribute("data-l10n-id", total > limit ? "pdfjs-find-match-count-limit" : "pdfjs-find-match-count");\n findResultsCount.setAttribute("data-l10n-args", JSON.stringify({\n limit,\n current,\n total\n }));\n } else {\n findResultsCount.removeAttribute("data-l10n-id");\n findResultsCount.textContent = "";\n }\n }\n open() {\n if (!this.opened) {\n this.#resizeObserver.observe(this.#mainContainer);\n this.#resizeObserver.observe(this.bar);\n this.opened = true;\n toggleExpandedBtn(this.toggleButton, true, this.bar);\n }\n this.findField.select();\n this.findField.focus();\n }\n close() {\n if (!this.opened) {\n return;\n }\n this.#resizeObserver.disconnect();\n this.opened = false;\n toggleExpandedBtn(this.toggleButton, false, this.bar);\n this.eventBus.dispatch("findbarclose", {\n source: this\n });\n }\n toggle() {\n if (this.opened) {\n this.close();\n } else {\n this.open();\n }\n }\n #resizeObserverCallback() {\n const {\n bar\n } = this;\n bar.classList.remove("wrapContainers");\n const findbarHeight = bar.clientHeight;\n const inputContainerHeight = bar.firstElementChild.clientHeight;\n if (findbarHeight > inputContainerHeight) {\n bar.classList.add("wrapContainers");\n }\n }\n}\n\n;// ./web/pdf_history.js\n\n\n\n\nconst HASH_CHANGE_TIMEOUT = 1000;\nconst POSITION_UPDATED_THRESHOLD = 50;\nconst UPDATE_VIEWAREA_TIMEOUT = 1000;\nfunction getCurrentHash() {\n return document.location.hash;\n}\nclass PDFHistory {\n #eventAbortController = null;\n constructor({\n linkService,\n eventBus\n }) {\n this.linkService = linkService;\n this.eventBus = eventBus;\n this._initialized = false;\n this._fingerprint = "";\n this.reset();\n this.eventBus._on("pagesinit", () => {\n this._isPagesLoaded = false;\n this.eventBus._on("pagesloaded", evt => {\n this._isPagesLoaded = !!evt.pagesCount;\n }, {\n once: true\n });\n });\n }\n initialize({\n fingerprint,\n resetHistory = false,\n updateUrl = false\n }) {\n if (!fingerprint || typeof fingerprint !== "string") {\n console.error(\'PDFHistory.initialize: The "fingerprint" must be a non-empty string.\');\n return;\n }\n if (this._initialized) {\n this.reset();\n }\n const reInitialized = this._fingerprint !== "" && this._fingerprint !== fingerprint;\n this._fingerprint = fingerprint;\n this._updateUrl = updateUrl === true;\n this._initialized = true;\n this.#bindEvents();\n const state = window.history.state;\n this._popStateInProgress = false;\n this._blockHashChange = 0;\n this._currentHash = getCurrentHash();\n this._numPositionUpdates = 0;\n this._uid = this._maxUid = 0;\n this._destination = null;\n this._position = null;\n if (!this.#isValidState(state, true) || resetHistory) {\n const {\n hash,\n page,\n rotation\n } = this.#parseCurrentHash(true);\n if (!hash || reInitialized || resetHistory) {\n this.#pushOrReplaceState(null, true);\n return;\n }\n this.#pushOrReplaceState({\n hash,\n page,\n rotation\n }, true);\n return;\n }\n const destination = state.destination;\n this.#updateInternalState(destination, state.uid, true);\n if (destination.rotation !== undefined) {\n this._initialRotation = destination.rotation;\n }\n if (destination.dest) {\n this._initialBookmark = JSON.stringify(destination.dest);\n this._destination.page = null;\n } else if (destination.hash) {\n this._initialBookmark = destination.hash;\n } else if (destination.page) {\n this._initialBookmark = `page=${destination.page}`;\n }\n }\n reset() {\n if (this._initialized) {\n this.#pageHide();\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 push({\n namedDest = null,\n explicitDest,\n pageNumber\n }) {\n if (!this._initialized) {\n return;\n }\n if (namedDest && typeof namedDest !== "string") {\n console.error("PDFHistory.push: " + `"${namedDest}" is not a valid namedDest parameter.`);\n return;\n } else if (!Array.isArray(explicitDest)) {\n console.error("PDFHistory.push: " + `"${explicitDest}" is not a valid explicitDest parameter.`);\n return;\n } else if (!this.#isValidPage(pageNumber)) {\n if (pageNumber !== null || this._destination) {\n console.error("PDFHistory.push: " + `"${pageNumber}" is not a valid pageNumber parameter.`);\n return;\n }\n }\n const hash = namedDest || JSON.stringify(explicitDest);\n if (!hash) {\n return;\n }\n let forceReplace = false;\n if (this._destination && (isDestHashesEqual(this._destination.hash, hash) || isDestArraysEqual(this._destination.dest, explicitDest))) {\n if (this._destination.page) {\n return;\n }\n forceReplace = true;\n }\n if (this._popStateInProgress && !forceReplace) {\n return;\n }\n this.#pushOrReplaceState({\n dest: explicitDest,\n hash,\n page: pageNumber,\n rotation: this.linkService.rotation\n }, forceReplace);\n if (!this._popStateInProgress) {\n this._popStateInProgress = true;\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n }\n pushPage(pageNumber) {\n if (!this._initialized) {\n return;\n }\n if (!this.#isValidPage(pageNumber)) {\n console.error(`PDFHistory.pushPage: "${pageNumber}" is not a valid page number.`);\n return;\n }\n if (this._destination?.page === pageNumber) {\n return;\n }\n if (this._popStateInProgress) {\n return;\n }\n this.#pushOrReplaceState({\n dest: null,\n hash: `page=${pageNumber}`,\n page: pageNumber,\n rotation: this.linkService.rotation\n });\n if (!this._popStateInProgress) {\n this._popStateInProgress = true;\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n }\n pushCurrentPosition() {\n if (!this._initialized || this._popStateInProgress) {\n return;\n }\n this.#tryPushCurrentPosition();\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 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 get popStateInProgress() {\n return this._initialized && (this._popStateInProgress || this._blockHashChange > 0);\n }\n get initialBookmark() {\n return this._initialized ? this._initialBookmark : null;\n }\n get initialRotation() {\n return this._initialized ? this._initialRotation : null;\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 this.#updateInternalState(destination, newState.uid);\n let newUrl;\n if (this._updateUrl && destination?.hash) {\n const {\n href,\n protocol\n } = document.location;\n if (protocol !== "file:") {\n newUrl = updateUrlHash(href, destination.hash);\n }\n }\n if (shouldReplace) {\n window.history.replaceState(newState, "", newUrl);\n } else {\n window.history.pushState(newState, "", newUrl);\n }\n }\n #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 if (!this._destination) {\n this.#pushOrReplaceState(position);\n return;\n }\n if (this._destination.temporary) {\n this.#pushOrReplaceState(position, true);\n return;\n }\n if (this._destination.hash === position.hash) {\n return;\n }\n if (!this._destination.page && (POSITION_UPDATED_THRESHOLD <= 0 || this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)) {\n return;\n }\n let forceReplace = false;\n if (this._destination.page >= position.first && this._destination.page <= position.page) {\n if (this._destination.dest !== undefined || !this._destination.first) {\n return;\n }\n forceReplace = true;\n }\n this.#pushOrReplaceState(position, forceReplace);\n }\n #isValidPage(val) {\n return Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount;\n }\n #isValidState(state, checkReload = false) {\n if (!state) {\n return false;\n }\n if (state.fingerprint !== this._fingerprint) {\n if (checkReload) {\n if (typeof state.fingerprint !== "string" || state.fingerprint.length !== this._fingerprint.length) {\n return false;\n }\n const [perfEntry] = performance.getEntriesByType("navigation");\n if (perfEntry?.type !== "reload") {\n return false;\n }\n } else {\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 #updateInternalState(destination, uid, removeTemporary = false) {\n if (this._updateViewareaTimeout) {\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n if (removeTemporary && destination?.temporary) {\n delete destination.temporary;\n }\n this._destination = destination;\n this._uid = uid;\n this._maxUid = Math.max(this._maxUid, uid);\n this._numPositionUpdates = 0;\n }\n #parseCurrentHash(checkNameddest = false) {\n const hash = unescape(getCurrentHash()).substring(1);\n const params = parseQueryString(hash);\n const nameddest = params.get("nameddest") || "";\n let page = params.get("page") | 0;\n if (!this.#isValidPage(page) || checkNameddest && nameddest.length > 0) {\n page = null;\n }\n return {\n hash,\n page,\n rotation: this.linkService.rotation\n };\n }\n #updateViewarea({\n location\n }) {\n if (this._updateViewareaTimeout) {\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\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 if (this._popStateInProgress) {\n return;\n }\n if (POSITION_UPDATED_THRESHOLD > 0 && this._isPagesLoaded && this._destination && !this._destination.page) {\n this._numPositionUpdates++;\n }\n if (UPDATE_VIEWAREA_TIMEOUT > 0) {\n this._updateViewareaTimeout = setTimeout(() => {\n if (!this._popStateInProgress) {\n this.#tryPushCurrentPosition(true);\n }\n this._updateViewareaTimeout = null;\n }, UPDATE_VIEWAREA_TIMEOUT);\n }\n }\n #popState({\n state\n }) {\n const newHash = getCurrentHash(),\n hashChanged = this._currentHash !== newHash;\n this._currentHash = newHash;\n if (!state) {\n this._uid++;\n const {\n hash,\n page,\n rotation\n } = this.#parseCurrentHash();\n this.#pushOrReplaceState({\n hash,\n page,\n rotation\n }, true);\n return;\n }\n if (!this.#isValidState(state)) {\n return;\n }\n this._popStateInProgress = true;\n if (hashChanged) {\n this._blockHashChange++;\n waitOnEventOrTimeout({\n target: window,\n name: "hashchange",\n delay: HASH_CHANGE_TIMEOUT\n }).then(() => {\n this._blockHashChange--;\n });\n }\n const destination = state.destination;\n this.#updateInternalState(destination, state.uid, true);\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 this.linkService.page = destination.page;\n }\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n #pageHide() {\n if (!this._destination || this._destination.temporary) {\n this.#tryPushCurrentPosition();\n }\n }\n #bindEvents() {\n if (this.#eventAbortController) {\n return;\n }\n this.#eventAbortController = new AbortController();\n const {\n signal\n } = this.#eventAbortController;\n this.eventBus._on("updateviewarea", this.#updateViewarea.bind(this), {\n signal\n });\n window.addEventListener("popstate", this.#popState.bind(this), {\n signal\n });\n window.addEventListener("pagehide", this.#pageHide.bind(this), {\n signal\n });\n }\n #unbindEvents() {\n this.#eventAbortController?.abort();\n this.#eventAbortController = null;\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}\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 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\n;// ./web/pdf_layer_viewer.js\n\n\n\n\nclass PDFLayerViewer extends BaseTreeViewer {\n constructor(options) {\n super(options);\n this.eventBus._on("optionalcontentconfigchanged", evt => {\n this.#updateLayers(evt.promise);\n });\n this.eventBus._on("resetlayers", () => {\n this.#updateLayers();\n });\n this.eventBus._on("togglelayerstree", this._toggleAllTreeItems.bind(this));\n }\n reset() {\n super.reset();\n this._optionalContentConfig = null;\n this._optionalContentVisibility?.clear();\n this._optionalContentVisibility = null;\n }\n _dispatchEvent(layersCount) {\n this.eventBus.dispatch("layersloaded", {\n source: this,\n layersCount\n });\n }\n _bindLink(element, {\n groupId,\n input\n }) {\n const setVisibility = () => {\n const visible = input.checked;\n this._optionalContentConfig.setVisibility(groupId, visible);\n const cached = this._optionalContentVisibility.get(groupId);\n if (cached) {\n cached.visible = visible;\n }\n this.eventBus.dispatch("optionalcontentconfig", {\n source: this,\n promise: Promise.resolve(this._optionalContentConfig)\n });\n };\n element.onclick = evt => {\n if (evt.target === input) {\n setVisibility();\n return true;\n } else if (evt.target !== element) {\n return true;\n }\n input.checked = !input.checked;\n setVisibility();\n return false;\n };\n }\n _setNestedName(element, {\n name = null\n }) {\n if (typeof name === "string") {\n element.textContent = this._normalizeTextContent(name);\n return;\n }\n element.setAttribute("data-l10n-id", "pdfjs-additional-layers");\n element.style.fontStyle = "italic";\n this._l10n.translateOnce(element);\n }\n _addToggleButton(div, {\n name = null\n }) {\n super._addToggleButton(div, name === null);\n }\n _toggleAllTreeItems() {\n if (!this._optionalContentConfig) {\n return;\n }\n super._toggleAllTreeItems();\n }\n render({\n optionalContentConfig,\n pdfDocument\n }) {\n if (this._optionalContentConfig) {\n this.reset();\n }\n this._optionalContentConfig = optionalContentConfig || null;\n this._pdfDocument = pdfDocument || null;\n const groups = optionalContentConfig?.getOrder();\n if (!groups) {\n this._dispatchEvent(0);\n return;\n }\n this._optionalContentVisibility = new Map();\n const fragment = document.createDocumentFragment(),\n queue = [{\n parent: fragment,\n groups\n }];\n let layersCount = 0,\n hasAnyNesting = false;\n while (queue.length > 0) {\n const levelData = queue.shift();\n for (const groupId of levelData.groups) {\n const div = document.createElement("div");\n div.className = "treeItem";\n const element = document.createElement("a");\n div.append(element);\n if (typeof groupId === "object") {\n hasAnyNesting = true;\n this._addToggleButton(div, groupId);\n this._setNestedName(element, groupId);\n const itemsDiv = document.createElement("div");\n itemsDiv.className = "treeItems";\n div.append(itemsDiv);\n queue.push({\n parent: itemsDiv,\n groups: groupId.order\n });\n } else {\n const group = optionalContentConfig.getGroup(groupId);\n const label = document.createElement("label");\n const input = document.createElement("input");\n label.append(input, document.createTextNode(this._normalizeTextContent(group.name)));\n this._bindLink(element, {\n groupId,\n input\n });\n input.type = "checkbox";\n input.checked = group.visible;\n this._optionalContentVisibility.set(groupId, {\n input,\n visible: input.checked\n });\n element.append(label);\n layersCount++;\n }\n levelData.parent.append(div);\n }\n }\n this._finishRendering(fragment, layersCount, hasAnyNesting);\n }\n async #updateLayers(promise = null) {\n if (!this._optionalContentConfig) {\n return;\n }\n const pdfDocument = this._pdfDocument;\n const optionalContentConfig = await (promise || pdfDocument.getOptionalContentConfig({\n intent: "display"\n }));\n if (pdfDocument !== this._pdfDocument) {\n return;\n }\n if (promise) {\n for (const [groupId, cached] of this._optionalContentVisibility) {\n const group = optionalContentConfig.getGroup(groupId);\n if (group && cached.visible !== group.visible) {\n cached.input.checked = cached.visible = !cached.visible;\n }\n }\n return;\n }\n this.eventBus.dispatch("optionalcontentconfig", {\n source: this,\n promise: Promise.resolve(optionalContentConfig)\n });\n this.render({\n optionalContentConfig,\n pdfDocument: this._pdfDocument\n });\n }\n}\n\n;// ./web/pdf_outline_viewer.js\n\n\n\n\n\n\nclass PDFOutlineViewer extends BaseTreeViewer {\n constructor(options) {\n super(options);\n this.linkService = options.linkService;\n this.downloadManager = options.downloadManager;\n this.eventBus._on("toggleoutlinetree", this._toggleAllTreeItems.bind(this));\n this.eventBus._on("currentoutlineitem", this._currentOutlineItem.bind(this));\n this.eventBus._on("pagechanging", evt => {\n this._currentPageNumber = evt.pageNumber;\n });\n this.eventBus._on("pagesloaded", evt => {\n this._isPagesLoaded = !!evt.pagesCount;\n this._currentOutlineItemCapability?.resolve(this._isPagesLoaded);\n });\n this.eventBus._on("sidebarviewchanged", evt => {\n this._sidebarView = evt.view;\n });\n }\n reset() {\n super.reset();\n this._outline = null;\n this._pageNumberToDestHashCapability = null;\n this._currentPageNumber = 1;\n this._isPagesLoaded = null;\n this._currentOutlineItemCapability?.resolve(false);\n this._currentOutlineItemCapability = null;\n }\n _dispatchEvent(outlineCount) {\n this._currentOutlineItemCapability = Promise.withResolvers();\n if (outlineCount === 0 || this._pdfDocument?.loadingParams.disableAutoFetch) {\n this._currentOutlineItemCapability.resolve(false);\n } else if (this._isPagesLoaded !== null) {\n this._currentOutlineItemCapability.resolve(this._isPagesLoaded);\n }\n this.eventBus.dispatch("outlineloaded", {\n source: this,\n outlineCount,\n currentOutlineItemPromise: this._currentOutlineItemCapability.promise\n });\n }\n _bindLink(element, {\n url,\n newWindow,\n action,\n attachment,\n dest,\n setOCGState\n }) {\n const {\n linkService\n } = this;\n if (url) {\n linkService.addLinkAttributes(element, url, newWindow);\n return;\n }\n if (action) {\n element.href = linkService.getAnchorUrl("");\n element.onclick = () => {\n linkService.executeNamedAction(action);\n return false;\n };\n return;\n }\n if (attachment) {\n element.href = linkService.getAnchorUrl("");\n element.onclick = () => {\n this.downloadManager.openOrDownloadData(attachment.content, attachment.filename);\n return false;\n };\n return;\n }\n if (setOCGState) {\n element.href = linkService.getAnchorUrl("");\n element.onclick = () => {\n linkService.executeSetOCGState(setOCGState);\n return false;\n };\n return;\n }\n element.href = linkService.getDestinationHash(dest);\n element.onclick = evt => {\n this._updateCurrentTreeItem(evt.target.parentNode);\n if (dest) {\n linkService.goToDestination(dest);\n }\n return false;\n };\n }\n _setStyles(element, {\n bold,\n italic\n }) {\n if (bold) {\n element.style.fontWeight = "bold";\n }\n if (italic) {\n element.style.fontStyle = "italic";\n }\n }\n _addToggleButton(div, {\n count,\n items\n }) {\n let hidden = false;\n if (count < 0) {\n let totalCount = items.length;\n if (totalCount > 0) {\n const queue = [...items];\n while (queue.length > 0) {\n const {\n count: nestedCount,\n items: nestedItems\n } = queue.shift();\n if (nestedCount > 0 && nestedItems.length > 0) {\n totalCount += nestedItems.length;\n queue.push(...nestedItems);\n }\n }\n }\n if (Math.abs(count) === totalCount) {\n hidden = true;\n }\n }\n super._addToggleButton(div, hidden);\n }\n _toggleAllTreeItems() {\n if (!this._outline) {\n return;\n }\n super._toggleAllTreeItems();\n }\n render({\n outline,\n pdfDocument\n }) {\n if (this._outline) {\n this.reset();\n }\n this._outline = outline || null;\n this._pdfDocument = pdfDocument || null;\n if (!outline) {\n this._dispatchEvent(0);\n return;\n }\n const fragment = document.createDocumentFragment();\n const queue = [{\n parent: fragment,\n items: outline\n }];\n let outlineCount = 0,\n hasAnyNesting = false;\n while (queue.length > 0) {\n const levelData = queue.shift();\n for (const item of levelData.items) {\n const div = document.createElement("div");\n div.className = "treeItem";\n const element = document.createElement("a");\n this._bindLink(element, item);\n this._setStyles(element, item);\n element.textContent = this._normalizeTextContent(item.title);\n div.append(element);\n if (item.items.length > 0) {\n hasAnyNesting = true;\n this._addToggleButton(div, item);\n const itemsDiv = document.createElement("div");\n itemsDiv.className = "treeItems";\n div.append(itemsDiv);\n queue.push({\n parent: itemsDiv,\n items: item.items\n });\n }\n levelData.parent.append(div);\n outlineCount++;\n }\n }\n this._finishRendering(fragment, outlineCount, hasAnyNesting);\n }\n async _currentOutlineItem() {\n if (!this._isPagesLoaded) {\n throw new Error("_currentOutlineItem: All pages have not been loaded.");\n }\n if (!this._outline || !this._pdfDocument) {\n return;\n }\n const pageNumberToDestHash = await this._getPageNumberToDestHash(this._pdfDocument);\n if (!pageNumberToDestHash) {\n return;\n }\n this._updateCurrentTreeItem(null);\n if (this._sidebarView !== SidebarView.OUTLINE) {\n return;\n }\n for (let i = this._currentPageNumber; i > 0; i--) {\n const destHash = pageNumberToDestHash.get(i);\n if (!destHash) {\n continue;\n }\n const linkElement = this.container.querySelector(`a[href="${destHash}"]`);\n if (!linkElement) {\n continue;\n }\n this._scrollToCurrentTreeItem(linkElement.parentNode);\n break;\n }\n }\n async _getPageNumberToDestHash(pdfDocument) {\n if (this._pageNumberToDestHashCapability) {\n return this._pageNumberToDestHashCapability.promise;\n }\n this._pageNumberToDestHashCapability = Promise.withResolvers();\n const pageNumberToDestHash = new Map(),\n pageNumberNesting = new Map();\n const queue = [{\n nesting: 0,\n items: this._outline\n }];\n while (queue.length > 0) {\n const levelData = queue.shift(),\n currentNesting = levelData.nesting;\n for (const {\n dest,\n items\n } of levelData.items) {\n let explicitDest, pageNumber;\n if (typeof dest === "string") {\n explicitDest = await pdfDocument.getDestination(dest);\n if (pdfDocument !== this._pdfDocument) {\n return null;\n }\n } else {\n explicitDest = dest;\n }\n if (Array.isArray(explicitDest)) {\n const [destRef] = explicitDest;\n if (destRef && typeof destRef === "object") {\n pageNumber = pdfDocument.cachedPageNumber(destRef);\n } else if (Number.isInteger(destRef)) {\n pageNumber = destRef + 1;\n }\n if (Number.isInteger(pageNumber) && (!pageNumberToDestHash.has(pageNumber) || currentNesting > pageNumberNesting.get(pageNumber))) {\n const destHash = this.linkService.getDestinationHash(dest);\n pageNumberToDestHash.set(pageNumber, destHash);\n pageNumberNesting.set(pageNumber, currentNesting);\n }\n }\n if (items.length > 0) {\n queue.push({\n nesting: currentNesting + 1,\n items\n });\n }\n }\n }\n this._pageNumberToDestHashCapability.resolve(pageNumberToDestHash.size > 0 ? pageNumberToDestHash : null);\n return this._pageNumberToDestHashCapability.promise;\n }\n}\n\n;// ./web/pdf_presentation_mode.js\n\n\nconst DELAY_BEFORE_HIDING_CONTROLS = 3000;\nconst ACTIVE_SELECTOR = "pdfPresentationMode";\nconst CONTROLS_SELECTOR = "pdfPresentationModeControls";\nconst MOUSE_SCROLL_COOLDOWN_TIME = 50;\nconst PAGE_SWITCH_THRESHOLD = 0.1;\nconst SWIPE_MIN_DISTANCE_THRESHOLD = 50;\nconst SWIPE_ANGLE_THRESHOLD = Math.PI / 6;\nclass PDFPresentationMode {\n #state = PresentationModeState.UNKNOWN;\n #args = null;\n #fullscreenChangeAbortController = null;\n #windowAbortController = null;\n constructor({\n container,\n pdfViewer,\n eventBus\n }) {\n this.container = container;\n this.pdfViewer = pdfViewer;\n this.eventBus = eventBus;\n this.contextMenuOpen = false;\n this.mouseScrollTimeStamp = 0;\n this.mouseScrollDelta = 0;\n this.touchSwipeState = null;\n }\n async request() {\n const {\n container,\n pdfViewer\n } = this;\n if (this.active || !pdfViewer.pagesCount || !container.requestFullscreen) {\n return false;\n }\n this.#addFullscreenChangeListeners();\n this.#notifyStateChange(PresentationModeState.CHANGING);\n const promise = container.requestFullscreen();\n this.#args = {\n pageNumber: pdfViewer.currentPageNumber,\n scaleValue: pdfViewer.currentScaleValue,\n scrollMode: pdfViewer.scrollMode,\n spreadMode: null,\n annotationEditorMode: null\n };\n if (pdfViewer.spreadMode !== SpreadMode.NONE && !(pdfViewer.pageViewsReady && pdfViewer.hasEqualPageSizes)) {\n console.warn("Ignoring Spread modes when entering PresentationMode, " + "since the document may contain varying page sizes.");\n this.#args.spreadMode = pdfViewer.spreadMode;\n }\n if (pdfViewer.annotationEditorMode !== AnnotationEditorType.DISABLE) {\n this.#args.annotationEditorMode = pdfViewer.annotationEditorMode;\n }\n try {\n await promise;\n pdfViewer.focus();\n return true;\n } catch {\n this.#removeFullscreenChangeListeners();\n this.#notifyStateChange(PresentationModeState.NORMAL);\n }\n return false;\n }\n get active() {\n return this.#state === PresentationModeState.CHANGING || this.#state === PresentationModeState.FULLSCREEN;\n }\n #mouseWheel(evt) {\n if (!this.active) {\n return;\n }\n evt.preventDefault();\n const delta = normalizeWheelEventDelta(evt);\n const currentTime = Date.now();\n const storedTime = this.mouseScrollTimeStamp;\n if (currentTime > storedTime && currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME) {\n return;\n }\n if (this.mouseScrollDelta > 0 && delta < 0 || this.mouseScrollDelta < 0 && delta > 0) {\n this.#resetMouseScrollState();\n }\n this.mouseScrollDelta += delta;\n if (Math.abs(this.mouseScrollDelta) >= PAGE_SWITCH_THRESHOLD) {\n const totalDelta = this.mouseScrollDelta;\n this.#resetMouseScrollState();\n const success = totalDelta > 0 ? this.pdfViewer.previousPage() : this.pdfViewer.nextPage();\n if (success) {\n this.mouseScrollTimeStamp = currentTime;\n }\n }\n }\n #notifyStateChange(state) {\n this.#state = state;\n this.eventBus.dispatch("presentationmodechanged", {\n source: this,\n state\n });\n }\n #enter() {\n this.#notifyStateChange(PresentationModeState.FULLSCREEN);\n this.container.classList.add(ACTIVE_SELECTOR);\n setTimeout(() => {\n this.pdfViewer.scrollMode = ScrollMode.PAGE;\n if (this.#args.spreadMode !== null) {\n this.pdfViewer.spreadMode = SpreadMode.NONE;\n }\n this.pdfViewer.currentPageNumber = this.#args.pageNumber;\n this.pdfViewer.currentScaleValue = "page-fit";\n if (this.#args.annotationEditorMode !== null) {\n this.pdfViewer.annotationEditorMode = {\n mode: AnnotationEditorType.NONE\n };\n }\n }, 0);\n this.#addWindowListeners();\n this.#showControls();\n this.contextMenuOpen = false;\n document.getSelection().empty();\n }\n #exit() {\n const pageNumber = this.pdfViewer.currentPageNumber;\n this.container.classList.remove(ACTIVE_SELECTOR);\n setTimeout(() => {\n this.#removeFullscreenChangeListeners();\n this.#notifyStateChange(PresentationModeState.NORMAL);\n this.pdfViewer.scrollMode = this.#args.scrollMode;\n if (this.#args.spreadMode !== null) {\n this.pdfViewer.spreadMode = this.#args.spreadMode;\n }\n this.pdfViewer.currentScaleValue = this.#args.scaleValue;\n this.pdfViewer.currentPageNumber = pageNumber;\n if (this.#args.annotationEditorMode !== null) {\n this.pdfViewer.annotationEditorMode = {\n mode: this.#args.annotationEditorMode\n };\n }\n this.#args = null;\n }, 0);\n this.#removeWindowListeners();\n this.#hideControls();\n this.#resetMouseScrollState();\n this.contextMenuOpen = false;\n }\n #mouseDown(evt) {\n if (this.contextMenuOpen) {\n this.contextMenuOpen = false;\n evt.preventDefault();\n return;\n }\n if (evt.button !== 0) {\n return;\n }\n if (evt.target.href && evt.target.parentNode?.hasAttribute("data-internal-link")) {\n return;\n }\n evt.preventDefault();\n if (evt.shiftKey) {\n this.pdfViewer.previousPage();\n } else {\n this.pdfViewer.nextPage();\n }\n }\n #contextMenu() {\n this.contextMenuOpen = true;\n }\n #showControls() {\n if (this.controlsTimeout) {\n clearTimeout(this.controlsTimeout);\n } else {\n this.container.classList.add(CONTROLS_SELECTOR);\n }\n this.controlsTimeout = setTimeout(() => {\n this.container.classList.remove(CONTROLS_SELECTOR);\n delete this.controlsTimeout;\n }, DELAY_BEFORE_HIDING_CONTROLS);\n }\n #hideControls() {\n if (!this.controlsTimeout) {\n return;\n }\n clearTimeout(this.controlsTimeout);\n this.container.classList.remove(CONTROLS_SELECTOR);\n delete this.controlsTimeout;\n }\n #resetMouseScrollState() {\n this.mouseScrollTimeStamp = 0;\n this.mouseScrollDelta = 0;\n }\n #touchSwipe(evt) {\n if (!this.active) {\n return;\n }\n if (evt.touches.length > 1) {\n this.touchSwipeState = null;\n return;\n }\n switch (evt.type) {\n case "touchstart":\n this.touchSwipeState = {\n startX: evt.touches[0].pageX,\n startY: evt.touches[0].pageY,\n endX: evt.touches[0].pageX,\n endY: evt.touches[0].pageY\n };\n break;\n case "touchmove":\n if (this.touchSwipeState === null) {\n return;\n }\n this.touchSwipeState.endX = evt.touches[0].pageX;\n this.touchSwipeState.endY = evt.touches[0].pageY;\n evt.preventDefault();\n break;\n case "touchend":\n if (this.touchSwipeState === null) {\n return;\n }\n let delta = 0;\n const dx = this.touchSwipeState.endX - this.touchSwipeState.startX;\n const dy = this.touchSwipeState.endY - this.touchSwipeState.startY;\n const absAngle = Math.abs(Math.atan2(dy, dx));\n if (Math.abs(dx) > SWIPE_MIN_DISTANCE_THRESHOLD && (absAngle <= SWIPE_ANGLE_THRESHOLD || absAngle >= Math.PI - SWIPE_ANGLE_THRESHOLD)) {\n delta = dx;\n } else if (Math.abs(dy) > SWIPE_MIN_DISTANCE_THRESHOLD && Math.abs(absAngle - Math.PI / 2) <= SWIPE_ANGLE_THRESHOLD) {\n delta = dy;\n }\n if (delta > 0) {\n this.pdfViewer.previousPage();\n } else if (delta < 0) {\n this.pdfViewer.nextPage();\n }\n break;\n }\n }\n #addWindowListeners() {\n if (this.#windowAbortController) {\n return;\n }\n this.#windowAbortController = new AbortController();\n const {\n signal\n } = this.#windowAbortController;\n const touchSwipeBind = this.#touchSwipe.bind(this);\n window.addEventListener("mousemove", this.#showControls.bind(this), {\n signal\n });\n window.addEventListener("mousedown", this.#mouseDown.bind(this), {\n signal\n });\n window.addEventListener("wheel", this.#mouseWheel.bind(this), {\n passive: false,\n signal\n });\n window.addEventListener("keydown", this.#resetMouseScrollState.bind(this), {\n signal\n });\n window.addEventListener("contextmenu", this.#contextMenu.bind(this), {\n signal\n });\n window.addEventListener("touchstart", touchSwipeBind, {\n signal\n });\n window.addEventListener("touchmove", touchSwipeBind, {\n signal\n });\n window.addEventListener("touchend", touchSwipeBind, {\n signal\n });\n }\n #removeWindowListeners() {\n this.#windowAbortController?.abort();\n this.#windowAbortController = null;\n }\n #addFullscreenChangeListeners() {\n if (this.#fullscreenChangeAbortController) {\n return;\n }\n this.#fullscreenChangeAbortController = new AbortController();\n window.addEventListener("fullscreenchange", () => {\n if (document.fullscreenElement) {\n this.#enter();\n } else {\n this.#exit();\n }\n }, {\n signal: this.#fullscreenChangeAbortController.signal\n });\n }\n #removeFullscreenChangeListeners() {\n this.#fullscreenChangeAbortController?.abort();\n this.#fullscreenChangeAbortController = null;\n }\n}\n\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.every.js\nvar es_iterator_every = __webpack_require__(1148);\n;// ./web/xfa_layer_builder.js\n\nclass XfaLayerBuilder {\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 this.div = null;\n this._cancelled = false;\n }\n async render({\n viewport,\n intent = "display"\n }) {\n if (intent === "print") {\n const parameters = {\n viewport: viewport.clone({\n dontFlip: true\n }),\n div: this.div,\n xfaHtml: this.xfaHtml,\n annotationStorage: this.annotationStorage,\n linkService: this.linkService,\n intent\n };\n this.div = document.createElement("div");\n parameters.div = this.div;\n return XfaLayer.render(parameters);\n }\n const xfaHtml = await this.pdfPage.getXfa();\n if (this._cancelled || !xfaHtml) {\n return {\n textDivs: []\n };\n }\n const parameters = {\n viewport: viewport.clone({\n dontFlip: true\n }),\n div: this.div,\n xfaHtml,\n annotationStorage: this.annotationStorage,\n linkService: this.linkService,\n intent\n };\n if (this.div) {\n return XfaLayer.update(parameters);\n }\n this.div = document.createElement("div");\n parameters.div = this.div;\n return XfaLayer.render(parameters);\n }\n cancel() {\n this._cancelled = true;\n }\n hide() {\n if (!this.div) {\n return;\n }\n this.div.hidden = true;\n }\n}\n\n;// ./web/print_utils.js\n\n\n\nclass BasePrintServiceFactory {\n static initGlobals(app) {}\n static get supportsPrinting() {\n throw new Error("Not implemented: supportsPrinting");\n }\n static createPrintService(params) {\n throw new Error("Not implemented: createPrintService");\n }\n}\nfunction getXfaHtmlForPrinting(printContainer, pdfDocument) {\n const xfaHtml = pdfDocument.allXfaHtml;\n const linkService = new SimpleLinkService();\n const scale = Math.round(PixelsPerInch.PDF_TO_CSS_UNITS * 100) / 100;\n for (const xfaPage of xfaHtml.children) {\n const page = document.createElement("div");\n page.className = "xfaPrintedPage";\n printContainer.append(page);\n const builder = new XfaLayerBuilder({\n pdfPage: null,\n annotationStorage: pdfDocument.annotationStorage,\n linkService,\n xfaHtml: xfaPage\n });\n const viewport = getXfaPageViewport(xfaPage, {\n scale\n });\n builder.render({\n viewport,\n intent: "print"\n });\n page.append(builder.div);\n }\n}\n\n;// ./web/pdf_print_service.js\n\n\n\n\n\n\n\n\n\nlet activeService = null;\nlet dialog = null;\nlet overlayManager = null;\nlet viewerApp = {\n initialized: false\n};\nfunction renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size, printResolution, optionalContentConfigPromise, printAnnotationStoragePromise) {\n const scratchCanvas = activeService.scratchCanvas;\n const PRINT_UNITS = printResolution / PixelsPerInch.PDF;\n scratchCanvas.width = Math.floor(size.width * PRINT_UNITS);\n scratchCanvas.height = Math.floor(size.height * PRINT_UNITS);\n const ctx = scratchCanvas.getContext("2d");\n ctx.save();\n ctx.fillStyle = "rgb(255, 255, 255)";\n ctx.fillRect(0, 0, scratchCanvas.width, scratchCanvas.height);\n ctx.restore();\n return Promise.all([pdfDocument.getPage(pageNumber), printAnnotationStoragePromise]).then(function ([pdfPage, printAnnotationStorage]) {\n const renderContext = {\n canvas: scratchCanvas,\n transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],\n viewport: pdfPage.getViewport({\n scale: 1,\n rotation: size.rotation\n }),\n intent: "print",\n annotationMode: AnnotationMode.ENABLE_STORAGE,\n optionalContentConfigPromise,\n printAnnotationStorage\n };\n const renderTask = pdfPage.render(renderContext);\n return renderTask.promise.catch(reason => {\n if (!(reason instanceof RenderingCancelledException)) {\n console.error(reason);\n }\n throw reason;\n });\n });\n}\nclass PDFPrintService {\n constructor({\n pdfDocument,\n pagesOverview,\n printContainer,\n printResolution,\n printAnnotationStoragePromise = null\n }) {\n this.pdfDocument = pdfDocument;\n this.pagesOverview = pagesOverview;\n this.printContainer = printContainer;\n this._printResolution = printResolution || 150;\n this._optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({\n intent: "print"\n });\n this._printAnnotationStoragePromise = printAnnotationStoragePromise || Promise.resolve();\n this.currentPage = -1;\n this.scratchCanvas = document.createElement("canvas");\n }\n layout() {\n this.throwIfInactive();\n const body = document.querySelector("body");\n body.setAttribute("data-pdfjsprinting", true);\n const {\n width,\n height\n } = this.pagesOverview[0];\n const hasEqualPageSizes = this.pagesOverview.every(size => size.width === width && size.height === height);\n if (!hasEqualPageSizes) {\n console.warn("Not all pages have the same size. The printed result may be incorrect!");\n }\n this.pageStyleSheet = document.createElement("style");\n this.pageStyleSheet.textContent = `@page { size: ${width}pt ${height}pt;}`;\n body.append(this.pageStyleSheet);\n }\n destroy() {\n if (activeService !== this) {\n return;\n }\n this.printContainer.textContent = "";\n const body = document.querySelector("body");\n body.removeAttribute("data-pdfjsprinting");\n if (this.pageStyleSheet) {\n this.pageStyleSheet.remove();\n this.pageStyleSheet = null;\n }\n this.scratchCanvas.width = this.scratchCanvas.height = 0;\n this.scratchCanvas = null;\n activeService = null;\n ensureOverlay().then(function () {\n overlayManager.closeIfActive(dialog);\n });\n }\n renderPages() {\n if (this.pdfDocument.isPureXfa) {\n getXfaHtmlForPrinting(this.printContainer, this.pdfDocument);\n return Promise.resolve();\n }\n const pageCount = this.pagesOverview.length;\n const renderNextPage = (resolve, reject) => {\n this.throwIfInactive();\n if (++this.currentPage >= pageCount) {\n renderProgress(pageCount, pageCount);\n resolve();\n return;\n }\n const index = this.currentPage;\n renderProgress(index, pageCount);\n renderPage(this, this.pdfDocument, index + 1, this.pagesOverview[index], this._printResolution, this._optionalContentConfigPromise, this._printAnnotationStoragePromise).then(this.useRenderedPage.bind(this)).then(function () {\n renderNextPage(resolve, reject);\n }, reject);\n };\n return new Promise(renderNextPage);\n }\n useRenderedPage() {\n this.throwIfInactive();\n const img = document.createElement("img");\n this.scratchCanvas.toBlob(blob => {\n img.src = URL.createObjectURL(blob);\n });\n const wrapper = document.createElement("div");\n wrapper.className = "printedPage";\n wrapper.append(img);\n this.printContainer.append(wrapper);\n const {\n promise,\n resolve,\n reject\n } = Promise.withResolvers();\n img.onload = resolve;\n img.onerror = reject;\n promise.catch(() => {}).then(() => {\n URL.revokeObjectURL(img.src);\n });\n return promise;\n }\n performPrint() {\n this.throwIfInactive();\n return new Promise(resolve => {\n setTimeout(() => {\n if (!this.active) {\n resolve();\n return;\n }\n print.call(window);\n setTimeout(resolve, 20);\n }, 0);\n });\n }\n get active() {\n return this === activeService;\n }\n throwIfInactive() {\n if (!this.active) {\n throw new Error("This print request was cancelled or completed.");\n }\n }\n}\nconst print = window.print;\nwindow.print = function () {\n if (activeService) {\n console.warn("Ignored window.print() because of a pending print job.");\n return;\n }\n ensureOverlay().then(function () {\n if (activeService) {\n overlayManager.open(dialog);\n }\n });\n try {\n dispatchEvent("beforeprint");\n } finally {\n if (!activeService) {\n console.error("Expected print service to be initialized.");\n ensureOverlay().then(function () {\n overlayManager.closeIfActive(dialog);\n });\n } else {\n const activeServiceOnEntry = activeService;\n activeService.renderPages().then(() => activeServiceOnEntry.performPrint()).catch(() => {}).then(() => {\n if (activeServiceOnEntry.active) {\n abort();\n }\n });\n }\n }\n};\nfunction dispatchEvent(eventType) {\n const event = new CustomEvent(eventType, {\n bubbles: false,\n cancelable: false,\n detail: "custom"\n });\n window.dispatchEvent(event);\n}\nfunction abort() {\n if (activeService) {\n activeService.destroy();\n dispatchEvent("afterprint");\n }\n}\nfunction renderProgress(index, total) {\n dialog ||= document.getElementById("printServiceDialog");\n const progress = Math.round(100 * index / total);\n const progressBar = dialog.querySelector("progress");\n const progressPerc = dialog.querySelector(".relative-progress");\n progressBar.value = progress;\n progressPerc.setAttribute("data-l10n-args", JSON.stringify({\n progress\n }));\n}\nwindow.addEventListener("keydown", function (event) {\n if (event.keyCode === 80 && (event.ctrlKey || event.metaKey) && !event.altKey && (!event.shiftKey || window.chrome || window.opera)) {\n window.print();\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n}, true);\nif ("onbeforeprint" in window) {\n const stopPropagationIfNeeded = function (event) {\n if (event.detail !== "custom") {\n event.stopImmediatePropagation();\n }\n };\n window.addEventListener("beforeprint", stopPropagationIfNeeded);\n window.addEventListener("afterprint", stopPropagationIfNeeded);\n}\nlet overlayPromise;\nfunction ensureOverlay() {\n if (!overlayPromise) {\n overlayManager = viewerApp.overlayManager;\n if (!overlayManager) {\n throw new Error("The overlay manager has not yet been initialized.");\n }\n dialog ||= document.getElementById("printServiceDialog");\n overlayPromise = overlayManager.register(dialog, true);\n document.getElementById("printCancel").onclick = abort;\n dialog.addEventListener("close", abort);\n }\n return overlayPromise;\n}\nclass PDFPrintServiceFactory extends BasePrintServiceFactory {\n static initGlobals(app) {\n viewerApp = app;\n }\n static get supportsPrinting() {\n return shadow(this, "supportsPrinting", true);\n }\n static createPrintService(params) {\n if (activeService) {\n throw new Error("The print service is created and active.");\n }\n return activeService = new PDFPrintService(params);\n }\n}\n\n;// ./web/renderable_view.js\nconst RenderingStates = {\n INITIAL: 0,\n RUNNING: 1,\n PAUSED: 2,\n FINISHED: 3\n};\nclass RenderableView {\n renderingId = "";\n renderTask = null;\n resume = null;\n get renderingState() {\n throw new Error("Abstract getter `renderingState` accessed");\n }\n set renderingState(state) {\n throw new Error("Abstract setter `renderingState` accessed");\n }\n async draw() {\n throw new Error("Not implemented: draw");\n }\n}\n\n;// ./web/pdf_rendering_queue.js\n\n\nconst CLEANUP_TIMEOUT = 30000;\nclass PDFRenderingQueue {\n #highestPriorityPage = null;\n #idleTimeout = null;\n #pdfThumbnailViewer = null;\n #pdfViewer = null;\n isThumbnailViewEnabled = false;\n onIdle = null;\n printing = false;\n constructor() {\n Object.defineProperty(this, "hasViewer", {\n value: () => !!this.#pdfViewer\n });\n }\n setViewer(pdfViewer) {\n this.#pdfViewer = pdfViewer;\n }\n setThumbnailViewer(pdfThumbnailViewer) {\n this.#pdfThumbnailViewer = pdfThumbnailViewer;\n }\n isHighestPriority(view) {\n return this.#highestPriorityPage === view.renderingId;\n }\n renderHighestPriority(currentlyVisiblePages) {\n if (this.#idleTimeout) {\n clearTimeout(this.#idleTimeout);\n this.#idleTimeout = null;\n }\n if (this.#pdfViewer.forceRendering(currentlyVisiblePages)) {\n return;\n }\n if (this.isThumbnailViewEnabled && this.#pdfThumbnailViewer?.forceRendering()) {\n return;\n }\n if (this.printing) {\n return;\n }\n if (this.onIdle) {\n this.#idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);\n }\n }\n getHighestPriority(visible, views, scrolledDown, preRenderExtra = false, ignoreDetailViews = false) {\n const visibleViews = visible.views,\n numVisible = visibleViews.length;\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 if (!ignoreDetailViews) {\n for (let i = 0; i < numVisible; i++) {\n const {\n detailView\n } = visibleViews[i].view;\n if (detailView && !this.isViewFinished(detailView)) {\n return detailView;\n }\n }\n }\n const firstId = visible.first.id,\n lastId = visible.last.id;\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 let preRenderIndex = scrolledDown ? lastId : firstId - 2;\n let preRenderView = views[preRenderIndex];\n if (preRenderView && !this.isViewFinished(preRenderView)) {\n return preRenderView;\n }\n if (preRenderExtra) {\n preRenderIndex += scrolledDown ? 1 : -1;\n preRenderView = views[preRenderIndex];\n if (preRenderView && !this.isViewFinished(preRenderView)) {\n return preRenderView;\n }\n }\n return null;\n }\n isViewFinished(view) {\n return view.renderingState === RenderingStates.FINISHED;\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.draw().finally(() => {\n this.renderHighestPriority();\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\n;// ./web/pdf_scripting_manager.js\n\n\n\n\n\n\n\n\n\n\n\n\n\nclass PDFScriptingManager {\n #closeCapability = null;\n #destroyCapability = null;\n #docProperties = null;\n #eventAbortController = null;\n #eventBus = null;\n #externalServices = null;\n #pdfDocument = null;\n #pdfViewer = null;\n #ready = false;\n #scripting = null;\n #willPrintCapability = null;\n constructor({\n eventBus,\n externalServices = null,\n docProperties = null\n }) {\n this.#eventBus = eventBus;\n this.#externalServices = externalServices;\n this.#docProperties = docProperties;\n }\n setViewer(pdfViewer) {\n this.#pdfViewer = pdfViewer;\n }\n async setDocument(pdfDocument) {\n if (this.#pdfDocument) {\n await this.#destroyScripting();\n }\n this.#pdfDocument = pdfDocument;\n if (!pdfDocument) {\n return;\n }\n const [objects, calculationOrder, docActions] = await Promise.all([pdfDocument.getFieldObjects(), pdfDocument.getCalculationOrderIds(), pdfDocument.getJSActions()]);\n if (!objects && !docActions) {\n await this.#destroyScripting();\n return;\n }\n if (pdfDocument !== this.#pdfDocument) {\n return;\n }\n try {\n this.#scripting = this.#initScripting();\n } catch (error) {\n console.error("setDocument:", error);\n await this.#destroyScripting();\n return;\n }\n const eventBus = this.#eventBus;\n this.#eventAbortController = new AbortController();\n const {\n signal\n } = this.#eventAbortController;\n eventBus._on("updatefromsandbox", event => {\n if (event?.source === window) {\n this.#updateFromSandbox(event.detail);\n }\n }, {\n signal\n });\n eventBus._on("dispatcheventinsandbox", event => {\n this.#scripting?.dispatchEventInSandbox(event.detail);\n }, {\n signal\n });\n eventBus._on("pagechanging", ({\n pageNumber,\n previous\n }) => {\n if (pageNumber === previous) {\n return;\n }\n this.#dispatchPageClose(previous);\n this.#dispatchPageOpen(pageNumber);\n }, {\n signal\n });\n eventBus._on("pagerendered", ({\n pageNumber\n }) => {\n if (!this._pageOpenPending.has(pageNumber)) {\n return;\n }\n if (pageNumber !== this.#pdfViewer.currentPageNumber) {\n return;\n }\n this.#dispatchPageOpen(pageNumber);\n }, {\n signal\n });\n eventBus._on("pagesdestroy", async () => {\n await this.#dispatchPageClose(this.#pdfViewer.currentPageNumber);\n await this.#scripting?.dispatchEventInSandbox({\n id: "doc",\n name: "WillClose"\n });\n this.#closeCapability?.resolve();\n }, {\n signal\n });\n try {\n const docProperties = await this.#docProperties(pdfDocument);\n if (pdfDocument !== this.#pdfDocument) {\n return;\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 eventBus.dispatch("sandboxcreated", {\n source: this\n });\n } catch (error) {\n console.error("setDocument:", error);\n await this.#destroyScripting();\n return;\n }\n await this.#scripting?.dispatchEventInSandbox({\n id: "doc",\n name: "Open"\n });\n await this.#dispatchPageOpen(this.#pdfViewer.currentPageNumber, true);\n Promise.resolve().then(() => {\n if (pdfDocument === this.#pdfDocument) {\n this.#ready = true;\n }\n });\n }\n async dispatchWillSave() {\n return this.#scripting?.dispatchEventInSandbox({\n id: "doc",\n name: "WillSave"\n });\n }\n async dispatchDidSave() {\n return this.#scripting?.dispatchEventInSandbox({\n id: "doc",\n name: "DidSave"\n });\n }\n async dispatchWillPrint() {\n if (!this.#scripting) {\n return;\n }\n await this.#willPrintCapability?.promise;\n this.#willPrintCapability = Promise.withResolvers();\n try {\n await this.#scripting.dispatchEventInSandbox({\n id: "doc",\n name: "WillPrint"\n });\n } catch (ex) {\n this.#willPrintCapability.resolve();\n this.#willPrintCapability = null;\n throw ex;\n }\n await this.#willPrintCapability.promise;\n }\n async dispatchDidPrint() {\n return this.#scripting?.dispatchEventInSandbox({\n id: "doc",\n name: "DidPrint"\n });\n }\n get destroyPromise() {\n return this.#destroyCapability?.promise || null;\n }\n get ready() {\n return this.#ready;\n }\n get _pageOpenPending() {\n return shadow(this, "_pageOpenPending", new Set());\n }\n get _visitedPages() {\n return shadow(this, "_visitedPages", new Map());\n }\n async #updateFromSandbox(detail) {\n const pdfViewer = this.#pdfViewer;\n const isInPresentationMode = pdfViewer.isInPresentationMode || pdfViewer.isChangingPresentationMode;\n const {\n id,\n siblings,\n command,\n value\n } = 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", {\n source: this\n });\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", {\n source: this\n });\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 if (isInPresentationMode && detail.focus) {\n return;\n }\n delete detail.id;\n delete detail.siblings;\n const ids = siblings ? [id, ...siblings] : [id];\n for (const elementId of ids) {\n const element = document.querySelector(`[data-element-id="${elementId}"]`);\n if (element) {\n element.dispatchEvent(new CustomEvent("updatefromsandbox", {\n detail\n }));\n } else {\n this.#pdfDocument?.annotationStorage.setValue(elementId, detail);\n }\n }\n }\n async #dispatchPageOpen(pageNumber, initialize = false) {\n const pdfDocument = this.#pdfDocument,\n visitedPages = this._visitedPages;\n if (initialize) {\n this.#closeCapability = Promise.withResolvers();\n }\n if (!this.#closeCapability) {\n return;\n }\n const pageView = this.#pdfViewer.getPageView(pageNumber - 1);\n if (pageView?.renderingState !== RenderingStates.FINISHED) {\n this._pageOpenPending.add(pageNumber);\n return;\n }\n this._pageOpenPending.delete(pageNumber);\n const actionsPromise = (async () => {\n const actions = await (!visitedPages.has(pageNumber) ? pageView.pdfPage?.getJSActions() : null);\n if (pdfDocument !== this.#pdfDocument) {\n return;\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 async #dispatchPageClose(pageNumber) {\n const pdfDocument = this.#pdfDocument,\n visitedPages = this._visitedPages;\n if (!this.#closeCapability) {\n return;\n }\n if (this._pageOpenPending.has(pageNumber)) {\n return;\n }\n const actionsPromise = visitedPages.get(pageNumber);\n if (!actionsPromise) {\n return;\n }\n visitedPages.set(pageNumber, null);\n await actionsPromise;\n if (pdfDocument !== this.#pdfDocument) {\n return;\n }\n await this.#scripting?.dispatchEventInSandbox({\n id: "page",\n name: "PageClose",\n pageNumber\n });\n }\n #initScripting() {\n this.#destroyCapability = Promise.withResolvers();\n if (this.#scripting) {\n throw new Error("#initScripting: Scripting already exists.");\n }\n return this.#externalServices.createScripting();\n }\n async #destroyScripting() {\n if (!this.#scripting) {\n this.#pdfDocument = null;\n this.#destroyCapability?.resolve();\n return;\n }\n if (this.#closeCapability) {\n await Promise.race([this.#closeCapability.promise, new Promise(resolve => {\n setTimeout(resolve, 1000);\n })]).catch(() => {});\n this.#closeCapability = null;\n }\n this.#pdfDocument = null;\n try {\n await this.#scripting.destroySandbox();\n } catch {}\n this.#willPrintCapability?.reject(new Error("Scripting destroyed."));\n this.#willPrintCapability = null;\n this.#eventAbortController?.abort();\n this.#eventAbortController = null;\n this._pageOpenPending.clear();\n this._visitedPages.clear();\n this.#scripting = null;\n this.#ready = false;\n this.#destroyCapability?.resolve();\n }\n}\n\n;// ./web/pdf_text_extractor.js\n\n\n\n\n\n\n\nclass PdfTextExtractor {\n #pdfViewer;\n #externalServices;\n #textPromise;\n #pendingRequests = new Set();\n constructor(externalServices) {\n this.#externalServices = externalServices;\n window.addEventListener("requestTextContent", ({\n detail\n }) => {\n this.extractTextContent(detail.requestId);\n });\n }\n setViewer(pdfViewer) {\n this.#pdfViewer = pdfViewer;\n if (this.#pdfViewer && this.#pendingRequests.size) {\n for (const pendingRequest of this.#pendingRequests) {\n this.extractTextContent(pendingRequest);\n }\n this.#pendingRequests.clear();\n }\n }\n async extractTextContent(requestId) {\n if (!this.#pdfViewer) {\n this.#pendingRequests.add(requestId);\n return;\n }\n if (!this.#textPromise) {\n const textPromise = this.#textPromise = this.#pdfViewer.getAllText();\n textPromise.then(() => {\n setTimeout(() => {\n if (this.#textPromise === textPromise) {\n this.#textPromise = null;\n }\n }, 5000);\n });\n }\n this.#externalServices.reportText({\n text: await this.#textPromise,\n requestId\n });\n }\n}\n\n// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.find.js\nvar es_iterator_find = __webpack_require__(116);\n;// ./web/menu.js\n\n\n\n\nclass Menu {\n #triggeringButton;\n #menu;\n #menuItems;\n #openMenuAC = null;\n #menuAC = new AbortController();\n #lastIndex = -1;\n #onFocusOutBound = this.#onFocusOut.bind(this);\n constructor(menuContainer, triggeringButton, menuItems) {\n this.#menu = menuContainer;\n this.#triggeringButton = triggeringButton;\n if (Array.isArray(menuItems)) {\n this.#menuItems = menuItems;\n } else {\n this.#menuItems = [];\n for (const button of this.#menu.querySelectorAll("button")) {\n this.#menuItems.push(button);\n }\n }\n this.#setUpMenu();\n }\n #closeMenu() {\n if (!this.#openMenuAC) {\n return;\n }\n const menu = this.#menu;\n this.#triggeringButton.ariaExpanded = "false";\n this.#openMenuAC.abort();\n this.#openMenuAC = null;\n if (menu.contains(document.activeElement)) {\n setTimeout(() => {\n if (!menu.contains(document.activeElement)) {\n this.#triggeringButton.focus();\n }\n }, 0);\n }\n this.#lastIndex = -1;\n }\n #openMenu() {\n if (this.#openMenuAC) {\n return;\n }\n const menu = this.#menu;\n this.#triggeringButton.ariaExpanded = "true";\n this.#openMenuAC = new AbortController();\n const signal = AbortSignal.any([this.#menuAC.signal, this.#openMenuAC.signal]);\n window.addEventListener("pointerdown", ({\n target\n }) => {\n if (!this.#triggeringButton.contains(target) && !menu.contains(target)) {\n this.#closeMenu();\n }\n }, {\n signal\n });\n const closeMenu = this.#closeMenu.bind(this);\n window.addEventListener("blur", closeMenu, {\n signal\n });\n menu.addEventListener("focusout", this.#onFocusOutBound, {\n signal\n });\n }\n #onFocusOut({\n relatedTarget\n }) {\n if (!this.#triggeringButton.contains(relatedTarget) && !this.#menu.contains(relatedTarget)) {\n this.#closeMenu();\n }\n }\n #setUpMenu() {\n this.#triggeringButton.addEventListener("click", e => {\n if (this.#openMenuAC) {\n this.#closeMenu();\n return;\n }\n this.#openMenu();\n });\n this.#triggeringButton.addEventListener("focusout", this.#onFocusOutBound);\n const {\n signal\n } = this.#menuAC;\n this.#menu.addEventListener("keydown", e => {\n switch (e.key) {\n case "Escape":\n this.#closeMenu();\n stopEvent(e);\n break;\n case "ArrowDown":\n this.#goToNextItem(e.target, true);\n stopEvent(e);\n break;\n case "ArrowUp":\n this.#goToNextItem(e.target, false);\n stopEvent(e);\n break;\n case "Home":\n this.#menuItems.find(item => !item.disabled && !item.classList.contains("hidden"))?.focus();\n stopEvent(e);\n break;\n case "End":\n this.#menuItems.findLast(item => !item.disabled && !item.classList.contains("hidden"))?.focus();\n stopEvent(e);\n break;\n default:\n const {\n key\n } = e;\n if (!/^\\p{L}$/u.test(key)) {\n break;\n }\n const char = key.toLocaleLowerCase();\n this.#goToNextItem(e.target, true, item => item.textContent.trim().toLowerCase().startsWith(char));\n stopEvent(e);\n break;\n }\n }, {\n signal,\n capture: true\n });\n this.#menu.addEventListener("contextmenu", noContextMenu, {\n signal\n });\n this.#menu.addEventListener("click", this.#closeMenu.bind(this), {\n signal,\n capture: true\n });\n this.#triggeringButton.addEventListener("keydown", e => {\n switch (e.key) {\n case " ":\n case "Enter":\n case "ArrowDown":\n case "Home":\n stopEvent(e);\n if (!this.#openMenuAC) {\n this.#openMenu();\n }\n this.#menuItems.find(item => !item.disabled && !item.classList.contains("hidden"))?.focus();\n break;\n case "ArrowUp":\n case "End":\n stopEvent(e);\n if (!this.#openMenuAC) {\n this.#openMenu();\n }\n this.#menuItems.findLast(item => !item.disabled && !item.classList.contains("hidden"))?.focus();\n break;\n case "Escape":\n this.#closeMenu();\n stopEvent(e);\n break;\n }\n }, {\n signal\n });\n }\n #goToNextItem(element, forward, check = () => true) {\n const index = this.#lastIndex === -1 ? this.#menuItems.indexOf(element) : this.#lastIndex;\n const len = this.#menuItems.length;\n const increment = forward ? 1 : len - 1;\n for (let i = (index + increment) % len; i !== index; i = (i + increment) % len) {\n const menuItem = this.#menuItems[i];\n if (!menuItem.disabled && !menuItem.classList.contains("hidden") && check(menuItem)) {\n menuItem.focus();\n this.#lastIndex = i;\n break;\n }\n }\n }\n destroy() {\n this.#closeMenu();\n this.#menuAC?.abort();\n this.#menuAC = null;\n }\n}\n\n;// ./web/pdf_thumbnail_view.js\n\n\n\n\n\n\n\n\nconst DRAW_UPSCALE_FACTOR = 2;\nconst MAX_NUM_SCALING_STEPS = 3;\nconst THUMBNAIL_WIDTH = 126;\nclass TempImageFactory {\n static getCanvas(width, height) {\n let tempCanvas;\n if (FeatureTest.isOffscreenCanvasSupported) {\n tempCanvas = new OffscreenCanvas(width, height);\n } else {\n tempCanvas = document.createElement("canvas");\n tempCanvas.width = width;\n tempCanvas.height = height;\n }\n const ctx = tempCanvas.getContext("2d", {\n alpha: false\n });\n ctx.save();\n ctx.fillStyle = "rgb(255, 255, 255)";\n ctx.fillRect(0, 0, width, height);\n ctx.restore();\n return [tempCanvas, ctx];\n }\n}\nclass PDFThumbnailView extends RenderableView {\n #renderingState = RenderingStates.INITIAL;\n constructor({\n container,\n eventBus,\n id,\n defaultViewport,\n optionalContentConfigPromise,\n linkService,\n renderingQueue,\n maxCanvasPixels,\n maxCanvasDim,\n pageColors,\n enableSplitMerge = false\n }) {\n super();\n this.id = id;\n this.renderingId = `thumbnail${id}`;\n this.pageLabel = null;\n this.pdfPage = null;\n this.rotation = 0;\n this.viewport = defaultViewport;\n this.pdfPageRotate = defaultViewport.rotation;\n this._optionalContentConfigPromise = optionalContentConfigPromise || null;\n this.maxCanvasPixels = maxCanvasPixels ?? AppOptions.get("maxCanvasPixels");\n this.maxCanvasDim = maxCanvasDim || AppOptions.get("maxCanvasDim");\n this.pageColors = pageColors || null;\n this.eventBus = eventBus;\n this.linkService = linkService;\n this.renderingQueue = renderingQueue;\n this.placeholder = null;\n const thumbnailContainer = this.div = document.createElement("div");\n thumbnailContainer.className = "thumbnail";\n thumbnailContainer.setAttribute("page-number", id);\n const imageContainer = this.imageContainer = document.createElement("div");\n thumbnailContainer.append(imageContainer);\n imageContainer.classList.add("thumbnailImageContainer", "missingThumbnailImage");\n imageContainer.role = "button";\n imageContainer.tabIndex = -1;\n imageContainer.draggable = false;\n imageContainer.setAttribute("page-number", id);\n imageContainer.setAttribute("data-l10n-id", "pdfjs-thumb-page-title1");\n imageContainer.setAttribute("data-l10n-args", this.#getPageL10nArgs(true));\n const image = this.image = document.createElement("img");\n imageContainer.append(image);\n if (enableSplitMerge) {\n const checkbox = this.checkbox = document.createElement("input");\n checkbox.type = "checkbox";\n checkbox.tabIndex = -1;\n checkbox.setAttribute("data-l10n-id", "pdfjs-thumb-page-checkbox1");\n checkbox.setAttribute("data-l10n-args", this.#getPageL10nArgs());\n thumbnailContainer.append(checkbox);\n this.pasteButton = null;\n }\n this.#updateDims();\n container.append(thumbnailContainer);\n }\n clone(container, id) {\n const thumbnailView = new PDFThumbnailView({\n container,\n id,\n eventBus: this.eventBus,\n defaultViewport: this.viewport,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n linkService: this.linkService,\n renderingQueue: this.renderingQueue,\n maxCanvasPixels: this.maxCanvasPixels,\n maxCanvasDim: this.maxCanvasDim,\n pageColors: this.pageColors,\n enableSplitMerge: !!this.checkbox\n });\n thumbnailView.setPdfPage(this.pdfPage);\n const {\n imageContainer\n } = this;\n if (!imageContainer.classList.contains("missingThumbnailImage")) {\n thumbnailView.image.replaceWith(this.image.cloneNode(true));\n thumbnailView.imageContainer.classList.remove("missingThumbnailImage");\n }\n return thumbnailView;\n }\n addPasteButton(pasteCallback) {\n if (this.pasteButton) {\n return;\n }\n const pasteButton = this.pasteButton = document.createElement("button");\n pasteButton.classList.add("thumbnailPasteButton", "viewsManagerButton");\n pasteButton.tabIndex = 0;\n const span = document.createElement("span");\n span.setAttribute("data-l10n-id", "pdfjs-views-manager-paste-button-label");\n pasteButton.append(span);\n pasteButton.addEventListener("click", () => {\n pasteCallback(this.id);\n });\n this.imageContainer.after(pasteButton);\n }\n toggleSelected(isSelected) {\n if (this.checkbox) {\n this.checkbox.checked = isSelected;\n }\n }\n updateId(newId) {\n this.id = newId;\n this.renderingId = `thumbnail${newId}`;\n this.div.setAttribute("page-number", newId);\n this.imageContainer.setAttribute("page-number", newId);\n this.setPageLabel(this.pageLabel);\n }\n #updateDims() {\n const {\n width,\n height\n } = this.viewport;\n const ratio = width / height;\n const canvasWidth = this.canvasWidth = THUMBNAIL_WIDTH;\n const canvasHeight = this.canvasHeight = canvasWidth / ratio | 0;\n this.scale = canvasWidth / width;\n this.imageContainer.style.height = `${canvasHeight}px`;\n }\n get renderingState() {\n return this.#renderingState;\n }\n set renderingState(state) {\n this.#renderingState = state;\n }\n setPdfPage(pdfPage) {\n this.pdfPage = pdfPage;\n this.pdfPageRotate = pdfPage.rotate;\n const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = pdfPage.getViewport({\n scale: 1,\n rotation: totalRotation\n });\n this.reset();\n }\n reset() {\n this.cancelRendering();\n this.renderingState = RenderingStates.INITIAL;\n this.#updateDims();\n const {\n image,\n imageContainer\n } = this;\n const url = image.src;\n if (url) {\n URL.revokeObjectURL(url);\n image.src = "";\n imageContainer.removeAttribute("data-l10n-id");\n imageContainer.removeAttribute("data-l10n-args");\n imageContainer.classList.add("missingThumbnailImage");\n }\n }\n destroy() {\n this.reset();\n this.toggleCurrent(false);\n this.div.remove();\n }\n update({\n rotation = null\n }) {\n if (typeof rotation === "number") {\n this.rotation = rotation;\n }\n const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = this.viewport.clone({\n scale: 1,\n rotation: totalRotation\n });\n this.reset();\n }\n toggleCurrent(isCurrent) {\n const {\n imageContainer\n } = this;\n if (isCurrent) {\n imageContainer.ariaCurrent = "page";\n imageContainer.tabIndex = 0;\n if (this.checkbox) {\n this.checkbox.tabIndex = 0;\n }\n } else {\n imageContainer.ariaCurrent = false;\n imageContainer.tabIndex = -1;\n if (this.checkbox) {\n this.checkbox.tabIndex = -1;\n }\n }\n }\n cancelRendering() {\n if (this.renderTask) {\n this.renderTask.cancel();\n this.renderTask = null;\n }\n this.resume = null;\n }\n #getPageDrawContext(upscaleFactor = 1) {\n const outputScale = new OutputScale();\n const width = upscaleFactor * this.canvasWidth,\n height = upscaleFactor * this.canvasHeight;\n outputScale.limitCanvas(width, height, this.maxCanvasPixels, this.maxCanvasDim);\n const canvas = document.createElement("canvas");\n canvas.width = width * outputScale.sx | 0;\n canvas.height = height * outputScale.sy | 0;\n const transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null;\n return {\n canvas,\n transform\n };\n }\n async #convertCanvasToImage(canvas) {\n if (this.renderingState !== RenderingStates.FINISHED) {\n throw new Error("#convertCanvasToImage: Rendering has not finished.");\n }\n const reducedCanvas = this.#reduceImage(canvas);\n const {\n imageContainer,\n image\n } = this;\n const {\n promise,\n resolve\n } = Promise.withResolvers();\n reducedCanvas.toBlob(resolve);\n const blob = await promise;\n image.src = URL.createObjectURL(blob);\n image.setAttribute("data-l10n-id", "pdfjs-thumb-page-canvas");\n image.setAttribute("data-l10n-args", this.#getPageL10nArgs());\n imageContainer.classList.remove("missingThumbnailImage");\n if (!FeatureTest.isOffscreenCanvasSupported) {\n reducedCanvas.width = reducedCanvas.height = 0;\n }\n }\n async draw() {\n if (this.renderingState !== RenderingStates.INITIAL) {\n console.error("Must be in new state before drawing");\n return;\n }\n const {\n pageColors,\n pdfPage\n } = this;\n if (!pdfPage) {\n this.renderingState = RenderingStates.FINISHED;\n throw new Error("pdfPage is not loaded");\n }\n this.renderingState = RenderingStates.RUNNING;\n const {\n canvas,\n transform\n } = this.#getPageDrawContext(DRAW_UPSCALE_FACTOR);\n const drawViewport = this.viewport.clone({\n scale: DRAW_UPSCALE_FACTOR * this.scale\n });\n const renderContinueCallback = cont => {\n if (!this.renderingQueue.isHighestPriority(this)) {\n this.renderingState = RenderingStates.PAUSED;\n this.resume = () => {\n this.renderingState = RenderingStates.RUNNING;\n cont();\n };\n return;\n }\n cont();\n };\n const renderContext = {\n canvas,\n transform,\n viewport: drawViewport,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n pageColors\n };\n const renderTask = this.renderTask = pdfPage.render(renderContext);\n renderTask.onContinue = renderContinueCallback;\n let error = null;\n try {\n await renderTask.promise;\n } catch (e) {\n if (e instanceof RenderingCancelledException) {\n return;\n }\n error = e;\n } finally {\n if (renderTask === this.renderTask) {\n this.renderTask = null;\n }\n }\n this.renderingState = RenderingStates.FINISHED;\n await this.#convertCanvasToImage(canvas);\n this.eventBus.dispatch("thumbnailrendered", {\n source: this,\n pageNumber: this.id,\n pdfPage\n });\n if (error) {\n throw error;\n }\n }\n setImage(pageView) {\n if (this.renderingState !== RenderingStates.INITIAL) {\n return;\n }\n const {\n thumbnailCanvas: canvas,\n pdfPage,\n scale\n } = pageView;\n if (!canvas) {\n return;\n }\n if (!this.pdfPage) {\n this.setPdfPage(pdfPage);\n }\n if (scale < this.scale) {\n return;\n }\n this.renderingState = RenderingStates.FINISHED;\n this.#convertCanvasToImage(canvas);\n }\n #getReducedImageDims(canvas) {\n const width = canvas.width << MAX_NUM_SCALING_STEPS,\n height = canvas.height << MAX_NUM_SCALING_STEPS;\n const outputScale = new OutputScale();\n outputScale.sx = outputScale.sy = 1;\n outputScale.limitCanvas(width, height, this.maxCanvasPixels, this.maxCanvasDim);\n return [width * outputScale.sx | 0, height * outputScale.sy | 0];\n }\n #reduceImage(img) {\n const {\n canvas\n } = this.#getPageDrawContext(1);\n const ctx = canvas.getContext("2d", {\n alpha: false,\n willReadFrequently: false\n });\n if (img.width <= 2 * canvas.width) {\n ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height);\n return canvas;\n }\n let [reducedWidth, reducedHeight] = this.#getReducedImageDims(canvas);\n const [reducedImage, reducedImageCtx] = TempImageFactory.getCanvas(reducedWidth, reducedHeight);\n while (reducedWidth > img.width || reducedHeight > img.height) {\n reducedWidth >>= 1;\n reducedHeight >>= 1;\n }\n reducedImageCtx.drawImage(img, 0, 0, img.width, img.height, 0, 0, reducedWidth, reducedHeight);\n while (reducedWidth > 2 * canvas.width) {\n reducedImageCtx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight, 0, 0, reducedWidth >> 1, reducedHeight >> 1);\n reducedWidth >>= 1;\n reducedHeight >>= 1;\n }\n ctx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight, 0, 0, canvas.width, canvas.height);\n return canvas;\n }\n #getPageL10nArgs(hasTotal = false) {\n return JSON.stringify({\n page: this.pageLabel ?? this.id,\n total: hasTotal ? this.linkService.pagesCount : undefined\n });\n }\n setPageLabel(label) {\n this.pageLabel = typeof label === "string" ? label : null;\n this.imageContainer.setAttribute("data-l10n-args", this.#getPageL10nArgs(true));\n this.image.setAttribute("data-l10n-args", this.#getPageL10nArgs());\n this.checkbox?.setAttribute("data-l10n-args", this.#getPageL10nArgs());\n }\n}\n\n;// ./web/pdf_thumbnail_viewer.js\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst SCROLL_OPTIONS = {\n behavior: "instant",\n block: "nearest",\n inline: "nearest",\n container: "nearest"\n};\nconst DRAG_THRESHOLD_IN_PIXELS = 5;\nconst PIXELS_TO_SCROLL_WHEN_DRAGGING = 20;\nconst SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT = 15;\nclass PDFThumbnailViewer {\n static #draggingScaleFactor = 0;\n #enableSplitMerge = false;\n #dragAC = null;\n #draggedContainer = null;\n #thumbnailsPositions = null;\n #lastDraggedOverIndex = NaN;\n #selectedPages = null;\n #draggedImageX = 0;\n #draggedImageY = 0;\n #draggedImageWidth = 0;\n #draggedImageHeight = 0;\n #draggedImageOffsetX = 0;\n #draggedImageOffsetY = 0;\n #dragMarker = null;\n #pageNumberToRemove = NaN;\n #currentScrollBottom = 0;\n #currentScrollTop = 0;\n #pagesMapper = null;\n #manageSaveAsButton = null;\n #manageDeleteButton = null;\n #manageCopyButton = null;\n #manageCutButton = null;\n #copiedThumbnails = null;\n #copiedPageNumbers = null;\n #isCut = false;\n #isOneColumnView = false;\n #scrollableContainerWidth = 0;\n #scrollableContainerHeight = 0;\n constructor({\n container,\n eventBus,\n linkService,\n renderingQueue,\n maxCanvasPixels,\n maxCanvasDim,\n pageColors,\n abortSignal,\n enableHWA,\n enableSplitMerge,\n manageMenu,\n addFileButton\n }) {\n this.scrollableContainer = container.parentElement;\n this.container = container;\n this.eventBus = eventBus;\n this.linkService = linkService;\n this.renderingQueue = renderingQueue;\n this.maxCanvasPixels = maxCanvasPixels;\n this.maxCanvasDim = maxCanvasDim;\n this.pageColors = pageColors || null;\n this.enableHWA = enableHWA || false;\n this.#enableSplitMerge = enableSplitMerge || false;\n if (this.#enableSplitMerge && manageMenu) {\n const {\n button,\n menu,\n copy,\n cut,\n delete: del,\n saveAs\n } = manageMenu;\n this.eventBus.on("pagesloaded", () => {\n button.disabled = false;\n }, {\n once: true\n });\n this._manageMenu = new Menu(menu, button, [copy, cut, del, saveAs]);\n this.#manageSaveAsButton = saveAs;\n saveAs.addEventListener("click", () => {\n this.eventBus.dispatch("savepageseditedpdf", {\n source: this,\n data: this.#pagesMapper.getPageMappingForSaving()\n });\n });\n this.#manageDeleteButton = del;\n del.addEventListener("click", this.#deletePages.bind(this));\n this.#manageCopyButton = copy;\n copy.addEventListener("click", this.#copyPages.bind(this));\n this.#manageCutButton = cut;\n cut.addEventListener("click", this.#cutPages.bind(this));\n this.#toggleMenuEntries(false);\n button.disabled = true;\n } else {\n manageMenu.button.hidden = true;\n }\n this.scroll = watchScroll(this.scrollableContainer, this.#scrollUpdated.bind(this), abortSignal);\n this.#resetView();\n this.#addEventListeners();\n }\n #scrollUpdated() {\n this.renderingQueue.renderHighestPriority();\n }\n getThumbnail(index) {\n return this._thumbnails[index];\n }\n #getVisibleThumbs() {\n return getVisibleElements({\n scrollEl: this.scrollableContainer,\n views: this._thumbnails\n });\n }\n scrollThumbnailIntoView(pageNumber) {\n if (!this.pdfDocument) {\n return;\n }\n const thumbnailView = this._thumbnails[pageNumber - 1];\n if (!thumbnailView) {\n console.error(\'scrollThumbnailIntoView: Invalid "pageNumber" parameter.\');\n return;\n }\n if (pageNumber !== this._currentPageNumber) {\n const prevThumbnailView = this._thumbnails[this._currentPageNumber - 1];\n prevThumbnailView?.toggleCurrent(false);\n thumbnailView.toggleCurrent(true);\n this._currentPageNumber = pageNumber;\n }\n const {\n first,\n last,\n views\n } = this.#getVisibleThumbs();\n if (views.length > 0) {\n let shouldScroll = false;\n if (pageNumber <= first.id || pageNumber >= last.id) {\n shouldScroll = true;\n } else {\n for (const {\n id,\n percent\n } of views) {\n if (id !== pageNumber) {\n continue;\n }\n shouldScroll = percent < 100;\n break;\n }\n }\n if (shouldScroll) {\n thumbnailView.div.scrollIntoView(SCROLL_OPTIONS);\n }\n }\n this._currentPageNumber = pageNumber;\n }\n get pagesRotation() {\n return this._pagesRotation;\n }\n set pagesRotation(rotation) {\n if (!isValidRotation(rotation)) {\n throw new Error("Invalid thumbnails rotation angle.");\n }\n if (!this.pdfDocument) {\n return;\n }\n if (this._pagesRotation === rotation) {\n return;\n }\n this._pagesRotation = rotation;\n const updateArgs = {\n rotation\n };\n for (const thumbnail of this._thumbnails) {\n thumbnail.update(updateArgs);\n }\n }\n cleanup() {\n for (const thumbnail of this._thumbnails) {\n if (thumbnail.renderingState !== RenderingStates.FINISHED) {\n thumbnail.reset();\n }\n }\n }\n #resetView() {\n this._thumbnails = [];\n this._currentPageNumber = 1;\n this._pageLabels = null;\n this._pagesRotation = 0;\n this.container.textContent = "";\n }\n setDocument(pdfDocument) {\n if (this.pdfDocument) {\n this.#cancelRendering();\n this.#resetView();\n }\n this.pdfDocument = pdfDocument;\n if (!pdfDocument) {\n return;\n }\n this.#pagesMapper = pdfDocument.pagesMapper;\n const firstPagePromise = pdfDocument.getPage(1);\n const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({\n intent: "display"\n });\n firstPagePromise.then(firstPdfPage => {\n const pagesCount = pdfDocument.numPages;\n const viewport = firstPdfPage.getViewport({\n scale: 1\n });\n const fragment = document.createDocumentFragment();\n for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n const thumbnail = new PDFThumbnailView({\n container: fragment,\n eventBus: this.eventBus,\n id: pageNum,\n defaultViewport: viewport.clone(),\n optionalContentConfigPromise,\n linkService: this.linkService,\n renderingQueue: this.renderingQueue,\n maxCanvasPixels: this.maxCanvasPixels,\n maxCanvasDim: this.maxCanvasDim,\n pageColors: this.pageColors,\n enableHWA: this.enableHWA,\n enableSplitMerge: this.#enableSplitMerge\n });\n this._thumbnails.push(thumbnail);\n }\n this._thumbnails[0]?.setPdfPage(firstPdfPage);\n const thumbnailView = this._thumbnails[this._currentPageNumber - 1];\n thumbnailView.toggleCurrent(true);\n this.container.append(fragment);\n }).catch(reason => {\n console.error("Unable to initialize thumbnail viewer", reason);\n });\n }\n #cancelRendering() {\n for (const thumbnail of this._thumbnails) {\n thumbnail.cancelRendering();\n }\n }\n setPageLabels(labels) {\n if (!this.pdfDocument) {\n return;\n }\n if (!labels) {\n this._pageLabels = null;\n } else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) {\n this._pageLabels = null;\n console.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.");\n } else {\n this._pageLabels = labels;\n }\n for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {\n this._thumbnails[i].setPageLabel(this._pageLabels?.[i] ?? null);\n }\n }\n async #ensurePdfPageLoaded(thumbView) {\n if (thumbView.pdfPage) {\n return thumbView.pdfPage;\n }\n try {\n const pdfPage = await this.pdfDocument.getPage(thumbView.id);\n if (!thumbView.pdfPage) {\n thumbView.setPdfPage(pdfPage);\n }\n return pdfPage;\n } catch (reason) {\n console.error("Unable to get page for thumb view", reason);\n return null;\n }\n }\n #getScrollAhead(visible) {\n if (visible.first?.id === 1) {\n return true;\n } else if (visible.last?.id === this._thumbnails.length) {\n return false;\n }\n return this.scroll.down;\n }\n forceRendering() {\n const visibleThumbs = this.#getVisibleThumbs();\n const scrollAhead = this.#getScrollAhead(visibleThumbs);\n const thumbView = this.renderingQueue.getHighestPriority(visibleThumbs, this._thumbnails, scrollAhead, false, true);\n if (thumbView) {\n this.#ensurePdfPageLoaded(thumbView).then(() => {\n this.renderingQueue.renderView(thumbView);\n });\n return true;\n }\n return false;\n }\n static #getScaleFactor(image) {\n return PDFThumbnailViewer.#draggingScaleFactor ||= parseFloat(getComputedStyle(image).getPropertyValue("--thumbnail-dragging-scale"));\n }\n #updateThumbnails(currentPageNumber) {\n let newCurrentPageNumber = 0;\n const pagesMapper = this.#pagesMapper;\n this.container.replaceChildren();\n const prevThumbnails = this._thumbnails;\n const newThumbnails = this._thumbnails = [];\n const fragment = document.createDocumentFragment();\n const isCut = this.#isCut;\n const oldThumbnails = new Set(prevThumbnails);\n for (let i = 1, ii = pagesMapper.pagesNumber; i <= ii; i++) {\n const prevPageNumber = pagesMapper.getPrevPageNumber(i);\n if (prevPageNumber < 0) {\n let thumbnail = this.#copiedThumbnails.get(-prevPageNumber);\n oldThumbnails.delete(thumbnail);\n thumbnail.checkbox.checked = false;\n if (isCut) {\n thumbnail.updateId(i);\n fragment.append(thumbnail.div);\n } else {\n thumbnail = thumbnail.clone(fragment, i);\n }\n newThumbnails.push(thumbnail);\n continue;\n }\n if (prevPageNumber === currentPageNumber) {\n newCurrentPageNumber = i;\n }\n const newThumbnail = prevThumbnails[prevPageNumber - 1];\n newThumbnails.push(newThumbnail);\n newThumbnail.updateId(i);\n oldThumbnails.delete(newThumbnail);\n newThumbnail.checkbox.checked = false;\n fragment.append(newThumbnail.div);\n }\n this.container.append(fragment);\n for (const oldThumbnail of oldThumbnails) {\n oldThumbnail.destroy();\n }\n return newCurrentPageNumber;\n }\n #onStartDragging(draggedThumbnail) {\n this.#currentScrollTop = this.scrollableContainer.scrollTop;\n this.#currentScrollBottom = this.#currentScrollTop + this.scrollableContainer.clientHeight;\n this.#dragAC = new AbortController();\n this.container.classList.add("isDragging");\n const startPageNumber = parseInt(draggedThumbnail.getAttribute("page-number"), 10);\n this.#lastDraggedOverIndex = startPageNumber - 1;\n if (!this.#selectedPages?.has(startPageNumber)) {\n this.#pageNumberToRemove = startPageNumber;\n this.#selectPage(startPageNumber, true);\n }\n for (const selected of this.#selectedPages) {\n const thumbnail = this._thumbnails[selected - 1];\n const placeholder = thumbnail.placeholder = document.createElement("div");\n placeholder.classList.add("thumbnailImageContainer", "placeholder");\n const {\n div,\n imageContainer\n } = thumbnail;\n div.classList.add("isDragging");\n placeholder.style.height = getComputedStyle(imageContainer).height;\n imageContainer.after(placeholder);\n if (selected !== startPageNumber) {\n imageContainer.classList.add("hidden");\n continue;\n }\n if (this.#selectedPages.size === 1) {\n imageContainer.classList.add("draggingThumbnail");\n this.#draggedContainer = imageContainer;\n continue;\n }\n const draggedContainer = this.#draggedContainer = document.createElement("div");\n draggedContainer.classList.add("draggingThumbnail", "thumbnailImageContainer", "multiple");\n draggedContainer.style.height = getComputedStyle(imageContainer).height;\n imageContainer.replaceWith(draggedContainer);\n imageContainer.classList.remove("thumbnailImageContainer");\n draggedContainer.append(imageContainer);\n draggedContainer.setAttribute("data-multiple-count", this.#selectedPages.size);\n }\n }\n #onStopDragging(isDropping = false) {\n const draggedContainer = this.#draggedContainer;\n this.#draggedContainer = null;\n const lastDraggedOverIndex = this.#lastDraggedOverIndex;\n this.#lastDraggedOverIndex = NaN;\n this.#dragMarker?.remove();\n this.#dragMarker = null;\n this.#dragAC.abort();\n this.#dragAC = null;\n this.container.classList.remove("isDragging");\n for (const selected of this.#selectedPages) {\n const thumbnail = this._thumbnails[selected - 1];\n const {\n div,\n placeholder,\n imageContainer\n } = thumbnail;\n placeholder.remove();\n imageContainer.classList.remove("draggingThumbnail", "hidden");\n div.classList.remove("isDragging");\n }\n if (draggedContainer.classList.contains("multiple")) {\n const originalImageContainer = draggedContainer.firstElementChild;\n draggedContainer.replaceWith(originalImageContainer);\n originalImageContainer.classList.add("thumbnailImageContainer");\n } else {\n draggedContainer.style.translate = "";\n }\n const selectedPages = this.#selectedPages;\n if (!isNaN(lastDraggedOverIndex) && isDropping && !(selectedPages.size === 1 && (selectedPages.has(lastDraggedOverIndex + 1) || selectedPages.has(lastDraggedOverIndex + 2)))) {\n this._thumbnails[this._currentPageNumber - 1]?.toggleCurrent(false);\n this._currentPageNumber = -1;\n const newIndex = lastDraggedOverIndex + 1;\n const pagesToMove = Array.from(selectedPages).sort((a, b) => a - b);\n const pagesMapper = this.#pagesMapper;\n let currentPageNumber = isNaN(this.#pageNumberToRemove) ? pagesToMove[0] : this.#pageNumberToRemove;\n pagesMapper.movePages(selectedPages, pagesToMove, newIndex);\n currentPageNumber = this.#updateThumbnails(currentPageNumber);\n this.#computeThumbnailsPosition();\n selectedPages.clear();\n this.#pageNumberToRemove = NaN;\n this.#updateMenuEntries();\n this.eventBus.dispatch("pagesedited", {\n source: this,\n pagesMapper,\n type: "move"\n });\n setTimeout(() => {\n this.forceRendering();\n this.linkService.goToPage(currentPageNumber);\n }, 0);\n }\n if (!isNaN(this.#pageNumberToRemove)) {\n this.#selectPage(this.#pageNumberToRemove, false);\n this.#pageNumberToRemove = NaN;\n }\n }\n #clearSelection() {\n for (const pageNumber of this.#selectedPages) {\n this._thumbnails[pageNumber - 1].toggleSelected(false);\n }\n this.#selectedPages.clear();\n }\n #copyPages(clearSelection = true) {\n const pageNumbersToCopy = this.#copiedPageNumbers = Uint32Array.from(this.#selectedPages).sort((a, b) => a - b);\n const pagesMapper = this.#pagesMapper;\n pagesMapper.copyPages(pageNumbersToCopy);\n this.#copiedThumbnails ||= new Map();\n for (const pageNumber of pageNumbersToCopy) {\n this.#copiedThumbnails.set(pageNumber, this._thumbnails[pageNumber - 1]);\n }\n this.eventBus.dispatch("pagesedited", {\n source: this,\n pagesMapper,\n pageNumbers: pageNumbersToCopy,\n type: "copy"\n });\n if (clearSelection) {\n this.#clearSelection();\n }\n for (const thumbnail of this._thumbnails) {\n thumbnail.addPasteButton(this.#pastePages.bind(this));\n }\n this.container.classList.add("pasteMode");\n this.#toggleMenuEntries(false);\n }\n #cutPages() {\n this.#isCut = true;\n this.#copyPages(false);\n this.#deletePages("cut");\n }\n #pastePages(index) {\n this.container.classList.remove("pasteMode");\n this.#toggleMenuEntries(true);\n const pagesMapper = this.#pagesMapper;\n let currentPageNumber = this.#copiedPageNumbers.includes(this._currentPageNumber) ? 0 : this._currentPageNumber;\n pagesMapper.pastePages(index);\n currentPageNumber = this.#updateThumbnails(currentPageNumber);\n this.eventBus.dispatch("pagesedited", {\n source: this,\n pagesMapper,\n hasBeenCut: this.#isCut,\n type: "paste"\n });\n this.#copiedThumbnails = null;\n this.#isCut = false;\n this.#updateMenuEntries();\n setTimeout(() => {\n this.forceRendering();\n this.linkService.goToPage(currentPageNumber || 1);\n }, 0);\n }\n #deletePages(type = "delete") {\n const selectedPages = this.#selectedPages;\n if (selectedPages.size === 0) {\n return;\n }\n const pagesMapper = this.#pagesMapper;\n let currentPageNumber = selectedPages.has(this._currentPageNumber) ? 0 : this._currentPageNumber;\n const pagesToDelete = Uint32Array.from(selectedPages).sort((a, b) => a - b);\n pagesMapper.deletePages(pagesToDelete);\n currentPageNumber = this.#updateThumbnails(currentPageNumber);\n selectedPages.clear();\n this.#updateMenuEntries();\n this.eventBus.dispatch("pagesedited", {\n source: this,\n pagesMapper,\n pageNumbers: pagesToDelete,\n type\n });\n setTimeout(() => {\n this.forceRendering();\n this.linkService.goToPage(currentPageNumber || 1);\n }, 0);\n }\n #updateMenuEntries() {\n this.#manageSaveAsButton.disabled = !this.#pagesMapper.hasBeenAltered();\n this.#manageDeleteButton.disabled = this.#manageCopyButton.disabled = this.#manageCutButton.disabled = !this.#selectedPages?.size;\n }\n #toggleMenuEntries(enable) {\n this.#manageSaveAsButton.disabled = this.#manageDeleteButton.disabled = this.#manageCopyButton.disabled = this.#manageCutButton.disabled = !enable;\n }\n #moveDraggedContainer(dx, dy) {\n if (this.#isOneColumnView) {\n dx = 0;\n }\n if (this.#draggedImageX + dx < 0 || this.#draggedImageX + this.#draggedImageWidth + dx > this.#scrollableContainerWidth) {\n dx = 0;\n }\n if (this.#draggedImageY + dy < 0 || this.#draggedImageY + this.#draggedImageHeight + dy > this.#scrollableContainerHeight) {\n dy = 0;\n }\n this.#draggedImageX += dx;\n this.#draggedImageY += dy;\n this.#draggedImageOffsetX += dx;\n this.#draggedImageOffsetY += dy;\n this.#draggedContainer.style.translate = `${this.#draggedImageOffsetX}px ${this.#draggedImageOffsetY}px`;\n if (this.#draggedImageY + this.#draggedImageHeight > this.#currentScrollBottom) {\n this.scrollableContainer.scrollTop = Math.min(this.scrollableContainer.scrollTop + PIXELS_TO_SCROLL_WHEN_DRAGGING, this.#scrollableContainerHeight);\n } else if (this.#draggedImageY < this.#currentScrollTop) {\n this.scrollableContainer.scrollTop = Math.max(this.scrollableContainer.scrollTop - PIXELS_TO_SCROLL_WHEN_DRAGGING, 0);\n }\n const positionData = this.#findClosestThumbnail(this.#draggedImageX + this.#draggedImageWidth / 2, this.#draggedImageY + this.#draggedImageHeight / 2);\n if (!positionData) {\n return;\n }\n let dragMarker = this.#dragMarker;\n if (!dragMarker) {\n dragMarker = this.#dragMarker = document.createElement("div");\n dragMarker.className = "dragMarker";\n this.container.firstChild.before(dragMarker);\n }\n const [index, space] = positionData;\n const dragMarkerStyle = dragMarker.style;\n const {\n bbox,\n x: xPos\n } = this.#thumbnailsPositions;\n let x, y, width, height;\n if (index < 0) {\n if (xPos.length === 1) {\n y = bbox[1] - SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT;\n x = bbox[4];\n width = bbox[2];\n } else {\n y = bbox[1];\n x = bbox[0] - SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT;\n height = bbox[3];\n }\n } else if (xPos.length === 1) {\n y = bbox[index * 4 + 1] + bbox[index * 4 + 3] + space;\n x = bbox[index * 4];\n width = bbox[index * 4 + 2];\n } else {\n y = bbox[index * 4 + 1];\n x = bbox[index * 4] + bbox[index * 4 + 2] + space;\n height = bbox[index * 4 + 3];\n }\n dragMarkerStyle.translate = `${x}px ${y}px`;\n dragMarkerStyle.width = width ? `${width}px` : "";\n dragMarkerStyle.height = height ? `${height}px` : "";\n }\n #computeThumbnailsPosition() {\n const positionsX = [];\n const positionsY = [];\n const positionsLastX = [];\n const bbox = new Float32Array(this._thumbnails.length * 4);\n let prevX = -Infinity;\n let prevY = -Infinity;\n let reminder = -1;\n let firstRightX;\n let lastRightX;\n let firstBottomY;\n for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {\n const {\n div\n } = this._thumbnails[i];\n const {\n offsetTop: y,\n offsetLeft: x,\n offsetWidth: w,\n offsetHeight: h\n } = div;\n if (w === 0) {\n return;\n }\n bbox[i * 4] = x;\n bbox[i * 4 + 1] = y;\n bbox[i * 4 + 2] = w;\n bbox[i * 4 + 3] = h;\n if (x > prevX) {\n prevX = x + w / 2;\n firstRightX ??= prevX + w;\n positionsX.push(prevX);\n }\n if (reminder > 0 && i >= ii - reminder) {\n const cx = x + w / 2;\n positionsLastX.push(cx);\n lastRightX ??= cx + w;\n }\n if (y > prevY) {\n if (reminder === -1 && positionsX.length > 1) {\n reminder = ii % positionsX.length;\n }\n prevY = y + h / 2;\n firstBottomY ??= prevY + h;\n positionsY.push(prevY);\n }\n }\n const space = positionsX.length > 1 ? (positionsX[1] - firstRightX) / 2 : (positionsY[1] - firstBottomY) / 2;\n this.#thumbnailsPositions = {\n x: positionsX,\n y: positionsY,\n lastX: positionsLastX,\n space,\n lastSpace: (positionsLastX.at(-1) - lastRightX) / 2,\n bbox\n };\n this.#isOneColumnView = positionsX.length === 1;\n ({\n clientWidth: this.#scrollableContainerWidth,\n scrollHeight: this.#scrollableContainerHeight\n } = this.scrollableContainer);\n }\n #addEventListeners() {\n this.eventBus.on("resize", ({\n source\n }) => {\n if (source.thumbnailsView === this.container) {\n this.#computeThumbnailsPosition();\n }\n });\n this.container.addEventListener("keydown", e => {\n const {\n target\n } = e;\n const isCheckbox = target instanceof HTMLInputElement && target.type === "checkbox";\n switch (e.key) {\n case "ArrowLeft":\n this.#goToNextItem(target, false, true, isCheckbox);\n stopEvent(e);\n break;\n case "ArrowRight":\n this.#goToNextItem(target, true, true, isCheckbox);\n stopEvent(e);\n break;\n case "ArrowDown":\n this.#goToNextItem(target, true, false, isCheckbox);\n stopEvent(e);\n break;\n case "ArrowUp":\n this.#goToNextItem(target, false, false, isCheckbox);\n stopEvent(e);\n break;\n case "Home":\n this.#focusThumbnailElement(this._thumbnails[0], isCheckbox);\n stopEvent(e);\n break;\n case "End":\n this.#focusThumbnailElement(this._thumbnails.at(-1), isCheckbox);\n stopEvent(e);\n break;\n case "Enter":\n case " ":\n if (!isCheckbox) {\n this.#goToPage(e);\n }\n break;\n case "c":\n if (this.#enableSplitMerge && (e.ctrlKey || e.metaKey) && this.#selectedPages?.size) {\n this.#copyPages();\n stopEvent(e);\n }\n break;\n case "x":\n if (this.#enableSplitMerge && (e.ctrlKey || e.metaKey) && this.#selectedPages?.size) {\n this.#cutPages();\n stopEvent(e);\n }\n break;\n case "Delete":\n case "Backspace":\n if (this.#enableSplitMerge && this.#selectedPages?.size) {\n this.#deletePages();\n stopEvent(e);\n }\n break;\n }\n });\n this.container.addEventListener("click", e => {\n const {\n target\n } = e;\n if (target instanceof HTMLInputElement) {\n const pageNumber = parseInt(target.parentElement.getAttribute("page-number"), 10);\n this.#selectPage(pageNumber, target.checked);\n return;\n }\n this.#goToPage(e);\n });\n this.#addDragListeners();\n }\n #selectPage(pageNumber, checked) {\n const set = this.#selectedPages ??= new Set();\n if (checked) {\n set.add(pageNumber);\n } else {\n set.delete(pageNumber);\n }\n this.#updateMenuEntries();\n }\n #addDragListeners() {\n if (!this.#enableSplitMerge) {\n return;\n }\n this.container.addEventListener("pointerdown", e => {\n const {\n target: draggedImage,\n clientX: clickX,\n clientY: clickY,\n pointerId: dragPointerId\n } = e;\n if (e.button !== 0 || this.#pagesMapper.copiedPageNumbers?.length > 0 || !isNaN(this.#lastDraggedOverIndex) || !draggedImage.classList.contains("thumbnailImageContainer")) {\n return;\n }\n const thumbnail = draggedImage.parentElement;\n const pointerDownAC = new AbortController();\n const {\n signal: pointerDownSignal\n } = pointerDownAC;\n let prevDragX = clickX;\n let prevDragY = clickY;\n let prevScrollTop = this.scrollableContainer.scrollTop;\n const scaleFactor = PDFThumbnailViewer.#getScaleFactor(draggedImage);\n this.#draggedImageOffsetY = ((scaleFactor - 1) * e.layerY + draggedImage.offsetTop) / scaleFactor;\n if (this.#isOneColumnView) {\n this.#draggedImageOffsetX = draggedImage.offsetLeft + (scaleFactor - 1) * 0.5 * draggedImage.offsetWidth / scaleFactor;\n } else {\n this.#draggedImageOffsetX = ((scaleFactor - 1) * e.layerX + draggedImage.offsetLeft) / scaleFactor;\n }\n this.#draggedImageX = thumbnail.offsetLeft + this.#draggedImageOffsetX;\n this.#draggedImageY = thumbnail.offsetTop + this.#draggedImageOffsetY;\n this.#draggedImageWidth = draggedImage.offsetWidth / scaleFactor;\n this.#draggedImageHeight = draggedImage.offsetHeight / scaleFactor;\n this.container.addEventListener("pointermove", ev => {\n const {\n clientX: x,\n clientY: y,\n pointerId\n } = ev;\n if (isNaN(this.#lastDraggedOverIndex)) {\n if (pointerId !== dragPointerId || Math.abs(x - clickX) <= DRAG_THRESHOLD_IN_PIXELS && Math.abs(y - clickY) <= DRAG_THRESHOLD_IN_PIXELS) {\n return;\n }\n this.#onStartDragging(thumbnail);\n const stopDragging = (_e, isDropping = false) => {\n this.#onStopDragging(isDropping);\n pointerDownAC.abort();\n };\n const {\n signal\n } = this.#dragAC;\n window.addEventListener("touchmove", stopEvent, {\n passive: false,\n signal\n });\n window.addEventListener("contextmenu", noContextMenu, {\n signal\n });\n this.scrollableContainer.addEventListener("scrollend", () => {\n const {\n scrollableContainer: {\n clientHeight,\n scrollTop\n }\n } = this;\n this.#currentScrollTop = scrollTop;\n this.#currentScrollBottom = scrollTop + clientHeight;\n const dy = scrollTop - prevScrollTop;\n prevScrollTop = scrollTop;\n this.#moveDraggedContainer(0, dy);\n }, {\n passive: true,\n signal\n });\n window.addEventListener("pointerup", upEv => {\n if (upEv.pointerId !== dragPointerId) {\n return;\n }\n window.addEventListener("click", stopEvent, {\n capture: true,\n once: true,\n signal\n });\n stopEvent(upEv);\n stopDragging(upEv, true);\n }, {\n signal\n });\n window.addEventListener("blur", stopDragging, {\n signal\n });\n window.addEventListener("pointercancel", stopDragging, {\n signal\n });\n window.addEventListener("wheel", stopEvent, {\n passive: false,\n signal\n });\n window.addEventListener("keydown", kEv => {\n if (kEv.key === "Escape" && !isNaN(this.#lastDraggedOverIndex)) {\n stopDragging(kEv);\n }\n }, {\n signal\n });\n }\n const dx = x - prevDragX;\n const dy = y - prevDragY;\n prevDragX = x;\n prevDragY = y;\n this.#moveDraggedContainer(dx, dy);\n }, {\n passive: true,\n signal: pointerDownSignal\n });\n window.addEventListener("pointerup", ({\n pointerId\n }) => {\n if (pointerId !== dragPointerId) {\n return;\n }\n pointerDownAC.abort();\n }, {\n signal: pointerDownSignal\n });\n window.addEventListener("dragstart", stopEvent, {\n capture: true,\n signal: pointerDownSignal\n });\n });\n }\n #goToPage(e) {\n const {\n target\n } = e;\n if (target.classList.contains("thumbnailImageContainer")) {\n const pageNumber = parseInt(target.parentElement.getAttribute("page-number"), 10);\n this.linkService.goToPage(pageNumber);\n stopEvent(e);\n }\n }\n #focusThumbnailElement(thumbnail, focusCheckbox) {\n if (focusCheckbox && thumbnail.checkbox) {\n thumbnail.checkbox.focus();\n } else {\n thumbnail.imageContainer.focus();\n }\n }\n #goToNextItem(element, forward, horizontal, navigateCheckboxes = false) {\n let currentPageNumber = parseInt(element.parentElement.getAttribute("page-number"), 10);\n if (isNaN(currentPageNumber)) {\n currentPageNumber = this._currentPageNumber;\n }\n const increment = forward ? 1 : -1;\n let nextThumbnail;\n if (horizontal) {\n const nextPageNumber = MathClamp(currentPageNumber + increment, 1, this._thumbnails.length + 1);\n nextThumbnail = this._thumbnails[nextPageNumber - 1];\n } else {\n const currentThumbnail = this._thumbnails[currentPageNumber - 1];\n const {\n x: currentX,\n y: currentY\n } = currentThumbnail.div.getBoundingClientRect();\n let firstWithDifferentY;\n for (let i = currentPageNumber - 1 + increment; i >= 0 && i < this._thumbnails.length; i += increment) {\n const thumbnail = this._thumbnails[i];\n const {\n x,\n y\n } = thumbnail.div.getBoundingClientRect();\n if (!firstWithDifferentY && y !== currentY) {\n firstWithDifferentY = thumbnail;\n }\n if (x === currentX) {\n nextThumbnail = thumbnail;\n break;\n }\n }\n if (!nextThumbnail) {\n nextThumbnail = firstWithDifferentY;\n }\n }\n if (nextThumbnail) {\n this.#focusThumbnailElement(nextThumbnail, navigateCheckboxes);\n }\n }\n #findClosestThumbnail(x, y) {\n if (!this.#thumbnailsPositions) {\n this.#computeThumbnailsPosition();\n }\n const {\n x: positionsX,\n y: positionsY,\n lastX: positionsLastX,\n space: spaceBetweenThumbnails,\n lastSpace: lastSpaceBetweenThumbnails\n } = this.#thumbnailsPositions;\n const lastDraggedOverIndex = this.#lastDraggedOverIndex;\n let xPos = lastDraggedOverIndex % positionsX.length;\n let yPos = Math.floor(lastDraggedOverIndex / positionsX.length);\n let xArray = yPos === positionsY.length - 1 ? positionsLastX : positionsX;\n if (positionsY[yPos] <= y && y < (positionsY[yPos + 1] ?? Infinity) && xArray[xPos] <= x && x < (xArray[xPos + 1] ?? Infinity)) {\n return null;\n }\n let index;\n yPos = binarySearchFirstItem(positionsY, cy => y < cy);\n if (this.#isOneColumnView) {\n index = yPos - 1;\n } else {\n if (yPos === positionsY.length) {\n yPos = positionsY.length - 1;\n } else {\n const dist1 = Math.abs(positionsY[yPos - 1] - y);\n const dist2 = Math.abs(positionsY[yPos] - y);\n yPos = dist1 < dist2 ? yPos - 1 : yPos;\n }\n xArray = yPos === positionsY.length - 1 && positionsLastX.length > 0 ? positionsLastX : positionsX;\n xPos = binarySearchFirstItem(xArray, cx => x < cx) - 1;\n if (yPos < 0) {\n if (xPos <= 0) {\n xPos = -1;\n }\n yPos = 0;\n }\n index = MathClamp(yPos * positionsX.length + xPos, -1, this._thumbnails.length - 1);\n }\n if (index === lastDraggedOverIndex) {\n return null;\n }\n this.#lastDraggedOverIndex = index;\n const space = yPos === positionsY.length - 1 && positionsLastX.length > 0 && xPos >= 0 ? lastSpaceBetweenThumbnails : spaceBetweenThumbnails;\n return [index, space];\n }\n}\n\n;// ./web/annotation_editor_layer_builder.js\n\n\nclass AnnotationEditorLayerBuilder {\n #annotationLayer = null;\n #drawLayer = null;\n #onAppend = null;\n #structTreeLayer = null;\n #textLayer = null;\n #uiManager;\n #clonedFrom = null;\n constructor(options) {\n this.pageIndex = options.pageIndex;\n this.accessibilityManager = options.accessibilityManager;\n this.l10n = options.l10n;\n this.l10n ||= new genericl10n_GenericL10n();\n this.annotationEditorLayer = null;\n this.div = null;\n this._cancelled = false;\n this.#uiManager = options.uiManager;\n this.#annotationLayer = options.annotationLayer || null;\n this.#textLayer = options.textLayer || null;\n this.#drawLayer = options.drawLayer || null;\n this.#onAppend = options.onAppend || null;\n this.#structTreeLayer = options.structTreeLayer || null;\n this.#clonedFrom = options.clonedFrom || null;\n }\n updatePageIndex(newPageIndex) {\n this.pageIndex = newPageIndex;\n this.annotationEditorLayer?.updatePageIndex(newPageIndex);\n }\n async render({\n viewport,\n intent = "display"\n }) {\n if (intent !== "display") {\n return;\n }\n if (this._cancelled) {\n return;\n }\n const clonedViewport = viewport.clone({\n dontFlip: true\n });\n if (this.div) {\n this.annotationEditorLayer.update({\n viewport: clonedViewport\n });\n this.show();\n return;\n }\n const div = this.div = document.createElement("div");\n div.className = "annotationEditorLayer";\n div.hidden = true;\n div.dir = this.#uiManager.direction;\n this.#onAppend?.(div);\n this.annotationEditorLayer = new AnnotationEditorLayer({\n uiManager: this.#uiManager,\n div,\n structTreeLayer: this.#structTreeLayer,\n accessibilityManager: this.accessibilityManager,\n pageIndex: this.pageIndex,\n l10n: this.l10n,\n viewport: clonedViewport,\n annotationLayer: this.#annotationLayer,\n textLayer: this.#textLayer,\n drawLayer: this.#drawLayer\n });\n this.annotationEditorLayer.setClonedFrom(this.#clonedFrom?.annotationEditorLayer);\n this.#clonedFrom = null;\n const parameters = {\n viewport: clonedViewport,\n div,\n annotations: null,\n intent\n };\n this.annotationEditorLayer.render(parameters);\n this.show();\n }\n cancel() {\n this._cancelled = true;\n if (!this.div) {\n return;\n }\n this.annotationEditorLayer.destroy();\n }\n hide() {\n if (!this.div) {\n return;\n }\n this.annotationEditorLayer.pause(true);\n this.div.hidden = true;\n }\n show() {\n if (!this.div || this.annotationEditorLayer.isInvisible) {\n return;\n }\n this.div.hidden = false;\n this.annotationEditorLayer.pause(false);\n }\n}\n\n;// ./web/annotation_layer_builder.js\n\n\n\n\n\nclass AnnotationLayerBuilder {\n #annotations = null;\n #commentManager = null;\n #externalHide = false;\n #onAppend = null;\n #eventAbortController = null;\n #linksInjected = false;\n constructor({\n pdfPage,\n linkService,\n downloadManager,\n annotationStorage = null,\n imageResourcesPath = "",\n renderForms = true,\n enableComment = false,\n commentManager = null,\n enableScripting = false,\n hasJSActionsPromise = null,\n fieldObjectsPromise = null,\n annotationCanvasMap = null,\n accessibilityManager = null,\n annotationEditorUIManager = null,\n onAppend = null\n }) {\n this.pdfPage = pdfPage;\n this.linkService = linkService;\n this.downloadManager = downloadManager;\n this.imageResourcesPath = imageResourcesPath;\n this.renderForms = renderForms;\n this.annotationStorage = annotationStorage;\n this.enableComment = enableComment;\n this.#commentManager = commentManager;\n this.enableScripting = enableScripting;\n this._hasJSActionsPromise = hasJSActionsPromise || Promise.resolve(false);\n this._fieldObjectsPromise = fieldObjectsPromise || Promise.resolve(null);\n this._annotationCanvasMap = annotationCanvasMap;\n this._accessibilityManager = accessibilityManager;\n this._annotationEditorUIManager = annotationEditorUIManager;\n this.#onAppend = onAppend;\n this.annotationLayer = null;\n this.div = null;\n this._cancelled = false;\n this._eventBus = linkService.eventBus;\n }\n async render({\n viewport,\n intent = "display",\n structTreeLayer = null\n }) {\n if (this.div) {\n if (this._cancelled || !this.annotationLayer) {\n return;\n }\n this.annotationLayer.update({\n viewport: viewport.clone({\n dontFlip: true\n })\n });\n return;\n }\n const [annotations, hasJSActions, fieldObjects] = await Promise.all([this.pdfPage.getAnnotations({\n intent\n }), this._hasJSActionsPromise, this._fieldObjectsPromise]);\n if (this._cancelled) {\n return;\n }\n const div = this.div = document.createElement("div");\n div.className = "annotationLayer";\n this.#onAppend?.(div);\n this.#initAnnotationLayer(viewport, structTreeLayer);\n if (annotations.length === 0) {\n this.#annotations = annotations;\n setLayerDimensions(this.div, viewport);\n return;\n }\n await this.annotationLayer.render({\n annotations,\n imageResourcesPath: this.imageResourcesPath,\n renderForms: this.renderForms,\n downloadManager: this.downloadManager,\n enableComment: this.enableComment,\n enableScripting: this.enableScripting,\n hasJSActions,\n fieldObjects\n });\n this.#annotations = annotations;\n if (this.linkService.isInPresentationMode) {\n this.#updatePresentationModeState(PresentationModeState.FULLSCREEN);\n }\n if (!this.#eventAbortController) {\n this.#eventAbortController = new AbortController();\n this._eventBus?._on("presentationmodechanged", evt => {\n this.#updatePresentationModeState(evt.state);\n }, {\n signal: this.#eventAbortController.signal\n });\n }\n }\n #initAnnotationLayer(viewport, structTreeLayer) {\n this.annotationLayer = new AnnotationLayer({\n div: this.div,\n accessibilityManager: this._accessibilityManager,\n annotationCanvasMap: this._annotationCanvasMap,\n annotationEditorUIManager: this._annotationEditorUIManager,\n annotationStorage: this.annotationStorage,\n page: this.pdfPage,\n viewport: viewport.clone({\n dontFlip: true\n }),\n structTreeLayer,\n commentManager: this.#commentManager,\n linkService: this.linkService\n });\n }\n cancel() {\n this._cancelled = true;\n this.#eventAbortController?.abort();\n this.#eventAbortController = null;\n }\n hide(internal = false) {\n this.#externalHide = !internal;\n if (!this.div) {\n return;\n }\n this.div.hidden = true;\n }\n hasEditableAnnotations() {\n return !!this.annotationLayer?.hasEditableAnnotations();\n }\n async injectLinkAnnotations(inferredLinks) {\n if (this.#annotations === null) {\n throw new Error("`render` method must be called before `injectLinkAnnotations`.");\n }\n if (this._cancelled || this.#linksInjected) {\n return;\n }\n this.#linksInjected = true;\n const newLinks = this.#annotations.length ? this.#checkInferredLinks(inferredLinks) : inferredLinks;\n if (!newLinks.length) {\n return;\n }\n await this.annotationLayer.addLinkAnnotations(newLinks);\n if (!this.#externalHide) {\n this.div.hidden = false;\n }\n }\n #updatePresentationModeState(state) {\n if (!this.div) {\n return;\n }\n let disableFormElements = false;\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 #checkInferredLinks(inferredLinks) {\n function annotationRects(annot) {\n if (!annot.quadPoints) {\n return [annot.rect];\n }\n const rects = [];\n for (let i = 2, ii = annot.quadPoints.length; i < ii; i += 8) {\n const trX = annot.quadPoints[i];\n const trY = annot.quadPoints[i + 1];\n const blX = annot.quadPoints[i + 2];\n const blY = annot.quadPoints[i + 3];\n rects.push([blX, blY, trX, trY]);\n }\n return rects;\n }\n function intersectAnnotations(annot1, annot2) {\n const intersections = [];\n const annot1Rects = annotationRects(annot1);\n const annot2Rects = annotationRects(annot2);\n for (const rect1 of annot1Rects) {\n for (const rect2 of annot2Rects) {\n const intersection = Util.intersect(rect1, rect2);\n if (intersection) {\n intersections.push(intersection);\n }\n }\n }\n return intersections;\n }\n function areaRects(rects) {\n let totalArea = 0;\n for (const rect of rects) {\n totalArea += Math.abs((rect[2] - rect[0]) * (rect[3] - rect[1]));\n }\n return totalArea;\n }\n return inferredLinks.filter(link => {\n let linkAreaRects;\n for (const annotation of this.#annotations) {\n if (annotation.annotationType !== AnnotationType.LINK || !annotation.url) {\n continue;\n }\n const intersections = intersectAnnotations(annotation, link);\n if (intersections.length === 0) {\n continue;\n }\n linkAreaRects ??= areaRects(annotationRects(link));\n if (areaRects(intersections) / linkAreaRects > 0.5) {\n return false;\n }\n }\n return true;\n });\n }\n}\n\n;// ./web/autolinker.js\n\n\n\n\n\n\nfunction DOMRectToPDF({\n width,\n height,\n left,\n top\n}, pdfPageView) {\n if (width === 0 || height === 0) {\n return null;\n }\n const pageBox = pdfPageView.textLayer.div.getBoundingClientRect();\n const bottomLeft = pdfPageView.getPagePoint(left - pageBox.left, top - pageBox.top);\n const topRight = pdfPageView.getPagePoint(left - pageBox.left + width, top - pageBox.top + height);\n return Util.normalizeRect([bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]]);\n}\nfunction calculateLinkPosition(range, pdfPageView) {\n const rangeRects = range.getClientRects();\n if (rangeRects.length === 1) {\n return {\n rect: DOMRectToPDF(rangeRects[0], pdfPageView)\n };\n }\n const rect = [Infinity, Infinity, -Infinity, -Infinity];\n const quadPoints = [];\n let i = 0;\n for (const domRect of rangeRects) {\n const normalized = DOMRectToPDF(domRect, pdfPageView);\n if (normalized === null) {\n continue;\n }\n quadPoints[i] = quadPoints[i + 4] = normalized[0];\n quadPoints[i + 1] = quadPoints[i + 3] = normalized[3];\n quadPoints[i + 2] = quadPoints[i + 6] = normalized[2];\n quadPoints[i + 5] = quadPoints[i + 7] = normalized[1];\n Util.rectBoundingBox(...normalized, rect);\n i += 8;\n }\n return {\n quadPoints,\n rect\n };\n}\nfunction textPosition(container, offset) {\n let currentContainer = container;\n do {\n if (currentContainer.nodeType === Node.TEXT_NODE) {\n const currentLength = currentContainer.textContent.length;\n if (offset <= currentLength) {\n return [currentContainer, offset];\n }\n offset -= currentLength;\n } else if (currentContainer.firstChild) {\n currentContainer = currentContainer.firstChild;\n continue;\n }\n while (!currentContainer.nextSibling && currentContainer !== container) {\n currentContainer = currentContainer.parentNode;\n }\n if (currentContainer !== container) {\n currentContainer = currentContainer.nextSibling;\n }\n } while (currentContainer !== container);\n throw new Error("Offset is bigger than container\'s contents length.");\n}\nfunction createLinkAnnotation({\n url,\n index,\n length\n}, pdfPageView, id) {\n const highlighter = pdfPageView._textHighlighter;\n const [{\n begin,\n end\n }] = highlighter._convertMatches([index], [length]);\n const range = new Range();\n range.setStart(...textPosition(highlighter.textDivs[begin.divIdx], begin.offset));\n range.setEnd(...textPosition(highlighter.textDivs[end.divIdx], end.offset));\n return {\n id: `inferred_link_${id}`,\n unsafeUrl: url,\n url,\n annotationType: AnnotationType.LINK,\n rotation: 0,\n ...calculateLinkPosition(range, pdfPageView),\n borderStyle: null\n };\n}\nclass Autolinker {\n static #index = 0;\n static #regex;\n static #numericTLDRegex;\n static findLinks(text) {\n this.#regex ??= /\\b(?:https?:\\/\\/|mailto:|www\\.)(?:[\\0-\\x08\\x0E-\\x1F\\$\\+0-9=A-Z\\^`-z\\|~-\\x9F\\xA2-\\xA6\\xA8-\\xAA\\xAC-\\xB5\\xB8-\\xBA\\xBC-\\xBE\\xC0-\\u037D\\u037F-\\u0386\\u0388-\\u0559\\u0560-\\u0588\\u058B-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7-\\u05F2\\u05F5-\\u0608\\u060B\\u060E-\\u061A\\u061C\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06FF\\u070E-\\u07F6\\u07FA-\\u082F\\u083F-\\u085D\\u085F-\\u0963\\u0966-\\u096F\\u0971-\\u09FC\\u09FE-\\u0A75\\u0A77-\\u0AEF\\u0AF1-\\u0C76\\u0C78-\\u0C83\\u0C85-\\u0DF3\\u0DF5-\\u0E4E\\u0E50-\\u0E59\\u0E5C-\\u0F03\\u0F13\\u0F15-\\u0F39\\u0F3E-\\u0F84\\u0F86-\\u0FCF\\u0FD5-\\u0FD8\\u0FDB-\\u1049\\u1050-\\u10FA\\u10FC-\\u135F\\u1369-\\u13FF\\u1401-\\u166D\\u166F-\\u167F\\u1681-\\u169A\\u169D-\\u16EA\\u16EE-\\u1734\\u1737-\\u17D3\\u17D7\\u17DB-\\u17FF\\u180B-\\u1943\\u1946-\\u1A1D\\u1A20-\\u1A9F\\u1AA7\\u1AAE-\\u1B4D\\u1B50-\\u1B59\\u1B61-\\u1B7C\\u1B80-\\u1BFB\\u1C00-\\u1C3A\\u1C40-\\u1C7D\\u1C80-\\u1CBF\\u1CC8-\\u1CD2\\u1CD4-\\u1FFF\\u200B-\\u200F\\u202A-\\u202E\\u2044\\u2052\\u2060-\\u207C\\u207F-\\u208C\\u208F-\\u2307\\u230C-\\u2328\\u232B-\\u2767\\u2776-\\u27C4\\u27C7-\\u27E5\\u27F0-\\u2982\\u2999-\\u29D7\\u29DC-\\u29FB\\u29FE-\\u2CF8\\u2CFD\\u2D00-\\u2D6F\\u2D71-\\u2DFF\\u2E2F\\u2E50\\u2E51\\u2E5E-\\u2FFF\\u3004-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u303C\\u303E-\\u309F\\u30A1-\\u30FA\\u30FC-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA672\\uA674-\\uA67D\\uA67F-\\uA6F1\\uA6F8-\\uA873\\uA878-\\uA8CD\\uA8D0-\\uA8F7\\uA8FB\\uA8FD-\\uA92D\\uA930-\\uA95E\\uA960-\\uA9C0\\uA9CE-\\uA9DD\\uA9E0-\\uAA5B\\uAA60-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uABEA\\uABEC-\\uFD3D\\uFD40-\\uFE0F\\uFE1A-\\uFE2F\\uFE53\\uFE62\\uFE64-\\uFE67\\uFE69\\uFE6C-\\uFEFE\\uFF00\\uFF04\\uFF0B\\uFF10-\\uFF19\\uFF1C-\\uFF1E\\uFF21-\\uFF3A\\uFF3E\\uFF40-\\uFF5A\\uFF5C\\uFF5E\\uFF66-\\u{100FF}\\u{10103}-\\u{1039E}\\u{103A0}-\\u{103CF}\\u{103D1}-\\u{1056E}\\u{10570}-\\u{10856}\\u{10858}-\\u{1091E}\\u{10920}-\\u{1093E}\\u{10940}-\\u{10A4F}\\u{10A59}-\\u{10A7E}\\u{10A80}-\\u{10AEF}\\u{10AF7}-\\u{10B38}\\u{10B40}-\\u{10B98}\\u{10B9D}-\\u{10D6D}\\u{10D6F}-\\u{10EAC}\\u{10EAE}-\\u{10ECF}\\u{10ED1}-\\u{10F54}\\u{10F5A}-\\u{10F85}\\u{10F8A}-\\u{11046}\\u{1104E}-\\u{110BA}\\u{110BD}\\u{110C2}-\\u{1113F}\\u{11144}-\\u{11173}\\u{11176}-\\u{111C4}\\u{111C9}-\\u{111CC}\\u{111CE}-\\u{111DA}\\u{111DC}\\u{111E0}-\\u{11237}\\u{1123E}-\\u{112A8}\\u{112AA}-\\u{113D3}\\u{113D6}\\u{113D9}-\\u{1144A}\\u{11450}-\\u{11459}\\u{1145C}\\u{1145E}-\\u{114C5}\\u{114C7}-\\u{115C0}\\u{115D8}-\\u{11640}\\u{11644}-\\u{1165F}\\u{1166D}-\\u{116B8}\\u{116BA}-\\u{1173B}\\u{1173F}-\\u{1183A}\\u{1183C}-\\u{11943}\\u{11947}-\\u{119E1}\\u{119E3}-\\u{11A3E}\\u{11A47}-\\u{11A99}\\u{11A9D}\\u{11AA3}-\\u{11AFF}\\u{11B0A}-\\u{11BE0}\\u{11BE2}-\\u{11C40}\\u{11C46}-\\u{11C6F}\\u{11C72}-\\u{11EF6}\\u{11EF9}-\\u{11F42}\\u{11F50}-\\u{11FFE}\\u{12000}-\\u{1246F}\\u{12475}-\\u{12FF0}\\u{12FF3}-\\u{16A6D}\\u{16A70}-\\u{16AF4}\\u{16AF6}-\\u{16B36}\\u{16B3C}-\\u{16B43}\\u{16B45}-\\u{16D6C}\\u{16D70}-\\u{16E96}\\u{16E9B}-\\u{16FE1}\\u{16FE3}-\\u{1BC9E}\\u{1BCA0}-\\u{1DA86}\\u{1DA8C}-\\u{1E5FE}\\u{1E600}-\\u{1E95D}\\u{1E960}-\\u{10FFFF}]|\\/|[\\0-\\x08\\x0E-\\x1F!-Z\\\\\\^-\\x9F\\xA1-\\u167F\\u1681-\\u1FFF\\u200B-\\u2027\\u202A-\\u202E\\u2030-\\u205E\\u2060-\\u2FFF\\u3001-\\uFEFE\\uFF00-\\u{10FFFF}]+[\\0-\\x08\\x0E-\\x1F\\$\\+0-9=A-Z\\^`-z\\|~-\\x9F\\xA2-\\xA6\\xA8-\\xAA\\xAC-\\xB5\\xB8-\\xBA\\xBC-\\xBE\\xC0-\\u037D\\u037F-\\u0386\\u0388-\\u0559\\u0560-\\u0588\\u058B-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7-\\u05F2\\u05F5-\\u0608\\u060B\\u060E-\\u061A\\u061C\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06FF\\u070E-\\u07F6\\u07FA-\\u082F\\u083F-\\u085D\\u085F-\\u0963\\u0966-\\u096F\\u0971-\\u09FC\\u09FE-\\u0A75\\u0A77-\\u0AEF\\u0AF1-\\u0C76\\u0C78-\\u0C83\\u0C85-\\u0DF3\\u0DF5-\\u0E4E\\u0E50-\\u0E59\\u0E5C-\\u0F03\\u0F13\\u0F15-\\u0F39\\u0F3E-\\u0F84\\u0F86-\\u0FCF\\u0FD5-\\u0FD8\\u0FDB-\\u1049\\u1050-\\u10FA\\u10FC-\\u135F\\u1369-\\u13FF\\u1401-\\u166D\\u166F-\\u167F\\u1681-\\u169A\\u169D-\\u16EA\\u16EE-\\u1734\\u1737-\\u17D3\\u17D7\\u17DB-\\u17FF\\u180B-\\u1943\\u1946-\\u1A1D\\u1A20-\\u1A9F\\u1AA7\\u1AAE-\\u1B4D\\u1B50-\\u1B59\\u1B61-\\u1B7C\\u1B80-\\u1BFB\\u1C00-\\u1C3A\\u1C40-\\u1C7D\\u1C80-\\u1CBF\\u1CC8-\\u1CD2\\u1CD4-\\u1FFF\\u200B-\\u200F\\u202A-\\u202E\\u2044\\u2052\\u2060-\\u207C\\u207F-\\u208C\\u208F-\\u2307\\u230C-\\u2328\\u232B-\\u2767\\u2776-\\u27C4\\u27C7-\\u27E5\\u27F0-\\u2982\\u2999-\\u29D7\\u29DC-\\u29FB\\u29FE-\\u2CF8\\u2CFD\\u2D00-\\u2D6F\\u2D71-\\u2DFF\\u2E2F\\u2E50\\u2E51\\u2E5E-\\u2FFF\\u3004-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u303C\\u303E-\\u309F\\u30A1-\\u30FA\\u30FC-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA672\\uA674-\\uA67D\\uA67F-\\uA6F1\\uA6F8-\\uA873\\uA878-\\uA8CD\\uA8D0-\\uA8F7\\uA8FB\\uA8FD-\\uA92D\\uA930-\\uA95E\\uA960-\\uA9C0\\uA9CE-\\uA9DD\\uA9E0-\\uAA5B\\uAA60-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uABEA\\uABEC-\\uFD3D\\uFD40-\\uFE0F\\uFE1A-\\uFE2F\\uFE53\\uFE62\\uFE64-\\uFE67\\uFE69\\uFE6C-\\uFEFE\\uFF00\\uFF04\\uFF0B\\uFF10-\\uFF19\\uFF1C-\\uFF1E\\uFF21-\\uFF3A\\uFF3E\\uFF40-\\uFF5A\\uFF5C\\uFF5E\\uFF66-\\u{100FF}\\u{10103}-\\u{1039E}\\u{103A0}-\\u{103CF}\\u{103D1}-\\u{1056E}\\u{10570}-\\u{10856}\\u{10858}-\\u{1091E}\\u{10920}-\\u{1093E}\\u{10940}-\\u{10A4F}\\u{10A59}-\\u{10A7E}\\u{10A80}-\\u{10AEF}\\u{10AF7}-\\u{10B38}\\u{10B40}-\\u{10B98}\\u{10B9D}-\\u{10D6D}\\u{10D6F}-\\u{10EAC}\\u{10EAE}-\\u{10ECF}\\u{10ED1}-\\u{10F54}\\u{10F5A}-\\u{10F85}\\u{10F8A}-\\u{11046}\\u{1104E}-\\u{110BA}\\u{110BD}\\u{110C2}-\\u{1113F}\\u{11144}-\\u{11173}\\u{11176}-\\u{111C4}\\u{111C9}-\\u{111CC}\\u{111CE}-\\u{111DA}\\u{111DC}\\u{111E0}-\\u{11237}\\u{1123E}-\\u{112A8}\\u{112AA}-\\u{113D3}\\u{113D6}\\u{113D9}-\\u{1144A}\\u{11450}-\\u{11459}\\u{1145C}\\u{1145E}-\\u{114C5}\\u{114C7}-\\u{115C0}\\u{115D8}-\\u{11640}\\u{11644}-\\u{1165F}\\u{1166D}-\\u{116B8}\\u{116BA}-\\u{1173B}\\u{1173F}-\\u{1183A}\\u{1183C}-\\u{11943}\\u{11947}-\\u{119E1}\\u{119E3}-\\u{11A3E}\\u{11A47}-\\u{11A99}\\u{11A9D}\\u{11AA3}-\\u{11AFF}\\u{11B0A}-\\u{11BE0}\\u{11BE2}-\\u{11C40}\\u{11C46}-\\u{11C6F}\\u{11C72}-\\u{11EF6}\\u{11EF9}-\\u{11F42}\\u{11F50}-\\u{11FFE}\\u{12000}-\\u{1246F}\\u{12475}-\\u{12FF0}\\u{12FF3}-\\u{16A6D}\\u{16A70}-\\u{16AF4}\\u{16AF6}-\\u{16B36}\\u{16B3C}-\\u{16B43}\\u{16B45}-\\u{16D6C}\\u{16D70}-\\u{16E96}\\u{16E9B}-\\u{16FE1}\\u{16FE3}-\\u{1BC9E}\\u{1BCA0}-\\u{1DA86}\\u{1DA8C}-\\u{1E5FE}\\u{1E600}-\\u{1E95D}\\u{1E960}-\\u{10FFFF}])+|(?=\\p{L})[\\0-\\x08\\x0E-\\x1F!-\'\\*-;=\\?A-Z\\\\\\^-z\\|~-\\x9F\\xA1-\\u0F39\\u0F3E-\\u167F\\u1681-\\u169A\\u169D-\\u1FFF\\u200B-\\u2019\\u201B-\\u201D\\u201F-\\u2027\\u202A-\\u202E\\u2030-\\u2044\\u2047-\\u205E\\u2060-\\u207C\\u207F-\\u208C\\u208F-\\u2307\\u230C-\\u2328\\u232B-\\u2767\\u2776-\\u27C4\\u27C7-\\u27E5\\u27F0-\\u2982\\u2999-\\u29D7\\u29DC-\\u29FB\\u29FE-\\u2E21\\u2E2A-\\u2E41\\u2E43-\\u2E54\\u2E5D-\\u2FFF\\u3001-\\u3007\\u3012\\u3013\\u301C\\u3020-\\uFD3D\\uFD40-\\uFE16\\uFE19-\\uFE34\\uFE45\\uFE46\\uFE49-\\uFE58\\uFE5F-\\uFEFE\\uFF00-\\uFF07\\uFF0A-\\uFF3A\\uFF3C\\uFF3E-\\uFF5A\\uFF5C\\uFF5E\\uFF61\\uFF64-\\u{10FFFF}]+@([\\0-\\x08\\x0E-\\x1F\\$\\+\\x2D0-9=A-Z\\^`-z\\|~-\\x9F\\xA2-\\xA6\\xA8-\\xAA\\xAC-\\xB5\\xB8-\\xBA\\xBC-\\xBE\\xC0-\\u037D\\u037F-\\u0386\\u0388-\\u0559\\u0560-\\u0588\\u058B-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7-\\u05F2\\u05F5-\\u0608\\u060B\\u060E-\\u061A\\u061C\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06FF\\u070E-\\u07F6\\u07FA-\\u082F\\u083F-\\u085D\\u085F-\\u0963\\u0966-\\u096F\\u0971-\\u09FC\\u09FE-\\u0A75\\u0A77-\\u0AEF\\u0AF1-\\u0C76\\u0C78-\\u0C83\\u0C85-\\u0DF3\\u0DF5-\\u0E4E\\u0E50-\\u0E59\\u0E5C-\\u0F03\\u0F13\\u0F15-\\u0F39\\u0F3E-\\u0F84\\u0F86-\\u0FCF\\u0FD5-\\u0FD8\\u0FDB-\\u1049\\u1050-\\u10FA\\u10FC-\\u135F\\u1369-\\u13FF\\u1401-\\u166D\\u166F-\\u167F\\u1681-\\u169A\\u169D-\\u16EA\\u16EE-\\u1734\\u1737-\\u17D3\\u17D7\\u17DB-\\u17FF\\u180B-\\u1943\\u1946-\\u1A1D\\u1A20-\\u1A9F\\u1AA7\\u1AAE-\\u1B4D\\u1B50-\\u1B59\\u1B61-\\u1B7C\\u1B80-\\u1BFB\\u1C00-\\u1C3A\\u1C40-\\u1C7D\\u1C80-\\u1CBF\\u1CC8-\\u1CD2\\u1CD4-\\u1FFF\\u200B-\\u200F\\u202A-\\u202E\\u2044\\u2052\\u2060-\\u207C\\u207F-\\u208C\\u208F-\\u2307\\u230C-\\u2328\\u232B-\\u2767\\u2776-\\u27C4\\u27C7-\\u27E5\\u27F0-\\u2982\\u2999-\\u29D7\\u29DC-\\u29FB\\u29FE-\\u2CF8\\u2CFD\\u2D00-\\u2D6F\\u2D71-\\u2DFF\\u2E2F\\u2E50\\u2E51\\u2E5E-\\u2FFF\\u3004-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u303C\\u303E-\\u309F\\u30A1-\\u30FA\\u30FC-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA672\\uA674-\\uA67D\\uA67F-\\uA6F1\\uA6F8-\\uA873\\uA878-\\uA8CD\\uA8D0-\\uA8F7\\uA8FB\\uA8FD-\\uA92D\\uA930-\\uA95E\\uA960-\\uA9C0\\uA9CE-\\uA9DD\\uA9E0-\\uAA5B\\uAA60-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uABEA\\uABEC-\\uFD3D\\uFD40-\\uFE0F\\uFE1A-\\uFE2F\\uFE53\\uFE62\\uFE64-\\uFE67\\uFE69\\uFE6C-\\uFEFE\\uFF00\\uFF04\\uFF0B\\uFF10-\\uFF19\\uFF1C-\\uFF1E\\uFF21-\\uFF3A\\uFF3E\\uFF40-\\uFF5A\\uFF5C\\uFF5E\\uFF66-\\u{100FF}\\u{10103}-\\u{1039E}\\u{103A0}-\\u{103CF}\\u{103D1}-\\u{1056E}\\u{10570}-\\u{10856}\\u{10858}-\\u{1091E}\\u{10920}-\\u{1093E}\\u{10940}-\\u{10A4F}\\u{10A59}-\\u{10A7E}\\u{10A80}-\\u{10AEF}\\u{10AF7}-\\u{10B38}\\u{10B40}-\\u{10B98}\\u{10B9D}-\\u{10D6D}\\u{10D6F}-\\u{10EAC}\\u{10EAE}-\\u{10ECF}\\u{10ED1}-\\u{10F54}\\u{10F5A}-\\u{10F85}\\u{10F8A}-\\u{11046}\\u{1104E}-\\u{110BA}\\u{110BD}\\u{110C2}-\\u{1113F}\\u{11144}-\\u{11173}\\u{11176}-\\u{111C4}\\u{111C9}-\\u{111CC}\\u{111CE}-\\u{111DA}\\u{111DC}\\u{111E0}-\\u{11237}\\u{1123E}-\\u{112A8}\\u{112AA}-\\u{113D3}\\u{113D6}\\u{113D9}-\\u{1144A}\\u{11450}-\\u{11459}\\u{1145C}\\u{1145E}-\\u{114C5}\\u{114C7}-\\u{115C0}\\u{115D8}-\\u{11640}\\u{11644}-\\u{1165F}\\u{1166D}-\\u{116B8}\\u{116BA}-\\u{1173B}\\u{1173F}-\\u{1183A}\\u{1183C}-\\u{11943}\\u{11947}-\\u{119E1}\\u{119E3}-\\u{11A3E}\\u{11A47}-\\u{11A99}\\u{11A9D}\\u{11AA3}-\\u{11AFF}\\u{11B0A}-\\u{11BE0}\\u{11BE2}-\\u{11C40}\\u{11C46}-\\u{11C6F}\\u{11C72}-\\u{11EF6}\\u{11EF9}-\\u{11F42}\\u{11F50}-\\u{11FFE}\\u{12000}-\\u{1246F}\\u{12475}-\\u{12FF0}\\u{12FF3}-\\u{16A6D}\\u{16A70}-\\u{16AF4}\\u{16AF6}-\\u{16B36}\\u{16B3C}-\\u{16B43}\\u{16B45}-\\u{16D6C}\\u{16D70}-\\u{16E96}\\u{16E9B}-\\u{16FE1}\\u{16FE3}-\\u{1BC9E}\\u{1BCA0}-\\u{1DA86}\\u{1DA8C}-\\u{1E5FE}\\u{1E600}-\\u{1E95D}\\u{1E960}-\\u{10FFFF}]+(?:\\.[\\0-\\x08\\x0E-\\x1F\\$\\+\\x2D0-9=A-Z\\^`-z\\|~-\\x9F\\xA2-\\xA6\\xA8-\\xAA\\xAC-\\xB5\\xB8-\\xBA\\xBC-\\xBE\\xC0-\\u037D\\u037F-\\u0386\\u0388-\\u0559\\u0560-\\u0588\\u058B-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7-\\u05F2\\u05F5-\\u0608\\u060B\\u060E-\\u061A\\u061C\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06FF\\u070E-\\u07F6\\u07FA-\\u082F\\u083F-\\u085D\\u085F-\\u0963\\u0966-\\u096F\\u0971-\\u09FC\\u09FE-\\u0A75\\u0A77-\\u0AEF\\u0AF1-\\u0C76\\u0C78-\\u0C83\\u0C85-\\u0DF3\\u0DF5-\\u0E4E\\u0E50-\\u0E59\\u0E5C-\\u0F03\\u0F13\\u0F15-\\u0F39\\u0F3E-\\u0F84\\u0F86-\\u0FCF\\u0FD5-\\u0FD8\\u0FDB-\\u1049\\u1050-\\u10FA\\u10FC-\\u135F\\u1369-\\u13FF\\u1401-\\u166D\\u166F-\\u167F\\u1681-\\u169A\\u169D-\\u16EA\\u16EE-\\u1734\\u1737-\\u17D3\\u17D7\\u17DB-\\u17FF\\u180B-\\u1943\\u1946-\\u1A1D\\u1A20-\\u1A9F\\u1AA7\\u1AAE-\\u1B4D\\u1B50-\\u1B59\\u1B61-\\u1B7C\\u1B80-\\u1BFB\\u1C00-\\u1C3A\\u1C40-\\u1C7D\\u1C80-\\u1CBF\\u1CC8-\\u1CD2\\u1CD4-\\u1FFF\\u200B-\\u200F\\u202A-\\u202E\\u2044\\u2052\\u2060-\\u207C\\u207F-\\u208C\\u208F-\\u2307\\u230C-\\u2328\\u232B-\\u2767\\u2776-\\u27C4\\u27C7-\\u27E5\\u27F0-\\u2982\\u2999-\\u29D7\\u29DC-\\u29FB\\u29FE-\\u2CF8\\u2CFD\\u2D00-\\u2D6F\\u2D71-\\u2DFF\\u2E2F\\u2E50\\u2E51\\u2E5E-\\u2FFF\\u3004-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u303C\\u303E-\\u309F\\u30A1-\\u30FA\\u30FC-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA672\\uA674-\\uA67D\\uA67F-\\uA6F1\\uA6F8-\\uA873\\uA878-\\uA8CD\\uA8D0-\\uA8F7\\uA8FB\\uA8FD-\\uA92D\\uA930-\\uA95E\\uA960-\\uA9C0\\uA9CE-\\uA9DD\\uA9E0-\\uAA5B\\uAA60-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uABEA\\uABEC-\\uFD3D\\uFD40-\\uFE0F\\uFE1A-\\uFE2F\\uFE53\\uFE62\\uFE64-\\uFE67\\uFE69\\uFE6C-\\uFEFE\\uFF00\\uFF04\\uFF0B\\uFF10-\\uFF19\\uFF1C-\\uFF1E\\uFF21-\\uFF3A\\uFF3E\\uFF40-\\uFF5A\\uFF5C\\uFF5E\\uFF66-\\u{100FF}\\u{10103}-\\u{1039E}\\u{103A0}-\\u{103CF}\\u{103D1}-\\u{1056E}\\u{10570}-\\u{10856}\\u{10858}-\\u{1091E}\\u{10920}-\\u{1093E}\\u{10940}-\\u{10A4F}\\u{10A59}-\\u{10A7E}\\u{10A80}-\\u{10AEF}\\u{10AF7}-\\u{10B38}\\u{10B40}-\\u{10B98}\\u{10B9D}-\\u{10D6D}\\u{10D6F}-\\u{10EAC}\\u{10EAE}-\\u{10ECF}\\u{10ED1}-\\u{10F54}\\u{10F5A}-\\u{10F85}\\u{10F8A}-\\u{11046}\\u{1104E}-\\u{110BA}\\u{110BD}\\u{110C2}-\\u{1113F}\\u{11144}-\\u{11173}\\u{11176}-\\u{111C4}\\u{111C9}-\\u{111CC}\\u{111CE}-\\u{111DA}\\u{111DC}\\u{111E0}-\\u{11237}\\u{1123E}-\\u{112A8}\\u{112AA}-\\u{113D3}\\u{113D6}\\u{113D9}-\\u{1144A}\\u{11450}-\\u{11459}\\u{1145C}\\u{1145E}-\\u{114C5}\\u{114C7}-\\u{115C0}\\u{115D8}-\\u{11640}\\u{11644}-\\u{1165F}\\u{1166D}-\\u{116B8}\\u{116BA}-\\u{1173B}\\u{1173F}-\\u{1183A}\\u{1183C}-\\u{11943}\\u{11947}-\\u{119E1}\\u{119E3}-\\u{11A3E}\\u{11A47}-\\u{11A99}\\u{11A9D}\\u{11AA3}-\\u{11AFF}\\u{11B0A}-\\u{11BE0}\\u{11BE2}-\\u{11C40}\\u{11C46}-\\u{11C6F}\\u{11C72}-\\u{11EF6}\\u{11EF9}-\\u{11F42}\\u{11F50}-\\u{11FFE}\\u{12000}-\\u{1246F}\\u{12475}-\\u{12FF0}\\u{12FF3}-\\u{16A6D}\\u{16A70}-\\u{16AF4}\\u{16AF6}-\\u{16B36}\\u{16B3C}-\\u{16B43}\\u{16B45}-\\u{16D6C}\\u{16D70}-\\u{16E96}\\u{16E9B}-\\u{16FE1}\\u{16FE3}-\\u{1BC9E}\\u{1BCA0}-\\u{1DA86}\\u{1DA8C}-\\u{1E5FE}\\u{1E600}-\\u{1E95D}\\u{1E960}-\\u{10FFFF}]+)+)/gmu;\n const [normalizedText, diffs] = normalize(text, {\n ignoreDashEOL: true\n });\n const matches = normalizedText.matchAll(this.#regex);\n const links = [];\n for (const match of matches) {\n const [url, emailDomain] = match;\n let raw;\n if (url.startsWith("www.") || url.startsWith("http://") || url.startsWith("https://")) {\n raw = url;\n } else if (emailDomain) {\n const hostname = URL.parse(`http://${emailDomain}`)?.hostname;\n if (!hostname) {\n continue;\n }\n this.#numericTLDRegex ??= /\\.\\d+$/;\n if (this.#numericTLDRegex.test(hostname)) {\n continue;\n }\n }\n raw ??= url.startsWith("mailto:") ? url : `mailto:${url}`;\n const absoluteURL = createValidAbsoluteUrl(raw, null, {\n addDefaultProtocol: true\n });\n if (absoluteURL) {\n const [index, length] = getOriginalIndex(diffs, match.index, url.length);\n links.push({\n url: absoluteURL.href,\n index,\n length\n });\n }\n }\n return links;\n }\n static processLinks(pdfPageView) {\n return this.findLinks(pdfPageView._textHighlighter.textContentItemsStr.join("\\n")).map(link => createLinkAnnotation(link, pdfPageView, this.#index++));\n }\n}\n\n;// ./web/base_pdf_page_view.js\n\n\nclass BasePDFPageView extends RenderableView {\n #loadingId = null;\n #renderError = null;\n #renderingState = RenderingStates.INITIAL;\n #showCanvas = null;\n #startTime = 0;\n #tempCanvas = null;\n canvas = null;\n div = null;\n enableOptimizedPartialRendering = false;\n eventBus = null;\n id = null;\n pageColors = null;\n recordedBBoxes = null;\n renderingQueue = null;\n constructor(options) {\n super();\n this.eventBus = options.eventBus;\n this.id = options.id;\n this.pageColors = options.pageColors || null;\n this.renderingQueue = options.renderingQueue;\n this.enableOptimizedPartialRendering = options.enableOptimizedPartialRendering ?? false;\n this.minDurationToUpdateCanvas = options.minDurationToUpdateCanvas ?? 500;\n }\n get renderingState() {\n return this.#renderingState;\n }\n set renderingState(state) {\n if (state === this.#renderingState) {\n return;\n }\n this.#renderingState = state;\n if (this.#loadingId) {\n clearTimeout(this.#loadingId);\n this.#loadingId = null;\n }\n switch (state) {\n case RenderingStates.PAUSED:\n this.div.classList.remove("loading");\n this.#startTime = 0;\n this.#showCanvas?.(false);\n break;\n case RenderingStates.RUNNING:\n this.div.classList.add("loadingIcon");\n this.#loadingId = setTimeout(() => {\n this.div.classList.add("loading");\n this.#loadingId = null;\n }, 0);\n this.#startTime = Date.now();\n break;\n case RenderingStates.INITIAL:\n case RenderingStates.FINISHED:\n this.div.classList.remove("loadingIcon", "loading");\n this.#startTime = 0;\n break;\n }\n }\n _createCanvas(onShow, hideUntilComplete = false) {\n const {\n pageColors\n } = this;\n const hasHCM = !!(pageColors?.background && pageColors?.foreground);\n const prevCanvas = this.canvas;\n const updateOnFirstShow = !prevCanvas && !hasHCM && !hideUntilComplete;\n let canvas = this.canvas = document.createElement("canvas");\n this.#showCanvas = isLastShow => {\n if (updateOnFirstShow) {\n let tempCanvas = this.#tempCanvas;\n if (!isLastShow && this.minDurationToUpdateCanvas > 0) {\n if (Date.now() - this.#startTime < this.minDurationToUpdateCanvas) {\n return;\n }\n if (!tempCanvas) {\n tempCanvas = this.#tempCanvas = canvas;\n canvas = this.canvas = canvas.cloneNode(false);\n onShow(canvas);\n }\n }\n if (tempCanvas) {\n const ctx = canvas.getContext("2d", {\n alpha: false\n });\n ctx.drawImage(tempCanvas, 0, 0);\n if (isLastShow) {\n this.#resetTempCanvas();\n } else {\n this.#startTime = Date.now();\n }\n return;\n }\n onShow(canvas);\n this.#showCanvas = null;\n return;\n }\n if (!isLastShow) {\n return;\n }\n if (prevCanvas) {\n prevCanvas.replaceWith(canvas);\n prevCanvas.width = prevCanvas.height = 0;\n } else {\n onShow(canvas);\n }\n };\n return {\n canvas,\n prevCanvas\n };\n }\n #renderContinueCallback = cont => {\n this.#showCanvas?.(false);\n if (this.renderingQueue && !this.renderingQueue.isHighestPriority(this)) {\n this.renderingState = RenderingStates.PAUSED;\n this.resume = () => {\n this.renderingState = RenderingStates.RUNNING;\n cont();\n };\n return;\n }\n cont();\n };\n _resetCanvas() {\n const {\n canvas\n } = this;\n if (!canvas) {\n return;\n }\n canvas.remove();\n canvas.width = canvas.height = 0;\n this.canvas = null;\n this.#resetTempCanvas();\n }\n #resetTempCanvas() {\n if (this.#tempCanvas) {\n this.#tempCanvas.width = this.#tempCanvas.height = 0;\n this.#tempCanvas = null;\n }\n }\n async _drawCanvas(options, onCancel, onFinish) {\n const renderTask = this.renderTask = this.pdfPage.render(options);\n renderTask.onContinue = this.#renderContinueCallback;\n renderTask.onError = error => {\n if (error instanceof RenderingCancelledException) {\n onCancel();\n this.#renderError = null;\n }\n };\n let error = null;\n try {\n await renderTask.promise;\n this.#showCanvas?.(true);\n } catch (e) {\n if (e instanceof RenderingCancelledException) {\n return;\n }\n error = e;\n this.#showCanvas?.(true);\n } finally {\n this.#renderError = error;\n if (renderTask === this.renderTask) {\n this.renderTask = null;\n if (this.enableOptimizedPartialRendering) {\n this.recordedBBoxes ??= renderTask.recordedBBoxes;\n }\n }\n }\n this.renderingState = RenderingStates.FINISHED;\n onFinish(renderTask);\n if (error) {\n throw error;\n }\n }\n cancelRendering({\n cancelExtraDelay = 0\n } = {}) {\n if (this.renderTask) {\n this.renderTask.cancel(cancelExtraDelay);\n this.renderTask = null;\n }\n this.resume = null;\n }\n dispatchPageRender() {\n this.eventBus.dispatch("pagerender", {\n source: this,\n pageNumber: this.id\n });\n }\n dispatchPageRendered(cssTransform, isDetailView) {\n this.eventBus.dispatch("pagerendered", {\n source: this,\n pageNumber: this.id,\n cssTransform,\n isDetailView,\n timestamp: performance.now(),\n error: this.#renderError\n });\n }\n}\n\n;// ./web/draw_layer_builder.js\n\nclass DrawLayerBuilder {\n #drawLayer = null;\n async render({\n intent = "display"\n }) {\n if (intent !== "display" || this.#drawLayer || this._cancelled) {\n return;\n }\n this.#drawLayer = new DrawLayer();\n }\n cancel() {\n this._cancelled = true;\n if (!this.#drawLayer) {\n return;\n }\n this.#drawLayer.destroy();\n this.#drawLayer = null;\n }\n setParent(parent) {\n this.#drawLayer?.setParent(parent);\n }\n getDrawLayer() {\n return this.#drawLayer;\n }\n}\n\n;// ./web/pdf_page_detail_view.js\n\n\n\nclass PDFPageDetailView extends BasePDFPageView {\n #detailArea = null;\n renderingCancelled = false;\n constructor({\n pageView\n }) {\n super(pageView);\n this.pageView = pageView;\n this.renderingId = "detail" + this.id;\n this.div = pageView.div;\n }\n setPdfPage(pdfPage) {\n this.pageView.setPdfPage(pdfPage);\n }\n get pdfPage() {\n return this.pageView.pdfPage;\n }\n get renderingState() {\n return super.renderingState;\n }\n set renderingState(state) {\n this.renderingCancelled = false;\n super.renderingState = state;\n }\n reset({\n keepCanvas = false\n } = {}) {\n const renderingCancelled = this.renderingCancelled || this.renderingState === RenderingStates.RUNNING || this.renderingState === RenderingStates.PAUSED;\n this.cancelRendering();\n this.renderingState = RenderingStates.INITIAL;\n this.renderingCancelled = renderingCancelled;\n if (!keepCanvas) {\n this._resetCanvas();\n }\n }\n #shouldRenderDifferentArea(visibleArea) {\n if (!this.#detailArea) {\n return true;\n }\n const minDetailX = this.#detailArea.minX;\n const minDetailY = this.#detailArea.minY;\n const maxDetailX = this.#detailArea.width + minDetailX;\n const maxDetailY = this.#detailArea.height + minDetailY;\n if (visibleArea.minX < minDetailX || visibleArea.minY < minDetailY || visibleArea.maxX > maxDetailX || visibleArea.maxY > maxDetailY) {\n return true;\n }\n const {\n width: maxWidth,\n height: maxHeight,\n scale\n } = this.pageView.viewport;\n if (this.#detailArea.scale !== scale) {\n return true;\n }\n const paddingLeftSize = visibleArea.minX - minDetailX;\n const paddingRightSize = maxDetailX - visibleArea.maxX;\n const paddingTopSize = visibleArea.minY - minDetailY;\n const paddingBottomSize = maxDetailY - visibleArea.maxY;\n const MOVEMENT_THRESHOLD = 0.5;\n const ratio = (1 + MOVEMENT_THRESHOLD) / MOVEMENT_THRESHOLD;\n if (minDetailX > 0 && paddingRightSize / paddingLeftSize > ratio || maxDetailX < maxWidth && paddingLeftSize / paddingRightSize > ratio || minDetailY > 0 && paddingBottomSize / paddingTopSize > ratio || maxDetailY < maxHeight && paddingTopSize / paddingBottomSize > ratio) {\n return true;\n }\n return false;\n }\n update({\n visibleArea = null,\n underlyingViewUpdated = false\n } = {}) {\n if (underlyingViewUpdated) {\n this.cancelRendering();\n this.renderingState = RenderingStates.INITIAL;\n return;\n }\n if (!this.#shouldRenderDifferentArea(visibleArea)) {\n return;\n }\n const {\n viewport,\n maxCanvasPixels,\n capCanvasAreaFactor\n } = this.pageView;\n const visibleWidth = visibleArea.maxX - visibleArea.minX;\n const visibleHeight = visibleArea.maxY - visibleArea.minY;\n const visiblePixels = visibleWidth * visibleHeight * OutputScale.pixelRatio ** 2;\n const maxDetailToVisibleLinearRatio = Math.sqrt(OutputScale.capPixels(maxCanvasPixels, capCanvasAreaFactor) / visiblePixels);\n const maxOverflowScale = (maxDetailToVisibleLinearRatio - 1) / 2;\n let overflowScale = Math.min(1, maxOverflowScale);\n if (overflowScale < 0) {\n overflowScale = 0;\n }\n const overflowWidth = visibleWidth * overflowScale;\n const overflowHeight = visibleHeight * overflowScale;\n const minX = Math.max(0, visibleArea.minX - overflowWidth);\n const maxX = Math.min(viewport.width, visibleArea.maxX + overflowWidth);\n const minY = Math.max(0, visibleArea.minY - overflowHeight);\n const maxY = Math.min(viewport.height, visibleArea.maxY + overflowHeight);\n const width = maxX - minX;\n const height = maxY - minY;\n this.#detailArea = {\n minX,\n minY,\n width,\n height,\n scale: viewport.scale\n };\n this.reset({\n keepCanvas: true\n });\n }\n _getRenderingContext(canvas, transform) {\n const baseContext = this.pageView._getRenderingContext(canvas, transform, false);\n const recordedBBoxes = this.pdfPage.recordedBBoxes;\n if (!recordedBBoxes || !this.enableOptimizedPartialRendering) {\n return baseContext;\n }\n const {\n viewport: {\n width: vWidth,\n height: vHeight\n }\n } = this.pageView;\n const {\n width: aWidth,\n height: aHeight,\n minX: aMinX,\n minY: aMinY\n } = this.#detailArea;\n const detailMinX = aMinX / vWidth;\n const detailMinY = aMinY / vHeight;\n const detailMaxX = (aMinX + aWidth) / vWidth;\n const detailMaxY = (aMinY + aHeight) / vHeight;\n return {\n ...baseContext,\n operationsFilter(index) {\n if (recordedBBoxes.isEmpty(index)) {\n return false;\n }\n return recordedBBoxes.minX(index) <= detailMaxX && recordedBBoxes.maxX(index) >= detailMinX && recordedBBoxes.minY(index) <= detailMaxY && recordedBBoxes.maxY(index) >= detailMinY;\n }\n };\n }\n async draw() {\n if (this.pageView.detailView !== this) {\n return undefined;\n }\n const hideUntilComplete = this.pageView.renderingState === RenderingStates.FINISHED || this.renderingState === RenderingStates.FINISHED;\n if (this.renderingState !== RenderingStates.INITIAL) {\n console.error("Must be in new state before drawing");\n this.reset();\n }\n const {\n div,\n pdfPage,\n viewport\n } = this.pageView;\n if (!pdfPage) {\n this.renderingState = RenderingStates.FINISHED;\n throw new Error("pdfPage is not loaded");\n }\n this.renderingState = RenderingStates.RUNNING;\n const canvasWrapper = this.pageView._ensureCanvasWrapper();\n const {\n canvas,\n prevCanvas\n } = this._createCanvas(newCanvas => {\n if (canvasWrapper.firstElementChild?.tagName === "CANVAS") {\n canvasWrapper.firstElementChild.after(newCanvas);\n } else {\n canvasWrapper.prepend(newCanvas);\n }\n }, hideUntilComplete);\n canvas.ariaHidden = true;\n if (this.enableOptimizedPartialRendering) {\n canvas.className = "detailView";\n }\n const {\n width,\n height\n } = viewport;\n const area = this.#detailArea;\n const {\n pixelRatio\n } = OutputScale;\n const transform = [pixelRatio, 0, 0, pixelRatio, -area.minX * pixelRatio, -area.minY * pixelRatio];\n canvas.width = area.width * pixelRatio;\n canvas.height = area.height * pixelRatio;\n const {\n style\n } = canvas;\n style.width = `${area.width * 100 / width}%`;\n style.height = `${area.height * 100 / height}%`;\n style.top = `${area.minY * 100 / height}%`;\n style.left = `${area.minX * 100 / width}%`;\n const renderingPromise = this._drawCanvas(this._getRenderingContext(canvas, transform), () => {\n this.canvas?.remove();\n this.canvas = prevCanvas;\n }, () => {\n this.dispatchPageRendered(false, true);\n });\n div.setAttribute("data-loaded", true);\n this.dispatchPageRender();\n return renderingPromise;\n }\n}\n\n;// ./web/struct_tree_layer_builder.js\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst PDF_ROLE_TO_HTML_ROLE = {\n Document: null,\n DocumentFragment: null,\n Part: "group",\n Sect: "group",\n Div: "group",\n Aside: "note",\n NonStruct: "none",\n P: null,\n H: "heading",\n Title: null,\n FENote: "note",\n Sub: "group",\n Lbl: null,\n Span: null,\n Em: null,\n Strong: null,\n Link: "link",\n Annot: "note",\n Form: "form",\n Ruby: null,\n RB: null,\n RT: null,\n RP: null,\n Warichu: null,\n WT: null,\n WP: null,\n L: "list",\n LI: "listitem",\n LBody: null,\n Table: "table",\n TR: "row",\n TH: "columnheader",\n TD: "cell",\n THead: "rowgroup",\n TBody: "rowgroup",\n TFoot: null,\n Caption: null,\n Figure: "figure",\n Formula: null,\n Artifact: null\n};\nconst MathMLElements = new Set(["math", "merror", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics"]);\nconst MathMLNamespace = "http://www.w3.org/1998/Math/MathML";\nclass MathMLSanitizer {\n static get sanitizer() {\n return shadow(this, "sanitizer", FeatureTest.isSanitizerSupported ? new Sanitizer({\n elements: [...MathMLElements].map(name => ({\n name,\n namespace: MathMLNamespace\n })),\n replaceWithChildrenElements: [{\n name: "maction",\n namespace: MathMLNamespace\n }],\n attributes: ["dir", "displaystyle", "mathbackground", "mathcolor", "mathsize", "scriptlevel", "encoding", "display", "linethickness", "intent", "arg", "form", "fence", "separator", "lspace", "rspace", "stretchy", "symmetric", "maxsize", "minsize", "largeop", "movablelimits", "width", "height", "depth", "voffset", "accent", "accentunder", "columnspan", "rowspan"],\n comments: false\n }) : null);\n }\n}\nconst HEADING_PATTERN = /^H(\\d+)$/;\nclass StructTreeLayerBuilder {\n #promise;\n #treeDom = null;\n #treePromise;\n #elementAttributes = new Map();\n #rawDims;\n #elementsToAddToTextLayer = null;\n #elementsToHideInTextLayer = null;\n #elementsToStealFromTextLayer = null;\n constructor(pdfPage, rawDims) {\n this.#promise = pdfPage.getStructTree();\n this.#rawDims = rawDims;\n }\n async render() {\n if (this.#treePromise) {\n return this.#treePromise;\n }\n const {\n promise,\n resolve,\n reject\n } = Promise.withResolvers();\n this.#treePromise = promise;\n try {\n this.#treeDom = this.#walk(await this.#promise);\n } catch (ex) {\n reject(ex);\n }\n this.#promise = null;\n this.#treeDom?.classList.add("structTree");\n resolve(this.#treeDom);\n return promise;\n }\n async getAriaAttributes(annotationId) {\n try {\n await this.render();\n return this.#elementAttributes.get(annotationId);\n } catch {}\n return null;\n }\n hide() {\n if (this.#treeDom && !this.#treeDom.hidden) {\n this.#treeDom.hidden = true;\n }\n }\n show() {\n if (this.#treeDom?.hidden) {\n this.#treeDom.hidden = false;\n }\n }\n #setAttributes(structElement, htmlElement) {\n const {\n alt,\n id,\n lang\n } = structElement;\n if (alt !== undefined) {\n let added = false;\n const label = removeNullCharacters(alt);\n for (const child of structElement.children) {\n if (child.type === "annotation") {\n this.#elementAttributes.getOrInsertComputed(child.id, makeMap).set("aria-label", label);\n added = true;\n }\n }\n if (!added) {\n htmlElement.setAttribute("aria-label", label);\n }\n }\n if (id !== undefined) {\n htmlElement.setAttribute("aria-owns", id);\n }\n if (lang !== undefined) {\n htmlElement.setAttribute("lang", removeNullCharacters(lang, true));\n }\n }\n #addImageInTextLayer(node, element) {\n const {\n alt,\n bbox,\n children\n } = node;\n const child = children?.[0];\n if (!this.#rawDims || !alt || !bbox || child?.type !== "content") {\n return false;\n }\n const {\n id\n } = child;\n if (!id) {\n return false;\n }\n element.setAttribute("aria-owns", id);\n const img = document.createElement("span");\n (this.#elementsToAddToTextLayer ||= new Map()).set(id, img);\n img.setAttribute("role", "img");\n img.setAttribute("aria-label", removeNullCharacters(alt));\n const {\n pageHeight,\n pageX,\n pageY\n } = this.#rawDims;\n const calc = "calc(var(--total-scale-factor) *";\n const {\n style\n } = img;\n style.width = `${calc}${bbox[2] - bbox[0]}px)`;\n style.height = `${calc}${bbox[3] - bbox[1]}px)`;\n style.left = `${calc}${bbox[0] - pageX}px)`;\n style.top = `${calc}${pageHeight - bbox[3] + pageY}px)`;\n return true;\n }\n updateTextLayer() {\n if (this.#elementsToAddToTextLayer) {\n for (const [id, img] of this.#elementsToAddToTextLayer) {\n document.getElementById(id)?.append(img);\n }\n this.#elementsToAddToTextLayer.clear();\n this.#elementsToAddToTextLayer = null;\n }\n if (this.#elementsToHideInTextLayer) {\n for (const id of this.#elementsToHideInTextLayer) {\n const elem = document.getElementById(id);\n if (elem) {\n elem.ariaHidden = true;\n }\n }\n this.#elementsToHideInTextLayer.length = 0;\n this.#elementsToHideInTextLayer = null;\n }\n if (this.#elementsToStealFromTextLayer) {\n for (let i = 0, ii = this.#elementsToStealFromTextLayer.length; i < ii; i += 2) {\n const element = this.#elementsToStealFromTextLayer[i];\n const ids = this.#elementsToStealFromTextLayer[i + 1];\n let textContent = "";\n for (const id of ids) {\n const elem = document.getElementById(id);\n if (elem) {\n textContent += elem.textContent.trim() || "";\n elem.ariaHidden = "true";\n }\n }\n if (textContent) {\n element.textContent = textContent;\n }\n }\n this.#elementsToStealFromTextLayer.length = 0;\n this.#elementsToStealFromTextLayer = null;\n }\n }\n #walk(node, parentNodes = []) {\n if (!node) {\n return null;\n }\n let element;\n if ("role" in node) {\n const {\n role\n } = node;\n if (MathMLElements.has(role)) {\n element = document.createElementNS(MathMLNamespace, role);\n const ids = [];\n (this.#elementsToStealFromTextLayer ||= []).push(element, ids);\n for (const {\n type,\n id\n } of node.children || []) {\n if (type === "content" && id) {\n ids.push(id);\n }\n }\n } else {\n element = document.createElement("span");\n }\n const match = role.match(HEADING_PATTERN);\n if (match) {\n element.setAttribute("role", "heading");\n element.setAttribute("aria-level", match[1]);\n } else if (PDF_ROLE_TO_HTML_ROLE[role]) {\n element.setAttribute("role", role === "TH" && parentNodes.at(-1)?.role === "TR" && parentNodes.at(-2)?.role === "TBody" ? "rowheader" : PDF_ROLE_TO_HTML_ROLE[role]);\n }\n if (role === "Figure" && this.#addImageInTextLayer(node, element)) {\n return element;\n }\n if (role === "Formula") {\n if (node.mathML && MathMLSanitizer.sanitizer) {\n element.setHTML(node.mathML, {\n sanitizer: MathMLSanitizer.sanitizer\n });\n for (const {\n id\n } of node.children || []) {\n if (!id) {\n continue;\n }\n (this.#elementsToHideInTextLayer ||= []).push(id);\n }\n delete node.alt;\n }\n if (!node.mathML && node.children.length === 1 && node.children[0].role !== "math") {\n element = document.createElementNS(MathMLNamespace, "math");\n delete node.alt;\n }\n }\n }\n element ||= document.createElement("span");\n this.#setAttributes(node, element);\n if (node.children) {\n if (node.children.length === 1 && "id" in node.children[0]) {\n this.#setAttributes(node.children[0], element);\n } else {\n parentNodes.push(node);\n for (const kid of node.children) {\n element.append(this.#walk(kid, parentNodes));\n }\n parentNodes.pop();\n }\n }\n return element;\n }\n}\n\n;// ./web/text_accessibility.js\n\n\n\n\n\nclass TextAccessibilityManager {\n #enabled = false;\n #textChildren = null;\n #textNodes = new Map();\n #waitingElements = new Map();\n setTextMapping(textDivs) {\n this.#textChildren = textDivs;\n }\n static #compareElementPositions(e1, e2) {\n const rect1 = e1.getBoundingClientRect();\n const rect2 = e2.getBoundingClientRect();\n if (rect1.width === 0 && rect1.height === 0) {\n return +1;\n }\n if (rect2.width === 0 && rect2.height === 0) {\n return -1;\n }\n const top1 = rect1.y;\n const bot1 = rect1.y + rect1.height;\n const mid1 = rect1.y + rect1.height / 2;\n const top2 = rect2.y;\n const bot2 = rect2.y + rect2.height;\n const mid2 = rect2.y + rect2.height / 2;\n if (mid1 <= top2 && mid2 >= bot1) {\n return -1;\n }\n if (mid2 <= top1 && mid1 >= bot2) {\n return +1;\n }\n const centerX1 = rect1.x + rect1.width / 2;\n const centerX2 = rect2.x + rect2.width / 2;\n return centerX1 - centerX2;\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 this.#enabled = true;\n this.#textChildren = this.#textChildren.slice();\n this.#textChildren.sort(TextAccessibilityManager.#compareElementPositions);\n if (this.#textNodes.size > 0) {\n const textChildren = this.#textChildren;\n for (const [id, nodeIndex] of this.#textNodes) {\n const element = document.getElementById(id);\n if (!element) {\n this.#textNodes.delete(id);\n continue;\n }\n this.#addIdToAriaOwns(id, textChildren[nodeIndex]);\n }\n }\n for (const [element, isRemovable] of this.#waitingElements) {\n this.addPointerInTextLayer(element, isRemovable);\n }\n this.#waitingElements.clear();\n }\n disable() {\n if (!this.#enabled) {\n return;\n }\n this.#waitingElements.clear();\n this.#textChildren = null;\n this.#enabled = false;\n }\n removePointerInTextLayer(element) {\n if (!this.#enabled) {\n this.#waitingElements.delete(element);\n return;\n }\n const children = this.#textChildren;\n if (!children || children.length === 0) {\n return;\n }\n const {\n id\n } = element;\n const nodeIndex = this.#textNodes.get(id);\n if (nodeIndex === undefined) {\n return;\n }\n const node = children[nodeIndex];\n this.#textNodes.delete(id);\n let owns = node.getAttribute("aria-owns");\n if (owns?.includes(id)) {\n owns = owns.split(" ").filter(x => x !== id).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 #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 addPointerInTextLayer(element, isRemovable) {\n const {\n id\n } = element;\n if (!id) {\n return null;\n }\n if (!this.#enabled) {\n this.#waitingElements.set(element, isRemovable);\n return null;\n }\n if (isRemovable) {\n this.removePointerInTextLayer(element);\n }\n const children = this.#textChildren;\n if (!children || children.length === 0) {\n return null;\n }\n const index = binarySearchFirstItem(children, node => TextAccessibilityManager.#compareElementPositions(element, node) < 0);\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 const parent = child.parentNode;\n return parent?.classList.contains("markedContent") ? parent.id : null;\n }\n moveElementInDOM(container, element, contentElement, isRemovable) {\n const id = this.addPointerInTextLayer(contentElement, isRemovable);\n if (!container.hasChildNodes()) {\n container.append(element);\n return id;\n }\n const children = Array.from(container.childNodes).filter(node => node !== element);\n if (children.length === 0) {\n return id;\n }\n const index = binarySearchFirstItem(children, node => TextAccessibilityManager.#compareElementPositions(element, node) < 0);\n if (index === 0) {\n children[0].before(element);\n } else {\n children[index - 1].after(element);\n }\n return id;\n }\n}\n\n;// ./web/text_highlighter.js\n\nclass TextHighlighter {\n #eventAbortController = null;\n constructor({\n findController,\n eventBus,\n pageIndex\n }) {\n this.findController = findController;\n this.matches = [];\n this.eventBus = eventBus;\n this.pageIdx = pageIndex;\n this.textDivs = null;\n this.textContentItemsStr = null;\n this.enabled = false;\n }\n setTextMapping(divs, texts) {\n this.textDivs = divs;\n this.textContentItemsStr = texts;\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.#eventAbortController) {\n this.#eventAbortController = new AbortController();\n this.eventBus._on("updatetextlayermatches", evt => {\n if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) {\n this._updateMatches();\n }\n }, {\n signal: this.#eventAbortController.signal\n });\n }\n this._updateMatches();\n }\n disable() {\n if (!this.enabled) {\n return;\n }\n this.enabled = false;\n this.#eventAbortController?.abort();\n this.#eventAbortController = null;\n this._updateMatches(true);\n }\n _convertMatches(matches, matchesLength) {\n if (!matches) {\n return [];\n }\n const {\n textContentItemsStr\n } = this;\n let i = 0,\n iIndex = 0;\n const end = textContentItemsStr.length - 1;\n const result = [];\n for (let m = 0, mm = matches.length; m < mm; m++) {\n let matchIdx = matches[m];\n while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) {\n iIndex += textContentItemsStr[i].length;\n i++;\n }\n if (i === textContentItemsStr.length) {\n console.error("Could not find a matching mapping");\n }\n const match = {\n begin: {\n divIdx: i,\n offset: matchIdx - iIndex\n }\n };\n matchIdx += matchesLength[m];\n while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) {\n iIndex += textContentItemsStr[i].length;\n i++;\n }\n match.end = {\n divIdx: i,\n offset: matchIdx - iIndex\n };\n result.push(match);\n }\n return result;\n }\n _renderMatches(matches) {\n if (matches.length === 0) {\n return;\n }\n const {\n findController,\n pageIdx\n } = this;\n const {\n textContentItemsStr,\n textDivs\n } = this;\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 function beginText(begin, className) {\n const divIdx = begin.divIdx;\n textDivs[divIdx].textContent = "";\n return appendTextToDiv(divIdx, 0, begin.offset, className);\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(fromOffset, toOffset);\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 if (className.includes("selected")) {\n const {\n left\n } = span.getClientRects()[0];\n const parentLeft = div.getBoundingClientRect().left;\n return left - parentLeft;\n }\n return 0;\n }\n div.append(node);\n return 0;\n }\n let i0 = selectedMatchIdx,\n i1 = i0 + 1;\n if (highlightAll) {\n i0 = 0;\n i1 = matches.length;\n } else if (!isSelectedPage) {\n return;\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 continue;\n }\n lastDivIdx = begin.divIdx;\n lastOffset = begin.offset;\n const end = match.end;\n const isSelected = isSelectedPage && i === selectedMatchIdx;\n const highlightSuffix = isSelected ? " selected" : "";\n let selectedLeft = 0;\n if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {\n if (prevEnd !== null) {\n appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);\n }\n beginText(begin);\n } else {\n appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);\n }\n if (begin.divIdx === end.divIdx) {\n selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, end.offset, "highlight" + highlightSuffix);\n } else {\n selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, infinity.offset, "highlight begin" + highlightSuffix);\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 if (isSelected) {\n findController.scrollMatchIntoView({\n element: textDivs[begin.divIdx],\n selectedLeft,\n pageIndex: pageIdx,\n matchIndex: selectedMatchIdx\n });\n }\n }\n if (prevEnd) {\n appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);\n }\n }\n _updateMatches(reset = false) {\n if (!this.enabled && !reset) {\n return;\n }\n const {\n findController,\n matches,\n pageIdx\n } = this;\n const {\n textContentItemsStr,\n textDivs\n } = this;\n let clearedUntilDivIdx = -1;\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 if (!findController?.highlightMatches || reset) {\n return;\n }\n const pageMatches = findController.pageMatches[pageIdx] || null;\n const pageMatchesLength = findController.pageMatchesLength[pageIdx] || null;\n this.matches = this._convertMatches(pageMatches, pageMatchesLength);\n this._renderMatches(this.matches);\n }\n}\n\n;// ./web/text_layer_builder.js\n\n\n\n\n\n\n\n\n\n\n\n\n\nclass TextLayerBuilder {\n #enablePermissions = false;\n #onAppend = null;\n #renderingDone = false;\n #textLayer = null;\n static #textLayers = new Map();\n static #selectionChangeAbortController = null;\n constructor({\n pdfPage,\n highlighter = null,\n accessibilityManager = null,\n enablePermissions = false,\n onAppend = null\n }) {\n this.pdfPage = pdfPage;\n this.highlighter = highlighter;\n this.accessibilityManager = accessibilityManager;\n this.#enablePermissions = enablePermissions === true;\n this.#onAppend = onAppend;\n this.div = document.createElement("div");\n this.div.tabIndex = 0;\n this.div.className = "textLayer";\n }\n async render({\n viewport,\n textContentParams = null\n }) {\n if (this.#renderingDone && this.#textLayer) {\n this.#textLayer.update({\n viewport,\n onBefore: this.hide.bind(this)\n });\n this.show();\n return;\n }\n this.cancel();\n this.#textLayer = new TextLayer({\n textContentSource: this.pdfPage.streamTextContent(textContentParams || {\n includeMarkedContent: true,\n disableNormalization: true\n }),\n container: this.div,\n viewport\n });\n const {\n textDivs,\n textContentItemsStr\n } = this.#textLayer;\n this.highlighter?.setTextMapping(textDivs, textContentItemsStr);\n this.accessibilityManager?.setTextMapping(textDivs);\n await this.#textLayer.render();\n this.#renderingDone = true;\n const endOfContent = document.createElement("div");\n endOfContent.className = "endOfContent";\n this.div.append(endOfContent);\n this.#bindMouse(endOfContent);\n this.#onAppend?.(this.div);\n this.highlighter?.enable();\n this.accessibilityManager?.enable();\n }\n hide() {\n if (!this.div.hidden && this.#renderingDone) {\n this.highlighter?.disable();\n this.div.hidden = true;\n }\n }\n show() {\n if (this.div.hidden && this.#renderingDone) {\n this.div.hidden = false;\n this.highlighter?.enable();\n }\n }\n cancel() {\n this.#textLayer?.cancel();\n this.#textLayer = null;\n this.highlighter?.disable();\n this.accessibilityManager?.disable();\n TextLayerBuilder.#removeGlobalSelectionListener(this.div);\n }\n #bindMouse(end) {\n const {\n div\n } = this;\n div.addEventListener("mousedown", () => {\n div.classList.add("selecting");\n });\n div.addEventListener("copy", event => {\n if (!this.#enablePermissions) {\n const selection = document.getSelection();\n event.clipboardData.setData("text/plain", removeNullCharacters(normalizeUnicode(selection.toString())));\n }\n stopEvent(event);\n });\n TextLayerBuilder.#textLayers.set(div, end);\n TextLayerBuilder.#enableGlobalSelectionListener();\n }\n static #removeGlobalSelectionListener(textLayerDiv) {\n this.#textLayers.delete(textLayerDiv);\n if (this.#textLayers.size === 0) {\n this.#selectionChangeAbortController?.abort();\n this.#selectionChangeAbortController = null;\n }\n }\n static #enableGlobalSelectionListener() {\n if (this.#selectionChangeAbortController) {\n return;\n }\n this.#selectionChangeAbortController = new AbortController();\n const {\n signal\n } = this.#selectionChangeAbortController;\n const reset = (end, textLayer) => {\n textLayer.append(end);\n end.style.width = "";\n end.style.height = "";\n textLayer.classList.remove("selecting");\n };\n let isPointerDown = false;\n document.addEventListener("pointerdown", () => {\n isPointerDown = true;\n }, {\n signal\n });\n document.addEventListener("pointerup", () => {\n isPointerDown = false;\n this.#textLayers.forEach(reset);\n }, {\n signal\n });\n window.addEventListener("blur", () => {\n isPointerDown = false;\n this.#textLayers.forEach(reset);\n }, {\n signal\n });\n document.addEventListener("keyup", () => {\n if (!isPointerDown) {\n this.#textLayers.forEach(reset);\n }\n }, {\n signal\n });\n var isFirefox, prevRange;\n document.addEventListener("selectionchange", () => {\n const selection = document.getSelection();\n if (selection.rangeCount === 0) {\n this.#textLayers.forEach(reset);\n return;\n }\n const activeTextLayers = new Set();\n for (let i = 0; i < selection.rangeCount; i++) {\n const range = selection.getRangeAt(i);\n for (const textLayerDiv of this.#textLayers.keys()) {\n if (!activeTextLayers.has(textLayerDiv) && range.intersectsNode(textLayerDiv)) {\n activeTextLayers.add(textLayerDiv);\n }\n }\n }\n for (const [textLayerDiv, endDiv] of this.#textLayers) {\n if (activeTextLayers.has(textLayerDiv)) {\n textLayerDiv.classList.add("selecting");\n } else {\n reset(endDiv, textLayerDiv);\n }\n }\n isFirefox ??= getComputedStyle(this.#textLayers.values().next().value).getPropertyValue("-moz-user-select") === "none";\n if (isFirefox) {\n return;\n }\n const range = selection.getRangeAt(0);\n const modifyStart = prevRange && (range.compareBoundaryPoints(Range.END_TO_END, prevRange) === 0 || range.compareBoundaryPoints(Range.START_TO_END, prevRange) === 0);\n let anchor = modifyStart ? range.startContainer : range.endContainer;\n if (anchor.nodeType === Node.TEXT_NODE) {\n anchor = anchor.parentNode;\n }\n if (anchor.classList?.contains("highlight")) {\n anchor = anchor.parentNode;\n }\n if (!modifyStart && range.endOffset === 0) {\n do {\n while (!anchor.previousSibling) {\n anchor = anchor.parentNode;\n }\n anchor = anchor.previousSibling;\n } while (!anchor.childNodes.length);\n }\n const parentTextLayer = anchor.parentElement?.closest(".textLayer");\n const endDiv = this.#textLayers.get(parentTextLayer);\n if (endDiv) {\n endDiv.style.width = parentTextLayer.style.width;\n endDiv.style.height = parentTextLayer.style.height;\n endDiv.style.userSelect = "text";\n anchor.parentElement.insertBefore(endDiv, modifyStart ? anchor : anchor.nextSibling);\n }\n prevRange = range.cloneRange();\n }, {\n signal\n });\n }\n}\n\n;// ./web/pdf_page_view.js\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst DEFAULT_LAYER_PROPERTIES = null;\nconst LAYERS_ORDER = new Map([["canvasWrapper", 0], ["textLayer", 1], ["annotationLayer", 2], ["annotationEditorLayer", 3], ["xfaLayer", 3]]);\nclass PDFPageView extends BasePDFPageView {\n #annotationMode = AnnotationMode.ENABLE_FORMS;\n #canvasWrapper = null;\n #commentManager = null;\n #enableAutoLinking = true;\n #hasRestrictedScaling = false;\n #isEditing = false;\n #layerProperties = null;\n #needsRestrictedScaling = false;\n #originalViewport = null;\n #previousRotation = null;\n #scaleRoundX = 1;\n #scaleRoundY = 1;\n #textLayerMode = TextLayerMode.ENABLE;\n #userUnit = 1;\n #useThumbnailCanvas = {\n directDrawing: true,\n initialOptionalContent: true,\n regularAnnotations: true\n };\n #layers = [null, null, null, null];\n #clonedFrom = null;\n constructor(options) {\n super(options);\n const {\n container,\n defaultViewport\n } = options;\n this.renderingId = "page" + this.id;\n this.#layerProperties = options.layerProperties || DEFAULT_LAYER_PROPERTIES;\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 = options.optionalContentConfigPromise || null;\n this.#textLayerMode = options.textLayerMode ?? TextLayerMode.ENABLE;\n this.#annotationMode = options.annotationMode ?? AnnotationMode.ENABLE_FORMS;\n this.imageResourcesPath = options.imageResourcesPath || "";\n this.enableDetailCanvas = options.enableDetailCanvas ?? true;\n this.maxCanvasPixels = options.maxCanvasPixels ?? AppOptions.get("maxCanvasPixels");\n this.maxCanvasDim = options.maxCanvasDim || AppOptions.get("maxCanvasDim");\n this.capCanvasAreaFactor = options.capCanvasAreaFactor ?? AppOptions.get("capCanvasAreaFactor");\n this.#enableAutoLinking = options.enableAutoLinking !== false;\n this.#commentManager = options.commentManager || null;\n this.#clonedFrom = options.clonedFrom || null;\n this.l10n = options.l10n;\n this.l10n ||= new genericl10n_GenericL10n();\n this._isStandalone = !this.renderingQueue?.hasViewer();\n this._container = container;\n this._annotationCanvasMap = null;\n this.annotationLayer = null;\n this.annotationEditorLayer = null;\n this.textLayer = null;\n this.xfaLayer = null;\n this.structTreeLayer = null;\n this.drawLayer = null;\n this.detailView = null;\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({\n page: this.id\n }));\n this.div = div;\n this.#setDimensions();\n container?.append(div);\n if (this._isStandalone) {\n container?.style.setProperty("--scale-factor", this.scale * PixelsPerInch.PDF_TO_CSS_UNITS);\n if (this.pageColors?.background) {\n container?.style.setProperty("--page-bg-color", this.pageColors.background);\n }\n const {\n optionalContentConfigPromise\n } = options;\n if (optionalContentConfigPromise) {\n optionalContentConfigPromise.then(optionalContentConfig => {\n if (optionalContentConfigPromise !== this._optionalContentConfigPromise) {\n return;\n }\n this.#useThumbnailCanvas.initialOptionalContent = optionalContentConfig.hasInitialVisibility;\n });\n }\n if (!options.l10n) {\n this.l10n.translate(this.div);\n }\n }\n }\n clone(id) {\n const clone = new PDFPageView({\n container: null,\n eventBus: this.eventBus,\n pagesColors: this.pageColors,\n renderingQueue: this.renderingQueue,\n enableOptimizedPartialRendering: this.enableOptimizedPartialRendering,\n minDurationToUpdateCanvas: this.minDurationToUpdateCanvas,\n defaultViewport: this.viewport,\n id,\n layerProperties: this.#layerProperties,\n scale: this.scale,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n textLayerMode: this.#textLayerMode,\n annotationMode: this.#annotationMode,\n imageResourcesPath: this.imageResourcesPath,\n enableDetailCanvas: this.enableDetailCanvas,\n maxCanvasPixels: this.maxCanvasPixels,\n maxCanvasDim: this.maxCanvasDim,\n capCanvasAreaFactor: this.capCanvasAreaFactor,\n enableAutoLinking: this.#enableAutoLinking,\n commentManager: this.#commentManager,\n l10n: this.l10n,\n clonedFrom: this\n });\n clone.setPdfPage(this.pdfPage);\n return clone;\n }\n #addLayer(div, name) {\n const pos = LAYERS_ORDER.get(name);\n const oldDiv = this.#layers[pos];\n this.#layers[pos] = div;\n if (oldDiv) {\n oldDiv.replaceWith(div);\n return;\n }\n for (let i = pos - 1; i >= 0; i--) {\n const layer = this.#layers[i];\n if (layer) {\n layer.after(div);\n return;\n }\n }\n this.div.prepend(div);\n }\n #setDimensions() {\n const {\n div,\n viewport\n } = this;\n if (viewport.userUnit !== this.#userUnit) {\n if (viewport.userUnit !== 1) {\n div.style.setProperty("--user-unit", viewport.userUnit);\n } else {\n div.style.removeProperty("--user-unit");\n }\n this.#userUnit = viewport.userUnit;\n }\n if (this.pdfPage) {\n if (this.#previousRotation === viewport.rotation) {\n return;\n }\n this.#previousRotation = viewport.rotation;\n }\n setLayerDimensions(div, viewport, true, false);\n }\n updatePageNumber(newPageNumber) {\n if (this.id === newPageNumber) {\n return;\n }\n this.id = newPageNumber;\n this.renderingId = `page${newPageNumber}`;\n if (this.pdfPage) {\n this.pdfPage.pageNumber = newPageNumber;\n }\n this.setPageLabel(this.pageLabel);\n const {\n div\n } = this;\n div.setAttribute("data-page-number", newPageNumber);\n div.setAttribute("data-l10n-args", JSON.stringify({\n page: newPageNumber\n }));\n this._textHighlighter.pageIdx = newPageNumber - 1;\n this.annotationEditorLayer?.updatePageIndex(newPageNumber - 1);\n }\n setPdfPage(pdfPage) {\n if (this._isStandalone && (this.pageColors?.foreground === "CanvasText" || this.pageColors?.background === "Canvas")) {\n this._container?.style.setProperty("--hcm-highlight-filter", pdfPage.filterFactory.addHighlightHCMFilter("highlight", "CanvasText", "Canvas", "HighlightText", "Highlight"));\n this._container?.style.setProperty("--hcm-highlight-selected-filter", pdfPage.filterFactory.addHighlightHCMFilter("highlight_selected", "CanvasText", "Canvas", "HighlightText", "Highlight"));\n }\n this.pdfPage = pdfPage;\n this.pdfPageRotate = pdfPage.rotate;\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 destroy() {\n this.reset();\n this.pdfPage?.cleanup();\n }\n deleteMe(isCut) {\n if (isCut) {\n this.div.remove();\n return;\n }\n this.destroy();\n this.#layerProperties.annotationEditorUIManager?.deletePage(this.id);\n }\n hasEditableAnnotations() {\n return !!this.annotationLayer?.hasEditableAnnotations();\n }\n get _textHighlighter() {\n return shadow(this, "_textHighlighter", new TextHighlighter({\n pageIndex: this.id - 1,\n eventBus: this.eventBus,\n findController: this.#layerProperties.findController\n }));\n }\n #dispatchLayerRendered(name, error) {\n this.eventBus.dispatch(name, {\n source: this,\n pageNumber: this.id,\n error\n });\n }\n async #renderAnnotationLayer() {\n let error = null;\n try {\n await this.annotationLayer.render({\n viewport: this.viewport,\n intent: "display",\n structTreeLayer: this.structTreeLayer\n });\n } catch (ex) {\n console.error("#renderAnnotationLayer:", ex);\n error = ex;\n } finally {\n this.#dispatchLayerRendered("annotationlayerrendered", error);\n }\n }\n async #renderAnnotationEditorLayer() {\n let error = null;\n try {\n await this.annotationEditorLayer.render({\n viewport: this.viewport,\n intent: "display"\n });\n } catch (ex) {\n console.error("#renderAnnotationEditorLayer:", ex);\n error = ex;\n } finally {\n this.#dispatchLayerRendered("annotationeditorlayerrendered", error);\n }\n }\n async #renderDrawLayer() {\n try {\n await this.drawLayer.render({\n intent: "display"\n });\n } catch (ex) {\n console.error("#renderDrawLayer:", ex);\n }\n }\n async #renderXfaLayer() {\n let error = null;\n try {\n const result = await this.xfaLayer.render({\n viewport: this.viewport,\n intent: "display"\n });\n if (result?.textDivs && this._textHighlighter) {\n this.#buildXfaTextContentItems(result.textDivs);\n }\n } catch (ex) {\n console.error("#renderXfaLayer:", ex);\n error = ex;\n } finally {\n if (this.xfaLayer?.div) {\n this.l10n.pause();\n this.#addLayer(this.xfaLayer.div, "xfaLayer");\n this.l10n.resume();\n }\n this.#dispatchLayerRendered("xfalayerrendered", error);\n }\n }\n async #renderTextLayer() {\n if (!this.textLayer) {\n return;\n }\n let error = null;\n try {\n await this.textLayer.render({\n viewport: this.viewport\n });\n } catch (ex) {\n if (ex instanceof AbortException) {\n return;\n }\n console.error("#renderTextLayer:", ex);\n error = ex;\n }\n this.#dispatchLayerRendered("textlayerrendered", error);\n this.#renderStructTreeLayer();\n }\n async #renderStructTreeLayer() {\n if (!this.textLayer) {\n return;\n }\n const treeDom = await this.structTreeLayer?.render();\n if (treeDom) {\n this.l10n.pause();\n this.structTreeLayer?.updateTextLayer();\n if (this.canvas && treeDom.parentNode !== this.canvas) {\n this.canvas.append(treeDom);\n }\n this.l10n.resume();\n }\n this.structTreeLayer?.show();\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 async #injectLinkAnnotations(textLayerPromise) {\n let error = null;\n try {\n await textLayerPromise;\n if (!this.annotationLayer) {\n return;\n }\n await this.annotationLayer.injectLinkAnnotations(Autolinker.processLinks(this));\n } catch (ex) {\n console.error("#injectLinkAnnotations:", ex);\n error = ex;\n }\n }\n _resetCanvas() {\n super._resetCanvas();\n this.#originalViewport = null;\n }\n reset({\n keepAnnotationLayer = false,\n keepAnnotationEditorLayer = false,\n keepXfaLayer = false,\n keepTextLayer = false,\n keepCanvasWrapper = false,\n preserveDetailViewState = false\n } = {}) {\n const keepPdfBugGroups = this.pdfPage?._pdfBug ?? false;\n this.cancelRendering({\n keepAnnotationLayer,\n keepAnnotationEditorLayer,\n keepXfaLayer,\n keepTextLayer\n });\n this.renderingState = RenderingStates.INITIAL;\n const div = this.div;\n const childNodes = div.childNodes,\n annotationLayerNode = keepAnnotationLayer && this.annotationLayer?.div || null,\n annotationEditorLayerNode = keepAnnotationEditorLayer && this.annotationEditorLayer?.div || null,\n xfaLayerNode = keepXfaLayer && this.xfaLayer?.div || null,\n textLayerNode = keepTextLayer && this.textLayer?.div || null,\n canvasWrapperNode = keepCanvasWrapper && this.#canvasWrapper || null;\n for (let i = childNodes.length - 1; i >= 0; i--) {\n const node = childNodes[i];\n switch (node) {\n case annotationLayerNode:\n case annotationEditorLayerNode:\n case xfaLayerNode:\n case textLayerNode:\n case canvasWrapperNode:\n continue;\n }\n if (keepPdfBugGroups && node.classList.contains("pdfBugGroupsLayer")) {\n continue;\n }\n node.remove();\n const layerIndex = this.#layers.indexOf(node);\n if (layerIndex >= 0) {\n this.#layers[layerIndex] = null;\n }\n }\n div.removeAttribute("data-loaded");\n if (annotationLayerNode) {\n this.annotationLayer.hide();\n }\n if (annotationEditorLayerNode) {\n this.annotationEditorLayer.hide();\n }\n if (xfaLayerNode) {\n this.xfaLayer.hide();\n }\n if (textLayerNode) {\n this.textLayer.hide();\n }\n this.structTreeLayer?.hide();\n if (!keepCanvasWrapper && this.#canvasWrapper) {\n this.#canvasWrapper = null;\n this._resetCanvas();\n }\n if (!preserveDetailViewState) {\n this.detailView?.reset({\n keepCanvas: keepCanvasWrapper\n });\n if (!keepCanvasWrapper) {\n this.detailView = null;\n }\n }\n }\n toggleEditingMode(isEditing) {\n this.#isEditing = isEditing;\n if (!this.hasEditableAnnotations()) {\n return;\n }\n this.reset({\n keepAnnotationLayer: true,\n keepAnnotationEditorLayer: true,\n keepXfaLayer: true,\n keepTextLayer: true,\n keepCanvasWrapper: true\n });\n }\n updateVisibleArea(visibleArea) {\n if (this.enableDetailCanvas) {\n if (this.#needsRestrictedScaling && this.maxCanvasPixels > 0 && visibleArea) {\n this.detailView ??= new PDFPageDetailView({\n pageView: this,\n enableOptimizedPartialRendering: this.enableOptimizedPartialRendering\n });\n this.detailView.update({\n visibleArea\n });\n } else if (this.detailView) {\n this.detailView.reset();\n this.detailView = null;\n }\n }\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;\n }\n if (optionalContentConfigPromise instanceof Promise) {\n this._optionalContentConfigPromise = optionalContentConfigPromise;\n optionalContentConfigPromise.then(optionalContentConfig => {\n if (optionalContentConfigPromise !== this._optionalContentConfigPromise) {\n return;\n }\n this.#useThumbnailCanvas.initialOptionalContent = optionalContentConfig.hasInitialVisibility;\n });\n }\n this.#useThumbnailCanvas.directDrawing = true;\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 if (this._isStandalone) {\n this._container?.style.setProperty("--scale-factor", this.viewport.scale);\n }\n this.#computeScale();\n if (this.canvas) {\n const onlyCssZoom = this.#hasRestrictedScaling && this.#needsRestrictedScaling;\n const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000;\n if (postponeDrawing || onlyCssZoom) {\n if (postponeDrawing && !onlyCssZoom && this.renderingState !== RenderingStates.FINISHED) {\n this.cancelRendering({\n keepAnnotationLayer: true,\n keepAnnotationEditorLayer: true,\n keepXfaLayer: true,\n keepTextLayer: true,\n cancelExtraDelay: drawingDelay\n });\n this.renderingState = RenderingStates.FINISHED;\n this.#useThumbnailCanvas.directDrawing = false;\n }\n this.cssTransform({\n redrawAnnotationLayer: true,\n redrawAnnotationEditorLayer: true,\n redrawXfaLayer: true,\n redrawTextLayer: !postponeDrawing,\n hideTextLayer: postponeDrawing\n });\n if (!postponeDrawing) {\n this.detailView?.update({\n underlyingViewUpdated: true\n });\n this.dispatchPageRendered(true, false);\n }\n return;\n }\n }\n this.cssTransform({});\n this.reset({\n keepAnnotationLayer: true,\n keepAnnotationEditorLayer: true,\n keepXfaLayer: true,\n keepTextLayer: true,\n keepCanvasWrapper: true,\n preserveDetailViewState: true\n });\n this.detailView?.update({\n underlyingViewUpdated: true\n });\n }\n #computeScale() {\n const {\n width,\n height\n } = this.viewport;\n const outputScale = this.outputScale = new OutputScale();\n if (this.maxCanvasPixels === 0) {\n const invScale = 1 / this.scale;\n outputScale.sx *= invScale;\n outputScale.sy *= invScale;\n this.#needsRestrictedScaling = true;\n } else {\n this.#needsRestrictedScaling = outputScale.limitCanvas(width, height, this.maxCanvasPixels, this.maxCanvasDim, this.capCanvasAreaFactor);\n if (this.#needsRestrictedScaling && this.enableDetailCanvas) {\n const factor = this.enableOptimizedPartialRendering ? 4 : 2;\n outputScale.sx /= factor;\n outputScale.sy /= factor;\n }\n }\n }\n cancelRendering({\n keepAnnotationLayer = false,\n keepAnnotationEditorLayer = false,\n keepXfaLayer = false,\n keepTextLayer = false,\n cancelExtraDelay = 0\n } = {}) {\n super.cancelRendering({\n cancelExtraDelay\n });\n if (this.textLayer && (!keepTextLayer || !this.textLayer.div)) {\n this.textLayer.cancel();\n this.textLayer = null;\n }\n if (this.annotationLayer && (!keepAnnotationLayer || !this.annotationLayer.div)) {\n this.annotationLayer.cancel();\n this.annotationLayer = null;\n this._annotationCanvasMap = null;\n }\n if (this.structTreeLayer && !this.textLayer) {\n this.structTreeLayer = null;\n }\n if (this.annotationEditorLayer && (!keepAnnotationEditorLayer || !this.annotationEditorLayer.div)) {\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 cssTransform({\n redrawAnnotationLayer = false,\n redrawAnnotationEditorLayer = false,\n redrawXfaLayer = false,\n redrawTextLayer = false,\n hideTextLayer = false\n }) {\n const {\n canvas\n } = this;\n if (!canvas) {\n return;\n }\n const originalViewport = this.#originalViewport;\n if (this.viewport !== originalViewport) {\n const relativeRotation = (360 + this.viewport.rotation - originalViewport.rotation) % 360;\n if (relativeRotation === 90 || relativeRotation === 270) {\n const {\n width,\n height\n } = this.viewport;\n const scaleX = height / width;\n const scaleY = width / height;\n canvas.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX},${scaleY})`;\n } else {\n canvas.style.transform = relativeRotation === 0 ? "" : `rotate(${relativeRotation}deg)`;\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 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 get width() {\n return this.viewport.width;\n }\n get height() {\n return this.viewport.height;\n }\n getPagePoint(x, y) {\n return this.viewport.convertToPdfPoint(x, y);\n }\n _ensureCanvasWrapper() {\n let canvasWrapper = this.#canvasWrapper;\n if (!canvasWrapper) {\n canvasWrapper = this.#canvasWrapper = document.createElement("div");\n canvasWrapper.classList.add("canvasWrapper");\n this.#addLayer(canvasWrapper, "canvasWrapper");\n }\n return canvasWrapper;\n }\n _getRenderingContext(canvas, transform, recordOperations) {\n return {\n canvas,\n transform,\n viewport: this.viewport,\n annotationMode: this.#annotationMode,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n annotationCanvasMap: this._annotationCanvasMap,\n pageColors: this.pageColors,\n isEditing: this.#isEditing,\n recordOperations\n };\n }\n async draw() {\n if (this.renderingState !== RenderingStates.INITIAL) {\n console.error("Must be in new state before drawing");\n this.reset();\n }\n const {\n div,\n l10n,\n pdfPage,\n viewport\n } = this;\n if (!pdfPage) {\n this.renderingState = RenderingStates.FINISHED;\n throw new Error("pdfPage is not loaded");\n }\n this.renderingState = RenderingStates.RUNNING;\n const canvasWrapper = this._ensureCanvasWrapper();\n if (!this.textLayer && this.#textLayerMode !== TextLayerMode.DISABLE && !pdfPage.isPureXfa) {\n this._accessibilityManager ||= new TextAccessibilityManager();\n this.textLayer = new TextLayerBuilder({\n pdfPage,\n highlighter: this._textHighlighter,\n accessibilityManager: this._accessibilityManager,\n enablePermissions: this.#textLayerMode === TextLayerMode.ENABLE_PERMISSIONS,\n onAppend: textLayerDiv => {\n this.l10n.pause();\n this.#addLayer(textLayerDiv, "textLayer");\n this.l10n.resume();\n }\n });\n }\n if (!this.annotationLayer && this.#annotationMode !== AnnotationMode.DISABLE) {\n const {\n annotationStorage,\n annotationEditorUIManager,\n downloadManager,\n enableComment,\n enableScripting,\n fieldObjectsPromise,\n hasJSActionsPromise,\n linkService\n } = this.#layerProperties;\n this._annotationCanvasMap ||= new Map();\n this.annotationLayer = new AnnotationLayerBuilder({\n pdfPage,\n annotationStorage,\n imageResourcesPath: this.imageResourcesPath,\n renderForms: this.#annotationMode === AnnotationMode.ENABLE_FORMS,\n linkService,\n downloadManager,\n enableComment,\n enableScripting,\n hasJSActionsPromise,\n fieldObjectsPromise,\n annotationCanvasMap: this._annotationCanvasMap,\n accessibilityManager: this._accessibilityManager,\n annotationEditorUIManager,\n commentManager: this.#commentManager,\n onAppend: annotationLayerDiv => {\n this.#addLayer(annotationLayerDiv, "annotationLayer");\n }\n });\n }\n const {\n width,\n height\n } = viewport;\n this.#originalViewport = viewport;\n const {\n canvas,\n prevCanvas\n } = this._createCanvas(newCanvas => {\n canvasWrapper.prepend(newCanvas);\n });\n canvas.setAttribute("role", "presentation");\n if (!this.outputScale) {\n this.#computeScale();\n }\n const {\n outputScale\n } = this;\n this.#hasRestrictedScaling = this.#needsRestrictedScaling;\n const sfx = approximateFraction(outputScale.sx);\n const sfy = approximateFraction(outputScale.sy);\n const canvasWidth = canvas.width = floorToDivide(calcRound(width * outputScale.sx), sfx[0]);\n const canvasHeight = canvas.height = floorToDivide(calcRound(height * outputScale.sy), sfy[0]);\n const pageWidth = floorToDivide(calcRound(width), sfx[1]);\n const pageHeight = floorToDivide(calcRound(height), sfy[1]);\n outputScale.sx = canvasWidth / pageWidth;\n outputScale.sy = canvasHeight / pageHeight;\n if (this.#scaleRoundX !== sfx[1]) {\n div.style.setProperty("--scale-round-x", `${sfx[1]}px`);\n this.#scaleRoundX = sfx[1];\n }\n if (this.#scaleRoundY !== sfy[1]) {\n div.style.setProperty("--scale-round-y", `${sfy[1]}px`);\n this.#scaleRoundY = sfy[1];\n }\n const recordBBoxes = this.enableOptimizedPartialRendering && this.#hasRestrictedScaling && !this.recordedBBoxes;\n const transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null;\n const resultPromise = this._drawCanvas(this._getRenderingContext(canvas, transform, recordBBoxes), () => {\n prevCanvas?.remove();\n this._resetCanvas();\n }, renderTask => {\n this.#useThumbnailCanvas.regularAnnotations = !renderTask.separateAnnots;\n this.dispatchPageRendered(false, false);\n }).then(async () => {\n if (this.renderingState !== RenderingStates.FINISHED) {\n return;\n }\n this.structTreeLayer ||= new StructTreeLayerBuilder(pdfPage, viewport.rawDims);\n const textLayerPromise = this.#renderTextLayer();\n if (this.annotationLayer) {\n await this.#renderAnnotationLayer();\n if (this.#enableAutoLinking && this.annotationLayer && this.textLayer) {\n await this.#injectLinkAnnotations(textLayerPromise);\n }\n }\n const {\n annotationEditorUIManager\n } = this.#layerProperties;\n if (!annotationEditorUIManager) {\n return;\n }\n this.drawLayer ||= new DrawLayerBuilder();\n await this.#renderDrawLayer();\n this.drawLayer.setParent(canvasWrapper);\n if (this.annotationLayer || this.#annotationMode === AnnotationMode.DISABLE) {\n this.annotationEditorLayer ||= new AnnotationEditorLayerBuilder({\n uiManager: annotationEditorUIManager,\n pageIndex: this.id - 1,\n l10n,\n structTreeLayer: this.structTreeLayer,\n accessibilityManager: this._accessibilityManager,\n annotationLayer: this.annotationLayer?.annotationLayer,\n textLayer: this.textLayer,\n drawLayer: this.drawLayer.getDrawLayer(),\n clonedFrom: this.#clonedFrom?.annotationEditorLayer,\n onAppend: annotationEditorLayerDiv => {\n this.#addLayer(annotationEditorLayerDiv, "annotationEditorLayer");\n }\n });\n this.#clonedFrom = null;\n this.#renderAnnotationEditorLayer();\n }\n });\n if (pdfPage.isPureXfa) {\n if (!this.xfaLayer) {\n const {\n annotationStorage,\n linkService\n } = this.#layerProperties;\n this.xfaLayer = new XfaLayerBuilder({\n pdfPage,\n annotationStorage,\n linkService\n });\n }\n this.#renderXfaLayer();\n }\n div.setAttribute("data-loaded", true);\n this.dispatchPageRender();\n return resultPromise;\n }\n setPageLabel(label) {\n this.pageLabel = typeof label === "string" ? label : null;\n this.div.setAttribute("data-l10n-args", JSON.stringify({\n page: this.pageLabel ?? this.id\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 get thumbnailCanvas() {\n const {\n directDrawing,\n initialOptionalContent,\n regularAnnotations\n } = this.#useThumbnailCanvas;\n return directDrawing && initialOptionalContent && regularAnnotations ? this.canvas : null;\n }\n}\n\n;// ./web/pdf_viewer.js\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst DEFAULT_CACHE_SIZE = 10;\nconst PagesCountLimit = {\n FORCE_SCROLL_MODE_PAGE: 10000,\n FORCE_LAZY_PAGE_INIT: 5000,\n PAUSE_EAGER_PAGE_INIT: 250\n};\nfunction isValidAnnotationEditorMode(mode) {\n return Object.values(AnnotationEditorType).includes(mode) && mode !== AnnotationEditorType.DISABLE;\n}\nclass PDFPageViewBuffer {\n #buf = new Set();\n #size = 0;\n constructor(size) {\n this.#size = size;\n }\n push(view) {\n const buf = this.#buf;\n if (buf.has(view)) {\n buf.delete(view);\n }\n buf.add(view);\n if (buf.size > this.#size) {\n this.#destroyFirstView();\n }\n }\n resize(newSize, idsToKeep = null) {\n this.#size = newSize;\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);\n buf.add(view);\n }\n if (++i > ii) {\n break;\n }\n }\n }\n while (buf.size > this.#size) {\n this.#destroyFirstView();\n }\n }\n has(view) {\n return this.#buf.has(view);\n }\n [Symbol.iterator]() {\n return this.#buf.keys();\n }\n #destroyFirstView() {\n const firstView = this.#buf.keys().next().value;\n firstView?.destroy();\n this.#buf.delete(firstView);\n }\n}\nclass PDFViewer {\n #buffer = null;\n #altTextManager = null;\n #annotationEditorHighlightColors = null;\n #annotationEditorMode = AnnotationEditorType.NONE;\n #annotationEditorUIManager = null;\n #annotationMode = AnnotationMode.ENABLE_FORMS;\n #commentManager = null;\n #containerTopLeft = null;\n #editorUndoBar = null;\n #enableHWA = false;\n #enableHighlightFloatingButton = false;\n #enablePermissions = false;\n #enableUpdatedAddImage = false;\n #enableNewAltTextWhenAddingImage = false;\n #enableAutoLinking = true;\n #eventAbortController = null;\n #minDurationToUpdateCanvas = 0;\n #mlManager = null;\n #printingAllowed = true;\n #scrollTimeoutId = null;\n #switchAnnotationEditorModeAC = null;\n #switchAnnotationEditorModeTimeoutId = null;\n #getAllTextInProgress = false;\n #hiddenCopyElement = null;\n #interruptCopyCondition = false;\n #previousContainerHeight = 0;\n #resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this));\n #scrollModePageState = null;\n #scaleTimeoutId = null;\n #signatureManager = null;\n #supportsPinchToZoom = true;\n #textLayerMode = TextLayerMode.ENABLE;\n #viewerAlert = null;\n #copiedPageViews = null;\n constructor(options) {\n const viewerVersion = "5.5.207";\n if (version !== viewerVersion) {\n throw new Error(`The API version "${version}" does not match the Viewer version "${viewerVersion}".`);\n }\n this.container = options.container;\n this.viewer = options.viewer || options.container.firstElementChild;\n this.#viewerAlert = options.viewerAlert || null;\n if (this.container?.tagName !== "DIV" || this.viewer?.tagName !== "DIV") {\n throw new Error("Invalid `container` and/or `viewer` option.");\n }\n if (this.container.offsetParent && getComputedStyle(this.container).position !== "absolute") {\n throw new Error("The `container` must be absolutely positioned.");\n }\n this.#resizeObserver.observe(this.container);\n this.eventBus = options.eventBus;\n this.linkService = options.linkService || new SimpleLinkService();\n this.downloadManager = options.downloadManager || null;\n this.findController = options.findController || null;\n this.#altTextManager = options.altTextManager || null;\n this.#commentManager = options.commentManager || null;\n this.#signatureManager = options.signatureManager || null;\n this.#editorUndoBar = options.editorUndoBar || null;\n if (this.findController) {\n this.findController.onIsPageVisible = pageNumber => this._getVisiblePages().ids.has(pageNumber);\n }\n this._scriptingManager = options.scriptingManager || null;\n this.#textLayerMode = options.textLayerMode ?? TextLayerMode.ENABLE;\n this.#annotationMode = options.annotationMode ?? AnnotationMode.ENABLE_FORMS;\n this.#annotationEditorMode = options.annotationEditorMode ?? AnnotationEditorType.NONE;\n this.#annotationEditorHighlightColors = options.annotationEditorHighlightColors || null;\n this.#enableHighlightFloatingButton = options.enableHighlightFloatingButton === true;\n this.#enableUpdatedAddImage = options.enableUpdatedAddImage === true;\n this.#enableNewAltTextWhenAddingImage = options.enableNewAltTextWhenAddingImage === true;\n this.imageResourcesPath = options.imageResourcesPath || "";\n this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;\n this.removePageBorders = options.removePageBorders || false;\n this.maxCanvasPixels = options.maxCanvasPixels;\n this.maxCanvasDim = options.maxCanvasDim;\n this.capCanvasAreaFactor = options.capCanvasAreaFactor;\n this.enableDetailCanvas = options.enableDetailCanvas ?? true;\n this.enableOptimizedPartialRendering = options.enableOptimizedPartialRendering ?? false;\n this.l10n = options.l10n;\n this.l10n ||= new genericl10n_GenericL10n();\n this.#enablePermissions = options.enablePermissions || false;\n this.pageColors = options.pageColors || null;\n this.#mlManager = options.mlManager || null;\n this.#enableHWA = options.enableHWA || false;\n this.#supportsPinchToZoom = options.supportsPinchToZoom !== false;\n this.#enableAutoLinking = options.enableAutoLinking !== false;\n this.#minDurationToUpdateCanvas = options.minDurationToUpdateCanvas ?? 500;\n this.defaultRenderingQueue = !options.renderingQueue;\n if (this.defaultRenderingQueue) {\n this.renderingQueue = new PDFRenderingQueue();\n this.renderingQueue.setViewer(this);\n } else {\n this.renderingQueue = options.renderingQueue;\n }\n const {\n abortSignal\n } = options;\n abortSignal?.addEventListener("abort", () => {\n this.#resizeObserver.disconnect();\n this.#resizeObserver = null;\n }, {\n once: true\n });\n this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this), abortSignal);\n this.presentationModeState = PresentationModeState.UNKNOWN;\n this._resetView();\n if (this.removePageBorders) {\n this.viewer.classList.add("removePageBorders");\n }\n this.#updateContainerHeightCss();\n this.eventBus._on("thumbnailrendered", ({\n pageNumber,\n pdfPage\n }) => {\n const pageView = this._pages[pageNumber - 1];\n if (!this.#buffer.has(pageView)) {\n pdfPage?.cleanup();\n }\n });\n if (!options.l10n) {\n this.l10n.translate(this.container);\n }\n }\n get printingAllowed() {\n return this.#printingAllowed;\n }\n get pagesCount() {\n return this._pages.length;\n }\n getPageView(index) {\n return this._pages[index];\n }\n getCachedPageViews() {\n return new Set(this.#buffer);\n }\n get pageViewsReady() {\n return this._pages.every(pageView => pageView?.pdfPage);\n }\n get renderForms() {\n return this.#annotationMode === AnnotationMode.ENABLE_FORMS;\n }\n get enableScripting() {\n return !!this._scriptingManager;\n }\n get currentPageNumber() {\n return this._currentPageNumber;\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 if (!this._setCurrentPageNumber(val, true)) {\n console.error(`currentPageNumber: "${val}" is not a valid page.`);\n }\n }\n _setCurrentPageNumber(val, resetCurrentPageView = false) {\n if (this._currentPageNumber === val) {\n if (resetCurrentPageView) {\n this.#resetCurrentPageView();\n }\n return true;\n }\n if (!(0 < val && val <= this.pagesCount)) {\n return false;\n }\n const previous = this._currentPageNumber;\n this._currentPageNumber = val;\n this.eventBus.dispatch("pagechanging", {\n source: this,\n pageNumber: val,\n pageLabel: this._pageLabels?.[val - 1] ?? null,\n previous\n });\n if (resetCurrentPageView) {\n this.#resetCurrentPageView();\n }\n return true;\n }\n get currentPageLabel() {\n return this._pageLabels?.[this._currentPageNumber - 1] ?? null;\n }\n set currentPageLabel(val) {\n if (!this.pdfDocument) {\n return;\n }\n let page = val | 0;\n if (this._pageLabels) {\n const i = this._pageLabels.indexOf(val);\n if (i >= 0) {\n page = i + 1;\n }\n }\n if (!this._setCurrentPageNumber(page, true)) {\n console.error(`currentPageLabel: "${val}" is not a valid page.`);\n }\n }\n get currentScale() {\n return this._currentScale !== UNKNOWN_SCALE ? this._currentScale : DEFAULT_SCALE;\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, {\n noScroll: false\n });\n }\n get currentScaleValue() {\n return this._currentScaleValue;\n }\n set currentScaleValue(val) {\n if (!this.pdfDocument) {\n return;\n }\n this.#setScale(val, {\n noScroll: false\n });\n }\n get pagesRotation() {\n return this._pagesRotation;\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 rotation %= 360;\n if (rotation < 0) {\n rotation += 360;\n }\n if (this._pagesRotation === rotation) {\n return;\n }\n this._pagesRotation = rotation;\n const pageNumber = this._currentPageNumber;\n this.refresh(true, {\n rotation\n });\n if (this._currentScaleValue) {\n this.#setScale(this._currentScaleValue, {\n noScroll: true\n });\n }\n this.eventBus.dispatch("rotationchanging", {\n source: this,\n pagesRotation: rotation,\n pageNumber\n });\n if (this.defaultRenderingQueue) {\n this.update();\n }\n }\n get firstPagePromise() {\n return this.pdfDocument ? this._firstPageCapability.promise : null;\n }\n get onePageRendered() {\n return this.pdfDocument ? this._onePageRenderedCapability.promise : null;\n }\n get pagesPromise() {\n return this.pdfDocument ? this._pagesCapability.promise : null;\n }\n get _layerProperties() {\n const self = this;\n return shadow(this, "_layerProperties", {\n get annotationEditorUIManager() {\n return self.#annotationEditorUIManager;\n },\n get annotationStorage() {\n return self.pdfDocument?.annotationStorage;\n },\n get downloadManager() {\n return self.downloadManager;\n },\n get enableComment() {\n return !!self.#commentManager;\n },\n get enableScripting() {\n return !!self._scriptingManager;\n },\n get fieldObjectsPromise() {\n return self.pdfDocument?.getFieldObjects();\n },\n get findController() {\n return self.findController;\n },\n get hasJSActionsPromise() {\n return self.pdfDocument?.hasJSActions();\n },\n get linkService() {\n return self.linkService;\n }\n });\n }\n #initializePermissions(permissions) {\n const params = {\n annotationEditorMode: this.#annotationEditorMode,\n annotationMode: this.#annotationMode,\n textLayerMode: this.#textLayerMode\n };\n if (!permissions) {\n this.#printingAllowed = true;\n this.eventBus.dispatch("printingallowed", {\n source: this,\n isAllowed: this.#printingAllowed\n });\n return params;\n }\n this.#printingAllowed = permissions.includes(PermissionFlag.PRINT_HIGH_QUALITY) || permissions.includes(PermissionFlag.PRINT);\n this.eventBus.dispatch("printingallowed", {\n source: this,\n isAllowed: this.#printingAllowed\n });\n if (!permissions.includes(PermissionFlag.COPY) && this.#textLayerMode === TextLayerMode.ENABLE) {\n params.textLayerMode = TextLayerMode.ENABLE_PERMISSIONS;\n }\n if (!permissions.includes(PermissionFlag.MODIFY_CONTENTS)) {\n params.annotationEditorMode = AnnotationEditorType.DISABLE;\n }\n if (!permissions.includes(PermissionFlag.MODIFY_ANNOTATIONS) && !permissions.includes(PermissionFlag.FILL_INTERACTIVE_FORMS) && this.#annotationMode === AnnotationMode.ENABLE_FORMS) {\n params.annotationMode = AnnotationMode.ENABLE;\n }\n return params;\n }\n async #onePageRenderedOrForceFetch(signal) {\n if (document.visibilityState === "hidden" || !this.container.offsetParent || this._getVisiblePages().views.length === 0) {\n return;\n }\n const hiddenCapability = Promise.withResolvers(),\n ac = new AbortController();\n document.addEventListener("visibilitychange", () => {\n if (document.visibilityState === "hidden") {\n hiddenCapability.resolve();\n }\n }, {\n signal: AbortSignal.any([signal, ac.signal])\n });\n await Promise.race([this._onePageRenderedCapability.promise, hiddenCapability.promise]);\n ac.abort();\n }\n async getAllText() {\n const texts = [];\n const buffer = [];\n for (let pageNum = 1, pagesCount = this.pdfDocument.numPages; pageNum <= pagesCount; ++pageNum) {\n if (this.#interruptCopyCondition) {\n return null;\n }\n buffer.length = 0;\n const page = await this.pdfDocument.getPage(pageNum);\n const {\n items\n } = 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 return texts.join("\\n");\n }\n #copyCallback(textLayerMode, event) {\n const selection = document.getSelection();\n const {\n focusNode,\n anchorNode\n } = selection;\n if (anchorNode && focusNode && selection.containsNode(this.#hiddenCopyElement)) {\n if (this.#getAllTextInProgress || textLayerMode === TextLayerMode.ENABLE_PERMISSIONS) {\n stopEvent(event);\n return;\n }\n this.#getAllTextInProgress = true;\n const {\n classList\n } = this.viewer;\n classList.add("copyAll");\n const ac = new AbortController();\n window.addEventListener("keydown", ev => this.#interruptCopyCondition = ev.key === "Escape", {\n signal: ac.signal\n });\n this.getAllText().then(async text => {\n if (text !== null) {\n await navigator.clipboard.writeText(text);\n }\n }).catch(reason => {\n console.warn(`Something goes wrong when extracting the text: ${reason.message}`);\n }).finally(() => {\n this.#getAllTextInProgress = false;\n this.#interruptCopyCondition = false;\n ac.abort();\n classList.remove("copyAll");\n });\n stopEvent(event);\n }\n }\n setDocument(pdfDocument) {\n if (this.pdfDocument) {\n this.eventBus.dispatch("pagesdestroy", {\n source: this\n });\n this._cancelRendering();\n this._resetView();\n this.findController?.setDocument(null);\n this._scriptingManager?.setDocument(null);\n this.#annotationEditorUIManager?.destroy();\n this.#annotationEditorUIManager = null;\n this.#annotationEditorMode = AnnotationEditorType.NONE;\n this.#printingAllowed = true;\n }\n this.pdfDocument = pdfDocument;\n if (!pdfDocument) {\n return;\n }\n const pagesCount = pdfDocument.numPages;\n const firstPagePromise = pdfDocument.getPage(1);\n const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({\n intent: "display"\n });\n const permissionsPromise = this.#enablePermissions ? pdfDocument.getPermissions() : Promise.resolve();\n const {\n eventBus,\n pageColors,\n viewer\n } = this;\n this.#eventAbortController = new AbortController();\n const {\n signal\n } = this.#eventAbortController;\n if (pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {\n console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");\n const mode = this._scrollMode = ScrollMode.PAGE;\n eventBus.dispatch("scrollmodechanged", {\n source: this,\n mode\n });\n }\n this._pagesCapability.promise.then(() => {\n eventBus.dispatch("pagesloaded", {\n source: this,\n pagesCount\n });\n }, () => {});\n const onBeforeDraw = evt => {\n const pageView = this._pages[evt.pageNumber - 1];\n if (!pageView) {\n return;\n }\n this.#buffer.push(pageView);\n };\n eventBus._on("pagerender", onBeforeDraw, {\n signal\n });\n const onAfterDraw = evt => {\n if (evt.cssTransform || evt.isDetailView) {\n return;\n }\n this._onePageRenderedCapability.resolve({\n timestamp: evt.timestamp\n });\n eventBus._off("pagerendered", onAfterDraw);\n };\n eventBus._on("pagerendered", onAfterDraw, {\n signal\n });\n Promise.all([firstPagePromise, permissionsPromise]).then(([firstPdfPage, permissions]) => {\n if (pdfDocument !== this.pdfDocument) {\n return;\n }\n this._firstPageCapability.resolve(firstPdfPage);\n this._optionalContentConfigPromise = optionalContentConfigPromise;\n const {\n annotationEditorMode,\n annotationMode,\n textLayerMode\n } = this.#initializePermissions(permissions);\n if (textLayerMode !== TextLayerMode.DISABLE) {\n const element = this.#hiddenCopyElement = document.createElement("div");\n element.id = "hiddenCopyElement";\n viewer.before(element);\n }\n if (annotationEditorMode !== AnnotationEditorType.DISABLE) {\n const mode = annotationEditorMode;\n if (pdfDocument.isPureXfa) {\n console.warn("Warning: XFA-editing is not implemented.");\n } else if (isValidAnnotationEditorMode(mode)) {\n this.#annotationEditorUIManager = new AnnotationEditorUIManager(this.container, viewer, this.#viewerAlert, this.#altTextManager, this.#commentManager, this.#signatureManager, eventBus, pdfDocument, pageColors, this.#annotationEditorHighlightColors, this.#enableHighlightFloatingButton, this.#enableUpdatedAddImage, this.#enableNewAltTextWhenAddingImage, this.#mlManager, this.#editorUndoBar, this.#supportsPinchToZoom);\n eventBus.dispatch("annotationeditoruimanager", {\n source: this,\n uiManager: this.#annotationEditorUIManager\n });\n if (mode !== AnnotationEditorType.NONE) {\n this.#preloadEditingData(mode);\n this.#annotationEditorUIManager.updateMode(mode);\n }\n } else {\n console.error(`Invalid AnnotationEditor mode: ${mode}`);\n }\n }\n const viewerElement = this._scrollMode === ScrollMode.PAGE ? null : viewer;\n const scale = this.currentScale;\n const viewport = firstPdfPage.getViewport({\n scale: scale * PixelsPerInch.PDF_TO_CSS_UNITS\n });\n viewer.style.setProperty("--scale-factor", viewport.scale);\n if (pageColors?.background) {\n viewer.style.setProperty("--page-bg-color", pageColors.background);\n }\n if (pageColors?.foreground === "CanvasText" || pageColors?.background === "Canvas") {\n viewer.style.setProperty("--hcm-highlight-filter", pdfDocument.filterFactory.addHighlightHCMFilter("highlight", "CanvasText", "Canvas", "HighlightText", "Highlight"));\n viewer.style.setProperty("--hcm-highlight-selected-filter", pdfDocument.filterFactory.addHighlightHCMFilter("highlight_selected", "CanvasText", "Canvas", "HighlightText", "ButtonText"));\n }\n for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n const pageView = new PDFPageView({\n container: viewerElement,\n eventBus,\n id: pageNum,\n scale,\n defaultViewport: viewport.clone(),\n optionalContentConfigPromise,\n renderingQueue: this.renderingQueue,\n textLayerMode,\n annotationMode,\n imageResourcesPath: this.imageResourcesPath,\n maxCanvasPixels: this.maxCanvasPixels,\n maxCanvasDim: this.maxCanvasDim,\n capCanvasAreaFactor: this.capCanvasAreaFactor,\n enableDetailCanvas: this.enableDetailCanvas,\n enableOptimizedPartialRendering: this.enableOptimizedPartialRendering,\n pageColors,\n l10n: this.l10n,\n layerProperties: this._layerProperties,\n enableHWA: this.#enableHWA,\n enableAutoLinking: this.#enableAutoLinking,\n minDurationToUpdateCanvas: this.#minDurationToUpdateCanvas,\n commentManager: this.#commentManager\n });\n this._pages.push(pageView);\n }\n this._pages[0]?.setPdfPage(firstPdfPage);\n if (this._scrollMode === ScrollMode.PAGE) {\n this.#ensurePageViewVisible();\n } else if (this._spreadMode !== SpreadMode.NONE) {\n this._updateSpreadMode();\n }\n eventBus._on("annotationeditorlayerrendered", evt => {\n if (this.#annotationEditorUIManager) {\n eventBus.dispatch("annotationeditormodechanged", {\n source: this,\n mode: this.#annotationEditorMode\n });\n }\n }, {\n once: true,\n signal\n });\n this.#onePageRenderedOrForceFetch(signal).then(async () => {\n if (pdfDocument !== this.pdfDocument) {\n return;\n }\n this.findController?.setDocument(pdfDocument);\n this._scriptingManager?.setDocument(pdfDocument);\n if (this.#hiddenCopyElement) {\n document.addEventListener("copy", this.#copyCallback.bind(this, textLayerMode), {\n signal\n });\n }\n if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT) {\n this._pagesCapability.resolve();\n return;\n }\n let getPagesLeft = pagesCount - 1;\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(pdfPage => {\n const pageView = this._pages[pageNum - 1];\n if (!pageView.pdfPage) {\n pageView.setPdfPage(pdfPage);\n }\n if (--getPagesLeft === 0) {\n this._pagesCapability.resolve();\n }\n }, reason => {\n console.error(`Unable to get page ${pageNum} to initialize viewer`, reason);\n if (--getPagesLeft === 0) {\n this._pagesCapability.resolve();\n }\n });\n if (pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0) {\n await promise;\n }\n }\n });\n eventBus.dispatch("pagesinit", {\n source: this\n });\n pdfDocument.getMetadata().then(({\n info\n }) => {\n if (pdfDocument !== this.pdfDocument) {\n return;\n }\n if (info.Language) {\n viewer.lang = info.Language;\n }\n });\n if (this.defaultRenderingQueue) {\n this.update();\n }\n }).catch(reason => {\n console.error("Unable to initialize viewer", reason);\n this._pagesCapability.reject(reason);\n });\n }\n onPagesEdited({\n pagesMapper,\n type,\n hasBeenCut,\n pageNumbers\n }) {\n if (type === "copy") {\n this.#copiedPageViews = new Map();\n for (const pageNum of pageNumbers) {\n this.#copiedPageViews.set(pageNum, this._pages[pageNum - 1]);\n }\n return;\n }\n const isCut = type === "cut";\n if (isCut || type === "delete") {\n for (const pageNum of pageNumbers) {\n this._pages[pageNum - 1].deleteMe(isCut);\n }\n }\n this._currentPageNumber = 0;\n const prevPages = this._pages;\n const newPages = this._pages = [];\n for (let i = 1, ii = pagesMapper.pagesNumber; i <= ii; i++) {\n const prevPageNumber = pagesMapper.getPrevPageNumber(i);\n if (prevPageNumber < 0) {\n let page = this.#copiedPageViews.get(-prevPageNumber);\n if (hasBeenCut) {\n page.updatePageNumber(i);\n } else {\n page = page.clone(i);\n }\n newPages.push(page);\n continue;\n }\n const page = prevPages[prevPageNumber - 1];\n newPages.push(page);\n page.updatePageNumber(i);\n }\n if (!isCut) {\n this.#copiedPageViews = null;\n }\n const viewerElement = this._scrollMode === ScrollMode.PAGE ? null : this.viewer;\n if (viewerElement) {\n viewerElement.replaceChildren();\n const fragment = document.createDocumentFragment();\n for (let i = 0, ii = pagesMapper.pagesNumber; i < ii; i++) {\n const {\n div\n } = newPages[i];\n div.setAttribute("data-page-number", i + 1);\n fragment.append(div);\n }\n viewerElement.append(fragment);\n }\n setTimeout(() => {\n this.forceRendering();\n });\n }\n setPageLabels(labels) {\n if (!this.pdfDocument) {\n return;\n }\n if (!labels) {\n this._pageLabels = null;\n } else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) {\n this._pageLabels = null;\n console.error(`setPageLabels: Invalid page labels.`);\n } else {\n this._pageLabels = labels;\n }\n for (let i = 0, ii = this._pages.length; i < ii; i++) {\n this._pages[i].setPageLabel(this._pageLabels?.[i] ?? null);\n }\n }\n _resetView() {\n this._pages = [];\n this._currentPageNumber = 1;\n this._currentScale = UNKNOWN_SCALE;\n this._currentScaleValue = null;\n this._pageLabels = null;\n this.#buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);\n this._location = null;\n this._pagesRotation = 0;\n this._optionalContentConfigPromise = null;\n this._firstPageCapability = Promise.withResolvers();\n this._onePageRenderedCapability = Promise.withResolvers();\n this._pagesCapability = Promise.withResolvers();\n this._scrollMode = ScrollMode.VERTICAL;\n this._previousScrollMode = ScrollMode.UNKNOWN;\n this._spreadMode = SpreadMode.NONE;\n this.#scrollModePageState = {\n previousPageNumber: 1,\n scrollDown: true,\n pages: []\n };\n this.#eventAbortController?.abort();\n this.#eventAbortController = null;\n this.viewer.textContent = "";\n this._updateScrollMode();\n this.viewer.removeAttribute("lang");\n this.#hiddenCopyElement?.remove();\n this.#hiddenCopyElement = null;\n this.#cleanupTimeouts();\n this.#cleanupSwitchAnnotationEditorMode();\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 viewer.textContent = "";\n state.pages.length = 0;\n if (this._spreadMode === SpreadMode.NONE && !this.isInPresentationMode) {\n const pageView = this._pages[pageNumber - 1];\n viewer.append(pageView.div);\n state.pages.push(pageView);\n } else {\n const pageIndexSet = new Set(),\n parity = this._spreadMode - 1;\n if (parity === -1) {\n pageIndexSet.add(pageNumber - 1);\n } else if (pageNumber % 2 !== parity) {\n pageIndexSet.add(pageNumber - 1);\n pageIndexSet.add(pageNumber);\n } else {\n pageIndexSet.add(pageNumber - 2);\n pageIndexSet.add(pageNumber - 1);\n }\n const spread = document.createElement("div");\n spread.className = "spread";\n if (this.isInPresentationMode) {\n const dummyPage = document.createElement("div");\n dummyPage.className = "dummyPage";\n spread.append(dummyPage);\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 state.pages.push(pageView);\n }\n viewer.append(spread);\n }\n state.scrollDown = pageNumber >= state.previousPageNumber;\n state.previousPageNumber = pageNumber;\n }\n _scrollUpdate() {\n if (this.pagesCount === 0) {\n return;\n }\n if (this.#scrollTimeoutId) {\n clearTimeout(this.#scrollTimeoutId);\n }\n this.#scrollTimeoutId = setTimeout(() => {\n this.#scrollTimeoutId = null;\n this.update();\n }, 100);\n this.update();\n }\n #scrollIntoView(pageView, pageSpot = null) {\n const {\n div,\n id\n } = pageView;\n if (this._currentPageNumber !== id) {\n this._setCurrentPageNumber(id);\n }\n if (this._scrollMode === ScrollMode.PAGE) {\n this.#ensurePageViewVisible();\n this.update();\n }\n if (!pageSpot && !this.isInPresentationMode) {\n const left = div.offsetLeft + div.clientLeft,\n right = left + div.clientWidth;\n const {\n scrollLeft,\n clientWidth\n } = this.container;\n if (this._scrollMode === ScrollMode.HORIZONTAL || left < scrollLeft || right > scrollLeft + clientWidth) {\n pageSpot = {\n left: 0,\n top: 0\n };\n }\n }\n scrollIntoView(div, pageSpot);\n if (!this._currentScaleValue && this._location) {\n this._location = null;\n }\n }\n #isSameScale(newScale) {\n return newScale === this._currentScale || Math.abs(newScale - this._currentScale) < 1e-15;\n }\n #setScaleUpdatePages(newScale, newValue, {\n noScroll = false,\n preset = false,\n drawingDelay = -1,\n origin = null\n }) {\n this._currentScaleValue = newValue.toString();\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 this.viewer.style.setProperty("--scale-factor", newScale * PixelsPerInch.PDF_TO_CSS_UNITS);\n const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000;\n this.refresh(true, {\n scale: newScale,\n drawingDelay: postponeDrawing ? drawingDelay : -1\n });\n if (postponeDrawing) {\n this.#scaleTimeoutId = setTimeout(() => {\n this.#scaleTimeoutId = null;\n this.refresh();\n }, drawingDelay);\n }\n const previousScale = this._currentScale;\n this._currentScale = newScale;\n if (!noScroll) {\n let page = this._currentPageNumber,\n dest;\n if (this._location && !(this.isInPresentationMode || this.isChangingPresentationMode)) {\n page = this._location.pageNumber;\n dest = [null, {\n name: "XYZ"\n }, this._location.left, this._location.top, null];\n }\n this.scrollPageIntoView({\n pageNumber: page,\n destArray: dest,\n allowNegativeOffset: true\n });\n if (Array.isArray(origin)) {\n const scaleDiff = newScale / previousScale - 1;\n const [top, left] = this.containerTopLeft;\n this.container.scrollLeft += (origin[0] - left) * scaleDiff;\n this.container.scrollTop += (origin[1] - top) * scaleDiff;\n }\n }\n this.eventBus.dispatch("scalechanging", {\n source: this,\n scale: newScale,\n presetValue: preset ? newValue : undefined\n });\n if (this.defaultRenderingQueue) {\n this.update();\n }\n }\n get #pageWidthScaleFactor() {\n if (this._spreadMode !== SpreadMode.NONE && this._scrollMode !== ScrollMode.HORIZONTAL) {\n return 2;\n }\n return 1;\n }\n #setScale(value, options) {\n let scale = parseFloat(value);\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 if (this.isInPresentationMode) {\n hPadding = vPadding = 4;\n if (this._spreadMode !== SpreadMode.NONE) {\n hPadding *= 2;\n }\n } else if (this.removePageBorders) {\n hPadding = vPadding = 0;\n } else if (this._scrollMode === ScrollMode.HORIZONTAL) {\n [hPadding, vPadding] = [vPadding, hPadding];\n }\n const pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale / this.#pageWidthScaleFactor;\n const pageHeightScale = (this.container.clientHeight - vPadding) / currentPage.height * 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 const horizontalScale = isPortraitOrientation(currentPage) ? pageWidthScale : 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 #resetCurrentPageView() {\n const pageView = this._pages[this._currentPageNumber - 1];\n if (this.isInPresentationMode) {\n this.#setScale(this._currentScaleValue, {\n noScroll: true\n });\n }\n this.#scrollIntoView(pageView);\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 scrollPageIntoView({\n pageNumber,\n destArray = null,\n allowNegativeOffset = false,\n ignoreDestinationZoom = false,\n center = null\n }) {\n if (!this.pdfDocument) {\n return;\n }\n const pageView = Number.isInteger(pageNumber) && this._pages[pageNumber - 1];\n if (!pageView) {\n console.error(`scrollPageIntoView: "${pageNumber}" is not a valid pageNumber parameter.`);\n return;\n }\n if (this.isInPresentationMode || !destArray) {\n this._setCurrentPageNumber(pageNumber, 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 = (changeOrientation ? pageView.height : pageView.width) / pageView.scale / PixelsPerInch.PDF_TO_CSS_UNITS;\n const pageHeight = (changeOrientation ? pageView.width : pageView.height) / pageView.scale / 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 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 if (y === null && this._location) {\n x = this._location.left;\n y = this._location.top;\n } else if (typeof y !== "number" || y < 0) {\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 if (this.removePageBorders) {\n hPadding = vPadding = 0;\n }\n widthScale = (this.container.clientWidth - hPadding) / width / PixelsPerInch.PDF_TO_CSS_UNITS;\n heightScale = (this.container.clientHeight - vPadding) / height / PixelsPerInch.PDF_TO_CSS_UNITS;\n scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));\n break;\n default:\n console.error(`scrollPageIntoView: "${destArray[1].name}" is not a valid destination type.`);\n return;\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 if (scale === "page-fit" && !destArray[4]) {\n this.#scrollIntoView(pageView);\n return;\n }\n const boundingRect = [pageView.viewport.convertToViewportPoint(x, y), pageView.viewport.convertToViewportPoint(x + width, y + height)];\n let left = Math.min(boundingRect[0][0], boundingRect[1][0]);\n let top = Math.min(boundingRect[0][1], boundingRect[1][1]);\n if (center) {\n if (center === "both" || center === "vertical") {\n top -= (this.container.clientHeight - Math.abs(boundingRect[1][1] - boundingRect[0][1])) / 2;\n }\n if (center === "both" || center === "horizontal") {\n left -= (this.container.clientWidth - Math.abs(boundingRect[1][0] - boundingRect[0][0])) / 2;\n }\n } else if (!allowNegativeOffset) {\n left = Math.max(left, 0);\n top = Math.max(top, 0);\n }\n this.#scrollIntoView(pageView, {\n left,\n top\n });\n }\n _updateLocation(firstPage) {\n const currentScale = this._currentScale;\n const currentScaleValue = this._currentScaleValue;\n const normalizedScaleValue = parseFloat(currentScaleValue) === currentScale ? Math.round(currentScale * 10000) / 100 : currentScaleValue;\n const pageNumber = firstPage.id;\n const currentPageView = this._pages[pageNumber - 1];\n const container = this.container;\n const topLeft = currentPageView.getPagePoint(container.scrollLeft - firstPage.x, container.scrollTop - firstPage.y);\n const intLeft = Math.round(topLeft[0]);\n const intTop = Math.round(topLeft[1]);\n let pdfOpenParams = `#page=${pageNumber}`;\n if (!this.isInPresentationMode) {\n pdfOpenParams += `&zoom=${normalizedScaleValue},${intLeft},${intTop}`;\n }\n this._location = {\n pageNumber,\n scale: normalizedScaleValue,\n top: intTop,\n left: intLeft,\n rotation: this._pagesRotation,\n pdfOpenParams\n };\n }\n update() {\n const visible = this._getVisiblePages();\n const visiblePages = visible.views,\n numVisiblePages = visiblePages.length;\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 for (const {\n view,\n visibleArea\n } of visiblePages) {\n view.updateVisibleArea(visibleArea);\n }\n for (const view of this.#buffer) {\n if (!visible.ids.has(view.id)) {\n view.updateVisibleArea(null);\n }\n }\n this.renderingQueue.renderHighestPriority(visible);\n const isSimpleLayout = this._spreadMode === SpreadMode.NONE && (this._scrollMode === ScrollMode.PAGE || this._scrollMode === ScrollMode.VERTICAL);\n const currentPageNumber = this._currentPageNumber;\n let stillFullyVisible = false;\n for (const page of visiblePages) {\n if (page.percent < 100) {\n break;\n }\n if (page.id === currentPageNumber && isSimpleLayout) {\n stillFullyVisible = true;\n break;\n }\n }\n this._setCurrentPageNumber(stillFullyVisible ? this._currentPageNumber : visiblePages[0].id);\n this._updateLocation(visible.first);\n this.eventBus.dispatch("updateviewarea", {\n source: this,\n location: this._location\n });\n }\n #switchToEditAnnotationMode() {\n const visible = this._getVisiblePages();\n const pagesToRefresh = [];\n const {\n ids,\n views\n } = visible;\n for (const page of views) {\n const {\n view\n } = page;\n if (!view.hasEditableAnnotations()) {\n ids.delete(view.id);\n continue;\n }\n pagesToRefresh.push(page);\n }\n if (pagesToRefresh.length === 0) {\n return null;\n }\n this.renderingQueue.renderHighestPriority({\n first: pagesToRefresh[0],\n last: pagesToRefresh.at(-1),\n views: pagesToRefresh,\n ids\n });\n return ids;\n }\n containsElement(element) {\n return this.container.contains(element);\n }\n focus() {\n this.container.focus();\n }\n get _isContainerRtl() {\n return getComputedStyle(this.container).direction === "rtl";\n }\n get isInPresentationMode() {\n return this.presentationModeState === PresentationModeState.FULLSCREEN;\n }\n get isChangingPresentationMode() {\n return this.presentationModeState === PresentationModeState.CHANGING;\n }\n get isHorizontalScrollbarEnabled() {\n return this.isInPresentationMode ? false : this.container.scrollWidth > this.container.clientWidth;\n }\n get isVerticalScrollbarEnabled() {\n return this.isInPresentationMode ? false : this.container.scrollHeight > this.container.clientHeight;\n }\n _getVisiblePages() {\n const views = this._scrollMode === ScrollMode.PAGE ? this.#scrollModePageState.pages : this._pages,\n horizontal = this._scrollMode === ScrollMode.HORIZONTAL,\n rtl = horizontal && this._isContainerRtl;\n return getVisibleElements({\n scrollEl: this.container,\n views,\n sortByVisibility: true,\n horizontal,\n rtl\n });\n }\n cleanup() {\n for (const pageView of this._pages) {\n if (pageView.renderingState !== RenderingStates.FINISHED) {\n pageView.reset();\n }\n }\n }\n _cancelRendering() {\n for (const pageView of this._pages) {\n pageView.cancelRendering();\n }\n }\n async #ensurePdfPageLoaded(pageView) {\n if (pageView.pdfPage) {\n return pageView.pdfPage;\n }\n try {\n const pdfPage = await this.pdfDocument.getPage(pageView.id);\n if (!pageView.pdfPage) {\n pageView.setPdfPage(pdfPage);\n }\n return pdfPage;\n } catch (reason) {\n console.error("Unable to get page for page view", reason);\n return null;\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 forceRendering(currentlyVisiblePages) {\n const visiblePages = currentlyVisiblePages || this._getVisiblePages();\n const scrollAhead = this.#getScrollAhead(visiblePages);\n const preRenderExtra = this._spreadMode !== SpreadMode.NONE && this._scrollMode !== ScrollMode.HORIZONTAL;\n const ignoreDetailViews = this.#scaleTimeoutId !== null || this.#scrollTimeoutId !== null && visiblePages.views.some(page => page.detailView?.renderingCancelled);\n const pageView = this.renderingQueue.getHighestPriority(visiblePages, this._pages, scrollAhead, preRenderExtra, ignoreDetailViews);\n if (pageView) {\n this.#ensurePdfPageLoaded(pageView).then(() => {\n this.renderingQueue.renderView(pageView);\n });\n return true;\n }\n return false;\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 (pageView.width !== firstPageView.width || pageView.height !== firstPageView.height) {\n return false;\n }\n }\n return true;\n }\n getPagesOverview() {\n let initialOrientation;\n return this._pages.map(pageView => {\n const viewport = pageView.pdfPage.getViewport({\n scale: 1\n });\n const orientation = isPortraitOrientation(viewport);\n if (initialOrientation === undefined) {\n initialOrientation = orientation;\n } else if (this.enablePrintAutoRotate && orientation !== initialOrientation) {\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 get optionalContentConfigPromise() {\n if (!this.pdfDocument) {\n return Promise.resolve(null);\n }\n if (!this._optionalContentConfigPromise) {\n console.error("optionalContentConfigPromise: Not initialized yet.");\n return this.pdfDocument.getOptionalContentConfig({\n intent: "display"\n });\n }\n return this._optionalContentConfigPromise;\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 return;\n }\n this._optionalContentConfigPromise = promise;\n this.refresh(false, {\n optionalContentConfigPromise: promise\n });\n this.eventBus.dispatch("optionalcontentconfigchanged", {\n source: this,\n promise\n });\n }\n get scrollMode() {\n return this._scrollMode;\n }\n set scrollMode(mode) {\n if (this._scrollMode === mode) {\n return;\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;\n }\n this._previousScrollMode = this._scrollMode;\n this._scrollMode = mode;\n this.eventBus.dispatch("scrollmodechanged", {\n source: this,\n mode\n });\n this._updateScrollMode(this._currentPageNumber);\n }\n _updateScrollMode(pageNumber = null) {\n const scrollMode = this._scrollMode,\n viewer = this.viewer;\n viewer.classList.toggle("scrollHorizontal", scrollMode === ScrollMode.HORIZONTAL);\n viewer.classList.toggle("scrollWrapped", scrollMode === ScrollMode.WRAPPED);\n if (!this.pdfDocument || !pageNumber) {\n return;\n }\n if (scrollMode === ScrollMode.PAGE) {\n this.#ensurePageViewVisible();\n } else if (this._previousScrollMode === ScrollMode.PAGE) {\n this._updateSpreadMode();\n }\n if (this._currentScaleValue && isNaN(this._currentScaleValue)) {\n this.#setScale(this._currentScaleValue, {\n noScroll: true\n });\n }\n this._setCurrentPageNumber(pageNumber, true);\n this.update();\n }\n get spreadMode() {\n return this._spreadMode;\n }\n set spreadMode(mode) {\n if (this._spreadMode === mode) {\n return;\n }\n if (!isValidSpreadMode(mode)) {\n throw new Error(`Invalid spread mode: ${mode}`);\n }\n this._spreadMode = mode;\n this.eventBus.dispatch("spreadmodechanged", {\n source: this,\n mode\n });\n this._updateSpreadMode(this._currentPageNumber);\n }\n _updateSpreadMode(pageNumber = null) {\n if (!this.pdfDocument) {\n return;\n }\n const viewer = this.viewer,\n pages = this._pages;\n if (this._scrollMode === ScrollMode.PAGE) {\n this.#ensurePageViewVisible();\n } else {\n viewer.textContent = "";\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 if (!pageNumber) {\n return;\n }\n if (this._currentScaleValue && isNaN(this._currentScaleValue)) {\n this.#setScale(this._currentScaleValue, {\n noScroll: true\n });\n }\n this._setCurrentPageNumber(pageNumber, true);\n this.update();\n }\n #getPageAdvance(currentPageNumber, previous = false) {\n switch (this._scrollMode) {\n case ScrollMode.WRAPPED:\n {\n const {\n views\n } = this._getVisiblePages(),\n pageLayout = new Map();\n for (const {\n id,\n y,\n percent,\n widthPercent\n } of views) {\n if (percent === 0 || widthPercent < 100) {\n continue;\n }\n pageLayout.getOrInsertComputed(y, makeArr).push(id);\n }\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 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 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 {\n break;\n }\n case ScrollMode.PAGE:\n case ScrollMode.VERTICAL:\n {\n if (this._spreadMode === SpreadMode.NONE) {\n break;\n }\n const parity = this._spreadMode - 1;\n if (previous && currentPageNumber % 2 !== parity) {\n break;\n } else if (!previous && currentPageNumber % 2 === parity) {\n break;\n }\n const {\n views\n } = this._getVisiblePages(),\n expectedId = previous ? currentPageNumber - 1 : currentPageNumber + 1;\n for (const {\n id,\n percent,\n widthPercent\n } 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 nextPage() {\n const currentPageNumber = this._currentPageNumber,\n pagesCount = this.pagesCount;\n if (currentPageNumber >= pagesCount) {\n return false;\n }\n const advance = this.#getPageAdvance(currentPageNumber, false) || 1;\n this.currentPageNumber = Math.min(currentPageNumber + advance, pagesCount);\n return true;\n }\n previousPage() {\n const currentPageNumber = this._currentPageNumber;\n if (currentPageNumber <= 1) {\n return false;\n }\n const advance = this.#getPageAdvance(currentPageNumber, true) || 1;\n this.currentPageNumber = Math.max(currentPageNumber - advance, 1);\n return true;\n }\n updateScale({\n drawingDelay,\n scaleFactor = null,\n steps = null,\n origin\n }) {\n if (steps === null && scaleFactor === null) {\n throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");\n }\n if (!this.pdfDocument) {\n return;\n }\n let newScale = this._currentScale;\n if (scaleFactor > 0 && scaleFactor !== 1) {\n newScale = Math.round(newScale * scaleFactor * 100) / 100;\n } else if (steps) {\n const delta = steps > 0 ? DEFAULT_SCALE_DELTA : 1 / DEFAULT_SCALE_DELTA;\n const round = steps > 0 ? Math.ceil : Math.floor;\n steps = Math.abs(steps);\n do {\n newScale = round((newScale * delta).toFixed(2) * 10) / 10;\n } while (--steps > 0);\n }\n newScale = MathClamp(newScale, MIN_SCALE, MAX_SCALE);\n this.#setScale(newScale, {\n noScroll: false,\n drawingDelay,\n origin\n });\n }\n increaseScale(options = {}) {\n this.updateScale({\n ...options,\n steps: options.steps ?? 1\n });\n }\n decreaseScale(options = {}) {\n this.updateScale({\n ...options,\n steps: -(options.steps ?? 1)\n });\n }\n #updateContainerHeightCss(height = this.container.clientHeight) {\n if (height !== this.#previousContainerHeight) {\n this.#previousContainerHeight = height;\n docStyle.setProperty("--viewer-container-height", `${height}px`);\n }\n }\n #resizeObserverCallback(entries) {\n for (const entry of entries) {\n if (entry.target === this.container) {\n this.#updateContainerHeightCss(Math.floor(entry.borderBoxSize[0].blockSize));\n this.#containerTopLeft = null;\n break;\n }\n }\n }\n get containerTopLeft() {\n return this.#containerTopLeft ||= [this.container.offsetTop, this.container.offsetLeft];\n }\n #cleanupTimeouts() {\n if (this.#scaleTimeoutId !== null) {\n clearTimeout(this.#scaleTimeoutId);\n this.#scaleTimeoutId = null;\n }\n if (this.#scrollTimeoutId !== null) {\n clearTimeout(this.#scrollTimeoutId);\n this.#scrollTimeoutId = null;\n }\n }\n #cleanupSwitchAnnotationEditorMode() {\n this.#switchAnnotationEditorModeAC?.abort();\n this.#switchAnnotationEditorModeAC = null;\n if (this.#switchAnnotationEditorModeTimeoutId !== null) {\n clearTimeout(this.#switchAnnotationEditorModeTimeoutId);\n this.#switchAnnotationEditorModeTimeoutId = null;\n }\n }\n #preloadEditingData(mode) {\n switch (mode) {\n case AnnotationEditorType.STAMP:\n this.#mlManager?.loadModel("altText");\n break;\n case AnnotationEditorType.SIGNATURE:\n this.#signatureManager?.loadSignatures();\n break;\n }\n }\n get annotationEditorMode() {\n return this.#annotationEditorUIManager ? this.#annotationEditorMode : AnnotationEditorType.DISABLE;\n }\n set annotationEditorMode({\n mode,\n editId = null,\n isFromKeyboard = false,\n mustEnterInEditMode = false,\n editComment = false\n }) {\n if (!this.#annotationEditorUIManager) {\n throw new Error(`The AnnotationEditor is not enabled.`);\n }\n if (this.#annotationEditorMode === mode) {\n return;\n }\n if (!isValidAnnotationEditorMode(mode)) {\n throw new Error(`Invalid AnnotationEditor mode: ${mode}`);\n }\n if (!this.pdfDocument) {\n return;\n }\n this.#preloadEditingData(mode);\n const {\n eventBus,\n pdfDocument\n } = this;\n const updater = async () => {\n this.#cleanupSwitchAnnotationEditorMode();\n this.#annotationEditorMode = mode;\n await this.#annotationEditorUIManager.updateMode(mode, editId, true, isFromKeyboard, mustEnterInEditMode, editComment);\n if (mode !== this.#annotationEditorMode || pdfDocument !== this.pdfDocument) {\n return;\n }\n eventBus.dispatch("annotationeditormodechanged", {\n source: this,\n mode\n });\n };\n if (mode === AnnotationEditorType.NONE || this.#annotationEditorMode === AnnotationEditorType.NONE) {\n const isEditing = mode !== AnnotationEditorType.NONE;\n if (!isEditing) {\n this.pdfDocument.annotationStorage.resetModifiedIds();\n }\n this.cleanup();\n for (const pageView of this._pages) {\n pageView.toggleEditingMode(isEditing);\n }\n const idsToRefresh = this.#switchToEditAnnotationMode();\n if (isEditing && idsToRefresh) {\n this.#cleanupSwitchAnnotationEditorMode();\n this.#switchAnnotationEditorModeAC = new AbortController();\n const signal = AbortSignal.any([this.#eventAbortController.signal, this.#switchAnnotationEditorModeAC.signal]);\n eventBus._on("pagerendered", ({\n pageNumber\n }) => {\n idsToRefresh.delete(pageNumber);\n if (idsToRefresh.size === 0) {\n this.#switchAnnotationEditorModeTimeoutId = setTimeout(updater, 0);\n }\n }, {\n signal\n });\n return;\n }\n }\n updater();\n }\n refresh(noUpdate = false, updateArgs = Object.create(null)) {\n if (!this.pdfDocument) {\n return;\n }\n for (const pageView of this._pages) {\n pageView.update(updateArgs);\n }\n this.#cleanupTimeouts();\n if (!noUpdate) {\n this.update();\n }\n }\n}\n\n;// ./web/secondary_toolbar.js\n\n\n\nclass SecondaryToolbar {\n #opts;\n constructor(options, eventBus) {\n this.#opts = options;\n const buttons = [{\n element: options.presentationModeButton,\n eventName: "presentationmode",\n close: true\n }, {\n element: options.printButton,\n eventName: "print",\n close: true\n }, {\n element: options.downloadButton,\n eventName: "download",\n close: true\n }, {\n element: options.viewBookmarkButton,\n eventName: null,\n close: true\n }, {\n element: options.firstPageButton,\n eventName: "firstpage",\n close: true\n }, {\n element: options.lastPageButton,\n eventName: "lastpage",\n close: true\n }, {\n element: options.pageRotateCwButton,\n eventName: "rotatecw",\n close: false\n }, {\n element: options.pageRotateCcwButton,\n eventName: "rotateccw",\n close: false\n }, {\n element: options.cursorSelectToolButton,\n eventName: "switchcursortool",\n eventDetails: {\n tool: CursorTool.SELECT\n },\n close: true\n }, {\n element: options.cursorHandToolButton,\n eventName: "switchcursortool",\n eventDetails: {\n tool: CursorTool.HAND\n },\n close: true\n }, {\n element: options.scrollPageButton,\n eventName: "switchscrollmode",\n eventDetails: {\n mode: ScrollMode.PAGE\n },\n close: true\n }, {\n element: options.scrollVerticalButton,\n eventName: "switchscrollmode",\n eventDetails: {\n mode: ScrollMode.VERTICAL\n },\n close: true\n }, {\n element: options.scrollHorizontalButton,\n eventName: "switchscrollmode",\n eventDetails: {\n mode: ScrollMode.HORIZONTAL\n },\n close: true\n }, {\n element: options.scrollWrappedButton,\n eventName: "switchscrollmode",\n eventDetails: {\n mode: ScrollMode.WRAPPED\n },\n close: true\n }, {\n element: options.spreadNoneButton,\n eventName: "switchspreadmode",\n eventDetails: {\n mode: SpreadMode.NONE\n },\n close: true\n }, {\n element: options.spreadOddButton,\n eventName: "switchspreadmode",\n eventDetails: {\n mode: SpreadMode.ODD\n },\n close: true\n }, {\n element: options.spreadEvenButton,\n eventName: "switchspreadmode",\n eventDetails: {\n mode: SpreadMode.EVEN\n },\n close: true\n }, {\n element: options.imageAltTextSettingsButton,\n eventName: "imagealttextsettings",\n close: true\n }, {\n element: options.documentPropertiesButton,\n eventName: "documentproperties",\n close: true\n }];\n buttons.push({\n element: options.openFileButton,\n eventName: "openfile",\n close: true\n });\n this.eventBus = eventBus;\n this.opened = false;\n this.#bindListeners(buttons);\n this.reset();\n }\n get isOpen() {\n return this.opened;\n }\n setPageNumber(pageNumber) {\n this.pageNumber = pageNumber;\n this.#updateUIState();\n }\n setPagesCount(pagesCount) {\n this.pagesCount = pagesCount;\n this.#updateUIState();\n }\n reset() {\n this.pageNumber = 0;\n this.pagesCount = 0;\n this.#updateUIState();\n this.eventBus.dispatch("switchcursortool", {\n source: this,\n reset: true\n });\n this.#scrollModeChanged({\n mode: ScrollMode.VERTICAL\n });\n this.#spreadModeChanged({\n mode: SpreadMode.NONE\n });\n }\n #updateUIState() {\n const {\n firstPageButton,\n lastPageButton,\n pageRotateCwButton,\n pageRotateCcwButton\n } = this.#opts;\n firstPageButton.disabled = this.pageNumber <= 1;\n lastPageButton.disabled = this.pageNumber >= this.pagesCount;\n pageRotateCwButton.disabled = this.pagesCount === 0;\n pageRotateCcwButton.disabled = this.pagesCount === 0;\n }\n #bindListeners(buttons) {\n const {\n eventBus\n } = this;\n const {\n toggleButton\n } = this.#opts;\n toggleButton.addEventListener("click", this.toggle.bind(this));\n for (const {\n element,\n eventName,\n close,\n eventDetails\n } of buttons) {\n element.addEventListener("click", evt => {\n if (eventName !== null) {\n eventBus.dispatch(eventName, {\n source: this,\n ...eventDetails\n });\n }\n if (close) {\n this.close();\n }\n eventBus.dispatch("reporttelemetry", {\n source: this,\n details: {\n type: "buttons",\n data: {\n id: element.id\n }\n }\n });\n });\n }\n eventBus._on("cursortoolchanged", this.#cursorToolChanged.bind(this));\n eventBus._on("scrollmodechanged", this.#scrollModeChanged.bind(this));\n eventBus._on("spreadmodechanged", this.#spreadModeChanged.bind(this));\n }\n #cursorToolChanged({\n tool,\n disabled\n }) {\n const {\n cursorSelectToolButton,\n cursorHandToolButton\n } = this.#opts;\n toggleCheckedBtn(cursorSelectToolButton, tool === CursorTool.SELECT);\n toggleCheckedBtn(cursorHandToolButton, tool === CursorTool.HAND);\n cursorSelectToolButton.disabled = disabled;\n cursorHandToolButton.disabled = disabled;\n }\n #scrollModeChanged({\n mode\n }) {\n const {\n scrollPageButton,\n scrollVerticalButton,\n scrollHorizontalButton,\n scrollWrappedButton,\n spreadNoneButton,\n spreadOddButton,\n spreadEvenButton\n } = this.#opts;\n toggleCheckedBtn(scrollPageButton, mode === ScrollMode.PAGE);\n toggleCheckedBtn(scrollVerticalButton, mode === ScrollMode.VERTICAL);\n toggleCheckedBtn(scrollHorizontalButton, mode === ScrollMode.HORIZONTAL);\n toggleCheckedBtn(scrollWrappedButton, mode === ScrollMode.WRAPPED);\n const forceScrollModePage = this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE;\n scrollPageButton.disabled = forceScrollModePage;\n scrollVerticalButton.disabled = forceScrollModePage;\n scrollHorizontalButton.disabled = forceScrollModePage;\n scrollWrappedButton.disabled = forceScrollModePage;\n const isHorizontal = mode === ScrollMode.HORIZONTAL;\n spreadNoneButton.disabled = isHorizontal;\n spreadOddButton.disabled = isHorizontal;\n spreadEvenButton.disabled = isHorizontal;\n }\n #spreadModeChanged({\n mode\n }) {\n const {\n spreadNoneButton,\n spreadOddButton,\n spreadEvenButton\n } = this.#opts;\n toggleCheckedBtn(spreadNoneButton, mode === SpreadMode.NONE);\n toggleCheckedBtn(spreadOddButton, mode === SpreadMode.ODD);\n toggleCheckedBtn(spreadEvenButton, mode === SpreadMode.EVEN);\n }\n open() {\n if (this.opened) {\n return;\n }\n this.opened = true;\n const {\n toggleButton,\n toolbar\n } = this.#opts;\n toggleExpandedBtn(toggleButton, true, toolbar);\n }\n close() {\n if (!this.opened) {\n return;\n }\n this.opened = false;\n const {\n toggleButton,\n toolbar\n } = this.#opts;\n toggleExpandedBtn(toggleButton, false, toolbar);\n }\n toggle() {\n if (this.opened) {\n this.close();\n } else {\n this.open();\n }\n }\n}\n\n;// ./web/signature_manager.js\n\n\n\n\n\n\n\nconst DEFAULT_HEIGHT_IN_PAGE = 40;\nclass SignatureManager {\n #addButton;\n #tabsToAltText = null;\n #clearButton;\n #clearDescription;\n #currentEditor;\n #description;\n #dialog;\n #drawCurves = null;\n #drawPlaceholder;\n #drawPath = null;\n #drawPathString = "";\n #drawPoints = null;\n #drawSVG;\n #drawThickness;\n #errorBar;\n #errorDescription;\n #errorTitle;\n #extractedSignatureData = null;\n #imagePath = null;\n #imagePicker;\n #imagePickerLink;\n #imagePlaceholder;\n #imageSVG;\n #saveCheckbox;\n #saveContainer;\n #tabButtons;\n #addSignatureToolbarButton;\n #loadSignaturesPromise = null;\n #typeInput;\n #currentTab = null;\n #currentTabAC = null;\n #hasDescriptionChanged = false;\n #eventBus;\n #isStorageFull = false;\n #l10n;\n #overlayManager;\n #editDescriptionDialog;\n #signatureStorage;\n #uiManager = null;\n static #l10nDescription = null;\n constructor({\n dialog,\n panels,\n typeButton,\n typeInput,\n drawButton,\n drawPlaceholder,\n drawSVG,\n drawThickness,\n imageButton,\n imageSVG,\n imagePlaceholder,\n imagePicker,\n imagePickerLink,\n description,\n clearButton,\n cancelButton,\n addButton,\n errorCloseButton,\n errorBar,\n errorTitle,\n errorDescription,\n saveCheckbox,\n saveContainer\n }, editSignatureElements, addSignatureToolbarButton, overlayManager, l10n, signatureStorage, eventBus) {\n this.#addButton = addButton;\n this.#clearButton = clearButton;\n this.#clearDescription = description.lastElementChild;\n this.#description = description.firstElementChild;\n this.#dialog = dialog;\n this.#drawSVG = drawSVG;\n this.#drawPlaceholder = drawPlaceholder;\n this.#drawThickness = drawThickness;\n this.#errorBar = errorBar;\n this.#errorTitle = errorTitle;\n this.#errorDescription = errorDescription;\n this.#imageSVG = imageSVG;\n this.#imagePlaceholder = imagePlaceholder;\n this.#imagePicker = imagePicker;\n this.#imagePickerLink = imagePickerLink;\n this.#overlayManager = overlayManager;\n this.#saveCheckbox = saveCheckbox;\n this.#saveContainer = saveContainer;\n this.#addSignatureToolbarButton = addSignatureToolbarButton;\n this.#typeInput = typeInput;\n this.#l10n = l10n;\n this.#signatureStorage = signatureStorage;\n this.#eventBus = eventBus;\n this.#editDescriptionDialog = new EditDescriptionDialog(editSignatureElements, overlayManager);\n SignatureManager.#l10nDescription ||= Object.freeze({\n signature: "pdfjs-editor-add-signature-description-default-when-drawing",\n errorUploadTitle: "pdfjs-editor-add-signature-image-upload-error-title",\n errorUploadDescription: "pdfjs-editor-add-signature-image-upload-error-description",\n errorNoDataTitle: "pdfjs-editor-add-signature-image-no-data-error-title",\n errorNoDataDescription: "pdfjs-editor-add-signature-image-no-data-error-description"\n });\n dialog.addEventListener("close", this.#close.bind(this));\n dialog.addEventListener("contextmenu", e => {\n const {\n target\n } = e;\n if (target !== this.#typeInput && target !== this.#description) {\n e.preventDefault();\n }\n });\n dialog.addEventListener("drop", e => {\n stopEvent(e);\n });\n cancelButton.addEventListener("click", this.#cancel.bind(this));\n addButton.addEventListener("click", this.#add.bind(this));\n clearButton.addEventListener("click", () => {\n this.#reportTelemetry({\n type: "signature",\n action: "pdfjs.signature.clear",\n data: {\n type: this.#currentTab\n }\n });\n this.#initTab(null);\n }, {\n passive: true\n });\n this.#description.addEventListener("input", () => {\n this.#clearDescription.disabled = this.#description.value === "";\n }, {\n passive: true\n });\n this.#clearDescription.addEventListener("click", () => {\n this.#description.value = "";\n this.#clearDescription.disabled = true;\n }, {\n passive: true\n });\n errorCloseButton.addEventListener("click", () => {\n errorBar.hidden = true;\n }, {\n passive: true\n });\n this.#initTabButtons(typeButton, drawButton, imageButton, panels);\n imagePicker.accept = SupportedImageMimeTypes.join(",");\n eventBus._on("storedsignatureschanged", this.#signaturesChanged.bind(this));\n overlayManager.register(dialog);\n }\n #initTabButtons(typeButton, drawButton, imageButton, panels) {\n const buttons = this.#tabButtons = new Map([["type", typeButton], ["draw", drawButton], ["image", imageButton]]);\n const tabCallback = e => {\n for (const [name, button] of buttons) {\n if (button === e.target) {\n button.setAttribute("aria-selected", true);\n button.setAttribute("tabindex", 0);\n panels.setAttribute("data-selected", name);\n this.#initTab(name);\n } else {\n button.setAttribute("aria-selected", false);\n button.setAttribute("tabindex", -1);\n }\n }\n };\n const buttonsArray = Array.from(buttons.values());\n for (let i = 0, ii = buttonsArray.length; i < ii; i++) {\n const button = buttonsArray[i];\n button.addEventListener("click", tabCallback, {\n passive: true\n });\n button.addEventListener("keydown", ({\n key\n }) => {\n if (key !== "ArrowLeft" && key !== "ArrowRight") {\n return;\n }\n buttonsArray[i + (key === "ArrowLeft" ? -1 : 1)]?.focus();\n }, {\n passive: true\n });\n }\n }\n #resetCommon() {\n this.#hasDescriptionChanged = false;\n this.#description.value = "";\n if (this.#currentTab) {\n this.#tabsToAltText.get(this.#currentTab).value = "";\n }\n }\n #resetTab(name) {\n switch (name) {\n case "type":\n this.#typeInput.value = "";\n break;\n case "draw":\n this.#drawCurves = null;\n this.#drawPoints = null;\n this.#drawPathString = "";\n this.#drawPath?.remove();\n this.#drawPath = null;\n this.#drawPlaceholder.hidden = false;\n this.#drawThickness.value = 1;\n break;\n case "image":\n this.#imagePlaceholder.hidden = false;\n this.#imagePath?.remove();\n this.#imagePath = null;\n break;\n }\n }\n #initTab(name) {\n if (name && this.#currentTab === name) {\n return;\n }\n if (this.#currentTab) {\n this.#tabsToAltText.get(this.#currentTab).value = this.#description.value;\n }\n if (name) {\n this.#currentTab = name;\n }\n this.#errorBar.hidden = true;\n const reset = !name;\n if (reset) {\n this.#resetCommon();\n } else {\n this.#description.value = this.#tabsToAltText.get(this.#currentTab).value;\n }\n this.#clearDescription.disabled = this.#description.value === "";\n this.#currentTabAC?.abort();\n this.#currentTabAC = new AbortController();\n switch (this.#currentTab) {\n case "type":\n this.#initTypeTab(reset);\n break;\n case "draw":\n this.#initDrawTab(reset);\n break;\n case "image":\n this.#initImageTab(reset);\n break;\n }\n }\n #disableButtons(value) {\n if (!value || !this.#isStorageFull) {\n this.#saveCheckbox.disabled = !value;\n }\n this.#clearButton.disabled = this.#addButton.disabled = this.#description.disabled = !value;\n }\n #initTypeTab(reset) {\n if (reset) {\n this.#resetTab("type");\n }\n this.#disableButtons(this.#typeInput.value);\n const {\n signal\n } = this.#currentTabAC;\n const options = {\n passive: true,\n signal\n };\n this.#typeInput.addEventListener("input", () => {\n const {\n value\n } = this.#typeInput;\n if (!this.#hasDescriptionChanged) {\n this.#tabsToAltText.get("type").default = this.#description.value = value;\n this.#clearDescription.disabled = value === "";\n }\n this.#disableButtons(value);\n }, options);\n this.#description.addEventListener("input", () => {\n this.#hasDescriptionChanged = this.#typeInput.value !== this.#description.value;\n }, options);\n }\n #initDrawTab(reset) {\n if (reset) {\n this.#resetTab("draw");\n }\n this.#disableButtons(this.#drawPath);\n const {\n signal\n } = this.#currentTabAC;\n const options = {\n signal\n };\n let currentPointerId = NaN;\n const drawCallback = e => {\n const {\n pointerId\n } = e;\n if (!isNaN(currentPointerId) && currentPointerId !== pointerId) {\n return;\n }\n currentPointerId = pointerId;\n e.preventDefault();\n this.#drawSVG.setPointerCapture(pointerId);\n const {\n width: drawWidth,\n height: drawHeight\n } = this.#drawSVG.getBoundingClientRect();\n let {\n offsetX,\n offsetY\n } = e;\n offsetX = Math.round(offsetX);\n offsetY = Math.round(offsetY);\n if (e.target === this.#drawPlaceholder) {\n this.#drawPlaceholder.hidden = true;\n }\n if (!this.#drawCurves) {\n this.#drawCurves = {\n width: drawWidth,\n height: drawHeight,\n thickness: parseInt(this.#drawThickness.value),\n curves: []\n };\n this.#disableButtons(true);\n const svgFactory = new DOMSVGFactory();\n const path = this.#drawPath = svgFactory.createElement("path");\n path.setAttribute("stroke-width", this.#drawThickness.value);\n this.#drawSVG.append(path);\n this.#drawSVG.addEventListener("pointerdown", drawCallback, options);\n this.#drawPlaceholder.removeEventListener("pointerdown", drawCallback);\n if (this.#description.value === "") {\n this.#l10n.get(SignatureManager.#l10nDescription.signature).then(description => {\n this.#tabsToAltText.get("draw").default = description;\n this.#description.value ||= description;\n this.#clearDescription.disabled = this.#description.value === "";\n });\n }\n }\n this.#drawPoints = [offsetX, offsetY];\n this.#drawCurves.curves.push({\n points: this.#drawPoints\n });\n this.#drawPathString += `M ${offsetX} ${offsetY}`;\n this.#drawPath.setAttribute("d", this.#drawPathString);\n const finishDrawAC = new AbortController();\n const listenerDrawOptions = {\n signal: AbortSignal.any([signal, finishDrawAC.signal])\n };\n this.#drawSVG.addEventListener("contextmenu", noContextMenu, listenerDrawOptions);\n this.#drawSVG.addEventListener("pointermove", evt => {\n evt.preventDefault();\n let {\n offsetX: x,\n offsetY: y\n } = evt;\n x = Math.round(x);\n y = Math.round(y);\n const drawPoints = this.#drawPoints;\n if (x < 0 || y < 0 || x > drawWidth || y > drawHeight || x === drawPoints.at(-2) && y === drawPoints.at(-1)) {\n return;\n }\n if (drawPoints.length >= 4) {\n const [x1, y1, x2, y2] = drawPoints.slice(-4);\n this.#drawPathString += `C${(x1 + 5 * x2) / 6} ${(y1 + 5 * y2) / 6} ${(5 * x2 + x) / 6} ${(5 * y2 + y) / 6} ${(x2 + x) / 2} ${(y2 + y) / 2}`;\n } else {\n this.#drawPathString += `L${x} ${y}`;\n }\n drawPoints.push(x, y);\n this.#drawPath.setAttribute("d", this.#drawPathString);\n }, listenerDrawOptions);\n this.#drawSVG.addEventListener("pointerup", evt => {\n const {\n pointerId: pId\n } = evt;\n if (!isNaN(currentPointerId) && currentPointerId !== pId) {\n return;\n }\n currentPointerId = NaN;\n evt.preventDefault();\n this.#drawSVG.releasePointerCapture(pId);\n finishDrawAC.abort();\n if (this.#drawPoints.length === 2) {\n this.#drawPathString += `L${this.#drawPoints[0]} ${this.#drawPoints[1]}`;\n this.#drawPath.setAttribute("d", this.#drawPathString);\n }\n }, listenerDrawOptions);\n };\n if (this.#drawCurves) {\n this.#drawSVG.addEventListener("pointerdown", drawCallback, options);\n } else {\n this.#drawPlaceholder.addEventListener("pointerdown", drawCallback, options);\n }\n this.#drawThickness.addEventListener("input", () => {\n const {\n value: thickness\n } = this.#drawThickness;\n this.#drawThickness.setAttribute("data-l10n-args", JSON.stringify({\n thickness\n }));\n if (!this.#drawCurves) {\n return;\n }\n this.#drawPath.setAttribute("stroke-width", thickness);\n this.#drawCurves.thickness = thickness;\n }, options);\n }\n #showError(type) {\n this.#errorTitle.setAttribute("data-l10n-id", SignatureManager.#l10nDescription[`error${type}Title`]);\n this.#errorDescription.setAttribute("data-l10n-id", SignatureManager.#l10nDescription[`error${type}Description`]);\n this.#errorBar.hidden = false;\n }\n #initImageTab(reset) {\n if (reset) {\n this.#resetTab("image");\n }\n this.#disableButtons(this.#imagePath);\n const {\n signal\n } = this.#currentTabAC;\n const options = {\n signal\n };\n const passiveOptions = {\n passive: true,\n signal\n };\n this.#imagePickerLink.addEventListener("keydown", e => {\n const {\n key\n } = e;\n if (key === "Enter" || key === " ") {\n stopEvent(e);\n this.#imagePicker.click();\n }\n }, options);\n this.#imagePicker.addEventListener("click", () => {\n this.#dialog.classList.toggle("waiting", true);\n }, passiveOptions);\n this.#imagePicker.addEventListener("change", async () => {\n const file = this.#imagePicker.files?.[0];\n if (!file || !SupportedImageMimeTypes.includes(file.type)) {\n this.#showError("Upload");\n this.#dialog.classList.toggle("waiting", false);\n return;\n }\n await this.#extractSignature(file);\n }, passiveOptions);\n this.#imagePicker.addEventListener("cancel", () => {\n this.#dialog.classList.toggle("waiting", false);\n }, passiveOptions);\n this.#imagePlaceholder.addEventListener("dragover", e => {\n const {\n dataTransfer\n } = e;\n for (const {\n type\n } of dataTransfer.items) {\n if (!SupportedImageMimeTypes.includes(type)) {\n continue;\n }\n dataTransfer.dropEffect = dataTransfer.effectAllowed === "copy" ? "copy" : "move";\n stopEvent(e);\n return;\n }\n dataTransfer.dropEffect = "none";\n }, options);\n this.#imagePlaceholder.addEventListener("drop", e => {\n const {\n dataTransfer: {\n files\n }\n } = e;\n if (!files?.length) {\n return;\n }\n for (const file of files) {\n if (SupportedImageMimeTypes.includes(file.type)) {\n this.#extractSignature(file);\n break;\n }\n }\n stopEvent(e);\n this.#dialog.classList.toggle("waiting", true);\n }, options);\n }\n async #extractSignature(file) {\n let data;\n try {\n data = await this.#uiManager.imageManager.getFromFile(file);\n } catch (e) {\n console.error("SignatureManager.#extractSignature.", e);\n }\n if (!data) {\n this.#showError("Upload");\n this.#dialog.classList.toggle("waiting", false);\n return;\n }\n const lineData = this.#extractedSignatureData = this.#currentEditor.getFromImage(data.bitmap);\n if (!lineData) {\n this.#showError("NoData");\n this.#dialog.classList.toggle("waiting", false);\n return;\n }\n const {\n outline\n } = lineData;\n this.#imagePlaceholder.hidden = true;\n this.#disableButtons(true);\n const svgFactory = new DOMSVGFactory();\n const path = this.#imagePath = svgFactory.createElement("path");\n this.#imageSVG.setAttribute("viewBox", outline.viewBox);\n this.#imageSVG.setAttribute("preserveAspectRatio", "xMidYMid meet");\n this.#imageSVG.append(path);\n path.setAttribute("d", outline.toSVGPath());\n this.#tabsToAltText.get("image").default = file.name;\n if (this.#description.value === "") {\n this.#description.value = file.name || "";\n this.#clearDescription.disabled = this.#description.value === "";\n }\n this.#dialog.classList.toggle("waiting", false);\n }\n #getOutlineForType() {\n return this.#currentEditor.getFromText(this.#typeInput.value, window.getComputedStyle(this.#typeInput));\n }\n #getOutlineForDraw() {\n const {\n width,\n height\n } = this.#drawSVG.getBoundingClientRect();\n return this.#currentEditor.getDrawnSignature(this.#drawCurves, width, height);\n }\n #reportTelemetry(data) {\n this.#eventBus.dispatch("reporttelemetry", {\n source: this,\n details: {\n type: "editing",\n data\n }\n });\n }\n #addToolbarButton(signatureData, uuid, description) {\n const {\n curves,\n areContours,\n thickness,\n width,\n height\n } = signatureData;\n const maxDim = Math.max(width, height);\n const outlineData = SignatureExtractor.processDrawnLines({\n lines: {\n curves,\n thickness,\n width,\n height\n },\n pageWidth: maxDim,\n pageHeight: maxDim,\n rotation: 0,\n innerMargin: 0,\n mustSmooth: false,\n areContours\n });\n if (!outlineData) {\n return;\n }\n const {\n outline\n } = outlineData;\n const svgFactory = new DOMSVGFactory();\n const div = document.createElement("div");\n const button = document.createElement("button");\n button.addEventListener("click", () => {\n this.#eventBus.dispatch("switchannotationeditorparams", {\n source: this,\n type: AnnotationEditorParamsType.CREATE,\n value: {\n signatureData: {\n lines: {\n curves,\n thickness,\n width,\n height\n },\n mustSmooth: false,\n areContours,\n description,\n uuid,\n heightInPage: DEFAULT_HEIGHT_IN_PAGE\n }\n }\n });\n });\n div.append(button);\n div.classList.add("toolbarAddSignatureButtonContainer");\n const svg = svgFactory.create(1, 1, true);\n button.append(svg);\n const span = document.createElement("span");\n span.ariaHidden = true;\n button.append(span);\n button.classList.add("toolbarAddSignatureButton");\n button.type = "button";\n span.textContent = description;\n button.setAttribute("data-l10n-id", "pdfjs-editor-add-saved-signature-button");\n button.setAttribute("data-l10n-args", JSON.stringify({\n description\n }));\n button.tabIndex = 0;\n const path = svgFactory.createElement("path");\n svg.append(path);\n svg.setAttribute("viewBox", outline.viewBox);\n svg.setAttribute("preserveAspectRatio", "xMidYMid meet");\n if (areContours) {\n path.classList.add("contours");\n }\n path.setAttribute("d", outline.toSVGPath());\n const deleteButton = document.createElement("button");\n div.append(deleteButton);\n deleteButton.classList.add("toolbarButton", "deleteButton");\n deleteButton.setAttribute("data-l10n-id", "pdfjs-editor-delete-signature-button1");\n deleteButton.type = "button";\n deleteButton.tabIndex = 0;\n deleteButton.addEventListener("click", async () => {\n if (await this.#signatureStorage.delete(uuid)) {\n div.remove();\n this.#reportTelemetry({\n type: "signature",\n action: "pdfjs.signature.delete_saved",\n data: {\n savedCount: await this.#signatureStorage.size()\n }\n });\n }\n });\n const deleteSpan = document.createElement("span");\n deleteButton.append(deleteSpan);\n deleteSpan.setAttribute("data-l10n-id", "pdfjs-editor-delete-signature-button-label1");\n this.#addSignatureToolbarButton.before(div);\n }\n async #signaturesChanged() {\n const parent = this.#addSignatureToolbarButton.parentElement;\n while (parent.firstElementChild !== this.#addSignatureToolbarButton) {\n parent.firstElementChild.remove();\n }\n this.#loadSignaturesPromise = null;\n await this.loadSignatures(true);\n }\n getSignature(params) {\n return this.open(params);\n }\n async loadSignatures(reload = false) {\n if (!this.#addSignatureToolbarButton || !reload && this.#addSignatureToolbarButton.previousElementSibling || !this.#signatureStorage) {\n return;\n }\n if (!this.#loadSignaturesPromise) {\n this.#loadSignaturesPromise = this.#signatureStorage.getAll().then(async signatures => [signatures, await Promise.all(Array.from(signatures.values(), ({\n signatureData\n }) => SignatureExtractor.decompressSignature(signatureData)))]);\n if (!reload) {\n return;\n }\n }\n const [signatures, signaturesData] = await this.#loadSignaturesPromise;\n this.#loadSignaturesPromise = null;\n let i = 0;\n for (const [uuid, {\n description\n }] of signatures) {\n const data = signaturesData[i++];\n if (!data) {\n continue;\n }\n data.curves = data.outlines.map(points => ({\n points\n }));\n delete data.outlines;\n this.#addToolbarButton(data, uuid, description);\n }\n }\n async renderEditButton(editor) {\n const button = document.createElement("button");\n button.classList.add("altText", "editDescription");\n button.tabIndex = 0;\n if (editor.description) {\n button.title = editor.description;\n }\n const span = document.createElement("span");\n button.append(span);\n span.setAttribute("data-l10n-id", "pdfjs-editor-add-signature-edit-button-label");\n button.addEventListener("click", () => {\n this.#editDescriptionDialog.open(editor);\n }, {\n passive: true\n });\n return button;\n }\n async open({\n uiManager,\n editor\n }) {\n this.#tabsToAltText ||= new Map(this.#tabButtons.keys().map(name => [name, {\n value: "",\n default: ""\n }]));\n this.#uiManager = uiManager;\n this.#currentEditor = editor;\n this.#uiManager.removeEditListeners();\n const isStorageFull = this.#isStorageFull = await this.#signatureStorage.isFull();\n this.#saveContainer.classList.toggle("fullStorage", isStorageFull);\n this.#saveCheckbox.checked = !isStorageFull;\n await this.#overlayManager.open(this.#dialog);\n const tabType = this.#tabButtons.get("type");\n tabType.focus();\n tabType.click();\n }\n #cancel() {\n this.#finish();\n }\n #finish() {\n this.#overlayManager.closeIfActive(this.#dialog);\n }\n #close() {\n if (this.#currentEditor._drawId === null) {\n this.#currentEditor.remove();\n }\n this.#uiManager?.addEditListeners();\n this.#currentTabAC?.abort();\n this.#currentTabAC = null;\n this.#uiManager = null;\n this.#currentEditor = null;\n this.#resetCommon();\n for (const [name] of this.#tabButtons) {\n this.#resetTab(name);\n }\n this.#disableButtons(false);\n this.#currentTab = null;\n this.#tabsToAltText = null;\n }\n async #add() {\n let data;\n const type = this.#currentTab;\n switch (type) {\n case "type":\n data = this.#getOutlineForType();\n break;\n case "draw":\n data = this.#getOutlineForDraw();\n break;\n case "image":\n data = this.#extractedSignatureData;\n break;\n }\n let uuid = null;\n const description = this.#description.value;\n if (this.#saveCheckbox.checked) {\n const {\n newCurves,\n areContours,\n thickness,\n width,\n height\n } = data;\n const signatureData = await SignatureExtractor.compressSignature({\n outlines: newCurves,\n areContours,\n thickness,\n width,\n height\n });\n uuid = await this.#signatureStorage.create({\n description,\n signatureData\n });\n if (uuid) {\n this.#addToolbarButton({\n curves: newCurves.map(points => ({\n points\n })),\n areContours,\n thickness,\n width,\n height\n }, uuid, description);\n } else {\n console.warn("SignatureManager.add: cannot save the signature.");\n }\n }\n const altText = this.#tabsToAltText.get(type);\n this.#reportTelemetry({\n type: "signature",\n action: "pdfjs.signature.created",\n data: {\n type,\n saved: !!uuid,\n savedCount: await this.#signatureStorage.size(),\n descriptionChanged: description !== altText.default\n }\n });\n this.#currentEditor.addSignature(data, DEFAULT_HEIGHT_IN_PAGE, this.#description.value, uuid);\n this.#finish();\n }\n destroy() {\n this.#uiManager = null;\n this.#finish();\n }\n}\nclass EditDescriptionDialog {\n #currentEditor;\n #previousDescription;\n #description;\n #dialog;\n #overlayManager;\n #signatureSVG;\n #uiManager;\n constructor({\n dialog,\n description,\n cancelButton,\n updateButton,\n editSignatureView\n }, overlayManager) {\n const descriptionInput = this.#description = description.firstElementChild;\n this.#signatureSVG = editSignatureView;\n this.#dialog = dialog;\n this.#overlayManager = overlayManager;\n dialog.addEventListener("close", this.#close.bind(this));\n dialog.addEventListener("contextmenu", e => {\n if (e.target !== this.#description) {\n e.preventDefault();\n }\n });\n cancelButton.addEventListener("click", this.#cancel.bind(this));\n updateButton.addEventListener("click", this.#update.bind(this));\n const clearDescription = description.lastElementChild;\n clearDescription.addEventListener("click", () => {\n descriptionInput.value = "";\n clearDescription.disabled = true;\n updateButton.disabled = this.#previousDescription === "";\n });\n descriptionInput.addEventListener("input", () => {\n const {\n value\n } = descriptionInput;\n clearDescription.disabled = value === "";\n updateButton.disabled = value === this.#previousDescription;\n editSignatureView.setAttribute("aria-label", value);\n }, {\n passive: true\n });\n overlayManager.register(dialog);\n }\n async open(editor) {\n this.#uiManager = editor._uiManager;\n this.#currentEditor = editor;\n this.#previousDescription = this.#description.value = editor.description;\n this.#description.dispatchEvent(new Event("input"));\n this.#uiManager.removeEditListeners();\n const {\n areContours,\n outline\n } = editor.getSignaturePreview();\n const svgFactory = new DOMSVGFactory();\n const path = svgFactory.createElement("path");\n this.#signatureSVG.append(path);\n this.#signatureSVG.setAttribute("viewBox", outline.viewBox);\n path.setAttribute("d", outline.toSVGPath());\n if (areContours) {\n path.classList.add("contours");\n }\n await this.#overlayManager.open(this.#dialog);\n }\n async #update() {\n this.#currentEditor._reportTelemetry({\n action: "pdfjs.signature.edit_description",\n data: {\n hasBeenChanged: true\n }\n });\n this.#currentEditor.description = this.#description.value;\n this.#finish();\n }\n #cancel() {\n this.#currentEditor._reportTelemetry({\n action: "pdfjs.signature.edit_description",\n data: {\n hasBeenChanged: false\n }\n });\n this.#finish();\n }\n #finish() {\n this.#overlayManager.closeIfActive(this.#dialog);\n }\n #close() {\n this.#uiManager?.addEditListeners();\n this.#uiManager = null;\n this.#currentEditor = null;\n this.#signatureSVG.firstElementChild.remove();\n }\n}\n\n;// ./web/toolbar.js\n\n\n\nclass Toolbar {\n #colorPicker = null;\n #opts;\n constructor(options, eventBus, toolbarDensity = 0) {\n this.#opts = options;\n this.eventBus = eventBus;\n const buttons = [{\n element: options.previous,\n eventName: "previouspage"\n }, {\n element: options.next,\n eventName: "nextpage"\n }, {\n element: options.zoomIn,\n eventName: "zoomin"\n }, {\n element: options.zoomOut,\n eventName: "zoomout"\n }, {\n element: options.print,\n eventName: "print"\n }, {\n element: options.download,\n eventName: "download"\n }, {\n element: options.editorCommentButton,\n eventName: "switchannotationeditormode",\n eventDetails: {\n get mode() {\n const {\n classList\n } = options.editorCommentButton;\n return classList.contains("toggled") ? AnnotationEditorType.NONE : AnnotationEditorType.POPUP;\n }\n }\n }, {\n element: options.editorFreeTextButton,\n eventName: "switchannotationeditormode",\n eventDetails: {\n get mode() {\n const {\n classList\n } = options.editorFreeTextButton;\n return classList.contains("toggled") ? AnnotationEditorType.NONE : AnnotationEditorType.FREETEXT;\n }\n }\n }, {\n element: options.editorHighlightButton,\n eventName: "switchannotationeditormode",\n eventDetails: {\n get mode() {\n const {\n classList\n } = options.editorHighlightButton;\n return classList.contains("toggled") ? AnnotationEditorType.NONE : AnnotationEditorType.HIGHLIGHT;\n }\n }\n }, {\n element: options.editorInkButton,\n eventName: "switchannotationeditormode",\n eventDetails: {\n get mode() {\n const {\n classList\n } = options.editorInkButton;\n return classList.contains("toggled") ? AnnotationEditorType.NONE : AnnotationEditorType.INK;\n }\n }\n }, {\n element: options.editorStampButton,\n eventName: "switchannotationeditormode",\n eventDetails: {\n get mode() {\n const {\n classList\n } = options.editorStampButton;\n return classList.contains("toggled") ? AnnotationEditorType.NONE : AnnotationEditorType.STAMP;\n }\n },\n telemetry: {\n type: "editing",\n data: {\n action: "pdfjs.image.icon_click"\n }\n }\n }, {\n element: options.editorSignatureButton,\n eventName: "switchannotationeditormode",\n eventDetails: {\n get mode() {\n const {\n classList\n } = options.editorSignatureButton;\n return classList.contains("toggled") ? AnnotationEditorType.NONE : AnnotationEditorType.SIGNATURE;\n }\n }\n }];\n this.#bindListeners(buttons);\n this.#updateToolbarDensity({\n value: toolbarDensity\n });\n this.reset();\n }\n #updateToolbarDensity({\n value\n }) {\n let name = "normal";\n switch (value) {\n case 1:\n name = "compact";\n break;\n case 2:\n name = "touch";\n break;\n }\n document.documentElement.setAttribute("data-toolbar-density", name);\n }\n setPageNumber(pageNumber, pageLabel) {\n this.pageNumber = pageNumber;\n this.pageLabel = pageLabel;\n this.#updateUIState(false);\n }\n setPagesCount(pagesCount, hasPageLabels) {\n this.pagesCount = pagesCount;\n this.hasPageLabels = hasPageLabels;\n this.#updateUIState(true);\n }\n setPageScale(pageScaleValue, pageScale) {\n this.pageScaleValue = (pageScaleValue || pageScale).toString();\n this.pageScale = pageScale;\n this.#updateUIState(false);\n }\n reset() {\n this.#colorPicker = null;\n this.pageNumber = 0;\n this.pageLabel = null;\n this.hasPageLabels = false;\n this.pagesCount = 0;\n this.pageScaleValue = DEFAULT_SCALE_VALUE;\n this.pageScale = DEFAULT_SCALE;\n this.#updateUIState(true);\n this.updateLoadingIndicatorState();\n this.#editorModeChanged({\n mode: AnnotationEditorType.DISABLE\n });\n }\n #bindListeners(buttons) {\n const {\n eventBus\n } = this;\n const {\n editorHighlightColorPicker,\n editorHighlightButton,\n pageNumber,\n scaleSelect\n } = this.#opts;\n const self = this;\n for (const {\n element,\n eventName,\n eventDetails,\n telemetry\n } of buttons) {\n element.addEventListener("click", evt => {\n if (eventName !== null) {\n eventBus.dispatch(eventName, {\n source: this,\n ...eventDetails,\n isFromKeyboard: evt.detail === 0\n });\n }\n if (telemetry) {\n eventBus.dispatch("reporttelemetry", {\n source: this,\n details: telemetry\n });\n }\n });\n }\n pageNumber.addEventListener("click", function () {\n this.select();\n });\n pageNumber.addEventListener("change", function () {\n eventBus.dispatch("pagenumberchanged", {\n source: self,\n value: this.value\n });\n });\n eventBus._on("pagesedited", ({\n pagesMapper\n }) => {\n const pagesCount = pagesMapper.pagesNumber;\n if (pagesCount !== this.pagesCount) {\n this.setPagesCount(pagesCount, this.hasPageLabels);\n }\n });\n scaleSelect.addEventListener("change", function () {\n if (this.value === "custom") {\n return;\n }\n eventBus.dispatch("scalechanged", {\n source: self,\n value: this.value\n });\n });\n scaleSelect.addEventListener("click", function ({\n target\n }) {\n if (this.value === self.pageScaleValue && target.tagName.toUpperCase() === "OPTION") {\n this.blur();\n }\n });\n scaleSelect.oncontextmenu = noContextMenu;\n eventBus._on("annotationeditormodechanged", this.#editorModeChanged.bind(this));\n eventBus._on("showannotationeditorui", ({\n mode\n }) => {\n switch (mode) {\n case AnnotationEditorType.HIGHLIGHT:\n editorHighlightButton.click();\n break;\n }\n });\n eventBus._on("toolbardensity", this.#updateToolbarDensity.bind(this));\n if (editorHighlightColorPicker) {\n eventBus._on("annotationeditoruimanager", ({\n uiManager\n }) => {\n const cp = this.#colorPicker = new ColorPicker({\n uiManager\n });\n uiManager.setMainHighlightColorPicker(cp);\n editorHighlightColorPicker.append(cp.renderMainDropdown());\n });\n eventBus._on("mainhighlightcolorpickerupdatecolor", ({\n value\n }) => {\n this.#colorPicker?.updateColor(value);\n });\n }\n }\n #editorModeChanged({\n mode\n }) {\n const {\n editorCommentButton,\n editorCommentParamsToolbar,\n editorFreeTextButton,\n editorFreeTextParamsToolbar,\n editorHighlightButton,\n editorHighlightParamsToolbar,\n editorInkButton,\n editorInkParamsToolbar,\n editorStampButton,\n editorStampParamsToolbar,\n editorSignatureButton,\n editorSignatureParamsToolbar\n } = this.#opts;\n toggleExpandedBtn(editorCommentButton, mode === AnnotationEditorType.POPUP, editorCommentParamsToolbar);\n toggleExpandedBtn(editorFreeTextButton, mode === AnnotationEditorType.FREETEXT, editorFreeTextParamsToolbar);\n toggleExpandedBtn(editorHighlightButton, mode === AnnotationEditorType.HIGHLIGHT, editorHighlightParamsToolbar);\n toggleExpandedBtn(editorInkButton, mode === AnnotationEditorType.INK, editorInkParamsToolbar);\n toggleExpandedBtn(editorStampButton, mode === AnnotationEditorType.STAMP, editorStampParamsToolbar);\n toggleExpandedBtn(editorSignatureButton, mode === AnnotationEditorType.SIGNATURE, editorSignatureParamsToolbar);\n editorCommentButton.disabled = editorFreeTextButton.disabled = editorHighlightButton.disabled = editorInkButton.disabled = editorStampButton.disabled = editorSignatureButton.disabled = mode === AnnotationEditorType.DISABLE;\n }\n #updateUIState(resetNumPages = false) {\n const {\n pageNumber,\n pagesCount,\n pageScaleValue,\n pageScale\n } = this;\n const opts = this.#opts;\n if (resetNumPages) {\n if (this.hasPageLabels) {\n opts.pageNumber.type = "text";\n opts.numPages.setAttribute("data-l10n-id", "pdfjs-page-of-pages");\n } else {\n opts.pageNumber.type = "number";\n opts.numPages.setAttribute("data-l10n-id", "pdfjs-of-pages");\n opts.numPages.setAttribute("data-l10n-args", JSON.stringify({\n pagesCount\n }));\n }\n opts.pageNumber.max = pagesCount;\n }\n if (this.hasPageLabels) {\n opts.pageNumber.value = this.pageLabel;\n opts.numPages.setAttribute("data-l10n-args", JSON.stringify({\n pageNumber,\n pagesCount\n }));\n } else {\n opts.pageNumber.value = pageNumber;\n }\n opts.previous.disabled = pageNumber <= 1;\n opts.next.disabled = pageNumber >= pagesCount;\n opts.zoomOut.disabled = pageScale <= MIN_SCALE;\n opts.zoomIn.disabled = pageScale >= MAX_SCALE;\n let predefinedValueFound = false;\n for (const option of opts.scaleSelect.options) {\n if (option.value !== pageScaleValue) {\n option.selected = false;\n continue;\n }\n option.selected = true;\n predefinedValueFound = true;\n }\n if (!predefinedValueFound) {\n opts.customScaleOption.selected = true;\n opts.customScaleOption.setAttribute("data-l10n-args", JSON.stringify({\n scale: Math.round(pageScale * 10000) / 100\n }));\n }\n }\n updateLoadingIndicatorState(loading = false) {\n const {\n pageNumber\n } = this.#opts;\n pageNumber.classList.toggle("loading", loading);\n }\n}\n\n;// ./web/view_history.js\n\n\n\nconst DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20;\nclass ViewHistory {\n constructor(fingerprint, cacheSize = DEFAULT_VIEW_HISTORY_CACHE_SIZE) {\n this.fingerprint = fingerprint;\n this.cacheSize = cacheSize;\n this._initializedPromise = this._readFromStorage().then(databaseStr => {\n const database = JSON.parse(databaseStr || "{}");\n let index = -1;\n if (!Array.isArray(database.files)) {\n database.files = [];\n } else {\n while (database.files.length >= this.cacheSize) {\n database.files.shift();\n }\n for (let i = 0, ii = database.files.length; i < ii; i++) {\n const branch = database.files[i];\n if (branch.fingerprint === this.fingerprint) {\n index = i;\n break;\n }\n }\n }\n if (index === -1) {\n index = database.files.push({\n fingerprint: this.fingerprint\n }) - 1;\n }\n this.file = database.files[index];\n this.database = database;\n });\n }\n async _writeToStorage() {\n const databaseStr = JSON.stringify(this.database);\n localStorage.setItem("pdfjs.history", databaseStr);\n }\n async _readFromStorage() {\n return localStorage.getItem("pdfjs.history");\n }\n async set(name, val) {\n await this._initializedPromise;\n this.file[name] = val;\n return this._writeToStorage();\n }\n async setMultiple(properties) {\n await this._initializedPromise;\n for (const name in properties) {\n this.file[name] = properties[name];\n }\n return this._writeToStorage();\n }\n async get(name, defaultValue) {\n await this._initializedPromise;\n const val = this.file[name];\n return val !== undefined ? val : defaultValue;\n }\n async getMultiple(properties) {\n await this._initializedPromise;\n const values = Object.create(null);\n for (const name in properties) {\n const val = this.file[name];\n values[name] = val !== undefined ? val : properties[name];\n }\n return values;\n }\n}\n\n;// ./web/views_manager.js\n\n\n\nconst SIDEBAR_WIDTH_VAR = "--viewsManager-width";\nconst SIDEBAR_RESIZING_CLASS = "viewsManagerResizing";\nconst UI_NOTIFICATION_CLASS = "pdfSidebarNotification";\nclass ViewsManager extends Sidebar {\n static #l10nDescription = null;\n #hasAnimations = !window.matchMedia("(prefers-reduced-motion: reduce)").matches;\n constructor({\n elements: {\n outerContainer,\n sidebarContainer,\n toggleButton,\n resizer,\n thumbnailButton,\n outlineButton,\n attachmentsButton,\n layersButton,\n thumbnailsView,\n outlinesView,\n attachmentsView,\n layersView,\n viewsManagerAddFileButton,\n viewsManagerCurrentOutlineButton,\n viewsManagerSelectorButton,\n viewsManagerSelectorOptions,\n viewsManagerHeaderLabel,\n viewsManagerStatus\n },\n eventBus,\n l10n\n }) {\n super({\n sidebar: sidebarContainer,\n resizer,\n toggleButton\n }, l10n.getDirection() === "ltr", false);\n this.isOpen = false;\n this.active = SidebarView.THUMBS;\n this.isInitialViewSet = false;\n this.isInitialEventDispatched = false;\n this.onToggled = null;\n this.onUpdateThumbnails = null;\n this.outerContainer = outerContainer;\n this.sidebarContainer = sidebarContainer;\n this.toggleButton = toggleButton;\n this.resizer = resizer;\n this.thumbnailButton = thumbnailButton;\n this.outlineButton = outlineButton;\n this.attachmentsButton = attachmentsButton;\n this.layersButton = layersButton;\n this.thumbnailsView = thumbnailsView;\n this.outlinesView = outlinesView;\n this.attachmentsView = attachmentsView;\n this.layersView = layersView;\n this.viewsManagerAddFileButton = viewsManagerAddFileButton;\n this.viewsManagerCurrentOutlineButton = viewsManagerCurrentOutlineButton;\n this.viewsManagerHeaderLabel = viewsManagerHeaderLabel;\n this.viewsManagerStatus = viewsManagerStatus;\n this.eventBus = eventBus;\n this.menu = new Menu(viewsManagerSelectorOptions, viewsManagerSelectorButton, [thumbnailButton, outlineButton, attachmentsButton, layersButton]);\n ViewsManager.#l10nDescription ||= Object.freeze({\n pagesTitle: "pdfjs-views-manager-pages-title",\n outlinesTitle: "pdfjs-views-manager-outlines-title",\n attachmentsTitle: "pdfjs-views-manager-attachments-title",\n layersTitle: "pdfjs-views-manager-layers-title",\n notificationButton: "pdfjs-toggle-views-manager-notification-button",\n toggleButton: "pdfjs-toggle-views-manager-button"\n });\n this.#addEventListeners();\n }\n reset() {\n this.isInitialViewSet = false;\n this.isInitialEventDispatched = false;\n this.#hideUINotification(true);\n this.switchView(SidebarView.THUMBS);\n this.outlineButton.disabled = this.attachmentsButton.disabled = this.layersButton.disabled = false;\n this.viewsManagerCurrentOutlineButton.disabled = true;\n }\n get visibleView() {\n return this.isOpen ? this.active : SidebarView.NONE;\n }\n setInitialView(view = SidebarView.NONE) {\n if (this.isInitialViewSet) {\n return;\n }\n this.isInitialViewSet = true;\n if (view === SidebarView.NONE || view === SidebarView.UNKNOWN) {\n this.#dispatchEvent();\n return;\n }\n this.switchView(view, true);\n if (!this.isInitialEventDispatched) {\n this.#dispatchEvent();\n }\n }\n switchView(view, forceOpen = false) {\n const isViewChanged = view !== this.active;\n let forceRendering = false;\n let titleL10nId = null;\n switch (view) {\n case SidebarView.NONE:\n if (this.isOpen) {\n this.close();\n }\n return;\n case SidebarView.THUMBS:\n titleL10nId = "pagesTitle";\n if (this.isOpen && isViewChanged) {\n forceRendering = true;\n }\n break;\n case SidebarView.OUTLINE:\n titleL10nId = "outlinesTitle";\n if (this.outlineButton.disabled) {\n return;\n }\n break;\n case SidebarView.ATTACHMENTS:\n titleL10nId = "attachmentsTitle";\n if (this.attachmentsButton.disabled) {\n return;\n }\n break;\n case SidebarView.LAYERS:\n titleL10nId = "layersTitle";\n if (this.layersButton.disabled) {\n return;\n }\n break;\n default:\n console.error(`PDFSidebar.switchView: "${view}" is not a valid view.`);\n return;\n }\n this.viewsManagerStatus.hidden = view !== SidebarView.THUMBS;\n this.viewsManagerAddFileButton.hidden = view !== SidebarView.THUMBS;\n this.viewsManagerCurrentOutlineButton.hidden = view !== SidebarView.OUTLINE;\n this.viewsManagerHeaderLabel.setAttribute("data-l10n-id", ViewsManager.#l10nDescription[titleL10nId] || "");\n this.active = view;\n toggleSelectedBtn(this.thumbnailButton, view === SidebarView.THUMBS, this.thumbnailsView);\n toggleSelectedBtn(this.outlineButton, view === SidebarView.OUTLINE, this.outlinesView);\n toggleSelectedBtn(this.attachmentsButton, view === SidebarView.ATTACHMENTS, this.attachmentsView);\n toggleSelectedBtn(this.layersButton, view === SidebarView.LAYERS, this.layersView);\n if (forceOpen && !this.isOpen) {\n this.open();\n return;\n }\n if (forceRendering) {\n this.onUpdateThumbnails();\n this.onToggled();\n }\n if (isViewChanged) {\n this.#dispatchEvent();\n }\n }\n open() {\n if (this.isOpen) {\n return;\n }\n this.isOpen = true;\n this.onResizing(this.width);\n this._sidebar.hidden = false;\n toggleExpandedBtn(this.toggleButton, true);\n this.switchView(this.active);\n if (this.#hasAnimations) {\n queueMicrotask(() => {\n this.outerContainer.classList.add("viewsManagerMoving", "viewsManagerOpen");\n });\n } else {\n this.outerContainer.classList.add("viewsManagerOpen");\n this.eventBus.dispatch("resize", {\n source: this\n });\n }\n if (this.active === SidebarView.THUMBS) {\n this.onUpdateThumbnails();\n }\n this.onToggled();\n this.#dispatchEvent();\n this.#hideUINotification();\n }\n close(evt = null) {\n if (!this.isOpen) {\n return;\n }\n this.isOpen = false;\n this._sidebar.hidden = true;\n toggleExpandedBtn(this.toggleButton, false);\n this.outerContainer.classList.add("viewsManagerMoving");\n this.outerContainer.classList.remove("viewsManagerOpen");\n this.onToggled();\n this.#dispatchEvent();\n if (evt?.detail > 0) {\n this.toggleButton.blur();\n }\n }\n toggle(evt = null) {\n super.toggle();\n if (this.isOpen) {\n this.close(evt);\n } else {\n this.open();\n }\n }\n #dispatchEvent() {\n if (this.isInitialViewSet) {\n this.isInitialEventDispatched ||= true;\n }\n this.eventBus.dispatch("sidebarviewchanged", {\n source: this,\n view: this.visibleView\n });\n }\n #showUINotification() {\n this.toggleButton.setAttribute("data-l10n-id", ViewsManager.#l10nDescription.notificationButton);\n if (!this.isOpen) {\n this.toggleButton.classList.add(UI_NOTIFICATION_CLASS);\n }\n }\n #hideUINotification(reset = false) {\n if (this.isOpen || reset) {\n this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS);\n }\n if (reset) {\n this.toggleButton.setAttribute("data-l10n-id", ViewsManager.#l10nDescription.toggleButton);\n }\n }\n #addEventListeners() {\n const {\n eventBus,\n outerContainer\n } = this;\n if (this.#hasAnimations) {\n this.sidebarContainer.addEventListener("transitionend", evt => {\n if (evt.target === this.sidebarContainer) {\n outerContainer.classList.remove("viewsManagerMoving");\n eventBus.dispatch("resize", {\n source: this\n });\n }\n });\n }\n this.thumbnailButton.addEventListener("click", () => {\n this.switchView(SidebarView.THUMBS);\n });\n this.outlineButton.addEventListener("click", () => {\n this.switchView(SidebarView.OUTLINE);\n });\n this.outlineButton.addEventListener("dblclick", () => {\n eventBus.dispatch("toggleoutlinetree", {\n source: this\n });\n });\n this.attachmentsButton.addEventListener("click", () => {\n this.switchView(SidebarView.ATTACHMENTS);\n });\n this.layersButton.addEventListener("click", () => {\n this.switchView(SidebarView.LAYERS);\n });\n this.layersButton.addEventListener("dblclick", () => {\n eventBus.dispatch("resetlayers", {\n source: this\n });\n });\n this.viewsManagerCurrentOutlineButton.addEventListener("click", () => {\n eventBus.dispatch("currentoutlineitem", {\n source: this\n });\n });\n const onTreeLoaded = (count, button, view) => {\n button.disabled = !count;\n if (count) {\n this.#showUINotification();\n } else if (this.active === view) {\n this.switchView(SidebarView.THUMBS);\n }\n };\n eventBus._on("outlineloaded", evt => {\n onTreeLoaded(evt.outlineCount, this.outlineButton, SidebarView.OUTLINE);\n evt.currentOutlineItemPromise.then(enabled => {\n if (!this.isInitialViewSet) {\n return;\n }\n this.viewsManagerCurrentOutlineButton.disabled = !enabled;\n });\n });\n eventBus._on("attachmentsloaded", evt => {\n onTreeLoaded(evt.attachmentsCount, this.attachmentsButton, SidebarView.ATTACHMENTS);\n });\n eventBus._on("layersloaded", evt => {\n onTreeLoaded(evt.layersCount, this.layersButton, SidebarView.LAYERS);\n });\n eventBus._on("presentationmodechanged", evt => {\n if (evt.state === PresentationModeState.NORMAL && this.visibleView === SidebarView.THUMBS) {\n this.onUpdateThumbnails();\n }\n });\n }\n onStartResizing() {\n this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);\n }\n onStopResizing() {\n this.eventBus.dispatch("resize", {\n source: this\n });\n this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);\n }\n onResizing(newWidth) {\n docStyle.setProperty(SIDEBAR_WIDTH_VAR, `${newWidth}px`);\n }\n}\n\n;// ./web/app.js\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst FORCE_PAGES_LOADED_TIMEOUT = 10000;\nconst ViewOnLoad = {\n UNKNOWN: -1,\n PREVIOUS: 0,\n INITIAL: 1\n};\nconst PDFViewerApplication = {\n initialBookmark: document.location.hash.substring(1),\n _initializedCapability: {\n ...Promise.withResolvers(),\n settled: false\n },\n appConfig: null,\n pdfDocument: null,\n pdfLoadingTask: null,\n printService: null,\n pdfViewer: null,\n pdfThumbnailViewer: null,\n pdfRenderingQueue: null,\n pdfPresentationMode: null,\n pdfDocumentProperties: null,\n pdfLinkService: null,\n pdfTextExtractor: null,\n pdfHistory: null,\n viewsManager: null,\n pdfOutlineViewer: null,\n pdfAttachmentViewer: null,\n pdfLayerViewer: null,\n pdfCursorTools: null,\n pdfScriptingManager: null,\n store: null,\n downloadManager: null,\n overlayManager: null,\n preferences: new Preferences(),\n toolbar: null,\n secondaryToolbar: null,\n eventBus: null,\n l10n: null,\n annotationEditorParams: null,\n imageAltTextSettings: null,\n isInitialViewSet: false,\n isViewerEmbedded: window.parent !== window,\n url: "",\n baseUrl: "",\n mlManager: null,\n _downloadUrl: "",\n _eventBusAbortController: null,\n _windowAbortController: null,\n _globalAbortController: new AbortController(),\n documentInfo: null,\n metadata: null,\n _contentDispositionFilename: null,\n _contentLength: null,\n _saveInProgress: false,\n _wheelUnusedTicks: 0,\n _wheelUnusedFactor: 1,\n _touchManager: null,\n _touchUnusedTicks: 0,\n _touchUnusedFactor: 1,\n _PDFBug: null,\n _hasAnnotationEditors: false,\n _title: document.title,\n _printAnnotationStoragePromise: null,\n _isCtrlKeyDown: false,\n _caretBrowsing: null,\n _isScrolling: false,\n editorUndoBar: null,\n _printPermissionPromise: null,\n async initialize(appConfig) {\n this.appConfig = appConfig;\n try {\n await this.preferences.initializedPromise;\n } catch (ex) {\n console.error("initialize:", ex);\n }\n if (AppOptions.get("pdfBugEnabled")) {\n await this._parseHashParams();\n }\n let mode;\n switch (AppOptions.get("viewerCssTheme")) {\n case 1:\n mode = "light";\n break;\n case 2:\n mode = "dark";\n break;\n }\n if (mode) {\n docStyle.setProperty("color-scheme", mode);\n }\n this.l10n = await this.externalServices.createL10n();\n document.getElementsByTagName("html")[0].dir = this.l10n.getDirection();\n this.l10n.translate(appConfig.appContainer || document.documentElement);\n if (this.isViewerEmbedded && AppOptions.get("externalLinkTarget") === LinkTarget.NONE) {\n AppOptions.set("externalLinkTarget", LinkTarget.TOP);\n }\n await this._initializeViewerComponents();\n this.pdfTextExtractor = new PdfTextExtractor(this.externalServices);\n this.bindEvents();\n this.bindWindowEvents();\n this._initializedCapability.settled = true;\n this._initializedCapability.resolve();\n },\n async _parseHashParams() {\n const hash = document.location.hash.substring(1);\n if (!hash) {\n return;\n }\n const {\n mainContainer,\n viewerContainer\n } = this.appConfig,\n params = parseQueryString(hash);\n const loadPDFBug = async () => {\n if (this._PDFBug) {\n return;\n }\n const {\n PDFBug\n } = await import(\n /*webpackIgnore: true*/\n /*@vite-ignore*/\n AppOptions.get("debuggerSrc"));\n this._PDFBug = PDFBug;\n };\n if (params.get("disableworker") === "true") {\n try {\n GlobalWorkerOptions.workerSrc ||= AppOptions.get("workerSrc");\n await import(\n /*webpackIgnore: true*/\n /*@vite-ignore*/\n PDFWorker.workerSrc);\n AppOptions.set("workerPort", null);\n } catch (ex) {\n console.error("_parseHashParams:", ex);\n }\n }\n if (params.has("textlayer")) {\n switch (params.get("textlayer")) {\n case "off":\n AppOptions.set("textLayerMode", TextLayerMode.DISABLE);\n break;\n case "visible":\n case "shadow":\n case "hover":\n viewerContainer.classList.add(`textLayer-${params.get("textlayer")}`);\n try {\n await loadPDFBug();\n this._PDFBug.loadCSS();\n } catch (ex) {\n console.error("_parseHashParams:", ex);\n }\n break;\n }\n }\n if (params.has("pdfbug")) {\n const enabled = params.get("pdfbug").split(",");\n try {\n await loadPDFBug();\n this._PDFBug.init(mainContainer, enabled);\n } catch (ex) {\n console.error("_parseHashParams:", ex);\n }\n const debugOpts = {\n pdfBug: true,\n fontExtraProperties: true\n };\n if (globalThis.StepperManager?.enabled) {\n debugOpts.minDurationToUpdateCanvas = 0;\n }\n AppOptions.setAll(debugOpts);\n }\n if (params.has("locale")) {\n AppOptions.set("localeProperties", {\n lang: params.get("locale")\n });\n }\n const opts = {\n disableAutoFetch: x => x === "true",\n disableFontFace: x => x === "true",\n disableHistory: x => x === "true",\n disableRange: x => x === "true",\n disableStream: x => x === "true",\n verbosity: x => x | 0\n };\n for (const name in opts) {\n const check = opts[name],\n key = name.toLowerCase();\n if (params.has(key)) {\n AppOptions.set(name, check(params.get(key)));\n }\n }\n },\n async _initializeViewerComponents() {\n const {\n appConfig,\n externalServices,\n l10n,\n mlManager\n } = this;\n const abortSignal = this._globalAbortController.signal;\n const eventBus = new EventBus();\n this.eventBus = AppOptions.eventBus = eventBus;\n mlManager?.setEventBus(eventBus, abortSignal);\n const overlayManager = this.overlayManager = new OverlayManager();\n const renderingQueue = this.pdfRenderingQueue = new PDFRenderingQueue();\n renderingQueue.onIdle = this._cleanup.bind(this);\n const linkService = this.pdfLinkService = new PDFLinkService({\n eventBus,\n externalLinkTarget: AppOptions.get("externalLinkTarget"),\n externalLinkRel: AppOptions.get("externalLinkRel"),\n ignoreDestinationZoom: AppOptions.get("ignoreDestinationZoom")\n });\n const downloadManager = this.downloadManager = new DownloadManager();\n const findController = this.findController = new PDFFindController({\n linkService,\n eventBus,\n updateMatchesCountOnProgress: true\n });\n const pdfScriptingManager = this.pdfScriptingManager = new PDFScriptingManager({\n eventBus,\n externalServices,\n docProperties: this._scriptingDocProperties.bind(this)\n });\n const container = appConfig.mainContainer,\n viewer = appConfig.viewerContainer;\n const annotationEditorMode = AppOptions.get("annotationEditorMode");\n const hasForcedColors = AppOptions.get("forcePageColors") || window.matchMedia("(forced-colors: active)").matches;\n const pageColors = hasForcedColors ? {\n background: AppOptions.get("pageColorsBackground"),\n foreground: AppOptions.get("pageColorsForeground")\n } : null;\n let altTextManager;\n if (AppOptions.get("enableUpdatedAddImage")) {\n altTextManager = appConfig.newAltTextDialog ? new NewAltTextManager(appConfig.newAltTextDialog, overlayManager, eventBus) : null;\n } else {\n altTextManager = appConfig.altTextDialog ? new AltTextManager(appConfig.altTextDialog, container, overlayManager, eventBus) : null;\n }\n if (appConfig.editorUndoBar) {\n this.editorUndoBar = new EditorUndoBar(appConfig.editorUndoBar, eventBus);\n }\n const signatureManager = AppOptions.get("enableSignatureEditor") && appConfig.addSignatureDialog ? new SignatureManager(appConfig.addSignatureDialog, appConfig.editSignatureDialog, appConfig.annotationEditorParams?.editorSignatureAddSignature || null, overlayManager, l10n, externalServices.createSignatureStorage(eventBus, abortSignal), eventBus) : null;\n const ltr = appConfig.viewerContainer ? getComputedStyle(appConfig.viewerContainer).direction === "ltr" : true;\n const commentManager = AppOptions.get("enableComment") && appConfig.editCommentDialog ? new CommentManager(appConfig.editCommentDialog, {\n learnMoreUrl: AppOptions.get("commentLearnMoreUrl"),\n sidebar: appConfig.annotationEditorParams?.editorCommentsSidebar || null,\n sidebarResizer: appConfig.annotationEditorParams?.editorCommentsSidebarResizer || null,\n commentsList: appConfig.annotationEditorParams?.editorCommentsSidebarList || null,\n commentCount: appConfig.annotationEditorParams?.editorCommentsSidebarCount || null,\n sidebarTitle: appConfig.annotationEditorParams?.editorCommentsSidebarTitle || null,\n closeButton: appConfig.annotationEditorParams?.editorCommentsSidebarCloseButton || null,\n commentToolbarButton: appConfig.toolbar?.editorCommentButton || null\n }, eventBus, linkService, overlayManager, ltr, hasForcedColors) : null;\n const enableHWA = AppOptions.get("enableHWA"),\n maxCanvasPixels = AppOptions.get("maxCanvasPixels"),\n maxCanvasDim = AppOptions.get("maxCanvasDim"),\n capCanvasAreaFactor = AppOptions.get("capCanvasAreaFactor");\n const pdfViewer = this.pdfViewer = new PDFViewer({\n container,\n viewer,\n viewerAlert: appConfig.viewerAlert,\n eventBus,\n renderingQueue,\n linkService,\n downloadManager,\n altTextManager,\n commentManager,\n signatureManager,\n editorUndoBar: this.editorUndoBar,\n findController,\n scriptingManager: AppOptions.get("enableScripting") && pdfScriptingManager,\n l10n,\n textLayerMode: AppOptions.get("textLayerMode"),\n annotationMode: AppOptions.get("annotationMode"),\n annotationEditorMode,\n annotationEditorHighlightColors: AppOptions.get("highlightEditorColors"),\n enableHighlightFloatingButton: AppOptions.get("enableHighlightFloatingButton"),\n enableUpdatedAddImage: AppOptions.get("enableUpdatedAddImage"),\n enableNewAltTextWhenAddingImage: AppOptions.get("enableNewAltTextWhenAddingImage"),\n imageResourcesPath: AppOptions.get("imageResourcesPath"),\n enablePrintAutoRotate: AppOptions.get("enablePrintAutoRotate"),\n maxCanvasPixels,\n maxCanvasDim,\n capCanvasAreaFactor,\n enableDetailCanvas: AppOptions.get("enableDetailCanvas"),\n enablePermissions: AppOptions.get("enablePermissions"),\n enableOptimizedPartialRendering: AppOptions.get("enableOptimizedPartialRendering"),\n pageColors,\n mlManager,\n abortSignal,\n enableHWA,\n supportsPinchToZoom: this.supportsPinchToZoom,\n enableAutoLinking: AppOptions.get("enableAutoLinking"),\n minDurationToUpdateCanvas: AppOptions.get("minDurationToUpdateCanvas")\n });\n renderingQueue.setViewer(pdfViewer);\n linkService.setViewer(pdfViewer);\n pdfScriptingManager.setViewer(pdfViewer);\n if (appConfig.viewsManager?.thumbnailsView) {\n this.pdfThumbnailViewer = new PDFThumbnailViewer({\n container: appConfig.viewsManager.thumbnailsView,\n eventBus,\n renderingQueue,\n linkService,\n maxCanvasPixels,\n maxCanvasDim,\n pageColors,\n abortSignal,\n enableHWA,\n enableSplitMerge: AppOptions.get("enableSplitMerge"),\n manageMenu: appConfig.viewsManager.manageMenu,\n addFileButton: appConfig.viewsManager.viewsManagerAddFileButton\n });\n renderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);\n }\n if (!this.isViewerEmbedded && !AppOptions.get("disableHistory")) {\n this.pdfHistory = new PDFHistory({\n linkService,\n eventBus\n });\n linkService.setHistory(this.pdfHistory);\n }\n if (!this.supportsIntegratedFind && appConfig.findBar) {\n this.findBar = new PDFFindBar(appConfig.findBar, appConfig.principalContainer, eventBus);\n }\n if (appConfig.annotationEditorParams) {\n if (annotationEditorMode !== AnnotationEditorType.DISABLE) {\n const editorSignatureButton = appConfig.toolbar?.editorSignatureButton;\n if (editorSignatureButton && AppOptions.get("enableSignatureEditor")) {\n editorSignatureButton.parentElement.hidden = false;\n }\n const editorCommentButton = appConfig.toolbar?.editorCommentButton;\n if (editorCommentButton && AppOptions.get("enableComment")) {\n editorCommentButton.parentElement.hidden = false;\n }\n this.annotationEditorParams = new AnnotationEditorParams(appConfig.annotationEditorParams, eventBus);\n } else {\n for (const id of ["editorModeButtons", "editorModeSeparator"]) {\n document.getElementById(id)?.classList.add("hidden");\n }\n }\n }\n if (mlManager && appConfig.secondaryToolbar?.imageAltTextSettingsButton) {\n this.imageAltTextSettings = new ImageAltTextSettings(appConfig.altTextSettingsDialog, overlayManager, eventBus, mlManager);\n }\n if (appConfig.documentProperties) {\n this.pdfDocumentProperties = new PDFDocumentProperties(appConfig.documentProperties, overlayManager, eventBus, l10n, () => this._docFilename, () => this._docTitle);\n }\n if (appConfig.secondaryToolbar?.cursorHandToolButton) {\n this.pdfCursorTools = new PDFCursorTools({\n container,\n eventBus,\n cursorToolOnLoad: AppOptions.get("cursorToolOnLoad")\n });\n }\n if (appConfig.toolbar) {\n this.toolbar = new Toolbar(appConfig.toolbar, eventBus, AppOptions.get("toolbarDensity"));\n }\n if (appConfig.secondaryToolbar) {\n if (AppOptions.get("enableAltText")) {\n appConfig.secondaryToolbar.imageAltTextSettingsButton?.classList.remove("hidden");\n appConfig.secondaryToolbar.imageAltTextSettingsSeparator?.classList.remove("hidden");\n }\n this.secondaryToolbar = new SecondaryToolbar(appConfig.secondaryToolbar, eventBus);\n }\n if (this.supportsFullscreen && appConfig.secondaryToolbar?.presentationModeButton) {\n this.pdfPresentationMode = new PDFPresentationMode({\n container,\n pdfViewer,\n eventBus\n });\n }\n if (appConfig.passwordOverlay) {\n this.passwordPrompt = new PasswordPrompt(appConfig.passwordOverlay, overlayManager, this.isViewerEmbedded);\n }\n if (appConfig.viewsManager?.outlinesView) {\n this.pdfOutlineViewer = new PDFOutlineViewer({\n container: appConfig.viewsManager.outlinesView,\n eventBus,\n l10n,\n linkService,\n downloadManager\n });\n }\n if (appConfig.viewsManager?.attachmentsView) {\n this.pdfAttachmentViewer = new PDFAttachmentViewer({\n container: appConfig.viewsManager.attachmentsView,\n eventBus,\n l10n,\n downloadManager\n });\n }\n if (appConfig.viewsManager?.layersView) {\n this.pdfLayerViewer = new PDFLayerViewer({\n container: appConfig.viewsManager.layersView,\n eventBus,\n l10n\n });\n }\n if (appConfig.viewsManager) {\n this.viewsManager = new ViewsManager({\n elements: appConfig.viewsManager,\n eventBus,\n l10n\n });\n this.viewsManager.onToggled = this.forceRendering.bind(this);\n this.viewsManager.onUpdateThumbnails = () => {\n for (const pageView of pdfViewer.getCachedPageViews()) {\n if (pageView.renderingState === RenderingStates.FINISHED) {\n this.pdfThumbnailViewer.getThumbnail(pageView.id - 1)?.setImage(pageView);\n }\n }\n this.pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber);\n };\n }\n },\n async run(config) {\n await this.initialize(config);\n const {\n appConfig,\n eventBus\n } = this;\n let file;\n const queryString = document.location.search.substring(1);\n const params = parseQueryString(queryString);\n file = params.get("file") ?? AppOptions.get("defaultUrl");\n try {\n file = new URL(file).href;\n } catch {\n file = encodeURIComponent(file).replaceAll("%2F", "/");\n }\n validateFileURL(file);\n const fileInput = this._openFileInput = document.createElement("input");\n fileInput.id = "fileInput";\n fileInput.hidden = true;\n fileInput.type = "file";\n fileInput.value = null;\n document.body.append(fileInput);\n fileInput.addEventListener("change", function (evt) {\n const {\n files\n } = evt.target;\n if (!files || files.length === 0) {\n return;\n }\n eventBus.dispatch("fileinputchange", {\n source: this,\n fileInput: evt.target\n });\n });\n appConfig.mainContainer.addEventListener("dragover", function (evt) {\n for (const item of evt.dataTransfer.items) {\n if (item.type === "application/pdf") {\n evt.dataTransfer.dropEffect = evt.dataTransfer.effectAllowed === "copy" ? "copy" : "move";\n stopEvent(evt);\n return;\n }\n }\n });\n appConfig.mainContainer.addEventListener("drop", function (evt) {\n if (evt.dataTransfer.files?.[0].type !== "application/pdf") {\n return;\n }\n stopEvent(evt);\n eventBus.dispatch("fileinputchange", {\n source: this,\n fileInput: evt.dataTransfer\n });\n });\n if (!AppOptions.get("supportsDocumentFonts")) {\n AppOptions.set("disableFontFace", true);\n this.l10n.get("pdfjs-web-fonts-disabled").then(msg => {\n console.warn(msg);\n });\n }\n const togglePrintingButtons = visible => {\n appConfig.toolbar?.print?.classList.toggle("hidden", !visible);\n appConfig.secondaryToolbar?.printButton.classList.toggle("hidden", !visible);\n };\n if (!this.supportsPrinting) {\n togglePrintingButtons(false);\n } else {\n eventBus.on("printingallowed", ({\n isAllowed\n }) => togglePrintingButtons(isAllowed));\n }\n if (!this.supportsFullscreen) {\n appConfig.secondaryToolbar?.presentationModeButton.classList.add("hidden");\n }\n if (this.supportsIntegratedFind) {\n appConfig.findBar?.toggleButton?.classList.add("hidden");\n }\n if (file) {\n this.open({\n url: file\n });\n } else {\n this._hideViewBookmark();\n }\n },\n get externalServices() {\n return shadow(this, "externalServices", new ExternalServices());\n },\n get initialized() {\n return this._initializedCapability.settled;\n },\n get initializedPromise() {\n return this._initializedCapability.promise;\n },\n updateZoom(steps, scaleFactor, origin) {\n if (this.pdfViewer.isInPresentationMode) {\n return;\n }\n this.pdfViewer.updateScale({\n drawingDelay: AppOptions.get("defaultZoomDelay"),\n steps,\n scaleFactor,\n origin\n });\n },\n zoomIn() {\n this.updateZoom(1);\n },\n zoomOut() {\n this.updateZoom(-1);\n },\n zoomReset() {\n if (this.pdfViewer.isInPresentationMode) {\n return;\n }\n this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;\n },\n touchPinchCallback(origin, prevDistance, distance) {\n if (this.supportsPinchToZoom) {\n const newScaleFactor = this._accumulateFactor(this.pdfViewer.currentScale, distance / prevDistance, "_touchUnusedFactor");\n this.updateZoom(null, newScaleFactor, origin);\n } else {\n const PIXELS_PER_LINE_SCALE = 30;\n const ticks = this._accumulateTicks((distance - prevDistance) / PIXELS_PER_LINE_SCALE, "_touchUnusedTicks");\n this.updateZoom(ticks, null, origin);\n }\n },\n touchPinchEndCallback() {\n this._touchUnusedTicks = 0;\n this._touchUnusedFactor = 1;\n },\n get pagesCount() {\n return this.pdfDocument ? this.pdfDocument.numPages : 0;\n },\n get page() {\n return this.pdfViewer.currentPageNumber;\n },\n set page(val) {\n this.pdfViewer.currentPageNumber = val;\n },\n get supportsPrinting() {\n return shadow(this, "supportsPrinting", AppOptions.get("supportsPrinting") && PDFPrintServiceFactory.supportsPrinting);\n },\n get supportsFullscreen() {\n return shadow(this, "supportsFullscreen", document.fullscreenEnabled);\n },\n get supportsPinchToZoom() {\n return shadow(this, "supportsPinchToZoom", AppOptions.get("supportsPinchToZoom"));\n },\n get supportsIntegratedFind() {\n return shadow(this, "supportsIntegratedFind", AppOptions.get("supportsIntegratedFind"));\n },\n get loadingBar() {\n const barElement = document.getElementById("loadingBar");\n const bar = barElement ? new ProgressBar(barElement) : null;\n return shadow(this, "loadingBar", bar);\n },\n get supportsMouseWheelZoomCtrlKey() {\n return shadow(this, "supportsMouseWheelZoomCtrlKey", AppOptions.get("supportsMouseWheelZoomCtrlKey"));\n },\n get supportsMouseWheelZoomMetaKey() {\n return shadow(this, "supportsMouseWheelZoomMetaKey", AppOptions.get("supportsMouseWheelZoomMetaKey"));\n },\n get supportsCaretBrowsingMode() {\n return AppOptions.get("supportsCaretBrowsingMode");\n },\n moveCaret(isUp, select) {\n this._caretBrowsing ||= new CaretBrowsingMode(this._globalAbortController.signal, this.appConfig.mainContainer, this.appConfig.viewerContainer, this.appConfig.toolbar?.container);\n this._caretBrowsing.moveCaret(isUp, select);\n },\n setTitleUsingUrl(url = "", downloadUrl = null) {\n this.url = url;\n this.baseUrl = updateUrlHash(url, "", true);\n if (downloadUrl) {\n this._downloadUrl = downloadUrl === url ? this.baseUrl : updateUrlHash(downloadUrl, "", true);\n }\n if (isDataScheme(url)) {\n this._hideViewBookmark();\n }\n let title = getPdfFilenameFromUrl(url, "");\n if (!title) {\n try {\n title = decodeURIComponent(getFilenameFromUrl(url));\n } catch {}\n }\n this.setTitle(title || url);\n },\n setTitle(title = this._title) {\n this._title = title;\n if (this.isViewerEmbedded) {\n return;\n }\n const editorIndicator = this._hasAnnotationEditors && !this.pdfRenderingQueue.printing;\n document.title = `${editorIndicator ? "* " : ""}${title}`;\n },\n get _docFilename() {\n return this._contentDispositionFilename || getPdfFilenameFromUrl(this.url);\n },\n get _docTitle() {\n const {\n documentInfo,\n metadata\n } = this;\n const title = metadata?.get("dc:title");\n if (title) {\n if (title !== "Untitled" && !/[\\uFFF0-\\uFFFF]/g.test(title)) {\n return title;\n }\n }\n return documentInfo.Title;\n },\n _hideViewBookmark() {\n const {\n secondaryToolbar\n } = this.appConfig;\n secondaryToolbar?.viewBookmarkButton.classList.add("hidden");\n if (secondaryToolbar?.presentationModeButton.classList.contains("hidden")) {\n document.getElementById("viewBookmarkSeparator")?.classList.add("hidden");\n }\n },\n async close() {\n this._unblockDocumentLoadEvent();\n this._hideViewBookmark();\n if (!this.pdfLoadingTask) {\n return;\n }\n if (this.pdfDocument?.annotationStorage.size > 0 && this._annotationStorageModified) {\n try {\n await this.save();\n } catch {}\n }\n const promises = [];\n promises.push(this.pdfLoadingTask.destroy());\n this.pdfLoadingTask = null;\n if (this.pdfDocument) {\n this.pdfDocument = null;\n this.pdfThumbnailViewer?.setDocument(null);\n this.pdfViewer.setDocument(null);\n this.pdfLinkService.setDocument(null);\n this.pdfDocumentProperties?.setDocument(null);\n this.pdfTextExtractor?.setViewer(null);\n }\n this.pdfLinkService.externalLinkEnabled = true;\n this.store = null;\n this.isInitialViewSet = false;\n this.url = "";\n this.baseUrl = "";\n this._downloadUrl = "";\n this.documentInfo = null;\n this.metadata = null;\n this._contentDispositionFilename = null;\n this._contentLength = null;\n this._saveInProgress = false;\n this._hasAnnotationEditors = false;\n promises.push(this.pdfScriptingManager.destroyPromise, this.passwordPrompt.close());\n this.setTitle();\n this.viewsManager?.reset();\n this.pdfOutlineViewer?.reset();\n this.pdfAttachmentViewer?.reset();\n this.pdfLayerViewer?.reset();\n this.pdfHistory?.reset();\n this.findBar?.reset();\n this.toolbar?.reset();\n this.secondaryToolbar?.reset();\n this._PDFBug?.cleanup();\n await Promise.all(promises);\n },\n async open(args) {\n if (this.pdfLoadingTask) {\n await this.close();\n }\n const workerParams = AppOptions.getAll(OptionKind.WORKER);\n Object.assign(GlobalWorkerOptions, workerParams);\n if (args.url) {\n this.setTitleUsingUrl(args.originalUrl || args.url, args.url);\n }\n const apiParams = AppOptions.getAll(OptionKind.API);\n const loadingTask = getDocument({\n ...apiParams,\n ...args\n });\n this.pdfLoadingTask = loadingTask;\n loadingTask.onPassword = (updateCallback, reason) => {\n if (this.isViewerEmbedded) {\n this._unblockDocumentLoadEvent();\n }\n this.pdfLinkService.externalLinkEnabled = false;\n this.passwordPrompt.setUpdateCallback(updateCallback, reason);\n this.passwordPrompt.open();\n };\n loadingTask.onProgress = evt => this.progress(evt.percent);\n return loadingTask.promise.then(pdfDocument => {\n this.load(pdfDocument);\n }, reason => {\n if (loadingTask !== this.pdfLoadingTask) {\n return undefined;\n }\n let key = "pdfjs-loading-error";\n if (reason instanceof InvalidPDFException) {\n key = "pdfjs-invalid-file-error";\n } else if (reason instanceof ResponseException) {\n key = reason.missing ? "pdfjs-missing-file-error" : "pdfjs-unexpected-response-error";\n }\n return this._documentError(key, {\n message: reason.message\n }).then(() => {\n throw reason;\n });\n });\n },\n async download() {\n let data;\n try {\n data = await (this.pdfDocument ? this.pdfDocument.getData() : this.pdfLoadingTask.getData());\n } catch {}\n this.downloadManager.download(data, this._downloadUrl, this._docFilename);\n },\n async save() {\n if (this._saveInProgress) {\n return;\n }\n this._saveInProgress = true;\n await this.pdfScriptingManager.dispatchWillSave();\n try {\n const data = await this.pdfDocument.saveDocument();\n this.downloadManager.download(data, this._downloadUrl, this._docFilename);\n } catch (reason) {\n console.error(`Error when saving the document:`, reason);\n await this.download();\n } finally {\n await this.pdfScriptingManager.dispatchDidSave();\n this._saveInProgress = false;\n }\n const editorStats = this.pdfDocument?.annotationStorage.editorStats;\n if (editorStats) {\n this.externalServices.reportTelemetry({\n type: "editing",\n data: {\n type: "save",\n stats: editorStats\n }\n });\n }\n },\n async downloadOrSave() {\n const {\n classList\n } = this.appConfig.appContainer;\n classList.add("wait");\n await (this.pdfDocument?.annotationStorage.size > 0 ? this.save() : this.download());\n classList.remove("wait");\n },\n async _documentError(key, moreInfo = null) {\n this._unblockDocumentLoadEvent();\n const message = await this._otherError(key || "pdfjs-loading-error", moreInfo);\n this.eventBus.dispatch("documenterror", {\n source: this,\n message,\n reason: moreInfo?.message ?? null\n });\n },\n async _otherError(key, moreInfo = null) {\n const message = await this.l10n.get(key);\n const moreInfoText = [`PDF.js v${version || "?"} (build: ${build || "?"})`];\n if (moreInfo) {\n moreInfoText.push(`Message: ${moreInfo.message}`);\n if (moreInfo.stack) {\n moreInfoText.push(`Stack: ${moreInfo.stack}`);\n } else {\n if (moreInfo.filename) {\n moreInfoText.push(`File: ${moreInfo.filename}`);\n }\n if (moreInfo.lineNumber) {\n moreInfoText.push(`Line: ${moreInfo.lineNumber}`);\n }\n }\n }\n console.error(`${message}\\n\\n${moreInfoText.join("\\n")}`);\n return message;\n },\n progress(percent) {\n if (!this.loadingBar || percent <= this.loadingBar.percent) {\n return;\n }\n this.loadingBar.percent = percent;\n if (this.pdfDocument?.loadingParams.disableAutoFetch ?? AppOptions.get("disableAutoFetch")) {\n this.loadingBar.setDisableAutoFetch();\n }\n },\n load(pdfDocument) {\n this.pdfDocument = pdfDocument;\n this._printPermissionPromise = new Promise(resolve => {\n this.eventBus.on("printingallowed", ({\n isAllowed\n }) => {\n resolve(isAllowed);\n }, {\n once: true\n });\n });\n pdfDocument.getDownloadInfo().then(({\n length\n }) => {\n this._contentLength = length;\n this.loadingBar?.hide();\n firstPagePromise.then(() => {\n this.eventBus.dispatch("documentloaded", {\n source: this\n });\n });\n });\n const pageLayoutPromise = pdfDocument.getPageLayout().catch(() => {});\n const pageModePromise = pdfDocument.getPageMode().catch(() => {});\n const openActionPromise = pdfDocument.getOpenAction().catch(() => {});\n this.toolbar?.setPagesCount(pdfDocument.numPages, false);\n this.secondaryToolbar?.setPagesCount(pdfDocument.numPages);\n this.pdfLinkService.setDocument(pdfDocument);\n this.pdfDocumentProperties?.setDocument(pdfDocument);\n const pdfViewer = this.pdfViewer;\n pdfViewer.setDocument(pdfDocument);\n this.pdfTextExtractor.setViewer(pdfViewer);\n const {\n firstPagePromise,\n onePageRendered,\n pagesPromise\n } = pdfViewer;\n this.pdfThumbnailViewer?.setDocument(pdfDocument);\n const storedPromise = (this.store = new ViewHistory(pdfDocument.fingerprints[0])).getMultiple({\n page: null,\n zoom: DEFAULT_SCALE_VALUE,\n scrollLeft: "0",\n scrollTop: "0",\n rotation: null,\n sidebarView: SidebarView.UNKNOWN,\n scrollMode: ScrollMode.UNKNOWN,\n spreadMode: SpreadMode.UNKNOWN\n }).catch(() => {});\n firstPagePromise.then(pdfPage => {\n this.loadingBar?.setWidth(this.appConfig.viewerContainer);\n this._initializeAnnotationStorageCallbacks(pdfDocument);\n Promise.all([animationStarted, storedPromise, pageLayoutPromise, pageModePromise, openActionPromise]).then(async ([timeStamp, stored, pageLayout, pageMode, openAction]) => {\n const viewOnLoad = AppOptions.get("viewOnLoad");\n this._initializePdfHistory({\n fingerprint: pdfDocument.fingerprints[0],\n viewOnLoad,\n initialDest: openAction?.dest\n });\n const initialBookmark = this.initialBookmark;\n const zoom = AppOptions.get("defaultZoomValue");\n let hash = zoom ? `zoom=${zoom}` : null;\n let rotation = null;\n let sidebarView = AppOptions.get("sidebarViewOnLoad");\n let scrollMode = AppOptions.get("scrollModeOnLoad");\n let spreadMode = AppOptions.get("spreadModeOnLoad");\n if (stored?.page && viewOnLoad !== ViewOnLoad.INITIAL) {\n hash = `page=${stored.page}&zoom=${zoom || stored.zoom},` + `${stored.scrollLeft},${stored.scrollTop}`;\n rotation = parseInt(stored.rotation, 10);\n if (sidebarView === SidebarView.UNKNOWN) {\n sidebarView = stored.sidebarView | 0;\n }\n if (scrollMode === ScrollMode.UNKNOWN) {\n scrollMode = stored.scrollMode | 0;\n }\n if (spreadMode === SpreadMode.UNKNOWN) {\n spreadMode = stored.spreadMode | 0;\n }\n }\n if (pageMode && sidebarView === SidebarView.UNKNOWN) {\n sidebarView = apiPageModeToSidebarView(pageMode);\n }\n if (pageLayout && scrollMode === ScrollMode.UNKNOWN && spreadMode === SpreadMode.UNKNOWN) {\n const modes = apiPageLayoutToViewerModes(pageLayout);\n spreadMode = modes.spreadMode;\n }\n this.setInitialView(hash, {\n rotation,\n sidebarView,\n scrollMode,\n spreadMode\n });\n this.eventBus.dispatch("documentinit", {\n source: this\n });\n await Promise.race([pagesPromise, new Promise(resolve => {\n setTimeout(resolve, FORCE_PAGES_LOADED_TIMEOUT);\n })]);\n if (!initialBookmark && !hash) {\n return;\n }\n if (pdfViewer.hasEqualPageSizes) {\n return;\n }\n this.initialBookmark = initialBookmark;\n pdfViewer.currentScaleValue = pdfViewer.currentScaleValue;\n this.setInitialView(hash);\n }).catch(() => {\n this.setInitialView();\n }).then(function () {\n pdfViewer.update();\n });\n });\n pagesPromise.then(() => {\n this._unblockDocumentLoadEvent();\n this._initializeAutoPrint(pdfDocument, openActionPromise);\n }, reason => {\n this._documentError("pdfjs-loading-error", {\n message: reason.message\n });\n });\n onePageRendered.then(data => {\n this.externalServices.reportTelemetry({\n type: "pageInfo",\n timestamp: data.timestamp\n });\n if (this.pdfOutlineViewer) {\n pdfDocument.getOutline().then(outline => {\n if (pdfDocument !== this.pdfDocument) {\n return;\n }\n this.pdfOutlineViewer.render({\n outline,\n pdfDocument\n });\n });\n }\n if (this.pdfAttachmentViewer) {\n pdfDocument.getAttachments().then(attachments => {\n if (pdfDocument !== this.pdfDocument) {\n return;\n }\n this.pdfAttachmentViewer.render({\n attachments\n });\n });\n }\n if (this.pdfLayerViewer) {\n pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => {\n if (pdfDocument !== this.pdfDocument) {\n return;\n }\n this.pdfLayerViewer.render({\n optionalContentConfig,\n pdfDocument\n });\n });\n }\n });\n this._initializePageLabels(pdfDocument);\n this._initializeMetadata(pdfDocument);\n },\n async _scriptingDocProperties(pdfDocument) {\n if (!this.documentInfo) {\n await new Promise(resolve => {\n this.eventBus._on("metadataloaded", resolve, {\n once: true\n });\n });\n if (pdfDocument !== this.pdfDocument) {\n return null;\n }\n }\n if (!this._contentLength) {\n await new Promise(resolve => {\n this.eventBus._on("documentloaded", resolve, {\n once: true\n });\n });\n if (pdfDocument !== this.pdfDocument) {\n return null;\n }\n }\n return {\n ...this.documentInfo,\n baseURL: this.baseUrl,\n filesize: this._contentLength,\n filename: this._docFilename,\n metadata: this.metadata?.getRaw(),\n authors: this.metadata?.get("dc:creator"),\n numPages: this.pagesCount,\n URL: this.url\n };\n },\n async _initializeAutoPrint(pdfDocument, openActionPromise) {\n const [openAction, jsActions] = await Promise.all([openActionPromise, this.pdfViewer.enableScripting ? null : pdfDocument.getJSActions()]);\n if (pdfDocument !== this.pdfDocument) {\n return;\n }\n let triggerAutoPrint = openAction?.action === "Print";\n if (jsActions) {\n console.warn("Warning: JavaScript support is not enabled");\n for (const name in jsActions) {\n if (triggerAutoPrint) {\n break;\n }\n switch (name) {\n case "WillClose":\n case "WillSave":\n case "DidSave":\n case "WillPrint":\n case "DidPrint":\n continue;\n }\n triggerAutoPrint = jsActions[name].some(js => AutoPrintRegExp.test(js));\n }\n }\n if (triggerAutoPrint) {\n this.triggerPrinting();\n }\n },\n async _initializeMetadata(pdfDocument) {\n const {\n info,\n metadata,\n contentDispositionFilename,\n contentLength,\n hasStructTree\n } = await pdfDocument.getMetadata();\n if (pdfDocument !== this.pdfDocument) {\n return;\n }\n this.externalServices.reportTelemetry({\n type: "taggedPDF",\n data: hasStructTree\n });\n this.documentInfo = info;\n this.metadata = metadata;\n this._contentDispositionFilename ??= contentDispositionFilename;\n this._contentLength ??= contentLength;\n console.log(`PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` + `${(metadata?.get("pdf:producer") || info.Producer || "-").trim()} / ` + `${(metadata?.get("xmp:creatortool") || info.Creator || "-").trim()}` + `] (PDF.js: ${version || "?"} [${build || "?"}])`);\n const pdfTitle = this._docTitle;\n if (pdfTitle) {\n this.setTitle(`${pdfTitle} - ${this._contentDispositionFilename || this._title}`);\n } else if (this._contentDispositionFilename) {\n this.setTitle(this._contentDispositionFilename);\n }\n if (info.IsXFAPresent && !info.IsAcroFormPresent && !pdfDocument.isPureXfa) {\n if (pdfDocument.loadingParams.enableXfa) {\n console.warn("Warning: XFA Foreground documents are not supported");\n } else {\n console.warn("Warning: XFA support is not enabled");\n }\n } else if ((info.IsAcroFormPresent || info.IsXFAPresent) && !this.pdfViewer.renderForms) {\n console.warn("Warning: Interactive form support is not enabled");\n }\n if (info.IsSignaturesPresent) {\n console.warn("Warning: Digital signatures validation is not supported");\n }\n this.eventBus.dispatch("metadataloaded", {\n source: this\n });\n },\n async _initializePageLabels(pdfDocument) {\n const labels = await pdfDocument.getPageLabels();\n if (pdfDocument !== this.pdfDocument) {\n return;\n }\n if (!labels || AppOptions.get("disablePageLabels")) {\n return;\n }\n const numLabels = labels.length;\n let standardLabels = 0,\n emptyLabels = 0;\n for (let i = 0; i < numLabels; i++) {\n const label = labels[i];\n if (label === (i + 1).toString()) {\n standardLabels++;\n } else if (label === "") {\n emptyLabels++;\n } else {\n break;\n }\n }\n if (standardLabels >= numLabels || emptyLabels >= numLabels) {\n return;\n }\n const {\n pdfViewer,\n pdfThumbnailViewer,\n toolbar\n } = this;\n pdfViewer.setPageLabels(labels);\n pdfThumbnailViewer?.setPageLabels(labels);\n toolbar?.setPagesCount(numLabels, true);\n toolbar?.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel);\n },\n _initializePdfHistory({\n fingerprint,\n viewOnLoad,\n initialDest = null\n }) {\n if (!this.pdfHistory) {\n return;\n }\n this.pdfHistory.initialize({\n fingerprint,\n resetHistory: viewOnLoad === ViewOnLoad.INITIAL,\n updateUrl: AppOptions.get("historyUpdateUrl")\n });\n if (this.pdfHistory.initialBookmark) {\n this.initialBookmark = this.pdfHistory.initialBookmark;\n this.initialRotation = this.pdfHistory.initialRotation;\n }\n if (initialDest && !this.initialBookmark && viewOnLoad === ViewOnLoad.UNKNOWN) {\n this.initialBookmark = JSON.stringify(initialDest);\n this.pdfHistory.push({\n explicitDest: initialDest,\n pageNumber: null\n });\n }\n },\n _initializeAnnotationStorageCallbacks(pdfDocument) {\n if (pdfDocument !== this.pdfDocument) {\n return;\n }\n const {\n annotationStorage\n } = pdfDocument;\n annotationStorage.onSetModified = () => {\n window.addEventListener("beforeunload", beforeUnload);\n this._annotationStorageModified = true;\n };\n annotationStorage.onResetModified = () => {\n window.removeEventListener("beforeunload", beforeUnload);\n delete this._annotationStorageModified;\n };\n annotationStorage.onAnnotationEditor = typeStr => {\n this._hasAnnotationEditors = !!typeStr;\n this.setTitle();\n };\n },\n setInitialView(storedHash, {\n rotation,\n sidebarView,\n scrollMode,\n spreadMode\n } = {}) {\n const setRotation = angle => {\n if (isValidRotation(angle)) {\n this.pdfViewer.pagesRotation = angle;\n }\n };\n const setViewerModes = (scroll, spread) => {\n if (isValidScrollMode(scroll)) {\n this.pdfViewer.scrollMode = scroll;\n }\n if (isValidSpreadMode(spread)) {\n this.pdfViewer.spreadMode = spread;\n }\n };\n this.isInitialViewSet = true;\n this.viewsManager?.setInitialView(sidebarView);\n setViewerModes(scrollMode, spreadMode);\n if (this.initialBookmark) {\n setRotation(this.initialRotation);\n delete this.initialRotation;\n this.pdfLinkService.setHash(this.initialBookmark);\n this.initialBookmark = null;\n } else if (storedHash) {\n setRotation(rotation);\n this.pdfLinkService.setHash(storedHash);\n }\n this.toolbar?.setPageNumber(this.pdfViewer.currentPageNumber, this.pdfViewer.currentPageLabel);\n this.secondaryToolbar?.setPageNumber(this.pdfViewer.currentPageNumber);\n if (!this.pdfViewer.currentScaleValue) {\n this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;\n }\n },\n _cleanup() {\n if (!this.pdfDocument) {\n return;\n }\n this.pdfViewer.cleanup();\n this.pdfThumbnailViewer?.cleanup();\n this.pdfDocument.cleanup(AppOptions.get("fontExtraProperties"));\n },\n forceRendering() {\n this.pdfRenderingQueue.printing = !!this.printService;\n this.pdfRenderingQueue.isThumbnailViewEnabled = this.viewsManager?.visibleView === SidebarView.THUMBS;\n this.pdfRenderingQueue.renderHighestPriority();\n },\n beforePrint() {\n this._printAnnotationStoragePromise = this.pdfScriptingManager.dispatchWillPrint().catch(() => {}).then(() => this.pdfDocument?.annotationStorage.print);\n if (this.printService) {\n return;\n }\n if (!this.supportsPrinting || !this.pdfViewer.printingAllowed) {\n this._otherError("pdfjs-printing-not-supported");\n return;\n }\n if (!this.pdfViewer.pageViewsReady) {\n this.l10n.get("pdfjs-printing-not-ready").then(msg => {\n window.alert(msg);\n });\n return;\n }\n this.printService = PDFPrintServiceFactory.createPrintService({\n pdfDocument: this.pdfDocument,\n pagesOverview: this.pdfViewer.getPagesOverview(),\n printContainer: this.appConfig.printContainer,\n printResolution: AppOptions.get("printResolution"),\n printAnnotationStoragePromise: this._printAnnotationStoragePromise\n });\n this.forceRendering();\n this.setTitle();\n this.printService.layout();\n if (this._hasAnnotationEditors) {\n this.externalServices.reportTelemetry({\n type: "editing",\n data: {\n type: "print",\n stats: this.pdfDocument?.annotationStorage.editorStats\n }\n });\n }\n },\n afterPrint() {\n if (this._printAnnotationStoragePromise) {\n this._printAnnotationStoragePromise.then(() => {\n this.pdfScriptingManager.dispatchDidPrint();\n });\n this._printAnnotationStoragePromise = null;\n }\n if (this.printService) {\n this.printService.destroy();\n this.printService = null;\n this.pdfDocument?.annotationStorage.resetModified();\n }\n this.forceRendering();\n this.setTitle();\n },\n rotatePages(delta) {\n this.pdfViewer.pagesRotation += delta;\n },\n requestPresentationMode() {\n this.pdfPresentationMode?.request();\n },\n async triggerPrinting() {\n if (this.supportsPrinting && (await this._printPermissionPromise)) {\n window.print();\n }\n },\n bindEvents() {\n if (this._eventBusAbortController) {\n return;\n }\n const ac = this._eventBusAbortController = new AbortController();\n const opts = {\n signal: ac.signal\n };\n const {\n eventBus,\n externalServices,\n pdfDocumentProperties,\n pdfViewer,\n preferences\n } = this;\n eventBus._on("resize", onResize.bind(this), opts);\n eventBus._on("hashchange", onHashchange.bind(this), opts);\n eventBus._on("beforeprint", this.beforePrint.bind(this), opts);\n eventBus._on("afterprint", this.afterPrint.bind(this), opts);\n eventBus._on("pagerender", onPageRender.bind(this), opts);\n eventBus._on("pagerendered", onPageRendered.bind(this), opts);\n eventBus._on("updateviewarea", onUpdateViewarea.bind(this), opts);\n eventBus._on("pagechanging", onPageChanging.bind(this), opts);\n eventBus._on("scalechanging", onScaleChanging.bind(this), opts);\n eventBus._on("rotationchanging", onRotationChanging.bind(this), opts);\n eventBus._on("sidebarviewchanged", onSidebarViewChanged.bind(this), opts);\n eventBus._on("pagemode", onPageMode.bind(this), opts);\n eventBus._on("namedaction", onNamedAction.bind(this), opts);\n eventBus._on("presentationmodechanged", evt => pdfViewer.presentationModeState = evt.state, opts);\n eventBus._on("presentationmode", this.requestPresentationMode.bind(this), opts);\n eventBus._on("switchannotationeditormode", evt => pdfViewer.annotationEditorMode = evt, opts);\n eventBus._on("print", this.triggerPrinting.bind(this), opts);\n eventBus._on("download", this.downloadOrSave.bind(this), opts);\n eventBus._on("firstpage", () => this.page = 1, opts);\n eventBus._on("lastpage", () => this.page = this.pagesCount, opts);\n eventBus._on("nextpage", () => pdfViewer.nextPage(), opts);\n eventBus._on("previouspage", () => pdfViewer.previousPage(), opts);\n eventBus._on("zoomin", this.zoomIn.bind(this), opts);\n eventBus._on("zoomout", this.zoomOut.bind(this), opts);\n eventBus._on("zoomreset", this.zoomReset.bind(this), opts);\n eventBus._on("pagenumberchanged", onPageNumberChanged.bind(this), opts);\n eventBus._on("scalechanged", evt => pdfViewer.currentScaleValue = evt.value, opts);\n eventBus._on("rotatecw", this.rotatePages.bind(this, 90), opts);\n eventBus._on("rotateccw", this.rotatePages.bind(this, -90), opts);\n eventBus._on("optionalcontentconfig", evt => pdfViewer.optionalContentConfigPromise = evt.promise, opts);\n eventBus._on("switchscrollmode", evt => pdfViewer.scrollMode = evt.mode, opts);\n eventBus._on("scrollmodechanged", onViewerModesChanged.bind(this, "scrollMode"), opts);\n eventBus._on("switchspreadmode", evt => pdfViewer.spreadMode = evt.mode, opts);\n eventBus._on("spreadmodechanged", onViewerModesChanged.bind(this, "spreadMode"), opts);\n eventBus._on("imagealttextsettings", onImageAltTextSettings.bind(this), opts);\n eventBus._on("documentproperties", () => pdfDocumentProperties?.open(), opts);\n eventBus._on("findfromurlhash", onFindFromUrlHash.bind(this), opts);\n eventBus._on("updatefindmatchescount", onUpdateFindMatchesCount.bind(this), opts);\n eventBus._on("updatefindcontrolstate", onUpdateFindControlState.bind(this), opts);\n eventBus._on("fileinputchange", onFileInputChange.bind(this), opts);\n eventBus._on("openfile", onOpenFile.bind(this), opts);\n eventBus._on("pagesedited", this.onPagesEdited.bind(this), opts);\n eventBus._on("savepageseditedpdf", this.onSavePagesEditedPDF.bind(this), opts);\n },\n bindWindowEvents() {\n if (this._windowAbortController) {\n return;\n }\n this._windowAbortController = new AbortController();\n const {\n eventBus,\n appConfig: {\n mainContainer\n },\n pdfViewer,\n _windowAbortController: {\n signal\n }\n } = this;\n this._touchManager = new TouchManager({\n container: window,\n isPinchingDisabled: () => pdfViewer.isInPresentationMode,\n isPinchingStopped: () => this.overlayManager?.active,\n onPinching: this.touchPinchCallback.bind(this),\n onPinchEnd: this.touchPinchEndCallback.bind(this),\n signal\n });\n function addWindowResolutionChange(evt = null) {\n if (evt) {\n pdfViewer.refresh();\n }\n const mediaQueryList = window.matchMedia(`(resolution: ${OutputScale.pixelRatio}dppx)`);\n mediaQueryList.addEventListener("change", addWindowResolutionChange, {\n once: true,\n signal\n });\n }\n addWindowResolutionChange();\n window.addEventListener("wheel", onWheel.bind(this), {\n passive: false,\n signal\n });\n window.addEventListener("click", onClick.bind(this), {\n signal\n });\n window.addEventListener("keydown", onKeyDown.bind(this), {\n signal\n });\n window.addEventListener("keyup", onKeyUp.bind(this), {\n signal\n });\n window.addEventListener("resize", () => eventBus.dispatch("resize", {\n source: window\n }), {\n signal\n });\n window.addEventListener("hashchange", () => {\n eventBus.dispatch("hashchange", {\n source: window,\n hash: document.location.hash.substring(1)\n });\n }, {\n signal\n });\n window.addEventListener("beforeprint", () => eventBus.dispatch("beforeprint", {\n source: window\n }), {\n signal\n });\n window.addEventListener("afterprint", () => eventBus.dispatch("afterprint", {\n source: window\n }), {\n signal\n });\n window.addEventListener("updatefromsandbox", evt => {\n eventBus.dispatch("updatefromsandbox", {\n source: window,\n detail: evt.detail\n });\n }, {\n signal\n });\n if (!("onscrollend" in document.documentElement)) {\n return;\n }\n ({\n scrollTop: this._lastScrollTop,\n scrollLeft: this._lastScrollLeft\n } = mainContainer);\n let scrollendTimeoutID, scrollAbortController;\n const scrollend = () => {\n ({\n scrollTop: this._lastScrollTop,\n scrollLeft: this._lastScrollLeft\n } = mainContainer);\n clearTimeout(scrollendTimeoutID);\n if (this._isScrolling) {\n scrollAbortController.abort();\n scrollAbortController = null;\n this._isScrolling = false;\n }\n };\n const scroll = () => {\n if (this._isCtrlKeyDown) {\n return;\n }\n if (this._lastScrollTop === mainContainer.scrollTop && this._lastScrollLeft === mainContainer.scrollLeft) {\n return;\n }\n if (!this._isScrolling) {\n scrollAbortController = new AbortController();\n const abortSignal = AbortSignal.any([scrollAbortController.signal, signal]);\n mainContainer.addEventListener("scrollend", scrollend, {\n signal: abortSignal\n });\n mainContainer.addEventListener("blur", scrollend, {\n signal: abortSignal\n });\n this._isScrolling = true;\n }\n clearTimeout(scrollendTimeoutID);\n scrollendTimeoutID = setTimeout(scrollend, 100);\n };\n mainContainer.addEventListener("scroll", scroll, {\n passive: true,\n signal\n });\n },\n unbindEvents() {\n this._eventBusAbortController?.abort();\n this._eventBusAbortController = null;\n },\n unbindWindowEvents() {\n this._windowAbortController?.abort();\n this._windowAbortController = null;\n this._touchManager = null;\n },\n async testingClose() {\n this.unbindEvents();\n this.unbindWindowEvents();\n this._globalAbortController?.abort();\n this._globalAbortController = null;\n this.findBar?.close();\n await Promise.all([this.l10n?.destroy(), this.close()]);\n },\n onPagesEdited(data) {\n this.pdfViewer.onPagesEdited(data);\n },\n async onSavePagesEditedPDF({\n data: extractParams\n }) {\n if (!this.pdfDocument) {\n return;\n }\n const modifiedPdfBytes = await this.pdfDocument.extractPages(extractParams);\n if (!modifiedPdfBytes) {\n console.error("Something wrong happened when saving the edited PDF.\\nPlease file a bug.");\n return;\n }\n this.downloadManager.download(modifiedPdfBytes, this._downloadUrl, this._docFilename);\n },\n _accumulateTicks(ticks, prop) {\n if (this[prop] > 0 && ticks < 0 || this[prop] < 0 && ticks > 0) {\n this[prop] = 0;\n }\n this[prop] += ticks;\n const wholeTicks = Math.trunc(this[prop]);\n this[prop] -= wholeTicks;\n return wholeTicks;\n },\n _accumulateFactor(previousScale, factor, prop) {\n if (factor === 1) {\n return 1;\n }\n if (this[prop] > 1 && factor < 1 || this[prop] < 1 && factor > 1) {\n this[prop] = 1;\n }\n const newFactor = Math.floor(previousScale * factor * this[prop] * 100) / (100 * previousScale);\n this[prop] = factor / newFactor;\n return newFactor;\n },\n _unblockDocumentLoadEvent() {\n document.blockUnblockOnload?.(false);\n this._unblockDocumentLoadEvent = () => {};\n },\n get scriptingReady() {\n return this.pdfScriptingManager.ready;\n }\n};\ninitCom(PDFViewerApplication);\nPDFPrintServiceFactory.initGlobals(PDFViewerApplication);\n{\n const HOSTED_VIEWER_ORIGINS = new Set(["null", "http://mozilla.github.io", "https://mozilla.github.io"]);\n var validateFileURL = function (file) {\n if (!file) {\n return;\n }\n const viewerOrigin = URL.parse(window.location)?.origin || "null";\n if (HOSTED_VIEWER_ORIGINS.has(viewerOrigin)) {\n return;\n }\n const fileOrigin = URL.parse(file, window.location)?.origin;\n if (fileOrigin === viewerOrigin) {\n return;\n }\n const ex = new Error("file origin does not match viewer\'s");\n PDFViewerApplication._documentError("pdfjs-loading-error", {\n message: ex.message\n });\n throw ex;\n };\n var onFileInputChange = function (evt) {\n if (this.pdfViewer?.isInPresentationMode) {\n return;\n }\n const file = evt.fileInput.files[0];\n this.open({\n url: URL.createObjectURL(file),\n originalUrl: encodeURIComponent(file.name)\n });\n };\n var onOpenFile = function (evt) {\n this._openFileInput?.click();\n };\n}\nfunction onPageRender({\n pageNumber\n}) {\n if (pageNumber === this.page) {\n this.toolbar?.updateLoadingIndicatorState(true);\n }\n}\nfunction onPageRendered({\n pageNumber,\n isDetailView,\n error\n}) {\n if (pageNumber === this.page) {\n this.toolbar?.updateLoadingIndicatorState(false);\n }\n if (!isDetailView && this.viewsManager?.visibleView === SidebarView.THUMBS) {\n const pageView = this.pdfViewer.getPageView(pageNumber - 1);\n const thumbnailView = this.pdfThumbnailViewer?.getThumbnail(pageNumber - 1);\n if (pageView) {\n thumbnailView?.setImage(pageView);\n }\n }\n if (error) {\n this._otherError("pdfjs-rendering-error", error);\n }\n}\nfunction onPageMode({\n mode\n}) {\n let view;\n switch (mode) {\n case "thumbs":\n view = SidebarView.THUMBS;\n break;\n case "bookmarks":\n case "outline":\n view = SidebarView.OUTLINE;\n break;\n case "attachments":\n view = SidebarView.ATTACHMENTS;\n break;\n case "layers":\n view = SidebarView.LAYERS;\n break;\n case "none":\n view = SidebarView.NONE;\n break;\n default:\n console.error(\'Invalid "pagemode" hash parameter: \' + mode);\n return;\n }\n this.viewsManager?.switchView(view, true);\n}\nfunction onNamedAction(evt) {\n switch (evt.action) {\n case "GoToPage":\n this.appConfig.toolbar?.pageNumber.select();\n break;\n case "Find":\n if (!this.supportsIntegratedFind) {\n this.findBar?.toggle();\n }\n break;\n case "Print":\n this.triggerPrinting();\n break;\n case "SaveAs":\n this.downloadOrSave();\n break;\n }\n}\nfunction onSidebarViewChanged({\n view\n}) {\n this.pdfRenderingQueue.isThumbnailViewEnabled = view === SidebarView.THUMBS;\n if (this.isInitialViewSet) {\n this.store?.set("sidebarView", view).catch(() => {});\n }\n}\nfunction onUpdateViewarea({\n location\n}) {\n if (this.isInitialViewSet) {\n this.store?.setMultiple({\n page: location.pageNumber,\n zoom: location.scale,\n scrollLeft: location.left,\n scrollTop: location.top,\n rotation: location.rotation\n }).catch(() => {});\n }\n if (this.appConfig.secondaryToolbar) {\n this.appConfig.secondaryToolbar.viewBookmarkButton.href = this.pdfLinkService.getAnchorUrl(location.pdfOpenParams);\n }\n}\nfunction onViewerModesChanged(name, evt) {\n if (this.isInitialViewSet && !this.pdfViewer.isInPresentationMode) {\n this.store?.set(name, evt.mode).catch(() => {});\n }\n}\nfunction onResize() {\n const {\n pdfDocument,\n pdfViewer,\n pdfRenderingQueue\n } = this;\n if (pdfRenderingQueue.printing && window.matchMedia("print").matches) {\n return;\n }\n if (!pdfDocument) {\n return;\n }\n const currentScaleValue = pdfViewer.currentScaleValue;\n if (currentScaleValue === "auto" || currentScaleValue === "page-fit" || currentScaleValue === "page-width") {\n pdfViewer.currentScaleValue = currentScaleValue;\n }\n pdfViewer.update();\n}\nfunction onHashchange(evt) {\n const hash = evt.hash;\n if (!hash) {\n return;\n }\n if (!this.isInitialViewSet) {\n this.initialBookmark = hash;\n } else if (!this.pdfHistory?.popStateInProgress) {\n this.pdfLinkService.setHash(hash);\n }\n}\nfunction onPageNumberChanged(evt) {\n const {\n pdfViewer\n } = this;\n if (evt.value !== "") {\n this.pdfLinkService.goToPage(evt.value);\n }\n if (evt.value !== pdfViewer.currentPageNumber.toString() && evt.value !== pdfViewer.currentPageLabel) {\n this.toolbar?.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel);\n }\n}\nfunction onImageAltTextSettings() {\n this.imageAltTextSettings?.open({\n enableGuessAltText: AppOptions.get("enableGuessAltText"),\n enableNewAltTextWhenAddingImage: AppOptions.get("enableNewAltTextWhenAddingImage")\n });\n}\nfunction onFindFromUrlHash(evt) {\n this.eventBus.dispatch("find", {\n source: evt.source,\n type: "",\n query: evt.query,\n caseSensitive: false,\n entireWord: false,\n highlightAll: true,\n findPrevious: false,\n matchDiacritics: true\n });\n}\nfunction onUpdateFindMatchesCount({\n matchesCount\n}) {\n if (this.supportsIntegratedFind) {\n this.externalServices.updateFindMatchesCount(matchesCount);\n } else {\n this.findBar?.updateResultsCount(matchesCount);\n }\n}\nfunction onUpdateFindControlState({\n state,\n previous,\n entireWord,\n matchesCount,\n rawQuery\n}) {\n if (this.supportsIntegratedFind) {\n this.externalServices.updateFindControlState({\n result: state,\n findPrevious: previous,\n entireWord,\n matchesCount,\n rawQuery\n });\n } else {\n this.findBar?.updateUIState(state, previous, matchesCount);\n }\n}\nfunction onScaleChanging(evt) {\n this.toolbar?.setPageScale(evt.presetValue, evt.scale);\n this.pdfViewer.update();\n}\nfunction onRotationChanging(evt) {\n if (this.pdfThumbnailViewer) {\n this.pdfThumbnailViewer.pagesRotation = evt.pagesRotation;\n }\n this.forceRendering();\n this.pdfViewer.currentPageNumber = evt.pageNumber;\n}\nfunction onPageChanging({\n pageNumber,\n pageLabel\n}) {\n this.toolbar?.setPageNumber(pageNumber, pageLabel);\n this.secondaryToolbar?.setPageNumber(pageNumber);\n if (this.viewsManager?.visibleView === SidebarView.THUMBS) {\n this.pdfThumbnailViewer?.scrollThumbnailIntoView(pageNumber);\n }\n const currentPage = this.pdfViewer.getPageView(pageNumber - 1);\n this.toolbar?.updateLoadingIndicatorState(currentPage?.renderingState === RenderingStates.RUNNING);\n}\nfunction onWheel(evt) {\n const {\n pdfViewer,\n supportsMouseWheelZoomCtrlKey,\n supportsMouseWheelZoomMetaKey,\n supportsPinchToZoom\n } = this;\n if (pdfViewer.isInPresentationMode) {\n return;\n }\n const deltaMode = evt.deltaMode;\n let scaleFactor = Math.exp(-evt.deltaY / 100);\n const isBuiltInMac = false;\n const isPinchToZoom = evt.ctrlKey && !this._isCtrlKeyDown && deltaMode === WheelEvent.DOM_DELTA_PIXEL && evt.deltaX === 0 && (Math.abs(scaleFactor - 1) < 0.05 || isBuiltInMac) && evt.deltaZ === 0;\n const origin = [evt.clientX, evt.clientY];\n if (isPinchToZoom || evt.ctrlKey && supportsMouseWheelZoomCtrlKey || evt.metaKey && supportsMouseWheelZoomMetaKey) {\n evt.preventDefault();\n if (this._isScrolling || document.visibilityState === "hidden" || this.overlayManager.active) {\n return;\n }\n if (isPinchToZoom && supportsPinchToZoom) {\n scaleFactor = this._accumulateFactor(pdfViewer.currentScale, scaleFactor, "_wheelUnusedFactor");\n this.updateZoom(null, scaleFactor, origin);\n } else {\n const delta = normalizeWheelEventDirection(evt);\n let ticks = 0;\n if (deltaMode === WheelEvent.DOM_DELTA_LINE || deltaMode === WheelEvent.DOM_DELTA_PAGE) {\n ticks = Math.abs(delta) >= 1 ? Math.sign(delta) : this._accumulateTicks(delta, "_wheelUnusedTicks");\n } else {\n const PIXELS_PER_LINE_SCALE = 30;\n ticks = this._accumulateTicks(delta / PIXELS_PER_LINE_SCALE, "_wheelUnusedTicks");\n }\n this.updateZoom(ticks, null, origin);\n }\n }\n}\nfunction closeSecondaryToolbar({\n target\n}) {\n if (!this.secondaryToolbar?.isOpen) {\n return;\n }\n const {\n toolbar,\n secondaryToolbar\n } = this.appConfig;\n if (this.pdfViewer.containsElement(target) || toolbar?.container.contains(target) && !secondaryToolbar?.toolbar.contains(target) && !secondaryToolbar?.toggleButton.contains(target)) {\n this.secondaryToolbar.close();\n }\n}\nfunction closeEditorUndoBar(evt) {\n if (!this.editorUndoBar?.isOpen) {\n return;\n }\n if (this.appConfig.secondaryToolbar?.toolbar.contains(evt.target)) {\n this.editorUndoBar.hide();\n }\n}\nfunction onClick(evt) {\n closeSecondaryToolbar.call(this, evt);\n closeEditorUndoBar.call(this, evt);\n}\nfunction onKeyUp(evt) {\n if (evt.key === "Control") {\n this._isCtrlKeyDown = false;\n }\n}\nfunction onKeyDown(evt) {\n this._isCtrlKeyDown = evt.key === "Control";\n if (this.editorUndoBar?.isOpen && evt.keyCode !== 9 && evt.keyCode !== 16 && !((evt.keyCode === 13 || evt.keyCode === 32) && getActiveOrFocusedElement() === this.appConfig.editorUndoBar.undoButton)) {\n this.editorUndoBar.hide();\n }\n if (this.overlayManager.active) {\n return;\n }\n const {\n eventBus,\n pdfViewer\n } = this;\n const isViewerInPresentationMode = pdfViewer.isInPresentationMode;\n let handled = false,\n ensureViewerFocused = false;\n const cmd = (evt.ctrlKey ? 1 : 0) | (evt.altKey ? 2 : 0) | (evt.shiftKey ? 4 : 0) | (evt.metaKey ? 8 : 0);\n if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) {\n switch (evt.keyCode) {\n case 70:\n if (!this.supportsIntegratedFind && !evt.shiftKey) {\n this.findBar?.open();\n handled = true;\n }\n break;\n case 71:\n if (!this.supportsIntegratedFind) {\n const {\n state\n } = this.findController;\n if (state) {\n const newState = {\n source: window,\n type: "again",\n findPrevious: cmd === 5 || cmd === 12\n };\n eventBus.dispatch("find", {\n ...state,\n ...newState\n });\n }\n handled = true;\n }\n break;\n case 61:\n case 107:\n case 187:\n case 171:\n this.zoomIn();\n handled = true;\n break;\n case 173:\n case 109:\n case 189:\n this.zoomOut();\n handled = true;\n break;\n case 48:\n case 96:\n if (!isViewerInPresentationMode) {\n setTimeout(() => {\n this.zoomReset();\n });\n handled = false;\n }\n break;\n case 38:\n if (isViewerInPresentationMode || this.page > 1) {\n this.page = 1;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n case 40:\n if (isViewerInPresentationMode || this.page < this.pagesCount) {\n this.page = this.pagesCount;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n }\n }\n if (cmd === 1 || cmd === 8) {\n switch (evt.keyCode) {\n case 83:\n eventBus.dispatch("download", {\n source: window\n });\n handled = true;\n break;\n case 79:\n {\n eventBus.dispatch("openfile", {\n source: window\n });\n handled = true;\n }\n break;\n }\n }\n if (cmd === 3 || cmd === 10) {\n switch (evt.keyCode) {\n case 80:\n this.requestPresentationMode();\n handled = true;\n this.externalServices.reportTelemetry({\n type: "buttons",\n data: {\n id: "presentationModeKeyboard"\n }\n });\n break;\n case 71:\n if (this.appConfig.toolbar) {\n this.appConfig.toolbar.pageNumber.select();\n handled = true;\n }\n break;\n }\n }\n if (handled) {\n if (ensureViewerFocused && !isViewerInPresentationMode) {\n pdfViewer.focus();\n }\n evt.preventDefault();\n return;\n }\n const curElement = getActiveOrFocusedElement();\n const curElementTagName = curElement?.tagName.toUpperCase();\n if (curElementTagName === "INPUT" || curElementTagName === "TEXTAREA" || curElementTagName === "SELECT" || curElementTagName === "BUTTON" && evt.keyCode === 32 || curElement?.isContentEditable) {\n if (evt.keyCode !== 27) {\n return;\n }\n }\n if (cmd === 0) {\n let turnPage = 0,\n turnOnlyIfPageFit = false;\n switch (evt.keyCode) {\n case 38:\n if (this.supportsCaretBrowsingMode) {\n this.moveCaret(true, false);\n handled = true;\n break;\n }\n case 33:\n if (pdfViewer.isVerticalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n turnPage = -1;\n break;\n case 8:\n if (!isViewerInPresentationMode) {\n turnOnlyIfPageFit = true;\n }\n turnPage = -1;\n break;\n case 37:\n if (this.supportsCaretBrowsingMode) {\n return;\n }\n if (pdfViewer.isHorizontalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n case 75:\n case 80:\n turnPage = -1;\n break;\n case 27:\n if (this.secondaryToolbar?.isOpen) {\n this.secondaryToolbar.close();\n handled = true;\n }\n if (!this.supportsIntegratedFind && this.findBar?.opened) {\n this.findBar.close();\n handled = true;\n }\n break;\n case 40:\n if (this.supportsCaretBrowsingMode) {\n this.moveCaret(false, false);\n handled = true;\n break;\n }\n case 34:\n if (pdfViewer.isVerticalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n turnPage = 1;\n break;\n case 32:\n if (!isViewerInPresentationMode) {\n turnOnlyIfPageFit = true;\n }\n turnPage = 1;\n break;\n case 39:\n if (this.supportsCaretBrowsingMode) {\n return;\n }\n if (pdfViewer.isHorizontalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n case 74:\n case 78:\n turnPage = 1;\n break;\n case 36:\n if (isViewerInPresentationMode || this.page > 1) {\n this.page = 1;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n case 35:\n if (isViewerInPresentationMode || this.page < this.pagesCount) {\n this.page = this.pagesCount;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n case 83:\n this.pdfCursorTools?.switchTool(CursorTool.SELECT);\n break;\n case 72:\n this.pdfCursorTools?.switchTool(CursorTool.HAND);\n break;\n case 82:\n this.rotatePages(90);\n break;\n case 115:\n this.viewsManager?.toggle();\n break;\n }\n if (turnPage !== 0 && (!turnOnlyIfPageFit || pdfViewer.currentScaleValue === "page-fit")) {\n if (turnPage > 0) {\n pdfViewer.nextPage();\n } else {\n pdfViewer.previousPage();\n }\n handled = true;\n }\n }\n if (cmd === 4) {\n switch (evt.keyCode) {\n case 32:\n if (!isViewerInPresentationMode && pdfViewer.currentScaleValue !== "page-fit") {\n break;\n }\n pdfViewer.previousPage();\n handled = true;\n break;\n case 38:\n this.moveCaret(true, true);\n handled = true;\n break;\n case 40:\n this.moveCaret(false, true);\n handled = true;\n break;\n case 82:\n this.rotatePages(-90);\n break;\n }\n }\n if (!handled && !isViewerInPresentationMode) {\n if (evt.keyCode >= 33 && evt.keyCode <= 40 || evt.keyCode === 32 && curElementTagName !== "BUTTON") {\n ensureViewerFocused = true;\n }\n }\n if (ensureViewerFocused && !pdfViewer.containsElement(curElement)) {\n pdfViewer.focus();\n }\n if (handled) {\n evt.preventDefault();\n }\n}\nfunction beforeUnload(evt) {\n evt.preventDefault();\n evt.returnValue = "";\n return false;\n}\n\n;// ./web/viewer.js\n\n\n\n\n\nconst AppConstants = {\n LinkTarget: LinkTarget,\n RenderingStates: RenderingStates,\n ScrollMode: ScrollMode,\n SpreadMode: SpreadMode\n};\nwindow.PDFViewerApplication = PDFViewerApplication;\nwindow.PDFViewerApplicationConstants = AppConstants;\nwindow.PDFViewerApplicationOptions = AppOptions;\nfunction getViewerConfiguration() {\n return {\n appContainer: document.body,\n principalContainer: document.getElementById("mainContainer"),\n mainContainer: document.getElementById("viewerContainer"),\n viewerContainer: document.getElementById("viewer"),\n viewerAlert: document.getElementById("viewer-alert"),\n toolbar: {\n container: document.getElementById("toolbarContainer"),\n numPages: document.getElementById("numPages"),\n pageNumber: document.getElementById("pageNumber"),\n scaleSelect: document.getElementById("scaleSelect"),\n customScaleOption: document.getElementById("customScaleOption"),\n previous: document.getElementById("previous"),\n next: document.getElementById("next"),\n zoomIn: document.getElementById("zoomInButton"),\n zoomOut: document.getElementById("zoomOutButton"),\n print: document.getElementById("printButton"),\n editorCommentButton: document.getElementById("editorCommentButton"),\n editorCommentParamsToolbar: document.getElementById("editorCommentParamsToolbar"),\n editorFreeTextButton: document.getElementById("editorFreeTextButton"),\n editorFreeTextParamsToolbar: document.getElementById("editorFreeTextParamsToolbar"),\n editorHighlightButton: document.getElementById("editorHighlightButton"),\n editorHighlightParamsToolbar: document.getElementById("editorHighlightParamsToolbar"),\n editorHighlightColorPicker: document.getElementById("editorHighlightColorPicker"),\n editorInkButton: document.getElementById("editorInkButton"),\n editorInkParamsToolbar: document.getElementById("editorInkParamsToolbar"),\n editorStampButton: document.getElementById("editorStampButton"),\n editorStampParamsToolbar: document.getElementById("editorStampParamsToolbar"),\n editorSignatureButton: document.getElementById("editorSignatureButton"),\n editorSignatureParamsToolbar: document.getElementById("editorSignatureParamsToolbar"),\n download: document.getElementById("downloadButton")\n },\n secondaryToolbar: {\n toolbar: document.getElementById("secondaryToolbar"),\n toggleButton: document.getElementById("secondaryToolbarToggleButton"),\n presentationModeButton: document.getElementById("presentationMode"),\n openFileButton: document.getElementById("secondaryOpenFile"),\n printButton: document.getElementById("secondaryPrint"),\n downloadButton: document.getElementById("secondaryDownload"),\n viewBookmarkButton: document.getElementById("viewBookmark"),\n firstPageButton: document.getElementById("firstPage"),\n lastPageButton: document.getElementById("lastPage"),\n pageRotateCwButton: document.getElementById("pageRotateCw"),\n pageRotateCcwButton: document.getElementById("pageRotateCcw"),\n cursorSelectToolButton: document.getElementById("cursorSelectTool"),\n cursorHandToolButton: document.getElementById("cursorHandTool"),\n scrollPageButton: document.getElementById("scrollPage"),\n scrollVerticalButton: document.getElementById("scrollVertical"),\n scrollHorizontalButton: document.getElementById("scrollHorizontal"),\n scrollWrappedButton: document.getElementById("scrollWrapped"),\n spreadNoneButton: document.getElementById("spreadNone"),\n spreadOddButton: document.getElementById("spreadOdd"),\n spreadEvenButton: document.getElementById("spreadEven"),\n imageAltTextSettingsButton: document.getElementById("imageAltTextSettings"),\n imageAltTextSettingsSeparator: document.getElementById("imageAltTextSettingsSeparator"),\n documentPropertiesButton: document.getElementById("documentProperties")\n },\n viewsManager: {\n outerContainer: document.getElementById("outerContainer"),\n toggleButton: document.getElementById("viewsManagerToggleButton"),\n sidebarContainer: document.getElementById("viewsManager"),\n resizer: document.getElementById("viewsManagerResizer"),\n thumbnailButton: document.getElementById("thumbnailsViewMenu"),\n outlineButton: document.getElementById("outlinesViewMenu"),\n attachmentsButton: document.getElementById("attachmentsViewMenu"),\n layersButton: document.getElementById("layersViewMenu"),\n viewsManagerSelectorButton: document.getElementById("viewsManagerSelectorButton"),\n viewsManagerSelectorOptions: document.getElementById("viewsManagerSelectorOptions"),\n thumbnailsView: document.getElementById("thumbnailsView"),\n outlinesView: document.getElementById("outlinesView"),\n attachmentsView: document.getElementById("attachmentsView"),\n layersView: document.getElementById("layersView"),\n viewsManagerAddFileButton: document.getElementById("viewsManagerAddFileButton"),\n viewsManagerCurrentOutlineButton: document.getElementById("viewsManagerCurrentOutlineButton"),\n viewsManagerHeaderLabel: document.getElementById("viewsManagerHeaderLabel"),\n viewsManagerStatus: document.getElementById("viewsManagerStatus"),\n manageMenu: {\n button: document.getElementById("viewsManagerStatusActionButton"),\n menu: document.getElementById("viewsManagerStatusActionOptions"),\n copy: document.getElementById("viewsManagerStatusActionCopy"),\n cut: document.getElementById("viewsManagerStatusActionCut"),\n delete: document.getElementById("viewsManagerStatusActionDelete"),\n saveAs: document.getElementById("viewsManagerStatusActionSaveAs")\n }\n },\n findBar: {\n bar: document.getElementById("findbar"),\n toggleButton: document.getElementById("viewFindButton"),\n findField: document.getElementById("findInput"),\n highlightAllCheckbox: document.getElementById("findHighlightAll"),\n caseSensitiveCheckbox: document.getElementById("findMatchCase"),\n matchDiacriticsCheckbox: document.getElementById("findMatchDiacritics"),\n entireWordCheckbox: document.getElementById("findEntireWord"),\n findMsg: document.getElementById("findMsg"),\n findResultsCount: document.getElementById("findResultsCount"),\n findPreviousButton: document.getElementById("findPreviousButton"),\n findNextButton: document.getElementById("findNextButton")\n },\n passwordOverlay: {\n dialog: document.getElementById("passwordDialog"),\n label: document.getElementById("passwordText"),\n input: document.getElementById("password"),\n submitButton: document.getElementById("passwordSubmit"),\n cancelButton: document.getElementById("passwordCancel")\n },\n documentProperties: {\n dialog: document.getElementById("documentPropertiesDialog"),\n closeButton: document.getElementById("documentPropertiesClose"),\n fields: {\n fileName: document.getElementById("fileNameField"),\n fileSize: document.getElementById("fileSizeField"),\n title: document.getElementById("titleField"),\n author: document.getElementById("authorField"),\n subject: document.getElementById("subjectField"),\n keywords: document.getElementById("keywordsField"),\n creationDate: document.getElementById("creationDateField"),\n modificationDate: document.getElementById("modificationDateField"),\n creator: document.getElementById("creatorField"),\n producer: document.getElementById("producerField"),\n version: document.getElementById("versionField"),\n pageCount: document.getElementById("pageCountField"),\n pageSize: document.getElementById("pageSizeField"),\n linearized: document.getElementById("linearizedField")\n }\n },\n altTextDialog: {\n dialog: document.getElementById("altTextDialog"),\n optionDescription: document.getElementById("descriptionButton"),\n optionDecorative: document.getElementById("decorativeButton"),\n textarea: document.getElementById("descriptionTextarea"),\n cancelButton: document.getElementById("altTextCancel"),\n saveButton: document.getElementById("altTextSave")\n },\n newAltTextDialog: {\n dialog: document.getElementById("newAltTextDialog"),\n title: document.getElementById("newAltTextTitle"),\n descriptionContainer: document.getElementById("newAltTextDescriptionContainer"),\n textarea: document.getElementById("newAltTextDescriptionTextarea"),\n disclaimer: document.getElementById("newAltTextDisclaimer"),\n learnMore: document.getElementById("newAltTextLearnMore"),\n imagePreview: document.getElementById("newAltTextImagePreview"),\n createAutomatically: document.getElementById("newAltTextCreateAutomatically"),\n createAutomaticallyButton: document.getElementById("newAltTextCreateAutomaticallyButton"),\n downloadModel: document.getElementById("newAltTextDownloadModel"),\n downloadModelDescription: document.getElementById("newAltTextDownloadModelDescription"),\n error: document.getElementById("newAltTextError"),\n errorCloseButton: document.getElementById("newAltTextCloseButton"),\n cancelButton: document.getElementById("newAltTextCancel"),\n notNowButton: document.getElementById("newAltTextNotNow"),\n saveButton: document.getElementById("newAltTextSave")\n },\n altTextSettingsDialog: {\n dialog: document.getElementById("altTextSettingsDialog"),\n createModelButton: document.getElementById("createModelButton"),\n learnMore: document.getElementById("altTextSettingsLearnMore"),\n showAltTextDialogButton: document.getElementById("showAltTextDialogButton"),\n altTextSettingsCloseButton: document.getElementById("altTextSettingsCloseButton"),\n closeButton: document.getElementById("altTextSettingsCloseButton")\n },\n addSignatureDialog: {\n dialog: document.getElementById("addSignatureDialog"),\n panels: document.getElementById("addSignatureActionContainer"),\n typeButton: document.getElementById("addSignatureTypeButton"),\n typeInput: document.getElementById("addSignatureTypeInput"),\n drawButton: document.getElementById("addSignatureDrawButton"),\n drawSVG: document.getElementById("addSignatureDraw"),\n drawPlaceholder: document.getElementById("addSignatureDrawPlaceholder"),\n drawThickness: document.getElementById("addSignatureDrawThickness"),\n imageButton: document.getElementById("addSignatureImageButton"),\n imageSVG: document.getElementById("addSignatureImage"),\n imagePlaceholder: document.getElementById("addSignatureImagePlaceholder"),\n imagePicker: document.getElementById("addSignatureFilePicker"),\n imagePickerLink: document.getElementById("addSignatureImageBrowse"),\n description: document.getElementById("addSignatureDescription"),\n clearButton: document.getElementById("clearSignatureButton"),\n saveContainer: document.getElementById("addSignatureSaveContainer"),\n saveCheckbox: document.getElementById("addSignatureSaveCheckbox"),\n errorBar: document.getElementById("addSignatureError"),\n errorTitle: document.getElementById("addSignatureErrorTitle"),\n errorDescription: document.getElementById("addSignatureErrorDescription"),\n errorCloseButton: document.getElementById("addSignatureErrorCloseButton"),\n cancelButton: document.getElementById("addSignatureCancelButton"),\n addButton: document.getElementById("addSignatureAddButton")\n },\n editSignatureDialog: {\n dialog: document.getElementById("editSignatureDescriptionDialog"),\n description: document.getElementById("editSignatureDescription"),\n editSignatureView: document.getElementById("editSignatureView"),\n cancelButton: document.getElementById("editSignatureCancelButton"),\n updateButton: document.getElementById("editSignatureUpdateButton")\n },\n annotationEditorParams: {\n editorCommentsSidebar: document.getElementById("editorCommentsSidebar"),\n editorCommentsSidebarCount: document.getElementById("editorCommentsSidebarCount"),\n editorCommentsSidebarTitle: document.getElementById("editorCommentsSidebarTitle"),\n editorCommentsSidebarCloseButton: document.getElementById("editorCommentsSidebarCloseButton"),\n editorCommentsSidebarList: document.getElementById("editorCommentsSidebarList"),\n editorCommentsSidebarResizer: document.getElementById("editorCommentsSidebarResizer"),\n editorFreeTextFontSize: document.getElementById("editorFreeTextFontSize"),\n editorFreeTextColor: document.getElementById("editorFreeTextColor"),\n editorInkColor: document.getElementById("editorInkColor"),\n editorInkThickness: document.getElementById("editorInkThickness"),\n editorInkOpacity: document.getElementById("editorInkOpacity"),\n editorStampAddImage: document.getElementById("editorStampAddImage"),\n editorSignatureAddSignature: document.getElementById("editorSignatureAddSignature"),\n editorFreeHighlightThickness: document.getElementById("editorFreeHighlightThickness"),\n editorHighlightShowAll: document.getElementById("editorHighlightShowAll")\n },\n printContainer: document.getElementById("printContainer"),\n editorUndoBar: {\n container: document.getElementById("editorUndoBar"),\n message: document.getElementById("editorUndoBarMessage"),\n undoButton: document.getElementById("editorUndoBarUndoButton"),\n closeButton: document.getElementById("editorUndoBarCloseButton")\n },\n editCommentDialog: {\n dialog: document.getElementById("commentManagerDialog"),\n toolbar: document.getElementById("commentManagerToolbar"),\n title: document.getElementById("commentManagerTitle"),\n textInput: document.getElementById("commentManagerTextInput"),\n cancelButton: document.getElementById("commentManagerCancelButton"),\n saveButton: document.getElementById("commentManagerSaveButton")\n }\n };\n}\nfunction webViewerLoad() {\n const config = getViewerConfiguration();\n const event = new CustomEvent("webviewerloaded", {\n bubbles: true,\n cancelable: true,\n detail: {\n source: window\n }\n });\n try {\n parent.document.dispatchEvent(event);\n } catch (ex) {\n console.error("webviewerloaded:", ex);\n document.dispatchEvent(event);\n }\n PDFViewerApplication.run(config);\n}\ndocument.blockUnblockOnload?.(true);\nif (document.readyState === "interactive" || document.readyState === "complete") {\n webViewerLoad();\n} else {\n document.addEventListener("DOMContentLoaded", webViewerLoad, true);\n}\n\nexport { PDFViewerApplication, AppConstants as PDFViewerApplicationConstants, AppOptions as PDFViewerApplicationOptions };\n\n//# sourceMappingURL=viewer.mjs.map';export{e as default};
|