UNPKG

ngx-extended-pdf-viewer

Version:

Embedding PDF files in your Angular application. Highly configurable viewer including the toolbar, sidebar, and all the features you're used to.

37 lines 1.35 MB
/**
 * @licstart The following is the entire license notice for the
 * JavaScript code in this page
 *
 * Copyright 2024 Mozilla Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @licend The above is the entire license notice for the
 * JavaScript code in this page
 */
/**
 * pdfjsVersion = 5.6.1112
 * pdfjsBuild = 32a32f523
 */var e={9306(e,t,i){var a=i(4901),s=i(6823),n=TypeError;e.exports=function(e){if(a(e))return e;throw new n(s(e)+" is not a function")}},6194(e,t,i){var a=i(2248).has;e.exports=function(e){a(e);return e}},3506(e,t,i){var a=i(3925),s=String,n=TypeError;e.exports=function(e){if(a(e))return e;throw new n("Can't set "+s(e)+" as a prototype")}},7080(e,t,i){var a=i(4402).has;e.exports=function(e){a(e);return e}},3463(e){var t=TypeError;e.exports=function(e){if("string"==typeof e)return e;throw new t("Argument is not a string")}},4328(e,t,i){var a=i(4995),s=new a.WeakMap,n=a.set,r=a.remove;e.exports=function(e){n(s,e,1);r(s,e);return e}},6557(e,t,i){var a=i(4995).has;e.exports=function(e){a(e);return e}},6469(e,t,i){var a=i(8227),s=i(2360),n=i(4913).f,r=a("unscopables"),o=Array.prototype;void 0===o[r]&&n(o,r,{configurable:!0,value:s(null)});e.exports=function(e){o[r][e]=!0}},679(e,t,i){var a=i(1625),s=TypeError;e.exports=function(e,t){if(a(t,e))return e;throw new s("Incorrect invocation")}},3972(e,t,i){var a=i(34),s=String,n=TypeError;e.exports=function(e){if(void 0===e||a(e))return e;throw new n(s(e)+" is not an object or undefined")}},8551(e,t,i){var a=i(34),s=String,n=TypeError;e.exports=function(e){if(a(e))return e;throw new n(s(e)+" is not an object")}},4154(e,t,i){var a=i(6955),s=TypeError;e.exports=function(e){if("Uint8Array"===a(e))return e;throw new s("Argument is not an Uint8Array")}},7811(e){e.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},7394(e,t,i){var a=i(4576),s=i(6706),n=i(2195),r=a.ArrayBuffer,o=a.TypeError;e.exports=r&&s(r.prototype,"byteLength","get")||function(e){if("ArrayBuffer"!==n(e))throw new o("ArrayBuffer expected");return e.byteLength}},3238(e,t,i){var a=i(4576),s=i(7811),n=i(7394),r=a.DataView;e.exports=function(e){if(!s||0!==n(e))return!1;try{new r(e);return!1}catch(e){return!0}}},5169(e,t,i){var a=i(3238),s=TypeError;e.exports=function(e){if(a(e))throw new s("ArrayBuffer is detached");return e}},5636(e,t,i){var a=i(4576),s=i(9504),n=i(6706),r=i(7696),o=i(5169),l=i(7394),d=i(4483),c=i(1548),h=a.structuredClone,u=a.ArrayBuffer,_=a.DataView,p=Math.min,g=u.prototype,f=_.prototype,m=s(g.slice),v=n(g,"resizable","get"),P=n(g,"maxByteLength","get"),w=s(f.getInt8),b=s(f.setInt8);e.exports=(c||d)&&function(e,t,i){var a,s=l(e),n=void 0===t?s:r(t),g=!v||!v(e);o(e);if(c){e=h(e,{transfer:[e]});if(s===n&&(i||g))return e}if(s>=n&&(!i||g))a=m(e,0,n);else{var f=i&&!g&&P?{maxByteLength:P(e)}:void 0;a=new u(n,f);for(var y=new _(e),S=new _(a),C=p(n,s),x=0;x<C;x++)b(S,x,w(y,x))}c||d(e);return a}},4644(e,t,i){var a,s,n,r=i(7811),o=i(3724),l=i(4576),d=i(4901),c=i(34),h=i(9297),u=i(6955),_=i(6823),p=i(6699),g=i(6840),f=i(2106),m=i(1625),v=i(2787),P=i(2967),w=i(8227),b=i(3392),y=i(1181),S=y.enforce,C=y.get,x=l.Int8Array,k=x&&x.prototype,E=l.Uint8ClampedArray,A=E&&E.prototype,G=x&&v(x),B=k&&v(k),M=Object.prototype,I=l.TypeError,T=w("toStringTag"),D=b("TYPED_ARRAY_TAG"),L="TypedArrayConstructor",R=r&&!!P&&"Opera"!==u(l.opera),N=!1,O={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},W={BigInt64Array:8,BigUint64Array:8},getTypedArrayConstructor=function(e){var t=v(e);if(c(t)){var i=C(t);return i&&h(i,L)?i[L]:getTypedArrayConstructor(t)}},isTypedArray=function(e){if(!c(e))return!1;var t=u(e);return h(O,t)||h(W,t)};for(a in O)(n=(s=l[a])&&s.prototype)?S(n)[L]=s:R=!1;for(a in W)(n=(s=l[a])&&s.prototype)&&(S(n)[L]=s);if(!R||!d(G)||G===Function.prototype){G=function TypedArray(){throw new I("Incorrect invocation")};if(R)for(a in O)l[a]&&P(l[a],G)}if(!R||!B||B===M){B=G.prototype;if(R)for(a in O)l[a]&&P(l[a].prototype,B)}R&&v(A)!==B&&P(A,B);if(o&&!h(B,T)){N=!0;f(B,T,{configurable:!0,get:function(){return c(this)?this[D]:void 0}});for(a in O)l[a]&&p(l[a],D,a)}e.exports={NATIVE_ARRAY_BUFFER_VIEWS:R,TYPED_ARRAY_TAG:N&&D,aTypedArray:function(e){if(isTypedArray(e))return e;throw new I("Target is not a typed array")},aTypedArrayConstructor:function(e){if(d(e)&&(!P||m(G,e)))return e;throw new I(_(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,a){if(o){if(i)for(var s in O){var n=l[s];if(n&&h(n.prototype,e))try{delete n.prototype[e]}catch(i){try{n.prototype[e]=t}catch(e){}}}B[e]&&!i||g(B,e,i?t:R&&k[e]||t,a)}},exportTypedArrayStaticMethod:function(e,t,i){var a,s;if(o){if(P){if(i)for(a in O)if((s=l[a])&&h(s,e))try{delete s[e]}catch(e){}if(G[e]&&!i)return;try{return g(G,e,i?t:R&&G[e]||t)}catch(e){}}for(a in O)!(s=l[a])||s[e]&&!i||g(s,e,t)}},getTypedArrayConstructor,isView:function isView(e){if(!c(e))return!1;var t=u(e);return"DataView"===t||h(O,t)||h(W,t)},isTypedArray,TypedArray:G,TypedArrayPrototype:B}},4373(e,t,i){var a=i(8981),s=i(5610),n=i(6198);e.exports=function fill(e){for(var t=a(this),i=n(t),r=arguments.length,o=s(r>1?arguments[1]:void 0,i),l=r>2?arguments[2]:void 0,d=void 0===l?i:s(l,i);d>o;)t[o++]=e;return t}},5370(e,t,i){var a=i(6198);e.exports=function(e,t,i){for(var s=0,n=arguments.length>2?i:a(t),r=new e(n);n>s;)r[s]=t[s++];return r}},9617(e,t,i){var a=i(5397),s=i(5610),n=i(6198),createMethod=function(e){return function(t,i,r){var o=a(t),l=n(o);if(0===l)return!e&&-1;var d,c=s(r,l);if(e&&i!=i){for(;l>c;)if((d=o[c++])!=d)return!0}else for(;l>c;c++)if((e||c in o)&&o[c]===i)return e||c||0;return!e&&-1}};e.exports={includes:createMethod(!0),indexOf:createMethod(!1)}},3839(e,t,i){var a=i(6080),s=i(7055),n=i(8981),r=i(6198),createMethod=function(e){var t=1===e;return function(i,o,l){for(var d,c=n(i),h=s(c),u=r(h),_=a(o,l);u-- >0;)if(_(d=h[u],u,c))switch(e){case 0:return d;case 1:return u}return t?-1:void 0}};e.exports={findLast:createMethod(0),findLastIndex:createMethod(1)}},4527(e,t,i){var a=i(3724),s=i(4376),n=TypeError,r=Object.getOwnPropertyDescriptor,o=a&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();e.exports=o?function(e,t){if(s(e)&&!r(e,"length").writable)throw new n("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},7680(e,t,i){var a=i(9504);e.exports=a([].slice)},4488(e,t,i){var a=i(7680),s=Math.floor,sort=function(e,t){var i=e.length;if(i<8)for(var n,r,o=1;o<i;){r=o;n=e[o];for(;r&&t(e[r-1],n)>0;)e[r]=e[--r];r!==o++&&(e[r]=n)}else for(var l=s(i/2),d=sort(a(e,0,l),t),c=sort(a(e,l),t),h=d.length,u=c.length,_=0,p=0;_<h||p<u;)e[_+p]=_<h&&p<u?t(d[_],c[p])<=0?d[_++]:c[p++]:_<h?d[_++]:c[p++];return e};e.exports=sort},2804(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=t+"+/",a=t+"-_",inverse=function(e){for(var t={},i=0;i<64;i++)t[e.charAt(i)]=i;return t};e.exports={i2c:i,c2i:inverse(i),i2cUrl:a,c2iUrl:inverse(a)}},6319(e,t,i){var a=i(8551),s=i(9539);e.exports=function(e,t,i,n){try{return n?t(a(i)[0],i[1]):t(i)}catch(t){s(e,"throw",t)}}},2195(e,t,i){var a=i(9504),s=a({}.toString),n=a("".slice);e.exports=function(e){return n(s(e),8,-1)}},6955(e,t,i){var a=i(2140),s=i(4901),n=i(2195),r=i(8227)("toStringTag"),o=Object,l="Arguments"===n(function(){return arguments}());e.exports=a?n:function(e){var t,i,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(e){}}(t=o(e),r))?i:l?n(t):"Object"===(a=n(t))&&s(t.callee)?"Arguments":a}},7740(e,t,i){var a=i(9297),s=i(5031),n=i(7347),r=i(4913);e.exports=function(e,t,i){for(var o=s(t),l=r.f,d=n.f,c=0;c<o.length;c++){var h=o[c];a(e,h)||i&&a(i,h)||l(e,h,d(t,h))}}},2211(e,t,i){var a=i(9039);e.exports=!a(function(){function F(){}F.prototype.constructor=null;return Object.getPrototypeOf(new F)!==F.prototype})},2529(e){e.exports=function(e,t){return{value:e,done:t}}},6699(e,t,i){var a=i(3724),s=i(4913),n=i(6980);e.exports=a?function(e,t,i){return s.f(e,t,n(1,i))}:function(e,t,i){e[t]=i;return e}},6980(e){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},2278(e,t,i){var a=i(3724),s=i(4913),n=i(6980);e.exports=function(e,t,i){a?s.f(e,t,n(0,i)):e[t]=i}},2106(e,t,i){var a=i(283),s=i(4913);e.exports=function(e,t,i){i.get&&a(i.get,t,{getter:!0});i.set&&a(i.set,t,{setter:!0});return s.f(e,t,i)}},6840(e,t,i){var a=i(4901),s=i(4913),n=i(283),r=i(9433);e.exports=function(e,t,i,o){o||(o={});var l=o.enumerable,d=void 0!==o.name?o.name:t;a(i)&&n(i,d,o);if(o.global)l?e[t]=i:r(t,i);else{try{o.unsafe?e[t]&&(l=!0):delete e[t]}catch(e){}l?e[t]=i:s.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e}},6279(e,t,i){var a=i(6840);e.exports=function(e,t,i){for(var s in t)a(e,s,t[s],i);return e}},9433(e,t,i){var a=i(4576),s=Object.defineProperty;e.exports=function(e,t){try{s(a,e,{value:t,configurable:!0,writable:!0})}catch(i){a[e]=t}return t}},3724(e,t,i){var a=i(9039);e.exports=!a(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},4483(e,t,i){var a,s,n,r,o=i(4576),l=i(9429),d=i(1548),c=o.structuredClone,h=o.ArrayBuffer,u=o.MessageChannel,_=!1;if(d)_=function(e){c(e,{transfer:[e]})};else if(h)try{u||(a=l("worker_threads"))&&(u=a.MessageChannel);if(u){s=new u;n=new h(2);r=function(e){s.port1.postMessage(null,[e])};if(2===n.byteLength){r(n);0===n.byteLength&&(_=r)}}}catch(e){}e.exports=_},4055(e,t,i){var a=i(4576),s=i(34),n=a.document,r=s(n)&&s(n.createElement);e.exports=function(e){return r?n.createElement(e):{}}},6837(e){var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},5002(e){e.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},8727(e){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3709(e,t,i){var a=i(2839).match(/firefox\/(\d+)/i);e.exports=!!a&&+a[1]},3763(e,t,i){var a=i(2839);e.exports=/MSIE|Trident/.test(a)},8574(e,t,i){var a=i(4215);e.exports="NODE"===a},2839(e,t,i){var a=i(4576).navigator,s=a&&a.userAgent;e.exports=s?String(s):""},9519(e,t,i){var a,s,n=i(4576),r=i(2839),o=n.process,l=n.Deno,d=o&&o.versions||l&&l.version,c=d&&d.v8;c&&(s=(a=c.split("."))[0]>0&&a[0]<4?1:+(a[0]+a[1]));!s&&r&&(!(a=r.match(/Edge\/(\d+)/))||a[1]>=74)&&(a=r.match(/Chrome\/(\d+)/))&&(s=+a[1]);e.exports=s},3607(e,t,i){var a=i(2839).match(/AppleWebKit\/(\d+)\./);e.exports=!!a&&+a[1]},4215(e,t,i){var a=i(4576),s=i(2839),n=i(2195),userAgentStartsWith=function(e){return s.slice(0,e.length)===e};e.exports=userAgentStartsWith("Bun/")?"BUN":userAgentStartsWith("Cloudflare-Workers")?"CLOUDFLARE":userAgentStartsWith("Deno/")?"DENO":userAgentStartsWith("Node.js/")?"NODE":a.Bun&&"string"==typeof Bun.version?"BUN":a.Deno&&"object"==typeof Deno.version?"DENO":"process"===n(a.process)?"NODE":a.window&&a.document?"BROWSER":"REST"},6193(e,t,i){var a=i(9504),s=Error,n=a("".replace),r=String(new s("zxcasd").stack),o=/\n\s*at [^:]*:[^\n]*/,l=o.test(r);e.exports=function(e,t){if(l&&"string"==typeof e&&!s.prepareStackTrace)for(;t--;)e=n(e,o,"");return e}},747(e,t,i){var a=i(6699),s=i(6193),n=i(4659),r=Error.captureStackTrace;e.exports=function(e,t,i,o){n&&(r?r(e,t):a(e,"stack",s(i,o)))}},4659(e,t,i){var a=i(9039),s=i(6980);e.exports=!a(function(){var e=new Error("a");if(!("stack"in e))return!0;Object.defineProperty(e,"stack",s(1,7));return 7!==e.stack})},6518(e,t,i){var a=i(4576),s=i(7347).f,n=i(6699),r=i(6840),o=i(9433),l=i(7740),d=i(2796);e.exports=function(e,t){var i,c,h,u,_,p=e.target,g=e.global,f=e.stat;if(i=g?a:f?a[p]||o(p,{}):a[p]&&a[p].prototype)for(c in t){u=t[c];h=e.dontCallGetSet?(_=s(i,c))&&_.value:i[c];if(!d(g?c:p+(f?".":"#")+c,e.forced)&&void 0!==h){if(typeof u==typeof h)continue;l(u,h)}(e.sham||h&&h.sham)&&n(u,"sham",!0);r(i,c,u,e)}}},9039(e){e.exports=function(e){try{return!!e()}catch(e){return!0}}},8745(e,t,i){var a=i(616),s=Function.prototype,n=s.apply,r=s.call;e.exports="object"==typeof Reflect&&Reflect.apply||(a?r.bind(n):function(){return r.apply(n,arguments)})},6080(e,t,i){var a=i(7476),s=i(9306),n=i(616),r=a(a.bind);e.exports=function(e,t){s(e);return void 0===t?e:n?r(e,t):function(){return e.apply(t,arguments)}}},616(e,t,i){var a=i(9039);e.exports=!a(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})},9565(e,t,i){var a=i(616),s=Function.prototype.call;e.exports=a?s.bind(s):function(){return s.apply(s,arguments)}},350(e,t,i){var a=i(3724),s=i(9297),n=Function.prototype,r=a&&Object.getOwnPropertyDescriptor,o=s(n,"name"),l=o&&"something"===function something(){}.name,d=o&&(!a||a&&r(n,"name").configurable);e.exports={EXISTS:o,PROPER:l,CONFIGURABLE:d}},6706(e,t,i){var a=i(9504),s=i(9306);e.exports=function(e,t,i){try{return a(s(Object.getOwnPropertyDescriptor(e,t)[i]))}catch(e){}}},7476(e,t,i){var a=i(2195),s=i(9504);e.exports=function(e){if("Function"===a(e))return s(e)}},9504(e,t,i){var a=i(616),s=Function.prototype,n=s.call,r=a&&s.bind.bind(n,n);e.exports=a?r:function(e){return function(){return n.apply(e,arguments)}}},944(e){var t=TypeError;e.exports=function(e){var i=e&&e.alphabet;if(void 0===i||"base64"===i||"base64url"===i)return i||"base64";throw new t("Incorrect `alphabet` option")}},9429(e,t,i){var a=i(4576),s=i(8574);e.exports=function(e){if(s){try{return a.process.getBuiltinModule(e)}catch(e){}try{return Function('return require("'+e+'")')()}catch(e){}}}},7751(e,t,i){var a=i(4576),s=i(4901);e.exports=function(e,t){return arguments.length<2?(i=a[e],s(i)?i:void 0):a[e]&&a[e][t];var i}},1767(e){e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},8646(e,t,i){var a=i(9565),s=i(8551),n=i(1767),r=i(851);e.exports=function(e,t){t&&"string"==typeof e||s(e);var i=r(e);return n(s(void 0!==i?a(i,e):e))}},851(e,t,i){var a=i(6955),s=i(5966),n=i(4117),r=i(6269),o=i(8227)("iterator");e.exports=function(e){if(!n(e))return s(e,o)||s(e,"@@iterator")||r[a(e)]}},81(e,t,i){var a=i(9565),s=i(9306),n=i(8551),r=i(6823),o=i(851),l=TypeError;e.exports=function(e,t){var i=arguments.length<2?o(e):t;if(s(i))return n(a(i,e));throw new l(r(e)+" is not iterable")}},5966(e,t,i){var a=i(9306),s=i(4117);e.exports=function(e,t){var i=e[t];return s(i)?void 0:a(i)}},3789(e,t,i){var a=i(9306),s=i(8551),n=i(9565),r=i(1291),o=i(1767),l="Invalid size",d=RangeError,c=TypeError,h=Math.max,SetRecord=function(e,t){this.set=e;this.size=h(t,0);this.has=a(e.has);this.keys=a(e.keys)};SetRecord.prototype={getIterator:function(){return o(s(n(this.keys,this.set)))},includes:function(e){return n(this.has,this.set,e)}};e.exports=function(e){s(e);var t=+e.size;if(t!=t)throw new c(l);var i=r(t);if(i<0)throw new d(l);return new SetRecord(e,i)}},4576(e){var check=function(e){return e&&e.Math===Math&&e};e.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof global&&global)||check("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297(e,t,i){var a=i(9504),s=i(8981),n=a({}.hasOwnProperty);e.exports=Object.hasOwn||function hasOwn(e,t){return n(s(e),t)}},421(e){e.exports={}},397(e,t,i){var a=i(7751);e.exports=a("document","documentElement")},5917(e,t,i){var a=i(3724),s=i(9039),n=i(4055);e.exports=!a&&!s(function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a})},7055(e,t,i){var a=i(9504),s=i(9039),n=i(2195),r=Object,o=a("".split);e.exports=s(function(){return!r("z").propertyIsEnumerable(0)})?function(e){return"String"===n(e)?o(e,""):r(e)}:r},3167(e,t,i){var a=i(4901),s=i(34),n=i(2967);e.exports=function(e,t,i){var r,o;n&&a(r=t.constructor)&&r!==i&&s(o=r.prototype)&&o!==i.prototype&&n(e,o);return e}},3706(e,t,i){var a=i(9504),s=i(4901),n=i(7629),r=a(Function.toString);s(n.inspectSource)||(n.inspectSource=function(e){return r(e)});e.exports=n.inspectSource},7584(e,t,i){var a=i(34),s=i(6699);e.exports=function(e,t){a(t)&&"cause"in t&&s(e,"cause",t.cause)}},1181(e,t,i){var a,s,n,r=i(8622),o=i(4576),l=i(34),d=i(6699),c=i(9297),h=i(7629),u=i(6119),_=i(421),p="Object already initialized",g=o.TypeError,f=o.WeakMap;if(r||h.state){var m=h.state||(h.state=new f);m.get=m.get;m.has=m.has;m.set=m.set;a=function(e,t){if(m.has(e))throw new g(p);t.facade=e;m.set(e,t);return t};s=function(e){return m.get(e)||{}};n=function(e){return m.has(e)}}else{var v=u("state");_[v]=!0;a=function(e,t){if(c(e,v))throw new g(p);t.facade=e;d(e,v,t);return t};s=function(e){return c(e,v)?e[v]:{}};n=function(e){return c(e,v)}}e.exports={set:a,get:s,has:n,enforce:function(e){return n(e)?s(e):a(e,{})},getterFor:function(e){return function(t){var i;if(!l(t)||(i=s(t)).type!==e)throw new g("Incompatible receiver, "+e+" required");return i}}}},4209(e,t,i){var a=i(8227),s=i(6269),n=a("iterator"),r=Array.prototype;e.exports=function(e){return void 0!==e&&(s.Array===e||r[n]===e)}},4376(e,t,i){var a=i(2195);e.exports=Array.isArray||function isArray(e){return"Array"===a(e)}},1108(e,t,i){var a=i(6955);e.exports=function(e){var t=a(e);return"BigInt64Array"===t||"BigUint64Array"===t}},4901(e){var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},2796(e,t,i){var a=i(9039),s=i(4901),n=/#|\.prototype\./,isForced=function(e,t){var i=o[r(e)];return i===d||i!==l&&(s(t)?a(t):!!t)},r=isForced.normalize=function(e){return String(e).replace(n,".").toLowerCase()},o=isForced.data={},l=isForced.NATIVE="N",d=isForced.POLYFILL="P";e.exports=isForced},4117(e){e.exports=function(e){return null==e}},34(e,t,i){var a=i(4901);e.exports=function(e){return"object"==typeof e?null!==e:a(e)}},3925(e,t,i){var a=i(34);e.exports=function(e){return a(e)||null===e}},6395(e){e.exports=!1},5810(e,t,i){var a=i(34),s=i(1181).get;e.exports=function isRawJSON(e){if(!a(e))return!1;var t=s(e);return!!t&&"RawJSON"===t.type}},757(e,t,i){var a=i(7751),s=i(4901),n=i(1625),r=i(7040),o=Object;e.exports=r?function(e){return"symbol"==typeof e}:function(e){var t=a("Symbol");return s(t)&&n(t.prototype,o(e))}},507(e,t,i){var a=i(9565);e.exports=function(e,t,i){for(var s,n,r=i?e:e.iterator,o=e.next;!(s=a(o,r)).done;)if(void 0!==(n=t(s.value)))return n}},2652(e,t,i){var a=i(6080),s=i(9565),n=i(8551),r=i(6823),o=i(4209),l=i(6198),d=i(1625),c=i(81),h=i(851),u=i(9539),_=TypeError,Result=function(e,t){this.stopped=e;this.result=t},p=Result.prototype;e.exports=function(e,t,i){var g,f,m,v,P,w,b,y=i&&i.that,S=!(!i||!i.AS_ENTRIES),C=!(!i||!i.IS_RECORD),x=!(!i||!i.IS_ITERATOR),k=!(!i||!i.INTERRUPTED),E=a(t,y),stop=function(e){g&&u(g,"normal");return new Result(!0,e)},callFn=function(e){if(S){n(e);return k?E(e[0],e[1],stop):E(e[0],e[1])}return k?E(e,stop):E(e)};if(C)g=e.iterator;else if(x)g=e;else{if(!(f=h(e)))throw new _(r(e)+" is not iterable");if(o(f)){for(m=0,v=l(e);v>m;m++)if((P=callFn(e[m]))&&d(p,P))return P;return new Result(!1)}g=c(e,f)}w=C?e.next:g.next;for(;!(b=s(w,g)).done;){try{P=callFn(b.value)}catch(e){u(g,"throw",e)}if("object"==typeof P&&P&&d(p,P))return P}return new Result(!1)}},1385(e,t,i){var a=i(9539);e.exports=function(e,t,i){for(var s=e.length-1;s>=0;s--)if(void 0!==e[s])try{i=a(e[s].iterator,t,i)}catch(e){t="throw";i=e}if("throw"===t)throw i;return i}},9539(e,t,i){var a=i(9565),s=i(8551),n=i(5966);e.exports=function(e,t,i){var r,o;s(e);try{if(!(r=n(e,"return"))){if("throw"===t)throw i;return i}r=a(r,e)}catch(e){o=!0;r=e}if("throw"===t)throw i;if(o)throw r;s(r);return i}},9462(e,t,i){var a=i(9565),s=i(2360),n=i(6699),r=i(6279),o=i(8227),l=i(1181),d=i(5966),c=i(7657).IteratorPrototype,h=i(2529),u=i(9539),_=i(1385),p=o("toStringTag"),g="IteratorHelper",f="WrapForValidIterator",m="normal",v="throw",P=l.set,createIteratorProxyPrototype=function(e){var t=l.getterFor(e?f:g);return r(s(c),{next:function next(){var i=t(this);if(e)return i.nextHandler();if(i.done)return h(void 0,!0);try{var a=i.nextHandler();return i.returnHandlerResult?a:h(a,i.done)}catch(e){i.done=!0;throw e}},return:function(){var i=t(this),s=i.iterator;i.done=!0;if(e){var n=d(s,"return");return n?a(n,s):h(void 0,!0)}if(i.inner)try{u(i.inner.iterator,m)}catch(e){return u(s,v,e)}if(i.openIters)try{_(i.openIters,m)}catch(e){return u(s,v,e)}s&&u(s,m);return h(void 0,!0)}})},w=createIteratorProxyPrototype(!0),b=createIteratorProxyPrototype(!1);n(b,p,"Iterator Helper");e.exports=function(e,t,i){var a=function Iterator(a,s){if(s){s.iterator=a.iterator;s.next=a.next}else s=a;s.type=t?f:g;s.returnHandlerResult=!!i;s.nextHandler=e;s.counter=0;s.done=!1;P(this,s)};a.prototype=t?w:b;return a}},684(e){e.exports=function(e,t){var i="function"==typeof Iterator&&Iterator.prototype[e];if(i)try{i.call({next:null},t).next()}catch(e){return!0}}},4549(e,t,i){var a=i(4576);e.exports=function(e,t){var i=a.Iterator,s=i&&i.prototype,n=s&&s[e],r=!1;if(n)try{n.call({next:function(){return{done:!0}},return:function(){r=!0}},-1)}catch(e){e instanceof t||(r=!1)}if(!r)return n}},7657(e,t,i){var a,s,n,r=i(9039),o=i(4901),l=i(34),d=i(2360),c=i(2787),h=i(6840),u=i(8227),_=i(6395),p=u("iterator"),g=!1;[].keys&&("next"in(n=[].keys())?(s=c(c(n)))!==Object.prototype&&(a=s):g=!0);!l(a)||r(function(){var e={};return a[p].call(e)!==e})?a={}:_&&(a=d(a));o(a[p])||h(a,p,function(){return this});e.exports={IteratorPrototype:a,BUGGY_SAFARI_ITERATORS:g}},6269(e){e.exports={}},6198(e,t,i){var a=i(8014);e.exports=function(e){return a(e.length)}},283(e,t,i){var a=i(9504),s=i(9039),n=i(4901),r=i(9297),o=i(3724),l=i(350).CONFIGURABLE,d=i(3706),c=i(1181),h=c.enforce,u=c.get,_=String,p=Object.defineProperty,g=a("".slice),f=a("".replace),m=a([].join),v=o&&!s(function(){return 8!==p(function(){},"length",{value:8}).length}),P=String(String).split("String"),w=e.exports=function(e,t,i){"Symbol("===g(_(t),0,7)&&(t="["+f(_(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]");i&&i.getter&&(t="get "+t);i&&i.setter&&(t="set "+t);(!r(e,"name")||l&&e.name!==t)&&(o?p(e,"name",{value:t,configurable:!0}):e.name=t);v&&i&&r(i,"arity")&&e.length!==i.arity&&p(e,"length",{value:i.arity});try{i&&r(i,"constructor")&&i.constructor?o&&p(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var a=h(e);r(a,"source")||(a.source=m(P,"string"==typeof t?t:""));return e};Function.prototype.toString=w(function toString(){return n(this)&&u(this).source||d(this)},"toString")},2248(e,t,i){var a=i(9504),s=Map.prototype;e.exports={Map,set:a(s.set),get:a(s.get),has:a(s.has),remove:a(s.delete),proto:s}},741(e){var t=Math.ceil,i=Math.floor;e.exports=Math.trunc||function trunc(e){var a=+e;return(a>0?i:t)(a)}},7819(e,t,i){var a=i(9039);e.exports=!a(function(){var e="9007199254740993",t=JSON.rawJSON(e);return!JSON.isRawJSON(t)||JSON.stringify(t)!==e})},6043(e,t,i){var a=i(9306),s=TypeError,PromiseCapability=function(e){var t,i;this.promise=new e(function(e,a){if(void 0!==t||void 0!==i)throw new s("Bad Promise constructor");t=e;i=a});this.resolve=a(t);this.reject=a(i)};e.exports.f=function(e){return new PromiseCapability(e)}},2603(e,t,i){var a=i(655);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:a(e)}},4149(e){var t=RangeError;e.exports=function(e){if(e==e)return e;throw new t("NaN is not allowed")}},2360(e,t,i){var a,s=i(8551),n=i(6801),r=i(8727),o=i(421),l=i(397),d=i(4055),c=i(6119),h="prototype",u="script",_=c("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(e){return"<"+u+">"+e+"</"+u+">"},NullProtoObjectViaActiveX=function(e){e.write(scriptTag(""));e.close();var t=e.parentWindow.Object;e=null;return t},NullProtoObject=function(){try{a=new ActiveXObject("htmlfile")}catch(e){}NullProtoObject="undefined"!=typeof document?document.domain&&a?NullProtoObjectViaActiveX(a):function(){var e,t=d("iframe"),i="java"+u+":";t.style.display="none";l.appendChild(t);t.src=String(i);(e=t.contentWindow.document).open();e.write(scriptTag("document.F=Object"));e.close();return e.F}():NullProtoObjectViaActiveX(a);for(var e=r.length;e--;)delete NullProtoObject[h][r[e]];return NullProtoObject()};o[_]=!0;e.exports=Object.create||function create(e,t){var i;if(null!==e){EmptyConstructor[h]=s(e);i=new EmptyConstructor;EmptyConstructor[h]=null;i[_]=e}else i=NullProtoObject();return void 0===t?i:n.f(i,t)}},6801(e,t,i){var a=i(3724),s=i(8686),n=i(4913),r=i(8551),o=i(5397),l=i(1072);t.f=a&&!s?Object.defineProperties:function defineProperties(e,t){r(e);for(var i,a=o(t),s=l(t),d=s.length,c=0;d>c;)n.f(e,i=s[c++],a[i]);return e}},4913(e,t,i){var a=i(3724),s=i(5917),n=i(8686),r=i(8551),o=i(6969),l=TypeError,d=Object.defineProperty,c=Object.getOwnPropertyDescriptor,h="enumerable",u="configurable",_="writable";t.f=a?n?function defineProperty(e,t,i){r(e);t=o(t);r(i);if("function"==typeof e&&"prototype"===t&&"value"in i&&_ in i&&!i[_]){var a=c(e,t);if(a&&a[_]){e[t]=i.value;i={configurable:u in i?i[u]:a[u],enumerable:h in i?i[h]:a[h],writable:!1}}}return d(e,t,i)}:d:function defineProperty(e,t,i){r(e);t=o(t);r(i);if(s)try{return d(e,t,i)}catch(e){}if("get"in i||"set"in i)throw new l("Accessors not supported");"value"in i&&(e[t]=i.value);return e}},7347(e,t,i){var a=i(3724),s=i(9565),n=i(8773),r=i(6980),o=i(5397),l=i(6969),d=i(9297),c=i(5917),h=Object.getOwnPropertyDescriptor;t.f=a?h:function getOwnPropertyDescriptor(e,t){e=o(e);t=l(t);if(c)try{return h(e,t)}catch(e){}if(d(e,t))return r(!s(n.f,e,t),e[t])}},8480(e,t,i){var a=i(1828),s=i(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function getOwnPropertyNames(e){return a(e,s)}},3717(e,t){t.f=Object.getOwnPropertySymbols},2787(e,t,i){var a=i(9297),s=i(4901),n=i(8981),r=i(6119),o=i(2211),l=r("IE_PROTO"),d=Object,c=d.prototype;e.exports=o?d.getPrototypeOf:function(e){var t=n(e);if(a(t,l))return t[l];var i=t.constructor;return s(i)&&t instanceof i?i.prototype:t instanceof d?c:null}},1625(e,t,i){var a=i(9504);e.exports=a({}.isPrototypeOf)},1828(e,t,i){var a=i(9504),s=i(9297),n=i(5397),r=i(9617).indexOf,o=i(421),l=a([].push);e.exports=function(e,t){var i,a=n(e),d=0,c=[];for(i in a)!s(o,i)&&s(a,i)&&l(c,i);for(;t.length>d;)s(a,i=t[d++])&&(~r(c,i)||l(c,i));return c}},1072(e,t,i){var a=i(1828),s=i(8727);e.exports=Object.keys||function keys(e){return a(e,s)}},8773(e,t){var i={}.propertyIsEnumerable,a=Object.getOwnPropertyDescriptor,s=a&&!i.call({1:2},1);t.f=s?function propertyIsEnumerable(e){var t=a(this,e);return!!t&&t.enumerable}:i},2967(e,t,i){var a=i(6706),s=i(34),n=i(7750),r=i(3506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=a(Object.prototype,"__proto__","set"))(i,[]);t=i instanceof Array}catch(e){}return function setPrototypeOf(i,a){n(i);r(a);if(!s(i))return i;t?e(i,a):i.__proto__=a;return i}}():void 0)},4270(e,t,i){var a=i(9565),s=i(4901),n=i(34),r=TypeError;e.exports=function(e,t){var i,o;if("string"===t&&s(i=e.toString)&&!n(o=a(i,e)))return o;if(s(i=e.valueOf)&&!n(o=a(i,e)))return o;if("string"!==t&&s(i=e.toString)&&!n(o=a(i,e)))return o;throw new r("Can't convert object to primitive value")}},5031(e,t,i){var a=i(7751),s=i(9504),n=i(8480),r=i(3717),o=i(8551),l=s([].concat);e.exports=a("Reflect","ownKeys")||function ownKeys(e){var t=n.f(o(e)),i=r.f;return i?l(t,i(e)):t}},8235(e,t,i){var a=i(9504),s=i(9297),n=SyntaxError,r=parseInt,o=String.fromCharCode,l=a("".charAt),d=a("".slice),c=a(/./.exec),h={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},u=/^[\da-f]{4}$/i,_=/^[\u0000-\u001F]$/;e.exports=function(e,t){for(var i=!0,a="";t<e.length;){var p=l(e,t);if("\\"===p){var g=d(e,t,t+2);if(s(h,g)){a+=h[g];t+=2}else{if("\\u"!==g)throw new n('Unknown escape sequence: "'+g+'"');var f=d(e,t+=2,t+4);if(!c(u,f))throw new n("Bad Unicode escape at: "+t);a+=o(r(f,16));t+=4}}else{if('"'===p){i=!1;t++;break}if(c(_,p))throw new n("Bad control character in string literal at: "+t);a+=p;t++}}if(i)throw new n("Unterminated string at: "+t);return{value:a,end:t}}},1103(e){e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},1056(e,t,i){var a=i(4913).f;e.exports=function(e,t,i){i in e||a(e,i,{configurable:!0,get:function(){return t[i]},set:function(e){t[i]=e}})}},7750(e,t,i){var a=i(4117),s=TypeError;e.exports=function(e){if(a(e))throw new s("Can't call method on "+e);return e}},9286(e,t,i){var a=i(4402),s=i(8469),n=a.Set,r=a.add;e.exports=function(e){var t=new n;s(e,function(e){r(t,e)});return t}},3440(e,t,i){var a=i(7080),s=i(4402),n=i(9286),r=i(5170),o=i(3789),l=i(8469),d=i(507),c=s.has,h=s.remove;e.exports=function difference(e){var t=a(this),i=o(e),s=n(t);r(t)<=i.size?l(t,function(e){i.includes(e)&&h(s,e)}):d(i.getIterator(),function(e){c(s,e)&&h(s,e)});return s}},4402(e,t,i){var a=i(9504),s=Set.prototype;e.exports={Set,add:a(s.add),has:a(s.has),remove:a(s.delete),proto:s}},8750(e,t,i){var a=i(7080),s=i(4402),n=i(5170),r=i(3789),o=i(8469),l=i(507),d=s.Set,c=s.add,h=s.has;e.exports=function intersection(e){var t=a(this),i=r(e),s=new d;n(t)>i.size?l(i.getIterator(),function(e){h(t,e)&&c(s,e)}):o(t,function(e){i.includes(e)&&c(s,e)});return s}},4449(e,t,i){var a=i(7080),s=i(4402).has,n=i(5170),r=i(3789),o=i(8469),l=i(507),d=i(9539);e.exports=function isDisjointFrom(e){var t=a(this),i=r(e);if(n(t)<=i.size)return!1!==o(t,function(e){if(i.includes(e))return!1},!0);var c=i.getIterator();return!1!==l(c,function(e){if(s(t,e))return d(c,"normal",!1)})}},3838(e,t,i){var a=i(7080),s=i(5170),n=i(8469),r=i(3789);e.exports=function isSubsetOf(e){var t=a(this),i=r(e);return!(s(t)>i.size)&&!1!==n(t,function(e){if(!i.includes(e))return!1},!0)}},8527(e,t,i){var a=i(7080),s=i(4402).has,n=i(5170),r=i(3789),o=i(507),l=i(9539);e.exports=function isSupersetOf(e){var t=a(this),i=r(e);if(n(t)<i.size)return!1;var d=i.getIterator();return!1!==o(d,function(e){if(!s(t,e))return l(d,"normal",!1)})}},8469(e,t,i){var a=i(9504),s=i(507),n=i(4402),r=n.Set,o=n.proto,l=a(o.forEach),d=a(o.keys),c=d(new r).next;e.exports=function(e,t,i){return i?s({iterator:d(e),next:c},t):l(e,t)}},4916(e,t,i){var a=i(7751),createSetLike=function(e){return{size:e,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},createSetLikeWithInfinitySize=function(e){return{size:e,has:function(){return!0},keys:function(){throw new Error("e")}}};e.exports=function(e,t){var i=a("Set");try{(new i)[e](createSetLike(0));try{(new i)[e](createSetLike(-1));return!1}catch(a){if(!t)return!0;try{(new i)[e](createSetLikeWithInfinitySize(-1/0));return!1}catch(a){return t(new i([1,2])[e](createSetLikeWithInfinitySize(1/0)))}}}catch(e){return!1}}},9835(e){e.exports=function(e){try{var t=new Set,i={size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){t.clear();t.add(4);return function(){return{done:!0}}}})}},a=t[e](i);return 1===a.size&&4===a.values().next().value}catch(e){return!1}}},5170(e,t,i){var a=i(6706),s=i(4402);e.exports=a(s.proto,"size","get")||function(e){return e.size}},3650(e,t,i){var a=i(7080),s=i(4402),n=i(9286),r=i(3789),o=i(507),l=s.add,d=s.has,c=s.remove;e.exports=function symmetricDifference(e){var t=a(this),i=r(e).getIterator(),s=n(t);o(i,function(e){d(t,e)?c(s,e):l(s,e)});return s}},4204(e,t,i){var a=i(7080),s=i(4402).add,n=i(9286),r=i(3789),o=i(507);e.exports=function union(e){var t=a(this),i=r(e).getIterator(),l=n(t);o(i,function(e){s(l,e)});return l}},6119(e,t,i){var a=i(5745),s=i(3392),n=a("keys");e.exports=function(e){return n[e]||(n[e]=s(e))}},7629(e,t,i){var a=i(6395),s=i(4576),n=i(9433),r="__core-js_shared__",o=e.exports=s[r]||n(r,{});(o.versions||(o.versions=[])).push({version:"3.48.0",mode:a?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.48.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745(e,t,i){var a=i(7629);e.exports=function(e,t){return a[e]||(a[e]=t||{})}},533(e,t,i){var a=i(9504),s=i(8014),n=i(655),r=i(2333),o=i(7750),l=a(r),d=a("".slice),c=Math.ceil,createMethod=function(e){return function(t,i,a){var r,h,u=n(o(t)),_=s(i),p=u.length,g=void 0===a?" ":n(a);if(_<=p||""===g)return u;(h=l(g,c((r=_-p)/g.length))).length>r&&(h=d(h,0,r));return e?u+h:h+u}};e.exports={start:createMethod(!1),end:createMethod(!0)}},2333(e,t,i){var a=i(1291),s=i(655),n=i(7750),r=RangeError;e.exports=function repeat(e){var t=s(n(this)),i="",o=a(e);if(o<0||o===1/0)throw new r("Wrong number of repetitions");for(;o>0;(o>>>=1)&&(t+=t))1&o&&(i+=t);return i}},1548(e,t,i){var a=i(4576),s=i(9039),n=i(9519),r=i(4215),o=a.structuredClone;e.exports=!!o&&!s(function(){if("DENO"===r&&n>92||"NODE"===r&&n>94||"BROWSER"===r&&n>97)return!1;var e=new ArrayBuffer(8),t=o(e,{transfer:[e]});return 0!==e.byteLength||8!==t.byteLength})},4495(e,t,i){var a=i(9519),s=i(9039),n=i(4576).String;e.exports=!!Object.getOwnPropertySymbols&&!s(function(){var e=Symbol("symbol detection");return!n(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&a&&a<41})},5610(e,t,i){var a=i(1291),s=Math.max,n=Math.min;e.exports=function(e,t){var i=a(e);return i<0?s(i+t,0):n(i,t)}},5854(e,t,i){var a=i(2777),s=TypeError;e.exports=function(e){var t=a(e,"number");if("number"==typeof t)throw new s("Can't convert number to bigint");return BigInt(t)}},7696(e,t,i){var a=i(1291),s=i(8014),n=RangeError;e.exports=function(e){if(void 0===e)return 0;var t=a(e),i=s(t);if(t!==i)throw new n("Wrong length or index");return i}},5397(e,t,i){var a=i(7055),s=i(7750);e.exports=function(e){return a(s(e))}},1291(e,t,i){var a=i(741);e.exports=function(e){var t=+e;return t!=t||0===t?0:a(t)}},8014(e,t,i){var a=i(1291),s=Math.min;e.exports=function(e){var t=a(e);return t>0?s(t,9007199254740991):0}},8981(e,t,i){var a=i(7750),s=Object;e.exports=function(e){return s(a(e))}},8229(e,t,i){var a=i(9590),s=RangeError;e.exports=function(e,t){var i=a(e);if(i%t)throw new s("Wrong offset");return i}},9590(e,t,i){var a=i(1291),s=RangeError;e.exports=function(e){var t=a(e);if(t<0)throw new s("The argument can't be less than 0");return t}},2777(e,t,i){var a=i(9565),s=i(34),n=i(757),r=i(5966),o=i(4270),l=i(8227),d=TypeError,c=l("toPrimitive");e.exports=function(e,t){if(!s(e)||n(e))return e;var i,l=r(e,c);if(l){void 0===t&&(t="default");i=a(l,e,t);if(!s(i)||n(i))return i;throw new d("Can't convert object to primitive value")}void 0===t&&(t="number");return o(e,t)}},6969(e,t,i){var a=i(2777),s=i(757);e.exports=function(e){var t=a(e,"string");return s(t)?t:t+""}},2140(e,t,i){var a={};a[i(8227)("toStringTag")]="z";e.exports="[object z]"===String(a)},655(e,t,i){var a=i(6955),s=String;e.exports=function(e){if("Symbol"===a(e))throw new TypeError("Cannot convert a Symbol value to a string");return s(e)}},6823(e){var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},3392(e,t,i){var a=i(9504),s=0,n=Math.random(),r=a(1.1.toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+r(++s+n,36)}},9143(e,t,i){var a=i(4576),s=i(9504),n=i(3972),r=i(3463),o=i(9297),l=i(2804),d=i(944),c=i(5169),h=l.c2i,u=l.c2iUrl,_=a.SyntaxError,p=a.TypeError,g=s("".charAt),skipAsciiWhitespace=function(e,t){for(var i=e.length;t<i;t++){var a=g(e,t);if(" "!==a&&"\t"!==a&&"\n"!==a&&"\f"!==a&&"\r"!==a)break}return t},decodeBase64Chunk=function(e,t,i){var a=e.length;a<4&&(e+=2===a?"AA":"A");var s=(t[g(e,0)]<<18)+(t[g(e,1)]<<12)+(t[g(e,2)]<<6)+t[g(e,3)],n=[s>>16&255,s>>8&255,255&s];if(2===a){if(i&&0!==n[1])throw new _("Extra bits");return[n[0]]}if(3===a){if(i&&0!==n[2])throw new _("Extra bits");return[n[0],n[1]]}return n},writeBytes=function(e,t,i){for(var a=t.length,s=0;s<a;s++)e[i+s]=t[s];return i+a};e.exports=function(e,t,i,a){r(e);n(t);var s="base64"===d(t)?h:u,l=t?t.lastChunkHandling:void 0;void 0===l&&(l="loose");if("loose"!==l&&"strict"!==l&&"stop-before-partial"!==l)throw new p("Incorrect `lastChunkHandling` option");i&&c(i.buffer);var f=e.length,m=i||[],v=0,P=0,w="",b=0;if(a)for(;;){if((b=skipAsciiWhitespace(e,b))===f){if(w.length>0){if("stop-before-partial"===l)break;if("loose"!==l)throw new _("Missing padding");if(1===w.length)throw new _("Malformed padding: exactly one additional character");v=writeBytes(m,decodeBase64Chunk(w,s,!1),v)}P=f;break}var y=g(e,b);++b;if("="===y){if(w.length<2)throw new _("Padding is too early");b=skipAsciiWhitespace(e,b);if(2===w.length){if(b===f){if("stop-before-partial"===l)break;throw new _("Malformed padding: only one =")}if("="===g(e,b)){++b;b=skipAsciiWhitespace(e,b)}}if(b<f)throw new _("Unexpected character after padding");v=writeBytes(m,decodeBase64Chunk(w,s,"strict"===l),v);P=f;break}if(!o(s,y))throw new _("Unexpected character");var S=a-v;if(1===S&&2===w.length||2===S&&3===w.length)break;if(4===(w+=y).length){v=writeBytes(m,decodeBase64Chunk(w,s,!1),v);w="";P=b;if(v===a)break}}return{bytes:m,read:P,written:v}}},2303(e,t,i){var a=i(4576),s=i(9504),n=a.Uint8Array,r=a.SyntaxError,o=a.parseInt,l=Math.min,d=/[^\da-f]/i,c=s(d.exec),h=s("".slice);e.exports=function(e,t){var i=e.length;if(i%2!=0)throw new r("String should be an even number of characters");for(var a=t?l(t.length,i/2):i/2,s=t||new n(a),u=0,_=0;_<a;){var p=h(e,u,u+=2);if(c(d,p))throw new r("String should only contain hex characters");s[_++]=o(p,16)}return{bytes:s,read:u}}},7416(e,t,i){var a=i(9039),s=i(8227),n=i(3724),r=i(6395),o=s("iterator");e.exports=!a(function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,i=new URLSearchParams("a=1&a=2&b=3"),a="";e.pathname="c%20d";t.forEach(function(e,i){t.delete("b");a+=i+e});i.delete("a",2);i.delete("b",void 0);return r&&(!e.toJSON||!i.has("a",1)||i.has("a",2)||!i.has("a",void 0)||i.has("b"))||!t.size&&(r||!n)||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[o]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==a||"x"!==new URL("https://x",void 0).host})},7040(e,t,i){var a=i(4495);e.exports=a&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686(e,t,i){var a=i(3724),s=i(9039);e.exports=a&&s(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},2812(e){var t=TypeError;e.exports=function(e,i){if(e<i)throw new t("Not enough arguments");return e}},8622(e,t,i){var a=i(4576),s=i(4901),n=a.WeakMap;e.exports=s(n)&&/native code/.test(String(n))},4995(e,t,i){var a=i(9504),s=WeakMap.prototype;e.exports={WeakMap,set:a(s.set),get:a(s.get),has:a(s.has),remove:a(s.delete)}},8227(e,t,i){var a=i(4576),s=i(5745),n=i(9297),r=i(3392),o=i(4495),l=i(7040),d=a.Symbol,c=s("wks"),h=l?d.for||d:d&&d.withoutSetter||r;e.exports=function(e){n(c,e)||(c[e]=o&&n(d,e)?d[e]:h("Symbol."+e));return c[e]}},7452(e){e.exports="\t\n\v\f\r                 \u2028\u2029\ufeff"},4601(e,t,i){var a=i(7751),s=i(9297),n=i(6699),r=i(1625),o=i(2967),l=i(7740),d=i(1056),c=i(3167),h=i(2603),u=i(7584),_=i(747),p=i(3724),g=i(6395);e.exports=function(e,t,i,f){var m="stackTraceLimit",v=f?2:1,P=e.split("."),w=P[P.length-1],b=a.apply(null,P);if(b){var y=b.prototype;!g&&s(y,"cause")&&delete y.cause;if(!i)return b;var S=a("Error"),C=t(function(e,t){var i=h(f?t:e,void 0),a=f?new b(e):new b;void 0!==i&&n(a,"message",i);_(a,C,a.stack,2);this&&r(y,this)&&c(a,this,C);arguments.length>v&&u(a,arguments[v]);return a});C.prototype=y;if("Error"!==w)o?o(C,S):l(C,S,{name:!0});else if(p&&m in b){d(C,b,m);d(C,b,"prepareStackTrace")}l(C,b);if(!g)try{y.name!==w&&n(y,"name",w);y.constructor=C}catch(e){}return C}}},6573(e,t,i){var a=i(3724),s=i(2106),n=i(3238),r=ArrayBuffer.prototype;a&&!("detached"in r)&&s(r,"detached",{configurable:!0,get:function detached(){return n(this)}})},7936(e,t,i){var a=i(6518),s=i(5636);s&&a({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function transferToFixedLength(){return s(this,arguments.length?arguments[0]:void 0,!1)}})},8100(e,t,i){var a=i(6518),s=i(5636);s&&a({target:"ArrayBuffer",proto:!0},{transfer:function transfer(){return s(this,arguments.length?arguments[0]:void 0,!0)}})},8107(e,t,i){var a=i(6518),s=i(8981),n=i(6198),r=i(1291),o=i(6469);a({target:"Array",proto:!0},{at:function at(e){var t=s(this),i=n(t),a=r(e),o=a>=0?a:i+a;return o<0||o>=i?void 0:t[o]}});o("at")},838(e,t,i){var a=i(6518),s=i(3839).findLast,n=i(6469);a({target:"Array",proto:!0},{findLast:function findLast(e){return s(this,e,arguments.length>1?arguments[1]:void 0)}});n("findLast")},4114(e,t,i){var a=i(6518),s=i(8981),n=i(6198),r=i(4527),o=i(6837);a({target:"Array",proto:!0,arity:1,forced:i(9039)(function(){return 4294967297!==[].push.call({length:4294967296},1)})||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function push(e){var t=s(this),i=n(t),a=arguments.length;o(i+a);for(var l=0;l<a;l++){t[i]=arguments[l];i++}r(t,i);return i}})},6280(e,t,i){var a=i(6518),s=i(4576),n=i(8745),r=i(4601),o="WebAssembly",l=s[o],d=7!==new Error("e",{cause:7}).cause,exportGlobalErrorCauseWrapper=function(e,t){var i={};i[e]=r(e,t,d);a({global:!0,constructor:!0,arity:1,forced:d},i)},exportWebAssemblyErrorCauseWrapper=function(e,t){if(l&&l[e]){var i={};i[e]=r(o+"."+e,t,d);a({target:o,stat:!0,constructor:!0,arity:1,forced:d},i)}};exportGlobalErrorCauseWrapper("Error",function(e){return function Error(t){return n(e,this,arguments)}});exportGlobalErrorCauseWrapper("EvalError",function(e){return function EvalError(t){return n(e,this,arguments)}});exportGlobalErrorCauseWrapper("RangeError",function(e){return function RangeError(t){return n(e,this,arguments)}});exportGlobalErrorCauseWrapper("ReferenceError",function(e){return function ReferenceError(t){return n(e,this,arguments)}});exportGlobalErrorCauseWrapper("SyntaxError",function(e){return function SyntaxError(t){return n(e,this,arguments)}});exportGlobalErrorCauseWrapper("TypeError",function(e){return function TypeError(t){return n(e,this,arguments)}});exportGlobalErrorCauseWrapper("URIError",function(e){return function URIError(t){return n(e,this,arguments)}});exportWebAssemblyErrorCauseWrapper("CompileError",function(e){return function CompileError(t){return n(e,this,arguments)}});exportWebAssemblyErrorCauseWrapper("LinkError",function(e){return function LinkError(t){return n(e,this,arguments)}});exportWebAssemblyErrorCauseWrapper("RuntimeError",function(e){return function RuntimeError(t){return n(e,this,arguments)}})},8111(e,t,i){var a=i(6518),s=i(4576),n=i(679),r=i(8551),o=i(4901),l=i(2787),d=i(2106),c=i(2278),h=i(9039),u=i(9297),_=i(8227),p=i(7657).IteratorPrototype,g=i(3724),f=i(6395),m="constructor",v="Iterator",P=_("toStringTag"),w=TypeError,b=s[v],y=f||!o(b)||b.prototype!==p||!h(function(){b({})}),S=function Iterator(){n(this,p);if(l(this)===p)throw new w("Abstract class Iterator not directly constructable")},defineIteratorPrototypeAccessor=function(e,t){g?d(p,e,{configurable:!0,get:function(){return t},set:function(t){r(this);if(this===p)throw new w("You can't redefine this property");u(this,e)?this[e]=t:c(this,e,t)}}):p[e]=t};u(p,P)||defineIteratorPrototypeAccessor(P,v);!y&&u(p,m)&&p[m]!==Object||defineIteratorPrototypeAccessor(m,S);S.prototype=p;a({global:!0,constructor:!0,forced:y},{Iterator:S})},9314(e,t,i){var a=i(6518),s=i(9565),n=i(8551),r=i(1767),o=i(4149),l=i(9590),d=i(9539),c=i(9462),h=i(684),u=i(4549),_=i(6395),p=!_&&!h("drop",0),g=!_&&!p&&u("drop",RangeError),f=_||p||g,m=c(function(){for(var e,t=this.iterator,i=this.next;this.remaining;){this.remaining--;e=n(s(i,t));if(this.done=!!e.done)return}e=n(s(i,t));if(!(this.done=!!e.done))return e.value});a({target:"Iterator",proto:!0,real:!0,forced:f},{drop:function drop(e){n(this);var t;try{t=l(o(+e))}catch(e){d(this,"throw",e)}return g?s(g,this,t):new m(r(this),{remaining:t})}})},1148(e,t,i){var a=i(6518),s=i(9565),n=i(2652),r=i(9306),o=i(8551),l=i(1767),d=i(9539),c=i(4549)("every",TypeError);a({target:"Iterator",proto:!0,real:!0,forced:c},{every:function every(e){o(this);try{r(e)}catch(e){d(this,"throw",e)}if(c)return s(c,this,e);var t=l(this),i=0;return!n(t,function(t,a){if(!e(t,i++))return a()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},2489(e,t,i){var a=i(6518),s=i(9565),n=i(9306),r=i(8551),o=i(1767),l=i(9462),d=i(6319),c=i(6395),h=i(9539),u=i(684),_=i(4549),p=!c&&!u("filter",function(){}),g=!c&&!p&&_("filter",TypeError),f=c||p||g,m=l(function(){for(var e,t,i=this.iterator,a=this.predicate,n=this.next;;){e=r(s(n,i));if(this.done=!!e.done)return;t=e.value;if(d(i,a,[t,this.counter++],!0))return t}});a({target:"Iterator",proto:!0,real:!0,forced:f},{filter:function filter(e){r(this);try{n(e)}catch(e){h(this,"throw",e)}return g?s(g,this,e):new m(o(this),{predicate:e})}})},116(e,t,i){var a=i(6518),s=i(9565),n=i(2652),r=i(9306),o=i(8551),l=i(1767),d=i(9539),c=i(4549)("find",TypeError);a({target:"Iterator",proto:!0,real:!0,forced:c},{find:function find(e){o(this);try{r(e)}catch(e){d(this,"throw",e)}if(c)return s(c,this,e);var t=l(this),i=0;return n(t,function(t,a){if(e(t,i++))return a(t)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})},531(e,t,i){var a=i(6518),s=i(9565),n=i(9306),r=i(8551),o=i(1767),l=i(8646),d=i(9462),c=i(9539),h=i(6395),u=i(684),_=i(4549);var p=!h&&!u("flatMap",function(){}),g=!h&&!p&&_("flatMap",TypeError),f=h||p||g||function throwsOnIteratorWithoutReturn(){try{var e=Iterator.prototype.flatMap.call(new Map([[4,5]]).entries(),function(e){return e});e.next();e.return()}catch(e){return!0}}(),m=d(function(){for(var e,t,i=this.iterator,a=this.mapper;;){if(t=this.inner)try{if(!(e=r(s(t.next,t.iterator))).done)return e.value;this.inner=null}catch(e){c(i,"throw",e)}e=r(s(this.next,i));if(this.done=!!e.done)return;try{this.inner=l(a(e.value,this.counter++),!1)}catch(e){c(i,"throw",e)}}});a({target:"Iterator",proto:!0,real:!0,forced:f},{flatMap:function flatMap(e){r(this);try{n(e)}catch(e){c(this,"throw",e)}return g?s(g,this,e):new m(o(this),{mapper:e,inner:null})}})},7588(e,t,i){var a=i(6518),s=i(9565),n=i(2652),r=i(9306),o=i(8551),l=i(1767),d=i(9539),c=i(4549)("forEach",TypeError);a({target:"Iterator",proto:!0,real:!0,forced:c},{forEach:function forEach(e){o(this);try{r(e)}catch(e){d(this,"throw",e)}if(c)return s(c,this,e);var t=l(this),i=0;n(t,function(t){e(t,i++)},{IS_RECORD:!0})}})},1701(e,t,i){var a=i(6518),s=i(9565),n=i(9306),r=i(8551),o=i(1767),l=i(9462),d=i(6319),c=i(9539),h=i(684),u=i(4549),_=i(6395),p=!_&&!h("map",function(){}),g=!_&&!p&&u("map",TypeError),f=_||p||g,m=l(function(){var e=this.iterator,t=r(s(this.next,e));if(!(this.done=!!t.done))return d(e,this.mapper,[t.value,this.counter++],!0)});a({target:"Iterator",proto:!0,real:!0,forced:f},{map:function map(e){r(this);try{n(e)}catch(e){c(this,"throw",e)}return g?s(g,this,e):new m(o(this),{mapper:e})}})},8237(e,t,i){var a=i(6518),s=i(2652),n=i(9306),r=i(8551),o=i(1767),l=i(9539),d=i(4549),c=i(8745),h=i(9039),u=TypeError,_=h(function(){[].keys().reduce(function(){},void 0)}),p=!_&&d("reduce",u);a({target:"Iterator",proto:!0,real:!0,forced:_||p},{reduce:function reduce(e){r(this);try{n(e)}catch(e){l(this,"throw",e)}var t=arguments.length<2,i=t?void 0:arguments[1];if(p)return c(p,this,t?[e]:[e,i]);var a=o(this),d=0;s(a,function(a){if(t){t=!1;i=a}else i=e(i,a,d);d++},{IS_RECORD:!0});if(t)throw new u("Reduce of empty iterator with no initial value");return i}})},3579(e,t,i){var a=i(6518),s=i(9565),n=i(2652),r=i(9306),o=i(8551),l=i(1767),d=i(9539),c=i(4549)("some",TypeError);a({target:"Iterator",proto:!0,real:!0,forced:c},{some:function some(e){o(this);try{r(e)}catch(e){d(this,"throw",e)}if(c)return s(c,this,e);var t=l(this),i=0;return n(t,function(t,a){if(e(t,i++))return a()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},4972(e,t,i){var a=i(6518),s=i(9565),n=i(8551),r=i(1767),o=i(4149),l=i(9590),d=i(9462),c=i(9539),h=i(4549),u=i(6395),_=!u&&h("take",RangeError),p=d(function(){var e=this.iterator;if(!this.remaining--){this.done=!0;return c(e,"normal",void 0)}var t=n(s(this.next,e));if(!(this.done=!!t.done))return t.value});a({target:"Iterator",proto:!0,real:!0,forced:u||_},{take:function take(e){n(this);var t;try{t=l(o(+e))}catch(e){c(this,"throw",e)}return _?s(_,this,t):new p(r(this),{remaining:t})}})},9112(e,t,i){var a=i(6518),s=i(3724),n=i(4576),r=i(7751),o=i(9504),l=i(9565),d=i(4901),c=i(34),h=i(4376),u=i(9297),_=i(655),p=i(6198),g=i(2278),f=i(9039),m=i(8235),v=i(4495),P=n.JSON,w=n.Number,b=n.SyntaxError,y=P&&P.parse,S=r("Object","keys"),C=Object.getOwnPropertyDescriptor,x=o("".charAt),k=o("".slice),E=o(/./.exec),A=o([].push),G=/^\d$/,B=/^[1-9]$/,M=/^[\d-]$/,I=/^[\t\n\r ]$/,internalize=function(e,t,i,a){var s,n,r,o,d,_=e[t],g=a&&_===a.value,f=g&&"string"==typeof a.source?{source:a.source}:{};if(c(_)){var m=h(_),v=g?a.nodes:m?[]:{};if(m){s=v.length;r=p(_);for(o=0;o<r;o++)internalizeProperty(_,o,internalize(_,""+o,i,o<s?v[o]:void 0))}else{n=S(_);r=p(n);for(o=0;o<r;o++){d=n[o];internalizeProperty(_,d,internalize(_,d,i,u(v,d)?v[d]:void 0))}}}return l(i,e,t,_,f)},internalizeProperty=function(e,t,i){if(s){var a=C(e,t);if(a&&!a.configurable)return}void 0===i?delete e[t]:g(e,t,i)},Node=function(e,t,i,a){this.value=e;this.end=t;this.source=i;this.nodes=a},Context=function(e,t){this.source=e;this.index=t};Context.prototype={fork:function(e){return new Context(this.source,e)},parse:function(){var e=this.source,t=this.skip(I,this.index),i=this.fork(t),a=x(e,t);if(E(M,a))return i.number();switch(a){case"{":return i.object();case"[":return i.array();case'"':return i.string();case"t":return i.keyword(!0);case"f":return i.keyword(!1);case"n":return i.keyword(null)}throw new b('Unexpected character: "'+a+'" at: '+t)},node:function(e,t,i,a,s){return new Node(t,a,e?null:k(this.source,i,a),s)},object:function(){for(var e=this.source,t=this.index+1,i=!1,a={},s={};t<e.length;){t=this.until(['"',"}"],t);if("}"===x(e,t)&&!i){t++;break}var n=this.fork(t).string(),r=n.value;t=n.end;t=this.until([":"],t)+1;t=this.skip(I,t);n=this.fork(t).parse();g(s,r,n);g(a,r,n.value);t=this.until([",","}"],n.end);var o=x(e,t);if(","===o){i=!0;t++}else if("}"===o){t++;break}}return this.node(1,a,this.index,t,s)},array:function(){for(var e=this.source,t=this.index+1,i=!1,a=[],s=[];t<e.length;){t=this.skip(I,t);if("]"===x(e,t)&&!i){t++;break}var n=this.fork(t).parse();A(s,n);A(a,n.value);t=this.until([",","]"],n.end);if(","===x(e,t)){i=!0;t++}else if("]"===x(e,t)){t++;break}}return this.node(1,a,this.index,t,s)},string:function(){var e=this.index,t=m(this.source,this.index+1);return this.node(0,t.value,e,t.end)},number:function(){var e=this.source,t=this.index,i=t;"-"===x(e,i)&&i++;if("0"===x(e,i))i++;else{if(!E(B,x(e,i)))throw new b("Failed to parse number at: "+i);i=this.skip(G,i+1)}"."===x(e,i)&&(i=this.skip(G,i+1));if("e"===x(e,i)||"E"===x(e,i)){i++;"+"!==x(e,i)&&"-"!==x(e,i)||i++;if(i===(i=this.skip(G,i)))throw new b("Failed to parse number's exponent value at: "+i)}return this.node(0,w(k(e,t,i)),t,i)},keyword:function(e){var t=""+e,i=this.index,a=i+t.length;if(k(this.source,i,a)!==t)throw new b("Failed to parse value at: "+i);return this.node(0,e,i,a)},skip:function(e,t){for(var i=this.source;t<i.length&&E(e,x(i,t));t++);return t},until:function(e,t){t=this.skip(I,t);for(var i=x(this.source,t),a=0;a<e.length;a++)if(e[a]===i)return t;throw new b('Unexpected character: "'+i+'" at: '+t)}};var T=f(function(){var e,t="9007199254740993";y(t,function(t,i,a){e=a.source});return e!==t}),D=v&&!f(function(){return 1/y("-0 \t")!=-1/0});a({target:"JSON",stat:!0,forced:T},{parse:function parse(e,t){return D&&!d(t)?y(e):function(e,t){e=_(e);var i=new Context(e,0,""),a=i.parse(),s=a.value,n=i.skip(I,a.end);if(n<e.length)throw new b('Unexpected extra character: "'+x(e,n)+'" after the parsed data at: '+n);return d(t)?internalize({"":s},"",t,a):s}(e,t)}})},3110(e,t,i){var a=i(6518),s=i(7751),n=i(8745),r=i(9565),o=i(9504),l=i(9039),d=i(4376),c=i(4901),h=i(5810),u=i(757),_=i(2195),p=i(655),g=i(7680),f=i(8235),m=i(3392),v=i(4495),P=i(7819),w=String,b=s("JSON","stringify"),y=o(/./.exec),S=o("".charAt),C=o("".charCodeAt),x=o("".replace),k=o("".slice),E=o([].push),A=o(1.1.toString),G=/[\uD800-\uDFFF]/g,B=/^[\uD800-\uDBFF]$/,M=/^[\uDC00-\uDFFF]$/,I=m(),T=I.length,D=!v||l(function(){var e=s("Symbol")("stringify detection");return"[null]"!==b([e])||"{}"!==b({a:e})||"{}"!==b(Object(e))}),L=l(function(){return'"\\udf06\\ud834"'!==b("\udf06\ud834")||'"\\udead"'!==b("\udead")}),R=D?function(e,t){var i=g(arguments),a=getReplacerFunction(t);if(c(a)||void 0!==e&&!u(e)){i[1]=function(e,t){c(a)&&(t=r(a,this,w(e),t));if(!u(t))return t};return n(b,null,i)}}:b,fixIllFormedJSON=function(e,t,i){var a=S(i,t-1),s=S(i,t+1);return y(B,e)&&!y(M,s)||y(M,e)&&!y(B,a)?"\\u"+A(C(e,0),16):e},getReplacerFunction=function(e){if(c(e))return e;if(d(e)){for(var t=e.length,i=[],a=0;a<t;a++){var s=e[a];"string"==typeof s?E(i,s):"number"!=typeof s&&"Number"!==_(s)&&"String"!==_(s)||E(i,p(s))}var n=i.length,r=!0;return function(e,t){if(r){r=!1;return t}if(d(this))return t;for(var a=0;a<n;a++)if(i[a]===e)return t}}};b&&a({target:"JSON",stat:!0,arity:3,forced:D||L||!P},{stringify:function stringify(e,t,i){var a=getReplacerFunction(t),s=[],n=R(e,function(e,t){var i=c(a)?r(a,this,w(e),t):t;return!P&&h(i)?I+(E(s,i.rawJSON)-1):i},i);if("string"!=typeof n)return n;L&&(n=x(n,G,fixIllFormedJSON));if(P)return n;for(var o="",l=n.length,d=0;d<l;d++){var u=S(n,d);if('"'===u){var _=f(n,++d).end-1,p=k(n,d,_);o+=k(p,0,T)===I?s[k(p,T)]:'"'+p+'"';d=_}else o+=u}return o}})},2731(e,t,i){var a=i(6518),s=i(9306),n=i(6194),r=i(2248),o=i(6395),l=r.get,d=r.has,c=r.set;a({target:"Map",proto:!0,real:!0,forced:o},{getOrInsertComputed:function getOrInsertComputed(e,t){n(this);s(t);if(d(this,e))return l(this,e);0===e&&1/e==-1/0&&(e=0);var i=t(e);c(this,e,i);return i}})},5367(e,t,i){var a=i(6518),s=i(6194),n=i(2248),r=i(6395),o=n.get,l=n.has,d=n.set;a({target:"Map",proto:!0,real:!0,forced:r},{getOrInsert:function getOrInsert(e,t){if(l(s(this),e))return o(this,e);d(this,e,t);return t}})},3068(e,t,i){var a=i(6518),s=i(9504),n=i(2652),r=RangeError,o=TypeError,l=1/0,d=Math.abs,c=Math.pow,h=s([].push),u=c(2,1023),_=c(2,53)-1,p=Number.MAX_VALUE,g=c(2,971),f={},m={},v={},P={},w={},twosum=function(e,t){var i=e+t;return{hi:i,lo:t-(i-e)}};a({target:"Math",stat:!0},{sumPrecise:function sumPrecise(e){var t=[],i=0,a=P;n(e,function(e){if(++i>=_)throw new r("Maximum allowed index exceeded");if("number"!=typeof e)throw new o("Value is not a number");if(a!==f)if(e!=e)a=f;else if(e===l)a=a===m?f:v;else if(e===-1/0)a=a===v?f:m;else if(!(0===e&&1/e!==l||a!==P&&a!==w)){a=w;h(t,e)}});switch(a){case f:return NaN;case m:return-1/0;case v:return l;case P:return-0}for(var s,c,b,y,S,C,x=[],k=0,E=0;E<t.length;E++){s=t[E];for(var A=0,G=0;G<x.length;G++){c=x[G];if(d(s)<d(c)){C=s;s=c;c=C}y=(b=twosum(s,c)).hi;S=b.lo;if(d(y)===l){var B=y===l?1:-1;k+=B;if(d(s=s-B*u-B*u)<d(c)){C=s;s=c;c=C}y=(b=twosum(s,c)).hi;S=b.lo}0!==S&&(x[A++]=S);s=y}x.length=A;0!==s&&h(x,s)}var M=x.length-1;y=0;S=0;if(0!==k){var I=M>=0?x[M]:0;M--;if(d(k)>1||k>0&&I>0||k<0&&I<0)return k>0?l:-1/0;y=(b=twosum(k*u,I/2)).hi;S=b.lo;S*=2;if(d(2*y)===l)return y>0?y===u&&S===-g/2&&M>=0&&x[M]<0?p:l:y===-u&&S===g/2&&M>=0&&x[M]>0?-p:-1/0;if(0!==S){x[++M]=S;S=0}y*=2}for(;M>=0;){y=(b=twosum(y,x[M--])).hi;if(0!==(S=b.lo))break}M>=0&&(S<0&&x[M]<0||S>0&&x[M]>0)&&(c=2*S)===(s=y+c)-y&&(y=s);return y}})},1689(e,t,i){var a=i(6518),s=i(4576),n=i(8745),r=i(7680),o=i(6043),l=i(9306),d=i(1103),c=s.Promise,h=!1;a({target:"Promise",stat:!0,forced:!c||!c.try||d(function(){c.try(function(e){h=8===e},8)}).error||!h},{try:function(e){var t=arguments.length>1?r(arguments,1):[],i=o.f(this),a=d(function(){return n(l(e),void 0,t)});(a.error?i.reject:i.resolve)(a.value);return i.promise}})},4628(e,t,i){var a=i(6518),s=i(6043);a({target:"Promise",stat:!0},{withResolvers:function withResolvers(){var e=s.f(this);return{promise:e.promise,resolve:e.resolve,reject:e.reject}}})},6069(e,t,i){var a=i(6518),s=i(9504),n=i(3463),r=i(9297),o=i(533).start,l=i(7452),d=Array,c=RegExp.escape,h=s("".charAt),u=s("".charCodeAt),_=s(1.1.toString),p=s([].join),g=/^[0-9a-z]/i,f=/^[$()*+./?[\\\]^{|}]/,m=RegExp("^[!\"#%&',\\-:;<=>@`~"+l+"]"),v=s(g.exec),P={"\t":"t","\n":"n","\v":"v","\f":"f","\r":"r"},escapeChar=function(e){var t=_(u(e,0),16);return t.length<3?"\\x"+o(t,2,"0"):"\\u"+o(t,4,"0")};a({target:"RegExp",stat:!0,forced:!c||"\\x61b"!==c("ab")},{escape:function escape(e){n(e);for(var t=e.length,i=d(t),a=0;a<t;a++){var s=h(e,a);if(0===a&&v(g,s))i[a]=escapeChar(s);else if(r(P,s))i[a]="\\"+P[s];else if(v(f,s))i[a]="\\"+s;else if(v(m,s))i[a]=escapeChar(s);else{var o=u(s,0);if(55296!=(63488&o))i[a]=s;else if(o>=56320||a+1>=t||56320!=(64512&u(e,a+1)))i[a]=escapeChar(s);else{i[a]=s;i[++a]=h(e,a)}}}return p(i,"")}})},7642(e,t,i){var a=i(6518),s=i(3440),n=i(9039);a({target:"Set",proto:!0,real:!0,forced:!i(4916)("difference",function(e){return 0===e.size})||n(function(){var e={size:1,has:function(){return!0},keys:function(){var e=0;return{next:function(){var i=e++>1;t.has(1)&&t.clear();return{done:i,value:2}}}}},t=new Set([1,2,3,4]);return 3!==t.difference(e).size})},{difference:s})},8004(e,t,i){var a=i(6518),s=i(9039),n=i(8750);a({target:"Set",proto:!0,real:!0,forced:!i(4916)("intersection",function(e){return 2===e.size&&e.has(1)&&e.has(2)})||s(function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))})},{intersection:n})},3853(e,t,i){var a=i(6518),s=i(4449);a({target:"Set",proto:!0,real:!0,forced:!i(4916)("isDisjointFrom",function(e){return!e})},{isDisjointFrom:s})},5876(e,t,i){var a=i(6518),s=i(3838);a({target:"Set",proto:!0,real:!0,forced:!i(4916)("isSubsetOf",function(e){return e})},{isSubsetOf:s})},2475(e,t,i){var a=i(6518),s=i(8527);a({target:"Set",proto:!0,real:!0,forced:!i(4916)("isSupersetOf",function(e){return!e})},{isSupersetOf:s})},5024(e,t,i){var a=i(6518),s=i(3650),n=i(9835);a({target:"Set",proto:!0,real:!0,forced:!i(4916)("symmetricDifference")||!n("symmetricDifference")},{symmetricDifference:s})},1698(e,t,i){var a=i(6518),s=i(4204),n=i(9835);a({target:"Set",proto:!0,real:!0,forced:!i(4916)("union")||!n("union")},{union:s})},7357(e,t,i){var a=i(6518),s=i(9504),n=i(7750),r=i(1291),o=i(655),l=i(9039),d=s("".charAt);a({target:"String",proto:!0,forced:l(function(){return"\ud842"!=="𠮷".at(-2)})},{at:function at(e){var t=o(n(this)),i=t.length,a=r(e),s=a>=0?a:i+a;return s<0||s>=i?void 0:d(t,s)}})},8140(e,t,i){var a=i(4644),s=i(6198),n=i(1291),r=a.aTypedArray;(0,a.exportTypedArrayMethod)("at",function at(e){var t=r(this),i=s(t),a=n(e),o=a>=0?a:i+a;return o<0||o>=i?void 0:t[o]})},5044(e,t,i){var a=i(4644),s=i(4373),n=i(5854),r=i(6955),o=i(9565),l=i(9504),d=i(9039),c=a.aTypedArray,h=a.exportTypedArrayMethod,u=l("".slice);h("fill",function fill(e){var t=arguments.length;c(this);var i="Big"===u(r(this),0,3)?n(e):+e;return o(s,this,i,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)},d(function(){var e=0;new Int8Array(2).fill({valueOf:function(){return e++}});return 1!==e}))},1134(e,t,i){var a=i(4644),s=i(3839).findLastIndex,n=a.aTypedArray;(0,a.exportTypedArrayMethod)("findLastIndex",function findLastIndex(e){return s(n(this),e,arguments.length>1?arguments[1]:void 0)})},1903(e,t,i){var a=i(4644),s=i(3839).findLast,n=a.aTypedArray;(0,a.exportTypedArrayMethod)("findLast",function findLast(e){return s(n(this),e,arguments.length>1?arguments[1]:void 0)})},8845(e,t,i){var a=i(4576),s=i(9565),n=i(4644),r=i(6198),o=i(8229),l=i(8981),d=i(9039),c=a.RangeError,h=a.Int8Array,u=h&&h.prototype,_=u&&u.set,p=n.aTypedArray,g=n.exportTypedArrayMethod,f=!d(function(){var e=new Uint8ClampedArray(2);s(_,e,{length:1,0:3},1);return 3!==e[1]}),m=f&&n.NATIVE_ARRAY_BUFFER_VIEWS&&d(function(){var e=new h(2);e.set(1);e.set("2",1);return 0!==e[0]||2!==e[1]});g("set",function set(e){p(this);var t=o(arguments.length>1?arguments[1]:void 0,1),i=l(e);if(f)return s(_,this,i,t);var a=this.length,n=r(i),d=0;if(n+t>a)throw new c("Wrong length");for(;d<n;)this[t+d]=i[d++]},!f||m)},373(e,t,i){var a=i(4576),s=i(7476),n=i(9039),r=i(9306),o=i(4488),l=i(4644),d=i(3709),c=i(3763),h=i(9519),u=i(3607),_=l.aTypedArray,p=l.exportTypedArrayMethod,g=a.Uint16Array,f=g&&s(g.prototype.sort),m=!(!f||n(function(){f(new g(2),null)})&&n(function(){f(new g(2),{})})),v=!!f&&!n(function(){if(h)return h<74;if(d)return d<67;if(c)return!0;if(u)return u<602;var e,t,i=new g(516),a=Array(516);for(e=0;e<516;e++){t=e%4;i[e]=515-e;a[e]=e-2*t+3}f(i,function(e,t){return(e/4|0)-(t/4|0)});for(e=0;e<516;e++)if(i[e]!==a[e])return!0});p("sort",function sort(e){void 0!==e&&r(e);return v?f(this,e):o(_(this),function(e){return function(t,i){return void 0!==e?+e(t,i)||0:i!=i?-1:t!=t?1:0===t&&0===i?1/t>0&&1/i<0?1:-1:t>i}}(e))},!v||m)},7467(e,t,i){var a=i(6198),s=i(4644),n=s.aTypedArray,r=s.exportTypedArrayMethod,o=s.getTypedArrayConstructor;r("toReversed",function toReversed(){for(var e=n(this),t=a(e),i=new(o(e))(t),s=0;s<t;s++)i[s]=e[t-s-1];return i})},4732(e,t,i){var a=i(4644),s=i(9504),n=i(9306),r=i(5370),o=a.aTypedArray,l=a.getTypedArrayConstructor,d=a.exportTypedArrayMethod,c=s(a.TypedArrayPrototype.sort);d("toSorted",function toSorted(e){void 0!==e&&n(e);var t=o(this),i=r(l(t),t);return c(i,e)})},9577(e,t,i){var a=i(4644),s=i(1108),n=i(6198),r=i(1291),o=i(5854),l=a.aTypedArray,d=a.getTypedArrayConstructor,c=a.exportTypedArrayMethod,h=RangeError,u=function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(e){return 8===e}}(),_=u&&function(){try{new Int8Array(1).with(-.5,1)}catch(e){return!0}}();c("with",{with:function(e,t){var i=l(this),a=n(i),c=r(e),u=c<0?a+c:c,_=s(i)?o(t):+t;if(u>=a||u<0)throw new h("Incorrect index");for(var p=new(d(i))(a),g=0;g<a;g++)p[g]=g===u?_:i[g];return p}}.with,!u||_)},5213(e,t,i){var a=i(6518),s=i(4576),n=i(5370),r=i(9143),o=s.Uint8Array,l=!o||!o.fromBase64||!function(){try{o.fromBase64("a");return}catch(e){}try{o.fromBase64("",null)}catch(e){return!0}}();o&&a({target:"Uint8Array",stat:!0,forced:l},{fromBase64:function fromBase64(e){var t=r(e,arguments.length>1?arguments[1]:void 0,null,9007199254740991);return n(o,t.bytes)}})},6632(e,t,i){var a=i(6518),s=i(4576),n=i(9143),r=i(4154),o=s.Uint8Array,l=!o||!o.prototype.setFromBase64||!function(){var e=new o([255,255,255,255,255]);try{e.setFromBase64("",null);return}catch(e){}try{e.setFromBase64("a");return}catch(e){}try{e.setFromBase64("MjYyZg===")}catch(t){return 50===e[0]&&54===e[1]&&50===e[2]&&255===e[3]&&255===e[4]}}();o&&a({target:"Uint8Array",proto:!0,forced:l},{setFromBase64:function setFromBase64(e){r(this);var t=n(e,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:t.read,written:t.written}}})},4226(e,t,i){var a=i(6518),s=i(4576),n=i(3463),r=i(4154),o=i(5169),l=i(2303);s.Uint8Array&&a({target:"Uint8Array",proto:!0,forced:function throwsOnLengthTrackingView(){try{var e=new ArrayBuffer(16,{maxByteLength:1024});new Uint8Array(e).setFromHex("cafed00d")}catch(e){return!0}}()},{setFromHex:function setFromHex(e){r(this);n(e);o(this.buffer);var t=l(e,this).read;return{read:t,written:t/2}}})},9486(e,t,i){var a=i(6518),s=i(4576),n=i(9504),r=i(3972),o=i(4154),l=i(5169),d=i(2804),c=i(944),h=d.i2c,u=d.i2cUrl,_=n("".charAt),p=s.Uint8Array,g=!p||!p.prototype.toBase64||!function(){try{(new p).toBase64(null)}catch(e){return!0}}();p&&a({target:"Uint8Array",proto:!0,forced:g},{toBase64:function toBase64(){var e=o(this),t=arguments.length?r(arguments[0]):void 0,i="base64"===c(t)?h:u,a=!!t&&!!t.omitPadding;l(this.buffer);for(var s,n="",d=0,p=e.length,at=function(e){return _(i,s>>6*e&63)};d+2<p;d+=3){s=(e[d]<<16)+(e[d+1]<<8)+e[d+2];n+=at(3)+at(2)+at(1)+at(0)}if(d+2===p){s=(e[d]<<16)+(e[d+1]<<8);n+=at(3)+at(2)+at(1)+(a?"":"=")}else if(d+1===p){s=e[d]<<16;n+=at(3)+at(2)+(a?"":"==")}return n}})},456(e,t,i){var a=i(6518),s=i(4576),n=i(9504),r=i(4154),o=i(5169),l=n(1.1.toString),d=s.Uint8Array,c=!d||!d.prototype.toHex||!function(){try{return"ffffffffffffffff"===new d([255,255,255,255,255,255,255,255]).toHex()}catch(e){return!1}}();d&&a({target:"Uint8Array",proto:!0,forced:c},{toHex:function toHex(){r(this);o(this.buffer);for(var e="",t=0,i=this.length;t<i;t++){var a=l(this[t],16);e+=1===a.length?"0"+a:a}return e}})},9452(e,t,i){var a=i(6518),s=i(9306),n=i(6557),r=i(4328),o=i(4995),l=i(6395),d=o.get,c=o.has,h=o.set;a({target:"WeakMap",proto:!0,real:!0,forced:l||!function(){try{WeakMap.prototype.getOrInsertComputed&&(new WeakMap).getOrInsertComputed(1,function(){throw 1})}catch(e){return e instanceof TypeError}}()},{getOrInsertComputed:function getOrInsertComputed(e,t){n(this);r(e);s(t);if(c(this,e))return d(this,e);var i=t(e);h(this,e,i);return i}})},8454(e,t,i){var a=i(6518),s=i(6557),n=i(4995),r=i(6395),o=n.get,l=n.has,d=n.set;a({target:"WeakMap",proto:!0,real:!0,forced:r},{getOrInsert:function getOrInsert(e,t){if(l(s(this),e))return o(this,e);d(this,e,t);return t}})},4979(e,t,i){var a=i(6518),s=i(4576),n=i(7751),r=i(6980),o=i(4913).f,l=i(9297),d=i(679),c=i(3167),h=i(2603),u=i(5002),_=i(6193),p=i(3724),g=i(6395),f="DOMException",m=n("Error"),v=n(f),P=function DOMException(){d(this,w);var e=arguments.length,t=h(e<1?void 0:arguments[0]),i=h(e<2?void 0:arguments[1],"Error"),a=new v(t,i),s=new m(t);s.name=f;o(a,"stack",r(1,_(s.stack,1)));c(a,this,P);return a},w=P.prototype=v.prototype,b="stack"in new m(f),y="stack"in new v(1,2),S=v&&p&&Object.getOwnPropertyDescriptor(s,f),C=!(!S||S.writable&&S.configurable),x=b&&!C&&!y;a({global:!0,constructor:!0,forced:g||x},{DOMException:x?P:v});var k=n(f),E=k.prototype;if(E.constructor!==k){g||o(E,"constructor",r(1,k));for(var A in u)if(l(u,A)){var G=u[A],B=G.s;l(k,B)||o(k,B,r(6,G.c))}}},3611(e,t,i){var a=i(6518),s=i(4576),n=i(2106),r=i(3724),o=TypeError,l=Object.defineProperty,d=s.self!==s;try{if(r){var c=Object.getOwnPropertyDescriptor(s,"self");!d&&c&&c.get&&c.enumerable||n(s,"self",{get:function self(){return s},set:function self(e){if(this!==s)throw new o("Illegal invocation");l(s,"self",{value:e,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}else a({global:!0,simple:!0,forced:d},{self:s})}catch(e){}},4603(e,t,i){var a=i(6840),s=i(9504),n=i(655),r=i(2812),o=URLSearchParams,l=o.prototype,d=s(l.append),c=s(l.delete),h=s(l.forEach),u=s([].push),_=new o("a=1&a=2&b=3");_.delete("a",1);_.delete("b",void 0);_+""!="a=2"&&a(l,"delete",function(e){var t=arguments.length,i=t<2?void 0:arguments[1];if(t&&void 0===i)return c(this,e);var a=[];h(this,function(e,t){u(a,{key:t,value:e})});r(t,1);for(var s,o=n(e),l=n(i),_=0,p=0,g=!1,f=a.length;_<f;){s=a[_++];if(g||s.key===o){g=!0;c(this,s.key)}else p++}for(;p<f;)(s=a[p++]).key===o&&s.value===l||d(this,s.key,s.value)},{enumerable:!0,unsafe:!0})},7566(e,t,i){var a=i(6840),s=i(9504),n=i(655),r=i(2812),o=URLSearchParams,l=o.prototype,d=s(l.getAll),c=s(l.has),h=new o("a=1");!h.has("a",2)&&h.has("a",void 0)||a(l,"has",function has(e){var t=arguments.length,i=t<2?void 0:arguments[1];if(t&&void 0===i)return c(this,e);var a=d(this,e);r(t,1);for(var s=n(i),o=0;o<a.length;)if(a[o++]===s)return!0;return!1},{enumerable:!0,unsafe:!0})},8721(e,t,i){var a=i(3724),s=i(9504),n=i(2106),r=URLSearchParams.prototype,o=s(r.forEach);a&&!("size"in r)&&n(r,"size",{get:function size(){var e=0;o(this,function(){e++});return e},configurable:!0,enumerable:!0})},5781(e,t,i){var a=i(6518),s=i(7751),n=i(2812),r=i(655),o=i(7416),l=s("URL");a({target:"URL",stat:!0,forced:!o},{parse:function parse(e){var t=n(arguments.length,1),i=r(e),a=t<2||void 0===arguments[1]?void 0:r(arguments[1]);try{return new l(i,a)}catch(e){return null}}})}},t={};function __webpack_require__(i){var a=t[i];if(void 0!==a)return a.exports;var s=t[i]={exports:{}};e[i].call(s.exports,s,s.exports,__webpack_require__);return s.exports}__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})};__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var i;__webpack_require__(6280),__webpack_require__(4114),__webpack_require__(6573),__webpack_require__(8100),__webpack_require__(7936),__webpack_require__(8111),__webpack_require__(8237),__webpack_require__(5367),__webpack_require__(2731),__webpack_require__(3068),__webpack_require__(8140),__webpack_require__(5044),__webpack_require__(1903),__webpack_require__(1134),__webpack_require__(8845),__webpack_require__(373),__webpack_require__(7467),__webpack_require__(4732),__webpack_require__(9577),__webpack_require__(6632),__webpack_require__(4226),__webpack_require__(9486),__webpack_require__(456),__webpack_require__(3611),__webpack_require__(5781);class ngx_console_NgxConsole{static log(e,t){ngx_console_NgxConsole.ngxConsoleFilter("log",e)&&(void 0!==t?console.log("%s",e,t):console.log(e))}static error(e,t){ngx_console_NgxConsole.ngxConsoleFilter("error",e)&&(void 0!==t?console.error("%s",e,t):console.error(e))}static warn(e,t){ngx_console_NgxConsole.ngxConsoleFilter("warn",e)&&(void 0!==t?console.warn("%s",e,t):console.warn(e))}static debug(e,t){ngx_console_NgxConsole.ngxConsoleFilter("debug",e)&&(void 0!==t?console.warn("%s",e,t):console.warn(e))}get ngxConsoleFilter(){return ngx_console_NgxConsole.ngxConsoleFilter}set ngxConsoleFilter(e){ngx_console_NgxConsole.ngxConsoleFilter=e}reset(){ngx_console_NgxConsole.ngxConsoleFilter=(e,t)=>!0}}!function _defineProperty(e,t,i){return(t=function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}(ngx_console_NgxConsole,"ngxConsoleFilter",(e,t)=>!0);function _assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const a=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),s=[.001,0,0,.001,0,0],n=1.35,r=1,o=2,l=4,d=16,c=32,h=64,u=128,_=256,p={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},g="pdfjs_internal_editor_",f={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},m={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},v={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},P=1,w=2,b=0,y=1,S=2,C=3,x=3,k=4,E={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},A={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},G=1,B=2,M=3,I=4,T=5,D={ERRORS:0,WARNINGS:1,INFOS:5},L={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},R=0,N=1,O=2,W=3,j=4,V={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let U=D.WARNINGS;function setVerbosityLevel(e){Number.isInteger(e)&&(U=e)}function getVerbosityLevel(){return U}function info(e){U>=D.INFOS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope||Window&&ngx_console_NgxConsole?ngx_console_NgxConsole.log(`Info: ${e}`):console.log(`Info: ${e}`))}function warn(e){U>=D.WARNINGS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope||Window&&ngx_console_NgxConsole?ngx_console_NgxConsole.log(`Warning: ${e}`):console.log(`Warning: ${e}`))}function unreachable(e){throw new Error(e)}function assert(e,t){e||unreachable(t)}function createValidAbsoluteUrl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e)return null;if(i&&"string"==typeof e){if(i.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t?.length>=2&&(e=`http://${e}`)}if(i.tryConvertEncoding)try{e=function stringToUTF8String(e){return decodeURIComponent(escape(e))}(e)}catch{}}const a=t?URL.parse(e,t):URL.parse(e);return function _isValidProtocol(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":case"capacitor":return!0;default:return!1}}(a)?a:null}function updateUrlHash(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=URL.parse(e);if(a){a.hash=t;return a.href}return i&&createValidAbsoluteUrl(e,"http://example.com")?e.split("#",1)[0]+""+(t?`#${t}`:""):""}function stripPath(e){return e.substring(e.lastIndexOf("/")+1)}function shadow(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Object.defineProperty(e,t,{value:i,enumerable:!a,configurable:!0,writable:!1});return i}const z=function BaseExceptionClosure(){function BaseException(e,t){this.message=e;this.name=t}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();class PasswordException extends z{constructor(e,t){super(e,"PasswordException");this.code=t}}class UnknownErrorException extends z{constructor(e,t){super(e,"UnknownErrorException");this.details=t}}class InvalidPDFException extends z{constructor(e){super(e,"InvalidPDFException")}}class ResponseException extends z{constructor(e,t,i){super(e,"ResponseException");this.status=t;this.missing=i}}class FormatError extends z{constructor(e){super(e,"FormatError")}}class AbortException extends z{constructor(e){super(e,"AbortException")}}function stringToBytes(e){"string"!=typeof e&&unreachable("Invalid argument for stringToBytes");const t=e.length,i=new Uint8Array(t);for(let a=0;a<t;++a)i[a]=255&e.charCodeAt(a);return i}class FeatureTest{static get isLittleEndian(){return shadow(this,"isLittleEndian",function isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return shadow(this,"isEvalSupported",function isEvalSupported(){try{new Function("");return!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get isImageDecoderSupported(){return shadow(this,"isImageDecoderSupported","undefined"!=typeof ImageDecoder)}static get isFloat16ArraySupported(){return shadow(this,"isFloat16ArraySupported","undefined"!=typeof Float16Array)}static get isSanitizerSupported(){return shadow(this,"isSanitizerSupported","undefined"!=typeof Sanitizer)}static get platform(){const{platform:e,userAgent:t}=navigator;return shadow(this,"platform",{isAndroid:t.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:t.includes("Firefox")})}static get isCSSRoundSupported(){return shadow(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const H=Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,"0"));class Util{static makeHexColor(e,t,i){return`#${H[e]}${H[t]}${H[i]}`}static domMatrixToTransform(e){return[e.a,e.b,e.c,e.d,e.e,e.f]}static scaleMinMax(e,t){let i;if(e[0]){if(e[0]<0){i=t[0];t[0]=t[2];t[2]=i}t[0]*=e[0];t[2]*=e[0];if(e[3]<0){i=t[1];t[1]=t[3];t[3]=i}t[1]*=e[3];t[3]*=e[3]}else{i=t[0];t[0]=t[1];t[1]=i;i=t[2];t[2]=t[3];t[3]=i;if(e[1]<0){i=t[1];t[1]=t[3];t[3]=i}t[1]*=e[1];t[3]*=e[1];if(e[2]<0){i=t[0];t[0]=t[2];t[2]=i}t[0]*=e[2];t[2]*=e[2]}t[0]+=e[4];t[1]+=e[5];t[2]+=e[4];t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static multiplyByDOMMatrix(e,t){return[e[0]*t.a+e[2]*t.b,e[1]*t.a+e[3]*t.b,e[0]*t.c+e[2]*t.d,e[1]*t.c+e[3]*t.d,e[0]*t.e+e[2]*t.f+e[4],e[1]*t.e+e[3]*t.f+e[5]]}static applyTransform(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const a=e[i],s=e[i+1];e[i]=a*t[0]+s*t[2]+t[4];e[i+1]=a*t[1]+s*t[3]+t[5]}static applyTransformToBezier(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const a=t[0],s=t[1],n=t[2],r=t[3],o=t[4],l=t[5];for(let t=0;t<6;t+=2){const d=e[i+t],c=e[i+t+1];e[i+t]=d*a+c*n+o;e[i+t+1]=d*s+c*r+l}}static applyInverseTransform(e,t){const i=e[0],a=e[1],s=t[0]*t[3]-t[1]*t[2];e[0]=(i*t[3]-a*t[2]+t[2]*t[5]-t[4]*t[3])/s;e[1]=(-i*t[1]+a*t[0]+t[4]*t[1]-t[5]*t[0])/s}static axialAlignedBoundingBox(e,t,i){const a=t[0],s=t[1],n=t[2],r=t[3],o=t[4],l=t[5],d=e[0],c=e[1],h=e[2],u=e[3];let _=a*d+o,p=_,g=a*h+o,f=g,m=r*c+l,v=m,P=r*u+l,w=P;if(0!==s||0!==n){const e=s*d,t=s*h,i=n*c,a=n*u;_+=i;f+=i;g+=a;p+=a;m+=e;w+=e;P+=t;v+=t}i[0]=Math.min(i[0],_,g,p,f);i[1]=Math.min(i[1],m,P,v,w);i[2]=Math.max(i[2],_,g,p,f);i[3]=Math.max(i[3],m,P,v,w)}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){const i=e[0],a=e[1],s=e[2],n=e[3],r=i**2+a**2,o=i*s+a*n,l=s**2+n**2,d=(r+l)/2,c=Math.sqrt(d**2-(r*l-o**2));t[0]=Math.sqrt(d+c||1);t[1]=Math.sqrt(d-c||1)}static normalizeRect(e){const t=e.slice(0);if(e[0]>e[2]){t[0]=e[2];t[2]=e[0]}if(e[1]>e[3]){t[1]=e[3];t[3]=e[1]}return t}static intersect(e,t){const i=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),a=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(i>a)return null;const s=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),n=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return s>n?null:[i,s,a,n]}static pointBoundingBox(e,t,i){i[0]=Math.min(i[0],e);i[1]=Math.min(i[1],t);i[2]=Math.max(i[2],e);i[3]=Math.max(i[3],t)}static rectBoundingBox(e,t,i,a,s){s[0]=Math.min(s[0],e,i);s[1]=Math.min(s[1],t,a);s[2]=Math.max(s[2],e,i);s[3]=Math.max(s[3],t,a)}static bezierBoundingBox(e,t,i,a,s,n,r,o,l){l[0]=Math.min(l[0],e,r);l[1]=Math.min(l[1],t,o);l[2]=Math.max(l[2],e,r);l[3]=Math.max(l[3],t,o);_assertClassBrand(Util,this,_getExtremum).call(this,e,i,s,r,t,a,n,o,3*(3*(i-s)-e+r),6*(e-2*i+s),3*(i-e),l);_assertClassBrand(Util,this,_getExtremum).call(this,e,i,s,r,t,a,n,o,3*(3*(a-n)-t+o),6*(t-2*a+n),3*(a-t),l)}}i=Util;function _getExtremumOnCurve(e,t,i,a,s,n,r,o,l,d){if(l<=0||l>=1)return;const c=1-l,h=l*l,u=h*l,_=c*(c*(c*e+3*l*t)+3*h*i)+u*a,p=c*(c*(c*s+3*l*n)+3*h*r)+u*o;d[0]=Math.min(d[0],_);d[1]=Math.min(d[1],p);d[2]=Math.max(d[2],_);d[3]=Math.max(d[3],p)}function _getExtremum(e,t,a,s,n,r,o,l,d,c,h,u){if(Math.abs(d)<1e-12){Math.abs(c)>=1e-12&&_assertClassBrand(i,this,_getExtremumOnCurve).call(this,e,t,a,s,n,r,o,l,-h/c,u);return}const _=c**2-4*h*d;if(_<0)return;const p=Math.sqrt(_),g=2*d;_assertClassBrand(i,this,_getExtremumOnCurve).call(this,e,t,a,s,n,r,o,l,(-c+p)/g,u);_assertClassBrand(i,this,_getExtremumOnCurve).call(this,e,t,a,s,n,r,o,l,(-c-p)/g,u)}let $=null,q=null;function normalizeUnicode(e){if(!$){$=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu;q=new Map([["ſt","ſt"]])}return e.replaceAll($,(e,t,i)=>t?t.normalize("NFKC"):q.get(i))}function getUuid(){if("function"==typeof crypto.randomUUID)return crypto.randomUUID();const e=new Uint8Array(32);crypto.getRandomValues(e);return function bytesToString(e){"object"==typeof e&&void 0!==e?.length||unreachable("Invalid argument for bytesToString");const t=e.length,i=8192;if(t<i)return String.fromCharCode.apply(null,e);const a=[];for(let s=0;s<t;s+=i){const n=Math.min(s+i,t),r=e.subarray(s,n);a.push(String.fromCharCode.apply(null,r))}return a.join("")}(e)}const X="pdfjs_internal_id_";const makeArr=()=>[],makeMap=()=>new Map,makeObj=()=>Object.create(null);function MathClamp(e,t,i){return Math.min(Math.max(e,t),i)}"function"!=typeof Math.sumPrecise&&(Math.sumPrecise=function(e){return e.reduce((e,t)=>e+t,0)});var K;__webpack_require__(838),__webpack_require__(1701),__webpack_require__(8454),__webpack_require__(9452),__webpack_require__(4603),__webpack_require__(7566),__webpack_require__(8721),__webpack_require__(8107);class XfaText{static textContent(e){const t=[],i={items:t,styles:Object.create(null)};!function walk(e){if(!e)return;let i=null;const a=e.name;if("#text"===a)i=e.value;else{if(!XfaText.shouldBuildText(a))return;e?.attributes?.textContent?i=e.attributes.textContent:e.value&&(i=e.value)}null!==i&&t.push({str:i});if(e.children)for(const t of e.children)walk(t)}(e);return i}static shouldBuildText(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}class XfaLayer{static setupStorage(e,t,i,a,s){const n=window.getFormValueFromAngular(e);n.value&&a.setValue(t,n);const r=a.getValue(t,{value:null}),o=n.value?n:r;window.registerXFAField(e,o,r);e.addEventListener("updateFromAngular",e=>a.setValue(t,{value:e.detail}));switch(i.name){case"textarea":null!==o.value&&(e.textContent=o.value);if("print"===s)break;e.addEventListener("input",i=>{window.updateAngularFormValue(e,{value:i.target.value});a.setValue(t,{value:i.target.value})});break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){o.value===i.attributes.xfaOn?e.setAttribute("checked",!0):e.removeAttribute("checked");if("print"===s)break;e.addEventListener("change",i=>{window.updateAngularFormValue(e,{value:i.target.checked?i.target.getAttribute("xfaOn"):i.target.getAttribute("xfaOff")});a.setValue(t,{value:i.target.checked?i.target.getAttribute("xfaOn"):i.target.getAttribute("xfaOff")})})}else{null!==o.value&&e.setAttribute("value",o.value);if("print"===s)break;e.addEventListener("input",i=>{window.updateAngularFormValue(e,{value:i.target.value});a.setValue(t,{value:i.target.value})})}break;case"select":if(null!==o.value){e.setAttribute("value",o.value);for(const e of i.children)e.attributes.value===o.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected}e.addEventListener("input",i=>{const s=i.target.options,n=-1===s.selectedIndex?"":s[s.selectedIndex].value;window.updateAngularFormValue(e,{value:n});a.setValue(t,{value:n})})}}static setAttributes(e){let{html:t,element:i,storage:a=null,intent:s,linkService:n}=e;const{attributes:r}=i,o=t instanceof HTMLAnchorElement;"radio"===r.type&&(r.name=`${r.name}-${s}`);for(const[e,i]of Object.entries(r))if(null!=i)switch(e){case"class":i.length&&t.setAttribute(e,i.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",i);break;case"style":Object.assign(t.style,i);break;case"textContent":t.textContent=i;break;default:(!o||"href"!==e&&"newWindow"!==e)&&t.setAttribute(e,i)}o&&n.addLinkAttributes(t,r.href,r.newWindow);a&&r.dataId&&this.setupStorage(t,r.dataId,i,a)}static render(e){const t=e.annotationStorage,i=e.linkService,a=e.xfaHtml,s=e.intent||"display",n=document.createElement(a.name);a.attributes&&this.setAttributes({html:n,element:a,intent:s,linkService:i});const r="richText"!==s,o=e.div;o.append(n);if(e.viewport){const t=`matrix(${e.viewport.transform.join(",")})`;o.style.transform=t}r&&o.setAttribute("class","xfaLayer xfaFont");const l=[];if(0===a.children.length){if(a.value){const e=document.createTextNode(a.value);n.append(e);r&&XfaText.shouldBuildText(a.name)&&l.push(e)}return{textDivs:l}}const d=[[a,-1,n]];for(;d.length>0;){const[e,a,n]=d.at(-1);if(a+1===e.children.length){d.pop();continue}const o=e.children[++d.at(-1)[1]];if(null===o)continue;const{name:c}=o;if("#text"===c){const e=document.createTextNode(o.value);l.push(e);n.append(e);continue}const h=o?.attributes?.xmlns?document.createElementNS(o.attributes.xmlns,c):document.createElement(c);n.append(h);o.attributes&&this.setAttributes({html:h,element:o,storage:t,intent:s,linkService:i});if(o.children?.length>0)d.push([o,-1,h]);else if(o.value){const e=document.createTextNode(o.value);r&&XfaText.shouldBuildText(c)&&l.push(e);h.append(e)}}for(const e of o.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:l}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t;e.div.hidden=!1}}function _classPrivateFieldInitSpec(e,t,i){(function _checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function _classPrivateFieldGet(e,t){return e.get(display_utils_assertClassBrand(e,t))}function display_utils_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function display_utils_defineProperty(e,t,i){return(t=function display_utils_toPropertyKey(e){var t=function display_utils_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const Y="http://www.w3.org/2000/svg";class PixelsPerInch{}K=PixelsPerInch;display_utils_defineProperty(PixelsPerInch,"CSS",96);display_utils_defineProperty(PixelsPerInch,"PDF",72);display_utils_defineProperty(PixelsPerInch,"PDF_TO_CSS_UNITS",K.CSS/K.PDF);async function fetchData(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";if(isValidFetchUrl(e,document.baseURI)){const i=await fetch(e);if(!i.ok)throw new Error(i.statusText);switch(t){case"blob":return i.blob();case"bytes":return i.bytes();case"json":return i.json()}return i.text()}return new Promise((i,a)=>{const s=new XMLHttpRequest;s.open("GET",e,!0);s.responseType="bytes"===t?"arraybuffer":t;s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE)if(200!==s.status&&0!==s.status)a(new Error(s.statusText));else{switch(t){case"bytes":i(new Uint8Array(s.response));return;case"blob":case"json":i(s.response);return}i(s.responseText)}};s.send(null)})}class PageViewport{constructor(e){let{viewBox:t,userUnit:i,scale:a,rotation:s,offsetX:n=0,offsetY:r=0,dontFlip:o=!1}=e;this.viewBox=t;this.userUnit=i;this.scale=a;this.rotation=s;this.offsetX=n;this.offsetY=r;a*=i;const l=(t[2]+t[0])/2,d=(t[3]+t[1])/2;let c,h,u,_,p,g,f,m;s%=360;s<0&&(s+=360);switch(s){case 180:c=-1;h=0;u=0;_=1;break;case 90:c=0;h=1;u=1;_=0;break;case 270:c=0;h=-1;u=-1;_=0;break;case 0:c=1;h=0;u=0;_=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}if(o){u=-u;_=-_}if(0===c){p=Math.abs(d-t[1])*a+n;g=Math.abs(l-t[0])*a+r;f=(t[3]-t[1])*a;m=(t[2]-t[0])*a}else{p=Math.abs(l-t[0])*a+n;g=Math.abs(d-t[1])*a+r;f=(t[2]-t[0])*a;m=(t[3]-t[1])*a}this.transform=[c*a,h*a,u*a,_*a,p-c*a*l-u*a*d,g-h*a*l-_*a*d];this.width=f;this.height=m}get rawDims(){const e=this.viewBox;return shadow(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone(){let{scale:e=this.scale,rotation:t=this.rotation,offsetX:i=this.offsetX,offsetY:a=this.offsetY,dontFlip:s=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new PageViewport({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:i,offsetY:a,dontFlip:s})}convertToViewportPoint(e,t){const i=[e,t];Util.applyTransform(i,this.transform);return i}convertToViewportRectangle(e){const t=[e[0],e[1]];Util.applyTransform(t,this.transform);const i=[e[2],e[3]];Util.applyTransform(i,this.transform);return[t[0],t[1],i[0],i[1]]}convertToPdfPoint(e,t){const i=[e,t];Util.applyInverseTransform(i,this.transform);return i}}class RenderingCancelledException extends z{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(e,"RenderingCancelledException");this.extraDelay=t}}function isDataScheme(e){const t=e.length;let i=0;for(;i<t&&""===e[i].trim();)i++;return"data:"===e.substring(i,i+5).toLowerCase()}function isPdfFile(e){return"string"==typeof e&&/\.pdf$/i.test(e)}function getPdfFilenameFromUrl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if(t&&"document.pdf"!==t)return t;if("string"!=typeof e)return t;if(isDataScheme(e)){warn('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.');return t}const i=(e=>{try{return new URL(e)}catch{try{return new URL(decodeURIComponent(e))}catch{try{return new URL(e,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(e),"https://foo.bar")}catch{return null}}}}})(e);if(!i)return t;const decode=e=>{try{let t=decodeURIComponent(e);if(t.includes("/")){t=stripPath(t);if(/^\.pdf$/i.test(t))return e}return t}catch{return e}},a=/\.pdf$/i,s=stripPath(i.pathname);if(a.test(s))return decode(s);if(i.searchParams.size>0){const getLast=e=>[...e].findLast(e=>a.test(e)),e=getLast(i.searchParams.values())??getLast(i.searchParams.keys());if(e)return decode(e)}if(i.hash){const e=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(i.hash);if(e)return decode(e[0])}return t}var Z=new WeakMap;class StatTimer{constructor(){_classPrivateFieldInitSpec(this,Z,new Map);display_utils_defineProperty(this,"times",[])}time(e){_classPrivateFieldGet(Z,this).has(e)&&warn(`Timer is already running for ${e}`);_classPrivateFieldGet(Z,this).set(e,Date.now())}timeEnd(e){_classPrivateFieldGet(Z,this).has(e)||warn(`Timer has not been started for ${e}`);this.times.push({name:e,start:_classPrivateFieldGet(Z,this).get(e),end:Date.now()});_classPrivateFieldGet(Z,this).delete(e)}toString(){const e=Math.max(...this.times.map(e=>e.name.length));return this.times.map(t=>`${t.name.padEnd(e)} ${t.end-t.start}ms\n`).join("")}}function isValidFetchUrl(e,t){const i=t?URL.parse(e,t):URL.parse(e);return/https?:|blob:|capacitor:/.test(i?.protocol??"")}function noContextMenu(e){e.preventDefault()}function stopEvent(e){e.preventDefault();e.stopPropagation()}class PDFDateString{static toDateObject(e){if(e instanceof Date)return e;if(!e||"string"!=typeof e)return null;display_utils_assertClassBrand(PDFDateString,this,J)._||(J._=display_utils_assertClassBrand(PDFDateString,this,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?")));const t=display_utils_assertClassBrand(PDFDateString,this,J)._.exec(e);if(!t)return null;const i=parseInt(t[1],10);let a=parseInt(t[2],10);a=a>=1&&a<=12?a-1:0;let s=parseInt(t[3],10);s=s>=1&&s<=31?s:1;let n=parseInt(t[4],10);n=n>=0&&n<=23?n:0;let r=parseInt(t[5],10);r=r>=0&&r<=59?r:0;let o=parseInt(t[6],10);o=o>=0&&o<=59?o:0;const l=t[7]||"Z";let d=parseInt(t[8],10);d=d>=0&&d<=23?d:0;let c=parseInt(t[9],10)||0;c=c>=0&&c<=59?c:0;if("-"===l){n+=d;r+=c}else if("+"===l){n-=d;r-=c}return new Date(Date.UTC(i,a,s,n,r,o))}}var J={_:void 0};function getXfaPageViewport(e,t){let{scale:i=1,rotation:a=0}=t;const{width:s,height:n}=e.attributes.style,r=[0,0,parseInt(s),parseInt(n)];return new PageViewport({viewBox:r,userUnit:1,scale:i,rotation:a})}function getRGB(e){if(e.startsWith("#")){const t=parseInt(e.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}if(e.startsWith("rgb("))return e.slice(4,-1).split(",").map(e=>parseInt(e));if(e.startsWith("rgba("))return e.slice(5,-1).split(",",3).map(e=>parseInt(e));warn(`Not a valid color format: "${e}"`);return[0,0,0]}function getCurrentTransform(e){const{a:t,b:i,c:a,d:s,e:n,f:r}=e.getTransform();return[t,i,a,s,n,r]}function getCurrentTransformInverse(e){const{a:t,b:i,c:a,d:s,e:n,f:r}=e.getTransform().invertSelf();return[t,i,a,s,n,r]}function setLayerDimensions(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(t instanceof PageViewport){const{pageWidth:a,pageHeight:s}=t.rawDims,{style:n}=e,r=FeatureTest.isCSSRoundSupported,o=`var(--total-scale-factor) * ${a}px`,l=`var(--total-scale-factor) * ${s}px`,d=r?`round(down, ${o}, var(--scale-round-x))`:`calc(${o})`,c=r?`round(down, ${l}, var(--scale-round-y))`:`calc(${l})`;if(i&&t.rotation%180!=0){n.width=c;n.height=d}else{n.width=d;n.height=c}}a&&e.setAttribute("data-main-rotation",t.rotation)}class OutputScale{constructor(){const{pixelRatio:e}=OutputScale;this.sx=e;this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}limitCanvas(e,t,i,a){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,n=1/0,r=1/0,o=1/0;(i=OutputScale.capPixels(i,s))>0&&(n=Math.sqrt(i/(e*t)));if(-1!==a){r=a/e;o=a/t}const l=Math.min(n,r,o);if(this.sx>l||this.sy>l){this.sx=l;this.sy=l;return!0}return!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){const i=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,i):i}return e}}const Q=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class ColorScheme{static get isDarkMode(){return shadow(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}}class CSSConstants{static get commentForegroundColor(){const e=document.createElement("ngx-extended-pdf-viewer");e.style.display="block";const t=document.createElement("span");t.classList.add("commentPopup","comment","sidebar");const{style:i}=t;i.width=i.height="0";i.display="none";i.color="var(--comment-fg-color)";e.append(t);document.body.append(e);const{color:a}=window.getComputedStyle(t);e.remove();return shadow(this,"commentForegroundColor",getRGB(a))}}function applyOpacity(e,t){const i=255*(1-(t=MathClamp(t??1,0,1)));return e.map(e=>Math.round(e*t+i))}function RGBToHSL(e,t){const i=e[0]/255,a=e[1]/255,s=e[2]/255,n=Math.max(i,a,s),r=Math.min(i,a,s),o=(n+r)/2;if(n===r)t[0]=t[1]=0;else{const e=n-r;t[1]=o<.5?e/(n+r):e/(2-n-r);switch(n){case i:t[0]=60*((a-s)/e+(a<s?6:0));break;case a:t[0]=60*((s-i)/e+2);break;case s:t[0]=60*((i-a)/e+4)}}t[2]=o}function HSLToRGB(e,t){const i=e[0],a=e[1],s=e[2],n=(1-Math.abs(2*s-1))*a,r=n*(1-Math.abs(i/60%2-1)),o=s-n/2;switch(Math.floor(i/60)){case 0:t[0]=n+o;t[1]=r+o;t[2]=o;break;case 1:t[0]=r+o;t[1]=n+o;t[2]=o;break;case 2:t[0]=o;t[1]=n+o;t[2]=r+o;break;case 3:t[0]=o;t[1]=r+o;t[2]=n+o;break;case 4:t[0]=r+o;t[1]=o;t[2]=n+o;break;case 5:case 6:t[0]=n+o;t[1]=o;t[2]=r+o}}function computeLuminance(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function contrastRatio(e,t,i){HSLToRGB(e,i);i.map(computeLuminance);const a=.2126*i[0]+.7152*i[1]+.0722*i[2];HSLToRGB(t,i);i.map(computeLuminance);const s=.2126*i[0]+.7152*i[1]+.0722*i[2];return a>s?(a+.05)/(s+.05):(s+.05)/(a+.05)}const ee=new Map;function findContrastColor(e,t){const i=e[0]+256*e[1]+65536*e[2]+16777216*t[0]+4294967296*t[1]+1099511627776*t[2];let a=ee.get(i);if(a)return a;const s=new Float32Array(9),n=s.subarray(0,3),r=s.subarray(3,6);RGBToHSL(e,r);const o=s.subarray(6,9);RGBToHSL(t,o);const l=o[2]<.5,d=l?12:4.5;r[2]=l?Math.sqrt(r[2]):1-Math.sqrt(1-r[2]);if(contrastRatio(r,o,n)<d){let e,t;if(l){e=r[2];t=1}else{e=0;t=r[2]}const i=.005;for(;t-e>i;){const i=r[2]=(e+t)/2;l===contrastRatio(r,o,n)<d?e=i:t=i}r[2]=l?t:e}HSLToRGB(r,n);a=Util.makeHexColor(Math.round(255*n[0]),Math.round(255*n[1]),Math.round(255*n[2]));ee.set(i,a);return a}function renderRichText(e,t){let{html:i,dir:a,className:s}=e;const n=document.createDocumentFragment();if("string"==typeof i){const e=document.createElement("p");e.dir=a||"auto";const t=i.split(/(?:\r\n?|\n)/);for(let i=0,a=t.length;i<a;++i){const s=t[i];e.append(document.createTextNode(s));i<a-1&&e.append(document.createElement("br"))}n.append(e)}else XfaLayer.render({xfaHtml:i,div:n,intent:"richText"});n.firstElementChild.classList.add("richText",s);t.append(n)}function makePathFromDrawOPS(e){const t=new Path2D;if(!e)return t;for(let i=0,a=e.length;i<a;)switch(e[i++]){case R:t.moveTo(e[i++],e[i++]);break;case N:t.lineTo(e[i++],e[i++]);break;case O:t.bezierCurveTo(e[i++],e[i++],e[i++],e[i++],e[i++],e[i++]);break;case W:t.quadraticCurveTo(e[i++],e[i++],e[i++],e[i++]);break;case j:t.closePath();break;default:warn(`Unrecognized drawing path operator: ${e[i-1]}`)}return t}__webpack_require__(4972),__webpack_require__(4628),__webpack_require__(7642),__webpack_require__(8004),__webpack_require__(3853),__webpack_require__(5876),__webpack_require__(2475),__webpack_require__(5024),__webpack_require__(1698),__webpack_require__(4979),__webpack_require__(3579),__webpack_require__(3110),__webpack_require__(9314),__webpack_require__(1148),__webpack_require__(7588),__webpack_require__(9112),__webpack_require__(7357);function _classPrivateMethodInitSpec(e,t){toolbar_checkPrivateRedeclaration(e,t),t.add(e)}function toolbar_classPrivateFieldInitSpec(e,t,i){toolbar_checkPrivateRedeclaration(e,t),t.set(e,i)}function toolbar_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateGetter(e,t,i){return i(toolbar_assertClassBrand(e,t))}function toolbar_classPrivateFieldGet(e,t){return e.get(toolbar_assertClassBrand(e,t))}function _classPrivateFieldSet(e,t,i){return e.set(toolbar_assertClassBrand(e,t),i),i}function toolbar_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var te=new WeakMap,ie=new WeakMap,ae=new WeakMap,se=new WeakMap,ne=new WeakMap,re=new WeakMap,oe=new WeakMap,le=new WeakMap,de=new WeakSet;class EditorToolbar{constructor(e){_classPrivateMethodInitSpec(this,de);toolbar_classPrivateFieldInitSpec(this,te,null);toolbar_classPrivateFieldInitSpec(this,ie,null);toolbar_classPrivateFieldInitSpec(this,ae,void 0);toolbar_classPrivateFieldInitSpec(this,se,null);toolbar_classPrivateFieldInitSpec(this,ne,null);toolbar_classPrivateFieldInitSpec(this,re,null);toolbar_classPrivateFieldInitSpec(this,oe,null);toolbar_classPrivateFieldInitSpec(this,le,null);_classPrivateFieldSet(ae,this,e);he._||(he._=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){const e=_classPrivateFieldSet(te,this,document.createElement("div"));e.classList.add("editToolbar","hidden");e.setAttribute("role","toolbar");const t=toolbar_classPrivateFieldGet(ae,this)._uiManager._signal;if(t instanceof AbortSignal&&!t.aborted){e.addEventListener("contextmenu",noContextMenu,{signal:t});e.addEventListener("pointerdown",_pointerDown,{signal:t})}const i=_classPrivateFieldSet(se,this,document.createElement("div"));i.className="buttons";e.append(i);const a=toolbar_classPrivateFieldGet(ae,this).toolbarPosition;if(a){const{style:t}=e,i="ltr"===toolbar_classPrivateFieldGet(ae,this)._uiManager.direction?1-a[0]:a[0];t.insetInlineEnd=100*i+"%";t.top=`calc(${100*a[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return toolbar_classPrivateFieldGet(te,this)}hide(){toolbar_classPrivateFieldGet(te,this).classList.add("hidden");toolbar_classPrivateFieldGet(ie,this)?.hideDropdown()}show(){toolbar_classPrivateFieldGet(te,this).classList.remove("hidden");toolbar_classPrivateFieldGet(ne,this)?.shown();toolbar_classPrivateFieldGet(re,this)?.shown()}addDeleteButton(){const{editorType:e,_uiManager:t}=toolbar_classPrivateFieldGet(ae,this),i=document.createElement("button");i.classList.add("basic","deleteButton");i.tabIndex=0;i.setAttribute("data-l10n-id",he._[e]);toolbar_assertClassBrand(de,this,_addListenersToElement).call(this,i)&&i.addEventListener("click",e=>{t.delete()},{signal:t._signal});toolbar_classPrivateFieldGet(se,this).append(i)}async addAltText(e){const t=await e.render();toolbar_assertClassBrand(de,this,_addListenersToElement).call(this,t);toolbar_classPrivateFieldGet(se,this).append(t,_classPrivateGetter(de,this,_get_divider));_classPrivateFieldSet(ne,this,e)}addComment(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(toolbar_classPrivateFieldGet(re,this))return;const i=e.renderForToolbar();if(!i)return;toolbar_assertClassBrand(de,this,_addListenersToElement).call(this,i);const a=_classPrivateFieldSet(oe,this,_classPrivateGetter(de,this,_get_divider));if(t){toolbar_classPrivateFieldGet(se,this).insertBefore(i,t);toolbar_classPrivateFieldGet(se,this).insertBefore(a,t)}else toolbar_classPrivateFieldGet(se,this).append(i,a);_classPrivateFieldSet(re,this,e);e.toolbar=this}addColorPicker(e){if(toolbar_classPrivateFieldGet(ie,this))return;_classPrivateFieldSet(ie,this,e);const t=e.renderButton();toolbar_assertClassBrand(de,this,_addListenersToElement).call(this,t);toolbar_classPrivateFieldGet(se,this).append(t,_classPrivateGetter(de,this,_get_divider))}async addEditSignatureButton(e){const t=_classPrivateFieldSet(le,this,await e.renderEditButton(toolbar_classPrivateFieldGet(ae,this)));toolbar_assertClassBrand(de,this,_addListenersToElement).call(this,t);toolbar_classPrivateFieldGet(se,this).append(t,_classPrivateGetter(de,this,_get_divider))}removeButton(e){if("comment"===e){toolbar_classPrivateFieldGet(re,this)?.removeToolbarCommentButton();_classPrivateFieldSet(re,this,null);toolbar_classPrivateFieldGet(oe,this)?.remove();_classPrivateFieldSet(oe,this,null)}}async addButton(e,t){switch(e){case"colorPicker":t&&this.addColorPicker(t);break;case"altText":t&&await this.addAltText(t);break;case"editSignature":t&&await this.addEditSignatureButton(t);break;case"delete":this.addDeleteButton();break;case"comment":t&&this.addComment(t)}}async addButtonBefore(e,t,i){if(!t&&"comment"===e)return;const a=toolbar_classPrivateFieldGet(se,this).querySelector(i);a&&"comment"===e&&this.addComment(t,a)}updateEditSignatureButton(e){toolbar_classPrivateFieldGet(le,this)&&(toolbar_classPrivateFieldGet(le,this).title=e)}remove(){toolbar_classPrivateFieldGet(te,this).remove();toolbar_classPrivateFieldGet(ie,this)?.destroy();_classPrivateFieldSet(ie,this,null)}}function _pointerDown(e){e.stopPropagation()}function _focusIn(e){toolbar_classPrivateFieldGet(ae,this)._focusEventsAllowed=!1;stopEvent(e)}function _focusOut(e){toolbar_classPrivateFieldGet(ae,this)._focusEventsAllowed=!0;stopEvent(e)}function _addListenersToElement(e){const t=toolbar_classPrivateFieldGet(ae,this)._uiManager._signal;if(!(t instanceof AbortSignal)||t.aborted)return!1;e.addEventListener("focusin",toolbar_assertClassBrand(de,this,_focusIn).bind(this),{capture:!0,signal:t});e.addEventListener("focusout",toolbar_assertClassBrand(de,this,_focusOut).bind(this),{capture:!0,signal:t});e.addEventListener("contextmenu",noContextMenu,{signal:t});return!0}function _get_divider(e){const t=document.createElement("div");t.className="divider";return t}var ce,he={_:null},ue=new WeakMap,_e=new WeakMap,pe=new WeakMap,ge=new WeakSet;class FloatingToolbar{constructor(e){_classPrivateMethodInitSpec(this,ge);toolbar_classPrivateFieldInitSpec(this,ue,null);toolbar_classPrivateFieldInitSpec(this,_e,null);toolbar_classPrivateFieldInitSpec(this,pe,void 0);_classPrivateFieldSet(pe,this,e)}show(e,t,i){const[a,s]=toolbar_assertClassBrand(ge,this,_getLastPoint).call(this,t,i),{style:n}=toolbar_classPrivateFieldGet(_e,this)||_classPrivateFieldSet(_e,this,toolbar_assertClassBrand(ge,this,_render).call(this));e.append(toolbar_classPrivateFieldGet(_e,this));n.insetInlineEnd=100*a+"%";n.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){toolbar_classPrivateFieldGet(_e,this).remove()}}function _render(){const e=_classPrivateFieldSet(_e,this,document.createElement("div"));e.className="editToolbar";e.setAttribute("role","toolbar");const t=toolbar_classPrivateFieldGet(pe,this)._signal;t instanceof AbortSignal&&!t.aborted&&e.addEventListener("contextmenu",noContextMenu,{signal:t});const i=_classPrivateFieldSet(ue,this,document.createElement("div"));i.className="buttons";e.append(i);toolbar_classPrivateFieldGet(pe,this).hasCommentManager()&&toolbar_assertClassBrand(ge,this,_makeButton).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{toolbar_classPrivateFieldGet(pe,this).commentSelection("floating_button")});toolbar_assertClassBrand(ge,this,_makeButton).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{toolbar_classPrivateFieldGet(pe,this).highlightSelection("floating_button")});return e}function _getLastPoint(e,t){let i=0,a=0;for(const s of e){const e=s.y+s.height;if(e<i)continue;const n=s.x+(t?s.width:0);if(e>i){a=n;i=e}else t?n>a&&(a=n):n<a&&(a=n)}return[t?1-a:a,i]}function _makeButton(e,t,i,a){const s=document.createElement("button");s.classList.add("basic",e);s.tabIndex=0;s.setAttribute("data-l10n-id",t);const n=document.createElement("span");s.append(n);n.className="visuallyHidden";n.setAttribute("data-l10n-id",i);const r=toolbar_classPrivateFieldGet(pe,this)._signal;if(r instanceof AbortSignal&&!r.aborted){s.addEventListener("contextmenu",noContextMenu,{signal:r});s.addEventListener("click",a,{signal:r})}toolbar_classPrivateFieldGet(ue,this).append(s)}function tools_defineProperty(e,t,i){return(t=function tools_toPropertyKey(e){var t=function tools_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function tools_classPrivateMethodInitSpec(e,t){tools_checkPrivateRedeclaration(e,t),t.add(e)}function tools_classPrivateFieldInitSpec(e,t,i){tools_checkPrivateRedeclaration(e,t),t.set(e,i)}function tools_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function tools_classPrivateFieldGet(e,t){return e.get(tools_assertClassBrand(e,t))}function tools_classPrivateFieldSet(e,t,i){return e.set(tools_assertClassBrand(e,t),i),i}function tools_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function bindEvents(e,t,i){for(const a of i)t.addEventListener(a,e[a].bind(e))}class CurrentPointers{static initializeAndAddPointerId(e){(me._||(me._=new Set)).add(e)}static setPointer(e,t){fe._||(fe._=t);Pe._??(Pe._=e)}static setTimeStamp(e){ve._=e}static isSamePointerId(e){return fe._===e}static isSamePointerIdOrRemove(e){if(fe._===e)return!0;me._?.delete(e);return!1}static isSamePointerType(e){return Pe._===e}static isInitializedAndDifferentPointerType(e){return null!==Pe._&&!CurrentPointers.isSamePointerType(e)}static isSameTimeStamp(e){return ve._===e}static isUsingMultiplePointers(){return me._?.size>=1}static clearPointerType(){Pe._=null}static clearPointerIds(){fe._=NaN;me._=null}static clearTimeStamp(){ve._=NaN}}var fe={_:NaN},me={_:null},ve={_:NaN},Pe={_:null},we=new WeakMap;class IdManager{constructor(){tools_classPrivateFieldInitSpec(this,we,0)}get id(){var e,t;return`${g}${tools_classPrivateFieldSet(we,this,(e=tools_classPrivateFieldGet(we,this),t=e++,e)),t}`}}var Fe=new WeakMap,be=new WeakMap,ye=new WeakMap,Se=new WeakSet;class ImageManager{constructor(){tools_classPrivateMethodInitSpec(this,Se);tools_classPrivateFieldInitSpec(this,Fe,getUuid());tools_classPrivateFieldInitSpec(this,be,0);tools_classPrivateFieldInitSpec(this,ye,null)}static get _isSVGFittingCanvas(){const e=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),t=new Image;t.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>';return shadow(this,"_isSVGFittingCanvas",t.decode().then(()=>{e.drawImage(t,0,0,1,1,0,0,1,3);return 0===new Uint32Array(e.getImageData(0,0,1,1).data.buffer)[0]}))}async getFromFile(e){const{lastModified:t,name:i,size:a,type:s}=e;return tools_assertClassBrand(Se,this,_get).call(this,`${t}_${i}_${a}_${s}`,e)}async getFromUrl(e){return tools_assertClassBrand(Se,this,_get).call(this,e,e)}async getFromBlob(e,t){const i=await t;return tools_assertClassBrand(Se,this,_get).call(this,e,i)}async getFromId(e){tools_classPrivateFieldGet(ye,this)||tools_classPrivateFieldSet(ye,this,new Map);const t=tools_classPrivateFieldGet(ye,this).get(e);if(!t)return null;if(t.bitmap){t.refCounter+=1;return t}if(t.file)return this.getFromFile(t.file);if(t.blobPromise){const{blobPromise:e}=t;delete t.blobPromise;return this.getFromBlob(t.id,e)}return this.getFromUrl(t.url)}getFromCanvas(e,t){var i,a;tools_classPrivateFieldGet(ye,this)||tools_classPrivateFieldSet(ye,this,new Map);let s=tools_classPrivateFieldGet(ye,this).get(e);if(s?.bitmap){s.refCounter+=1;return s}const n=new OffscreenCanvas(t.width,t.height);n.getContext("2d").drawImage(t,0,0);s={bitmap:n.transferToImageBitmap(),id:`image_${tools_classPrivateFieldGet(Fe,this)}_${tools_classPrivateFieldSet(be,this,(i=tools_classPrivateFieldGet(be,this),a=i++,i)),a}`,refCounter:1,isSvg:!1};tools_classPrivateFieldGet(ye,this).set(e,s);tools_classPrivateFieldGet(ye,this).set(s.id,s);return s}getSvgUrl(e){const t=tools_classPrivateFieldGet(ye,this).get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){tools_classPrivateFieldGet(ye,this)||tools_classPrivateFieldSet(ye,this,new Map);const t=tools_classPrivateFieldGet(ye,this).get(e);if(!t)return;t.refCounter-=1;if(0!==t.refCounter)return;const{bitmap:i}=t;if(!t.url&&!t.file){const e=new OffscreenCanvas(i.width,i.height);e.getContext("bitmaprenderer").transferFromImageBitmap(i);t.blobPromise=e.convertToBlob()}i.close?.();t.bitmap=null}isValidId(e){return e.startsWith(`image_${tools_classPrivateFieldGet(Fe,this)}_`)}}ce=ImageManager;async function _get(e,t){tools_classPrivateFieldGet(ye,this)||tools_classPrivateFieldSet(ye,this,new Map);let i=tools_classPrivateFieldGet(ye,this).get(e);if(null===i)return null;if(i?.bitmap){i.refCounter+=1;return i}try{var a,s;i||={bitmap:null,id:`image_${tools_classPrivateFieldGet(Fe,this)}_${tools_classPrivateFieldSet(be,this,(a=tools_classPrivateFieldGet(be,this),s=a++,a)),s}`,refCounter:0,isSvg:!1};let e;if("string"==typeof t){i.url=t;e=await fetchData(t,"blob")}else t instanceof File?e=i.file=t:t instanceof Blob&&(e=t);if("image/svg+xml"===e.type){const t=ce._isSVGFittingCanvas,a=new FileReader,s=new Image,n=new Promise((e,n)=>{s.onload=()=>{i.bitmap=s;i.isSvg=!0;e()};a.onload=async()=>{const e=i.svgUrl=a.result;s.src=await t?`${e}#svgView(preserveAspectRatio(none))`:e};s.onerror=a.onerror=n});a.readAsDataURL(e);await n}else i.bitmap=await createImageBitmap(e);i.refCounter=1}catch(e){warn(e);i=null}tools_classPrivateFieldGet(ye,this).set(e,i);i&&tools_classPrivateFieldGet(ye,this).set(i.id,i);return i}var Ce=new WeakMap,xe=new WeakMap,ke=new WeakMap,Ee=new WeakMap;class CommandManager{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;tools_classPrivateFieldInitSpec(this,Ce,[]);tools_classPrivateFieldInitSpec(this,xe,!1);tools_classPrivateFieldInitSpec(this,ke,void 0);tools_classPrivateFieldInitSpec(this,Ee,-1);tools_classPrivateFieldSet(ke,this,e)}add(e){let{cmd:t,undo:i,post:a,mustExec:s,type:n=NaN,overwriteIfSameType:r=!1,keepUndo:o=!1}=e;s&&t();if(tools_classPrivateFieldGet(xe,this))return;const l={cmd:t,undo:i,post:a,type:n};if(-1===tools_classPrivateFieldGet(Ee,this)){tools_classPrivateFieldGet(Ce,this).length>0&&(tools_classPrivateFieldGet(Ce,this).length=0);tools_classPrivateFieldSet(Ee,this,0);tools_classPrivateFieldGet(Ce,this).push(l);return}if(r&&tools_classPrivateFieldGet(Ce,this)[tools_classPrivateFieldGet(Ee,this)].type===n){o&&(l.undo=tools_classPrivateFieldGet(Ce,this)[tools_classPrivateFieldGet(Ee,this)].undo);tools_classPrivateFieldGet(Ce,this)[tools_classPrivateFieldGet(Ee,this)]=l;return}const d=tools_classPrivateFieldGet(Ee,this)+1;if(d===tools_classPrivateFieldGet(ke,this))tools_classPrivateFieldGet(Ce,this).splice(0,1);else{tools_classPrivateFieldSet(Ee,this,d);d<tools_classPrivateFieldGet(Ce,this).length&&tools_classPrivateFieldGet(Ce,this).splice(d)}tools_classPrivateFieldGet(Ce,this).push(l)}undo(){if(-1===tools_classPrivateFieldGet(Ee,this))return;tools_classPrivateFieldSet(xe,this,!0);const{undo:e,post:t}=tools_classPrivateFieldGet(Ce,this)[tools_classPrivateFieldGet(Ee,this)];e();t?.();tools_classPrivateFieldSet(xe,this,!1);tools_classPrivateFieldSet(Ee,this,tools_classPrivateFieldGet(Ee,this)-1)}redo(){if(tools_classPrivateFieldGet(Ee,this)<tools_classPrivateFieldGet(Ce,this).length-1){tools_classPrivateFieldSet(Ee,this,tools_classPrivateFieldGet(Ee,this)+1);tools_classPrivateFieldSet(xe,this,!0);const{cmd:e,post:t}=tools_classPrivateFieldGet(Ce,this)[tools_classPrivateFieldGet(Ee,this)];e();t?.();tools_classPrivateFieldSet(xe,this,!1)}}hasSomethingToUndo(){return-1!==tools_classPrivateFieldGet(Ee,this)}hasSomethingToRedo(){return tools_classPrivateFieldGet(Ee,this)<tools_classPrivateFieldGet(Ce,this).length-1}cleanType(e){if(-1!==tools_classPrivateFieldGet(Ee,this)){for(let t=tools_classPrivateFieldGet(Ee,this);t>=0;t--)if(tools_classPrivateFieldGet(Ce,this)[t].type!==e){tools_classPrivateFieldGet(Ce,this).splice(t+1,tools_classPrivateFieldGet(Ee,this)-t);tools_classPrivateFieldSet(Ee,this,t);return}tools_classPrivateFieldGet(Ce,this).length=0;tools_classPrivateFieldSet(Ee,this,-1)}}destroy(){tools_classPrivateFieldSet(Ce,this,null)}reset(){tools_classPrivateFieldSet(Ce,this,[]);tools_classPrivateFieldSet(Ee,this,-1);tools_classPrivateFieldSet(xe,this,!1)}}var Ae=new WeakSet;class KeyboardManager{constructor(e){tools_classPrivateMethodInitSpec(this,Ae);this.buffer=[];this.callbacks=new Map;this.allKeys=new Set;const{isMac:t}=FeatureTest.platform;for(const[i,a,s={}]of e)for(const e of i){const i=e.startsWith("mac+");if(t&&i){this.callbacks.set(e.slice(4),{callback:a,options:s});this.allKeys.add(e.split("+").at(-1))}else if(!t&&!i){this.callbacks.set(e,{callback:a,options:s});this.allKeys.add(e.split("+").at(-1))}}}exec(e,t){if(!this.allKeys.has(t.key))return;const i=this.callbacks.get(tools_assertClassBrand(Ae,this,_serialize).call(this,t));if(!i)return;const{callback:a,options:{bubbles:s=!1,args:n=[],checker:r=null}}=i;if(!r||r(e,t)){a.bind(e,...n,t)();s||stopEvent(t)}}}function _serialize(e){e.altKey&&this.buffer.push("alt");e.ctrlKey&&this.buffer.push("ctrl");e.metaKey&&this.buffer.push("meta");e.shiftKey&&this.buffer.push("shift");this.buffer.push(e.key);const t=this.buffer.join("+");this.buffer.length=0;return t}class ColorManager{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);!function getColorValues(e){const t=document.createElement("span");t.style.visibility="hidden";t.style.colorScheme="only light";document.body.append(t);for(const i of e.keys()){t.style.color=i;const a=window.getComputedStyle(t).color;e.set(i,getRGB(a))}t.remove()}(e);return shadow(this,"_colors",e)}convert(e){const t=getRGB(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[e,i]of this._colors)if(i.every((e,i)=>e===t[i]))return ColorManager._colorsMapping.get(e);return t}getHexCode(e){const t=this._colors.get(e);return t?Util.makeHexColor(...t):e}}tools_defineProperty(ColorManager,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));var Ge=new WeakMap,Be=new WeakMap,Me=new WeakMap,Ie=new WeakMap,Te=new WeakMap,De=new WeakMap,Le=new WeakMap,Re=new WeakMap,Ne=new WeakMap,Oe=new WeakMap,We=new WeakMap,je=new WeakMap,Ve=new WeakMap,Ue=new WeakMap,ze=new WeakMap,He=new WeakMap,$e=new WeakMap,qe=new WeakMap,Xe=new WeakMap,Ke=new WeakMap,Ye=new WeakMap,Ze=new WeakMap,Je=new WeakMap,Qe=new WeakMap,et=new WeakMap,tt=new WeakMap,it=new WeakMap,st=new WeakMap,nt=new WeakMap,rt=new WeakMap,ot=new WeakMap,lt=new WeakMap,dt=new WeakMap,ct=new WeakMap,ht=new WeakMap,ut=new WeakMap,_t=new WeakMap,pt=new WeakMap,gt=new WeakMap,ft=new WeakMap,mt=new WeakMap,vt=new WeakMap,Pt=new WeakMap,wt=new WeakMap,Ft=new WeakMap,bt=new WeakMap,yt=new WeakMap,St=new WeakMap,Ct=new WeakMap,xt=new WeakMap,kt=new WeakSet;class AnnotationEditorUIManager{static get _keyboardManager(){const e=AnnotationEditorUIManager.prototype,arrowChecker=e=>tools_classPrivateFieldGet(yt,e).contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&e.hasSomethingToControl(),textInputChecker=(e,t)=>{let{target:i}=t;if(i instanceof HTMLInputElement){const{type:e}=i;return"text"!==e&&"number"!==e}return!0},t=this.TRANSLATE_SMALL,i=this.TRANSLATE_BIG;return shadow(this,"_keyboardManager",new KeyboardManager([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:textInputChecker}],[["ctrl+z","mac+meta+z"],e.undo,{checker:textInputChecker}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:textInputChecker}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:textInputChecker}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(e,t)=>{let{target:i}=t;return!(i instanceof HTMLButtonElement)&&tools_classPrivateFieldGet(yt,e).contains(i)&&!e.isEnterHandled}}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(e,t)=>{let{target:i}=t;return!(i instanceof HTMLButtonElement)&&tools_classPrivateFieldGet(yt,e).contains(document.activeElement)}}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-t,0],checker:arrowChecker}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:arrowChecker}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[t,0],checker:arrowChecker}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:arrowChecker}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-t],checker:arrowChecker}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:arrowChecker}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,t],checker:arrowChecker}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:arrowChecker}]]))}constructor(e,t,i,a,s,n,r,o,l,d,c,h,u,_,p,g){tools_classPrivateMethodInitSpec(this,kt);tools_classPrivateFieldInitSpec(this,Ge,new AbortController);tools_classPrivateFieldInitSpec(this,Be,null);tools_classPrivateFieldInitSpec(this,Me,null);tools_classPrivateFieldInitSpec(this,Ie,new Map);tools_classPrivateFieldInitSpec(this,Te,new Map);tools_classPrivateFieldInitSpec(this,De,null);tools_classPrivateFieldInitSpec(this,Le,null);tools_classPrivateFieldInitSpec(this,Re,null);tools_classPrivateFieldInitSpec(this,Ne,null);tools_classPrivateFieldInitSpec(this,Oe,new CommandManager);tools_classPrivateFieldInitSpec(this,We,null);tools_classPrivateFieldInitSpec(this,je,null);tools_classPrivateFieldInitSpec(this,Ve,null);tools_classPrivateFieldInitSpec(this,Ue,0);tools_classPrivateFieldInitSpec(this,ze,new Set);tools_classPrivateFieldInitSpec(this,He,null);tools_classPrivateFieldInitSpec(this,$e,null);tools_classPrivateFieldInitSpec(this,qe,new Set);tools_defineProperty(this,"_editorUndoBar",null);tools_classPrivateFieldInitSpec(this,Xe,!1);tools_classPrivateFieldInitSpec(this,Ke,!1);tools_classPrivateFieldInitSpec(this,Ye,!1);tools_classPrivateFieldInitSpec(this,Ze,null);tools_classPrivateFieldInitSpec(this,Je,null);tools_classPrivateFieldInitSpec(this,Qe,null);tools_classPrivateFieldInitSpec(this,et,null);tools_classPrivateFieldInitSpec(this,tt,!1);tools_classPrivateFieldInitSpec(this,it,null);tools_classPrivateFieldInitSpec(this,st,new IdManager);tools_classPrivateFieldInitSpec(this,nt,!1);tools_classPrivateFieldInitSpec(this,rt,!1);tools_classPrivateFieldInitSpec(this,ot,!1);tools_classPrivateFieldInitSpec(this,lt,null);tools_classPrivateFieldInitSpec(this,dt,null);tools_classPrivateFieldInitSpec(this,ct,null);tools_classPrivateFieldInitSpec(this,ht,null);tools_classPrivateFieldInitSpec(this,ut,null);tools_classPrivateFieldInitSpec(this,_t,f.NONE);tools_classPrivateFieldInitSpec(this,pt,new Set);tools_classPrivateFieldInitSpec(this,gt,null);tools_classPrivateFieldInitSpec(this,ft,null);tools_classPrivateFieldInitSpec(this,mt,null);tools_classPrivateFieldInitSpec(this,vt,null);tools_classPrivateFieldInitSpec(this,Pt,null);tools_classPrivateFieldInitSpec(this,wt,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});tools_classPrivateFieldInitSpec(this,Ft,[0,0]);tools_classPrivateFieldInitSpec(this,bt,null);tools_classPrivateFieldInitSpec(this,yt,null);tools_classPrivateFieldInitSpec(this,St,null);tools_classPrivateFieldInitSpec(this,Ct,null);tools_classPrivateFieldInitSpec(this,xt,null);const m=this._signal=tools_classPrivateFieldGet(Ge,this).signal;tools_classPrivateFieldSet(yt,this,e);tools_classPrivateFieldSet(St,this,t);tools_classPrivateFieldSet(Ct,this,i);tools_classPrivateFieldSet(Le,this,a);tools_classPrivateFieldSet(We,this,s);tools_classPrivateFieldSet(ft,this,n);tools_classPrivateFieldSet(Pt,this,o);this._eventBus=r;r._on("editingaction",this.onEditingAction.bind(this),{signal:m});r._on("pagechanging",this.onPageChanging.bind(this),{signal:m});r._on("scalechanging",this.onScaleChanging.bind(this),{signal:m});r._on("rotationchanging",this.onRotationChanging.bind(this),{signal:m});r._on("setpreference",this.onSetPreference.bind(this),{signal:m});r._on("switchannotationeditorparams",e=>this.updateParams(e.type,e.value),{signal:m});window.addEventListener("pointerdown",()=>{tools_classPrivateFieldSet(rt,this,!0)},{capture:!0,signal:m});window.addEventListener("pointerup",()=>{tools_classPrivateFieldSet(rt,this,!1)},{capture:!0,signal:m});window.addEventListener("beforeunload",tools_assertClassBrand(kt,this,_beforeUnload).bind(this),{capture:!0,signal:m});tools_assertClassBrand(kt,this,_addSelectionListener).call(this);tools_assertClassBrand(kt,this,_addDragAndDropListeners).call(this);tools_assertClassBrand(kt,this,_addKeyboardManager).call(this);tools_classPrivateFieldSet(Re,this,o.annotationStorage);tools_classPrivateFieldSet(Ze,this,o.filterFactory);tools_classPrivateFieldSet(mt,this,l);tools_classPrivateFieldSet(et,this,d||null);tools_classPrivateFieldSet(Xe,this,c);tools_classPrivateFieldSet(Ke,this,h);tools_classPrivateFieldSet(Ye,this,u);tools_classPrivateFieldSet(ut,this,_||null);this.viewParameters={realScale:PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0};this.isShiftKeyDown=!1;this._editorUndoBar=p||null;this._supportsPinchToZoom=!1!==g;s?.setSidebarUiManager(this)}destroy(){tools_classPrivateFieldGet(xt,this)?.resolve();tools_classPrivateFieldSet(xt,this,null);tools_classPrivateFieldGet(Ge,this)?.abort();tools_classPrivateFieldSet(Ge,this,null);this._signal=null;for(const e of tools_classPrivateFieldGet(Te,this).values())e.destroy();tools_classPrivateFieldGet(Te,this).clear();tools_classPrivateFieldGet(Ie,this).clear();tools_classPrivateFieldGet(qe,this).clear();tools_classPrivateFieldGet(ht,this)?.clear();tools_classPrivateFieldSet(Be,this,null);tools_classPrivateFieldGet(pt,this).clear();tools_classPrivateFieldGet(Oe,this).destroy();tools_classPrivateFieldGet(Le,this)?.destroy();tools_classPrivateFieldGet(We,this)?.destroy();tools_classPrivateFieldGet(ft,this)?.destroy();tools_classPrivateFieldGet(it,this)?.hide();tools_classPrivateFieldSet(it,this,null);tools_classPrivateFieldGet(ct,this)?.destroy();tools_classPrivateFieldSet(ct,this,null);tools_classPrivateFieldSet(Me,this,null);if(tools_classPrivateFieldGet(Je,this)){clearTimeout(tools_classPrivateFieldGet(Je,this));tools_classPrivateFieldSet(Je,this,null)}if(tools_classPrivateFieldGet(bt,this)){clearTimeout(tools_classPrivateFieldGet(bt,this));tools_classPrivateFieldSet(bt,this,null)}this._editorUndoBar?.destroy();tools_classPrivateFieldSet(Pt,this,null)}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return tools_classPrivateFieldGet(ut,this)}get useNewAltTextFlow(){return tools_classPrivateFieldGet(Ke,this)}get useNewAltTextWhenAddingImage(){return tools_classPrivateFieldGet(Ye,this)}get hcmFilter(){return shadow(this,"hcmFilter",tools_classPrivateFieldGet(mt,this)?tools_classPrivateFieldGet(Ze,this).addHCMFilter(tools_classPrivateFieldGet(mt,this).foreground,tools_classPrivateFieldGet(mt,this).background):"none")}get direction(){return shadow(this,"direction",getComputedStyle(tools_classPrivateFieldGet(yt,this)).direction)}get _highlightColors(){return shadow(this,"_highlightColors",tools_classPrivateFieldGet(et,this)?new Map(tools_classPrivateFieldGet(et,this).split(",").map(e=>{(e=e.split("=").map(e=>e.trim()))[1]=e[1].toUpperCase();return e})):null)}get highlightColors(){const{_highlightColors:e}=this;if(!e)return shadow(this,"highlightColors",null);const t=new Map,i=!!tools_classPrivateFieldGet(mt,this);for(const[a,s]of e){const e=a.endsWith("_HCM");i&&e?t.set(a.replace("_HCM",""),s):i||e||t.set(a,s)}return shadow(this,"highlightColors",t)}get highlightColorNames(){return shadow(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;const t=this.highlightColorNames.get(e);return this._highlightColors.get(t)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){if(e){this.unselectAll();this.disableUserSelect(!0)}else this.disableUserSelect(!1);tools_classPrivateFieldSet(Ve,this,e)}setMainHighlightColorPicker(e){tools_classPrivateFieldSet(ct,this,e)}editAltText(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];tools_classPrivateFieldGet(Le,this)?.editAltText(this,e,t)}hasCommentManager(){return!!tools_classPrivateFieldGet(We,this)}editComment(e,t,i,a){tools_classPrivateFieldGet(We,this)?.showDialog(this,e,t,i,a)}selectComment(e,t){const i=tools_classPrivateFieldGet(Te,this).get(e),a=i?.getEditorByUID(t);a?.toggleComment(!0,!0)}updateComment(e){tools_classPrivateFieldGet(We,this)?.updateComment(e.getData())}updatePopupColor(e){tools_classPrivateFieldGet(We,this)?.updatePopupColor(e)}removeComment(e){tools_classPrivateFieldGet(We,this)?.removeComments([e.uid])}deleteComment(e,t){const undo=()=>{e.comment=t};this.addCommands({cmd:()=>{this._editorUndoBar?.show(undo,"comment");this.toggleComment(null);e.comment=null},undo,mustExec:!0})}toggleComment(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;tools_classPrivateFieldGet(We,this)?.toggleCommentPopup(e,t,i)}makeCommentColor(e,t){return e&&tools_classPrivateFieldGet(We,this)?.makeCommentColor(e,t)||null}getCommentDialogElement(){return tools_classPrivateFieldGet(We,this)?.dialogElement||null}async waitForEditorsRendered(e){if(tools_classPrivateFieldGet(Te,this).has(e-1))return;const{resolve:t,promise:i}=Promise.withResolvers(),onEditorsRendered=i=>{if(i.pageNumber===e){this._eventBus._off("editorsrendered",onEditorsRendered);t()}};this._eventBus.on("editorsrendered",onEditorsRendered);await i}getSignature(e){tools_classPrivateFieldGet(ft,this)?.getSignature({uiManager:this,editor:e})}get signatureManager(){return tools_classPrivateFieldGet(ft,this)}switchToMode(e,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal});this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch("setpreference",{source:this,name:e,value:t})}onSetPreference(e){let{name:t,value:i}=e;if("enableNewAltTextWhenAddingImage"===t)tools_classPrivateFieldSet(Ye,this,i)}onPageChanging(e){let{pageNumber:t}=e;tools_classPrivateFieldSet(Ue,this,t-1)}deletePage(e){for(const t of this.getEditors(e))t.remove();tools_classPrivateFieldGet(Te,this).delete(e);tools_classPrivateFieldGet(Ue,this)===e&&tools_classPrivateFieldSet(Ue,this,0)}focusMainContainer(){tools_classPrivateFieldGet(yt,this).focus()}findParent(e,t){for(const i of tools_classPrivateFieldGet(Te,this).values()){const{x:a,y:s,width:n,height:r}=i.div.getBoundingClientRect();if(e>=a&&e<=a+n&&t>=s&&t<=s+r)return i}return null}disableUserSelect(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];tools_classPrivateFieldGet(St,this).classList.toggle("noUserSelect",e)}addShouldRescale(e){tools_classPrivateFieldGet(qe,this).add(e)}removeShouldRescale(e){tools_classPrivateFieldGet(qe,this).delete(e)}onScaleChanging(e){let{scale:t}=e;this.commitOrRemove();this.viewParameters.realScale=t*PixelsPerInch.PDF_TO_CSS_UNITS;for(const e of tools_classPrivateFieldGet(qe,this))e.onScaleChanging();tools_classPrivateFieldGet(Ve,this)?.onScaleChanging()}onRotationChanging(e){let{pagesRotation:t}=e;this.commitOrRemove();this.viewParameters.rotation=t}highlightSelection(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.getSelection();if(!i||i.isCollapsed)return;const{anchorNode:a,anchorOffset:s,focusNode:n,focusOffset:r}=i,o=i.toString(),l=tools_assertClassBrand(kt,this,_getAnchorElementForSelection).call(this,i).closest(".textLayer"),d=this.getSelectionBoxes(l);if(!d)return;i.empty();const c=tools_assertClassBrand(kt,this,_getLayerForTextLayer).call(this,l),h=tools_classPrivateFieldGet(_t,this)===f.NONE,callback=()=>{const i=c?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:d,anchorNode:a,anchorOffset:s,focusNode:n,focusOffset:r,text:o});h&&this.showAllEditors("highlight",!0,!0);t&&i?.editComment()};h?this.switchToMode(f.HIGHLIGHT,callback):callback()}commentSelection(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.highlightSelection(e,!0)}getAndRemoveDataFromAnnotationStorage(e){if(!tools_classPrivateFieldGet(Re,this))return null;const t=`${g}${e}`,i=tools_classPrivateFieldGet(Re,this).getRawValue(t);i&&tools_classPrivateFieldGet(Re,this).remove(t);return i}addToAnnotationStorage(e){e.isEmpty()||!tools_classPrivateFieldGet(Re,this)||tools_classPrivateFieldGet(Re,this).has(e.id)||tools_classPrivateFieldGet(Re,this).setValue(e.id,e)}a11yAlert(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=tools_classPrivateFieldGet(Ct,this);if(i){i.setAttribute("data-l10n-id",e);t?i.setAttribute("data-l10n-args",JSON.stringify(t)):i.removeAttribute("data-l10n-args")}}blur(){this.isShiftKeyDown=!1;if(tools_classPrivateFieldGet(tt,this)){tools_classPrivateFieldSet(tt,this,!1);tools_assertClassBrand(kt,this,_onSelectEnd).call(this,"main_toolbar")}if(!this.hasSelection)return;const{activeElement:e}=document;for(const t of tools_classPrivateFieldGet(pt,this))if(t.div.contains(e)){tools_classPrivateFieldSet(dt,this,[t,e]);t._focusEventsAllowed=!1;break}}focus(){if(!tools_classPrivateFieldGet(dt,this))return;const[e,t]=tools_classPrivateFieldGet(dt,this);tools_classPrivateFieldSet(dt,this,null);t.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal});t.focus()}addEditListeners(){tools_assertClassBrand(kt,this,_addKeyboardManager).call(this);this.setEditingState(!0)}removeEditListeners(){tools_assertClassBrand(kt,this,_removeKeyboardManager).call(this);this.setEditingState(!1)}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const i of tools_classPrivateFieldGet($e,this))if(i.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect="copy";e.preventDefault();return}}drop(e){for(const t of e.dataTransfer.items)for(const i of tools_classPrivateFieldGet($e,this))if(i.isHandlingMimeForPasting(t.type)){i.paste(t,this.currentLayer);e.preventDefault();return}}copy(e){e.preventDefault();tools_classPrivateFieldGet(Be,this)?.commitOrRemove();if(!this.hasSelection)return;const t=[];for(const e of tools_classPrivateFieldGet(pt,this)){const i=e.serialize(!0);i&&t.push(i)}0!==t.length&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e);this.delete()}async paste(e){e.preventDefault();const{clipboardData:t}=e;for(const e of t.items)for(const t of tools_classPrivateFieldGet($e,this))if(t.isHandlingMimeForPasting(e.type)){t.paste(e,this.currentLayer);return}const i=t.getData("application/pdfjs");await this.addSerializedEditor(i)}async addSerializedEditor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(!e)return;try{"string"==typeof e&&(e=JSON.parse(e))}catch(e){warn(`paste: "${e.message}".`);return}if(!Array.isArray(e))return;const s=tools_classPrivateFieldGet(_t,this);t&&s===f.NONE&&this.updateMode(f.FREETEXT);this.unselectAll();try{const t=[];for(const s of e){const e=void 0===s.pageIndex,n=a||e?this.currentLayer:this.getLayer(s.pageIndex),r=await n.deserialize(s);if(!r)return;r.doNotMove=i;t.push(r)}const cmd=()=>{for(const e of t)tools_assertClassBrand(kt,this,_addEditorToLayer).call(this,e);tools_assertClassBrand(kt,this,_selectEditors).call(this,t)},undo=()=>{for(const e of t)e.remove()};this.addCommands({cmd,undo,mustExec:!0})}catch(e){warn(`paste: "${e.message}".`)}t&&s!==tools_classPrivateFieldGet(_t,this)&&this.updateMode(s)}keydown(e){this.isShiftKeyDown||"Shift"!==e.key||(this.isShiftKeyDown=!0);tools_classPrivateFieldGet(_t,this)===f.NONE||this.isEditorHandlingKeyboard||AnnotationEditorUIManager._keyboardManager.exec(this,e)}keyup(e){if(this.isShiftKeyDown&&"Shift"===e.key){this.isShiftKeyDown=!1;if(tools_classPrivateFieldGet(tt,this)){tools_classPrivateFieldSet(tt,this,!1);tools_assertClassBrand(kt,this,_onSelectEnd).call(this,"main_toolbar")}}}onEditingAction(e){let{name:t}=e;switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu")}}updatePageIndex(e,t){for(const i of this.getEditors(e))i.pageIndex=t;const i=tools_classPrivateFieldGet(De,this).get(e);if(i){i.pageIndex=t;tools_classPrivateFieldGet(Te,this).set(t,i);tools_classPrivateFieldGet(nt,this)?i.enable():i.disable()}}startUpdatePages(){tools_classPrivateFieldSet(De,this,new Map(tools_classPrivateFieldGet(Te,this)));tools_classPrivateFieldGet(Te,this).clear()}endUpdatePages(){tools_classPrivateFieldSet(De,this,null)}clonePage(e,t){for(const i of this.getEditors(e)){const e=i.serialize(i.mode!==f.HIGHLIGHT);if(e){e.pageIndex=t;e.id=this.getId();e.isClone=!0;delete e.popupRef;tools_classPrivateFieldGet(Re,this).setValue(e.id,e)}}}findClonesForPage(e){const t=[],{pageIndex:i}=e;for(const[a,s]of tools_classPrivateFieldGet(Re,this))if(s.pageIndex===i&&s.isClone){tools_classPrivateFieldGet(Re,this).remove(a);t.push(e.deserialize(s).then(t=>{if(t){t.isClone=!0;e.addOrRebuild(t)}}))}return Promise.all(t)}setEditingState(e){if(e){tools_assertClassBrand(kt,this,_addFocusManager).call(this);tools_assertClassBrand(kt,this,_addCopyPasteListeners).call(this);tools_assertClassBrand(kt,this,_dispatchUpdateStates).call(this,{isEditing:tools_classPrivateFieldGet(_t,this)!==f.NONE,isEmpty:tools_assertClassBrand(kt,this,_isEmpty).call(this),hasSomethingToUndo:tools_classPrivateFieldGet(Oe,this).hasSomethingToUndo(),hasSomethingToRedo:tools_classPrivateFieldGet(Oe,this).hasSomethingToRedo(),hasSelectedEditor:!1})}else{tools_assertClassBrand(kt,this,_removeFocusManager).call(this);tools_assertClassBrand(kt,this,_removeCopyPasteListeners).call(this);tools_assertClassBrand(kt,this,_dispatchUpdateStates).call(this,{isEditing:!1});this.disableUserSelect(!1)}}registerEditorTypes(e){if(!tools_classPrivateFieldGet($e,this)){tools_classPrivateFieldSet($e,this,e);for(const e of tools_classPrivateFieldGet($e,this))tools_assertClassBrand(kt,this,_dispatchUpdateUI).call(this,e.defaultPropertiesToUpdate)}}getId(){return tools_classPrivateFieldGet(st,this).id}get currentLayer(){return tools_classPrivateFieldGet(Te,this).get(tools_classPrivateFieldGet(Ue,this))}getLayer(e){return tools_classPrivateFieldGet(Te,this).get(e)}get currentPageIndex(){return tools_classPrivateFieldGet(Ue,this)}addLayer(e){tools_classPrivateFieldGet(Te,this).set(e.pageIndex,e);tools_classPrivateFieldGet(nt,this)?e.enable():e.disable()}removeLayer(e){tools_classPrivateFieldGet(Te,this).delete(e.pageIndex)}async updateMode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],n=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(tools_classPrivateFieldGet(_t,this)!==e){if(tools_classPrivateFieldGet(xt,this)){await tools_classPrivateFieldGet(xt,this).promise;if(!tools_classPrivateFieldGet(xt,this))return}tools_classPrivateFieldSet(xt,this,Promise.withResolvers());tools_classPrivateFieldGet(Ve,this)?.commitOrRemove();tools_classPrivateFieldGet(_t,this)===f.POPUP&&tools_classPrivateFieldGet(We,this)?.hideSidebar();tools_classPrivateFieldGet(We,this)?.destroyPopup();tools_classPrivateFieldSet(_t,this,e);if(e!==f.NONE){for(const e of tools_classPrivateFieldGet(Ie,this).values())e.addStandaloneCommentButton();e===f.SIGNATURE&&await(tools_classPrivateFieldGet(ft,this)?.loadSignatures());i&&CurrentPointers.clearPointerType();this.setEditingState(!0);await tools_assertClassBrand(kt,this,_enableAll).call(this);this.unselectAll();for(const t of tools_classPrivateFieldGet(Te,this).values())t.updateMode(e);if(e===f.POPUP){tools_classPrivateFieldGet(Me,this)||tools_classPrivateFieldSet(Me,this,await tools_classPrivateFieldGet(Pt,this).getAnnotationsByType(new Set(tools_classPrivateFieldGet($e,this).map(e=>e._editorType))));const e=new Set,t=[];for(const i of tools_classPrivateFieldGet(Ie,this).values()){const{annotationElementId:a,hasComment:s,deleted:n}=i;a&&e.add(a);s&&!n&&t.push(i.getData())}for(const i of tools_classPrivateFieldGet(Me,this)){const{id:a,popupRef:s,contentsObj:n}=i;s&&n?.str&&!e.has(a)&&!tools_classPrivateFieldGet(ze,this).has(a)&&t.push(i)}tools_classPrivateFieldGet(We,this)?.showSidebar(t)}if(t){for(const e of tools_classPrivateFieldGet(Ie,this).values())if(e.uid===t){this.setSelected(e);n?e.editComment():s?e.enterInEditMode():e.focus()}else e.unselect();tools_classPrivateFieldGet(xt,this).resolve()}else{a&&this.addNewEditorFromKeyboard();tools_classPrivateFieldGet(xt,this).resolve()}}else{this.setEditingState(!1);tools_assertClassBrand(kt,this,_disableAll).call(this);for(const e of tools_classPrivateFieldGet(Ie,this).values())e.hideStandaloneCommentButton();this._editorUndoBar?.hide();this.toggleComment(null);tools_classPrivateFieldGet(xt,this).resolve()}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==tools_classPrivateFieldGet(_t,this)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,t){if(tools_classPrivateFieldGet($e,this)){switch(e){case m.CREATE:this.currentLayer.addNewEditor(t);return;case m.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}});(tools_classPrivateFieldGet(vt,this)||tools_classPrivateFieldSet(vt,this,new Map)).set(e,t);this.showAllEditors("highlight",t)}if(this.hasSelection){for(const i of tools_classPrivateFieldGet(pt,this))i.updateParams(e,t);if(e===m.HIGHLIGHT_COLOR||e===m.HIGHLIGHT_THICKNESS)for(const i of tools_classPrivateFieldGet($e,this))i.updateDefaultParams(e,t)}else for(const i of tools_classPrivateFieldGet($e,this))i.updateDefaultParams(e,t)}}showAllEditors(e,t){for(const i of tools_classPrivateFieldGet(Ie,this).values())i.editorType===e&&i.show(t);(tools_classPrivateFieldGet(vt,this)?.get(m.HIGHLIGHT_SHOW_ALL)??!0)!==t&&tools_assertClassBrand(kt,this,_dispatchUpdateUI).call(this,[[m.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(tools_classPrivateFieldGet(ot,this)!==e){tools_classPrivateFieldSet(ot,this,e);for(const t of tools_classPrivateFieldGet(Te,this).values()){e?t.disableClick():t.enableClick();t.div.classList.toggle("waiting",e)}}}*getEditors(e){for(const t of tools_classPrivateFieldGet(Ie,this).values())t.pageIndex===e&&(yield t)}getEditor(e){return tools_classPrivateFieldGet(Ie,this).get(e)}addEditor(e){tools_classPrivateFieldGet(Ie,this).set(e.id,e)}removeEditor(e){if(e.div.contains(document.activeElement)){tools_classPrivateFieldGet(Je,this)&&clearTimeout(tools_classPrivateFieldGet(Je,this));tools_classPrivateFieldSet(Je,this,setTimeout(()=>{this.focusMainContainer();tools_classPrivateFieldSet(Je,this,null)},0))}tools_classPrivateFieldGet(Ie,this).delete(e.id);e.annotationElementId&&tools_classPrivateFieldGet(ht,this)?.delete(e.annotationElementId);this.unselect(e);e.annotationElementId&&tools_classPrivateFieldGet(ze,this).has(e.annotationElementId)||tools_classPrivateFieldGet(Re,this)?.remove(e.id)}addDeletedAnnotationElement(e){tools_classPrivateFieldGet(ze,this).add(e.annotationElementId);this.addChangedExistingAnnotation(e);e.deleted=!0}isDeletedAnnotationElement(e){return tools_classPrivateFieldGet(ze,this).has(e)}removeDeletedAnnotationElement(e){tools_classPrivateFieldGet(ze,this).delete(e.annotationElementId);this.removeChangedExistingAnnotation(e);e.deleted=!1}setActiveEditor(e){if(tools_classPrivateFieldGet(Be,this)!==e){tools_classPrivateFieldSet(Be,this,e);e&&tools_assertClassBrand(kt,this,_dispatchUpdateUI).call(this,e.propertiesToUpdate)}}updateUI(e){(function tools_classPrivateGetter(e,t,i){return i(tools_assertClassBrand(e,t))})(kt,this,_get_lastSelectedEditor)===e&&tools_assertClassBrand(kt,this,_dispatchUpdateUI).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){tools_assertClassBrand(kt,this,_dispatchUpdateUI).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(tools_classPrivateFieldGet(pt,this).has(e)){tools_classPrivateFieldGet(pt,this).delete(e);e.unselect();tools_assertClassBrand(kt,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:this.hasSelection})}else{tools_classPrivateFieldGet(pt,this).add(e);e.select();tools_assertClassBrand(kt,this,_dispatchUpdateUI).call(this,e.propertiesToUpdate);tools_assertClassBrand(kt,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:!0})}}setSelected(e){this.updateToolbar({mode:e.mode,editId:e.uid});tools_classPrivateFieldGet(Ve,this)?.commitOrRemove();for(const t of tools_classPrivateFieldGet(pt,this))t!==e&&t.unselect();tools_classPrivateFieldGet(We,this)?.destroyPopup();tools_classPrivateFieldGet(pt,this).clear();tools_classPrivateFieldGet(pt,this).add(e);e.select();tools_assertClassBrand(kt,this,_dispatchUpdateUI).call(this,e.propertiesToUpdate);tools_assertClassBrand(kt,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:!0})}isSelected(e){return tools_classPrivateFieldGet(pt,this).has(e)}get firstSelectedEditor(){return tools_classPrivateFieldGet(pt,this).values().next().value}unselect(e){e.unselect();tools_classPrivateFieldGet(pt,this).delete(e);tools_assertClassBrand(kt,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==tools_classPrivateFieldGet(pt,this).size}get isEnterHandled(){return 1===tools_classPrivateFieldGet(pt,this).size&&this.firstSelectedEditor.isEnterHandled}undo(){tools_classPrivateFieldGet(Oe,this).undo();tools_assertClassBrand(kt,this,_dispatchUpdateStates).call(this,{hasSomethingToUndo:tools_classPrivateFieldGet(Oe,this).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:tools_assertClassBrand(kt,this,_isEmpty).call(this)});this._editorUndoBar?.hide()}redo(){tools_classPrivateFieldGet(Oe,this).redo();tools_assertClassBrand(kt,this,_dispatchUpdateStates).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:tools_classPrivateFieldGet(Oe,this).hasSomethingToRedo(),isEmpty:tools_assertClassBrand(kt,this,_isEmpty).call(this)})}addCommands(e){tools_classPrivateFieldGet(Oe,this).add(e);tools_assertClassBrand(kt,this,_dispatchUpdateStates).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:tools_assertClassBrand(kt,this,_isEmpty).call(this)})}cleanUndoStack(e){tools_classPrivateFieldGet(Oe,this).cleanType(e)}delete(){this.commitOrRemove();const e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const t=e?[e]:[...tools_classPrivateFieldGet(pt,this)],undo=()=>{for(const e of t)tools_assertClassBrand(kt,this,_addEditorToLayer).call(this,e)};this.addCommands({cmd:()=>{this._editorUndoBar?.show(undo,1===t.length?t[0].editorType:t.length);for(const e of t)e.remove()},undo,mustExec:!0})}commitOrRemove(){tools_classPrivateFieldGet(Be,this)?.commitOrRemove()}hasSomethingToControl(){return tools_classPrivateFieldGet(Be,this)||this.hasSelection}selectAll(){for(const e of tools_classPrivateFieldGet(pt,this))e.commit();tools_assertClassBrand(kt,this,_selectEditors).call(this,tools_classPrivateFieldGet(Ie,this).values())}unselectAll(){if(tools_classPrivateFieldGet(Be,this)){tools_classPrivateFieldGet(Be,this).commitOrRemove();if(tools_classPrivateFieldGet(_t,this)!==f.NONE)return}if(!tools_classPrivateFieldGet(Ve,this)?.commitOrRemove()){tools_classPrivateFieldGet(We,this)?.destroyPopup();if(this.hasSelection){for(const e of tools_classPrivateFieldGet(pt,this))e.unselect();tools_classPrivateFieldGet(pt,this).clear();tools_assertClassBrand(kt,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:!1})}}}translateSelectedEditors(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2]||this.commitOrRemove();if(!this.hasSelection)return;tools_classPrivateFieldGet(Ft,this)[0]+=e;tools_classPrivateFieldGet(Ft,this)[1]+=t;const[i,a]=tools_classPrivateFieldGet(Ft,this),s=[...tools_classPrivateFieldGet(pt,this)];tools_classPrivateFieldGet(bt,this)&&clearTimeout(tools_classPrivateFieldGet(bt,this));tools_classPrivateFieldSet(bt,this,setTimeout(()=>{tools_classPrivateFieldSet(bt,this,null);tools_classPrivateFieldGet(Ft,this)[0]=tools_classPrivateFieldGet(Ft,this)[1]=0;this.addCommands({cmd:()=>{for(const e of s)if(tools_classPrivateFieldGet(Ie,this).has(e.id)){e.translateInPage(i,a);e.translationDone()}},undo:()=>{for(const e of s)if(tools_classPrivateFieldGet(Ie,this).has(e.id)){e.translateInPage(-i,-a);e.translationDone()}},mustExec:!1})},1e3));for(const i of s){i.translateInPage(e,t);i.translationDone()}}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0);tools_classPrivateFieldSet(He,this,new Map);for(const e of tools_classPrivateFieldGet(pt,this))tools_classPrivateFieldGet(He,this).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!tools_classPrivateFieldGet(He,this))return!1;this.disableUserSelect(!1);const e=tools_classPrivateFieldGet(He,this);tools_classPrivateFieldSet(He,this,null);let t=!1;for(const[{x:i,y:a,pageIndex:s},n]of e){n.newX=i;n.newY=a;n.newPageIndex=s;t||=i!==n.savedX||a!==n.savedY||s!==n.savedPageIndex}if(!t)return!1;const move=(e,t,i,a)=>{if(tools_classPrivateFieldGet(Ie,this).has(e.id)){const s=tools_classPrivateFieldGet(Te,this).get(a);if(s)e._setParentAndPosition(s,t,i);else{e.pageIndex=a;e.x=t;e.y=i}}};this.addCommands({cmd:()=>{for(const[t,{newX:i,newY:a,newPageIndex:s,savedX:n,savedY:r,savedPageIndex:o}]of e){move(t,i,a,s);this._eventBus?.dispatch("annotation-editor-event",{source:t,type:"moved",page:s+1,editorType:t.constructor.name,id:t.uid,previousValue:{x:n,y:r,page:o+1},value:{x:i,y:a,page:s+1}})}},undo:()=>{for(const[t,{savedX:i,savedY:a,savedPageIndex:s}]of e)move(t,i,a,s)},mustExec:!0});return!0}dragSelectedEditors(e,t){if(tools_classPrivateFieldGet(He,this))for(const i of tools_classPrivateFieldGet(He,this).keys())i.drag(e,t)}rebuild(e){if(null===e.parent){const t=this.getLayer(e.pageIndex);if(t){t.changeParent(e);t.addOrRebuild(e)}else{this.addEditor(e);this.addToAnnotationStorage(e);e.rebuild()}}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||1===tools_classPrivateFieldGet(pt,this).size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return tools_classPrivateFieldGet(Be,this)===e}getActive(){return tools_classPrivateFieldGet(Be,this)}getMode(){return tools_classPrivateFieldGet(_t,this)}isEditingMode(){return tools_classPrivateFieldGet(_t,this)!==f.NONE}get imageManager(){return shadow(this,"imageManager",new ImageManager)}removeEditors(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>!0,t=!1;tools_classPrivateFieldGet(Ie,this).forEach(i=>{if(i?.serialize()&&e(i.serialize())){i.remove();t=!0}});if(t){tools_assertClassBrand(kt,this,_dispatchUpdateStates).call(this,{hasSomethingToUndo:!1,hasSomethingToRedo:!1,isEmpty:tools_assertClassBrand(kt,this,_isEmpty).call(this)});tools_classPrivateFieldGet(Oe,this).reset()}}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let i=0,a=t.rangeCount;i<a;i++)if(!e.contains(t.getRangeAt(i).commonAncestorContainer))return null;const{x:i,y:a,width:s,height:n}=e.getBoundingClientRect();let r;switch(e.getAttribute("data-main-rotation")){case"90":r=(e,t,r,o)=>({x:(t-a)/n,y:1-(e+r-i)/s,width:o/n,height:r/s});break;case"180":r=(e,t,r,o)=>({x:1-(e+r-i)/s,y:1-(t+o-a)/n,width:r/s,height:o/n});break;case"270":r=(e,t,r,o)=>({x:1-(t+o-a)/n,y:(e-i)/s,width:o/n,height:r/s});break;default:r=(e,t,r,o)=>({x:(e-i)/s,y:(t-a)/n,width:r/s,height:o/n})}const o=[];for(let e=0,i=t.rangeCount;e<i;e++){const i=t.getRangeAt(e);if(!i.collapsed)for(const{x:e,y:t,width:a,height:s}of i.getClientRects())0!==a&&0!==s&&o.push(r(e,t,a,s))}return 0===o.length?null:o}addChangedExistingAnnotation(e){let{annotationElementId:t,id:i}=e;(tools_classPrivateFieldGet(Ne,this)||tools_classPrivateFieldSet(Ne,this,new Map)).set(t,i)}removeChangedExistingAnnotation(e){let{annotationElementId:t}=e;tools_classPrivateFieldGet(Ne,this)?.delete(t)}renderAnnotationElement(e){const t=tools_classPrivateFieldGet(Ne,this)?.get(e.data.id);if(!t)return;const i=tools_classPrivateFieldGet(Re,this).getRawValue(t);i&&(tools_classPrivateFieldGet(_t,this)!==f.NONE||i.hasBeenModified)&&i.renderAnnotationElement(e)}setMissingCanvas(e,t,i){const a=tools_classPrivateFieldGet(ht,this)?.get(e);if(a){a.setCanvas(t,i);tools_classPrivateFieldGet(ht,this).delete(e)}}addMissingCanvas(e,t){(tools_classPrivateFieldGet(ht,this)||tools_classPrivateFieldSet(ht,this,new Map)).set(e,t)}}function _getAnchorElementForSelection(e){let{anchorNode:t}=e;return t.nodeType===Node.TEXT_NODE?t.parentElement:t}function _getLayerForTextLayer(e){const{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(const t of tools_classPrivateFieldGet(Te,this).values())if(t.hasTextLayer(e))return t;return null}function _beforeUnload(e){this.commitOrRemove();this.currentLayer?.endDrawingSession(!1)}function _displayFloatingToolbar(){const e=document.getSelection();if(!e||e.isCollapsed)return;const t=tools_assertClassBrand(kt,this,_getAnchorElementForSelection).call(this,e).closest(".textLayer"),i=this.getSelectionBoxes(t);if(i){tools_classPrivateFieldGet(it,this)||tools_classPrivateFieldSet(it,this,new FloatingToolbar(this));tools_classPrivateFieldGet(it,this).show(t,i,"ltr"===this.direction)}}function _selectionChange(){const e=document.getSelection();if(!e||e.isCollapsed){if(tools_classPrivateFieldGet(gt,this)){tools_classPrivateFieldGet(it,this)?.hide();tools_classPrivateFieldSet(gt,this,null);tools_assertClassBrand(kt,this,_dispatchUpdateStates).call(this,{hasSelectedText:!1})}return}const{anchorNode:t}=e;if(t===tools_classPrivateFieldGet(gt,this))return;const i=tools_assertClassBrand(kt,this,_getAnchorElementForSelection).call(this,e).closest(".textLayer");if(i){tools_classPrivateFieldGet(it,this)?.hide();tools_classPrivateFieldSet(gt,this,t);tools_assertClassBrand(kt,this,_dispatchUpdateStates).call(this,{hasSelectedText:!0});if(tools_classPrivateFieldGet(_t,this)===f.HIGHLIGHT||tools_classPrivateFieldGet(_t,this)===f.NONE){tools_classPrivateFieldGet(_t,this)===f.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0);tools_classPrivateFieldSet(tt,this,this.isShiftKeyDown);if(!this.isShiftKeyDown){const e=tools_classPrivateFieldGet(_t,this)===f.HIGHLIGHT?tools_assertClassBrand(kt,this,_getLayerForTextLayer).call(this,i):null;e?.toggleDrawing();if(tools_classPrivateFieldGet(rt,this)){const t=new AbortController,i=this.combinedSignal(t),pointerup=i=>{if("pointerup"!==i.type||0===i.button){t.abort();e?.toggleDrawing(!0);"pointerup"===i.type&&tools_assertClassBrand(kt,this,_onSelectEnd).call(this,"main_toolbar")}};window.addEventListener("pointerup",pointerup,{signal:i});window.addEventListener("blur",pointerup,{signal:i})}else{e?.toggleDrawing(!0);tools_assertClassBrand(kt,this,_onSelectEnd).call(this,"main_toolbar")}}}}else if(tools_classPrivateFieldGet(gt,this)){tools_classPrivateFieldGet(it,this)?.hide();tools_classPrivateFieldSet(gt,this,null);tools_assertClassBrand(kt,this,_dispatchUpdateStates).call(this,{hasSelectedText:!1})}}function _onSelectEnd(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";tools_classPrivateFieldGet(_t,this)===f.HIGHLIGHT?this.highlightSelection(e):tools_classPrivateFieldGet(Xe,this)&&tools_assertClassBrand(kt,this,_displayFloatingToolbar).call(this)}function _addSelectionListener(){document.addEventListener("selectionchange",tools_assertClassBrand(kt,this,_selectionChange).bind(this),{signal:this._signal})}function _addFocusManager(){if(tools_classPrivateFieldGet(Qe,this))return;tools_classPrivateFieldSet(Qe,this,new AbortController);const e=this.combinedSignal(tools_classPrivateFieldGet(Qe,this));window.addEventListener("focus",this.focus.bind(this),{signal:e});window.addEventListener("blur",this.blur.bind(this),{signal:e})}function _removeFocusManager(){tools_classPrivateFieldGet(Qe,this)?.abort();tools_classPrivateFieldSet(Qe,this,null)}function _addKeyboardManager(){if(tools_classPrivateFieldGet(lt,this))return;tools_classPrivateFieldSet(lt,this,new AbortController);const e=this.combinedSignal(tools_classPrivateFieldGet(lt,this));window.addEventListener("keydown",this.keydown.bind(this),{signal:e});window.addEventListener("keyup",this.keyup.bind(this),{signal:e})}function _removeKeyboardManager(){tools_classPrivateFieldGet(lt,this)?.abort();tools_classPrivateFieldSet(lt,this,null)}function _addCopyPasteListeners(){if(tools_classPrivateFieldGet(je,this))return;tools_classPrivateFieldSet(je,this,new AbortController);const e=this.combinedSignal(tools_classPrivateFieldGet(je,this));document.addEventListener("copy",this.copy.bind(this),{signal:e});document.addEventListener("cut",this.cut.bind(this),{signal:e});document.addEventListener("paste",this.paste.bind(this),{signal:e})}function _removeCopyPasteListeners(){tools_classPrivateFieldGet(je,this)?.abort();tools_classPrivateFieldSet(je,this,null)}function _addDragAndDropListeners(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e});document.addEventListener("drop",this.drop.bind(this),{signal:e})}function _dispatchUpdateStates(e){if(Object.entries(e).some(e=>{let[t,i]=e;return tools_classPrivateFieldGet(wt,this)[t]!==i})){this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(tools_classPrivateFieldGet(wt,this),e)});tools_classPrivateFieldGet(_t,this)===f.HIGHLIGHT&&!1===e.hasSelectedEditor&&tools_assertClassBrand(kt,this,_dispatchUpdateUI).call(this,[[m.HIGHLIGHT_FREE,!0]])}}function _dispatchUpdateUI(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}async function _enableAll(){if(!tools_classPrivateFieldGet(nt,this)){tools_classPrivateFieldSet(nt,this,!0);const e=[];for(const t of tools_classPrivateFieldGet(Te,this).values())e.push(t.enable());await Promise.all(e);for(const e of tools_classPrivateFieldGet(Ie,this).values())e.enable()}}function _disableAll(){this.unselectAll();if(tools_classPrivateFieldGet(nt,this)){tools_classPrivateFieldSet(nt,this,!1);for(const e of tools_classPrivateFieldGet(Te,this).values())e.disable();for(const e of tools_classPrivateFieldGet(Ie,this).values())e.disable()}}function _addEditorToLayer(e){const t=tools_classPrivateFieldGet(Te,this).get(e.pageIndex);if(t)t.addOrRebuild(e);else{this.addEditor(e);this.addToAnnotationStorage(e)}}function _get_lastSelectedEditor(e){let t=null;for(t of tools_classPrivateFieldGet(pt,e));return t}function _isEmpty(){if(0===tools_classPrivateFieldGet(Ie,this).size)return!0;if(1===tools_classPrivateFieldGet(Ie,this).size)for(const e of tools_classPrivateFieldGet(Ie,this).values())return e.isEmpty();return!1}function _selectEditors(e){for(const e of tools_classPrivateFieldGet(pt,this))e.unselect();tools_classPrivateFieldGet(pt,this).clear();for(const t of e)if(!t.isEmpty()){tools_classPrivateFieldGet(pt,this).add(t);t.select()}tools_assertClassBrand(kt,this,_dispatchUpdateStates).call(this,{hasSelectedEditor:this.hasSelection})}tools_defineProperty(AnnotationEditorUIManager,"TRANSLATE_SMALL",1);tools_defineProperty(AnnotationEditorUIManager,"TRANSLATE_BIG",10);function alt_text_classPrivateFieldInitSpec(e,t,i){alt_text_checkPrivateRedeclaration(e,t),t.set(e,i)}function alt_text_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function alt_text_classPrivateGetter(e,t,i){return i(alt_text_assertClassBrand(e,t))}function alt_text_classPrivateFieldGet(e,t){return e.get(alt_text_assertClassBrand(e,t))}function alt_text_classPrivateFieldSet(e,t,i){return e.set(alt_text_assertClassBrand(e,t),i),i}function alt_text_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Et=new WeakMap,At=new WeakMap,Gt=new WeakMap,Bt=new WeakMap,Mt=new WeakMap,It=new WeakMap,Tt=new WeakMap,Dt=new WeakMap,Lt=new WeakMap,Rt=new WeakMap,Nt=new WeakMap,Ot=new WeakMap,Wt=new WeakSet;class AltText{constructor(e){!function alt_text_classPrivateMethodInitSpec(e,t){alt_text_checkPrivateRedeclaration(e,t),t.add(e)}(this,Wt);alt_text_classPrivateFieldInitSpec(this,Et,null);alt_text_classPrivateFieldInitSpec(this,At,!1);alt_text_classPrivateFieldInitSpec(this,Gt,null);alt_text_classPrivateFieldInitSpec(this,Bt,null);alt_text_classPrivateFieldInitSpec(this,Mt,null);alt_text_classPrivateFieldInitSpec(this,It,null);alt_text_classPrivateFieldInitSpec(this,Tt,!1);alt_text_classPrivateFieldInitSpec(this,Dt,null);alt_text_classPrivateFieldInitSpec(this,Lt,null);alt_text_classPrivateFieldInitSpec(this,Rt,null);alt_text_classPrivateFieldInitSpec(this,Nt,null);alt_text_classPrivateFieldInitSpec(this,Ot,!1);alt_text_classPrivateFieldSet(Lt,this,e);alt_text_classPrivateFieldSet(Ot,this,e._uiManager.useNewAltTextFlow);jt._||(jt._=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(e){AltText._l10n??=e}async render(){const e=alt_text_classPrivateFieldSet(Gt,this,document.createElement("button"));e.className="altText";e.tabIndex="0";const t=alt_text_classPrivateFieldSet(Bt,this,document.createElement("span"));e.append(t);if(alt_text_classPrivateFieldGet(Ot,this)){e.classList.add("new");e.setAttribute("data-l10n-id",jt._.missing);t.setAttribute("data-l10n-id",jt._["missing-label"])}else{e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button");t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label")}const i=alt_text_classPrivateFieldGet(Lt,this)._uiManager._signal;e.addEventListener("contextmenu",noContextMenu,{signal:i});e.addEventListener("pointerdown",e=>e.stopPropagation(),{signal:i});const onClick=e=>{e.preventDefault();alt_text_classPrivateFieldGet(Lt,this)._uiManager.editAltText(alt_text_classPrivateFieldGet(Lt,this));alt_text_classPrivateFieldGet(Ot,this)&&alt_text_classPrivateFieldGet(Lt,this)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:alt_text_classPrivateGetter(Wt,this,_get_label)}})};e.addEventListener("click",onClick,{capture:!0,signal:i});e.addEventListener("keydown",t=>{if(t.target===e&&"Enter"===t.key){alt_text_classPrivateFieldSet(Tt,this,!0);onClick(t)}},{signal:i});await alt_text_assertClassBrand(Wt,this,_setState).call(this);return e}finish(){if(alt_text_classPrivateFieldGet(Gt,this)){alt_text_classPrivateFieldGet(Gt,this).focus({focusVisible:alt_text_classPrivateFieldGet(Tt,this)});alt_text_classPrivateFieldSet(Tt,this,!1)}}isEmpty(){return alt_text_classPrivateFieldGet(Ot,this)?null===alt_text_classPrivateFieldGet(Et,this):!alt_text_classPrivateFieldGet(Et,this)&&!alt_text_classPrivateFieldGet(At,this)}hasData(){return alt_text_classPrivateFieldGet(Ot,this)?null!==alt_text_classPrivateFieldGet(Et,this)||!!alt_text_classPrivateFieldGet(Rt,this):this.isEmpty()}get guessedText(){return alt_text_classPrivateFieldGet(Rt,this)}async setGuessedText(e){if(null===alt_text_classPrivateFieldGet(Et,this)){alt_text_classPrivateFieldSet(Rt,this,e);alt_text_classPrivateFieldSet(Nt,this,await AltText._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e}));alt_text_assertClassBrand(Wt,this,_setState).call(this)}}toggleAltTextBadge(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(alt_text_classPrivateFieldGet(Ot,this)&&!alt_text_classPrivateFieldGet(Et,this)){if(!alt_text_classPrivateFieldGet(Dt,this)){const e=alt_text_classPrivateFieldSet(Dt,this,document.createElement("div"));e.className="noAltTextBadge";alt_text_classPrivateFieldGet(Lt,this).div.append(e)}alt_text_classPrivateFieldGet(Dt,this).classList.toggle("hidden",!e)}else{alt_text_classPrivateFieldGet(Dt,this)?.remove();alt_text_classPrivateFieldSet(Dt,this,null)}}serialize(e){let t=alt_text_classPrivateFieldGet(Et,this);e||alt_text_classPrivateFieldGet(Rt,this)!==t||(t=alt_text_classPrivateFieldGet(Nt,this));return{altText:t,decorative:alt_text_classPrivateFieldGet(At,this),guessedText:alt_text_classPrivateFieldGet(Rt,this),textWithDisclaimer:alt_text_classPrivateFieldGet(Nt,this)}}get data(){return{altText:alt_text_classPrivateFieldGet(Et,this),decorative:alt_text_classPrivateFieldGet(At,this)}}set data(e){let{altText:t,decorative:i,guessedText:a,textWithDisclaimer:s,cancel:n=!1}=e;if(a){alt_text_classPrivateFieldSet(Rt,this,a);alt_text_classPrivateFieldSet(Nt,this,s)}if(alt_text_classPrivateFieldGet(Et,this)!==t||alt_text_classPrivateFieldGet(At,this)!==i){if(!n){alt_text_classPrivateFieldSet(Et,this,t);alt_text_classPrivateFieldSet(At,this,i)}alt_text_assertClassBrand(Wt,this,_setState).call(this)}}toggle(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(alt_text_classPrivateFieldGet(Gt,this)){if(!e&&alt_text_classPrivateFieldGet(It,this)){clearTimeout(alt_text_classPrivateFieldGet(It,this));alt_text_classPrivateFieldSet(It,this,null)}alt_text_classPrivateFieldGet(Gt,this).disabled=!e}}shown(){alt_text_classPrivateFieldGet(Lt,this)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:alt_text_classPrivateGetter(Wt,this,_get_label)}})}destroy(){alt_text_classPrivateFieldGet(Gt,this)?.remove();alt_text_classPrivateFieldSet(Gt,this,null);alt_text_classPrivateFieldSet(Bt,this,null);alt_text_classPrivateFieldSet(Mt,this,null);alt_text_classPrivateFieldGet(Dt,this)?.remove();alt_text_classPrivateFieldSet(Dt,this,null)}}function _get_label(e){return(alt_text_classPrivateFieldGet(Et,e)?"added":null===alt_text_classPrivateFieldGet(Et,e)&&e.guessedText&&"review")||"missing"}async function _setState(){const e=alt_text_classPrivateFieldGet(Gt,this);if(!e)return;if(alt_text_classPrivateFieldGet(Ot,this)){e.classList.toggle("done",!!alt_text_classPrivateFieldGet(Et,this));e.setAttribute("data-l10n-id",jt._[alt_text_classPrivateGetter(Wt,this,_get_label)]);alt_text_classPrivateFieldGet(Bt,this)?.setAttribute("data-l10n-id",jt._[`${alt_text_classPrivateGetter(Wt,this,_get_label)}-label`]);if(!alt_text_classPrivateFieldGet(Et,this)){alt_text_classPrivateFieldGet(Mt,this)?.remove();return}}else{if(!alt_text_classPrivateFieldGet(Et,this)&&!alt_text_classPrivateFieldGet(At,this)){e.classList.remove("done");alt_text_classPrivateFieldGet(Mt,this)?.remove();return}e.classList.add("done");e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let t=alt_text_classPrivateFieldGet(Mt,this);if(!t){alt_text_classPrivateFieldSet(Mt,this,t=document.createElement("span"));t.className="tooltip";t.setAttribute("role","tooltip");t.id=`alt-text-tooltip-${alt_text_classPrivateFieldGet(Lt,this).id}`;const i=100,a=alt_text_classPrivateFieldGet(Lt,this)._uiManager._signal;a.addEventListener("abort",()=>{clearTimeout(alt_text_classPrivateFieldGet(It,this));alt_text_classPrivateFieldSet(It,this,null)},{once:!0});e.addEventListener("mouseenter",()=>{alt_text_classPrivateFieldSet(It,this,setTimeout(()=>{alt_text_classPrivateFieldSet(It,this,null);alt_text_classPrivateFieldGet(Mt,this).classList.add("show");alt_text_classPrivateFieldGet(Lt,this)._reportTelemetry({action:"alt_text_tooltip"})},i))},{signal:a});e.addEventListener("mouseleave",()=>{if(alt_text_classPrivateFieldGet(It,this)){clearTimeout(alt_text_classPrivateFieldGet(It,this));alt_text_classPrivateFieldSet(It,this,null)}alt_text_classPrivateFieldGet(Mt,this)?.classList.remove("show")},{signal:a})}if(alt_text_classPrivateFieldGet(At,this))t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip");else{t.removeAttribute("data-l10n-id");t.textContent=alt_text_classPrivateFieldGet(Et,this)}t.parentNode||e.append(t);const i=alt_text_classPrivateFieldGet(Lt,this).getElementForAltText();i?.setAttribute("aria-describedby",t.id)}var jt={_:null};!function alt_text_defineProperty(e,t,i){return(t=function alt_text_toPropertyKey(e){var t=function alt_text_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}(AltText,"_l10n",null);function comment_classPrivateFieldInitSpec(e,t,i){comment_checkPrivateRedeclaration(e,t),t.set(e,i)}function comment_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function comment_classPrivateFieldGet(e,t){return e.get(comment_assertClassBrand(e,t))}function comment_classPrivateFieldSet(e,t,i){return e.set(comment_assertClassBrand(e,t),i),i}function comment_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Vt,Ut=new WeakMap,zt=new WeakMap,Ht=new WeakMap,$t=new WeakMap,qt=new WeakMap,Xt=new WeakMap,Kt=new WeakMap,Yt=new WeakMap,Zt=new WeakMap,Jt=new WeakMap,Qt=new WeakSet;class Comment{constructor(e){!function comment_classPrivateMethodInitSpec(e,t){comment_checkPrivateRedeclaration(e,t),t.add(e)}(this,Qt);comment_classPrivateFieldInitSpec(this,Ut,null);comment_classPrivateFieldInitSpec(this,zt,null);comment_classPrivateFieldInitSpec(this,Ht,!1);comment_classPrivateFieldInitSpec(this,$t,null);comment_classPrivateFieldInitSpec(this,qt,null);comment_classPrivateFieldInitSpec(this,Xt,null);comment_classPrivateFieldInitSpec(this,Kt,null);comment_classPrivateFieldInitSpec(this,Yt,null);comment_classPrivateFieldInitSpec(this,Zt,!1);comment_classPrivateFieldInitSpec(this,Jt,null);comment_classPrivateFieldSet($t,this,e)}renderForToolbar(){const e=comment_classPrivateFieldSet(zt,this,document.createElement("button"));e.className="comment";return comment_assertClassBrand(Qt,this,comment_render).call(this,e,!1)}renderForStandalone(){const e=comment_classPrivateFieldSet(Ut,this,document.createElement("button"));e.className="annotationCommentButton";const t=comment_classPrivateFieldGet($t,this).commentButtonPosition;if(t){const{style:i}=e;i.insetInlineEnd=`calc(${100*("ltr"===comment_classPrivateFieldGet($t,this)._uiManager.direction?1-t[0]:t[0])}% - var(--comment-button-dim))`;i.top=`calc(${100*t[1]}% - var(--comment-button-dim))`;const a=comment_classPrivateFieldGet($t,this).commentButtonColor;a&&(i.backgroundColor=a)}return comment_assertClassBrand(Qt,this,comment_render).call(this,e,!0)}focusButton(){setTimeout(()=>{(comment_classPrivateFieldGet(Ut,this)??comment_classPrivateFieldGet(zt,this))?.focus()},0)}onUpdatedColor(){if(!comment_classPrivateFieldGet(Ut,this))return;const e=comment_classPrivateFieldGet($t,this).commentButtonColor;e&&(comment_classPrivateFieldGet(Ut,this).style.backgroundColor=e);comment_classPrivateFieldGet($t,this)._uiManager.updatePopupColor(comment_classPrivateFieldGet($t,this))}get commentButtonWidth(){return(comment_classPrivateFieldGet(Ut,this)?.getBoundingClientRect().width??0)/comment_classPrivateFieldGet($t,this).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(comment_classPrivateFieldGet(Jt,this))return comment_classPrivateFieldGet(Jt,this);if(!comment_classPrivateFieldGet(Ut,this))return null;const{x:e,y:t,height:i}=comment_classPrivateFieldGet(Ut,this).getBoundingClientRect(),{x:a,y:s,width:n,height:r}=comment_classPrivateFieldGet($t,this).parent.boundingClientRect;return[(e-a)/n,(t+i-s)/r]}set commentPopupPositionInLayer(e){comment_classPrivateFieldSet(Jt,this,e)}hasDefaultPopupPosition(){return null===comment_classPrivateFieldGet(Jt,this)}removeStandaloneCommentButton(){comment_classPrivateFieldGet(Ut,this)?.remove();comment_classPrivateFieldSet(Ut,this,null)}removeToolbarCommentButton(){comment_classPrivateFieldGet(zt,this)?.remove();comment_classPrivateFieldSet(zt,this,null)}setCommentButtonStates(e){let{selected:t,hasPopup:i}=e;if(comment_classPrivateFieldGet(Ut,this)){comment_classPrivateFieldGet(Ut,this).classList.toggle("selected",t);comment_classPrivateFieldGet(Ut,this).ariaExpanded=i}}edit(e){const t=this.commentPopupPositionInLayer;let i,a;if(t)[i,a]=t;else{[i,a]=comment_classPrivateFieldGet($t,this).commentButtonPosition;const{width:e,height:t,x:s,y:n}=comment_classPrivateFieldGet($t,this);i=s+i*e;a=n+a*t}const s=comment_classPrivateFieldGet($t,this).parent.boundingClientRect,{x:n,y:r,width:o,height:l}=s;comment_classPrivateFieldGet($t,this)._uiManager.editComment(comment_classPrivateFieldGet($t,this),n+i*o,r+a*l,{...e,parentDimensions:s})}finish(){if(comment_classPrivateFieldGet(zt,this)){comment_classPrivateFieldGet(zt,this).focus({focusVisible:comment_classPrivateFieldGet(Ht,this)});comment_classPrivateFieldSet(Ht,this,!1)}}isDeleted(){return comment_classPrivateFieldGet(Zt,this)||""===comment_classPrivateFieldGet(Kt,this)}isEmpty(){return null===comment_classPrivateFieldGet(Kt,this)}hasBeenEdited(){return this.isDeleted()||comment_classPrivateFieldGet(Kt,this)!==comment_classPrivateFieldGet(qt,this)}serialize(){return this.data}get data(){return{text:comment_classPrivateFieldGet(Kt,this),richText:comment_classPrivateFieldGet(Xt,this),date:comment_classPrivateFieldGet(Yt,this),deleted:this.isDeleted()}}set data(e){e!==comment_classPrivateFieldGet(Kt,this)&&comment_classPrivateFieldSet(Xt,this,null);if(null!==e){comment_classPrivateFieldSet(Kt,this,e);comment_classPrivateFieldSet(Yt,this,new Date);comment_classPrivateFieldSet(Zt,this,!1);comment_classPrivateFieldGet($t,this).eventBus?.dispatch("annotation-editor-event",{source:comment_classPrivateFieldGet($t,this),type:"commented",page:comment_classPrivateFieldGet($t,this).pageIndex+1,editorType:comment_classPrivateFieldGet($t,this).constructor.name,id:comment_classPrivateFieldGet($t,this).uid,value:comment_classPrivateFieldGet($t,this)})}else{comment_classPrivateFieldSet(Kt,this,"");comment_classPrivateFieldSet(Zt,this,!0);comment_classPrivateFieldGet($t,this).eventBus?.dispatch("annotation-editor-event",{source:comment_classPrivateFieldGet($t,this),type:"commentRemoved",page:comment_classPrivateFieldGet($t,this).pageIndex+1,editorType:comment_classPrivateFieldGet($t,this).constructor.name,id:comment_classPrivateFieldGet($t,this).uid,value:comment_classPrivateFieldGet($t,this)})}}restoreData(e){let{text:t,richText:i,date:a}=e;comment_classPrivateFieldSet(Kt,this,t);comment_classPrivateFieldSet(Xt,this,i);comment_classPrivateFieldSet(Yt,this,a);comment_classPrivateFieldSet(Zt,this,!1)}setInitialText(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;comment_classPrivateFieldSet(qt,this,e);this.data=e;comment_classPrivateFieldSet(Yt,this,null);comment_classPrivateFieldSet(Xt,this,t)}setDate(e){const t=e&&new Date(e);!t||isNaN(t)?comment_classPrivateFieldSet(Yt,this,new Date):comment_classPrivateFieldSet(Yt,this,t)}shown(){}destroy(){comment_classPrivateFieldGet(zt,this)?.remove();comment_classPrivateFieldSet(zt,this,null);comment_classPrivateFieldGet(Ut,this)?.remove();comment_classPrivateFieldSet(Ut,this,null);comment_classPrivateFieldSet(Kt,this,"");comment_classPrivateFieldSet(Xt,this,null);comment_classPrivateFieldSet(Yt,this,null);comment_classPrivateFieldSet($t,this,null);comment_classPrivateFieldSet(Ht,this,!1);comment_classPrivateFieldSet(Zt,this,!1)}}function comment_render(e,t){if(!comment_classPrivateFieldGet($t,this)._uiManager.hasCommentManager())return null;e.tabIndex="0";e.ariaHasPopup="dialog";if(t){e.ariaControls="commentPopup";e.setAttribute("data-l10n-id","pdfjs-show-comment-button")}else{e.ariaControlsElements=[comment_classPrivateFieldGet($t,this)._uiManager.getCommentDialogElement()];e.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button")}const i=comment_classPrivateFieldGet($t,this)._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return e;e.addEventListener("contextmenu",noContextMenu,{signal:i});if(t){e.addEventListener("focusin",e=>{comment_classPrivateFieldGet($t,this)._focusEventsAllowed=!1;stopEvent(e)},{capture:!0,signal:i});e.addEventListener("focusout",e=>{comment_classPrivateFieldGet($t,this)._focusEventsAllowed=!0;stopEvent(e)},{capture:!0,signal:i})}e.addEventListener("pointerdown",e=>e.stopPropagation(),{signal:i});const onClick=t=>{t.preventDefault();e===comment_classPrivateFieldGet(zt,this)?this.edit():comment_classPrivateFieldGet($t,this).toggleComment(!0)};e.addEventListener("click",onClick,{capture:!0,signal:i});e.addEventListener("keydown",t=>{if(t.target===e&&"Enter"===t.key){comment_classPrivateFieldSet(Ht,this,!0);onClick(t)}},{signal:i});e.addEventListener("pointerenter",()=>{comment_classPrivateFieldGet($t,this).toggleComment(!1,!0)},{signal:i});e.addEventListener("pointerleave",()=>{comment_classPrivateFieldGet($t,this).toggleComment(!1,!1)},{signal:i});return e}function touch_manager_classPrivateFieldInitSpec(e,t,i){touch_manager_checkPrivateRedeclaration(e,t),t.set(e,i)}function touch_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function touch_manager_classPrivateFieldGet(e,t){return e.get(touch_manager_assertClassBrand(e,t))}function touch_manager_classPrivateFieldSet(e,t,i){return e.set(touch_manager_assertClassBrand(e,t),i),i}function touch_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var ei,ti=new WeakMap,ii=new WeakMap,ai=new WeakMap,si=new WeakMap,ni=new WeakMap,ri=new WeakMap,oi=new WeakMap,li=new WeakMap,di=new WeakMap,ci=new WeakMap,hi=new WeakMap,ui=new WeakMap,_i=new WeakSet;class TouchManager{constructor(e){let{container:t,isPinchingDisabled:i=null,isPinchingStopped:a=null,onPinchStart:s=null,onPinching:n=null,onPinchEnd:r=null,signal:o}=e;!function touch_manager_classPrivateMethodInitSpec(e,t){touch_manager_checkPrivateRedeclaration(e,t),t.add(e)}(this,_i);touch_manager_classPrivateFieldInitSpec(this,ti,void 0);touch_manager_classPrivateFieldInitSpec(this,ii,!1);touch_manager_classPrivateFieldInitSpec(this,ai,null);touch_manager_classPrivateFieldInitSpec(this,si,void 0);touch_manager_classPrivateFieldInitSpec(this,ni,void 0);touch_manager_classPrivateFieldInitSpec(this,ri,void 0);touch_manager_classPrivateFieldInitSpec(this,oi,void 0);touch_manager_classPrivateFieldInitSpec(this,li,null);touch_manager_classPrivateFieldInitSpec(this,di,void 0);touch_manager_classPrivateFieldInitSpec(this,ci,null);touch_manager_classPrivateFieldInitSpec(this,hi,void 0);touch_manager_classPrivateFieldInitSpec(this,ui,null);touch_manager_classPrivateFieldSet(ti,this,t);touch_manager_classPrivateFieldSet(ai,this,a);touch_manager_classPrivateFieldSet(si,this,i);touch_manager_classPrivateFieldSet(ni,this,s);touch_manager_classPrivateFieldSet(ri,this,n);touch_manager_classPrivateFieldSet(oi,this,r);touch_manager_classPrivateFieldSet(hi,this,new AbortController);touch_manager_classPrivateFieldSet(di,this,AbortSignal.any([o,touch_manager_classPrivateFieldGet(hi,this).signal]));t.addEventListener("touchstart",touch_manager_assertClassBrand(_i,this,_onTouchStart).bind(this),{passive:!1,signal:touch_manager_classPrivateFieldGet(di,this)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/OutputScale.pixelRatio}destroy(){touch_manager_classPrivateFieldGet(hi,this)?.abort();touch_manager_classPrivateFieldSet(hi,this,null);touch_manager_classPrivateFieldGet(li,this)?.abort();touch_manager_classPrivateFieldSet(li,this,null)}}Vt=TouchManager;function _onTouchStart(e){if(touch_manager_classPrivateFieldGet(si,this)?.call(this))return;if(1===e.touches.length){if(touch_manager_classPrivateFieldGet(li,this))return;const e=touch_manager_classPrivateFieldSet(li,this,new AbortController),t=AbortSignal.any([touch_manager_classPrivateFieldGet(di,this),e.signal]),i=touch_manager_classPrivateFieldGet(ti,this),a={capture:!0,signal:t,passive:!1},cancelPointerDown=e=>{if("touch"===e.pointerType){touch_manager_classPrivateFieldGet(li,this)?.abort();touch_manager_classPrivateFieldSet(li,this,null)}};i.addEventListener("pointerdown",e=>{if("touch"===e.pointerType){stopEvent(e);cancelPointerDown(e)}},a);i.addEventListener("pointerup",cancelPointerDown,a);i.addEventListener("pointercancel",cancelPointerDown,a);return}if(!touch_manager_classPrivateFieldGet(ui,this)){touch_manager_classPrivateFieldSet(ui,this,new AbortController);const e=AbortSignal.any([touch_manager_classPrivateFieldGet(di,this),touch_manager_classPrivateFieldGet(ui,this).signal]),t=touch_manager_classPrivateFieldGet(ti,this),i={signal:e,capture:!1,passive:!1};t.addEventListener("touchmove",touch_manager_assertClassBrand(_i,this,_onTouchMove).bind(this),i);const a=touch_manager_assertClassBrand(_i,this,_onTouchEnd).bind(this);t.addEventListener("touchend",a,i);t.addEventListener("touchcancel",a,i);i.capture=!0;t.addEventListener("pointerdown",stopEvent,i);t.addEventListener("pointermove",stopEvent,i);t.addEventListener("pointercancel",stopEvent,i);t.addEventListener("pointerup",stopEvent,i);touch_manager_classPrivateFieldGet(ni,this)?.call(this)}stopEvent(e);if(2!==e.touches.length||touch_manager_classPrivateFieldGet(ai,this)?.call(this)){touch_manager_classPrivateFieldSet(ci,this,null);return}let[t,i]=e.touches;t.identifier>i.identifier&&([t,i]=[i,t]);touch_manager_classPrivateFieldSet(ci,this,{touch0X:t.screenX,touch0Y:t.screenY,touch1X:i.screenX,touch1Y:i.screenY})}function _onTouchMove(e){if(!touch_manager_classPrivateFieldGet(ci,this)||2!==e.touches.length)return;stopEvent(e);let[t,i]=e.touches;t.identifier>i.identifier&&([t,i]=[i,t]);const{screenX:a,screenY:s}=t,{screenX:n,screenY:r}=i,o=touch_manager_classPrivateFieldGet(ci,this),{touch0X:l,touch0Y:d,touch1X:c,touch1Y:h}=o,u=c-l,_=h-d,p=n-a,g=r-s,f=Math.hypot(p,g)||1,m=Math.hypot(u,_)||1;if(!touch_manager_classPrivateFieldGet(ii,this)&&Math.abs(m-f)<=Vt.MIN_TOUCH_DISTANCE_TO_PINCH)return;o.touch0X=a;o.touch0Y=s;o.touch1X=n;o.touch1Y=r;if(!touch_manager_classPrivateFieldGet(ii,this)){touch_manager_classPrivateFieldSet(ii,this,!0);return}const v=[(t.screenX+i.screenX)/2,(t.screenY+i.screenY)/2];touch_manager_classPrivateFieldGet(ri,this)?.call(this,v,m,f)}function _onTouchEnd(e){if(!(e.touches.length>=2)){if(touch_manager_classPrivateFieldGet(ui,this)){touch_manager_classPrivateFieldGet(ui,this).abort();touch_manager_classPrivateFieldSet(ui,this,null);touch_manager_classPrivateFieldGet(oi,this)?.call(this)}if(touch_manager_classPrivateFieldGet(ci,this)){stopEvent(e);touch_manager_classPrivateFieldSet(ci,this,null);touch_manager_classPrivateFieldSet(ii,this,!1)}}}function editor_defineProperty(e,t,i){return(t=function editor_toPropertyKey(e){var t=function editor_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function editor_classPrivateFieldInitSpec(e,t,i){editor_checkPrivateRedeclaration(e,t),t.set(e,i)}function editor_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function editor_classPrivateFieldSet(e,t,i){return e.set(editor_assertClassBrand(e,t),i),i}function editor_classPrivateFieldGet(e,t){return e.get(editor_assertClassBrand(e,t))}function editor_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var pi=new WeakMap,gi=new WeakMap,fi=new WeakMap,mi=new WeakMap,vi=new WeakMap,Pi=new WeakMap,wi=new WeakMap,Fi=new WeakMap,bi=new WeakMap,yi=new WeakMap,Si=new WeakMap,Ci=new WeakMap,xi=new WeakMap,ki=new WeakMap,Ei=new WeakMap,Ai=new WeakMap,Gi=new WeakMap,Bi=new WeakMap,Mi=new WeakMap,Ii=new WeakMap,Ti=new WeakMap,Di=new WeakMap,Li=new WeakMap,Ri=new WeakMap,Ni=new WeakMap,Oi=new WeakMap,Wi=new WeakMap,ji=new WeakSet;class AnnotationEditor{static get _resizerKeyboardManager(){const e=AnnotationEditor.prototype._resizeWithKeyboard,t=AnnotationEditorUIManager.TRANSLATE_SMALL,i=AnnotationEditorUIManager.TRANSLATE_BIG;return shadow(this,"_resizerKeyboardManager",new KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,i]}],[["Escape","mac+Escape"],AnnotationEditor.prototype._stopResizingWithKeyboard]]))}constructor(e){!function editor_classPrivateMethodInitSpec(e,t){editor_checkPrivateRedeclaration(e,t),t.add(e)}(this,ji);editor_classPrivateFieldInitSpec(this,pi,null);editor_classPrivateFieldInitSpec(this,gi,null);editor_classPrivateFieldInitSpec(this,fi,null);editor_classPrivateFieldInitSpec(this,mi,null);editor_classPrivateFieldInitSpec(this,vi,null);editor_classPrivateFieldInitSpec(this,Pi,!1);editor_classPrivateFieldInitSpec(this,wi,null);editor_classPrivateFieldInitSpec(this,Fi,"");editor_classPrivateFieldInitSpec(this,bi,!1);editor_classPrivateFieldInitSpec(this,yi,null);editor_classPrivateFieldInitSpec(this,Si,null);editor_classPrivateFieldInitSpec(this,Ci,null);editor_classPrivateFieldInitSpec(this,xi,null);editor_classPrivateFieldInitSpec(this,ki,null);editor_classPrivateFieldInitSpec(this,Ei,"");editor_classPrivateFieldInitSpec(this,Ai,!1);editor_classPrivateFieldInitSpec(this,Gi,null);editor_classPrivateFieldInitSpec(this,Bi,!1);editor_classPrivateFieldInitSpec(this,Mi,!1);editor_classPrivateFieldInitSpec(this,Ii,!1);editor_classPrivateFieldInitSpec(this,Ti,null);editor_classPrivateFieldInitSpec(this,Di,0);editor_classPrivateFieldInitSpec(this,Li,0);editor_classPrivateFieldInitSpec(this,Ri,null);editor_classPrivateFieldInitSpec(this,Ni,null);editor_defineProperty(this,"isSelected",!1);editor_defineProperty(this,"_isCopy",!1);editor_defineProperty(this,"_editToolbar",null);editor_defineProperty(this,"_initialOptions",Object.create(null));editor_defineProperty(this,"_initialData",null);editor_defineProperty(this,"_isVisible",!0);editor_defineProperty(this,"_uiManager",null);editor_defineProperty(this,"_focusEventsAllowed",!0);editor_classPrivateFieldInitSpec(this,Oi,!1);editor_classPrivateFieldInitSpec(this,Wi,AnnotationEditor._zIndex++);editor_defineProperty(this,"doNotMove",!1);this.parent=e.parent;this.id=e.id;this.width=this.height=null;this.pageIndex=e.parent.pageIndex;this.name=e.name;this.div=null;this._uiManager=e.uiManager;this.annotationElementId=null;this._willKeepAspectRatio=!1;this._initialOptions.isCentered=e.isCentered;this._structTreeParentId=null;this.annotationElementId=e.annotationElementId||null;this.creationDate=e.creationDate||new Date;this.modificationDate=e.modificationDate||null;this.canAddComment=!0;const{rotation:t,rawDims:{pageWidth:i,pageHeight:a,pageX:s,pageY:n}}=this.parent.viewport;this.rotation=t;this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360;this.pageDimensions=[i,a];this.pageTranslation=[s,n];const[r,o]=this.parentDimensions;this.x=e.x/r;this.y=e.y/o;this.isAttachedToDOM=!1;this.deleted=!1;this.eventBus=e.eventBus}updatePageIndex(e){this.pageIndex=e}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return shadow(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new FakeEditor({id:e._uiManager.getId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId;t.deleted=!0;t._uiManager.addToAnnotationStorage(t)}static initialize(e,t){AnnotationEditor._l10n??=e;AnnotationEditor._l10nResizer||=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"});if(-1!==AnnotationEditor._borderLineWidth)return;const i=getComputedStyle(document.documentElement);AnnotationEditor._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){unreachable("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return editor_classPrivateFieldGet(Oi,this)}set _isDraggable(e){editor_classPrivateFieldSet(Oi,this,e);this.div?.classList.toggle("draggable",e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){const[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(2*e);this.y+=this.width*e/(2*t);break;case 180:this.x+=this.width/2;this.y+=this.height/2;break;case 270:this.x+=this.height*t/(2*e);this.y-=this.width*e/(2*t);break;default:this.x-=this.width/2;this.y-=this.height/2}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=editor_classPrivateFieldGet(Wi,this)}setParent(e){if(null!==e){this.pageIndex=e.pageIndex;this.pageDimensions=e.pageDimensions}else{editor_assertClassBrand(ji,this,_stopResizing).call(this);editor_classPrivateFieldGet(xi,this)?.remove();editor_classPrivateFieldSet(xi,this,null)}this.parent=e}focusin(e){this._focusEventsAllowed&&(editor_classPrivateFieldGet(Ai,this)?editor_classPrivateFieldSet(Ai,this,!1):this.parent.setSelected(this))}focusout(e){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const t=e.relatedTarget;if(!t?.closest(`#${this.id}`)){e.preventDefault();this.parent?.isMultipleSelection||this.commitOrRemove()}}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){if(this.isInEditMode()){this.addToAnnotationStorage();this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"commit",page:this.pageIndex+1,editorType:this.constructor.name,value:this,id:this.uid})}}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,i,a){const[s,n]=this.parentDimensions;[i,a]=this.screenToPageTranslation(i,a);this.doNotMove&&([i,a]=[0,0]);this.x=(e+i)/s;this.y=(t+a)/n;this.fixAndSetPosition()}_moveAfterPaste(e,t){if(this.isClone){delete this.isClone;return}const[i,a]=this.parentDimensions;this.setAt(e*i,t*a,this.width*i,this.height*a);this._onTranslated()}translate(e,t){editor_assertClassBrand(ji,this,_translate).call(this,this.parentDimensions,e,t)}translateInPage(e,t){editor_classPrivateFieldGet(Gi,this)||editor_classPrivateFieldSet(Gi,this,[this.x,this.y,this.width,this.height]);editor_assertClassBrand(ji,this,_translate).call(this,this.pageDimensions,e,t);this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){editor_classPrivateFieldGet(Gi,this)||editor_classPrivateFieldSet(Gi,this,[this.x,this.y,this.width,this.height]);const{div:i,parentDimensions:[a,s]}=this;this.x+=e/a;this.y+=t/s;if(this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:e,y:t}=this.div.getBoundingClientRect();if(this.parent.findNewParent(this,e,t)){this.x-=Math.floor(this.x);this.y-=Math.floor(this.y)}}let{x:n,y:r}=this;const[o,l]=this.getBaseTranslation();n+=o;r+=l;const{style:d}=i;d.left=`${(100*n).toFixed(2)}%`;d.top=`${(100*r).toFixed(2)}%`;this._onTranslating(n,r);i.scrollIntoView({block:"nearest"})}_onTranslating(e,t){}_onTranslated(e,t){this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"moved",page:this.pageIndex+1,id:this.uid,editorType:this.constructor.name,value:{x:e,y:t}})}get _hasBeenMoved(){return!!editor_classPrivateFieldGet(Gi,this)&&(editor_classPrivateFieldGet(Gi,this)[0]!==this.x||editor_classPrivateFieldGet(Gi,this)[1]!==this.y)}get _hasBeenResized(){return!!editor_classPrivateFieldGet(Gi,this)&&(editor_classPrivateFieldGet(Gi,this)[2]!==this.width||editor_classPrivateFieldGet(Gi,this)[3]!==this.height)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:i}=AnnotationEditor,a=i/e,s=i/t;switch(this.rotation){case 90:return[-a,s];case 180:return[a,s];case 270:return[a,-s];default:return[-a,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.rotation;const{div:{style:t},pageDimensions:[i,a]}=this;let{x:s,y:n,width:r,height:o}=this;r*=i;o*=a;s*=i;n*=a;if(this._mustFixPosition)switch(e){case 0:s=MathClamp(s,0,i-r);n=MathClamp(n,0,a-o);break;case 90:s=MathClamp(s,0,i-o);n=MathClamp(n,r,a);break;case 180:s=MathClamp(s,r,i);n=MathClamp(n,o,a);break;case 270:s=MathClamp(s,o,i);n=MathClamp(n,0,a-r)}this.x=s/=i;this.y=n/=a;const[l,d]=this.getBaseTranslation();s+=l;n+=d;t.left=`${(100*s).toFixed(2)}%`;t.top=`${(100*n).toFixed(2)}%`;this.moveInDOM()}screenToPageTranslation(e,t){return _rotatePoint.call(AnnotationEditor,e,t,this.parentRotation)}pageTranslationToScreen(e,t){return _rotatePoint.call(AnnotationEditor,e,t,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[t,i]}=this;return[t*e,i*e]}setDims(){const{div:{style:e},width:t,height:i}=this;e.width=`${(100*t).toFixed(2)}%`;e.height=`${(100*i).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(e){return Math.round(1e4*e)/1e4}_onResizing(){}altTextFinish(){editor_classPrivateFieldGet(fi,this)?.finish();this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"altTextChanged",page:this.pageIndex+1,id:this.uid,editorType:this.constructor.name,value:editor_classPrivateFieldGet(fi,this)})}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||editor_classPrivateFieldGet(Mi,this))return this._editToolbar;this._editToolbar=new EditorToolbar(this);this.div.append(this._editToolbar.render());const{toolbarButtons:e}=this;if(e)for(const[t,i]of e)await this._editToolbar.addButton(t,i);this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton());this._editToolbar.addButton("delete");return this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton("comment")}removeEditToolbar(){this._editToolbar?.remove();this._editToolbar=null;editor_classPrivateFieldGet(fi,this)?.destroy()}addContainer(e){const t=this._editToolbar?.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){if(!editor_classPrivateFieldGet(fi,this)){AltText.initialize(AnnotationEditor._l10n);editor_classPrivateFieldSet(fi,this,new AltText(this));if(editor_classPrivateFieldGet(pi,this)){editor_classPrivateFieldGet(fi,this).data=editor_classPrivateFieldGet(pi,this);editor_classPrivateFieldSet(pi,this,null)}}return editor_classPrivateFieldGet(fi,this)}get altTextData(){return editor_classPrivateFieldGet(fi,this)?.data}set altTextData(e){editor_classPrivateFieldGet(fi,this)&&(editor_classPrivateFieldGet(fi,this).data=e)}get guessedAltText(){return editor_classPrivateFieldGet(fi,this)?.guessedText}async setGuessedAltText(e){await(editor_classPrivateFieldGet(fi,this)?.setGuessedText(e))}serializeAltText(e){return editor_classPrivateFieldGet(fi,this)?.serialize(e)}hasAltText(){return!!editor_classPrivateFieldGet(fi,this)&&!editor_classPrivateFieldGet(fi,this).isEmpty()}hasAltTextData(){return editor_classPrivateFieldGet(fi,this)?.hasData()??!1}focusCommentButton(){editor_classPrivateFieldGet(mi,this)?.focusButton()}addCommentButton(){return this.canAddComment?editor_classPrivateFieldGet(mi,this)||editor_classPrivateFieldSet(mi,this,new Comment(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager())if(editor_classPrivateFieldGet(vi,this))this._uiManager.isEditingMode()&&editor_classPrivateFieldGet(vi,this).classList.remove("hidden");else if(this.hasComment){editor_classPrivateFieldSet(vi,this,editor_classPrivateFieldGet(mi,this).renderForStandalone());this.div.append(editor_classPrivateFieldGet(vi,this))}}removeStandaloneCommentButton(){editor_classPrivateFieldGet(mi,this).removeStandaloneCommentButton();editor_classPrivateFieldSet(vi,this,null)}hideStandaloneCommentButton(){editor_classPrivateFieldGet(vi,this)?.classList.add("hidden")}get comment(){if(!editor_classPrivateFieldGet(mi,this))return null;const{data:{richText:e,text:t,date:i,deleted:a}}=editor_classPrivateFieldGet(mi,this);return{text:t,richText:e,date:i,deleted:a,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){editor_classPrivateFieldGet(mi,this)||editor_classPrivateFieldSet(mi,this,new Comment(this));"object"==typeof e&&null!==e?editor_classPrivateFieldGet(mi,this).restoreData(e):editor_classPrivateFieldGet(mi,this).data=e;if(this.hasComment){this.removeCommentButtonFromToolbar();this.addStandaloneCommentButton();this._uiManager.updateComment(this)}else{this.addCommentButtonInToolbar();this.removeStandaloneCommentButton();this._uiManager.removeComment(this)}}setCommentData(e){let{comment:t,popupRef:i,richText:a,commentDate:s}=e;if(!i)return;editor_classPrivateFieldGet(mi,this)||editor_classPrivateFieldSet(mi,this,new Comment(this));editor_classPrivateFieldGet(mi,this).setInitialText(t,a);s&&editor_classPrivateFieldGet(mi,this).setDate(s);if(!this.annotationElementId)return;const n=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);n&&this.updateFromAnnotationLayer(n)}get hasEditedComment(){return editor_classPrivateFieldGet(mi,this)?.hasBeenEdited()}get hasDeletedComment(){return editor_classPrivateFieldGet(mi,this)?.isDeleted()}get hasComment(){return!!editor_classPrivateFieldGet(mi,this)&&!editor_classPrivateFieldGet(mi,this).isEmpty()&&!editor_classPrivateFieldGet(mi,this).isDeleted()}async editComment(e){editor_classPrivateFieldGet(mi,this)||editor_classPrivateFieldSet(mi,this,new Comment(this));editor_classPrivateFieldGet(mi,this).edit(e)}toggleComment(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;this.hasComment&&this._uiManager.toggleComment(this,e,t)}setSelectedCommentButton(e){editor_classPrivateFieldGet(mi,this).setSelectedButton(e)}addComment(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.hasEditedComment||t&&this.hasComment){const t=180,i=100,[,,,a]=e.rect,[s]=this.pageDimensions,[n]=this.pageTranslation,r=n+s+1,o=a-i,l=r+t;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[r,o,l,a],date:this.comment.date?.toISOString()}}}updateFromAnnotationLayer(e){let{popup:{contents:t,deleted:i}}=e;editor_classPrivateFieldGet(mi,this).data=i?null:t}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360);e.className=this.name;e.setAttribute("id",this.id);e.tabIndex=editor_classPrivateFieldGet(Pi,this)?-1:0;e.setAttribute("role","application");this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId);this._isVisible||e.classList.add("hidden");this.setInForeground();editor_assertClassBrand(ji,this,_addFocusListeners).call(this);const[t,i]=this.parentDimensions;if(this.parentRotation%180!=0){e.style.maxWidth=`${(100*i/t).toFixed(2)}%`;e.style.maxHeight=`${(100*t/i).toFixed(2)}%`}const[a,s]=this.getInitialTranslation();this.translate(a,s);bindEvents(this,e,["keydown","pointerdown","dblclick"]);this.isResizable&&this._uiManager._supportsPinchToZoom&&(editor_classPrivateFieldGet(Ni,this)||editor_classPrivateFieldSet(Ni,this,new TouchManager({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:editor_assertClassBrand(ji,this,_touchPinchStartCallback).bind(this),onPinching:editor_assertClassBrand(ji,this,_touchPinchCallback).bind(this),onPinchEnd:editor_assertClassBrand(ji,this,_touchPinchEndCallback).bind(this),signal:this._uiManager._signal})));this.addStandaloneCommentButton();this._uiManager._editorUndoBar?.hide();return e}pointerdown(e){const{isMac:t}=FeatureTest.platform;if(0!==e.button||e.ctrlKey&&t)e.preventDefault();else{editor_classPrivateFieldSet(Ai,this,!0);this._isDraggable?editor_assertClassBrand(ji,this,_setUpDragSession).call(this,e):editor_assertClassBrand(ji,this,_selectOnPointerEvent).call(this,e)}}_onStartDragging(){}_onStopDragging(){}moveInDOM(){editor_classPrivateFieldGet(Ti,this)&&clearTimeout(editor_classPrivateFieldGet(Ti,this));editor_classPrivateFieldSet(Ti,this,setTimeout(()=>{editor_classPrivateFieldSet(Ti,this,null);this.parent?.moveEditorInDOM(this)},0))}_setParentAndPosition(e,t,i){e.changeParent(this);this.x=t;this.y=i;this.fixAndSetPosition();this._onTranslated()}getRect(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.rotation;const a=this.parentScale,[s,n]=this.pageDimensions,[r,o]=this.pageTranslation,l=e/a,d=t/a,c=this.x*s,h=this.y*n,u=this.width*s,_=this.height*n;switch(i){case 0:return[c+l+r,n-h-d-_+o,c+l+u+r,n-h-d+o];case 90:return[c+d+r,n-h+l+o,c+d+_+r,n-h+l+u+o];case 180:return[c-l-u+r,n-h+d+o,c-l+r,n-h+d+_+o];case 270:return[c-d-_+r,n-h-l-u+o,c-d+r,n-h-l+o];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[i,a,s,n]=e,r=s-i,o=n-a;switch(this.rotation){case 0:return[i,t-n,r,o];case 90:return[i,t-a,o,r];case 180:return[s,t-a,r,o];case 270:return[s,t-n,o,r];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&AnnotationEditor._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){editor_classPrivateFieldGet(mi,this)?.onUpdatedColor()}getData(){const{comment:{text:e,color:t,date:i,opacity:a,deleted:s,richText:n},uid:r,pageIndex:o,creationDate:l,modificationDate:d}=this;return{id:r,pageIndex:o,rect:this.getPDFRect(),richText:n,contentsObj:{str:e},creationDate:l,modificationDate:i||d,popupRef:!s,color:t,opacity:a}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){if(this.isInEditMode())return!1;this.parent.setEditingState(!1);editor_classPrivateFieldSet(Mi,this,!0);return!0}disableEditMode(){if(!this.isInEditMode())return!1;this.parent.setEditingState(!0);editor_classPrivateFieldSet(Mi,this,!1);return!0}isInEditMode(){return editor_classPrivateFieldGet(Mi,this)}shouldGetKeyboardEvents(){return editor_classPrivateFieldGet(Ii,this)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:t,bottom:i,right:a}=this.getClientDimensions(),{innerHeight:s,innerWidth:n}=window;return t<n&&a>0&&e<s&&i>0}rebuild(){editor_assertClassBrand(ji,this,_addFocusListeners).call(this)}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||""}}static async deserialize(e,t,i){const a=new this.prototype.constructor({parent:t,id:i.getId(),uiManager:i,annotationElementId:e.annotationElementId,eventBus:t.eventBus,creationDate:e.creationDate,modificationDate:e.modificationDate});a.rotation=e.rotation;editor_classPrivateFieldSet(pi,a,e.accessibilityData);a._isCopy=e.isCopy||!1;const[s,n]=a.pageDimensions,[r,o,l,d]=a.getRectInCurrentCoords(e.rect,n);a.x=r/s;a.y=o/n;a.width=l/s;a.height=d/n;return a}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){editor_classPrivateFieldGet(ki,this)?.abort();editor_classPrivateFieldSet(ki,this,null);this.isEmpty()||this.commit();this.parent?this.parent.remove(this):this._uiManager.removeEditor(this);this.hideCommentPopup();if(editor_classPrivateFieldGet(Ti,this)){clearTimeout(editor_classPrivateFieldGet(Ti,this));editor_classPrivateFieldSet(Ti,this,null)}editor_assertClassBrand(ji,this,_stopResizing).call(this);this.removeEditToolbar();if(editor_classPrivateFieldGet(Ri,this)){for(const e of editor_classPrivateFieldGet(Ri,this).values())clearTimeout(e);editor_classPrivateFieldSet(Ri,this,null)}this.parent=null;this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"removed",page:this.pageIndex+1,id:this.uid,editorType:this.constructor.name,value:this});editor_classPrivateFieldGet(Ni,this)?.destroy();editor_classPrivateFieldSet(Ni,this,null);editor_classPrivateFieldGet(xi,this)?.remove();editor_classPrivateFieldSet(xi,this,null)}get isResizable(){return!1}makeResizable(){if(this.isResizable){editor_assertClassBrand(ji,this,_createResizers).call(this);editor_classPrivateFieldGet(yi,this).classList.remove("hidden")}}get toolbarPosition(){return null}get commentButtonPosition(){return"ltr"===this._uiManager.direction?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[e,t]}=this,[i,a,s,n]=this.getPDFRect();return[AnnotationEditor._round(i+(s-i)*e),AnnotationEditor._round(a+(n-a)*(1-t))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return editor_classPrivateFieldGet(mi,this).commentPopupPositionInLayer}set commentPopupPosition(e){editor_classPrivateFieldGet(mi,this).commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return editor_classPrivateFieldGet(mi,this).hasDefaultPopupPosition()}get commentButtonWidth(){return editor_classPrivateFieldGet(mi,this).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){editor_classPrivateFieldGet(mi,this)?.setCommentButtonStates(e)}keydown(e){if(!this.isResizable||e.target!==this.div||"Enter"!==e.key)return;this._uiManager.setSelected(this);editor_classPrivateFieldSet(Ci,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const t=editor_classPrivateFieldGet(yi,this).children;if(!editor_classPrivateFieldGet(gi,this)){editor_classPrivateFieldSet(gi,this,Array.from(t));const e=editor_assertClassBrand(ji,this,_resizerKeydown).bind(this),i=editor_assertClassBrand(ji,this,_resizerBlur).bind(this),a=this._uiManager._signal;for(const t of editor_classPrivateFieldGet(gi,this)){const s=t.getAttribute("data-resizer-name");t.setAttribute("role","spinbutton");t.addEventListener("keydown",e,{signal:a});t.addEventListener("blur",i,{signal:a});t.addEventListener("focus",editor_assertClassBrand(ji,this,_resizerFocus).bind(this,s),{signal:a});t.setAttribute("data-l10n-id",AnnotationEditor._l10nResizer[s])}}const i=editor_classPrivateFieldGet(gi,this)[0];let a=0;for(const e of t){if(e===i)break;a++}const s=(360-this.rotation+this.parentRotation)%360/90*(editor_classPrivateFieldGet(gi,this).length/4);if(s!==a){if(s<a)for(let e=0;e<a-s;e++)editor_classPrivateFieldGet(yi,this).append(editor_classPrivateFieldGet(yi,this).firstElementChild);else if(s>a)for(let e=0;e<s-a;e++)editor_classPrivateFieldGet(yi,this).firstElementChild.before(editor_classPrivateFieldGet(yi,this).lastElementChild);let e=0;for(const i of t){const t=editor_classPrivateFieldGet(gi,this)[e++].getAttribute("data-resizer-name");i.setAttribute("data-l10n-id",AnnotationEditor._l10nResizer[t])}}editor_assertClassBrand(ji,this,_setResizerTabIndex).call(this,0);editor_classPrivateFieldSet(Ii,this,!0);editor_classPrivateFieldGet(yi,this).firstElementChild.focus({focusVisible:!0});e.preventDefault();e.stopImmediatePropagation()}_resizeWithKeyboard(e,t){editor_classPrivateFieldGet(Ii,this)&&editor_assertClassBrand(ji,this,_resizerPointermove).call(this,editor_classPrivateFieldGet(Ei,this),{deltaX:e,deltaY:t,fromKeyboard:!0})}_stopResizingWithKeyboard(){editor_assertClassBrand(ji,this,_stopResizing).call(this);this.div.focus()}select(){if(this.isSelected&&this._editToolbar)this._editToolbar.show();else{this.isSelected=!0;this.makeResizable();this.div?.classList.add("selectedEditor");if(this._editToolbar){this._editToolbar?.show();editor_classPrivateFieldGet(fi,this)?.toggleAltTextBadge(!1)}else this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()})}}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){if(this.isSelected){this.isSelected=!1;editor_classPrivateFieldGet(yi,this)?.classList.add("hidden");this.div?.classList.remove("selectedEditor");this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0});this._editToolbar?.hide();editor_classPrivateFieldGet(fi,this)?.toggleAltTextBadge(!0);this.hideCommentPopup()}}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){if(this.canChangeContent){this.enableEditMode();this.div.focus()}}dblclick(e){if("BUTTON"!==e.target.nodeName){this.enterInEditMode();this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid})}}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return editor_classPrivateFieldGet(Bi,this)}set isEditing(e){editor_classPrivateFieldSet(Bi,this,e);if(this.parent)if(e){this.parent.setSelected(this);this.parent.setActiveEditor(this)}else this.parent.setActiveEditor(null)}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){editor_classPrivateFieldGet(Ri,this)||editor_classPrivateFieldSet(Ri,this,new Map);const{action:t}=e;let i=editor_classPrivateFieldGet(Ri,this).get(t);i&&clearTimeout(i);i=setTimeout(()=>{this._reportTelemetry(e);editor_classPrivateFieldGet(Ri,this).delete(t);0===editor_classPrivateFieldGet(Ri,this).size&&editor_classPrivateFieldSet(Ri,this,null)},AnnotationEditor._telemetryTimeout);editor_classPrivateFieldGet(Ri,this).set(t,i);return}e.type||=this.editorType;this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;this.div.classList.toggle("hidden",!e);this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0);editor_classPrivateFieldSet(Pi,this,!1)}disable(){this.div&&(this.div.tabIndex=-1);editor_classPrivateFieldSet(Pi,this,!0)}updateFakeAnnotationElement(e){if(editor_classPrivateFieldGet(xi,this)||this.deleted)if(this.deleted){editor_classPrivateFieldGet(xi,this).remove();editor_classPrivateFieldSet(xi,this,null)}else(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&editor_classPrivateFieldGet(xi,this).updateEdited({rect:this.getPDFRect(),popup:this.comment});else editor_classPrivateFieldSet(xi,this,e.addFakeAnnotation(this))}renderAnnotationElement(e){if(this.deleted){e.hide();return null}let t=e.container.querySelector(".annotationContent");if(t){if("CANVAS"===t.nodeName){const e=t;t=document.createElement("div");t.classList.add("annotationContent",this.editorType);e.before(t)}}else{t=document.createElement("div");t.classList.add("annotationContent",this.editorType);e.container.prepend(t)}return t}resetAnnotationElement(e){const{firstElementChild:t}=e.container;"DIV"===t?.nodeName&&t.classList.contains("annotationContent")&&t.remove()}}ei=AnnotationEditor;function _translate(e,t,i){let[a,s]=e;[t,i]=this.screenToPageTranslation(t,i);this.x+=t/a;this.y+=i/s;this._onTranslating(this.x,this.y);this.fixAndSetPosition()}function _rotatePoint(e,t,i){switch(i){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}function _getRotationMatrix(e){switch(e){case 90:{const[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,t]=this.pageDimensions;return[0,e/t,-t/e,0]}default:return[1,0,0,1]}}function _createResizers(){if(editor_classPrivateFieldGet(yi,this))return;editor_classPrivateFieldSet(yi,this,document.createElement("div"));editor_classPrivateFieldGet(yi,this).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],t=this._uiManager._signal;for(const i of e){const e=document.createElement("div");editor_classPrivateFieldGet(yi,this).append(e);e.classList.add("resizer",i);e.setAttribute("data-resizer-name",i);e.addEventListener("pointerdown",editor_assertClassBrand(ji,this,_resizerPointerdown).bind(this,i),{signal:t});e.addEventListener("contextmenu",noContextMenu,{signal:t});e.tabIndex=-1}this.div.prepend(editor_classPrivateFieldGet(yi,this))}function _resizerPointerdown(e,t){t.preventDefault();const{isMac:i}=FeatureTest.platform;if(0!==t.button||t.ctrlKey&&i)return;editor_classPrivateFieldGet(fi,this)?.toggle(!1);const a=this._isDraggable;this._isDraggable=!1;editor_classPrivateFieldSet(Si,this,[t.screenX,t.screenY]);const s=new AbortController,n=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1);window.addEventListener("pointermove",editor_assertClassBrand(ji,this,_resizerPointermove).bind(this,e),{passive:!0,capture:!0,signal:n});window.addEventListener("touchmove",stopEvent,{passive:!1,signal:n});window.addEventListener("contextmenu",noContextMenu,{signal:n});editor_classPrivateFieldSet(Ci,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const r=this.parent.div.style.cursor,o=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const pointerUpCallback=()=>{s.abort();this.parent.togglePointerEvents(!0);editor_classPrivateFieldGet(fi,this)?.toggle(!0);this._isDraggable=a;this.parent.div.style.cursor=r;this.div.style.cursor=o;editor_assertClassBrand(ji,this,_addResizeToUndoStack).call(this)};window.addEventListener("pointerup",pointerUpCallback,{signal:n});window.addEventListener("blur",pointerUpCallback,{signal:n})}function _resize(e,t,i,a){this.width=i;this.height=a;this.x=e;this.y=t;this.setDims();this.fixAndSetPosition();this._onResized()}function _addResizeToUndoStack(){if(!editor_classPrivateFieldGet(Ci,this))return;const{savedX:e,savedY:t,savedWidth:i,savedHeight:a}=editor_classPrivateFieldGet(Ci,this);editor_classPrivateFieldSet(Ci,this,null);const s=this.x,n=this.y,r=this.width,o=this.height;if(s!==e||n!==t||r!==i||o!==a){this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"sizeChanged",editorType:this.constructor.name,id:this.uid,page:this.pageIndex+1,value:{x:e,y:t,width:i,height:a}});this.addCommands({cmd:editor_assertClassBrand(ji,this,_resize).bind(this,s,n,r,o),undo:editor_assertClassBrand(ji,this,_resize).bind(this,e,t,i,a),mustExec:!0})}}function _resizerPointermove(e,t){const[i,a]=this.parentDimensions,s=this.x,n=this.y,r=this.width,o=this.height,l=ei.MIN_SIZE/i,d=ei.MIN_SIZE/a,c=editor_assertClassBrand(ji,this,_getRotationMatrix).call(this,this.rotation),transf=(e,t)=>[c[0]*e+c[2]*t,c[1]*e+c[3]*t],h=editor_assertClassBrand(ji,this,_getRotationMatrix).call(this,360-this.rotation);let u,_,p=!1,g=!1;switch(e){case"topLeft":p=!0;u=(e,t)=>[0,0];_=(e,t)=>[e,t];break;case"topMiddle":u=(e,t)=>[e/2,0];_=(e,t)=>[e/2,t];break;case"topRight":p=!0;u=(e,t)=>[e,0];_=(e,t)=>[0,t];break;case"middleRight":g=!0;u=(e,t)=>[e,t/2];_=(e,t)=>[0,t/2];break;case"bottomRight":p=!0;u=(e,t)=>[e,t];_=(e,t)=>[0,0];break;case"bottomMiddle":u=(e,t)=>[e/2,t];_=(e,t)=>[e/2,0];break;case"bottomLeft":p=!0;u=(e,t)=>[0,t];_=(e,t)=>[e,0];break;case"middleLeft":g=!0;u=(e,t)=>[0,t/2];_=(e,t)=>[e,t/2]}const f=u(r,o),m=_(r,o);let v=transf(...m);const P=ei._round(s+v[0]),w=ei._round(n+v[1]);let b,y,S=1,C=1;if(t.fromKeyboard)({deltaX:b,deltaY:y}=t);else{const{screenX:e,screenY:i}=t,[a,s]=editor_classPrivateFieldGet(Si,this);[b,y]=this.screenToPageTranslation(e-a,i-s);editor_classPrivateFieldGet(Si,this)[0]=e;editor_classPrivateFieldGet(Si,this)[1]=i}[b,y]=(x=b/i,k=y/a,[h[0]*x+h[2]*k,h[1]*x+h[3]*k]);var x,k;if(p){const e=Math.hypot(r,o);S=C=Math.max(Math.min(Math.hypot(m[0]-f[0]-b,m[1]-f[1]-y)/e,1/r,1/o),l/r,d/o)}else g?S=MathClamp(Math.abs(m[0]-f[0]-b),l,1)/r:C=MathClamp(Math.abs(m[1]-f[1]-y),d,1)/o;const E=ei._round(r*S),A=ei._round(o*C);v=transf(..._(E,A));const G=P-v[0],B=w-v[1];editor_classPrivateFieldGet(Gi,this)||editor_classPrivateFieldSet(Gi,this,[this.x,this.y,this.width,this.height]);this.width=E;this.height=A;this.x=G;this.y=B;this.setDims();this.fixAndSetPosition();this._onResizing()}function _touchPinchStartCallback(){editor_classPrivateFieldSet(Ci,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});editor_classPrivateFieldGet(fi,this)?.toggle(!1);this.parent.togglePointerEvents(!1)}function _touchPinchCallback(e,t,i){let a=i/t*.7+1-.7;if(1===a)return;const s=editor_assertClassBrand(ji,this,_getRotationMatrix).call(this,this.rotation),transf=(e,t)=>[s[0]*e+s[2]*t,s[1]*e+s[3]*t],[n,r]=this.parentDimensions,o=this.x,l=this.y,d=this.width,c=this.height,h=ei.MIN_SIZE/n,u=ei.MIN_SIZE/r;a=Math.max(Math.min(a,1/d,1/c),h/d,u/c);const _=ei._round(d*a),p=ei._round(c*a);if(_===d&&p===c)return;editor_classPrivateFieldGet(Gi,this)||editor_classPrivateFieldSet(Gi,this,[o,l,d,c]);const g=transf(d/2,c/2),f=ei._round(o+g[0]),m=ei._round(l+g[1]),v=transf(_/2,p/2);this.x=f-v[0];this.y=m-v[1];this.width=_;this.height=p;this.setDims();this.fixAndSetPosition();this._onResizing()}function _touchPinchEndCallback(){editor_classPrivateFieldGet(fi,this)?.toggle(!0);this.parent.togglePointerEvents(!0);editor_assertClassBrand(ji,this,_addResizeToUndoStack).call(this)}function _selectOnPointerEvent(e){const{isMac:t}=FeatureTest.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}function _setUpDragSession(e){const{isSelected:t}=this;this._uiManager.setUpDragSession();let i=!1;const a=new AbortController,s=this._uiManager.combinedSignal(a),n={capture:!0,passive:!1,signal:s},cancelDrag=e=>{a.abort();editor_classPrivateFieldSet(wi,this,null);editor_classPrivateFieldSet(Ai,this,!1);this._uiManager.endDragSession()||editor_assertClassBrand(ji,this,_selectOnPointerEvent).call(this,e);i&&this._onStopDragging()};if(t){editor_classPrivateFieldSet(Di,this,e.clientX);editor_classPrivateFieldSet(Li,this,e.clientY);editor_classPrivateFieldSet(wi,this,e.pointerId);editor_classPrivateFieldSet(Fi,this,e.pointerType);window.addEventListener("pointermove",e=>{if(!i){i=!0;this._uiManager.toggleComment(this,!0,!1);this._onStartDragging()}const{clientX:t,clientY:a,pointerId:s}=e;if(s!==editor_classPrivateFieldGet(wi,this)){stopEvent(e);return}const[n,r]=this.screenToPageTranslation(t-editor_classPrivateFieldGet(Di,this),a-editor_classPrivateFieldGet(Li,this));editor_classPrivateFieldSet(Di,this,t);editor_classPrivateFieldSet(Li,this,a);this._uiManager.dragSelectedEditors(n,r)},n);window.addEventListener("touchmove",stopEvent,n);window.addEventListener("pointerdown",e=>{e.pointerType===editor_classPrivateFieldGet(Fi,this)&&(editor_classPrivateFieldGet(Ni,this)||e.isPrimary)&&cancelDrag(e);stopEvent(e)},n)}const pointerUpCallback=e=>{editor_classPrivateFieldGet(wi,this)&&editor_classPrivateFieldGet(wi,this)!==e.pointerId?stopEvent(e):cancelDrag(e)};window.addEventListener("pointerup",pointerUpCallback,{signal:s});window.addEventListener("blur",pointerUpCallback,{signal:s})}function _addFocusListeners(){if(editor_classPrivateFieldGet(ki,this)||!this.div)return;editor_classPrivateFieldSet(ki,this,new AbortController);const e=this._uiManager.combinedSignal(editor_classPrivateFieldGet(ki,this));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e});this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})}function _resizerKeydown(e){ei._resizerKeyboardManager.exec(this,e)}function _resizerBlur(e){editor_classPrivateFieldGet(Ii,this)&&e.relatedTarget?.parentNode!==editor_classPrivateFieldGet(yi,this)&&editor_assertClassBrand(ji,this,_stopResizing).call(this)}function _resizerFocus(e){editor_classPrivateFieldSet(Ei,this,editor_classPrivateFieldGet(Ii,this)?e:"")}function _setResizerTabIndex(e){if(editor_classPrivateFieldGet(gi,this))for(const t of editor_classPrivateFieldGet(gi,this))t.tabIndex=e}function _stopResizing(){editor_classPrivateFieldSet(Ii,this,!1);editor_assertClassBrand(ji,this,_setResizerTabIndex).call(this,-1);editor_assertClassBrand(ji,this,_addResizeToUndoStack).call(this)}editor_defineProperty(AnnotationEditor,"_l10n",null);editor_defineProperty(AnnotationEditor,"_l10nResizer",null);editor_defineProperty(AnnotationEditor,"_borderLineWidth",-1);editor_defineProperty(AnnotationEditor,"_colorManager",new ColorManager);editor_defineProperty(AnnotationEditor,"_zIndex",1);editor_defineProperty(AnnotationEditor,"_telemetryTimeout",1e3);class FakeEditor extends AnnotationEditor{constructor(e){super(e);this.annotationElementId=e.annotationElementId;this.deleted=!0}serialize(){return this.serializeDeleted()}}const Vi=3285377520,Ui=4294901760,zi=65535;class MurmurHash3_64{constructor(e){this.h1=e?4294967295&e:Vi;this.h2=e?4294967295&e:Vi}update(e){let t,i;if("string"==typeof e){t=new Uint8Array(2*e.length);i=0;for(let a=0,s=e.length;a<s;a++){const s=e.charCodeAt(a);if(s<=255)t[i++]=s;else{t[i++]=s>>>8;t[i++]=255&s}}}else{if(!ArrayBuffer.isView(e))throw new Error("Invalid data format, must be a string or TypedArray.");t=e.slice();i=t.byteLength}const a=i>>2,s=i-4*a,n=new Uint32Array(t.buffer,0,a);let r=0,o=0,l=this.h1,d=this.h2;const c=3432918353,h=461845907,u=11601,_=13715;for(let e=0;e<a;e++)if(1&e){r=n[e];r=r*c&Ui|r*u&zi;r=r<<15|r>>>17;r=r*h&Ui|r*_&zi;l^=r;l=l<<13|l>>>19;l=5*l+3864292196}else{o=n[e];o=o*c&Ui|o*u&zi;o=o<<15|o>>>17;o=o*h&Ui|o*_&zi;d^=o;d=d<<13|d>>>19;d=5*d+3864292196}r=0;switch(s){case 3:r^=t[4*a+2]<<16;case 2:r^=t[4*a+1]<<8;case 1:r^=t[4*a];r=r*c&Ui|r*u&zi;r=r<<15|r>>>17;r=r*h&Ui|r*_&zi;1&a?l^=r:d^=r}this.h1=l;this.h2=d}hexdigest(){let e=this.h1,t=this.h2;e^=t>>>1;e=3981806797*e&Ui|36045*e&zi;t=4283543511*t&Ui|(2950163797*(t<<16|e>>>16)&Ui)>>>16;e^=t>>>1;e=444984403*e&Ui|60499*e&zi;t=3301882366*t&Ui|(3120437893*(t<<16|e>>>16)&Ui)>>>16;e^=t>>>1;return(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}function annotation_storage_defineProperty(e,t,i){return(t=function annotation_storage_toPropertyKey(e){var t=function annotation_storage_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function annotation_storage_classPrivateFieldInitSpec(e,t,i){annotation_storage_checkPrivateRedeclaration(e,t),t.set(e,i)}function annotation_storage_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function annotation_storage_classPrivateFieldSet(e,t,i){return e.set(annotation_storage_assertClassBrand(e,t),i),i}function annotation_storage_classPrivateFieldGet(e,t){return e.get(annotation_storage_assertClassBrand(e,t))}function annotation_storage_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Hi=Object.freeze({map:null,hash:"",transfer:void 0});var $i=new WeakMap,qi=new WeakMap,Xi=new WeakMap,Ki=new WeakMap,Yi=new WeakSet;class AnnotationStorage{constructor(){!function annotation_storage_classPrivateMethodInitSpec(e,t){annotation_storage_checkPrivateRedeclaration(e,t),t.add(e)}(this,Yi);annotation_storage_classPrivateFieldInitSpec(this,$i,!1);annotation_storage_classPrivateFieldInitSpec(this,qi,null);annotation_storage_classPrivateFieldInitSpec(this,Xi,null);annotation_storage_classPrivateFieldInitSpec(this,Ki,new Map);annotation_storage_defineProperty(this,"onSetModified",null);annotation_storage_defineProperty(this,"onResetModified",null);annotation_storage_defineProperty(this,"onAnnotationEditor",null)}getValue(e,t){const i=annotation_storage_classPrivateFieldGet(Ki,this).get(e);return void 0===i?t:Object.assign(t,i)}getRawValue(e){return annotation_storage_classPrivateFieldGet(Ki,this).get(e)}remove(e){const t=annotation_storage_classPrivateFieldGet(Ki,this).get(e);if(void 0!==t){t instanceof AnnotationEditor&&annotation_storage_classPrivateFieldGet(Xi,this).delete(t.annotationElementId);annotation_storage_classPrivateFieldGet(Ki,this).delete(e);0===annotation_storage_classPrivateFieldGet(Ki,this).size&&this.resetModified();annotation_storage_classPrivateFieldGet(Ki,this).values().some(e=>e instanceof AnnotationEditor)||this.onAnnotationEditor?.(null)}}setValue(e,t){const i=annotation_storage_classPrivateFieldGet(Ki,this).get(e);let a=!1;if(void 0!==i){for(const[e,s]of Object.entries(t))if(i[e]!==s){a=!0;i[e]=s}}else{a=!0;annotation_storage_classPrivateFieldGet(Ki,this).set(e,t)}a&&annotation_storage_assertClassBrand(Yi,this,_setModified).call(this);if(t instanceof AnnotationEditor){(annotation_storage_classPrivateFieldGet(Xi,this)||annotation_storage_classPrivateFieldSet(Xi,this,new Map)).set(t.annotationElementId,t);this.onAnnotationEditor?.(t.constructor._type)}}has(e){return annotation_storage_classPrivateFieldGet(Ki,this).has(e)}get size(){return annotation_storage_classPrivateFieldGet(Ki,this).size}resetModified(){if(annotation_storage_classPrivateFieldGet($i,this)){annotation_storage_classPrivateFieldSet($i,this,!1);this.onResetModified?.()}}get print(){return new PrintAnnotationStorage(this)}get serializable(){if(0===annotation_storage_classPrivateFieldGet(Ki,this).size)return Hi;const e=new Map,t=new MurmurHash3_64,i=[],a=Object.create(null);let s=!1;for(const[i,n]of annotation_storage_classPrivateFieldGet(Ki,this)){const r=n instanceof AnnotationEditor?n.serialize(!1,a):n;if(n.page){n.pageIndex=n.page._pageIndex;delete n.page}if(r){e.set(i,r);t.update(`${i}:${JSON.stringify(r)}`);s||=!!r.bitmap}}if(s)for(const t of e.values())t.bitmap&&i.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:i}:Hi}get editorStats(){let e=null;const t=new Map;let i=0,a=0;for(const s of annotation_storage_classPrivateFieldGet(Ki,this).values()){if(!(s instanceof AnnotationEditor)){s.popup&&(s.popup.deleted?a+=1:i+=1);continue}s.isCommentDeleted?a+=1:s.hasEditedComment&&(i+=1);const n=s.telemetryFinalData;if(!n)continue;const{type:r}=n;t.has(r)||t.set(r,Object.getPrototypeOf(s).constructor);e||=Object.create(null);const o=e[r]||=new Map;for(const[e,t]of Object.entries(n)){if("type"===e)continue;const i=o.getOrInsertComputed(e,makeMap);i.set(t,(i.get(t)??0)+1)}}if(a>0||i>0){e||=Object.create(null);e.comments={deleted:a,edited:i}}if(!e)return null;for(const[i,a]of t)e[i]=a.computeTelemetryFinalData(e[i]);return e}resetModifiedIds(){annotation_storage_classPrivateFieldSet(qi,this,null)}updateEditor(e,t){const i=annotation_storage_classPrivateFieldGet(Xi,this)?.get(e);if(i){i.updateFromAnnotationLayer(t);return!0}return!1}getEditor(e){return annotation_storage_classPrivateFieldGet(Xi,this)?.get(e)||null}get modifiedIds(){if(annotation_storage_classPrivateFieldGet(qi,this))return annotation_storage_classPrivateFieldGet(qi,this);const e=[];if(annotation_storage_classPrivateFieldGet(Xi,this))for(const t of annotation_storage_classPrivateFieldGet(Xi,this).values())t.serialize()&&e.push(t.annotationElementId);return annotation_storage_classPrivateFieldSet(qi,this,{ids:new Set(e),hash:e.join(",")})}[Symbol.iterator](){return annotation_storage_classPrivateFieldGet(Ki,this).entries()}}function _setModified(){if(!annotation_storage_classPrivateFieldGet($i,this)){annotation_storage_classPrivateFieldSet($i,this,!0);this.onSetModified?.()}}var Zi=new WeakMap;class PrintAnnotationStorage extends AnnotationStorage{constructor(e){super();annotation_storage_classPrivateFieldInitSpec(this,Zi,Hi);const{serializable:t}=e;if(t===Hi)return;const{map:i,hash:a,transfer:s}=t,n=structuredClone(i,s?{transfer:s}:null);annotation_storage_classPrivateFieldSet(Zi,this,{map:n,hash:a,transfer:[]})}get print(){unreachable("Should not call PrintAnnotationStorage.print")}get serializable(){return annotation_storage_classPrivateFieldGet(Zi,this)}get modifiedIds(){return shadow(this,"modifiedIds",{ids:new Set,hash:""})}}function canvas_dependency_tracker_defineProperty(e,t,i){return(t=function canvas_dependency_tracker_toPropertyKey(e){var t=function canvas_dependency_tracker_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function canvas_dependency_tracker_classPrivateFieldInitSpec(e,t,i){canvas_dependency_tracker_checkPrivateRedeclaration(e,t),t.set(e,i)}function canvas_dependency_tracker_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function canvas_dependency_tracker_classPrivateFieldGet(e,t){return e.get(canvas_dependency_tracker_assertClassBrand(e,t))}function canvas_dependency_tracker_classPrivateFieldSet(e,t,i){return e.set(canvas_dependency_tracker_assertClassBrand(e,t),i),i}function canvas_dependency_tracker_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Ji="__forcedDependency",{floor:Qi,ceil:ea}=Math;function expandBBox(e,t,i,a,s,n){e[4*t+0]=Math.min(e[4*t+0],i);e[4*t+1]=Math.min(e[4*t+1],a);e[4*t+2]=Math.max(e[4*t+2],s);e[4*t+3]=Math.max(e[4*t+3],n)}const ta=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];var ia=new WeakMap,aa=new WeakMap;class BBoxReader{constructor(e,t){canvas_dependency_tracker_classPrivateFieldInitSpec(this,ia,void 0);canvas_dependency_tracker_classPrivateFieldInitSpec(this,aa,void 0);canvas_dependency_tracker_classPrivateFieldSet(ia,this,e);canvas_dependency_tracker_classPrivateFieldSet(aa,this,t)}get length(){return canvas_dependency_tracker_classPrivateFieldGet(ia,this).length}isEmpty(e){return canvas_dependency_tracker_classPrivateFieldGet(ia,this)[e]===ta}minX(e){return canvas_dependency_tracker_classPrivateFieldGet(aa,this)[4*e+0]/256}minY(e){return canvas_dependency_tracker_classPrivateFieldGet(aa,this)[4*e+1]/256}maxX(e){return(canvas_dependency_tracker_classPrivateFieldGet(aa,this)[4*e+2]+1)/256}maxY(e){return(canvas_dependency_tracker_classPrivateFieldGet(aa,this)[4*e+3]+1)/256}}const ensureDebugMetadata=(e,t)=>e?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1}));var sa=new WeakMap,na=new WeakMap,ra=new WeakMap,oa=new WeakMap,la=new WeakMap,da=new WeakMap,ca=new WeakMap,ha=new WeakSet;class CanvasBBoxTracker{constructor(e,t){!function canvas_dependency_tracker_classPrivateMethodInitSpec(e,t){canvas_dependency_tracker_checkPrivateRedeclaration(e,t),t.add(e)}(this,ha);canvas_dependency_tracker_classPrivateFieldInitSpec(this,sa,[[1,0,0,1,0,0]]);canvas_dependency_tracker_classPrivateFieldInitSpec(this,na,[-1/0,-1/0,1/0,1/0]);canvas_dependency_tracker_classPrivateFieldInitSpec(this,ra,new Float64Array([1/0,1/0,-1/0,-1/0]));canvas_dependency_tracker_defineProperty(this,"_pendingBBoxIdx",-1);canvas_dependency_tracker_classPrivateFieldInitSpec(this,oa,void 0);canvas_dependency_tracker_classPrivateFieldInitSpec(this,la,void 0);canvas_dependency_tracker_classPrivateFieldInitSpec(this,da,void 0);canvas_dependency_tracker_classPrivateFieldInitSpec(this,ca,void 0);canvas_dependency_tracker_defineProperty(this,"_savesStack",[]);canvas_dependency_tracker_defineProperty(this,"_markedContentStack",[]);canvas_dependency_tracker_classPrivateFieldSet(oa,this,e.width);canvas_dependency_tracker_classPrivateFieldSet(la,this,e.height);canvas_dependency_tracker_assertClassBrand(ha,this,_initializeBBoxes).call(this,t)}growOperationsCount(e){e>=canvas_dependency_tracker_classPrivateFieldGet(ca,this).length&&canvas_dependency_tracker_assertClassBrand(ha,this,_initializeBBoxes).call(this,e,canvas_dependency_tracker_classPrivateFieldGet(ca,this))}get clipBox(){return canvas_dependency_tracker_classPrivateFieldGet(na,this)}save(e){canvas_dependency_tracker_classPrivateFieldSet(na,this,{__proto__:canvas_dependency_tracker_classPrivateFieldGet(na,this)});this._savesStack.push(e);return this}restore(e,t){const i=Object.getPrototypeOf(canvas_dependency_tracker_classPrivateFieldGet(na,this));if(null===i)return this;canvas_dependency_tracker_classPrivateFieldSet(na,this,i);const a=this._savesStack.pop();if(void 0!==a){t?.(a,e);canvas_dependency_tracker_classPrivateFieldGet(ca,this)[e]=canvas_dependency_tracker_classPrivateFieldGet(ca,this)[a]}return this}recordOpenMarker(e){this._savesStack.push(e);return this}getOpenMarker(){return 0===this._savesStack.length?null:this._savesStack.at(-1)}recordCloseMarker(e,t){const i=this._savesStack.pop();if(void 0!==i){t?.(i,e);canvas_dependency_tracker_classPrivateFieldGet(ca,this)[e]=canvas_dependency_tracker_classPrivateFieldGet(ca,this)[i]}return this}beginMarkedContent(e){this._markedContentStack.push(e);return this}endMarkedContent(e,t){const i=this._markedContentStack.pop();if(void 0!==i){t?.(i,e);canvas_dependency_tracker_classPrivateFieldGet(ca,this)[e]=canvas_dependency_tracker_classPrivateFieldGet(ca,this)[i]}return this}pushBaseTransform(e){canvas_dependency_tracker_classPrivateFieldGet(sa,this).push(Util.multiplyByDOMMatrix(canvas_dependency_tracker_classPrivateFieldGet(sa,this).at(-1),e.getTransform()));return this}popBaseTransform(){canvas_dependency_tracker_classPrivateFieldGet(sa,this).length>1&&canvas_dependency_tracker_classPrivateFieldGet(sa,this).pop();return this}resetBBox(e){if(this._pendingBBoxIdx!==e){this._pendingBBoxIdx=e;canvas_dependency_tracker_classPrivateFieldGet(ra,this)[0]=1/0;canvas_dependency_tracker_classPrivateFieldGet(ra,this)[1]=1/0;canvas_dependency_tracker_classPrivateFieldGet(ra,this)[2]=-1/0;canvas_dependency_tracker_classPrivateFieldGet(ra,this)[3]=-1/0}return this}recordClipBox(e,t,i,a,s,n){const r=Util.multiplyByDOMMatrix(canvas_dependency_tracker_classPrivateFieldGet(sa,this).at(-1),t.getTransform()),o=[1/0,1/0,-1/0,-1/0];Util.axialAlignedBoundingBox([i,s,a,n],r,o);const l=Util.intersect(canvas_dependency_tracker_classPrivateFieldGet(na,this),o);if(l){canvas_dependency_tracker_classPrivateFieldGet(na,this)[0]=l[0];canvas_dependency_tracker_classPrivateFieldGet(na,this)[1]=l[1];canvas_dependency_tracker_classPrivateFieldGet(na,this)[2]=l[2];canvas_dependency_tracker_classPrivateFieldGet(na,this)[3]=l[3]}else{canvas_dependency_tracker_classPrivateFieldGet(na,this)[0]=canvas_dependency_tracker_classPrivateFieldGet(na,this)[1]=1/0;canvas_dependency_tracker_classPrivateFieldGet(na,this)[2]=canvas_dependency_tracker_classPrivateFieldGet(na,this)[3]=-1/0}return this}recordBBox(e,t,i,a,s,n){const r=canvas_dependency_tracker_classPrivateFieldGet(na,this);if(r[0]===1/0)return this;const o=Util.multiplyByDOMMatrix(canvas_dependency_tracker_classPrivateFieldGet(sa,this).at(-1),t.getTransform());if(r[0]===-1/0){Util.axialAlignedBoundingBox([i,s,a,n],o,canvas_dependency_tracker_classPrivateFieldGet(ra,this));return this}const l=[1/0,1/0,-1/0,-1/0];Util.axialAlignedBoundingBox([i,s,a,n],o,l);canvas_dependency_tracker_classPrivateFieldGet(ra,this)[0]=Math.min(canvas_dependency_tracker_classPrivateFieldGet(ra,this)[0],Math.max(l[0],r[0]));canvas_dependency_tracker_classPrivateFieldGet(ra,this)[1]=Math.min(canvas_dependency_tracker_classPrivateFieldGet(ra,this)[1],Math.max(l[1],r[1]));canvas_dependency_tracker_classPrivateFieldGet(ra,this)[2]=Math.max(canvas_dependency_tracker_classPrivateFieldGet(ra,this)[2],Math.min(l[2],r[2]));canvas_dependency_tracker_classPrivateFieldGet(ra,this)[3]=Math.max(canvas_dependency_tracker_classPrivateFieldGet(ra,this)[3],Math.min(l[3],r[3]));return this}recordFullPageBBox(e){canvas_dependency_tracker_classPrivateFieldGet(ra,this)[0]=Math.max(0,canvas_dependency_tracker_classPrivateFieldGet(na,this)[0]);canvas_dependency_tracker_classPrivateFieldGet(ra,this)[1]=Math.max(0,canvas_dependency_tracker_classPrivateFieldGet(na,this)[1]);canvas_dependency_tracker_classPrivateFieldGet(ra,this)[2]=Math.min(canvas_dependency_tracker_classPrivateFieldGet(oa,this),canvas_dependency_tracker_classPrivateFieldGet(na,this)[2]);canvas_dependency_tracker_classPrivateFieldGet(ra,this)[3]=Math.min(canvas_dependency_tracker_classPrivateFieldGet(la,this),canvas_dependency_tracker_classPrivateFieldGet(na,this)[3]);return this}recordOperation(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(this._pendingBBoxIdx!==e)return this;const a=Qi(256*canvas_dependency_tracker_classPrivateFieldGet(ra,this)[0]/canvas_dependency_tracker_classPrivateFieldGet(oa,this)),s=Qi(256*canvas_dependency_tracker_classPrivateFieldGet(ra,this)[1]/canvas_dependency_tracker_classPrivateFieldGet(la,this)),n=ea(256*canvas_dependency_tracker_classPrivateFieldGet(ra,this)[2]/canvas_dependency_tracker_classPrivateFieldGet(oa,this)),r=ea(256*canvas_dependency_tracker_classPrivateFieldGet(ra,this)[3]/canvas_dependency_tracker_classPrivateFieldGet(la,this));expandBBox(canvas_dependency_tracker_classPrivateFieldGet(da,this),e,a,s,n,r);if(i)for(const t of i)for(const i of t)i!==e&&expandBBox(canvas_dependency_tracker_classPrivateFieldGet(da,this),i,a,s,n,r);t||(this._pendingBBoxIdx=-1);return this}bboxToClipBoxDropOperation(e){if(this._pendingBBoxIdx===e){this._pendingBBoxIdx=-1;canvas_dependency_tracker_classPrivateFieldGet(na,this)[0]=Math.max(canvas_dependency_tracker_classPrivateFieldGet(na,this)[0],canvas_dependency_tracker_classPrivateFieldGet(ra,this)[0]);canvas_dependency_tracker_classPrivateFieldGet(na,this)[1]=Math.max(canvas_dependency_tracker_classPrivateFieldGet(na,this)[1],canvas_dependency_tracker_classPrivateFieldGet(ra,this)[1]);canvas_dependency_tracker_classPrivateFieldGet(na,this)[2]=Math.min(canvas_dependency_tracker_classPrivateFieldGet(na,this)[2],canvas_dependency_tracker_classPrivateFieldGet(ra,this)[2]);canvas_dependency_tracker_classPrivateFieldGet(na,this)[3]=Math.min(canvas_dependency_tracker_classPrivateFieldGet(na,this)[3],canvas_dependency_tracker_classPrivateFieldGet(ra,this)[3])}return this}take(){return new BBoxReader(canvas_dependency_tracker_classPrivateFieldGet(ca,this),canvas_dependency_tracker_classPrivateFieldGet(da,this))}takeDebugMetadata(){throw new Error("Unreachable")}recordSimpleData(e,t){return this}recordIncrementalData(e,t){return this}resetIncrementalData(e,t){return this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,i){return this}recordFutureForcedDependency(e,t){return this}inheritSimpleDataAsFutureForcedDependencies(e){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(e,t,i){return this}getSimpleIndex(e){}recordDependencies(e,t){return this}recordNamedDependency(e,t){return this}recordShowTextOperation(e){return this}}function _initializeBBoxes(e,t){const i=new ArrayBuffer(4*e);canvas_dependency_tracker_classPrivateFieldSet(da,this,new Uint8ClampedArray(i));canvas_dependency_tracker_classPrivateFieldSet(ca,this,new Uint32Array(i));if(t&&t.length>0){canvas_dependency_tracker_classPrivateFieldGet(ca,this).set(t);canvas_dependency_tracker_classPrivateFieldGet(ca,this).fill(ta,t.length)}else canvas_dependency_tracker_classPrivateFieldGet(ca,this).fill(ta)}var ua=new WeakMap,_a=new WeakMap,pa=new WeakMap,ga=new WeakMap,fa=new WeakMap,ma=new WeakMap,va=new WeakMap,Pa=new WeakMap;class CanvasDependencyTracker{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];canvas_dependency_tracker_classPrivateFieldInitSpec(this,ua,{__proto__:null});canvas_dependency_tracker_classPrivateFieldInitSpec(this,_a,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Ji]:[]});canvas_dependency_tracker_classPrivateFieldInitSpec(this,pa,new Map);canvas_dependency_tracker_classPrivateFieldInitSpec(this,ga,new Set);canvas_dependency_tracker_classPrivateFieldInitSpec(this,fa,new Map);canvas_dependency_tracker_classPrivateFieldInitSpec(this,ma,void 0);canvas_dependency_tracker_classPrivateFieldInitSpec(this,va,void 0);canvas_dependency_tracker_classPrivateFieldInitSpec(this,Pa,void 0);canvas_dependency_tracker_classPrivateFieldSet(Pa,this,e);if(t){canvas_dependency_tracker_classPrivateFieldSet(ma,this,new Map);canvas_dependency_tracker_classPrivateFieldSet(va,this,(e,t)=>{ensureDebugMetadata(canvas_dependency_tracker_classPrivateFieldGet(ma,this),t).dependencies.add(e)})}}get clipBox(){return canvas_dependency_tracker_classPrivateFieldGet(Pa,this).clipBox}growOperationsCount(e){canvas_dependency_tracker_classPrivateFieldGet(Pa,this).growOperationsCount(e)}save(e){canvas_dependency_tracker_classPrivateFieldSet(ua,this,{__proto__:canvas_dependency_tracker_classPrivateFieldGet(ua,this)});canvas_dependency_tracker_classPrivateFieldSet(_a,this,{__proto__:canvas_dependency_tracker_classPrivateFieldGet(_a,this),transform:{__proto__:canvas_dependency_tracker_classPrivateFieldGet(_a,this).transform},moveText:{__proto__:canvas_dependency_tracker_classPrivateFieldGet(_a,this).moveText},sameLineText:{__proto__:canvas_dependency_tracker_classPrivateFieldGet(_a,this).sameLineText},[Ji]:{__proto__:canvas_dependency_tracker_classPrivateFieldGet(_a,this)[Ji]}});canvas_dependency_tracker_classPrivateFieldGet(Pa,this).save(e);return this}restore(e){canvas_dependency_tracker_classPrivateFieldGet(Pa,this).restore(e,canvas_dependency_tracker_classPrivateFieldGet(va,this));const t=Object.getPrototypeOf(canvas_dependency_tracker_classPrivateFieldGet(ua,this));if(null===t)return this;canvas_dependency_tracker_classPrivateFieldSet(ua,this,t);canvas_dependency_tracker_classPrivateFieldSet(_a,this,Object.getPrototypeOf(canvas_dependency_tracker_classPrivateFieldGet(_a,this)));return this}recordOpenMarker(e){canvas_dependency_tracker_classPrivateFieldGet(Pa,this).recordOpenMarker(e,canvas_dependency_tracker_classPrivateFieldGet(va,this));return this}getOpenMarker(){return canvas_dependency_tracker_classPrivateFieldGet(Pa,this).getOpenMarker()}recordCloseMarker(e){canvas_dependency_tracker_classPrivateFieldGet(Pa,this).recordCloseMarker(e,canvas_dependency_tracker_classPrivateFieldGet(va,this));return this}beginMarkedContent(e){canvas_dependency_tracker_classPrivateFieldGet(Pa,this).beginMarkedContent(e);return this}endMarkedContent(e){canvas_dependency_tracker_classPrivateFieldGet(Pa,this).endMarkedContent(e,canvas_dependency_tracker_classPrivateFieldGet(va,this));return this}pushBaseTransform(e){canvas_dependency_tracker_classPrivateFieldGet(Pa,this).pushBaseTransform(e);return this}popBaseTransform(){canvas_dependency_tracker_classPrivateFieldGet(Pa,this).popBaseTransform();return this}recordSimpleData(e,t){canvas_dependency_tracker_classPrivateFieldGet(ua,this)[e]=t;return this}recordIncrementalData(e,t){canvas_dependency_tracker_classPrivateFieldGet(_a,this)[e].push(t);return this}resetIncrementalData(e,t){canvas_dependency_tracker_classPrivateFieldGet(_a,this)[e].length=0;return this}recordNamedData(e,t){canvas_dependency_tracker_classPrivateFieldGet(pa,this).set(e,t);return this}recordSimpleDataFromNamed(e,t,i){canvas_dependency_tracker_classPrivateFieldGet(ua,this)[e]=canvas_dependency_tracker_classPrivateFieldGet(pa,this).get(t)??i}recordFutureForcedDependency(e,t){this.recordIncrementalData(Ji,t);return this}inheritSimpleDataAsFutureForcedDependencies(e){for(const t of e)t in canvas_dependency_tracker_classPrivateFieldGet(ua,this)&&this.recordFutureForcedDependency(t,canvas_dependency_tracker_classPrivateFieldGet(ua,this)[t]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const e of canvas_dependency_tracker_classPrivateFieldGet(ga,this))this.recordFutureForcedDependency(Ji,e);return this}resetBBox(e){canvas_dependency_tracker_classPrivateFieldGet(Pa,this).resetBBox(e);return this}recordClipBox(e,t,i,a,s,n){canvas_dependency_tracker_classPrivateFieldGet(Pa,this).recordClipBox(e,t,i,a,s,n);return this}recordBBox(e,t,i,a,s,n){canvas_dependency_tracker_classPrivateFieldGet(Pa,this).recordBBox(e,t,i,a,s,n);return this}recordCharacterBBox(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=arguments.length>6?arguments[6]:void 0;const o=i.bbox;let l,d;if(o){l=o[2]!==o[0]&&o[3]!==o[1]&&canvas_dependency_tracker_classPrivateFieldGet(fa,this).get(i);if(!1!==l){d=[0,0,0,0];Util.axialAlignedBoundingBox(o,i.fontMatrix,d);1===a&&0===s&&0===n||Util.scaleMinMax([a,0,0,-a,s,n],d);if(l)return this.recordBBox(e,t,d[0],d[2],d[1],d[3])}}if(!r)return this.recordFullPageBBox(e);const c=r();if(o&&d&&void 0===l){l=d[0]<=s-c.actualBoundingBoxLeft&&d[2]>=s+c.actualBoundingBoxRight&&d[1]<=n-c.actualBoundingBoxAscent&&d[3]>=n+c.actualBoundingBoxDescent;canvas_dependency_tracker_classPrivateFieldGet(fa,this).set(i,l);if(l)return this.recordBBox(e,t,d[0],d[2],d[1],d[3])}return this.recordBBox(e,t,s-c.actualBoundingBoxLeft,s+c.actualBoundingBoxRight,n-c.actualBoundingBoxAscent,n+c.actualBoundingBoxDescent)}recordFullPageBBox(e){canvas_dependency_tracker_classPrivateFieldGet(Pa,this).recordFullPageBBox(e);return this}getSimpleIndex(e){return canvas_dependency_tracker_classPrivateFieldGet(ua,this)[e]}recordDependencies(e,t){const i=canvas_dependency_tracker_classPrivateFieldGet(ga,this),a=canvas_dependency_tracker_classPrivateFieldGet(ua,this),s=canvas_dependency_tracker_classPrivateFieldGet(_a,this);for(const e of t)e in canvas_dependency_tracker_classPrivateFieldGet(ua,this)?i.add(a[e]):e in s&&s[e].forEach(i.add,i);return this}recordNamedDependency(e,t){canvas_dependency_tracker_classPrivateFieldGet(pa,this).has(t)&&canvas_dependency_tracker_classPrivateFieldGet(ga,this).add(canvas_dependency_tracker_classPrivateFieldGet(pa,this).get(t));return this}recordOperation(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.recordDependencies(e,[Ji]);if(canvas_dependency_tracker_classPrivateFieldGet(ma,this)){const t=ensureDebugMetadata(canvas_dependency_tracker_classPrivateFieldGet(ma,this),e),{dependencies:i}=t;canvas_dependency_tracker_classPrivateFieldGet(ga,this).forEach(i.add,i);canvas_dependency_tracker_classPrivateFieldGet(Pa,this)._savesStack.forEach(i.add,i);canvas_dependency_tracker_classPrivateFieldGet(Pa,this)._markedContentStack.forEach(i.add,i);i.delete(e);t.isRenderingOperation=!0}const i=!t&&e===canvas_dependency_tracker_classPrivateFieldGet(Pa,this)._pendingBBoxIdx;canvas_dependency_tracker_classPrivateFieldGet(Pa,this).recordOperation(e,t,[canvas_dependency_tracker_classPrivateFieldGet(ga,this),canvas_dependency_tracker_classPrivateFieldGet(Pa,this)._savesStack,canvas_dependency_tracker_classPrivateFieldGet(Pa,this)._markedContentStack]);i&&canvas_dependency_tracker_classPrivateFieldGet(ga,this).clear();return this}recordShowTextOperation(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=Array.from(canvas_dependency_tracker_classPrivateFieldGet(ga,this));this.recordOperation(e,t);this.recordIncrementalData("sameLineText",e);for(const e of i)this.recordIncrementalData("sameLineText",e);return this}bboxToClipBoxDropOperation(e){const t=!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&e===canvas_dependency_tracker_classPrivateFieldGet(Pa,this)._pendingBBoxIdx;canvas_dependency_tracker_classPrivateFieldGet(Pa,this).bboxToClipBoxDropOperation(e);t&&canvas_dependency_tracker_classPrivateFieldGet(ga,this).clear();return this}take(){canvas_dependency_tracker_classPrivateFieldGet(fa,this).clear();return canvas_dependency_tracker_classPrivateFieldGet(Pa,this).take()}takeDebugMetadata(){return canvas_dependency_tracker_classPrivateFieldGet(ma,this)}}var wa=new WeakMap,Fa=new WeakMap,ba=new WeakMap,ya=new WeakMap,Sa=new WeakMap;class CanvasNestedDependencyTracker{constructor(e,t,i){canvas_dependency_tracker_classPrivateFieldInitSpec(this,wa,void 0);canvas_dependency_tracker_classPrivateFieldInitSpec(this,Fa,void 0);canvas_dependency_tracker_classPrivateFieldInitSpec(this,ba,void 0);canvas_dependency_tracker_classPrivateFieldInitSpec(this,ya,0);canvas_dependency_tracker_classPrivateFieldInitSpec(this,Sa,0);if(e instanceof CanvasNestedDependencyTracker&&canvas_dependency_tracker_classPrivateFieldGet(ba,e)===!!i)return e;canvas_dependency_tracker_classPrivateFieldSet(wa,this,e);canvas_dependency_tracker_classPrivateFieldSet(Fa,this,t);canvas_dependency_tracker_classPrivateFieldSet(ba,this,!!i)}get clipBox(){return canvas_dependency_tracker_classPrivateFieldGet(wa,this).clipBox}growOperationsCount(){throw new Error("Unreachable")}save(e){var t;canvas_dependency_tracker_classPrivateFieldSet(Sa,this,(t=canvas_dependency_tracker_classPrivateFieldGet(Sa,this),t++,t));canvas_dependency_tracker_classPrivateFieldGet(wa,this).save(canvas_dependency_tracker_classPrivateFieldGet(Fa,this));return this}restore(e){if(canvas_dependency_tracker_classPrivateFieldGet(Sa,this)>0){var t;canvas_dependency_tracker_classPrivateFieldGet(wa,this).restore(canvas_dependency_tracker_classPrivateFieldGet(Fa,this));canvas_dependency_tracker_classPrivateFieldSet(Sa,this,(t=canvas_dependency_tracker_classPrivateFieldGet(Sa,this),t--,t))}return this}recordOpenMarker(e){var t;canvas_dependency_tracker_classPrivateFieldSet(ya,this,(t=canvas_dependency_tracker_classPrivateFieldGet(ya,this),t++,t));return this}getOpenMarker(){return canvas_dependency_tracker_classPrivateFieldGet(ya,this)>0?canvas_dependency_tracker_classPrivateFieldGet(Fa,this):canvas_dependency_tracker_classPrivateFieldGet(wa,this).getOpenMarker()}recordCloseMarker(e){var t;canvas_dependency_tracker_classPrivateFieldSet(ya,this,(t=canvas_dependency_tracker_classPrivateFieldGet(ya,this),t--,t));return this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){canvas_dependency_tracker_classPrivateFieldGet(wa,this).pushBaseTransform(e);return this}popBaseTransform(){canvas_dependency_tracker_classPrivateFieldGet(wa,this).popBaseTransform();return this}recordSimpleData(e,t){canvas_dependency_tracker_classPrivateFieldGet(wa,this).recordSimpleData(e,canvas_dependency_tracker_classPrivateFieldGet(Fa,this));return this}recordIncrementalData(e,t){canvas_dependency_tracker_classPrivateFieldGet(wa,this).recordIncrementalData(e,canvas_dependency_tracker_classPrivateFieldGet(Fa,this));return this}resetIncrementalData(e,t){canvas_dependency_tracker_classPrivateFieldGet(wa,this).resetIncrementalData(e,canvas_dependency_tracker_classPrivateFieldGet(Fa,this));return this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,i){canvas_dependency_tracker_classPrivateFieldGet(wa,this).recordSimpleDataFromNamed(e,t,canvas_dependency_tracker_classPrivateFieldGet(Fa,this));return this}recordFutureForcedDependency(e,t){canvas_dependency_tracker_classPrivateFieldGet(wa,this).recordFutureForcedDependency(e,canvas_dependency_tracker_classPrivateFieldGet(Fa,this));return this}inheritSimpleDataAsFutureForcedDependencies(e){canvas_dependency_tracker_classPrivateFieldGet(wa,this).inheritSimpleDataAsFutureForcedDependencies(e);return this}inheritPendingDependenciesAsFutureForcedDependencies(){canvas_dependency_tracker_classPrivateFieldGet(wa,this).inheritPendingDependenciesAsFutureForcedDependencies();return this}resetBBox(e){canvas_dependency_tracker_classPrivateFieldGet(ba,this)||canvas_dependency_tracker_classPrivateFieldGet(wa,this).resetBBox(canvas_dependency_tracker_classPrivateFieldGet(Fa,this));return this}recordClipBox(e,t,i,a,s,n){canvas_dependency_tracker_classPrivateFieldGet(ba,this)||canvas_dependency_tracker_classPrivateFieldGet(wa,this).recordClipBox(canvas_dependency_tracker_classPrivateFieldGet(Fa,this),t,i,a,s,n);return this}recordBBox(e,t,i,a,s,n){canvas_dependency_tracker_classPrivateFieldGet(ba,this)||canvas_dependency_tracker_classPrivateFieldGet(wa,this).recordBBox(canvas_dependency_tracker_classPrivateFieldGet(Fa,this),t,i,a,s,n);return this}recordCharacterBBox(e,t,i,a,s,n,r){canvas_dependency_tracker_classPrivateFieldGet(ba,this)||canvas_dependency_tracker_classPrivateFieldGet(wa,this).recordCharacterBBox(canvas_dependency_tracker_classPrivateFieldGet(Fa,this),t,i,a,s,n,r);return this}recordFullPageBBox(e){canvas_dependency_tracker_classPrivateFieldGet(ba,this)||canvas_dependency_tracker_classPrivateFieldGet(wa,this).recordFullPageBBox(canvas_dependency_tracker_classPrivateFieldGet(Fa,this));return this}getSimpleIndex(e){return canvas_dependency_tracker_classPrivateFieldGet(wa,this).getSimpleIndex(e)}recordDependencies(e,t){canvas_dependency_tracker_classPrivateFieldGet(wa,this).recordDependencies(canvas_dependency_tracker_classPrivateFieldGet(Fa,this),t);return this}recordNamedDependency(e,t){canvas_dependency_tracker_classPrivateFieldGet(wa,this).recordNamedDependency(canvas_dependency_tracker_classPrivateFieldGet(Fa,this),t);return this}recordOperation(e){canvas_dependency_tracker_classPrivateFieldGet(wa,this).recordOperation(canvas_dependency_tracker_classPrivateFieldGet(Fa,this),!0);return this}recordShowTextOperation(e){canvas_dependency_tracker_classPrivateFieldGet(wa,this).recordShowTextOperation(canvas_dependency_tracker_classPrivateFieldGet(Fa,this),!0);return this}bboxToClipBoxDropOperation(e){canvas_dependency_tracker_classPrivateFieldGet(ba,this)||canvas_dependency_tracker_classPrivateFieldGet(wa,this).bboxToClipBoxDropOperation(canvas_dependency_tracker_classPrivateFieldGet(Fa,this),!0);return this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}}const Ca=["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],xa=["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],ka=["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],Ea=["filter","fillColor","fillAlpha"],Aa=["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],Ga=["transform"],Ba=["transform","fillColor"];var Ma=new WeakMap,Ia=new WeakMap,Ta=new WeakMap,Da=new WeakMap,La=new WeakMap;class CanvasImagesTracker{constructor(e){canvas_dependency_tracker_classPrivateFieldInitSpec(this,Ma,void 0);canvas_dependency_tracker_classPrivateFieldInitSpec(this,Ia,void 0);canvas_dependency_tracker_classPrivateFieldInitSpec(this,Ta,4);canvas_dependency_tracker_classPrivateFieldInitSpec(this,Da,0);canvas_dependency_tracker_classPrivateFieldInitSpec(this,La,new Ra._(6*canvas_dependency_tracker_classPrivateFieldGet(Ta,this)));canvas_dependency_tracker_classPrivateFieldSet(Ma,this,e.width);canvas_dependency_tracker_classPrivateFieldSet(Ia,this,e.height)}record(e,t,i,a){var s;if(canvas_dependency_tracker_classPrivateFieldGet(Da,this)===canvas_dependency_tracker_classPrivateFieldGet(Ta,this)){canvas_dependency_tracker_classPrivateFieldSet(Ta,this,2*canvas_dependency_tracker_classPrivateFieldGet(Ta,this));const e=new Ra._(6*canvas_dependency_tracker_classPrivateFieldGet(Ta,this));e.set(canvas_dependency_tracker_classPrivateFieldGet(La,this));canvas_dependency_tracker_classPrivateFieldSet(La,this,e)}const n=Util.domMatrixToTransform(e.getTransform());let r;if(a[0]!==1/0){const e=[1/0,1/0,-1/0,-1/0];Util.axialAlignedBoundingBox([0,-i,t,0],n,e);const s=Util.intersect(a,e);if(!s)return;const[o,l,d,c]=s;if(o!==e[0]||l!==e[1]||d!==e[2]||c!==e[3]){const e=Math.atan2(n[1],n[0]),t=Math.abs(Math.sin(e)),i=Math.abs(Math.cos(e));if(t<1e-6||i<1e-6||Math.abs(t-i)<1e-6)r=[o,l,o,c,d,l];else{const e=d-o,a=c-l,s=t*t,n=i*i,h=i*t,u=n-s,_=(a*n-e*h)/u;r=[o+(a*h-e*s)/u,l,o,l+_,d,c-_]}}}if(!r){r=[0,-i,0,0,t,-i];Util.applyTransform(r,n,0);Util.applyTransform(r,n,2);Util.applyTransform(r,n,4)}r[0]/=canvas_dependency_tracker_classPrivateFieldGet(Ma,this);r[1]/=canvas_dependency_tracker_classPrivateFieldGet(Ia,this);r[2]/=canvas_dependency_tracker_classPrivateFieldGet(Ma,this);r[3]/=canvas_dependency_tracker_classPrivateFieldGet(Ia,this);r[4]/=canvas_dependency_tracker_classPrivateFieldGet(Ma,this);r[5]/=canvas_dependency_tracker_classPrivateFieldGet(Ia,this);canvas_dependency_tracker_classPrivateFieldGet(La,this).set(r,6*canvas_dependency_tracker_classPrivateFieldGet(Da,this));canvas_dependency_tracker_classPrivateFieldSet(Da,this,(s=canvas_dependency_tracker_classPrivateFieldGet(Da,this),s++,s))}take(){return canvas_dependency_tracker_classPrivateFieldGet(La,this).subarray(0,6*canvas_dependency_tracker_classPrivateFieldGet(Da,this))}}var Ra={_:FeatureTest.isFloat16ArraySupported?Float16Array:Float32Array};function font_loader_defineProperty(e,t,i){return(t=function font_loader_toPropertyKey(e){var t=function font_loader_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function font_loader_classPrivateFieldInitSpec(e,t,i){(function font_loader_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function font_loader_classPrivateFieldGet(e,t){return e.get(font_loader_assertClassBrand(e,t))}function font_loader_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Na=new WeakMap;class FontLoader{constructor(e){let{ownerDocument:t=globalThis.document,styleElement:i=null}=e;font_loader_classPrivateFieldInitSpec(this,Na,new Set);this._document=t;this.nativeFontFaces=new Set;this.styleElement=null;this.loadingRequests=[];this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e);this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e);this._document.fonts.delete(e)}insertRule(e){if(!this.styleElement){this.styleElement=this._document.createElement("style");this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement)}const t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear();font_loader_classPrivateFieldGet(Na,this).clear();if(this.styleElement){this.styleElement.remove();this.styleElement=null}}async loadSystemFont(e){let{systemFontInfo:t,disableFontFace:i,_inspectFont:a}=e;if(t&&!font_loader_classPrivateFieldGet(Na,this).has(t.loadedName)){assert(!i,"loadSystemFont shouldn't be called when `disableFontFace` is set.");if(this.isFontLoadingAPISupported){const{loadedName:e,src:i,style:s}=t,n=new FontFace(e,i,s);this.addNativeFontFace(n);try{await n.load();font_loader_classPrivateFieldGet(Na,this).add(e);a?.(t)}catch{warn(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`);this.removeNativeFontFace(n)}return}unreachable("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;e.attached=!0;if(e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(i){warn(`Failed to load font '${t.family}': '${i}'.`);e.disableFontFace=!0;throw i}}return}const t=e.createFontFaceRule();if(t){this.insertRule(t);if(this.isSyncFontLoadingSupported)return;await new Promise(t=>{const i=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,i)})}}get isFontLoadingAPISupported(){return shadow(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){return shadow(this,"isSyncFontLoadingSupported",a||FeatureTest.platform.isFirefox)}_queueLoadingCallback(e){const{loadingRequests:t}=this,i={done:!1,complete:function completeRequest(){assert(!i.done,"completeRequest() cannot be called twice.");i.done=!0;for(;t.length>0&&t[0].done;){const e=t.shift();setTimeout(e.callback,0)}},callback:e};t.push(i);return i}get _loadTestFont(){return shadow(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(e,t){function int32(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function spliceString(e,t,i,a){return e.substring(0,t)+a+e.substring(t+i)}let i,a;const s=this._document.createElement("canvas");s.width=1;s.height=1;const n=s.getContext("2d");let r=0;const o=`lt${Date.now()}${this.loadTestFontId++}`;let l=this._loadTestFont;l=spliceString(l,976,o.length,o);const d=1482184792;let c=int32(l,16);for(i=0,a=o.length-3;i<a;i+=4)c=c-d+int32(o,i)|0;i<o.length&&(c=c-d+int32(o+"XXX",i)|0);l=spliceString(l,16,4,function string32(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)}(c));const h=`@font-face {font-family:"${o}";src:${`url(data:font/opentype;base64,${btoa(l)});`}}`;this.insertRule(h);const u=this._document.createElement("div");u.style.visibility="hidden";u.style.width=u.style.height="10px";u.style.position="absolute";u.style.top=u.style.left="0px";for(const t of[e.loadedName,o]){const e=this._document.createElement("span");e.textContent="Hi";e.style.fontFamily=t;u.append(e)}this._document.body.append(u);!function isFontReady(e,t){if(++r>30){warn("Load test font never loaded.");t();return}n.font="30px "+e;n.fillText(".",0,20);n.getImageData(0,0,1,1).data[3]>0?t():setTimeout(isFontReady.bind(null,e,t))}(o,()=>{u.remove();t.complete()})}}var Oa,Wa=new WeakMap;class FontFaceObject{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0;font_loader_defineProperty(this,"compiledGlyphs",Object.create(null));font_loader_classPrivateFieldInitSpec(this,Wa,void 0);!function font_loader_classPrivateFieldSet(e,t,i){return e.set(font_loader_assertClassBrand(e,t),i),i}(Wa,this,e);this._inspectFont=t;i&&(this.charProcOperatorList=i);a&&Object.assign(this,a)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`);e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});this._inspectFont?.(this);return e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${this.data.toBase64()});`;let t;if(this.cssFontInfo){let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`);t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${e}}`}else t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;this._inspectFont?.(this,e);return t}getPathGenerator(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];const i=this.loadedName+"_path_"+t;let a;try{a=e.get(i)}catch(e){warn(`getPathGenerator - ignoring character: "${e}".`)}const s=makePathFromDrawOPS(a?.path);this.fontExtraProperties||e.delete(i);return this.compiledGlyphs[t]=s}get black(){return font_loader_classPrivateFieldGet(Wa,this).black}get bold(){return font_loader_classPrivateFieldGet(Wa,this).bold}get disableFontFace(){return font_loader_classPrivateFieldGet(Wa,this).disableFontFace}set disableFontFace(e){shadow(this,"disableFontFace",!!e)}get fontExtraProperties(){return font_loader_classPrivateFieldGet(Wa,this).fontExtraProperties}get isInvalidPDFjsFont(){return font_loader_classPrivateFieldGet(Wa,this).isInvalidPDFjsFont}get isType3Font(){return font_loader_classPrivateFieldGet(Wa,this).isType3Font}get italic(){return font_loader_classPrivateFieldGet(Wa,this).italic}get missingFile(){return font_loader_classPrivateFieldGet(Wa,this).missingFile}get remeasure(){return font_loader_classPrivateFieldGet(Wa,this).remeasure}get vertical(){return font_loader_classPrivateFieldGet(Wa,this).vertical}get ascent(){return font_loader_classPrivateFieldGet(Wa,this).ascent}get defaultWidth(){return font_loader_classPrivateFieldGet(Wa,this).defaultWidth}get descent(){return font_loader_classPrivateFieldGet(Wa,this).descent}get bbox(){return font_loader_classPrivateFieldGet(Wa,this).bbox}get fontMatrix(){return font_loader_classPrivateFieldGet(Wa,this).fontMatrix}get fallbackName(){return font_loader_classPrivateFieldGet(Wa,this).fallbackName}get loadedName(){return font_loader_classPrivateFieldGet(Wa,this).loadedName}get mimetype(){return font_loader_classPrivateFieldGet(Wa,this).mimetype}get name(){return font_loader_classPrivateFieldGet(Wa,this).name}get data(){return font_loader_classPrivateFieldGet(Wa,this).data}clearData(){font_loader_classPrivateFieldGet(Wa,this).clearData()}get cssFontInfo(){return font_loader_classPrivateFieldGet(Wa,this).cssFontInfo}get systemFontInfo(){return font_loader_classPrivateFieldGet(Wa,this).systemFontInfo}get defaultVMetrics(){return font_loader_classPrivateFieldGet(Wa,this).defaultVMetrics}}function obj_bin_transform_utils_defineProperty(e,t,i){return(t=function obj_bin_transform_utils_toPropertyKey(e){var t=function obj_bin_transform_utils_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class CSS_FONT_INFO{}obj_bin_transform_utils_defineProperty(CSS_FONT_INFO,"strings",["fontFamily","fontWeight","italicAngle"]);class SYSTEM_FONT_INFO{}obj_bin_transform_utils_defineProperty(SYSTEM_FONT_INFO,"strings",["css","loadedName","baseFontName","src"]);class FONT_INFO{}Oa=FONT_INFO;obj_bin_transform_utils_defineProperty(FONT_INFO,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]);obj_bin_transform_utils_defineProperty(FONT_INFO,"numbers",["ascent","defaultWidth","descent"]);obj_bin_transform_utils_defineProperty(FONT_INFO,"strings",["fallbackName","loadedName","mimetype","name"]);obj_bin_transform_utils_defineProperty(FONT_INFO,"OFFSET_NUMBERS",Math.ceil(2*Oa.bools.length/8));obj_bin_transform_utils_defineProperty(FONT_INFO,"OFFSET_BBOX",Oa.OFFSET_NUMBERS+8*Oa.numbers.length);obj_bin_transform_utils_defineProperty(FONT_INFO,"OFFSET_FONT_MATRIX",Oa.OFFSET_BBOX+1+8);obj_bin_transform_utils_defineProperty(FONT_INFO,"OFFSET_DEFAULT_VMETRICS",Oa.OFFSET_FONT_MATRIX+1+48);obj_bin_transform_utils_defineProperty(FONT_INFO,"OFFSET_STRINGS",Oa.OFFSET_DEFAULT_VMETRICS+1+6);class PATTERN_INFO{}obj_bin_transform_utils_defineProperty(PATTERN_INFO,"KIND",0);obj_bin_transform_utils_defineProperty(PATTERN_INFO,"HAS_BBOX",1);obj_bin_transform_utils_defineProperty(PATTERN_INFO,"HAS_BACKGROUND",2);obj_bin_transform_utils_defineProperty(PATTERN_INFO,"SHADING_TYPE",3);obj_bin_transform_utils_defineProperty(PATTERN_INFO,"N_COORD",4);obj_bin_transform_utils_defineProperty(PATTERN_INFO,"N_COLOR",8);obj_bin_transform_utils_defineProperty(PATTERN_INFO,"N_STOP",12);obj_bin_transform_utils_defineProperty(PATTERN_INFO,"N_FIGURES",16);function obj_bin_transform_display_classPrivateMethodInitSpec(e,t){obj_bin_transform_display_checkPrivateRedeclaration(e,t),t.add(e)}function obj_bin_transform_display_classPrivateFieldInitSpec(e,t,i){obj_bin_transform_display_checkPrivateRedeclaration(e,t),t.set(e,i)}function obj_bin_transform_display_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function obj_bin_transform_display_classPrivateFieldGet(e,t){return e.get(obj_bin_transform_display_assertClassBrand(e,t))}function obj_bin_transform_display_classPrivateFieldSet(e,t,i){return e.set(obj_bin_transform_display_assertClassBrand(e,t),i),i}function obj_bin_transform_display_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var ja=new WeakMap,Va=new WeakMap,Ua=new WeakMap,za=new WeakSet;class CssFontInfo{constructor(e){obj_bin_transform_display_classPrivateMethodInitSpec(this,za);obj_bin_transform_display_classPrivateFieldInitSpec(this,ja,void 0);obj_bin_transform_display_classPrivateFieldInitSpec(this,Va,new TextDecoder);obj_bin_transform_display_classPrivateFieldInitSpec(this,Ua,void 0);obj_bin_transform_display_classPrivateFieldSet(ja,this,e);obj_bin_transform_display_classPrivateFieldSet(Ua,this,new DataView(e))}get fontFamily(){return obj_bin_transform_display_assertClassBrand(za,this,_readString).call(this,0)}get fontWeight(){return obj_bin_transform_display_assertClassBrand(za,this,_readString).call(this,1)}get italicAngle(){return obj_bin_transform_display_assertClassBrand(za,this,_readString).call(this,2)}}function _readString(e){assert(e<CSS_FONT_INFO.strings.length,"Invalid string index");let t=0;for(let i=0;i<e;i++)t+=obj_bin_transform_display_classPrivateFieldGet(Ua,this).getUint32(t)+4;const i=obj_bin_transform_display_classPrivateFieldGet(Ua,this).getUint32(t);return obj_bin_transform_display_classPrivateFieldGet(Va,this).decode(new Uint8Array(obj_bin_transform_display_classPrivateFieldGet(ja,this),t+4,i))}var Ha=new WeakMap,$a=new WeakMap,qa=new WeakMap,Xa=new WeakSet;class SystemFontInfo{constructor(e){obj_bin_transform_display_classPrivateMethodInitSpec(this,Xa);obj_bin_transform_display_classPrivateFieldInitSpec(this,Ha,void 0);obj_bin_transform_display_classPrivateFieldInitSpec(this,$a,new TextDecoder);obj_bin_transform_display_classPrivateFieldInitSpec(this,qa,void 0);obj_bin_transform_display_classPrivateFieldSet(Ha,this,e);obj_bin_transform_display_classPrivateFieldSet(qa,this,new DataView(e))}get guessFallback(){return 0!==obj_bin_transform_display_classPrivateFieldGet(qa,this).getUint8(0)}get css(){return obj_bin_transform_display_assertClassBrand(Xa,this,_readString2).call(this,0)}get loadedName(){return obj_bin_transform_display_assertClassBrand(Xa,this,_readString2).call(this,1)}get baseFontName(){return obj_bin_transform_display_assertClassBrand(Xa,this,_readString2).call(this,2)}get src(){return obj_bin_transform_display_assertClassBrand(Xa,this,_readString2).call(this,3)}get style(){let e=1;e+=4+obj_bin_transform_display_classPrivateFieldGet(qa,this).getUint32(e);const t=obj_bin_transform_display_classPrivateFieldGet(qa,this).getUint32(e),i=obj_bin_transform_display_classPrivateFieldGet($a,this).decode(new Uint8Array(obj_bin_transform_display_classPrivateFieldGet(Ha,this),e+4,t));e+=4+t;const a=obj_bin_transform_display_classPrivateFieldGet(qa,this).getUint32(e);return{style:i,weight:obj_bin_transform_display_classPrivateFieldGet($a,this).decode(new Uint8Array(obj_bin_transform_display_classPrivateFieldGet(Ha,this),e+4,a))}}}function _readString2(e){assert(e<SYSTEM_FONT_INFO.strings.length,"Invalid string index");let t=5;for(let i=0;i<e;i++)t+=obj_bin_transform_display_classPrivateFieldGet(qa,this).getUint32(t)+4;const i=obj_bin_transform_display_classPrivateFieldGet(qa,this).getUint32(t);return obj_bin_transform_display_classPrivateFieldGet($a,this).decode(new Uint8Array(obj_bin_transform_display_classPrivateFieldGet(Ha,this),t+4,i))}var Ka=new WeakMap,Ya=new WeakMap,Za=new WeakMap,Ja=new WeakSet;class FontInfo{constructor(e){let{buffer:t,extra:i}=e;obj_bin_transform_display_classPrivateMethodInitSpec(this,Ja);obj_bin_transform_display_classPrivateFieldInitSpec(this,Ka,void 0);obj_bin_transform_display_classPrivateFieldInitSpec(this,Ya,new TextDecoder);obj_bin_transform_display_classPrivateFieldInitSpec(this,Za,void 0);obj_bin_transform_display_classPrivateFieldSet(Ka,this,t);obj_bin_transform_display_classPrivateFieldSet(Za,this,new DataView(t));i&&Object.assign(this,i)}get black(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readBoolean).call(this,0)}get bold(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readBoolean).call(this,1)}get disableFontFace(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readBoolean).call(this,2)}get fontExtraProperties(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readBoolean).call(this,3)}get isInvalidPDFjsFont(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readBoolean).call(this,4)}get isType3Font(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readBoolean).call(this,5)}get italic(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readBoolean).call(this,6)}get missingFile(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readBoolean).call(this,7)}get remeasure(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readBoolean).call(this,8)}get vertical(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readBoolean).call(this,9)}get ascent(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readNumber).call(this,0)}get defaultWidth(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readNumber).call(this,1)}get descent(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readNumber).call(this,2)}get bbox(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readArray).call(this,FONT_INFO.OFFSET_BBOX,4,"getInt16",2)}get fontMatrix(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readArray).call(this,FONT_INFO.OFFSET_FONT_MATRIX,6,"getFloat64",8)}get defaultVMetrics(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readArray).call(this,FONT_INFO.OFFSET_DEFAULT_VMETRICS,3,"getInt16",2)}get fallbackName(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readString3).call(this,0)}get loadedName(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readString3).call(this,1)}get mimetype(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readString3).call(this,2)}get name(){return obj_bin_transform_display_assertClassBrand(Ja,this,_readString3).call(this,3)}get data(){const{offset:e,length:t}=obj_bin_transform_display_assertClassBrand(Ja,this,_getDataOffsets).call(this);return 0===t?void 0:new Uint8Array(obj_bin_transform_display_classPrivateFieldGet(Ka,this),e+4,t)}clearData(){const{offset:e,length:t}=obj_bin_transform_display_assertClassBrand(Ja,this,_getDataOffsets).call(this);if(0!==t){obj_bin_transform_display_classPrivateFieldGet(Za,this).setUint32(e,0);obj_bin_transform_display_classPrivateFieldSet(Ka,this,new Uint8Array(obj_bin_transform_display_classPrivateFieldGet(Ka,this),0,e+4).slice().buffer);obj_bin_transform_display_classPrivateFieldSet(Za,this,new DataView(obj_bin_transform_display_classPrivateFieldGet(Ka,this)))}}get cssFontInfo(){let e=FONT_INFO.OFFSET_STRINGS;e+=4+obj_bin_transform_display_classPrivateFieldGet(Za,this).getUint32(e);e+=4+obj_bin_transform_display_classPrivateFieldGet(Za,this).getUint32(e);const t=obj_bin_transform_display_classPrivateFieldGet(Za,this).getUint32(e);if(0===t)return null;const i=new Uint8Array(t);i.set(new Uint8Array(obj_bin_transform_display_classPrivateFieldGet(Ka,this),e+4,t));return new CssFontInfo(i.buffer)}get systemFontInfo(){let e=FONT_INFO.OFFSET_STRINGS;e+=4+obj_bin_transform_display_classPrivateFieldGet(Za,this).getUint32(e);const t=obj_bin_transform_display_classPrivateFieldGet(Za,this).getUint32(e);if(0===t)return null;const i=new Uint8Array(t);i.set(new Uint8Array(obj_bin_transform_display_classPrivateFieldGet(Ka,this),e+4,t));return new SystemFontInfo(i.buffer)}}function _readBoolean(e){assert(e<FONT_INFO.bools.length,"Invalid boolean index");const t=Math.floor(e/4),i=2*e%8,a=obj_bin_transform_display_classPrivateFieldGet(Za,this).getUint8(t)>>i&3;return 0===a?void 0:2===a}function _readNumber(e){assert(e<FONT_INFO.numbers.length,"Invalid number index");return obj_bin_transform_display_classPrivateFieldGet(Za,this).getFloat64(FONT_INFO.OFFSET_NUMBERS+8*e)}function _readArray(e,t,i,a){const s=obj_bin_transform_display_classPrivateFieldGet(Za,this).getUint8(e);if(0===s)return;assert(s===t,"Invalid array length.");e+=1;const n=new Array(s);for(let t=0;t<s;t++){n[t]=obj_bin_transform_display_classPrivateFieldGet(Za,this)[i](e,!0);e+=a}return n}function _readString3(e){assert(e<FONT_INFO.strings.length,"Invalid string index");let t=FONT_INFO.OFFSET_STRINGS+4;for(let i=0;i<e;i++)t+=obj_bin_transform_display_classPrivateFieldGet(Za,this).getUint32(t)+4;const i=obj_bin_transform_display_classPrivateFieldGet(Za,this).getUint32(t);return obj_bin_transform_display_classPrivateFieldGet(Ya,this).decode(new Uint8Array(obj_bin_transform_display_classPrivateFieldGet(Ka,this),t+4,i))}function _getDataOffsets(){let e=FONT_INFO.OFFSET_STRINGS;e+=4+obj_bin_transform_display_classPrivateFieldGet(Za,this).getUint32(e);e+=4+obj_bin_transform_display_classPrivateFieldGet(Za,this).getUint32(e);e+=4+obj_bin_transform_display_classPrivateFieldGet(Za,this).getUint32(e);return{offset:e,length:obj_bin_transform_display_classPrivateFieldGet(Za,this).getUint32(e)}}class PatternInfo{constructor(e){this.buffer=e;this.view=new DataView(e);this.data=new Uint8Array(e)}getIR(){const e=this.view,t=this.data[PATTERN_INFO.KIND],i=!!this.data[PATTERN_INFO.HAS_BBOX],a=!!this.data[PATTERN_INFO.HAS_BACKGROUND],s=e.getUint32(PATTERN_INFO.N_COORD,!0),n=e.getUint32(PATTERN_INFO.N_COLOR,!0),r=e.getUint32(PATTERN_INFO.N_STOP,!0),o=e.getUint32(PATTERN_INFO.N_FIGURES,!0);let l=20;const d=new Float32Array(this.buffer,l,2*s);l+=8*s;const c=new Uint8Array(this.buffer,l,3*n);l+=3*n;const h=[];for(let t=0;t<r;++t){const t=e.getFloat32(l,!0);l+=4;const i=e.getUint32(l,!0);l+=4;h.push([t,`#${i.toString(16).padStart(6,"0")}`])}let u=null;if(i){u=[];for(let t=0;t<4;++t){u.push(e.getFloat32(l,!0));l+=4}}let _=null;if(a){_=new Uint8Array(this.buffer,l,3);l+=3}const p=[];for(let t=0;t<o;++t){const t=e.getUint8(l);l+=1;l=4*Math.ceil(l/4);const i=e.getUint32(l,!0);l+=4;const a=new Int32Array(this.buffer,l,i);l+=4*i;const s=e.getUint32(l,!0);l+=4;const n=new Int32Array(this.buffer,l,s);l+=4*s;const r={type:t,coords:a,colors:n};if(t===w){r.verticesPerRow=e.getUint32(l,!0);l+=4}p.push(r)}if(1===t)return["RadialAxial","axial",u,h,Array.from(d.slice(0,2)),Array.from(d.slice(2,4)),null,null];if(2===t)return["RadialAxial","radial",u,h,[d[0],d[1]],[d[3],d[4]],d[2],d[5]];if(3===t){const e=this.data[PATTERN_INFO.SHADING_TYPE];let t=null;if(d.length>0){t=[1/0,1/0,-1/0,-1/0];for(let e=0,i=d.length;e<i;e+=2)Util.pointBoundingBox(d[e],d[e+1],t)}return["Mesh",e,d,c,p,t,u,_]}throw new Error(`Unsupported pattern kind: ${t}`)}}var Qa=new WeakMap;class FontPathInfo{constructor(e){obj_bin_transform_display_classPrivateFieldInitSpec(this,Qa,void 0);obj_bin_transform_display_classPrivateFieldSet(Qa,this,e)}get path(){return FeatureTest.isFloat16ArraySupported?new Float16Array(obj_bin_transform_display_classPrivateFieldGet(Qa,this)):new Float32Array(obj_bin_transform_display_classPrivateFieldGet(Qa,this))}}function api_utils_classPrivateFieldInitSpec(e,t,i){(function api_utils_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function api_utils_classPrivateFieldGet(e,t){return e.get(function api_utils_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}(e,t))}function getFactoryUrlProp(e){if("string"!=typeof e)return null;if(e.endsWith("/"))return e;throw new Error(`Invalid factory url: "${e}" must include trailing slash.`)}const isRefProxy=e=>"object"==typeof e&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0,es=function _isValidExplicitDest(e,t,i){if(!Array.isArray(i)||i.length<2)return!1;const[a,s,...n]=i;if(!e(a)&&!Number.isInteger(a))return!1;if(!t(s))return!1;const r=n.length;let o=!0;switch(s.name){case"XYZ":if(r<2||r>3)return!1;break;case"Fit":case"FitB":return 0===r;case"FitH":case"FitBH":case"FitV":case"FitBV":if(r>1)return!1;break;case"FitR":if(4!==r)return!1;o=!1;break;default:return!1}for(const e of n)if(!("number"==typeof e||o&&null===e))return!1;return!0}.bind(null,isRefProxy,e=>"object"==typeof e&&"string"==typeof e?.name);var ts=new WeakMap,is=new WeakMap;class LoopbackPort{constructor(){api_utils_classPrivateFieldInitSpec(this,ts,new Map);api_utils_classPrivateFieldInitSpec(this,is,Promise.resolve())}postMessage(e,t){const i={data:structuredClone(e,t?{transfer:t}:null)};api_utils_classPrivateFieldGet(is,this).then(()=>{for(const[e]of api_utils_classPrivateFieldGet(ts,this))e.call(this,i)})}addEventListener(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=null;if(i?.signal instanceof AbortSignal){const{signal:s}=i;if(s.aborted){warn("LoopbackPort - cannot use an `aborted` signal.");return}const onAbort=()=>this.removeEventListener(e,t);a=()=>s.removeEventListener("abort",onAbort);s.addEventListener("abort",onAbort)}api_utils_classPrivateFieldGet(ts,this).set(t,a)}removeEventListener(e,t){const i=api_utils_classPrivateFieldGet(ts,this).get(t);i?.();api_utils_classPrivateFieldGet(ts,this).delete(t)}terminate(){for(const[,e]of api_utils_classPrivateFieldGet(ts,this))e?.();api_utils_classPrivateFieldGet(ts,this).clear()}}__webpack_require__(1689);function message_handler_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function message_handler_classPrivateFieldGet(e,t){return e.get(message_handler_assertClassBrand(e,t))}function message_handler_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const as=1,ss=2,ns=1,rs=2,os=3,ls=4,ds=5,cs=6,hs=7,us=8;function onFn(){}function wrapReason(e){if(e instanceof AbortException||e instanceof InvalidPDFException||e instanceof PasswordException||e instanceof ResponseException||e instanceof UnknownErrorException)return e;e instanceof Error||"object"==typeof e&&null!==e||unreachable('wrapReason: Expected "reason" to be a (possibly cloned) Error.');switch(e.name){case"AbortException":return new AbortException(e.message);case"InvalidPDFException":return new InvalidPDFException(e.message);case"PasswordException":return new PasswordException(e.message,e.code);case"ResponseException":return new ResponseException(e.message,e.status,e.missing);case"UnknownErrorException":return new UnknownErrorException(e.message,e.details)}return new UnknownErrorException(e.message,e.toString())}var _s=new WeakMap,ps=new WeakSet;class MessageHandler{constructor(e,t,i){!function message_handler_classPrivateMethodInitSpec(e,t){message_handler_checkPrivateRedeclaration(e,t),t.add(e)}(this,ps);!function message_handler_classPrivateFieldInitSpec(e,t,i){message_handler_checkPrivateRedeclaration(e,t),t.set(e,i)}(this,_s,new AbortController);this.sourceName=e;this.targetName=t;this.comObj=i;this.callbackId=1;this.streamId=1;this.streamSinks=Object.create(null);this.streamControllers=Object.create(null);this.callbackCapabilities=Object.create(null);this.actionHandler=Object.create(null);i.addEventListener("message",message_handler_assertClassBrand(ps,this,_onMessage).bind(this),{signal:message_handler_classPrivateFieldGet(_s,this).signal})}on(e,t){const i=this.actionHandler;if(i[e])throw new Error(`There is already an actionName called "${e}"`);i[e]=t}send(e,t,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},i)}sendWithPromise(e,t,i){const a=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[a]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:a,data:t},i)}catch(e){s.reject(e)}return s.promise}sendWithStream(e,t,i,a){const s=this.streamId++,n=this.sourceName,r=this.targetName,o=this.comObj;return new ReadableStream({start:i=>{const l=Promise.withResolvers();this.streamControllers[s]={controller:i,startCall:l,pullCall:null,cancelCall:null,isClosed:!1};o.postMessage({sourceName:n,targetName:r,action:e,streamId:s,data:t,desiredSize:i.desiredSize},a);return l.promise},pull:e=>{const t=Promise.withResolvers();this.streamControllers[s].pullCall=t;o.postMessage({sourceName:n,targetName:r,stream:cs,streamId:s,desiredSize:e.desiredSize});return t.promise},cancel:e=>{assert(e instanceof Error,"cancel must have a valid reason");const t=Promise.withResolvers();this.streamControllers[s].cancelCall=t;this.streamControllers[s].isClosed=!0;o.postMessage({sourceName:n,targetName:r,stream:ns,streamId:s,reason:wrapReason(e)});return t.promise}},i)}destroy(){message_handler_classPrivateFieldGet(_s,this)?.abort();!function message_handler_classPrivateFieldSet(e,t,i){return e.set(message_handler_assertClassBrand(e,t),i),i}(_s,this,null)}}function _onMessage(e){let{data:t}=e;if(t.targetName!==this.sourceName)return;if(t.stream){message_handler_assertClassBrand(ps,this,_processStreamMessage).call(this,t);return}if(t.callback){const e=t.callbackId,i=this.callbackCapabilities[e];if(!i)throw new Error(`Cannot resolve callback ${e}`);delete this.callbackCapabilities[e];if(t.callback===as)i.resolve(t.data);else{if(t.callback!==ss)throw new Error("Unexpected callback case");i.reject(wrapReason(t.reason))}return}const i=this.actionHandler[t.action];if(!i)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const e=this.sourceName,a=t.sourceName,s=this.comObj;Promise.try(i,t.data).then(function(i){s.postMessage({sourceName:e,targetName:a,callback:as,callbackId:t.callbackId,data:i})},function(i){s.postMessage({sourceName:e,targetName:a,callback:ss,callbackId:t.callbackId,reason:wrapReason(i)})});return}t.streamId?message_handler_assertClassBrand(ps,this,_createStreamSink).call(this,t):i(t.data)}function _createStreamSink(e){const t=e.streamId,i=this.sourceName,a=e.sourceName,s=this.comObj,n=this,r=this.actionHandler[e.action],o={enqueue(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;const o=this.desiredSize;this.desiredSize-=n;if(o>0&&this.desiredSize<=0){this.sinkCapability=Promise.withResolvers();this.ready=this.sinkCapability.promise}s.postMessage({sourceName:i,targetName:a,stream:ls,streamId:t,chunk:e},r)},close(){if(!this.isCancelled){this.isCancelled=!0;s.postMessage({sourceName:i,targetName:a,stream:os,streamId:t});delete n.streamSinks[t]}},error(e){assert(e instanceof Error,"error must have a valid reason");if(!this.isCancelled){this.isCancelled=!0;s.postMessage({sourceName:i,targetName:a,stream:ds,streamId:t,reason:wrapReason(e)})}},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};o.sinkCapability.resolve();o.ready=o.sinkCapability.promise;this.streamSinks[t]=o;Promise.try(r,e.data,o).then(function(){s.postMessage({sourceName:i,targetName:a,stream:us,streamId:t,success:!0})},function(e){s.postMessage({sourceName:i,targetName:a,stream:us,streamId:t,reason:wrapReason(e)})})}function _processStreamMessage(e){const t=e.streamId,i=this.sourceName,a=e.sourceName,s=this.comObj,n=this.streamControllers[t],r=this.streamSinks[t];switch(e.stream){case us:e.success?n.startCall.resolve():n.startCall.reject(wrapReason(e.reason));break;case hs:e.success?n.pullCall.resolve():n.pullCall.reject(wrapReason(e.reason));break;case cs:if(!r){s.postMessage({sourceName:i,targetName:a,stream:hs,streamId:t,success:!0});break}r.desiredSize<=0&&e.desiredSize>0&&r.sinkCapability.resolve();r.desiredSize=e.desiredSize;Promise.try(r.onPull||onFn).then(function(){s.postMessage({sourceName:i,targetName:a,stream:hs,streamId:t,success:!0})},function(e){s.postMessage({sourceName:i,targetName:a,stream:hs,streamId:t,reason:wrapReason(e)})});break;case ls:assert(n,"enqueue should have stream controller");if(n.isClosed)break;n.controller.enqueue(e.chunk);break;case os:assert(n,"close should have stream controller");if(n.isClosed)break;n.isClosed=!0;n.controller.close();message_handler_assertClassBrand(ps,this,_deleteStreamController).call(this,n,t);break;case ds:assert(n,"error should have stream controller");n.controller.error(wrapReason(e.reason));message_handler_assertClassBrand(ps,this,_deleteStreamController).call(this,n,t);break;case rs:e.success?n.cancelCall.resolve():n.cancelCall.reject(wrapReason(e.reason));message_handler_assertClassBrand(ps,this,_deleteStreamController).call(this,n,t);break;case ns:if(!r)break;const o=wrapReason(e.reason);Promise.try(r.onCancel||onFn,o).then(function(){s.postMessage({sourceName:i,targetName:a,stream:rs,streamId:t,success:!0})},function(e){s.postMessage({sourceName:i,targetName:a,stream:rs,streamId:t,reason:wrapReason(e)})});r.sinkCapability.reject(o);r.isCancelled=!0;delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async function _deleteStreamController(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]);delete this.streamControllers[t]}function binary_data_factory_classPrivateFieldInitSpec(e,t,i){(function binary_data_factory_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function binary_data_factory_classPrivateFieldGet(e,t){return e.get(function binary_data_factory_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}(e,t))}var gs=new WeakMap;class BaseBinaryDataFactory{constructor(e){let{cMapUrl:t=null,standardFontDataUrl:i=null,wasmUrl:a=null}=e;binary_data_factory_classPrivateFieldInitSpec(this,gs,Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"}));this.cMapUrl=t;this.standardFontDataUrl=i;this.wasmUrl=a}async fetch(e){let{kind:t,filename:i}=e;switch(t){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:unreachable(`Not implemented: ${t}`)}const a=this[t];if(!a)throw new Error(`Ensure that the \`${t}\` API parameter is provided.`);const s=`${a}${i}`;return this._fetch(s,t).catch(e=>{throw new Error(`Unable to load ${binary_data_factory_classPrivateFieldGet(gs,this)[t]} data at: ${s}`)})}async _fetch(e,t){unreachable("Abstract method `_fetch` called.")}}class DOMBinaryDataFactory extends BaseBinaryDataFactory{async _fetch(e,t){const i="cMapUrl"!==t||e.endsWith(".bcmap")?"bytes":"text",a=await fetchData(e,i);return a instanceof Uint8Array?a:stringToBytes(a)}}function canvas_factory_classPrivateFieldInitSpec(e,t,i){(function canvas_factory_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function canvas_factory_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var fs=new WeakMap;class BaseCanvasFactory{constructor(e){let{enableHWA:t=!1}=e;canvas_factory_classPrivateFieldInitSpec(this,fs,!1);!function canvas_factory_classPrivateFieldSet(e,t,i){return e.set(canvas_factory_assertClassBrand(e,t),i),i}(fs,this,t)}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(e,t);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!(a=fs,s=this,a.get(canvas_factory_assertClassBrand(a,s)))})};var a,s}reset(e,t,i){let{canvas:a}=e;if(!a)throw new Error("Canvas is not specified");if(t<=0||i<=0)throw new Error("Invalid canvas size");a.width=t;a.height=i}destroy(e){const{canvas:t}=e;if(!t)throw new Error("Canvas is not specified");t.width=t.height=0;e.canvas=null;e.context=null}_createCanvas(e,t){unreachable("Abstract method `_createCanvas` called.")}}class DOMCanvasFactory extends BaseCanvasFactory{constructor(e){let{ownerDocument:t=globalThis.document,enableHWA:i=!1}=e;super({enableHWA:i});this._document=t}_createCanvas(e,t){const i=this._document.createElement("canvas");i.width=e;i.height=t;return i}}__webpack_require__(2489);function filter_factory_classPrivateFieldInitSpec(e,t,i){filter_factory_checkPrivateRedeclaration(e,t),t.set(e,i)}function filter_factory_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function filter_factory_classPrivateGetter(e,t,i){return i(filter_factory_assertClassBrand(e,t))}function filter_factory_classPrivateFieldGet(e,t){return e.get(filter_factory_assertClassBrand(e,t))}function filter_factory_classPrivateFieldSet(e,t,i){return e.set(filter_factory_assertClassBrand(e,t),i),i}function filter_factory_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}class BaseFilterFactory{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,i,a,s){return"none"}destroy(){}}var ms=new WeakMap,vs=new WeakMap,Ps=new WeakMap,ws=new WeakMap,Fs=new WeakMap,bs=new WeakMap,ys=new WeakMap,Ss=new WeakSet;class DOMFilterFactory extends BaseFilterFactory{constructor(e){let{docId:t,ownerDocument:i=globalThis.document}=e;super();!function filter_factory_classPrivateMethodInitSpec(e,t){filter_factory_checkPrivateRedeclaration(e,t),t.add(e)}(this,Ss);filter_factory_classPrivateFieldInitSpec(this,ms,void 0);filter_factory_classPrivateFieldInitSpec(this,vs,void 0);filter_factory_classPrivateFieldInitSpec(this,Ps,void 0);filter_factory_classPrivateFieldInitSpec(this,ws,void 0);filter_factory_classPrivateFieldInitSpec(this,Fs,void 0);filter_factory_classPrivateFieldInitSpec(this,bs,void 0);filter_factory_classPrivateFieldInitSpec(this,ys,0);filter_factory_classPrivateFieldSet(ws,this,t);filter_factory_classPrivateFieldSet(Fs,this,i)}addFilter(e){var t,i;if(!e)return"none";let a=filter_factory_classPrivateGetter(Ss,this,_get_cache).get(e);if(a)return a;const[s,n,r]=filter_factory_assertClassBrand(Ss,this,_createTables).call(this,e),o=1===e.length?s:`${s}${n}${r}`;a=filter_factory_classPrivateGetter(Ss,this,_get_cache).get(o);if(a){filter_factory_classPrivateGetter(Ss,this,_get_cache).set(e,a);return a}const l=`g_${filter_factory_classPrivateFieldGet(ws,this)}_transfer_map_${filter_factory_classPrivateFieldSet(ys,this,(t=filter_factory_classPrivateFieldGet(ys,this),i=t++,t)),i}`,d=filter_factory_assertClassBrand(Ss,this,_createUrl).call(this,l);filter_factory_classPrivateGetter(Ss,this,_get_cache).set(e,d);filter_factory_classPrivateGetter(Ss,this,_get_cache).set(o,d);const c=filter_factory_assertClassBrand(Ss,this,_createFilter).call(this,l);filter_factory_assertClassBrand(Ss,this,_addTransferMapConversion).call(this,s,n,r,c);return d}addHCMFilter(e,t){const i=`${e}-${t}`,a="base";let s=filter_factory_classPrivateGetter(Ss,this,_get_hcmCache).get(a);if(s?.key===i)return s.url;if(s){s.filter?.remove();s.key=i;s.url="none";s.filter=null}else{s={key:i,url:"none",filter:null};filter_factory_classPrivateGetter(Ss,this,_get_hcmCache).set(a,s)}if(!e||!t)return s.url;const n=filter_factory_assertClassBrand(Ss,this,_getRGB).call(this,e);e=Util.makeHexColor(...n);const r=filter_factory_assertClassBrand(Ss,this,_getRGB).call(this,t);t=Util.makeHexColor(...r);filter_factory_classPrivateGetter(Ss,this,_get_defs).style.color="";if("#000000"===e&&"#ffffff"===t||e===t)return s.url;const o=new Array(256);for(let e=0;e<=255;e++){const t=e/255;o[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const l=o.join(","),d=`g_${filter_factory_classPrivateFieldGet(ws,this)}_hcm_filter`,c=s.filter=filter_factory_assertClassBrand(Ss,this,_createFilter).call(this,d);filter_factory_assertClassBrand(Ss,this,_addTransferMapConversion).call(this,l,l,l,c);filter_factory_assertClassBrand(Ss,this,_addGrayConversion).call(this,c);const getSteps=(e,t)=>{const i=n[e]/255,a=r[e]/255,s=new Array(t+1);for(let e=0;e<=t;e++)s[e]=i+e/t*(a-i);return s.join(",")};filter_factory_assertClassBrand(Ss,this,_addTransferMapConversion).call(this,getSteps(0,5),getSteps(1,5),getSteps(2,5),c);s.url=filter_factory_assertClassBrand(Ss,this,_createUrl).call(this,d);return s.url}addAlphaFilter(e){var t,i;let a=filter_factory_classPrivateGetter(Ss,this,_get_cache).get(e);if(a)return a;const[s]=filter_factory_assertClassBrand(Ss,this,_createTables).call(this,[e]),n=`alpha_${s}`;a=filter_factory_classPrivateGetter(Ss,this,_get_cache).get(n);if(a){filter_factory_classPrivateGetter(Ss,this,_get_cache).set(e,a);return a}const r=`g_${filter_factory_classPrivateFieldGet(ws,this)}_alpha_map_${filter_factory_classPrivateFieldSet(ys,this,(t=filter_factory_classPrivateFieldGet(ys,this),i=t++,t)),i}`,o=filter_factory_assertClassBrand(Ss,this,_createUrl).call(this,r);filter_factory_classPrivateGetter(Ss,this,_get_cache).set(e,o);filter_factory_classPrivateGetter(Ss,this,_get_cache).set(n,o);const l=filter_factory_assertClassBrand(Ss,this,_createFilter).call(this,r);filter_factory_assertClassBrand(Ss,this,_addTransferMapAlphaConversion).call(this,s,l);return o}addLuminosityFilter(e){var t,i;let a,s,n=filter_factory_classPrivateGetter(Ss,this,_get_cache).get(e||"luminosity");if(n)return n;if(e){[a]=filter_factory_assertClassBrand(Ss,this,_createTables).call(this,[e]);s=`luminosity_${a}`}else s="luminosity";n=filter_factory_classPrivateGetter(Ss,this,_get_cache).get(s);if(n){filter_factory_classPrivateGetter(Ss,this,_get_cache).set(e,n);return n}const r=`g_${filter_factory_classPrivateFieldGet(ws,this)}_luminosity_map_${filter_factory_classPrivateFieldSet(ys,this,(t=filter_factory_classPrivateFieldGet(ys,this),i=t++,t)),i}`,o=filter_factory_assertClassBrand(Ss,this,_createUrl).call(this,r);filter_factory_classPrivateGetter(Ss,this,_get_cache).set(e,o);filter_factory_classPrivateGetter(Ss,this,_get_cache).set(s,o);const l=filter_factory_assertClassBrand(Ss,this,_createFilter).call(this,r);filter_factory_assertClassBrand(Ss,this,_addLuminosityConversion).call(this,l);e&&filter_factory_assertClassBrand(Ss,this,_addTransferMapAlphaConversion).call(this,a,l);return o}addHighlightHCMFilter(e,t,i,a,s){const n=`${t}-${i}-${a}-${s}`;let r=filter_factory_classPrivateGetter(Ss,this,_get_hcmCache).get(e);if(r?.key===n)return r.url;if(r){r.filter?.remove();r.key=n;r.url="none";r.filter=null}else{r={key:n,url:"none",filter:null};filter_factory_classPrivateGetter(Ss,this,_get_hcmCache).set(e,r)}if(!t||!i)return r.url;const[o,l]=[t,i].map(filter_factory_assertClassBrand(Ss,this,_getRGB).bind(this));let d=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),c=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[h,u]=[a,s].map(filter_factory_assertClassBrand(Ss,this,_getRGB).bind(this));c<d&&([d,c,h,u]=[c,d,u,h]);filter_factory_classPrivateGetter(Ss,this,_get_defs).style.color="";const getSteps=(e,t,i)=>{const a=new Array(256),s=(c-d)/i,n=e/255,r=(t-e)/(255*i);let o=0;for(let e=0;e<=i;e++){const t=Math.round(d+e*s),i=n+e*r;for(let e=o;e<=t;e++)a[e]=i;o=t+1}for(let e=o;e<256;e++)a[e]=a[o-1];return a.join(",")},_=`g_${filter_factory_classPrivateFieldGet(ws,this)}_hcm_${e}_filter`,p=r.filter=filter_factory_assertClassBrand(Ss,this,_createFilter).call(this,_);filter_factory_assertClassBrand(Ss,this,_addGrayConversion).call(this,p);filter_factory_assertClassBrand(Ss,this,_addTransferMapConversion).call(this,getSteps(h[0],u[0],5),getSteps(h[1],u[1],5),getSteps(h[2],u[2],5),p);r.url=filter_factory_assertClassBrand(Ss,this,_createUrl).call(this,_);return r.url}destroy(){if(!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])||!filter_factory_classPrivateFieldGet(bs,this)?.size){filter_factory_classPrivateFieldGet(Ps,this)?.parentNode.parentNode.remove();filter_factory_classPrivateFieldSet(Ps,this,null);filter_factory_classPrivateFieldGet(vs,this)?.clear();filter_factory_classPrivateFieldSet(vs,this,null);filter_factory_classPrivateFieldGet(bs,this)?.clear();filter_factory_classPrivateFieldSet(bs,this,null);filter_factory_classPrivateFieldSet(ys,this,0)}}}function _get_cache(e){return filter_factory_classPrivateFieldGet(vs,e)||filter_factory_classPrivateFieldSet(vs,e,new Map)}function _get_hcmCache(e){return filter_factory_classPrivateFieldGet(bs,e)||filter_factory_classPrivateFieldSet(bs,e,new Map)}function _get_defs(e){if(!filter_factory_classPrivateFieldGet(Ps,e)){const t=filter_factory_classPrivateFieldGet(Fs,e).createElement("div"),{style:i}=t;i.visibility="hidden";i.contain="strict";i.width=i.height=0;i.position="absolute";i.top=i.left=0;i.zIndex=-1;const a=filter_factory_classPrivateFieldGet(Fs,e).createElementNS(Y,"svg");a.setAttribute("width",0);a.setAttribute("height",0);filter_factory_classPrivateFieldSet(Ps,e,filter_factory_classPrivateFieldGet(Fs,e).createElementNS(Y,"defs"));t.append(a);a.append(filter_factory_classPrivateFieldGet(Ps,e));filter_factory_classPrivateFieldGet(Fs,e).body.append(t)}return filter_factory_classPrivateFieldGet(Ps,e)}function _createTables(e){if(1===e.length){const t=e[0],i=new Array(256);for(let e=0;e<256;e++)i[e]=t[e]/255;const a=i.join(",");return[a,a,a]}const[t,i,a]=e,s=new Array(256),n=new Array(256),r=new Array(256);for(let e=0;e<256;e++){s[e]=t[e]/255;n[e]=i[e]/255;r[e]=a[e]/255}return[s.join(","),n.join(","),r.join(",")]}function _createUrl(e){if(void 0===filter_factory_classPrivateFieldGet(ms,this)){filter_factory_classPrivateFieldSet(ms,this,"");const e=filter_factory_classPrivateFieldGet(Fs,this).URL;e!==filter_factory_classPrivateFieldGet(Fs,this).baseURI&&(isDataScheme(e)?warn('#createUrl: ignore "data:"-URL for performance reasons.'):filter_factory_classPrivateFieldSet(ms,this,updateUrlHash(e,"")))}return`url(${filter_factory_classPrivateFieldGet(ms,this)}#${e})`}function _addLuminosityConversion(e){const t=filter_factory_classPrivateFieldGet(Fs,this).createElementNS(Y,"feColorMatrix");t.setAttribute("type","matrix");t.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0");e.append(t)}function _addGrayConversion(e){const t=filter_factory_classPrivateFieldGet(Fs,this).createElementNS(Y,"feColorMatrix");t.setAttribute("type","matrix");t.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0");e.append(t)}function _createFilter(e){const t=filter_factory_classPrivateFieldGet(Fs,this).createElementNS(Y,"filter");t.setAttribute("color-interpolation-filters","sRGB");t.setAttribute("id",e);filter_factory_classPrivateGetter(Ss,this,_get_defs).append(t);return t}function _appendFeFunc(e,t,i){const a=filter_factory_classPrivateFieldGet(Fs,this).createElementNS(Y,t);a.setAttribute("type","discrete");a.setAttribute("tableValues",i);e.append(a)}function _addTransferMapConversion(e,t,i,a){const s=filter_factory_classPrivateFieldGet(Fs,this).createElementNS(Y,"feComponentTransfer");a.append(s);filter_factory_assertClassBrand(Ss,this,_appendFeFunc).call(this,s,"feFuncR",e);filter_factory_assertClassBrand(Ss,this,_appendFeFunc).call(this,s,"feFuncG",t);filter_factory_assertClassBrand(Ss,this,_appendFeFunc).call(this,s,"feFuncB",i)}function _addTransferMapAlphaConversion(e,t){const i=filter_factory_classPrivateFieldGet(Fs,this).createElementNS(Y,"feComponentTransfer");t.append(i);filter_factory_assertClassBrand(Ss,this,_appendFeFunc).call(this,i,"feFuncA",e)}function _getRGB(e){filter_factory_classPrivateGetter(Ss,this,_get_defs).style.color=e;return getRGB(getComputedStyle(filter_factory_classPrivateGetter(Ss,this,_get_defs)).getPropertyValue("color"))}class NodeFilterFactory extends BaseFilterFactory{}class NodeCanvasFactory extends BaseCanvasFactory{_createCanvas(e,t){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,t)}}class NodeBinaryDataFactory extends BaseBinaryDataFactory{async _fetch(e,t){return async function node_utils_fetchData(e){const t=process.getBuiltinModule("fs"),i=await t.promises.readFile(e);return new Uint8Array(i)}(e)}}function webgpu_mesh_classPrivateFieldInitSpec(e,t,i){webgpu_mesh_checkPrivateRedeclaration(e,t),t.set(e,i)}function webgpu_mesh_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function webgpu_mesh_classPrivateFieldGet(e,t){return e.get(webgpu_mesh_assertClassBrand(e,t))}function webgpu_mesh_classPrivateFieldSet(e,t,i){return e.set(webgpu_mesh_assertClassBrand(e,t),i),i}function webgpu_mesh_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Cs=new WeakMap,xs=new WeakMap,ks=new WeakMap,Es=new WeakMap,As=new WeakSet;async function _initGPU(){if(!globalThis.navigator?.gpu)return!1;try{const e=await navigator.gpu.requestAdapter();if(!e)return!1;webgpu_mesh_classPrivateFieldSet(Es,this,navigator.gpu.getPreferredCanvasFormat());const t=webgpu_mesh_classPrivateFieldSet(xs,this,await e.requestDevice()),i=t.createShaderModule({code:"\nstruct Uniforms {\n  offsetX      : f32,\n  offsetY      : f32,\n  scaleX       : f32,\n  scaleY       : f32,\n  paddedWidth  : f32,\n  paddedHeight : f32,\n  borderSize   : f32,\n  _pad         : f32,\n};\n\n@group(0) @binding(0) var<uniform> u : Uniforms;\n\nstruct VertexInput {\n  @location(0) position : vec2<f32>,\n  @location(1) color    : vec4<f32>,\n};\n\nstruct VertexOutput {\n  @builtin(position) position : vec4<f32>,\n  @location(0)       color    : vec3<f32>,\n};\n\n@vertex\nfn vs_main(in : VertexInput) -> VertexOutput {\n  var out : VertexOutput;\n  let cx = (in.position.x + u.offsetX) * u.scaleX;\n  let cy = (in.position.y + u.offsetY) * u.scaleY;\n  out.position = vec4<f32>(\n    ((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0,\n    1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0,\n    0.0,\n    1.0\n  );\n  out.color = in.color.rgb;\n  return out;\n}\n\n@fragment\nfn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {\n  return vec4<f32>(in.color, 1.0);\n}\n"});webgpu_mesh_classPrivateFieldSet(ks,this,t.createRenderPipeline({layout:"auto",vertex:{module:i,entryPoint:"vs_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:i,entryPoint:"fs_main",targets:[{format:webgpu_mesh_classPrivateFieldGet(Es,this)}]},primitive:{topology:"triangle-list"}}));return!0}catch{return!1}}function _buildVertexStreams(e,t){const{coords:i,colors:a}=t;let s=0;for(const t of e){const e=t.coords;if(t.type===P)s+=e.length;else if(t.type===w){const i=t.verticesPerRow;s+=(Math.floor(e.length/i)-1)*(i-1)*6}}const n=new Float32Array(2*s),r=new Uint8Array(4*s);let o=0,l=0;const addVertex=(e,t)=>{n[o++]=i[2*e];n[o++]=i[2*e+1];r[l++]=a[4*t];r[l++]=a[4*t+1];r[l++]=a[4*t+2];l++};for(const t of e){const e=t.coords,i=t.colors;if(t.type===P)for(let t=0,a=e.length;t<a;t+=3){addVertex(e[t],i[t]);addVertex(e[t+1],i[t+1]);addVertex(e[t+2],i[t+2])}else if(t.type===w){const a=t.verticesPerRow,s=Math.floor(e.length/a)-1,n=a-1;for(let t=0;t<s;t++){let s=t*a;for(let t=0;t<n;t++,s++){addVertex(e[s],i[s]);addVertex(e[s+1],i[s+1]);addVertex(e[s+a],i[s+a]);addVertex(e[s+a+1],i[s+a+1]);addVertex(e[s+1],i[s+1]);addVertex(e[s+a],i[s+a])}}}}return{posData:n,colData:r,vertexCount:s}}const Gs=new class WebGPUMesh{constructor(){!function webgpu_mesh_classPrivateMethodInitSpec(e,t){webgpu_mesh_checkPrivateRedeclaration(e,t),t.add(e)}(this,As);webgpu_mesh_classPrivateFieldInitSpec(this,Cs,null);webgpu_mesh_classPrivateFieldInitSpec(this,xs,null);webgpu_mesh_classPrivateFieldInitSpec(this,ks,null);webgpu_mesh_classPrivateFieldInitSpec(this,Es,null)}init(){null===webgpu_mesh_classPrivateFieldGet(Cs,this)&&webgpu_mesh_classPrivateFieldSet(Cs,this,webgpu_mesh_assertClassBrand(As,this,_initGPU).call(this))}get isReady(){return null!==webgpu_mesh_classPrivateFieldGet(xs,this)}draw(e,t,i,a,s,n){const r=webgpu_mesh_classPrivateFieldGet(xs,this),{offsetX:o,offsetY:l,scaleX:d,scaleY:c}=t,{posData:h,colData:u,vertexCount:_}=webgpu_mesh_assertClassBrand(As,this,_buildVertexStreams).call(this,e,t),p=r.createBuffer({size:Math.max(h.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});h.byteLength>0&&r.queue.writeBuffer(p,0,h);const g=r.createBuffer({size:Math.max(u.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});u.byteLength>0&&r.queue.writeBuffer(g,0,u);const f=r.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});r.queue.writeBuffer(f,0,new Float32Array([o,l,d,c,a,s,n,0]));const m=r.createBindGroup({layout:webgpu_mesh_classPrivateFieldGet(ks,this).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:f}}]}),v=new OffscreenCanvas(a,s),P=v.getContext("webgpu");P.configure({device:r,format:webgpu_mesh_classPrivateFieldGet(Es,this),alphaMode:i?"opaque":"premultiplied"});const w=i?{r:i[0]/255,g:i[1]/255,b:i[2]/255,a:1}:{r:0,g:0,b:0,a:0},b=r.createCommandEncoder(),y=b.beginRenderPass({colorAttachments:[{view:P.getCurrentTexture().createView(),clearValue:w,loadOp:"clear",storeOp:"store"}]});if(_>0){y.setPipeline(webgpu_mesh_classPrivateFieldGet(ks,this));y.setBindGroup(0,m);y.setVertexBuffer(0,p);y.setVertexBuffer(1,g);y.draw(_)}y.end();r.queue.submit([b.finish()]);p.destroy();g.destroy();f.destroy();return v.transferToImageBitmap()}};const Bs="Fill",Ms="Stroke",Is="Shading";function applyBoundingBox(e,t){if(!t)return;const i=t[2]-t[0],a=t[3]-t[1],s=new Path2D;s.rect(t[0],t[1],i,a);e.clip(s)}class BaseShadingPattern{isModifyingCurrentTransform(){return!1}getPattern(){unreachable("Abstract method `getPattern` called.")}}class RadialAxialShadingPattern extends BaseShadingPattern{constructor(e){super();this._type=e[1];this._bbox=e[2];this._colorStops=e[3];this._p0=e[4];this._p1=e[5];this._r0=e[6];this._r1=e[7];this.matrix=null}isOriginBased(){return 0===this._p0[0]&&0===this._p0[1]&&(!this.isRadial()||0===this._p1[0]&&0===this._p1[1])}isRadial(){return"radial"===this._type}_isCircleCenterOutside(){if(!this.isRadial()||this._r0>this._r1)return!1;return Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1])>this._r1}_createGradient(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=this._p0,s=this._p1;if(i){a=a.slice();s=s.slice();Util.applyTransform(a,i);Util.applyTransform(s,i)}if("axial"===this._type)t=e.createLinearGradient(a[0],a[1],s[0],s[1]);else if("radial"===this._type){let n=this._r0,r=this._r1;if(i){const e=new Float32Array(2);Util.singularValueDecompose2dScale(i,e);n*=e[0];r*=e[0]}t=e.createRadialGradient(a[0],a[1],n,s[0],s[1],r)}for(const e of this._colorStops)t.addColorStop(e[0],e[1]);return t}_createReversedGradient(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this._p1,a=this._p0;if(t){i=i.slice();a=a.slice();Util.applyTransform(i,t);Util.applyTransform(a,t)}let s=this._r1,n=this._r0;if(t){const e=new Float32Array(2);Util.singularValueDecompose2dScale(t,e);s*=e[0];n*=e[0]}const r=e.createRadialGradient(i[0],i[1],s,a[0],a[1],n),o=this._colorStops.map(e=>{let[t,i]=e;return[1-t,i]}).reverse();for(const[e,t]of o)r.addColorStop(e,t);return r}getPattern(e,t,i,a){let s;if(a===Ms||a===Bs){if(this.isOriginBased()){let a=Util.transform(i,t.baseTransform);this.matrix&&(a=Util.transform(a,this.matrix));const s=.001,n=Math.hypot(a[0],a[1]),r=Math.hypot(a[2],a[3]),o=(a[0]*a[2]+a[1]*a[3])/(n*r);if(Math.abs(o)<s){if(!this.isRadial())return this._createGradient(e,a);if(Math.abs(n-r)<s)return this._createGradient(e,a)}}const n=t.current.getClippedPathBoundingBox(a,getCurrentTransform(e))||[0,0,0,0],r=Math.ceil(n[2]-n[0])||1,o=Math.ceil(n[3]-n[1])||1,l=t.canvasFactory.create(r,o),d=l.context;d.clearRect(0,0,d.canvas.width,d.canvas.height);d.beginPath();d.rect(0,0,d.canvas.width,d.canvas.height);d.translate(-n[0],-n[1]);i=Util.transform(i,[1,0,0,1,n[0],n[1]]);d.transform(...t.baseTransform);this.matrix&&d.transform(...this.matrix);applyBoundingBox(d,this._bbox);if(this._isCircleCenterOutside()){d.fillStyle=this._createReversedGradient(d);d.fill()}d.fillStyle=this._createGradient(d);d.fill();s=e.createPattern(l.canvas,"no-repeat");t.canvasFactory.destroy(l);const c=new DOMMatrix(i);s.setTransform(c)}else{if(this._isCircleCenterOutside()){e.save();applyBoundingBox(e,this._bbox);e.fillStyle=this._createReversedGradient(e);e.fillRect(-1e10,-1e10,2e10,2e10);e.restore()}applyBoundingBox(e,this._bbox);s=this._createGradient(e)}return s}}function drawTriangle(e,t,i,a,s,n,r,o){const l=t.coords,d=t.colors,c=e.data,h=4*e.width;let u;if(l[2*i+1]>l[2*a+1]){u=i;i=a;a=u;u=n;n=r;r=u}if(l[2*a+1]>l[2*s+1]){u=a;a=s;s=u;u=r;r=o;o=u}if(l[2*i+1]>l[2*a+1]){u=i;i=a;a=u;u=n;n=r;r=u}const _=(l[2*i]+t.offsetX)*t.scaleX,p=(l[2*i+1]+t.offsetY)*t.scaleY,g=(l[2*a]+t.offsetX)*t.scaleX,f=(l[2*a+1]+t.offsetY)*t.scaleY,m=(l[2*s]+t.offsetX)*t.scaleX,v=(l[2*s+1]+t.offsetY)*t.scaleY;if(p>=v)return;const P=d[4*n],w=d[4*n+1],b=d[4*n+2],y=d[4*r],S=d[4*r+1],C=d[4*r+2],x=d[4*o],k=d[4*o+1],E=d[4*o+2],A=Math.round(p),G=Math.round(v);let B,M,I,T,D,L,R,N;for(let e=A;e<=G;e++){if(e<f){const t=e<p?0:(p-e)/(p-f);B=_-(_-g)*t;M=P-(P-y)*t;I=w-(w-S)*t;T=b-(b-C)*t}else{let t;t=e>v?1:f===v?0:(f-e)/(f-v);B=g-(g-m)*t;M=y-(y-x)*t;I=S-(S-k)*t;T=C-(C-E)*t}let t;t=e<p?0:e>v?1:(p-e)/(p-v);D=_-(_-m)*t;L=P-(P-x)*t;R=w-(w-k)*t;N=b-(b-E)*t;const i=Math.round(Math.min(B,D)),a=Math.round(Math.max(B,D));let s=h*e+4*i;for(let e=i;e<=a;e++){t=(B-e)/(B-D);t<0?t=0:t>1&&(t=1);c[s++]=M-(M-L)*t|0;c[s++]=I-(I-R)*t|0;c[s++]=T-(T-N)*t|0;c[s++]=255}}}function drawFigure(e,t,i){const a=t.coords,s=t.colors;let n,r;switch(t.type){case w:const o=t.verticesPerRow,l=Math.floor(a.length/o)-1,d=o-1;for(n=0;n<l;n++){let t=n*o;for(let n=0;n<d;n++,t++){drawTriangle(e,i,a[t],a[t+1],a[t+o],s[t],s[t+1],s[t+o]);drawTriangle(e,i,a[t+o+1],a[t+1],a[t+o],s[t+o+1],s[t+1],s[t+o])}}break;case P:for(n=0,r=a.length;n<r;n+=3)drawTriangle(e,i,a[n],a[n+1],a[n+2],s[n],s[n+1],s[n+2]);break;default:throw new Error("illegal figure")}}class MeshShadingPattern extends BaseShadingPattern{constructor(e){super();this._coords=e[2];this._colors=e[3];this._figures=e[4];this._bounds=e[5];this._bbox=e[6];this._background=e[7];this.matrix=null}_createMeshCanvas(e,t,i){const a=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),n=Math.ceil(this._bounds[2])-a,r=Math.ceil(this._bounds[3])-s,o=Math.min(Math.ceil(Math.abs(n*e[0]*1.1)),3e3)||1,l=Math.min(Math.ceil(Math.abs(r*e[1]*1.1)),3e3)||1,d=n?n/o:1,c=r?r/l:1,h={coords:this._coords,colors:this._colors,offsetX:-a,offsetY:-s,scaleX:1/d,scaleY:1/c},u=o+4,_=l+4,p=i.create(u,_);if(function isWebGPUMeshReady(){return Gs.isReady}())p.context.drawImage(function drawMeshWithGPU(e,t,i,a,s,n){return Gs.draw(e,t,i,a,s,n)}(this._figures,h,t,u,_,2),0,0);else{const e=p.context.createImageData(o,l);if(t){const i=e.data;for(let e=0,a=i.length;e<a;e+=4){i[e]=t[0];i[e+1]=t[1];i[e+2]=t[2];i[e+3]=255}}for(const t of this._figures)drawFigure(e,t,h);p.context.putImageData(e,2,2)}return{canvas:p.canvas,offsetX:a-2*d,offsetY:s-2*c,scaleX:d,scaleY:c}}isModifyingCurrentTransform(){return!0}getPattern(e,t,i,a){applyBoundingBox(e,this._bbox);const s=new Float32Array(2);if(a===Is)Util.singularValueDecompose2dScale(getCurrentTransform(e),s);else if(this.matrix){Util.singularValueDecompose2dScale(this.matrix,s);const[e,i]=s;Util.singularValueDecompose2dScale(t.baseTransform,s);s[0]*=e;s[1]*=i}else Util.singularValueDecompose2dScale(t.baseTransform,s);const n=this._createMeshCanvas(s,a===Is?null:this._background,t.canvasFactory);if(a!==Is){e.setTransform(...t.baseTransform);this.matrix&&e.transform(...this.matrix)}e.translate(n.offsetX,n.offsetY);e.scale(n.scaleX,n.scaleY);const r=e.createPattern(n.canvas,"no-repeat");t.canvasFactory.destroy(n);return r}}class DummyShadingPattern extends BaseShadingPattern{getPattern(){return"hotpink"}}const Ts=1,Ds=2;class TilingPattern{constructor(e,t,i,a){this.color=e[1];this.operatorList=e[2];this.matrix=e[3];this.bbox=e[4];this.xstep=e[5];this.ystep=e[6];this.paintType=e[7];this.tilingType=e[8];this.ctx=t;this.canvasGraphicsFactory=i;this.baseTransform=a}createPatternCanvas(e,t){const{bbox:i,operatorList:a,paintType:s,tilingType:n,color:r,canvasGraphicsFactory:o}=this;let{xstep:l,ystep:d}=this;l=Math.abs(l);d=Math.abs(d);info("TilingType: "+n);const c=i[0],h=i[1],u=i[2],_=i[3],p=u-c,g=_-h,f=new Float32Array(2);Util.singularValueDecompose2dScale(this.matrix,f);const[m,v]=f;Util.singularValueDecompose2dScale(this.baseTransform,f);const P=m*f[0],w=v*f[1];let b=p,y=g,S=!1,C=!1;const x=Math.ceil(l*P),k=Math.ceil(d*w);x>=Math.ceil(p*P)?b=l:S=!0;k>=Math.ceil(g*w)?y=d:C=!0;const E=this.getSizeAndScale(b,this.ctx.canvas.width,P),A=this.getSizeAndScale(y,this.ctx.canvas.height,w),G=e.canvasFactory.create(E.size,A.size),B=G.context,M=o.createCanvasGraphics(B,t);M.groupLevel=e.groupLevel;this.setFillAndStrokeStyleToContext(M,s,r);B.translate(-E.scale*c,-A.scale*h);M.transform(0,E.scale,0,0,A.scale,0,0);B.save();M.dependencyTracker?.save();this.clipBbox(M,c,h,u,_);M.baseTransform=getCurrentTransform(M.ctx);M.executeOperatorList(a);M.endDrawing();M.dependencyTracker?.restore();B.restore();if(S||C){const t=G.canvas;S&&(b=l);C&&(y=d);const i=this.getSizeAndScale(b,this.ctx.canvas.width,P),a=this.getSizeAndScale(y,this.ctx.canvas.height,w),s=i.size,n=a.size,r=e.canvasFactory.create(s,n),o=r.context,u=S?Math.floor(p/l):0,_=C?Math.floor(g/d):0;for(let e=0;e<=u;e++)for(let i=0;i<=_;i++)o.drawImage(t,s*e,n*i,s,n,0,0,s,n);e.canvasFactory.destroy(G);return{canvas:r.canvas,canvasEntry:r,scaleX:i.scale,scaleY:a.scale,offsetX:c,offsetY:h}}return{canvas:G.canvas,canvasEntry:G,scaleX:E.scale,scaleY:A.scale,offsetX:c,offsetY:h}}getSizeAndScale(e,t,i){const a=Math.max(TilingPattern.MAX_PATTERN_SIZE,t);let s=Math.ceil(e*i);s>=a?s=a:i=s/e;return{scale:i,size:s}}clipBbox(e,t,i,a,s){const n=a-t,r=s-i;e.ctx.rect(t,i,n,r);Util.axialAlignedBoundingBox([t,i,a,s],getCurrentTransform(e.ctx),e.current.minMax);e.clip();e.endPath()}setFillAndStrokeStyleToContext(e,t,i){const a=e.ctx,s=e.current;switch(t){case Ts:const{fillStyle:e,strokeStyle:n}=this.ctx;a.fillStyle=s.fillColor=e;a.strokeStyle=s.strokeColor=n;break;case Ds:a.fillStyle=a.strokeStyle=i;s.fillColor=s.strokeColor=i;break;default:throw new FormatError(`Unsupported paint type: ${t}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,t,i,a,s){let n=i;if(a!==Is){n=Util.transform(n,t.baseTransform);this.matrix&&(n=Util.transform(n,this.matrix))}const r=this.createPatternCanvas(t,s);let o=new DOMMatrix(n);o=o.translate(r.offsetX,r.offsetY);o=o.scale(1/r.scaleX,1/r.scaleY);const l=e.createPattern(r.canvas,"repeat");t.canvasFactory.destroy(r.canvasEntry);l.setTransform(o);return l}}!function pattern_helper_defineProperty(e,t,i){return(t=function pattern_helper_toPropertyKey(e){var t=function pattern_helper_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}(TilingPattern,"MAX_PATTERN_SIZE",3e3);function convertBlackAndWhiteToRGBA(e){let{src:t,srcPos:i=0,dest:a,width:s,height:n,nonBlackColor:r=4294967295,inverseDecode:o=!1}=e;const l=FeatureTest.isLittleEndian?4278190080:255,[d,c]=o?[r,l]:[l,r],h=s>>3,u=7&s,_=d^c,p=t.length;a=new Uint32Array(a.buffer);let g=0;for(let e=0;e<n;++e){for(const e=i+h;i<e;++i,g+=8){const e=t[i];a[g]=d^-(e>>7&1)&_;a[g+1]=d^-(e>>6&1)&_;a[g+2]=d^-(e>>5&1)&_;a[g+3]=d^-(e>>4&1)&_;a[g+4]=d^-(e>>3&1)&_;a[g+5]=d^-(e>>2&1)&_;a[g+6]=d^-(e>>1&1)&_;a[g+7]=d^-(1&e)&_}if(0===u)continue;const e=i<p?t[i++]:255;for(let t=0;t<u;++t,++g)a[g]=d^-(e>>7-t&1)&_}return{srcPos:i,destPos:g}}function canvas_classPrivateMethodInitSpec(e,t){(function canvas_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function canvas_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function canvas_defineProperty(e,t,i){return(t=function canvas_toPropertyKey(e){var t=function canvas_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const Ls=16,Rs=new DOMMatrix,Ns=new Float32Array(2),Os=new Float32Array([1/0,1/0,-1/0,-1/0]);function drawImageAtIntegerCoords(e,t,i,a,s,n,r,o,l,d){const[c,h,u,_,p,g]=getCurrentTransform(e);if(0===h&&0===u){const f=r*c+p,m=Math.round(f),v=o*_+g,P=Math.round(v),w=(r+l)*c+p,b=Math.abs(Math.round(w)-m)||1,y=(o+d)*_+g,S=Math.abs(Math.round(y)-P)||1;e.setTransform(Math.sign(c),0,0,Math.sign(_),m,P);e.drawImage(t,i,a,s,n,0,0,b,S);e.setTransform(c,h,u,_,p,g);return[b,S]}if(0===c&&0===_){const f=o*u+p,m=Math.round(f),v=r*h+g,P=Math.round(v),w=(o+d)*u+p,b=Math.abs(Math.round(w)-m)||1,y=(r+l)*h+g,S=Math.abs(Math.round(y)-P)||1;e.setTransform(0,Math.sign(h),Math.sign(u),0,m,P);e.drawImage(t,i,a,s,n,0,0,S,b);e.setTransform(c,h,u,_,p,g);return[S,b]}e.drawImage(t,i,a,s,n,r,o,l,d);return[Math.hypot(c,h)*l,Math.hypot(u,_)*d]}class CanvasExtraState{constructor(e,t){canvas_defineProperty(this,"alphaIsShape",!1);canvas_defineProperty(this,"fontSize",0);canvas_defineProperty(this,"fontSizeScale",1);canvas_defineProperty(this,"textMatrix",null);canvas_defineProperty(this,"textMatrixScale",1);canvas_defineProperty(this,"fontMatrix",s);canvas_defineProperty(this,"leading",0);canvas_defineProperty(this,"x",0);canvas_defineProperty(this,"y",0);canvas_defineProperty(this,"lineX",0);canvas_defineProperty(this,"lineY",0);canvas_defineProperty(this,"charSpacing",0);canvas_defineProperty(this,"wordSpacing",0);canvas_defineProperty(this,"textHScale",1);canvas_defineProperty(this,"textRenderingMode",b);canvas_defineProperty(this,"textRise",0);canvas_defineProperty(this,"fillColor","#000000");canvas_defineProperty(this,"strokeColor","#000000");canvas_defineProperty(this,"patternFill",!1);canvas_defineProperty(this,"patternStroke",!1);canvas_defineProperty(this,"fillAlpha",1);canvas_defineProperty(this,"strokeAlpha",1);canvas_defineProperty(this,"lineWidth",1);canvas_defineProperty(this,"activeSMask",null);canvas_defineProperty(this,"transferMaps","none");canvas_defineProperty(this,"minMax",Os.slice());this.clipBox=new Float32Array([0,0,e,t])}clone(){const e=Object.create(this);e.clipBox=this.clipBox.slice();e.minMax=this.minMax.slice();return e}getPathBoundingBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Bs,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=this.minMax.slice();if(e===Ms){t||unreachable("Stroke bounding box must include transform.");Util.singularValueDecompose2dScale(t,Ns);const e=Ns[0]*this.lineWidth/2,a=Ns[1]*this.lineWidth/2;i[0]-=e;i[1]-=a;i[2]+=e;i[3]+=a}return i}updateClipFromPath(){const e=Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0);this.minMax.set(Os,0)}getClippedPathBoundingBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Bs,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Util.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function putBinaryImageData(e,t){if(t instanceof ImageData){e.putImageData(t,0,0);return}const i=t.height,a=t.width,s=i%Ls,n=(i-s)/Ls,r=0===s?n:n+1,o=e.createImageData(a,Ls);let l,d=0;const c=t.data,h=o.data;let u,_,p,g;if(t.kind===E.GRAYSCALE_1BPP){const t=c.byteLength,i=new Uint32Array(h.buffer,0,h.byteLength>>2),g=i.length,f=a+7>>3,m=4294967295,v=FeatureTest.isLittleEndian?4278190080:255;for(u=0;u<r;u++){p=u<n?Ls:s;l=0;for(_=0;_<p;_++){const e=t-d;let s=0;const n=e>f?a:8*e-7,r=-8&n;let o=0,h=0;for(;s<r;s+=8){h=c[d++];i[l++]=128&h?m:v;i[l++]=64&h?m:v;i[l++]=32&h?m:v;i[l++]=16&h?m:v;i[l++]=8&h?m:v;i[l++]=4&h?m:v;i[l++]=2&h?m:v;i[l++]=1&h?m:v}for(;s<n;s++){if(0===o){h=c[d++];o=128}i[l++]=h&o?m:v;o>>=1}}for(;l<g;)i[l++]=0;e.putImageData(o,0,u*Ls)}}else if(t.kind===E.RGBA_32BPP){_=0;g=a*Ls*4;for(u=0;u<n;u++){h.set(c.subarray(d,d+g));d+=g;e.putImageData(o,0,_);_+=Ls}if(u<r){g=a*s*4;h.set(c.subarray(d,d+g));e.putImageData(o,0,_)}}else{if(t.kind!==E.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);p=Ls;g=a*p;for(u=0;u<r;u++){if(u>=n){p=s;g=a*p}l=0;for(_=g;_--;){h[l++]=c[d++];h[l++]=c[d++];h[l++]=c[d++];h[l++]=255}e.putImageData(o,0,u*Ls)}}}function putBinaryImageMask(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}const i=t.height,a=t.width,s=i%Ls,n=(i-s)/Ls,r=0===s?n:n+1,o=e.createImageData(a,Ls);let l=0;const d=t.data,c=o.data;for(let t=0;t<r;t++){const i=t<n?Ls:s;({srcPos:l}=convertBlackAndWhiteToRGBA({src:d,srcPos:l,dest:c,width:a,height:i,nonBlackColor:0}));e.putImageData(o,0,t*Ls)}}function copyCtxState(e,t){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const a of i)void 0!==e[a]&&(t[a]=e[a]);if(void 0!==e.setLineDash){t.setLineDash(e.getLineDash());t.lineDashOffset=e.lineDashOffset}}function resetCtxToDefault(e){e.strokeStyle=e.fillStyle="#000000";e.fillRule="nonzero";e.globalAlpha=1;e.lineWidth=1;e.lineCap="butt";e.lineJoin="miter";e.miterLimit=10;e.globalCompositeOperation="source-over";e.font="10px sans-serif";if(void 0!==e.setLineDash){e.setLineDash([]);e.lineDashOffset=0}const{filter:t}=e;"none"!==t&&""!==t&&(e.filter="none")}function getImageSmoothingEnabled(e,t){if(t)return!0;Util.singularValueDecompose2dScale(e,Ns);const i=Math.fround(OutputScale.pixelRatio*PixelsPerInch.PDF_TO_CSS_UNITS);return Ns[0]<=i&&Ns[1]<=i}const Ws=["butt","round","square"],js=["miter","round","bevel"],Vs={},Us={};var zs=new WeakSet;class CanvasGraphics{constructor(e,t,i,a,s,n,r,o,l,d){let{optionalContentConfig:c,markedContentStack:h=null}=n;canvas_classPrivateMethodInitSpec(this,zs);this.ctx=e;this.current=new CanvasExtraState(this.ctx.canvas.width,this.ctx.canvas.height);this.stateStack=[];this.pendingClip=null;this.pendingEOFill=!1;this.commonObjs=t;this.objs=i;this.canvasFactory=a;this.filterFactory=s;this.groupStack=[];this.baseTransform=null;this.baseTransformStack=[];this.groupLevel=0;this.smaskStack=[];this.smaskCounter=0;this.tempSMask=null;this.smaskGroupCanvases=[];this.suspendedCtx=null;this.contentVisible=!0;this.markedContentStack=h||[];this.optionalContentConfig=c;this.cachedPatterns=new Map;this.annotationCanvasMap=r;this.viewportScale=1;this.outputScaleX=1;this.outputScaleY=1;this.pageColors=o;this._cachedScaleForStroking=[-1,0];this._cachedGetSinglePixelWidth=null;this._cachedBitmapsMap=new Map;this.dependencyTracker=l??null;this.imagesTracker=d??null}getObject(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("string"==typeof t){this.dependencyTracker?.recordNamedDependency(e,t);return t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t)}return i}beginDrawing(e){let{transform:t,viewport:i,transparency:a=!1,background:s=null}=e;const n=this.ctx.canvas.width,r=this.ctx.canvas.height,o=this.ctx.fillStyle;this.ctx.fillStyle=s||"#ffffff";this.ctx.fillRect(0,0,n,r);this.ctx.fillStyle=o;if(a){const e=this.transparentCanvasEntry=this.canvasFactory.create(n,r);this.compositeCtx=this.ctx;({canvas:this.transparentCanvas,context:this.ctx}=e);this.ctx.save();this.ctx.transform(...getCurrentTransform(this.compositeCtx))}this.ctx.save();resetCtxToDefault(this.ctx);if(t){this.ctx.transform(...t);this.outputScaleX=t[0];this.outputScaleY=t[0]}this.ctx.transform(...i.transform);this.viewportScale=i.scale;this.baseTransform=getCurrentTransform(this.ctx)}executeOperatorList(e,t,i,a,s){const n=e.argsArray,r=e.fnArray;let o=t||0;const l=n.length;if(l===o)return o;const d=l-o>10&&"function"==typeof i,c=d?Date.now()+15:0;let h=0;const u=this.commonObjs,_=this.objs;let p,g;for(;;){if(void 0!==a){if(o===a.nextBreakPoint){a.breakIt(o,i);return o}if(a.shouldSkip(o)){if(++o===l)return o;continue}}if(!s||s(o)){p=r[o];g=n[o]??null;if(p!==L.dependency)null===g?this[p](o):this[p](o,...g);else for(const e of g){this.dependencyTracker?.recordNamedData(e,o);const t=e.startsWith("g_")?u:_;if(!t.has(e)){t.get(e,i);return o}}}o++;if(o===l)return o;if(d&&++h>10){if(Date.now()>c){i();return o}h=0}}}endDrawing(){canvas_assertClassBrand(zs,this,_restoreInitialState).call(this);for(const e of this.smaskGroupCanvases)this.canvasFactory.destroy(e);this.smaskGroupCanvases.length=0;this.tempSMask=null;this.smaskStack.length=0;this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear();canvas_assertClassBrand(zs,this,_drawFilter).call(this)}_scaleImage(e,t){const i=e.width??e.displayWidth,a=e.height??e.displayHeight,s=[];let n=Math.max(Math.hypot(t[0],t[1]),1),r=Math.max(Math.hypot(t[2],t[3]),1),o=i,l=a;for(;n>2&&o>1||r>2&&l>1;){let e=o,t=l;if(n>2&&o>1){e=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2);n/=o/e}if(r>2&&l>1){t=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2;r/=l/t}s.push({newWidth:e,newHeight:t});o=e;l=t}if(0===s.length)return{img:e,paintWidth:i,paintHeight:a,tmpCanvas:null};if(1===s.length){const{newWidth:t,newHeight:n}=s[0],r=this.canvasFactory.create(t,n);r.context.drawImage(e,0,0,i,a,0,0,t,n);return{img:r.canvas,paintWidth:t,paintHeight:n,tmpCanvas:r}}let d=this.canvasFactory.create(1,1),c=this.canvasFactory.create(1,1),h=i,u=a,_=e;for(const{newWidth:e,newHeight:t}of s){this.canvasFactory.reset(c,e,t);c.context.drawImage(_,0,0,h,u,0,0,e,t);[d,c]=[c,d];_=d.canvas;h=e;u=t}this.canvasFactory.destroy(c);return{img:d.canvas,paintWidth:h,paintHeight:u,tmpCanvas:d}}_createMaskCanvas(e,t){const i=this.ctx,{width:a,height:s}=t,n=this.current.fillColor,r=this.current.patternFill,o=getCurrentTransform(i);let l,d,c,h;if((t.bitmap||t.data)&&t.count>1){const i=t.bitmap||t.data.buffer;d=JSON.stringify(r?o:[o.slice(0,4),n]);l=this._cachedBitmapsMap.getOrInsertComputed(i,makeMap);const a=l.get(d);if(a&&!r){const t=Math.round(Math.min(o[0],o[2])+o[4]),i=Math.round(Math.min(o[1],o[3])+o[5]);this.dependencyTracker?.recordDependencies(e,Ba);return{canvas:a,offsetX:t,offsetY:i}}c=a}if(!c){h=this.canvasFactory.create(a,s);putBinaryImageMask(h.context,t)}let u=Util.transform(o,[1/a,0,0,-1/s,0,0]);u=Util.transform(u,[1,0,0,1,0,-s]);const _=Os.slice();Util.axialAlignedBoundingBox([0,0,a,s],u,_);const[p,g,f,m]=_,v=Math.round(f-p)||1,P=Math.round(m-g)||1,w=this.canvasFactory.create(v,P),b=w.context,y=p,S=g;b.translate(-y,-S);b.transform(...u);let C=null;if(!c){const e=this._scaleImage(h.canvas,getCurrentTransformInverse(b));c=e.img;C=e.tmpCanvas;if(c!==h.canvas){this.canvasFactory.destroy(h);h=null}if(l&&r){l.set(d,c);C=null;h=null}}b.imageSmoothingEnabled=getImageSmoothingEnabled(getCurrentTransform(b),t.interpolate);drawImageAtIntegerCoords(b,c,0,0,c.width,c.height,0,0,a,s);C&&this.canvasFactory.destroy(C);h&&this.canvasFactory.destroy(h);b.globalCompositeOperation="source-in";const x=Util.transform(getCurrentTransformInverse(b),[1,0,0,1,-y,-S]);b.fillStyle=r?n.getPattern(i,this,x,Bs,e):n;b.fillRect(0,0,a,s);l&&!r&&l.set(d,w.canvas);this.dependencyTracker?.recordDependencies(e,Ba);return{canvas:w.canvas,canvasEntry:l&&!r?null:w,offsetX:Math.round(y),offsetY:Math.round(S)}}setLineWidth(e,t){this.dependencyTracker?.recordSimpleData("lineWidth",e);t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1);this.current.lineWidth=t;this.ctx.lineWidth=t}setLineCap(e,t){this.dependencyTracker?.recordSimpleData("lineCap",e);this.ctx.lineCap=Ws[t]}setLineJoin(e,t){this.dependencyTracker?.recordSimpleData("lineJoin",e);this.ctx.lineJoin=js[t]}setMiterLimit(e,t){this.dependencyTracker?.recordSimpleData("miterLimit",e);this.ctx.miterLimit=t}setDash(e,t,i){this.dependencyTracker?.recordSimpleData("dash",e);const a=this.ctx;if(void 0!==a.setLineDash){a.setLineDash(t);a.lineDashOffset=i}}setRenderingIntent(e,t){}setFlatness(e,t){}setGState(e,t){for(const[i,a]of t)switch(i){case"LW":this.setLineWidth(e,a);break;case"LC":this.setLineCap(e,a);break;case"LJ":this.setLineJoin(e,a);break;case"ML":this.setMiterLimit(e,a);break;case"D":this.setDash(e,a[0],a[1]);break;case"RI":this.setRenderingIntent(e,a);break;case"FL":this.setFlatness(e,a);break;case"Font":this.setFont(e,a[0],a[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",e);this.current.strokeAlpha=a;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",e);this.ctx.globalAlpha=this.current.fillAlpha=a;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",e);this.ctx.globalCompositeOperation=a;break;case"SMask":this.dependencyTracker?.recordSimpleData("SMask",e);this.current.activeSMask=a?this.tempSMask:null;this.tempSMask=null;this.checkSMaskState();break;case"TR":this.dependencyTracker?.recordSimpleData("filter",e);this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(a)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(e){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,i=this.ctx.canvas.height,a=this.canvasFactory.create(t,i);this.smaskScratchCanvas=a;this.suspendedCtx=this.ctx;const s=this.ctx=a.context;s.setTransform(this.suspendedCtx.getTransform());copyCtxState(this.suspendedCtx,s);!function mirrorContextOperations(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save;e.__originalRestore=e.restore;e.__originalRotate=e.rotate;e.__originalScale=e.scale;e.__originalTranslate=e.translate;e.__originalTransform=e.transform;e.__originalSetTransform=e.setTransform;e.__originalResetTransform=e.resetTransform;e.__originalClip=e.clip;e.__originalMoveTo=e.moveTo;e.__originalLineTo=e.lineTo;e.__originalBezierCurveTo=e.bezierCurveTo;e.__originalRect=e.rect;e.__originalClosePath=e.closePath;e.__originalBeginPath=e.beginPath;e._removeMirroring=()=>{e.save=e.__originalSave;e.restore=e.__originalRestore;e.rotate=e.__originalRotate;e.scale=e.__originalScale;e.translate=e.__originalTranslate;e.transform=e.__originalTransform;e.setTransform=e.__originalSetTransform;e.resetTransform=e.__originalResetTransform;e.clip=e.__originalClip;e.moveTo=e.__originalMoveTo;e.lineTo=e.__originalLineTo;e.bezierCurveTo=e.__originalBezierCurveTo;e.rect=e.__originalRect;e.closePath=e.__originalClosePath;e.beginPath=e.__originalBeginPath;delete e._removeMirroring};e.save=function(){t.save();this.__originalSave()};e.restore=function(){t.restore();this.__originalRestore()};e.translate=function(e,i){t.translate(e,i);this.__originalTranslate(e,i)};e.scale=function(e,i){t.scale(e,i);this.__originalScale(e,i)};e.transform=function(e,i,a,s,n,r){t.transform(e,i,a,s,n,r);this.__originalTransform(e,i,a,s,n,r)};e.setTransform=function(e,i,a,s,n,r){t.setTransform(e,i,a,s,n,r);this.__originalSetTransform(e,i,a,s,n,r)};e.resetTransform=function(){t.resetTransform();this.__originalResetTransform()};e.rotate=function(e){t.rotate(e);this.__originalRotate(e)};e.clip=function(e){t.clip(e);this.__originalClip(e)};e.moveTo=function(e,i){t.moveTo(e,i);this.__originalMoveTo(e,i)};e.lineTo=function(e,i){t.lineTo(e,i);this.__originalLineTo(e,i)};e.bezierCurveTo=function(e,i,a,s,n,r){t.bezierCurveTo(e,i,a,s,n,r);this.__originalBezierCurveTo(e,i,a,s,n,r)};e.rect=function(e,i,a,s){t.rect(e,i,a,s);this.__originalRect(e,i,a,s)};e.closePath=function(){t.closePath();this.__originalClosePath()};e.beginPath=function(){t.beginPath();this.__originalBeginPath()}}(s,this.suspendedCtx);this.setGState(e,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring();copyCtxState(this.ctx,this.suspendedCtx);this.ctx=this.suspendedCtx;this.suspendedCtx=null;this.canvasFactory.destroy(this.smaskScratchCanvas);this.smaskScratchCanvas=null}compose(e){if(!this.current.activeSMask)return;if(e){e[0]=Math.floor(e[0]);e[1]=Math.floor(e[1]);e[2]=Math.ceil(e[2]);e[3]=Math.ceil(e[3])}else e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,t,this.ctx,e);this.ctx.save();this.ctx.setTransform(1,0,0,1,0,0);this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height);this.ctx.restore()}composeSMask(e,t,i,a){const s=a[0],n=a[1],r=a[2]-s,o=a[3]-n;if(0!==r&&0!==o){this.genericComposeSMask(t.context,i,r,o,t.subtype,t.backdrop,t.transferMap,s,n,t.offsetX,t.offsetY);e.save();e.globalAlpha=1;e.globalCompositeOperation="source-over";e.setTransform(1,0,0,1,0,0);e.drawImage(i.canvas,0,0);e.restore()}}genericComposeSMask(e,t,i,a,s,n,r,o,l,d,c){let h=e.canvas,u=o-d,_=l-c,p=null;if(n)if(u<0||_<0||u+i>h.width||_+a>h.height){p=this.canvasFactory.create(i,a);const e=p.context;e.drawImage(h,-u,-_);e.globalCompositeOperation="destination-atop";e.fillStyle=n;e.fillRect(0,0,i,a);e.globalCompositeOperation="source-over";h=p.canvas;u=_=0}else{e.save();e.globalAlpha=1;e.setTransform(1,0,0,1,0,0);const t=new Path2D;t.rect(u,_,i,a);e.clip(t);e.globalCompositeOperation="destination-atop";e.fillStyle=n;e.fillRect(u,_,i,a);e.restore()}t.save();t.globalAlpha=1;t.setTransform(1,0,0,1,0,0);"Alpha"===s&&r?t.filter=this.filterFactory.addAlphaFilter(r):"Luminosity"===s&&(t.filter=this.filterFactory.addLuminosityFilter(r));const g=new Path2D;g.rect(o,l,i,a);t.clip(g);t.globalCompositeOperation="destination-in";t.drawImage(h,u,_,i,a,o,l,i,a);t.restore();p&&this.canvasFactory.destroy(p)}save(e){this.inSMaskMode&&copyCtxState(this.ctx,this.suspendedCtx);this.ctx.save();const t=this.current;this.stateStack.push(t);this.current=t.clone();this.dependencyTracker?.save(e)}restore(e){this.dependencyTracker?.restore(e);if(0!==this.stateStack.length){this.current=this.stateStack.pop();this.ctx.restore();this.inSMaskMode&&copyCtxState(this.suspendedCtx,this.ctx);this.checkSMaskState();this.pendingClip=null;this._cachedScaleForStroking[0]=-1;this._cachedGetSinglePixelWidth=null}else this.inSMaskMode&&this.endSMaskMode()}transform(e,t,i,a,s,n,r){this.dependencyTracker?.recordIncrementalData("transform",e);this.ctx.transform(t,i,a,s,n,r);this._cachedScaleForStroking[0]=-1;this._cachedGetSinglePixelWidth=null}constructPath(e,t,i,a){let[s]=i;if(a){if(null!==this.dependencyTracker){const i=t===L.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,a[0]-i,a[2]+i,a[1]-i,a[3]+i).recordDependencies(e,["transform"])}s instanceof Path2D||(s=i[0]=makePathFromDrawOPS(s));Util.axialAlignedBoundingBox(a,getCurrentTransform(this.ctx),this.current.minMax);this[t](e,s);this._pathStartIdx=e}else{s||=i[0]=new Path2D;this[t](e,s)}}closePath(e){this.ctx.closePath()}stroke(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const a=this.ctx,s=this.current.strokeColor;a.globalAlpha=this.current.strokeAlpha;if(this.contentVisible)if("object"==typeof s&&s?.getPattern){const i=s.isModifyingCurrentTransform()?a.getTransform():null;a.save();a.strokeStyle=s.getPattern(a,this,getCurrentTransformInverse(a),Ms,e);if(i){const e=new Path2D;e.addPath(t,a.getTransform().invertSelf().multiplySelf(i));t=e}this.rescaleAndStroke(t,!1);a.restore()}else this.rescaleAndStroke(t,!0);this.dependencyTracker?.recordDependencies(e,Ca);i&&this.consumePath(e,t,this.current.getClippedPathBoundingBox(Ms,getCurrentTransform(this.ctx)));a.globalAlpha=this.current.fillAlpha}closeStroke(e,t){this.stroke(e,t)}fill(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const a=this.ctx,s=this.current.fillColor;let n=!1;if(this.current.patternFill){const i=s.isModifyingCurrentTransform()?a.getTransform():null;this.dependencyTracker?.save(e);a.save();a.fillStyle=s.getPattern(a,this,getCurrentTransformInverse(a),Bs,e);if(i){const e=new Path2D;e.addPath(t,a.getTransform().invertSelf().multiplySelf(i));t=e}n=!0}const r=this.current.getClippedPathBoundingBox();if(this.contentVisible&&null!==r)if(this.pendingEOFill){a.fill(t,"evenodd");this.pendingEOFill=!1}else a.fill(t);this.dependencyTracker?.recordDependencies(e,xa);if(n){a.restore();this.dependencyTracker?.restore(e)}i&&this.consumePath(e,t,r)}eoFill(e,t){this.pendingEOFill=!0;this.fill(e,t)}fillStroke(e,t){this.fill(e,t,!1);this.stroke(e,t,!1);this.consumePath(e,t)}eoFillStroke(e,t){this.pendingEOFill=!0;this.fillStroke(e,t)}closeFillStroke(e,t){this.fillStroke(e,t)}closeEOFillStroke(e,t){this.pendingEOFill=!0;this.fillStroke(e,t)}endPath(e,t){this.consumePath(e,t)}rawFillPath(e,t){this.ctx.fill(t);this.dependencyTracker?.recordDependencies(e,Ea).recordOperation(e)}clip(e){this.dependencyTracker?.recordFutureForcedDependency("clipMode",e);this.pendingClip=Vs}eoClip(e){this.dependencyTracker?.recordFutureForcedDependency("clipMode",e);this.pendingClip=Us}beginText(e){this.current.textMatrix=null;this.current.textMatrixScale=1;this.current.x=this.current.lineX=0;this.current.y=this.current.lineY=0;this.dependencyTracker?.recordOpenMarker(e).resetIncrementalData("sameLineText").resetIncrementalData("moveText",e)}endText(e){const t=this.pendingTextPaths,i=this.ctx;if(this.dependencyTracker){const{dependencyTracker:i}=this;void 0!==t&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",e);i.recordCloseMarker(e)}if(void 0!==t){const e=new Path2D,a=i.getTransform().invertSelf();for(const{transform:i,x:s,y:n,fontSize:r,path:o}of t)o&&e.addPath(o,new DOMMatrix(i).preMultiplySelf(a).translate(s,n).scale(r,-r));i.clip(e)}delete this.pendingTextPaths}setCharSpacing(e,t){this.dependencyTracker?.recordSimpleData("charSpacing",e);this.current.charSpacing=t}setWordSpacing(e,t){this.dependencyTracker?.recordSimpleData("wordSpacing",e);this.current.wordSpacing=t}setHScale(e,t){this.dependencyTracker?.recordSimpleData("hScale",e);this.current.textHScale=t/100}setLeading(e,t){this.dependencyTracker?.recordSimpleData("leading",e);this.current.leading=-t}setFont(e,t,i){this.dependencyTracker?.recordSimpleData("font",e).recordSimpleDataFromNamed("fontObj",t,e);const a=this.commonObjs.get(t),n=this.current;if(!a)throw new Error(`Can't find font for ${t}`);n.fontMatrix=a.fontMatrix||s;0!==n.fontMatrix[0]&&0!==n.fontMatrix[3]||warn("Invalid font matrix for font "+t);if(i<0){i=-i;n.fontDirection=-1}else n.fontDirection=1;this.current.font=a;this.current.fontSize=i;if(a.isType3Font)return;const r=a.loadedName||"sans-serif",o=a.systemFontInfo?.css||`"${r}", ${a.fallbackName}`;let l="normal";a.black?l="900":a.bold&&(l="bold");const d=a.italic?"italic":"normal";let c=i;i<16?c=16:i>100&&(c=100);this.current.fontSizeScale=i/c;this.ctx.font=`${d} ${l} ${c}px ${o}`}setTextRenderingMode(e,t){this.dependencyTracker?.recordSimpleData("textRenderingMode",e);this.current.textRenderingMode=t}setTextRise(e,t){this.dependencyTracker?.recordSimpleData("textRise",e);this.current.textRise=t}moveText(e,t,i){this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText",e);this.current.x=this.current.lineX+=t;this.current.y=this.current.lineY+=i}setLeadingMoveText(e,t,i){this.setLeading(e,-i);this.moveText(e,t,i)}setTextMatrix(e,t){this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",e);const{current:i}=this;i.textMatrix=t;i.textMatrixScale=Math.hypot(t[0],t[1]);i.x=i.lineX=0;i.y=i.lineY=0}nextLine(e){this.moveText(e,0,this.current.leading);this.dependencyTracker?.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??e)}paintChar(e,t,i,a,s,n){const r=this.ctx,o=this.current,l=o.font,d=o.textRenderingMode,c=o.fontSize/o.fontSizeScale,h=d&x,u=!!(d&k),_=o.patternFill&&!l.missingFile,p=o.patternStroke&&!l.missingFile;let g;(l.disableFontFace||u||_||p)&&!l.missingFile&&(g=l.getPathGenerator(this.commonObjs,t));if(g&&(l.disableFontFace||_||p)){r.save();r.translate(i,a);r.scale(c,-c);this.dependencyTracker?.recordCharacterBBox(e,r,l);let t;if(h===b||h===S)if(s){t=r.getTransform();r.setTransform(...s);const e=canvas_assertClassBrand(zs,this,_getScaledPath).call(this,g,t,s);r.fill(e)}else r.fill(g);if(h===y||h===S)if(n){t||=r.getTransform();r.setTransform(...n);const{a:e,b:i,c:a,d:s}=t,o=Util.inverseTransform(n),l=Util.transform([e,i,a,s,0,0],o);Util.singularValueDecompose2dScale(l,Ns);r.lineWidth*=Math.max(Ns[0],Ns[1])/c;r.stroke(canvas_assertClassBrand(zs,this,_getScaledPath).call(this,g,t,n))}else{r.lineWidth/=c;r.stroke(g)}r.restore()}else{if(h===b||h===S){r.fillText(t,i,a);this.dependencyTracker?.recordCharacterBBox(e,r,l,c,i,a,()=>r.measureText(t))}if(h===y||h===S){this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(e,r,l,c,i,a,()=>r.measureText(t)).recordDependencies(e,Ca);r.strokeText(t,i,a)}}if(u){(this.pendingTextPaths||=[]).push({transform:getCurrentTransform(r),x:i,y:a,fontSize:c,path:g});this.dependencyTracker?.recordCharacterBBox(e,r,l,c,i,a)}}get isFontSubpixelAAEnabled(){const e=this.canvasFactory.create(10,10),t=e.context;t.scale(1.5,1);t.fillText("I",0,10);const i=t.getImageData(0,0,10,10).data;this.canvasFactory.destroy(e);let a=!1;for(let e=3;e<i.length;e+=4)if(i[e]>0&&i[e]<255){a=!0;break}return shadow(this,"isFontSubpixelAAEnabled",a)}showText(e,t){if(this.dependencyTracker){this.dependencyTracker.recordDependencies(e,Aa).resetBBox(e);this.current.textRenderingMode&k&&this.dependencyTracker.recordFutureForcedDependency("textClip",e).inheritPendingDependenciesAsFutureForcedDependencies()}const i=this.current,a=i.font;if(a.isType3Font){this.showType3Text(e,t);this.dependencyTracker?.recordShowTextOperation(e);return}const s=i.fontSize;if(0===s){this.dependencyTracker?.recordOperation(e);return}const n=this.ctx,r=i.fontSizeScale,o=i.charSpacing,l=i.wordSpacing,d=i.fontDirection,c=i.textHScale*d,h=t.length,u=a.vertical,_=u?1:-1,p=a.defaultVMetrics,g=s*i.fontMatrix[0],f=i.textRenderingMode===b&&!a.disableFontFace&&!i.patternFill;n.save();i.textMatrix&&n.transform(...i.textMatrix);n.translate(i.x,i.y+i.textRise);d>0?n.scale(c,-1):n.scale(c,1);let m,v;const P=i.textRenderingMode&x,w=P===y||P===S;if((P===b||P===S)&&i.patternFill){n.save();const t=i.fillColor.getPattern(n,this,getCurrentTransformInverse(n),Bs,e);m=getCurrentTransform(n);n.restore();n.fillStyle=t}if(w&&i.patternStroke){n.save();const t=i.strokeColor.getPattern(n,this,getCurrentTransformInverse(n),Ms,e);v=getCurrentTransform(n);n.restore();n.strokeStyle=t}let C=i.lineWidth;const E=i.textMatrixScale;0===E||0===C?w&&(C=this.getSinglePixelWidth()):C/=E;if(1!==r){n.scale(r,r);C/=r}n.lineWidth=C;if(a.isInvalidPDFjsFont){const a=[];let s=0;for(const e of t){a.push(e.unicode);s+=e.width}const r=a.join("");n.fillText(r,0,0);if(null!==this.dependencyTracker){const t=n.measureText(r);this.dependencyTracker.recordBBox(e,this.ctx,-t.actualBoundingBoxLeft,t.actualBoundingBoxRight,-t.actualBoundingBoxAscent,t.actualBoundingBoxDescent).recordShowTextOperation(e)}i.x+=s*g*c;n.restore();this.compose();return}let A,G=0;for(A=0;A<h;++A){const i=t[A];if("number"==typeof i){G+=_*i*s/1e3;continue}let c=!1;const h=(i.isSpace?l:0)+o,P=i.fontChar,w=i.accent;let b,y,S,C=i.width;if(u){const e=i.vmetric||p,t=-(i.vmetric?e[1]:.5*C)*g,a=e[2]*g;C=e?-e[0]:C;b=t/r;y=(G+a)/r}else{b=G/r;y=0}if(a.remeasure&&C>0){S=n.measureText(P);const e=1e3*S.width/s*r;if(C<e&&this.isFontSubpixelAAEnabled){const t=C/e;c=!0;n.save();n.scale(t,1);b/=t}else C!==e&&(b+=(C-e)/2e3*s/r)}if(this.contentVisible&&(i.isInFont||a.missingFile))if(f&&!w){n.fillText(P,b,y);this.dependencyTracker?.recordCharacterBBox(e,n,S?{bbox:null}:a,s/r,b,y,()=>S??n.measureText(P))}else{this.paintChar(e,P,b,y,m,v);if(w){const t=b+s*w.offset.x/r,i=y-s*w.offset.y/r;this.paintChar(e,w.fontChar,t,i,m,v)}}G+=u?C*g-h*d:C*g+h*d;c&&n.restore()}u?i.y-=G:i.x+=G*c;n.restore();this.compose();this.dependencyTracker?.recordShowTextOperation(e)}showType3Text(e,t){const i=this.ctx,a=this.current,n=a.font,r=a.fontSize,o=a.fontDirection,l=n.vertical?1:-1,d=a.charSpacing,c=a.wordSpacing,h=a.textHScale*o,u=a.fontMatrix||s,_=t.length;let p,g,f,m;if(a.textRenderingMode===C||0===r)return;this._cachedScaleForStroking[0]=-1;this._cachedGetSinglePixelWidth=null;i.save();a.textMatrix&&i.transform(...a.textMatrix);i.translate(a.x,a.y+a.textRise);i.scale(h,o);const v=this.dependencyTracker;this.dependencyTracker=v?new CanvasNestedDependencyTracker(v,e):null;for(p=0;p<_;++p){g=t[p];if("number"==typeof g){m=l*g*r/1e3;this.ctx.translate(m,0);a.x+=m*h;continue}const e=(g.isSpace?c:0)+d,s=n.charProcOperatorList[g.operatorListId];if(s){if(this.contentVisible){this.save();i.scale(r,r);i.transform(...u);this.executeOperatorList(s);this.restore()}}else warn(`Type3 character "${g.operatorListId}" is not available.`);const o=[g.width,0];Util.applyTransform(o,u);f=o[0]*r+e;i.translate(f,0);a.x+=f*h}i.restore();v&&(this.dependencyTracker=v)}setCharWidth(e,t,i){}setCharWidthAndBounds(e,t,i,a,s,n,r){const o=new Path2D;o.rect(a,s,n-a,r-s);this.ctx.clip(o);this.dependencyTracker?.recordBBox(e,this.ctx,a,n,s,r).recordClipBox(e,this.ctx,a,n,s,r);this.endPath(e)}getColorN_Pattern(e,t){let i;if("TilingPattern"===t[0]){const e=this.baseTransform||getCurrentTransform(this.ctx),a={createCanvasGraphics:(e,t)=>new CanvasGraphics(e,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new CanvasNestedDependencyTracker(this.dependencyTracker,t,!0):null)};i=new TilingPattern(t,this.ctx,a,e)}else i=this._getPattern(e,t[1],t[2]);return i}setStrokeColorN(e){this.dependencyTracker?.recordSimpleData("strokeColor",e);for(var t=arguments.length,i=new Array(t>1?t-1:0),a=1;a<t;a++)i[a-1]=arguments[a];this.current.strokeColor=this.getColorN_Pattern(e,i);this.current.patternStroke=!0}setFillColorN(e){this.dependencyTracker?.recordSimpleData("fillColor",e);for(var t=arguments.length,i=new Array(t>1?t-1:0),a=1;a<t;a++)i[a-1]=arguments[a];this.current.fillColor=this.getColorN_Pattern(e,i);this.current.patternFill=!0}setStrokeRGBColor(e,t){this.dependencyTracker?.recordSimpleData("strokeColor",e);this.ctx.strokeStyle=this.current.strokeColor=t;this.current.patternStroke=!1}setStrokeTransparent(e){this.dependencyTracker?.recordSimpleData("strokeColor",e);this.ctx.strokeStyle=this.current.strokeColor="transparent";this.current.patternStroke=!1}setFillRGBColor(e,t){this.dependencyTracker?.recordSimpleData("fillColor",e);this.ctx.fillStyle=this.current.fillColor=t;this.current.patternFill=!1}setFillTransparent(e){this.dependencyTracker?.recordSimpleData("fillColor",e);this.ctx.fillStyle=this.current.fillColor="transparent";this.current.patternFill=!1}_getPattern(e,t){let i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(this.cachedPatterns.has(t))i=this.cachedPatterns.get(t);else{i=function getShadingPattern(e){switch(e[0]){case"RadialAxial":return new RadialAxialShadingPattern(e);case"Mesh":return new MeshShadingPattern(e);case"Dummy":return new DummyShadingPattern}throw new Error(`Unknown IR type: ${e[0]}`)}(this.getObject(e,t));this.cachedPatterns.set(t,i)}a&&(i.matrix=a);return i}shadingFill(e,t){if(!this.contentVisible)return;const i=this.ctx;this.save(e);const a=this._getPattern(e,t);i.fillStyle=a.getPattern(i,this,getCurrentTransformInverse(i),Is,e);const s=getCurrentTransformInverse(i);if(s){const{width:e,height:t}=i.canvas,a=Os.slice();Util.axialAlignedBoundingBox([0,0,e,t],s,a);const[n,r,o,l]=a;this.ctx.fillRect(n,r,o-n,l-r)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,Ga).recordDependencies(e,xa).recordOperation(e);this.compose(this.current.getClippedPathBoundingBox());this.restore(e)}beginInlineImage(){unreachable("Should not call beginInlineImage")}beginImageData(){unreachable("Should not call beginImageData")}paintFormXObjectBegin(e,t,i){if(this.contentVisible){this.save(e);this.baseTransformStack.push(this.baseTransform);t&&this.transform(e,...t);this.baseTransform=getCurrentTransform(this.ctx);if(i){Util.axialAlignedBoundingBox(i,this.baseTransform,this.current.minMax);const[t,a,s,n]=i,r=new Path2D;r.rect(t,a,s-t,n-a);this.ctx.clip(r);this.dependencyTracker?.recordClipBox(e,this.ctx,t,s,a,n);this.endPath(e)}}}paintFormXObjectEnd(e){if(this.contentVisible){this.restore(e);this.baseTransform=this.baseTransformStack.pop()}}beginGroup(e,t){if(!this.contentVisible)return;this.save(e);if(this.inSMaskMode){this.endSMaskMode();this.current.activeSMask=null}const i=this.ctx;t.isolated||info("TODO: Support non-isolated groups.");t.knockout&&warn("Knockout groups not supported.");const a=getCurrentTransform(i);t.matrix&&i.transform(...t.matrix);const s=[0,0,i.canvas.width,i.canvas.height];let n;if(t.bbox){n=Os.slice();Util.axialAlignedBoundingBox(t.bbox,getCurrentTransform(i),n);n=Util.intersect(n,s)||[0,0,0,0]}else n=s;const r=Math.floor(n[0]),o=Math.floor(n[1]),l=Math.max(Math.ceil(n[2])-r,1),d=Math.max(Math.ceil(n[3])-o,1);this.current.startNewPathAndClipBox([0,0,l,d]);t.smask&&this.smaskCounter++;const c=this.canvasFactory.create(l,d);t.smask&&this.smaskGroupCanvases.push(c);const h=c.context;h.translate(-r,-o);h.transform(...a);if(t.bbox){let e=new Path2D;const[i,a,s,n]=t.bbox;e.rect(i,a,s-i,n-a);if(t.matrix){const i=new Path2D;i.addPath(e,new DOMMatrix(t.matrix));e=i}h.clip(e)}t.smask&&this.smaskStack.push({canvas:c.canvas,context:h,offsetX:r,offsetY:o,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null});if(!t.smask||this.dependencyTracker){i.setTransform(1,0,0,1,0,0);i.translate(r,o);i.save()}copyCtxState(i,h);this.ctx=h;this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(i);this.setGState(e,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]);this.groupStack.push(i);this.groupLevel++}endGroup(e,t){if(!this.contentVisible)return;this.groupLevel--;const i=this.ctx,a=this.groupStack.pop();this.ctx=a;this.ctx.imageSmoothingEnabled=!1;this.dependencyTracker?.popBaseTransform();if(t.smask){this.tempSMask=this.smaskStack.pop();this.restore(e);this.dependencyTracker&&this.ctx.restore()}else{this.ctx.restore();const t=getCurrentTransform(this.ctx);this.restore(e);this.ctx.save();this.ctx.setTransform(...t);const a=Os.slice();Util.axialAlignedBoundingBox([0,0,i.canvas.width,i.canvas.height],t,a);this.ctx.drawImage(i.canvas,0,0);this.ctx.restore();this.canvasFactory.destroy({canvas:i.canvas,context:i});this.compose(a)}}beginAnnotation(e,t,i,a,s,n){canvas_assertClassBrand(zs,this,_restoreInitialState).call(this);resetCtxToDefault(this.ctx);this.ctx.save();this.save(e);this.baseTransform&&this.ctx.setTransform(...this.baseTransform);if(i){const s=i[2]-i[0],r=i[3]-i[1];if(n&&this.annotationCanvasMap){(a=a.slice())[4]-=i[0];a[5]-=i[1];(i=i.slice())[0]=i[1]=0;i[2]=s;i[3]=r;Util.singularValueDecompose2dScale(getCurrentTransform(this.ctx),Ns);const{viewportScale:e}=this,n=Math.ceil(s*this.outputScaleX*e),o=Math.ceil(r*this.outputScaleY*e);this.annotationCanvas=this.canvasFactory.create(n,o);const{canvas:l,context:d}=this.annotationCanvas;this.annotationCanvasMap.set(t,l);this.annotationCanvas.savedCtx=this.ctx;this.ctx=d;this.ctx.save();this.ctx.setTransform(Ns[0],0,0,-Ns[1],0,r*Ns[1]);resetCtxToDefault(this.ctx)}else{resetCtxToDefault(this.ctx);this.endPath(e);const t=new Path2D;t.rect(i[0],i[1],s,r);this.ctx.clip(t)}}this.current=new CanvasExtraState(this.ctx.canvas.width,this.ctx.canvas.height);this.transform(e,...a);this.transform(e,...s)}endAnnotation(e){if(this.annotationCanvas){this.ctx.restore();canvas_assertClassBrand(zs,this,_drawFilter).call(this);this.ctx=this.annotationCanvas.savedCtx;delete this.annotationCanvas.savedCtx;delete this.annotationCanvas}}paintImageMaskXObject(e,t){if(!this.contentVisible)return;const i=t.count;(t=this.getObject(e,t.data,t)).count=i;const a=this.ctx,s=this._createMaskCanvas(e,t),n=s.canvas;a.save();a.setTransform(1,0,0,1,0,0);a.drawImage(n,s.offsetX,s.offsetY);this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,s.offsetX,s.offsetX+n.width,s.offsetY,s.offsetY+n.height).recordOperation(e);a.restore();s.canvasEntry&&this.canvasFactory.destroy(s.canvasEntry);this.compose()}paintImageMaskXObjectRepeat(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,n=arguments.length>5?arguments[5]:void 0,r=arguments.length>6?arguments[6]:void 0;if(!this.contentVisible)return;t=this.getObject(e,t.data,t);const o=this.ctx;o.save();const l=getCurrentTransform(o);o.transform(i,a,s,n,0,0);const d=this._createMaskCanvas(e,t);o.setTransform(1,0,0,1,d.offsetX-l[4],d.offsetY-l[5]);this.dependencyTracker?.resetBBox(e);for(let t=0,c=r.length;t<c;t+=2){const c=Util.transform(l,[i,a,s,n,r[t],r[t+1]]);o.drawImage(d.canvas,c[4],c[5]);this.dependencyTracker?.recordBBox(e,this.ctx,c[4],c[4]+d.canvas.width,c[5],c[5]+d.canvas.height)}o.restore();d.canvasEntry&&this.canvasFactory.destroy(d.canvasEntry);this.compose();this.dependencyTracker?.recordOperation(e)}paintImageMaskXObjectGroup(e,t){if(!this.contentVisible)return;const i=this.ctx,a=this.current.fillColor,s=this.current.patternFill;this.dependencyTracker?.resetBBox(e).recordDependencies(e,Ba);for(const n of t){const{data:t,width:r,height:o,transform:l}=n,d=this.canvasFactory.create(r,o),c=d.context;c.save();putBinaryImageMask(c,this.getObject(e,t,n));c.globalCompositeOperation="source-in";c.fillStyle=s?a.getPattern(c,this,getCurrentTransformInverse(i),Bs,e):a;c.fillRect(0,0,r,o);c.restore();i.save();i.transform(...l);i.scale(1,-1);drawImageAtIntegerCoords(i,d.canvas,0,0,r,o,0,-1,1,1);this.canvasFactory.destroy(d);this.dependencyTracker?.recordBBox(e,i,0,r,0,o);i.restore()}this.compose();this.dependencyTracker?.recordOperation(e)}paintImageXObject(e,t){if(!this.contentVisible)return;const i=this.getObject(e,t);i?this.paintInlineImageXObject(e,i):warn("Dependent image isn't ready yet")}paintImageXObjectRepeat(e,t,i,a,s){if(!this.contentVisible)return;const n=this.getObject(e,t);if(!n){warn("Dependent image isn't ready yet");return}const r=n.width,o=n.height,l=[];for(let e=0,t=s.length;e<t;e+=2)l.push({transform:[i,0,0,a,s[e],s[e+1]],x:0,y:0,w:r,h:o});this.paintInlineImageXObjectGroup(e,n,l)}applyTransferMapsToCanvas(e){if("none"!==this.current.transferMaps){e.filter=this.current.transferMaps;e.drawImage(e.canvas,0,0);e.filter="none"}return e.canvas}applyTransferMapsToBitmap(e){if("none"===this.current.transferMaps)return{img:e.bitmap,canvasEntry:null};const{bitmap:t,width:i,height:a}=e,s=this.canvasFactory.create(i,a),n=s.context;n.filter=this.current.transferMaps;n.drawImage(t,0,0);n.filter="none";return{img:s.canvas,canvasEntry:s}}paintInlineImageXObject(e,t){if(!this.contentVisible)return;const i=t.width,a=t.height,s=this.ctx;this.save(e);const{filter:n}=s;"none"!==n&&""!==n&&(s.filter="none");s.scale(1/i,-1/a);let r,o=null;if(t.bitmap){const e=this.applyTransferMapsToBitmap(t);r=e.img;o=e.canvasEntry}else if("function"==typeof HTMLElement&&t instanceof HTMLElement||!t.data)r=t;else{const e=this.canvasFactory.create(i,a);putBinaryImageData(e.context,t);r=this.applyTransferMapsToCanvas(e.context);o=e}const l=this._scaleImage(r,getCurrentTransformInverse(s));s.imageSmoothingEnabled=getImageSmoothingEnabled(getCurrentTransform(s),t.interpolate);if(this.dependencyTracker){this.dependencyTracker.resetBBox(e).recordBBox(e,s,0,i,-a,0).recordDependencies(e,ka).recordOperation(e);this.imagesTracker?.record(s,i,a,this.dependencyTracker.clipBox)}drawImageAtIntegerCoords(s,l.img,0,0,l.paintWidth,l.paintHeight,0,-a,i,a);l.tmpCanvas&&this.canvasFactory.destroy(l.tmpCanvas);o&&this.canvasFactory.destroy(o);this.compose();this.restore(e)}paintInlineImageXObjectGroup(e,t,i){if(!this.contentVisible)return;const a=this.ctx;let s,n=null;if(t.bitmap)s=t.bitmap;else{const e=t.width,i=t.height,a=this.canvasFactory.create(e,i);putBinaryImageData(a.context,t);s=this.applyTransferMapsToCanvas(a.context);n=a}this.dependencyTracker?.resetBBox(e);for(const t of i){a.save();a.transform(...t.transform);a.scale(1,-1);drawImageAtIntegerCoords(a,s,t.x,t.y,t.w,t.h,0,-1,1,1);this.dependencyTracker?.recordBBox(e,a,0,1,-1,0);a.restore()}n&&this.canvasFactory.destroy(n);this.dependencyTracker?.recordOperation(e);this.compose()}paintSolidColorImageMask(e){if(this.contentVisible){this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,0,1,0,1).recordDependencies(e,xa).recordOperation(e);this.ctx.fillRect(0,0,1,1);this.compose()}}markPoint(e,t){}markPointProps(e,t,i){}beginMarkedContent(e,t){this.dependencyTracker?.beginMarkedContent(e);this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t,i){this.dependencyTracker?.beginMarkedContent(e);"OC"===t?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(i)}):this.markedContentStack.push({visible:!0});this.contentVisible=this.isContentVisible()}endMarkedContent(e){this.dependencyTracker?.endMarkedContent(e);this.markedContentStack.pop();this.contentVisible=this.isContentVisible()}beginCompat(e){}endCompat(e){}consumePath(e,t,i){const a=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath();this.pendingClip||this.compose(i);const s=this.ctx;if(this.pendingClip){a||(this.pendingClip===Us?s.clip(t,"evenodd"):s.clip(t));this.pendingClip=null;this.dependencyTracker?.bboxToClipBoxDropOperation(e).recordFutureForcedDependency("clipPath",e)}else this.dependencyTracker?.recordOperation(e);this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=getCurrentTransform(this.ctx);if(0===e[1]&&0===e[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),i=Math.hypot(e[0],e[2]),a=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(i,a)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:e}=this.current,{a:t,b:i,c:a,d:s}=this.ctx.getTransform();let n,r;if(0===i&&0===a){const i=Math.abs(t),a=Math.abs(s);if(i===a)if(0===e)n=r=1/i;else{const t=i*e;n=r=t<1?1/t:1}else if(0===e){n=1/i;r=1/a}else{const t=i*e,s=a*e;n=t<1?1/t:1;r=s<1?1/s:1}}else{const o=Math.abs(t*s-i*a),l=Math.hypot(t,i),d=Math.hypot(a,s);if(0===e){n=d/o;r=l/o}else{const t=e*o;n=d>t?d/t:1;r=l>t?l/t:1}}this._cachedScaleForStroking[0]=n;this._cachedScaleForStroking[1]=r}return this._cachedScaleForStroking}rescaleAndStroke(e,t){const{ctx:i,current:{lineWidth:a}}=this,[s,n]=this.getScaleForStroking();if(s===n){i.lineWidth=(a||1)*s;i.stroke(e);return}const r=i.getLineDash();t&&i.save();i.scale(s,n);Rs.a=1/s;Rs.d=1/n;const o=new Path2D;o.addPath(e,Rs);if(r.length>0){const e=Math.max(s,n);i.setLineDash(r.map(t=>t/e));i.lineDashOffset/=e}i.lineWidth=a||1;i.stroke(o);t&&i.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}function _restoreInitialState(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null;this.ctx.restore();if(this.transparentCanvas){this.ctx=this.compositeCtx;this.ctx.save();this.ctx.setTransform(1,0,0,1,0,0);this.ctx.drawImage(this.transparentCanvas,0,0);this.ctx.restore();this.canvasFactory.destroy(this.transparentCanvasEntry);this.transparentCanvas=null;this.transparentCanvasEntry=null}}function _drawFilter(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==e){const t=this.ctx.filter;this.ctx.filter=e;this.ctx.drawImage(this.ctx.canvas,0,0);this.ctx.filter=t}}}function _getScaledPath(e,t,i){const a=new Path2D;a.addPath(e,new DOMMatrix(i).invertSelf().multiplySelf(t));return a}for(const e in L)void 0!==CanvasGraphics.prototype[e]&&(CanvasGraphics.prototype[L[e]]=CanvasGraphics.prototype[e]);function base_pdf_stream_defineProperty(e,t,i){return(t=function base_pdf_stream_toPropertyKey(e){var t=function base_pdf_stream_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function base_pdf_stream_classPrivateFieldInitSpec(e,t,i){(function base_pdf_stream_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function base_pdf_stream_classPrivateFieldGet(e,t){return e.get(base_pdf_stream_assertClassBrand(e,t))}function base_pdf_stream_classPrivateFieldSet(e,t,i){return e.set(base_pdf_stream_assertClassBrand(e,t),i),i}function base_pdf_stream_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Hs=new WeakMap,$s=new WeakMap;class BasePDFStream{constructor(e,t,i){base_pdf_stream_classPrivateFieldInitSpec(this,Hs,null);base_pdf_stream_classPrivateFieldInitSpec(this,$s,null);base_pdf_stream_defineProperty(this,"_fullReader",null);base_pdf_stream_defineProperty(this,"_rangeReaders",new Set);base_pdf_stream_defineProperty(this,"_source",null);this._source=e;base_pdf_stream_classPrivateFieldSet(Hs,this,t);base_pdf_stream_classPrivateFieldSet($s,this,i)}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){assert(!this._fullReader,"BasePDFStream.getFullReader can only be called once.");return this._fullReader=new(base_pdf_stream_classPrivateFieldGet(Hs,this))(this)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=new(base_pdf_stream_classPrivateFieldGet($s,this))(this,e,t);this._rangeReaders.add(i);return i}cancelAllRequests(e){this._fullReader?.cancel(e);for(const t of new Set(this._rangeReaders))t.cancel(e)}}class BasePDFStreamReader{constructor(e){base_pdf_stream_defineProperty(this,"onProgress",null);base_pdf_stream_defineProperty(this,"_contentLength",0);base_pdf_stream_defineProperty(this,"_filename",null);base_pdf_stream_defineProperty(this,"_headersCapability",Promise.withResolvers());base_pdf_stream_defineProperty(this,"_isRangeSupported",!1);base_pdf_stream_defineProperty(this,"_isStreamingSupported",!1);base_pdf_stream_defineProperty(this,"_loaded",0);base_pdf_stream_defineProperty(this,"_stream",null);this._stream=e}_callOnProgress(){this.onProgress?.({loaded:this._loaded,total:this._contentLength})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){unreachable("Abstract method `read` called")}cancel(e){unreachable("Abstract method `cancel` called")}}class BasePDFStreamRangeReader{constructor(e,t,i){base_pdf_stream_defineProperty(this,"_stream",null);this._stream=e}async read(){unreachable("Abstract method `read` called")}cancel(e){unreachable("Abstract method `cancel` called")}}function createHeaders(e,t){const i=new Headers;if(!e||!t||"object"!=typeof t)return i;for(const e in t){const a=t[e];void 0!==a&&i.append(e,a)}return i}function getResponseOrigin(e){return URL.parse(e)?.origin??null}function validateRangeRequestCapabilities(e){let{responseHeaders:t,isHttp:i,rangeChunkSize:a,disableRange:s}=e;const n={contentLength:0,isRangeSupported:!1},r=parseInt(t.get("Content-Length"),10);if(!Number.isInteger(r))return n;n.contentLength=r;if(r<=2*a)return n;if(s||!i)return n;if("bytes"!==t.get("Accept-Ranges"))return n;"identity"===(t.get("Content-Encoding")||"identity")&&(n.isRangeSupported=!0);return n}function extractFilenameFromHeader(e){const t=e.get("Content-Disposition");if(t){let e=function getFilenameFromContentDispositionHeader(e){let t=!0,i=toParamRegExp("filename\\*","i").exec(e);if(i){i=i[1];let e=rfc2616unquote(i);e=unescape(e);e=rfc5987decode(e);e=rfc2047decode(e);return fixupEncoding(e)}i=function rfc2231getparam(e){const t=[];let i;const a=toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=a.exec(e));){let[,e,a,s]=i;e=parseInt(e,10);if(e in t){if(0===e)break}else t[e]=[a,s]}const s=[];for(let e=0;e<t.length&&e in t;++e){let[i,a]=t[e];a=rfc2616unquote(a);if(i){a=unescape(a);0===e&&(a=rfc5987decode(a))}s.push(a)}return s.join("")}(e);if(i)return fixupEncoding(rfc2047decode(i));i=toParamRegExp("filename","i").exec(e);if(i){i=i[1];let e=rfc2616unquote(i);e=rfc2047decode(e);return fixupEncoding(e)}function toParamRegExp(e,t){return new RegExp("(?:^|;)\\s*"+e+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',t)}function textdecode(e,i){if(e){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const a=new TextDecoder(e,{fatal:!0}),s=stringToBytes(i);i=a.decode(s);t=!1}catch{}}return i}function fixupEncoding(e){if(t&&/[\x80-\xff]/.test(e)){e=textdecode("utf-8",e);t&&(e=textdecode("iso-8859-1",e))}return e}function rfc2616unquote(e){if(e.startsWith('"')){const t=e.slice(1).split('\\"');for(let e=0;e<t.length;++e){const i=t[e].indexOf('"');if(-1!==i){t[e]=t[e].slice(0,i);t.length=e+1}t[e]=t[e].replaceAll(/\\(.)/g,"$1")}e=t.join('"')}return e}function rfc5987decode(e){const t=e.indexOf("'");return-1===t?e:textdecode(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,""))}function rfc2047decode(e){return!e.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(e,t,i,a){if("q"===i||"Q"===i)return textdecode(t,a=(a=a.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(e,t){return String.fromCharCode(parseInt(t,16))}));try{a=atob(a)}catch{}return textdecode(t,a)})}return""}(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(isPdfFile(e))return e}return null}function createResponseError(e,t){return new ResponseException(`Unexpected server response (${e}) while retrieving PDF "${t.href}".`,e,404===e||0===e&&"file:"===t.protocol)}function ensureResponseOrigin(e,t){if(e!==t)throw new Error(`Expected range response-origin "${e}" to match "${t}".`)}function fetch_stream_defineProperty(e,t,i){return(t=function fetch_stream_toPropertyKey(e){var t=function fetch_stream_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function fetchUrl(e,t,i,a){return fetch(e,{method:"GET",headers:t,signal:a.signal,mode:"cors",credentials:i?"include":"same-origin",redirect:"follow"})}function ensureResponseStatus(e,t){if(200!==e&&206!==e)throw createResponseError(e,t)}function getArrayBuffer(e){if(e instanceof Uint8Array)return e.buffer;if(e instanceof ArrayBuffer)return e;throw new Error(`getArrayBuffer - unexpected data: ${e}`)}class PDFFetchStream extends BasePDFStream{constructor(e){super(e,PDFFetchStreamReader,PDFFetchStreamRangeReader);fetch_stream_defineProperty(this,"_responseOrigin",null);const{httpHeaders:t,url:i}=e;assert(/https?:|blob:|capacitor:/.test(i.protocol),"PDFFetchStream only supports http(s)://, blob:, and capacitor:// URLs.");this.headers=createHeaders(!0,t)}}class PDFFetchStreamReader extends BasePDFStreamReader{constructor(e){super(e);fetch_stream_defineProperty(this,"_abortController",new AbortController);fetch_stream_defineProperty(this,"_reader",null);const{disableRange:t,disableStream:i,rangeChunkSize:a,url:s,withCredentials:n}=e._source;this._isStreamingSupported=!i;const r=new Headers(e.headers);fetchUrl(s,r,n,this._abortController).then(i=>{e._responseOrigin=getResponseOrigin(i.url);ensureResponseStatus(i.status,s);this._reader=i.body.getReader();const n=i.headers,{contentLength:r,isRangeSupported:o}=validateRangeRequestCapabilities({responseHeaders:n,isHttp:!0,rangeChunkSize:a,disableRange:t});this._contentLength=r;this._isRangeSupported=o;this._filename=extractFilenameFromHeader(n);!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new AbortException("Streaming is disabled."));this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();if(t)return{value:e,done:t};this._loaded+=e.byteLength;this._callOnProgress();return{value:getArrayBuffer(e),done:!1}}cancel(e){this._reader?.cancel(e);this._abortController.abort()}}class PDFFetchStreamRangeReader extends BasePDFStreamRangeReader{constructor(e,t,i){super(e,t,i);fetch_stream_defineProperty(this,"_abortController",new AbortController);fetch_stream_defineProperty(this,"_readCapability",Promise.withResolvers());fetch_stream_defineProperty(this,"_reader",null);const{url:a,withCredentials:s}=e._source,n=new Headers(e.headers);n.append("Range",`bytes=${t}-${i-1}`);fetchUrl(a,n,s,this._abortController).then(t=>{ensureResponseOrigin(getResponseOrigin(t.url),e._responseOrigin);ensureResponseStatus(t.status,a);this._reader=t.body.getReader();this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:{value:getArrayBuffer(e),done:!1}}cancel(e){this._reader?.cancel(e);this._abortController.abort()}}__webpack_require__(116);function transport_stream_classPrivateFieldInitSpec(e,t,i){transport_stream_checkPrivateRedeclaration(e,t),t.set(e,i)}function transport_stream_classPrivateFieldGet(e,t){return e.get(transport_stream_assertClassBrand(e,t))}function transport_stream_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function transport_stream_defineProperty(e,t,i){return(t=function transport_stream_toPropertyKey(e){var t=function transport_stream_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function transport_stream_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function transport_stream_getArrayBuffer(e){return e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}function endRequests(){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}var qs=new WeakSet;class PDFDataTransportStream extends BasePDFStream{constructor(e){super(e,PDFDataTransportStreamReader,PDFDataTransportStreamRangeReader);!function transport_stream_classPrivateMethodInitSpec(e,t){transport_stream_checkPrivateRedeclaration(e,t),t.add(e)}(this,qs);transport_stream_defineProperty(this,"_progressiveDone",!1);transport_stream_defineProperty(this,"_queuedChunks",[]);const{pdfDataRangeTransport:t}=e,{initialData:i,progressiveDone:a}=t;if(i?.length>0){const e=transport_stream_getArrayBuffer(i);this._queuedChunks.push(e)}this._progressiveDone=a;t.addRangeListener((e,t)=>{transport_stream_assertClassBrand(qs,this,_onReceiveData).call(this,e,t)});t.addProgressiveReadListener(e=>{transport_stream_assertClassBrand(qs,this,_onReceiveData).call(this,void 0,e)});t.addProgressiveDoneListener(()=>{this._fullReader?.progressiveDone();this._progressiveDone=!0});t.transportReady()}getFullReader(){const e=super.getFullReader();this._queuedChunks=null;return e}getRangeReader(e,t){const i=super.getRangeReader(e,t);if(i){i.onDone=()=>this._rangeReaders.delete(i);this._source.pdfDataRangeTransport.requestDataRange(e,t)}return i}cancelAllRequests(e){super.cancelAllRequests(e);this._source.pdfDataRangeTransport.abort()}}function _onReceiveData(e,t){const i=transport_stream_getArrayBuffer(t);if(void 0===e)this._fullReader?this._fullReader._enqueue(i):this._queuedChunks.push(i);else{const t=this._rangeReaders.keys().find(t=>t._begin===e);assert(t,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");t._enqueue(i)}}var Xs=new WeakMap;class PDFDataTransportStreamReader extends BasePDFStreamReader{constructor(e){super(e);transport_stream_classPrivateFieldInitSpec(this,Xs,endRequests.bind(this));transport_stream_defineProperty(this,"_done",!1);transport_stream_defineProperty(this,"_queuedChunks",null);transport_stream_defineProperty(this,"_requests",[]);const{pdfDataRangeTransport:t,disableRange:i,disableStream:a}=e._source,{length:s,contentDispositionFilename:n}=t;this._queuedChunks=e._queuedChunks||[];for(const e of this._queuedChunks)this._loaded+=e.byteLength;this._done=e._progressiveDone;this._contentLength=s;this._isStreamingSupported=!a;this._isRangeSupported=!i;isPdfFile(n)&&(this._filename=n);this._headersCapability.resolve();const r=this._loaded;Promise.resolve().then(()=>{r>0&&this._loaded===r&&this._callOnProgress()})}_enqueue(e){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunks.push(e);this._loaded+=e.byteLength;this._callOnProgress()}}async read(){if(this._queuedChunks.length>0){return{value:this._queuedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();this._requests.push(e);return e.promise}cancel(e){this._done=!0;transport_stream_classPrivateFieldGet(Xs,this).call(this)}progressiveDone(){this._done||=!0;0===this._queuedChunks.length&&transport_stream_classPrivateFieldGet(Xs,this).call(this)}}var Ks=new WeakMap;class PDFDataTransportStreamRangeReader extends BasePDFStreamRangeReader{constructor(e,t,i){super(e,t,i);transport_stream_classPrivateFieldInitSpec(this,Ks,endRequests.bind(this));transport_stream_defineProperty(this,"onDone",null);transport_stream_defineProperty(this,"_begin",-1);transport_stream_defineProperty(this,"_done",!1);transport_stream_defineProperty(this,"_queuedChunk",null);transport_stream_defineProperty(this,"_requests",[]);this._begin=t}_enqueue(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});transport_stream_classPrivateFieldGet(Ks,this).call(this)}this._done=!0;this.onDone?.()}}async read(){if(this._queuedChunk){const e=this._queuedChunk;this._queuedChunk=null;return{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();this._requests.push(e);return e.promise}cancel(e){this._done=!0;transport_stream_classPrivateFieldGet(Ks,this).call(this);this.onDone?.()}}function network_classPrivateMethodInitSpec(e,t){network_checkPrivateRedeclaration(e,t),t.add(e)}function network_defineProperty(e,t,i){return(t=function network_toPropertyKey(e){var t=function network_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function network_classPrivateFieldInitSpec(e,t,i){network_checkPrivateRedeclaration(e,t),t.set(e,i)}function network_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function network_classPrivateFieldGet(e,t){return e.get(network_assertClassBrand(e,t))}function network_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Ys=new WeakMap,Zs=new WeakSet;class PDFNetworkStream extends BasePDFStream{constructor(e){super(e,PDFNetworkStreamReader,PDFNetworkStreamRangeReader);network_classPrivateMethodInitSpec(this,Zs);network_classPrivateFieldInitSpec(this,Ys,new WeakMap);network_defineProperty(this,"_responseOrigin",null);const{httpHeaders:t,url:i}=e;this.url=i;this.isHttp=/https?:/.test(i.protocol);this.headers=createHeaders(this.isHttp,t)}_request(e){const t=new XMLHttpRequest,i={validateStatus:null,onHeadersReceived:e.onHeadersReceived,onDone:e.onDone,onError:e.onError,onProgress:e.onProgress};network_classPrivateFieldGet(Ys,this).set(t,i);t.open("GET",this.url);t.withCredentials=this._source.withCredentials;for(const[e,i]of this.headers)t.setRequestHeader(e,i);if(this.isHttp&&"begin"in e&&"end"in e){t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`);i.validateStatus=e=>206===e||200===e}else i.validateStatus=e=>200===e;t.responseType="arraybuffer";assert(e.onError,"Expected `onError` callback to be provided.");t.onerror=()=>e.onError(t.status);t.onreadystatechange=network_assertClassBrand(Zs,this,_onStateChange).bind(this,t);t.onprogress=network_assertClassBrand(Zs,this,_onProgress).bind(this,t);t.send(null);return t}_abortRequest(e){if(network_classPrivateFieldGet(Ys,this).has(e)){network_classPrivateFieldGet(Ys,this).delete(e);e.abort()}}getRangeReader(e,t){const i=super.getRangeReader(e,t);i&&(i.onClosed=()=>this._rangeReaders.delete(i));return i}}function _onProgress(e,t){const i=network_classPrivateFieldGet(Ys,this).get(e);i?.onProgress?.(t)}function _onStateChange(e,t){const i=network_classPrivateFieldGet(Ys,this).get(e);if(!i)return;if(e.readyState>=2&&i.onHeadersReceived){i.onHeadersReceived();delete i.onHeadersReceived}if(4!==e.readyState)return;if(!network_classPrivateFieldGet(Ys,this).has(e))return;network_classPrivateFieldGet(Ys,this).delete(e);if(0===e.status&&this.isHttp){i.onError(e.status);return}const a=e.status||200;if(!i.validateStatus(a)){i.onError(e.status);return}const s=function network_getArrayBuffer(e){return"string"!=typeof e?e:stringToBytes(e).buffer}(e.response);if(206===a){const t=e.getResponseHeader("Content-Range");if(/bytes (\d+)-(\d+)\/(\d+)/.test(t))i.onDone(s);else{warn('Missing or invalid "Content-Range" header.');i.onError(0)}}else s?i.onDone(s):i.onError(e.status)}var Js=new WeakMap,Qs=new WeakSet;class PDFNetworkStreamReader extends BasePDFStreamReader{constructor(e){super(e);network_classPrivateMethodInitSpec(this,Qs);network_classPrivateFieldInitSpec(this,Js,endRequests.bind(this));network_defineProperty(this,"_cachedChunks",[]);network_defineProperty(this,"_done",!1);network_defineProperty(this,"_requests",[]);network_defineProperty(this,"_storedError",null);this._fullRequestXhr=e._request({onHeadersReceived:network_assertClassBrand(Qs,this,_onHeadersReceived).bind(this),onDone:network_assertClassBrand(Qs,this,_onDone).bind(this),onError:network_assertClassBrand(Qs,this,_onError).bind(this),onProgress:network_assertClassBrand(Qs,this,_onProgress2).bind(this)})}async read(){await this._headersCapability.promise;if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0){return{value:this._cachedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();this._requests.push(e);return e.promise}cancel(e){this._done=!0;this._headersCapability.reject(e);network_classPrivateFieldGet(Js,this).call(this);this._stream._abortRequest(this._fullRequestXhr);this._fullRequestXhr=null}}function _onHeadersReceived(){const e=this._stream,{disableRange:t,rangeChunkSize:i}=e._source,a=this._fullRequestXhr;e._responseOrigin=getResponseOrigin(a.responseURL);const s=a.getAllResponseHeaders(),n=new Headers(s?s.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(e=>{const[t,...i]=e.split(": ");return[t,i.join(": ")]}):[]),{contentLength:r,isRangeSupported:o}=validateRangeRequestCapabilities({responseHeaders:n,isHttp:e.isHttp,rangeChunkSize:i,disableRange:t});this._contentLength=r;this._isRangeSupported=o;this._filename=extractFilenameFromHeader(n);this._isRangeSupported&&e._abortRequest(a);this._headersCapability.resolve()}function _onDone(e){if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._cachedChunks.push(e);this._done=!0;0===this._cachedChunks.length&&network_classPrivateFieldGet(Js,this).call(this)}function _onError(e){this._storedError=createResponseError(e,this._stream.url);this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0;this._cachedChunks.length=0}function _onProgress2(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}var en=new WeakMap,tn=new WeakSet;class PDFNetworkStreamRangeReader extends BasePDFStreamRangeReader{constructor(e,t,i){super(e,t,i);network_classPrivateMethodInitSpec(this,tn);network_classPrivateFieldInitSpec(this,en,endRequests.bind(this));network_defineProperty(this,"onClosed",null);network_defineProperty(this,"_done",!1);network_defineProperty(this,"_queuedChunk",null);network_defineProperty(this,"_requests",[]);network_defineProperty(this,"_storedError",null);this._requestXhr=e._request({begin:t,end:i,onHeadersReceived:network_assertClassBrand(tn,this,_onHeadersReceived2).bind(this),onDone:network_assertClassBrand(tn,this,_onDone2).bind(this),onError:network_assertClassBrand(tn,this,_onError2).bind(this),onProgress:null})}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const e=this._queuedChunk;this._queuedChunk=null;return{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();this._requests.push(e);return e.promise}cancel(e){this._done=!0;network_classPrivateFieldGet(en,this).call(this);this._stream._abortRequest(this._requestXhr);this.onClosed?.()}}function _onHeadersReceived2(){const e=getResponseOrigin(this._requestXhr?.responseURL);try{ensureResponseOrigin(e,this._stream._responseOrigin)}catch(e){this._storedError=e;network_assertClassBrand(tn,this,_onError2).call(this,0)}}function _onDone2(e){if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunk=e;this._done=!0;network_classPrivateFieldGet(en,this).call(this);this.onClosed?.()}function _onError2(e){this._storedError??=createResponseError(e,this._stream.url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0;this._queuedChunk=null}function node_stream_defineProperty(e,t,i){return(t=function node_stream_toPropertyKey(e){var t=function node_stream_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function getReadableStream(e){const{Readable:t}=process.getBuiltinModule("stream");if("function"==typeof t.toWeb)return t.toWeb(e);return process.getBuiltinModule("module").createRequire(import.meta.url)("node-readable-to-web-readable-stream").makeDefaultReadableStreamFromNodeReadable(e)}class PDFNodeStream extends BasePDFStream{constructor(e){super(e,PDFNodeStreamReader,PDFNodeStreamRangeReader);const{url:t}=e;assert("file:"===t.protocol,"PDFNodeStream only supports file:// URLs.")}}class PDFNodeStreamReader extends BasePDFStreamReader{constructor(e){super(e);node_stream_defineProperty(this,"_reader",null);const{disableRange:t,disableStream:i,rangeChunkSize:a,url:s}=e._source;this._isStreamingSupported=!i;const n=process.getBuiltinModule("fs");n.promises.lstat(s).then(e=>{const i=getReadableStream(n.createReadStream(s));this._reader=i.getReader();const{size:r}=e;this._contentLength=r;this._isRangeSupported=!t&&r>2*a;!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new AbortException("Streaming is disabled."));this._headersCapability.resolve()}).catch(e=>{"ENOENT"===e.code&&(e=createResponseError(0,s));this._headersCapability.reject(e)})}async read(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();if(t)return{value:e,done:t};this._loaded+=e.byteLength;this._callOnProgress();return{value:getArrayBuffer(e),done:!1}}cancel(e){this._reader?.cancel(e)}}class PDFNodeStreamRangeReader extends BasePDFStreamRangeReader{constructor(e,t,i){super(e,t,i);node_stream_defineProperty(this,"_readCapability",Promise.withResolvers());node_stream_defineProperty(this,"_reader",null);const{url:a}=e._source,s=process.getBuiltinModule("fs");try{const e=getReadableStream(s.createReadStream(a,{start:t,end:i-1}));this._reader=e.getReader();this._readCapability.resolve()}catch(e){this._readCapability.reject(e)}}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:{value:getArrayBuffer(e),done:!1}}cancel(e){this._reader?.cancel(e)}}function worker_options_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}class GlobalWorkerOptions{static get workerPort(){return worker_options_assertClassBrand(GlobalWorkerOptions,this,an)._}static set workerPort(e){if(!("undefined"!=typeof Worker&&e instanceof Worker)&&null!==e)throw new Error("Invalid `workerPort` type.");an._=worker_options_assertClassBrand(GlobalWorkerOptions,this,e)}static get workerSrc(){return worker_options_assertClassBrand(GlobalWorkerOptions,this,sn)._}static set workerSrc(e){if("string"!=typeof e)throw new Error("Invalid `workerSrc` type.");sn._=worker_options_assertClassBrand(GlobalWorkerOptions,this,e)}}var an={_:null},sn={_:""};function metadata_classPrivateFieldInitSpec(e,t,i){(function metadata_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function metadata_classPrivateFieldGet(e,t){return e.get(metadata_assertClassBrand(e,t))}function metadata_classPrivateFieldSet(e,t,i){return e.set(metadata_assertClassBrand(e,t),i),i}function metadata_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var nn=new WeakMap,rn=new WeakMap;class Metadata{constructor(e){let{parsedData:t,rawData:i}=e;metadata_classPrivateFieldInitSpec(this,nn,void 0);metadata_classPrivateFieldInitSpec(this,rn,void 0);metadata_classPrivateFieldSet(nn,this,t);metadata_classPrivateFieldSet(rn,this,i)}getRaw(){return metadata_classPrivateFieldGet(rn,this)}get(e){return metadata_classPrivateFieldGet(nn,this).get(e)??null}[Symbol.iterator](){return metadata_classPrivateFieldGet(nn,this).entries()}}function optional_content_config_classPrivateFieldInitSpec(e,t,i){optional_content_config_checkPrivateRedeclaration(e,t),t.set(e,i)}function optional_content_config_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function optional_content_config_classPrivateFieldGet(e,t){return e.get(optional_content_config_assertClassBrand(e,t))}function optional_content_config_classPrivateFieldSet(e,t,i){return e.set(optional_content_config_assertClassBrand(e,t),i),i}function optional_content_config_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const on=Symbol("INTERNAL");var ln=new WeakMap,dn=new WeakMap,cn=new WeakMap,hn=new WeakMap;class OptionalContentGroup{constructor(e,t){let{name:i,intent:a,usage:s,rbGroups:n}=t;optional_content_config_classPrivateFieldInitSpec(this,ln,!1);optional_content_config_classPrivateFieldInitSpec(this,dn,!1);optional_content_config_classPrivateFieldInitSpec(this,cn,!1);optional_content_config_classPrivateFieldInitSpec(this,hn,!0);optional_content_config_classPrivateFieldSet(ln,this,!!(e&o));optional_content_config_classPrivateFieldSet(dn,this,!!(e&l));this.name=i;this.intent=a;this.usage=s;this.rbGroups=n}get visible(){if(optional_content_config_classPrivateFieldGet(cn,this))return optional_content_config_classPrivateFieldGet(hn,this);if(!optional_content_config_classPrivateFieldGet(hn,this))return!1;const{print:e,view:t}=this.usage;return optional_content_config_classPrivateFieldGet(ln,this)?"OFF"!==t?.viewState:!optional_content_config_classPrivateFieldGet(dn,this)||"OFF"!==e?.printState}_setVisible(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e!==on&&unreachable("Internal method `_setVisible` called.");optional_content_config_classPrivateFieldSet(cn,this,i);optional_content_config_classPrivateFieldSet(hn,this,t)}}var un=new WeakMap,_n=new WeakMap,pn=new WeakMap,gn=new WeakMap,fn=new WeakSet;class OptionalContentConfig{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;!function optional_content_config_classPrivateMethodInitSpec(e,t){optional_content_config_checkPrivateRedeclaration(e,t),t.add(e)}(this,fn);optional_content_config_classPrivateFieldInitSpec(this,un,null);optional_content_config_classPrivateFieldInitSpec(this,_n,new Map);optional_content_config_classPrivateFieldInitSpec(this,pn,null);optional_content_config_classPrivateFieldInitSpec(this,gn,null);this.renderingIntent=t;this.name=null;this.creator=null;if(null!==e){this.name=e.name;this.creator=e.creator;optional_content_config_classPrivateFieldSet(gn,this,e.order);for(const i of e.groups)optional_content_config_classPrivateFieldGet(_n,this).set(i.id,new OptionalContentGroup(t,i));if("OFF"===e.baseState)for(const e of optional_content_config_classPrivateFieldGet(_n,this).values())e._setVisible(on,!1);for(const t of e.on)optional_content_config_classPrivateFieldGet(_n,this).get(t)._setVisible(on,!0);for(const t of e.off)optional_content_config_classPrivateFieldGet(_n,this).get(t)._setVisible(on,!1);optional_content_config_classPrivateFieldSet(pn,this,this.getHash())}}isVisible(e){if(0===optional_content_config_classPrivateFieldGet(_n,this).size)return!0;if(!e){info("Optional content group not defined.");return!0}if("OCG"===e.type){if(!optional_content_config_classPrivateFieldGet(_n,this).has(e.id)){warn(`Optional content group not found: ${e.id}`);return!0}return optional_content_config_classPrivateFieldGet(_n,this).get(e.id).visible}if("OCMD"===e.type){if(e.expression)return optional_content_config_assertClassBrand(fn,this,_evaluateVisibilityExpression).call(this,e.expression);if(!e.policy||"AnyOn"===e.policy){for(const t of e.ids){if(!optional_content_config_classPrivateFieldGet(_n,this).has(t)){warn(`Optional content group not found: ${t}`);return!0}if(optional_content_config_classPrivateFieldGet(_n,this).get(t).visible)return!0}return!1}if("AllOn"===e.policy){for(const t of e.ids){if(!optional_content_config_classPrivateFieldGet(_n,this).has(t)){warn(`Optional content group not found: ${t}`);return!0}if(!optional_content_config_classPrivateFieldGet(_n,this).get(t).visible)return!1}return!0}if("AnyOff"===e.policy){for(const t of e.ids){if(!optional_content_config_classPrivateFieldGet(_n,this).has(t)){warn(`Optional content group not found: ${t}`);return!0}if(!optional_content_config_classPrivateFieldGet(_n,this).get(t).visible)return!0}return!1}if("AllOff"===e.policy){for(const t of e.ids){if(!optional_content_config_classPrivateFieldGet(_n,this).has(t)){warn(`Optional content group not found: ${t}`);return!0}if(optional_content_config_classPrivateFieldGet(_n,this).get(t).visible)return!1}return!0}warn(`Unknown optional content policy ${e.policy}.`);return!0}warn(`Unknown group type ${e.type}.`);return!0}setVisibility(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const a=optional_content_config_classPrivateFieldGet(_n,this).get(e);if(a){if(i&&t&&a.rbGroups.length)for(const t of a.rbGroups)for(const i of t)i!==e&&optional_content_config_classPrivateFieldGet(_n,this).get(i)?._setVisible(on,!1,!0);a._setVisible(on,!!t,!0);optional_content_config_classPrivateFieldSet(un,this,null)}else warn(`Optional content group not found: ${e}`)}setOCGState(e){let t,{state:i,preserveRB:a}=e;for(const e of i){switch(e){case"ON":case"OFF":case"Toggle":t=e;continue}const i=optional_content_config_classPrivateFieldGet(_n,this).get(e);if(i)switch(t){case"ON":this.setVisibility(e,!0,a);break;case"OFF":this.setVisibility(e,!1,a);break;case"Toggle":this.setVisibility(e,!i.visible,a)}}optional_content_config_classPrivateFieldSet(un,this,null)}get hasInitialVisibility(){return null===optional_content_config_classPrivateFieldGet(pn,this)||this.getHash()===optional_content_config_classPrivateFieldGet(pn,this)}getOrder(){return optional_content_config_classPrivateFieldGet(_n,this).size?optional_content_config_classPrivateFieldGet(gn,this)?optional_content_config_classPrivateFieldGet(gn,this).slice():[...optional_content_config_classPrivateFieldGet(_n,this).keys()]:null}getGroup(e){return optional_content_config_classPrivateFieldGet(_n,this).get(e)||null}getHash(){if(null!==optional_content_config_classPrivateFieldGet(un,this))return optional_content_config_classPrivateFieldGet(un,this);const e=new MurmurHash3_64;for(const[t,i]of optional_content_config_classPrivateFieldGet(_n,this))e.update(`${t}:${i.visible}`);return optional_content_config_classPrivateFieldSet(un,this,e.hexdigest())}[Symbol.iterator](){return optional_content_config_classPrivateFieldGet(_n,this).entries()}}function _evaluateVisibilityExpression(e){const t=e.length;if(t<2)return!0;const i=e[0];for(let a=1;a<t;a++){const t=e[a];let s;if(Array.isArray(t))s=optional_content_config_assertClassBrand(fn,this,_evaluateVisibilityExpression).call(this,t);else{if(!optional_content_config_classPrivateFieldGet(_n,this).has(t)){warn(`Optional content group not found: ${t}`);return!0}s=optional_content_config_classPrivateFieldGet(_n,this).get(t).visible}switch(i){case"And":if(!s)return!1;break;case"Or":if(s)return!0;break;case"Not":return!s;default:return!0}}return"And"===i}function pages_mapper_classPrivateFieldInitSpec(e,t,i){pages_mapper_checkPrivateRedeclaration(e,t),t.set(e,i)}function pages_mapper_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pages_mapper_classPrivateFieldSet(e,t,i){return e.set(pages_mapper_assertClassBrand(e,t),i),i}function pages_mapper_classPrivateFieldGet(e,t){return e.get(pages_mapper_assertClassBrand(e,t))}function pages_mapper_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var mn=new WeakMap,vn=new WeakMap,Pn=new WeakMap,wn=new WeakMap,Fn=new WeakMap,bn=new WeakSet;class PagesMapper{constructor(){!function pages_mapper_classPrivateMethodInitSpec(e,t){pages_mapper_checkPrivateRedeclaration(e,t),t.add(e)}(this,bn);pages_mapper_classPrivateFieldInitSpec(this,mn,null);pages_mapper_classPrivateFieldInitSpec(this,vn,null);pages_mapper_classPrivateFieldInitSpec(this,Pn,0);pages_mapper_classPrivateFieldInitSpec(this,wn,null);pages_mapper_classPrivateFieldInitSpec(this,Fn,null)}get pagesNumber(){return pages_mapper_classPrivateFieldGet(Pn,this)}set pagesNumber(e){if(pages_mapper_classPrivateFieldGet(Pn,this)!==e){pages_mapper_classPrivateFieldSet(Pn,this,e);pages_mapper_classPrivateFieldSet(mn,this,null);pages_mapper_classPrivateFieldSet(vn,this,null)}}movePages(e,t,i){pages_mapper_assertClassBrand(bn,this,_ensureInit).call(this);const a=pages_mapper_classPrivateFieldGet(mn,this),s=pages_mapper_assertClassBrand(bn,this,_buildIdToPageNumber).call(this),n=t.length,r=new Uint32Array(n);let o=0;for(let e=0;e<n;e++){const s=t[e]-1;r[e]=a[s];s<i&&o++}const l=pages_mapper_classPrivateFieldGet(Pn,this),d=l-n,c=MathClamp(i-o,0,d);for(let t=0,i=0;t<l;t++)e.has(t+1)||(a[i++]=a[t]);a.copyWithin(c+n,c,d);a.set(r,c);pages_mapper_assertClassBrand(bn,this,_updatePrevPageNumbers).call(this,s);a.every((e,t)=>e===t+1)&&pages_mapper_classPrivateFieldSet(mn,this,null)}deletePages(e){pages_mapper_assertClassBrand(bn,this,_ensureInit).call(this);const t=pages_mapper_classPrivateFieldGet(mn,this),i=pages_mapper_assertClassBrand(bn,this,_buildIdToPageNumber).call(this);pages_mapper_classPrivateFieldSet(Fn,this,{pageNumberToId:t.slice(),pagesNumber:pages_mapper_classPrivateFieldGet(Pn,this),prevPageNumbers:pages_mapper_classPrivateFieldGet(vn,this).slice()});const a=pages_mapper_classPrivateFieldGet(Pn,this)-e.length;pages_mapper_classPrivateFieldSet(Pn,this,a);const s=pages_mapper_classPrivateFieldSet(mn,this,new Uint32Array(a));pages_mapper_classPrivateFieldSet(vn,this,new Int32Array(a));let n=0,r=0;for(const i of e){const e=i-1;if(e!==n){s.set(t.subarray(n,e),r);r+=e-n}n=e+1}n<t.length&&s.set(t.subarray(n),r);pages_mapper_assertClassBrand(bn,this,_updatePrevPageNumbers).call(this,i,new Set(e))}cancelDelete(){if(pages_mapper_classPrivateFieldGet(Fn,this)){pages_mapper_classPrivateFieldSet(mn,this,pages_mapper_classPrivateFieldGet(Fn,this).pageNumberToId);pages_mapper_classPrivateFieldSet(Pn,this,pages_mapper_classPrivateFieldGet(Fn,this).pagesNumber);pages_mapper_classPrivateFieldSet(vn,this,pages_mapper_classPrivateFieldGet(Fn,this).prevPageNumbers);pages_mapper_classPrivateFieldSet(Fn,this,null)}}cleanSavedData(){pages_mapper_classPrivateFieldSet(Fn,this,null)}copyPages(e){pages_mapper_assertClassBrand(bn,this,_ensureInit).call(this);pages_mapper_classPrivateFieldSet(wn,this,{pageNumbers:e,pageIds:e.map(e=>pages_mapper_classPrivateFieldGet(mn,this)[e-1])})}cancelCopy(){pages_mapper_classPrivateFieldSet(wn,this,null)}pastePages(e){pages_mapper_assertClassBrand(bn,this,_ensureInit).call(this);const t=pages_mapper_classPrivateFieldGet(mn,this),i=pages_mapper_assertClassBrand(bn,this,_buildIdToPageNumber).call(this),{pageNumbers:a,pageIds:s}=pages_mapper_classPrivateFieldGet(wn,this),n=pages_mapper_classPrivateFieldGet(Pn,this)+a.length;pages_mapper_classPrivateFieldSet(Pn,this,n);const r=pages_mapper_classPrivateFieldSet(mn,this,new Uint32Array(n));pages_mapper_classPrivateFieldSet(vn,this,new Int32Array(n));r.set(t.subarray(0,e),0);r.set(s,e);r.set(t.subarray(e),e+a.length);pages_mapper_assertClassBrand(bn,this,_updatePrevPageNumbers).call(this,i,null,e,a);pages_mapper_classPrivateFieldSet(wn,this,null)}hasBeenAltered(){return null!==pages_mapper_classPrivateFieldGet(mn,this)}getPageMappingForSaving(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;e??=pages_mapper_assertClassBrand(bn,this,_buildIdToPageNumber).call(this);let t=0;for(const i of e.values())t=Math.max(t,i.length);const i=new Array(t);for(let e=0;e<t;e++)i[e]={document:null,pageIndices:[],includePages:[]};for(const[t,a]of e)for(let e=0,s=a.length;e<s;e++)i[e].includePages.push([t-1,a[e]-1]);for(const{includePages:e,pageIndices:t}of i){e.sort((e,t)=>e[0]-t[0]);for(let i=0,a=e.length;i<a;i++){t.push(e[i][1]);e[i]=e[i][0]}}return i}extractPages(e){e=Array.from(e).sort((e,t)=>e-t);const t=new Map;for(let i=0,a=e.length;i<a;i++){const a=this.getPageId(e[i]);t.getOrInsertComputed(a,makeArr).push(i+1)}return this.getPageMappingForSaving(t)}getPrevPageNumber(e){return pages_mapper_classPrivateFieldGet(vn,this)?.[e-1]??0}getPageNumber(e){if(!pages_mapper_classPrivateFieldGet(mn,this))return e;const t=pages_mapper_classPrivateFieldGet(mn,this);for(let i=0,a=pages_mapper_classPrivateFieldGet(Pn,this);i<a;i++)if(t[i]===e)return i+1;return 0}getPageId(e){return pages_mapper_classPrivateFieldGet(mn,this)?.[e-1]??e}getMapping(){return pages_mapper_classPrivateFieldGet(mn,this)?.subarray(0,this.pagesNumber)}}function _ensureInit(){if(pages_mapper_classPrivateFieldGet(mn,this))return;const e=pages_mapper_classPrivateFieldGet(Pn,this),t=pages_mapper_classPrivateFieldSet(mn,this,new Uint32Array(e));for(let i=0;i<e;i++)t[i]=i+1;pages_mapper_classPrivateFieldSet(vn,this,new Int32Array(t))}function _buildIdToPageNumber(){const e=new Map,t=pages_mapper_classPrivateFieldGet(mn,this);for(let i=0,a=pages_mapper_classPrivateFieldGet(Pn,this);i<a;i++){const a=t[i],s=e.get(a);s?s.push(i+1):e.set(a,[i+1])}return e}function _updatePrevPageNumbers(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const s=pages_mapper_classPrivateFieldGet(vn,this),n=pages_mapper_classPrivateFieldGet(mn,this),r=i+(a?.length??0),o=new Map;for(let l=0,d=pages_mapper_classPrivateFieldGet(Pn,this);l<d;l++){if(l>=i&&l<r){s[l]=-a[l-i];continue}const d=n[l],c=e.get(d);let h=o.get(d)||0;if(t&&c)for(;h<c.length&&t.has(c[h]);)h++;s[l]=c?.[h];o.set(d,h+1)}}function pdf_objects_classPrivateFieldInitSpec(e,t,i){(function pdf_objects_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function pdf_objects_classPrivateFieldGet(e,t){return e.get(function pdf_objects_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}(e,t))}const yn=Symbol("INITIAL_DATA"),dataObj=()=>({...Promise.withResolvers(),data:yn});var Sn,Cn=new WeakMap;class PDFObjects{constructor(){pdf_objects_classPrivateFieldInitSpec(this,Cn,new Map)}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t){const i=pdf_objects_classPrivateFieldGet(Cn,this).getOrInsertComputed(e,dataObj);i.promise.then(()=>t(i.data));return null}const i=pdf_objects_classPrivateFieldGet(Cn,this).get(e);if(!i||i.data===yn)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return i.data}has(e){const t=pdf_objects_classPrivateFieldGet(Cn,this).get(e);return!!t&&t.data!==yn}delete(e){const t=pdf_objects_classPrivateFieldGet(Cn,this).get(e);if(!t||t.data===yn)return!1;pdf_objects_classPrivateFieldGet(Cn,this).delete(e);return!0}resolve(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=pdf_objects_classPrivateFieldGet(Cn,this).getOrInsertComputed(e,dataObj);if(i.data!==yn)throw new Error(`Object already resolved ${e}.`);i.data=t;i.resolve()}clear(){for(const{data:e}of pdf_objects_classPrivateFieldGet(Cn,this).values())e?.bitmap?.close();pdf_objects_classPrivateFieldGet(Cn,this).clear()}*[Symbol.iterator](){for(const[e,{data:t}]of pdf_objects_classPrivateFieldGet(Cn,this))t!==yn&&(yield[e,t])}}function text_layer_classPrivateFieldInitSpec(e,t,i){text_layer_checkPrivateRedeclaration(e,t),t.set(e,i)}function text_layer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function text_layer_classPrivateFieldGet(e,t){return e.get(text_layer_assertClassBrand(e,t))}function text_layer_classPrivateFieldSet(e,t,i){return e.set(text_layer_assertClassBrand(e,t),i),i}function text_layer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var xn=new WeakMap,kn=new WeakMap,En=new WeakMap,An=new WeakMap,Gn=new WeakMap,Bn=new WeakMap,Mn=new WeakMap,In=new WeakMap,Tn=new WeakMap,Dn=new WeakMap,Ln=new WeakMap,Rn=new WeakMap,Nn=new WeakMap,On=new WeakMap,Wn=new WeakMap,jn=new WeakMap,Vn=new WeakMap,Un=new WeakMap,zn=new WeakMap,Hn=new WeakSet;class TextLayer{constructor(e){let{textContentSource:t,images:i,container:a,viewport:s}=e;!function text_layer_classPrivateMethodInitSpec(e,t){text_layer_checkPrivateRedeclaration(e,t),t.add(e)}(this,Hn);text_layer_classPrivateFieldInitSpec(this,xn,Promise.withResolvers());text_layer_classPrivateFieldInitSpec(this,kn,null);text_layer_classPrivateFieldInitSpec(this,En,!1);text_layer_classPrivateFieldInitSpec(this,An,!!globalThis.FontInspector?.enabled);text_layer_classPrivateFieldInitSpec(this,Gn,null);text_layer_classPrivateFieldInitSpec(this,Bn,null);text_layer_classPrivateFieldInitSpec(this,Mn,null);text_layer_classPrivateFieldInitSpec(this,In,0);text_layer_classPrivateFieldInitSpec(this,Tn,0);text_layer_classPrivateFieldInitSpec(this,Dn,null);text_layer_classPrivateFieldInitSpec(this,Ln,null);text_layer_classPrivateFieldInitSpec(this,Rn,0);text_layer_classPrivateFieldInitSpec(this,Nn,0);text_layer_classPrivateFieldInitSpec(this,On,Object.create(null));text_layer_classPrivateFieldInitSpec(this,Wn,[]);text_layer_classPrivateFieldInitSpec(this,jn,null);text_layer_classPrivateFieldInitSpec(this,Vn,[]);text_layer_classPrivateFieldInitSpec(this,Un,new WeakMap);text_layer_classPrivateFieldInitSpec(this,zn,null);if(t instanceof ReadableStream)text_layer_classPrivateFieldSet(jn,this,t);else{if("object"!=typeof t)throw new Error('No "textContentSource" parameter specified.');text_layer_classPrivateFieldSet(jn,this,new ReadableStream({start(e){e.enqueue(t);e.close()}}))}text_layer_classPrivateFieldSet(kn,this,text_layer_classPrivateFieldSet(Ln,this,a));text_layer_classPrivateFieldSet(Gn,this,i);text_layer_classPrivateFieldSet(Nn,this,s.scale*OutputScale.pixelRatio);text_layer_classPrivateFieldSet(Rn,this,s.rotation);text_layer_classPrivateFieldSet(Mn,this,{div:null,properties:null,ctx:null});const{pageWidth:n,pageHeight:r,pageX:o,pageY:l}=s.rawDims;text_layer_classPrivateFieldSet(zn,this,[1,0,0,-1,-o,l+r]);text_layer_classPrivateFieldSet(Tn,this,n);text_layer_classPrivateFieldSet(In,this,r);_ensureMinFontSizeComputed.call(TextLayer);a.style.setProperty("--min-font-size",Yn._);setLayerDimensions(a,s);text_layer_classPrivateFieldGet(xn,this).promise.finally(()=>{Zn._.delete(this);text_layer_classPrivateFieldSet(Mn,this,null);text_layer_classPrivateFieldSet(On,this,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=FeatureTest.platform;return shadow(this,"fontFamilyMap",new Map([["sans-serif",(e&&t?"Calibri, ":"")+"sans-serif"],["monospace",(e&&t?"Lucida Console, ":"")+"monospace"]]))}render(){text_layer_classPrivateFieldGet(Gn,this)&&text_layer_classPrivateFieldGet(kn,this).append(text_layer_classPrivateFieldGet(Gn,this).render());const pump=()=>{text_layer_classPrivateFieldGet(Dn,this).read().then(e=>{let{value:t,done:i}=e;if(i)text_layer_classPrivateFieldGet(xn,this).resolve();else{text_layer_classPrivateFieldGet(Bn,this)??text_layer_classPrivateFieldSet(Bn,this,t.lang);Object.assign(text_layer_classPrivateFieldGet(On,this),t.styles);text_layer_assertClassBrand(Hn,this,_processItems).call(this,t.items);pump()}},text_layer_classPrivateFieldGet(xn,this).reject)};text_layer_classPrivateFieldSet(Dn,this,text_layer_classPrivateFieldGet(jn,this).getReader());Zn._.add(this);pump();return text_layer_classPrivateFieldGet(xn,this).promise}update(e){let{viewport:t,onBefore:i=null}=e;const a=t.scale*OutputScale.pixelRatio,s=t.rotation;if(s!==text_layer_classPrivateFieldGet(Rn,this)){i?.();text_layer_classPrivateFieldSet(Rn,this,s);setLayerDimensions(text_layer_classPrivateFieldGet(Ln,this),{rotation:s})}if(a!==text_layer_classPrivateFieldGet(Nn,this)){i?.();text_layer_classPrivateFieldSet(Nn,this,a);const e={div:null,properties:null,ctx:_getCtx.call(TextLayer,text_layer_classPrivateFieldGet(Bn,this))};for(const t of text_layer_classPrivateFieldGet(Vn,this)){e.properties=text_layer_classPrivateFieldGet(Un,this).get(t);e.div=t;text_layer_assertClassBrand(Hn,this,_layout).call(this,e)}}}cancel(){const e=new AbortException("TextLayer task cancelled.");text_layer_classPrivateFieldGet(Dn,this)?.cancel(e).catch(()=>{});text_layer_classPrivateFieldSet(Dn,this,null);text_layer_classPrivateFieldGet(xn,this).reject(e)}get textDivs(){return text_layer_classPrivateFieldGet(Vn,this)}get textContentItemsStr(){return text_layer_classPrivateFieldGet(Wn,this)}static cleanup(){if(!(text_layer_assertClassBrand(TextLayer,this,Zn)._.size>0)){text_layer_assertClassBrand(TextLayer,this,qn)._.clear();for(const{canvas:e}of text_layer_assertClassBrand(TextLayer,this,Xn)._.values())e.remove();text_layer_assertClassBrand(TextLayer,this,Xn)._.clear()}}}Sn=TextLayer;function _processItems(e){if(text_layer_classPrivateFieldGet(En,this))return;text_layer_classPrivateFieldGet(Mn,this).ctx??=_getCtx.call(Sn,text_layer_classPrivateFieldGet(Bn,this));const t=text_layer_classPrivateFieldGet(Vn,this),i=text_layer_classPrivateFieldGet(Wn,this);for(const a of e){if(t.length>1e5){warn("Ignoring additional textDivs for performance reasons.");text_layer_classPrivateFieldSet(En,this,!0);return}if(void 0!==a.str){i.push(a.str);text_layer_assertClassBrand(Hn,this,_appendText).call(this,a)}else if("beginMarkedContentProps"===a.type||"beginMarkedContent"===a.type){const e=text_layer_classPrivateFieldGet(kn,this);text_layer_classPrivateFieldSet(kn,this,document.createElement("span"));text_layer_classPrivateFieldGet(kn,this).classList.add("markedContent");a.id&&text_layer_classPrivateFieldGet(kn,this).setAttribute("id",`${a.id}`);"Artifact"===a.tag&&(text_layer_classPrivateFieldGet(kn,this).ariaHidden=!0);e.append(text_layer_classPrivateFieldGet(kn,this))}else"endMarkedContent"===a.type&&text_layer_classPrivateFieldSet(kn,this,text_layer_classPrivateFieldGet(kn,this).parentNode)}}function _appendText(e){const t=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:""!==e.str,hasEOL:e.hasEOL,fontSize:0};text_layer_classPrivateFieldGet(Vn,this).push(t);const a=Util.transform(text_layer_classPrivateFieldGet(zn,this),e.transform);let s=Math.atan2(a[1],a[0]);const n=text_layer_classPrivateFieldGet(On,this)[e.fontName];n.vertical&&(s+=Math.PI/2);let r=text_layer_classPrivateFieldGet(An,this)&&n.fontSubstitution||n.fontFamily;r=Sn.fontFamilyMap.get(r)||r;const o=Math.hypot(a[2],a[3]),l=o*_getAscent.call(Sn,r,n,text_layer_classPrivateFieldGet(Bn,this));let d,c;if(0===s){d=a[4];c=a[5]-l}else{d=a[4]+l*Math.sin(s);c=a[5]-l*Math.cos(s)}const h=t.style;h.left=`${(100*d/text_layer_classPrivateFieldGet(Tn,this)).toFixed(2)}%`;h.top=`${(100*c/text_layer_classPrivateFieldGet(In,this)).toFixed(2)}%`;h.setProperty("--font-height",`${o.toFixed(2)}px`);h.fontFamily=r;i.fontSize=o;t.setAttribute("role","presentation");t.textContent=e.str;t.dir=e.dir;text_layer_classPrivateFieldGet(An,this)&&(t.dataset.fontName=n.fontSubstitutionLoadedName||e.fontName);0!==s&&(i.angle=s*(180/Math.PI));let u=!1;if(e.str.length>1)u=!0;else if(" "!==e.str&&e.transform[0]!==e.transform[3]){const t=Math.abs(e.transform[0]),i=Math.abs(e.transform[3]);t!==i&&Math.max(t,i)/Math.min(t,i)>1.5&&(u=!0)}u&&(i.canvasWidth=n.vertical?e.height:e.width);text_layer_classPrivateFieldGet(Un,this).set(t,i);text_layer_classPrivateFieldGet(Mn,this).div=t;text_layer_classPrivateFieldGet(Mn,this).properties=i;text_layer_assertClassBrand(Hn,this,_layout).call(this,text_layer_classPrivateFieldGet(Mn,this));i.hasText&&text_layer_classPrivateFieldGet(kn,this).append(t);if(i.hasEOL){const e=document.createElement("br");e.setAttribute("role","presentation");text_layer_classPrivateFieldGet(kn,this).append(e)}}function _layout(e){const{div:t,properties:i,ctx:a}=e,{style:s}=t;if(0!==i.canvasWidth&&i.hasText){const{fontFamily:e}=s,{canvasWidth:n,fontSize:r}=i;_ensureCtxFont.call(Sn,a,r*text_layer_classPrivateFieldGet(Nn,this),e);try{const{width:e}=a.measureText(t.textContent);e>0&&(transform=`scaleX(${n*text_layer_classPrivateFieldGet(Nn,this)/e}) ${transform}`)}catch(e){}const{width:o}=a.measureText(t.textContent);o>0&&s.setProperty("--scale-x",n*text_layer_classPrivateFieldGet(Nn,this)/o)}0!==i.angle&&s.setProperty("--rotate",`${i.angle}deg`)}function _getCtx(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=text_layer_assertClassBrand(Sn,this,Xn)._.get(e||="");if(!t){const i=document.createElement("canvas");i.className="hiddenCanvasElement";i.lang=e;i.width=i.height=0;document.body.append(i);t=i.getContext("2d",{alpha:!1,willReadFrequently:!0});text_layer_assertClassBrand(Sn,this,Xn)._.set(e,t);text_layer_assertClassBrand(Sn,this,Kn)._.set(t,{size:0,family:""})}return t}function _ensureCtxFont(e,t,i){const a=text_layer_assertClassBrand(Sn,this,Kn)._.get(e);if(t!==a.size||i!==a.family){e.font=`${t}px ${i}`;a.size=t;a.family=i}}function _ensureMinFontSizeComputed(){if(null!==text_layer_assertClassBrand(Sn,this,Yn)._)return;const e=document.createElement("div");e.style.opacity=0;e.style.lineHeight=1;e.style.fontSize="1px";e.style.position="absolute";e.textContent="X";document.body.append(e);Yn._=text_layer_assertClassBrand(Sn,this,e.getBoundingClientRect().height);e.remove()}function _getAscent(e,t,i){const a=text_layer_assertClassBrand(Sn,this,qn)._.get(e);if(a)return a;const s=text_layer_assertClassBrand(Sn,this,_getCtx).call(this,i);s.canvas.width=s.canvas.height=30;text_layer_assertClassBrand(Sn,this,_ensureCtxFont).call(this,s,30,e);const n=s.measureText(""),r=n?.fontBoundingBoxAscent,o=Math.abs(n?.fontBoundingBoxDescent);s.canvas.width=s.canvas.height=0;let l=.8;if(r)l=r/(r+o);else{FeatureTest.platform.isFirefox&&warn("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering.");t.ascent?l=t.ascent:t.descent&&(l=1+t.descent)}text_layer_assertClassBrand(Sn,this,qn)._.set(e,l);return l}var $n,qn={_:new Map},Xn={_:new Map},Kn={_:new WeakMap},Yn={_:null},Zn={_:new Set};function app_options_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}{var Jn=new Map;const{maxTouchPoints:e,platform:t,userAgent:i}=navigator,a=/Android/.test(i);(/\b(iPad|iPhone|iPod)(?=;)/.test(i)||"MacIntel"===t&&e>1||a)&&Jn.set("maxCanvasPixels",5242880);a&&Jn.set("useSystemFonts",!1)}const Qn=1,er=2,tr=4,ir=8,ar=16,sr=128,nr={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},rr={defaultCacheSize:{value:50,kind:er},passwordPrompt:{value:null,kind:er},enableDragAndDrop:{value:!0,kind:er},pageViewMode:{value:"multiple",kind:er},findController:{value:null,kind:er},secondaryFindController:{value:null,kind:er},enableOpenActionJavaScript:{value:!1,kind:ir},enableCatalogAAJavaScript:{value:!1,kind:ir},allowedGlobalEvents:{value:null,kind:Qn},canvasMaxAreaInBytes:{value:-1,kind:Qn+tr},isInAutomation:{value:!1,kind:Qn},localeProperties:{value:{lang:navigator.language||"en-US"},kind:Qn},maxCanvasDim:{value:32767,kind:Qn+er},nimbusDataStr:{value:"",kind:Qn},supportsCaretBrowsingMode:{value:!1,kind:Qn},supportsDocumentFonts:{value:!0,kind:Qn},supportsIntegratedFind:{value:!1,kind:Qn},supportsMouseWheelZoomCtrlKey:{value:!0,kind:Qn},supportsMouseWheelZoomMetaKey:{value:!0,kind:Qn},supportsPinchToZoom:{value:!0,kind:Qn},supportsPrinting:{value:!0,kind:Qn},toolbarDensity:{value:0,kind:Qn+ar},altTextLearnMoreUrl:{value:"",kind:er+sr},annotationEditorMode:{value:0,kind:er+sr},annotationMode:{value:2,kind:er+sr},capCanvasAreaFactor:{value:200,kind:er+sr},commentLearnMoreUrl:{value:"",kind:er+sr},cursorToolOnLoad:{value:0,kind:er+sr},debuggerSrc:{value:"./debugger.mjs",kind:er},defaultZoomDelay:{value:400,kind:er+sr},defaultZoomValue:{value:"auto",kind:er+sr},disableHistory:{value:!1,kind:er},disablePageLabels:{value:!1,kind:er+sr},enableAltText:{value:!1,kind:er+sr},enableAltTextModelDownload:{value:!0,kind:er+sr+ar},enableAutoLinking:{value:!0,kind:er+sr},enableComment:{value:!1,kind:er+sr},enableDetailCanvas:{value:!0,kind:er},enableGuessAltText:{value:!0,kind:er+sr+ar},enableHighlightFloatingButton:{value:!1,kind:er+sr},enableNewAltTextWhenAddingImage:{value:!0,kind:er+sr},enableNewBadge:{value:!1,kind:er+sr},enableOptimizedPartialRendering:{value:!1,kind:er+sr},enablePermissions:{value:!1,kind:er+sr},enablePrintAutoRotate:{value:!0,kind:er+sr},enableScripting:{value:!1,kind:er+sr},enableSignatureEditor:{value:!1,kind:er+sr},enablePageReordering:{value:!0,kind:er+sr},enableSplitMerge:{value:!1,kind:er+sr},pdfBackgroundColor:{value:"",kind:er+sr},enableUpdatedAddImage:{value:!1,kind:er+sr},externalLinkRel:{value:"noopener noreferrer nofollow",kind:er},externalLinkTarget:{value:0,kind:er+sr},highlightEditorColors:{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",kind:er+sr},historyUpdateUrl:{value:!1,kind:er+sr},ignoreDestinationZoom:{value:!1,kind:er+sr},imageResourcesPath:{value:"./images/",kind:er},imagesRightClickMinSize:{value:-1,kind:er+sr},maxCanvasPixels:{value:2**25,kind:er},minDurationToUpdateCanvas:{value:500,kind:er},forcePageColors:{value:!1,kind:er+sr},pageColorsBackground:{value:"Canvas",kind:er+sr},pageColorsForeground:{value:"CanvasText",kind:er+sr},pdfBugEnabled:{value:!1,kind:er+sr},printResolution:{value:150,kind:er},removePageBorders:{value:!1,kind:er+sr},sidebarViewOnLoad:{value:-1,kind:er+sr},scrollModeOnLoad:{value:-1,kind:er+sr},readingDirection:{value:"auto",kind:er+sr},spreadModeOnLoad:{value:-1,kind:er+sr},textLayerMode:{value:1,kind:er+sr},viewerCssTheme:{value:0,kind:er+sr},viewOnLoad:{value:0,kind:er+sr},cMapPacked:{value:!0,kind:tr},cMapUrl:{value:"../web/cmaps/",kind:tr},disableAutoFetch:{value:!1,kind:tr+sr},disableFontFace:{value:!1,kind:tr+sr},disableRange:{value:!1,kind:tr+sr},disableStream:{value:!1,kind:tr+sr},docBaseUrl:{value:"",kind:tr},enableHWA:{value:!0,kind:tr+sr},enableWebGPU:{value:!0,kind:tr+sr},enableXfa:{value:!0,kind:tr+sr},fontExtraProperties:{value:!1,kind:tr},iccUrl:{value:"../web/iccs/",kind:tr},isEvalSupported:{value:!0,kind:tr},isOffscreenCanvasSupported:{value:!0,kind:tr},maxZoom:{value:10,kind:er},minZoom:{value:.1,kind:er},maxImageSize:{value:-1,kind:tr},pdfBug:{value:!1,kind:tr},standardFontDataUrl:{value:"../web/standard_fonts/",kind:tr},useSystemFonts:{value:void 0,kind:tr,type:nr.BOOLEAN+nr.UNDEFINED},verbosity:{value:1,kind:tr},wasmUrl:{value:"../web/wasm/",kind:tr},workerPort:{value:null,kind:ir},workerSrc:{value:"./assets/pdf.worker.mjs",kind:ir}};rr.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:er};rr.sandboxBundleSrc={value:"../build/pdf.sandbox.mjs",kind:er};rr.enableFakeMLManager={value:!0,kind:er};rr.disablePreferences={value:!1,kind:er};class AppOptions{static get(e){return app_options_assertClassBrand(AppOptions,this,cr)._.get(e)}static getAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=Object.create(null);for(const a in rr){const s=rr[a];(!e||e&s.kind)&&(i[a]=t?s.value:app_options_assertClassBrand(AppOptions,this,cr)._.get(a))}return i}static set(e,t){this.setAll({[e]:t})}static setAll(e){let t,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._hasInvokedSet||=!0;for(const a in e){if("positionPopupDialogsWithJavaScript"===a)continue;const s=rr[a];let n=e[a];if(!s||!(typeof n==typeof s.value||nr[(typeof n).toUpperCase()]&s.type)){"number"==typeof s?.value&&"string"==typeof n&&(Number.isNaN(Number(n))||(n=Number(n)));if(!(typeof n==typeof s.value||nr[(typeof n).toUpperCase()]&s.type||["maxZoom","minZoom","passwordPrompt","defaultZoomValue","findController","pdfBackgroundColor"].includes(a))){console.error("Invalid AppOptions value: "+a+" = "+n);continue}}const{kind:r}=s;if(!i||r&Qn||r&sr){this.eventBus&&r&ar&&(t||=new Map).set(a,n);app_options_assertClassBrand(AppOptions,this,cr)._.set(a,n)}else console.error("Invalid AppOptions parameter: "+a+" = "+n)}if(t)for(const[e,i]of t)this.eventBus.dispatch(e.toLowerCase(),{source:this,value:i})}}$n=AppOptions;!function app_options_defineProperty(e,t,i){return(t=function app_options_toPropertyKey(e){var t=function app_options_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}(AppOptions,"eventBus",void 0);var or,lr,dr,cr={_:new Map};(()=>{for(const e in rr)app_options_assertClassBrand($n,$n,cr)._.set(e,rr[e].value);for(const[e,t]of Jn)app_options_assertClassBrand($n,$n,cr)._.set(e,t);$n._hasInvokedSet=!1;$n._checkDisablePreferences=()=>{if($n.get("disablePreferences"))return!0;$n._hasInvokedSet&&console.warn('The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.');return!1}})();function api_classPrivateGetter(e,t,i){return i(api_assertClassBrand(e,t))}function api_classPrivateMethodInitSpec(e,t){api_checkPrivateRedeclaration(e,t),t.add(e)}function api_classPrivateFieldSet(e,t,i){return e.set(api_assertClassBrand(e,t),i),i}function api_classPrivateFieldInitSpec(e,t,i){api_checkPrivateRedeclaration(e,t),t.set(e,i)}function api_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function api_classPrivateFieldGet(e,t){return e.get(api_assertClassBrand(e,t))}function api_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function api_defineProperty(e,t,i){return(t=function api_toPropertyKey(e){var t=function api_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function getDocument(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"string"==typeof e||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const t=new PDFDocumentLoadingTask,{docId:i}=t,s=e.url?function getUrlProp(e,t){if(e instanceof URL)return e;if("string"==typeof e){if(a){if(/^[a-z][a-z0-9\-+.]+:/i.test(e))return new URL(e);const t=process.getBuiltinModule("url");return new URL(t.pathToFileURL(e))}if(t)return new URL(e,window.location.origin+t);const i=URL.parse(e,window.location);if(i)return i}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(e.url,e.baseHref):null,n=e.data?function getDataProp(e){if(a&&"undefined"!=typeof Buffer&&e instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if("string"==typeof e)return stringToBytes(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||"object"==typeof e&&!isNaN(e?.length))return new Uint8Array(e);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(e.data):null,r=e.httpHeaders||null,o=!0===e.withCredentials,l=e.password??null,d=e.range instanceof PDFDataRangeTransport?e.range:null,c=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:65536;let h=e.worker instanceof PDFWorker?e.worker:null;const u=e.verbosity,_="string"!=typeof e.docBaseUrl||isDataScheme(e.docBaseUrl)?null:e.docBaseUrl,p=getFactoryUrlProp("function"==typeof e.cMapUrl?e.cMapUrl():"string"==typeof e.cMapUrl?e.cMapUrl:null),g=!1!==e.cMapPacked,f=getFactoryUrlProp(e.iccUrl),m=getFactoryUrlProp("function"==typeof e.standardFontDataUrl?e.standardFontDataUrl():"string"==typeof e.standardFontDataUrl?e.standardFontDataUrl:null),v=getFactoryUrlProp(e.wasmUrl),P=!0!==e.stopAtErrors,w=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,b=!1!==e.isEvalSupported,y="boolean"==typeof e.isOffscreenCanvasSupported?e.isOffscreenCanvasSupported:!a,S="boolean"==typeof e.isImageDecoderSupported?e.isImageDecoderSupported:!a&&(FeatureTest.platform.isFirefox||!globalThis.chrome),C=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,x="boolean"==typeof e.disableFontFace?e.disableFontFace:a,k=!0===e.fontExtraProperties,E=!0===e.enableXfa,A=e.ownerDocument||globalThis.document,G=!0===e.disableRange,B=!0===e.disableStream,M=!0===e.disableAutoFetch,I=!0===e.pdfBug,T=e.CanvasFactory||(a?NodeCanvasFactory:DOMCanvasFactory),D=e.FilterFactory||(a?NodeFilterFactory:DOMFilterFactory),L=e.BinaryDataFactory||(a?NodeBinaryDataFactory:DOMBinaryDataFactory),R=!0===e.enableHWA,N=!0===e.enableWebGPU,O=!1!==e.useWasm,W=e.pagesMapper||new PagesMapper,j="boolean"==typeof e.useSystemFonts?e.useSystemFonts:!a&&!x,V="boolean"==typeof e.useWorkerFetch?e.useWorkerFetch:!!(L===DOMBinaryDataFactory&&p&&g&&m&&v&&isValidFetchUrl(p,document.baseURI)&&isValidFetchUrl(m,document.baseURI)&&isValidFetchUrl(v,document.baseURI));setVerbosityLevel(u);const U={canvasFactory:new T({ownerDocument:A,enableHWA:R}),filterFactory:new D({docId:i,ownerDocument:A}),binaryDataFactory:V?null:new L({cMapUrl:p,standardFontDataUrl:m,wasmUrl:v})};if(!h){const i={verbosity:u,port:GlobalWorkerOptions.workerPort,cspPolicyService:e.cspPolicyService};h=PDFWorker.create(i);t._worker=h}const z={docId:i,apiVersion:"5.6.1112",data:n,password:l,disableAutoFetch:M,rangeChunkSize:c,docBaseUrl:_,enableXfa:E,enableOpenActionJavaScript:AppOptions.get("enableOpenActionJavaScript"),enableCatalogAAJavaScript:AppOptions.get("enableCatalogAAJavaScript"),evaluatorOptions:{maxImageSize:w,disableFontFace:x,ignoreErrors:P,isEvalSupported:b,isOffscreenCanvasSupported:y,isImageDecoderSupported:S,canvasMaxAreaInBytes:C,fontExtraProperties:k,useSystemFonts:j,useWasm:O,useWorkerFetch:V,cMapUrl:p,cMapPacked:g,iccUrl:f,standardFontDataUrl:m,wasmUrl:v,enableWebGPU:N}},H={ownerDocument:A,pdfBug:I,styleElement:null,enableHWA:R,loadingParams:{disableAutoFetch:M,enableXfa:E}};h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const e=h.messageHandler.sendWithPromise("GetDocRequest",z,n?[n.buffer]:null);let l;if(n);else if(d)l=new PDFDataTransportStream({pdfDataRangeTransport:d,disableRange:G,disableStream:B});else{if(!s)throw new Error("getDocument - expected either `data`, `range`, or `url` parameter.");{const e=function getNetworkStream(e){return isValidFetchUrl(e)?PDFFetchStream:a?PDFNodeStream:PDFNetworkStream}(s);l=new e({url:s,httpHeaders:r,withCredentials:o,rangeChunkSize:c,disableRange:G,disableStream:B})}}return e.then(e=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const a=new MessageHandler(i,e,h.port),s=new WorkerTransport(a,t,l,H,U,W);t._transport=s;a.send("Ready",null)})}).catch(t._capability.reject);return t}class PDFDocumentLoadingTask{constructor(){api_defineProperty(this,"_capability",Promise.withResolvers());api_defineProperty(this,"_transport",null);api_defineProperty(this,"_worker",null);api_defineProperty(this,"docId",`d${hr._=(or=hr._,lr=or++,or),lr}`);api_defineProperty(this,"destroyed",!1);api_defineProperty(this,"onPassword",null);api_defineProperty(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0);await(this._transport?.destroy())}catch(e){this._worker?.port&&delete this._worker._pendingDestroy;throw e}this._transport=null;this._worker?.destroy();this._worker=null}async getData(){return this._transport.getData()}}var hr={_:0},ur=new WeakMap,_r=new WeakMap,pr=new WeakMap,gr=new WeakMap;class PDFDataRangeTransport{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;api_classPrivateFieldInitSpec(this,ur,Promise.withResolvers());api_classPrivateFieldInitSpec(this,_r,[]);api_classPrivateFieldInitSpec(this,pr,[]);api_classPrivateFieldInitSpec(this,gr,[]);this.length=e;this.initialData=t;this.progressiveDone=i;this.contentDispositionFilename=a;Object.defineProperty(this,"onDataProgress",{value:()=>{!function deprecated(e){ngx_console_NgxConsole.log("Deprecated API usage: "+e)}("`PDFDataRangeTransport.prototype.onDataProgress` - method was removed, since loading progress is now reported automatically through the `PDFDataTransportStream` class (and related code).")}})}addRangeListener(e){api_classPrivateFieldGet(gr,this).push(e)}addProgressiveReadListener(e){api_classPrivateFieldGet(pr,this).push(e)}addProgressiveDoneListener(e){api_classPrivateFieldGet(_r,this).push(e)}onDataRange(e,t){for(const i of api_classPrivateFieldGet(gr,this))i(e,t)}onDataProgressiveRead(e){api_classPrivateFieldGet(ur,this).promise.then(()=>{for(const t of api_classPrivateFieldGet(pr,this))t(e)})}onDataProgressiveDone(){api_classPrivateFieldGet(ur,this).promise.then(()=>{for(const e of api_classPrivateFieldGet(_r,this))e()})}transportReady(){api_classPrivateFieldGet(ur,this).resolve()}requestDataRange(e,t){unreachable("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class PDFDocumentProxy{constructor(e,t){this._pdfInfo=e;this._transport=t}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return shadow(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAnnotationsByType(e,t){return this._transport.getAnnotationsByType(e,t)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){let{intent:e="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this._transport.saveDocument(e)}extractPages(e){return this._transport.extractPages(e)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}getRawData(e){return this._transport.getRawData(e)}cleanup(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var fr=new WeakMap,mr=new WeakMap,vr=new WeakSet;class PDFPageProxy{constructor(e,t,i,a){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];api_classPrivateMethodInitSpec(this,vr);api_classPrivateFieldInitSpec(this,fr,!1);api_classPrivateFieldInitSpec(this,mr,null);this._pageIndex=e;this._pageInfo=t;this._transport=i;this._stats=s?new StatTimer:null;this._pdfBug=s;this.commonObjs=i.commonObjs;this.objs=new PDFObjects;this._intentStates=new Map;this.destroyed=!1;this.recordedBBoxes=null;api_classPrivateFieldSet(mr,this,a);this.imageCoordinates=null}clone(e){const t=new PDFPageProxy(e,this._pageInfo,this._transport,api_classPrivateFieldGet(mr,this),this._pdfBug);t.clonedFromIndex=this.clonedFromIndex??this._pageIndex;this._transport.updatePage(t);return t}get pageNumber(){return this._pageIndex+1}set pageNumber(e){this._pageIndex=e-1;this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport(){let{scale:e,rotation:t=this.rotate,offsetX:i=0,offsetY:a=0,dontFlip:s=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new PageViewport({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:i,offsetY:a,dontFlip:s})}getAnnotations(){let{intent:e="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return shadow(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render(e){let{canvasContext:t,canvas:i=t.canvas,viewport:a,intent:s="display",annotationMode:n=p.ENABLE,transform:r=null,background:o=null,optionalContentConfigPromise:d=null,annotationCanvasMap:c=null,pageColors:h=null,printAnnotationStorage:u=null,isEditing:_=!1,recordImages:g=!1,recordOperations:f=!1,operationsFilter:m=null}=e;this._stats?.time("Overall");const v=this._transport.getRenderingIntent(s,n,u,_),{renderingIntent:P,cacheKey:w}=v;api_classPrivateFieldSet(fr,this,!1);d||=this._transport.getOptionalContentConfig(P);const b=this._intentStates.getOrInsertComputed(w,makeObj);if(b.streamReaderCancelTimeout){clearTimeout(b.streamReaderCancelTimeout);b.streamReaderCancelTimeout=null}const y=!!(P&l);if(!b.displayReadyCapability){b.displayReadyCapability=Promise.withResolvers();b.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null};this._stats?.time("Page Request");this._pumpOperatorList(v)}const S=!(!this._pdfBug||!globalThis.StepperManager?.enabled),C=!!i&&!this.recordedBBoxes&&(f||S),x=!!i&&!this.imageCoordinates&&g,complete=e=>{b.renderTasks.delete(A);if(C){const e=A.gfx?.dependencyTracker.take();if(e){A.stepper?.setOperatorBBoxes(e,A.gfx.dependencyTracker.takeDebugMetadata());f&&(this.recordedBBoxes=e)}}x&&!e&&(this.imageCoordinates=A.gfx?.imagesTracker.take());y&&api_classPrivateFieldSet(fr,this,!0);api_assertClassBrand(vr,this,_tryCleanup).call(this);if(e){A.capability.reject(e);this._abortOperatorList({intentState:b,reason:e instanceof Error?e:new Error(e)})}else A.capability.resolve();if(this._stats){this._stats.timeEnd("Rendering");this._stats.timeEnd("Overall");globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats)}};let k=null,E=null;(C||x)&&(E=new CanvasBBoxTracker(i,b.operatorList.length));C&&(k=new CanvasDependencyTracker(E,S));const A=new InternalRenderTask({callback:complete,params:{canvas:i,canvasContext:t,dependencyTracker:k??E,imagesTracker:x?new CanvasImagesTracker(i):null,viewport:a,transform:r,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:b.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!y,pdfBug:this._pdfBug,pageColors:h,enableHWA:this._transport.enableHWA,operationsFilter:m});(b.renderTasks||=new Set).add(A);const G=A.task;Promise.all([b.displayReadyCapability.promise,d]).then(e=>{let[t,i]=e;if(this.destroyed)complete();else{this._stats?.time("Rendering");if(!(i.renderingIntent&P))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");A.initializeGraphics({transparency:t,optionalContentConfig:i});A.operatorListChanged()}}).catch(complete);return G}getOperatorList(){let{intent:e="display",annotationMode:t=p.ENABLE,printAnnotationStorage:i=null,isEditing:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=this._transport.getRenderingIntent(e,t,i,a,!0),n=this._intentStates.getOrInsertComputed(s.cacheKey,makeObj);let r;if(!n.opListReadCapability){r=Object.create(null);r.operatorListChanged=function operatorListChanged(){if(n.operatorList.lastChunk){n.opListReadCapability.resolve(n.operatorList);n.renderTasks.delete(r)}};n.opListReadCapability=Promise.withResolvers();(n.renderTasks||=new Set).add(r);n.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null};this._stats?.time("Page Request");this._pumpOperatorList(s)}return n.opListReadCapability.promise}streamTextContent(){let{includeMarkedContent:e=!1,disableNormalization:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:api_classPrivateFieldGet(mr,this).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:!0===e,disableNormalization:!0===t},{highWaterMark:100,size:e=>e.items.length})}async getTextContent(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then(e=>XfaText.textContent(e));const t=this.streamTextContent(e),i={items:[],styles:Object.create(null),lang:null};for await(const e of t){i.lang??=e.lang;Object.assign(i.styles,e.styles);i.items.push(...e.items)}return i}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values()){this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0});if(!t.opListReadCapability)for(const i of t.renderTasks){e.push(i.completed);i.cancel()}}this.objs.clear();api_classPrivateFieldSet(fr,this,!1);return Promise.all(e)}cleanup(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];api_classPrivateFieldSet(fr,this,!0);const t=api_assertClassBrand(vr,this,_tryCleanup).call(this);e&&t&&(this._stats&&=new StatTimer);return t}_startRenderPage(e,t){const i=this._intentStates.get(t);if(i){this._stats?.timeEnd("Page Request");i.displayReadyCapability?.resolve(e)}}_renderPageChunk(e,t){for(let i=0,a=e.length;i<a;i++){t.operatorList.fnArray.push(e.fnArray[i]);t.operatorList.argsArray.push(e.argsArray[i])}t.operatorList.lastChunk=e.lastChunk;t.operatorList.separateAnnots=e.separateAnnots;for(const e of t.renderTasks)e.operatorListChanged();e.lastChunk&&api_assertClassBrand(vr,this,_tryCleanup).call(this)}_pumpOperatorList(e){let{renderingIntent:t,cacheKey:i,annotationStorageSerializable:a,modifiedIds:s}=e;const{map:n,transfer:r}=a,o=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:api_classPrivateFieldGet(mr,this).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:t,cacheKey:i,annotationStorage:n,modifiedIds:s},void 0,r).getReader(),l=this._intentStates.get(i);l.streamReader=o;const pump=()=>{o.read().then(e=>{let{value:t,done:i}=e;if(i)l.streamReader=null;else if(!this._transport.destroyed){this._renderPageChunk(t,l);pump()}},e=>{l.streamReader=null;if(!this._transport.destroyed){if(l.operatorList){l.operatorList.lastChunk=!0;for(const e of l.renderTasks)e.operatorListChanged();api_assertClassBrand(vr,this,_tryCleanup).call(this)}if(l.displayReadyCapability)l.displayReadyCapability.reject(e);else{if(!l.opListReadCapability)throw e;l.opListReadCapability.reject(e)}}})};pump()}_abortOperatorList(e){let{intentState:t,reason:i,force:a=!1}=e;if(t.streamReader){if(t.streamReaderCancelTimeout){clearTimeout(t.streamReaderCancelTimeout);t.streamReaderCancelTimeout=null}if(!a){if(t.renderTasks.size>0)return;if(i instanceof RenderingCancelledException){let e=100;i.extraDelay>0&&i.extraDelay<1e3&&(e+=i.extraDelay);t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null;this._abortOperatorList({intentState:t,reason:i,force:!0})},e);return}}t.streamReader.cancel(new AbortException(i.message)).catch(()=>{});t.streamReader=null;if(!this._transport.destroyed){for(const[e,i]of this._intentStates)if(i===t){this._intentStates.delete(e);break}this.cleanup()}}}get stats(){return this._stats}}function _tryCleanup(){if(!api_classPrivateFieldGet(fr,this)||this.destroyed)return!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;this._intentStates.clear();this.objs.clear();api_classPrivateFieldSet(fr,this,!1);return!0}var Pr=new WeakMap,wr=new WeakMap,Fr=new WeakMap,br=new WeakMap,yr=new WeakSet;class PDFWorker{constructor(){let{name:e=null,port:t=null,verbosity:i=getVerbosityLevel(),cspPolicyService:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};api_classPrivateMethodInitSpec(this,yr);api_classPrivateFieldInitSpec(this,Pr,Promise.withResolvers());api_classPrivateFieldInitSpec(this,wr,null);api_classPrivateFieldInitSpec(this,Fr,null);api_classPrivateFieldInitSpec(this,br,null);this.name=e;this.destroyed=!1;this.verbosity=i;if(t){if(xr._.has(t))throw new Error("Cannot use more than one PDFWorker per port.");xr._.set(t,this);api_assertClassBrand(yr,this,_initializeFromPort).call(this,t)}else this._initialize(a)}get promise(){return api_classPrivateFieldGet(Pr,this).promise}get port(){return api_classPrivateFieldGet(Fr,this)}get messageHandler(){return api_classPrivateFieldGet(wr,this)}_initialize(e){if(Cr._||_get_mainThreadWorkerMessageHandler(PDFWorker)){api_assertClassBrand(yr,this,_setupFakeWorker).call(this);return}let{workerSrc:t}=PDFWorker;try{PDFWorker._isSameOrigin(window.location,t)||(t=PDFWorker._createCDNWrapper(new URL(t,window.location).href));const i=new Worker(e.generateTrustedURL(t),{type:"module"}),a=new MessageHandler("main","worker",i),terminateEarly=()=>{s.abort();a.destroy();i.terminate();this.destroyed?api_classPrivateFieldGet(Pr,this).reject(new Error("Worker was destroyed")):api_assertClassBrand(yr,this,_setupFakeWorker).call(this)},s=new AbortController;i.addEventListener("error",()=>{api_classPrivateFieldGet(br,this)||terminateEarly()},{signal:s.signal});a.on("test",e=>{s.abort();if(!this.destroyed&&e){api_classPrivateFieldSet(wr,this,a);api_classPrivateFieldSet(Fr,this,i);api_classPrivateFieldSet(br,this,i);api_assertClassBrand(yr,this,_resolve).call(this)}else terminateEarly()});a.on("ready",e=>{s.abort();if(this.destroyed)terminateEarly();else try{sendTest()}catch{api_assertClassBrand(yr,this,_setupFakeWorker).call(this)}});const sendTest=()=>{const e=new Uint8Array;a.send("test",e,[e.buffer])};sendTest();return}catch{info("The worker has been disabled.")}api_assertClassBrand(yr,this,_setupFakeWorker).call(this)}destroy(){this.destroyed=!0;api_classPrivateFieldGet(br,this)?.terminate();api_classPrivateFieldSet(br,this,null);xr._.delete(api_classPrivateFieldGet(Fr,this));api_classPrivateFieldSet(Fr,this,null);api_classPrivateFieldGet(wr,this)?.destroy();api_classPrivateFieldSet(wr,this,null)}static create(e){const t=api_assertClassBrand(PDFWorker,this,xr)._.get(e?.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new PDFWorker(e)}static get workerSrc(){if(GlobalWorkerOptions.workerSrc)return GlobalWorkerOptions.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return shadow(this,"_setupFakeWorkerGlobal",(async()=>{if(api_classPrivateGetter(PDFWorker,this,_get_mainThreadWorkerMessageHandler))return api_classPrivateGetter(PDFWorker,this,_get_mainThreadWorkerMessageHandler);return(await import(
/*webpackIgnore: true*/
/*@vite-ignore*/
this.workerSrc)).WorkerMessageHandler})())}}dr=PDFWorker;function _resolve(){api_classPrivateFieldGet(Pr,this).resolve();api_classPrivateFieldGet(wr,this).send("configure",{verbosity:this.verbosity})}function _initializeFromPort(e){api_classPrivateFieldSet(Fr,this,e);api_classPrivateFieldSet(wr,this,new MessageHandler("main","worker",e));api_classPrivateFieldGet(wr,this).on("ready",()=>{});api_assertClassBrand(yr,this,_resolve).call(this)}function _setupFakeWorker(){if(!Cr._){warn("Setting up fake worker.");Cr._=!0}dr._setupFakeWorkerGlobal.then(e=>{var t,i;if(this.destroyed){api_classPrivateFieldGet(Pr,this).reject(new Error("Worker was destroyed"));return}const a=new LoopbackPort;api_classPrivateFieldSet(Fr,this,a);const s=`fake${Sr._=(t=Sr._,i=t++,t),i}`,n=new MessageHandler(s+"_worker",s,a);e.setup(n,a);api_classPrivateFieldSet(wr,this,new MessageHandler(s,s+"_worker",a));api_assertClassBrand(yr,this,_resolve).call(this)}).catch(e=>{api_classPrivateFieldGet(Pr,this).reject(new Error(`Setting up fake worker failed: "${e.message}".`))})}function _get_mainThreadWorkerMessageHandler(e){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}var Sr={_:0},Cr={_:!1},xr={_:new WeakMap};(()=>{if(a){Cr._=api_assertClassBrand(dr,dr,!0);GlobalWorkerOptions.workerSrc||="./pdf.worker.mjs"}dr._isSameOrigin=(e,t)=>{const i=URL.parse(e);if(!i?.origin||"null"===i.origin)return!1;const a=new URL(t,i);return i.origin===a.origin};dr._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))}})();var kr=new WeakMap,Er=new WeakMap,Ar=new WeakMap,Gr=new WeakMap,Br=new WeakMap,Mr=new WeakMap,Ir=new WeakMap,Tr=new WeakSet;class WorkerTransport{constructor(e,t,i,a,s,n){api_classPrivateMethodInitSpec(this,Tr);api_defineProperty(this,"downloadInfoCapability",Promise.withResolvers());api_classPrivateFieldInitSpec(this,kr,null);api_classPrivateFieldInitSpec(this,Er,new Map);api_classPrivateFieldInitSpec(this,Ar,null);api_classPrivateFieldInitSpec(this,Gr,new Map);api_classPrivateFieldInitSpec(this,Br,new Map);api_classPrivateFieldInitSpec(this,Mr,new Map);api_classPrivateFieldInitSpec(this,Ir,null);this.messageHandler=e;this.loadingTask=t;api_classPrivateFieldSet(Ar,this,i);this.commonObjs=new PDFObjects;this.fontLoader=new FontLoader({ownerDocument:a.ownerDocument,styleElement:a.styleElement});this.enableHWA=a.enableHWA;this.loadingParams=a.loadingParams;this._params=a;this.canvasFactory=s.canvasFactory;this.filterFactory=s.filterFactory;this.binaryDataFactory=s.binaryDataFactory;this.pagesMapper=n;this.destroyed=!1;this.destroyCapability=null;this.setupMessageHandler()}updatePage(e){const{_pageIndex:t}=e;api_classPrivateFieldGet(Gr,this).set(t,e);api_classPrivateFieldGet(Br,this).set(t,Promise.resolve(e))}get annotationStorage(){return shadow(this,"annotationStorage",new AnnotationStorage)}getRenderingIntent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],n=o,g=Hi;switch(e){case"any":n=r;break;case"display":break;case"print":n=l;break;default:warn(`getRenderingIntent - invalid intent: ${e}`)}const f=n&l&&i instanceof PrintAnnotationStorage?i:this.annotationStorage;switch(t){case p.DISABLE:n+=h;break;case p.ENABLE:break;case p.ENABLE_FORMS:n+=d;break;case p.ENABLE_STORAGE:n+=c;g=f.serializable;break;default:warn(`getRenderingIntent - invalid annotationMode: ${t}`)}a&&(n+=u);s&&(n+=_);const{ids:m,hash:v}=f.modifiedIds;return{renderingIntent:n,cacheKey:[n,g.hash,v].join("_"),annotationStorageSerializable:g,modifiedIds:m}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0;this.destroyCapability=Promise.withResolvers();api_classPrivateFieldGet(Ir,this)?.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const t of api_classPrivateFieldGet(Gr,this).values())e.push(t._destroy());api_classPrivateFieldGet(Gr,this).clear();api_classPrivateFieldGet(Br,this).clear();api_classPrivateFieldGet(Mr,this).clear();this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);e.push(t);Promise.all(e).then(()=>{this.commonObjs.clear();this.fontLoader.clear();api_classPrivateFieldGet(Er,this).clear();this.filterFactory.destroy();TextLayer.cleanup();api_classPrivateFieldGet(Ar,this)?.cancelAllRequests(new AbortException("Worker was terminated."));this.messageHandler?.destroy();this.messageHandler=null;this.destroyCapability.resolve()},this.destroyCapability.reject);return this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",(e,t)=>{assert(api_classPrivateFieldGet(Ar,this),"GetReader - no `BasePDFStream` instance available.");api_classPrivateFieldSet(kr,this,api_classPrivateFieldGet(Ar,this).getFullReader());api_classPrivateFieldGet(kr,this).onProgress=e=>api_assertClassBrand(Tr,this,api_onProgress).call(this,e);t.onPull=()=>{api_classPrivateFieldGet(kr,this).read().then(function(e){let{value:i,done:a}=e;if(a)t.close();else{assert(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer.");t.enqueue(new Uint8Array(i),1,[i])}}).catch(e=>{t.error(e)})};t.onCancel=e=>{api_classPrivateFieldGet(kr,this).cancel(e);t.ready.catch(e=>{if(!this.destroyed)throw e})}});e.on("ReaderHeadersReady",async e=>{await api_classPrivateFieldGet(kr,this).headersReady;const{isStreamingSupported:t,isRangeSupported:i,contentLength:a}=api_classPrivateFieldGet(kr,this);t&&i&&(api_classPrivateFieldGet(kr,this).onProgress=null);return{isStreamingSupported:t,isRangeSupported:i,contentLength:a}});e.on("GetRangeReader",(e,t)=>{assert(api_classPrivateFieldGet(Ar,this),"GetRangeReader - no `BasePDFStream` instance available.");const i=api_classPrivateFieldGet(Ar,this).getRangeReader(e.begin,e.end);if(i){t.onPull=()=>{i.read().then(function(e){let{value:i,done:a}=e;if(a)t.close();else{assert(i instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer.");t.enqueue(new Uint8Array(i),1,[i])}}).catch(e=>{t.error(e)})};t.onCancel=e=>{i.cancel(e);t.ready.catch(e=>{if(!this.destroyed)throw e})}}else t.close()});e.on("GetDoc",e=>{let{pdfInfo:i}=e;this.pagesMapper.pagesNumber=i.numPages;this._numPages=i.numPages;this._htmlForXfa=i.htmlForXfa;delete i.htmlForXfa;t._capability.resolve(new PDFDocumentProxy(i,this))});e.on("DocException",e=>{t._capability.reject(wrapReason(e))});e.on("PasswordRequest",e=>{api_classPrivateFieldSet(Ir,this,Promise.withResolvers());try{if(!t.onPassword)throw wrapReason(e);const updatePassword=e=>{e instanceof Error?api_classPrivateFieldGet(Ir,this).reject(e):api_classPrivateFieldGet(Ir,this).resolve({password:e})};t.onPassword(updatePassword,e.code)}catch(e){api_classPrivateFieldGet(Ir,this).reject(e)}return api_classPrivateFieldGet(Ir,this).promise});e.on("DataLoaded",e=>{api_assertClassBrand(Tr,this,api_onProgress).call(this,{loaded:e.length,total:e.length});this.downloadInfoCapability.resolve(e)});e.on("StartRenderPage",e=>{if(this.destroyed)return;api_classPrivateFieldGet(Gr,this).get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)});e.on("commonobj",t=>{let[i,a,s]=t;if(this.destroyed)return null;if(this.commonObjs.has(i))return null;switch(a){case"Font":if("error"in s){const e=s.error;warn(`Error during font loading: ${e}`);this.commonObjs.resolve(i,e);break}const t=new FontInfo(s),n=this._params.pdfBug&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,r=new FontFaceObject(t,n,s.charProcOperatorList,s.extra);this.fontLoader.bind(r).catch(()=>e.sendWithPromise("FontFallback",{id:i})).finally(()=>{r.fontExtraProperties||r.clearData();this.commonObjs.resolve(i,r)});break;case"CopyLocalImage":const{imageRef:o}=s;assert(o,"The imageRef must be defined.");for(const e of api_classPrivateFieldGet(Gr,this).values())for(const[,t]of e.objs)if(t?.ref===o){if(!t.dataLen)return null;this.commonObjs.resolve(i,structuredClone(t));return t.dataLen}break;case"FontPath":this.commonObjs.resolve(i,new FontPathInfo(s));break;case"Image":this.commonObjs.resolve(i,s);break;case"Pattern":const l=new PatternInfo(s);this.commonObjs.resolve(i,l.getIR());break;default:throw new Error(`Got unknown common object type ${a}`)}return null});e.on("obj",e=>{let[t,i,a,s]=e;if(this.destroyed)return;const n=api_classPrivateFieldGet(Gr,this).get(i);if(!n.objs.has(t))if(0!==n._intentStates.size)switch(a){case"Image":case"Pattern":n.objs.resolve(t,s);break;default:throw new Error(`Got unknown object type ${a}`)}else s?.bitmap?.close()});e.on("DocProgress",e=>{this.destroyed||api_assertClassBrand(Tr,this,api_onProgress).call(this,e)});e.on("PrepareWebGPU",()=>{this.destroyed||function initWebGPUMesh(){Gs.init()}()});e.on("FetchBinaryData",async e=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.binaryDataFactory)throw new Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(e)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.annotationStorage.size<=0&&warn("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:i}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:api_classPrivateFieldGet(kr,this)?.filename??null,pageOrder:e},i).finally(()=>{this.annotationStorage.resetModified()})}extractPages(e){const t={pageInfos:e};let i;if(this.annotationStorage.size>0){const{map:e,transfer:a}=this.annotationStorage.serializable;t.annotationStorage=e;i=a}return this.messageHandler.sendWithPromise("ExtractPages",t,i).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this.pagesMapper.pagesNumber)return Promise.reject(new Error("Invalid page request."));const t=e-1,i=this.pagesMapper.getPageId(e)-1,a=api_classPrivateFieldGet(Br,this).get(t);if(a)return a;const s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:i}).then(e=>{if(this.destroyed)throw new Error("Transport destroyed");e.refStr&&api_classPrivateFieldGet(Mr,this).set(e.refStr,i);const a=new PDFPageProxy(t,e,this,this.pagesMapper,this._params.pdfBug);api_classPrivateFieldGet(Gr,this).set(t,a);return a});api_classPrivateFieldGet(Br,this).set(t,s);return s}async getPageIndex(e){if(!isRefProxy(e))throw new Error("Invalid pageIndex request.");const t=await this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}),i=this.pagesMapper.getPageNumber(t+1);if(0===i)throw new Error("GetPageIndex: page has been removed.");return i-1}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(e+1)-1,intent:t})}getFieldObjects(){return api_assertClassBrand(Tr,this,_cacheSimpleMethod).call(this,"GetFieldObjects")}hasJSActions(){return api_assertClassBrand(Tr,this,_cacheSimpleMethod).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return"string"!=typeof e?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAnnotationsByType(e,t){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:e,pageIndexesToSkip:t})}getDocJSActions(){return api_assertClassBrand(Tr,this,_cacheSimpleMethod).call(this,"GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return api_assertClassBrand(Tr,this,_cacheSimpleMethod).call(this,"GetOptionalContentConfig").then(t=>new OptionalContentConfig(t,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata";return api_classPrivateFieldGet(Er,this).getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,null).then(e=>({info:e[0],metadata:e[1]?new Metadata(e[1]):null,contentDispositionFilename:api_classPrivateFieldGet(kr,this)?.filename??null,contentLength:api_classPrivateFieldGet(kr,this)?.contentLength??null,hasStructTree:e[2]})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}getRawData(e){return this.messageHandler.sendWithPromise("GetRawData",e)}async startCleanup(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of api_classPrivateFieldGet(Gr,this).values()){if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`)}this.commonObjs.clear();e||this.fontLoader.clear();api_classPrivateFieldGet(Er,this).clear();this.filterFactory.destroy(!0);TextLayer.cleanup()}}cachedPageNumber(e){if(!isRefProxy(e))return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`,i=api_classPrivateFieldGet(Mr,this).get(t);if(i>=0){const e=this.pagesMapper.getPageNumber(i+1);if(0!==e)return e}return null}}function _cacheSimpleMethod(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return api_classPrivateFieldGet(Er,this).getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,t))}function api_onProgress(e){let{loaded:t,total:i}=e;this.loadingTask.onProgress?.({loaded:t,total:i,percent:i?MathClamp(Math.round(t/i*100),0,100):NaN})}class RenderTask{constructor(e){api_defineProperty(this,"_internalRenderTask",null);api_defineProperty(this,"onContinue",null);api_defineProperty(this,"onError",null);this._internalRenderTask=e}get promise(){return this._internalRenderTask.capability.promise}cancel(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._internalRenderTask.cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=this._internalRenderTask.operatorList;if(!e)return!1;const{annotationCanvasMap:t}=this._internalRenderTask;return e.form||e.canvas&&t?.size>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}}var Dr=new WeakMap;class InternalRenderTask{constructor(e){let{callback:t,params:i,objs:a,commonObjs:s,annotationCanvasMap:n,operatorList:r,pageIndex:o,canvasFactory:l,filterFactory:d,useRequestAnimationFrame:c=!1,pdfBug:h=!1,pageColors:u=null,enableHWA:_=!1,operationsFilter:p=null}=e;api_classPrivateFieldInitSpec(this,Dr,null);this.callback=t;this.params=i;this.objs=a;this.commonObjs=s;this.annotationCanvasMap=n;this.operatorListIdx=null;this.operatorList=r;this._pageIndex=o;this.canvasFactory=l;this.filterFactory=d;this._pdfBug=h;this.pageColors=u;this.running=!1;this.graphicsReadyCallback=null;this.graphicsReady=!1;this._useRequestAnimationFrame=!0===c&&"undefined"!=typeof window;this.cancelled=!1;this.capability=Promise.withResolvers();this.task=new RenderTask(this);this._cancelBound=this.cancel.bind(this);this._continueBound=this._continue.bind(this);this._scheduleNextBound=this._scheduleNext.bind(this);this._nextBound=this._next.bind(this);this._canvas=i.canvas;this._canvasContext=i.canvas?null:i.canvasContext;this._enableHWA=_;this._dependencyTracker=i.dependencyTracker;this._imagesTracker=i.imagesTracker;this._operationsFilter=p}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics(e){let{transparency:t=!1,optionalContentConfig:i}=e;if(this.cancelled)return;if(this._canvas){if(Lr._.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");Lr._.add(this._canvas)}if(this._pdfBug&&globalThis.StepperManager?.enabled){this.stepper=globalThis.StepperManager.create(this._pageIndex);this.stepper.init(this.operatorList);this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint()}const{viewport:a,transform:s,background:n,dependencyTracker:r,imagesTracker:o}=this.params,l=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new CanvasGraphics(l,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:i},this.annotationCanvasMap,this.pageColors,r,o);this.gfx.beginDrawing({transform:s,viewport:a,transparency:t,background:n});this.operatorListIdx=0;this.graphicsReady=!0;this.graphicsReadyCallback?.()}cancel(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1;this.cancelled=!0;this.gfx?.endDrawing();if(api_classPrivateFieldGet(Dr,this)){window.cancelAnimationFrame(api_classPrivateFieldGet(Dr,this));api_classPrivateFieldSet(Dr,this,null)}Lr._.delete(this._canvas);e||=new RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,t);this.callback(e);this.task.onError?.(e)}operatorListChanged(){if(this.graphicsReady){this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length);this.stepper?.updateOperatorList(this.operatorList);this.running||this._continue()}else this.graphicsReadyCallback||=this._continueBound}_continue(){this.running=!0;this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?api_classPrivateFieldSet(Dr,this,window.requestAnimationFrame(()=>{api_classPrivateFieldSet(Dr,this,null);this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){if(!this.cancelled){this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter);if(this.operatorListIdx===this.operatorList.argsArray.length){this.running=!1;if(this.operatorList.lastChunk){this.gfx.endDrawing();Lr._.delete(this._canvas);this.callback()}}}}}var Lr={_:new WeakSet};const Rr="5.6.1112",Nr="32a32f523";var Or;function color_picker_classPrivateFieldInitSpec(e,t,i){color_picker_checkPrivateRedeclaration(e,t),t.set(e,i)}function color_picker_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function color_picker_classPrivateGetter(e,t,i){return i(color_picker_assertClassBrand(e,t))}function color_picker_classPrivateFieldGet(e,t){return e.get(color_picker_assertClassBrand(e,t))}function color_picker_classPrivateFieldSet(e,t,i){return e.set(color_picker_assertClassBrand(e,t),i),i}function color_picker_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Wr=new WeakMap,jr=new WeakMap,Vr=new WeakMap,Ur=new WeakMap,zr=new WeakMap,Hr=new WeakMap,$r=new WeakMap,qr=new WeakMap,Xr=new WeakMap,Kr=new WeakMap,Yr=new WeakSet;class ColorPicker{static get _keyboardManager(){return shadow(this,"_keyboardManager",new KeyboardManager([[["Escape","mac+Escape"],ColorPicker.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],ColorPicker.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],ColorPicker.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],ColorPicker.prototype._moveToPrevious],[["Home","mac+Home"],ColorPicker.prototype._moveToBeginning],[["End","mac+End"],ColorPicker.prototype._moveToEnd]]))}constructor(e){let{editor:t=null,uiManager:i=null}=e;!function color_picker_classPrivateMethodInitSpec(e,t){color_picker_checkPrivateRedeclaration(e,t),t.add(e)}(this,Yr);color_picker_classPrivateFieldInitSpec(this,Wr,null);color_picker_classPrivateFieldInitSpec(this,jr,null);color_picker_classPrivateFieldInitSpec(this,Vr,void 0);color_picker_classPrivateFieldInitSpec(this,Ur,null);color_picker_classPrivateFieldInitSpec(this,zr,!1);color_picker_classPrivateFieldInitSpec(this,Hr,!1);color_picker_classPrivateFieldInitSpec(this,$r,null);color_picker_classPrivateFieldInitSpec(this,qr,void 0);color_picker_classPrivateFieldInitSpec(this,Xr,null);color_picker_classPrivateFieldInitSpec(this,Kr,null);if(t){color_picker_classPrivateFieldSet(Hr,this,!1);color_picker_classPrivateFieldSet($r,this,t)}else color_picker_classPrivateFieldSet(Hr,this,!0);color_picker_classPrivateFieldSet(Kr,this,t?._uiManager||i);color_picker_classPrivateFieldSet(qr,this,color_picker_classPrivateFieldGet(Kr,this)._eventBus);color_picker_classPrivateFieldSet(Vr,this,t?.color?.toUpperCase()||color_picker_classPrivateFieldGet(Kr,this)?.highlightColors.values().next().value||"#FFFF98");Zr._||(Zr._=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}renderButton(){const e=color_picker_classPrivateFieldSet(Wr,this,document.createElement("button"));e.className="colorPicker";e.tabIndex="0";e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button");e.ariaHasPopup="true";color_picker_classPrivateFieldGet($r,this)&&(e.ariaControls=`${color_picker_classPrivateFieldGet($r,this).id}_colorpicker_dropdown`);const t=color_picker_classPrivateFieldGet(Kr,this)._signal;e.addEventListener("click",color_picker_assertClassBrand(Yr,this,_openDropdown).bind(this),{signal:t});e.addEventListener("keydown",color_picker_assertClassBrand(Yr,this,_keyDown).bind(this),{signal:t});const i=color_picker_classPrivateFieldSet(jr,this,document.createElement("span"));i.className="swatch";i.ariaHidden="true";i.style.backgroundColor=color_picker_classPrivateFieldGet(Vr,this);e.append(i);return e}renderMainDropdown(){const e=color_picker_classPrivateFieldSet(Ur,this,color_picker_assertClassBrand(Yr,this,_getDropdownRoot).call(this));e.ariaOrientation="horizontal";e.ariaLabelledBy="highlightColorPickerLabel";return e}_colorSelectFromKeyboard(e){if(e.target===color_picker_classPrivateFieldGet(Wr,this)){color_picker_assertClassBrand(Yr,this,_openDropdown).call(this,e);return}const t=e.target.getAttribute("data-color");t&&color_picker_assertClassBrand(Yr,this,_colorSelect).call(this,t,e)}_moveToNext(e){color_picker_classPrivateGetter(Yr,this,_get_isDropdownVisible)?e.target!==color_picker_classPrivateFieldGet(Wr,this)?e.target.nextSibling?.focus():color_picker_classPrivateFieldGet(Ur,this).firstElementChild?.focus():color_picker_assertClassBrand(Yr,this,_openDropdown).call(this,e)}_moveToPrevious(e){if(e.target!==color_picker_classPrivateFieldGet(Ur,this)?.firstElementChild&&e.target!==color_picker_classPrivateFieldGet(Wr,this)){color_picker_classPrivateGetter(Yr,this,_get_isDropdownVisible)||color_picker_assertClassBrand(Yr,this,_openDropdown).call(this,e);e.target.previousSibling?.focus()}else color_picker_classPrivateGetter(Yr,this,_get_isDropdownVisible)&&this._hideDropdownFromKeyboard()}_moveToBeginning(e){color_picker_classPrivateGetter(Yr,this,_get_isDropdownVisible)?color_picker_classPrivateFieldGet(Ur,this).firstElementChild?.focus():color_picker_assertClassBrand(Yr,this,_openDropdown).call(this,e)}_moveToEnd(e){color_picker_classPrivateGetter(Yr,this,_get_isDropdownVisible)?color_picker_classPrivateFieldGet(Ur,this).lastElementChild?.focus():color_picker_assertClassBrand(Yr,this,_openDropdown).call(this,e)}hideDropdown(){color_picker_classPrivateFieldGet(Ur,this)?.classList.add("hidden");color_picker_classPrivateFieldGet(Wr,this).ariaExpanded="false";color_picker_classPrivateFieldGet(Xr,this)?.abort();color_picker_classPrivateFieldSet(Xr,this,null)}_hideDropdownFromKeyboard(){if(!color_picker_classPrivateFieldGet(Hr,this))if(color_picker_classPrivateGetter(Yr,this,_get_isDropdownVisible)){this.hideDropdown();color_picker_classPrivateFieldGet(Wr,this).focus({preventScroll:!0,focusVisible:color_picker_classPrivateFieldGet(zr,this)})}else color_picker_classPrivateFieldGet($r,this)?.unselect()}updateColor(e){color_picker_classPrivateFieldGet(jr,this)&&(color_picker_classPrivateFieldGet(jr,this).style.backgroundColor=e);if(!color_picker_classPrivateFieldGet(Ur,this))return;const t=color_picker_classPrivateFieldGet(Kr,this).highlightColors.values();for(const i of color_picker_classPrivateFieldGet(Ur,this).children)i.ariaSelected=t.next().value===e.toUpperCase()}destroy(){color_picker_classPrivateFieldGet(Wr,this)?.remove();color_picker_classPrivateFieldSet(Wr,this,null);color_picker_classPrivateFieldSet(jr,this,null);color_picker_classPrivateFieldGet(Ur,this)?.remove();color_picker_classPrivateFieldSet(Ur,this,null)}}Or=ColorPicker;function _getDropdownRoot(){const e=document.createElement("div"),t=color_picker_classPrivateFieldGet(Kr,this)._signal;e.addEventListener("contextmenu",noContextMenu,{signal:t});e.className="dropdown";e.role="listbox";e.ariaMultiSelectable="false";e.ariaOrientation="vertical";e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");color_picker_classPrivateFieldGet($r,this)&&(e.id=`${color_picker_classPrivateFieldGet($r,this).id}_colorpicker_dropdown`);for(const[i,a]of color_picker_classPrivateFieldGet(Kr,this).highlightColors){const s=document.createElement("button");s.tabIndex="0";s.role="option";s.setAttribute("data-color",a);s.title=i;s.setAttribute("data-l10n-id",Zr._[i]);const n=document.createElement("span");s.append(n);n.className="swatch";n.style.backgroundColor=a;s.ariaSelected=a===color_picker_classPrivateFieldGet(Vr,this);s.addEventListener("click",color_picker_assertClassBrand(Yr,this,_colorSelect).bind(this,a),{signal:t});e.append(s)}e.addEventListener("keydown",color_picker_assertClassBrand(Yr,this,_keyDown).bind(this),{signal:t});return e}function _colorSelect(e,t){t.stopPropagation();color_picker_classPrivateFieldGet(qr,this).dispatch("switchannotationeditorparams",{source:this,type:m.HIGHLIGHT_COLOR,value:e});this.updateColor(e)}function _keyDown(e){Or._keyboardManager.exec(this,e)}function _openDropdown(e){if(color_picker_classPrivateGetter(Yr,this,_get_isDropdownVisible)){this.hideDropdown();return}color_picker_classPrivateFieldSet(zr,this,0===e.detail);if(!color_picker_classPrivateFieldGet(Xr,this)){color_picker_classPrivateFieldSet(Xr,this,new AbortController);window.addEventListener("pointerdown",color_picker_assertClassBrand(Yr,this,color_picker_pointerDown).bind(this),{signal:color_picker_classPrivateFieldGet(Kr,this).combinedSignal(color_picker_classPrivateFieldGet(Xr,this))})}color_picker_classPrivateFieldGet(Wr,this).ariaExpanded="true";if(color_picker_classPrivateFieldGet(Ur,this)){color_picker_classPrivateFieldGet(Ur,this).classList.remove("hidden");return}const t=color_picker_classPrivateFieldSet(Ur,this,color_picker_assertClassBrand(Yr,this,_getDropdownRoot).call(this));color_picker_classPrivateFieldGet(Wr,this).append(t)}function color_picker_pointerDown(e){color_picker_classPrivateFieldGet(Ur,this)?.contains(e.target)||this.hideDropdown()}function _get_isDropdownVisible(e){return color_picker_classPrivateFieldGet(Ur,e)&&!color_picker_classPrivateFieldGet(Ur,e).classList.contains("hidden")}var Zr={_:null},Jr=new WeakMap,Qr=new WeakMap,eo=new WeakMap;class BasicColorPicker{constructor(e){color_picker_classPrivateFieldInitSpec(this,Jr,null);color_picker_classPrivateFieldInitSpec(this,Qr,null);color_picker_classPrivateFieldInitSpec(this,eo,null);color_picker_classPrivateFieldSet(Qr,this,e);color_picker_classPrivateFieldSet(eo,this,e._uiManager);to._||(to._=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(color_picker_classPrivateFieldGet(Jr,this))return color_picker_classPrivateFieldGet(Jr,this);const{editorType:e,colorType:t,color:i}=color_picker_classPrivateFieldGet(Qr,this),a=color_picker_classPrivateFieldSet(Jr,this,document.createElement("input"));a.type="color";a.value=i||"#000000";a.className="basicColorPicker";a.tabIndex=0;a.setAttribute("data-l10n-id",to._[e]);a.addEventListener("input",()=>{color_picker_classPrivateFieldGet(eo,this).updateParams(t,a.value)},{signal:color_picker_classPrivateFieldGet(eo,this)._signal});return a}update(e){color_picker_classPrivateFieldGet(Jr,this)&&(color_picker_classPrivateFieldGet(Jr,this).value=e)}destroy(){color_picker_classPrivateFieldGet(Jr,this)?.remove();color_picker_classPrivateFieldSet(Jr,this,null)}hideDropdown(){}}var to={_:null};__webpack_require__(531);function makeColorComp(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}function scaleAndClamp(e){return Math.max(0,Math.min(255,255*e))}class ColorConverters{static CMYK_G(e){let[t,i,a,s]=e;return["G",1-Math.min(1,.3*t+.59*a+.11*i+s)]}static G_CMYK(e){let[t]=e;return["CMYK",0,0,0,1-t]}static G_RGB(e){let[t]=e;return["RGB",t,t,t]}static G_rgb(e){let[t]=e;t=scaleAndClamp(t);return[t,t,t]}static G_HTML(e){let[t]=e;const i=makeColorComp(t);return`#${i}${i}${i}`}static RGB_G(e){let[t,i,a]=e;return["G",.3*t+.59*i+.11*a]}static RGB_rgb(e){return e.map(scaleAndClamp)}static RGB_HTML(e){return`#${e.map(makeColorComp).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB(e){let[t,i,a,s]=e;return["RGB",1-Math.min(1,t+s),1-Math.min(1,a+s),1-Math.min(1,i+s)]}static CMYK_rgb(e){let[t,i,a,s]=e;return[scaleAndClamp(1-Math.min(1,t+s)),scaleAndClamp(1-Math.min(1,a+s)),scaleAndClamp(1-Math.min(1,i+s))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK(e){let[t,i,a]=e;const s=1-t,n=1-i,r=1-a;return["CMYK",s,n,r,Math.min(s,n,r)]}}class BaseSVGFactory{create(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const a=this._createSVG("svg:svg");a.setAttribute("version","1.1");if(!i){a.setAttribute("width",`${e}px`);a.setAttribute("height",`${t}px`)}a.setAttribute("preserveAspectRatio","none");a.setAttribute("viewBox",`0 0 ${e} ${t}`);return a}createElement(e){if("string"!=typeof e)throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){unreachable("Abstract method `_createSVG` called.")}}class DOMSVGFactory extends BaseSVGFactory{_createSVG(e){return document.createElementNS(Y,e)}}function _toSetter(e,t,i){t||(t=[]);var a=t.length++;return Object.defineProperty({},"_",{set:function(s){t[a]=s,e.apply(i,t)}})}function annotation_layer_classPrivateGetter(e,t,i){return i(annotation_layer_assertClassBrand(e,t))}function annotation_layer_classPrivateMethodInitSpec(e,t){annotation_layer_checkPrivateRedeclaration(e,t),t.add(e)}function annotation_layer_classPrivateFieldInitSpec(e,t,i){annotation_layer_checkPrivateRedeclaration(e,t),t.set(e,i)}function annotation_layer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function annotation_layer_classPrivateFieldSet(e,t,i){return e.set(annotation_layer_assertClassBrand(e,t),i),i}function annotation_layer_classPrivateFieldGet(e,t){return e.get(annotation_layer_assertClassBrand(e,t))}function annotation_layer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const io=new WeakSet,ao=60*(new Date).getTimezoneOffset()*1e3;class AnnotationElementFactory{static create(e){switch(e.data.annotationType){case A.LINK:return new LinkAnnotationElement(e);case A.TEXT:return new TextAnnotationElement(e);case A.WIDGET:switch(e.data.fieldType){case"Tx":return new TextWidgetAnnotationElement(e);case"Btn":return e.data.radioButton?new RadioButtonWidgetAnnotationElement(e):e.data.checkBox?new CheckboxWidgetAnnotationElement(e):new PushButtonWidgetAnnotationElement(e);case"Ch":return new ChoiceWidgetAnnotationElement(e);case"Sig":return new SignatureWidgetAnnotationElement(e)}return new WidgetAnnotationElement(e);case A.POPUP:return new PopupAnnotationElement(e);case A.FREETEXT:return new FreeTextAnnotationElement(e);case A.LINE:return new LineAnnotationElement(e);case A.SQUARE:return new SquareAnnotationElement(e);case A.CIRCLE:return new CircleAnnotationElement(e);case A.POLYLINE:return new PolylineAnnotationElement(e);case A.CARET:return new CaretAnnotationElement(e);case A.INK:return new InkAnnotationElement(e);case A.POLYGON:return new PolygonAnnotationElement(e);case A.HIGHLIGHT:return new HighlightAnnotationElement(e);case A.UNDERLINE:return new UnderlineAnnotationElement(e);case A.SQUIGGLY:return new SquigglyAnnotationElement(e);case A.STRIKEOUT:return new StrikeOutAnnotationElement(e);case A.STAMP:return new StampAnnotationElement(e);case A.FILEATTACHMENT:return new FileAttachmentAnnotationElement(e);default:return new AnnotationElement(e)}}}var so=new WeakMap,no=new WeakMap,ro=new WeakMap,oo=new WeakSet;class AnnotationElement{constructor(e){let{isRenderable:t=!1,ignoreBorder:i=!1,createQuadrilaterals:a=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};annotation_layer_classPrivateMethodInitSpec(this,oo);annotation_layer_classPrivateFieldInitSpec(this,so,null);annotation_layer_classPrivateFieldInitSpec(this,no,!1);annotation_layer_classPrivateFieldInitSpec(this,ro,null);this.isRenderable=t;this.data=e.data;this.layer=e.layer;this.linkService=e.linkService;this.downloadManager=e.downloadManager;this.imageResourcesPath=e.imageResourcesPath;this.renderForms=e.renderForms;this.svgFactory=e.svgFactory;this.annotationStorage=e.annotationStorage;this.enableComment=e.enableComment;this.enableScripting=e.enableScripting;this.hasJSActions=e.hasJSActions;this._fieldObjects=e.fieldObjects;this.parent=e.parent;this.hasOwnCommentButton=!1;t&&(this.contentElement=this.container=this._createContainer(i));a&&this._createQuadrilaterals()}static _hasPopupData(e){let{contentsObj:t,richText:i}=e;return!(!t?.str&&!i?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return AnnotationElement._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){const{data:e}=this,t=this.annotationStorage?.getEditor(e.id);return t?t.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){const e=this.annotationStorage?.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;const{quadPoints:t,inkLists:i,rect:a}=this.data;let s=-1/0,n=-1/0;if(t?.length>=8){for(let e=0;e<t.length;e+=8)if(t[e+1]>n){n=t[e+1];s=t[e+2]}else t[e+1]===n&&(s=Math.max(s,t[e+2]));return[s,n]}if(i?.length>=1){for(const e of i)for(let t=0,i=e.length;t<i;t+=2)if(e[t+1]>n){n=e[t+1];s=e[t]}else e[t+1]===n&&(s=Math.max(s,e[t]));if(s!==1/0)return[s,n]}return a?[a[2],a[3]]:null}_normalizePoint(e){const{page:{view:t},viewport:{rawDims:{pageWidth:i,pageHeight:a,pageX:s,pageY:n}}}=this.parent;e[1]=t[3]-e[1]+t[1];e[0]=100*(e[0]-s)/i;e[1]=100*(e[1]-n)/a;return e}get commentText(){const{data:e}=this;return this.annotationStorage.getRawValue(`${g}${e.id}`)?.popup?.contents||e.contentsObj?.str||""}set commentText(e){const{data:t}=this,i={deleted:!e,contents:e||""};this.annotationStorage.updateEditor(t.id,{popup:i})||this.annotationStorage.setValue(`${g}${t.id}`,{id:t.id,annotationType:t.annotationType,page:this.parent.page,popup:i,popupRef:t.popupRef,modificationDate:new Date});e||this.removePopup()}removePopup(){(annotation_layer_classPrivateFieldGet(ro,this)?.popup||this.popup)?.remove();annotation_layer_classPrivateFieldSet(ro,this,this.popup=null)}updateEdited(e){if(!this.container)return;e.rect&&(annotation_layer_classPrivateFieldGet(so,this)||annotation_layer_classPrivateFieldSet(so,this,{rect:this.data.rect.slice(0)}));const{rect:t,popup:i}=e;t&&annotation_layer_assertClassBrand(oo,this,_setRectEdited).call(this,t);let a=annotation_layer_classPrivateFieldGet(ro,this)?.popup||this.popup;if(!a&&i?.text){this._createPopup(i);a=annotation_layer_classPrivateFieldGet(ro,this).popup}if(a){a.updateEdited(e);if(i?.deleted){a.remove();annotation_layer_classPrivateFieldSet(ro,this,null);this.popup=null}}}resetEdited(){if(annotation_layer_classPrivateFieldGet(so,this)){annotation_layer_assertClassBrand(oo,this,_setRectEdited).call(this,annotation_layer_classPrivateFieldGet(so,this).rect);annotation_layer_classPrivateFieldGet(ro,this)?.popup.resetEdited();annotation_layer_classPrivateFieldSet(so,this,null)}}_createContainer(e){const{data:t,parent:{page:i,viewport:a}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",t.id);this instanceof WidgetAnnotationElement||this instanceof LinkAnnotationElement||(s.tabIndex=0);const{style:n}=s;n.zIndex=this.parent.zIndex;this.parent.zIndex+=2;t.alternativeText&&(s.title=t.alternativeText);t.noRotate&&s.classList.add("norotate");if(!t.rect||this instanceof PopupAnnotationElement){const{rotation:e}=t;t.hasOwnCanvas||0===e||this.setRotation(e,s);return s}const{width:r,height:o}=this;if(!e&&t.borderStyle.width>0){n.borderWidth=`${t.borderStyle.width}px`;const e=t.borderStyle.horizontalCornerRadius,i=t.borderStyle.verticalCornerRadius;if(e>0||i>0){const t=`calc(${e}px * var(--total-scale-factor)) / calc(${i}px * var(--total-scale-factor))`;n.borderRadius=t}else if(this instanceof RadioButtonWidgetAnnotationElement){const e=`calc(${r}px * var(--total-scale-factor)) / calc(${o}px * var(--total-scale-factor))`;n.borderRadius=e}switch(t.borderStyle.style){case G:n.borderStyle="solid";break;case B:n.borderStyle="dashed";break;case M:warn("Unimplemented border style: beveled");break;case I:warn("Unimplemented border style: inset");break;case T:n.borderBottomStyle="solid"}const a=t.borderColor||null;if(a){annotation_layer_classPrivateFieldSet(no,this,!0);n.borderColor=Util.makeHexColor(0|a[0],0|a[1],0|a[2])}else n.borderWidth=0}const l=Util.normalizeRect([t.rect[0],i.view[3]-t.rect[1]+i.view[1],t.rect[2],i.view[3]-t.rect[3]+i.view[1]]),{pageWidth:d,pageHeight:c,pageX:h,pageY:u}=a.rawDims;n.left=100*(l[0]-h)/d+"%";n.top=100*(l[1]-u)/c+"%";const{rotation:_}=t;if(t.hasOwnCanvas||0===_){n.width=100*r/d+"%";n.height=100*o/c+"%"}else this.setRotation(_,s);return s}setRotation(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;if(!this.data.rect)return;const{pageWidth:i,pageHeight:a}=this.parent.viewport.rawDims;let{width:s,height:n}=this;e%180!=0&&([s,n]=[n,s]);t.style.width=100*s/i+"%";t.style.height=100*n/a+"%";t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const setColor=(e,t,i)=>{const a=i.detail[e],s=a[0],n=a.slice(1);i.target.style[t]=ColorConverters[`${s}_HTML`](n);this.annotationStorage.setValue(this.data.id,{[t]:ColorConverters[`${s}_rgb`](n)})};return shadow(this,"_commonActions",{display:e=>{const{display:t}=e.detail,i=t%2==1;this.container.style.visibility=i?"hidden":"visible";this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===t||2===t})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:t}=e.detail;this.container.style.visibility=t?"hidden":"visible";this.annotationStorage.setValue(this.data.id,{noPrint:t,noView:t})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{setColor("bgColor","backgroundColor",e)},fillColor:e=>{setColor("fillColor","backgroundColor",e)},fgColor:e=>{setColor("fgColor","color",e)},textColor:e=>{setColor("textColor","color",e)},borderColor:e=>{setColor("borderColor","borderColor",e)},strokeColor:e=>{setColor("strokeColor","borderColor",e)},rotation:e=>{const t=e.detail.rotation;this.setRotation(t);this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){const i=this._commonActions;for(const a of Object.keys(t.detail)){const s=e[a]||i[a];s?.(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const i=this._commonActions;for(const[a,s]of Object.entries(t)){const n=i[a];if(n){n({detail:{[a]:s},target:e});delete t[a]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,i,a,s]=this.data.rect.map(e=>Math.fround(e));if(8===e.length){const[n,r,o,l]=e.subarray(2,6);if(a===n&&s===r&&t===o&&i===l)return}const{style:n}=this.container;let r;if(annotation_layer_classPrivateFieldGet(no,this)){const{borderColor:e,borderWidth:t}=n;n.borderWidth=0;r=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${e}" stroke-width="${t}">`];this.container.classList.add("hasBorder")}const o=a-t,l=s-i,{svgFactory:d}=this,c=d.createElement("svg");c.classList.add("quadrilateralsContainer");c.setAttribute("width",0);c.setAttribute("height",0);c.role="none";const h=d.createElement("defs");c.append(h);const u=d.createElement("clipPath"),_=`clippath_${this.data.id}`;u.setAttribute("id",_);u.setAttribute("clipPathUnits","objectBoundingBox");h.append(u);for(let i=2,a=e.length;i<a;i+=8){const a=e[i],n=e[i+1],c=e[i+2],h=e[i+3],_=d.createElement("rect"),p=(c-t)/o,g=(s-n)/l,f=(a-c)/o,m=(n-h)/l;_.setAttribute("x",p);_.setAttribute("y",g);_.setAttribute("width",f);_.setAttribute("height",m);u.append(_);r?.push(`<rect vector-effect="non-scaling-stroke" x="${p}" y="${g}" width="${f}" height="${m}"/>`)}if(annotation_layer_classPrivateFieldGet(no,this)){r.push("</g></svg>')");n.backgroundImage=r.join("")}this.container.append(c);this.container.style.clipPath=`url(#${_})`}_createPopup(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const{data:t}=this;let i,a;if(e){i={str:e.text};a=e.date}else{i=t.contentsObj;a=t.modificationDate}annotation_layer_classPrivateFieldSet(ro,this,new PopupAnnotationElement({data:{color:t.color,titleObj:t.titleObj,modificationDate:a,contentsObj:i,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}))}get hasPopupElement(){return!!(annotation_layer_classPrivateFieldGet(ro,this)||this.popup||this.data.popupRef)}get extraPopupElement(){return annotation_layer_classPrivateFieldGet(ro,this)}render(){unreachable("Abstract method `AnnotationElement.render` called")}_getElementsByName(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[];if(this._fieldObjects){const a=this._fieldObjects[e];if(a)for(const{page:e,id:s,exportValues:n}of a){if(-1===e)continue;if(s===t)continue;const a="string"==typeof n?n:null,r=document.querySelector(`[data-element-id="${s}"]`);!r||io.has(r)?i.push({id:s,exportValue:a,domElement:r}):warn(`_getElementsByName - element not allowed: ${s}`)}return i}for(const a of document.getElementsByName(e)){const{exportValue:e}=a,s=a.getAttribute("data-element-id");s!==t&&(io.has(a)&&i.push({id:s,exportValue:e,domElement:a}))}return i}show(){this.container&&(this.container.hidden=!1);this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0);this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}}function _setRectEdited(e){const{container:{style:t},data:{rect:i,rotation:a},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:n,pageX:r,pageY:o}}}}=this;i?.splice(0,4,...e);t.left=100*(e[0]-r)/s+"%";t.top=100*(n-e[3]+o)/n+"%";if(0===a){t.width=100*(e[2]-e[0])/s+"%";t.height=100*(e[3]-e[1])/n+"%"}else this.setRotation(a)}class EditorAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});this.editor=e.editor}render(){this.container.className="editorAnnotation";return this.container}createOrUpdatePopup(){const{editor:e}=this;e.hasComment&&this._createPopup(e.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(e){this.editor.comment=e;e||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id);this.container.remove();this.container=null;this.removePopup()}}var lo=new WeakSet;class LinkAnnotationElement extends AnnotationElement{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0});annotation_layer_classPrivateMethodInitSpec(this,lo);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:t}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let a=!1;if(e.url){t.addLinkAttributes(i,e.url,e.newWindow);a=!0}else if(e.action){this._bindNamedAction(i,e.action,e.overlaidText);a=!0}else if(e.attachment){annotation_layer_assertClassBrand(lo,this,_bindAttachment).call(this,i,e.attachment,e.overlaidText,e.attachmentDest);a=!0}else if(e.setOCGState){annotation_layer_assertClassBrand(lo,this,_bindSetOCGState).call(this,i,e.setOCGState,e.overlaidText);a=!0}else if(e.dest){this._bindLink(i,e.dest,e.overlaidText);a=!0}else{if(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions){this._bindJSAction(i,e);a=!0}if(e.resetForm){this._bindResetFormAction(i,e.resetForm);a=!0}else if(this.isTooltipOnly&&!a){this._bindLink(i,"");a=!0}}this.container.classList.add("linkAnnotation");if(a){this.contentElement=i;this.container.append(i)}return this.container}_bindLink(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";e.href=this.linkService.getDestinationHash(t);e.onclick=()=>{t&&this.linkService.goToDestination(t);return!1};(t||""===t)&&annotation_layer_assertClassBrand(lo,this,_setInternalLink).call(this);i&&(e.title=i)}_bindNamedAction(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";e.href=this.linkService.getAnchorUrl("");e.onclick=()=>{this.linkService.executeNamedAction(t);return!1};i&&(e.title=i);annotation_layer_assertClassBrand(lo,this,_setInternalLink).call(this)}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const a of Object.keys(t.actions)){const s=i.get(a);s&&(e[s]=()=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:a}});return!1})}t.overlaidText&&(e.title=t.overlaidText);e.onclick||(e.onclick=()=>!1);annotation_layer_assertClassBrand(lo,this,_setInternalLink).call(this)}_bindResetFormAction(e,t){const i=e.onclick;i||(e.href=this.linkService.getAnchorUrl(""));annotation_layer_assertClassBrand(lo,this,_setInternalLink).call(this);if(this._fieldObjects)e.onclick=()=>{i?.();const{fields:e,refs:a,include:s}=t,n=[];if(0!==e.length||0!==a.length){const t=new Set(a);for(const i of e){const e=this._fieldObjects[i]||[];for(const{id:i}of e)t.add(i)}for(const e of Object.values(this._fieldObjects))for(const i of e)t.has(i.id)===s&&n.push(i)}else for(const e of Object.values(this._fieldObjects))n.push(...e);const r=this.annotationStorage,o=[];for(const e of n){const{id:t}=e;o.push(t);switch(e.type){case"text":{const i=e.defaultValue||"";r.setValue(t,{value:i});window.updateAngularFormValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;r.setValue(t,{value:i});window.updateAngularFormValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";r.setValue(t,{value:i});window.updateAngularFormValue(t,{value:i});break}default:continue}const i=document.querySelector(`[data-element-id="${t}"]`);i&&(io.has(i)?i.dispatchEvent(new Event("resetform")):warn(`_bindResetFormAction - element not allowed: ${t}`))}this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}});return!1};else{warn('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.');i||(e.onclick=()=>!1)}}}function _setInternalLink(){this.container.setAttribute("data-internal-link","")}function _bindAttachment(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;e.href=this.linkService.getAnchorUrl("");t.description?e.title=t.description:i&&(e.title=i);e.onclick=()=>{this.downloadManager?.openOrDownloadData(t.content,t.filename,a);return!1};annotation_layer_assertClassBrand(lo,this,_setInternalLink).call(this)}function _bindSetOCGState(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";e.href=this.linkService.getAnchorUrl("");e.onclick=()=>{this.linkService.executeSetOCGState(t);return!1};i&&(e.title=i);annotation_layer_assertClassBrand(lo,this,_setInternalLink).call(this)}class TextAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg";e.setAttribute("data-l10n-id","pdfjs-text-annotation-type");e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name}));if(!this.data.popupRef&&this.hasPopupData){this.hasOwnCommentButton=!0;this._createPopup()}this.container.append(e);return this.container}}class WidgetAnnotationElement extends AnnotationElement{render(){return this.container}showElementAndHideCanvas(e){if(this.data.hasOwnCanvas){"CANVAS"===e.previousSibling?.nodeName&&(e.previousSibling.hidden=!0);e.hidden=!1}}_getKeyModifier(e){return FeatureTest.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,i,a,s){i.includes("mouse")?e.addEventListener(i,e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:s(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})}):e.addEventListener(i,e=>{if("blur"===i){if(!t.focused)return;t.focused=!1}else if("focus"===i){if(t.focused)return;t.focused=!0}s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:s(e)}})})}_setEventListeners(e,t,i,a){for(const[s,n]of i)if("Action"===n||this.data.actions?.[n]){"Focus"!==n&&"Blur"!==n||(t||={focused:!1});this._setEventListener(e,t,s,n,a);"Focus"!==n||this.data.actions?.Blur?"Blur"!==n||this.data.actions?.Focus||this._setEventListener(e,t,"focus","Focus",null):this._setEventListener(e,t,"blur","Blur",null)}}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=null===t?"transparent":Util.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,a=this.data.defaultAppearanceData.fontSize||9,s=e.style;let r;const roundToOneDecimal=e=>Math.round(10*e)/10;if(this.data.multiLine){const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(n*a))||1);r=Math.min(a,roundToOneDecimal(t/n))}else{const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);r=Math.min(a,roundToOneDecimal(e/n))}s.fontSize=`calc(${r}px * var(--total-scale-factor))`;s.color=Util.makeHexColor(i[0],i[1],i[2]);null!==this.data.textAlignment&&(s.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required");e.setAttribute("aria-required",t)}}class TextWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue})}setPropertyOnSiblings(e,t,i,a){const s=this.annotationStorage;for(const n of this._getElementsByName(e.name,e.id)){n.domElement&&(n.domElement[t]=i);s.setValue(n.id,{[a]:i})}}render(){const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){const a=window.getFormValueFromAngular(this.data.fieldName),s=e.getValue(t,{value:this.data.fieldValue}),n=a.value?a:s;if(a!==s){e.setValue(t,{value:a.value});n.formattedValue=a.value}let r=n.value||"";const o=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;o&&r.length>o&&(r=r.slice(0,o));let l=n.formattedValue||this.data.textContent?.join("\n")||null;l&&this.data.comb&&(l=l.replaceAll(/\s+/g,""));const d={userValue:r,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};if(this.data.multiLine){i=document.createElement("textarea");i.textContent=l??r;this.data.doNotScroll&&(i.style.overflowY="hidden")}else{i=document.createElement("input");i.type=this.data.password?"password":"text";i.setAttribute("value",l??r);this.data.doNotScroll&&(i.style.overflowX="hidden")}this.data.hasOwnCanvas&&(i.hidden=!0);io.add(i);this.contentElement=i;i.setAttribute("data-element-id",t);i.disabled=this.data.readOnly;i.name=this.data.fieldName;i.tabIndex=0;const{datetimeFormat:c,datetimeType:h,timeStep:u}=this.data,_=!!h&&this.enableScripting;c&&(i.title=c);this._setRequired(i,this.data.required);o&&(i.maxLength=o);i.addEventListener("input",a=>{e.setValue(t,{value:a.target.value});window.updateAngularFormValue(t,{value:a.target.value});this.setPropertyOnSiblings(i,"value",a.target.value,"value");d.formattedValue=null});i.addEventListener("resetform",e=>{const t=this.data.defaultFieldValue??"";i.value=d.userValue=t;d.formattedValue=null});let blurListener=e=>{const{formattedValue:t}=d;null!=t&&(e.target.value=t);e.target.scrollLeft=0};window.registerAcroformField(t,i,n.value,void 0,this.data.fieldValue);i.addEventListener("updateFromAngular",i=>{d.formattedValue=null;e.setValue(t,{value:i.detail})});if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",e=>{if(d.focused)return;const{target:t}=e;if(_){t.type=h;u&&(t.step=u)}if(d.userValue){const e=d.userValue;if(_)if("time"===h){const i=new Date(e),a=[i.getHours(),i.getMinutes(),i.getSeconds()];t.value=a.map(e=>e.toString().padStart(2,"0")).join(":")}else t.value=new Date(e-ao).toISOString().split("date"===h?"T":".",1)[0];else t.value=e}d.lastCommittedValue=t.value;d.commitKey=1;this.data.actions?.Focus||(d.focused=!0)});i.addEventListener("updatefromsandbox",i=>{this.showElementAndHideCanvas(i.target);const a={value(i){d.userValue=i.detail.value??"";if(!_){e.setValue(t,{value:d.userValue.toString()});window.updateAngularFormValue(t,{value:d.userValue.toString()})}i.target.value=d.userValue},formattedValue(i){const{formattedValue:a}=i.detail;d.formattedValue=a;null!=a&&i.target!==document.activeElement&&(i.target.value=a);const s={formattedValue:a};_&&(s.value=a);e.setValue(t,s);window.updateAngularFormValue(t,{formattedValue:a})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:i=>{const{charLimit:a}=i.detail,{target:s}=i;if(0===a){s.removeAttribute("maxLength");return}s.setAttribute("maxLength",a);let n=d.userValue;if(n&&!(n.length<=a)){n=n.slice(0,a);s.value=d.userValue=n;e.setValue(t,{value:n});window.updateAngularFormValue(t,{value:n});this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:n,willCommit:!0,commitKey:1,selStart:s.selectionStart,selEnd:s.selectionEnd}})}}};this._dispatchEventFromSandbox(a,i)});i.addEventListener("keydown",e=>{d.commitKey=1;let i=-1;"Escape"===e.key?i=0:"Enter"!==e.key||this.data.multiLine?"Tab"===e.key&&(d.commitKey=3):i=2;if(-1===i)return;const{value:a}=e.target;if(d.lastCommittedValue!==a){d.lastCommittedValue=a;d.userValue=a;this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:a,willCommit:!0,commitKey:i,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}})}});const a=blurListener;blurListener=null;i.addEventListener("blur",e=>{if(!d.focused)return;this.data.actions?.Blur||(d.focused=!1);const{target:i}=e;let{value:s}=i;if(_){if(s&&"time"===h){const e=s.split(":").map(e=>parseInt(e,10));s=new Date(2e3,0,1,e[0],e[1],e[2]||0).valueOf();i.step=""}else{s.includes("T")||(s=`${s}T00:00`);s=new Date(s).valueOf()}i.type="text"}d.userValue=s;d.lastCommittedValue!==s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,willCommit:!0,commitKey:d.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}});a(e)});this.data.actions?.Keystroke&&i.addEventListener("beforeinput",e=>{d.lastCommittedValue=null;const{data:i,target:a}=e,{value:s,selectionStart:n,selectionEnd:r}=a;let o=n,l=r;switch(e.inputType){case"deleteWordBackward":{const e=s.substring(0,n).match(/\w*[^\w]*$/);e&&(o-=e[0].length);break}case"deleteWordForward":{const e=s.substring(n).match(/^[^\w]*\w*/);e&&(l+=e[0].length);break}case"deleteContentBackward":n===r&&(o-=1);break;case"deleteContentForward":n===r&&(l+=1)}e.preventDefault();this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,change:i||"",willCommit:!1,selStart:o,selEnd:l}})});this._setEventListeners(i,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],e=>e.target.value)}blurListener&&i.addEventListener("blur",blurListener);if(this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/o;i.classList.add("comb");i.style.letterSpacing=`calc(${e}px * var(--total-scale-factor) - 1ch)`}}else{i=document.createElement("div");i.textContent=this.data.fieldValue;i.style.verticalAlign="middle";i.style.display="table-cell";this.data.hasOwnCanvas&&(i.hidden=!0)}this._setTextStyle(i);this._setBackgroundColor(i);this._setDefaultPropertiesFromJS(i);this.container.append(i);return this.container}}class SignatureWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,i=t.id,a=window.getFormValueFromAngular(this.data.fieldName),s=e.getValue(i,{value:t.exportValue===t.fieldValue}).value;let n;a.value&&(n=!0===a.value||a.value===t.exportValue);let r=void 0!==n?n:s,o=!1;if("string"==typeof r){r=r===t.exportValue;e.setValue(i,{value:r});o=!0}else if(void 0!==a?.value&&a.value!==s){r=!0===a.value||a.value===t.exportValue?t.exportValue:void 0;e.setValue(i,{value:r})}this.container.classList.add("buttonWidgetAnnotation","checkBox");const l=document.createElement("input");io.add(l);l.setAttribute("data-element-id",i);l.disabled=t.readOnly;this._setRequired(l,this.data.required);l.type="checkbox";l.name=t.fieldName;r&&l.setAttribute("checked",!0);l.setAttribute("exportValue",t.exportValue);l.tabIndex=0;l.addEventListener("change",a=>{const{name:s,checked:n}=a.target;for(const a of this._getElementsByName(s,i)){const s=n&&a.exportValue===t.exportValue;a.domElement&&(a.domElement.checked=s);e.setValue(a.id,{value:s});window.updateAngularFormValue(i,{value:s})}e.setValue(i,{value:n});window.updateAngularFormValue(i,{value:n})});l.addEventListener("resetform",e=>{const i=t.defaultFieldValue||"Off";e.target.checked=i===t.exportValue});window.registerAcroformField(i,l,r?t.exportValue:void 0,void 0,this.data.fieldValue);l.addEventListener("updateFromAngular",t=>e.setValue(i,{value:t.detail}));o&&window.updateAngularFormValue(i,{value:r});if(this.enableScripting&&this.hasJSActions){l.addEventListener("updatefromsandbox",t=>{const a={value(t){t.target.checked="Off"!==t.detail.value;e.setValue(i,{value:t.target.checked});window.updateAngularFormValue(i,{value:t.target.value})}};this._dispatchEventFromSandbox(a,t)});this._setEventListeners(l,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],e=>e.target.checked)}this._setBackgroundColor(l);this._setDefaultPropertiesFromJS(l);this.container.append(l);return this.container}}class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,i=t.id,a=window.getFormValueFromAngular(this.data.fieldName),s=t.fieldValue===t.buttonValue?t.buttonValue:void 0,n=e.getValue(i,{value:s}).value;let r=a.value??n;if("string"==typeof r||a!==n){r=r===t.buttonValue;e.setValue(i,{value:r})}else r&&window.updateAngularFormValue(i,{value:t.buttonValue});if(r)for(const a of this._getElementsByName(t.fieldName,i))e.setValue(a.id,{value:!1});const o=document.createElement("input");io.add(o);o.setAttribute("data-element-id",i);o.disabled=t.readOnly;this._setRequired(o,this.data.required);o.type="radio";o.name=t.fieldName;r&&o.setAttribute("checked",!0);o.tabIndex=0;o.addEventListener("change",t=>{const{name:a,checked:s}=t.target;for(const t of this._getElementsByName(a,i)){e.setValue(t.id,{value:!1});window.updateAngularFormValue(t.id,{value:!1})}e.setValue(i,{value:s});window.updateAngularFormValue(i,{value:s})});o.addEventListener("resetform",e=>{const i=t.defaultFieldValue;e.target.checked=null!=i&&i===t.buttonValue});window.registerAcroformField(i,o,r?t.buttonValue:void 0,t.buttonValue,this.data.fieldValue);o.addEventListener("updateFromAngular",t=>e.setValue(i,{value:t.detail}));if(this.enableScripting&&this.hasJSActions){const a=t.buttonValue;o.addEventListener("updatefromsandbox",t=>{const s={value:t=>{const s=a===t.detail.value;for(const a of this._getElementsByName(t.target.name)){const t=s&&a.id===i;a.domElement&&(a.domElement.checked=t);e.setValue(a.id,{value:t});window.updateAngularFormValue(i,{value:t})}}};this._dispatchEventFromSandbox(s,t)});this._setEventListeners(o,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],e=>e.target.checked)}this._setBackgroundColor(o);this._setDefaultPropertiesFromJS(o);this.container.append(o);return this.container}}class PushButtonWidgetAnnotationElement extends LinkAnnotationElement{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;if(this.enableScripting&&this.hasJSActions&&t){this._setDefaultPropertiesFromJS(t);t.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({},e)})}return e}}class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,i=window.getFormValueFromAngular(this.data.fieldName),a=e.getValue(t,{value:this.data.fieldValue}),s=i.value?i:a;i!==a&&e.setValue(t,{value:i.value});const n=document.createElement("select");io.add(n);n.setAttribute("data-element-id",t);n.disabled=this.data.readOnly;this._setRequired(n,this.data.required);n.name=this.data.fieldName;n.tabIndex=0;let r=this.data.combo&&this.data.options.length>0;if(!this.data.combo){n.size=this.data.options.length;this.data.multiSelect&&(n.multiple=!0)}n.addEventListener("resetform",e=>{const t=this.data.defaultFieldValue;for(const e of n.options)e.selected=e.value===t});const fixDisplayValue=(e,t)=>{const i=t.replaceAll(" "," ");e.textContent=i;i!==t&&e.setAttribute("display-value",t)};for(const e of this.data.options){const t=document.createElement("option");fixDisplayValue(t,e.displayValue);t.value=e.exportValue;if(s.value.includes(e.exportValue)){t.setAttribute("selected",!0);r=!1}n.append(t)}let o=null;if(r){const e=document.createElement("option");e.value=" ";e.setAttribute("hidden",!0);e.setAttribute("selected",!0);n.prepend(e);o=()=>{e.remove();n.removeEventListener("input",o);o=null};n.addEventListener("input",o)}const getValue=e=>{const t=e?"value":"textContent",{options:i,multiple:a}=n;return a?Array.prototype.filter.call(i,e=>e.selected).map(e=>e[t]):-1===i.selectedIndex?null:i[i.selectedIndex][t]};let l=getValue(!1);const getItems=e=>{const t=e.target.options;return Array.prototype.map.call(t,e=>({displayValue:e.getAttribute("display-value")||e.textContent,exportValue:e.value}))};window.registerAcroformField(t,n,l,void 0,this.data.fieldValue);n.addEventListener("updateFromAngular",i=>e.setValue(t,{value:i.detail}));if(this.enableScripting&&this.hasJSActions){n.addEventListener("updatefromsandbox",i=>{const a={value(i){o?.();const a=i.detail.value,s=new Set(Array.isArray(a)?a:[a]);for(const e of n.options)e.selected=s.has(e.value);e.setValue(t,{value:getValue(!0)});l=getValue(!1);window.updateAngularFormValue(t,{value:l})},multipleSelection(e){n.multiple=!0},remove(i){const a=n.options,s=i.detail.remove;a[s].selected=!1;n.remove(s);if(a.length>0){-1===Array.prototype.findIndex.call(a,e=>e.selected)&&(a[0].selected=!0)}e.setValue(t,{value:getValue(!0),items:getItems(i)});l=getValue(!1)},clear(i){for(;0!==n.length;)n.remove(0);e.setValue(t,{value:null,items:[]});l=getValue(!1);window.updateAngularFormValue(t,{value:l})},insert(i){const{index:a,displayValue:s,exportValue:r}=i.detail.insert,o=n.children[a],d=document.createElement("option");fixDisplayValue(d,s);d.value=r;o?o.before(d):n.append(d);e.setValue(t,{value:getValue(!0),items:getItems(i)});l=getValue(!1);window.updateAngularFormValue(t,{value:l})},items(i){const{items:a}=i.detail;for(;0!==n.length;)n.remove(0);for(const e of a){const{displayValue:t,exportValue:i}=e,a=document.createElement("option");fixDisplayValue(a,t);a.value=i;n.append(a)}n.options.length>0&&(n.options[0].selected=!0);e.setValue(t,{value:getValue(!0),items:getItems(i)});l=getValue(!1);window.updateAngularFormValue(t,{value:l})},indices(i){const a=new Set(i.detail.indices);for(const e of i.target.options)e.selected=a.has(e.index);e.setValue(t,{value:getValue(!0)});l=getValue(!1);window.updateAngularFormValue(t,{value:l})},editable(e){e.target.disabled=!e.detail.editable}};this._dispatchEventFromSandbox(a,i)});n.addEventListener("input",i=>{const a=getValue(!0),s=getValue(!1);e.setValue(t,{value:a});window.updateAngularFormValue(t,{value:a});i.preventDefault();this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:l,change:s,changeEx:a,willCommit:!1,commitKey:1,keyDown:!1}})});this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],e=>e.target.value)}else n.addEventListener("input",function(i){e.setValue(t,{value:getValue(!0)});window.updateAngularFormValue(t,{value:getValue(!0)})});this.data.combo&&this._setTextStyle(n);this._setBackgroundColor(n);this._setDefaultPropertiesFromJS(n);this.container.append(n);return this.container}}var co=new WeakSet;class PopupAnnotationElement extends AnnotationElement{constructor(e){const{data:t,elements:i,parent:a}=e,s=!!a._commentManager;super(e,{isRenderable:!s&&AnnotationElement._hasPopupData(t)});annotation_layer_classPrivateMethodInitSpec(this,co);this.elements=i;if(s&&AnnotationElement._hasPopupData(t)){const e=this.popup=annotation_layer_assertClassBrand(co,this,_createPopup).call(this);for(const t of i)t.popup=e}else this.popup=null}render(){const{container:e}=this;e.classList.add("popupAnnotation");e.role="comment";const t=this.popup=annotation_layer_assertClassBrand(co,this,_createPopup).call(this),i=[];for(const e of this.elements){e.popup=t;e.container.ariaHasPopup="dialog";i.push(e.data.id);e.addHighlightArea()}this.container.setAttribute("aria-controls",i.map(e=>`${X}${e}`).join(","));return this.container}}function _createPopup(){return new PopupElement({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})}var ho=new WeakMap,uo=new WeakMap,_o=new WeakMap,po=new WeakMap,go=new WeakMap,fo=new WeakMap,mo=new WeakMap,vo=new WeakMap,Po=new WeakMap,wo=new WeakMap,Fo=new WeakMap,bo=new WeakMap,yo=new WeakMap,So=new WeakMap,Co=new WeakMap,xo=new WeakMap,ko=new WeakMap,Eo=new WeakMap,Ao=new WeakMap,Go=new WeakMap,Bo=new WeakMap,Mo=new WeakMap,Io=new WeakMap,To=new WeakMap,Do=new WeakMap,Lo=new WeakMap,Ro=new WeakSet;class PopupElement{constructor(e){let{container:t,color:i,elements:a,titleObj:s,modificationDate:n,contentsObj:r,richText:o,parent:l,rect:d,parentRect:c,open:h,commentManager:u=null}=e;annotation_layer_classPrivateMethodInitSpec(this,Ro);annotation_layer_classPrivateFieldInitSpec(this,ho,null);annotation_layer_classPrivateFieldInitSpec(this,uo,annotation_layer_assertClassBrand(Ro,this,annotation_layer_keyDown).bind(this));annotation_layer_classPrivateFieldInitSpec(this,_o,annotation_layer_assertClassBrand(Ro,this,_hide).bind(this));annotation_layer_classPrivateFieldInitSpec(this,po,annotation_layer_assertClassBrand(Ro,this,_show).bind(this));annotation_layer_classPrivateFieldInitSpec(this,go,annotation_layer_assertClassBrand(Ro,this,_toggle).bind(this));annotation_layer_classPrivateFieldInitSpec(this,fo,null);annotation_layer_classPrivateFieldInitSpec(this,mo,null);annotation_layer_classPrivateFieldInitSpec(this,vo,null);annotation_layer_classPrivateFieldInitSpec(this,Po,null);annotation_layer_classPrivateFieldInitSpec(this,wo,null);annotation_layer_classPrivateFieldInitSpec(this,Fo,null);annotation_layer_classPrivateFieldInitSpec(this,bo,null);annotation_layer_classPrivateFieldInitSpec(this,yo,!1);annotation_layer_classPrivateFieldInitSpec(this,So,null);annotation_layer_classPrivateFieldInitSpec(this,Co,null);annotation_layer_classPrivateFieldInitSpec(this,xo,null);annotation_layer_classPrivateFieldInitSpec(this,ko,null);annotation_layer_classPrivateFieldInitSpec(this,Eo,null);annotation_layer_classPrivateFieldInitSpec(this,Ao,null);annotation_layer_classPrivateFieldInitSpec(this,Go,null);annotation_layer_classPrivateFieldInitSpec(this,Bo,null);annotation_layer_classPrivateFieldInitSpec(this,Mo,null);annotation_layer_classPrivateFieldInitSpec(this,Io,null);annotation_layer_classPrivateFieldInitSpec(this,To,!1);annotation_layer_classPrivateFieldInitSpec(this,Do,null);annotation_layer_classPrivateFieldInitSpec(this,Lo,null);annotation_layer_classPrivateFieldSet(mo,this,t);annotation_layer_classPrivateFieldSet(Mo,this,s);annotation_layer_classPrivateFieldSet(vo,this,r);annotation_layer_classPrivateFieldSet(Bo,this,o);annotation_layer_classPrivateFieldSet(Fo,this,l);annotation_layer_classPrivateFieldSet(fo,this,i);annotation_layer_classPrivateFieldSet(Go,this,d);annotation_layer_classPrivateFieldSet(bo,this,c);annotation_layer_classPrivateFieldSet(wo,this,a);annotation_layer_classPrivateFieldSet(ho,this,u);annotation_layer_classPrivateFieldSet(Do,this,a[0]);annotation_layer_classPrivateFieldSet(Po,this,PDFDateString.toDateObject(n));this.trigger=a.flatMap(e=>e.getElementsToTriggerPopup());if(!u){annotation_layer_assertClassBrand(Ro,this,_addEventListeners).call(this);annotation_layer_classPrivateFieldGet(mo,this).hidden=!0;h&&annotation_layer_assertClassBrand(Ro,this,_toggle).call(this)}}renderCommentButton(){if(annotation_layer_classPrivateFieldGet(ko,this)){annotation_layer_classPrivateFieldGet(ko,this).parentNode||annotation_layer_classPrivateFieldGet(Do,this).container.after(annotation_layer_classPrivateFieldGet(ko,this));return}annotation_layer_classPrivateFieldGet(Eo,this)||annotation_layer_assertClassBrand(Ro,this,_setCommentButtonPosition).call(this);if(!annotation_layer_classPrivateFieldGet(Eo,this))return;const{signal:e}=annotation_layer_classPrivateFieldSet(Co,this,new AbortController),t=annotation_layer_classPrivateFieldGet(Do,this).hasOwnCommentButton,togglePopup=()=>{annotation_layer_classPrivateFieldGet(ho,this).toggleCommentPopup(this,!0,void 0,!t)},showPopup=()=>{annotation_layer_classPrivateFieldGet(ho,this).toggleCommentPopup(this,!1,!0,!t)},hidePopup=()=>{annotation_layer_classPrivateFieldGet(ho,this).toggleCommentPopup(this,!1,!1)};if(t){annotation_layer_classPrivateFieldSet(ko,this,annotation_layer_classPrivateFieldGet(Do,this).container);for(const t of this.trigger){t.ariaHasPopup="dialog";t.ariaControls="commentPopup";t.addEventListener("keydown",annotation_layer_classPrivateFieldGet(uo,this),{signal:e});t.addEventListener("click",togglePopup,{signal:e});t.addEventListener("pointerenter",showPopup,{signal:e});t.addEventListener("pointerleave",hidePopup,{signal:e});t.classList.add("popupTriggerArea")}}else{const t=annotation_layer_classPrivateFieldSet(ko,this,document.createElement("button"));t.className="annotationCommentButton";const i=annotation_layer_classPrivateFieldGet(Do,this).container;t.style.zIndex=i.style.zIndex+1;t.tabIndex=0;t.ariaHasPopup="dialog";t.ariaControls="commentPopup";t.setAttribute("data-l10n-id","pdfjs-show-comment-button");annotation_layer_assertClassBrand(Ro,this,_updateColor).call(this);annotation_layer_assertClassBrand(Ro,this,_updateCommentButtonPosition).call(this);t.addEventListener("keydown",annotation_layer_classPrivateFieldGet(uo,this),{signal:e});t.addEventListener("click",togglePopup,{signal:e});t.addEventListener("pointerenter",showPopup,{signal:e});t.addEventListener("pointerleave",hidePopup,{signal:e});i.after(t)}}get commentButtonColor(){const{color:e,opacity:t}=annotation_layer_classPrivateFieldGet(Do,this).commentData;return e?annotation_layer_classPrivateFieldGet(Fo,this)._commentManager.makeCommentColor(e,t):null}focusCommentButton(){setTimeout(()=>{annotation_layer_classPrivateFieldGet(ko,this)?.focus()},0)}getData(){const{richText:e,color:t,opacity:i,creationDate:a,modificationDate:s}=annotation_layer_classPrivateFieldGet(Do,this).commentData;return{contentsObj:{str:this.comment},richText:e,color:t,opacity:i,creationDate:a,modificationDate:s}}get elementBeforePopup(){return annotation_layer_classPrivateFieldGet(ko,this)}get comment(){annotation_layer_classPrivateFieldGet(Lo,this)||annotation_layer_classPrivateFieldSet(Lo,this,annotation_layer_classPrivateFieldGet(Do,this).commentText);return annotation_layer_classPrivateFieldGet(Lo,this)}set comment(e){e!==this.comment&&(annotation_layer_classPrivateFieldGet(Do,this).commentText=annotation_layer_classPrivateFieldSet(Lo,this,e))}focus(){annotation_layer_classPrivateFieldGet(Do,this).container?.focus()}get parentBoundingClientRect(){return annotation_layer_classPrivateFieldGet(Do,this).layer.getBoundingClientRect()}setCommentButtonStates(e){let{selected:t,hasPopup:i}=e;if(annotation_layer_classPrivateFieldGet(ko,this)){annotation_layer_classPrivateFieldGet(ko,this).classList.toggle("selected",t);annotation_layer_classPrivateFieldGet(ko,this).ariaExpanded=i}}setSelectedCommentButton(e){annotation_layer_classPrivateFieldGet(ko,this).classList.toggle("selected",e)}get commentPopupPosition(){if(annotation_layer_classPrivateFieldGet(Ao,this))return annotation_layer_classPrivateFieldGet(Ao,this);const{x:e,y:t,height:i}=annotation_layer_classPrivateFieldGet(ko,this).getBoundingClientRect(),{x:a,y:s,width:n,height:r}=annotation_layer_classPrivateFieldGet(Do,this).layer.getBoundingClientRect();return[(e-a)/n,(t+i-s)/r]}set commentPopupPosition(e){annotation_layer_classPrivateFieldSet(Ao,this,e)}hasDefaultPopupPosition(){return null===annotation_layer_classPrivateFieldGet(Ao,this)}get commentButtonPosition(){return annotation_layer_classPrivateFieldGet(Eo,this)}get commentButtonWidth(){return annotation_layer_classPrivateFieldGet(ko,this).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){const[t,i]=annotation_layer_classPrivateFieldGet(Ao,this)||this.commentButtonPosition.map(e=>e/100),a=this.parentBoundingClientRect,{x:s,y:n,width:r,height:o}=a;annotation_layer_classPrivateFieldGet(ho,this).showDialog(null,this,s+t*r,n+i*o,{...e,parentDimensions:a})}render(){if(annotation_layer_classPrivateFieldGet(So,this))return;const e=annotation_layer_classPrivateFieldSet(So,this,document.createElement("div"));e.className="popup";if(annotation_layer_classPrivateFieldGet(fo,this)){const t=e.style.outlineColor=Util.makeHexColor(...annotation_layer_classPrivateFieldGet(fo,this));e.style.backgroundColor=`color-mix(in srgb, ${t} 30%, white)`}const t=document.createElement("span");t.className="header";if(annotation_layer_classPrivateFieldGet(Mo,this)?.str){const e=document.createElement("span");e.className="title";t.append(e);({dir:e.dir,str:e.textContent}=annotation_layer_classPrivateFieldGet(Mo,this))}e.append(t);if(annotation_layer_classPrivateFieldGet(Po,this)){const e=document.createElement("time");e.className="popupDate";e.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string");e.setAttribute("data-l10n-args",JSON.stringify({dateObj:annotation_layer_classPrivateFieldGet(Po,this).valueOf()}));e.dateTime=annotation_layer_classPrivateFieldGet(Po,this).toISOString();t.append(e)}renderRichText({html:annotation_layer_classPrivateGetter(Ro,this,_get_html)||annotation_layer_classPrivateFieldGet(vo,this).str,dir:annotation_layer_classPrivateFieldGet(vo,this)?.dir,className:"popupContent"},e);annotation_layer_classPrivateFieldGet(mo,this).append(e)}updateEdited(e){let{rect:t,popup:i,deleted:a}=e;if(annotation_layer_classPrivateFieldGet(ho,this)){if(a){this.remove();annotation_layer_classPrivateFieldSet(Lo,this,null)}else if(i)if(i.deleted)this.remove();else{annotation_layer_assertClassBrand(Ro,this,_updateColor).call(this);annotation_layer_classPrivateFieldSet(Lo,this,i.text)}if(t){annotation_layer_classPrivateFieldSet(Eo,this,null);annotation_layer_assertClassBrand(Ro,this,_setCommentButtonPosition).call(this);annotation_layer_assertClassBrand(Ro,this,_updateCommentButtonPosition).call(this)}}else if(a||i?.deleted)this.remove();else{annotation_layer_assertClassBrand(Ro,this,_addEventListeners).call(this);annotation_layer_classPrivateFieldGet(Io,this)||annotation_layer_classPrivateFieldSet(Io,this,{contentsObj:annotation_layer_classPrivateFieldGet(vo,this),richText:annotation_layer_classPrivateFieldGet(Bo,this)});t&&annotation_layer_classPrivateFieldSet(xo,this,null);if(i&&i.text){annotation_layer_classPrivateFieldSet(Bo,this,annotation_layer_assertClassBrand(Ro,this,_makePopupContent).call(this,i.text));annotation_layer_classPrivateFieldSet(Po,this,PDFDateString.toDateObject(i.date));annotation_layer_classPrivateFieldSet(vo,this,null)}annotation_layer_classPrivateFieldGet(So,this)?.remove();annotation_layer_classPrivateFieldSet(So,this,null)}}resetEdited(){if(annotation_layer_classPrivateFieldGet(Io,this)){({contentsObj:_toSetter(annotation_layer_classPrivateFieldSet,[vo,this])._,richText:_toSetter(annotation_layer_classPrivateFieldSet,[Bo,this])._}=annotation_layer_classPrivateFieldGet(Io,this));annotation_layer_classPrivateFieldSet(Io,this,null);annotation_layer_classPrivateFieldGet(So,this)?.remove();annotation_layer_classPrivateFieldSet(So,this,null);annotation_layer_classPrivateFieldSet(xo,this,null)}}remove(){annotation_layer_classPrivateFieldGet(Co,this)?.abort();annotation_layer_classPrivateFieldSet(Co,this,null);annotation_layer_classPrivateFieldGet(So,this)?.remove();annotation_layer_classPrivateFieldSet(So,this,null);annotation_layer_classPrivateFieldSet(To,this,!1);annotation_layer_classPrivateFieldSet(yo,this,!1);annotation_layer_classPrivateFieldGet(ko,this)?.remove();annotation_layer_classPrivateFieldSet(ko,this,null);if(this.trigger)for(const e of this.trigger)e.classList.remove("popupTriggerArea")}forceHide(){annotation_layer_classPrivateFieldSet(To,this,this.isVisible);annotation_layer_classPrivateFieldGet(To,this)&&(annotation_layer_classPrivateFieldGet(mo,this).hidden=!0)}maybeShow(){if(!annotation_layer_classPrivateFieldGet(ho,this)){annotation_layer_assertClassBrand(Ro,this,_addEventListeners).call(this);if(annotation_layer_classPrivateFieldGet(To,this)){annotation_layer_classPrivateFieldGet(So,this)||annotation_layer_assertClassBrand(Ro,this,_show).call(this);annotation_layer_classPrivateFieldSet(To,this,!1);annotation_layer_classPrivateFieldGet(mo,this).hidden=!1}}}get isVisible(){return!annotation_layer_classPrivateFieldGet(ho,this)&&!1===annotation_layer_classPrivateFieldGet(mo,this).hidden}}function _addEventListeners(){if(annotation_layer_classPrivateFieldGet(Co,this))return;annotation_layer_classPrivateFieldSet(Co,this,new AbortController);const{signal:e}=annotation_layer_classPrivateFieldGet(Co,this);for(const t of this.trigger){t.addEventListener("click",annotation_layer_classPrivateFieldGet(go,this),{signal:e});t.addEventListener("pointerenter",annotation_layer_classPrivateFieldGet(po,this),{signal:e});t.addEventListener("pointerleave",annotation_layer_classPrivateFieldGet(_o,this),{signal:e});t.classList.add("popupTriggerArea")}for(const t of annotation_layer_classPrivateFieldGet(wo,this))t.container?.addEventListener("keydown",annotation_layer_classPrivateFieldGet(uo,this),{signal:e})}function _setCommentButtonPosition(){const e=annotation_layer_classPrivateFieldGet(wo,this).find(e=>e.hasCommentButton);e&&annotation_layer_classPrivateFieldSet(Eo,this,e._normalizePoint(e.commentButtonPosition))}function _updateCommentButtonPosition(){if(annotation_layer_classPrivateFieldGet(Do,this).extraPopupElement&&!annotation_layer_classPrivateFieldGet(Do,this).editor)return;annotation_layer_classPrivateFieldGet(ko,this)||this.renderCommentButton();const[e,t]=annotation_layer_classPrivateFieldGet(Eo,this),{style:i}=annotation_layer_classPrivateFieldGet(ko,this);i.left=`calc(${e}%)`;i.top=`calc(${t}% - var(--comment-button-dim))`}function _updateColor(){if(!annotation_layer_classPrivateFieldGet(Do,this).extraPopupElement){annotation_layer_classPrivateFieldGet(ko,this)||this.renderCommentButton();annotation_layer_classPrivateFieldGet(ko,this).style.backgroundColor=this.commentButtonColor||""}}function _get_html(e){const t=annotation_layer_classPrivateFieldGet(Bo,e),i=annotation_layer_classPrivateFieldGet(vo,e);return!t?.str||i?.str&&i.str!==t.str?null:annotation_layer_classPrivateFieldGet(Bo,e).html||null}function _get_fontSize(e){return annotation_layer_classPrivateGetter(Ro,e,_get_html)?.attributes?.style?.fontSize||0}function _get_fontColor(e){return annotation_layer_classPrivateGetter(Ro,e,_get_html)?.attributes?.style?.color||null}function _makePopupContent(e){const t=[],i={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},a={style:{color:annotation_layer_classPrivateGetter(Ro,this,_get_fontColor),fontSize:annotation_layer_classPrivateGetter(Ro,this,_get_fontSize)?`calc(${annotation_layer_classPrivateGetter(Ro,this,_get_fontSize)}px * var(--total-scale-factor))`:""}};for(const i of e.split("\n"))t.push({name:"span",value:i,attributes:a});return i}function annotation_layer_keyDown(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||("Enter"===e.key||"Escape"===e.key&&annotation_layer_classPrivateFieldGet(yo,this))&&annotation_layer_assertClassBrand(Ro,this,_toggle).call(this)}function _setPosition(){if(null!==annotation_layer_classPrivateFieldGet(xo,this))return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:i,pageX:a,pageY:s}}}=annotation_layer_classPrivateFieldGet(Fo,this);let n=!!annotation_layer_classPrivateFieldGet(bo,this),r=annotation_layer_classPrivateFieldGet(n?bo:Go,this);for(const e of annotation_layer_classPrivateFieldGet(wo,this))if(!r||null!==Util.intersect(e.data.rect,r)){r=e.data.rect;n=!0;break}const o=Util.normalizeRect([r[0],e[3]-r[1]+e[1],r[2],e[3]-r[3]+e[1]]),l=n?r[2]-r[0]+5:0,d=o[0]+l,c=o[1];annotation_layer_classPrivateFieldSet(xo,this,[100*(d-a)/t,100*(c-s)/i]);const{style:h}=annotation_layer_classPrivateFieldGet(mo,this);h.left=`${annotation_layer_classPrivateFieldGet(xo,this)[0]}%`;h.top=`${annotation_layer_classPrivateFieldGet(xo,this)[1]}%`}function _toggle(){if(annotation_layer_classPrivateFieldGet(ho,this))annotation_layer_classPrivateFieldGet(ho,this).toggleCommentPopup(this,!1);else{annotation_layer_classPrivateFieldSet(yo,this,!annotation_layer_classPrivateFieldGet(yo,this));if(annotation_layer_classPrivateFieldGet(yo,this)){annotation_layer_assertClassBrand(Ro,this,_show).call(this);annotation_layer_classPrivateFieldGet(mo,this).addEventListener("click",annotation_layer_classPrivateFieldGet(go,this));annotation_layer_classPrivateFieldGet(mo,this).addEventListener("keydown",annotation_layer_classPrivateFieldGet(uo,this))}else{annotation_layer_assertClassBrand(Ro,this,_hide).call(this);annotation_layer_classPrivateFieldGet(mo,this).removeEventListener("click",annotation_layer_classPrivateFieldGet(go,this));annotation_layer_classPrivateFieldGet(mo,this).removeEventListener("keydown",annotation_layer_classPrivateFieldGet(uo,this))}}}function _show(){annotation_layer_classPrivateFieldGet(So,this)||this.render();if(this.isVisible)annotation_layer_classPrivateFieldGet(yo,this)&&annotation_layer_classPrivateFieldGet(mo,this).classList.add("focused");else{annotation_layer_assertClassBrand(Ro,this,_setPosition).call(this);annotation_layer_classPrivateFieldGet(mo,this).hidden=!1;annotation_layer_classPrivateFieldGet(mo,this).style.zIndex=parseInt(annotation_layer_classPrivateFieldGet(mo,this).style.zIndex)+1e3;const e=annotation_layer_classPrivateFieldGet(mo,this).closest(".page");e&&(e.style.overflow="visible")}}function _hide(){annotation_layer_classPrivateFieldGet(mo,this).classList.remove("focused");if(annotation_layer_classPrivateFieldGet(yo,this)||!this.isVisible)return;annotation_layer_classPrivateFieldGet(mo,this).hidden=!0;annotation_layer_classPrivateFieldGet(mo,this).style.zIndex=parseInt(annotation_layer_classPrivateFieldGet(mo,this).style.zIndex)-1e3;const e=annotation_layer_classPrivateFieldGet(mo,this).closest(".page");e&&(e.style.overflow="")}class FreeTextAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});this.textContent=e.data.textContent;this.textPosition=e.data.textPosition;this.annotationEditorType=f.FREETEXT}render(){this.container.classList.add("freeTextAnnotation");if(this.textContent){const e=this.contentElement=document.createElement("div");e.classList.add("annotationTextContent");e.setAttribute("role","comment");for(const t of this.textContent){const i=document.createElement("span");i.textContent=t;e.append(i)}this.container.append(e)}if(!this.data.popupRef&&this.hasPopupData){this.hasOwnCommentButton=!0;this._createPopup()}this._editOnDoubleClick();return this.container}}var No=new WeakMap;class LineAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});annotation_layer_classPrivateFieldInitSpec(this,No,null)}render(){this.container.classList.add("lineAnnotation");const{data:e,width:t,height:i}=this,a=this.svgFactory.create(t,i,!0),s=annotation_layer_classPrivateFieldSet(No,this,this.svgFactory.createElement("svg:line"));s.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]);s.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]);s.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]);s.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]);s.setAttribute("stroke-width",e.borderStyle.width||1);s.setAttribute("stroke","transparent");s.setAttribute("fill","transparent");a.append(s);this.container.append(a);if(!e.popupRef&&this.hasPopupData){this.hasOwnCommentButton=!0;this._createPopup()}return this.container}getElementsToTriggerPopup(){return annotation_layer_classPrivateFieldGet(No,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Oo=new WeakMap;class SquareAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});annotation_layer_classPrivateFieldInitSpec(this,Oo,null)}render(){this.container.classList.add("squareAnnotation");const{data:e,width:t,height:i}=this,a=this.svgFactory.create(t,i,!0),s=e.borderStyle.width,n=annotation_layer_classPrivateFieldSet(Oo,this,this.svgFactory.createElement("svg:rect"));n.setAttribute("x",s/2);n.setAttribute("y",s/2);n.setAttribute("width",t-s);n.setAttribute("height",i-s);n.setAttribute("stroke-width",s||1);n.setAttribute("stroke","transparent");n.setAttribute("fill","transparent");a.append(n);this.container.append(a);if(!e.popupRef&&this.hasPopupData){this.hasOwnCommentButton=!0;this._createPopup()}return this.container}getElementsToTriggerPopup(){return annotation_layer_classPrivateFieldGet(Oo,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Wo=new WeakMap;class CircleAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});annotation_layer_classPrivateFieldInitSpec(this,Wo,null)}render(){this.container.classList.add("circleAnnotation");const{data:e,width:t,height:i}=this,a=this.svgFactory.create(t,i,!0),s=e.borderStyle.width,n=annotation_layer_classPrivateFieldSet(Wo,this,this.svgFactory.createElement("svg:ellipse"));n.setAttribute("cx",t/2);n.setAttribute("cy",i/2);n.setAttribute("rx",t/2-s/2);n.setAttribute("ry",i/2-s/2);n.setAttribute("stroke-width",s||1);n.setAttribute("stroke","transparent");n.setAttribute("fill","transparent");a.append(n);this.container.append(a);if(!e.popupRef&&this.hasPopupData){this.hasOwnCommentButton=!0;this._createPopup()}return this.container}getElementsToTriggerPopup(){return annotation_layer_classPrivateFieldGet(Wo,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var jo=new WeakMap;class PolylineAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});annotation_layer_classPrivateFieldInitSpec(this,jo,null);this.containerClassName="polylineAnnotation";this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:t,borderStyle:i,popupRef:a},width:s,height:n}=this;if(!t)return this.container;const r=this.svgFactory.create(s,n,!0);let o=[];for(let i=0,a=t.length;i<a;i+=2){const a=t[i]-e[0],s=e[3]-t[i+1];o.push(`${a},${s}`)}o=o.join(" ");const l=annotation_layer_classPrivateFieldSet(jo,this,this.svgFactory.createElement(this.svgElementName));l.setAttribute("points",o);l.setAttribute("stroke-width",i.width||1);l.setAttribute("stroke","transparent");l.setAttribute("fill","transparent");r.append(l);this.container.append(r);if(!a&&this.hasPopupData){this.hasOwnCommentButton=!0;this._createPopup()}return this.container}getElementsToTriggerPopup(){return annotation_layer_classPrivateFieldGet(jo,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}class PolygonAnnotationElement extends PolylineAnnotationElement{constructor(e){super(e);this.containerClassName="polygonAnnotation";this.svgElementName="svg:polygon"}}class CaretAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("caretAnnotation");if(!this.data.popupRef&&this.hasPopupData){this.hasOwnCommentButton=!0;this._createPopup()}return this.container}}var Vo=new WeakMap,Uo=new WeakMap,zo=new WeakSet;class InkAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});annotation_layer_classPrivateMethodInitSpec(this,zo);annotation_layer_classPrivateFieldInitSpec(this,Vo,null);annotation_layer_classPrivateFieldInitSpec(this,Uo,[]);this.containerClassName="inkAnnotation";this.svgElementName="svg:polyline";this.annotationEditorType="InkHighlight"===this.data.it?f.HIGHLIGHT:f.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,rotation:t,inkLists:i,borderStyle:a,popupRef:s}}=this,{transform:n,width:r,height:o}=annotation_layer_assertClassBrand(zo,this,_getTransform).call(this,t,e),l=this.svgFactory.create(r,o,!0),d=annotation_layer_classPrivateFieldSet(Vo,this,this.svgFactory.createElement("svg:g"));l.append(d);d.setAttribute("stroke-width",a.width||1);d.setAttribute("stroke-linecap","round");d.setAttribute("stroke-linejoin","round");d.setAttribute("stroke-miterlimit",10);d.setAttribute("stroke","transparent");d.setAttribute("fill","transparent");d.setAttribute("transform",n);for(let e=0,t=i.length;e<t;e++){const t=this.svgFactory.createElement(this.svgElementName);annotation_layer_classPrivateFieldGet(Uo,this).push(t);t.setAttribute("points",i[e].join(","));d.append(t)}if(!s&&this.hasPopupData){this.hasOwnCommentButton=!0;this._createPopup()}this.container.append(l);this._editOnDoubleClick();return this.container}updateEdited(e){super.updateEdited(e);const{thickness:t,points:i,rect:a}=e,s=annotation_layer_classPrivateFieldGet(Vo,this);t>=0&&s.setAttribute("stroke-width",t||1);if(i)for(let e=0,t=annotation_layer_classPrivateFieldGet(Uo,this).length;e<t;e++)annotation_layer_classPrivateFieldGet(Uo,this)[e].setAttribute("points",i[e].join(","));if(a){const{transform:e,width:t,height:i}=annotation_layer_assertClassBrand(zo,this,_getTransform).call(this,this.data.rotation,a);s.parentElement.setAttribute("viewBox",`0 0 ${t} ${i}`);s.setAttribute("transform",e)}}getElementsToTriggerPopup(){return annotation_layer_classPrivateFieldGet(Uo,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}function _getTransform(e,t){switch(e){case 90:return{transform:`rotate(90) translate(${-t[0]},${t[1]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};case 180:return{transform:`rotate(180) translate(${-t[2]},${t[1]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]};case 270:return{transform:`rotate(270) translate(${-t[2]},${t[3]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};default:return{transform:`translate(${-t[0]},${t[3]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]}}}class HighlightAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0});this.annotationEditorType=f.HIGHLIGHT}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData){this.hasOwnCommentButton=!0;this._createPopup()}this.container.classList.add("highlightAnnotation");this._editOnDoubleClick();if(e){const t=document.createElement("mark");t.classList.add("overlaidText");t.textContent=e;this.container.append(t)}return this.container}}class UnderlineAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData){this.hasOwnCommentButton=!0;this._createPopup()}this.container.classList.add("underlineAnnotation");if(e){const t=document.createElement("u");t.classList.add("overlaidText");t.textContent=e;this.container.append(t)}return this.container}}class SquigglyAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData){this.hasOwnCommentButton=!0;this._createPopup()}this.container.classList.add("squigglyAnnotation");if(e){const t=document.createElement("u");t.classList.add("overlaidText");t.textContent=e;this.container.append(t)}return this.container}}class StrikeOutAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData){this.hasOwnCommentButton=!0;this._createPopup()}this.container.classList.add("strikeoutAnnotation");if(e){const t=document.createElement("s");t.classList.add("overlaidText");t.textContent=e;this.container.append(t)}return this.container}}class StampAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});this.annotationEditorType=f.STAMP}render(){this.container.classList.add("stampAnnotation");this.container.setAttribute("role","img");if(!this.data.popupRef&&this.hasPopupData){this.hasOwnCommentButton=!0;this._createPopup()}this._editOnDoubleClick();return this.container}}var Ho=new WeakMap,$o=new WeakSet;class FileAttachmentAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0});annotation_layer_classPrivateMethodInitSpec(this,$o);annotation_layer_classPrivateFieldInitSpec(this,Ho,null);const{file:t}=this.data;this.filename=t.filename;this.content=t.content;this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...t})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:t}=this;let i;if(t.hasAppearance||0===t.fillAlpha)i=document.createElement("div");else{i=document.createElement("img");i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?"paperclip":"pushpin"}.svg`;t.fillAlpha&&t.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(100*t.fillAlpha)}%);`)}i.addEventListener("dblclick",annotation_layer_assertClassBrand($o,this,_download).bind(this));annotation_layer_classPrivateFieldSet(Ho,this,i);const{isMac:a}=FeatureTest.platform;e.addEventListener("keydown",e=>{"Enter"===e.key&&(a?e.metaKey:e.ctrlKey)&&annotation_layer_assertClassBrand($o,this,_download).call(this)});if(!t.popupRef&&this.hasPopupData){this.hasOwnCommentButton=!0;this._createPopup()}else i.classList.add("popupTriggerArea");e.append(i);return e}getElementsToTriggerPopup(){return annotation_layer_classPrivateFieldGet(Ho,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}function _download(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}var qo,Xo=new WeakMap,Ko=new WeakMap,Yo=new WeakMap,Zo=new WeakMap,Jo=new WeakMap,Qo=new WeakMap,el=new WeakMap,tl=new WeakMap,il=new WeakSet;class AnnotationLayer{constructor(e){let{div:t,accessibilityManager:i,annotationCanvasMap:a,annotationEditorUIManager:s,page:n,viewport:r,structTreeLayer:o,commentManager:l,linkService:d,annotationStorage:c}=e;annotation_layer_classPrivateMethodInitSpec(this,il);annotation_layer_classPrivateFieldInitSpec(this,Xo,null);annotation_layer_classPrivateFieldInitSpec(this,Ko,null);annotation_layer_classPrivateFieldInitSpec(this,Yo,null);annotation_layer_classPrivateFieldInitSpec(this,Zo,new Map);annotation_layer_classPrivateFieldInitSpec(this,Jo,null);annotation_layer_classPrivateFieldInitSpec(this,Qo,null);annotation_layer_classPrivateFieldInitSpec(this,el,[]);annotation_layer_classPrivateFieldInitSpec(this,tl,!1);this.div=t;annotation_layer_classPrivateFieldSet(Xo,this,i);annotation_layer_classPrivateFieldSet(Ko,this,a);annotation_layer_classPrivateFieldSet(Jo,this,o||null);annotation_layer_classPrivateFieldSet(Qo,this,d||null);annotation_layer_classPrivateFieldSet(Yo,this,c||new AnnotationStorage);this.page=n;this.viewport=r;this.zIndex=0;this._annotationEditorUIManager=s;this._commentManager=l||null}hasEditableAnnotations(){return annotation_layer_classPrivateFieldGet(Zo,this).size>0}async render(e){const{annotations:t}=e,i=this.div;setLayerDimensions(i,this.viewport);const a=new Map,s=[],n={data:null,layer:i,linkService:annotation_layer_classPrivateFieldGet(Qo,this),downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new DOMSVGFactory,annotationStorage:annotation_layer_classPrivateFieldGet(Yo,this),enableComment:!0===e.enableComment,enableScripting:!0===e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const e of t){if(e.noHTML)continue;const t=e.annotationType===A.POPUP;if(t){const t=a.get(e.id);if(!t)continue;if(!this._commentManager){s.push(e);continue}n.elements=t}else if(e.rect[2]===e.rect[0]||e.rect[3]===e.rect[1])continue;n.data=e;const i=AnnotationElementFactory.create(n);if(!i.isRenderable)continue;if(!t){annotation_layer_classPrivateFieldGet(el,this).push(i);e.popupRef&&a.getOrInsertComputed(e.popupRef,makeArr).push(i)}const r=i.render();e.hidden&&(r.style.visibility="hidden");if(i._isEditable){annotation_layer_classPrivateFieldGet(Zo,this).set(i.data.id,i);this._annotationEditorUIManager?.renderAnnotationElement(i)}}await annotation_layer_assertClassBrand(il,this,_addElementsToDOM).call(this);for(const e of s){const t=n.elements=a.get(e.id);n.data=e;const i=AnnotationElementFactory.create(n);if(!i.isRenderable)continue;const s=i.render();i.contentElement.id=`${X}${e.id}`;e.hidden&&(s.style.visibility="hidden");t.at(-1).container.after(s)}annotation_layer_assertClassBrand(il,this,_setAnnotationCanvasMap).call(this)}async addLinkAnnotations(e){const t={data:null,layer:this.div,linkService:annotation_layer_classPrivateFieldGet(Qo,this),svgFactory:new DOMSVGFactory,parent:this};for(const i of e){i.borderStyle||=AnnotationLayer._defaultBorderStyle;t.data=i;const e=AnnotationElementFactory.create(t);if(e.isRenderable){e.render();e.contentElement.id=`${X}${i.id}`;annotation_layer_classPrivateFieldGet(el,this).push(e)}}await annotation_layer_assertClassBrand(il,this,_addElementsToDOM).call(this)}update(e){let{viewport:t}=e;const i=this.div;this.viewport=t;setLayerDimensions(i,{rotation:t.rotation});annotation_layer_assertClassBrand(il,this,_setAnnotationCanvasMap).call(this);i.hidden=!1}getEditableAnnotations(){return annotation_layer_classPrivateFieldGet(Zo,this).values()}getEditableAnnotation(e){return annotation_layer_classPrivateFieldGet(Zo,this).get(e)}addFakeAnnotation(e){const{div:t}=this,{id:i,rotation:a}=e,s=new EditorAnnotationElement({data:{id:i,rect:e.getPDFRect(),rotation:a},editor:e,layer:t,parent:this,enableComment:!!this._commentManager,linkService:annotation_layer_classPrivateFieldGet(Qo,this),annotationStorage:annotation_layer_classPrivateFieldGet(Yo,this)});s.render();s.contentElement.id=`${X}${i}`;s.createOrUpdatePopup();annotation_layer_classPrivateFieldGet(el,this).push(s);return s}removeAnnotation(e){const t=annotation_layer_classPrivateFieldGet(el,this).findIndex(t=>t.data.id===e);if(t<0)return;const[i]=annotation_layer_classPrivateFieldGet(el,this).splice(t,1);annotation_layer_classPrivateFieldGet(Xo,this)?.removePointerInTextLayer(i.contentElement)}updateFakeAnnotations(e){if(0!==e.length){for(const t of e)t.updateFakeAnnotationElement(this);annotation_layer_assertClassBrand(il,this,_addElementsToDOM).call(this)}}togglePointerEvents(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("disabled",!e)}static get _defaultBorderStyle(){return shadow(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:G,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}}async function _addElementsToDOM(){if(0===annotation_layer_classPrivateFieldGet(el,this).length)return;this.div.replaceChildren();const e=[];if(!annotation_layer_classPrivateFieldGet(tl,this)){annotation_layer_classPrivateFieldSet(tl,this,!0);for(const{contentElement:t,data:{id:i}}of annotation_layer_classPrivateFieldGet(el,this)){const a=t.id=`${X}${i}`;e.push(annotation_layer_classPrivateFieldGet(Jo,this)?.getAriaAttributes(a).then(e=>{if(e)for(const[i,a]of e)t.setAttribute(i,a)}))}}annotation_layer_classPrivateFieldGet(el,this).sort((e,t)=>{let{data:{rect:[i,a,s,n]}}=e,{data:{rect:[r,o,l,d]}}=t;if(i===s&&a===n)return 1;if(r===l&&o===d)return-1;const c=(a+n)/2,h=(o+d)/2;if(c>=d&&h<=a)return-1;if(h>=n&&c<=o)return 1;return(i+s)/2-(r+l)/2});const t=document.createDocumentFragment();for(const e of annotation_layer_classPrivateFieldGet(el,this)){t.append(e.container);this._commentManager?(e.extraPopupElement?.popup||e.popup)?.renderCommentButton():e.extraPopupElement&&t.append(e.extraPopupElement.render())}this.div.append(t);await Promise.all(e);if(annotation_layer_classPrivateFieldGet(Xo,this))for(const e of annotation_layer_classPrivateFieldGet(el,this))annotation_layer_classPrivateFieldGet(Xo,this).addPointerInTextLayer(e.contentElement,!1)}function _setAnnotationCanvasMap(){if(!annotation_layer_classPrivateFieldGet(Ko,this))return;const e=this.div;for(const[t,i]of annotation_layer_classPrivateFieldGet(Ko,this)){const a=e.querySelector(`[data-annotation-id="${t}"]`);if(!a)continue;i.className="annotationContent";const{firstChild:s}=a;s?"CANVAS"===s.nodeName?s.replaceWith(i):s.classList.contains("annotationContent")?s.after(i):s.before(i):a.append(i);const n=annotation_layer_classPrivateFieldGet(Zo,this).get(t);if(n)if(n._hasNoCanvas){this._annotationEditorUIManager?.setMissingCanvas(t,a.id,i);n._hasNoCanvas=!1}else n.canvas=i}annotation_layer_classPrivateFieldGet(Ko,this).clear()}function freetext_defineProperty(e,t,i){return(t=function freetext_toPropertyKey(e){var t=function freetext_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function freetext_classPrivateFieldInitSpec(e,t,i){freetext_checkPrivateRedeclaration(e,t),t.set(e,i)}function freetext_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function freetext_classPrivateFieldGet(e,t){return e.get(freetext_assertClassBrand(e,t))}function freetext_classPrivateFieldSet(e,t,i){return e.set(freetext_assertClassBrand(e,t),i),i}function freetext_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const al=/\r\n?|\n/g;var sl=new WeakMap,nl=new WeakMap,rl=new WeakMap,ol=new WeakMap,ll=new WeakSet;class FreeTextEditor extends AnnotationEditor{static get _keyboardManager(){const e=FreeTextEditor.prototype,arrowChecker=e=>e.isEmpty(),t=AnnotationEditorUIManager.TRANSLATE_SMALL,i=AnnotationEditorUIManager.TRANSLATE_BIG;return shadow(this,"_keyboardManager",new KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-t,0],checker:arrowChecker}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:arrowChecker}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[t,0],checker:arrowChecker}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[i,0],checker:arrowChecker}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-t],checker:arrowChecker}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:arrowChecker}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,t],checker:arrowChecker}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,i],checker:arrowChecker}]]))}constructor(e){super({...e,name:"freeTextEditor"});!function freetext_classPrivateMethodInitSpec(e,t){freetext_checkPrivateRedeclaration(e,t),t.add(e)}(this,ll);freetext_classPrivateFieldInitSpec(this,sl,"");freetext_classPrivateFieldInitSpec(this,nl,`${this.id}-editor`);freetext_classPrivateFieldInitSpec(this,rl,null);freetext_classPrivateFieldInitSpec(this,ol,void 0);freetext_defineProperty(this,"_colorPicker",null);this.color=e.color||FreeTextEditor._defaultColor||AnnotationEditor._defaultLineColor;freetext_classPrivateFieldSet(ol,this,e.fontSize||FreeTextEditor._defaultFontSize);this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert");this.canAddComment=!1}static initialize(e,t){AnnotationEditor.initialize(e,t);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,t){switch(e){case m.FREETEXT_SIZE:FreeTextEditor._defaultFontSize=t;break;case m.FREETEXT_COLOR:FreeTextEditor._defaultColor=t}}updateParams(e,t){switch(e){case m.FREETEXT_SIZE:freetext_assertClassBrand(ll,this,_updateFontSize).call(this,t);break;case m.FREETEXT_COLOR:freetext_assertClassBrand(ll,this,freetext_updateColor).call(this,t)}}static get defaultPropertiesToUpdate(){return[[m.FREETEXT_SIZE,FreeTextEditor._defaultFontSize],[m.FREETEXT_COLOR,FreeTextEditor._defaultColor||AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[m.FREETEXT_SIZE,freetext_classPrivateFieldGet(ol,this)],[m.FREETEXT_COLOR,this.color]]}get toolbarButtons(){this._colorPicker||=new BasicColorPicker(this);return[["colorPicker",this._colorPicker]]}get colorType(){return m.FREETEXT_COLOR}onUpdatedColor(){this.editorDiv.style.color=this.color;this._colorPicker?.update(this.color);super.onUpdatedColor()}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){const e=this.parentScale;return[-FreeTextEditor._internalPadding*e,-(FreeTextEditor._internalPadding+freetext_classPrivateFieldGet(ol,this))*e]}rebuild(){if(this.parent){super.rebuild();null!==this.div&&(this.isAttachedToDOM||this.parent.add(this))}}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled");this.editorDiv.contentEditable=!0;this._isDraggable=!1;this.div.removeAttribute("aria-activedescendant");freetext_classPrivateFieldSet(rl,this,new AbortController);const e=this._uiManager.combinedSignal(freetext_classPrivateFieldGet(rl,this));this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e});this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e});this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e});this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e});this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e});return!0}disableEditMode(){if(!super.disableEditMode())return!1;this.overlayDiv.classList.add("enabled");this.editorDiv.contentEditable=!1;this.div.setAttribute("aria-activedescendant",freetext_classPrivateFieldGet(nl,this));this._isDraggable=!0;freetext_classPrivateFieldGet(rl,this)?.abort();freetext_classPrivateFieldSet(rl,this,null);this.div.focus({preventScroll:!0});this.isEditing=!1;this.parent.div.classList.add("freetextEditing");return!0}focusin(e){if(this._focusEventsAllowed){super.focusin(e);e.target!==this.editorDiv&&this.editorDiv.focus()}}onceAdded(e){if(!this.width){this.enableEditMode();e&&this.editorDiv.focus();this._initialOptions?.isCentered&&this.center();this._initialOptions=null}}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1;if(this.parent){this.parent.setEditingState(!0);this.parent.div.classList.add("freetextEditing")}super.remove()}commit(){if(!this.isInEditMode())return;super.commit();this.disableEditMode();const e=freetext_classPrivateFieldGet(sl,this),t=freetext_classPrivateFieldSet(sl,this,freetext_assertClassBrand(ll,this,_extractText).call(this).trimEnd());if(e===t)return;const setText=e=>{freetext_classPrivateFieldSet(sl,this,e);if(e){freetext_assertClassBrand(ll,this,_setContent).call(this);this._uiManager.rebuild(this);freetext_assertClassBrand(ll,this,_setEditorDimensions).call(this)}else this.remove()};this.addCommands({cmd:()=>{setText(t)},undo:()=>{setText(e)},mustExec:!1});freetext_assertClassBrand(ll,this,_setEditorDimensions).call(this);this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"commit",page:this.pageIndex+1,id:this.uid,value:t,previousValue:e})}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode();this.editorDiv.focus()}keydown(e){if(e.target===this.div&&"Enter"===e.key){this.enterInEditMode();e.preventDefault()}}editorDivKeydown(e){FreeTextEditor._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment");this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox");this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,t;if(this._isCopy||this.annotationElementId){e=this.x;t=this.y}super.render();this.editorDiv=document.createElement("div");this.editorDiv.className="internal";this.editorDiv.setAttribute("id",freetext_classPrivateFieldGet(nl,this));this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2");this.editorDiv.setAttribute("data-l10n-attrs","default-content");this.enableEditing();this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;i.fontSize=`calc(${freetext_classPrivateFieldGet(ol,this)}px * var(--total-scale-factor))`;i.color=this.color;this.div.append(this.editorDiv);this.overlayDiv=document.createElement("div");this.overlayDiv.classList.add("overlay","enabled");this.div.append(this.overlayDiv);if(this._isCopy||this.annotationElementId){const[i,a]=this.parentDimensions;if(this.annotationElementId){const{position:s}=this._initialData;let[n,r]=this.getInitialTranslation();[n,r]=this.pageTranslationToScreen(n,r);const[o,l]=this.pageDimensions,[d,c]=this.pageTranslation;let h,u;switch(this.rotation){case 0:h=e+(s[0]-d)/o;u=t+this.height-(s[1]-c)/l;break;case 90:h=e+(s[0]-d)/o;u=t-(s[1]-c)/l;[n,r]=[r,-n];break;case 180:h=e-this.width+(s[0]-d)/o;u=t-(s[1]-c)/l;[n,r]=[-n,-r];break;case 270:h=e+(s[0]-d-this.height*l)/o;u=t+(s[1]-c-this.width*o)/l;[n,r]=[-r,n]}this.setAt(h*i,u*a,n,r)}else this._moveAfterPaste(e,t);freetext_assertClassBrand(ll,this,_setContent).call(this);this._isDraggable=!0;this.editorDiv.contentEditable=!1}else{this._isDraggable=!1;this.editorDiv.contentEditable=!0}return this.div}editorDivPaste(e){const t=e.clipboardData||window.clipboardData,{types:i}=t;if(1===i.length&&"text/plain"===i[0])return;e.preventDefault();const a=_deserializeContent.call(FreeTextEditor,t.getData("text")||"").replaceAll(al,"\n");if(!a)return;const s=window.getSelection();if(!s.rangeCount)return;this.editorDiv.normalize();s.deleteFromDocument();const n=s.getRangeAt(0);if(!a.includes("\n")){n.insertNode(document.createTextNode(a));this.editorDiv.normalize();s.collapseToStart();return}const{startContainer:r,startOffset:o}=n,l=[],d=[];if(r.nodeType===Node.TEXT_NODE){const e=r.parentElement;d.push(r.nodeValue.slice(o).replaceAll(al,""));if(e!==this.editorDiv){let t=l;for(const i of this.editorDiv.childNodes)i!==e?t.push(_getNodeContent.call(FreeTextEditor,i)):t=d}l.push(r.nodeValue.slice(0,o).replaceAll(al,""))}else if(r===this.editorDiv){let e=l,t=0;for(const i of this.editorDiv.childNodes){t++===o&&(e=d);e.push(_getNodeContent.call(FreeTextEditor,i))}}freetext_classPrivateFieldSet(sl,this,`${l.join("\n")}${a}${d.join("\n")}`);freetext_assertClassBrand(ll,this,_setContent).call(this);const c=new Range;let h=Math.sumPrecise(l.map(e=>e.length));for(const{firstChild:e}of this.editorDiv.childNodes)if(e.nodeType===Node.TEXT_NODE){const t=e.nodeValue.length;if(h<=t){c.setStart(e,h);c.setEnd(e,h);break}h-=t}s.removeAllRanges();s.addRange(c)}get contentDiv(){return this.editorDiv}getPDFRect(){const e=FreeTextEditor._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,t,i){let a=null;if(e instanceof FreeTextAnnotationElement){const{data:{defaultAppearanceData:{fontSize:t,fontColor:i},rect:s,rotation:n,id:r,popupRef:o,richText:l,contentsObj:d,creationDate:c,modificationDate:h},textContent:u,textPosition:_,parent:{page:{pageNumber:p}}}=e;if(!u||0===u.length)return null;a=e={annotationType:f.FREETEXT,color:Array.from(i),fontSize:t,value:u.join("\n"),position:_,pageIndex:p-1,rect:s.slice(0),rotation:n,annotationElementId:r,id:r,deleted:!1,popupRef:o,comment:d?.str||null,richText:l,creationDate:c,modificationDate:h}}const s=await super.deserialize(e,t,i);freetext_classPrivateFieldSet(ol,s,e.fontSize);s.color=Util.makeHexColor(...e.color);freetext_classPrivateFieldSet(sl,s,_deserializeContent.call(FreeTextEditor,e.value));s._initialData=a;e.comment&&s.setCommentData(e);return s}serialize(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const a=AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),s=Object.assign(super.serialize(e,t),{color:a,fontSize:freetext_classPrivateFieldGet(ol,this),value:freetext_assertClassBrand(ll,this,_serializeContent).call(this)});this.addComment(s,this._isCopy);if(e){i&&(s.id=this.uid);s.isCopy=!0;return s}if(this.annotationElementId&&!freetext_assertClassBrand(ll,this,_hasElementChanged).call(this,s))return null;s.id=this.uid;return s}renderAnnotationElement(e){const t=super.renderAnnotationElement(e);if(!t)return null;const{style:i}=t;i.fontSize=`calc(${freetext_classPrivateFieldGet(ol,this)}px * var(--total-scale-factor))`;i.color=this.color;t.replaceChildren();for(const e of freetext_classPrivateFieldGet(sl,this).split("\n")){const i=document.createElement("div");i.append(e?document.createTextNode(e):document.createElement("br"));t.append(i)}e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:freetext_classPrivateFieldGet(sl,this)}});return t}resetAnnotationElement(e){super.resetAnnotationElement(e);e.resetEdited()}}qo=FreeTextEditor;function _updateFontSize(e){const setFontsize=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--total-scale-factor))`;this.translate(0,-(e-freetext_classPrivateFieldGet(ol,this))*this.parentScale);freetext_classPrivateFieldSet(ol,this,e);freetext_assertClassBrand(ll,this,_setEditorDimensions).call(this)},t=freetext_classPrivateFieldGet(ol,this);this.addCommands({cmd:setFontsize.bind(this,e),undo:setFontsize.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:m.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0});this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"fontSizeChanged",page:this.pageIndex+1,id:this.uid,editorType:this.constructor.name,value:e,previousValue:freetext_classPrivateFieldGet(ol,this)})}function freetext_updateColor(e){const setColor=e=>{this.color=e;this.onUpdatedColor()},t=this.color;this.addCommands({cmd:setColor.bind(this,e),undo:setColor.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:m.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0});this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"colorChanged",page:this.pageIndex+1,id:this.uid,editorType:this.constructor.name,value:e,previousValue:t})}function _extractText(){const e=[];this.editorDiv.normalize();let t=null;for(const i of this.editorDiv.childNodes)if(t?.nodeType!==Node.TEXT_NODE||"BR"!==i.nodeName){e.push(_getNodeContent.call(qo,i));t=i}return e.join("\n")}function _setEditorDimensions(){const[e,t]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:e,div:t}=this,a=t.style.display,s=t.classList.contains("hidden");t.classList.remove("hidden");t.style.display="hidden";e.div.append(this.div);i=t.getBoundingClientRect();t.remove();t.style.display=a;t.classList.toggle("hidden",s)}if(this.rotation%180==this.parentRotation%180){this.width=i.width/e;this.height=i.height/t}else{this.width=i.height/e;this.height=i.width/t}this.fixAndSetPosition()}function _getNodeContent(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(al,"")}function _setContent(){this.editorDiv.replaceChildren();if(freetext_classPrivateFieldGet(sl,this))for(const e of freetext_classPrivateFieldGet(sl,this).split("\n")){const t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br"));this.editorDiv.append(t)}}function _serializeContent(){return freetext_classPrivateFieldGet(sl,this).replaceAll(" "," ")}function _deserializeContent(e){return e.replaceAll(" "," ")}function _hasElementChanged(e){const{value:t,fontSize:i,color:a,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==t||e.fontSize!==i||e.color.some((e,t)=>e!==a[t])||e.pageIndex!==s}freetext_defineProperty(FreeTextEditor,"_freeTextDefaultContent","");freetext_defineProperty(FreeTextEditor,"_internalPadding",0);freetext_defineProperty(FreeTextEditor,"_defaultColor",null);freetext_defineProperty(FreeTextEditor,"_defaultFontSize",10);freetext_defineProperty(FreeTextEditor,"_type","freetext");freetext_defineProperty(FreeTextEditor,"_editorType",f.FREETEXT);class Outline{toSVGPath(){unreachable("Abstract method `toSVGPath` must be implemented.")}get box(){unreachable("Abstract getter `box` must be implemented.")}serialize(e,t){unreachable("Abstract method `serialize` must be implemented.")}static _rescale(e,t,i,a,s,n){n||=new Float32Array(e.length);for(let r=0,o=e.length;r<o;r+=2){n[r]=t+e[r]*a;n[r+1]=i+e[r+1]*s}return n}static _rescaleAndSwap(e,t,i,a,s,n){n||=new Float32Array(e.length);for(let r=0,o=e.length;r<o;r+=2){n[r]=t+e[r+1]*a;n[r+1]=i+e[r]*s}return n}static _translate(e,t,i,a){a||=new Float32Array(e.length);for(let s=0,n=e.length;s<n;s+=2){a[s]=t+e[s];a[s+1]=i+e[s+1]}return a}static svgRound(e){return Math.round(1e4*e)}static _normalizePoint(e,t,i,a,s){switch(s){case 90:return[1-t/i,e/a];case 180:return[1-e/i,1-t/a];case 270:return[t/i,1-e/a];default:return[e/i,t/a]}}static _normalizePagePoint(e,t,i){switch(i){case 90:return[1-t,e];case 180:return[1-e,1-t];case 270:return[t,1-e];default:return[e,t]}}static createBezierPoints(e,t,i,a,s,n){return[(e+5*i)/6,(t+5*a)/6,(5*i+s)/6,(5*a+n)/6,(i+s)/2,(a+n)/2]}}!function outline_defineProperty(e,t,i){return(t=function outline_toPropertyKey(e){var t=function outline_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}(Outline,"PRECISION",1e-4);function freedraw_classPrivateMethodInitSpec(e,t){freedraw_checkPrivateRedeclaration(e,t),t.add(e)}function freedraw_classPrivateFieldInitSpec(e,t,i){freedraw_checkPrivateRedeclaration(e,t),t.set(e,i)}function freedraw_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function freedraw_classPrivateFieldGet(e,t){return e.get(freedraw_assertClassBrand(e,t))}function freedraw_classPrivateFieldSet(e,t,i){return e.set(freedraw_assertClassBrand(e,t),i),i}function freedraw_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var dl=new WeakMap,cl=new WeakMap,hl=new WeakMap,ul=new WeakMap,_l=new WeakMap,pl=new WeakMap,gl=new WeakMap,fl=new WeakMap,ml=new WeakMap,vl=new WeakMap,Pl=new WeakMap,wl=new WeakMap,Fl=new WeakMap,bl=new WeakSet;class FreeDrawOutliner{constructor(e,t,i,a,s){let{x:n,y:r}=e,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;freedraw_classPrivateMethodInitSpec(this,bl);freedraw_classPrivateFieldInitSpec(this,dl,void 0);freedraw_classPrivateFieldInitSpec(this,cl,[]);freedraw_classPrivateFieldInitSpec(this,hl,void 0);freedraw_classPrivateFieldInitSpec(this,ul,void 0);freedraw_classPrivateFieldInitSpec(this,_l,[]);freedraw_classPrivateFieldInitSpec(this,pl,new Float32Array(18));freedraw_classPrivateFieldInitSpec(this,gl,void 0);freedraw_classPrivateFieldInitSpec(this,fl,void 0);freedraw_classPrivateFieldInitSpec(this,ml,void 0);freedraw_classPrivateFieldInitSpec(this,vl,void 0);freedraw_classPrivateFieldInitSpec(this,Pl,void 0);freedraw_classPrivateFieldInitSpec(this,wl,void 0);freedraw_classPrivateFieldInitSpec(this,Fl,[]);freedraw_classPrivateFieldSet(dl,this,t);freedraw_classPrivateFieldSet(wl,this,a*i);freedraw_classPrivateFieldSet(ul,this,s);freedraw_classPrivateFieldGet(pl,this).set([NaN,NaN,NaN,NaN,n,r],6);freedraw_classPrivateFieldSet(hl,this,o);freedraw_classPrivateFieldSet(vl,this,yl._*i);freedraw_classPrivateFieldSet(ml,this,Sl._*i);freedraw_classPrivateFieldSet(Pl,this,i);freedraw_classPrivateFieldGet(Fl,this).push(n,r)}isEmpty(){return isNaN(freedraw_classPrivateFieldGet(pl,this)[8])}add(e){let{x:t,y:i}=e;freedraw_classPrivateFieldSet(gl,this,t);freedraw_classPrivateFieldSet(fl,this,i);const[a,s,n,r]=freedraw_classPrivateFieldGet(dl,this);let[o,l,d,c]=freedraw_classPrivateFieldGet(pl,this).subarray(8,12);const h=t-d,u=i-c,_=Math.hypot(h,u);if(_<freedraw_classPrivateFieldGet(ml,this))return!1;const p=_-freedraw_classPrivateFieldGet(vl,this),g=p/_,f=g*h,m=g*u;let v=o,P=l;o=d;l=c;d+=f;c+=m;freedraw_classPrivateFieldGet(Fl,this)?.push(t,i);const w=f/p,b=-m/p*freedraw_classPrivateFieldGet(wl,this),y=w*freedraw_classPrivateFieldGet(wl,this);freedraw_classPrivateFieldGet(pl,this).set(freedraw_classPrivateFieldGet(pl,this).subarray(2,8),0);freedraw_classPrivateFieldGet(pl,this).set([d+b,c+y],4);freedraw_classPrivateFieldGet(pl,this).set(freedraw_classPrivateFieldGet(pl,this).subarray(14,18),12);freedraw_classPrivateFieldGet(pl,this).set([d-b,c-y],16);if(isNaN(freedraw_classPrivateFieldGet(pl,this)[6])){if(0===freedraw_classPrivateFieldGet(_l,this).length){freedraw_classPrivateFieldGet(pl,this).set([o+b,l+y],2);freedraw_classPrivateFieldGet(_l,this).push(NaN,NaN,NaN,NaN,(o+b-a)/n,(l+y-s)/r);freedraw_classPrivateFieldGet(pl,this).set([o-b,l-y],14);freedraw_classPrivateFieldGet(cl,this).push(NaN,NaN,NaN,NaN,(o-b-a)/n,(l-y-s)/r)}freedraw_classPrivateFieldGet(pl,this).set([v,P,o,l,d,c],6);return!this.isEmpty()}freedraw_classPrivateFieldGet(pl,this).set([v,P,o,l,d,c],6);if(Math.abs(Math.atan2(P-l,v-o)-Math.atan2(m,f))<Math.PI/2){[o,l,d,c]=freedraw_classPrivateFieldGet(pl,this).subarray(2,6);freedraw_classPrivateFieldGet(_l,this).push(NaN,NaN,NaN,NaN,((o+d)/2-a)/n,((l+c)/2-s)/r);[o,l,v,P]=freedraw_classPrivateFieldGet(pl,this).subarray(14,18);freedraw_classPrivateFieldGet(cl,this).push(NaN,NaN,NaN,NaN,((v+o)/2-a)/n,((P+l)/2-s)/r);return!0}[v,P,o,l,d,c]=freedraw_classPrivateFieldGet(pl,this).subarray(0,6);freedraw_classPrivateFieldGet(_l,this).push(((v+5*o)/6-a)/n,((P+5*l)/6-s)/r,((5*o+d)/6-a)/n,((5*l+c)/6-s)/r,((o+d)/2-a)/n,((l+c)/2-s)/r);[d,c,o,l,v,P]=freedraw_classPrivateFieldGet(pl,this).subarray(12,18);freedraw_classPrivateFieldGet(cl,this).push(((v+5*o)/6-a)/n,((P+5*l)/6-s)/r,((5*o+d)/6-a)/n,((5*l+c)/6-s)/r,((o+d)/2-a)/n,((l+c)/2-s)/r);return!0}toSVGPath(){if(this.isEmpty())return"";const e=freedraw_classPrivateFieldGet(_l,this),t=freedraw_classPrivateFieldGet(cl,this);if(isNaN(freedraw_classPrivateFieldGet(pl,this)[6])&&!this.isEmpty())return freedraw_assertClassBrand(bl,this,_toSVGPathTwoPoints).call(this);const i=[];i.push(`M${e[4]} ${e[5]}`);for(let t=6;t<e.length;t+=6)isNaN(e[t])?i.push(`L${e[t+4]} ${e[t+5]}`):i.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);freedraw_assertClassBrand(bl,this,_toSVGPathEnd).call(this,i);for(let e=t.length-6;e>=6;e-=6)isNaN(t[e])?i.push(`L${t[e+4]} ${t[e+5]}`):i.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);freedraw_assertClassBrand(bl,this,_toSVGPathStart).call(this,i);return i.join(" ")}newFreeDrawOutline(e,t,i,a,s,n){return new FreeDrawOutline(e,t,i,a,s,n)}getOutlines(){const e=freedraw_classPrivateFieldGet(_l,this),t=freedraw_classPrivateFieldGet(cl,this),i=freedraw_classPrivateFieldGet(pl,this),[a,s,n,r]=freedraw_classPrivateFieldGet(dl,this),o=new Float32Array((freedraw_classPrivateFieldGet(Fl,this)?.length??0)+2);for(let e=0,t=o.length-2;e<t;e+=2){o[e]=(freedraw_classPrivateFieldGet(Fl,this)[e]-a)/n;o[e+1]=(freedraw_classPrivateFieldGet(Fl,this)[e+1]-s)/r}o[o.length-2]=(freedraw_classPrivateFieldGet(gl,this)-a)/n;o[o.length-1]=(freedraw_classPrivateFieldGet(fl,this)-s)/r;if(isNaN(i[6])&&!this.isEmpty())return freedraw_assertClassBrand(bl,this,_getOutlineTwoPoints).call(this,o);const l=new Float32Array(freedraw_classPrivateFieldGet(_l,this).length+24+freedraw_classPrivateFieldGet(cl,this).length);let d=e.length;for(let t=0;t<d;t+=2)if(isNaN(e[t]))l[t]=l[t+1]=NaN;else{l[t]=e[t];l[t+1]=e[t+1]}d=freedraw_assertClassBrand(bl,this,_getOutlineEnd).call(this,l,d);for(let e=t.length-6;e>=6;e-=6)for(let i=0;i<6;i+=2)if(isNaN(t[e+i])){l[d]=l[d+1]=NaN;d+=2}else{l[d]=t[e+i];l[d+1]=t[e+i+1];d+=2}freedraw_assertClassBrand(bl,this,_getOutlineStart).call(this,l,d);return this.newFreeDrawOutline(l,o,freedraw_classPrivateFieldGet(dl,this),freedraw_classPrivateFieldGet(Pl,this),freedraw_classPrivateFieldGet(hl,this),freedraw_classPrivateFieldGet(ul,this))}}function _getLastCoords(){const e=freedraw_classPrivateFieldGet(pl,this).subarray(4,6),t=freedraw_classPrivateFieldGet(pl,this).subarray(16,18),[i,a,s,n]=freedraw_classPrivateFieldGet(dl,this);return[(freedraw_classPrivateFieldGet(gl,this)+(e[0]-t[0])/2-i)/s,(freedraw_classPrivateFieldGet(fl,this)+(e[1]-t[1])/2-a)/n,(freedraw_classPrivateFieldGet(gl,this)+(t[0]-e[0])/2-i)/s,(freedraw_classPrivateFieldGet(fl,this)+(t[1]-e[1])/2-a)/n]}function _toSVGPathTwoPoints(){const[e,t,i,a]=freedraw_classPrivateFieldGet(dl,this),[s,n,r,o]=freedraw_assertClassBrand(bl,this,_getLastCoords).call(this);return`M${(freedraw_classPrivateFieldGet(pl,this)[2]-e)/i} ${(freedraw_classPrivateFieldGet(pl,this)[3]-t)/a} L${(freedraw_classPrivateFieldGet(pl,this)[4]-e)/i} ${(freedraw_classPrivateFieldGet(pl,this)[5]-t)/a} L${s} ${n} L${r} ${o} L${(freedraw_classPrivateFieldGet(pl,this)[16]-e)/i} ${(freedraw_classPrivateFieldGet(pl,this)[17]-t)/a} L${(freedraw_classPrivateFieldGet(pl,this)[14]-e)/i} ${(freedraw_classPrivateFieldGet(pl,this)[15]-t)/a} Z`}function _toSVGPathStart(e){const t=freedraw_classPrivateFieldGet(cl,this);e.push(`L${t[4]} ${t[5]} Z`)}function _toSVGPathEnd(e){const[t,i,a,s]=freedraw_classPrivateFieldGet(dl,this),n=freedraw_classPrivateFieldGet(pl,this).subarray(4,6),r=freedraw_classPrivateFieldGet(pl,this).subarray(16,18),[o,l,d,c]=freedraw_assertClassBrand(bl,this,_getLastCoords).call(this);e.push(`L${(n[0]-t)/a} ${(n[1]-i)/s} L${o} ${l} L${d} ${c} L${(r[0]-t)/a} ${(r[1]-i)/s}`)}function _getOutlineTwoPoints(e){const t=freedraw_classPrivateFieldGet(pl,this),[i,a,s,n]=freedraw_classPrivateFieldGet(dl,this),[r,o,l,d]=freedraw_assertClassBrand(bl,this,_getLastCoords).call(this),c=new Float32Array(36);c.set([NaN,NaN,NaN,NaN,(t[2]-i)/s,(t[3]-a)/n,NaN,NaN,NaN,NaN,(t[4]-i)/s,(t[5]-a)/n,NaN,NaN,NaN,NaN,r,o,NaN,NaN,NaN,NaN,l,d,NaN,NaN,NaN,NaN,(t[16]-i)/s,(t[17]-a)/n,NaN,NaN,NaN,NaN,(t[14]-i)/s,(t[15]-a)/n],0);return this.newFreeDrawOutline(c,e,freedraw_classPrivateFieldGet(dl,this),freedraw_classPrivateFieldGet(Pl,this),freedraw_classPrivateFieldGet(hl,this),freedraw_classPrivateFieldGet(ul,this))}function _getOutlineStart(e,t){const i=freedraw_classPrivateFieldGet(cl,this);e.set([NaN,NaN,NaN,NaN,i[4],i[5]],t);return t+6}function _getOutlineEnd(e,t){const i=freedraw_classPrivateFieldGet(pl,this).subarray(4,6),a=freedraw_classPrivateFieldGet(pl,this).subarray(16,18),[s,n,r,o]=freedraw_classPrivateFieldGet(dl,this),[l,d,c,h]=freedraw_assertClassBrand(bl,this,_getLastCoords).call(this);e.set([NaN,NaN,NaN,NaN,(i[0]-s)/r,(i[1]-n)/o,NaN,NaN,NaN,NaN,l,d,NaN,NaN,NaN,NaN,c,h,NaN,NaN,NaN,NaN,(a[0]-s)/r,(a[1]-n)/o],t);return t+24}var yl={_:8},Sl={_:yl._+2},Cl=new WeakMap,xl=new WeakMap,kl=new WeakMap,El=new WeakMap,Al=new WeakMap,Gl=new WeakMap,Bl=new WeakMap,Ml=new WeakSet;class FreeDrawOutline extends Outline{constructor(e,t,i,a,s,n){super();freedraw_classPrivateMethodInitSpec(this,Ml);freedraw_classPrivateFieldInitSpec(this,Cl,void 0);freedraw_classPrivateFieldInitSpec(this,xl,new Float32Array(4));freedraw_classPrivateFieldInitSpec(this,kl,void 0);freedraw_classPrivateFieldInitSpec(this,El,void 0);freedraw_classPrivateFieldInitSpec(this,Al,void 0);freedraw_classPrivateFieldInitSpec(this,Gl,void 0);freedraw_classPrivateFieldInitSpec(this,Bl,void 0);freedraw_classPrivateFieldSet(Bl,this,e);freedraw_classPrivateFieldSet(Al,this,t);freedraw_classPrivateFieldSet(Cl,this,i);freedraw_classPrivateFieldSet(Gl,this,a);freedraw_classPrivateFieldSet(kl,this,s);freedraw_classPrivateFieldSet(El,this,n);this.firstPoint=[NaN,NaN];this.lastPoint=[NaN,NaN];freedraw_assertClassBrand(Ml,this,_computeMinMax).call(this,n);const[r,o,l,d]=freedraw_classPrivateFieldGet(xl,this);for(let t=0,i=e.length;t<i;t+=2){e[t]=(e[t]-r)/l;e[t+1]=(e[t+1]-o)/d}for(let e=0,i=t.length;e<i;e+=2){t[e]=(t[e]-r)/l;t[e+1]=(t[e+1]-o)/d}}toSVGPath(){const e=[`M${freedraw_classPrivateFieldGet(Bl,this)[4]} ${freedraw_classPrivateFieldGet(Bl,this)[5]}`];for(let t=6,i=freedraw_classPrivateFieldGet(Bl,this).length;t<i;t+=6)isNaN(freedraw_classPrivateFieldGet(Bl,this)[t])?e.push(`L${freedraw_classPrivateFieldGet(Bl,this)[t+4]} ${freedraw_classPrivateFieldGet(Bl,this)[t+5]}`):e.push(`C${freedraw_classPrivateFieldGet(Bl,this)[t]} ${freedraw_classPrivateFieldGet(Bl,this)[t+1]} ${freedraw_classPrivateFieldGet(Bl,this)[t+2]} ${freedraw_classPrivateFieldGet(Bl,this)[t+3]} ${freedraw_classPrivateFieldGet(Bl,this)[t+4]} ${freedraw_classPrivateFieldGet(Bl,this)[t+5]}`);e.push("Z");return e.join(" ")}serialize(e,t){let[i,a,s,n]=e;const r=s-i,o=n-a;let l,d;switch(t){case 0:l=Outline._rescale(freedraw_classPrivateFieldGet(Bl,this),i,n,r,-o);d=Outline._rescale(freedraw_classPrivateFieldGet(Al,this),i,n,r,-o);break;case 90:l=Outline._rescaleAndSwap(freedraw_classPrivateFieldGet(Bl,this),i,a,r,o);d=Outline._rescaleAndSwap(freedraw_classPrivateFieldGet(Al,this),i,a,r,o);break;case 180:l=Outline._rescale(freedraw_classPrivateFieldGet(Bl,this),s,a,-r,o);d=Outline._rescale(freedraw_classPrivateFieldGet(Al,this),s,a,-r,o);break;case 270:l=Outline._rescaleAndSwap(freedraw_classPrivateFieldGet(Bl,this),s,n,-r,-o);d=Outline._rescaleAndSwap(freedraw_classPrivateFieldGet(Al,this),s,n,-r,-o)}return{outline:Array.from(l),points:[Array.from(d)]}}get box(){return freedraw_classPrivateFieldGet(xl,this)}newOutliner(e,t,i,a,s){return new FreeDrawOutliner(e,t,i,a,s,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0)}getNewOutline(e,t){const[i,a,s,n]=freedraw_classPrivateFieldGet(xl,this),[r,o,l,d]=freedraw_classPrivateFieldGet(Cl,this),c=s*l,h=n*d,u=i*l+r,_=a*d+o,p=this.newOutliner({x:freedraw_classPrivateFieldGet(Al,this)[0]*c+u,y:freedraw_classPrivateFieldGet(Al,this)[1]*h+_},freedraw_classPrivateFieldGet(Cl,this),freedraw_classPrivateFieldGet(Gl,this),e,freedraw_classPrivateFieldGet(El,this),t??freedraw_classPrivateFieldGet(kl,this));for(let e=2;e<freedraw_classPrivateFieldGet(Al,this).length;e+=2)p.add({x:freedraw_classPrivateFieldGet(Al,this)[e]*c+u,y:freedraw_classPrivateFieldGet(Al,this)[e+1]*h+_});return p.getOutlines()}}function _computeMinMax(e){const t=freedraw_classPrivateFieldGet(Bl,this);let i=t[4],a=t[5];const s=[i,a,i,a];let n=i,r=a,o=i,l=a;const d=e?Math.max:Math.min,c=new Float32Array(4);for(let e=6,h=t.length;e<h;e+=6){const h=t[e+4],u=t[e+5];if(isNaN(t[e])){Util.pointBoundingBox(h,u,s);if(r>u){n=h;r=u}else r===u&&(n=d(n,h));if(l<u){o=h;l=u}else l===u&&(o=d(o,h))}else{c[0]=c[1]=1/0;c[2]=c[3]=-1/0;Util.bezierBoundingBox(i,a,...t.slice(e,e+6),c);Util.rectBoundingBox(c[0],c[1],c[2],c[3],s);if(r>c[1]){n=c[0];r=c[1]}else r===c[1]&&(n=d(n,c[0]));if(l<c[3]){o=c[2];l=c[3]}else l===c[3]&&(o=d(o,c[2]))}i=h;a=u}const h=freedraw_classPrivateFieldGet(xl,this);h[0]=s[0]-freedraw_classPrivateFieldGet(kl,this);h[1]=s[1]-freedraw_classPrivateFieldGet(kl,this);h[2]=s[2]-s[0]+2*freedraw_classPrivateFieldGet(kl,this);h[3]=s[3]-s[1]+2*freedraw_classPrivateFieldGet(kl,this);this.firstPoint=[n,r];this.lastPoint=[o,l]}function highlight_classPrivateFieldInitSpec(e,t,i){highlight_checkPrivateRedeclaration(e,t),t.set(e,i)}function highlight_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function highlight_classPrivateFieldSet(e,t,i){return e.set(highlight_assertClassBrand(e,t),i),i}function highlight_classPrivateFieldGet(e,t){return e.get(highlight_assertClassBrand(e,t))}function highlight_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Il=new WeakMap,Tl=new WeakMap,Dl=new WeakMap,Ll=new WeakMap,Rl=new WeakMap,Nl=new WeakSet;class HighlightOutliner{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];!function highlight_classPrivateMethodInitSpec(e,t){highlight_checkPrivateRedeclaration(e,t),t.add(e)}(this,Nl);highlight_classPrivateFieldInitSpec(this,Il,void 0);highlight_classPrivateFieldInitSpec(this,Tl,void 0);highlight_classPrivateFieldInitSpec(this,Dl,void 0);highlight_classPrivateFieldInitSpec(this,Ll,[]);highlight_classPrivateFieldInitSpec(this,Rl,[]);const s=[1/0,1/0,-1/0,-1/0],n=10**-4;for(const{x:i,y:a,width:r,height:o}of e){const e=Math.floor((i-t)/n)*n,l=Math.ceil((i+r+t)/n)*n,d=Math.floor((a-t)/n)*n,c=Math.ceil((a+o+t)/n)*n,h=[e,d,c,!0],u=[l,d,c,!1];highlight_classPrivateFieldGet(Ll,this).push(h,u);Util.rectBoundingBox(e,d,l,c,s)}const r=s[2]-s[0]+2*i,o=s[3]-s[1]+2*i,l=s[0]-i,d=s[1]-i;let c=a?-1/0:1/0,h=1/0;const u=highlight_classPrivateFieldGet(Ll,this).at(a?-1:-2),_=[u[0],u[2]];for(const e of highlight_classPrivateFieldGet(Ll,this)){const[t,i,s,n]=e;if(!n&&a)if(i<h){h=i;c=t}else i===h&&(c=Math.max(c,t));else if(n&&!a)if(i<h){h=i;c=t}else i===h&&(c=Math.min(c,t));e[0]=(t-l)/r;e[1]=(i-d)/o;e[2]=(s-d)/o}highlight_classPrivateFieldSet(Il,this,new Float32Array([l,d,r,o]));highlight_classPrivateFieldSet(Tl,this,[c,h]);highlight_classPrivateFieldSet(Dl,this,_)}getOutlines(){highlight_classPrivateFieldGet(Ll,this).sort((e,t)=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2]);const e=[];for(const t of highlight_classPrivateFieldGet(Ll,this))if(t[3]){e.push(...highlight_assertClassBrand(Nl,this,_breakEdge).call(this,t));highlight_assertClassBrand(Nl,this,_insert).call(this,t)}else{highlight_assertClassBrand(Nl,this,_remove).call(this,t);e.push(...highlight_assertClassBrand(Nl,this,_breakEdge).call(this,t))}return highlight_assertClassBrand(Nl,this,_getOutlines).call(this,e)}}function _getOutlines(e){const t=[],i=new Set;for(const i of e){const[e,a,s]=i;t.push([e,a,i],[e,s,i])}t.sort((e,t)=>e[1]-t[1]||e[0]-t[0]);for(let e=0,a=t.length;e<a;e+=2){const a=t[e][2],s=t[e+1][2];a.push(s);s.push(a);i.add(a);i.add(s)}const a=[];let s;for(;i.size>0;){const e=i.values().next().value;let[t,n,r,o,l]=e;i.delete(e);let d=t,c=n;s=[t,r];a.push(s);for(;;){let e;if(i.has(o))e=o;else{if(!i.has(l))break;e=l}i.delete(e);[t,n,r,o,l]=e;if(d!==t){s.push(d,c,t,c===n?n:r);d=t}c=c===n?r:n}s.push(d,c)}return new HighlightOutline(a,highlight_classPrivateFieldGet(Il,this),highlight_classPrivateFieldGet(Tl,this),highlight_classPrivateFieldGet(Dl,this))}function _binarySearch(e){const t=highlight_classPrivateFieldGet(Rl,this);let i=0,a=t.length-1;for(;i<=a;){const s=i+a>>1,n=t[s][0];if(n===e)return s;n<e?i=s+1:a=s-1}return a+1}function _insert(e){let[,t,i]=e;const a=highlight_assertClassBrand(Nl,this,_binarySearch).call(this,t);highlight_classPrivateFieldGet(Rl,this).splice(a,0,[t,i])}function _remove(e){let[,t,i]=e;const a=highlight_assertClassBrand(Nl,this,_binarySearch).call(this,t);for(let e=a;e<highlight_classPrivateFieldGet(Rl,this).length;e++){const[a,s]=highlight_classPrivateFieldGet(Rl,this)[e];if(a!==t)break;if(a===t&&s===i){highlight_classPrivateFieldGet(Rl,this).splice(e,1);return}}for(let e=a-1;e>=0;e--){const[a,s]=highlight_classPrivateFieldGet(Rl,this)[e];if(a!==t)break;if(a===t&&s===i){highlight_classPrivateFieldGet(Rl,this).splice(e,1);return}}}function _breakEdge(e){const[t,i,a]=e,s=[[t,i,a]],n=highlight_assertClassBrand(Nl,this,_binarySearch).call(this,a);for(let e=0;e<n;e++){const[i,a]=highlight_classPrivateFieldGet(Rl,this)[e];for(let e=0,n=s.length;e<n;e++){const[,r,o]=s[e];if(!(a<=r||o<=i))if(r>=i)if(o>a)s[e][1]=a;else{if(1===n)return[];s.splice(e,1);e--;n--}else{s[e][2]=i;o>a&&s.push([t,a,o])}}}return s}var Ol,Wl=new WeakMap,jl=new WeakMap;class HighlightOutline extends Outline{constructor(e,t,i,a){super();highlight_classPrivateFieldInitSpec(this,Wl,void 0);highlight_classPrivateFieldInitSpec(this,jl,void 0);highlight_classPrivateFieldSet(jl,this,e);highlight_classPrivateFieldSet(Wl,this,t);this.firstPoint=i;this.lastPoint=a}toSVGPath(){const e=[];for(const t of highlight_classPrivateFieldGet(jl,this)){let[i,a]=t;e.push(`M${i} ${a}`);for(let s=2;s<t.length;s+=2){const n=t[s],r=t[s+1];if(n===i){e.push(`V${r}`);a=r}else if(r===a){e.push(`H${n}`);i=n}}e.push("Z")}return e.join(" ")}serialize(e,t){let[i,a,s,n]=e;const r=[],o=s-i,l=n-a;for(const e of highlight_classPrivateFieldGet(jl,this)){const t=new Array(e.length);for(let a=0;a<e.length;a+=2){t[a]=i+e[a]*o;t[a+1]=n-e[a+1]*l}r.push(t)}return r}get box(){return highlight_classPrivateFieldGet(Wl,this)}get classNamesForOutlining(){return["highlightOutline"]}}class FreeHighlightOutliner extends FreeDrawOutliner{newFreeDrawOutline(e,t,i,a,s,n){return new FreeHighlightOutline(e,t,i,a,s,n)}}class FreeHighlightOutline extends FreeDrawOutline{newOutliner(e,t,i,a,s){return new FreeHighlightOutliner(e,t,i,a,s,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0)}}function highlight_defineProperty(e,t,i){return(t=function highlight_toPropertyKey(e){var t=function highlight_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function editor_highlight_classPrivateFieldInitSpec(e,t,i){editor_highlight_checkPrivateRedeclaration(e,t),t.set(e,i)}function editor_highlight_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function highlight_toSetter(e,t,i){t||(t=[]);var a=t.length++;return Object.defineProperty({},"_",{set:function(s){t[a]=s,e.apply(i,t)}})}function editor_highlight_classPrivateFieldGet(e,t){return e.get(editor_highlight_assertClassBrand(e,t))}function editor_highlight_classPrivateFieldSet(e,t,i){return e.set(editor_highlight_assertClassBrand(e,t),i),i}function editor_highlight_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Vl,Ul=new WeakMap,zl=new WeakMap,Hl=new WeakMap,$l=new WeakMap,ql=new WeakMap,Xl=new WeakMap,Kl=new WeakMap,Yl=new WeakMap,Zl=new WeakMap,Jl=new WeakMap,Ql=new WeakMap,ed=new WeakMap,td=new WeakMap,id=new WeakMap,ad=new WeakMap,sd=new WeakMap,nd=new WeakMap,rd=new WeakMap,od=new WeakSet;class HighlightEditor extends AnnotationEditor{static get _keyboardManager(){const e=HighlightEditor.prototype;return shadow(this,"_keyboardManager",new KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:"highlightEditor"});!function editor_highlight_classPrivateMethodInitSpec(e,t){editor_highlight_checkPrivateRedeclaration(e,t),t.add(e)}(this,od);editor_highlight_classPrivateFieldInitSpec(this,Ul,null);editor_highlight_classPrivateFieldInitSpec(this,zl,0);editor_highlight_classPrivateFieldInitSpec(this,Hl,void 0);editor_highlight_classPrivateFieldInitSpec(this,$l,null);editor_highlight_classPrivateFieldInitSpec(this,ql,null);editor_highlight_classPrivateFieldInitSpec(this,Xl,null);editor_highlight_classPrivateFieldInitSpec(this,Kl,null);editor_highlight_classPrivateFieldInitSpec(this,Yl,0);editor_highlight_classPrivateFieldInitSpec(this,Zl,null);editor_highlight_classPrivateFieldInitSpec(this,Jl,null);editor_highlight_classPrivateFieldInitSpec(this,Ql,null);editor_highlight_classPrivateFieldInitSpec(this,ed,!1);editor_highlight_classPrivateFieldInitSpec(this,td,null);editor_highlight_classPrivateFieldInitSpec(this,id,null);editor_highlight_classPrivateFieldInitSpec(this,ad,null);editor_highlight_classPrivateFieldInitSpec(this,sd,"");editor_highlight_classPrivateFieldInitSpec(this,nd,void 0);editor_highlight_classPrivateFieldInitSpec(this,rd,"");this.color=e.color||HighlightEditor._defaultColor;editor_highlight_classPrivateFieldSet(nd,this,e.thickness||HighlightEditor._defaultThickness);this.opacity=e.opacity||HighlightEditor._defaultOpacity;editor_highlight_classPrivateFieldSet(Hl,this,e.boxes||null);editor_highlight_classPrivateFieldSet(rd,this,e.methodOfCreation||"");editor_highlight_classPrivateFieldSet(sd,this,e.text||"");this._isDraggable=!1;this.defaultL10nId="pdfjs-editor-highlight-editor";if(e.highlightId>-1){editor_highlight_classPrivateFieldSet(ed,this,!0);editor_highlight_assertClassBrand(od,this,_createFreeOutlines).call(this,e);editor_highlight_assertClassBrand(od,this,_addToDrawLayer).call(this)}else if(editor_highlight_classPrivateFieldGet(Hl,this)){editor_highlight_classPrivateFieldSet(Ul,this,e.anchorNode);editor_highlight_classPrivateFieldSet(zl,this,e.anchorOffset);editor_highlight_classPrivateFieldSet(Kl,this,e.focusNode);editor_highlight_classPrivateFieldSet(Yl,this,e.focusOffset);editor_highlight_assertClassBrand(od,this,_createOutlines).call(this);editor_highlight_assertClassBrand(od,this,_addToDrawLayer).call(this);this.rotate(this.rotation)}this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"added",page:this.pageIndex+1,id:this.uid,editorType:this.constructor.name,value:{color:this.color,thickness:editor_highlight_classPrivateFieldGet(nd,this),isFreeHighlight:editor_highlight_classPrivateFieldGet(ed,this),text:editor_highlight_classPrivateFieldGet(sd,this)}});this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}get telemetryInitialData(){return{action:"added",type:editor_highlight_classPrivateFieldGet(ed,this)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:editor_highlight_classPrivateFieldGet(nd,this),methodOfCreation:editor_highlight_classPrivateFieldGet(rd,this)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,t){AnnotationEditor.initialize(e,t);HighlightEditor._defaultColor||=t.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(e,t){switch(e){case m.HIGHLIGHT_COLOR:HighlightEditor._defaultColor=t;break;case m.HIGHLIGHT_THICKNESS:HighlightEditor._defaultThickness=t}}translateInPage(e,t){}get toolbarPosition(){return editor_highlight_classPrivateFieldGet(id,this)}get commentButtonPosition(){return editor_highlight_classPrivateFieldGet(td,this)}updateParams(e,t){switch(e){case m.HIGHLIGHT_COLOR:editor_highlight_assertClassBrand(od,this,highlight_updateColor).call(this,t);break;case m.HIGHLIGHT_THICKNESS:editor_highlight_assertClassBrand(od,this,_updateThickness).call(this,t)}}static get defaultPropertiesToUpdate(){return[[m.HIGHLIGHT_COLOR,HighlightEditor._defaultColor],[m.HIGHLIGHT_THICKNESS,HighlightEditor._defaultThickness]]}get propertiesToUpdate(){return[[m.HIGHLIGHT_COLOR,this.color||HighlightEditor._defaultColor],[m.HIGHLIGHT_THICKNESS,editor_highlight_classPrivateFieldGet(nd,this)||HighlightEditor._defaultThickness],[m.HIGHLIGHT_FREE,editor_highlight_classPrivateFieldGet(ed,this)]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(Ql,this),{root:{fill:this.color,"fill-opacity":this.opacity}});editor_highlight_classPrivateFieldGet(ql,this)?.updateColor(this.color);super.onUpdatedColor()}get toolbarButtons(){if(this._uiManager.highlightColors){return[["colorPicker",editor_highlight_classPrivateFieldSet(ql,this,new ColorPicker({editor:this}))]]}return super.toolbarButtons}disableEditing(){super.disableEditing();this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing();this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(editor_highlight_assertClassBrand(od,this,_getRotation).call(this))}getBaseTranslation(){return[0,0]}getRect(e,t){return super.getRect(e,t,editor_highlight_assertClassBrand(od,this,_getRotation).call(this))}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this);e&&this.div.focus()}remove(){editor_highlight_assertClassBrand(od,this,_cleanDrawLayer).call(this);this._reportTelemetry({action:"deleted"});super.remove()}rebuild(){if(this.parent){super.rebuild();if(null!==this.div){editor_highlight_assertClassBrand(od,this,_addToDrawLayer).call(this);this.isAttachedToDOM||this.parent.add(this)}}}setParent(e){let t=!1;if(this.parent&&!e)editor_highlight_assertClassBrand(od,this,_cleanDrawLayer).call(this);else if(e){editor_highlight_assertClassBrand(od,this,_addToDrawLayer).call(this,e);t=!this.parent&&this.div?.classList.contains("selectedEditor")}super.setParent(e);this.show(this._isVisible);t&&this.select()}rotate(e){const{drawLayer:t}=this.parent;let i;if(editor_highlight_classPrivateFieldGet(ed,this)){e=(e-this.rotation+360)%360;i=_rotateBbox.call(HighlightEditor,editor_highlight_classPrivateFieldGet(Jl,this).box,e)}else i=_rotateBbox.call(HighlightEditor,[this.x,this.y,this.width,this.height],e);t.updateProperties(editor_highlight_classPrivateFieldGet(Ql,this),{bbox:i,root:{"data-main-rotation":e}});t.updateProperties(editor_highlight_classPrivateFieldGet(ad,this),{bbox:_rotateBbox.call(HighlightEditor,editor_highlight_classPrivateFieldGet(Xl,this).box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;const e=super.render();if(editor_highlight_classPrivateFieldGet(sd,this)){e.setAttribute("aria-label",editor_highlight_classPrivateFieldGet(sd,this));e.setAttribute("role","mark")}editor_highlight_classPrivateFieldGet(ed,this)?e.classList.add("free"):this.div.addEventListener("keydown",editor_highlight_assertClassBrand(od,this,_keydown).bind(this),{signal:this._uiManager._signal});const t=editor_highlight_classPrivateFieldSet(Zl,this,document.createElement("div"));e.append(t);t.setAttribute("aria-hidden","true");t.className="internal";t.style.clipPath=editor_highlight_classPrivateFieldGet($l,this);this.setDims();bindEvents(this,editor_highlight_classPrivateFieldGet(Zl,this),["pointerover","pointerleave"]);this.enableEditing();return e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(ad,this),{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(ad,this),{rootClass:{hovered:!1}})}_moveCaret(e){this.parent.unselect(this);switch(e){case 0:case 2:editor_highlight_assertClassBrand(od,this,_setCaret).call(this,!0);break;case 1:case 3:editor_highlight_assertClassBrand(od,this,_setCaret).call(this,!1)}}select(){super.select();editor_highlight_classPrivateFieldGet(ad,this)&&this.parent?.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(ad,this),{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect();if(editor_highlight_classPrivateFieldGet(ad,this)){this.parent?.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(ad,this),{rootClass:{selected:!1}});editor_highlight_classPrivateFieldGet(ed,this)||editor_highlight_assertClassBrand(od,this,_setCaret).call(this,!1)}}get _mustFixPosition(){return!editor_highlight_classPrivateFieldGet(ed,this)}show(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;super.show(e);if(this.parent){this.parent.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(Ql,this),{rootClass:{hidden:!e}});this.parent.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(ad,this),{rootClass:{hidden:!e}})}}static startHighlighting(e,t,i){let{target:a,x:s,y:n}=i;const{x:r,y:o,width:l,height:d}=a.getBoundingClientRect(),c=new AbortController,h=e.combinedSignal(c),pointerUpCallback=t=>{c.abort();editor_highlight_assertClassBrand(HighlightEditor,this,_endHighlight).call(this,e,t)};window.addEventListener("blur",pointerUpCallback,{signal:h});window.addEventListener("pointerup",pointerUpCallback,{signal:h});window.addEventListener("pointerdown",stopEvent,{capture:!0,passive:!1,signal:h});window.addEventListener("contextmenu",noContextMenu,{signal:h});a.addEventListener("pointermove",editor_highlight_assertClassBrand(HighlightEditor,this,_highlightMove).bind(this,e),{signal:h});this._freeHighlight=new FreeHighlightOutliner({x:s,y:n},[r,o,l,d],e.scale,this._defaultThickness/2,t,.001);({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0))}static async deserialize(e,t,i){let a=null;if(e instanceof HighlightAnnotationElement){const{data:{quadPoints:t,rect:i,rotation:s,id:n,color:r,opacity:o,popupRef:l,richText:d,contentsObj:c,creationDate:h,modificationDate:u},parent:{page:{pageNumber:_}}}=e;a=e={annotationType:f.HIGHLIGHT,color:Array.from(r),opacity:o,quadPoints:t,boxes:null,pageIndex:_-1,rect:i.slice(0),rotation:s,annotationElementId:n,id:n,deleted:!1,popupRef:l,richText:d,comment:c?.str||null,creationDate:h,modificationDate:u}}else if(e.annotationType&&e.annotationType===f.HIGHLIGHT){let t,{quadPoints:i,outlines:s,rect:n,rotation:r,id:o,color:l,opacity:d,popup:c,popupRef:h,pageIndex:u,thickness:_}=e;i&&(Array.isArray(i)||(i=Object.values(i)));if(!i&&s){if(Array.isArray(s))t=s.map(e=>e);else{if("object"!=typeof s||!s.points){console.error("Unexpected outlines format");return null}t=[s.points.flat()]}_=_||e.thickness||1}a=e={annotationType:f.HIGHLIGHT,color:Array.from(l),opacity:d,quadPoints:i,inkLists:t,thickness:_,boxes:null,pageIndex:u,rect:n.slice(0),rotation:r,id:o,deleted:!1,popupRef:h||!(!c||!c.contents||c.deleted)||null,comment:!c?.deleted&&c?.contents||null,commentDate:!c?.deleted&&c?.date||null}}else if(e instanceof InkAnnotationElement){const{data:{inkLists:t,rect:i,rotation:s,id:n,color:r,borderStyle:{rawWidth:o},popupRef:l,richText:d,contentsObj:c,creationDate:h,modificationDate:u},parent:{page:{pageNumber:_}}}=e;a=e={annotationType:f.HIGHLIGHT,color:Array.from(r),thickness:o,inkLists:t,boxes:null,pageIndex:_-1,rect:i.slice(0),rotation:s,annotationElementId:n,id:n,deleted:!1,popupRef:l,richText:d,comment:c?.str||null,creationDate:h,modificationDate:u}}const{color:s,quadPoints:n,inkLists:r,outlines:o,opacity:l}=e,d=await super.deserialize(e,t,i);d.color=Util.makeHexColor(...s);d.opacity=l||1;r&&editor_highlight_classPrivateFieldSet(nd,d,e.thickness);d._initialData=a;e.comment&&d.setCommentData(e);const[c,h]=d.pageDimensions,[u,_]=d.pageTranslation;if(n){const e=editor_highlight_classPrivateFieldSet(Hl,d,[]);for(let t=0;t<n.length;t+=8)e.push({x:(n[t]-u)/c,y:1-(n[t+1]-_)/h,width:(n[t+2]-n[t])/c,height:(n[t+1]-n[t+5])/h});editor_highlight_assertClassBrand(od,d,_createOutlines).call(d);editor_highlight_assertClassBrand(od,d,_addToDrawLayer).call(d);d.rotate(d.rotation)}else if(r||o){editor_highlight_classPrivateFieldSet(ed,d,!0);const e=(r||o.points)[0],i={x:e[0]-u,y:h-(e[1]-_)},a=new FreeHighlightOutliner(i,[0,0,c,h],1,editor_highlight_classPrivateFieldGet(nd,d)/2,!0,.001);for(let t=0,s=e.length;t<s;t+=2){i.x=e[t]-u;i.y=h-(e[t+1]-_);a.add(i)}const{id:s,clipPathId:n}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:d.color,"fill-opacity":d._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:a.toSVGPath()}},!0,!0);editor_highlight_assertClassBrand(od,d,_createFreeOutlines).call(d,{highlightOutlines:a.getOutlines(),highlightId:s,clipPathId:n});editor_highlight_assertClassBrand(od,d,_addToDrawLayer).call(d);d.rotate(d.parentRotation)}return d}serialize(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isEmpty()||e&&!i)return null;if(this.deleted)return this.serializeDeleted();const a=AnnotationEditor._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),s=super.serialize(e,t);Object.assign(s,{color:a,opacity:this.opacity,thickness:editor_highlight_classPrivateFieldGet(nd,this),quadPoints:editor_highlight_assertClassBrand(od,this,_serializeBoxes).call(this),outlines:editor_highlight_assertClassBrand(od,this,_serializeOutlines).call(this,s.rect)});this.addComment(s,this._isCopy);if(e&&i){s.id=this.uid;s.isCopy=!0;return s}if(this.annotationElementId&&!editor_highlight_assertClassBrand(od,this,highlight_hasElementChanged).call(this,s))return null;s.id=this.uid;return s}renderAnnotationElement(e){if(this.deleted){e.hide();return null}e.updateEdited({rect:this.getPDFRect(),popup:this.comment});return null}static canCreateNewEmptyEditor(){return!1}}Ol=HighlightEditor;function _createOutlines(){const e=new HighlightOutliner(editor_highlight_classPrivateFieldGet(Hl,this),.001);editor_highlight_classPrivateFieldSet(Jl,this,e.getOutlines());[this.x,this.y,this.width,this.height]=editor_highlight_classPrivateFieldGet(Jl,this).box;const t=new HighlightOutliner(editor_highlight_classPrivateFieldGet(Hl,this),.0025,.001,"ltr"===this._uiManager.direction);editor_highlight_classPrivateFieldSet(Xl,this,t.getOutlines());const{firstPoint:i}=editor_highlight_classPrivateFieldGet(Jl,this);editor_highlight_classPrivateFieldSet(td,this,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]);const{lastPoint:a}=editor_highlight_classPrivateFieldGet(Xl,this);editor_highlight_classPrivateFieldSet(id,this,[(a[0]-this.x)/this.width,(a[1]-this.y)/this.height])}function _createFreeOutlines(e){let{highlightOutlines:t,highlightId:i,clipPathId:a}=e;editor_highlight_classPrivateFieldSet(Jl,this,t);editor_highlight_classPrivateFieldSet(Xl,this,t.getNewOutline(editor_highlight_classPrivateFieldGet(nd,this)/2+1.5,.0025));if(i>=0){editor_highlight_classPrivateFieldSet(Ql,this,i);editor_highlight_classPrivateFieldSet($l,this,a);this.parent.drawLayer.finalizeDraw(i,{bbox:t.box,path:{d:t.toSVGPath()}});editor_highlight_classPrivateFieldSet(ad,this,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:editor_highlight_classPrivateFieldGet(Xl,this).box,path:{d:editor_highlight_classPrivateFieldGet(Xl,this).toSVGPath()}},!0))}else if(this.parent){const e=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(Ql,this),{bbox:_rotateBbox.call(Ol,editor_highlight_classPrivateFieldGet(Jl,this).box,(e-this.rotation+360)%360),path:{d:t.toSVGPath()}});this.parent.drawLayer.updateProperties(editor_highlight_classPrivateFieldGet(ad,this),{bbox:_rotateBbox.call(Ol,editor_highlight_classPrivateFieldGet(Xl,this).box,e),path:{d:editor_highlight_classPrivateFieldGet(Xl,this).toSVGPath()}})}const[s,n,r,o]=t.box;switch(this.rotation){case 0:this.x=s;this.y=n;this.width=r;this.height=o;break;case 90:{const[e,t]=this.parentDimensions;this.x=n;this.y=1-s;this.width=r*t/e;this.height=o*e/t;break}case 180:this.x=1-s;this.y=1-n;this.width=r;this.height=o;break;case 270:{const[e,t]=this.parentDimensions;this.x=1-n;this.y=s;this.width=r*t/e;this.height=o*e/t;break}}const{firstPoint:l}=t;editor_highlight_classPrivateFieldSet(td,this,[(l[0]-s)/r,(l[1]-n)/o]);const{lastPoint:d}=editor_highlight_classPrivateFieldGet(Xl,this);editor_highlight_classPrivateFieldSet(id,this,[(d[0]-s)/r,(d[1]-n)/o])}function highlight_updateColor(e){const setColorAndOpacity=(e,t)=>{this.color=e;this.opacity=t;this.onUpdatedColor()},t=this.color,i=this.opacity;this.addCommands({cmd:setColorAndOpacity.bind(this,e,Ol._defaultOpacity),undo:setColorAndOpacity.bind(this,t,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:m.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0});this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(e)},!0);this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"colorChanged",page:this.pageIndex+1,id:this.uid,editorType:this.constructor.name,value:e,previousValue:t})}function _updateThickness(e){const t=editor_highlight_classPrivateFieldGet(nd,this),setThickness=e=>{editor_highlight_classPrivateFieldSet(nd,this,e);editor_highlight_assertClassBrand(od,this,_changeThickness).call(this,e)};this.addCommands({cmd:setThickness.bind(this,e),undo:setThickness.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:m.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0});this._reportTelemetry({action:"thickness_changed",thickness:e},!0);this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"thicknessChanged",page:this.pageIndex+1,id:this.uid,editorType:this.constructor.name,value:e,previousValue:t})}function _changeThickness(e){if(editor_highlight_classPrivateFieldGet(ed,this)){editor_highlight_assertClassBrand(od,this,_createFreeOutlines).call(this,{highlightOutlines:editor_highlight_classPrivateFieldGet(Jl,this).getNewOutline(e/2)});this.fixAndSetPosition();this.setDims()}}function _cleanDrawLayer(){if(null!==editor_highlight_classPrivateFieldGet(Ql,this)&&this.parent){this.parent.drawLayer.remove(editor_highlight_classPrivateFieldGet(Ql,this));editor_highlight_classPrivateFieldSet(Ql,this,null);this.parent.drawLayer.remove(editor_highlight_classPrivateFieldGet(ad,this));editor_highlight_classPrivateFieldSet(ad,this,null)}}function _addToDrawLayer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;if(null===editor_highlight_classPrivateFieldGet(Ql,this)){({id:highlight_toSetter(editor_highlight_classPrivateFieldSet,[Ql,this])._,clipPathId:highlight_toSetter(editor_highlight_classPrivateFieldSet,[$l,this])._}=e.drawLayer.draw({bbox:editor_highlight_classPrivateFieldGet(Jl,this).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:editor_highlight_classPrivateFieldGet(ed,this)},path:{d:editor_highlight_classPrivateFieldGet(Jl,this).toSVGPath()}},!1,!0));editor_highlight_classPrivateFieldSet(ad,this,e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:editor_highlight_classPrivateFieldGet(ed,this)},bbox:editor_highlight_classPrivateFieldGet(Xl,this).box,path:{d:editor_highlight_classPrivateFieldGet(Xl,this).toSVGPath()}},editor_highlight_classPrivateFieldGet(ed,this)));editor_highlight_classPrivateFieldGet(Zl,this)&&(editor_highlight_classPrivateFieldGet(Zl,this).style.clipPath=editor_highlight_classPrivateFieldGet($l,this))}}function _rotateBbox(e,t){let[i,a,s,n]=e;switch(t){case 90:return[1-a-n,i,n,s];case 180:return[1-i-s,1-a-n,s,n];case 270:return[a,1-i-s,n,s]}return[i,a,s,n]}function _keydown(e){Ol._keyboardManager.exec(this,e)}function _setCaret(e){if(!editor_highlight_classPrivateFieldGet(Ul,this))return;const t=window.getSelection();e?t.setPosition(editor_highlight_classPrivateFieldGet(Ul,this),editor_highlight_classPrivateFieldGet(zl,this)):t.setPosition(editor_highlight_classPrivateFieldGet(Kl,this),editor_highlight_classPrivateFieldGet(Yl,this))}function _getRotation(){return editor_highlight_classPrivateFieldGet(ed,this)?this.rotation:0}function _serializeBoxes(){if(editor_highlight_classPrivateFieldGet(ed,this))return null;const[e,t]=this.pageDimensions,[i,a]=this.pageTranslation,s=editor_highlight_classPrivateFieldGet(Hl,this),n=new Float32Array(8*s.length);let r=0;for(const{x:o,y:l,width:d,height:c}of s){const s=o*e+i,h=(1-l)*t+a;n[r]=n[r+4]=s;n[r+1]=n[r+3]=h;n[r+2]=n[r+6]=s+d*e;n[r+5]=n[r+7]=h-c*t;r+=8}return n}function _serializeOutlines(e){return editor_highlight_classPrivateFieldGet(Jl,this).serialize(e,editor_highlight_assertClassBrand(od,this,_getRotation).call(this))}function _highlightMove(e,t){this._freeHighlight.add(t)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}function _endHighlight(e,t){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(t,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"});this._freeHighlightId=-1;this._freeHighlight=null;this._freeHighlightClipId=""}function highlight_hasElementChanged(e){const{color:t}=this._initialData;return this.hasEditedComment||e.color.some((e,i)=>e!==t[i])}highlight_defineProperty(HighlightEditor,"_defaultColor",null);highlight_defineProperty(HighlightEditor,"_defaultOpacity",1);highlight_defineProperty(HighlightEditor,"_defaultThickness",12);highlight_defineProperty(HighlightEditor,"_type","highlight");highlight_defineProperty(HighlightEditor,"_editorType",f.HIGHLIGHT);highlight_defineProperty(HighlightEditor,"_freeHighlightId",-1);highlight_defineProperty(HighlightEditor,"_freeHighlight",null);highlight_defineProperty(HighlightEditor,"_freeHighlightClipId","");function draw_defineProperty(e,t,i){return(t=function draw_toPropertyKey(e){var t=function draw_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function draw_classPrivateFieldInitSpec(e,t,i){draw_checkPrivateRedeclaration(e,t),t.set(e,i)}function draw_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function draw_classPrivateFieldSet(e,t,i){return e.set(draw_assertClassBrand(e,t),i),i}function draw_classPrivateFieldGet(e,t){return e.get(draw_assertClassBrand(e,t))}function draw_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var ld=new WeakMap;class DrawingOptions{constructor(){draw_classPrivateFieldInitSpec(this,ld,Object.create(null))}updateProperty(e,t){this[e]=t;this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(const[t,i]of Object.entries(e))t.startsWith("_")||this.updateProperty(t,i)}updateSVGProperty(e,t){draw_classPrivateFieldGet(ld,this)[e]=t}toSVGProperties(){const e=draw_classPrivateFieldGet(ld,this);draw_classPrivateFieldSet(ld,this,Object.create(null));return{root:e}}reset(){draw_classPrivateFieldSet(ld,this,Object.create(null))}updateAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;this.updateProperties(e)}clone(){unreachable("Not implemented")}}var dd=new WeakMap,cd=new WeakMap,hd=new WeakSet;class DrawingEditor extends AnnotationEditor{constructor(e){super(e);!function draw_classPrivateMethodInitSpec(e,t){draw_checkPrivateRedeclaration(e,t),t.add(e)}(this,hd);draw_classPrivateFieldInitSpec(this,dd,null);draw_classPrivateFieldInitSpec(this,cd,void 0);draw_defineProperty(this,"_colorPicker",null);draw_defineProperty(this,"_drawId",null);draw_classPrivateFieldSet(cd,this,e.mustBeCommitted||!1);this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color);super.onUpdatedColor()}_addOutlines(e){if(e.drawOutlines){draw_assertClassBrand(hd,this,_createDrawOutlines).call(this,e);draw_assertClassBrand(hd,this,draw_addToDrawLayer).call(this)}}static _mergeSVGProperties(e,t){const i=new Set(Object.keys(e));for(const[a,s]of Object.entries(t))i.has(a)?Object.assign(e[a],s):e[a]=s;return e}static getDefaultDrawingOptions(e){unreachable("Not implemented")}static get typesMap(){unreachable("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,t){const i=this.typesMap.get(e);i&&this._defaultDrawingOptions.updateProperty(i,t);if(this._currentParent){ud._.updateProperty(i,t);this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties())}}updateParams(e,t){const i=this.constructor.typesMap.get(e);i&&this._updateProperty(e,i,t)}static get defaultPropertiesToUpdate(){const e=[],t=this._defaultDrawingOptions;for(const[i,a]of this.typesMap)e.push([i,t[a]]);return e}get propertiesToUpdate(){const e=[],{_drawingOptions:t}=this;for(const[i,a]of this.constructor.typesMap)e.push([i,t[a]]);return e}_updateProperty(e,t,i){const a=this._drawingOptions,s=a[t],setter=s=>{a.updateProperty(t,s);const n=draw_classPrivateFieldGet(dd,this).updateProperty(t,s);n&&draw_assertClassBrand(hd,this,_updateBbox).call(this,n);this.parent?.drawLayer.updateProperties(this._drawId,a.toSVGProperties());"stroke"===t?this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"colorChanged",page:this.pageIndex+1,editorType:this.constructor.name,value:i,id:this.uid}):"stroke-width"===t?this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"thicknessChanged",page:this.pageIndex+1,editorType:this.constructor.name,value:i,id:this.uid}):"stroke-opacity"===t&&this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"opacityChanged",page:this.pageIndex+1,editorType:this.constructor.name,value:i,id:this.uid});e===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:setter.bind(this,i),undo:setter.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,DrawingEditor._mergeSVGProperties(draw_classPrivateFieldGet(dd,this).getPathResizingSVGProperties(draw_assertClassBrand(hd,this,_convertToDrawSpace).call(this)),{bbox:draw_assertClassBrand(hd,this,_rotateBox).call(this)}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,DrawingEditor._mergeSVGProperties(draw_classPrivateFieldGet(dd,this).getPathResizedSVGProperties(draw_assertClassBrand(hd,this,_convertToDrawSpace).call(this)),{bbox:draw_assertClassBrand(hd,this,_rotateBox).call(this)}))}_onTranslating(e,t){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:draw_assertClassBrand(hd,this,_rotateBox).call(this)})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,DrawingEditor._mergeSVGProperties(draw_classPrivateFieldGet(dd,this).getPathTranslatedSVGProperties(draw_assertClassBrand(hd,this,_convertToDrawSpace).call(this),this.parentDimensions),{bbox:draw_assertClassBrand(hd,this,_rotateBox).call(this)}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit();this.disableEditMode();this.disableEditing()}disableEditing(){super.disableEditing();this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing();this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this);this._isDraggable=!0;if(draw_classPrivateFieldGet(cd,this)){draw_classPrivateFieldSet(cd,this,!1);this.commit();this.parent.setSelected(this);e&&this.isOnScreen&&this.div.focus()}}remove(){draw_assertClassBrand(hd,this,draw_cleanDrawLayer).call(this);super.remove()}rebuild(){if(this.parent){super.rebuild();if(null!==this.div){draw_assertClassBrand(hd,this,draw_addToDrawLayer).call(this);draw_assertClassBrand(hd,this,_updateBbox).call(this,draw_classPrivateFieldGet(dd,this).box);this.isAttachedToDOM||this.parent.add(this)}}}setParent(e){let t=!1;if(this.parent&&!e){this._uiManager.removeShouldRescale(this);draw_assertClassBrand(hd,this,draw_cleanDrawLayer).call(this)}else if(e){this._uiManager.addShouldRescale(this);draw_assertClassBrand(hd,this,draw_addToDrawLayer).call(this,e);t=!this.parent&&this.div?.classList.contains("selectedEditor")}super.setParent(e);t&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,DrawingEditor._mergeSVGProperties({bbox:draw_assertClassBrand(hd,this,_rotateBox).call(this)},draw_classPrivateFieldGet(dd,this).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&draw_assertClassBrand(hd,this,_updateBbox).call(this,draw_classPrivateFieldGet(dd,this).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,t;if(this._isCopy){e=this.x;t=this.y}const i=super.render();i.classList.add("draw");const a=document.createElement("div");i.append(a);a.setAttribute("aria-hidden","true");a.className="internal";this.setDims();this._uiManager.addShouldRescale(this);this.disableEditing();this._isCopy&&this._moveAfterPaste(e,t);return i}static createDrawerInstance(e,t,i,a,s){unreachable("Not implemented")}static startDrawing(e,t,i,a){const{target:s,offsetX:n,offsetY:r,pointerId:o,pointerType:l}=a;if(CurrentPointers.isInitializedAndDifferentPointerType(l))return;const{viewport:{rotation:d}}=e,{width:c,height:h}=s.getBoundingClientRect(),u=_d._=new AbortController,_=e.combinedSignal(u);CurrentPointers.setPointer(l,o);window.addEventListener("pointerup",e=>{CurrentPointers.isSamePointerIdOrRemove(e.pointerId)&&this._endDraw(e)},{signal:_});window.addEventListener("pointercancel",e=>{CurrentPointers.isSamePointerIdOrRemove(e.pointerId)&&this._currentParent.endDrawingSession()},{signal:_});window.addEventListener("pointerdown",e=>{if(CurrentPointers.isSamePointerType(e.pointerType)){CurrentPointers.initializeAndAddPointerId(e.pointerId);if(ud._.isCancellable()){ud._.removeLastElement();ud._.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)}}},{capture:!0,passive:!1,signal:_});window.addEventListener("contextmenu",noContextMenu,{signal:_});s.addEventListener("pointermove",this._drawMove.bind(this),{signal:_});s.addEventListener("touchmove",e=>{CurrentPointers.isSameTimeStamp(e.timeStamp)&&stopEvent(e)},{signal:_});e.toggleDrawing();this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"drawingStarted",editorType:this.name});t._editorUndoBar?.hide();if(ud._)e.drawLayer.updateProperties(this._currentDrawId,ud._.startNew(n,r,c,h,d));else{t.updateUIForDefaultProperties(this);ud._=this.createDrawerInstance(n,r,c,h,d);pd._=this.getDefaultDrawingOptions();this._currentParent=e;({id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(pd._.toSVGProperties(),ud._.defaultSVGProperties),!0,!1))}}static _drawMove(e){CurrentPointers.isSameTimeStamp(e.timeStamp);if(!ud._)return;const{offsetX:t,offsetY:i,pointerId:a}=e;if(CurrentPointers.isSamePointerId(a))if(CurrentPointers.isUsingMultiplePointers())this._endDraw(e);else{this._currentParent.drawLayer.updateProperties(this._currentDrawId,ud._.add(t,i));CurrentPointers.setTimeStamp(e.timeStamp);stopEvent(e)}}static _cleanup(e){if(e){this._currentDrawId=-1;this._currentParent=null;ud._=null;pd._=null;CurrentPointers.clearTimeStamp()}if(_d._){_d._.abort();_d._=null;CurrentPointers.clearPointerIds()}}static _endDraw(e){const t=this._currentParent;if(t){t.toggleDrawing(!0);this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"drawingStopped",editorType:this.name});this._cleanup(!1);e?.target===t.div&&t.drawLayer.updateProperties(this._currentDrawId,ud._.end(e.offsetX,e.offsetY));this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"bezierPathChanged",page:this._currentParent?this._currentParent.pageIndex+1:NaN,editorType:this.name,id:this.uid});if(this.supportMultipleDrawings){const e=ud._,i=this._currentDrawId,a=e.getLastElement();t.addCommands({cmd:()=>{t.drawLayer.updateProperties(i,e.setLastElement(a))},undo:()=>{t.drawLayer.updateProperties(i,e.removeLastElement())},mustExec:!1,type:m.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){const t=this._currentParent;if(!t)return null;t.toggleDrawing(!0);t.cleanUndoStack(m.DRAW_STEP);if(!ud._.isEmpty()){const{pageDimensions:[i,a],scale:s}=t,n=t.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:ud._.getOutlines(i*s,a*s,s,this._INNER_MARGIN),drawingOptions:pd._,mustBeCommitted:!e});this._cleanup(!0);return n}t.drawLayer.remove(this._currentDrawId);this._cleanup(!0);return null}createDrawingOptions(e){}static deserializeDraw(e,t,i,a,s,n){unreachable("Not implemented")}static async deserialize(e,t,i){const{rawDims:{pageWidth:a,pageHeight:s,pageX:n,pageY:r}}=t.viewport,o=this.deserializeDraw(n,r,a,s,this._INNER_MARGIN,e),l=await super.deserialize(e,t,i);l.createDrawingOptions(e);draw_assertClassBrand(hd,l,_createDrawOutlines).call(l,{drawOutlines:o});draw_assertClassBrand(hd,l,draw_addToDrawLayer).call(l);l.onScaleChanging();l.rotate();return l}serializeDraw(e){const[t,i]=this.pageTranslation,[a,s]=this.pageDimensions;return draw_classPrivateFieldGet(dd,this).serialize([t,i,a,s],e)}renderAnnotationElement(e){e.updateEdited({rect:this.getPDFRect()});return null}static canCreateNewEmptyEditor(){return!1}}Vl=DrawingEditor;function _createDrawOutlines(e){let{drawOutlines:t,drawId:i,drawingOptions:a}=e;draw_classPrivateFieldSet(dd,this,t);this._drawingOptions||=a;this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`);if(i>=0){this._drawId=i;this.parent.drawLayer.finalizeDraw(i,t.defaultProperties)}else this._drawId=draw_assertClassBrand(hd,this,_createDrawing).call(this,t,this.parent);draw_assertClassBrand(hd,this,_updateBbox).call(this,t.box)}function _createDrawing(e,t){const{id:i}=t.drawLayer.draw(Vl._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return i}function draw_cleanDrawLayer(){if(null!==this._drawId&&this.parent){this.parent.drawLayer.remove(this._drawId);this._drawId=null;this._drawingOptions.reset()}}function draw_addToDrawLayer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;if(null===this._drawId||this.parent!==e)if(null===this._drawId){this._drawingOptions.updateAll();this._drawId=draw_assertClassBrand(hd,this,_createDrawing).call(this,draw_classPrivateFieldGet(dd,this),e)}else this.parent.drawLayer.updateParent(this._drawId,e.drawLayer)}function _convertToParentSpace(e){let[t,i,a,s]=e;const{parentDimensions:[n,r],rotation:o}=this;switch(o){case 90:return[i,1-t,a*(r/n),s*(n/r)];case 180:return[1-t,1-i,a,s];case 270:return[1-i,t,a*(r/n),s*(n/r)];default:return[t,i,a,s]}}function _convertToDrawSpace(){const{x:e,y:t,width:i,height:a,parentDimensions:[s,n],rotation:r}=this;switch(r){case 90:return[1-t,e,i*(s/n),a*(n/s)];case 180:return[1-e,1-t,i,a];case 270:return[t,1-e,i*(s/n),a*(n/s)];default:return[e,t,i,a]}}function _updateBbox(e){[this.x,this.y,this.width,this.height]=draw_assertClassBrand(hd,this,_convertToParentSpace).call(this,e);if(this.div){this.fixAndSetPosition();this.setDims()}this._onResized()}function _rotateBox(){const{x:e,y:t,width:i,height:a,rotation:s,parentRotation:n,parentDimensions:[r,o]}=this;switch((4*s+n)/90){case 1:return[1-t-a,e,a,i];case 2:return[1-e-i,1-t-a,i,a];case 3:return[t,1-e-i,a,i];case 4:return[e,t-i*(r/o),a*(o/r),i*(r/o)];case 5:return[1-t,e,i*(r/o),a*(o/r)];case 6:return[1-e-a*(o/r),1-t,a*(o/r),i*(r/o)];case 7:return[t-i*(r/o),1-e-a*(o/r),i*(r/o),a*(o/r)];case 8:return[e-i,t-a,i,a];case 9:return[1-t,e-i,a,i];case 10:return[1-e,1-t,i,a];case 11:return[t-a,1-e,a,i];case 12:return[e-a*(o/r),t,a*(o/r),i*(r/o)];case 13:return[1-t-i*(r/o),e-a*(o/r),i*(r/o),a*(o/r)];case 14:return[1-e,1-t-i*(r/o),a*(o/r),i*(r/o)];case 15:return[t,1-e,i*(r/o),a*(o/r)];default:return[e,t,i,a]}}draw_defineProperty(DrawingEditor,"_currentDrawId",-1);draw_defineProperty(DrawingEditor,"_currentParent",null);var ud={_:null},_d={_:null},pd={_:null};draw_defineProperty(DrawingEditor,"_INNER_MARGIN",3);function inkdraw_classPrivateMethodInitSpec(e,t){inkdraw_checkPrivateRedeclaration(e,t),t.add(e)}function inkdraw_classPrivateFieldInitSpec(e,t,i){inkdraw_checkPrivateRedeclaration(e,t),t.set(e,i)}function inkdraw_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function inkdraw_classPrivateFieldGet(e,t){return e.get(inkdraw_assertClassBrand(e,t))}function inkdraw_classPrivateFieldSet(e,t,i){return e.set(inkdraw_assertClassBrand(e,t),i),i}function inkdraw_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var gd=new WeakMap,fd=new WeakMap,md=new WeakMap,vd=new WeakMap,Pd=new WeakMap,wd=new WeakMap,Fd=new WeakMap,bd=new WeakMap,yd=new WeakMap,Sd=new WeakMap,Cd=new WeakMap,xd=new WeakSet;class InkDrawOutliner{constructor(e,t,i,a,s,n){inkdraw_classPrivateMethodInitSpec(this,xd);inkdraw_classPrivateFieldInitSpec(this,gd,new Float64Array(6));inkdraw_classPrivateFieldInitSpec(this,fd,void 0);inkdraw_classPrivateFieldInitSpec(this,md,void 0);inkdraw_classPrivateFieldInitSpec(this,vd,void 0);inkdraw_classPrivateFieldInitSpec(this,Pd,void 0);inkdraw_classPrivateFieldInitSpec(this,wd,void 0);inkdraw_classPrivateFieldInitSpec(this,Fd,"");inkdraw_classPrivateFieldInitSpec(this,bd,0);inkdraw_classPrivateFieldInitSpec(this,yd,new InkDrawOutline);inkdraw_classPrivateFieldInitSpec(this,Sd,void 0);inkdraw_classPrivateFieldInitSpec(this,Cd,void 0);inkdraw_classPrivateFieldSet(Sd,this,i);inkdraw_classPrivateFieldSet(Cd,this,a);inkdraw_classPrivateFieldSet(vd,this,s);inkdraw_classPrivateFieldSet(Pd,this,n);[e,t]=inkdraw_assertClassBrand(xd,this,_normalizePoint).call(this,e,t);const r=inkdraw_classPrivateFieldSet(fd,this,[NaN,NaN,NaN,NaN,e,t]);inkdraw_classPrivateFieldSet(wd,this,[e,t]);inkdraw_classPrivateFieldSet(md,this,[{line:r,points:inkdraw_classPrivateFieldGet(wd,this)}]);inkdraw_classPrivateFieldGet(gd,this).set(r,0)}updateProperty(e,t){"stroke-width"===e&&inkdraw_classPrivateFieldSet(Pd,this,t)}isEmpty(){return!inkdraw_classPrivateFieldGet(md,this)||0===inkdraw_classPrivateFieldGet(md,this).length}isCancellable(){return inkdraw_classPrivateFieldGet(wd,this).length<=10}add(e,t){[e,t]=inkdraw_assertClassBrand(xd,this,_normalizePoint).call(this,e,t);const[i,a,s,n]=inkdraw_classPrivateFieldGet(gd,this).subarray(2,6),r=e-s,o=t-n;if(Math.hypot(inkdraw_classPrivateFieldGet(Sd,this)*r,inkdraw_classPrivateFieldGet(Cd,this)*o)<=2)return null;inkdraw_classPrivateFieldGet(wd,this).push(e,t);if(isNaN(i)){inkdraw_classPrivateFieldGet(gd,this).set([s,n,e,t],2);inkdraw_classPrivateFieldGet(fd,this).push(NaN,NaN,NaN,NaN,e,t);return{path:{d:this.toSVGPath()}}}isNaN(inkdraw_classPrivateFieldGet(gd,this)[0])&&inkdraw_classPrivateFieldGet(fd,this).splice(6,6);inkdraw_classPrivateFieldGet(gd,this).set([i,a,s,n,e,t],0);inkdraw_classPrivateFieldGet(fd,this).push(...Outline.createBezierPoints(i,a,s,n,e,t));return{path:{d:this.toSVGPath()}}}end(e,t){const i=this.add(e,t);return i||(2===inkdraw_classPrivateFieldGet(wd,this).length?{path:{d:this.toSVGPath()}}:null)}startNew(e,t,i,a,s){inkdraw_classPrivateFieldSet(Sd,this,i);inkdraw_classPrivateFieldSet(Cd,this,a);inkdraw_classPrivateFieldSet(vd,this,s);[e,t]=inkdraw_assertClassBrand(xd,this,_normalizePoint).call(this,e,t);const n=inkdraw_classPrivateFieldSet(fd,this,[NaN,NaN,NaN,NaN,e,t]);inkdraw_classPrivateFieldSet(wd,this,[e,t]);const r=inkdraw_classPrivateFieldGet(md,this).at(-1);if(r){r.line=new Float32Array(r.line);r.points=new Float32Array(r.points)}inkdraw_classPrivateFieldGet(md,this).push({line:n,points:inkdraw_classPrivateFieldGet(wd,this)});inkdraw_classPrivateFieldGet(gd,this).set(n,0);inkdraw_classPrivateFieldSet(bd,this,0);this.toSVGPath();return null}getLastElement(){return inkdraw_classPrivateFieldGet(md,this).at(-1)}setLastElement(e){if(!inkdraw_classPrivateFieldGet(md,this))return inkdraw_classPrivateFieldGet(yd,this).setLastElement(e);inkdraw_classPrivateFieldGet(md,this).push(e);inkdraw_classPrivateFieldSet(fd,this,e.line);inkdraw_classPrivateFieldSet(wd,this,e.points);inkdraw_classPrivateFieldSet(bd,this,0);return{path:{d:this.toSVGPath()}}}removeLastElement(){if(!inkdraw_classPrivateFieldGet(md,this))return inkdraw_classPrivateFieldGet(yd,this).removeLastElement();inkdraw_classPrivateFieldGet(md,this).pop();inkdraw_classPrivateFieldSet(Fd,this,"");for(let e=0,t=inkdraw_classPrivateFieldGet(md,this).length;e<t;e++){const{line:t,points:i}=inkdraw_classPrivateFieldGet(md,this)[e];inkdraw_classPrivateFieldSet(fd,this,t);inkdraw_classPrivateFieldSet(wd,this,i);inkdraw_classPrivateFieldSet(bd,this,0);this.toSVGPath()}return{path:{d:inkdraw_classPrivateFieldGet(Fd,this)}}}toSVGPath(){const e=Outline.svgRound(inkdraw_classPrivateFieldGet(fd,this)[4]),t=Outline.svgRound(inkdraw_classPrivateFieldGet(fd,this)[5]);if(2===inkdraw_classPrivateFieldGet(wd,this).length){inkdraw_classPrivateFieldSet(Fd,this,`${inkdraw_classPrivateFieldGet(Fd,this)} M ${e} ${t} Z`);return inkdraw_classPrivateFieldGet(Fd,this)}if(inkdraw_classPrivateFieldGet(wd,this).length<=6){const i=inkdraw_classPrivateFieldGet(Fd,this).lastIndexOf("M");inkdraw_classPrivateFieldSet(Fd,this,`${inkdraw_classPrivateFieldGet(Fd,this).slice(0,i)} M ${e} ${t}`);inkdraw_classPrivateFieldSet(bd,this,6)}if(4===inkdraw_classPrivateFieldGet(wd,this).length){const e=Outline.svgRound(inkdraw_classPrivateFieldGet(fd,this)[10]),t=Outline.svgRound(inkdraw_classPrivateFieldGet(fd,this)[11]);inkdraw_classPrivateFieldSet(Fd,this,`${inkdraw_classPrivateFieldGet(Fd,this)} L ${e} ${t}`);inkdraw_classPrivateFieldSet(bd,this,12);return inkdraw_classPrivateFieldGet(Fd,this)}const i=[];if(0===inkdraw_classPrivateFieldGet(bd,this)){i.push(`M ${e} ${t}`);inkdraw_classPrivateFieldSet(bd,this,6)}for(let e=inkdraw_classPrivateFieldGet(bd,this),t=inkdraw_classPrivateFieldGet(fd,this).length;e<t;e+=6){const[t,a,s,n,r,o]=inkdraw_classPrivateFieldGet(fd,this).slice(e,e+6).map(Outline.svgRound);i.push(`C${t} ${a} ${s} ${n} ${r} ${o}`)}inkdraw_classPrivateFieldSet(Fd,this,inkdraw_classPrivateFieldGet(Fd,this)+i.join(" "));inkdraw_classPrivateFieldSet(bd,this,inkdraw_classPrivateFieldGet(fd,this).length);return inkdraw_classPrivateFieldGet(Fd,this)}getOutlines(e,t,i,a){const s=inkdraw_classPrivateFieldGet(md,this).at(-1);s.line=new Float32Array(s.line);s.points=new Float32Array(s.points);inkdraw_classPrivateFieldGet(yd,this).build(inkdraw_classPrivateFieldGet(md,this),e,t,i,inkdraw_classPrivateFieldGet(vd,this),inkdraw_classPrivateFieldGet(Pd,this),a);inkdraw_classPrivateFieldSet(gd,this,null);inkdraw_classPrivateFieldSet(fd,this,null);inkdraw_classPrivateFieldSet(md,this,null);inkdraw_classPrivateFieldSet(Fd,this,null);return inkdraw_classPrivateFieldGet(yd,this)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}function _normalizePoint(e,t){return Outline._normalizePoint(e,t,inkdraw_classPrivateFieldGet(Sd,this),inkdraw_classPrivateFieldGet(Cd,this),inkdraw_classPrivateFieldGet(vd,this))}var kd=new WeakMap,Ed=new WeakMap,Ad=new WeakMap,Gd=new WeakMap,Bd=new WeakMap,Md=new WeakMap,Id=new WeakMap,Td=new WeakMap,Dd=new WeakMap,Ld=new WeakSet;class InkDrawOutline extends Outline{constructor(){super(...arguments);inkdraw_classPrivateMethodInitSpec(this,Ld);inkdraw_classPrivateFieldInitSpec(this,kd,void 0);inkdraw_classPrivateFieldInitSpec(this,Ed,0);inkdraw_classPrivateFieldInitSpec(this,Ad,void 0);inkdraw_classPrivateFieldInitSpec(this,Gd,void 0);inkdraw_classPrivateFieldInitSpec(this,Bd,void 0);inkdraw_classPrivateFieldInitSpec(this,Md,void 0);inkdraw_classPrivateFieldInitSpec(this,Id,void 0);inkdraw_classPrivateFieldInitSpec(this,Td,void 0);inkdraw_classPrivateFieldInitSpec(this,Dd,void 0)}build(e,t,i,a,s,n,r){inkdraw_classPrivateFieldSet(Bd,this,t);inkdraw_classPrivateFieldSet(Md,this,i);inkdraw_classPrivateFieldSet(Id,this,a);inkdraw_classPrivateFieldSet(Td,this,s);inkdraw_classPrivateFieldSet(Dd,this,n);inkdraw_classPrivateFieldSet(Ad,this,r??0);inkdraw_classPrivateFieldSet(Gd,this,e);inkdraw_assertClassBrand(Ld,this,_computeBbox).call(this)}get thickness(){return inkdraw_classPrivateFieldGet(Dd,this)}setLastElement(e){inkdraw_classPrivateFieldGet(Gd,this).push(e);return{path:{d:this.toSVGPath()}}}removeLastElement(){inkdraw_classPrivateFieldGet(Gd,this).pop();return{path:{d:this.toSVGPath()}}}toSVGPath(){const e=[];for(const{line:t}of inkdraw_classPrivateFieldGet(Gd,this)){e.push(`M${Outline.svgRound(t[4])} ${Outline.svgRound(t[5])}`);if(6!==t.length)if(12===t.length&&isNaN(t[6]))e.push(`L${Outline.svgRound(t[10])} ${Outline.svgRound(t[11])}`);else for(let i=6,a=t.length;i<a;i+=6){const[a,s,n,r,o,l]=t.subarray(i,i+6).map(Outline.svgRound);e.push(`C${a} ${s} ${n} ${r} ${o} ${l}`)}else e.push("Z")}return e.join("")}serialize(e,t){let[i,a,s,n]=e;const r=[],o=[],[l,d,c,h]=inkdraw_assertClassBrand(Ld,this,_getBBoxWithNoMargin).call(this);let u,_,p,g,f,m,v,P,w;switch(inkdraw_classPrivateFieldGet(Td,this)){case 0:w=Outline._rescale;u=i;_=a+n;p=s;g=-n;f=i+l*s;m=a+(1-d-h)*n;v=i+(l+c)*s;P=a+(1-d)*n;break;case 90:w=Outline._rescaleAndSwap;u=i;_=a;p=s;g=n;f=i+d*s;m=a+l*n;v=i+(d+h)*s;P=a+(l+c)*n;break;case 180:w=Outline._rescale;u=i+s;_=a;p=-s;g=n;f=i+(1-l-c)*s;m=a+d*n;v=i+(1-l)*s;P=a+(d+h)*n;break;case 270:w=Outline._rescaleAndSwap;u=i+s;_=a+n;p=-s;g=-n;f=i+(1-d-h)*s;m=a+(1-l-c)*n;v=i+(1-d)*s;P=a+(1-l)*n}for(const{line:e,points:i}of inkdraw_classPrivateFieldGet(Gd,this)){r.push(w(e,u,_,p,g,t?new Array(e.length):null));o.push(w(i,u,_,p,g,t?new Array(i.length):null))}return{lines:r,points:o,rect:[f,m,v,P]}}static deserialize(e,t,i,a,s,n){let{paths:{lines:r,points:o},rotation:l,thickness:d}=n;const c=[];let h,u,_,p,g;switch(l){case 0:g=Outline._rescale;h=-e/i;u=t/a+1;_=1/i;p=-1/a;break;case 90:g=Outline._rescaleAndSwap;h=-t/a;u=-e/i;_=1/a;p=1/i;break;case 180:g=Outline._rescale;h=e/i+1;u=-t/a;_=-1/i;p=1/a;break;case 270:g=Outline._rescaleAndSwap;h=t/a+1;u=e/i+1;_=-1/a;p=-1/i}if(!r){r=[];for(const e of o){const t=e.length;if(2===t){r.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1]]));continue}if(4===t){r.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1],NaN,NaN,NaN,NaN,e[2],e[3]]));continue}const i=new Float32Array(3*(t-2));r.push(i);let[a,s,n,o]=e.subarray(0,4);i.set([NaN,NaN,NaN,NaN,a,s],0);for(let r=4;r<t;r+=2){const t=e[r],l=e[r+1];i.set(Outline.createBezierPoints(a,s,n,o,t,l),3*(r-2));[a,s,n,o]=[n,o,t,l]}}}for(let e=0,t=r.length;e<t;e++)c.push({line:g(r[e].map(e=>e??NaN),h,u,_,p),points:g(o[e].map(e=>e??NaN),h,u,_,p)});const f=new this.prototype.constructor;f.build(c,i,a,1,l,d,s);return f}get box(){return inkdraw_classPrivateFieldGet(kd,this)}updateProperty(e,t){return"stroke-width"===e?inkdraw_assertClassBrand(Ld,this,inkdraw_updateThickness).call(this,t):null}updateParentDimensions(e,t){let[i,a]=e;const[s,n]=inkdraw_assertClassBrand(Ld,this,_getMarginComponents).call(this);inkdraw_classPrivateFieldSet(Bd,this,i);inkdraw_classPrivateFieldSet(Md,this,a);inkdraw_classPrivateFieldSet(Id,this,t);const[r,o]=inkdraw_assertClassBrand(Ld,this,_getMarginComponents).call(this),l=r-s,d=o-n,c=inkdraw_classPrivateFieldGet(kd,this);c[0]-=l;c[1]-=d;c[2]+=2*l;c[3]+=2*d;return c}updateRotation(e){inkdraw_classPrivateFieldSet(Ed,this,e);return{path:{transform:this.rotationTransform}}}get viewBox(){return inkdraw_classPrivateFieldGet(kd,this).map(Outline.svgRound).join(" ")}get defaultProperties(){const[e,t]=inkdraw_classPrivateFieldGet(kd,this);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Outline.svgRound(e)} ${Outline.svgRound(t)}`}}}get rotationTransform(){const[,,e,t]=inkdraw_classPrivateFieldGet(kd,this);let i=0,a=0,s=0,n=0,r=0,o=0;switch(inkdraw_classPrivateFieldGet(Ed,this)){case 90:a=t/e;s=-e/t;r=e;break;case 180:i=-1;n=-1;r=e;o=t;break;case 270:a=-t/e;s=e/t;o=t;break;default:return""}return`matrix(${i} ${a} ${s} ${n} ${Outline.svgRound(r)} ${Outline.svgRound(o)})`}getPathResizingSVGProperties(e){let[t,i,a,s]=e;const[n,r]=inkdraw_assertClassBrand(Ld,this,_getMarginComponents).call(this),[o,l,d,c]=inkdraw_classPrivateFieldGet(kd,this);if(Math.abs(d-n)<=Outline.PRECISION||Math.abs(c-r)<=Outline.PRECISION){const e=t+a/2-(o+d/2),n=i+s/2-(l+c/2);return{path:{"transform-origin":`${Outline.svgRound(t)} ${Outline.svgRound(i)}`,transform:`${this.rotationTransform} translate(${e} ${n})`}}}const h=(a-2*n)/(d-2*n),u=(s-2*r)/(c-2*r),_=d/a,p=c/s;return{path:{"transform-origin":`${Outline.svgRound(o)} ${Outline.svgRound(l)}`,transform:`${this.rotationTransform} scale(${_} ${p}) translate(${Outline.svgRound(n)} ${Outline.svgRound(r)}) scale(${h} ${u}) translate(${Outline.svgRound(-n)} ${Outline.svgRound(-r)})`}}}getPathResizedSVGProperties(e){let[t,i,a,s]=e;const[n,r]=inkdraw_assertClassBrand(Ld,this,_getMarginComponents).call(this),o=inkdraw_classPrivateFieldGet(kd,this),[l,d,c,h]=o;o[0]=t;o[1]=i;o[2]=a;o[3]=s;if(Math.abs(c-n)<=Outline.PRECISION||Math.abs(h-r)<=Outline.PRECISION){const e=t+a/2-(l+c/2),n=i+s/2-(d+h/2);for(const{line:t,points:i}of inkdraw_classPrivateFieldGet(Gd,this)){Outline._translate(t,e,n,t);Outline._translate(i,e,n,i)}return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Outline.svgRound(t)} ${Outline.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const u=(a-2*n)/(c-2*n),_=(s-2*r)/(h-2*r),p=-u*(l+n)+t+n,g=-_*(d+r)+i+r;if(1!==u||1!==_||0!==p||0!==g)for(const{line:e,points:t}of inkdraw_classPrivateFieldGet(Gd,this)){Outline._rescale(e,p,g,u,_,e);Outline._rescale(t,p,g,u,_,t)}return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Outline.svgRound(t)} ${Outline.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties(e,t){let[i,a]=e;const[s,n]=t,r=inkdraw_classPrivateFieldGet(kd,this),o=i-r[0],l=a-r[1];if(inkdraw_classPrivateFieldGet(Bd,this)===s&&inkdraw_classPrivateFieldGet(Md,this)===n)for(const{line:e,points:t}of inkdraw_classPrivateFieldGet(Gd,this)){Outline._translate(e,o,l,e);Outline._translate(t,o,l,t)}else{const e=inkdraw_classPrivateFieldGet(Bd,this)/s,t=inkdraw_classPrivateFieldGet(Md,this)/n;inkdraw_classPrivateFieldSet(Bd,this,s);inkdraw_classPrivateFieldSet(Md,this,n);for(const{line:i,points:a}of inkdraw_classPrivateFieldGet(Gd,this)){Outline._rescale(i,o,l,e,t,i);Outline._rescale(a,o,l,e,t,a)}r[2]*=e;r[3]*=t}r[0]=i;r[1]=a;return{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Outline.svgRound(i)} ${Outline.svgRound(a)}`}}}get defaultSVGProperties(){const e=inkdraw_classPrivateFieldGet(kd,this);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Outline.svgRound(e[0])} ${Outline.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}}function _getMarginComponents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:inkdraw_classPrivateFieldGet(Dd,this);const t=inkdraw_classPrivateFieldGet(Ad,this)+e/2*inkdraw_classPrivateFieldGet(Id,this);return inkdraw_classPrivateFieldGet(Td,this)%180==0?[t/inkdraw_classPrivateFieldGet(Bd,this),t/inkdraw_classPrivateFieldGet(Md,this)]:[t/inkdraw_classPrivateFieldGet(Md,this),t/inkdraw_classPrivateFieldGet(Bd,this)]}function _getBBoxWithNoMargin(){const[e,t,i,a]=inkdraw_classPrivateFieldGet(kd,this),[s,n]=inkdraw_assertClassBrand(Ld,this,_getMarginComponents).call(this,0);return[e+s,t+n,i-2*s,a-2*n]}function _computeBbox(){const e=inkdraw_classPrivateFieldSet(kd,this,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:t}of inkdraw_classPrivateFieldGet(Gd,this)){if(t.length<=12){for(let i=4,a=t.length;i<a;i+=6)Util.pointBoundingBox(t[i],t[i+1],e);continue}let i=t[4],a=t[5];for(let s=6,n=t.length;s<n;s+=6){const[n,r,o,l,d,c]=t.subarray(s,s+6);Util.bezierBoundingBox(i,a,n,r,o,l,d,c,e);i=d;a=c}}const[t,i]=inkdraw_assertClassBrand(Ld,this,_getMarginComponents).call(this);e[0]=MathClamp(e[0]-t,0,1);e[1]=MathClamp(e[1]-i,0,1);e[2]=MathClamp(e[2]+t,0,1);e[3]=MathClamp(e[3]+i,0,1);e[2]-=e[0];e[3]-=e[1]}function inkdraw_updateThickness(e){const[t,i]=inkdraw_assertClassBrand(Ld,this,_getMarginComponents).call(this);inkdraw_classPrivateFieldSet(Dd,this,e);const[a,s]=inkdraw_assertClassBrand(Ld,this,_getMarginComponents).call(this),[n,r]=[a-t,s-i],o=inkdraw_classPrivateFieldGet(kd,this);o[0]-=n;o[1]-=r;o[2]+=2*n;o[3]+=2*r;return o}function ink_classPrivateMethodInitSpec(e,t){(function ink_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function ink_defineProperty(e,t,i){return(t=function ink_toPropertyKey(e){var t=function ink_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class InkDrawingOptions extends DrawingOptions{constructor(e){super();this._viewParameters=e;super.updateProperties({fill:"none",stroke:AnnotationEditor._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,t){if("stroke-width"===e){t??=this["stroke-width"];t*=this._viewParameters.realScale}super.updateSVGProperty(e,t)}clone(){const e=new InkDrawingOptions(this._viewParameters);e.updateAll(this);return e}}var Rd=new WeakSet;class InkEditor extends DrawingEditor{constructor(e){super({...e,name:"inkEditor"});ink_classPrivateMethodInitSpec(this,Rd);this._willKeepAspectRatio=!0;this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,t){AnnotationEditor.initialize(e,t);this._defaultDrawingOptions=new InkDrawingOptions(t.viewParameters)}static getDefaultDrawingOptions(e){const t=this._defaultDrawingOptions.clone();t.updateProperties(e);return t}static get supportMultipleDrawings(){return!0}static get typesMap(){return shadow(this,"typesMap",new Map([[m.INK_THICKNESS,"stroke-width"],[m.INK_COLOR,"stroke"],[m.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,t,i,a,s){return new InkDrawOutliner(e,t,i,a,s,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,t,i,a,s,n){return InkDrawOutline.deserialize(e,t,i,a,s,n)}static async deserialize(e,t,i){let a=null;if(e instanceof InkAnnotationElement){const{data:{inkLists:t,rect:i,rotation:s,id:n,color:r,opacity:o,borderStyle:{rawWidth:l},popupRef:d,richText:c,contentsObj:h,creationDate:u,modificationDate:_},parent:{page:{pageNumber:p}}}=e;a=e={annotationType:f.INK,color:Array.from(r),thickness:l,opacity:o,paths:{points:t},boxes:null,pageIndex:p-1,rect:i.slice(0),rotation:s,annotationElementId:n,id:n,deleted:!1,popupRef:d,richText:c,comment:h?.str||null,creationDate:u,modificationDate:_}}else{const{popup:t,popupRef:i}=e;a=e={...e,popupRef:i||!(!t||!t.contents||t.deleted)||null,comment:!t?.deleted&&t?.contents||null,commentDate:!t?.deleted&&t?.date||null}}const s=await super.deserialize(e,t,i);s._initialData=a;e.comment&&s.setCommentData(e);return s}get toolbarButtons(){this._colorPicker||=new BasicColorPicker(this);return[["colorPicker",this._colorPicker]]}get colorType(){return m.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:e,_drawingOptions:t,parent:i}=this;t.updateSVGProperty("stroke-width");i.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){const e=this._currentParent;if(e){super.onScaleChangingWhenDrawing();this._defaultDrawingOptions.updateSVGProperty("stroke-width");e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties())}}createDrawingOptions(e){let{color:t,thickness:i,opacity:a}=e;this._drawingOptions=InkEditor.getDefaultDrawingOptions({stroke:Util.makeHexColor(...t),"stroke-width":i,"stroke-opacity":a})}serialize(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:a,points:s}=this.serializeDraw(e),{_drawingOptions:{stroke:n,"stroke-opacity":r,"stroke-width":o}}=this,l=Object.assign(super.serialize(e,t),{color:AnnotationEditor._colorManager.convert(n),opacity:r,thickness:o,paths:{lines:a,points:s}});this.addComment(l,this._isCopy);if(e){i&&(l.id=this.uid);l.isCopy=!0;return l}if(this.annotationElementId&&!function ink_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}(Rd,this,ink_hasElementChanged).call(this,l))return null;l.id=this.uid;return l}renderAnnotationElement(e){if(this.deleted){e.hide();return null}const{points:t,rect:i}=this.serializeDraw(!1);e.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:t,popup:this.comment});return null}}function ink_hasElementChanged(e){const{color:t,thickness:i,opacity:a,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((e,i)=>e!==t[i])||e.thickness!==i||e.opacity!==a||e.pageIndex!==s}ink_defineProperty(InkEditor,"_type","ink");ink_defineProperty(InkEditor,"_editorType",f.INK);ink_defineProperty(InkEditor,"_defaultDrawingOptions",null);class ContourDrawOutline extends InkDrawOutline{toSVGPath(){let e=super.toSVGPath();e.endsWith("Z")||(e+="Z");return e}}var Nd;__webpack_require__(5213);function signaturedraw_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}class SignatureExtractor{static extractContoursFromText(e,t,i,a,s,n){let{fontFamily:r,fontStyle:o,fontWeight:l}=t,d=new OffscreenCanvas(1,1),c=d.getContext("2d",{alpha:!1});const h=c.font=`${o} ${l} 200px ${r}`,{actualBoundingBoxLeft:u,actualBoundingBoxRight:_,actualBoundingBoxAscent:p,actualBoundingBoxDescent:g,fontBoundingBoxAscent:f,fontBoundingBoxDescent:m,width:v}=c.measureText(e),P=1.5,w=Math.ceil(Math.max(Math.abs(u)+Math.abs(_)||0,v)*P),b=Math.ceil(Math.max(Math.abs(p)+Math.abs(g)||200,Math.abs(f)+Math.abs(m)||200)*P);d=new OffscreenCanvas(w,b);c=d.getContext("2d",{alpha:!0,willReadFrequently:!0});c.font=h;c.filter="grayscale(1)";c.fillStyle="white";c.fillRect(0,0,w,b);c.fillStyle="black";c.fillText(e,.5*w/2,1.5*b/2);const y=signaturedraw_assertClassBrand(SignatureExtractor,this,_toUint).call(this,c.getImageData(0,0,w,b).data),S=signaturedraw_assertClassBrand(SignatureExtractor,this,_getHistogram).call(this,y),C=signaturedraw_assertClassBrand(SignatureExtractor,this,_guessThreshold).call(this,S),x=signaturedraw_assertClassBrand(SignatureExtractor,this,_findContours).call(this,y,w,b,C);return this.processDrawnLines({lines:{curves:x,width:w,height:b},pageWidth:i,pageHeight:a,rotation:s,innerMargin:n,mustSmooth:!0,areContours:!0})}static process(e,t,i,a,s){const[n,r,o]=signaturedraw_assertClassBrand(SignatureExtractor,this,_getGrayPixels).call(this,e),[l,d]=signaturedraw_assertClassBrand(SignatureExtractor,this,_bilateralFilter).call(this,n,r,o,Math.hypot(r,o)*signaturedraw_assertClassBrand(SignatureExtractor,this,Od)._.sigmaSFactor,signaturedraw_assertClassBrand(SignatureExtractor,this,Od)._.sigmaR,signaturedraw_assertClassBrand(SignatureExtractor,this,Od)._.kernelSize),c=signaturedraw_assertClassBrand(SignatureExtractor,this,_guessThreshold).call(this,d),h=signaturedraw_assertClassBrand(SignatureExtractor,this,_findContours).call(this,l,r,o,c);return this.processDrawnLines({lines:{curves:h,width:r,height:o},pageWidth:t,pageHeight:i,rotation:a,innerMargin:s,mustSmooth:!0,areContours:!0})}static processDrawnLines(e){let{lines:t,pageWidth:i,pageHeight:a,rotation:s,innerMargin:n,mustSmooth:r,areContours:o}=e;s%180!=0&&([i,a]=[a,i]);const{curves:l,width:d,height:c}=t,h=t.thickness??0,u=[],_=Math.min(i/d,a/c),p=_/i,g=_/a,f=[];for(const{points:e}of l){const t=r?signaturedraw_assertClassBrand(SignatureExtractor,this,_douglasPeucker).call(this,e):e;if(!t)continue;f.push(t);const i=t.length,a=new Float32Array(i),s=new Float32Array(3*(2===i?2:i-2));u.push({line:s,points:a});if(2===i){a[0]=t[0]*p;a[1]=t[1]*g;s.set([NaN,NaN,NaN,NaN,a[0],a[1]],0);continue}let[n,o,l,d]=t;n*=p;o*=g;l*=p;d*=g;a.set([n,o,l,d],0);s.set([NaN,NaN,NaN,NaN,n,o],0);for(let e=4;e<i;e+=2){const i=a[e]=t[e]*p,r=a[e+1]=t[e+1]*g;s.set(Outline.createBezierPoints(n,o,l,d,i,r),3*(e-2));[n,o,l,d]=[l,d,i,r]}}if(0===u.length)return null;const m=o?new ContourDrawOutline:new InkDrawOutline;m.build(u,i,a,1,s,o?0:h,n);return{outline:m,newCurves:f,areContours:o,thickness:h,width:d,height:c}}static async compressSignature(e){let t,{outlines:i,areContours:a,thickness:s,width:n,height:r}=e,o=1/0,l=-1/0,d=0;for(const e of i){d+=e.length;for(let t=2,i=e.length;t<i;t++){const i=e[t]-e[t-2];o=Math.min(o,i);l=Math.max(l,i)}}t=o>=-128&&l<=127?Int8Array:o>=-32768&&l<=32767?Int16Array:Int32Array;const c=i.length,h=8+3*c,u=new Uint32Array(h);let _=0;u[_++]=h*Uint32Array.BYTES_PER_ELEMENT+(d-2*c)*t.BYTES_PER_ELEMENT;u[_++]=0;u[_++]=n;u[_++]=r;u[_++]=a?0:1;u[_++]=Math.max(0,Math.floor(s??0));u[_++]=c;u[_++]=t.BYTES_PER_ELEMENT;for(const e of i){u[_++]=e.length-2;u[_++]=e[0];u[_++]=e[1]}const p=new CompressionStream("deflate-raw"),g=p.writable.getWriter();await g.ready;g.write(u);const f=t.prototype.constructor;for(const e of i){const t=new f(e.length-2);for(let i=2,a=e.length;i<a;i++)t[i-2]=e[i]-e[i-2];g.write(t)}g.close();return(await new Response(p.readable).bytes()).toBase64()}static async decompressSignature(e){try{const t=Uint8Array.fromBase64(e),{readable:i,writable:a}=new DecompressionStream("deflate-raw"),s=a.getWriter();await s.ready;s.write(t).then(async()=>{await s.ready;await s.close()}).catch(()=>{});let n=null,r=0;for await(const e of i){n||=new Uint8Array(new Uint32Array(e.buffer,0,4)[0]);n.set(e,r);r+=e.length}const o=new Uint32Array(n.buffer,0,n.length>>2),l=o[1];if(0!==l)throw new Error(`Invalid version: ${l}`);const d=o[2],c=o[3],h=0===o[4],u=o[5],_=o[6],p=o[7],g=[],f=(8+3*_)*Uint32Array.BYTES_PER_ELEMENT;let m;switch(p){case Int8Array.BYTES_PER_ELEMENT:m=new Int8Array(n.buffer,f);break;case Int16Array.BYTES_PER_ELEMENT:m=new Int16Array(n.buffer,f);break;case Int32Array.BYTES_PER_ELEMENT:m=new Int32Array(n.buffer,f)}r=0;for(let e=0;e<_;e++){const t=o[3*e+8],i=new Float32Array(t+2);g.push(i);for(let t=0;t<2;t++)i[t]=o[3*e+8+t+1];for(let e=0;e<t;e++)i[e+2]=i[e]+m[r++]}return{areContours:h,thickness:u,outlines:g,width:d,height:c}}catch(e){warn(`decompressSignature: ${e}`);return null}}}Nd=SignatureExtractor;function _neighborIndexToId(e,t,i,a){a-=t;return 0===(i-=e)?a>0?0:4:1===i?a+6:2-a}function _clockwiseNonZero(e,t,i,a,s,n,r){const o=signaturedraw_assertClassBrand(Nd,this,_neighborIndexToId).call(this,i,a,s,n);for(let s=0;s<8;s++){const n=(-s+o-r+16)%8;if(0!==e[(i+signaturedraw_assertClassBrand(Nd,this,Wd)._[2*n])*t+(a+signaturedraw_assertClassBrand(Nd,this,Wd)._[2*n+1])])return n}return-1}function _counterClockwiseNonZero(e,t,i,a,s,n,r){const o=signaturedraw_assertClassBrand(Nd,this,_neighborIndexToId).call(this,i,a,s,n);for(let s=0;s<8;s++){const n=(s+o+r+16)%8;if(0!==e[(i+signaturedraw_assertClassBrand(Nd,this,Wd)._[2*n])*t+(a+signaturedraw_assertClassBrand(Nd,this,Wd)._[2*n+1])])return n}return-1}function _findContours(e,t,i,a){const s=e.length,n=new Int32Array(s);for(let t=0;t<s;t++)n[t]=e[t]<=a?1:0;for(let e=1;e<i-1;e++)n[e*t]=n[e*t+t-1]=0;for(let e=0;e<t;e++)n[e]=n[t*i-1-e]=0;let r,o=1;const l=[];for(let e=1;e<i-1;e++){r=1;for(let i=1;i<t-1;i++){const a=e*t+i,s=n[a];if(0===s)continue;let d=e,c=i;if(1===s&&0===n[a-1]){o+=1;c-=1}else{if(!(s>=1&&0===n[a+1])){1!==s&&(r=Math.abs(s));continue}o+=1;c+=1;s>1&&(r=s)}const h=[i,e],u=c===i+1,_={isHole:u,points:h,id:o,parent:0};l.push(_);let p;for(const e of l)if(e.id===r){p=e;break}p?p.isHole?_.parent=u?p.parent:r:_.parent=u?r:p.parent:_.parent=u?r:0;const g=signaturedraw_assertClassBrand(Nd,this,_clockwiseNonZero).call(this,n,t,e,i,d,c,0);if(-1===g){n[a]=-o;1!==n[a]&&(r=Math.abs(n[a]));continue}let f=signaturedraw_assertClassBrand(Nd,this,Wd)._[2*g],m=signaturedraw_assertClassBrand(Nd,this,Wd)._[2*g+1];const v=e+f,P=i+m;d=v;c=P;let w=e,b=i;for(;;){const s=signaturedraw_assertClassBrand(Nd,this,_counterClockwiseNonZero).call(this,n,t,w,b,d,c,1);f=signaturedraw_assertClassBrand(Nd,this,Wd)._[2*s];m=signaturedraw_assertClassBrand(Nd,this,Wd)._[2*s+1];const l=w+f,u=b+m;h.push(u,l);const _=w*t+b;0===n[_+1]?n[_]=-o:1===n[_]&&(n[_]=o);if(l===e&&u===i&&w===v&&b===P){1!==n[a]&&(r=Math.abs(n[a]));break}d=w;c=b;w=l;b=u}}}return l}function _douglasPeuckerHelper(e,t,i,a){if(i-t<=4){for(let s=t;s<i-2;s+=2)a.push(e[s],e[s+1]);return}const s=e[t],n=e[t+1],r=e[i-4]-s,o=e[i-3]-n,l=Math.hypot(r,o),d=r/l,c=o/l,h=d*n-c*s,u=o/r,_=1/l,p=Math.atan(u),g=Math.cos(p),f=Math.sin(p),m=_*(Math.abs(g)+Math.abs(f)),v=_*(1-m+m**2),P=Math.max(Math.atan(Math.abs(f+g)*v),Math.atan(Math.abs(f-g)*v));let w=0,b=t;for(let a=t+2;a<i-2;a+=2){const t=Math.abs(h-d*e[a+1]+c*e[a]);if(t>w){b=a;w=t}}if(w>(l*P)**2){signaturedraw_assertClassBrand(Nd,this,_douglasPeuckerHelper).call(this,e,t,b+2,a);signaturedraw_assertClassBrand(Nd,this,_douglasPeuckerHelper).call(this,e,b,i,a)}else a.push(s,n)}function _douglasPeucker(e){const t=[],i=e.length;signaturedraw_assertClassBrand(Nd,this,_douglasPeuckerHelper).call(this,e,0,i,t);t.push(e[i-2],e[i-1]);return t.length<=4?null:t}function _bilateralFilter(e,t,i,a,s,n){const r=new Float32Array(n**2),o=-2*a**2,l=n>>1;for(let e=0;e<n;e++){const t=(e-l)**2;for(let i=0;i<n;i++)r[e*n+i]=Math.exp((t+(i-l)**2)/o)}const d=new Float32Array(256),c=-2*s**2;for(let e=0;e<256;e++)d[e]=Math.exp(e**2/c);const h=e.length,u=new Uint8Array(h),_=new Uint32Array(256);for(let a=0;a<i;a++)for(let s=0;s<t;s++){const o=a*t+s,c=e[o];let h=0,p=0;for(let o=0;o<n;o++){const u=a+o-l;if(!(u<0||u>=i))for(let i=0;i<n;i++){const a=s+i-l;if(a<0||a>=t)continue;const _=e[u*t+a],g=r[o*n+i]*d[Math.abs(_-c)];h+=_*g;p+=g}}_[u[o]=Math.round(h/p)]++}return[u,_]}function _getHistogram(e){const t=new Uint32Array(256);for(const i of e)t[i]++;return t}function _toUint(e){const t=e.length,i=new Uint8ClampedArray(t>>2);let a=-1/0,s=1/0;for(let t=0,n=i.length;t<n;t++){const n=i[t]=e[t<<2];a=Math.max(a,n);s=Math.min(s,n)}const n=255/(a-s);for(let e=0,t=i.length;e<t;e++)i[e]=(i[e]-s)*n;return i}function _guessThreshold(e){let t,i=-1/0,a=-1/0;const s=e.findIndex(e=>0!==e);let n=s,r=s;for(t=s;t<256;t++){const s=e[t];if(s>i){if(t-n>a){a=t-n;r=t-1}i=s;n=t}}for(t=r-1;t>=0&&!(e[t]>e[t+1]);t--);return t}function _getGrayPixels(e){const t=e,{width:i,height:a}=e,{maxDim:s}=signaturedraw_assertClassBrand(Nd,this,Od)._;let n=i,r=a;if(i>s||a>s){let o=i,l=a,d=Math.log2(Math.max(i,a)/s);const c=Math.floor(d);d=d===c?c-1:c;for(let i=0;i<d;i++){n=Math.ceil(o/2);r=Math.ceil(l/2);const i=new OffscreenCanvas(n,r);i.getContext("2d").drawImage(e,0,0,o,l,0,0,n,r);o=n;l=r;e!==t&&e.close();e=i.transferToImageBitmap()}const h=Math.min(s/n,s/r);n=Math.round(n*h);r=Math.round(r*h)}const o=new OffscreenCanvas(n,r).getContext("2d",{willReadFrequently:!0});o.fillStyle="white";o.fillRect(0,0,n,r);o.filter="grayscale(1)";o.drawImage(e,0,0,e.width,e.height,0,0,n,r);const l=o.getImageData(0,0,n,r).data;return[signaturedraw_assertClassBrand(Nd,this,_toUint).call(this,l),n,r]}var Od={_:{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}},Wd={_:new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1])};function signature_defineProperty(e,t,i){return(t=function signature_toPropertyKey(e){var t=function signature_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function signature_classPrivateFieldInitSpec(e,t,i){(function signature_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function signature_classPrivateFieldGet(e,t){return e.get(signature_assertClassBrand(e,t))}function signature_classPrivateFieldSet(e,t,i){return e.set(signature_assertClassBrand(e,t),i),i}function signature_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}class SignatureOptions extends DrawingOptions{constructor(){super();super.updateProperties({fill:AnnotationEditor._defaultLineColor,"stroke-width":0})}clone(){const e=new SignatureOptions;e.updateAll(this);return e}}class DrawnSignatureOptions extends InkDrawingOptions{constructor(e){super(e);super.updateProperties({stroke:AnnotationEditor._defaultLineColor,"stroke-width":1})}clone(){const e=new DrawnSignatureOptions(this._viewParameters);e.updateAll(this);return e}}var jd=new WeakMap,Vd=new WeakMap,Ud=new WeakMap,zd=new WeakMap;class SignatureEditor extends DrawingEditor{constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"});signature_classPrivateFieldInitSpec(this,jd,!1);signature_classPrivateFieldInitSpec(this,Vd,null);signature_classPrivateFieldInitSpec(this,Ud,null);signature_classPrivateFieldInitSpec(this,zd,null);this._willKeepAspectRatio=!0;signature_classPrivateFieldSet(Ud,this,e.signatureData||null);signature_classPrivateFieldSet(Vd,this,null);this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,t){AnnotationEditor.initialize(e,t);this._defaultDrawingOptions=new SignatureOptions;this._defaultDrawnSignatureOptions=new DrawnSignatureOptions(t.viewParameters)}static getDefaultDrawingOptions(e){const t=this._defaultDrawingOptions.clone();t.updateProperties(e);return t}static get supportMultipleDrawings(){return!1}static get typesMap(){return shadow(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!signature_classPrivateFieldGet(Vd,this)}}static computeTelemetryFinalData(e){const t=e.get("hasDescription");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){null!==this._drawId&&super.onScaleChanging()}render(){if(this.div)return this.div;let e,t;const{_isCopy:i}=this;if(i){this._isCopy=!1;e=this.x;t=this.y}super.render();if(null===this._drawId)if(signature_classPrivateFieldGet(Ud,this)){const{lines:e,mustSmooth:t,areContours:i,description:a,uuid:s,heightInPage:n}=signature_classPrivateFieldGet(Ud,this),{rawDims:{pageWidth:r,pageHeight:o},rotation:l}=this.parent.viewport,d=SignatureExtractor.processDrawnLines({lines:e,pageWidth:r,pageHeight:o,rotation:l,innerMargin:SignatureEditor._INNER_MARGIN,mustSmooth:t,areContours:i});this.addSignature(d,n,a,s)}else{this.div.setAttribute("data-l10n-args",JSON.stringify({description:""}));this.div.hidden=!0;this._uiManager.getSignature(this)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:signature_classPrivateFieldGet(Vd,this)||""}));if(i){this._isCopy=!0;this._moveAfterPaste(e,t)}return this.div}setUuid(e){signature_classPrivateFieldSet(zd,this,e);this.addEditToolbar()}getUuid(){return signature_classPrivateFieldGet(zd,this)}get description(){return signature_classPrivateFieldGet(Vd,this)}set description(e){signature_classPrivateFieldSet(Vd,this,e);if(this.div){this.div.setAttribute("data-l10n-args",JSON.stringify({description:e}));super.addEditToolbar().then(t=>{t?.updateEditSignatureButton(e)})}}getSignaturePreview(){const{newCurves:e,areContours:t,thickness:i,width:a,height:s}=signature_classPrivateFieldGet(Ud,this),n=Math.max(a,s);return{areContours:t,outline:SignatureExtractor.processDrawnLines({lines:{curves:e.map(e=>({points:e})),thickness:i,width:a,height:s},pageWidth:n,pageHeight:n,rotation:0,innerMargin:0,mustSmooth:!1,areContours:t}).outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,t,i,a){const{x:s,y:n}=this,{outline:r}=signature_classPrivateFieldSet(Ud,this,e);signature_classPrivateFieldSet(jd,this,r instanceof ContourDrawOutline);this.description=i;let o;if(signature_classPrivateFieldGet(jd,this))o=SignatureEditor.getDefaultDrawingOptions();else{o=SignatureEditor._defaultDrawnSignatureOptions.clone();o.updateProperties({"stroke-width":r.thickness})}this._addOutlines({drawOutlines:r,drawingOptions:o});const[,l]=this.pageDimensions;let d=t/l;d=d>=1?.5:d;this.width*=d/this.height;if(this.width>=1){d*=.9/this.width;this.width=.9}this.height=d;this.setDims();this.x=s;this.y=n;this.center();this._onResized();this.onScaleChanging();this.rotate();this._uiManager.addToAnnotationStorage(this);this.setUuid(a);this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!a,hasDescription:!!i}});this.div.hidden=!1;this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"signatureAdded",page:this.pageIndex+1,editorType:this.constructor.name,id:this.uid,value:this,description:i})}getFromImage(e){const{rawDims:{pageWidth:t,pageHeight:i},rotation:a}=this.parent.viewport;return SignatureExtractor.process(e,t,i,a,SignatureEditor._INNER_MARGIN)}getFromText(e,t){const{rawDims:{pageWidth:i,pageHeight:a},rotation:s}=this.parent.viewport;return SignatureExtractor.extractContoursFromText(e,t,i,a,s,SignatureEditor._INNER_MARGIN)}getDrawnSignature(e){const{rawDims:{pageWidth:t,pageHeight:i},rotation:a}=this.parent.viewport;return SignatureExtractor.processDrawnLines({lines:e,pageWidth:t,pageHeight:i,rotation:a,innerMargin:SignatureEditor._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions(e){let{areContours:t,thickness:i}=e;if(t)this._drawingOptions=SignatureEditor.getDefaultDrawingOptions();else{this._drawingOptions=SignatureEditor._defaultDrawnSignatureOptions.clone();this._drawingOptions.updateProperties({"stroke-width":i})}}serialize(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isEmpty())return null;const{lines:a,points:s}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":n}}=this,r=Object.assign(super.serialize(e,t),{isSignature:!0,areContours:signature_classPrivateFieldGet(jd,this),color:[0,0,0],thickness:signature_classPrivateFieldGet(jd,this)?0:n});this.addComment(r,this._isCopy);if(e){r.paths={lines:a,points:s};r.uuid=signature_classPrivateFieldGet(zd,this);r.isCopy=!0}else{r.lines=a;i&&(r.id=this.uid)}signature_classPrivateFieldGet(Vd,this)&&(r.accessibilityData={type:"Figure",alt:signature_classPrivateFieldGet(Vd,this)});return r}static deserializeDraw(e,t,i,a,s,n){return n.areContours?ContourDrawOutline.deserialize(e,t,i,a,s,n):InkDrawOutline.deserialize(e,t,i,a,s,n)}static async deserialize(e,t,i){const a=await super.deserialize(e,t,i);signature_classPrivateFieldSet(jd,a,e.areContours);a.description=e.accessibilityData?.alt||"";signature_classPrivateFieldSet(zd,a,e.uuid);return a}}signature_defineProperty(SignatureEditor,"_type","signature");signature_defineProperty(SignatureEditor,"_editorType",f.SIGNATURE);signature_defineProperty(SignatureEditor,"_defaultDrawingOptions",null);function stamp_defineProperty(e,t,i){return(t=function stamp_toPropertyKey(e){var t=function stamp_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function stamp_classPrivateFieldInitSpec(e,t,i){stamp_checkPrivateRedeclaration(e,t),t.set(e,i)}function stamp_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function stamp_classPrivateFieldGet(e,t){return e.get(stamp_assertClassBrand(e,t))}function stamp_classPrivateFieldSet(e,t,i){return e.set(stamp_assertClassBrand(e,t),i),i}function stamp_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Hd=new WeakMap,$d=new WeakMap,qd=new WeakMap,Xd=new WeakMap,Kd=new WeakMap,Yd=new WeakMap,Zd=new WeakMap,Jd=new WeakMap,Qd=new WeakMap,ec=new WeakMap,tc=new WeakMap,ic=new WeakSet;class StampEditor extends AnnotationEditor{constructor(e){super({...e,name:"stampEditor"});!function stamp_classPrivateMethodInitSpec(e,t){stamp_checkPrivateRedeclaration(e,t),t.add(e)}(this,ic);stamp_classPrivateFieldInitSpec(this,Hd,null);stamp_classPrivateFieldInitSpec(this,$d,null);stamp_classPrivateFieldInitSpec(this,qd,null);stamp_classPrivateFieldInitSpec(this,Xd,null);stamp_classPrivateFieldInitSpec(this,Kd,null);stamp_classPrivateFieldInitSpec(this,Yd,"");stamp_classPrivateFieldInitSpec(this,Zd,null);stamp_classPrivateFieldInitSpec(this,Jd,!1);stamp_classPrivateFieldInitSpec(this,Qd,null);stamp_classPrivateFieldInitSpec(this,ec,!1);stamp_classPrivateFieldInitSpec(this,tc,!1);stamp_classPrivateFieldSet(Xd,this,e.bitmapUrl);stamp_classPrivateFieldSet(Kd,this,e.bitmapFile);this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,t){AnnotationEditor.initialize(e,t)}static isHandlingMimeForPasting(e){return Q.includes(e)}static paste(e,t){t.pasteEditor({mode:f.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1);super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){const t=e.get("hasAltText");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}async mlGuessAltText(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:a,width:s,height:n}=e||this.copyCanvas(null,null,!0).imageData,r=await i.guess({name:"altText",request:{data:a,width:s,height:n,channels:a.length/(s*n)}});if(!r)throw new Error("No response from the AI service.");if(r.error)throw new Error("Error from the AI service.");if(r.cancel)return null;if(!r.output)throw new Error("No valid response from the AI service.");const o=r.output;await this.setGuessedAltText(o);t&&!this.hasAltTextData()&&(this.altTextData={alt:o,decorative:!1});return o}remove(){if(stamp_classPrivateFieldGet($d,this)){stamp_classPrivateFieldSet(Hd,this,null);this._uiManager.imageManager.deleteId(stamp_classPrivateFieldGet($d,this));stamp_classPrivateFieldGet(Zd,this)?.remove();stamp_classPrivateFieldSet(Zd,this,null);if(stamp_classPrivateFieldGet(Qd,this)){clearTimeout(stamp_classPrivateFieldGet(Qd,this));stamp_classPrivateFieldSet(Qd,this,null)}}super.remove()}rebuild(){if(this.parent){super.rebuild();if(null!==this.div){stamp_classPrivateFieldGet($d,this)&&null===stamp_classPrivateFieldGet(Zd,this)&&stamp_assertClassBrand(ic,this,_getBitmap).call(this);this.isAttachedToDOM||this.parent.add(this)}}else stamp_classPrivateFieldGet($d,this)&&stamp_assertClassBrand(ic,this,_getBitmap).call(this)}onceAdded(e){this._isDraggable=!0;e&&this.div.focus()}isEmpty(){return!(stamp_classPrivateFieldGet(qd,this)||stamp_classPrivateFieldGet(Hd,this)||stamp_classPrivateFieldGet(Xd,this)||stamp_classPrivateFieldGet(Kd,this)||stamp_classPrivateFieldGet($d,this)||stamp_classPrivateFieldGet(Jd,this))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;if(this._isCopy){e=this.x;t=this.y}super.render();this.div.hidden=!0;this.createAltText();stamp_classPrivateFieldGet(Jd,this)||(stamp_classPrivateFieldGet(Hd,this)?stamp_assertClassBrand(ic,this,_createCanvas).call(this):stamp_assertClassBrand(ic,this,_getBitmap).call(this));this._isCopy&&this._moveAfterPaste(e,t);this._uiManager.addShouldRescale(this);return this.div}setCanvas(e,t){const{id:i,bitmap:a}=this._uiManager.imageManager.getFromCanvas(e,t);t.remove();if(i&&this._uiManager.imageManager.isValidId(i)){stamp_classPrivateFieldSet($d,this,i);a&&stamp_classPrivateFieldSet(Hd,this,a);stamp_classPrivateFieldSet(Jd,this,!1);stamp_assertClassBrand(ic,this,_createCanvas).call(this)}}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;null!==stamp_classPrivateFieldGet(Qd,this)&&clearTimeout(stamp_classPrivateFieldGet(Qd,this));stamp_classPrivateFieldSet(Qd,this,setTimeout(()=>{stamp_classPrivateFieldSet(Qd,this,null);stamp_assertClassBrand(ic,this,_drawBitmap).call(this)},200))}copyCanvas(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e||(e=224);const{width:a,height:s}=stamp_classPrivateFieldGet(Hd,this),n=new OutputScale;let r=stamp_classPrivateFieldGet(Hd,this),o=a,l=s,d=null;if(t){if(a>t||s>t){const e=Math.min(t/a,t/s);o=Math.floor(a*e);l=Math.floor(s*e)}d=document.createElement("canvas");const e=d.width=Math.ceil(o*n.sx),i=d.height=Math.ceil(l*n.sy);stamp_classPrivateFieldGet(ec,this)||(r=stamp_assertClassBrand(ic,this,_scaleBitmap).call(this,e,i));const c=d.getContext("2d");c.filter=this._uiManager.hcmFilter;let h="white",u="#cfcfd8";if("none"!==this._uiManager.hcmFilter)u="black";else if(ColorScheme.isDarkMode){h="#8f8f9d";u="#42414d"}const _=15,p=_*n.sx,g=_*n.sy,f=new OffscreenCanvas(2*p,2*g),m=f.getContext("2d");m.fillStyle=h;m.fillRect(0,0,2*p,2*g);m.fillStyle=u;m.fillRect(0,0,p,g);m.fillRect(p,g,p,g);c.fillStyle=c.createPattern(f,"repeat");c.fillRect(0,0,e,i);c.drawImage(r,0,0,r.width,r.height,0,0,e,i)}let c=null;if(i){let t,i;if(n.symmetric&&r.width<e&&r.height<e){t=r.width;i=r.height}else{r=stamp_classPrivateFieldGet(Hd,this);if(a>e||s>e){const n=Math.min(e/a,e/s);t=Math.floor(a*n);i=Math.floor(s*n);stamp_classPrivateFieldGet(ec,this)||(r=stamp_assertClassBrand(ic,this,_scaleBitmap).call(this,t,i))}}const o=new OffscreenCanvas(t,i).getContext("2d",{willReadFrequently:!0});o.drawImage(r,0,0,r.width,r.height,0,0,t,i);c={width:t,height:i,data:o.getImageData(0,0,t,i).data}}return{canvas:d,width:o,height:l,imageData:c}}static async deserialize(e,t,i){let a=null,s=!1;if(e instanceof StampAnnotationElement){const{data:{rect:n,rotation:r,id:o,structParent:l,popupRef:d,richText:c,contentsObj:h,creationDate:u,modificationDate:_},container:p,parent:{page:{pageNumber:g}},canvas:m}=e;let v,P;if(m){delete e.canvas;({id:v,bitmap:P}=i.imageManager.getFromCanvas(p.id,m));m.remove()}else{s=!0;e._hasNoCanvas=!0}const w=(await t._structTree.getAriaAttributes(`${X}${o}`))?.get("aria-label")||"";a=e={annotationType:f.STAMP,bitmapId:v,bitmap:P,pageIndex:g-1,rect:n.slice(0),rotation:r,annotationElementId:o,id:o,deleted:!1,accessibilityData:{decorative:!1,altText:w},isSvg:!1,structParent:l,popupRef:d,richText:c,comment:h?.str||null,creationDate:u,modificationDate:_}}else{const{popup:t,popupRef:i}=e;a=e={...e,popupRef:i||!(!t||!t.contents||t.deleted)||null,comment:!t?.deleted&&t?.contents||null,commentDate:!t?.deleted&&t?.date||null}}const n=await super.deserialize(e,t,i),{rect:r,bitmap:o,bitmapUrl:l,bitmapId:d,isSvg:c,accessibilityData:h}=e;if(s){i.addMissingCanvas(e.id,n);stamp_classPrivateFieldSet(Jd,n,!0)}else if(d&&i.imageManager.isValidId(d)){stamp_classPrivateFieldSet($d,n,d);o&&stamp_classPrivateFieldSet(Hd,n,o)}else stamp_classPrivateFieldSet(Xd,n,l);stamp_classPrivateFieldSet(ec,n,c);const[u,_]=n.pageDimensions;n.width=(r[2]-r[0])/u;n.height=(r[3]-r[1])/_;h&&(n.altTextData=h);n._initialData=a;e.comment&&n.setCommentData(e);stamp_classPrivateFieldSet(tc,n,!!a);return n}serialize(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const a=Object.assign(super.serialize(e,t),{bitmapId:stamp_classPrivateFieldGet($d,this),isSvg:stamp_classPrivateFieldGet(ec,this)});this.addComment(a,this._isCopy);if(e){a.bitmapUrl=stamp_assertClassBrand(ic,this,_serializeBitmap).call(this,!0);a.accessibilityData=this.serializeAltText(!0);i&&(a.id=this.uid);a.isCopy=!0;return a}const{decorative:s,altText:n}=this.serializeAltText(!1);!s&&n&&(a.accessibilityData={type:"Figure",alt:n});if(this.annotationElementId){const e=stamp_assertClassBrand(ic,this,stamp_hasElementChanged).call(this,a);if(e.isSame)return null;e.isSameAltText?delete a.accessibilityData:a.accessibilityData.structParent=this._initialData.structParent??-1;a.id=this.uid;delete a.bitmapId;return a}if(null===t)return a;t.stamps||=new Map;const r=stamp_classPrivateFieldGet(ec,this)?(a.rect[2]-a.rect[0])*(a.rect[3]-a.rect[1]):null;if(t.stamps.has(stamp_classPrivateFieldGet($d,this))){if(stamp_classPrivateFieldGet(ec,this)){const e=t.stamps.get(stamp_classPrivateFieldGet($d,this));if(r>e.area){e.area=r;e.serialized.bitmap.close();e.serialized.bitmap=stamp_assertClassBrand(ic,this,_serializeBitmap).call(this,!1)}}}else{t.stamps.set(stamp_classPrivateFieldGet($d,this),{area:r,serialized:a});a.bitmap=stamp_assertClassBrand(ic,this,_serializeBitmap).call(this,!1)}return a}renderAnnotationElement(e){if(this.deleted){e.hide();return null}e.updateEdited({rect:this.getPDFRect(),popup:this.comment});return null}}function _getBitmapFetched(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e){stamp_classPrivateFieldSet(Hd,this,e.bitmap);if(!t){stamp_classPrivateFieldSet($d,this,e.id);stamp_classPrivateFieldSet(ec,this,e.isSvg)}e.file&&stamp_classPrivateFieldSet(Yd,this,e.file.name);stamp_assertClassBrand(ic,this,_createCanvas).call(this)}else this.remove()}function _getBitmapDone(){stamp_classPrivateFieldSet(qd,this,null);this._uiManager.enableWaiting(!1);if(stamp_classPrivateFieldGet(Zd,this))if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&stamp_classPrivateFieldGet(Hd,this))this.addEditToolbar().then(()=>{this._editToolbar.hide();this._uiManager.editAltText(this,!0)});else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&stamp_classPrivateFieldGet(Hd,this)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}function _getBitmap(){if(stamp_classPrivateFieldGet($d,this)){this._uiManager.enableWaiting(!0);this._uiManager.imageManager.getFromId(stamp_classPrivateFieldGet($d,this)).then(e=>stamp_assertClassBrand(ic,this,_getBitmapFetched).call(this,e,!0)).finally(()=>stamp_assertClassBrand(ic,this,_getBitmapDone).call(this));return}if(stamp_classPrivateFieldGet(Xd,this)){const e=stamp_classPrivateFieldGet(Xd,this);stamp_classPrivateFieldSet(Xd,this,null);this._uiManager.enableWaiting(!0);stamp_classPrivateFieldSet(qd,this,this._uiManager.imageManager.getFromUrl(e).then(e=>stamp_assertClassBrand(ic,this,_getBitmapFetched).call(this,e)).finally(()=>stamp_assertClassBrand(ic,this,_getBitmapDone).call(this)));return}if(stamp_classPrivateFieldGet(Kd,this)){const e=stamp_classPrivateFieldGet(Kd,this);stamp_classPrivateFieldSet(Kd,this,null);this._uiManager.enableWaiting(!0);stamp_classPrivateFieldSet(qd,this,this._uiManager.imageManager.getFromFile(e).then(e=>stamp_assertClassBrand(ic,this,_getBitmapFetched).call(this,e)).finally(()=>stamp_assertClassBrand(ic,this,_getBitmapDone).call(this)));return}const e=document.createElement("input");e.type="file";e.accept=Q.join(",");const t=this._uiManager._signal;stamp_classPrivateFieldSet(qd,this,new Promise(i=>{e.addEventListener("change",async()=>{if(e.files&&0!==e.files.length){this._uiManager.enableWaiting(!0);const t=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}});stamp_assertClassBrand(ic,this,_getBitmapFetched).call(this,t)}else this.remove();i()},{signal:t});e.addEventListener("cancel",()=>{this.remove();i()},{signal:t})}).finally(()=>stamp_assertClassBrand(ic,this,_getBitmapDone).call(this)));e.click()}function _createCanvas(){const{div:e}=this;let{width:t,height:i}=stamp_classPrivateFieldGet(Hd,this);const[a,s]=this.pageDimensions,n=.75;if(this.width){t=this.width*a;i=this.height*s}else if(t>n*a||i>n*s){const e=Math.min(n*a/t,n*s/i);t*=e;i*=e}this._uiManager.enableWaiting(!1);const r=stamp_classPrivateFieldSet(Zd,this,document.createElement("canvas"));r.setAttribute("role","img");this.addContainer(r);this.width=t/a;this.height=i/s;this.setDims();this._initialOptions?.isCentered?this.center():this.fixAndSetPosition();this._initialOptions=null;this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(e.hidden=!1);stamp_assertClassBrand(ic,this,_drawBitmap).call(this);if(!stamp_classPrivateFieldGet(tc,this)){this.parent.addUndoableEditor(this);stamp_classPrivateFieldSet(tc,this,!0)}this._reportTelemetry({action:"inserted_image"});this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"imageAdded",page:this.pageIndex+1,id:this.uid,editorType:this.constructor.name,value:r,width:t,height:i,fileName:stamp_classPrivateFieldGet(Yd,this)});stamp_classPrivateFieldGet(Yd,this)&&this.div.setAttribute("aria-description",stamp_classPrivateFieldGet(Yd,this));this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")}function _scaleBitmap(e,t){const{width:i,height:a}=stamp_classPrivateFieldGet(Hd,this);let s=i,n=a,r=stamp_classPrivateFieldGet(Hd,this);for(;s>2*e||n>2*t;){const i=s,a=n;s>2*e&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2));n>2*t&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2));const o=new OffscreenCanvas(s,n);o.getContext("2d").drawImage(r,0,0,i,a,0,0,s,n);r=o.transferToImageBitmap()}return r}function _drawBitmap(){const[e,t]=this.parentDimensions,{width:i,height:a}=this,s=new OutputScale,n=Math.ceil(i*e*s.sx),r=Math.ceil(a*t*s.sy),o=stamp_classPrivateFieldGet(Zd,this);if(!o||o.width===n&&o.height===r)return;o.width=n;o.height=r;const l=stamp_classPrivateFieldGet(ec,this)?stamp_classPrivateFieldGet(Hd,this):stamp_assertClassBrand(ic,this,_scaleBitmap).call(this,n,r),d=o.getContext("2d");d.filter=this._uiManager.hcmFilter;d.drawImage(l,0,0,l.width,l.height,0,0,n,r)}function _serializeBitmap(e){if(e){if(stamp_classPrivateFieldGet(ec,this)){const e=this._uiManager.imageManager.getSvgUrl(stamp_classPrivateFieldGet($d,this));if(e)return e}const e=document.createElement("canvas");({width:e.width,height:e.height}=stamp_classPrivateFieldGet(Hd,this));e.getContext("2d").drawImage(stamp_classPrivateFieldGet(Hd,this),0,0);return e.toDataURL()}if(stamp_classPrivateFieldGet(ec,this)){const[e,t]=this.pageDimensions,i=Math.round(this.width*e*PixelsPerInch.PDF_TO_CSS_UNITS),a=Math.round(this.height*t*PixelsPerInch.PDF_TO_CSS_UNITS),s=new OffscreenCanvas(i,a);s.getContext("2d").drawImage(stamp_classPrivateFieldGet(Hd,this),0,0,stamp_classPrivateFieldGet(Hd,this).width,stamp_classPrivateFieldGet(Hd,this).height,0,0,i,a);return s.transferToImageBitmap()}return structuredClone(stamp_classPrivateFieldGet(Hd,this))}function stamp_hasElementChanged(e){const{pageIndex:t,accessibilityData:{altText:i}}=this._initialData,a=e.pageIndex===t,s=(e.accessibilityData?.alt||"")===i;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&a&&s,isSameAltText:s}}stamp_defineProperty(StampEditor,"_type","stamp");stamp_defineProperty(StampEditor,"_editorType",f.STAMP);function annotation_editor_layer_classPrivateFieldInitSpec(e,t,i){annotation_editor_layer_checkPrivateRedeclaration(e,t),t.set(e,i)}function annotation_editor_layer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function annotation_editor_layer_classPrivateGetter(e,t,i){return i(annotation_editor_layer_assertClassBrand(e,t))}function annotation_editor_layer_classPrivateFieldGet(e,t){return e.get(annotation_editor_layer_assertClassBrand(e,t))}function annotation_editor_layer_classPrivateFieldSet(e,t,i){return e.set(annotation_editor_layer_assertClassBrand(e,t),i),i}function annotation_editor_layer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function annotation_editor_layer_defineProperty(e,t,i){return(t=function annotation_editor_layer_toPropertyKey(e){var t=function annotation_editor_layer_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class PointerType{constructor(e){if(null===PointerType.current){PointerType.current="";window.addEventListener("pointerdown",this.windowPointerDown,!0)}}destroy(){if(null!==PointerType.current){window.removeEventListener("pointerdown",this.windowPointerDown,!0);PointerType.current=null}}windowPointerDown(e){PointerType.current=e.pointerType;return!0}static initializeEditor(){setTimeout(()=>PointerType.editor=PointerType.current)}static sameAsEditor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return e?PointerType.editor==e:PointerType.editor==PointerType.current}}annotation_editor_layer_defineProperty(PointerType,"current",null);annotation_editor_layer_defineProperty(PointerType,"editor",null);new PointerType;var ac=new WeakMap,sc=new WeakMap,nc=new WeakMap,rc=new WeakMap,oc=new WeakMap,lc=new WeakMap,dc=new WeakMap,cc=new WeakMap,hc=new WeakMap,uc=new WeakMap,_c=new WeakMap,pc=new WeakMap,gc=new WeakMap,fc=new WeakMap,mc=new WeakMap,vc=new WeakMap,Pc=new WeakSet;class AnnotationEditorLayer{constructor(e){let{uiManager:t,pageIndex:i,div:a,structTreeLayer:s,accessibilityManager:n,annotationLayer:r,drawLayer:o,textLayer:l,viewport:d,l10n:c,eventBus:h}=e;!function annotation_editor_layer_classPrivateMethodInitSpec(e,t){annotation_editor_layer_checkPrivateRedeclaration(e,t),t.add(e)}(this,Pc);annotation_editor_layer_classPrivateFieldInitSpec(this,ac,void 0);annotation_editor_layer_classPrivateFieldInitSpec(this,sc,!1);annotation_editor_layer_classPrivateFieldInitSpec(this,nc,null);annotation_editor_layer_classPrivateFieldInitSpec(this,rc,null);annotation_editor_layer_classPrivateFieldInitSpec(this,oc,null);annotation_editor_layer_classPrivateFieldInitSpec(this,lc,new Map);annotation_editor_layer_classPrivateFieldInitSpec(this,dc,!1);annotation_editor_layer_classPrivateFieldInitSpec(this,cc,!1);annotation_editor_layer_classPrivateFieldInitSpec(this,hc,!1);annotation_editor_layer_classPrivateFieldInitSpec(this,uc,null);annotation_editor_layer_classPrivateFieldInitSpec(this,_c,null);annotation_editor_layer_classPrivateFieldInitSpec(this,pc,null);annotation_editor_layer_classPrivateFieldInitSpec(this,gc,null);annotation_editor_layer_classPrivateFieldInitSpec(this,fc,null);annotation_editor_layer_classPrivateFieldInitSpec(this,mc,-1);annotation_editor_layer_classPrivateFieldInitSpec(this,vc,void 0);const u=[...Fc._.values()];if(!AnnotationEditorLayer._initialized){AnnotationEditorLayer._initialized=!0;for(const e of u){e.eventBus=h;e.initialize(c,t)}}t.registerEditorTypes(u);annotation_editor_layer_classPrivateFieldSet(vc,this,t);this.pageIndex=i;this.div=a;annotation_editor_layer_classPrivateFieldSet(ac,this,n);annotation_editor_layer_classPrivateFieldSet(nc,this,r);this.viewport=d;annotation_editor_layer_classPrivateFieldSet(pc,this,l);this.drawLayer=o;this._structTree=s;annotation_editor_layer_classPrivateFieldGet(vc,this).addLayer(this);this.eventBus=h}get isEmpty(){return 0===annotation_editor_layer_classPrivateFieldGet(lc,this).size}get isInvisible(){return this.isEmpty&&annotation_editor_layer_classPrivateFieldGet(vc,this).getMode()===f.NONE}updateToolbar(e){annotation_editor_layer_classPrivateFieldGet(vc,this).updateToolbar(e)}updateMode(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:annotation_editor_layer_classPrivateFieldGet(vc,this).getMode();annotation_editor_layer_assertClassBrand(Pc,this,_cleanup).call(this);switch(e){case f.NONE:this.div.classList.toggle("nonEditing",!0);this.disableTextSelection();this.togglePointerEvents(!1);this.toggleAnnotationLayerPointerEvents(!0);this.disableClick();return;case f.INK:this.disableTextSelection();this.togglePointerEvents(!0);this.enableClick();break;case f.HIGHLIGHT:this.enableTextSelection();this.togglePointerEvents(!1);this.disableClick();break;default:this.disableTextSelection();this.togglePointerEvents(!0);this.enableClick()}PointerType.initializeEditor();this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;t.toggle("nonEditing",!1);if(e===f.POPUP)t.toggle("commentEditing",!0);else{t.toggle("commentEditing",!1);for(const i of Fc._.values())t.toggle(`${i._type}Editing`,e===i._editorType)}this.div.hidden=!1}hasTextLayer(e){return e===annotation_editor_layer_classPrivateFieldGet(pc,this)?.div}setEditingState(e){annotation_editor_layer_classPrivateFieldGet(vc,this).setEditingState(e)}addCommands(e){annotation_editor_layer_classPrivateFieldGet(vc,this).addCommands(e)}cleanUndoStack(e){annotation_editor_layer_classPrivateFieldGet(vc,this).cleanUndoStack(e)}toggleDrawing(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("drawing",!e)}togglePointerEvents(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];annotation_editor_layer_classPrivateFieldGet(nc,this)?.togglePointerEvents(e)}async enable(){annotation_editor_layer_classPrivateFieldSet(hc,this,!0);this.div.tabIndex=0;this.togglePointerEvents(!0);this.div.classList.toggle("nonEditing",!1);annotation_editor_layer_classPrivateFieldGet(fc,this)?.abort();annotation_editor_layer_classPrivateFieldSet(fc,this,null);const e=new Set;for(const t of annotation_editor_layer_classPrivateGetter(Pc,this,_get_allEditorsIterator)){t.enableEditing();t.show(!0);if(t.annotationElementId){annotation_editor_layer_classPrivateFieldGet(vc,this).removeChangedExistingAnnotation(t);e.add(t.annotationElementId)}}const t=annotation_editor_layer_classPrivateFieldGet(nc,this);if(t)for(const i of t.getEditableAnnotations()){i.hide();if(annotation_editor_layer_classPrivateFieldGet(vc,this).isDeletedAnnotationElement(i.data.id))continue;if(e.has(i.data.id))continue;const t=await this.deserialize(i);if(t){this.addOrRebuild(t);t.enableEditing()}}annotation_editor_layer_classPrivateFieldSet(hc,this,!1);annotation_editor_layer_classPrivateFieldGet(vc,this)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){annotation_editor_layer_classPrivateFieldSet(cc,this,!0);this.div.tabIndex=-1;this.togglePointerEvents(!1);this.div.classList.toggle("nonEditing",!0);if(annotation_editor_layer_classPrivateFieldGet(pc,this)&&!annotation_editor_layer_classPrivateFieldGet(fc,this)){annotation_editor_layer_classPrivateFieldSet(fc,this,new AbortController);const e=annotation_editor_layer_classPrivateFieldGet(vc,this).combinedSignal(annotation_editor_layer_classPrivateFieldGet(fc,this));annotation_editor_layer_classPrivateFieldGet(pc,this).div.addEventListener("pointerdown",e=>{const{clientX:t,clientY:i,timeStamp:a}=e;if(a-annotation_editor_layer_classPrivateFieldGet(mc,this)>500){annotation_editor_layer_classPrivateFieldSet(mc,this,a);return}annotation_editor_layer_classPrivateFieldSet(mc,this,-1);const{classList:s}=this.div;s.toggle("getElements",!0);const n=document.elementsFromPoint(t,i);s.toggle("getElements",!1);if(!this.div.contains(n[0]))return;let r;const o=new RegExp(`^${g}[0-9]+$`);for(const e of n)if(o.test(e.id)){r=e.id;break}if(!r)return;const l=annotation_editor_layer_classPrivateFieldGet(lc,this).get(r);if(null===l?.annotationElementId){e.stopPropagation();e.preventDefault();l.dblclick(e)}},{signal:e,capture:!0})}const e=annotation_editor_layer_classPrivateFieldGet(nc,this),t=[];if(e){const i=new Map,a=new Map;for(const e of annotation_editor_layer_classPrivateGetter(Pc,this,_get_allEditorsIterator)){e.disableEditing();if(e.annotationElementId)if(null===e.serialize()){a.set(e.annotationElementId,e);this.getEditableAnnotation(e.annotationElementId)?.show();e.remove()}else i.set(e.annotationElementId,e);else t.push(e)}for(const t of e.getEditableAnnotations()){const{id:e}=t.data;if(annotation_editor_layer_classPrivateFieldGet(vc,this).isDeletedAnnotationElement(e)){t.updateEdited({deleted:!0});continue}let s=a.get(e);if(s){s.resetAnnotationElement(t);s.show(!1);t.show()}else{s=i.get(e);if(s){annotation_editor_layer_classPrivateFieldGet(vc,this).addChangedExistingAnnotation(s);s.renderAnnotationElement(t)&&s.show(!1)}t.show()}}}annotation_editor_layer_assertClassBrand(Pc,this,_cleanup).call(this);this.isEmpty&&(this.div.hidden=!0);const{classList:i}=this.div;for(const e of Fc._.values())i.remove(`${e._type}Editing`);this.disableTextSelection();this.toggleAnnotationLayerPointerEvents(!0);e?.updateFakeAnnotations(t);annotation_editor_layer_classPrivateFieldSet(cc,this,!1)}getEditableAnnotation(e){return annotation_editor_layer_classPrivateFieldGet(nc,this)?.getEditableAnnotation(e)||null}setActiveEditor(e){annotation_editor_layer_classPrivateFieldGet(vc,this).getActive()!==e&&annotation_editor_layer_classPrivateFieldGet(vc,this).setActiveEditor(e)}enableTextSelection(){this.div.tabIndex=-1;if(annotation_editor_layer_classPrivateFieldGet(pc,this)?.div&&!annotation_editor_layer_classPrivateFieldGet(gc,this)){annotation_editor_layer_classPrivateFieldSet(gc,this,new AbortController);const e=annotation_editor_layer_classPrivateFieldGet(vc,this).combinedSignal(annotation_editor_layer_classPrivateFieldGet(gc,this));annotation_editor_layer_classPrivateFieldGet(pc,this).div.addEventListener("pointerdown",annotation_editor_layer_assertClassBrand(Pc,this,_textLayerPointerDown).bind(this),{signal:e});annotation_editor_layer_classPrivateFieldGet(pc,this).div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0;if(annotation_editor_layer_classPrivateFieldGet(pc,this)?.div&&annotation_editor_layer_classPrivateFieldGet(gc,this)){annotation_editor_layer_classPrivateFieldGet(gc,this).abort();annotation_editor_layer_classPrivateFieldSet(gc,this,null);annotation_editor_layer_classPrivateFieldGet(pc,this).div.classList.remove("highlighting")}}enableClick(){if(annotation_editor_layer_classPrivateFieldGet(rc,this))return;annotation_editor_layer_classPrivateFieldSet(rc,this,new AbortController);const e=annotation_editor_layer_classPrivateFieldGet(vc,this).combinedSignal(annotation_editor_layer_classPrivateFieldGet(rc,this));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});const t=this.pointerup.bind(this);this.div.addEventListener("pointerup",t,{signal:e});this.div.addEventListener("pointercancel",t,{signal:e})}disableClick(){annotation_editor_layer_classPrivateFieldGet(rc,this)?.abort();annotation_editor_layer_classPrivateFieldSet(rc,this,null)}attach(e){annotation_editor_layer_classPrivateFieldGet(lc,this).set(e.id,e);const{annotationElementId:t}=e;t&&annotation_editor_layer_classPrivateFieldGet(vc,this).isDeletedAnnotationElement(t)&&annotation_editor_layer_classPrivateFieldGet(vc,this).removeDeletedAnnotationElement(e)}detach(e){annotation_editor_layer_classPrivateFieldGet(lc,this).delete(e.id);annotation_editor_layer_classPrivateFieldGet(ac,this)?.removePointerInTextLayer(e.contentDiv);!annotation_editor_layer_classPrivateFieldGet(cc,this)&&e.annotationElementId&&annotation_editor_layer_classPrivateFieldGet(vc,this).addDeletedAnnotationElement(e)}remove(e){this.detach(e);annotation_editor_layer_classPrivateFieldGet(vc,this).removeEditor(e);e.div.remove();e.isAttachedToDOM=!1}changeParent(e){if(e.parent!==this){if(e.parent&&e.annotationElementId){annotation_editor_layer_classPrivateFieldGet(vc,this).addDeletedAnnotationElement(e);AnnotationEditor.deleteAnnotationElement(e);e.annotationElementId=null}this.attach(e);e.parent?.detach(e);e.setParent(this);if(e.div&&e.isAttachedToDOM){e.div.remove();this.div.append(e.div)}}}add(e){if(e.parent!==this||!e.isAttachedToDOM){this.changeParent(e);annotation_editor_layer_classPrivateFieldGet(vc,this).addEditor(e);this.attach(e);if(!e.isAttachedToDOM){const t=e.render();this.div.append(t);e.isAttachedToDOM=!0}e.fixAndSetPosition();e.onceAdded(!annotation_editor_layer_classPrivateFieldGet(hc,this));annotation_editor_layer_classPrivateFieldGet(vc,this).addToAnnotationStorage(e);e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;const{activeElement:t}=document;if(e.div.contains(t)&&!annotation_editor_layer_classPrivateFieldGet(oc,this)){e._focusEventsAllowed=!1;annotation_editor_layer_classPrivateFieldSet(oc,this,setTimeout(()=>{annotation_editor_layer_classPrivateFieldSet(oc,this,null);if(e.div.contains(document.activeElement))e._focusEventsAllowed=!0;else{e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:annotation_editor_layer_classPrivateFieldGet(vc,this)._signal});t.focus()}},0))}e._structTreeParentId=annotation_editor_layer_classPrivateFieldGet(ac,this)?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){if(e.needsToBeRebuilt()){e.parent||=this;e.rebuild();e.show()}else this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getEditorByUID(e){for(const t of annotation_editor_layer_classPrivateFieldGet(lc,this).values())if(t.uid===e)return t;return null}combinedSignal(e){return annotation_editor_layer_classPrivateFieldGet(vc,this).combinedSignal(e)}canCreateNewEmptyEditor(){return annotation_editor_layer_classPrivateGetter(Pc,this,_get_currentEditorType)?.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e);await annotation_editor_layer_classPrivateFieldGet(vc,this).updateMode(e.mode);const{offsetX:i,offsetY:a}=annotation_editor_layer_assertClassBrand(Pc,this,_getCenterPoint).call(this),s=annotation_editor_layer_classPrivateFieldGet(vc,this).getId(),n=annotation_editor_layer_assertClassBrand(Pc,this,_createNewEditor).call(this,{parent:this,id:s,x:i,y:a,uiManager:annotation_editor_layer_classPrivateFieldGet(vc,this),isCentered:!0,...t});n&&this.add(n)}async deserialize(e){return await(Fc._.get(e.annotationType??e.annotationEditorType)?.deserialize(e,this,annotation_editor_layer_classPrivateFieldGet(vc,this)))||null}createAndAddNewEditor(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=annotation_editor_layer_classPrivateFieldGet(vc,this).getId(),s=annotation_editor_layer_assertClassBrand(Pc,this,_createNewEditor).call(this,{parent:this,id:a,x:e.offsetX,y:e.offsetY,uiManager:annotation_editor_layer_classPrivateFieldGet(vc,this),isCentered:t,eventBus:this.eventBus,...i});s&&this.add(s);return s}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.createAndAddNewEditor(annotation_editor_layer_assertClassBrand(Pc,this,_getCenterPoint).call(this),!0,e)}setSelected(e){annotation_editor_layer_classPrivateFieldGet(vc,this).setSelected(e)}toggleSelected(e){annotation_editor_layer_classPrivateFieldGet(vc,this).toggleSelected(e)}unselect(e){annotation_editor_layer_classPrivateFieldGet(vc,this).unselect(e)}pointerup(e){const{isMac:t}=FeatureTest.platform;if(0!==e.button||e.ctrlKey&&t)return;if(e.target!==this.div)return;if(!annotation_editor_layer_classPrivateFieldGet(dc,this))return;annotation_editor_layer_classPrivateFieldSet(dc,this,!1);if(annotation_editor_layer_classPrivateGetter(Pc,this,_get_currentEditorType)?.isDrawer&&annotation_editor_layer_classPrivateGetter(Pc,this,_get_currentEditorType).supportMultipleDrawings)return;if(!annotation_editor_layer_classPrivateFieldGet(sc,this)){annotation_editor_layer_classPrivateFieldSet(sc,this,!0);return}const i=annotation_editor_layer_classPrivateFieldGet(vc,this).getMode();i!==f.STAMP&&i!==f.POPUP&&i!==f.SIGNATURE?this.createAndAddNewEditor(e,!1):annotation_editor_layer_classPrivateFieldGet(vc,this).unselectAll()}pointerdown(e){if(annotation_editor_layer_classPrivateFieldGet(vc,this).getMode()===f.HIGHLIGHT){if(!PointerType.sameAsEditor(e.pointerType))return;this.enableTextSelection()}else if(annotation_editor_layer_classPrivateFieldGet(vc,this).getMode()===f.INK&&!PointerType.sameAsEditor(e.pointerType))return;if(annotation_editor_layer_classPrivateFieldGet(dc,this)){annotation_editor_layer_classPrivateFieldSet(dc,this,!1);return}const{isMac:t}=FeatureTest.platform;if(0!==e.button||e.ctrlKey&&t)return;if(e.target!==this.div)return;annotation_editor_layer_classPrivateFieldSet(dc,this,!0);if(annotation_editor_layer_classPrivateGetter(Pc,this,_get_currentEditorType)?.isDrawer){this.startDrawingSession(e);return}const i=annotation_editor_layer_classPrivateFieldGet(vc,this).getActive();annotation_editor_layer_classPrivateFieldSet(sc,this,!i||i.isEmpty())}startDrawingSession(e){this.div.focus({preventScroll:!0});if(annotation_editor_layer_classPrivateFieldGet(uc,this)){annotation_editor_layer_classPrivateGetter(Pc,this,_get_currentEditorType).startDrawing(this,annotation_editor_layer_classPrivateFieldGet(vc,this),!1,e);return}annotation_editor_layer_classPrivateFieldGet(vc,this).setCurrentDrawingSession(this);annotation_editor_layer_classPrivateFieldSet(uc,this,new AbortController);const t=annotation_editor_layer_classPrivateFieldGet(vc,this).combinedSignal(annotation_editor_layer_classPrivateFieldGet(uc,this));this.div.addEventListener("blur",e=>{let{relatedTarget:t}=e;if(t&&!this.div.contains(t)){annotation_editor_layer_classPrivateFieldSet(_c,this,null);this.commitOrRemove()}},{signal:t});annotation_editor_layer_classPrivateGetter(Pc,this,_get_currentEditorType).startDrawing(this,annotation_editor_layer_classPrivateFieldGet(vc,this),!1,e)}pause(e){if(e){const{activeElement:e}=document;this.div.contains(e)&&annotation_editor_layer_classPrivateFieldSet(_c,this,e);return}annotation_editor_layer_classPrivateFieldGet(_c,this)&&setTimeout(()=>{annotation_editor_layer_classPrivateFieldGet(_c,this)?.focus();annotation_editor_layer_classPrivateFieldSet(_c,this,null)},0)}endDrawingSession(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!annotation_editor_layer_classPrivateFieldGet(uc,this))return null;annotation_editor_layer_classPrivateFieldGet(vc,this).setCurrentDrawingSession(null);annotation_editor_layer_classPrivateFieldGet(uc,this).abort();annotation_editor_layer_classPrivateFieldSet(uc,this,null);annotation_editor_layer_classPrivateFieldSet(_c,this,null);return annotation_editor_layer_classPrivateGetter(Pc,this,_get_currentEditorType).endDrawing(e)}findNewParent(e,t,i){const a=annotation_editor_layer_classPrivateFieldGet(vc,this).findParent(t,i);if(null===a||a===this)return!1;a.changeParent(e);return!0}commitOrRemove(){if(annotation_editor_layer_classPrivateFieldGet(uc,this)){this.endDrawingSession();return!0}return!1}onScaleChanging(){annotation_editor_layer_classPrivateFieldGet(uc,this)&&annotation_editor_layer_classPrivateGetter(Pc,this,_get_currentEditorType).onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove();if(annotation_editor_layer_classPrivateFieldGet(vc,this).getActive()?.parent===this){annotation_editor_layer_classPrivateFieldGet(vc,this).commitOrRemove();annotation_editor_layer_classPrivateFieldGet(vc,this).setActiveEditor(null)}if(annotation_editor_layer_classPrivateFieldGet(oc,this)){clearTimeout(annotation_editor_layer_classPrivateFieldGet(oc,this));annotation_editor_layer_classPrivateFieldSet(oc,this,null)}for(const e of annotation_editor_layer_classPrivateFieldGet(lc,this).values()){annotation_editor_layer_classPrivateFieldGet(ac,this)?.removePointerInTextLayer(e.contentDiv);e.setParent(null);e.isAttachedToDOM=!1;e.div.remove()}this.div=null;annotation_editor_layer_classPrivateFieldGet(lc,this).clear();annotation_editor_layer_classPrivateFieldGet(vc,this).removeLayer(this)}async render(e){let{viewport:t}=e;this.viewport=t;setLayerDimensions(this.div,t);for(const e of annotation_editor_layer_classPrivateFieldGet(vc,this).getEditors(this.pageIndex)){this.add(e);e.rebuild()}await annotation_editor_layer_classPrivateFieldGet(vc,this).findClonesForPage(this);this.div.hidden=this.isEmpty;this.updateMode()}update(e){let{viewport:t}=e;annotation_editor_layer_classPrivateFieldGet(vc,this).commitOrRemove();annotation_editor_layer_assertClassBrand(Pc,this,_cleanup).call(this);const i=this.viewport.rotation,a=t.rotation;this.viewport=t;setLayerDimensions(this.div,{rotation:a});if(i!==a)for(const e of annotation_editor_layer_classPrivateFieldGet(lc,this).values())e.rotate(a)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return annotation_editor_layer_classPrivateFieldGet(vc,this).viewParameters.realScale}}function _get_allEditorsIterator(e){return 0!==annotation_editor_layer_classPrivateFieldGet(lc,e).size?annotation_editor_layer_classPrivateFieldGet(lc,e).values():annotation_editor_layer_classPrivateFieldGet(vc,e).getEditors(e.pageIndex)}function _textLayerPointerDown(e){annotation_editor_layer_classPrivateFieldGet(vc,this).unselectAll();const{target:t}=e;if(t===annotation_editor_layer_classPrivateFieldGet(pc,this).div||("img"===t.getAttribute("role")||t.classList.contains("endOfContent"))&&annotation_editor_layer_classPrivateFieldGet(pc,this).div.contains(t)){const{isMac:t}=FeatureTest.platform;if(0!==e.button||e.ctrlKey&&t)return;annotation_editor_layer_classPrivateFieldGet(vc,this).showAllEditors("highlight",!0,!0);annotation_editor_layer_classPrivateFieldGet(pc,this).div.classList.add("free");this.toggleDrawing();this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"drawingStarted",editorType:"HighlightEditor"});HighlightEditor.startHighlighting(this,"ltr"===annotation_editor_layer_classPrivateFieldGet(vc,this).direction,{target:annotation_editor_layer_classPrivateFieldGet(pc,this).div,x:e.x,y:e.y});annotation_editor_layer_classPrivateFieldGet(pc,this).div.addEventListener("pointerup",()=>{annotation_editor_layer_classPrivateFieldGet(pc,this).div.classList.remove("free");this.toggleDrawing(!0);this.eventBus?.dispatch("annotation-editor-event",{source:this,type:"drawingStopped",editorType:"HighlightEditor"})},{once:!0,signal:annotation_editor_layer_classPrivateFieldGet(vc,this)._signal});e.preventDefault()}}function _get_currentEditorType(e){return Fc._.get(annotation_editor_layer_classPrivateFieldGet(vc,e).getMode())}function _createNewEditor(e){const t=annotation_editor_layer_classPrivateGetter(Pc,this,_get_currentEditorType);return t?new t.prototype.constructor(e):null}function _getCenterPoint(){const{x:e,y:t,width:i,height:a}=this.boundingClientRect,s=Math.max(0,e),n=Math.max(0,t),r=(s+Math.min(window.innerWidth,e+i))/2-e,o=(n+Math.min(window.innerHeight,t+a))/2-t,[l,d]=this.viewport.rotation%180==0?[r,o]:[o,r];return{offsetX:l,offsetY:d}}function _cleanup(){for(const e of annotation_editor_layer_classPrivateFieldGet(lc,this).values())e.isEmpty()&&e.remove()}annotation_editor_layer_defineProperty(AnnotationEditorLayer,"_initialized",!1);var wc,Fc={_:new Map([FreeTextEditor,InkEditor,StampEditor,HighlightEditor,SignatureEditor].map(e=>[e._editorType,e]))};function draw_layer_classPrivateFieldInitSpec(e,t,i){draw_layer_checkPrivateRedeclaration(e,t),t.set(e,i)}function draw_layer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function draw_layer_classPrivateFieldSet(e,t,i){return e.set(draw_layer_assertClassBrand(e,t),i),i}function draw_layer_classPrivateFieldGet(e,t){return e.get(draw_layer_assertClassBrand(e,t))}function draw_layer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var bc=new WeakMap,yc=new WeakMap,Sc=new WeakMap,Cc=new WeakSet;class DrawLayer{constructor(){!function draw_layer_classPrivateMethodInitSpec(e,t){draw_layer_checkPrivateRedeclaration(e,t),t.add(e)}(this,Cc);draw_layer_classPrivateFieldInitSpec(this,bc,null);draw_layer_classPrivateFieldInitSpec(this,yc,new Map);draw_layer_classPrivateFieldInitSpec(this,Sc,new Map)}setParent(e){if(draw_layer_classPrivateFieldGet(bc,this)){if(draw_layer_classPrivateFieldGet(bc,this)!==e){if(draw_layer_classPrivateFieldGet(yc,this).size>0)for(const t of draw_layer_classPrivateFieldGet(yc,this).values()){t.remove();e.append(t)}draw_layer_classPrivateFieldSet(bc,this,e)}}else draw_layer_classPrivateFieldSet(bc,this,e)}static get _svgFactory(){return shadow(this,"_svgFactory",new DOMSVGFactory)}draw(e){var t,i;let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=(xc._=(t=xc._,i=t++,t),i),r=draw_layer_assertClassBrand(Cc,this,_createSVG).call(this),o=DrawLayer._svgFactory.createElement("defs");r.append(o);const l=DrawLayer._svgFactory.createElement("path");o.append(l);const d=`path_${n}`;l.setAttribute("id",d);l.setAttribute("vector-effect","non-scaling-stroke");a&&draw_layer_classPrivateFieldGet(Sc,this).set(n,l);const c=s?draw_layer_assertClassBrand(Cc,this,_createClipPath).call(this,o,d):null,h=DrawLayer._svgFactory.createElement("use");r.append(h);h.setAttribute("href",`#${d}`);this.updateProperties(r,e);draw_layer_classPrivateFieldGet(yc,this).set(n,r);return{id:n,clipPathId:`url(#${c})`}}drawOutline(e,t){var i,a;const s=(xc._=(i=xc._,a=i++,i),a),n=draw_layer_assertClassBrand(Cc,this,_createSVG).call(this),r=DrawLayer._svgFactory.createElement("defs");n.append(r);const o=DrawLayer._svgFactory.createElement("path");r.append(o);const l=`path_${s}`;o.setAttribute("id",l);o.setAttribute("vector-effect","non-scaling-stroke");let d;if(t){const e=DrawLayer._svgFactory.createElement("mask");r.append(e);d=`mask_${s}`;e.setAttribute("id",d);e.setAttribute("maskUnits","objectBoundingBox");const t=DrawLayer._svgFactory.createElement("rect");e.append(t);t.setAttribute("width","1");t.setAttribute("height","1");t.setAttribute("fill","white");const i=DrawLayer._svgFactory.createElement("use");e.append(i);i.setAttribute("href",`#${l}`);i.setAttribute("stroke","none");i.setAttribute("fill","black");i.setAttribute("fill-rule","nonzero");i.classList.add("mask")}const c=DrawLayer._svgFactory.createElement("use");n.append(c);c.setAttribute("href",`#${l}`);d&&c.setAttribute("mask",`url(#${d})`);const h=c.cloneNode();n.append(h);c.classList.add("mainOutline");h.classList.add("secondaryOutline");this.updateProperties(n,e);draw_layer_classPrivateFieldGet(yc,this).set(s,n);return s}finalizeDraw(e,t){draw_layer_classPrivateFieldGet(Sc,this).delete(e);this.updateProperties(e,t)}updateProperties(e,t){if(!t)return;const{root:i,bbox:a,rootClass:s,path:n}=t,r="number"==typeof e?draw_layer_classPrivateFieldGet(yc,this).get(e):e;if(r){i&&draw_layer_assertClassBrand(Cc,this,_updateProperties).call(this,r,i);a&&_setBox.call(DrawLayer,r,a);if(s){const{classList:e}=r;for(const[t,i]of Object.entries(s))e.toggle(t,i)}if(n){const e=r.firstElementChild.firstElementChild;draw_layer_assertClassBrand(Cc,this,_updateProperties).call(this,e,n)}}}updateParent(e,t){if(t===this)return;const i=draw_layer_classPrivateFieldGet(yc,this).get(e);if(i){draw_layer_classPrivateFieldGet(bc,t).append(i);draw_layer_classPrivateFieldGet(yc,this).delete(e);draw_layer_classPrivateFieldGet(yc,t).set(e,i)}}remove(e){draw_layer_classPrivateFieldGet(Sc,this).delete(e);if(null!==draw_layer_classPrivateFieldGet(bc,this)){draw_layer_classPrivateFieldGet(yc,this).get(e).remove();draw_layer_classPrivateFieldGet(yc,this).delete(e)}}destroy(){draw_layer_classPrivateFieldSet(bc,this,null);for(const e of draw_layer_classPrivateFieldGet(yc,this).values())e.remove();draw_layer_classPrivateFieldGet(yc,this).clear();draw_layer_classPrivateFieldGet(Sc,this).clear()}}wc=DrawLayer;function _setBox(e,t){let[i,a,s,n]=t;const{style:r}=e;r.top=100*a+"%";r.left=100*i+"%";r.width=100*s+"%";r.height=100*n+"%"}function _createSVG(){const e=wc._svgFactory.create(1,1,!0);draw_layer_classPrivateFieldGet(bc,this).append(e);e.setAttribute("aria-hidden",!0);return e}function _createClipPath(e,t){const i=wc._svgFactory.createElement("clipPath");e.append(i);const a=`clip_${t}`;i.setAttribute("id",a);i.setAttribute("clipPathUnits","objectBoundingBox");const s=wc._svgFactory.createElement("use");i.append(s);s.setAttribute("href",`#${t}`);s.classList.add("clip");return a}function _updateProperties(e,t){for(const[i,a]of Object.entries(t))null===a?e.removeAttribute(i):e.setAttribute(i,a)}var xc={_:0};function text_layer_images_classPrivateFieldInitSpec(e,t,i){text_layer_images_checkPrivateRedeclaration(e,t),t.set(e,i)}function text_layer_images_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function text_layer_images_classPrivateFieldGet(e,t){return e.get(text_layer_images_assertClassBrand(e,t))}function text_layer_images_classPrivateFieldSet(e,t,i){return e.set(text_layer_images_assertClassBrand(e,t),i),i}function text_layer_images_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function percentage(e){return`${(100*e).toFixed(2)}%`}var kc=new WeakMap,Ec=new WeakMap,Ac=new WeakMap,Gc=new WeakMap,Bc=new WeakMap,Mc=new WeakMap,Ic=new WeakSet;class TextLayerImages{constructor(e,t,i,a){!function text_layer_images_classPrivateMethodInitSpec(e,t){text_layer_images_checkPrivateRedeclaration(e,t),t.add(e)}(this,Ic);text_layer_images_classPrivateFieldInitSpec(this,kc,[]);text_layer_images_classPrivateFieldInitSpec(this,Ec,new Map);text_layer_images_classPrivateFieldInitSpec(this,Ac,null);text_layer_images_classPrivateFieldInitSpec(this,Gc,0);text_layer_images_classPrivateFieldInitSpec(this,Bc,0);text_layer_images_classPrivateFieldInitSpec(this,Mc,0);text_layer_images_classPrivateFieldSet(Gc,this,e);text_layer_images_classPrivateFieldSet(kc,this,t);text_layer_images_classPrivateFieldSet(Bc,this,i.rawDims.pageWidth);text_layer_images_classPrivateFieldSet(Mc,this,i.rawDims.pageHeight);text_layer_images_classPrivateFieldSet(Ac,this,a)}render(){const e=document.createElement("div");e.className="textLayerImages";for(let t=0;t<text_layer_images_classPrivateFieldGet(kc,this).length;t+=6){const i=text_layer_images_assertClassBrand(Ic,this,_createImagePlaceholder).call(this,text_layer_images_classPrivateFieldGet(kc,this).subarray(t,t+6));i&&e.append(i)}e.addEventListener("contextmenu",e=>{if(!(e.target instanceof HTMLCanvasElement))return;const t=e.target,i=text_layer_images_classPrivateFieldGet(Ec,this).get(t);if(!i)return;const a=Tc._?.deref();if(a===t)return;if(a){a.width=0;a.height=0}Tc._=new WeakRef(t);const{inverseTransform:s,x1:n,y1:r,width:o,height:l}=i,d=text_layer_images_classPrivateFieldGet(Ac,this).call(this),c=Math.ceil(n*d.width),h=Math.ceil(r*d.height),u=Math.floor((n+o/text_layer_images_classPrivateFieldGet(Bc,this))*d.width),_=Math.floor((r+l/text_layer_images_classPrivateFieldGet(Mc,this))*d.height);t.width=u-c;t.height=_-h;const p=t.getContext("2d");p.setTransform(...s);p.translate(-c,-h);p.drawImage(d,0,0)});return e}}function _createImagePlaceholder(e){let[t,i,a,s,n,r]=e;const o=Math.hypot((n-t)*text_layer_images_classPrivateFieldGet(Bc,this),(r-i)*text_layer_images_classPrivateFieldGet(Mc,this)),l=Math.hypot((a-t)*text_layer_images_classPrivateFieldGet(Bc,this),(s-i)*text_layer_images_classPrivateFieldGet(Mc,this));if(o<text_layer_images_classPrivateFieldGet(Gc,this)||l<text_layer_images_classPrivateFieldGet(Gc,this))return null;const d=[(n-t)*text_layer_images_classPrivateFieldGet(Bc,this)/o,(r-i)*text_layer_images_classPrivateFieldGet(Mc,this)/o,(a-t)*text_layer_images_classPrivateFieldGet(Bc,this)/l,(s-i)*text_layer_images_classPrivateFieldGet(Mc,this)/l,0,0],c=Util.inverseTransform(d),h=document.createElement("canvas");h.className="textLayerImagePlaceholder";h.width=0;h.height=0;Object.assign(h.style,{opacity:0,position:"absolute",left:percentage(t),top:percentage(i),width:percentage(o/text_layer_images_classPrivateFieldGet(Bc,this)),height:percentage(l/text_layer_images_classPrivateFieldGet(Mc,this)),transformOrigin:"0% 0%",transform:`matrix(${d.join(",")})`});text_layer_images_classPrivateFieldGet(Ec,this).set(h,{inverseTransform:c,width:o,height:l,x1:t,y1:i});return h}var Tc={_:null};globalThis._pdfjsTestingUtils={HighlightOutliner};globalThis.pdfjsLib={AbortException,AnnotationEditorLayer,AnnotationEditorParamsType:m,AnnotationEditorType:f,AnnotationEditorUIManager,AnnotationLayer,AnnotationMode:p,AnnotationType:A,applyOpacity,build:Nr,ColorPicker,createValidAbsoluteUrl,CSSConstants,DOMSVGFactory,DrawLayer,FeatureTest,fetchData,findContrastColor,getDocument,getFilenameFromUrl:function getFilenameFromUrl(e){[e]=e.split(/[#?]/,1);return stripPath(e)},getPdfFilenameFromUrl,getRGB,getUuid,getXfaPageViewport,GlobalWorkerOptions,ImageKind:E,InvalidPDFException,isDataScheme,isPdfFile,isValidExplicitDest:es,makeArr,makeMap,makeObj,MathClamp,noContextMenu,normalizeUnicode,OPS:L,OutputScale,PasswordResponses:V,PDFDataRangeTransport,PDFDateString,PDFWorker,PermissionFlag:v,PixelsPerInch,RenderingCancelledException,renderRichText,ResponseException,setLayerDimensions,shadow,SignatureExtractor,stopEvent,SupportedImageMimeTypes:Q,TextLayer,TextLayerImages,TouchManager,updateUrlHash,Util,VerbosityLevel:D,version:Rr,XfaLayer};function ui_utils_classPrivateFieldInitSpec(e,t,i){(function ui_utils_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function ui_utils_classPrivateFieldGet(e,t){return e.get(ui_utils_assertClassBrand(e,t))}function ui_utils_classPrivateFieldSet(e,t,i){return e.set(ui_utils_assertClassBrand(e,t),i),i}function ui_utils_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Dc="auto",Lc=.1,Rc=0,Nc=1,Oc=2,Wc=3,jc=-1,Vc=0,Uc=1,zc=2,Hc=3,$c=4,qc=0,Xc=1,Kc=2,Yc={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},Zc={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2},Jc={SELECT:0,HAND:1,ZOOM:2,PAGE_FLIP:-3},Qc=/\bprint\s*\(/;function scrollIntoView(e,t){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.classList.contains("stf__item")||e.parentElement?.classList.contains("stf__item")||e.parentElement?.parentElement?.classList.contains("stf__item"))return;if(i){setTimeout(()=>{let i=e.parentElement;for(;i&&i!==document.body&&i!==document.documentElement;){const a=getComputedStyle(i).overflowY;if(("auto"===a||"scroll"===a)&&i.scrollHeight>i.clientHeight){const a=e.getBoundingClientRect(),s=i.getBoundingClientRect();let n=i.scrollTop+(a.top-s.top),r=i.scrollLeft+(a.left-s.left);if(t){void 0!==t.top&&(n+=t.top);void 0!==t.left&&(r+=t.left)}i.scrollTop=n;void 0!==t?.left&&(i.scrollLeft=r);return}i=i.parentElement}const a=e.getBoundingClientRect();let s=window.scrollY+a.top;void 0!==t?.top&&(s+=t.top);window.scrollTo(window.scrollX,s)},0);return}let a=e.offsetParent;if(!a){ngx_console_NgxConsole.error("offsetParent is not set -- cannot scroll");return}let s=e.offsetTop+e.clientTop,n=e.offsetLeft+e.clientLeft;for(;a.clientHeight===a.scrollHeight&&a.clientWidth===a.scrollWidth;){s+=a.offsetTop;n+=a.offsetLeft;a=a.offsetParent;if(!a)return}if("viewer"===a.id&&a.offsetParent){const e=a.offsetParent,t=getComputedStyle(e);if("auto"===t.overflow||"scroll"===t.overflow||"auto"===t.overflowX||"scroll"===t.overflowX){s+=a.offsetTop;n+=a.offsetLeft;a=e}}if(t){void 0!==t.top&&(s+=t.top);if(void 0!==t.left){n+=t.left;a.scrollLeft=n}}else if(function isDivInViewport(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}(e))return;a.scrollTop=s}function watchScroll(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const debounceScroll=function(i){s||(s=window.requestAnimationFrame(function viewAreaElementScrolled(){s=null;const i=e.scrollLeft,n=a.lastX;i!==n&&(a.right=i>n);a.lastX=i;const r=e.scrollTop,o=a.lastY;r!==o&&(a.down=r>o);a.lastY=r;t(a)}))},a={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:debounceScroll};let s=null;e.addEventListener("scroll",debounceScroll,{useCapture:!0,signal:i});i?.addEventListener("abort",()=>window.cancelAnimationFrame(s),{once:!0});return a}function parseQueryString(e){const t=new Map;for(const[i,a]of new URLSearchParams(e))t.set(i.toLowerCase(),a);return t}const eh=/[\x00-\x1F]/g;function removeNullCharacters(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return eh.test(e)?t?e.replaceAll(eh,e=>"\0"===e?"":" "):e.replaceAll("\0",""):e}function binarySearchFirstItem(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=e.length-1;if(a<0||!t(e[a]))return e.length;if(t(e[i]))return i;for(;i<a;){const s=i+a>>1;t(e[s])?a=s:i=s+1}return i}function approximateFraction(e){if(Math.floor(e)===e)return[e,1];const t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const i=e>1?t:e;let a,s=0,n=1,r=1,o=1;for(;;){const e=s+r,t=n+o;if(t>8)break;if(i<=e/t){r=e;o=t}else{s=e;n=t}}a=i-s/n<r/o-i?i===e?[s,n]:[n,s]:i===e?[r,o]:[o,r];return a}function floorToDivide(e,t){return e-e%t}function getPageSizeInches(e){let{view:t,userUnit:i,rotate:a}=e;const[s,n,r,o]=t,l=a%180!=0,d=(r-s)/72*i,c=(o-n)/72*i;return{width:l?c:d,height:l?d:c}}function getVisibleElements(e){let{scrollEl:t,views:i,sortByVisibility:a=!1,horizontal:s=!1,rtl:n=!1}=e;const r=t.scrollTop,o=r+t.clientHeight,l=t.scrollLeft,d=l+t.clientWidth;const c=[],h=new Set,u=i.length;let _=binarySearchFirstItem(i,s?function isElementNextAfterViewHorizontally(e){const t=e.div,i=t.offsetLeft+t.clientLeft,a=i+t.clientWidth;return n?i<d:a>l}:function isElementBottomAfterViewTop(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>r});_>0&&_<u&&!s&&(_=function backtrackBeforeAllVisibleElements(e,t,i){if(e<2)return e;let a=t[e].div,s=a.offsetTop+a.clientTop;if(s>=i){a=t[e-1].div;s=a.offsetTop+a.clientTop}for(let i=e-2;i>=0;--i){a=t[i].div;if(a.offsetTop+a.clientTop+a.clientHeight<=s)break;e=i}return e}(_,i,r));let p=s?d:-1;for(let e=_;e<u;e++){const t=i[e],a=t.div,n=a.offsetLeft+a.clientLeft,u=a.offsetTop+a.clientTop,_=a.clientWidth,g=a.clientHeight,f=n+_,m=u+g;if(-1===p)m>=o&&(p=m);else if((s?n:u)>p)break;if(m<=r||u>=o||f<=l||n>=d)continue;const v=Math.max(0,r-u),P=Math.max(0,l-n),w=v+Math.max(0,m-o),b=(_-(P+Math.max(0,f-d)))/_,y=(g-w)/g*b*100|0;c.push({id:t.id,x:n,y:u,visibleArea:100===y?null:{minX:P,minY:v,maxX:Math.min(f,d)-n,maxY:Math.min(m,o)-u},view:t,percent:y,widthPercent:100*b|0});h.add(t.id)}const g=c[0],f=c.at(-1);a&&c.sort(function(e,t){const i=e.percent-t.percent;return Math.abs(i)>.001?-i:e.id-t.id});return{first:g,last:f,views:c,ids:h}}function normalizeWheelEventDirection(e){let t=Math.hypot(e.deltaX,e.deltaY);const i=Math.atan2(e.deltaY,e.deltaX);-.25*Math.PI<i&&i<.75*Math.PI&&(t=-t);return t}function isValidRotation(e){return Number.isInteger(e)&&e%90==0}function isValidScrollMode(e){return Number.isInteger(e)&&Object.values(Yc).includes(e)&&e!==Yc.UNKNOWN}function isValidSpreadMode(e){return Number.isInteger(e)&&Object.values(Zc).includes(e)&&e!==Zc.UNKNOWN}function isPortraitOrientation(e){return e.width<=e.height}const th=new Promise(function(e){window.requestAnimationFrame(e)}),ih=document.documentElement.style;var ah=new WeakMap,sh=new WeakMap,nh=new WeakMap,rh=new WeakMap,oh=new WeakMap;class ProgressBar{constructor(e){ui_utils_classPrivateFieldInitSpec(this,ah,null);ui_utils_classPrivateFieldInitSpec(this,sh,null);ui_utils_classPrivateFieldInitSpec(this,nh,0);ui_utils_classPrivateFieldInitSpec(this,rh,null);ui_utils_classPrivateFieldInitSpec(this,oh,!0);ui_utils_classPrivateFieldSet(ah,this,e.classList);ui_utils_classPrivateFieldSet(rh,this,e.style)}get percent(){return ui_utils_classPrivateFieldGet(nh,this)}set percent(e){ui_utils_classPrivateFieldSet(nh,this,e);if(isNaN(e))ui_utils_classPrivateFieldGet(ah,this).add("indeterminate");else{ui_utils_classPrivateFieldGet(ah,this).remove("indeterminate");ui_utils_classPrivateFieldGet(rh,this).setProperty("--progressBar-percent",`${ui_utils_classPrivateFieldGet(nh,this)}%`)}}setWidth(e){if(!e)return;const t=e.parentNode.offsetWidth-e.offsetWidth;t>0&&ui_utils_classPrivateFieldGet(rh,this).setProperty("--progressBar-end-offset",`${t}px`)}setDisableAutoFetch(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5e3;if(100!==ui_utils_classPrivateFieldGet(nh,this)&&!isNaN(ui_utils_classPrivateFieldGet(nh,this))){ui_utils_classPrivateFieldGet(sh,this)&&clearTimeout(ui_utils_classPrivateFieldGet(sh,this));this.show();ui_utils_classPrivateFieldSet(sh,this,setTimeout(()=>{ui_utils_classPrivateFieldSet(sh,this,null);this.hide()},e))}}hide(){if(ui_utils_classPrivateFieldGet(oh,this)){ui_utils_classPrivateFieldSet(oh,this,!1);ui_utils_classPrivateFieldGet(ah,this).add("hidden")}}show(){if(!ui_utils_classPrivateFieldGet(oh,this)){ui_utils_classPrivateFieldSet(oh,this,!0);ui_utils_classPrivateFieldGet(ah,this).remove("hidden")}}}function getActiveOrFocusedElement(){let e=document,t=e.activeElement||e.querySelector(":focus");for(;t?.shadowRoot;){e=t.shadowRoot;t=e.activeElement||e.querySelector(":focus")}return t}function apiPageLayoutToViewerModes(e){let t=Yc.VERTICAL,i=Zc.NONE;switch(e){case"SinglePage":t=Yc.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=Yc.PAGE;case"TwoColumnLeft":i=Zc.ODD;break;case"TwoPageRight":t=Yc.PAGE;case"TwoColumnRight":i=Zc.EVEN}return{scrollMode:t,spreadMode:i}}function toggleCheckedBtn(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.classList.toggle("toggled",t);e.setAttribute("aria-checked",t);i?.classList.toggle("hidden",!t)}function toggleSelectedBtn(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.classList.toggle("selected",t);e.setAttribute("aria-selected",t);i?.classList.toggle("hidden",!t)}function toggleExpandedBtn(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e?.classList.toggle("toggled",t);e?.setAttribute("aria-expanded",t);i?.classList.toggle("hidden",!t);if(i&&!i.classList.contains("hidden")){const t=e.getBoundingClientRect(),a=e.closest("#toolbarViewer");if(a){const e=a.getBoundingClientRect().right-t.right;i.style.removeProperty("inset-inline-end");i.style.setProperty("inset-inline-end",e+"px")}}}const lh=function(){const e=document.createElement("div");e.style.width="round(down, calc(1.6666666666666665 * 792px), 1px)";return"calc(1320px)"===e.style.width?Math.fround:e=>e}();function pdf_link_service_defineProperty(e,t,i){return(t=function pdf_link_service_toPropertyKey(e){var t=function pdf_link_service_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const dh={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};class PDFLinkService{constructor(){let{eventBus:e,externalLinkTarget:t=null,externalLinkRel:i=null,ignoreDestinationZoom:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};pdf_link_service_defineProperty(this,"externalLinkEnabled",!0);this.eventBus=e;this.externalLinkTarget=t;this.externalLinkRel=i;this._ignoreDestinationZoom=a;this.baseUrl=null;this.pdfDocument=null;this.pdfViewer=null;this.pdfHistory=null}setDocument(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.baseUrl=t;this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setHistory(e){this.pdfHistory=e}get pagesCount(){return this.pdfDocument?.pagesMapper.pagesNumber||0}get page(){return this.pdfDocument?this.pdfViewer.currentPageNumber:1}set page(e){this.pdfDocument&&(this.pdfViewer.currentPageNumber=e)}get rotation(){return this.pdfDocument?this.pdfViewer.pagesRotation:0}set rotation(e){this.pdfDocument&&(this.pdfViewer.pagesRotation=e)}get isInPresentationMode(){return!!this.pdfDocument&&this.pdfViewer.isInPresentationMode}async goToDestination(e){if(!this.pdfDocument)return;let t,i,a;if("string"==typeof e){t=e;i=await this.pdfDocument.getDestination(e)}else{t=null;i=await e}if(!Array.isArray(i)){console.error(`goToDestination: "${i}" is not a valid destination array, for dest="${e}".`);return}const[s]=i;if(s&&"object"==typeof s){a=this.pdfDocument.cachedPageNumber(s);if(!a)try{a=await this.pdfDocument.getPageIndex(s)+1}catch{ngx_console_NgxConsole.error(`goToDestination: "${s}" is not a valid page reference, for dest="${e}".`);return}}else Number.isInteger(s)&&(a=s+1);if(!a||a<1||a>this.pagesCount){ngx_console_NgxConsole.error(`goToDestination: "${a}" is not a valid page number, for dest="${e}".`);return}if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.push({namedDest:t,explicitDest:i,pageNumber:a})}if("book"===this.pdfViewer.pageViewMode&&this.pdfViewer.pageFlip){this.pdfViewer.ensureAdjacentPagesAreLoaded();this.pdfViewer.pageFlip.flip(a-1)}else this.pdfViewer.scrollPageIntoView({pageNumber:a,destArray:i,ignoreDestinationZoom:this._ignoreDestinationZoom});const n=new AbortController;this.eventBus._on("textlayerrendered",e=>{if(e.pageNumber===a){e.source.textLayer.div.focus();n.abort()}},{signal:n.signal})}goToPage(e){if(!this.pdfDocument)return;const t="string"==typeof e&&this.pdfViewer.pageLabelToPageNumber(e)||0|e;if(Number.isInteger(t)&&t>0&&t<=this.pagesCount){if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.pushPage(t)}this.pdfViewer.scrollPageIntoView({pageNumber:t})}else ngx_console_NgxConsole.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`)}goToXY(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.pdfViewer.scrollPageIntoView({pageNumber:e,destArray:[null,{name:"XYZ"},t,i],ignoreDestinationZoom:!0,...a})}addLinkAttributes(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!t||"string"!=typeof t)throw new Error('A valid "url" parameter must provided.');const a=i?dh.BLANK:this.externalLinkTarget,s=this.externalLinkRel;if(this.externalLinkEnabled)e.href=e.title=t;else{e.href="";e.title=`Disabled: ${t}`;e.onclick=()=>!1}let n="";switch(a){case dh.NONE:break;case dh.SELF:n="_self";break;case dh.BLANK:n="_blank";break;case dh.PARENT:n="_parent";break;case dh.TOP:n="_top"}e.target=n;e.rel="string"==typeof s?s:"noopener noreferrer nofollow"}getDestinationHash(e){if("string"==typeof e){if(e.length>0)return this.getAnchorUrl("#"+escape(e))}else if(Array.isArray(e)){const t=JSON.stringify(e);if(t.length>0)return this.getAnchorUrl("#"+escape(t))}return this.getAnchorUrl("")}getAnchorUrl(e){return this.baseUrl?this.baseUrl+e:e}setHash(e){if(!this.pdfDocument)return;let t,i;if(e.includes("=")){const a=parseQueryString(e);if(a.has("search")){const e=a.get("search").replaceAll('"',""),t="true"===a.get("phrase");this.eventBus.dispatch("findfromurlhash",{source:this,query:t?e:e.match(/\S+/g)})}a.has("page")&&(t=0|a.get("page")||1);if(a.has("zoom")){const e=a.get("zoom").split(","),t=e[0],s=parseFloat(t);t.includes("Fit")?"Fit"===t||"FitB"===t?i=[null,{name:t}]:"FitH"===t||"FitBH"===t||"FitV"===t||"FitBV"===t?i=[null,{name:t},e.length>1?0|e[1]:null]:"FitR"===t?5!==e.length?ngx_console_NgxConsole.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:t},0|e[1],0|e[2],0|e[3],0|e[4]]:ngx_console_NgxConsole.error(`PDFLinkService.setHash: "${t}" is not a valid zoom value.`):i=[null,{name:"XYZ"},e.length>1?0|e[1]:null,e.length>2?0|e[2]:null,s?s/100:t]}i?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:i,allowNegativeOffset:!0}):t&&(this.page=t);a.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:a.get("pagemode")});a.has("nameddest")&&this.goToDestination(a.get("nameddest"));return}i=unescape(e);try{i=JSON.parse(i);Array.isArray(i)||(i=i.toString())}catch{}"string"==typeof i||es(i)?this.goToDestination(i):console.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}executeNamedAction(e){if(this.pdfDocument){switch(e){case"GoBack":this.pdfHistory?.back();break;case"GoForward":this.pdfHistory?.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}this.eventBus.dispatch("namedaction",{source:this,action:e})}}async executeSetOCGState(e){if(!this.pdfDocument)return;const t=this.pdfDocument,i=await this.pdfViewer.optionalContentConfigPromise;if(t===this.pdfDocument){i.setOCGState(e);this.pdfViewer.optionalContentConfigPromise=Promise.resolve(i)}}}class SimpleLinkService extends PDFLinkService{setDocument(e){}}function event_utils_classPrivateFieldInitSpec(e,t,i){(function event_utils_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function event_utils_classPrivateFieldGet(e,t){return e.get(event_utils_assertClassBrand(e,t))}function event_utils_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const ch="event",hh="timeout";async function waitOnEventOrTimeout(e){let{target:t,name:i,delay:a=0}=e;if("object"!=typeof t||!i||"string"!=typeof i||!(Number.isInteger(a)&&a>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");const{promise:s,resolve:n}=Promise.withResolvers(),r=new AbortController;function handler(e){r.abort();clearTimeout(o);n(e)}t[t instanceof EventBus?"_on":"addEventListener"](i,handler.bind(null,ch),{signal:r.signal});const o=setTimeout(handler.bind(null,hh),a);return s}var uh=new WeakMap;class EventBus{constructor(){event_utils_classPrivateFieldInitSpec(this,uh,Object.create(null))}on(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this._on(e,t,{external:!0,once:i?.once,signal:i?.signal})}off(e,t){this._off(e,t)}dispatch(e,t){const i=event_utils_classPrivateFieldGet(uh,this)[e];if(!i||0===i.length)return;let a;for(const{listener:s,external:n,once:r}of i.slice(0)){r&&this._off(e,s);n?(a||=[]).push(s):s(t)}if(a){for(const e of a)e(t);a=null}}_on(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=null;if(i?.signal instanceof AbortSignal){const{signal:s}=i;if(s.aborted){console.error("Cannot use an `aborted` signal.");return}const onAbort=()=>this._off(e,t);a=()=>s.removeEventListener("abort",onAbort);s.addEventListener("abort",onAbort)}(event_utils_classPrivateFieldGet(uh,this)[e]||=[]).push({listener:t,external:!0===i?.external,once:!0===i?.once,rmAbort:a})}_off(e,t){const i=event_utils_classPrivateFieldGet(uh,this)[e];if(i)for(let e=0,a=i.length;e<a;e++){const a=i[e];if(a.listener===t){a.rmAbort?.();i.splice(e,1);return}}}destroy(){let e;for(e in event_utils_classPrivateFieldGet(uh,this))event_utils_classPrivateFieldGet(uh,this)[e].length=0}}class BaseExternalServices{updateFindControlState(e){}updateFindMatchesCount(e){}initPassiveLoading(){}reportTelemetry(e){}reportText(e){}async createL10n(){throw new Error("Not implemented: createL10n")}createScripting(){throw new Error("Not implemented: createScripting")}createSignatureStorage(){throw new Error("Not implemented: createSignatureStorage")}updateEditorStates(e){throw new Error("Not implemented: updateEditorStates")}dispatchGlobalEvent(e){}}function preferences_classPrivateFieldInitSpec(e,t,i){(function preferences_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function preferences_classPrivateFieldGet(e,t){return e.get(preferences_assertClassBrand(e,t))}function preferences_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var _h=new WeakMap,ph=new WeakMap;class BasePreferences{constructor(){preferences_classPrivateFieldInitSpec(this,_h,Object.freeze(AppOptions.getAll(sr,!0)));preferences_classPrivateFieldInitSpec(this,ph,null);!function preferences_classPrivateFieldSet(e,t,i){return e.set(preferences_assertClassBrand(e,t),i),i}(ph,this,this._readFromStorage(preferences_classPrivateFieldGet(_h,this)).then(e=>{let{browserPrefs:t,prefs:i}=e;AppOptions._checkDisablePreferences()||AppOptions.setAll({...t,...i},!0)}))}async _writeToStorage(e){throw new Error("Not implemented: _writeToStorage")}async _readFromStorage(e){throw new Error("Not implemented: _readFromStorage")}async reset(){await preferences_classPrivateFieldGet(ph,this);AppOptions.setAll(preferences_classPrivateFieldGet(_h,this),!0);await this._writeToStorage(preferences_classPrivateFieldGet(_h,this))}async set(e,t){await preferences_classPrivateFieldGet(ph,this);AppOptions.setAll({[e]:t},!0);await this._writeToStorage(AppOptions.getAll(sr))}async get(e){await preferences_classPrivateFieldGet(ph,this);return AppOptions.get(e)}get defaults(){return preferences_classPrivateFieldGet(_h,this)}get initializedPromise(){return preferences_classPrivateFieldGet(ph,this)}}class FluentType{constructor(e){this.value=e}valueOf(){return this.value}}class FluentNone extends FluentType{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"???")}toString(e){return`{${this.value}}`}}class FluentNumber extends FluentType{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e);this.opts=t}toString(e){if(e)try{return e.memoizeIntlObject(Intl.NumberFormat,this.opts).format(this.value)}catch(t){e.reportError(t)}return this.value.toString(10)}}class FluentDateTime extends FluentType{static supportsValue(e){if("number"==typeof e)return!0;if(e instanceof Date)return!0;if(e instanceof FluentType)return FluentDateTime.supportsValue(e.valueOf());if("Temporal"in globalThis){const t=globalThis.Temporal;if(e instanceof t.Instant||e instanceof t.PlainDateTime||e instanceof t.PlainDate||e instanceof t.PlainMonthDay||e instanceof t.PlainTime||e instanceof t.PlainYearMonth)return!0}return!1}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e instanceof FluentDateTime){t={...e.opts,...t};e=e.value}else e instanceof FluentType&&(e=e.valueOf());"object"==typeof e&&"calendarId"in e&&void 0===t.calendar&&(t={...t,calendar:e.calendarId});super(e);this.opts=t}[Symbol.toPrimitive](e){return"string"===e?this.toString():this.toNumber()}toNumber(){const e=this.value;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("epochMilliseconds"in e)return e.epochMilliseconds;if("toZonedDateTime"in e)return e.toZonedDateTime("UTC").epochMilliseconds;throw new TypeError("Unwrapping a non-number value as a number")}toString(e){if(e)try{return e.memoizeIntlObject(Intl.DateTimeFormat,this.opts).format(this.value)}catch(t){e.reportError(t)}return"number"==typeof this.value||this.value instanceof Date?new Date(this.value).toISOString():this.value.toString()}}function match(e,t,i){if(i===t)return!0;if(i instanceof FluentNumber&&t instanceof FluentNumber&&i.value===t.value)return!0;if(t instanceof FluentNumber&&"string"==typeof i){if(i===e.memoizeIntlObject(Intl.PluralRules,t.opts).select(t.value))return!0}return!1}function getDefault(e,t,i){if(t[i])return resolvePattern(e,t[i].value);e.reportError(new RangeError("No default"));return new FluentNone}function getArguments(e,t){const i=[],a=Object.create(null);for(const s of t)"narg"===s.type?a[s.name]=resolveExpression(e,s.value):i.push(resolveExpression(e,s));return{positional:i,named:a}}function resolveExpression(e,t){switch(t.type){case"str":return t.value;case"num":return new FluentNumber(t.value,{minimumFractionDigits:t.precision});case"var":return function resolveVariableReference(e,t){let i,{name:a}=t;if(e.params){if(!Object.prototype.hasOwnProperty.call(e.params,a))return new FluentNone(`$${a}`);i=e.params[a]}else{if(!e.args||!Object.prototype.hasOwnProperty.call(e.args,a)){e.reportError(new ReferenceError(`Unknown variable: $${a}`));return new FluentNone(`$${a}`)}i=e.args[a]}if(i instanceof FluentType)return i;switch(typeof i){case"string":return i;case"number":return new FluentNumber(i);case"object":if(FluentDateTime.supportsValue(i))return new FluentDateTime(i);default:e.reportError(new TypeError(`Variable type not supported: $${a}, ${typeof i}`));return new FluentNone(`$${a}`)}}(e,t);case"mesg":return function resolveMessageReference(e,t){let{name:i,attr:a}=t;const s=e.bundle._messages.get(i);if(!s){e.reportError(new ReferenceError(`Unknown message: ${i}`));return new FluentNone(i)}if(a){const t=s.attributes[a];if(t)return resolvePattern(e,t);e.reportError(new ReferenceError(`Unknown attribute: ${a}`));return new FluentNone(`${i}.${a}`)}if(s.value)return resolvePattern(e,s.value);e.reportError(new ReferenceError(`No value: ${i}`));return new FluentNone(i)}(e,t);case"term":return function resolveTermReference(e,t){let{name:i,attr:a,args:s}=t;const n=`-${i}`,r=e.bundle._terms.get(n);if(!r){e.reportError(new ReferenceError(`Unknown term: ${n}`));return new FluentNone(n)}if(a){const t=r.attributes[a];if(t){e.params=getArguments(e,s).named;const i=resolvePattern(e,t);e.params=null;return i}e.reportError(new ReferenceError(`Unknown attribute: ${a}`));return new FluentNone(`${n}.${a}`)}e.params=getArguments(e,s).named;const o=resolvePattern(e,r.value);e.params=null;return o}(e,t);case"func":return function resolveFunctionReference(e,t){let{name:i,args:a}=t,s=e.bundle._functions[i];if(!s){e.reportError(new ReferenceError(`Unknown function: ${i}()`));return new FluentNone(`${i}()`)}if("function"!=typeof s){e.reportError(new TypeError(`Function ${i}() is not callable`));return new FluentNone(`${i}()`)}try{let t=getArguments(e,a);return s(t.positional,t.named)}catch(t){e.reportError(t);return new FluentNone(`${i}()`)}}(e,t);case"select":return function resolveSelectExpression(e,t){let{selector:i,variants:a,star:s}=t,n=resolveExpression(e,i);if(n instanceof FluentNone)return getDefault(e,a,s);for(const t of a){if(match(e,n,resolveExpression(e,t.key)))return resolvePattern(e,t.value)}return getDefault(e,a,s)}(e,t);default:return new FluentNone}}function resolveComplexPattern(e,t){if(e.dirty.has(t)){e.reportError(new RangeError("Cyclic reference"));return new FluentNone}e.dirty.add(t);const i=[],a=e.bundle._useIsolating&&t.length>1;for(const s of t)if("string"!=typeof s){e.placeables++;if(e.placeables>100){e.dirty.delete(t);throw new RangeError(`Too many placeables expanded: ${e.placeables}, max allowed is 100`)}a&&i.push("⁨");i.push(resolveExpression(e,s).toString(e));a&&i.push("⁩")}else i.push(e.bundle._transform(s));e.dirty.delete(t);return i.join("")}function resolvePattern(e,t){return"string"==typeof t?e.bundle._transform(t):resolveComplexPattern(e,t)}class Scope{constructor(e,t,i){this.dirty=new WeakSet;this.params=null;this.placeables=0;this.bundle=e;this.errors=t;this.args=i}reportError(e){if(!(this.errors&&e instanceof Error))throw e;this.errors.push(e)}memoizeIntlObject(e,t){let i=this.bundle._intls.get(e);if(!i){i={};this.bundle._intls.set(e,i)}let a=JSON.stringify(t);i[a]||(i[a]=new e(this.bundle.locales,t));return i[a]}}function values(e,t){const i=Object.create(null);for(const[a,s]of Object.entries(e))t.includes(a)&&(i[a]=s.valueOf());return i}const gh=["unitDisplay","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits"];function NUMBER(e,t){let i=e[0];if(i instanceof FluentNone)return new FluentNone(`NUMBER(${i.valueOf()})`);if(i instanceof FluentNumber)return new FluentNumber(i.valueOf(),{...i.opts,...values(t,gh)});if(i instanceof FluentDateTime)return new FluentNumber(i.toNumber(),{...values(t,gh)});throw new TypeError("Invalid argument to NUMBER")}const fh=["dateStyle","timeStyle","fractionalSecondDigits","dayPeriod","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function DATETIME(e,t){let i=e[0];if(i instanceof FluentNone)return new FluentNone(`DATETIME(${i.valueOf()})`);if(i instanceof FluentDateTime||i instanceof FluentNumber)return new FluentDateTime(i,values(t,fh));throw new TypeError("Invalid argument to DATETIME")}const mh=new Map;class FluentBundle{constructor(e){let{functions:t,useIsolating:i=!0,transform:a=e=>e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._terms=new Map;this._messages=new Map;this.locales=Array.isArray(e)?e:[e];this._functions={NUMBER,DATETIME,...t};this._useIsolating=i;this._transform=a;this._intls=function getMemoizerForLocale(e){const t=Array.isArray(e)?e.join(" "):e;let i=mh.get(t);if(void 0===i){i=new Map;mh.set(t,i)}return i}(e)}hasMessage(e){return this._messages.has(e)}getMessage(e){return this._messages.get(e)}addResource(e){let{allowOverrides:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=[];for(let a=0;a<e.body.length;a++){let s=e.body[a];if(s.id.startsWith("-")){if(!1===t&&this._terms.has(s.id)){i.push(new Error(`Attempt to override an existing term: "${s.id}"`));continue}this._terms.set(s.id,s)}else{if(!1===t&&this._messages.has(s.id)){i.push(new Error(`Attempt to override an existing message: "${s.id}"`));continue}this._messages.set(s.id,s)}}return i}formatPattern(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("string"==typeof e)return this._transform(e);let a=new Scope(this,i,t);try{return resolveComplexPattern(a,e).toString(a)}catch(e){if(a.errors&&e instanceof Error){a.errors.push(e);return(new FluentNone).toString(a)}throw e}}}const vh=/^(-?[a-zA-Z][\w-]*) *= */gm,Ph=/\.([a-zA-Z][\w-]*) *= */y,wh=/\*?\[/y,Fh=/(-?[0-9]+(?:\.([0-9]+))?)/y,bh=/([a-zA-Z][\w-]*)/y,yh=/([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y,Sh=/^[A-Z][A-Z0-9_-]*$/,Ch=/([^{}\n\r]+)/y,xh=/([^\\"\n\r]*)/y,kh=/\\([\\"])/y,Eh=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y,Ah=/^\n+/,Gh=/ +$/,Bh=/ *\r?\n/g,Mh=/( *)$/,Ih=/{\s*/y,Th=/\s*}/y,Dh=/\[\s*/y,Lh=/\s*] */y,Rh=/\s*\(\s*/y,Nh=/\s*->\s*/y,Oh=/\s*:\s*/y,Wh=/\s*,?\s*/y,jh=/\s+/y;class FluentResource{constructor(e){this.body=[];vh.lastIndex=0;let t=0;for(;;){let i=vh.exec(e);if(null===i)break;t=vh.lastIndex;try{this.body.push(parseMessage(i[1]))}catch(e){if(e instanceof SyntaxError)continue;throw e}}function test(i){i.lastIndex=t;return i.test(e)}function consumeChar(i,a){if(e[t]===i){t++;return!0}if(a)throw new a(`Expected ${i}`);return!1}function consumeToken(e,i){if(test(e)){t=e.lastIndex;return!0}if(i)throw new i(`Expected ${e.toString()}`);return!1}function match(i){i.lastIndex=t;let a=i.exec(e);if(null===a)throw new SyntaxError(`Expected ${i.toString()}`);t=i.lastIndex;return a}function match1(e){return match(e)[1]}function parseMessage(e){let t=parsePattern(),i=function parseAttributes(){let e=Object.create(null);for(;test(Ph);){let t=match1(Ph),i=parsePattern();if(null===i)throw new SyntaxError("Expected attribute value");e[t]=i}return e}();if(null===t&&0===Object.keys(i).length)throw new SyntaxError("Expected message value or attributes");return{id:e,value:t,attributes:i}}function parsePattern(){let i;test(Ch)&&(i=match1(Ch));if("{"===e[t]||"}"===e[t])return parsePatternElements(i?[i]:[],1/0);let a=parseIndent();if(a){if(i)return parsePatternElements([i,a],a.length);a.value=trim(a.value,Ah);return parsePatternElements([a],a.length)}return i?trim(i,Gh):null}function parsePatternElements(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],a=arguments.length>1?arguments[1]:void 0;for(;;){if(test(Ch)){i.push(match1(Ch));continue}if("{"===e[t]){i.push(parsePlaceable());continue}if("}"===e[t])throw new SyntaxError("Unbalanced closing brace");let s=parseIndent();if(!s)break;i.push(s);a=Math.min(a,s.length)}let s=i.length-1,n=i[s];"string"==typeof n&&(i[s]=trim(n,Gh));let r=[];for(let e of i){e instanceof Indent&&(e=e.value.slice(0,e.value.length-a));e&&r.push(e)}return r}function parsePlaceable(){consumeToken(Ih,SyntaxError);let e=parseInlineExpression();if(consumeToken(Th))return e;if(consumeToken(Nh)){let t=function parseVariants(){let e,t=[],i=0;for(;test(wh);){consumeChar("*")&&(e=i);let a=parseVariantKey(),s=parsePattern();if(null===s)throw new SyntaxError("Expected variant value");t[i++]={key:a,value:s}}if(0===i)return null;if(void 0===e)throw new SyntaxError("Expected default variant");return{variants:t,star:e}}();consumeToken(Th,SyntaxError);return{type:"select",selector:e,...t}}throw new SyntaxError("Unclosed placeable")}function parseInlineExpression(){if("{"===e[t])return parsePlaceable();if(test(yh)){let[,i,a,s=null]=match(yh);if("$"===i)return{type:"var",name:a};if(consumeToken(Rh)){let n=function parseArguments(){let i=[];for(;;){switch(e[t]){case")":t++;return i;case void 0:throw new SyntaxError("Unclosed argument list")}i.push(parseArgument());consumeToken(Wh)}}();if("-"===i)return{type:"term",name:a,attr:s,args:n};if(Sh.test(a))return{type:"func",name:a,args:n};throw new SyntaxError("Function names must be all upper-case")}return"-"===i?{type:"term",name:a,attr:s,args:[]}:{type:"mesg",name:a,attr:s}}return parseLiteral()}function parseArgument(){let e=parseInlineExpression();return"mesg"!==e.type?e:consumeToken(Oh)?{type:"narg",name:e.name,value:parseLiteral()}:e}function parseVariantKey(){consumeToken(Dh,SyntaxError);let e;e=test(Fh)?parseNumberLiteral():{type:"str",value:match1(bh)};consumeToken(Lh,SyntaxError);return e}function parseLiteral(){if(test(Fh))return parseNumberLiteral();if('"'===e[t])return function parseStringLiteral(){consumeChar('"',SyntaxError);let i="";for(;;){i+=match1(xh);if("\\"!==e[t]){if(consumeChar('"'))return{type:"str",value:i};throw new SyntaxError("Unclosed string literal")}i+=parseEscapeSequence()}}();throw new SyntaxError("Invalid expression")}function parseNumberLiteral(){let[,e,t=""]=match(Fh),i=t.length;return{type:"num",value:parseFloat(e),precision:i}}function parseEscapeSequence(){if(test(kh))return match1(kh);if(test(Eh)){let[,e,t]=match(Eh),i=parseInt(e||t,16);return i<=55295||57344<=i?String.fromCodePoint(i):"�"}throw new SyntaxError("Unknown escape sequence")}function parseIndent(){let i=t;consumeToken(jh);switch(e[t]){case".":case"[":case"*":case"}":case void 0:return!1;case"{":return makeIndent(e.slice(i,t))}return" "===e[t-1]&&makeIndent(e.slice(i,t))}function trim(e,t){return e.replace(t,"")}function makeIndent(e){let t=e.replace(Bh,"\n"),i=Mh.exec(e)[1].length;return new Indent(t,i)}}}class Indent{constructor(e,t){this.value=e;this.length=t}}const Vh=/<|&#?\w+;/,Uh={"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"]},zh={"http://www.w3.org/1999/xhtml":{global:["title","aria-description","aria-label","aria-valuetext"],a:["download"],area:["download","alt"],input:["alt","placeholder"],menuitem:["label"],menu:["label"],optgroup:["label"],option:["label"],track:["label"],img:["alt"],textarea:["placeholder"],th:["abbr"]},"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul":{global:["accesskey","aria-label","aria-valuetext","label","title","tooltiptext"],description:["value"],key:["key","keycode"],label:["value"],textbox:["placeholder","value"]}};function translateElement(e,t){const{value:i}=t;if("string"==typeof i)if("title"===e.localName&&"http://www.w3.org/1999/xhtml"===e.namespaceURI)e.textContent=i;else if(Vh.test(i)){const t=e.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","template");t.innerHTML=i;!function overlayChildNodes(e,t){for(const i of e.childNodes)if(i.nodeType!==i.TEXT_NODE){if(i.hasAttribute("data-l10n-name")){const a=getNodeForNamedElement(t,i);e.replaceChild(a,i);continue}if(isElementAllowed(i)){const t=createSanitizedElement(i);e.replaceChild(t,i);continue}console.warn(`An element of forbidden type "${i.localName}" was found in the translation. Only safe text-level elements and elements with data-l10n-name are allowed.`);e.replaceChild(createTextNodeFromTextContent(i),i)}t.textContent="";t.appendChild(e)}(t.content,e)}else e.textContent=i;overlayAttributes(t,e)}function hasAttribute(e,t){if(!e)return!1;for(let i of e)if(i.name===t)return!0;return!1}function overlayAttributes(e,t){const i=t.hasAttribute("data-l10n-attrs")?t.getAttribute("data-l10n-attrs").split(",").map(e=>e.trim()):null;for(const a of Array.from(t.attributes))isAttrNameLocalizable(a.name,t,i)&&!hasAttribute(e.attributes,a.name)&&t.removeAttribute(a.name);if(e.attributes)for(const a of Array.from(e.attributes))isAttrNameLocalizable(a.name,t,i)&&t.getAttribute(a.name)!==a.value&&t.setAttribute(a.name,a.value)}function getNodeForNamedElement(e,t){const i=t.getAttribute("data-l10n-name"),a=e.querySelector(`[data-l10n-name="${i}"]`);if(!a){console.warn(`An element named "${i}" wasn't found in the source.`);return createTextNodeFromTextContent(t)}if(a.localName!==t.localName){console.warn(`An element named "${i}" was found in the translation but its type ${t.localName} didn't match the element found in the source (${a.localName}).`);return createTextNodeFromTextContent(t)}e.removeChild(a);return shallowPopulateUsing(t,a.cloneNode(!1))}function createSanitizedElement(e){const t=e.ownerDocument.createElement(e.localName);return shallowPopulateUsing(e,t)}function createTextNodeFromTextContent(e){return e.ownerDocument.createTextNode(e.textContent)}function isElementAllowed(e){const t=Uh[e.namespaceURI];return t&&t.includes(e.localName)}function isAttrNameLocalizable(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(i&&i.includes(e))return!0;const a=zh[t.namespaceURI];if(!a)return!1;const s=e.toLowerCase(),n=t.localName;if(a.global.includes(s))return!0;if(!a[n])return!1;if(a[n].includes(s))return!0;if("http://www.w3.org/1999/xhtml"===t.namespaceURI&&"input"===n&&"value"===s){const e=t.type.toLowerCase();if("submit"===e||"button"===e||"reset"===e)return!0}return!1}function shallowPopulateUsing(e,t){t.textContent=e.textContent;overlayAttributes(e,t);return t}class CachedIterable extends Array{static from(e){return e instanceof this?e:new this(e)}}Symbol.iterator;class CachedAsyncIterable extends CachedIterable{constructor(e){super();if(Symbol.asyncIterator in Object(e))this.iterator=e[Symbol.asyncIterator]();else{if(!(Symbol.iterator in Object(e)))throw new TypeError("Argument must implement the iteration protocol.");this.iterator=e[Symbol.iterator]()}}[Symbol.asyncIterator](){const e=this;let t=0;return{async next(){e.length<=t&&e.push(e.iterator.next());return e[t++]}}}async touchNext(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=0;for(;t++<e;){const e=this[this.length-1];if(e&&(await e).done)break;this.push(this.iterator.next())}return this[this.length-1]}}class Localization{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;this.resourceIds=e;this.generateBundles=t;this.onChange(!0)}addResourceIds(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.resourceIds.push(...e);this.onChange(t);return this.resourceIds.length}removeResourceIds(e){this.resourceIds=this.resourceIds.filter(t=>!e.includes(t));this.onChange();return this.resourceIds.length}async formatWithFallback(e,t){const i=[];let a=!1;for await(const s of this.bundles){a=!0;const n=keysFromBundle(t,s,e,i);if(0===n.size)break;if("undefined"!=typeof console){const e=s.locales[0],t=Array.from(n).join(", ");console.warn(`[fluent] Missing translations in ${e}: ${t}`)}}a||"undefined"==typeof console||console.warn(`[fluent] Request for keys failed because no resource bundles got generated.\n  keys: ${JSON.stringify(e)}.\n  resourceIds: ${JSON.stringify(this.resourceIds)}.`);return i}formatMessages(e){return this.formatWithFallback(e,messageFromBundle)}formatValues(e){return this.formatWithFallback(e,valueFromBundle)}async formatValue(e,t){const[i]=await this.formatValues([{id:e,args:t}]);return i}handleEvent(){this.onChange()}onChange(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.bundles=CachedAsyncIterable.from(this.generateBundles(this.resourceIds));e&&this.bundles.touchNext(2)}}function valueFromBundle(e,t,i,a){return i.value?e.formatPattern(i.value,a,t):null}function messageFromBundle(e,t,i,a){const s={value:null,attributes:null};i.value&&(s.value=e.formatPattern(i.value,a,t));let n=Object.keys(i.attributes);if(n.length>0){s.attributes=new Array(n.length);for(let[r,o]of n.entries()){let n=e.formatPattern(i.attributes[o],a,t);s.attributes[r]={name:o,value:n}}}return s}function keysFromBundle(e,t,i,a){const s=[],n=new Set;i.forEach((i,r)=>{let{id:o,args:l}=i;if(void 0!==a[r])return;let d=t.getMessage(o);if(d){s.length=0;a[r]=e(t,s,d,l);if(s.length>0&&"undefined"!=typeof console){const e=t.locales[0],i=s.join(", ");console.warn(`[fluent][resolver] errors in ${e}/${o}: ${i}.`)}}else n.add(o)});return n}const Hh="data-l10n-id",$h="data-l10n-args",qh=`[${Hh}]`;class DOMLocalization extends Localization{constructor(e,t){super(e,t);this.roots=new Set;this.pendingrAF=null;this.pendingElements=new Set;this.windowElement=null;this.mutationObserver=null;this.observerConfig={attributes:!0,characterData:!1,childList:!0,subtree:!0,attributeFilter:[Hh,$h]}}onChange(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super.onChange(e);this.roots&&this.translateRoots()}setAttributes(e,t,i){e.setAttribute(Hh,t);i?e.setAttribute($h,JSON.stringify(i)):e.removeAttribute($h);return e}getAttributes(e){return{id:e.getAttribute(Hh),args:JSON.parse(e.getAttribute($h)||null)}}connectRoot(e){for(const t of this.roots)if(t===e||t.contains(e)||e.contains(t))throw new Error("Cannot add a root that overlaps with existing root.");if(this.windowElement){if(this.windowElement!==e.ownerDocument.defaultView)throw new Error("Cannot connect a root:\n          DOMLocalization already has a root from a different window.")}else{this.windowElement=e.ownerDocument.defaultView;this.mutationObserver=new this.windowElement.MutationObserver(e=>this.translateMutations(e))}this.roots.add(e);this.mutationObserver.observe(e,this.observerConfig)}disconnectRoot(e){this.roots.delete(e);this.pauseObserving();if(0===this.roots.size){this.mutationObserver=null;this.windowElement&&this.pendingrAF&&this.windowElement.cancelAnimationFrame(this.pendingrAF);this.windowElement=null;this.pendingrAF=null;this.pendingElements.clear();return!0}this.resumeObserving();return!1}translateRoots(){const e=Array.from(this.roots);return Promise.all(e.map(e=>this.translateFragment(e)))}pauseObserving(){if(this.mutationObserver){this.translateMutations(this.mutationObserver.takeRecords());this.mutationObserver.disconnect()}}resumeObserving(){if(this.mutationObserver)for(const e of this.roots)this.mutationObserver.observe(e,this.observerConfig)}translateMutations(e){for(const t of e)switch(t.type){case"attributes":t.target.hasAttribute("data-l10n-id")&&this.pendingElements.add(t.target);break;case"childList":for(const e of t.addedNodes)if(e.nodeType===e.ELEMENT_NODE)if(e.childElementCount)for(const t of this.getTranslatables(e))this.pendingElements.add(t);else e.hasAttribute(Hh)&&this.pendingElements.add(e)}this.pendingElements.size>0&&null===this.pendingrAF&&(this.pendingrAF=this.windowElement.requestAnimationFrame(()=>{this.translateElements(Array.from(this.pendingElements));this.pendingElements.clear();this.pendingrAF=null}))}translateFragment(e){return this.translateElements(this.getTranslatables(e))}async translateElements(e){if(!e.length)return;const t=e.map(this.getKeysForElement),i=await this.formatMessages(t);return this.applyTranslations(e,i)}applyTranslations(e,t){this.pauseObserving();for(let i=0;i<e.length;i++)void 0!==t[i]&&translateElement(e[i],t[i]);this.resumeObserving()}getTranslatables(e){const t=Array.from(e.querySelectorAll(qh));"function"==typeof e.hasAttribute&&e.hasAttribute(Hh)&&t.push(e);return t}getKeysForElement(e){return{id:e.getAttribute(Hh),args:JSON.parse(e.getAttribute($h)||null)}}}function l10n_classPrivateFieldInitSpec(e,t,i){(function l10n_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function l10n_classPrivateFieldGet(e,t){return e.get(l10n_assertClassBrand(e,t))}function l10n_classPrivateFieldSet(e,t,i){return e.set(l10n_assertClassBrand(e,t),i),i}function l10n_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Xh=new WeakMap,Kh=new WeakMap,Yh=new WeakMap,Zh=new WeakMap;class L10n{constructor(e){let{lang:t,isRTL:i}=e,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;l10n_classPrivateFieldInitSpec(this,Xh,void 0);l10n_classPrivateFieldInitSpec(this,Kh,void 0);l10n_classPrivateFieldInitSpec(this,Yh,void 0);l10n_classPrivateFieldInitSpec(this,Zh,void 0);l10n_classPrivateFieldSet(Yh,this,_fixupLangCode.call(L10n,t));l10n_classPrivateFieldSet(Zh,this,a);l10n_classPrivateFieldSet(Xh,this,i??_isRTL.call(L10n,l10n_classPrivateFieldGet(Yh,this))?"rtl":"ltr")}_setL10n(e){l10n_classPrivateFieldSet(Zh,this,e)}getLanguage(){return l10n_classPrivateFieldGet(Yh,this)}getDirection(){return l10n_classPrivateFieldGet(Xh,this)}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0;if(Array.isArray(e)){e=e.map(e=>({id:e}));return(await l10n_classPrivateFieldGet(Zh,this).formatMessages(e)).map(e=>e.value)}const a=await l10n_classPrivateFieldGet(Zh,this).formatMessages([{id:e,args:t}]);return a[0]?.value||i}async translate(e){(l10n_classPrivateFieldGet(Kh,this)||l10n_classPrivateFieldSet(Kh,this,new Set)).add(e);try{l10n_classPrivateFieldGet(Zh,this).connectRoot(e)}catch{}await l10n_classPrivateFieldGet(Zh,this).translateRoots()}async translateOnce(e){try{await l10n_classPrivateFieldGet(Zh,this).translateElements([e])}catch(e){console.error("translateOnce:",e)}}async destroy(){if(l10n_classPrivateFieldGet(Kh,this)){for(const e of l10n_classPrivateFieldGet(Kh,this))l10n_classPrivateFieldGet(Zh,this).disconnectRoot(e);l10n_classPrivateFieldGet(Kh,this).clear();l10n_classPrivateFieldSet(Kh,this,null)}l10n_classPrivateFieldGet(Zh,this).pauseObserving()}pause(){l10n_classPrivateFieldGet(Zh,this).pauseObserving()}resume(){l10n_classPrivateFieldGet(Zh,this).resumeObserving()}}function _fixupLangCode(e){return{en:"en-us",es:"es-es",fy:"fy-nl",ga:"ga-ie",gu:"gu-in",hi:"hi-in",hy:"hy-am",nb:"nb-no",ne:"ne-np",nn:"nn-no",pa:"pa-in",pt:"pt-pt",sv:"sv-se",zh:"zh-cn"}[e=e?.toLowerCase()||"en-us"]||e}function _isRTL(e){const t=e.split("-",1)[0];return["ar","he","fa","ps","ur"].includes(t)}var Jh;function genericl10n_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function PLATFORM(){const{isAndroid:e,isLinux:t,isMac:i,isWindows:a}=FeatureTest.platform;return t?"linux":a?"windows":i?"macos":e?"android":"other"}function createBundle(e,t){const i=new FluentResource(t),a=new FluentBundle(e,{functions:{PLATFORM}}),s=a.addResource(i);s.length&&console.error("L10n errors",s);return a}class genericl10n_GenericL10n extends L10n{constructor(e){super({lang:e});const t=e?_generateBundles.bind(genericl10n_GenericL10n,"en-us",this.getLanguage()):_generateBundlesFallback.bind(genericl10n_GenericL10n,this.getLanguage());this._setL10n(new DOMLocalization([],t))}}Jh=genericl10n_GenericL10n;async function*_generateBundles(e,t){const{baseURL:i,paths:a}=await genericl10n_assertClassBrand(Jh,this,_getPaths).call(this),s=[t];if(e!==t){const i=t.split("-",1)[0];i!==t&&s.push(i);s.push(e)}const n=s.map(e=>[e,genericl10n_assertClassBrand(Jh,this,_createBundle).call(this,e,i,a)]);for(const[e,t]of n){const i=await t;i?yield i:"en-us"===e&&(yield genericl10n_assertClassBrand(Jh,this,_createBundleFallback).call(this,e))}}async function _createBundle(e,t,i){const a=i[e];if(!a)return null;const s=new URL(a,t);return createBundle(e,await fetchData(s,"text"))}async function _getPaths(){try{const{href:e}=document.querySelector('link[type="application/l10n"]'),t=await fetchData(e,"json");return{baseURL:e.substring(0,e.lastIndexOf("/")+1)||"./",paths:t}}catch{}return{baseURL:"./",paths:Object.create(null)}}async function*_generateBundlesFallback(e){yield genericl10n_assertClassBrand(Jh,this,_createBundleFallback).call(this,e)}async function _createBundleFallback(e){return createBundle(e,'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…\npdfjs-document-properties-button-label = Document Properties…\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 } × { $height } { $unit } ({ $orientation })\npdfjs-document-properties-page-size-dimension-name-string = { $width } × { $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…\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…\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…\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’t see the image or when it doesn’t 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, “A young man sits down at a table to eat a meal”\npdfjs-editor-resizer-top-left =\n    .aria-label = Top left corner — resize\npdfjs-editor-resizer-top-middle =\n    .aria-label = Top middle — resize\npdfjs-editor-resizer-top-right =\n    .aria-label = Top right corner — resize\npdfjs-editor-resizer-middle-right =\n    .aria-label = Middle right — resize\npdfjs-editor-resizer-bottom-right =\n    .aria-label = Bottom right corner — resize\npdfjs-editor-resizer-bottom-middle =\n    .aria-label = Bottom middle — resize\npdfjs-editor-resizer-bottom-left =\n    .aria-label = Bottom left corner — resize\npdfjs-editor-resizer-middle-left =\n    .aria-label = Middle left — 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…\npdfjs-editor-new-alt-text-description = Short description for people who can’t see the image or when the image doesn’t 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’t 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’t see the image or when the image doesn’t 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’ve reached the limit of 5 saved signatures. Remove one to save more.\npdfjs-editor-add-signature-image-upload-error-title = Couldn’t 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’t 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…\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-title1 = Document outline\n    .title = Document outline (double-click to expand/collapse all items)\npdfjs-views-manager-attachments-title = Attachments\npdfjs-views-manager-layers-title1 = Layers\n    .title = Layers (double-click to reset all layers to the default state)\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-export-selected-button-label = Export selected…\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…\npdfjs-views-manager-pages-status-waiting-uploading-label = Uploading file…\npdfjs-views-manager-status-warning-cut-label = Couldn’t cut. Refresh page and try again.\npdfjs-views-manager-status-warning-copy-label = Couldn’t copy. Refresh page and try again.\npdfjs-views-manager-status-warning-delete-label = Couldn’t delete. Refresh page and try again.\npdfjs-views-manager-status-warning-save-label = Couldn’t save. Refresh page and try again.\npdfjs-views-manager-status-undo-button-label = Undo\npdfjs-views-manager-status-done-button-label = Done\npdfjs-views-manager-status-close-button =\n    .title = Close\npdfjs-views-manager-status-close-button-label = Close\npdfjs-views-manager-paste-button-label = Paste\npdfjs-views-manager-paste-button-before =\n    .title = Paste before the first page\npdfjs-views-manager-paste-button-after =\n    .title = Paste after page { $page }\npdfjs-new-badge-content = NEW')}class GenericScripting{constructor(e){"Function"===e?.constructor?.name&&(e=e());this._ready=new Promise((t,i)=>{import(
/*webpackIgnore: true*/
/*@vite-ignore*/
e).then(e=>{t(e.QuickJSSandbox())}).catch(i)})}async createSandbox(e){(await this._ready).create(e)}async dispatchEventInSandbox(e){const t=await this._ready;setTimeout(()=>t.dispatchEvent(e),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}function generic_signature_storage_classPrivateFieldInitSpec(e,t,i){generic_signature_storage_checkPrivateRedeclaration(e,t),t.set(e,i)}function generic_signature_storage_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function generic_signature_storage_classPrivateFieldGet(e,t){return e.get(generic_signature_storage_assertClassBrand(e,t))}function generic_signature_storage_classPrivateFieldSet(e,t,i){return e.set(generic_signature_storage_assertClassBrand(e,t),i),i}function generic_signature_storage_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Qh="pdfjs.signature";var eu=new WeakMap,tu=new WeakMap,iu=new WeakMap,au=new WeakSet;class SignatureStorage{constructor(e,t){!function generic_signature_storage_classPrivateMethodInitSpec(e,t){generic_signature_storage_checkPrivateRedeclaration(e,t),t.add(e)}(this,au);generic_signature_storage_classPrivateFieldInitSpec(this,eu,void 0);generic_signature_storage_classPrivateFieldInitSpec(this,tu,null);generic_signature_storage_classPrivateFieldInitSpec(this,iu,null);generic_signature_storage_classPrivateFieldSet(eu,this,e);generic_signature_storage_classPrivateFieldSet(iu,this,t)}async getAll(){if(generic_signature_storage_classPrivateFieldGet(iu,this)){window.addEventListener("storage",e=>{let{key:t}=e;if(t===Qh){generic_signature_storage_classPrivateFieldSet(tu,this,null);generic_signature_storage_classPrivateFieldGet(eu,this)?.dispatch("storedsignatureschanged",{source:this})}},{signal:generic_signature_storage_classPrivateFieldGet(iu,this)});generic_signature_storage_classPrivateFieldSet(iu,this,null)}if(!generic_signature_storage_classPrivateFieldGet(tu,this)){generic_signature_storage_classPrivateFieldSet(tu,this,new Map);const e=localStorage.getItem(Qh);if(e)for(const[t,i]of Object.entries(JSON.parse(e)))generic_signature_storage_classPrivateFieldGet(tu,this).set(t,i)}return generic_signature_storage_classPrivateFieldGet(tu,this)}async isFull(){return 5===await this.size()}async size(){return(await this.getAll()).size}async create(e){if(await this.isFull())return null;const t=getUuid();generic_signature_storage_classPrivateFieldGet(tu,this).set(t,e);generic_signature_storage_assertClassBrand(au,this,_save).call(this);return t}async delete(e){const t=await this.getAll();if(!t.has(e))return!1;t.delete(e);generic_signature_storage_assertClassBrand(au,this,_save).call(this);return!0}}function _save(){localStorage.setItem(Qh,JSON.stringify(Object.fromEntries(generic_signature_storage_classPrivateFieldGet(tu,this))))}class ExternalServices extends BaseExternalServices{async createL10n(){return new genericl10n_GenericL10n(AppOptions.get("localeProperties")?.lang)}createScripting(){return new GenericScripting(AppOptions.get("sandboxBundleSrc"))}createSignatureStorage(e,t){return new SignatureStorage(e,t)}}0;function new_alt_text_manager_classPrivateMethodInitSpec(e,t){new_alt_text_manager_checkPrivateRedeclaration(e,t),t.add(e)}function new_alt_text_manager_classPrivateFieldInitSpec(e,t,i){new_alt_text_manager_checkPrivateRedeclaration(e,t),t.set(e,i)}function new_alt_text_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function new_alt_text_manager_toSetter(e,t,i){t||(t=[]);var a=t.length++;return Object.defineProperty({},"_",{set:function(s){t[a]=s,e.apply(i,t)}})}function new_alt_text_manager_classPrivateFieldGet(e,t){return e.get(new_alt_text_manager_assertClassBrand(e,t))}function new_alt_text_manager_classPrivateFieldSet(e,t,i){return e.set(new_alt_text_manager_assertClassBrand(e,t),i),i}function new_alt_text_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var su=new WeakMap,nu=new WeakMap,ru=new WeakMap,ou=new WeakMap,lu=new WeakMap,du=new WeakMap,cu=new WeakMap,hu=new WeakMap,uu=new WeakMap,_u=new WeakMap,pu=new WeakMap,gu=new WeakMap,fu=new WeakMap,mu=new WeakMap,vu=new WeakMap,Pu=new WeakMap,wu=new WeakMap,Fu=new WeakMap,bu=new WeakMap,yu=new WeakMap,Su=new WeakMap,Cu=new WeakMap,xu=new WeakMap,ku=new WeakMap,Eu=new WeakMap,Au=new WeakSet;class NewAltTextManager{constructor(e,t,i){let{descriptionContainer:a,dialog:s,imagePreview:n,cancelButton:r,disclaimer:o,notNowButton:l,saveButton:d,textarea:c,learnMore:h,errorCloseButton:u,createAutomaticallyButton:_,downloadModel:p,downloadModelDescription:g,title:f}=e;new_alt_text_manager_classPrivateMethodInitSpec(this,Au);new_alt_text_manager_classPrivateFieldInitSpec(this,su,new_alt_text_manager_assertClassBrand(Au,this,_cancel).bind(this));new_alt_text_manager_classPrivateFieldInitSpec(this,nu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,ru,null);new_alt_text_manager_classPrivateFieldInitSpec(this,ou,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,lu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,du,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,cu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,hu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,uu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,_u,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,pu,!1);new_alt_text_manager_classPrivateFieldInitSpec(this,gu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,fu,null);new_alt_text_manager_classPrivateFieldInitSpec(this,mu,null);new_alt_text_manager_classPrivateFieldInitSpec(this,vu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Pu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,wu,!1);new_alt_text_manager_classPrivateFieldInitSpec(this,Fu,!1);new_alt_text_manager_classPrivateFieldInitSpec(this,bu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,yu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Su,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Cu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,xu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,ku,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Eu,null);new_alt_text_manager_classPrivateFieldSet(ou,this,r);new_alt_text_manager_classPrivateFieldSet(nu,this,_);new_alt_text_manager_classPrivateFieldSet(lu,this,a);new_alt_text_manager_classPrivateFieldSet(du,this,s);new_alt_text_manager_classPrivateFieldSet(cu,this,o);new_alt_text_manager_classPrivateFieldSet(yu,this,l);new_alt_text_manager_classPrivateFieldSet(vu,this,n);new_alt_text_manager_classPrivateFieldSet(Cu,this,c);new_alt_text_manager_classPrivateFieldSet(bu,this,h);new_alt_text_manager_classPrivateFieldSet(xu,this,f);new_alt_text_manager_classPrivateFieldSet(hu,this,p);new_alt_text_manager_classPrivateFieldSet(uu,this,g);new_alt_text_manager_classPrivateFieldSet(Su,this,t);new_alt_text_manager_classPrivateFieldSet(_u,this,i);s.addEventListener("close",new_alt_text_manager_assertClassBrand(Au,this,_close).bind(this));s.addEventListener("contextmenu",e=>{e.target!==new_alt_text_manager_classPrivateFieldGet(Cu,this)&&e.preventDefault()});r.addEventListener("click",new_alt_text_manager_classPrivateFieldGet(su,this));l.addEventListener("click",new_alt_text_manager_classPrivateFieldGet(su,this));d.addEventListener("click",new_alt_text_manager_assertClassBrand(Au,this,new_alt_text_manager_save).bind(this));u.addEventListener("click",()=>{new_alt_text_manager_assertClassBrand(Au,this,_toggleError).call(this,!1)});_.addEventListener("click",async()=>{const e="true"!==_.getAttribute("aria-pressed");new_alt_text_manager_classPrivateFieldGet(ru,this)._reportTelemetry({action:"pdfjs.image.alt_text.ai_generation_check",data:{status:e}});if(new_alt_text_manager_classPrivateFieldGet(ku,this)){const t=await new_alt_text_manager_classPrivateFieldGet(ku,this).mlManager.isEnabledFor("altText");new_alt_text_manager_classPrivateFieldGet(nu,this).disabled=!0;if(e&&!t){new_alt_text_manager_classPrivateFieldGet(Cu,this).value="";new_alt_text_manager_assertClassBrand(Au,this,_setProgress).call(this);new_alt_text_manager_classPrivateFieldGet(ku,this).setPreference("enableGuessAltText",!0);await new_alt_text_manager_classPrivateFieldGet(ku,this).mlManager.downloadModel("altText");new_alt_text_manager_assertClassBrand(Au,this,_setPref).call(this,"enableAltTextModelDownload",!0)}else if(!e&&t){new_alt_text_manager_classPrivateFieldGet(ku,this).setPreference("enableGuessAltText",!1);await new_alt_text_manager_classPrivateFieldGet(ku,this).mlManager.deleteModel("altText");new_alt_text_manager_assertClassBrand(Au,this,_setPref).call(this,"enableAltTextModelDownload",!1)}new_alt_text_manager_classPrivateFieldGet(nu,this).disabled=!1;await new_alt_text_manager_classPrivateFieldGet(ku,this).mlManager.toggleService("altText",e)}new_alt_text_manager_assertClassBrand(Au,this,_toggleGuessAltText).call(this,e,!1)});c.addEventListener("focus",()=>{new_alt_text_manager_classPrivateFieldSet(Fu,this,new_alt_text_manager_classPrivateFieldGet(wu,this));new_alt_text_manager_assertClassBrand(Au,this,_toggleLoading).call(this,!1);new_alt_text_manager_assertClassBrand(Au,this,_toggleTitleAndDisclaimer).call(this)});c.addEventListener("blur",()=>{c.value||new_alt_text_manager_assertClassBrand(Au,this,_toggleLoading).call(this,new_alt_text_manager_classPrivateFieldGet(Fu,this));new_alt_text_manager_assertClassBrand(Au,this,_toggleTitleAndDisclaimer).call(this)});c.addEventListener("input",()=>{new_alt_text_manager_assertClassBrand(Au,this,_toggleTitleAndDisclaimer).call(this)});c.addEventListener("keydown",e=>{!e.ctrlKey&&!e.metaKey||"Enter"!==e.key||d.disabled||new_alt_text_manager_assertClassBrand(Au,this,new_alt_text_manager_save).call(this)});i._on("enableguessalttext",e=>{let{value:t}=e;new_alt_text_manager_assertClassBrand(Au,this,_toggleGuessAltText).call(this,t,!1)});new_alt_text_manager_classPrivateFieldGet(Su,this).register(s);new_alt_text_manager_classPrivateFieldGet(bu,this).addEventListener("click",()=>{new_alt_text_manager_classPrivateFieldGet(ru,this)._reportTelemetry({action:"pdfjs.image.alt_text.info",data:{topic:"alt_text"}})})}async editAltText(e,t,i){if(new_alt_text_manager_classPrivateFieldGet(ru,this)||!t)return;if(i&&t.hasAltTextData()){t.altTextFinish();return}new_alt_text_manager_classPrivateFieldSet(pu,this,i);const{mlManager:a}=e,s=!!a;new_alt_text_manager_assertClassBrand(Au,this,_toggleTitleAndDisclaimer).call(this);a&&!a.isReady("altText")?a.hasProgress?new_alt_text_manager_assertClassBrand(Au,this,_setProgress).call(this):new_alt_text_manager_classPrivateFieldGet(nu,this).setAttribute("aria-pressed",!1):new_alt_text_manager_classPrivateFieldGet(hu,this).classList.toggle("hidden",!0);const n=a?.isEnabledFor("altText");new_alt_text_manager_classPrivateFieldSet(ru,this,t);new_alt_text_manager_classPrivateFieldSet(ku,this,e);new_alt_text_manager_classPrivateFieldGet(ku,this).removeEditListeners();({altText:new_alt_text_manager_toSetter(new_alt_text_manager_classPrivateFieldSet,[Eu,this])._}=t.altTextData);new_alt_text_manager_classPrivateFieldGet(Cu,this).value=new_alt_text_manager_classPrivateFieldGet(Eu,this)??"";let r,o,l;if(a){({canvas:r,width:o,height:l,imageData:new_alt_text_manager_toSetter(new_alt_text_manager_classPrivateFieldSet,[Pu,this])._}=t.copyCanvas(224,180,!0));s&&new_alt_text_manager_assertClassBrand(Au,this,_toggleGuessAltText).call(this,await n,!0)}else({canvas:r,width:o,height:l}=t.copyCanvas(224,180,!1));r.setAttribute("role","presentation");const{style:d}=r;d.width=`${o}px`;d.height=`${l}px`;new_alt_text_manager_classPrivateFieldGet(vu,this).append(r);new_alt_text_manager_assertClassBrand(Au,this,_toggleNotNow).call(this);new_alt_text_manager_assertClassBrand(Au,this,_toggleAI).call(this,s);new_alt_text_manager_assertClassBrand(Au,this,_toggleError).call(this,!1);try{await new_alt_text_manager_classPrivateFieldGet(Su,this).open(new_alt_text_manager_classPrivateFieldGet(du,this))}catch(e){new_alt_text_manager_assertClassBrand(Au,this,_close).call(this);throw e}}destroy(){new_alt_text_manager_classPrivateFieldSet(ku,this,null);new_alt_text_manager_assertClassBrand(Au,this,_finish).call(this)}}function _setPref(e,t){new_alt_text_manager_classPrivateFieldGet(_u,this).dispatch("setpreference",{source:this,name:e,value:t})}function _toggleLoading(e){if(new_alt_text_manager_classPrivateFieldGet(ku,this)&&new_alt_text_manager_classPrivateFieldGet(wu,this)!==e){new_alt_text_manager_classPrivateFieldSet(wu,this,e);new_alt_text_manager_classPrivateFieldGet(lu,this).classList.toggle("loading",e)}}function _toggleError(e){new_alt_text_manager_classPrivateFieldGet(ku,this)&&new_alt_text_manager_classPrivateFieldGet(du,this).classList.toggle("error",e)}async function _toggleGuessAltText(e,t){if(new_alt_text_manager_classPrivateFieldGet(ku,this)){new_alt_text_manager_classPrivateFieldGet(du,this).classList.toggle("aiDisabled",!e);new_alt_text_manager_classPrivateFieldGet(nu,this).setAttribute("aria-pressed",e);if(e){const{altTextLearnMoreUrl:e}=new_alt_text_manager_classPrivateFieldGet(ku,this).mlManager;e&&(new_alt_text_manager_classPrivateFieldGet(bu,this).href=e);new_alt_text_manager_assertClassBrand(Au,this,_mlGuessAltText).call(this,t)}else{new_alt_text_manager_assertClassBrand(Au,this,_toggleLoading).call(this,!1);new_alt_text_manager_classPrivateFieldSet(wu,this,!1);new_alt_text_manager_assertClassBrand(Au,this,_toggleTitleAndDisclaimer).call(this)}}}function _toggleNotNow(){new_alt_text_manager_classPrivateFieldGet(yu,this).classList.toggle("hidden",!new_alt_text_manager_classPrivateFieldGet(pu,this));new_alt_text_manager_classPrivateFieldGet(ou,this).classList.toggle("hidden",new_alt_text_manager_classPrivateFieldGet(pu,this))}function _toggleAI(e){if(new_alt_text_manager_classPrivateFieldGet(ku,this)&&new_alt_text_manager_classPrivateFieldGet(fu,this)!==e){new_alt_text_manager_classPrivateFieldSet(fu,this,e);new_alt_text_manager_classPrivateFieldGet(du,this).classList.toggle("noAi",!e);new_alt_text_manager_assertClassBrand(Au,this,_toggleTitleAndDisclaimer).call(this)}}function _toggleTitleAndDisclaimer(){const e=new_alt_text_manager_classPrivateFieldGet(wu,this)||new_alt_text_manager_classPrivateFieldGet(gu,this)&&new_alt_text_manager_classPrivateFieldGet(gu,this)===new_alt_text_manager_classPrivateFieldGet(Cu,this).value;new_alt_text_manager_classPrivateFieldGet(cu,this).hidden=!e;const t=new_alt_text_manager_classPrivateFieldGet(wu,this)||!!new_alt_text_manager_classPrivateFieldGet(Cu,this).value;if(new_alt_text_manager_classPrivateFieldGet(mu,this)!==t){new_alt_text_manager_classPrivateFieldSet(mu,this,t);new_alt_text_manager_classPrivateFieldGet(xu,this).setAttribute("data-l10n-id",t?"pdfjs-editor-new-alt-text-dialog-edit-label":"pdfjs-editor-new-alt-text-dialog-add-label")}}async function _mlGuessAltText(e){if(new_alt_text_manager_classPrivateFieldGet(wu,this))return;if(new_alt_text_manager_classPrivateFieldGet(Cu,this).value)return;if(e&&null!==new_alt_text_manager_classPrivateFieldGet(Eu,this))return;new_alt_text_manager_classPrivateFieldSet(gu,this,new_alt_text_manager_classPrivateFieldGet(ru,this).guessedAltText);if(null===new_alt_text_manager_classPrivateFieldGet(Eu,this)&&new_alt_text_manager_classPrivateFieldGet(gu,this)){new_alt_text_manager_assertClassBrand(Au,this,_addAltText).call(this,new_alt_text_manager_classPrivateFieldGet(gu,this));return}new_alt_text_manager_assertClassBrand(Au,this,_toggleLoading).call(this,!0);new_alt_text_manager_assertClassBrand(Au,this,_toggleTitleAndDisclaimer).call(this);let t=!1;try{const e=await new_alt_text_manager_classPrivateFieldGet(ru,this).mlGuessAltText(new_alt_text_manager_classPrivateFieldGet(Pu,this),!1);if(e){new_alt_text_manager_classPrivateFieldSet(gu,this,e);new_alt_text_manager_classPrivateFieldSet(Fu,this,new_alt_text_manager_classPrivateFieldGet(wu,this));new_alt_text_manager_classPrivateFieldGet(wu,this)&&new_alt_text_manager_assertClassBrand(Au,this,_addAltText).call(this,e)}}catch(e){console.error(e);t=!0}new_alt_text_manager_assertClassBrand(Au,this,_toggleLoading).call(this,!1);new_alt_text_manager_assertClassBrand(Au,this,_toggleTitleAndDisclaimer).call(this);t&&new_alt_text_manager_classPrivateFieldGet(ku,this)&&new_alt_text_manager_assertClassBrand(Au,this,_toggleError).call(this,!0)}function _addAltText(e){if(new_alt_text_manager_classPrivateFieldGet(ku,this)&&!new_alt_text_manager_classPrivateFieldGet(Cu,this).value){new_alt_text_manager_classPrivateFieldGet(Cu,this).value=e;new_alt_text_manager_assertClassBrand(Au,this,_toggleTitleAndDisclaimer).call(this)}}function _setProgress(){new_alt_text_manager_classPrivateFieldGet(hu,this).classList.toggle("hidden",!1);const callback=async e=>{let{detail:{finished:t,total:i,totalLoaded:a}}=e;const s=1e6;a=Math.min(.99*i,a);const n=new_alt_text_manager_classPrivateFieldGet(uu,this).ariaValueMax=Math.round(i/s),r=new_alt_text_manager_classPrivateFieldGet(uu,this).ariaValueNow=Math.round(a/s);new_alt_text_manager_classPrivateFieldGet(uu,this).setAttribute("data-l10n-args",JSON.stringify({totalSize:n,downloadedSize:r}));if(!t)return;new_alt_text_manager_classPrivateFieldGet(_u,this)._off("loadaiengineprogress",callback);new_alt_text_manager_classPrivateFieldGet(hu,this).classList.toggle("hidden",!0);new_alt_text_manager_assertClassBrand(Au,this,_toggleAI).call(this,!0);if(!new_alt_text_manager_classPrivateFieldGet(ku,this))return;const{mlManager:o}=new_alt_text_manager_classPrivateFieldGet(ku,this);o.toggleService("altText",!0);new_alt_text_manager_assertClassBrand(Au,this,_toggleGuessAltText).call(this,await o.isEnabledFor("altText"),!0)};new_alt_text_manager_classPrivateFieldGet(_u,this)._on("loadaiengineprogress",callback)}function _cancel(){new_alt_text_manager_classPrivateFieldGet(ru,this).altTextData={cancel:!0};const e=new_alt_text_manager_classPrivateFieldGet(Cu,this).value.trim();new_alt_text_manager_classPrivateFieldGet(ru,this)._reportTelemetry({action:"pdfjs.image.alt_text.dismiss",data:{alt_text_type:e?"present":"empty",flow:new_alt_text_manager_classPrivateFieldGet(pu,this)?"image_add":"alt_text_edit"}});new_alt_text_manager_classPrivateFieldGet(ru,this)._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!0,alt_text_type:"skipped"}});new_alt_text_manager_assertClassBrand(Au,this,_finish).call(this)}function _finish(){new_alt_text_manager_classPrivateFieldGet(Su,this).closeIfActive(new_alt_text_manager_classPrivateFieldGet(du,this))}function _close(){const e=new_alt_text_manager_classPrivateFieldGet(vu,this).firstElementChild;e.remove();e.width=e.height=0;new_alt_text_manager_classPrivateFieldSet(Pu,this,null);new_alt_text_manager_assertClassBrand(Au,this,_toggleLoading).call(this,!1);new_alt_text_manager_classPrivateFieldGet(ku,this)?.addEditListeners();new_alt_text_manager_classPrivateFieldGet(ru,this).altTextFinish();new_alt_text_manager_classPrivateFieldGet(ku,this)?.setSelected(new_alt_text_manager_classPrivateFieldGet(ru,this));new_alt_text_manager_classPrivateFieldSet(ru,this,null);new_alt_text_manager_classPrivateFieldSet(ku,this,null)}function _extractWords(e){return new Set(e.toLowerCase().split(/[^\p{L}\p{N}]+/gu).filter(e=>!!e))}function new_alt_text_manager_save(){const e=new_alt_text_manager_classPrivateFieldGet(Cu,this).value.trim();new_alt_text_manager_classPrivateFieldGet(ru,this).altTextData={altText:e,decorative:!1};new_alt_text_manager_classPrivateFieldGet(ru,this).altTextData.guessedAltText=new_alt_text_manager_classPrivateFieldGet(gu,this);if(new_alt_text_manager_classPrivateFieldGet(gu,this)&&new_alt_text_manager_classPrivateFieldGet(gu,this)!==e){const t=new_alt_text_manager_assertClassBrand(Au,this,_extractWords).call(this,new_alt_text_manager_classPrivateFieldGet(gu,this)),i=new_alt_text_manager_assertClassBrand(Au,this,_extractWords).call(this,e);new_alt_text_manager_classPrivateFieldGet(ru,this)._reportTelemetry({action:"pdfjs.image.alt_text.user_edit",data:{total_words:t.size,words_removed:t.difference(i).size,words_added:i.difference(t).size}})}new_alt_text_manager_classPrivateFieldGet(ru,this)._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!0,alt_text_type:e?"present":"empty"}});new_alt_text_manager_classPrivateFieldGet(ru,this)._reportTelemetry({action:"pdfjs.image.alt_text.save",data:{alt_text_type:e?"present":"empty",flow:new_alt_text_manager_classPrivateFieldGet(pu,this)?"image_add":"alt_text_edit"}});new_alt_text_manager_assertClassBrand(Au,this,_finish).call(this)}var Gu=new WeakMap,Bu=new WeakMap,Mu=new WeakMap,Iu=new WeakMap,Tu=new WeakMap,Du=new WeakMap,Lu=new WeakSet;class ImageAltTextSettings{constructor(e,t,i,a){let{dialog:s,createModelButton:n,learnMore:r,closeButton:o,showAltTextDialogButton:l}=e;new_alt_text_manager_classPrivateMethodInitSpec(this,Lu);new_alt_text_manager_classPrivateFieldInitSpec(this,Gu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Bu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Mu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Iu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Tu,void 0);new_alt_text_manager_classPrivateFieldInitSpec(this,Du,void 0);new_alt_text_manager_classPrivateFieldSet(Bu,this,s);new_alt_text_manager_classPrivateFieldSet(Gu,this,n);new_alt_text_manager_classPrivateFieldSet(Du,this,l);new_alt_text_manager_classPrivateFieldSet(Tu,this,t);new_alt_text_manager_classPrivateFieldSet(Mu,this,i);new_alt_text_manager_classPrivateFieldSet(Iu,this,a);const{altTextLearnMoreUrl:d}=a;d&&(r.href=d);s.addEventListener("contextmenu",noContextMenu);n.addEventListener("click",async e=>{const t=new_alt_text_manager_assertClassBrand(Lu,this,_togglePref).call(this,"enableGuessAltText",e);await(t?new_alt_text_manager_assertClassBrand(Lu,this,new_alt_text_manager_download).call(this,!0):new_alt_text_manager_assertClassBrand(Lu,this,_delete).call(this,!0));await a.toggleService("altText",t);new_alt_text_manager_assertClassBrand(Lu,this,_reportTelemetry).call(this,{type:"stamp",action:"pdfjs.image.alt_text.settings_ai_generation_check",data:{status:t}})});l.addEventListener("click",e=>{const t=new_alt_text_manager_assertClassBrand(Lu,this,_togglePref).call(this,"enableNewAltTextWhenAddingImage",e);new_alt_text_manager_assertClassBrand(Lu,this,_reportTelemetry).call(this,{type:"stamp",action:"pdfjs.image.alt_text.settings_edit_alt_text_check",data:{status:t}})});o.addEventListener("click",new_alt_text_manager_assertClassBrand(Lu,this,_finish2).bind(this));r.addEventListener("click",()=>{new_alt_text_manager_assertClassBrand(Lu,this,_reportTelemetry).call(this,{type:"stamp",action:"pdfjs.image.alt_text.info",data:{topic:"ai_generation"}})});i._on("enablealttextmodeldownload",e=>{let{value:t}=e;t?new_alt_text_manager_assertClassBrand(Lu,this,new_alt_text_manager_download).call(this,!1):new_alt_text_manager_assertClassBrand(Lu,this,_delete).call(this,!1)});new_alt_text_manager_classPrivateFieldGet(Tu,this).register(s)}async open(e){let{enableGuessAltText:t,enableNewAltTextWhenAddingImage:i}=e;const{enableAltTextModelDownload:a}=new_alt_text_manager_classPrivateFieldGet(Iu,this);new_alt_text_manager_classPrivateFieldGet(Gu,this).setAttribute("aria-pressed",a&&t);new_alt_text_manager_classPrivateFieldGet(Du,this).setAttribute("aria-pressed",i);await new_alt_text_manager_classPrivateFieldGet(Tu,this).open(new_alt_text_manager_classPrivateFieldGet(Bu,this));new_alt_text_manager_assertClassBrand(Lu,this,_reportTelemetry).call(this,{type:"stamp",action:"pdfjs.image.alt_text.settings_displayed"})}}function _reportTelemetry(e){new_alt_text_manager_classPrivateFieldGet(Mu,this).dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}async function new_alt_text_manager_download(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0]){await new_alt_text_manager_classPrivateFieldGet(Iu,this).downloadModel("altText");new_alt_text_manager_assertClassBrand(Lu,this,_setPref2).call(this,"enableGuessAltText",!0);new_alt_text_manager_classPrivateFieldGet(Iu,this).toggleService("altText",!0);new_alt_text_manager_assertClassBrand(Lu,this,_setPref2).call(this,"enableAltTextModelDownload",!0)}}async function _delete(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0]){await new_alt_text_manager_classPrivateFieldGet(Iu,this).deleteModel("altText");new_alt_text_manager_assertClassBrand(Lu,this,_setPref2).call(this,"enableGuessAltText",!1);new_alt_text_manager_assertClassBrand(Lu,this,_setPref2).call(this,"enableAltTextModelDownload",!1)}new_alt_text_manager_classPrivateFieldGet(Gu,this).setAttribute("aria-pressed",!1)}function _togglePref(e,t){let{target:i}=t;const a="true"!==i.getAttribute("aria-pressed");new_alt_text_manager_assertClassBrand(Lu,this,_setPref2).call(this,e,a);i.setAttribute("aria-pressed",a);return a}function _setPref2(e,t){new_alt_text_manager_classPrivateFieldGet(Mu,this).dispatch("setpreference",{source:this,name:e,value:t})}function _finish2(){new_alt_text_manager_classPrivateFieldGet(Tu,this).closeIfActive(new_alt_text_manager_classPrivateFieldGet(Bu,this))}function alt_text_manager_classPrivateFieldInitSpec(e,t,i){alt_text_manager_checkPrivateRedeclaration(e,t),t.set(e,i)}function alt_text_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function alt_text_manager_classPrivateFieldGet(e,t){return e.get(alt_text_manager_assertClassBrand(e,t))}function alt_text_manager_classPrivateFieldSet(e,t,i){return e.set(alt_text_manager_assertClassBrand(e,t),i),i}function alt_text_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Ru=new WeakMap,Nu=new WeakMap,Ou=new WeakMap,Wu=new WeakMap,ju=new WeakMap,Vu=new WeakMap,Uu=new WeakMap,zu=new WeakMap,Hu=new WeakMap,$u=new WeakMap,qu=new WeakMap,Xu=new WeakMap,Ku=new WeakMap,Yu=new WeakMap,Zu=new WeakMap,Ju=new WeakMap,Qu=new WeakMap,e_=new WeakMap,t_=new WeakSet;class AltTextManager{constructor(e,t,i,a){let{dialog:s,optionDescription:n,optionDecorative:r,textarea:o,cancelButton:l,saveButton:d}=e;!function alt_text_manager_classPrivateMethodInitSpec(e,t){alt_text_manager_checkPrivateRedeclaration(e,t),t.add(e)}(this,t_);alt_text_manager_classPrivateFieldInitSpec(this,Ru,null);alt_text_manager_classPrivateFieldInitSpec(this,Nu,null);alt_text_manager_classPrivateFieldInitSpec(this,Ou,void 0);alt_text_manager_classPrivateFieldInitSpec(this,Wu,void 0);alt_text_manager_classPrivateFieldInitSpec(this,ju,void 0);alt_text_manager_classPrivateFieldInitSpec(this,Vu,!1);alt_text_manager_classPrivateFieldInitSpec(this,Uu,void 0);alt_text_manager_classPrivateFieldInitSpec(this,zu,void 0);alt_text_manager_classPrivateFieldInitSpec(this,Hu,void 0);alt_text_manager_classPrivateFieldInitSpec(this,$u,void 0);alt_text_manager_classPrivateFieldInitSpec(this,qu,void 0);alt_text_manager_classPrivateFieldInitSpec(this,Xu,void 0);alt_text_manager_classPrivateFieldInitSpec(this,Ku,null);alt_text_manager_classPrivateFieldInitSpec(this,Yu,null);alt_text_manager_classPrivateFieldInitSpec(this,Zu,null);alt_text_manager_classPrivateFieldInitSpec(this,Ju,null);alt_text_manager_classPrivateFieldInitSpec(this,Qu,void 0);alt_text_manager_classPrivateFieldInitSpec(this,e_,null);alt_text_manager_classPrivateFieldSet(Wu,this,s);alt_text_manager_classPrivateFieldSet(Uu,this,n);alt_text_manager_classPrivateFieldSet(zu,this,r);alt_text_manager_classPrivateFieldSet(qu,this,o);alt_text_manager_classPrivateFieldSet(Ou,this,l);alt_text_manager_classPrivateFieldSet($u,this,d);alt_text_manager_classPrivateFieldSet(Hu,this,i);alt_text_manager_classPrivateFieldSet(ju,this,a);alt_text_manager_classPrivateFieldSet(Qu,this,t);const c=alt_text_manager_assertClassBrand(t_,this,_updateUIState).bind(this);s.addEventListener("close",alt_text_manager_assertClassBrand(t_,this,alt_text_manager_close).bind(this));s.addEventListener("contextmenu",e=>{e.target!==alt_text_manager_classPrivateFieldGet(qu,this)&&e.preventDefault()});l.addEventListener("click",alt_text_manager_assertClassBrand(t_,this,alt_text_manager_finish).bind(this));d.addEventListener("click",alt_text_manager_assertClassBrand(t_,this,alt_text_manager_save).bind(this));n.addEventListener("change",c);r.addEventListener("change",c);o.addEventListener("keydown",e=>{!e.ctrlKey&&!e.metaKey||"Enter"!==e.key||d.disabled||alt_text_manager_assertClassBrand(t_,this,alt_text_manager_save).call(this)});alt_text_manager_classPrivateFieldGet(Hu,this).register(s)}async editAltText(e,t){if(alt_text_manager_classPrivateFieldGet(Nu,this)||!t)return;alt_text_manager_assertClassBrand(t_,this,_createSVGElement).call(this);alt_text_manager_classPrivateFieldSet(Vu,this,!1);alt_text_manager_classPrivateFieldSet(Ru,this,new AbortController);const i={signal:alt_text_manager_classPrivateFieldGet(Ru,this).signal},a=alt_text_manager_assertClassBrand(t_,this,_onClick).bind(this);for(const e of[alt_text_manager_classPrivateFieldGet(Uu,this),alt_text_manager_classPrivateFieldGet(zu,this),alt_text_manager_classPrivateFieldGet(qu,this),alt_text_manager_classPrivateFieldGet($u,this),alt_text_manager_classPrivateFieldGet(Ou,this)])e.addEventListener("click",a,i);const{altText:s,decorative:n}=t.altTextData;if(!0===n){alt_text_manager_classPrivateFieldGet(zu,this).checked=!0;alt_text_manager_classPrivateFieldGet(Uu,this).checked=!1}else{alt_text_manager_classPrivateFieldGet(zu,this).checked=!1;alt_text_manager_classPrivateFieldGet(Uu,this).checked=!0}alt_text_manager_classPrivateFieldSet(Ku,this,alt_text_manager_classPrivateFieldGet(qu,this).value=s?.trim()||"");alt_text_manager_assertClassBrand(t_,this,_updateUIState).call(this);alt_text_manager_classPrivateFieldSet(Nu,this,t);alt_text_manager_classPrivateFieldSet(Xu,this,e);alt_text_manager_classPrivateFieldGet(Xu,this).removeEditListeners();alt_text_manager_classPrivateFieldSet(Yu,this,new AbortController);alt_text_manager_classPrivateFieldGet(ju,this)._on("resize",alt_text_manager_assertClassBrand(t_,this,alt_text_manager_setPosition).bind(this),{signal:alt_text_manager_classPrivateFieldGet(Yu,this).signal});try{await alt_text_manager_classPrivateFieldGet(Hu,this).open(alt_text_manager_classPrivateFieldGet(Wu,this));alt_text_manager_assertClassBrand(t_,this,alt_text_manager_setPosition).call(this)}catch(e){alt_text_manager_assertClassBrand(t_,this,alt_text_manager_close).call(this);throw e}}destroy(){alt_text_manager_classPrivateFieldSet(Xu,this,null);alt_text_manager_assertClassBrand(t_,this,alt_text_manager_finish).call(this);alt_text_manager_classPrivateFieldGet(Zu,this)?.remove();alt_text_manager_classPrivateFieldSet(Zu,this,alt_text_manager_classPrivateFieldSet(Ju,this,null))}}function _createSVGElement(){if(alt_text_manager_classPrivateFieldGet(Zu,this))return;const e=new DOMSVGFactory,t=alt_text_manager_classPrivateFieldSet(Zu,this,e.createElement("svg"));t.setAttribute("width","0");t.setAttribute("height","0");const i=e.createElement("defs");t.append(i);const a=e.createElement("mask");i.append(a);a.setAttribute("id","alttext-manager-mask");a.setAttribute("maskContentUnits","objectBoundingBox");let s=e.createElement("rect");a.append(s);s.setAttribute("fill","white");s.setAttribute("width","1");s.setAttribute("height","1");s.setAttribute("x","0");s.setAttribute("y","0");s=alt_text_manager_classPrivateFieldSet(Ju,this,e.createElement("rect"));a.append(s);s.setAttribute("fill","black");alt_text_manager_classPrivateFieldGet(Wu,this).append(t)}function alt_text_manager_setPosition(){if(!alt_text_manager_classPrivateFieldGet(Nu,this))return;const e=alt_text_manager_classPrivateFieldGet(Wu,this),{style:t}=e,{x:i,y:a,width:s,height:n}=alt_text_manager_classPrivateFieldGet(Qu,this).getBoundingClientRect(),{innerWidth:r,innerHeight:o}=window,{width:l,height:d}=e.getBoundingClientRect(),{x:c,y:h,width:u,height:_}=alt_text_manager_classPrivateFieldGet(Nu,this).getClientDimensions(),p=10,g="ltr"===alt_text_manager_classPrivateFieldGet(Xu,this).direction,f=Math.max(c,i),m=Math.min(c+u,i+s),v=Math.max(h,a),P=Math.min(h+_,a+n);alt_text_manager_classPrivateFieldGet(Ju,this).setAttribute("width",""+(m-f)/r);alt_text_manager_classPrivateFieldGet(Ju,this).setAttribute("height",""+(P-v)/o);alt_text_manager_classPrivateFieldGet(Ju,this).setAttribute("x",""+f/r);alt_text_manager_classPrivateFieldGet(Ju,this).setAttribute("y",""+v/o);let w=null,b=Math.max(h,0);b+=Math.min(o-(b+d),0);g?c+u+p+l<r?w=c+u+p:c>l+p&&(w=c-l-p):c>l+p?w=c-l-p:c+u+p+l<r&&(w=c+u+p);if(null===w){b=null;w=Math.max(c,0);w+=Math.min(r-(w+l),0);h>d+p?b=h-d-p:h+_+p+d<o&&(b=h+_+p)}if(null!==b){e.classList.add("positioned");g?t.left=`${w}px`:t.right=r-w-l+"px";t.top=`${b}px`}else{e.classList.remove("positioned");t.left="";t.top=""}}function alt_text_manager_finish(){alt_text_manager_classPrivateFieldGet(Hu,this).closeIfActive(alt_text_manager_classPrivateFieldGet(Wu,this))}function alt_text_manager_close(){alt_text_manager_classPrivateFieldGet(Nu,this)._reportTelemetry(alt_text_manager_classPrivateFieldGet(e_,this)||{action:"alt_text_cancel",alt_text_keyboard:!alt_text_manager_classPrivateFieldGet(Vu,this)});alt_text_manager_classPrivateFieldSet(e_,this,null);alt_text_manager_assertClassBrand(t_,this,_removeOnClickListeners).call(this);alt_text_manager_classPrivateFieldGet(Xu,this)?.addEditListeners();alt_text_manager_classPrivateFieldGet(Yu,this)?.abort();alt_text_manager_classPrivateFieldSet(Yu,this,null);alt_text_manager_classPrivateFieldGet(Nu,this).altTextFinish();alt_text_manager_classPrivateFieldSet(Nu,this,null);alt_text_manager_classPrivateFieldSet(Xu,this,null)}function _updateUIState(){alt_text_manager_classPrivateFieldGet(qu,this).disabled=alt_text_manager_classPrivateFieldGet(zu,this).checked}function alt_text_manager_save(){const e=alt_text_manager_classPrivateFieldGet(qu,this).value.trim(),t=alt_text_manager_classPrivateFieldGet(zu,this).checked;alt_text_manager_classPrivateFieldGet(Nu,this).altTextData={altText:e,decorative:t};alt_text_manager_classPrivateFieldSet(e_,this,{action:"alt_text_save",alt_text_description:!!e,alt_text_edit:!!alt_text_manager_classPrivateFieldGet(Ku,this)&&alt_text_manager_classPrivateFieldGet(Ku,this)!==e,alt_text_decorative:t,alt_text_keyboard:!alt_text_manager_classPrivateFieldGet(Vu,this)});alt_text_manager_assertClassBrand(t_,this,alt_text_manager_finish).call(this)}function _onClick(e){if(0!==e.detail){alt_text_manager_classPrivateFieldSet(Vu,this,!0);alt_text_manager_assertClassBrand(t_,this,_removeOnClickListeners).call(this)}}function _removeOnClickListeners(){alt_text_manager_classPrivateFieldGet(Ru,this)?.abort();alt_text_manager_classPrivateFieldSet(Ru,this,null)}function annotation_editor_params_classPrivateMethodInitSpec(e,t){(function annotation_editor_params_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}var i_,a_=new WeakSet;class AnnotationEditorParams{constructor(e,t){annotation_editor_params_classPrivateMethodInitSpec(this,a_);this.eventBus=t;(function annotation_editor_params_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")})(a_,this,_bindListeners).call(this,e)}}function _bindListeners(e){let{editorFreeTextFontSize:t,editorFreeTextColor:i,editorInkColor:a,editorInkThickness:s,editorInkOpacity:n,editorStampAddImage:r,editorFreeHighlightThickness:o,editorHighlightShowAll:l,editorSignatureAddSignature:d}=e;const{eventBus:c}=this,dispatchEvent=(e,t)=>{c.dispatch("switchannotationeditorparams",{source:this,type:m[e],value:t})};t.addEventListener("input",function(){dispatchEvent("FREETEXT_SIZE",this.valueAsNumber)});i.addEventListener("input",function(){dispatchEvent("FREETEXT_COLOR",this.value)});a.addEventListener("input",function(){dispatchEvent("INK_COLOR",this.value)});s.addEventListener("input",function(){dispatchEvent("INK_THICKNESS",this.valueAsNumber)});n.addEventListener("input",function(){dispatchEvent("INK_OPACITY",this.valueAsNumber)});r.addEventListener("click",()=>{c.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{action:"pdfjs.image.add_image_click"}}});dispatchEvent("CREATE")});o.addEventListener("input",function(){dispatchEvent("HIGHLIGHT_THICKNESS",this.valueAsNumber)});l.addEventListener("click",function(){const e="true"===this.getAttribute("aria-pressed");this.setAttribute("aria-pressed",!e);dispatchEvent("HIGHLIGHT_SHOW_ALL",!e)});d?.addEventListener("click",()=>{dispatchEvent("CREATE")});c._on("annotationeditorparamschanged",e=>{for(const[r,d]of e.details)switch(r){case m.FREETEXT_SIZE:t.value=d;break;case m.FREETEXT_COLOR:i.value=d;break;case m.INK_COLOR:a.value=d;break;case m.INK_THICKNESS:s.value=d;break;case m.INK_OPACITY:n.value=d;break;case m.HIGHLIGHT_COLOR:c.dispatch("mainhighlightcolorpickerupdatecolor",{source:this,value:d});break;case m.HIGHLIGHT_THICKNESS:o.value=d;break;case m.HIGHLIGHT_FREE:o.disabled=!d;break;case m.HIGHLIGHT_SHOW_ALL:l.setAttribute("aria-pressed",d)}})}function caret_browsing_classPrivateFieldInitSpec(e,t,i){caret_browsing_checkPrivateRedeclaration(e,t),t.set(e,i)}function caret_browsing_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function caret_browsing_classPrivateFieldGet(e,t){return e.get(caret_browsing_assertClassBrand(e,t))}function caret_browsing_classPrivateFieldSet(e,t,i){return e.set(caret_browsing_assertClassBrand(e,t),i),i}function caret_browsing_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const s_=.1;var n_=new WeakMap,r_=new WeakMap,o_=new WeakMap,l_=new WeakSet;class CaretBrowsingMode{constructor(e,t,i,a){!function caret_browsing_classPrivateMethodInitSpec(e,t){caret_browsing_checkPrivateRedeclaration(e,t),t.add(e)}(this,l_);caret_browsing_classPrivateFieldInitSpec(this,n_,void 0);caret_browsing_classPrivateFieldInitSpec(this,r_,0);caret_browsing_classPrivateFieldInitSpec(this,o_,void 0);caret_browsing_classPrivateFieldSet(n_,this,t);caret_browsing_classPrivateFieldSet(o_,this,i);if(!a)return;caret_browsing_classPrivateFieldSet(r_,this,a.getBoundingClientRect().height);const s=new ResizeObserver(e=>{for(const t of e)if(t.target===a){caret_browsing_classPrivateFieldSet(r_,this,Math.floor(t.borderBoxSize[0].blockSize));break}});s.observe(a);e.addEventListener("abort",()=>s.disconnect(),{once:!0})}moveCaret(e,t){const i=document.getSelection();if(0===i.rangeCount)return;const{focusNode:a}=i,s=a.nodeType!==Node.ELEMENT_NODE?a.parentElement:a,n=s.closest(".textLayer");if(!n)return;const r=document.createTreeWalker(n,NodeFilter.SHOW_TEXT);r.currentNode=a;const o=s.getBoundingClientRect();let l=null;const d=(e?r.previousSibling:r.nextSibling).bind(r);for(;d();){const e=r.currentNode.parentElement;if(!caret_browsing_assertClassBrand(l_,this,_isOnSameLine).call(this,o,e.getBoundingClientRect())){l=e;break}}if(!l){const s=caret_browsing_assertClassBrand(l_,this,_getNodeOnNextPage).call(this,n,e);if(!s)return;if(t){const t=(e?r.firstChild():r.lastChild())||a;i.extend(t,e?0:t.length);const n=document.createRange();n.setStart(s,e?s.length:0);n.setEnd(s,e?s.length:0);i.addRange(n);return}const[o]=caret_browsing_assertClassBrand(l_,this,_getCaretPosition).call(this,i,e),{parentElement:l}=s;caret_browsing_assertClassBrand(l_,this,_setCaretPosition).call(this,t,i,l,l.getBoundingClientRect(),o);return}const[c,h]=caret_browsing_assertClassBrand(l_,this,_getCaretPosition).call(this,i,e),u=l.getBoundingClientRect();if(caret_browsing_assertClassBrand(l_,this,_isUnderOver).call(this,u,c,h,e))caret_browsing_assertClassBrand(l_,this,_setCaretPosition).call(this,t,i,l,u,c);else{for(;d();){const a=r.currentNode.parentElement,s=a.getBoundingClientRect();if(!caret_browsing_assertClassBrand(l_,this,_isOnSameLine).call(this,u,s))break;if(caret_browsing_assertClassBrand(l_,this,_isUnderOver).call(this,s,c,h,e)){caret_browsing_assertClassBrand(l_,this,_setCaretPosition).call(this,t,i,a,s,c);return}}caret_browsing_assertClassBrand(l_,this,_setCaretPosition).call(this,t,i,l,u,c)}}}i_=CaretBrowsingMode;function _isOnSameLine(e,t){const i=e.y,a=e.bottom,s=e.y+e.height/2,n=t.y,r=t.bottom,o=t.y+t.height/2;return i<=o&&o<=a||n<=s&&s<=r}function _isUnderOver(e,t,i,a){const s=e.y+e.height/2;return(a?i>=s:i<=s)&&e.x-s_<=t&&t<=e.right+s_}function _isVisible(e){return e.top>=caret_browsing_classPrivateFieldGet(r_,this)&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}function _getCaretPosition(e,t){const{focusNode:i,focusOffset:a}=e,s=document.createRange();s.setStart(i,a);s.setEnd(i,a);const n=s.getBoundingClientRect();return[n.x,t?n.top:n.bottom]}function _caretPositionFromPoint(e,t){if(!document.caretPositionFromPoint){const{startContainer:i,startOffset:a}=document.caretRangeFromPoint(e,t);return{offsetNode:i,offset:a}}return document.caretPositionFromPoint(e,t)}function _setCaretPositionHelper(e,t,i,a,s){s||=a.getBoundingClientRect();if(t<=s.x+s_){i?e.extend(a.firstChild,0):e.setPosition(a.firstChild,0);return}if(s.right-s_<=t){const{lastChild:t}=a;i?e.extend(t,t.length):e.setPosition(t,t.length);return}const n=s.y+s.height/2;let r=_caretPositionFromPoint.call(i_,t,n),o=r.offsetNode?.parentElement;if(o&&o!==a){const e=document.elementsFromPoint(t,n),i=[];for(const t of e){if(t===a)break;const{style:e}=t;i.push([t,e.visibility]);e.visibility="hidden"}r=_caretPositionFromPoint.call(i_,t,n);o=r.offsetNode?.parentElement;for(const[e,t]of i)e.style.visibility=t}o===a?i?e.extend(r.offsetNode,r.offset):e.setPosition(r.offsetNode,r.offset):i?e.extend(a.firstChild,0):e.setPosition(a.firstChild,0)}function _setCaretPosition(e,t,i,a,s){if(caret_browsing_assertClassBrand(l_,this,_isVisible).call(this,a))caret_browsing_assertClassBrand(l_,this,_setCaretPositionHelper).call(this,t,s,e,i,a);else{caret_browsing_classPrivateFieldGet(n_,this).addEventListener("scrollend",caret_browsing_assertClassBrand(l_,this,_setCaretPositionHelper).bind(this,t,s,e,i,null),{once:!0});i.scrollIntoView()}}function _getNodeOnNextPage(e,t){for(;;){const i=e.closest(".page"),a=parseInt(i.getAttribute("data-page-number")),s=t?a-1:a+1;if(!(e=caret_browsing_classPrivateFieldGet(o_,this).querySelector(`.page[data-page-number="${s}"] .textLayer`)))return null;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=t?n.lastChild():n.firstChild();if(r)return r}}function sidebar_classPrivateFieldInitSpec(e,t,i){sidebar_checkPrivateRedeclaration(e,t),t.set(e,i)}function sidebar_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function sidebar_classPrivateFieldGet(e,t){return e.get(sidebar_assertClassBrand(e,t))}function sidebar_classPrivateFieldSet(e,t,i){return e.set(sidebar_assertClassBrand(e,t),i),i}function sidebar_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var d_=new WeakMap,c_=new WeakMap,h_=new WeakMap,u_=new WeakMap,__=new WeakMap,p_=new WeakMap,g_=new WeakMap,f_=new WeakMap,m_=new WeakMap,v_=new WeakSet;class Sidebar{constructor(e,t,i,a){let{sidebar:s,resizer:n,toggleButton:r}=e;!function sidebar_classPrivateMethodInitSpec(e,t){sidebar_checkPrivateRedeclaration(e,t),t.add(e)}(this,v_);sidebar_classPrivateFieldInitSpec(this,d_,0);sidebar_classPrivateFieldInitSpec(this,c_,0);sidebar_classPrivateFieldInitSpec(this,h_,void 0);sidebar_classPrivateFieldInitSpec(this,u_,null);sidebar_classPrivateFieldInitSpec(this,__,void 0);sidebar_classPrivateFieldInitSpec(this,p_,void 0);sidebar_classPrivateFieldInitSpec(this,g_,!1);sidebar_classPrivateFieldInitSpec(this,f_,void 0);sidebar_classPrivateFieldInitSpec(this,m_,0);if(!s){console.warn("[Sidebar] sidebar element is null, skipping initialization");this._sidebar=null;return}this._sidebar=s;sidebar_classPrivateFieldSet(h_,this,t===i?-1:1);sidebar_classPrivateFieldSet(__,this,n);sidebar_classPrivateFieldSet(p_,this,i);const o=window.getComputedStyle(s);sidebar_classPrivateFieldSet(d_,this,sidebar_classPrivateFieldSet(c_,this,parseFloat(o.getPropertyValue("--sidebar-width"))));n.ariaValueMin=parseFloat(o.getPropertyValue("--sidebar-min-width"))||0;n.ariaValueMax=parseFloat(o.getPropertyValue("--sidebar-max-width"))||1/0;n.ariaValueNow=sidebar_classPrivateFieldGet(c_,this);sidebar_assertClassBrand(v_,this,_makeSidebarResizable).call(this);this._isOpen=!1;s.hidden=!0;a?.addEventListener("abort",this.destroy.bind(this),{once:!0});sidebar_classPrivateFieldSet(f_,this,new ResizeObserver(e=>{let[{borderBoxSize:[{inlineSize:t}]}]=e;isNaN(sidebar_classPrivateFieldGet(m_,this))||sidebar_classPrivateFieldSet(m_,this,sidebar_classPrivateFieldGet(m_,this)+sidebar_classPrivateFieldGet(h_,this)*(t-sidebar_classPrivateFieldGet(c_,this)));sidebar_assertClassBrand(v_,this,_setWidth).call(this,t)}));sidebar_classPrivateFieldGet(f_,this).observe(s)}get width(){return sidebar_classPrivateFieldGet(c_,this)}set width(e){this._sidebar&&(this._sidebar.style.width=`${e}px`)}onStartResizing(){}onStopResizing(){}onResizing(e){}toggle(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:!this._isOpen;this._sidebar&&(this._sidebar.hidden=!(this._isOpen=e))}destroy(){sidebar_classPrivateFieldGet(f_,this)?.disconnect();sidebar_classPrivateFieldSet(f_,this,null)}}function _makeSidebarResizable(){if(!this._sidebar)return;const e=this._sidebar.style;let t;const cancelResize=()=>{sidebar_classPrivateFieldSet(u_,this,null);this._sidebar.classList.remove("resizing");t?.abort();t=null;sidebar_classPrivateFieldSet(g_,this,!1);this.onStopResizing();sidebar_classPrivateFieldSet(m_,this,NaN)};sidebar_classPrivateFieldGet(__,this).addEventListener("pointerdown",i=>{if(t){cancelResize();return}this.onStartResizing();const{clientX:a}=i;stopEvent(i);sidebar_classPrivateFieldSet(m_,this,a);t=new AbortController;const{signal:s}=t,n=this._sidebar;n.classList.add("resizing");n.parentElement.style.minWidth=0;window.addEventListener("contextmenu",noContextMenu,{signal:s});window.addEventListener("pointermove",i=>{if(t&&!(Math.abs(i.clientX-sidebar_classPrivateFieldGet(m_,this))<1)){stopEvent(i);e.width=`${Math.round(sidebar_classPrivateFieldGet(c_,this)+sidebar_classPrivateFieldGet(h_,this)*(i.clientX-sidebar_classPrivateFieldGet(m_,this)))}px`}},{signal:s,capture:!0});window.addEventListener("blur",cancelResize,{signal:s});window.addEventListener("pointerup",e=>{if(t){cancelResize();stopEvent(e)}},{signal:s})});sidebar_classPrivateFieldGet(__,this).addEventListener("keydown",t=>{const{key:i}=t,a="ArrowLeft"===i;if(a||"ArrowRight"===i){if(!sidebar_classPrivateFieldGet(g_,this)){this._sidebar.classList.add("resizing");sidebar_classPrivateFieldSet(g_,this,!0);this.onStartResizing()}const i=(t.ctrlKey||t.metaKey?10:1)*(a?-1:1);clearTimeout(sidebar_classPrivateFieldGet(u_,this));sidebar_classPrivateFieldSet(u_,this,setTimeout(cancelResize,400));e.width=`${Math.round(sidebar_classPrivateFieldGet(c_,this)+sidebar_classPrivateFieldGet(h_,this)*i)}px`;stopEvent(t)}})}function _setWidth(e){sidebar_classPrivateFieldSet(c_,this,e);sidebar_classPrivateFieldGet(__,this).ariaValueNow=Math.round(e);sidebar_classPrivateFieldGet(p_,this)&&this._sidebar?.parentElement&&(this._sidebar.parentElement.style.insetInlineStart=`${(sidebar_classPrivateFieldGet(d_,this)-e).toFixed(3)}px`);this.onResizing(e)}function comment_manager_classPrivateMethodInitSpec(e,t){comment_manager_checkPrivateRedeclaration(e,t),t.add(e)}function comment_manager_classPrivateFieldInitSpec(e,t,i){comment_manager_checkPrivateRedeclaration(e,t),t.set(e,i)}function comment_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function comment_manager_classPrivateFieldGet(e,t){return e.get(comment_manager_assertClassBrand(e,t))}function comment_manager_classPrivateFieldSet(e,t,i){return e.set(comment_manager_assertClassBrand(e,t),i),i}function comment_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var P_=new WeakMap,w_=new WeakMap,F_=new WeakMap;class CommentManager{constructor(e,t,i,a,s,n,r,o){comment_manager_classPrivateFieldInitSpec(this,P_,void 0);comment_manager_classPrivateFieldInitSpec(this,w_,void 0);comment_manager_classPrivateFieldInitSpec(this,F_,void 0);const l=new Intl.DateTimeFormat(void 0,{dateStyle:"long"});this.dialogElement=e.dialog;comment_manager_classPrivateFieldSet(P_,this,new CommentDialog(e,s,i,n));comment_manager_classPrivateFieldSet(w_,this,new CommentPopup(i,l,n,this.dialogElement));comment_manager_classPrivateFieldSet(F_,this,new CommentSidebar(t,i,a,comment_manager_classPrivateFieldGet(w_,this),l,n,o));comment_manager_classPrivateFieldGet(w_,this).sidebar=comment_manager_classPrivateFieldGet(F_,this);b_._=r}setSidebarUiManager(e){comment_manager_classPrivateFieldGet(F_,this).setUIManager(e)}showSidebar(e){comment_manager_classPrivateFieldGet(F_,this).show(e)}hideSidebar(){comment_manager_classPrivateFieldGet(F_,this).hide()}removeComments(e){comment_manager_classPrivateFieldGet(F_,this).removeComments(e)}selectComment(e){comment_manager_classPrivateFieldGet(F_,this).selectComment(null,e)}addComment(e){comment_manager_classPrivateFieldGet(F_,this).addComment(e)}updateComment(e){comment_manager_classPrivateFieldGet(F_,this).updateComment(e)}toggleCommentPopup(e,t,i,a){t&&this.selectComment(e.uid);comment_manager_classPrivateFieldGet(w_,this).toggle(e,t,i,a)}destroyPopup(){comment_manager_classPrivateFieldGet(w_,this).destroy()}updatePopupColor(e){comment_manager_classPrivateFieldGet(w_,this).updateColor(e)}showDialog(e,t,i,a,s){return comment_manager_classPrivateFieldGet(P_,this).open(e,t,i,a,s)}makeCommentColor(e,t){return CommentManager._makeCommentColor(e,t)}static _makeCommentColor(e,t){return comment_manager_assertClassBrand(CommentManager,this,b_)._?null:findContrastColor(applyOpacity(e,t??1),CSSConstants.commentForegroundColor)}destroy(){comment_manager_classPrivateFieldGet(P_,this).destroy();comment_manager_classPrivateFieldGet(F_,this).hide();comment_manager_classPrivateFieldGet(w_,this).destroy()}}var b_={_:null},y_=new WeakMap,S_=new WeakMap,C_=new WeakMap,x_=new WeakMap,k_=new WeakMap,E_=new WeakMap,A_=new WeakMap,G_=new WeakMap,B_=new WeakMap,M_=new WeakMap,I_=new WeakMap,T_=new WeakMap,D_=new WeakMap,L_=new WeakMap,R_=new WeakMap,N_=new WeakSet;class CommentSidebar extends Sidebar{constructor(e,t,i,a,s,n,r){let{learnMoreUrl:o,sidebar:l,sidebarResizer:d,commentsList:c,commentCount:h,sidebarTitle:u,closeButton:_,commentToolbarButton:p}=e;super({sidebar:l,resizer:d,toggleButton:p},n,!0,r);comment_manager_classPrivateMethodInitSpec(this,N_);comment_manager_classPrivateFieldInitSpec(this,y_,null);comment_manager_classPrivateFieldInitSpec(this,S_,void 0);comment_manager_classPrivateFieldInitSpec(this,C_,comment_manager_assertClassBrand(N_,this,_commentClick).bind(this));comment_manager_classPrivateFieldInitSpec(this,x_,comment_manager_assertClassBrand(N_,this,_commentKeydown).bind(this));comment_manager_classPrivateFieldInitSpec(this,k_,void 0);comment_manager_classPrivateFieldInitSpec(this,E_,void 0);comment_manager_classPrivateFieldInitSpec(this,A_,void 0);comment_manager_classPrivateFieldInitSpec(this,G_,void 0);comment_manager_classPrivateFieldInitSpec(this,B_,void 0);comment_manager_classPrivateFieldInitSpec(this,M_,void 0);comment_manager_classPrivateFieldInitSpec(this,I_,void 0);comment_manager_classPrivateFieldInitSpec(this,T_,void 0);comment_manager_classPrivateFieldInitSpec(this,D_,null);comment_manager_classPrivateFieldInitSpec(this,L_,null);comment_manager_classPrivateFieldInitSpec(this,R_,null);if(!l)return;comment_manager_classPrivateFieldSet(B_,this,u);comment_manager_classPrivateFieldSet(E_,this,c);comment_manager_classPrivateFieldSet(A_,this,h);comment_manager_classPrivateFieldSet(M_,this,o);comment_manager_classPrivateFieldSet(I_,this,i);comment_manager_classPrivateFieldSet(k_,this,_);comment_manager_classPrivateFieldSet(T_,this,a);comment_manager_classPrivateFieldSet(G_,this,s);comment_manager_classPrivateFieldSet(S_,this,t);_.addEventListener("click",()=>{t.dispatch("switchannotationeditormode",{source:this,mode:f.NONE})});const keyDownCallback=e=>{if("ArrowDown"===e.key||"Home"===e.key||"F6"===e.key){comment_manager_classPrivateFieldGet(E_,this).firstElementChild.focus();stopEvent(e)}else if("ArrowUp"===e.key||"End"===e.key){comment_manager_classPrivateFieldGet(E_,this).lastElementChild.focus();stopEvent(e)}};p?.addEventListener("keydown",keyDownCallback);l.addEventListener("keydown",keyDownCallback)}setUIManager(e){comment_manager_classPrivateFieldSet(R_,this,e)}show(e){comment_manager_classPrivateFieldSet(D_,this,new WeakMap);comment_manager_classPrivateFieldSet(L_,this,new Map);comment_manager_classPrivateFieldSet(y_,this,e);e.sort(comment_manager_assertClassBrand(N_,this,_sortComments).bind(this));if(0!==e.length){const t=document.createDocumentFragment();for(const i of e)t.append(comment_manager_assertClassBrand(N_,this,_createCommentElement).call(this,i));comment_manager_assertClassBrand(N_,this,_setCommentsCount).call(this,t);comment_manager_classPrivateFieldGet(E_,this).append(t)}else comment_manager_assertClassBrand(N_,this,_setCommentsCount).call(this);this._sidebar.hidden=!1;comment_manager_classPrivateFieldGet(S_,this).dispatch("reporttelemetry",{source:this,details:{type:"commentSidebar",data:{numberOfAnnotations:e.length}}})}hide(){this._sidebar.hidden=!0;comment_manager_classPrivateFieldGet(E_,this).replaceChildren();comment_manager_classPrivateFieldSet(D_,this,null);comment_manager_classPrivateFieldSet(L_,this,null);comment_manager_classPrivateFieldSet(y_,this,null)}removeComments(e){if(0!==e.length&&comment_manager_classPrivateFieldGet(L_,this))if(0!==new Set(comment_manager_classPrivateFieldGet(L_,this).keys()).difference(new Set(e)).size)for(const t of e)comment_manager_assertClassBrand(N_,this,_removeComment).call(this,t);else comment_manager_assertClassBrand(N_,this,_removeAll).call(this)}focusComment(e){const t=comment_manager_classPrivateFieldGet(L_,this).get(e);if(t){this._sidebar.scrollTop=t.offsetTop-this._sidebar.offsetTop;for(const e of comment_manager_classPrivateFieldGet(E_,this).children)e.classList.toggle("selected",e===t)}}updateComment(e){if(!comment_manager_classPrivateFieldGet(L_,this))return;const{id:t,creationDate:i,modificationDate:a,richText:s,contentsObj:n,popupRef:r}=e;r&&(s||n?.str)||comment_manager_assertClassBrand(N_,this,_removeComment).call(this,t);const o=comment_manager_classPrivateFieldGet(L_,this).get(t);if(!o)return;const l=comment_manager_classPrivateFieldGet(D_,this).get(o);let d=binarySearchFirstItem(comment_manager_classPrivateFieldGet(y_,this),e=>comment_manager_assertClassBrand(N_,this,_sortComments).call(this,e,l)>=0);if(!(d>=comment_manager_classPrivateFieldGet(y_,this).length)){comment_manager_assertClassBrand(N_,this,_setDate).call(this,o.firstElementChild,a||i);comment_manager_assertClassBrand(N_,this,_setText).call(this,o.lastElementChild,s,n);comment_manager_classPrivateFieldGet(y_,this).splice(d,1);d=binarySearchFirstItem(comment_manager_classPrivateFieldGet(y_,this),t=>comment_manager_assertClassBrand(N_,this,_sortComments).call(this,t,e)>=0);comment_manager_classPrivateFieldGet(y_,this).splice(d,0,e);d>=comment_manager_classPrivateFieldGet(E_,this).children.length?comment_manager_classPrivateFieldGet(E_,this).append(o):comment_manager_classPrivateFieldGet(E_,this).insertBefore(o,comment_manager_classPrivateFieldGet(E_,this).children[d])}}selectComment(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!comment_manager_classPrivateFieldGet(L_,this))return;const i=!e;e||=comment_manager_classPrivateFieldGet(L_,this).get(t);for(const t of comment_manager_classPrivateFieldGet(E_,this).children)t.classList.toggle("selected",t===e);i&&e?.scrollIntoView({behavior:"instant",block:"center"})}addComment(e){if(comment_manager_classPrivateFieldGet(L_,this)?.has(e.id))return;const{popupRef:t,contentsObj:i}=e;if(!t||!i?.str)return;const a=comment_manager_assertClassBrand(N_,this,_createCommentElement).call(this,e);if(0===comment_manager_classPrivateFieldGet(y_,this).length){comment_manager_classPrivateFieldGet(E_,this).replaceChildren(a);comment_manager_classPrivateFieldGet(y_,this).push(e);comment_manager_assertClassBrand(N_,this,_setCommentsCount).call(this);return}const s=binarySearchFirstItem(comment_manager_classPrivateFieldGet(y_,this),t=>comment_manager_assertClassBrand(N_,this,_sortComments).call(this,t,e)>=0);comment_manager_classPrivateFieldGet(y_,this).splice(s,0,e);s>=comment_manager_classPrivateFieldGet(E_,this).children.length?comment_manager_classPrivateFieldGet(E_,this).append(a):comment_manager_classPrivateFieldGet(E_,this).insertBefore(a,comment_manager_classPrivateFieldGet(E_,this).children[s]);comment_manager_assertClassBrand(N_,this,_setCommentsCount).call(this)}}function _removeComment(e){const t=comment_manager_classPrivateFieldGet(L_,this)?.get(e);if(!t)return;const i=comment_manager_classPrivateFieldGet(D_,this).get(t),a=binarySearchFirstItem(comment_manager_classPrivateFieldGet(y_,this),e=>comment_manager_assertClassBrand(N_,this,_sortComments).call(this,e,i)>=0);if(!(a>=comment_manager_classPrivateFieldGet(y_,this).length)){comment_manager_classPrivateFieldGet(y_,this).splice(a,1);t.remove();comment_manager_classPrivateFieldGet(L_,this).delete(e);comment_manager_assertClassBrand(N_,this,_setCommentsCount).call(this)}}function _removeAll(){comment_manager_classPrivateFieldGet(E_,this).replaceChildren();comment_manager_classPrivateFieldSet(D_,this,new WeakMap);comment_manager_classPrivateFieldGet(L_,this).clear();comment_manager_classPrivateFieldGet(y_,this).length=0;comment_manager_assertClassBrand(N_,this,_setCommentsCount).call(this)}function _setCommentsCount(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:comment_manager_classPrivateFieldGet(E_,this);const t=comment_manager_classPrivateFieldGet(L_,this).size;comment_manager_classPrivateFieldGet(B_,this).setAttribute("data-l10n-args",JSON.stringify({count:t}));comment_manager_classPrivateFieldGet(A_,this).textContent=t;0===t&&e.append(comment_manager_assertClassBrand(N_,this,_createZeroCommentElement).call(this))}function _createZeroCommentElement(){const e=document.createElement("li");e.classList.add("sidebarComment","noComments");const t=document.createElement("div");t.className="sidebarCommentText";t.setAttribute("data-l10n-id","pdfjs-editor-comments-sidebar-no-comments1");e.append(t);if(comment_manager_classPrivateFieldGet(M_,this)){const t=document.createElement("a");t.setAttribute("data-l10n-id","pdfjs-editor-comments-sidebar-no-comments-link");t.href=comment_manager_classPrivateFieldGet(M_,this);t.target="_blank";t.rel="noopener noreferrer";e.append(t)}return e}function _setDate(e,t){t=PDFDateString.toDateObject(t);e.dateTime=t.toISOString();e.textContent=comment_manager_classPrivateFieldGet(G_,this).format(t)}function _setText(e,t,i){e.replaceChildren();renderRichText({html:!t?.str||i?.str&&t.str!==i.str?i?.str:t.html,dir:i?.dir||"auto",className:"richText"},e)}function _createCommentElement(e){const{id:t,creationDate:i,modificationDate:a,richText:s,contentsObj:n,color:r,opacity:o}=e,l=document.createElement("li");l.role="button";l.className="sidebarComment";l.tabIndex=-1;l.style.backgroundColor=r&&CommentManager._makeCommentColor(r,o)||"";const d=document.createElement("time");comment_manager_assertClassBrand(N_,this,_setDate).call(this,d,a||i);const c=document.createElement("div");c.className="sidebarCommentText";comment_manager_assertClassBrand(N_,this,_setText).call(this,c,s,n);l.append(d,c);l.addEventListener("click",comment_manager_classPrivateFieldGet(C_,this));l.addEventListener("keydown",comment_manager_classPrivateFieldGet(x_,this));comment_manager_classPrivateFieldGet(D_,this).set(l,e);comment_manager_classPrivateFieldGet(L_,this).set(t,l);return l}async function _commentClick(e){let{currentTarget:t}=e;if(t.classList.contains("selected")){t.classList.remove("selected");comment_manager_classPrivateFieldGet(T_,this)._hide();return}const i=comment_manager_classPrivateFieldGet(D_,this).get(t);if(!i)return;comment_manager_classPrivateFieldGet(T_,this)._hide();const{id:a,pageIndex:s,rect:n}=i,r=s+1,o=comment_manager_classPrivateFieldGet(R_,this)?.waitForEditorsRendered(r);comment_manager_classPrivateFieldGet(I_,this)?.goToXY(r,n[0],n[3],{center:"both"});this.selectComment(t);await o;comment_manager_classPrivateFieldGet(R_,this)?.selectComment(s,a)}function _commentKeydown(e){const{key:t,currentTarget:i}=e;switch(t){case"ArrowDown":(i.nextElementSibling||comment_manager_classPrivateFieldGet(E_,this).firstElementChild).focus();stopEvent(e);break;case"ArrowUp":(i.previousElementSibling||comment_manager_classPrivateFieldGet(E_,this).lastElementChild).focus();stopEvent(e);break;case"Home":comment_manager_classPrivateFieldGet(E_,this).firstElementChild.focus();stopEvent(e);break;case"End":comment_manager_classPrivateFieldGet(E_,this).lastElementChild.focus();stopEvent(e);break;case"Enter":case" ":comment_manager_assertClassBrand(N_,this,_commentClick).call(this,e);stopEvent(e);break;case"ShiftTab":comment_manager_classPrivateFieldGet(k_,this).focus();stopEvent(e)}}function _sortComments(e,t){const i=PDFDateString.toDateObject(e.modificationDate||e.creationDate),a=PDFDateString.toDateObject(t.modificationDate||t.creationDate);return i!==a?null!==i&&null!==a?a-i:null!==i?-1:1:e.pageIndex!==t.pageIndex?e.pageIndex-t.pageIndex:e.rect[3]!==t.rect[3]?t.rect[3]-e.rect[3]:e.rect[0]!==t.rect[0]?e.rect[0]-t.rect[0]:e.rect[1]!==t.rect[1]?t.rect[1]-e.rect[1]:e.rect[2]!==t.rect[2]?e.rect[2]-t.rect[2]:e.id.localeCompare(t.id)}var O_=new WeakMap,W_=new WeakMap,j_=new WeakMap,V_=new WeakMap,U_=new WeakMap,z_=new WeakMap,H_=new WeakMap,$_=new WeakMap,q_=new WeakMap,X_=new WeakMap,K_=new WeakMap,Y_=new WeakMap,Z_=new WeakMap,J_=new WeakMap,Q_=new WeakMap,ep=new WeakSet;class CommentDialog{constructor(e,t,i,a){let{dialog:s,toolbar:n,title:r,textInput:o,cancelButton:l,saveButton:d}=e;comment_manager_classPrivateMethodInitSpec(this,ep);comment_manager_classPrivateFieldInitSpec(this,O_,void 0);comment_manager_classPrivateFieldInitSpec(this,W_,void 0);comment_manager_classPrivateFieldInitSpec(this,j_,void 0);comment_manager_classPrivateFieldInitSpec(this,V_,"");comment_manager_classPrivateFieldInitSpec(this,U_,"");comment_manager_classPrivateFieldInitSpec(this,z_,void 0);comment_manager_classPrivateFieldInitSpec(this,H_,void 0);comment_manager_classPrivateFieldInitSpec(this,$_,void 0);comment_manager_classPrivateFieldInitSpec(this,q_,void 0);comment_manager_classPrivateFieldInitSpec(this,X_,0);comment_manager_classPrivateFieldInitSpec(this,K_,0);comment_manager_classPrivateFieldInitSpec(this,Y_,0);comment_manager_classPrivateFieldInitSpec(this,Z_,0);comment_manager_classPrivateFieldInitSpec(this,J_,void 0);comment_manager_classPrivateFieldInitSpec(this,Q_,void 0);comment_manager_classPrivateFieldSet(O_,this,s);comment_manager_classPrivateFieldSet(z_,this,o);comment_manager_classPrivateFieldSet(j_,this,t);comment_manager_classPrivateFieldSet(Q_,this,i);comment_manager_classPrivateFieldSet($_,this,d);comment_manager_classPrivateFieldSet(H_,this,r);comment_manager_classPrivateFieldSet(J_,this,a);const c=comment_manager_assertClassBrand(ep,this,comment_manager_finish).bind(this);s.addEventListener("close",c);s.addEventListener("contextmenu",e=>{e.target!==comment_manager_classPrivateFieldGet(z_,this)&&e.preventDefault()});l.addEventListener("click",c);d.addEventListener("click",comment_manager_assertClassBrand(ep,this,comment_manager_save).bind(this));o.addEventListener("input",()=>{d.disabled=o.value===comment_manager_classPrivateFieldGet(V_,this)});o.addEventListener("keydown",e=>{!e.ctrlKey&&!e.metaKey||"Enter"!==e.key||d.disabled||comment_manager_assertClassBrand(ep,this,comment_manager_save).call(this)});let h;const cancelDrag=()=>{s.classList.remove("dragging");h?.abort();h=null};n.addEventListener("pointerdown",e=>{if(h){cancelDrag();return}const{clientX:t,clientY:i}=e;stopEvent(e);comment_manager_classPrivateFieldSet(X_,this,t);comment_manager_classPrivateFieldSet(K_,this,i);h=new AbortController;const{signal:a}=h,{innerHeight:n,innerWidth:r}=window;s.classList.add("dragging");window.addEventListener("pointermove",e=>{if(!h)return;const{clientX:t,clientY:i}=e;comment_manager_assertClassBrand(ep,this,comment_manager_setPosition).call(this,comment_manager_classPrivateFieldGet(Y_,this)+(t-comment_manager_classPrivateFieldGet(X_,this))/r,comment_manager_classPrivateFieldGet(Z_,this)+(i-comment_manager_classPrivateFieldGet(K_,this))/n);comment_manager_classPrivateFieldSet(X_,this,t);comment_manager_classPrivateFieldSet(K_,this,i);stopEvent(e)},{signal:a});window.addEventListener("blur",cancelDrag,{signal:a});window.addEventListener("pointerup",e=>{if(h){cancelDrag();stopEvent(e)}},{signal:a})});t.register(s)}async open(e,t,i,a,s){if(t){comment_manager_classPrivateFieldSet(q_,this,e);comment_manager_classPrivateFieldSet(W_,this,t)}const{contentsObj:{str:n},color:r,opacity:o}=t.getData(),{style:l}=comment_manager_classPrivateFieldGet(O_,this);if(r){l.backgroundColor=CommentManager._makeCommentColor(r,o);l.borderColor=Util.makeHexColor(...r)}else l.backgroundColor=l.borderColor="";comment_manager_classPrivateFieldSet(U_,this,n||"");const d=comment_manager_classPrivateFieldGet(z_,this);d.value=comment_manager_classPrivateFieldSet(V_,this,comment_manager_classPrivateFieldGet(U_,this));if(n){comment_manager_classPrivateFieldGet(H_,this).setAttribute("data-l10n-id","pdfjs-editor-edit-comment-dialog-title-when-editing");comment_manager_classPrivateFieldGet($_,this).setAttribute("data-l10n-id","pdfjs-editor-edit-comment-dialog-save-button-when-editing")}else{comment_manager_classPrivateFieldGet(H_,this).setAttribute("data-l10n-id","pdfjs-editor-edit-comment-dialog-title-when-adding");comment_manager_classPrivateFieldGet($_,this).setAttribute("data-l10n-id","pdfjs-editor-edit-comment-dialog-save-button-when-adding")}s?.height&&(d.style.height=`${s.height}px`);comment_manager_classPrivateFieldGet(q_,this)?.removeEditListeners();comment_manager_classPrivateFieldGet($_,this).disabled=!0;const c=s?.parentDimensions,{innerHeight:h,innerWidth:u}=window;if(t.hasDefaultPopupPosition()){const{dialogWidth:e,dialogHeight:t}=this._dialogDimensions;if(c)if(comment_manager_classPrivateFieldGet(J_,this)&&i+e>Math.min(c.x+c.width,u)){i-=e-comment_manager_classPrivateFieldGet(W_,this).commentButtonWidth*c.width}else if(!comment_manager_classPrivateFieldGet(J_,this)){const t=comment_manager_classPrivateFieldGet(W_,this).commentButtonWidth*c.width;i-e<Math.max(0,c.x)?i=Math.max(0,i):i-=e-t}const n=Math.max(t,s?.height||0);a+n>h&&(a=h-n);a<0&&(a=0)}i=MathClamp(i/u,0,1);a=MathClamp(a/h,0,1);comment_manager_assertClassBrand(ep,this,comment_manager_setPosition).call(this,i,a);await comment_manager_classPrivateFieldGet(j_,this).open(comment_manager_classPrivateFieldGet(O_,this));d.focus()}get _dialogDimensions(){const e=comment_manager_classPrivateFieldGet(O_,this),{style:t}=e;t.opacity="0";t.display="block";const{width:i,height:a}=e.getBoundingClientRect();t.opacity=t.display="";return shadow(this,"_dialogDimensions",{dialogWidth:i,dialogHeight:a})}destroy(){comment_manager_classPrivateFieldSet(q_,this,null);comment_manager_classPrivateFieldSet(W_,this,null);comment_manager_assertClassBrand(ep,this,comment_manager_finish).call(this)}}async function comment_manager_save(){comment_manager_classPrivateFieldGet(W_,this).comment=comment_manager_classPrivateFieldGet(z_,this).value;comment_manager_assertClassBrand(ep,this,comment_manager_finish).call(this)}function comment_manager_setPosition(e,t){comment_manager_classPrivateFieldSet(Y_,this,e);comment_manager_classPrivateFieldSet(Z_,this,t);const{style:i}=comment_manager_classPrivateFieldGet(O_,this);i.left=100*e+"%";i.top=100*t+"%"}function comment_manager_finish(){if(!comment_manager_classPrivateFieldGet(W_,this))return;const e=comment_manager_classPrivateFieldGet(z_,this).value!==comment_manager_classPrivateFieldGet(U_,this);comment_manager_classPrivateFieldGet(Q_,this).dispatch("reporttelemetry",{source:this,details:{type:"comment",data:{edited:e}}});e&&comment_manager_classPrivateFieldGet(Q_,this)?.dispatch("annotation-editor-event",{source:this,type:comment_manager_classPrivateFieldGet(z_,this).value?"commented":"commentRemoved",page:comment_manager_classPrivateFieldGet(W_,this).pageIndex+1,id:comment_manager_classPrivateFieldGet(W_,this).uid,editorType:comment_manager_classPrivateFieldGet(W_,this).constructor.name,value:comment_manager_classPrivateFieldGet(W_,this)});comment_manager_classPrivateFieldGet(W_,this)?.focusCommentButton();comment_manager_classPrivateFieldSet(W_,this,null);comment_manager_classPrivateFieldGet(z_,this).value=comment_manager_classPrivateFieldSet(V_,this,comment_manager_classPrivateFieldSet(U_,this,""));comment_manager_classPrivateFieldGet(j_,this).closeIfActive(comment_manager_classPrivateFieldGet(O_,this));comment_manager_classPrivateFieldGet(z_,this).style.height="";comment_manager_classPrivateFieldGet(q_,this)?.addEditListeners();comment_manager_classPrivateFieldSet(q_,this,null)}var tp=new WeakMap,ip=new WeakMap,ap=new WeakMap,sp=new WeakMap,np=new WeakMap,rp=new WeakMap,op=new WeakMap,lp=new WeakMap,dp=new WeakMap,cp=new WeakMap,hp=new WeakMap,up=new WeakMap,_p=new WeakMap,pp=new WeakMap,gp=new WeakMap,fp=new WeakMap,mp=new WeakSet;class CommentPopup{constructor(e,t,i,a){comment_manager_classPrivateMethodInitSpec(this,mp);comment_manager_classPrivateFieldInitSpec(this,tp,null);comment_manager_classPrivateFieldInitSpec(this,ip,void 0);comment_manager_classPrivateFieldInitSpec(this,ap,void 0);comment_manager_classPrivateFieldInitSpec(this,sp,void 0);comment_manager_classPrivateFieldInitSpec(this,np,null);comment_manager_classPrivateFieldInitSpec(this,rp,void 0);comment_manager_classPrivateFieldInitSpec(this,op,null);comment_manager_classPrivateFieldInitSpec(this,lp,null);comment_manager_classPrivateFieldInitSpec(this,dp,null);comment_manager_classPrivateFieldInitSpec(this,cp,0);comment_manager_classPrivateFieldInitSpec(this,hp,0);comment_manager_classPrivateFieldInitSpec(this,up,0);comment_manager_classPrivateFieldInitSpec(this,_p,0);comment_manager_classPrivateFieldInitSpec(this,pp,null);comment_manager_classPrivateFieldInitSpec(this,gp,!1);comment_manager_classPrivateFieldInitSpec(this,fp,!1);comment_manager_classPrivateFieldSet(ip,this,e);comment_manager_classPrivateFieldSet(sp,this,t);comment_manager_classPrivateFieldSet(rp,this,i);comment_manager_classPrivateFieldSet(ap,this,a);this.sidebar=null}get _popupWidth(){const e=document.createElement("ngx-extended-pdf-viewer");e.style.opacity="0";e.style.display="block";const t=document.createElement("div");t.classList.add("zoom");e.append(t);const i=comment_manager_assertClassBrand(mp,this,comment_manager_createPopup).call(this);i.style.display="block";t.append(i);document.body.append(e);const a=i.getBoundingClientRect().width;i.remove();e.remove();i.style.display="";return shadow(this,"_popupWidth",a)}updateColor(e){if(comment_manager_classPrivateFieldGet(np,this)!==e||!comment_manager_classPrivateFieldGet(fp,this))return;const{color:t,opacity:i}=e.getData();comment_manager_classPrivateFieldGet(op,this).style.backgroundColor=t&&CommentManager._makeCommentColor(t,i)||""}_hide(e){const t=comment_manager_assertClassBrand(mp,this,comment_manager_createPopup).call(this);t.classList.toggle("hidden",!0);t.classList.toggle("selected",!1);(e||comment_manager_classPrivateFieldGet(np,this))?.setCommentButtonStates({selected:!1,hasPopup:!1});comment_manager_classPrivateFieldSet(np,this,null);comment_manager_classPrivateFieldSet(gp,this,!1);comment_manager_classPrivateFieldSet(fp,this,!1);comment_manager_classPrivateFieldGet(lp,this).replaceChildren();this.sidebar.selectComment(null)}toggle(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(!e){this.destroy();return}if(t)i??=comment_manager_classPrivateFieldGet(np,this)!==e||(!comment_manager_classPrivateFieldGet(gp,this)||!comment_manager_classPrivateFieldGet(fp,this));else{if(comment_manager_classPrivateFieldGet(gp,this))return;i??=!comment_manager_classPrivateFieldGet(fp,this)}if(!i){this._hide(e);return}comment_manager_classPrivateFieldSet(fp,this,!0);comment_manager_classPrivateFieldGet(np,this)!==e&&comment_manager_classPrivateFieldGet(np,this)?.setCommentButtonStates({selected:!1,hasPopup:!1});const s=comment_manager_assertClassBrand(mp,this,comment_manager_createPopup).call(this);comment_manager_classPrivateFieldGet(tp,this).classList.toggle("hidden",!a);s.classList.toggle("hidden",!1);s.classList.toggle("selected",t);comment_manager_classPrivateFieldSet(gp,this,t);comment_manager_classPrivateFieldSet(np,this,e);e.setCommentButtonStates({selected:t,hasPopup:!0});const{contentsObj:n,richText:r,creationDate:o,modificationDate:l,color:d,opacity:c}=e.getData();s.style.backgroundColor=d&&CommentManager._makeCommentColor(d,c)||"";comment_manager_classPrivateFieldGet(lp,this).replaceChildren();const h=!r?.str||n?.str&&r.str!==n.str?n?.str:r.html;h&&renderRichText({html:h,dir:n?.dir||"auto",className:"richText"},comment_manager_classPrivateFieldGet(lp,this));comment_manager_classPrivateFieldGet(dp,this).textContent=comment_manager_classPrivateFieldGet(sp,this).format(PDFDateString.toDateObject(l||o));comment_manager_assertClassBrand(mp,this,_setPosition2).call(this,...e.commentPopupPosition,e.hasDefaultPopupPosition());e.elementBeforePopup.after(s);s.addEventListener("focus",e=>{let{relatedTarget:t}=e;comment_manager_classPrivateFieldSet(pp,this,t)},{once:!0});t&&setTimeout(()=>s.focus(),0)}destroy(){this._hide();comment_manager_classPrivateFieldGet(op,this)?.remove();comment_manager_classPrivateFieldSet(op,this,comment_manager_classPrivateFieldSet(lp,this,comment_manager_classPrivateFieldSet(dp,this,null)));comment_manager_classPrivateFieldSet(cp,this,comment_manager_classPrivateFieldSet(hp,this,1/0));comment_manager_classPrivateFieldSet(up,this,comment_manager_classPrivateFieldSet(_p,this,0));comment_manager_classPrivateFieldSet(pp,this,null)}}function comment_manager_createPopup(){if(comment_manager_classPrivateFieldGet(op,this))return comment_manager_classPrivateFieldGet(op,this);const e=comment_manager_classPrivateFieldSet(op,this,document.createElement("div"));e.className="commentPopup";e.id="commentPopup";e.tabIndex=-1;e.role="dialog";e.ariaModal="false";e.addEventListener("contextmenu",noContextMenu);e.addEventListener("keydown",e=>{if("Escape"===e.key){this.toggle(comment_manager_classPrivateFieldGet(np,this),!0,!1);comment_manager_classPrivateFieldGet(pp,this)?.focus();stopEvent(e)}});e.addEventListener("click",()=>{e.focus()});const t=document.createElement("div");t.className="commentPopupTop";const i=comment_manager_classPrivateFieldSet(dp,this,document.createElement("time"));i.className="commentPopupTime";const a=comment_manager_classPrivateFieldSet(tp,this,document.createElement("div"));a.className="commentPopupButtons";const s=document.createElement("button");s.classList.add("commentPopupEdit","toolbarButton");s.tabIndex=0;s.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-popup-button");s.ariaHasPopup="dialog";s.ariaControlsElements=[comment_manager_classPrivateFieldGet(ap,this)];const n=document.createElement("span");n.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-popup-button-label");s.append(n);s.addEventListener("click",()=>{const e=comment_manager_classPrivateFieldGet(np,this),t=parseFloat(getComputedStyle(comment_manager_classPrivateFieldGet(lp,this)).height);this.toggle(e,!0,!1);e.editComment({height:t})});s.addEventListener("contextmenu",noContextMenu);const r=document.createElement("button");r.classList.add("commentPopupDelete","toolbarButton");r.tabIndex=0;r.setAttribute("data-l10n-id","pdfjs-editor-delete-comment-popup-button");const o=document.createElement("span");o.setAttribute("data-l10n-id","pdfjs-editor-delete-comment-popup-button-label");r.append(o);r.addEventListener("click",()=>{comment_manager_classPrivateFieldGet(ip,this).dispatch("reporttelemetry",{source:this,details:{type:"comment",data:{deleted:!0}}});const e=comment_manager_classPrivateFieldGet(np,this),t=e.comment;comment_manager_classPrivateFieldGet(ip,this)?.dispatch("annotation-editor-event",{source:this,type:"commentRemoved",page:e.pageIndex+1,id:e.uid,editorType:e.constructor.name,value:e});this.destroy();t?.text?e._uiManager.deleteComment(e,t):e.comment=null;e.focus()});r.addEventListener("contextmenu",noContextMenu);a.append(s,r);t.append(i,a);const l=document.createElement("hr"),d=comment_manager_classPrivateFieldSet(lp,this,document.createElement("div"));d.className="commentPopupText";e.append(t,l,d);let c;const cancelDrag=()=>{e.classList.remove("dragging");c?.abort();c=null};t.addEventListener("pointerdown",t=>{if(c){cancelDrag();return}const{target:i,clientX:s,clientY:n}=t;if(a.contains(i))return;stopEvent(t);const{width:r,height:o}=comment_manager_classPrivateFieldGet(np,this).parentBoundingClientRect;comment_manager_classPrivateFieldSet(cp,this,s);comment_manager_classPrivateFieldSet(hp,this,n);c=new AbortController;const{signal:l}=c;e.classList.add("dragging");window.addEventListener("pointermove",e=>{if(!c)return;const{clientX:t,clientY:i}=e;comment_manager_assertClassBrand(mp,this,_setPosition2).call(this,comment_manager_classPrivateFieldGet(up,this)+(t-comment_manager_classPrivateFieldGet(cp,this))/r,comment_manager_classPrivateFieldGet(_p,this)+(i-comment_manager_classPrivateFieldGet(hp,this))/o,!1);comment_manager_classPrivateFieldSet(cp,this,t);comment_manager_classPrivateFieldSet(hp,this,i);stopEvent(e)},{signal:l});window.addEventListener("blur",cancelDrag,{signal:l});window.addEventListener("pointerup",e=>{if(c){cancelDrag();stopEvent(e)}},{signal:l})});return e}function _setPosition2(e,t,i){if(i){const t=comment_manager_classPrivateFieldGet(np,this).parentBoundingClientRect,i=this._popupWidth/t.width;if(comment_manager_classPrivateFieldGet(rp,this)&&e+i>1||!comment_manager_classPrivateFieldGet(rp,this)&&e-i>=0){e-=i-comment_manager_classPrivateFieldGet(np,this).commentButtonWidth}const a=.02;e=comment_manager_classPrivateFieldGet(rp,this)?Math.max(e,-t.x/t.width+a):Math.min(e,(window.innerWidth-t.x)/t.width-i-a)}else comment_manager_classPrivateFieldGet(np,this).commentPopupPosition=[e,t];comment_manager_classPrivateFieldSet(up,this,e);comment_manager_classPrivateFieldSet(_p,this,t);const{style:a}=comment_manager_classPrivateFieldGet(op,this);a.left=100*e+"%";a.top=100*t+"%"}function base_download_manager_classPrivateFieldInitSpec(e,t,i){(function base_download_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function base_download_manager_classPrivateFieldGet(e,t){return e.get(function base_download_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}(e,t))}var vp=new WeakMap;class BaseDownloadManager{constructor(){base_download_manager_classPrivateFieldInitSpec(this,vp,new WeakMap)}_triggerDownload(e,t,i){throw new Error("Not implemented: _triggerDownload")}_getOpenDataUrl(e,t){throw new Error("Not implemented: _getOpenDataUrl")}downloadData(e,t,i){const a=URL.createObjectURL(new Blob([e],{type:i}));this._triggerDownload(a,a,t,!0)}openOrDownloadData(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const a=isPdfFile(t),s=a?"application/pdf":"";if(a){const a=base_download_manager_classPrivateFieldGet(vp,this).getOrInsertComputed(e,()=>URL.createObjectURL(new Blob([e],{type:s})));try{const e=this._getOpenDataUrl(a,t,i);window.open(e);return!0}catch(t){console.error("openOrDownloadData:",t);URL.revokeObjectURL(a);base_download_manager_classPrivateFieldGet(vp,this).delete(e)}}this.downloadData(e,t,s);return!1}download(e,t,i){const a=e?URL.createObjectURL(new Blob([e],{type:"application/pdf"})):null;this._triggerDownload(a,t,i)}}class DownloadManager extends BaseDownloadManager{_triggerDownload(e,t,i){if(!e&&!(arguments.length>3&&void 0!==arguments[3]&&arguments[3])){if(!createValidAbsoluteUrl(t,"http://example.com"))throw new Error(`_triggerDownload - not a valid URL: ${t}`);e=t+"#pdfjs.action=download"}const a=document.createElement("a");a.href=e;a.target="_parent";"download"in a&&(a.download=i);(document.body||document.documentElement).append(a);a.click();a.remove()}_getOpenDataUrl(e,t){return e}}function editor_undo_bar_defineProperty(e,t,i){return(t=function editor_undo_bar_toPropertyKey(e){var t=function editor_undo_bar_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function editor_undo_bar_classPrivateFieldInitSpec(e,t,i){(function editor_undo_bar_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function editor_undo_bar_classPrivateFieldGet(e,t){return e.get(editor_undo_bar_assertClassBrand(e,t))}function editor_undo_bar_classPrivateFieldSet(e,t,i){return e.set(editor_undo_bar_assertClassBrand(e,t),i),i}function editor_undo_bar_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Pp=new WeakMap,wp=new WeakMap,Fp=new WeakMap,bp=new WeakMap,yp=new WeakMap,Sp=new WeakMap,Cp=new WeakMap,xp=new WeakMap;class EditorUndoBar{constructor(e,t){let{container:i,message:a,undoButton:s,closeButton:n}=e;editor_undo_bar_classPrivateFieldInitSpec(this,Pp,null);editor_undo_bar_classPrivateFieldInitSpec(this,wp,void 0);editor_undo_bar_classPrivateFieldInitSpec(this,Fp,null);editor_undo_bar_classPrivateFieldInitSpec(this,bp,null);editor_undo_bar_classPrivateFieldInitSpec(this,yp,null);editor_undo_bar_defineProperty(this,"isOpen",!1);editor_undo_bar_classPrivateFieldInitSpec(this,Sp,void 0);editor_undo_bar_classPrivateFieldInitSpec(this,Cp,null);editor_undo_bar_classPrivateFieldInitSpec(this,xp,void 0);editor_undo_bar_classPrivateFieldSet(wp,this,i);editor_undo_bar_classPrivateFieldSet(Sp,this,a);editor_undo_bar_classPrivateFieldSet(xp,this,s);editor_undo_bar_classPrivateFieldSet(Pp,this,n);editor_undo_bar_classPrivateFieldSet(Fp,this,t)}destroy(){editor_undo_bar_classPrivateFieldGet(yp,this)?.abort();editor_undo_bar_classPrivateFieldSet(yp,this,null);this.hide()}show(e,t){if(!editor_undo_bar_classPrivateFieldGet(yp,this)){editor_undo_bar_classPrivateFieldSet(yp,this,new AbortController);const e={signal:editor_undo_bar_classPrivateFieldGet(yp,this).signal},t=this.hide.bind(this);editor_undo_bar_classPrivateFieldGet(wp,this).addEventListener("contextmenu",noContextMenu,e);editor_undo_bar_classPrivateFieldGet(Pp,this).addEventListener("click",t,e);editor_undo_bar_classPrivateFieldGet(Fp,this)._on("beforeprint",t,e);editor_undo_bar_classPrivateFieldGet(Fp,this)._on("download",t,e)}this.hide();if("string"==typeof t)editor_undo_bar_classPrivateFieldGet(Sp,this).setAttribute("data-l10n-id",kp._[t]);else{editor_undo_bar_classPrivateFieldGet(Sp,this).setAttribute("data-l10n-id",kp._._multiple);editor_undo_bar_classPrivateFieldGet(Sp,this).setAttribute("data-l10n-args",JSON.stringify({count:t}))}this.isOpen=!0;editor_undo_bar_classPrivateFieldGet(wp,this).hidden=!1;editor_undo_bar_classPrivateFieldSet(Cp,this,new AbortController);editor_undo_bar_classPrivateFieldGet(xp,this).addEventListener("click",()=>{e();this.hide()},{signal:editor_undo_bar_classPrivateFieldGet(Cp,this).signal});editor_undo_bar_classPrivateFieldSet(bp,this,setTimeout(()=>{editor_undo_bar_classPrivateFieldGet(wp,this).contains(document.activeElement)||editor_undo_bar_classPrivateFieldGet(wp,this).focus();editor_undo_bar_classPrivateFieldSet(bp,this,null)},100))}hide(){if(this.isOpen){this.isOpen=!1;editor_undo_bar_classPrivateFieldGet(wp,this).hidden=!0;editor_undo_bar_classPrivateFieldGet(Cp,this)?.abort();editor_undo_bar_classPrivateFieldSet(Cp,this,null);if(editor_undo_bar_classPrivateFieldGet(bp,this)){clearTimeout(editor_undo_bar_classPrivateFieldGet(bp,this));editor_undo_bar_classPrivateFieldSet(bp,this,null)}}}}var kp={_:Object.freeze({highlight:"pdfjs-editor-undo-bar-message-highlight",freetext:"pdfjs-editor-undo-bar-message-freetext",stamp:"pdfjs-editor-undo-bar-message-stamp",ink:"pdfjs-editor-undo-bar-message-ink",signature:"pdfjs-editor-undo-bar-message-signature",comment:"pdfjs-editor-undo-bar-message-comment",_multiple:"pdfjs-editor-undo-bar-message-multiple"})};function overlay_manager_classPrivateFieldInitSpec(e,t,i){(function overlay_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function overlay_manager_classPrivateFieldSet(e,t,i){return e.set(overlay_manager_assertClassBrand(e,t),i),i}function overlay_manager_classPrivateFieldGet(e,t){return e.get(overlay_manager_assertClassBrand(e,t))}function overlay_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Ep=new WeakMap,Ap=new WeakMap;class OverlayManager{constructor(){overlay_manager_classPrivateFieldInitSpec(this,Ep,new WeakMap);overlay_manager_classPrivateFieldInitSpec(this,Ap,null)}get active(){return overlay_manager_classPrivateFieldGet(Ap,this)}async register(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("object"!=typeof e)throw new Error("Not enough parameters.");if(overlay_manager_classPrivateFieldGet(Ep,this).has(e))throw new Error("The overlay is already registered.");overlay_manager_classPrivateFieldGet(Ep,this).set(e,{canForceClose:t});e.addEventListener("cancel",e=>{let{target:t}=e;overlay_manager_classPrivateFieldGet(Ap,this)===t&&overlay_manager_classPrivateFieldSet(Ap,this,null)})}unregister(e){if(!overlay_manager_classPrivateFieldGet(Ep,this).has(e))throw new Error("The overlay does not exist.");overlay_manager_classPrivateFieldGet(Ep,this).delete(e)}async open(e){if(!overlay_manager_classPrivateFieldGet(Ep,this).has(e))throw new Error("The overlay does not exist.");if(overlay_manager_classPrivateFieldGet(Ap,this)){if(overlay_manager_classPrivateFieldGet(Ap,this)===e)throw new Error("The overlay is already active.");if(!overlay_manager_classPrivateFieldGet(Ep,this).get(e).canForceClose)throw new Error("Another overlay is currently active.");await this.close()}overlay_manager_classPrivateFieldSet(Ap,this,e);e.showModal();e.classList.remove("hidden")}async close(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:overlay_manager_classPrivateFieldGet(Ap,this),t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!overlay_manager_classPrivateFieldGet(Ep,this).has(e)){if(t)return;throw new Error("The overlay does not exist.")}if(!overlay_manager_classPrivateFieldGet(Ap,this)){if(t)return;throw new Error("The overlay is currently not active.")}if(overlay_manager_classPrivateFieldGet(Ap,this)!==e){if(t)return;throw new Error("Another overlay is currently active.")}e.close();overlay_manager_classPrivateFieldSet(Ap,this,null)}async closeIfActive(e){overlay_manager_classPrivateFieldGet(Ap,this)===e&&await this.close(e)}}function password_prompt_classPrivateFieldInitSpec(e,t,i){password_prompt_checkPrivateRedeclaration(e,t),t.set(e,i)}function password_prompt_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function password_prompt_classPrivateFieldSet(e,t,i){return e.set(password_prompt_assertClassBrand(e,t),i),i}function password_prompt_classPrivateFieldGet(e,t){return e.get(password_prompt_assertClassBrand(e,t))}function password_prompt_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Gp=new WeakMap,Bp=new WeakMap,Mp=new WeakMap,Ip=new WeakSet;class PasswordPrompt{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];!function password_prompt_classPrivateMethodInitSpec(e,t){password_prompt_checkPrivateRedeclaration(e,t),t.add(e)}(this,Ip);password_prompt_classPrivateFieldInitSpec(this,Gp,null);password_prompt_classPrivateFieldInitSpec(this,Bp,null);password_prompt_classPrivateFieldInitSpec(this,Mp,null);this.dialog=e.dialog;this.label=e.label;this.input=e.input;this.submitButton=e.submitButton;this.cancelButton=e.cancelButton;this.overlayManager=t;this._isViewerEmbedded=i;this.submitButton.addEventListener("click",password_prompt_assertClassBrand(Ip,this,_verify).bind(this));this.cancelButton.addEventListener("click",this.close.bind(this));this.input.addEventListener("keydown",e=>{13===e.keyCode&&password_prompt_assertClassBrand(Ip,this,_verify).call(this)});this.overlayManager.register(this.dialog,!0);this.dialog.addEventListener("close",password_prompt_assertClassBrand(Ip,this,password_prompt_cancel).bind(this))}async open(){await(password_prompt_classPrivateFieldGet(Gp,this)?.promise);password_prompt_classPrivateFieldSet(Gp,this,Promise.withResolvers());try{await this.overlayManager.open(this.dialog);this.input.type="password";this.input.focus()}catch(e){password_prompt_classPrivateFieldGet(Gp,this).resolve();throw e}const e=password_prompt_classPrivateFieldGet(Mp,this)===V.INCORRECT_PASSWORD;this._isViewerEmbedded&&!e||this.input.focus();this.label.setAttribute("data-l10n-id",e?"pdfjs-password-invalid":"pdfjs-password-label")}async close(){this.overlayManager.closeIfActive(this.dialog);this.input.value="";this.input.type="text"}async setUpdateCallback(e,t){password_prompt_classPrivateFieldGet(Gp,this)&&await password_prompt_classPrivateFieldGet(Gp,this).promise;password_prompt_classPrivateFieldSet(Bp,this,e);password_prompt_classPrivateFieldSet(Mp,this,t)}}function _verify(){const e=this.input.value;e?.length>0&&password_prompt_assertClassBrand(Ip,this,_invokeCallback).call(this,e)}function password_prompt_cancel(){password_prompt_assertClassBrand(Ip,this,_invokeCallback).call(this,new Error("PasswordPrompt cancelled."));password_prompt_classPrivateFieldGet(Gp,this).resolve()}function _invokeCallback(e){if(password_prompt_classPrivateFieldGet(Bp,this)){this.close();this.input.value="";password_prompt_classPrivateFieldGet(Bp,this).call(this,e);password_prompt_classPrivateFieldSet(Bp,this,null)}}const Tp="selected";class BaseTreeViewer{constructor(e){this.container=e.container;this.eventBus=e.eventBus;this._l10n=e.l10n;this.reset()}reset(){this._pdfDocument=null;this._lastToggleIsShow=!0;this._currentTreeItem=null;this.container.replaceChildren();this.container.classList.remove("withNesting")}_dispatchEvent(e){throw new Error("Not implemented: _dispatchEvent")}_bindLink(e,t){throw new Error("Not implemented: _bindLink")}_normalizeTextContent(e){return removeNullCharacters(e,!0)||"–"}_addToggleButton(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("div");i.className="treeItemToggler";t&&i.classList.add("treeItemsHidden");e.prepend(i)}_toggleTreeItem(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._l10n.pause();this._lastToggleIsShow=t;for(const i of e.querySelectorAll(".treeItemToggler"))i.classList.toggle("treeItemsHidden",!t);this._l10n.resume()}_toggleAllTreeItems(){this._toggleTreeItem(this.container,!this._lastToggleIsShow)}_finishRendering(e,t){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){this.container.classList.add("withNesting");this._lastToggleIsShow=!e.querySelector(".treeItemsHidden");this.container.addEventListener("click",e=>{const{target:t}=e;if(t.classList.contains("treeItemToggler")){stopEvent(e);t.classList.toggle("treeItemsHidden");if(e.shiftKey){const e=!t.classList.contains("treeItemsHidden");this._toggleTreeItem(t.parentNode,e)}}})}this._l10n.pause();this.container.append(e);this._l10n.resume();this._dispatchEvent(t)}render(e){throw new Error("Not implemented: render")}_updateCurrentTreeItem(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this._currentTreeItem){this._currentTreeItem.classList.remove(Tp);this._currentTreeItem=null}if(e){e.classList.add(Tp);this._currentTreeItem=e}}_scrollToCurrentTreeItem(e){if(!e)return;this._l10n.pause();let t=e.parentNode;for(;t&&t!==this.container;){if(t.classList.contains("treeItem")){const e=t.firstElementChild;e?.classList.remove("treeItemsHidden")}t=t.parentNode}this._l10n.resume();this._updateCurrentTreeItem(e);e.scrollIntoView({behavior:"instant",block:"center",inline:"center",container:"nearest"})}}function pdf_attachment_viewer_classPrivateMethodInitSpec(e,t){(function pdf_attachment_viewer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}var Dp=new WeakSet;class PDFAttachmentViewer extends BaseTreeViewer{constructor(e){super(e);pdf_attachment_viewer_classPrivateMethodInitSpec(this,Dp);this.downloadManager=e.downloadManager;this.eventBus._on("fileattachmentannotation",function pdf_attachment_viewer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}(Dp,this,_appendAttachment).bind(this))}reset(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super.reset();this._attachments=null;e||(this._renderedCapability=Promise.withResolvers());this._pendingDispatchEvent=!1}async _dispatchEvent(e){this._renderedCapability.resolve();if(0===e&&!this._pendingDispatchEvent){this._pendingDispatchEvent=!0;await waitOnEventOrTimeout({target:this.eventBus,name:"annotationlayerrendered",delay:1e3});if(!this._pendingDispatchEvent)return}this._pendingDispatchEvent=!1;this.eventBus.dispatch("attachmentsloaded",{source:this,attachmentsCount:e})}_bindLink(e,t){let{content:i,description:a,filename:s}=t;a&&(e.title=a);e.onclick=()=>{this.downloadManager.openOrDownloadData(i,s);return!1}}render(e){let{attachments:t,keepRenderedCapability:i=!1}=e;this._attachments&&this.reset(i);this._attachments=t||null;if(!t){this._dispatchEvent(0);return}const a=document.createDocumentFragment(),s=document.createElement("ul");a.append(s);let n=0;for(const e in t){const i=t[e],a=document.createElement("li");s.append(a);const r=document.createElement("a");a.append(r);this._bindLink(r,i);r.textContent=this._normalizeTextContent(i.filename);n++}this._finishRendering(a,n)}}function _appendAttachment(e){const t=this._renderedCapability.promise;t.then(()=>{if(t!==this._renderedCapability.promise)return;const i=this._attachments||Object.create(null);for(const t in i)if(e.filename===t)return;i[e.filename]=e;this.render({attachments:i,keepRenderedCapability:!0})})}function grab_to_pan_classPrivateFieldInitSpec(e,t,i){grab_to_pan_checkPrivateRedeclaration(e,t),t.set(e,i)}function grab_to_pan_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function grab_to_pan_classPrivateFieldSet(e,t,i){return e.set(grab_to_pan_assertClassBrand(e,t),i),i}function grab_to_pan_classPrivateFieldGet(e,t){return e.get(grab_to_pan_assertClassBrand(e,t))}function grab_to_pan_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Lp="grab-to-pan-grab";var Rp=new WeakMap,Np=new WeakMap,Op=new WeakMap,Wp=new WeakSet;class GrabToPan{constructor(e){let{element:t}=e;!function grab_to_pan_classPrivateMethodInitSpec(e,t){grab_to_pan_checkPrivateRedeclaration(e,t),t.add(e)}(this,Wp);grab_to_pan_classPrivateFieldInitSpec(this,Rp,null);grab_to_pan_classPrivateFieldInitSpec(this,Np,null);grab_to_pan_classPrivateFieldInitSpec(this,Op,null);this.element=t;this.document=t.ownerDocument;(this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}activate(){if(!grab_to_pan_classPrivateFieldGet(Rp,this)){grab_to_pan_classPrivateFieldSet(Rp,this,new AbortController);this.element.addEventListener("mousedown",grab_to_pan_assertClassBrand(Wp,this,_onMouseDown).bind(this),{capture:!0,signal:grab_to_pan_classPrivateFieldGet(Rp,this).signal});this.element.classList.add(Lp)}}deactivate(){if(grab_to_pan_classPrivateFieldGet(Rp,this)){grab_to_pan_classPrivateFieldGet(Rp,this).abort();grab_to_pan_classPrivateFieldSet(Rp,this,null);grab_to_pan_assertClassBrand(Wp,this,_endPan).call(this);this.element.classList.remove(Lp)}}toggle(){grab_to_pan_classPrivateFieldGet(Rp,this)?this.deactivate():this.activate()}ignoreTarget(e){return e.matches("a[href], a[href] *, input, textarea, button, button *, select, option")}}function _onMouseDown(e){if(0!==e.button||this.ignoreTarget(e.target))return;if(e.originalTarget)try{e.originalTarget.tagName}catch{return}this.scrollLeftStart=this.element.scrollLeft;this.scrollTopStart=this.element.scrollTop;this.clientXStart=e.clientX;this.clientYStart=e.clientY;if(isOverPerfectScrollbar(this.clientXStart,this.clientYStart,"ps__rail-x"))return;if(isOverPerfectScrollbar(this.clientXStart,this.clientYStart,"ps__rail-y"))return;grab_to_pan_classPrivateFieldSet(Np,this,new AbortController);const t=grab_to_pan_assertClassBrand(Wp,this,_endPan).bind(this),i={capture:!0,signal:grab_to_pan_classPrivateFieldGet(Np,this).signal};this.document.addEventListener("mousemove",grab_to_pan_assertClassBrand(Wp,this,_onMouseMove).bind(this),i);this.document.addEventListener("mouseup",t,i);grab_to_pan_classPrivateFieldSet(Op,this,new AbortController);this.element.addEventListener("scroll",t,{capture:!0,signal:grab_to_pan_classPrivateFieldGet(Op,this).signal});stopEvent(e);const a=document.activeElement;a&&!a.contains(e.target)&&a.blur()}function _onMouseMove(e){grab_to_pan_classPrivateFieldGet(Op,this)?.abort();grab_to_pan_classPrivateFieldSet(Op,this,null);if(!(1&e.buttons)){grab_to_pan_assertClassBrand(Wp,this,_endPan).call(this);return}const t=e.clientX-this.clientXStart,i=e.clientY-this.clientYStart;this.element.scrollTo({top:this.scrollTopStart-i,left:this.scrollLeftStart-t,behavior:"instant"});this.overlay.parentNode||document.body.append(this.overlay)}function _endPan(){grab_to_pan_classPrivateFieldGet(Np,this)?.abort();grab_to_pan_classPrivateFieldSet(Np,this,null);grab_to_pan_classPrivateFieldGet(Op,this)?.abort();grab_to_pan_classPrivateFieldSet(Op,this,null);this.overlay.remove()}function isOverPerfectScrollbar(e,t,i){const a=document.getElementsByClassName(i);if(a&&1===a.length){var{top:s,right:n,bottom:r,left:o}=a[0].getBoundingClientRect();if(t>=s&&t<=r&&e<=n&&e>=o)return!0}return!1}function pdf_cursor_tools_classPrivateFieldInitSpec(e,t,i){pdf_cursor_tools_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_cursor_tools_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_cursor_tools_classPrivateFieldSet(e,t,i){return e.set(pdf_cursor_tools_assertClassBrand(e,t),i),i}function pdf_cursor_tools_classPrivateFieldGet(e,t){return e.get(pdf_cursor_tools_assertClassBrand(e,t))}function pdf_cursor_tools_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var jp=new WeakMap,Vp=new WeakMap,Up=new WeakSet;class PDFCursorTools{constructor(e){let{container:t,eventBus:i,cursorToolOnLoad:a=Jc.SELECT}=e;!function pdf_cursor_tools_classPrivateMethodInitSpec(e,t){pdf_cursor_tools_checkPrivateRedeclaration(e,t),t.add(e)}(this,Up);pdf_cursor_tools_classPrivateFieldInitSpec(this,jp,Jc.SELECT);pdf_cursor_tools_classPrivateFieldInitSpec(this,Vp,null);this.container=t;this.eventBus=i;pdf_cursor_tools_assertClassBrand(Up,this,pdf_cursor_tools_addEventListeners).call(this);Promise.resolve().then(()=>{this.switchTool(a)})}get activeTool(){return pdf_cursor_tools_classPrivateFieldGet(jp,this)}switchTool(e){null===pdf_cursor_tools_classPrivateFieldGet(Vp,this)&&pdf_cursor_tools_assertClassBrand(Up,this,_switchTool).call(this,e)}get _handTool(){return shadow(this,"_handTool",new GrabToPan({element:this.container}))}}function _switchTool(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e===pdf_cursor_tools_classPrivateFieldGet(jp,this)){null!==pdf_cursor_tools_classPrivateFieldGet(Vp,this)&&this.eventBus.dispatch("cursortoolchanged",{source:this,tool:e,disabled:t});return}const disableActiveTool=()=>{switch(pdf_cursor_tools_classPrivateFieldGet(jp,this)){case Jc.SELECT:break;case Jc.HAND:this._handTool.deactivate();case Jc.PAGE_FLIP:case Jc.ZOOM:}};switch(e){case Jc.SELECT:disableActiveTool();break;case Jc.HAND:disableActiveTool();this._handTool.activate();break;case Jc.PAGE_FLIP:disableActiveTool();break;case Jc.ZOOM:default:ngx_console_NgxConsole.error(`switchTool: "${e}" is an unsupported value.`);return}pdf_cursor_tools_classPrivateFieldSet(jp,this,e);this.eventBus.dispatch("cursortoolchanged",{source:this,tool:e,disabled:t})}function pdf_cursor_tools_addEventListeners(){this.eventBus._on("switchcursortool",i=>{if(i.reset){if(null!==pdf_cursor_tools_classPrivateFieldGet(Vp,this)){e=f.NONE;t=Nc;enableActive()}}else this.switchTool(i.tool)});let e=f.NONE,t=Nc;const disableActive=()=>{pdf_cursor_tools_classPrivateFieldGet(Vp,this)??pdf_cursor_tools_classPrivateFieldSet(Vp,this,pdf_cursor_tools_classPrivateFieldGet(jp,this));pdf_cursor_tools_assertClassBrand(Up,this,_switchTool).call(this,Jc.SELECT,!0)},enableActive=()=>{if(null!==pdf_cursor_tools_classPrivateFieldGet(Vp,this)&&e===f.NONE&&t===Nc){pdf_cursor_tools_assertClassBrand(Up,this,_switchTool).call(this,pdf_cursor_tools_classPrivateFieldGet(Vp,this));pdf_cursor_tools_classPrivateFieldSet(Vp,this,null)}};this.eventBus._on("annotationeditormodechanged",t=>{let{mode:i}=t;e=i;i===f.NONE?enableActive():disableActive()});this.eventBus._on("presentationmodechanged",e=>{let{state:i}=e;t=i;i===Nc?enableActive():i===Wc&&disableActive()})}function pdf_document_properties_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_document_properties_classPrivateFieldSet(e,t,i){return e.set(pdf_document_properties_assertClassBrand(e,t),i),i}function pdf_document_properties_classPrivateFieldGet(e,t){return e.get(pdf_document_properties_assertClassBrand(e,t))}function pdf_document_properties_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const zp=["en-us","en-lr","my"],Hp={"8.5x11":"pdfjs-document-properties-page-size-name-letter","8.5x14":"pdfjs-document-properties-page-size-name-legal"},$p={"297x420":"pdfjs-document-properties-page-size-name-a-three","210x297":"pdfjs-document-properties-page-size-name-a-four"};function getPageName(e,t,i){return i[`${t?e.width:e.height}x${t?e.height:e.width}`]}var qp=new WeakMap,Xp=new WeakSet;class PDFDocumentProperties{constructor(e,t,i,a,s,n){let{dialog:r,fields:o,closeButton:l}=e;!function pdf_document_properties_classPrivateMethodInitSpec(e,t){pdf_document_properties_checkPrivateRedeclaration(e,t),t.add(e)}(this,Xp);!function pdf_document_properties_classPrivateFieldInitSpec(e,t,i){pdf_document_properties_checkPrivateRedeclaration(e,t),t.set(e,i)}(this,qp,null);this.dialog=r;this.fields=o;this.overlayManager=t;this.l10n=a;this._fileNameLookup=s;this.eventBus=i;this._titleLookup=n;pdf_document_properties_assertClassBrand(Xp,this,_reset).call(this);l.addEventListener("click",this.close.bind(this));this.overlayManager.register(this.dialog);i._on("pagechanging",e=>{this._currentPageNumber=e.pageNumber});i._on("rotationchanging",e=>{this._pagesRotation=e.pagesRotation})}async open(){await Promise.all([this.overlayManager.open(this.dialog),this._dataAvailableCapability.promise]);this.eventBus.dispatch("propertiesdialogopen",this);const e=this._currentPageNumber,t=this._pagesRotation;if(pdf_document_properties_classPrivateFieldGet(qp,this)&&e===pdf_document_properties_classPrivateFieldGet(qp,this)._currentPageNumber&&t===pdf_document_properties_classPrivateFieldGet(qp,this)._pagesRotation){pdf_document_properties_assertClassBrand(Xp,this,_updateUI).call(this);return}const[{info:i,metadata:a,contentLength:s},n]=await Promise.all([this.pdfDocument.getMetadata(),this.pdfDocument.getPage(e)]),[r,o,l,d,c,h,u]=await Promise.all([this._fileNameLookup(),pdf_document_properties_assertClassBrand(Xp,this,_parseFileSize).call(this,s),this._titleLookup(),pdf_document_properties_assertClassBrand(Xp,this,_parseDate).call(this,a?.get("xmp:createdate"),i.CreationDate),pdf_document_properties_assertClassBrand(Xp,this,_parseDate).call(this,a?.get("xmp:modifydate"),i.ModDate),pdf_document_properties_assertClassBrand(Xp,this,_parsePageSize).call(this,getPageSizeInches(n),t),pdf_document_properties_assertClassBrand(Xp,this,_parseLinearization).call(this,i.IsLinearized)]);pdf_document_properties_classPrivateFieldSet(qp,this,Object.freeze({fileName:r,fileSize:o,title:l,author:a?.get("dc:creator")?.join("\n")||i.Author,subject:a?.get("dc:subject")?.join("\n")||i.Subject,keywords:a?.get("pdf:keywords")||i.Keywords,creationDate:d,modificationDate:c,creator:a?.get("xmp:creatortool")||i.Creator,producer:a?.get("pdf:producer")||i.Producer,version:i.PDFFormatVersion,pageCount:this.pdfDocument.numPages,pageSize:h,linearized:u,_currentPageNumber:e,_pagesRotation:t}));pdf_document_properties_assertClassBrand(Xp,this,_updateUI).call(this);const{length:_}=await this.pdfDocument.getDownloadInfo();if(s===_)return;const p=Object.assign(Object.create(null),pdf_document_properties_classPrivateFieldGet(qp,this));p.fileSize=await pdf_document_properties_assertClassBrand(Xp,this,_parseFileSize).call(this,_);pdf_document_properties_classPrivateFieldSet(qp,this,Object.freeze(p));pdf_document_properties_assertClassBrand(Xp,this,_updateUI).call(this)}async close(){this.overlayManager.close(this.dialog,!0);this.eventBus.dispatch("propertiesdialogclose",this)}setDocument(e){if(this.pdfDocument){pdf_document_properties_assertClassBrand(Xp,this,_reset).call(this);pdf_document_properties_assertClassBrand(Xp,this,_updateUI).call(this)}if(e){this.pdfDocument=e;this._dataAvailableCapability.resolve()}}}function _reset(){this.pdfDocument=null;pdf_document_properties_classPrivateFieldSet(qp,this,null);this._dataAvailableCapability=Promise.withResolvers();this._currentPageNumber=1;this._pagesRotation=0}function _updateUI(){if(!pdf_document_properties_classPrivateFieldGet(qp,this)||this.overlayManager.active===this.dialog)for(const e in this.fields){const t=pdf_document_properties_classPrivateFieldGet(qp,this)?.[e];this.fields[e].textContent=t||0===t?t:"-"}}async function _parseFileSize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=e/1024,i=t/1024;return t?this.l10n.get(i>=1?"pdfjs-document-properties-size-mb":"pdfjs-document-properties-size-kb",{mb:i,kb:t,b:e}):void 0}async function _parsePageSize(e,t){if(!e)return;t%180!=0&&(e={width:e.height,height:e.width});const i=isPortraitOrientation(e),a=zp.includes(this.l10n.getLanguage());let s={width:Math.round(100*e.width)/100,height:Math.round(100*e.height)/100},n={width:Math.round(25.4*e.width*10)/10,height:Math.round(25.4*e.height*10)/10},r=getPageName(s,i,Hp)||getPageName(n,i,$p);if(!(r||Number.isInteger(n.width)&&Number.isInteger(n.height))){const t={width:25.4*e.width,height:25.4*e.height},a={width:Math.round(n.width),height:Math.round(n.height)};if(Math.abs(t.width-a.width)<.1&&Math.abs(t.height-a.height)<.1){r=getPageName(a,i,$p);if(r){s={width:Math.round(a.width/25.4*100)/100,height:Math.round(a.height/25.4*100)/100};n=a}}}const[{width:o,height:l},d,c,h]=await Promise.all([a?s:n,this.l10n.get(a?"pdfjs-document-properties-page-size-unit-inches":"pdfjs-document-properties-page-size-unit-millimeters"),r&&this.l10n.get(r),this.l10n.get(i?"pdfjs-document-properties-page-size-orientation-portrait":"pdfjs-document-properties-page-size-orientation-landscape")]);return this.l10n.get(c?"pdfjs-document-properties-page-size-dimension-name-string":"pdfjs-document-properties-page-size-dimension-string",{width:o,height:l,unit:d,name:c,orientation:h})}async function _parseDate(e,t){const i=Date.parse(e)||PDFDateString.toDateObject(t);return i?this.l10n.get("pdfjs-document-properties-date-time-string",{dateObj:i.valueOf()}):void 0}function _parseLinearization(e){return this.l10n.get(e?"pdfjs-document-properties-linearized-yes":"pdfjs-document-properties-linearized-no")}__webpack_require__(6069);const Kp=0,Yp=1,Zp=2,Jp=3,Qp=4,eg=5,tg=6,ig=7;function getCharacterType(e){return function isAlphabeticalScript(e){return e<11904}(e)?function isAscii(e){return!(65408&e)}(e)?function isAsciiSpace(e){return 32===e||9===e||13===e||10===e}(e)?Kp:function isAsciiAlpha(e){return e>=97&&e<=122||e>=65&&e<=90}(e)||function isAsciiDigit(e){return e>=48&&e<=57}(e)||95===e?Yp:Zp:function isThai(e){return 3584==(65408&e)}(e)?ig:160===e?Kp:Yp:function isHan(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}(e)?Jp:function isKatakana(e){return e>=12448&&e<=12543}(e)?Qp:function isHiragana(e){return e>=12352&&e<=12447}(e)?eg:function isHalfwidthKatakana(e){return e>=65376&&e<=65439}(e)?tg:Yp}let ag;function pdf_find_controller_classPrivateFieldInitSpec(e,t,i){pdf_find_controller_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_find_controller_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_find_controller_classPrivateGetter(e,t,i){return i(pdf_find_controller_assertClassBrand(e,t))}function pdf_find_controller_classPrivateFieldGet(e,t){return e.get(pdf_find_controller_assertClassBrand(e,t))}function pdf_find_controller_classPrivateFieldSet(e,t,i){return e.set(pdf_find_controller_assertClassBrand(e,t),i),i}function pdf_find_controller_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const sg=0,ng=1,rg=2,og=3,lg={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"},dg=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]);let cg;const hg=/\p{M}+/gu,ug=/([+^$|])|(\p{P}+)|(\s+)|(\p{M})|(\p{L})/gu,_g=/([^\p{M}])\p{M}*$/u,pg=/^\p{M}*([^\p{M}])/u,gg=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,fg=new Map,mg=new Map;let vg=null,Pg=null;function normalize(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=[];let a;for(;null!==(a=gg.exec(e));){let{index:e}=a;for(const t of a[0]){let a=fg.get(t);if(!a){a=t.normalize("NFD").length;fg.set(t,a)}i.push([a,e++])}}const s=i.length>0,n=t.ignoreDashEOL??!1;let r;if(!s&&vg)r=vg;else if(s&&Pg)r=Pg;else{const e=Object.keys(lg).join(""),t=function getNormalizeWithNFKC(){if(!ag){const e=[],t=[],i=/^\p{M}$/u;for(let a=0;a<65536;a++){if(a>=55296&&a<=57343)continue;const s=String.fromCharCode(a);if(s.normalize("NFKC")!==s&&!i.test(s)){if(2!==t.length){t[0]=t[1]=a;continue}if(t[1]+1!==a){t[0]===t[1]?e.push(String.fromCharCode(t[0])):e.push(`${String.fromCharCode(t[0])}-${String.fromCharCode(t[1])}`);t[0]=t[1]=a}else t[1]=a}}const a=e.join("");if(ag){if(a!==ag){for(let e=1;e<a.length;e++)if(a[e]!==ag[e]){console.log(`Difference at index ${e}: U+${a.charCodeAt(e).toString(16).toUpperCase().padStart(4,"0")}!== U+${ag.charCodeAt(e).toString(16).toUpperCase().padStart(4,"0")}`);break}throw new Error("getNormalizeWithNFKC - update the `NormalizeWithNFKC` string.")}}else ag=a}return ag}();r=new RegExp([`[${e}]`,`[${t}]`,`${"(?:゙|゚)"}\\n`,"\\p{M}+(?:-\\n)?",`${"\\p{Ll}-\\n(?=\\p{Ll})|\\p{Lu}-\\n(?=\\p{L})"}`,"\\S-\\n",`${"(?:\\p{Ideographic}|[぀-ヿ])"}\\n`,"\\n",s?"[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]":"\\u0000"].map(e=>`(${e})`).join("|"),"gum");s?Pg=r:vg=r}const o=[];for(;null!==(a=hg.exec(e));)o.push([a[0].length,a.index]);let l=e.normalize("NFD");const d=[0,0];let c=0,h=0,u=0,_=0,p=0,g=!1;l=l.replace(r,(e,t,a,s,r,l,f,m,v,P,w)=>{w-=_;if(t){const e=lg[t],i=e.length;for(let e=1;e<i;e++)d.push(w-u+e,u-e);u-=i-1;return e}if(a){let e=mg.get(a);if(!e){e=a.normalize("NFKC");mg.set(a,e)}const t=e.length;for(let e=1;e<t;e++)d.push(w-u+e,u-e);u-=t-1;return e}if(s){g=!0;if(w+p===o[c]?.[1])++c;else{d.push(w-1-u+1,u-1);u-=1;_+=1}d.push(w-u+1,u);_+=1;p+=1;return s.charAt(0)}if(r){const e=r.endsWith("\n"),t=e?r.length-2:r.length;g=!0;let i=t;if(w+p===o[c]?.[1]){i-=o[c][0];++c}for(let e=1;e<=i;e++)d.push(w-1-u+e,u-e);u-=i;_+=i;if(e){w+=t-1;d.push(w-u+1,1+u);u+=1;_+=1;p+=1;return r.slice(0,t)}return r}if(l){if(n){_+=1;p+=1;return l.slice(0,-1)}const e=l.length-2;d.push(w-u+e,1+u);u+=1;_+=1;p+=1;return l.slice(0,-2)}if(f){_+=1;p+=1;return f.slice(0,-1)}if(m){const e=m.length-1;d.push(w-u+e,u);_+=1;p+=1;return m.slice(0,-1)}if(v){d.push(w-u+1,u-1);u-=1;_+=1;p+=1;return" "}if(w+p===i[h]?.[1]){const e=i[h][0]-1;++h;for(let t=1;t<=e;t++)d.push(w-(u-t),u-t);u-=e;_+=e}return P});d.push(l.length,u);const f=new Uint32Array(d.length>>1),m=new Int32Array(d.length>>1);for(let e=0,t=d.length;e<t;e+=2){f[e>>1]=d[e];m[e>>1]=d[e+1]}return[l,[f,m],g]}function getOriginalIndex(e,t,i){if(!e)return[t,i];const[a,s]=e,n=t,r=t+i-1;let o=binarySearchFirstItem(a,e=>e>=n);a[o]>n&&--o;let l=binarySearchFirstItem(a,e=>e>=r,o);a[l]>r&&--l;const d=n+s[o];return[d,r+s[l]+1-d]}var wg=new WeakMap,Fg=new WeakMap,bg=new WeakMap,yg=new WeakMap,Sg=new WeakMap,Cg=new WeakSet;class PDFFindController{constructor(e){let{linkService:t,eventBus:i,updateMatchesCountOnProgress:a=!0,pageViewMode:s,listenToEventBus:n}=e;!function pdf_find_controller_classPrivateMethodInitSpec(e,t){pdf_find_controller_checkPrivateRedeclaration(e,t),t.add(e)}(this,Cg);pdf_find_controller_classPrivateFieldInitSpec(this,wg,null);pdf_find_controller_classPrivateFieldInitSpec(this,Fg,!0);pdf_find_controller_classPrivateFieldInitSpec(this,bg,0);pdf_find_controller_classPrivateFieldInitSpec(this,yg,null);pdf_find_controller_classPrivateFieldInitSpec(this,Sg,null);this._linkService=t;this._eventBus=i;pdf_find_controller_classPrivateFieldSet(Fg,this,a);this._pageViewMode=s;this.onIsPageVisible=null;pdf_find_controller_assertClassBrand(Cg,this,pdf_find_controller_reset).call(this);this._eventBus.on("pageviewmodechanged",e=>{let{pageViewMode:t}=e;this._pageViewMode=t});if(n){i._on("find",pdf_find_controller_assertClassBrand(Cg,this,_onFind).bind(this));i._on("findbarclose",pdf_find_controller_assertClassBrand(Cg,this,_onFindBarClose).bind(this));i._on("pagesedited",pdf_find_controller_assertClassBrand(Cg,this,_onPagesEdited).bind(this))}}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get pageMatchesColor(){return this._pageMatchesColor}get selected(){return this._selected}get state(){return pdf_find_controller_classPrivateFieldGet(wg,this)}setDocument(e){this._pdfDocument&&pdf_find_controller_assertClassBrand(Cg,this,pdf_find_controller_reset).call(this);if(e){this._pdfDocument=e;this._firstPageCapability.resolve()}}ngxFind(e){const t=[];this._findResultResolvers=[];for(let e=0,i=this._linkService.pagesCount;e<i;e++){const{promise:i,resolve:a}=Promise.withResolvers();t[e]=i;this._findResultResolvers[e]=a}pdf_find_controller_assertClassBrand(Cg,this,_onFind).call(this,e);return t}ngxFindNext(){const e={...pdf_find_controller_classPrivateFieldGet(wg,this),type:"again",findPrevious:!1};pdf_find_controller_assertClassBrand(Cg,this,_onFind).call(this,e)}ngxFindPrevious(){const e={...pdf_find_controller_classPrivateFieldGet(wg,this),type:"again",findPrevious:!0};pdf_find_controller_assertClassBrand(Cg,this,_onFind).call(this,e)}scrollMatchIntoView(e){let{element:t=null,pageIndex:i=-1,matchIndex:a=-1}=e;if(!pdf_find_controller_classPrivateFieldGet(wg,this)?.dontScrollIntoView&&this._scrollMatches&&t){this._scrollMatches=!1;"infinite-scroll"===this._pageViewMode?scrollIntoView(t,{top:-50,left:0},!0,!0):t.scrollIntoView({block:"start",inline:"center"})}}_convertToRegExpString(e,t){const{matchDiacritics:i}=pdf_find_controller_classPrivateFieldGet(wg,this);let a=!1;const addExtraWhitespaces=(t,i)=>t===e?i:e.startsWith(t)?`${i}[ ]*`:e.endsWith(t)?`[ ]*${i}`:`[ ]*${i}[ ]*`,s="[ ]*";(e=e.replaceAll(ug,(e,s,n,r,o,l)=>{if(s)return addExtraWhitespaces(s,RegExp.escape(s));if(n)return addExtraWhitespaces(n,RegExp.escape(n));if(r)return"[ ]+";if(i)return o||l;if(o)return dg.has(o.charCodeAt(0))?o:"";if(t){a=!0;return`${l}\\p{M}*`}return l})).endsWith(s)&&(e=e.slice(0,e.length-4));if(i&&t){cg||=String.fromCharCode(...dg);a=!0;e=`${e}(?=[${cg}]|[^\\p{M}]|$)`}return[a,e]}_calculateMatch(e){var t;if(!pdf_find_controller_classPrivateFieldGet(wg,this))return;const i=pdf_find_controller_classPrivateGetter(Cg,this,_get_query);if(0===i.length)return;const a=this._pageContents[e],s=this.match(i,a,e),n=this._pageMatches[e]=[],r=this._pageMatchesLength[e]=[],o=this._pageMatchesColor[e]=[],l=this._pageDiffs[e];s?.forEach(e=>{let{index:t,length:i,color:a}=e;const[s,d]=getOriginalIndex(l,t,i);if(d){n.push(s);r.push(d);o.push(a||0)}});pdf_find_controller_classPrivateFieldGet(wg,this).highlightAll&&pdf_find_controller_assertClassBrand(Cg,this,_updatePage).call(this,e);if(this._resumePageIdx===e){this._resumePageIdx=null;pdf_find_controller_assertClassBrand(Cg,this,_nextPageMatch).call(this)}const d=n.length;this._matchesCountTotal+=d;pdf_find_controller_classPrivateFieldGet(Fg,this)?d>0&&pdf_find_controller_assertClassBrand(Cg,this,_updateUIResultsCount).call(this,e):pdf_find_controller_classPrivateFieldSet(bg,this,(t=pdf_find_controller_classPrivateFieldGet(bg,this),++t))===this._linkService.pagesCount&&pdf_find_controller_assertClassBrand(Cg,this,_updateUIResultsCount).call(this,e)}match(e,t,i){const a=this._hasDiacritics[i];let s=!1;const{caseSensitive:n,findMultiple:r,matchRegExp:o}=pdf_find_controller_classPrivateFieldGet(wg,this);r&&"string"==typeof e&&(e=e.trim().split(/\s+/));let l=null;if(o&&"string"==typeof e){e=new RegExp(e,n?"g":"gi");s=a}else if("string"==typeof e)[s,e]=this._convertToRegExpString(e,a);else{const t=[...e];e=e.sort().reverse().map(e=>{const[t,i]=this._convertToRegExpString(e,a);s||=t;return`(${i})`}).join("|");l=[...t].sort().reverse().map(e=>t.indexOf(e))}if(!e)return;const{entireWord:d}=pdf_find_controller_classPrivateFieldGet(wg,this);e=new RegExp(e,`g${s?"u":""}${n?"":"i"}`);const c=[];let h;for(;null!==(h=e.exec(t));){if(d&&!pdf_find_controller_assertClassBrand(Cg,this,_isEntireWord).call(this,t,h.index,h[0].length))continue;let e=0;if(l)for(let t=1;t<h.length;t++)if(void 0!==h[t]){e=l[t-1]%5;break}c.push({index:h.index,length:h[0].length,color:e})}return c}}function _onFind(e){if(!e)return;const t=this._pdfDocument,{type:i}=e;(null===pdf_find_controller_classPrivateFieldGet(wg,this)||pdf_find_controller_assertClassBrand(Cg,this,_shouldDirtyMatch).call(this,e))&&(this._dirtyMatch=!0);pdf_find_controller_classPrivateFieldSet(wg,this,e);if("highlightallchange"!==i)pdf_find_controller_assertClassBrand(Cg,this,pdf_find_controller_updateUIState).call(this,og);else{const e=this._pageMatches.some(e=>e.length>0),t=!this.state?.query||e;pdf_find_controller_assertClassBrand(Cg,this,pdf_find_controller_updateUIState).call(this,t?sg:ng)}this._firstPageCapability.promise.then(()=>{if(!this._pdfDocument||t&&this._pdfDocument!==t)return;pdf_find_controller_assertClassBrand(Cg,this,pdf_find_controller_extractText).call(this);const e=!this._highlightMatches,a=!!this._findTimeout;if(this._findTimeout){clearTimeout(this._findTimeout);this._findTimeout=null}if(i)if(this._dirtyMatch)pdf_find_controller_assertClassBrand(Cg,this,_nextMatch).call(this);else if("again"===i){pdf_find_controller_assertClassBrand(Cg,this,_nextMatch).call(this);e&&pdf_find_controller_classPrivateFieldGet(wg,this).highlightAll&&pdf_find_controller_assertClassBrand(Cg,this,_updateAllPages).call(this)}else if("highlightallchange"===i){a?pdf_find_controller_assertClassBrand(Cg,this,_nextMatch).call(this):this._highlightMatches=!0;pdf_find_controller_assertClassBrand(Cg,this,_updateAllPages).call(this)}else pdf_find_controller_assertClassBrand(Cg,this,_nextMatch).call(this);else this._findTimeout=setTimeout(()=>{pdf_find_controller_assertClassBrand(Cg,this,_nextMatch).call(this);this._findTimeout=null},250)})}function pdf_find_controller_reset(){this._highlightMatches=!1;this._scrollMatches=!1;this._pdfDocument=null;this._pageMatches=[];this._pageMatchesLength=[];this._pageMatchesColor=[];pdf_find_controller_classPrivateFieldSet(bg,this,0);pdf_find_controller_classPrivateFieldSet(wg,this,null);this._selected={pageIdx:-1,matchIdx:-1};this._offset={pageIdx:null,matchIdx:null,wrapped:!1};this._extractTextPromises=[];this._findResultResolvers=[];this._pageContents=[];this._pageDiffs=[];this._hasDiacritics=[];this._matchesCountTotal=0;this._pagesToSearch=null;this._pendingFindMatches=new Set;this._resumePageIdx=null;this._dirtyMatch=!1;clearTimeout(this._findTimeout);this._findTimeout=null;pdf_find_controller_classPrivateFieldSet(yg,this,null);this._firstPageCapability=Promise.withResolvers()}function _get_query(e){const{query:t}=pdf_find_controller_classPrivateFieldGet(wg,e);if("string"==typeof t){if(t!==e._rawQuery){e._rawQuery=t;[e._normalizedQuery]=normalize(t)}return e._normalizedQuery}return(t||[]).filter(e=>!!e).map(e=>normalize(e)[0])}function _shouldDirtyMatch(e){const t=e.query,i=pdf_find_controller_classPrivateFieldGet(wg,this).query,a=typeof t;if(a!==typeof i)return!0;if("string"===a){if(t!==i)return!0}else if(JSON.stringify(t)!==JSON.stringify(i))return!0;switch(e.type){case"again":const e=this._selected.pageIdx+1,t=this._linkService;return e>=1&&e<=t.pagesCount&&e!==t.page&&!(this.onIsPageVisible?.(e)??1);case"highlightallchange":return!1}return!0}function _isEntireWord(e,t,i){let a=e.slice(0,t).match(_g);if(a){const i=e.charCodeAt(t),s=a[1].charCodeAt(0);if(getCharacterType(i)===getCharacterType(s))return!1}a=e.slice(t+i).match(pg);if(a){const s=e.charCodeAt(t+i-1),n=a[1].charCodeAt(0);if(getCharacterType(s)===getCharacterType(n))return!1}return!0}function pdf_find_controller_extractText(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();const t={disableNormalization:!0},i=this._pdfDocument;for(let a=0,s=this._linkService.pagesCount;a<s;a++){const{promise:s,resolve:n}=Promise.withResolvers();this._extractTextPromises[a]=s;e=e.then(async()=>{i===this._pdfDocument?await i.getPage(a+1).then(e=>e.getTextContent(t)).then(e=>{const t=[];for(const i of e.items){t.push(i.str);i.hasEOL&&t.push("\n")}[this._pageContents[a],this._pageDiffs[a],this._hasDiacritics[a]]=normalize(t.join(""));n()},e=>{ngx_console_NgxConsole.error(`Unable to get text content for page ${a+1}`,e);this._pageContents[a]="";this._pageDiffs[a]=null;this._hasDiacritics[a]=!1;n()}):n()})}}function _updatePage(e){this._scrollMatches&&this._selected.pageIdx===e&&(this.state.dontScrollIntoView||(this._linkService.page=e+1));this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})}function _updateAllPages(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}function _nextMatch(){const e=pdf_find_controller_classPrivateFieldGet(wg,this).findPrevious,t=this._linkService.page-1,i=this._linkService.pagesCount;this._highlightMatches=!0;if(this._dirtyMatch){this._dirtyMatch=!1;this._selected.pageIdx=this._selected.matchIdx=-1;this._offset.pageIdx=t;this._offset.matchIdx=null;this._offset.wrapped=!1;this._resumePageIdx=null;this._pageMatches.length=0;this._pageMatchesLength.length=0;pdf_find_controller_classPrivateFieldSet(bg,this,0);this._matchesCountTotal=0;pdf_find_controller_assertClassBrand(Cg,this,_updateAllPages).call(this);for(let e=0;e<i;e++)if(!this._pendingFindMatches.has(e)){this._pendingFindMatches.add(e);this._extractTextPromises[e].then(()=>{this._pendingFindMatches.delete(e);this._calculateMatch(e)})}}if(0===pdf_find_controller_classPrivateGetter(Cg,this,_get_query).length){pdf_find_controller_assertClassBrand(Cg,this,pdf_find_controller_updateUIState).call(this,sg);return}if(this._resumePageIdx)return;const a=this._offset;this._pagesToSearch=i;if(null!==a.matchIdx){const t=this._pageMatches[a.pageIdx].length;if(!e&&a.matchIdx+1<t||e&&a.matchIdx>0){a.matchIdx=e?a.matchIdx-1:a.matchIdx+1;pdf_find_controller_assertClassBrand(Cg,this,_updateMatch).call(this,!0);return}pdf_find_controller_assertClassBrand(Cg,this,_advanceOffsetPage).call(this,e)}pdf_find_controller_assertClassBrand(Cg,this,_nextPageMatch).call(this)}function _matchesReady(e){const t=this._offset,i=e.length,a=pdf_find_controller_classPrivateFieldGet(wg,this).findPrevious;if(i){t.matchIdx=a?i-1:0;pdf_find_controller_assertClassBrand(Cg,this,_updateMatch).call(this,!0);return!0}pdf_find_controller_assertClassBrand(Cg,this,_advanceOffsetPage).call(this,a);if(t.wrapped){t.matchIdx=null;if(this._pagesToSearch<0){pdf_find_controller_assertClassBrand(Cg,this,_updateMatch).call(this,!1);return!0}}return!1}function _nextPageMatch(){null!==this._resumePageIdx&&ngx_console_NgxConsole.error("There can only be one pending page.");let e=null;do{const t=this._offset.pageIdx;e=this._pageMatches[t];if(!e){this._resumePageIdx=t;break}}while(!pdf_find_controller_assertClassBrand(Cg,this,_matchesReady).call(this,e))}function _advanceOffsetPage(e){const t=this._offset,i=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1;t.matchIdx=null;this._pagesToSearch--;if(t.pageIdx>=i||t.pageIdx<0){t.pageIdx=e?i-1:0;t.wrapped=!0}}function _updateMatch(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=ng;const i=this._offset.wrapped;this._offset.wrapped=!1;if(e){const e=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx;this._selected.matchIdx=this._offset.matchIdx;t=i?rg:sg;-1!==e&&e!==this._selected.pageIdx&&pdf_find_controller_assertClassBrand(Cg,this,_updatePage).call(this,e)}pdf_find_controller_assertClassBrand(Cg,this,pdf_find_controller_updateUIState).call(this,t,pdf_find_controller_classPrivateFieldGet(wg,this).findPrevious);if(-1!==this._selected.pageIdx){this._scrollMatches=!0;pdf_find_controller_assertClassBrand(Cg,this,_updatePage).call(this,this._selected.pageIdx)}}function _onPagesEdited(e){let{pagesMapper:t,type:i,pageNumbers:a}=e;if(0===this._extractTextPromises.length)return;if("copy"===i){const e=new Map,t=new Map,i=new Map,s=new Map;for(const n of a){e.set(n,this._extractTextPromises[n-1]);t.set(n,this._pageContents[n-1]);i.set(n,this._pageDiffs[n-1]);s.set(n,this._hasDiacritics[n-1])}pdf_find_controller_classPrivateFieldSet(yg,this,{promises:e,contents:t,diffs:i,diacritics:s});return}if("cancelCopy"===i){pdf_find_controller_classPrivateFieldSet(yg,this,null);return}"delete"===i&&pdf_find_controller_classPrivateFieldSet(Sg,this,{promises:this._extractTextPromises,contents:this._pageContents,diffs:this._pageDiffs,diacritics:this._hasDiacritics});if("cancelDelete"===i){this._extractTextPromises=pdf_find_controller_classPrivateFieldGet(Sg,this).promises;this._pageContents=pdf_find_controller_classPrivateFieldGet(Sg,this).contents;this._pageDiffs=pdf_find_controller_classPrivateFieldGet(Sg,this).diffs;this._hasDiacritics=pdf_find_controller_classPrivateFieldGet(Sg,this).diacritics;return}if("cleanSavedData"===i){pdf_find_controller_classPrivateFieldSet(Sg,this,null);return}if(this._findTimeout){clearTimeout(this._findTimeout);this._findTimeout=null}this._resumePageIdx=null;this._dirtyMatch=!0;const s=this._extractTextPromises,n=this._pageContents,r=this._pageDiffs,o=this._hasDiacritics,l=this._extractTextPromises=[],d=this._pageContents=[],c=this._pageDiffs=[],h=this._hasDiacritics=[];for(let e=1,i=t.pagesNumber;e<=i;e++){const i=t.getPrevPageNumber(e);if(i<0){const e=-i;l.push(pdf_find_controller_classPrivateFieldGet(yg,this)?.promises.get(e)||Promise.resolve());d.push(pdf_find_controller_classPrivateFieldGet(yg,this)?.contents.get(e)??"");c.push(pdf_find_controller_classPrivateFieldGet(yg,this)?.diffs.get(e)??null);h.push(pdf_find_controller_classPrivateFieldGet(yg,this)?.diacritics.get(e)??!1);continue}l.push(s[i-1]||Promise.resolve());d.push(n[i-1]??"");c.push(r[i-1]??null);h.push(o[i-1]??!1)}pdf_find_controller_classPrivateFieldGet(wg,this)&&pdf_find_controller_assertClassBrand(Cg,this,_nextMatch).call(this)}function _onFindBarClose(e){const t=this._pdfDocument;this._firstPageCapability.promise.then(()=>{if(this._pdfDocument&&(!t||this._pdfDocument===t)){if(this._findTimeout){clearTimeout(this._findTimeout);this._findTimeout=null}if(this._resumePageIdx){this._resumePageIdx=null;this._dirtyMatch=!0}pdf_find_controller_assertClassBrand(Cg,this,pdf_find_controller_updateUIState).call(this,sg);this._highlightMatches=!1;pdf_find_controller_assertClassBrand(Cg,this,_updateAllPages).call(this)}})}function _requestMatchesCount(){const{pageIdx:e,matchIdx:t}=this._selected;let i=0,a=this._matchesCountTotal;if(-1!==t){for(let t=0;t<e;t++)i+=this._pageMatches[t]?.length||0;i+=t+1}(i<1||i>a)&&(i=a=0);return{current:i,total:a}}function _updateUIResultsCount(e){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:pdf_find_controller_assertClassBrand(Cg,this,_requestMatchesCount).call(this)});const t=this._pageMatches[e].length;if(this._findResultResolvers&&this._findResultResolvers[e]){this._findResultResolvers[e](t);this._findResultResolvers[e]=null}}function pdf_find_controller_updateUIState(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(pdf_find_controller_classPrivateFieldGet(Fg,this)||pdf_find_controller_classPrivateFieldGet(bg,this)===this._linkService.pagesCount&&e!==og)&&this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:t,entireWord:pdf_find_controller_classPrivateFieldGet(wg,this)?.entireWord??null,matchesCount:pdf_find_controller_assertClassBrand(Cg,this,_requestMatchesCount).call(this),rawQuery:pdf_find_controller_classPrivateFieldGet(wg,this)?.query??null})}function pdf_find_bar_defineProperty(e,t,i){return(t=function pdf_find_bar_toPropertyKey(e){var t=function pdf_find_bar_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function pdf_find_bar_classPrivateFieldInitSpec(e,t,i){pdf_find_bar_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_find_bar_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_find_bar_classPrivateFieldGet(e,t){return e.get(pdf_find_bar_assertClassBrand(e,t))}function pdf_find_bar_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var xg=new WeakMap,kg=new WeakMap,Eg=new WeakSet;class PDFFindBar{constructor(e,t,i){!function pdf_find_bar_classPrivateMethodInitSpec(e,t){pdf_find_bar_checkPrivateRedeclaration(e,t),t.add(e)}(this,Eg);pdf_find_bar_classPrivateFieldInitSpec(this,xg,void 0);pdf_find_bar_classPrivateFieldInitSpec(this,kg,new ResizeObserver(pdf_find_bar_assertClassBrand(Eg,this,_resizeObserverCallback).bind(this)));pdf_find_bar_defineProperty(this,"opened",!1);this.bar=e.bar;this.toggleButton=e.toggleButton;this.findField=e.findField;this.highlightAll=e.highlightAllCheckbox;this.currentPage=e.findCurrentPageCheckbox;this.pageRange=e.findPageRangeField;this.caseSensitive=e.caseSensitiveCheckbox;this.findMultipleCheckbox=e.findMultipleCheckbox;this.matchRegExpCheckbox=e.matchRegExpCheckbox;this.matchDiacritics=e.matchDiacriticsCheckbox;this.entireWord=e.entireWordCheckbox;this.findMsg=e.findMsg;this.findResultsCount=e.findResultsCount;this.findPreviousButton=e.findPreviousButton;this.findNextButton=e.findNextButton;this.eventBus=i;!function pdf_find_bar_classPrivateFieldSet(e,t,i){return e.set(pdf_find_bar_assertClassBrand(e,t),i),i}(xg,this,t);i._on("closeopenpopovers",e=>{let{source:t}=e;t!==this&&this.close()});const a=new Map(Array.from([[this.highlightAll,"highlightallchange"],[this.caseSensitive,"casesensitivitychange"],[this.entireWord,"entirewordchange"],[this.matchDiacritics,"diacriticmatchingchange"],[this.findMultipleCheckbox,"findmultiplechange"]]).filter(e=>{let[t]=e;return t&&t instanceof Element}));this.toggleButton&&(function isInsideNgxExtendedPdfViewer(e){let t=e;for(;t;){if("ngx-extended-pdf-viewer"===t.tagName.toLowerCase())return!0;t=t.parentElement}return!1}(this.toggleButton)||this.toggleButton.addEventListener("click",()=>{this.toggle()}));this.findField.addEventListener("input",()=>{this.dispatchEvent("")});this.findField.parentElement.addEventListener("keydown",e=>{const{keyCode:t}=e;13!==t&&27!==t&&e.stopPropagation();e.metaKey&&"ArrowDown"===e.key&&e.preventDefault();e.metaKey&&"ArrowUp"===e.key&&e.preventDefault()});this.bar.addEventListener("keydown",e=>{const{keyCode:t,shiftKey:i,target:s}=e;switch(t){case 13:if(s===this.findField)this.dispatchEvent("again",i);else if(a.has(s)){s.checked=!s.checked;this.dispatchEvent(a.get(s))}break;case 27:this.close();e.stopPropagation()}});this.findPreviousButton.addEventListener("click",()=>{this.dispatchEvent("again",!0)});this.findNextButton.addEventListener("click",()=>{this.dispatchEvent("again",!1)});for(const[e,t]of a)e.addEventListener("click",()=>{this.dispatchEvent(t)});this.matchRegExpCheckbox?.addEventListener("click",()=>{if(this.matchRegExpCheckbox.checked){this.findMultipleCheckbox.checked=!1;this.findMultipleCheckbox.disabled=!0;this.matchDiacritics.checked=!1;this.matchDiacritics.disabled=!0;this.entireWord.checked=!1;this.entireWord.disabled=!0}else{this.findMultipleCheckbox.disabled=!1;this.matchDiacritics.disabled=!1;this.entireWord.disabled=!1}this.dispatchEvent("findregexpchange")})}reset(){this.updateUIState()}dispatchEvent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.eventBus.dispatch("find",{source:this,type:e,query:this.findField.value,caseSensitive:this.caseSensitive.checked,findMultiple:this.findMultipleCheckbox?.checked,matchRegExp:this.matchRegExpCheckbox?.checked,entireWord:this.entireWord.checked,highlightAll:this.highlightAll.checked,findPrevious:t,matchDiacritics:this.matchDiacritics.checked})}updateUIState(e,t,i){const{findField:a,findMsg:s}=this;let n="",r="";switch(e){case sg:break;case og:r="pending";break;case ng:n="pdfjs-find-not-found";r="notFound";break;case rg:n=t?"pdfjs-find-reached-top":"pdfjs-find-reached-bottom"}a.setAttribute("data-status",r);a.setAttribute("aria-invalid",e===ng);s.setAttribute("data-status",r);if(n)s.setAttribute("data-l10n-id",n);else{s.removeAttribute("data-l10n-id");s.textContent=""}this.updateResultsCount(i)}updateResultsCount(){let{current:e=0,total:t=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{findResultsCount:i}=this;if(t>0){const a=1e3;i.setAttribute("data-l10n-id",t>a?"pdfjs-find-match-count-limit":"pdfjs-find-match-count");i.setAttribute("data-l10n-args",JSON.stringify({limit:a,current:e,total:t}))}else{i.removeAttribute("data-l10n-id");i.textContent=""}}open(){this.eventBus.dispatch("closeopenpopovers",{source:this});if(!this.opened){pdf_find_bar_classPrivateFieldGet(kg,this).observe(pdf_find_bar_classPrivateFieldGet(xg,this));pdf_find_bar_classPrivateFieldGet(kg,this).observe(this.bar);this.opened=!0;toggleExpandedBtn(this.toggleButton,!0,this.bar)}if(this.findField){"function"==typeof this.findField.select&&this.findField.select();"function"==typeof this.findField.focus&&this.findField.focus()}this.dispatchEvent("");this.eventBus.dispatch("findbaropen",{source:this})}close(){if(this.opened){pdf_find_bar_classPrivateFieldGet(kg,this).disconnect();this.opened=!1;toggleExpandedBtn(this.toggleButton,!1,this.bar);this.eventBus.dispatch("findbarclose",{source:this})}}toggle(){this.opened?this.close():this.open()}}function _resizeObserverCallback(){const{bar:e}=this;e.classList.remove("wrapContainers");e.clientHeight>e.firstElementChild.clientHeight&&e.classList.add("wrapContainers")}function pdf_history_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_history_classPrivateFieldSet(e,t,i){return e.set(pdf_history_assertClassBrand(e,t),i),i}function pdf_history_classPrivateFieldGet(e,t){return e.get(pdf_history_assertClassBrand(e,t))}function pdf_history_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function getCurrentHash(){return document.location.hash}var Ag=new WeakMap,Gg=new WeakSet;class PDFHistory{constructor(e){let{linkService:t,eventBus:i}=e;!function pdf_history_classPrivateMethodInitSpec(e,t){pdf_history_checkPrivateRedeclaration(e,t),t.add(e)}(this,Gg);!function pdf_history_classPrivateFieldInitSpec(e,t,i){pdf_history_checkPrivateRedeclaration(e,t),t.set(e,i)}(this,Ag,null);this.linkService=t;this.eventBus=i;this._initialized=!1;this._fingerprint="";this.reset();this.eventBus._on("pagesinit",()=>{this._isPagesLoaded=!1;this.eventBus._on("pagesloaded",e=>{this._isPagesLoaded=!!e.pagesCount},{once:!0})})}initialize(e){let{fingerprint:t,resetHistory:i=!1,updateUrl:a=!1}=e;if(!t||"string"!=typeof t){ngx_console_NgxConsole.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();const s=""!==this._fingerprint&&this._fingerprint!==t;this._fingerprint=t;this._updateUrl=!0===a;this._initialized=!0;pdf_history_assertClassBrand(Gg,this,_bindEvents).call(this);const n=window.history.state;this._popStateInProgress=!1;this._blockHashChange=0;this._currentHash=getCurrentHash();this._numPositionUpdates=0;this._uid=this._maxUid=0;this._destination=null;this._position=null;if(!pdf_history_assertClassBrand(Gg,this,_isValidState).call(this,n,!0)||i){const{hash:e,page:t,rotation:a}=pdf_history_assertClassBrand(Gg,this,_parseCurrentHash).call(this,!0);if(!e||s||i){pdf_history_assertClassBrand(Gg,this,_pushOrReplaceState).call(this,null,!0);return}pdf_history_assertClassBrand(Gg,this,_pushOrReplaceState).call(this,{hash:e,page:t,rotation:a},!0);return}const r=n.destination;pdf_history_assertClassBrand(Gg,this,_updateInternalState).call(this,r,n.uid,!0);void 0!==r.rotation&&(this._initialRotation=r.rotation);if(r.dest){this._initialBookmark=JSON.stringify(r.dest);this._destination.page=null}else r.hash?this._initialBookmark=r.hash:r.page&&(this._initialBookmark=`page=${r.page}`)}reset(){if(this._initialized){pdf_history_assertClassBrand(Gg,this,_pageHide).call(this);this._initialized=!1;pdf_history_assertClassBrand(Gg,this,_unbindEvents).call(this)}if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._initialBookmark=null;this._initialRotation=null}push(e){let{namedDest:t=null,explicitDest:i,pageNumber:a}=e;if(!this._initialized)return;if(t&&"string"!=typeof t){ngx_console_NgxConsole.error(`PDFHistory.push: "${t}" is not a valid namedDest parameter.`);return}if(!Array.isArray(i)){ngx_console_NgxConsole.error(`PDFHistory.push: "${i}" is not a valid explicitDest parameter.`);return}if(!pdf_history_assertClassBrand(Gg,this,_isValidPage).call(this,a)&&(null!==a||this._destination)){ngx_console_NgxConsole.error(`PDFHistory.push: "${a}" is not a valid pageNumber parameter.`);return}const s=t||JSON.stringify(i);if(!s)return;let n=!1;if(this._destination&&(function isDestHashesEqual(e,t){if("string"!=typeof e||"string"!=typeof t)return!1;if(e===t)return!0;if(parseQueryString(e).get("nameddest")===t)return!0;return!1}(this._destination.hash,s)||function isDestArraysEqual(e,t){function isEntryEqual(e,t){if(typeof e!=typeof t)return!1;if(Array.isArray(e)||Array.isArray(t))return!1;if(null!==e&&"object"==typeof e&&null!==t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!isEntryEqual(e[i],t[i]))return!1;return!0}return e===t||Number.isNaN(e)&&Number.isNaN(t)}if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let i=0,a=e.length;i<a;i++)if(!isEntryEqual(e[i],t[i]))return!1;return!0}(this._destination.dest,i))){if(this._destination.page)return;n=!0}if(!this._popStateInProgress||n){pdf_history_assertClassBrand(Gg,this,_pushOrReplaceState).call(this,{dest:i,hash:s,page:a,rotation:this.linkService.rotation},n);if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then(()=>{this._popStateInProgress=!1})}}}pushPage(e){if(this._initialized)if(pdf_history_assertClassBrand(Gg,this,_isValidPage).call(this,e)){if(this._destination?.page!==e&&!this._popStateInProgress){pdf_history_assertClassBrand(Gg,this,_pushOrReplaceState).call(this,{dest:null,hash:`page=${e}`,page:e,rotation:this.linkService.rotation});if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then(()=>{this._popStateInProgress=!1})}}}else ngx_console_NgxConsole.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`)}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&pdf_history_assertClassBrand(Gg,this,_tryPushCurrentPosition).call(this)}back(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;pdf_history_assertClassBrand(Gg,this,_isValidState).call(this,e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;pdf_history_assertClassBrand(Gg,this,_isValidState).call(this,e)&&e.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}}function _pushOrReplaceState(e){const t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]||!this._destination,i={fingerprint:this._fingerprint,uid:t?this._uid:this._uid+1,destination:e};pdf_history_assertClassBrand(Gg,this,_updateInternalState).call(this,e,i.uid);let a;if(this._updateUrl&&e?.hash){const{href:t,protocol:i}=document.location;"file:"!==i&&(a=updateUrlHash(t,e.hash))}t?window.history.replaceState(i,"",a):window.history.pushState(i,"",a)}function _tryPushCurrentPosition(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._position)return;let t=this._position;if(e){t=Object.assign(Object.create(null),this._position);t.temporary=!0}if(!this._destination){pdf_history_assertClassBrand(Gg,this,_pushOrReplaceState).call(this,t);return}if(this._destination.temporary){pdf_history_assertClassBrand(Gg,this,_pushOrReplaceState).call(this,t,!0);return}if(this._destination.hash===t.hash)return;if(!this._destination.page&&this._numPositionUpdates<=50)return;let i=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(void 0!==this._destination.dest||!this._destination.first)return;i=!0}pdf_history_assertClassBrand(Gg,this,_pushOrReplaceState).call(this,t,i)}function _isValidPage(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount}function _isValidState(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return!1;if(e.fingerprint!==this._fingerprint){if(!t)return!1;{if("string"!=typeof e.fingerprint||e.fingerprint.length!==this._fingerprint.length)return!1;const[t]=performance.getEntriesByType("navigation");if("reload"!==t?.type)return!1}}return!(!Number.isInteger(e.uid)||e.uid<0)&&(null!==e.destination&&"object"==typeof e.destination)}function _updateInternalState(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}i&&e?.temporary&&delete e.temporary;this._destination=e;this._uid=t;this._maxUid=Math.max(this._maxUid,t);this._numPositionUpdates=0}function _parseCurrentHash(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=unescape(getCurrentHash()).substring(1),i=parseQueryString(t),a=i.get("nameddest")||"";let s=0|i.get("page");(!pdf_history_assertClassBrand(Gg,this,_isValidPage).call(this,s)||e&&a.length>0)&&(s=null);return{hash:t,page:s,rotation:this.linkService.rotation}}function _updateViewarea(e){let{location:t}=e;if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._position={hash:t.pdfOpenParams.substring(1),page:this.linkService.page,first:t.pageNumber,rotation:t.rotation};if(!this._popStateInProgress){this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++;this._updateViewareaTimeout=setTimeout(()=>{this._popStateInProgress||pdf_history_assertClassBrand(Gg,this,_tryPushCurrentPosition).call(this,!0);this._updateViewareaTimeout=null},1e3)}}function _popState(e){let{state:t}=e;const i=getCurrentHash(),a=this._currentHash!==i;this._currentHash=i;if(!t){this._uid++;const{hash:e,page:t,rotation:i}=pdf_history_assertClassBrand(Gg,this,_parseCurrentHash).call(this);pdf_history_assertClassBrand(Gg,this,_pushOrReplaceState).call(this,{hash:e,page:t,rotation:i},!0);return}if(!pdf_history_assertClassBrand(Gg,this,_isValidState).call(this,t))return;this._popStateInProgress=!0;if(a){this._blockHashChange++;waitOnEventOrTimeout({target:window,name:"hashchange",delay:1e3}).then(()=>{this._blockHashChange--})}const s=t.destination;pdf_history_assertClassBrand(Gg,this,_updateInternalState).call(this,s,t.uid,!0);isValidRotation(s.rotation)&&(this.linkService.rotation=s.rotation);s.dest?this.linkService.goToDestination(s.dest):s.hash?this.linkService.setHash&&this.linkService.setHash(s.hash):s.page&&(this.linkService.page=s.page);Promise.resolve().then(()=>{this._popStateInProgress=!1})}function _pageHide(){this._destination&&!this._destination.temporary||pdf_history_assertClassBrand(Gg,this,_tryPushCurrentPosition).call(this)}function _bindEvents(){if(pdf_history_classPrivateFieldGet(Ag,this))return;pdf_history_classPrivateFieldSet(Ag,this,new AbortController);const{signal:e}=pdf_history_classPrivateFieldGet(Ag,this);this.eventBus._on("updateviewarea",pdf_history_assertClassBrand(Gg,this,_updateViewarea).bind(this),{signal:e});window.addEventListener("popstate",pdf_history_assertClassBrand(Gg,this,_popState).bind(this),{signal:e});window.addEventListener("pagehide",pdf_history_assertClassBrand(Gg,this,_pageHide).bind(this),{signal:e})}function _unbindEvents(){pdf_history_classPrivateFieldGet(Ag,this)?.abort();pdf_history_classPrivateFieldSet(Ag,this,null)}function pdf_layer_viewer_classPrivateMethodInitSpec(e,t){(function pdf_layer_viewer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function pdf_layer_viewer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Bg=new WeakSet;class PDFLayerViewer extends BaseTreeViewer{constructor(e){super(e);pdf_layer_viewer_classPrivateMethodInitSpec(this,Bg);this.eventBus._on("optionalcontentconfigchanged",e=>{pdf_layer_viewer_assertClassBrand(Bg,this,_updateLayers).call(this,e.promise)});this.eventBus._on("resetlayers",()=>{pdf_layer_viewer_assertClassBrand(Bg,this,_updateLayers).call(this)});this.eventBus._on("togglelayerstree",this._toggleAllTreeItems.bind(this))}reset(){super.reset();this._optionalContentConfig=null;this._optionalContentVisibility?.clear();this._optionalContentVisibility=null}_dispatchEvent(e){this.eventBus.dispatch("layersloaded",{source:this,layersCount:e})}_bindLink(e,t){let{groupId:i,input:a}=t;const setVisibility=()=>{const e=a.checked;this._optionalContentConfig.setVisibility(i,e);const t=this._optionalContentVisibility.get(i);t&&(t.visible=e);this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(this._optionalContentConfig)})};e.onclick=t=>{if(t.target===a){setVisibility();return!0}if(t.target!==e)return!0;a.checked=!a.checked;setVisibility();return!1}}_setNestedName(e,t){let{name:i=null}=t;if("string"!=typeof i){e.setAttribute("data-l10n-id","pdfjs-additional-layers");e.style.fontStyle="italic";this._l10n.translateOnce(e)}else e.textContent=this._normalizeTextContent(i)}_addToggleButton(e,t){let{name:i=null}=t;super._addToggleButton(e,null===i)}_toggleAllTreeItems(){this._optionalContentConfig&&super._toggleAllTreeItems()}render(e){let{optionalContentConfig:t,pdfDocument:i}=e;this._optionalContentConfig&&this.reset();this._optionalContentConfig=t||null;this._pdfDocument=i||null;const a=t?.getOrder();if(!a){this._dispatchEvent(0);return}this._optionalContentVisibility=new Map;const s=document.createDocumentFragment(),n=[{parent:s,groups:a}];let r=0,o=!1;for(;n.length>0;){const e=n.shift();for(const i of e.groups){const a=document.createElement("div");a.className="treeItem";const s=document.createElement("a");a.append(s);if("object"==typeof i){o=!0;this._addToggleButton(a,i);this._setNestedName(s,i);const e=document.createElement("div");e.className="treeItems";a.append(e);n.push({parent:e,groups:i.order})}else{const e=t.getGroup(i),a=document.createElement("label"),n=document.createElement("input");a.append(n,document.createTextNode(this._normalizeTextContent(e.name)));this._bindLink(s,{groupId:i,input:n});n.type="checkbox";n.checked=e.visible;this._optionalContentVisibility.set(i,{input:n,visible:n.checked});s.append(a);r++}e.parent.append(a)}}this._finishRendering(s,r,o)}}async function _updateLayers(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!this._optionalContentConfig)return;const t=this._pdfDocument,i=await(e||t.getOptionalContentConfig({intent:"display"}));if(t===this._pdfDocument)if(e)for(const[e,t]of this._optionalContentVisibility){const a=i.getGroup(e);a&&t.visible!==a.visible&&(t.input.checked=t.visible=!t.visible)}else{this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(i)});this.render({optionalContentConfig:i,pdfDocument:this._pdfDocument})}}class PDFOutlineViewer extends BaseTreeViewer{constructor(e){super(e);this.linkService=e.linkService;this.downloadManager=e.downloadManager;this.eventBus._on("toggleoutlinetree",this._toggleAllTreeItems.bind(this));this.eventBus._on("currentoutlineitem",this._currentOutlineItem.bind(this));this.eventBus._on("pagechanging",e=>{this._currentPageNumber=e.pageNumber});this.eventBus._on("pagesloaded",e=>{this._isPagesLoaded=!!e.pagesCount;this._currentOutlineItemCapability?.resolve(this._isPagesLoaded)});this.eventBus._on("sidebarviewchanged",e=>{this._sidebarView=e.view})}reset(){super.reset();this._outline=null;this._pageNumberToDestHashCapability=null;this._currentPageNumber=1;this._isPagesLoaded=null;this._currentOutlineItemCapability?.resolve(!1);this._currentOutlineItemCapability=null}_dispatchEvent(e){this._currentOutlineItemCapability=Promise.withResolvers();0===e||this._pdfDocument?.loadingParams.disableAutoFetch?this._currentOutlineItemCapability.resolve(!1):null!==this._isPagesLoaded&&this._currentOutlineItemCapability.resolve(this._isPagesLoaded);this.eventBus.dispatch("outlineloaded",{source:this,outlineCount:e,currentOutlineItemPromise:this._currentOutlineItemCapability.promise})}_bindLink(e,t){let{url:i,newWindow:a,action:s,attachment:n,dest:r,setOCGState:o}=t;const{linkService:l}=this;if(i)l.addLinkAttributes(e,i,a);else if(s){e.href=l.getAnchorUrl("");e.onclick=()=>{l.executeNamedAction(s);return!1}}else if(n){e.href=l.getAnchorUrl("");e.onclick=()=>{this.downloadManager.openOrDownloadData(n.content,n.filename);return!1}}else if(o){e.href=l.getAnchorUrl("");e.onclick=()=>{l.executeSetOCGState(o);return!1}}else{e.href=l.getDestinationHash(r);e.onclick=e=>{this._updateCurrentTreeItem(e.target.parentNode);r&&l.goToDestination(r);return!1}}}_setStyles(e,t){let{bold:i,italic:a}=t;i&&(e.style.fontWeight="bold");a&&(e.style.fontStyle="italic")}_addToggleButton(e,t){let{count:i,items:a}=t,s=!1;if(i<0){let e=a.length;if(e>0){const t=[...a];for(;t.length>0;){const{count:i,items:a}=t.shift();if(i>0&&a.length>0){e+=a.length;t.push(...a)}}}Math.abs(i)===e&&(s=!0)}super._addToggleButton(e,s)}_toggleAllTreeItems(){this._outline&&super._toggleAllTreeItems()}render(e){let{outline:t,pdfDocument:i}=e;this._outline&&this.reset();this._outline=t||null;this._pdfDocument=i||null;if(!t){this._dispatchEvent(0);return}const a=document.createDocumentFragment(),s=[{parent:a,items:t}];let n=0,r=!1;for(;s.length>0;){const e=s.shift();for(const t of e.items){const i=document.createElement("div");i.className="treeItem";const a=document.createElement("a");this._bindLink(a,t);this._setStyles(a,t);a.textContent=this._normalizeTextContent(t.title);i.append(a);if(t.items.length>0){r=!0;this._addToggleButton(i,t);const e=document.createElement("div");e.className="treeItems";i.append(e);s.push({parent:e,items:t.items})}e.parent.append(i);n++}}this._finishRendering(a,n,r)}async _currentOutlineItem(){if(!this._isPagesLoaded)throw new Error("_currentOutlineItem: All pages have not been loaded.");if(!this._outline||!this._pdfDocument)return;const e=await this._getPageNumberToDestHash(this._pdfDocument);if(e){this._updateCurrentTreeItem(null);if(this._sidebarView===zc)for(let t=this._currentPageNumber;t>0;t--){const i=e.get(t);if(!i)continue;const a=this.container.querySelector(`a[href="${i}"]`);if(a){this._scrollToCurrentTreeItem(a.parentNode);break}}}}async _getPageNumberToDestHash(e){if(this._pageNumberToDestHashCapability)return this._pageNumberToDestHashCapability.promise;this._pageNumberToDestHashCapability=Promise.withResolvers();const t=new Map,i=new Map,a=[{nesting:0,items:this._outline}];for(;a.length>0;){const s=a.shift(),n=s.nesting;for(const{dest:r,items:o}of s.items){let s,l;if("string"==typeof r){s=await e.getDestination(r);if(e!==this._pdfDocument)return null}else s=r;if(Array.isArray(s)){const[a]=s;a&&"object"==typeof a?l=e.cachedPageNumber(a):Number.isInteger(a)&&(l=a+1);if(Number.isInteger(l)&&(!t.has(l)||n>i.get(l))){const e=this.linkService.getDestinationHash(r);t.set(l,e);i.set(l,n)}}o.length>0&&a.push({nesting:n+1,items:o})}}this._pageNumberToDestHashCapability.resolve(t.size>0?t:null);return this._pageNumberToDestHashCapability.promise}}function pdf_presentation_mode_classPrivateFieldInitSpec(e,t,i){pdf_presentation_mode_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_presentation_mode_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_presentation_mode_classPrivateFieldGet(e,t){return e.get(pdf_presentation_mode_assertClassBrand(e,t))}function pdf_presentation_mode_classPrivateFieldSet(e,t,i){return e.set(pdf_presentation_mode_assertClassBrand(e,t),i),i}function pdf_presentation_mode_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Mg="pdfPresentationMode",Ig="pdfPresentationModeControls",Tg=Math.PI/6;var Dg=new WeakMap,Lg=new WeakMap,Rg=new WeakMap,Ng=new WeakMap,Og=new WeakSet;class PDFPresentationMode{constructor(e){let{container:t,pdfViewer:i,eventBus:a}=e;!function pdf_presentation_mode_classPrivateMethodInitSpec(e,t){pdf_presentation_mode_checkPrivateRedeclaration(e,t),t.add(e)}(this,Og);pdf_presentation_mode_classPrivateFieldInitSpec(this,Dg,Rc);pdf_presentation_mode_classPrivateFieldInitSpec(this,Lg,null);pdf_presentation_mode_classPrivateFieldInitSpec(this,Rg,null);pdf_presentation_mode_classPrivateFieldInitSpec(this,Ng,null);this.container=t;this.pdfViewer=i;this.eventBus=a;this.contextMenuOpen=!1;this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0;this.touchSwipeState=null}async request(){const{container:e,pdfViewer:t}=this;if(this.active||!t.pagesCount||!e.requestFullscreen)return!1;pdf_presentation_mode_assertClassBrand(Og,this,_addFullscreenChangeListeners).call(this);pdf_presentation_mode_assertClassBrand(Og,this,_notifyStateChange).call(this,Oc);const i=e.requestFullscreen();pdf_presentation_mode_classPrivateFieldSet(Lg,this,{pageNumber:t.currentPageNumber,scaleValue:t.currentScaleValue,scrollMode:t.scrollMode,spreadMode:null,annotationEditorMode:null});if(!(t.spreadMode===Zc.NONE||t.pageViewsReady&&t.hasEqualPageSizes)){ngx_console_NgxConsole.warn("Ignoring Spread modes when entering PresentationMode, since the document may contain varying page sizes.");pdf_presentation_mode_classPrivateFieldGet(Lg,this).spreadMode=t.spreadMode}t.annotationEditorMode!==f.DISABLE&&(pdf_presentation_mode_classPrivateFieldGet(Lg,this).annotationEditorMode=t.annotationEditorMode);try{await i;t.focus();return!0}catch{pdf_presentation_mode_assertClassBrand(Og,this,_removeFullscreenChangeListeners).call(this);pdf_presentation_mode_assertClassBrand(Og,this,_notifyStateChange).call(this,Nc)}return!1}get active(){return pdf_presentation_mode_classPrivateFieldGet(Dg,this)===Oc||pdf_presentation_mode_classPrivateFieldGet(Dg,this)===Wc}_prepareFullscreenMode(){const e=document.getElementsByClassName("zoom")[0].parentElement,t=e.parentElement;this.ngxContainer=t;for(let i=0;i<t.childElementCount;i++)t.children.item(i)===e&&(this.ngxContainerIndex=i);t.removeChild(e);document.body.append(e);const i=document.body.children;for(let t=0;t<i.length;t++){const a=i.item(t);a!==e&&a instanceof HTMLElement&&a.classList.add("hidden-by-fullscreen")}document.getElementById("sidebarContainer").classList.add("hidden-by-fullscreen");document.getElementsByClassName("toolbar")[0].classList.add("hidden-by-fullscreen")}_tidyUpFullscreenMode(){if(this.ngxContainer){const e=document.getElementsByClassName("zoom")[0].parentElement;document.body.removeChild(e);this.ngxContainerIndex>=this.ngxContainer.childElementCount?this.ngxContainer.append(e):this.ngxContainer.insertBefore(e,this.ngxContainer.children.item(this.ngxContainerIndex));this.ngxContainer=void 0;const t=document.body.children;for(let i=0;i<t.length;i++){const a=t.item(i);a!==e&&a instanceof HTMLElement&&a.classList.contains("hidden-by-fullscreen")&&a.classList.remove("hidden-by-fullscreen")}document.getElementById("sidebarContainer").classList.remove("hidden-by-fullscreen");document.getElementsByClassName("toolbar")[0].classList.remove("hidden-by-fullscreen")}}}function _mouseWheel(e){if(!this.active)return;e.preventDefault();const t=function normalizeWheelEventDelta(e){const t=e.deltaMode;let i=normalizeWheelEventDirection(e);t===WheelEvent.DOM_DELTA_PIXEL?i/=900:t===WheelEvent.DOM_DELTA_LINE&&(i/=30);return i}(e),i=Date.now(),a=this.mouseScrollTimeStamp;if(!(i>a&&i-a<50)){(this.mouseScrollDelta>0&&t<0||this.mouseScrollDelta<0&&t>0)&&pdf_presentation_mode_assertClassBrand(Og,this,_resetMouseScrollState).call(this);this.mouseScrollDelta+=t;if(Math.abs(this.mouseScrollDelta)>=.1){const e=this.mouseScrollDelta;pdf_presentation_mode_assertClassBrand(Og,this,_resetMouseScrollState).call(this);(e>0?this.pdfViewer.previousPage():this.pdfViewer.nextPage())&&(this.mouseScrollTimeStamp=i)}}}function _notifyStateChange(e){pdf_presentation_mode_classPrivateFieldSet(Dg,this,e);this.eventBus.dispatch("presentationmodechanged",{source:this,state:e})}function _enter(){pdf_presentation_mode_assertClassBrand(Og,this,_notifyStateChange).call(this,Wc);this.container.classList.add(Mg);setTimeout(()=>{this.pdfViewer.scrollMode=Yc.PAGE;null!==pdf_presentation_mode_classPrivateFieldGet(Lg,this).spreadMode&&(this.pdfViewer.spreadMode=Zc.NONE);this.pdfViewer.currentPageNumber=pdf_presentation_mode_classPrivateFieldGet(Lg,this).pageNumber;this.pdfViewer.currentScaleValue="page-fit";null!==pdf_presentation_mode_classPrivateFieldGet(Lg,this).annotationEditorMode&&(this.pdfViewer.annotationEditorMode={mode:f.NONE})},0);pdf_presentation_mode_assertClassBrand(Og,this,_addWindowListeners).call(this);pdf_presentation_mode_assertClassBrand(Og,this,_showControls).call(this);this.contextMenuOpen=!1;document.getSelection().empty()}function _exit(){const e=this.pdfViewer.currentPageNumber;this.container.classList.remove(Mg);setTimeout(()=>{pdf_presentation_mode_assertClassBrand(Og,this,_removeFullscreenChangeListeners).call(this);pdf_presentation_mode_assertClassBrand(Og,this,_notifyStateChange).call(this,Nc);this.pdfViewer.scrollMode=pdf_presentation_mode_classPrivateFieldGet(Lg,this).scrollMode;null!==pdf_presentation_mode_classPrivateFieldGet(Lg,this).spreadMode&&(this.pdfViewer.spreadMode=pdf_presentation_mode_classPrivateFieldGet(Lg,this).spreadMode);this.pdfViewer.currentScaleValue=pdf_presentation_mode_classPrivateFieldGet(Lg,this).scaleValue;this.pdfViewer.currentPageNumber=e;null!==pdf_presentation_mode_classPrivateFieldGet(Lg,this).annotationEditorMode&&(this.pdfViewer.annotationEditorMode={mode:pdf_presentation_mode_classPrivateFieldGet(Lg,this).annotationEditorMode});pdf_presentation_mode_classPrivateFieldSet(Lg,this,null)},0);pdf_presentation_mode_assertClassBrand(Og,this,_removeWindowListeners).call(this);pdf_presentation_mode_assertClassBrand(Og,this,_hideControls).call(this);pdf_presentation_mode_assertClassBrand(Og,this,_resetMouseScrollState).call(this);this.contextMenuOpen=!1}function _mouseDown(e){if(this.contextMenuOpen){this.contextMenuOpen=!1;e.preventDefault()}else if(!(0!==e.button||e.target.href&&e.target.parentNode?.hasAttribute("data-internal-link"))){e.preventDefault();e.shiftKey?this.pdfViewer.previousPage():this.pdfViewer.nextPage()}}function _contextMenu(){this.contextMenuOpen=!0}function _showControls(){this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(Ig);this.controlsTimeout=setTimeout(()=>{this.container.classList.remove(Ig);delete this.controlsTimeout},3e3)}function _hideControls(){if(this.controlsTimeout){clearTimeout(this.controlsTimeout);this.container.classList.remove(Ig);delete this.controlsTimeout}}function _resetMouseScrollState(){this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0}function _touchSwipe(e){if(this.active)if(e.touches.length>1)this.touchSwipeState=null;else switch(e.type){case"touchstart":this.touchSwipeState={startX:e.touches[0].pageX,startY:e.touches[0].pageY,endX:e.touches[0].pageX,endY:e.touches[0].pageY};break;case"touchmove":if(null===this.touchSwipeState)return;this.touchSwipeState.endX=e.touches[0].pageX;this.touchSwipeState.endY=e.touches[0].pageY;e.preventDefault();break;case"touchend":if(null===this.touchSwipeState)return;let t=0;const i=this.touchSwipeState.endX-this.touchSwipeState.startX,a=this.touchSwipeState.endY-this.touchSwipeState.startY,s=Math.abs(Math.atan2(a,i));Math.abs(i)>50&&(s<=Tg||s>=Math.PI-Tg)?t=i:Math.abs(a)>50&&Math.abs(s-Math.PI/2)<=Tg&&(t=a);t>0?this.pdfViewer.previousPage():t<0&&this.pdfViewer.nextPage()}}function _addWindowListeners(){if(pdf_presentation_mode_classPrivateFieldGet(Ng,this))return;pdf_presentation_mode_classPrivateFieldSet(Ng,this,new AbortController);const{signal:e}=pdf_presentation_mode_classPrivateFieldGet(Ng,this),t=pdf_presentation_mode_assertClassBrand(Og,this,_touchSwipe).bind(this);window.addEventListener("mousemove",pdf_presentation_mode_assertClassBrand(Og,this,_showControls).bind(this),{signal:e});window.addEventListener("mousedown",pdf_presentation_mode_assertClassBrand(Og,this,_mouseDown).bind(this),{signal:e});window.addEventListener("wheel",pdf_presentation_mode_assertClassBrand(Og,this,_mouseWheel).bind(this),{passive:!1,signal:e});window.addEventListener("keydown",pdf_presentation_mode_assertClassBrand(Og,this,_resetMouseScrollState).bind(this),{signal:e});window.addEventListener("contextmenu",pdf_presentation_mode_assertClassBrand(Og,this,_contextMenu).bind(this),{signal:e});window.addEventListener("touchstart",t,{signal:e});window.addEventListener("touchmove",t,{signal:e});window.addEventListener("touchend",t,{signal:e})}function _removeWindowListeners(){pdf_presentation_mode_classPrivateFieldGet(Ng,this)?.abort();pdf_presentation_mode_classPrivateFieldSet(Ng,this,null)}function _addFullscreenChangeListeners(){if(!pdf_presentation_mode_classPrivateFieldGet(Rg,this)){pdf_presentation_mode_classPrivateFieldSet(Rg,this,new AbortController);window.addEventListener("fullscreenchange",()=>{document.fullscreenElement?pdf_presentation_mode_assertClassBrand(Og,this,_enter).call(this):pdf_presentation_mode_assertClassBrand(Og,this,_exit).call(this)},{signal:pdf_presentation_mode_classPrivateFieldGet(Rg,this).signal})}}function _removeFullscreenChangeListeners(){pdf_presentation_mode_classPrivateFieldGet(Rg,this)?.abort();pdf_presentation_mode_classPrivateFieldSet(Rg,this,null)}class XfaLayerBuilder{constructor(e){let{pdfPage:t,annotationStorage:i=null,linkService:a,xfaHtml:s=null}=e;this.pdfPage=t;this.annotationStorage=i;this.linkService=a;this.xfaHtml=s;this.div=null;this._cancelled=!1}async render(e){let{viewport:t,intent:i="display"}=e;if("print"===i){const e={viewport:t.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:i};this.div=document.createElement("div");e.div=this.div;return XfaLayer.render(e)}const a=await this.pdfPage.getXfa();if(this._cancelled||!a)return{textDivs:[]};const s={viewport:t.clone({dontFlip:!0}),div:this.div,xfaHtml:a,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:i};if(this.div)return XfaLayer.update(s);this.div=document.createElement("div");s.div=this.div;return XfaLayer.render(s)}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}class BasePrintServiceFactory{static initGlobals(e){}static get supportsPrinting(){throw new Error("Not implemented: supportsPrinting")}static createPrintService(e){throw new Error("Not implemented: createPrintService")}}function canvasTest(e){const t=e.sizes.shift(),i=Math.max(Math.ceil(t[0]),1),a=Math.max(Math.ceil(t[1]),1),s=[i-1,a-1,1,1],n=performance.now(),r="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;let o,l;if(r){o=new OffscreenCanvas(1,1);l=new OffscreenCanvas(i,a)}else{o=document.createElement("canvas");o.width=1;o.height=1;l=document.createElement("canvas");l.width=i;l.height=a}const d=o.getContext("2d"),c=l.getContext("2d");if(c){c.fillRect.apply(c,s);d.drawImage(l,i-1,a-1,1,1,0,0,1,1)}const h=d&&0!==d.getImageData(0,0,1,1).data[3],u=parseInt(performance.now()-n);[o,l].forEach(e=>{e.height=0;e.width=0});if(r){postMessage({width:i,height:a,testTime:u,isTestPass:h});!h&&e.sizes.length&&setTimeout(()=>{canvasTest(e)},0)}else if(h)e.onSuccess({width:i,height:a,testTime:u});else{e.onError({width:i,height:a,testTime:u});e.sizes.length&&setTimeout(()=>{canvasTest(e)},0)}return h}const Wg={area:[16384,14188,11402,11180,10836,8192,4096,1],height:[8388607,65535,32767,16384,8192,4096,1],width:[4194303,65535,32767,16384,8192,4096,1]},jg={max:null,min:1,sizes:[],step:1024,useWorker:!1,onError:Function.prototype,onSuccess:Function.prototype},Vg={};function createSizesArray(e){const t=e.width===e.height,i=1===e.height,a=1===e.width,s=[];if(e.width&&e.height){const n=e.min||jg.min,r=e.step||jg.step;let o=Math.max(e.width,e.height);for(;o>=n;){const e=t||i?o:1,n=t||a?o:1;s.push([e,n]);o-=r}}else e.sizes.forEach(e=>{const n=t||i?e:1,r=t||a?e:1;s.push([n,r])});return s}function handleMethod(e){const t="undefined"!=typeof window,i=t&&"Promise"in window,a=t&&"HTMLCanvasElement"in window,s=t&&"OffscreenCanvas"in window,n=URL.createObjectURL(new Blob([])).slice(-36),r=performance.now(),{onError:o,onSuccess:l,...d}=e,getTotalTime=()=>parseInt(performance.now()-r);let c=null;if(!a)return!1;if(e.useWorker&&s){const e=`\n            var canvasTest = ${canvasTest.toString()};\n            onmessage = function(e) {\n                canvasTest(e.data);\n            };\n        `,t=new Blob([e],{type:"application/javascript"}),i=URL.createObjectURL(t);c=new Worker(i);URL.revokeObjectURL(i);c.onmessage=function(e){const{width:t,height:i,testTime:a,isTestPass:s}=e.data,r={width:t,height:i,testTime:a,totalTime:getTotalTime()};if(s){Vg[n].onSuccess(r);delete Vg[n]}else Vg[n].onError(r)}}if(i)return new Promise(t=>{const i={...e,onError(i){let{width:a,height:s,testTime:n}=i;const r={width:a,height:s,testTime:n,totalTime:getTotalTime()};let l;if(0===e.sizes.length)l=!0;else{const[[t,i]]=e.sizes.slice(-1);l=a===t&&s===i}o(r);l&&t({...r,success:!1})},onSuccess(e){let{width:i,height:a,testTime:s}=e;const n={width:i,height:a,testTime:s,totalTime:getTotalTime()};l(n);t({...n,success:!0})}};if(c){const{onError:e,onSuccess:t}=i;Vg[n]={onError:e,onSuccess:t};c.postMessage(d)}else canvasTest(i)});if(!c)return canvasTest(e);Vg[n]={onError:o,onSuccess:l};c.postMessage(d)}const Ug={maxArea(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=createSizesArray({width:e.max,height:e.max,min:e.min,step:e.step,sizes:[...Wg.area]});return handleMethod({...jg,...e,sizes:t})},maxHeight(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=createSizesArray({width:1,height:e.max,min:e.min,step:e.step,sizes:[...Wg.height]});return handleMethod({...jg,...e,sizes:t})},maxWidth(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=createSizesArray({width:e.max,height:1,min:e.min,step:e.step,sizes:[...Wg.width]});return handleMethod({...jg,...e,sizes:t})},test(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t={...jg,...e};t.sizes=[...t.sizes];t.width&&t.height&&(t.sizes=[[t.width,t.height]]);return handleMethod(t)}};function max_canvas_size_defineProperty(e,t,i){return(t=function max_canvas_size_toPropertyKey(e){var t=function max_canvas_size_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class MaxCanvasSize{static async determineMaxArea(){const{success:e,width:t,height:i}=await Ug.maxArea({useWorker:!0});if(!e){MaxCanvasSize.maxWidth=4096;MaxCanvasSize.maxArea=16777216;return 4096}MaxCanvasSize.maxArea=t*i;return MaxCanvasSize.maxArea}static async determineMaxWidth(){const{width:e}=await Ug.maxWidth({useWorker:!0});MaxCanvasSize.maxWidth=e;return MaxCanvasSize.maxWidth}static async determineMaxHeight(){const{height:e}=await Ug.maxHeight({useWorker:!0});MaxCanvasSize.maxHeight=e;return MaxCanvasSize.maxHeight}static async determineMaxDimensions(){if(MaxCanvasSize.maxWidth)return MaxCanvasSize.maxWidth;await this.determineMaxArea();await this.determineMaxHeight();await this.determineMaxWidth();return MaxCanvasSize.maxWidth}static async reduceToMaxCanvasSize(e,t){let i=1;if(e>=4096||t>=4096){await this.determineMaxDimensions();i=Math.max(e/MaxCanvasSize.maxWidth,t/MaxCanvasSize.maxHeight,Math.sqrt(e*t/MaxCanvasSize.maxArea));i>1&&(i=Math.ceil(1+100*i)/100)}return i}}max_canvas_size_defineProperty(MaxCanvasSize,"maxWidth",null);max_canvas_size_defineProperty(MaxCanvasSize,"maxHeight",null);max_canvas_size_defineProperty(MaxCanvasSize,"maxArea",null);let zg=null,Hg=null,$g=null,qg={initialized:!1};class PDFPrintService{constructor(e,t,i){let{pdfDocument:a,pagesOverview:s,printResolution:n,printAnnotationStoragePromise:r=null,eventBus:o,cspPolicyService:l,pageOrder:d=null}=e;this.pdfDocument=a;this.pagesOverview=s;this._printResolution=n||150;this.pageOrder=d||Array.from({length:a.numPages},(e,t)=>t+1);this._optionalContentConfigPromise=a.getOptionalContentConfig({intent:"print"});this._printAnnotationStoragePromise=r||Promise.resolve();this.currentPage=-1;this.scratchCanvas=document.createElement("canvas");this.eventBus=o;this.filteredPageCount=i;this.isInPDFPrintRange=t;this.cspPolicyService=l;this._blobUrls=[]}layout(){this.throwIfInactive();const e=document.querySelector("body");e.setAttribute("data-pdfjsprinting",!0);document.querySelector("html").setAttribute("data-pdfjsprinting",!0);const{width:t,height:i}=this.pagesOverview[0];this.pagesOverview.every(e=>e.width===t&&e.height===i)||ngx_console_NgxConsole.warn("Not all pages have the same size. The printed result may be incorrect!");this.pageStyleSheet=document.createElement("style");const a=`@page { size: ${t}pt ${i}pt;}`;this.cspPolicyService?this.cspPolicyService.addTrustedCSS(this.pageStyleSheet,a):this.pageStyleSheet.textContent=a;e.append(this.pageStyleSheet)}destroy(){if(zg!==this)return;this.printContainer.remove();this.printContainer=null;document.querySelector("body").removeAttribute("data-pdfjsprinting");document.querySelector("html").removeAttribute("data-pdfjsprinting");if(this.pageStyleSheet){this.pageStyleSheet.remove();this.pageStyleSheet=null}this.scratchCanvas.width=this.scratchCanvas.height=0;this.scratchCanvas=null;for(const e of this._blobUrls)URL.revokeObjectURL(e);this._blobUrls=[];zg=null;ensureOverlay().then(function(){$g.closeIfActive(Hg);$g.unregister(Hg);Kg=void 0})}renderPages(){if(this.pdfDocument.isPureXfa){!function getXfaHtmlForPrinting(e,t){const i=t.allXfaHtml,a=new SimpleLinkService,s=Math.round(100*PixelsPerInch.PDF_TO_CSS_UNITS)/100;for(const n of i.children){const i=document.createElement("div");i.className="xfaPrintedPage";e.append(i);const r=new XfaLayerBuilder({pdfPage:null,annotationStorage:t.annotationStorage,linkService:a,xfaHtml:n}),o=getXfaPageViewport(n,{scale:s});r.render({viewport:o,intent:"print"});i.append(r.div)}}(this.printContainer,this.pdfDocument);return Promise.resolve()}const e=this.pagesOverview.length,renderNextPage=(t,i)=>{this.throwIfInactive();for(;;){++this.currentPage;if(this.currentPage>=e)break;if(!this.isInPDFPrintRange||this.isInPDFPrintRange(this.currentPage))break}if(this.currentPage>=e){renderProgress(this.filteredPageCount??e,this.filteredPageCount??e,this.eventBus);t();return}const a=this.currentPage;renderProgress(a,this.filteredPageCount??e,this.eventBus);(async function renderPage(e,t,i,a,s,n,r){const o=zg.scratchCanvas;let l=s/PixelsPerInch.PDF;const d=Math.floor(a.width*l),c=Math.floor(a.height*l),h=await MaxCanvasSize.reduceToMaxCanvasSize(d,c);if(h>1){const e=Math.round(100*(h-1));l=Math.ceil(.95*l/h);warn(`Page ${i}: Reduced the maximum resolution by ${e}% because the browser can't render larger canvases. The resolution is now ${l*PixelsPerInch.PDF} DPI.`)}o.width=Math.floor(a.width*l);o.height=Math.floor(a.height*l);const u=o.getContext("2d");u.save();u.fillStyle="rgb(255, 255, 255)";u.fillRect(0,0,o.width,o.height);u.restore();return Promise.all([t.getPage(i),r]).then(function(e){let[t,i]=e;const s={canvas:o,transform:[l,0,0,l,0,0],viewport:t.getViewport({scale:1,rotation:a.rotation}),intent:"print",annotationMode:p.ENABLE_STORAGE,optionalContentConfigPromise:n,printAnnotationStorage:i};return t.render(s).promise.catch(e=>{e instanceof RenderingCancelledException||ngx_console_NgxConsole.error(e);throw e})})})(0,this.pdfDocument,this.pageOrder[a],this.pagesOverview[a],this._printResolution,this._optionalContentConfigPromise,this._printAnnotationStoragePromise).then(this.useRenderedPage.bind(this)).then(function(){renderNextPage(t,i)},i)};return new Promise(renderNextPage)}useRenderedPage(){this.throwIfInactive();const e=document.createElement("img"),{promise:t,resolve:i,reject:a}=Promise.withResolvers();e.onload=i;e.onerror=()=>{ngx_console_NgxConsole.error("Failed to load printed page image via blob URL, falling back to data URL.");try{e.onerror=()=>{ngx_console_NgxConsole.error("Print failed: could not load page image even with data URL fallback.");a(new Error("Failed to load printed page image."))};e.src=this.scratchCanvas.toDataURL()}catch(e){ngx_console_NgxConsole.error("Print failed: toDataURL fallback also failed.",e);a(e)}};try{this.scratchCanvas.toBlob(t=>{if(!t){ngx_console_NgxConsole.warn("Print: toBlob returned null, falling back to data URL.");try{e.src=this.scratchCanvas.toDataURL()}catch(e){ngx_console_NgxConsole.error("Print failed: both toBlob and toDataURL failed.",e);a(e)}return}const i=URL.createObjectURL(t);this._blobUrls.push(i);e.src=i})}catch(t){ngx_console_NgxConsole.warn("Print: toBlob threw, falling back to data URL.",t);try{e.src=this.scratchCanvas.toDataURL()}catch(e){ngx_console_NgxConsole.error("Print failed: both toBlob and toDataURL failed.",e);a(e)}}const s=document.createElement("div");s.className="printedPage";s.append(e);this.printContainer.append(s);t.catch(()=>{});return t}performPrint(){this.throwIfInactive();return new Promise(e=>{setTimeout(()=>{if(!this.active){e();return}Xg.call(window);const t=navigator.platform&&["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,i=/Android/i.test(navigator.userAgent);setTimeout(e,t||i?1500:100)},0)})}get active(){return this===zg}throwIfInactive(){if(!this.active)throw new Error("This print request was cancelled or completed.")}}const Xg=window.print;function dispatchEvent(e){const t=new CustomEvent(e,{bubbles:!1,cancelable:!1,detail:"custom"});window.dispatchEvent(t)}function abort(){if(zg){zg.destroy();dispatchEvent("afterprint")}}function renderProgress(e,t,i){Hg=document.getElementById("printServiceDialog");const a=Math.round(100*e/t),s=Hg.querySelector("progress"),n=Hg.querySelector(".relative-progress");s.value=a;n.setAttribute("data-l10n-args",JSON.stringify({progress:a}));i.dispatch("progress",{source:this,type:"print",total:t,page:e,percent:100*e/t})}window.addEventListener("keydown",function(e){if(80===e.keyCode&&(e.ctrlKey||e.metaKey)&&!e.altKey&&(!e.shiftKey||window.chrome||window.opera)){window.print();e.preventDefault();e.stopImmediatePropagation()}},!0);if("onbeforeprint"in window){const stopPropagationIfNeeded=function(e){"custom"!==e.detail&&e.stopImmediatePropagation()};window.addEventListener("beforeprint",stopPropagationIfNeeded);window.addEventListener("afterprint",stopPropagationIfNeeded)}let Kg;function ensureOverlay(){if(!Kg){$g=qg.overlayManager;if(!$g)throw new Error("The overlay manager has not yet been initialized.");Hg=document.getElementById("printServiceDialog");Kg=$g.register(Hg,!0);document.getElementById("printCancel").onclick=abort;Hg.addEventListener("close",abort)}return Kg}class PDFPrintServiceFactory extends BasePrintServiceFactory{static initGlobals(e){qg=e}static get supportsPrinting(){return shadow(this,"supportsPrinting",!0)}static createPrintService(e){if(zg)throw new Error("The print service is created and active.");PDFPrintServiceFactory.enablePrint||ngx_console_NgxConsole.debug("The print service is disabled.");return zg=new PDFPrintService(e,PDFPrintServiceFactory.isInPDFPrintRange,PDFPrintServiceFactory.filteredPageCount)}}function renderable_view_defineProperty(e,t,i){return(t=function renderable_view_toPropertyKey(e){var t=function renderable_view_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const Yg={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3};class RenderableView{constructor(){renderable_view_defineProperty(this,"renderingId","");renderable_view_defineProperty(this,"renderTask",null);renderable_view_defineProperty(this,"resume",null)}get renderingState(){throw new Error("Abstract getter `renderingState` accessed")}set renderingState(e){throw new Error("Abstract setter `renderingState` accessed")}async draw(){throw new Error("Not implemented: draw")}}function pdf_rendering_queue_defineProperty(e,t,i){return(t=function pdf_rendering_queue_toPropertyKey(e){var t=function pdf_rendering_queue_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function pdf_rendering_queue_classPrivateFieldInitSpec(e,t,i){(function pdf_rendering_queue_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function pdf_rendering_queue_classPrivateFieldSet(e,t,i){return e.set(pdf_rendering_queue_assertClassBrand(e,t),i),i}function pdf_rendering_queue_classPrivateFieldGet(e,t){return e.get(pdf_rendering_queue_assertClassBrand(e,t))}function pdf_rendering_queue_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Zg=new WeakMap,Jg=new WeakMap,Qg=new WeakMap,ef=new WeakMap;class PDFRenderingQueue{constructor(){pdf_rendering_queue_classPrivateFieldInitSpec(this,Zg,null);pdf_rendering_queue_classPrivateFieldInitSpec(this,Jg,null);pdf_rendering_queue_classPrivateFieldInitSpec(this,Qg,null);pdf_rendering_queue_classPrivateFieldInitSpec(this,ef,null);pdf_rendering_queue_defineProperty(this,"isThumbnailViewEnabled",!1);pdf_rendering_queue_defineProperty(this,"onIdle",null);pdf_rendering_queue_defineProperty(this,"printing",!1);Object.defineProperty(this,"hasViewer",{value:()=>!!pdf_rendering_queue_classPrivateFieldGet(ef,this)})}setViewer(e){pdf_rendering_queue_classPrivateFieldSet(ef,this,e)}setThumbnailViewer(e){pdf_rendering_queue_classPrivateFieldSet(Qg,this,e)}isHighestPriority(e){return pdf_rendering_queue_classPrivateFieldGet(Zg,this)===e.renderingId}renderHighestPriority(e){if(pdf_rendering_queue_classPrivateFieldGet(Jg,this)){clearTimeout(pdf_rendering_queue_classPrivateFieldGet(Jg,this));pdf_rendering_queue_classPrivateFieldSet(Jg,this,null)}pdf_rendering_queue_classPrivateFieldGet(ef,this).forceRendering(e)||this.isThumbnailViewEnabled&&pdf_rendering_queue_classPrivateFieldGet(Qg,this)?.forceRendering()||this.printing||this.onIdle&&pdf_rendering_queue_classPrivateFieldSet(Jg,this,setTimeout(this.onIdle.bind(this),3e4))}getHighestPriority(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const n=e.views,r=n.length;if(0===r)return null;for(let e=0;e<r;e++){const t=n[e].view;if(!this.isViewFinished(t))return t}if(!s)for(let e=0;e<r;e++){const{detailView:t}=n[e].view;if(t&&!this.isViewFinished(t))return t}const o=e.first.id,l=e.last.id;if(l-o+1>r){const a=e.ids;for(let e=1,s=l-o;e<s;e++){const s=i?o+e:l-e;if(a.has(s))continue;const n=t[s-1];if(!this.isViewFinished(n))return n}}let d=i?l:o-2,c=t[d];if(c&&!this.isViewFinished(c))return c;if(a){d+=i?1:-1;c=t[d];if(c&&!this.isViewFinished(c))return c}return null}isViewFinished(e){return e.renderingState===Yg.FINISHED}renderView(e){switch(e.renderingState){case Yg.FINISHED:return!1;case Yg.PAUSED:pdf_rendering_queue_classPrivateFieldSet(Zg,this,e.renderingId);e.resume();break;case Yg.RUNNING:pdf_rendering_queue_classPrivateFieldSet(Zg,this,e.renderingId);break;case Yg.INITIAL:pdf_rendering_queue_classPrivateFieldSet(Zg,this,e.renderingId);e.draw().finally(()=>{this.renderHighestPriority()}).catch(e=>{e instanceof RenderingCancelledException||ngx_console_NgxConsole.error("renderView:",e)})}return!0}}function pdf_scripting_manager_classPrivateFieldInitSpec(e,t,i){pdf_scripting_manager_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_scripting_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_scripting_manager_classPrivateFieldGet(e,t){return e.get(pdf_scripting_manager_assertClassBrand(e,t))}function pdf_scripting_manager_classPrivateFieldSet(e,t,i){return e.set(pdf_scripting_manager_assertClassBrand(e,t),i),i}function pdf_scripting_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var tf=new WeakMap,af=new WeakMap,sf=new WeakMap,nf=new WeakMap,rf=new WeakMap,of=new WeakMap,lf=new WeakMap,df=new WeakMap,cf=new WeakMap,hf=new WeakMap,uf=new WeakMap,_f=new WeakSet;class PDFScriptingManager{constructor(e){let{eventBus:t,externalServices:i=null,docProperties:a=null}=e;!function pdf_scripting_manager_classPrivateMethodInitSpec(e,t){pdf_scripting_manager_checkPrivateRedeclaration(e,t),t.add(e)}(this,_f);pdf_scripting_manager_classPrivateFieldInitSpec(this,tf,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,af,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,sf,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,nf,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,rf,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,of,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,lf,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,df,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,cf,!1);pdf_scripting_manager_classPrivateFieldInitSpec(this,hf,null);pdf_scripting_manager_classPrivateFieldInitSpec(this,uf,null);pdf_scripting_manager_classPrivateFieldSet(rf,this,t);pdf_scripting_manager_classPrivateFieldSet(of,this,i);pdf_scripting_manager_classPrivateFieldSet(sf,this,a)}setViewer(e){pdf_scripting_manager_classPrivateFieldSet(df,this,e)}async setDocument(e){pdf_scripting_manager_classPrivateFieldGet(lf,this)&&await pdf_scripting_manager_assertClassBrand(_f,this,_destroyScripting).call(this);pdf_scripting_manager_classPrivateFieldSet(lf,this,e);if(!e)return;const[t,i,a]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(!t&&!a){await pdf_scripting_manager_assertClassBrand(_f,this,_destroyScripting).call(this);return}if(e!==pdf_scripting_manager_classPrivateFieldGet(lf,this))return;try{pdf_scripting_manager_classPrivateFieldSet(hf,this,pdf_scripting_manager_assertClassBrand(_f,this,_initScripting).call(this))}catch(e){ngx_console_NgxConsole.error("setDocument:",e);await pdf_scripting_manager_assertClassBrand(_f,this,_destroyScripting).call(this);return}const s=pdf_scripting_manager_classPrivateFieldGet(rf,this);pdf_scripting_manager_classPrivateFieldSet(nf,this,new AbortController);const{signal:n}=pdf_scripting_manager_classPrivateFieldGet(nf,this);s._on("updatefromsandbox",e=>{e?.source===window&&pdf_scripting_manager_assertClassBrand(_f,this,_updateFromSandbox).call(this,e.detail)},{signal:n});s._on("dispatcheventinsandbox",e=>{pdf_scripting_manager_classPrivateFieldGet(hf,this)?.dispatchEventInSandbox(e.detail)},{signal:n});s._on("pagechanging",e=>{let{pageNumber:t,previous:i}=e;if(t!==i){pdf_scripting_manager_assertClassBrand(_f,this,_dispatchPageClose).call(this,i);pdf_scripting_manager_assertClassBrand(_f,this,_dispatchPageOpen).call(this,t)}},{signal:n});s._on("pagerendered",e=>{let{pageNumber:t}=e;this._pageOpenPending.has(t)&&t===pdf_scripting_manager_classPrivateFieldGet(df,this).currentPageNumber&&pdf_scripting_manager_assertClassBrand(_f,this,_dispatchPageOpen).call(this,t)},{signal:n});s._on("pagesdestroy",async()=>{await pdf_scripting_manager_assertClassBrand(_f,this,_dispatchPageClose).call(this,pdf_scripting_manager_classPrivateFieldGet(df,this).currentPageNumber);await(pdf_scripting_manager_classPrivateFieldGet(hf,this)?.dispatchEventInSandbox({id:"doc",name:"WillClose"}));pdf_scripting_manager_classPrivateFieldGet(tf,this)?.resolve()},{signal:n});try{const n=await pdf_scripting_manager_classPrivateFieldGet(sf,this).call(this,e);if(e!==pdf_scripting_manager_classPrivateFieldGet(lf,this))return;await pdf_scripting_manager_classPrivateFieldGet(hf,this).createSandbox({objects:t,calculationOrder:i,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...n,actions:a}});s.dispatch("sandboxcreated",{source:this})}catch(e){ngx_console_NgxConsole.error("setDocument:",e);await pdf_scripting_manager_assertClassBrand(_f,this,_destroyScripting).call(this);return}await(pdf_scripting_manager_classPrivateFieldGet(hf,this)?.dispatchEventInSandbox({id:"doc",name:"Open"}));await pdf_scripting_manager_assertClassBrand(_f,this,_dispatchPageOpen).call(this,pdf_scripting_manager_classPrivateFieldGet(df,this).currentPageNumber,!0);Promise.resolve().then(()=>{e===pdf_scripting_manager_classPrivateFieldGet(lf,this)&&pdf_scripting_manager_classPrivateFieldSet(cf,this,!0)})}async dispatchWillSave(){return pdf_scripting_manager_classPrivateFieldGet(hf,this)?.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(){return pdf_scripting_manager_classPrivateFieldGet(hf,this)?.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(){if(pdf_scripting_manager_classPrivateFieldGet(hf,this)){await(pdf_scripting_manager_classPrivateFieldGet(uf,this)?.promise);pdf_scripting_manager_classPrivateFieldSet(uf,this,Promise.withResolvers());try{await pdf_scripting_manager_classPrivateFieldGet(hf,this).dispatchEventInSandbox({id:"doc",name:"WillPrint"})}catch(e){pdf_scripting_manager_classPrivateFieldGet(uf,this).resolve();pdf_scripting_manager_classPrivateFieldSet(uf,this,null);throw e}await pdf_scripting_manager_classPrivateFieldGet(uf,this).promise}}async dispatchDidPrint(){return pdf_scripting_manager_classPrivateFieldGet(hf,this)?.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){return pdf_scripting_manager_classPrivateFieldGet(af,this)?.promise||null}get ready(){return pdf_scripting_manager_classPrivateFieldGet(cf,this)}get _pageOpenPending(){return shadow(this,"_pageOpenPending",new Set)}get _visitedPages(){return shadow(this,"_visitedPages",new Map)}}async function _updateFromSandbox(e){const t=pdf_scripting_manager_classPrivateFieldGet(df,this),i=t.isInPresentationMode||t.isChangingPresentationMode,{id:a,siblings:s,command:n,value:r}=e;if(!a){switch(n){case"clear":ngx_console_NgxConsole.clear();break;case"error":ngx_console_NgxConsole.error(r);break;case"layout":if(!i){const e=apiPageLayoutToViewerModes(r);t.spreadMode=e.spreadMode}break;case"page-num":t.currentPageNumber=r+1;break;case"print":await t.pagesPromise;pdf_scripting_manager_classPrivateFieldGet(rf,this).dispatch("print",{source:this});break;case"println":ngx_console_NgxConsole.log(r);break;case"zoom":i||(t.currentScaleValue=r);break;case"SaveAs":pdf_scripting_manager_classPrivateFieldGet(rf,this).dispatch("download",{source:this});break;case"FirstPage":t.currentPageNumber=1;break;case"LastPage":t.currentPageNumber=t.pagesCount;break;case"NextPage":t.nextPage();break;case"PrevPage":t.previousPage();break;case"ZoomViewIn":i||t.increaseScale();break;case"ZoomViewOut":i||t.decreaseScale();break;case"WillPrintFinished":pdf_scripting_manager_classPrivateFieldGet(uf,this)?.resolve();pdf_scripting_manager_classPrivateFieldSet(uf,this,null)}return}if(i&&e.focus)return;delete e.id;delete e.siblings;const o=s?[a,...s]:[a];for(const t of o){const i=document.querySelector(`[data-element-id="${t}"]`);i?i.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e})):pdf_scripting_manager_classPrivateFieldGet(lf,this)?.annotationStorage.setValue(t,e)}}async function _dispatchPageOpen(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=pdf_scripting_manager_classPrivateFieldGet(lf,this),a=this._visitedPages;t&&pdf_scripting_manager_classPrivateFieldSet(tf,this,Promise.withResolvers());if(!pdf_scripting_manager_classPrivateFieldGet(tf,this))return;const s=pdf_scripting_manager_classPrivateFieldGet(df,this).getPageView(e-1);if(s?.renderingState!==Yg.FINISHED){this._pageOpenPending.add(e);return}this._pageOpenPending.delete(e);const n=(async()=>{const t=await(a.has(e)?null:s.pdfPage?.getJSActions());i===pdf_scripting_manager_classPrivateFieldGet(lf,this)&&await(pdf_scripting_manager_classPrivateFieldGet(hf,this)?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:e,actions:t}))})();a.set(e,n)}async function _dispatchPageClose(e){const t=pdf_scripting_manager_classPrivateFieldGet(lf,this),i=this._visitedPages;if(!pdf_scripting_manager_classPrivateFieldGet(tf,this))return;if(this._pageOpenPending.has(e))return;const a=i.get(e);if(a){i.set(e,null);await a;t===pdf_scripting_manager_classPrivateFieldGet(lf,this)&&await(pdf_scripting_manager_classPrivateFieldGet(hf,this)?.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:e}))}}function _initScripting(){pdf_scripting_manager_classPrivateFieldSet(af,this,Promise.withResolvers());if(pdf_scripting_manager_classPrivateFieldGet(hf,this))throw new Error("#initScripting: Scripting already exists.");return pdf_scripting_manager_classPrivateFieldGet(of,this).createScripting()}async function _destroyScripting(){if(pdf_scripting_manager_classPrivateFieldGet(hf,this)){if(pdf_scripting_manager_classPrivateFieldGet(tf,this)){await Promise.race([pdf_scripting_manager_classPrivateFieldGet(tf,this).promise,new Promise(e=>{setTimeout(e,1e3)})]).catch(()=>{});pdf_scripting_manager_classPrivateFieldSet(tf,this,null)}pdf_scripting_manager_classPrivateFieldSet(lf,this,null);try{await pdf_scripting_manager_classPrivateFieldGet(hf,this).destroySandbox()}catch{}pdf_scripting_manager_classPrivateFieldGet(uf,this)?.reject(new Error("Scripting destroyed."));pdf_scripting_manager_classPrivateFieldSet(uf,this,null);pdf_scripting_manager_classPrivateFieldGet(nf,this)?.abort();pdf_scripting_manager_classPrivateFieldSet(nf,this,null);this._pageOpenPending.clear();this._visitedPages.clear();pdf_scripting_manager_classPrivateFieldSet(hf,this,null);pdf_scripting_manager_classPrivateFieldSet(cf,this,!1);pdf_scripting_manager_classPrivateFieldGet(af,this)?.resolve()}else{pdf_scripting_manager_classPrivateFieldSet(lf,this,null);pdf_scripting_manager_classPrivateFieldGet(af,this)?.resolve()}}function menu_classPrivateFieldInitSpec(e,t,i){menu_checkPrivateRedeclaration(e,t),t.set(e,i)}function menu_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function menu_classPrivateFieldGet(e,t){return e.get(menu_assertClassBrand(e,t))}function menu_classPrivateFieldSet(e,t,i){return e.set(menu_assertClassBrand(e,t),i),i}function menu_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var pf=new WeakMap,gf=new WeakMap,ff=new WeakMap,mf=new WeakMap,vf=new WeakMap,Pf=new WeakMap,wf=new WeakMap,Ff=new WeakSet;class Menu{constructor(e,t,i){!function menu_classPrivateMethodInitSpec(e,t){menu_checkPrivateRedeclaration(e,t),t.add(e)}(this,Ff);menu_classPrivateFieldInitSpec(this,pf,void 0);menu_classPrivateFieldInitSpec(this,gf,void 0);menu_classPrivateFieldInitSpec(this,ff,void 0);menu_classPrivateFieldInitSpec(this,mf,null);menu_classPrivateFieldInitSpec(this,vf,new AbortController);menu_classPrivateFieldInitSpec(this,Pf,-1);menu_classPrivateFieldInitSpec(this,wf,menu_assertClassBrand(Ff,this,_onFocusOut).bind(this));menu_classPrivateFieldSet(gf,this,e);menu_classPrivateFieldSet(pf,this,t);if(Array.isArray(i))menu_classPrivateFieldSet(ff,this,i);else{menu_classPrivateFieldSet(ff,this,[]);for(const e of menu_classPrivateFieldGet(gf,this).querySelectorAll("button"))menu_classPrivateFieldGet(ff,this).push(e)}menu_assertClassBrand(Ff,this,_setUpMenu).call(this)}destroy(){menu_assertClassBrand(Ff,this,_closeMenu).call(this);menu_classPrivateFieldGet(vf,this)?.abort();menu_classPrivateFieldSet(vf,this,null)}}function _closeMenu(){if(!menu_classPrivateFieldGet(mf,this))return;const e=menu_classPrivateFieldGet(gf,this);menu_classPrivateFieldGet(pf,this).ariaExpanded="false";menu_classPrivateFieldGet(mf,this).abort();menu_classPrivateFieldSet(mf,this,null);e.contains(document.activeElement)&&setTimeout(()=>{e.contains(document.activeElement)||menu_classPrivateFieldGet(pf,this).focus()},0);menu_classPrivateFieldSet(Pf,this,-1)}function _openMenu(){if(menu_classPrivateFieldGet(mf,this))return;const e=menu_classPrivateFieldGet(gf,this);menu_classPrivateFieldGet(pf,this).ariaExpanded="true";menu_classPrivateFieldSet(mf,this,new AbortController);const t=AbortSignal.any([menu_classPrivateFieldGet(vf,this).signal,menu_classPrivateFieldGet(mf,this).signal]);window.addEventListener("pointerdown",t=>{let{target:i}=t;menu_classPrivateFieldGet(pf,this).contains(i)||e.contains(i)||menu_assertClassBrand(Ff,this,_closeMenu).call(this)},{signal:t});const i=menu_assertClassBrand(Ff,this,_closeMenu).bind(this);window.addEventListener("blur",i,{signal:t});e.addEventListener("focusout",menu_classPrivateFieldGet(wf,this),{signal:t})}function _onFocusOut(e){let{relatedTarget:t}=e;menu_classPrivateFieldGet(pf,this).contains(t)||menu_classPrivateFieldGet(gf,this).contains(t)||menu_assertClassBrand(Ff,this,_closeMenu).call(this)}function _setUpMenu(){menu_classPrivateFieldGet(pf,this).addEventListener("click",e=>{menu_classPrivateFieldGet(mf,this)?menu_assertClassBrand(Ff,this,_closeMenu).call(this):menu_assertClassBrand(Ff,this,_openMenu).call(this)});menu_classPrivateFieldGet(pf,this).addEventListener("focusout",menu_classPrivateFieldGet(wf,this));const{signal:e}=menu_classPrivateFieldGet(vf,this);menu_classPrivateFieldGet(gf,this).addEventListener("keydown",e=>{switch(e.key){case"Escape":menu_assertClassBrand(Ff,this,_closeMenu).call(this);stopEvent(e);break;case"ArrowDown":menu_assertClassBrand(Ff,this,_goToNextItem).call(this,e.target,!0);stopEvent(e);break;case"ArrowUp":menu_assertClassBrand(Ff,this,_goToNextItem).call(this,e.target,!1);stopEvent(e);break;case"Home":menu_classPrivateFieldGet(ff,this).find(e=>!e.disabled&&!e.classList.contains("hidden"))?.focus();stopEvent(e);break;case"End":menu_classPrivateFieldGet(ff,this).findLast(e=>!e.disabled&&!e.classList.contains("hidden"))?.focus();stopEvent(e);break;default:const{key:t}=e;if(!/^\p{L}$/u.test(t))break;const i=t.toLocaleLowerCase();menu_assertClassBrand(Ff,this,_goToNextItem).call(this,e.target,!0,e=>e.textContent.trim().toLowerCase().startsWith(i));stopEvent(e)}},{signal:e,capture:!0});menu_classPrivateFieldGet(gf,this).addEventListener("contextmenu",noContextMenu,{signal:e});menu_classPrivateFieldGet(gf,this).addEventListener("click",menu_assertClassBrand(Ff,this,_closeMenu).bind(this),{signal:e,capture:!0});menu_classPrivateFieldGet(pf,this).addEventListener("keydown",e=>{switch(e.key){case" ":case"Enter":case"ArrowDown":case"Home":stopEvent(e);menu_classPrivateFieldGet(mf,this)||menu_assertClassBrand(Ff,this,_openMenu).call(this);menu_classPrivateFieldGet(ff,this).find(e=>!e.disabled&&!e.classList.contains("hidden"))?.focus();break;case"ArrowUp":case"End":stopEvent(e);menu_classPrivateFieldGet(mf,this)||menu_assertClassBrand(Ff,this,_openMenu).call(this);menu_classPrivateFieldGet(ff,this).findLast(e=>!e.disabled&&!e.classList.contains("hidden"))?.focus();break;case"Escape":menu_assertClassBrand(Ff,this,_closeMenu).call(this);stopEvent(e)}},{signal:e})}function _goToNextItem(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0;const a=-1===menu_classPrivateFieldGet(Pf,this)?menu_classPrivateFieldGet(ff,this).indexOf(e):menu_classPrivateFieldGet(Pf,this),s=menu_classPrivateFieldGet(ff,this).length,n=t?1:s-1;for(let e=(a+n)%s;e!==a;e=(e+n)%s){const t=menu_classPrivateFieldGet(ff,this)[e];if(!t.disabled&&!t.classList.contains("hidden")&&i(t)){t.focus();menu_classPrivateFieldSet(Pf,this,e);break}}}function pdf_thumbnail_view_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_thumbnail_view_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}let bf=0;class TempImageFactory{static getCanvas(e,t){let i;if(FeatureTest.isOffscreenCanvasSupported)i=new OffscreenCanvas(e,t);else{i=document.createElement("canvas");i.width=e;i.height=t}const a=i.getContext("2d",{alpha:!1});a.save();a.fillStyle="rgb(255, 255, 255)";a.fillRect(0,0,e,t);a.restore();return[i,a]}}var yf,Sf=new WeakMap,Cf=new WeakSet;class PDFThumbnailView extends RenderableView{constructor(e){let{container:t,eventBus:i,id:a,defaultViewport:s,optionalContentConfigPromise:n,linkService:r,renderingQueue:o,maxCanvasPixels:l,maxCanvasDim:d,pageColors:c,enableSplitMerge:h=!1,enablePageReordering:u=!1}=e;super();!function pdf_thumbnail_view_classPrivateMethodInitSpec(e,t){pdf_thumbnail_view_checkPrivateRedeclaration(e,t),t.add(e)}(this,Cf);!function pdf_thumbnail_view_classPrivateFieldInitSpec(e,t,i){pdf_thumbnail_view_checkPrivateRedeclaration(e,t),t.set(e,i)}(this,Sf,Yg.INITIAL);this.id=a;this.renderingId=`thumbnail${a}`;this.pageLabel=null;this.pdfPage=null;this.rotation=0;this.viewport=s;this.pdfPageRotate=s.rotation;this._optionalContentConfigPromise=n||null;this.maxCanvasPixels=l??AppOptions.get("maxCanvasPixels");this.maxCanvasDim=d||AppOptions.get("maxCanvasDim");this.pageColors=c||null;this.eventBus=i;this.linkService=r;this.renderingQueue=o;this.placeholder=null;i.dispatch("rendercustomthumbnail",{pdfThumbnailView:this,linkService:r,id:a,container:t,thumbPageTitlePromiseOrPageL10nArgs:pdf_thumbnail_view_assertClassBrand(Cf,this,_getPageL10nArgs).call(this)});const _=t.querySelector(`.${this.renderingId}`);if(_){this.div=_;this.imageContainer=this.div.querySelector(".thumbnailImageContainer")||this.div;this.image=this.div.querySelector(".thumbnailImage")||this.imageContainer.querySelector("img");this.checkbox=this.div.querySelector("input[type='checkbox']");if(this.image){if(h&&!this.checkbox){const e=this.checkbox=document.createElement("input");e.type="checkbox";e.tabIndex=-1;e.setAttribute("data-l10n-id","pdfjs-thumb-page-checkbox1");e.setAttribute("data-l10n-args",pdf_thumbnail_view_assertClassBrand(Cf,this,_getPageL10nArgs).call(this));this.div.append(e);this.pasteButton=null}}else pdf_thumbnail_view_assertClassBrand(Cf,this,_createStandardThumbnail).call(this,t,a,h,u)}else pdf_thumbnail_view_assertClassBrand(Cf,this,_createStandardThumbnail).call(this,t,a,h);_&&pdf_thumbnail_view_assertClassBrand(Cf,this,_updateDims).call(this);if(u&&this.div){this.div.addEventListener("dragstart",this._dragStartHandler.bind(this));this.div.addEventListener("dragover",this._dragOverHandler.bind(this));this.div.addEventListener("drop",this._dropHandler.bind(this));this.div.addEventListener("mousedown",this._mouseDownHandler.bind(this))}}clone(e,t){const i=new PDFThumbnailView({container:e,id:t,eventBus:this.eventBus,defaultViewport:this.viewport,optionalContentConfigPromise:this._optionalContentConfigPromise,linkService:this.linkService,renderingQueue:this.renderingQueue,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,pageColors:this.pageColors,enableSplitMerge:!!this.checkbox}),{imageContainer:a}=this;if(!a.classList.contains("missingThumbnailImage")){i.image.replaceWith(this.image.cloneNode(!0));i.imageContainer.classList.remove("missingThumbnailImage")}return i}addPasteButton(e){if(this.pasteButton)return;const t=this.pasteButton=document.createElement("button");t.classList.add("thumbnailPasteButton","viewsManagerButton");t.tabIndex=0;t.setAttribute("data-l10n-id","pdfjs-views-manager-paste-button-after");t.setAttribute("data-l10n-args",JSON.stringify({page:this.pageLabel??this.id}));const i=document.createElement("span");i.setAttribute("data-l10n-id","pdfjs-views-manager-paste-button-label");t.append(i);t.addEventListener("click",()=>{e(this.id)});if(1===this.id){const i=this.prevPasteButton=t.cloneNode(!0);i.setAttribute("data-l10n-id","pdfjs-views-manager-paste-button-before");i.addEventListener("click",()=>{e(0)});this.imageContainer.before(i)}this.imageContainer.after(t)}removePasteButton(){this.pasteButton?.remove();this.pasteButton=null;this.prevPasteButton?.remove();this.prevPasteButton=null}toggleSelected(e){this.checkbox&&(this.checkbox.checked=e)}_dragStartHandler(e){e.dataTransfer.setData("text/plain",this.id.toString())}_dragOverHandler(e){e.preventDefault();e.dataTransfer.dropEffect="move";const t=e.currentTarget,i=t.getBoundingClientRect();this._removeDottedLine();i.top<bf&&i.bottom>bf||this._showDottedLine(t,i.height,bf>e.clientY)}_dropHandler(e){e.preventDefault();e.stopPropagation();const t=parseInt(e.dataTransfer.getData("text/plain"),10),i=this.id;this._removeDottedLine();t!==i&&this._movePage(t,i)}_mouseDownHandler(e){bf=e.clientY}_showDottedLine(e,t,i){const a=document.createElement("div");a.className="dotted-line";i?a.style.setProperty("--dotted-line-margin-x",-t+"px"):a.style.setProperty("--dotted-line-margin-x","6px");e.appendChild(a)}_removeDottedLine(){const e=document.querySelector(".dotted-line");e&&e.parentNode.removeChild(e)}_movePage(e,t){const i=this.div.parentNode,a=i.children[e-1],s=i.children[t-1];a&&s&&Vw.movePage(e,t)}updateId(e){this.id=e;this.renderingId=`thumbnail${e}`;this.div.setAttribute("page-number",e);this.imageContainer.setAttribute("page-number",e);this.setPageLabel(this.pageLabel)}get renderingState(){return function pdf_thumbnail_view_classPrivateFieldGet(e,t){return e.get(pdf_thumbnail_view_assertClassBrand(e,t))}(Sf,this)}set renderingState(e){!function pdf_thumbnail_view_classPrivateFieldSet(e,t,i){return e.set(pdf_thumbnail_view_assertClassBrand(e,t),i),i}(Sf,this,e)}setPdfPage(e){if(!e)return;this.pdfPage=e;this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:1,rotation:t});this.reset()}reset(){this.cancelRendering();this.renderingState=Yg.INITIAL;pdf_thumbnail_view_assertClassBrand(Cf,this,_updateDims).call(this);const{image:e,imageContainer:t}=this,i=e.src;if(i){URL.revokeObjectURL(i);e.src="";t.removeAttribute("data-l10n-id");t.removeAttribute("data-l10n-args");t.classList.add("missingThumbnailImage")}}destroy(){this.reset();this.toggleCurrent(!1);this.div.remove()}update(e){let{rotation:t=null}=e;"number"==typeof t&&(this.rotation=t);const i=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:i});this.reset()}toggleCurrent(e){const{imageContainer:t}=this;if(e){t.ariaCurrent="page";t.tabIndex=0;this.checkbox&&(this.checkbox.tabIndex=0)}else{t.ariaCurrent=!1;t.tabIndex=-1;this.checkbox&&(this.checkbox.tabIndex=-1)}}cancelRendering(){if(this.renderTask){this.renderTask.cancel();this.renderTask=null}this.resume=null}async draw(){if(this.renderingState!==Yg.INITIAL){ngx_console_NgxConsole.error("Must be in new state before drawing");return}const{pageColors:e,pdfPage:t}=this;if(!t){this.renderingState=Yg.FINISHED;throw new Error("pdfPage is not loaded")}this.renderingState=Yg.RUNNING;const{canvas:i,transform:a}=pdf_thumbnail_view_assertClassBrand(Cf,this,_getPageDrawContext).call(this,2),s={canvas:i,transform:a,viewport:this.viewport.clone({scale:2*this.scale}),optionalContentConfigPromise:this._optionalContentConfigPromise,pageColors:e},n=this.renderTask=t.render(s);n.onContinue=e=>{if(this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=Yg.PAUSED;this.resume=()=>{this.renderingState=Yg.RUNNING;e()}}};let r=null;try{await n.promise}catch(e){if(e instanceof RenderingCancelledException)return;r=e}finally{n===this.renderTask&&(this.renderTask=null)}this.renderingState=Yg.FINISHED;await pdf_thumbnail_view_assertClassBrand(Cf,this,_convertCanvasToImage).call(this,i);this.eventBus.dispatch("thumbnailrendered",{source:this,pageNumber:this.id,pdfPage:t});if(r)throw r}setImage(e){if(this.renderingState!==Yg.INITIAL)return;const{thumbnailCanvas:t,pdfPage:i,scale:a}=e;if(t){this.pdfPage||this.setPdfPage(i);if(!(a<this.scale)){this.renderingState=Yg.FINISHED;pdf_thumbnail_view_assertClassBrand(Cf,this,_convertCanvasToImage).call(this,t)}}}setPageLabel(e){this.pageLabel="string"==typeof e?e:null;this.imageContainer.setAttribute("data-l10n-args",pdf_thumbnail_view_assertClassBrand(Cf,this,_getPageL10nArgs).call(this,!0));this.image.setAttribute("data-l10n-args",pdf_thumbnail_view_assertClassBrand(Cf,this,_getPageL10nArgs).call(this));this.checkbox?.setAttribute("data-l10n-args",pdf_thumbnail_view_assertClassBrand(Cf,this,_getPageL10nArgs).call(this))}}function _createStandardThumbnail(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=this.div=document.createElement("div");s.className="thumbnail";s.setAttribute("page-number",t);const n=this.imageContainer=document.createElement("div");s.append(n);n.classList.add("thumbnailImageContainer","missingThumbnailImage");n.role="button";n.tabIndex=-1;n.draggable=!1;n.setAttribute("page-number",t);n.setAttribute("data-l10n-id","pdfjs-thumb-page-title1");n.setAttribute("data-l10n-args",pdf_thumbnail_view_assertClassBrand(Cf,this,_getPageL10nArgs).call(this,!0));const r=this.image=document.createElement("img");n.append(r);a&&(n.draggable=!0);if(i){const e=this.checkbox=document.createElement("input");e.type="checkbox";e.tabIndex=-1;e.setAttribute("data-l10n-id","pdfjs-thumb-page-checkbox1");e.setAttribute("data-l10n-args",pdf_thumbnail_view_assertClassBrand(Cf,this,_getPageL10nArgs).call(this));s.append(e);this.pasteButton=null}pdf_thumbnail_view_assertClassBrand(Cf,this,_updateDims).call(this);e.append(s)}function _updateDims(){const{width:e,height:t}=this.viewport,i=e/t,a=this.canvasWidth=126,s=this.canvasHeight=a/i|0;this.scale=a/e;this.imageContainer.style.height=`${s}px`}function _getPageDrawContext(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const t=new OutputScale,i=e*this.canvasWidth,a=e*this.canvasHeight;t.limitCanvas(i,a,this.maxCanvasPixels,this.maxCanvasDim);const s=document.createElement("canvas");s.width=i*t.sx|0;s.height=a*t.sy|0;return{canvas:s,transform:t.scaled?[t.sx,0,0,t.sy,0,0]:null}}async function _convertCanvasToImage(e){if(this.renderingState!==Yg.FINISHED)throw new Error("#convertCanvasToImage: Rendering has not finished.");const t=pdf_thumbnail_view_assertClassBrand(Cf,this,_reduceImage).call(this,e),{imageContainer:i,image:a}=this,{promise:s,resolve:n}=Promise.withResolvers();t.toBlob(n);const r=await s;a.src=URL.createObjectURL(r);a.setAttribute("data-l10n-id","pdfjs-thumb-page-canvas");a.setAttribute("data-l10n-args",pdf_thumbnail_view_assertClassBrand(Cf,this,_getPageL10nArgs).call(this));i.classList.remove("missingThumbnailImage");FeatureTest.isOffscreenCanvasSupported||(t.width=t.height=0)}function _getReducedImageDims(e){const t=e.width<<3,i=e.height<<3,a=new OutputScale;a.sx=a.sy=1;a.limitCanvas(t,i,this.maxCanvasPixels,this.maxCanvasDim);return[t*a.sx|0,i*a.sy|0]}function _reduceImage(e){const{canvas:t}=pdf_thumbnail_view_assertClassBrand(Cf,this,_getPageDrawContext).call(this,1),i=t.getContext("2d",{alpha:!1,willReadFrequently:!1});if(e.width<=2*t.width){i.drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height);return t}let[a,s]=pdf_thumbnail_view_assertClassBrand(Cf,this,_getReducedImageDims).call(this,t);const[n,r]=TempImageFactory.getCanvas(a,s);for(;a>e.width||s>e.height;){a>>=1;s>>=1}r.drawImage(e,0,0,e.width,e.height,0,0,a,s);for(;a>2*t.width;){r.drawImage(n,0,0,a,s,0,0,a>>1,s>>1);a>>=1;s>>=1}i.drawImage(n,0,0,a,s,0,0,t.width,t.height);return t}function _getPageL10nArgs(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return JSON.stringify({page:this.pageLabel??this.id,total:e?this.linkService.pagesCount:void 0})}function pdf_thumbnail_viewer_classPrivateFieldInitSpec(e,t,i){pdf_thumbnail_viewer_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_thumbnail_viewer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_thumbnail_viewer_toSetter(e,t,i){t||(t=[]);var a=t.length++;return Object.defineProperty({},"_",{set:function(s){t[a]=s,e.apply(i,t)}})}function pdf_thumbnail_viewer_classPrivateFieldGet(e,t){return e.get(pdf_thumbnail_viewer_assertClassBrand(e,t))}function pdf_thumbnail_viewer_classPrivateFieldSet(e,t,i){return e.set(pdf_thumbnail_viewer_assertClassBrand(e,t),i),i}function pdf_thumbnail_viewer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const xf={behavior:"instant",block:"nearest",inline:"nearest",container:"nearest"};var kf=new WeakMap,Ef=new WeakMap,Af=new WeakMap,Gf=new WeakMap,Bf=new WeakMap,Mf=new WeakMap,If=new WeakMap,Tf=new WeakMap,Df=new WeakMap,Lf=new WeakMap,Rf=new WeakMap,Nf=new WeakMap,Of=new WeakMap,Wf=new WeakMap,jf=new WeakMap,Vf=new WeakMap,Uf=new WeakMap,zf=new WeakMap,Hf=new WeakMap,$f=new WeakMap,qf=new WeakMap,Xf=new WeakMap,Kf=new WeakMap,Yf=new WeakMap,Zf=new WeakMap,Jf=new WeakMap,Qf=new WeakMap,em=new WeakMap,tm=new WeakMap,im=new WeakMap,am=new WeakMap,sm=new WeakMap,nm=new WeakMap,rm=new WeakMap,om=new WeakMap,lm=new WeakMap,dm=new WeakMap,cm=new WeakMap,hm=new WeakMap,um=new WeakMap,_m=new WeakMap,pm=new WeakSet;class PDFThumbnailViewer{constructor(e){let{container:t,eventBus:i,linkService:a,renderingQueue:s,maxCanvasPixels:n,maxCanvasDim:r,pageColors:o,abortSignal:l,enableSplitMerge:d,enablePageReordering:c,enableNewBadge:h,statusBar:u,undoBar:_,manageMenu:p,addFileButton:g}=e;!function pdf_thumbnail_viewer_classPrivateMethodInitSpec(e,t){pdf_thumbnail_viewer_checkPrivateRedeclaration(e,t),t.add(e)}(this,pm);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,kf,!1);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Ef,!1);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Af,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Gf,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Bf,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Mf,NaN);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,If,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Tf,0);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Df,0);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Lf,0);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Rf,0);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Nf,0);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Of,0);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Wf,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,jf,NaN);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Vf,0);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Uf,0);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,zf,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Hf,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,$f,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,qf,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Xf,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Kf,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Yf,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Zf,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Jf,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,Qf,pdf_thumbnail_viewer_assertClassBrand(pm,this,_pastePages).bind(this));pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,em,!1);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,tm,!1);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,im,0);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,am,0);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,sm,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,nm,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,rm,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,om,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,lm,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,dm,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,cm,null);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,hm,!1);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,um,!1);pdf_thumbnail_viewer_classPrivateFieldInitSpec(this,_m,null);this.scrollableContainer=t.parentElement;this.container=t;this.eventBus=i;this.linkService=a;this.renderingQueue=s;this.maxCanvasPixels=n;this.maxCanvasDim=r;this.pageColors=o||null;pdf_thumbnail_viewer_classPrivateFieldSet(kf,this,d||!1);pdf_thumbnail_viewer_classPrivateFieldSet(Ef,this,c||!1);pdf_thumbnail_viewer_classPrivateFieldSet(sm,this,u?.viewsManagerStatusActionLabel||null);pdf_thumbnail_viewer_classPrivateFieldSet(rm,this,u?.viewsManagerStatusActionDeselectButton||null);pdf_thumbnail_viewer_classPrivateFieldSet(nm,this,u?.viewsManagerStatusAction||null);pdf_thumbnail_viewer_classPrivateFieldSet(om,this,_?.viewsManagerStatusUndo||null);pdf_thumbnail_viewer_classPrivateFieldSet(lm,this,_?.viewsManagerStatusUndoLabel||null);pdf_thumbnail_viewer_classPrivateFieldSet(dm,this,_?.viewsManagerStatusUndoButton||null);pdf_thumbnail_viewer_classPrivateFieldSet(cm,this,_?.viewsManagerStatusUndoCloseButton||null);if(pdf_thumbnail_viewer_classPrivateFieldGet(kf,this)&&p){const{button:e,menu:t,copy:i,cut:a,delete:s,exportSelected:n}=p;if(h){const t=document.createElement("span");t.setAttribute("data-l10n-id","pdfjs-new-badge-content");t.classList.add("newBadge");e.parentElement.before(t);pdf_thumbnail_viewer_classPrivateFieldSet(_m,this,t)}this.eventBus.on("pagesloaded",()=>{e.disabled=!1},{once:!0});this._manageMenu=new Menu(t,e,[i,a,s,n]);pdf_thumbnail_viewer_classPrivateFieldSet(Hf,this,n);n.addEventListener("click",pdf_thumbnail_viewer_assertClassBrand(pm,this,_saveExtractedPages).bind(this));pdf_thumbnail_viewer_classPrivateFieldSet($f,this,s);s.addEventListener("click",pdf_thumbnail_viewer_assertClassBrand(pm,this,_deletePages).bind(this,"delete"));pdf_thumbnail_viewer_classPrivateFieldSet(qf,this,i);i.addEventListener("click",pdf_thumbnail_viewer_assertClassBrand(pm,this,_copyPages).bind(this));pdf_thumbnail_viewer_classPrivateFieldSet(Xf,this,a);a.addEventListener("click",pdf_thumbnail_viewer_assertClassBrand(pm,this,_cutPages).bind(this));pdf_thumbnail_viewer_assertClassBrand(pm,this,_toggleMenuEntries).call(this,!1);e.disabled=!0;this.eventBus.on("editingaction",e=>{let{name:t}=e;switch(t){case"copyPage":pdf_thumbnail_viewer_assertClassBrand(pm,this,_copyPages).call(this);break;case"cutPage":pdf_thumbnail_viewer_assertClassBrand(pm,this,_cutPages).call(this);break;case"deletePage":pdf_thumbnail_viewer_assertClassBrand(pm,this,_deletePages).call(this,"delete");break;case"savePage":pdf_thumbnail_viewer_assertClassBrand(pm,this,_saveExtractedPages).call(this)}});this.container.addEventListener("contextmenu",e=>{this.eventBus.dispatch("editingstateschanged",{source:this,details:{thumbnailId:parseInt(e.target.closest(".thumbnailImageContainer")?.parentElement.getAttribute("page-number"))??-1,hasSelectedPages:!!pdf_thumbnail_viewer_classPrivateFieldGet(If,this)?.size,canDeletePages:pdf_thumbnail_viewer_assertClassBrand(pm,this,_canDelete).call(this)}})},{signal:l,passive:!0});pdf_thumbnail_viewer_classPrivateFieldGet(dm,this)?.addEventListener("click",pdf_thumbnail_viewer_assertClassBrand(pm,this,_undo).bind(this));pdf_thumbnail_viewer_classPrivateFieldGet(cm,this)?.addEventListener("click",pdf_thumbnail_viewer_assertClassBrand(pm,this,_dismissUndo).bind(this,!0));pdf_thumbnail_viewer_classPrivateFieldGet(rm,this)?.addEventListener("click",()=>{pdf_thumbnail_viewer_assertClassBrand(pm,this,_clearSelection).call(this);pdf_thumbnail_viewer_assertClassBrand(pm,this,_toggleMenuEntries).call(this,!1);pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateStatus).call(this,"select")});pdf_thumbnail_viewer_classPrivateFieldGet(rm,this).classList.toggle("hidden",!0)}else p&&(p.button.hidden=!0);this.scroll=watchScroll(this.scrollableContainer,pdf_thumbnail_viewer_assertClassBrand(pm,this,_scrollUpdated).bind(this),l);pdf_thumbnail_viewer_assertClassBrand(pm,this,_resetView).call(this);pdf_thumbnail_viewer_assertClassBrand(pm,this,pdf_thumbnail_viewer_addEventListeners).call(this)}getThumbnail(e){return this._thumbnails[e]}scrollThumbnailIntoView(e){if(!this.pdfDocument)return;const t=this._thumbnails[e-1];if(!t){ngx_console_NgxConsole.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');return}if(e!==this._currentPageNumber){pdf_thumbnail_viewer_assertClassBrand(pm,this,_resetCurrentThumbnail).call(this,e);t.toggleCurrent(!0)}const{first:i,last:a,views:s}=pdf_thumbnail_viewer_assertClassBrand(pm,this,_getVisibleThumbs).call(this);if(s.length>0){let n=!1;if(e<=i.id||e>=a.id)n=!0;else for(const{id:t,percent:i}of s)if(t===e){n=i<100;break}n&&t.div.scrollIntoView(xf)}this._currentPageNumber=e}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!isValidRotation(e))throw new Error("Invalid thumbnails rotation angle.");if(!this.pdfDocument)return;if(this._pagesRotation===e)return;this._pagesRotation=e;const t={rotation:e};for(const e of this._thumbnails)e.update(t)}swapThumbnails(e,t){let i=this._thumbnails[e].pdfPage;this._thumbnails[e].setPdfPage(this._thumbnails[t].pdfPage);this._thumbnails[t].setPdfPage(i)}cleanup(){for(const e of this._thumbnails)e.renderingState!==Yg.FINISHED&&e.reset()}setDocument(e){this.initialized=!1;if(this.pdfDocument){pdf_thumbnail_viewer_assertClassBrand(pm,this,_cancelRendering).call(this);pdf_thumbnail_viewer_assertClassBrand(pm,this,_resetView).call(this)}this.pdfDocument=e;if(!e)return;pdf_thumbnail_viewer_classPrivateFieldSet(zf,this,e.pagesMapper);const t=e.getPage(1),i=e.getOptionalContentConfig({intent:"display"});t.then(t=>{const a=e.numPages,s=t.getViewport({scale:1}),n=document.createDocumentFragment();for(let e=1;e<=a;++e){const t=new PDFThumbnailView({container:n,eventBus:this.eventBus,id:e,defaultViewport:s.clone(),optionalContentConfigPromise:i,linkService:this.linkService,renderingQueue:this.renderingQueue,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,pageColors:this.pageColors,eventBus:this.eventBus,enableSplitMerge:pdf_thumbnail_viewer_classPrivateFieldGet(kf,this),enablePageReordering:pdf_thumbnail_viewer_classPrivateFieldGet(Ef,this)});this._thumbnails.push(t)}this._thumbnails[0]?.setPdfPage(t);this._thumbnails[this._currentPageNumber-1].toggleCurrent(!0);this.container.append(n)}).catch(e=>{ngx_console_NgxConsole.error("Unable to initialize thumbnail viewer",e)})}setPageLabels(e){if(this.pdfDocument){if(e)if(Array.isArray(e)&&this.pdfDocument.numPages===e.length)this._pageLabels=e;else{this._pageLabels=null;ngx_console_NgxConsole.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(let e=0,t=this._thumbnails.length;e<t;e++)this._thumbnails[e].setPageLabel(this._pageLabels?.[e]??null)}}forceRendering(){const e=pdf_thumbnail_viewer_assertClassBrand(pm,this,_getVisibleThumbs).call(this),t=pdf_thumbnail_viewer_assertClassBrand(pm,this,_getScrollAhead).call(this,e),i=this.renderingQueue.getHighestPriority(e,this._thumbnails,t,!1,!0);if(i){pdf_thumbnail_viewer_assertClassBrand(pm,this,_ensurePdfPageLoaded).call(this,i).then(()=>{this.renderingQueue.renderView(i)});return!0}return!1}hasStructuralChanges(){return pdf_thumbnail_viewer_classPrivateFieldGet(zf,this)?.hasBeenAltered()||!1}getStructuralChanges(){return pdf_thumbnail_viewer_classPrivateFieldGet(zf,this)?.getPageMappingForSaving()||null}stopRendering(){pdf_thumbnail_viewer_assertClassBrand(pm,this,_cancelRendering).call(this)}}yf=PDFThumbnailViewer;function _scrollUpdated(){this.renderingQueue.renderHighestPriority()}function _getVisibleThumbs(){return getVisibleElements({scrollEl:this.scrollableContainer,views:this._thumbnails})}function _resetCurrentThumbnail(e){if(!this.pdfDocument)return;const t=this._thumbnails[this._currentPageNumber-1];t?.toggleCurrent(!1);this._currentPageNumber=e}function _resetView(){this._thumbnails=[];this._currentPageNumber=1;this._pageLabels=null;this._pagesRotation=0;this.container.textContent=""}function _cancelRendering(){for(const e of this._thumbnails)e.cancelRendering()}async function _ensurePdfPageLoaded(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);e.pdfPage||e.setPdfPage(t);return t}catch(e){ngx_console_NgxConsole.error("Unable to get page for thumb view",e);return null}}function _getScrollAhead(e){return 1===e.first?.id||e.last?.id!==this._thumbnails.length&&this.scroll.down}function _getScaleFactor(e){return gm._||(gm._=parseFloat(getComputedStyle(e).getPropertyValue("--thumbnail-dragging-scale")))}function _updateThumbnails(e){pdf_thumbnail_viewer_assertClassBrand(pm,this,_resetCurrentThumbnail).call(this,0);let t=0;const i=pdf_thumbnail_viewer_classPrivateFieldGet(zf,this),a=pdf_thumbnail_viewer_classPrivateFieldSet(Yf,this,this._thumbnails),s=this._thumbnails=[],n=document.createDocumentFragment(),r=pdf_thumbnail_viewer_classPrivateFieldGet(em,this);for(let o=1,l=i.pagesNumber;o<=l;o++){const l=i.getPrevPageNumber(o);if(l<0){let e=pdf_thumbnail_viewer_classPrivateFieldGet(Kf,this).get(-l);e.checkbox.checked=!1;if(r){e.updateId(o);n.append(e.div)}else e=e.clone(n,o);s.push(e);continue}l===e&&(t=o);const d=a[l-1];s.push(d);d.updateId(o);d.checkbox.checked=!1;n.append(d.div)}this.container.replaceChildren(n);return t}function _onStartDragging(e){pdf_thumbnail_viewer_classPrivateFieldSet(Uf,this,this.scrollableContainer.scrollTop);pdf_thumbnail_viewer_classPrivateFieldSet(Vf,this,pdf_thumbnail_viewer_classPrivateFieldGet(Uf,this)+this.scrollableContainer.clientHeight);pdf_thumbnail_viewer_classPrivateFieldSet(Af,this,new AbortController);this.container.classList.add("isDragging");pdf_thumbnail_viewer_classPrivateFieldGet(_m,this)?.classList.add("hidden");const t=parseInt(e.getAttribute("page-number"),10);pdf_thumbnail_viewer_classPrivateFieldSet(Mf,this,t-1);if(!pdf_thumbnail_viewer_classPrivateFieldGet(If,this)?.has(t)){pdf_thumbnail_viewer_classPrivateFieldSet(jf,this,t);pdf_thumbnail_viewer_assertClassBrand(pm,this,_selectPage).call(this,t,!0)}for(const e of pdf_thumbnail_viewer_classPrivateFieldGet(If,this)){const i=this._thumbnails[e-1],a=i.placeholder=document.createElement("div");a.classList.add("thumbnailImageContainer","placeholder");const{div:s,imageContainer:n}=i;s.classList.add("isDragging");a.style.height=getComputedStyle(n).height;n.after(a);if(e!==t){n.classList.add("hidden");continue}if(1===pdf_thumbnail_viewer_classPrivateFieldGet(If,this).size){n.classList.add("draggingThumbnail");pdf_thumbnail_viewer_classPrivateFieldSet(Gf,this,n);continue}const r=pdf_thumbnail_viewer_classPrivateFieldSet(Gf,this,document.createElement("div"));r.classList.add("draggingThumbnail","thumbnailImageContainer","multiple");r.style.height=getComputedStyle(n).height;n.replaceWith(r);n.classList.remove("thumbnailImageContainer");r.append(n);r.setAttribute("data-multiple-count",pdf_thumbnail_viewer_classPrivateFieldGet(If,this).size)}}function _onStopDragging(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=pdf_thumbnail_viewer_classPrivateFieldGet(Gf,this);pdf_thumbnail_viewer_classPrivateFieldSet(Gf,this,null);const i=pdf_thumbnail_viewer_classPrivateFieldGet(Mf,this);pdf_thumbnail_viewer_classPrivateFieldSet(Mf,this,NaN);pdf_thumbnail_viewer_classPrivateFieldGet(Wf,this)?.remove();pdf_thumbnail_viewer_classPrivateFieldSet(Wf,this,null);pdf_thumbnail_viewer_classPrivateFieldGet(Af,this).abort();pdf_thumbnail_viewer_classPrivateFieldSet(Af,this,null);pdf_thumbnail_viewer_classPrivateFieldGet(_m,this)?.classList.remove("hidden");this.container.classList.remove("isDragging");for(const e of pdf_thumbnail_viewer_classPrivateFieldGet(If,this)){const t=this._thumbnails[e-1],{div:i,placeholder:a,imageContainer:s}=t;a.remove();s.classList.remove("draggingThumbnail","hidden");i.classList.remove("isDragging")}if(t.classList.contains("multiple")){const e=t.firstElementChild;t.replaceWith(e);e.classList.add("thumbnailImageContainer")}else t.style.translate="";const a=pdf_thumbnail_viewer_classPrivateFieldGet(If,this);if(!isNaN(i)&&e&&(1!==a.size||!a.has(i+1)&&!a.has(i+2))){this._thumbnails[this._currentPageNumber-1]?.toggleCurrent(!1);this._currentPageNumber=-1;const e=i+1,t=Array.from(a).sort((e,t)=>e-t),s=pdf_thumbnail_viewer_classPrivateFieldGet(zf,this),n=isNaN(pdf_thumbnail_viewer_classPrivateFieldGet(jf,this))?t[0]:pdf_thumbnail_viewer_classPrivateFieldGet(jf,this);s.movePages(a,t,e);pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateCurrentPage).call(this,pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateThumbnails).call(this,n));pdf_thumbnail_viewer_assertClassBrand(pm,this,_computeThumbnailsPosition).call(this);a.clear();pdf_thumbnail_viewer_classPrivateFieldSet(jf,this,NaN);pdf_thumbnail_viewer_assertClassBrand(pm,this,_toggleMenuEntries).call(this,!1);pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateStatus).call(this,"select");pdf_thumbnail_viewer_assertClassBrand(pm,this,pdf_thumbnail_viewer_reportTelemetry).call(this,{action:"move"});this.eventBus.dispatch("pagesedited",{source:this,pagesMapper:s,type:"move"})}if(!isNaN(pdf_thumbnail_viewer_classPrivateFieldGet(jf,this))){pdf_thumbnail_viewer_assertClassBrand(pm,this,_selectPage).call(this,pdf_thumbnail_viewer_classPrivateFieldGet(jf,this),!1);pdf_thumbnail_viewer_classPrivateFieldSet(jf,this,NaN)}}function _clearSelection(){for(const e of pdf_thumbnail_viewer_classPrivateFieldGet(If,this))this._thumbnails[e-1].toggleSelected(!1);pdf_thumbnail_viewer_classPrivateFieldGet(If,this).clear()}function _updateCurrentPage(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];setTimeout(()=>{this.forceRendering();const i=e||1;this.linkService.goToPage(i);const a=this._thumbnails[i-1];!t&&this.container.contains(document.activeElement)||a.imageContainer.focus()},0)}function _undo(){pdf_thumbnail_viewer_assertClassBrand(pm,this,_clearSelection).call(this);pdf_thumbnail_viewer_assertClassBrand(pm,this,_toggleMenuEntries).call(this,!1);pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateStatus).call(this,"select");if(pdf_thumbnail_viewer_classPrivateFieldGet(Kf,this)){pdf_thumbnail_viewer_classPrivateFieldSet(Kf,this,null);pdf_thumbnail_viewer_classPrivateFieldGet(zf,this).cancelCopy();pdf_thumbnail_viewer_assertClassBrand(pm,this,_togglePasteMode).call(this,!1);this.eventBus.dispatch("pagesedited",{source:this,pagesMapper:pdf_thumbnail_viewer_classPrivateFieldGet(zf,this),type:"cancelCopy"})}pdf_thumbnail_viewer_classPrivateFieldSet(em,this,!1);if(pdf_thumbnail_viewer_classPrivateFieldGet(Yf,this)){const e=this._thumbnails[this._currentPageNumber-1];e?.toggleCurrent(!1);const t=document.createDocumentFragment();for(let e=1,i=pdf_thumbnail_viewer_classPrivateFieldGet(Yf,this).length;e<=i;e++){const i=pdf_thumbnail_viewer_classPrivateFieldGet(Yf,this)[e-1];i.updateId(e);i.checkbox.checked=!1;t.append(i.div)}this.container.replaceChildren(t);this._thumbnails=pdf_thumbnail_viewer_classPrivateFieldGet(Yf,this);pdf_thumbnail_viewer_classPrivateFieldSet(Yf,this,null);const i=e?this._thumbnails.indexOf(e):-1;this._currentPageNumber=i+1;e?.toggleCurrent(-1!==i);pdf_thumbnail_viewer_classPrivateFieldGet(zf,this).cancelDelete();this.eventBus.dispatch("pagesedited",{source:this,pagesMapper:pdf_thumbnail_viewer_classPrivateFieldGet(zf,this),type:"cancelDelete"})}}function _dismissUndo(e){pdf_thumbnail_viewer_classPrivateFieldSet(Kf,this,null);if(pdf_thumbnail_viewer_classPrivateFieldGet(Zf,this)){if(pdf_thumbnail_viewer_classPrivateFieldGet(Yf,this)){for(const e of pdf_thumbnail_viewer_classPrivateFieldGet(Zf,this))pdf_thumbnail_viewer_classPrivateFieldGet(Yf,this)[e-1].destroy();pdf_thumbnail_viewer_classPrivateFieldSet(Yf,this,null)}pdf_thumbnail_viewer_classPrivateFieldSet(Zf,this,null)}pdf_thumbnail_viewer_classPrivateFieldSet(em,this,!1);e&&pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateStatus).call(this,"select");pdf_thumbnail_viewer_assertClassBrand(pm,this,_togglePasteMode).call(this,!1);pdf_thumbnail_viewer_classPrivateFieldGet(zf,this).cleanSavedData();this.eventBus.dispatch("pagesedited",{source:this,pagesMapper:pdf_thumbnail_viewer_classPrivateFieldGet(zf,this),type:"cleanSavedData"})}function _canDelete(){const e=pdf_thumbnail_viewer_classPrivateFieldGet(If,this)?.size||0;return e>0&&e<this._thumbnails.length}function _togglePasteMode(e){pdf_thumbnail_viewer_classPrivateFieldSet(hm,this,e);if(e){this.container.classList.add("pasteMode");for(const e of this._thumbnails)e.addPasteButton(pdf_thumbnail_viewer_classPrivateFieldGet(Qf,this))}else{this.container.classList.remove("pasteMode");for(const e of this._thumbnails)e.removePasteButton()}}function pdf_thumbnail_viewer_reportTelemetry(e){this.eventBus.dispatch("reporttelemetry",{source:this,details:{type:"pageOrganization",data:e}})}function _saveExtractedPages(){pdf_thumbnail_viewer_assertClassBrand(pm,this,pdf_thumbnail_viewer_reportTelemetry).call(this,{action:"exportSelected"});this.eventBus.dispatch("saveextractedpages",{source:this,data:pdf_thumbnail_viewer_classPrivateFieldGet(zf,this).extractPages(pdf_thumbnail_viewer_classPrivateFieldGet(If,this))});pdf_thumbnail_viewer_assertClassBrand(pm,this,_clearSelection).call(this);pdf_thumbnail_viewer_assertClassBrand(pm,this,_toggleMenuEntries).call(this,!1);pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateStatus).call(this,"select")}function _copyPages(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(!pdf_thumbnail_viewer_classPrivateFieldGet(em,this)){pdf_thumbnail_viewer_classPrivateFieldSet(Yf,this,null);pdf_thumbnail_viewer_assertClassBrand(pm,this,pdf_thumbnail_viewer_reportTelemetry).call(this,{action:"copy"})}pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateStatus).call(this,pdf_thumbnail_viewer_classPrivateFieldGet(em,this)?"cut":"copy");const t=pdf_thumbnail_viewer_classPrivateFieldSet(Jf,this,Uint32Array.from(pdf_thumbnail_viewer_classPrivateFieldGet(If,this)).sort((e,t)=>e-t)),i=pdf_thumbnail_viewer_classPrivateFieldGet(zf,this);i.copyPages(t);pdf_thumbnail_viewer_classPrivateFieldSet(Kf,this,new Map);for(const e of t)pdf_thumbnail_viewer_classPrivateFieldGet(Kf,this).set(e,this._thumbnails[e-1]);this.eventBus.dispatch("pagesedited",{source:this,pagesMapper:i,pageNumbers:t,type:"copy"});e&&pdf_thumbnail_viewer_assertClassBrand(pm,this,_clearSelection).call(this);pdf_thumbnail_viewer_assertClassBrand(pm,this,_togglePasteMode).call(this,!0);pdf_thumbnail_viewer_assertClassBrand(pm,this,_toggleMenuEntries).call(this,!1)}function _cutPages(){if(pdf_thumbnail_viewer_assertClassBrand(pm,this,_canDelete).call(this)){pdf_thumbnail_viewer_assertClassBrand(pm,this,pdf_thumbnail_viewer_reportTelemetry).call(this,{action:"cut"});pdf_thumbnail_viewer_classPrivateFieldSet(em,this,!0);pdf_thumbnail_viewer_assertClassBrand(pm,this,_copyPages).call(this,!1);pdf_thumbnail_viewer_assertClassBrand(pm,this,_deletePages).call(this,"cut")}}function _pastePages(e){pdf_thumbnail_viewer_assertClassBrand(pm,this,pdf_thumbnail_viewer_reportTelemetry).call(this,{action:"paste"});const t=pdf_thumbnail_viewer_classPrivateFieldGet(zf,this),i=pdf_thumbnail_viewer_classPrivateFieldGet(Jf,this).includes(this._currentPageNumber)?0:this._currentPageNumber;t.pastePages(e);pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateThumbnails).call(this,i);pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateCurrentPage).call(this,e+1,!0);pdf_thumbnail_viewer_assertClassBrand(pm,this,_computeThumbnailsPosition).call(this);this.eventBus.dispatch("pagesedited",{source:this,pagesMapper:t,hasBeenCut:pdf_thumbnail_viewer_classPrivateFieldGet(em,this),type:"paste"});pdf_thumbnail_viewer_classPrivateFieldSet(Kf,this,null);pdf_thumbnail_viewer_classPrivateFieldSet(em,this,!1);pdf_thumbnail_viewer_assertClassBrand(pm,this,_togglePasteMode).call(this,!1);pdf_thumbnail_viewer_assertClassBrand(pm,this,_toggleMenuEntries).call(this,!1);pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateStatus).call(this,"select")}function _deletePages(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"delete";if(!pdf_thumbnail_viewer_assertClassBrand(pm,this,_canDelete).call(this))return;const t=pdf_thumbnail_viewer_classPrivateFieldGet(If,this);if("delete"===e){pdf_thumbnail_viewer_assertClassBrand(pm,this,pdf_thumbnail_viewer_reportTelemetry).call(this,{action:"delete"});pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateStatus).call(this,"delete")}const i=pdf_thumbnail_viewer_classPrivateFieldGet(zf,this),a=t.has(this._currentPageNumber)?0:this._currentPageNumber,s=pdf_thumbnail_viewer_classPrivateFieldSet(Zf,this,Uint32Array.from(t).sort((e,t)=>e-t));i.deletePages(s);pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateCurrentPage).call(this,pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateThumbnails).call(this,a));t.clear();pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateMenuEntries).call(this);this.eventBus.dispatch("pagesedited",{source:this,pagesMapper:i,pageNumbers:s,type:e})}function _updateMenuEntries(){const e=pdf_thumbnail_viewer_classPrivateFieldGet(If,this)?.size||0;pdf_thumbnail_viewer_classPrivateFieldGet(Hf,this).disabled=pdf_thumbnail_viewer_classPrivateFieldGet(qf,this).disabled=!e;pdf_thumbnail_viewer_classPrivateFieldGet($f,this).disabled=pdf_thumbnail_viewer_classPrivateFieldGet(Xf,this).disabled=!pdf_thumbnail_viewer_assertClassBrand(pm,this,_canDelete).call(this)}function _toggleMenuEntries(e){pdf_thumbnail_viewer_classPrivateFieldGet(Hf,this).disabled=pdf_thumbnail_viewer_classPrivateFieldGet($f,this).disabled=pdf_thumbnail_viewer_classPrivateFieldGet(qf,this).disabled=pdf_thumbnail_viewer_classPrivateFieldGet(Xf,this).disabled=!e}function _updateStatus(e){if(!pdf_thumbnail_viewer_classPrivateFieldGet(nm,this)||!pdf_thumbnail_viewer_classPrivateFieldGet(om,this))return;const t=pdf_thumbnail_viewer_classPrivateFieldGet(If,this)?.size||0;if("select"===e){pdf_thumbnail_viewer_classPrivateFieldGet(sm,this).setAttribute("data-l10n-id",t?"pdfjs-views-manager-pages-status-action-label":"pdfjs-views-manager-pages-status-none-action-label");if(t){pdf_thumbnail_viewer_classPrivateFieldGet(_m,this)?.classList.add("hidden");pdf_thumbnail_viewer_classPrivateFieldGet(sm,this).setAttribute("data-l10n-args",JSON.stringify({count:t}));pdf_thumbnail_viewer_classPrivateFieldGet(rm,this).classList.toggle("hidden",!1)}else{pdf_thumbnail_viewer_classPrivateFieldGet(_m,this)?.classList.remove("hidden");pdf_thumbnail_viewer_classPrivateFieldGet(sm,this).removeAttribute("data-l10n-args");pdf_thumbnail_viewer_classPrivateFieldGet(rm,this).classList.toggle("hidden",!0)}pdf_thumbnail_viewer_classPrivateFieldGet(nm,this).classList.toggle("hidden",!1);pdf_thumbnail_viewer_classPrivateFieldGet(om,this).classList.toggle("hidden",!0);pdf_thumbnail_viewer_classPrivateFieldSet(um,this,!1);return}let i;switch(e){case"copy":i="pdfjs-views-manager-pages-status-undo-copy-label";break;case"cut":i="pdfjs-views-manager-status-undo-cut-label";break;case"delete":i="pdfjs-views-manager-pages-status-undo-delete-label"}pdf_thumbnail_viewer_classPrivateFieldGet(lm,this).setAttribute("data-l10n-id",i);pdf_thumbnail_viewer_classPrivateFieldGet(lm,this).setAttribute("data-l10n-args",JSON.stringify({count:t}));if("copy"===e){pdf_thumbnail_viewer_classPrivateFieldGet(dm,this).firstElementChild.setAttribute("data-l10n-id","pdfjs-views-manager-status-done-button-label");pdf_thumbnail_viewer_classPrivateFieldGet(cm,this).classList.toggle("hidden",!0)}else{pdf_thumbnail_viewer_classPrivateFieldGet(dm,this).firstElementChild.setAttribute("data-l10n-id","pdfjs-views-manager-status-undo-button-label");pdf_thumbnail_viewer_classPrivateFieldGet(cm,this).classList.toggle("hidden",!1)}pdf_thumbnail_viewer_classPrivateFieldGet(nm,this).classList.toggle("hidden",!0);pdf_thumbnail_viewer_classPrivateFieldGet(om,this).classList.toggle("hidden",!1);pdf_thumbnail_viewer_classPrivateFieldSet(um,this,!0)}function _moveDraggedContainer(e,t){pdf_thumbnail_viewer_classPrivateFieldGet(tm,this)&&(e=0);(pdf_thumbnail_viewer_classPrivateFieldGet(Tf,this)+e<0||pdf_thumbnail_viewer_classPrivateFieldGet(Tf,this)+pdf_thumbnail_viewer_classPrivateFieldGet(Lf,this)+e>pdf_thumbnail_viewer_classPrivateFieldGet(im,this))&&(e=0);(pdf_thumbnail_viewer_classPrivateFieldGet(Df,this)+t<0||pdf_thumbnail_viewer_classPrivateFieldGet(Df,this)+pdf_thumbnail_viewer_classPrivateFieldGet(Rf,this)+t>pdf_thumbnail_viewer_classPrivateFieldGet(am,this))&&(t=0);pdf_thumbnail_viewer_classPrivateFieldSet(Tf,this,pdf_thumbnail_viewer_classPrivateFieldGet(Tf,this)+e);pdf_thumbnail_viewer_classPrivateFieldSet(Df,this,pdf_thumbnail_viewer_classPrivateFieldGet(Df,this)+t);pdf_thumbnail_viewer_classPrivateFieldSet(Nf,this,pdf_thumbnail_viewer_classPrivateFieldGet(Nf,this)+e);pdf_thumbnail_viewer_classPrivateFieldSet(Of,this,pdf_thumbnail_viewer_classPrivateFieldGet(Of,this)+t);pdf_thumbnail_viewer_classPrivateFieldGet(Gf,this).style.translate=`${pdf_thumbnail_viewer_classPrivateFieldGet(Nf,this)}px ${pdf_thumbnail_viewer_classPrivateFieldGet(Of,this)}px`;pdf_thumbnail_viewer_classPrivateFieldGet(Df,this)+pdf_thumbnail_viewer_classPrivateFieldGet(Rf,this)>pdf_thumbnail_viewer_classPrivateFieldGet(Vf,this)?this.scrollableContainer.scrollTop=Math.min(this.scrollableContainer.scrollTop+20,pdf_thumbnail_viewer_classPrivateFieldGet(am,this)):pdf_thumbnail_viewer_classPrivateFieldGet(Df,this)<pdf_thumbnail_viewer_classPrivateFieldGet(Uf,this)&&(this.scrollableContainer.scrollTop=Math.max(this.scrollableContainer.scrollTop-20,0));const i=pdf_thumbnail_viewer_assertClassBrand(pm,this,_findClosestThumbnail).call(this,pdf_thumbnail_viewer_classPrivateFieldGet(Tf,this)+pdf_thumbnail_viewer_classPrivateFieldGet(Lf,this)/2,pdf_thumbnail_viewer_classPrivateFieldGet(Df,this)+pdf_thumbnail_viewer_classPrivateFieldGet(Rf,this)/2);if(!i)return;let a=pdf_thumbnail_viewer_classPrivateFieldGet(Wf,this);if(!a){a=pdf_thumbnail_viewer_classPrivateFieldSet(Wf,this,document.createElement("div"));a.className="dragMarker";this.container.firstChild.before(a)}const[s,n]=i,r=a.style,{bbox:o,x:l}=pdf_thumbnail_viewer_classPrivateFieldGet(Bf,this);let d,c,h,u;if(s<0)if(1===l.length){c=o[1]-15;d=o[4];h=o[2]}else{c=o[1];d=o[0]-15;u=o[3]}else if(1===l.length){c=o[4*s+1]+o[4*s+3]+n;d=o[4*s];h=o[4*s+2]}else{c=o[4*s+1];d=o[4*s]+o[4*s+2]+n;u=o[4*s+3]}r.translate=`${d}px ${c}px`;r.width=h?`${h}px`:"";r.height=u?`${u}px`:""}function _computeThumbnailsPosition(){const e=[],t=[],i=[],a=new Float32Array(4*this._thumbnails.length);let s,n,r,o=-1/0,l=-1/0,d=-1;for(let c=0,h=this._thumbnails.length;c<h;c++){const{div:u}=this._thumbnails[c],{offsetTop:_,offsetLeft:p,offsetWidth:g,offsetHeight:f}=u;if(0===g)return;a[4*c]=p;a[4*c+1]=_;a[4*c+2]=g;a[4*c+3]=f;if(p>o){o=p+g/2;s??=o+g;e.push(o)}if(_>l){-1===d&&e.length>1&&(d=h%e.length);l=_+f/2;r??=l+f;t.push(l)}if(d>0&&c>=h-d){const e=p+g/2;i.push(e);n??=e+g}}const c=e.length>1?(e[1]-s)/2:(t[1]-r)/2;pdf_thumbnail_viewer_classPrivateFieldSet(Bf,this,{x:e,y:t,lastX:i,space:c,lastSpace:(i.at(-1)-n)/2,bbox:a});pdf_thumbnail_viewer_classPrivateFieldSet(tm,this,1===e.length);({clientWidth:pdf_thumbnail_viewer_toSetter(pdf_thumbnail_viewer_classPrivateFieldSet,[im,this])._,scrollHeight:pdf_thumbnail_viewer_toSetter(pdf_thumbnail_viewer_classPrivateFieldSet,[am,this])._}=this.scrollableContainer)}function pdf_thumbnail_viewer_addEventListeners(){this.eventBus.on("resize",e=>{let{source:t}=e;t.thumbnailsView===this.container&&pdf_thumbnail_viewer_assertClassBrand(pm,this,_computeThumbnailsPosition).call(this)});this.container.addEventListener("keydown",e=>{const{target:t}=e,i=t instanceof HTMLInputElement&&"checkbox"===t.type;switch(e.key){case"ArrowLeft":pdf_thumbnail_viewer_assertClassBrand(pm,this,pdf_thumbnail_viewer_goToNextItem).call(this,t,!1,!0,i);stopEvent(e);break;case"ArrowRight":pdf_thumbnail_viewer_assertClassBrand(pm,this,pdf_thumbnail_viewer_goToNextItem).call(this,t,!0,!0,i);stopEvent(e);break;case"ArrowDown":pdf_thumbnail_viewer_assertClassBrand(pm,this,pdf_thumbnail_viewer_goToNextItem).call(this,t,!0,!1,i);stopEvent(e);break;case"ArrowUp":pdf_thumbnail_viewer_assertClassBrand(pm,this,pdf_thumbnail_viewer_goToNextItem).call(this,t,!1,!1,i);stopEvent(e);break;case"Home":pdf_thumbnail_viewer_assertClassBrand(pm,this,_focusThumbnailElement).call(this,this._thumbnails[0],i);stopEvent(e);break;case"End":pdf_thumbnail_viewer_assertClassBrand(pm,this,_focusThumbnailElement).call(this,this._thumbnails.at(-1),i);stopEvent(e);break;case"Enter":case" ":i||pdf_thumbnail_viewer_assertClassBrand(pm,this,_goToPage).call(this,e);break;case"c":if(pdf_thumbnail_viewer_classPrivateFieldGet(kf,this)&&(e.ctrlKey||e.metaKey)&&pdf_thumbnail_viewer_classPrivateFieldGet(If,this)?.size){pdf_thumbnail_viewer_assertClassBrand(pm,this,_copyPages).call(this);stopEvent(e)}break;case"x":if(pdf_thumbnail_viewer_classPrivateFieldGet(kf,this)&&(e.ctrlKey||e.metaKey)&&pdf_thumbnail_viewer_classPrivateFieldGet(If,this)?.size){pdf_thumbnail_viewer_assertClassBrand(pm,this,_cutPages).call(this);stopEvent(e)}break;case"Delete":case"Backspace":if(pdf_thumbnail_viewer_classPrivateFieldGet(kf,this)&&!pdf_thumbnail_viewer_classPrivateFieldGet(hm,this)&&pdf_thumbnail_viewer_classPrivateFieldGet(If,this)?.size){pdf_thumbnail_viewer_assertClassBrand(pm,this,_deletePages).call(this);stopEvent(e)}}});this.container.addEventListener("click",e=>{const{target:t}=e;if(t instanceof HTMLInputElement){const e=parseInt(t.parentElement.getAttribute("page-number"),10);pdf_thumbnail_viewer_assertClassBrand(pm,this,_selectPage).call(this,e,t.checked);return}pdf_thumbnail_viewer_assertClassBrand(pm,this,_goToPage).call(this,e)});pdf_thumbnail_viewer_assertClassBrand(pm,this,_addDragListeners).call(this)}function _selectPage(e,t){pdf_thumbnail_viewer_classPrivateFieldGet(um,this)&&pdf_thumbnail_viewer_assertClassBrand(pm,this,_dismissUndo).call(this,!1);const i=pdf_thumbnail_viewer_classPrivateFieldGet(If,this)??pdf_thumbnail_viewer_classPrivateFieldSet(If,this,new Set);t?i.add(e):i.delete(e);pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateMenuEntries).call(this);pdf_thumbnail_viewer_assertClassBrand(pm,this,_updateStatus).call(this,"select")}function _addDragListeners(){var e=this;(pdf_thumbnail_viewer_classPrivateFieldGet(kf,this)||pdf_thumbnail_viewer_classPrivateFieldGet(Ef,this))&&this.container.addEventListener("pointerdown",t=>{const{target:i,clientX:a,clientY:s,pointerId:n}=t;if(0!==t.button||pdf_thumbnail_viewer_classPrivateFieldGet(hm,this)||1===this._thumbnails.length||!isNaN(pdf_thumbnail_viewer_classPrivateFieldGet(Mf,this))||!i.classList.contains("thumbnailImageContainer"))return;const r=i.parentElement,o=new AbortController,{signal:l}=o;let d=a,c=s,h=this.scrollableContainer.scrollTop;const u=_getScaleFactor.call(yf,i);pdf_thumbnail_viewer_classPrivateFieldSet(Of,this,((u-1)*t.layerY+i.offsetTop)/u);pdf_thumbnail_viewer_classPrivateFieldGet(tm,this)?pdf_thumbnail_viewer_classPrivateFieldSet(Nf,this,i.offsetLeft+.5*(u-1)*i.offsetWidth/u):pdf_thumbnail_viewer_classPrivateFieldSet(Nf,this,((u-1)*t.layerX+i.offsetLeft)/u);pdf_thumbnail_viewer_classPrivateFieldSet(Tf,this,r.offsetLeft+pdf_thumbnail_viewer_classPrivateFieldGet(Nf,this));pdf_thumbnail_viewer_classPrivateFieldSet(Df,this,r.offsetTop+pdf_thumbnail_viewer_classPrivateFieldGet(Of,this));pdf_thumbnail_viewer_classPrivateFieldSet(Lf,this,i.offsetWidth/u);pdf_thumbnail_viewer_classPrivateFieldSet(Rf,this,i.offsetHeight/u);this.container.addEventListener("pointermove",t=>{const{clientX:i,clientY:l,pointerId:u}=t;if(isNaN(pdf_thumbnail_viewer_classPrivateFieldGet(Mf,this))){if(u!==n||Math.abs(i-a)<=5&&Math.abs(l-s)<=5)return;pdf_thumbnail_viewer_assertClassBrand(pm,this,_onStartDragging).call(this,r);const stopDragging=function(t){let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];pdf_thumbnail_viewer_assertClassBrand(pm,e,_onStopDragging).call(e,i);o.abort()},{signal:t}=pdf_thumbnail_viewer_classPrivateFieldGet(Af,this);window.addEventListener("touchmove",stopEvent,{passive:!1,signal:t});window.addEventListener("contextmenu",noContextMenu,{signal:t});this.scrollableContainer.addEventListener("scrollend",()=>{const{scrollableContainer:{clientHeight:e,scrollTop:t}}=this;pdf_thumbnail_viewer_classPrivateFieldSet(Uf,this,t);pdf_thumbnail_viewer_classPrivateFieldSet(Vf,this,t+e);const i=t-h;h=t;pdf_thumbnail_viewer_assertClassBrand(pm,this,_moveDraggedContainer).call(this,0,i)},{passive:!0,signal:t});window.addEventListener("pointerup",e=>{if(e.pointerId===n){window.addEventListener("click",stopEvent,{capture:!0,once:!0,signal:t});stopEvent(e);stopDragging(e,!0)}},{signal:t});window.addEventListener("blur",stopDragging,{signal:t});window.addEventListener("pointercancel",stopDragging,{signal:t});window.addEventListener("wheel",stopEvent,{passive:!1,signal:t});window.addEventListener("keydown",e=>{"Escape"!==e.key||isNaN(pdf_thumbnail_viewer_classPrivateFieldGet(Mf,this))||stopDragging(e)},{signal:t})}const _=i-d,p=l-c;d=i;c=l;pdf_thumbnail_viewer_assertClassBrand(pm,this,_moveDraggedContainer).call(this,_,p)},{passive:!0,signal:l});window.addEventListener("pointerup",e=>{let{pointerId:t}=e;t===n&&o.abort()},{signal:l});window.addEventListener("dragstart",stopEvent,{capture:!0,signal:l})})}function _goToPage(e){const{target:t}=e;if(t.classList.contains("thumbnailImageContainer")){const i=parseInt(t.parentElement.getAttribute("page-number"),10);this.linkService.goToPage(i);stopEvent(e)}}function _focusThumbnailElement(e,t){t&&e.checkbox?e.checkbox.focus():e.imageContainer.focus()}function pdf_thumbnail_viewer_goToNextItem(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=parseInt(e.parentElement.getAttribute("page-number"),10);isNaN(s)&&(s=this._currentPageNumber);const n=t?1:-1;let r;if(i){const e=MathClamp(s+n,1,this._thumbnails.length+1);r=this._thumbnails[e-1]}else{const e=this._thumbnails[s-1],{x:t,y:i}=e.div.getBoundingClientRect();let a;for(let e=s-1+n;e>=0&&e<this._thumbnails.length;e+=n){const s=this._thumbnails[e],{x:n,y:o}=s.div.getBoundingClientRect();a||o===i||(a=s);if(n===t){r=s;break}}r||(r=a)}r&&pdf_thumbnail_viewer_assertClassBrand(pm,this,_focusThumbnailElement).call(this,r,a)}function _findClosestThumbnail(e,t){pdf_thumbnail_viewer_classPrivateFieldGet(Bf,this)||pdf_thumbnail_viewer_assertClassBrand(pm,this,_computeThumbnailsPosition).call(this);const{x:i,y:a,lastX:s,space:n,lastSpace:r}=pdf_thumbnail_viewer_classPrivateFieldGet(Bf,this),o=pdf_thumbnail_viewer_classPrivateFieldGet(Mf,this);let l,d=o%i.length,c=Math.floor(o/i.length),h=c===a.length-1?s:i;if(a[c]<=t&&t<(a[c+1]??1/0)&&h[d]<=e&&e<(h[d+1]??1/0))return null;c=binarySearchFirstItem(a,e=>t<e);if(pdf_thumbnail_viewer_classPrivateFieldGet(tm,this))l=c-1;else{if(c===a.length)c=a.length-1;else{c=Math.abs(a[c-1]-t)<Math.abs(a[c]-t)?c-1:c}h=c===a.length-1&&s.length>0?s:i;d=binarySearchFirstItem(h,t=>e<t)-1;if(c<0){d<=0&&(d=-1);c=0}l=MathClamp(c*i.length+d,-1,this._thumbnails.length-1)}if(l===o)return null;pdf_thumbnail_viewer_classPrivateFieldSet(Mf,this,l);return[l,c===a.length-1&&s.length>0&&d>=0?r:n]}var gm={_:0};class Page{constructor(e,t){this.state={angle:0,area:[],position:{x:0,y:0},hardAngle:0,hardDrawingAngle:0};this.createdDensity=t;this.nowDrawingDensity=this.createdDensity;this.render=e}setDensity(e){this.createdDensity=e;this.nowDrawingDensity=e}setDrawingDensity(e){this.nowDrawingDensity=e}setPosition(e){this.state.position=e}setAngle(e){this.state.angle=e}setArea(e){this.state.area=e}setHardDrawingAngle(e){this.state.hardDrawingAngle=e}setHardAngle(e){this.state.hardAngle=e;this.state.hardDrawingAngle=e}setOrientation(e){this.orientation=e}getDrawingDensity(){return this.nowDrawingDensity}getDensity(){return this.createdDensity}getHardAngle(){return this.state.hardAngle}}class PageCollection{constructor(e,t){this.pages=[];this.currentPageIndex=0;this.currentSpreadIndex=0;this.landscapeSpread=[];this.portraitSpread=[];this.render=t;this.app=e;this.currentPageIndex=0;this.isShowCover=this.app.getSettings().showCover}destroy(){this.pages=[]}createSpread(){this.landscapeSpread=[];this.portraitSpread=[];for(let e=0;e<this.pages.length;e++)this.portraitSpread.push([e]);let e=0;if(this.isShowCover){this.pages[0].setDensity("hard");this.landscapeSpread.push([e]);e++}for(let t=e;t<this.pages.length;t+=2)if(t<this.pages.length-1)this.landscapeSpread.push([t,t+1]);else{this.landscapeSpread.push([t]);this.pages[t].setDensity("hard")}}getSpread(){return"landscape"===this.render.getOrientation()?this.landscapeSpread:this.portraitSpread}getSpreadIndexByPage(e){const t=this.getSpread();for(let i=0;i<t.length;i++)if(e===t[i][0]||e===t[i][1])return i;return null}getPageCount(){return this.pages.length}getPages(){return this.pages}getPage(e){if(e>=0&&e<this.pages.length)return this.pages[e];throw new Error("Invalid page number")}nextBy(e){const t=this.pages.indexOf(e);return t<this.pages.length-1?this.pages[t+1]:null}prevBy(e){const t=this.pages.indexOf(e);return t>0?this.pages[t-1]:null}getFlippingPage(e){const t=this.currentSpreadIndex;if("portrait"===this.render.getOrientation())return 0===e?this.pages[t].newTemporaryCopy():this.pages[t-1];{const i=0===e?this.getSpread()[t+1]:this.getSpread()[t-1];return 1===i.length||0===e?this.pages[i[0]]:this.pages[i[1]]}}getBottomPage(e){const t=this.currentSpreadIndex;if("portrait"===this.render.getOrientation())return 0===e?this.pages[t+1]:this.pages[t-1];{const i=0===e?this.getSpread()[t+1]:this.getSpread()[t-1];return 1===i.length?this.pages[i[0]]:0===e?this.pages[i[1]]:this.pages[i[0]]}}showNext(){if(this.currentSpreadIndex<this.getSpread().length){this.currentSpreadIndex++;this.showSpread()}}showPrev(){if(this.currentSpreadIndex>0){this.currentSpreadIndex--;this.showSpread()}}getCurrentPageIndex(){return this.currentPageIndex}show(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;null===e&&(e=this.currentPageIndex);if(e<0||e>=this.pages.length)return;const t=this.getSpreadIndexByPage(e);if(null!==t){this.currentSpreadIndex=t;this.showSpread()}}getCurrentSpreadIndex(){return this.currentSpreadIndex}setCurrentSpreadIndex(e){if(!(e>=0&&e<this.getSpread().length))throw new Error("Invalid page");this.currentSpreadIndex=e}showSpread(){const e=this.getSpread()[this.currentSpreadIndex];if(2===e.length){this.render.setLeftPage(this.pages[e[0]]);this.render.setRightPage(this.pages[e[1]])}else if("landscape"===this.render.getOrientation())if(e[0]===this.pages.length-1){this.render.setLeftPage(this.pages[e[0]]);this.render.setRightPage(null)}else{this.render.setLeftPage(null);this.render.setRightPage(this.pages[e[0]])}else{this.render.setLeftPage(null);this.render.setRightPage(this.pages[e[0]])}this.currentPageIndex=e[0];this.app.updatePageIndex(this.currentPageIndex)}}class Helper{static GetDistanceBetweenTwoPoint(e,t){return null===e||null===t?1/0:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}static GetSegmentLength(e){return Helper.GetDistanceBetweenTwoPoint(e[0],e[1])}static GetAngleBetweenTwoLine(e,t){const i=e[0].y-e[1].y,a=t[0].y-t[1].y,s=e[1].x-e[0].x,n=t[1].x-t[0].x;return Math.acos((i*a+s*n)/(Math.sqrt(i*i+s*s)*Math.sqrt(a*a+n*n)))}static PointInRect(e,t){return null===t?null:t.x>=e.left&&t.x<=e.width+e.left&&t.y>=e.top&&t.y<=e.top+e.height?t:null}static GetRotatedPoint(e,t,i){return{x:e.x*Math.cos(i)+e.y*Math.sin(i)+t.x,y:e.y*Math.cos(i)-e.x*Math.sin(i)+t.y}}static LimitPointToCircle(e,t,i){if(Helper.GetDistanceBetweenTwoPoint(e,i)<=t)return i;const a=e.x,s=e.y,n=i.x,r=i.y;let o=Math.sqrt(Math.pow(t,2)*Math.pow(a-n,2)/(Math.pow(a-n,2)+Math.pow(s-r,2)))+a;i.x<0&&(o*=-1);let l=(o-a)*(s-r)/(a-n)+s;a-n+s===0&&(l=t);return{x:o,y:l}}static GetIntersectBetweenTwoSegment(e,t,i){return Helper.PointInRect(e,Helper.GetIntersectBeetwenTwoLine(t,i))}static GetIntersectBeetwenTwoLine(e,t){const i=e[0].y-e[1].y,a=t[0].y-t[1].y,s=e[1].x-e[0].x,n=t[1].x-t[0].x,r=e[0].x*e[1].y-e[1].x*e[0].y,o=t[0].x*t[1].y-t[1].x*t[0].y,l=i*o-a*r,d=s*o-n*r,c=-(r*n-o*s)/(i*n-a*s),h=-(i*o-a*r)/(i*n-a*s);if(isFinite(c)&&isFinite(h))return{x:c,y:h};if(Math.abs(l-d)<.1)throw new Error("Segment included");return null}static GetCordsFromTwoPoint(e,t){const i=Math.abs(e.x-t.x),a=Math.abs(e.y-t.y),s=Math.max(i,a),n=[e];function getCord(e,t,i,a,s){return t>e?e+s*(i/a):t<e?e-s*(i/a):e}for(let r=1;r<=s;r+=1)n.push({x:getCord(e.x,t.x,i,s,r),y:getCord(e.y,t.y,a,s,r)});return n}}class HTMLPage extends Page{constructor(e,t,i){super(e,i);this.copiedElement=null;this.temporaryCopy=null;this.isLoad=!1;this.element=t;this.element.classList.add("stf__item");this.element.classList.add("--"+i)}newTemporaryCopy(){if("hard"===this.nowDrawingDensity)return this;if(null===this.temporaryCopy){this.copiedElement=this.element.cloneNode(!0);this.element.parentElement.appendChild(this.copiedElement);this.temporaryCopy=new HTMLPage(this.render,this.copiedElement,this.nowDrawingDensity)}return this.getTemporaryCopy()}getTemporaryCopy(){return this.temporaryCopy}hideTemporaryCopy(){if(null!==this.temporaryCopy){this.copiedElement.remove();this.copiedElement=null;this.temporaryCopy=null}}draw(e){const t=e||this.nowDrawingDensity,i=this.render.convertToGlobal(this.state.position),a=this.render.getRect().pageWidth,s=this.render.getRect().height;this.element.classList.remove("--simple");const n=`\n            position: absolute;\n            display: block;\n            z-index: ${this.element.style.zIndex};\n            left: 0;\n            top: 0;\n            width: ${a}px;\n            height: ${s}px;\n        `;"hard"===t?this.drawHard(n):this.drawSoft(i,n)}drawHard(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const t=this.render.getRect().left+this.render.getRect().width/2,i=this.state.hardDrawingAngle,a=e+"\n                backface-visibility: hidden;\n                -webkit-backface-visibility: hidden;\n                clip-path: none;\n                -webkit-clip-path: none;\n            "+(0===this.orientation?`transform-origin: ${this.render.getRect().pageWidth}px 0;\n                   transform: translate3d(0, 0, 0) rotateY(${i}deg);`:`transform-origin: 0 0;\n                   transform: translate3d(${t}px, 0, 0) rotateY(${i}deg);`);this.element.style.cssText=a}drawSoft(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i="polygon( ";for(const e of this.state.area)if(null!==e){let t=1===this.render.getDirection()?{x:-e.x+this.state.position.x,y:e.y-this.state.position.y}:{x:e.x-this.state.position.x,y:e.y-this.state.position.y};t=Helper.GetRotatedPoint(t,{x:0,y:0},this.state.angle);i+=t.x+"px "+t.y+"px, "}i=i.slice(0,-2);i+=")";const a=t+`transform-origin: 0 0; clip-path: ${i}; -webkit-clip-path: ${i};`+(this.render.isSafari()&&0===this.state.angle?`transform: translate(${e.x}px, ${e.y}px);`:`transform: translate3d(${e.x}px, ${e.y}px, 0) rotate(${this.state.angle}rad);`);this.element.style.cssText=a}simpleDraw(e){const t=this.render.getRect(),i=t.pageWidth,a=t.height,s=1===e?t.left+t.pageWidth:t.left,n=t.top;this.element.classList.add("--simple");this.element.style.cssText=`\n            position: absolute;\n            display: block;\n            height: ${a}px;\n            left: ${s}px;\n            top: ${n}px;\n            width: ${i}px;\n            z-index: ${this.render.getSettings().startZIndex+1};`}getElement(){return this.element}load(){this.isLoad=!0}setOrientation(e){super.setOrientation(e);this.element.classList.remove("--left","--right");this.element.classList.add(1===e?"--right":"--left")}setDrawingDensity(e){this.element.classList.remove("--soft","--hard");this.element.classList.add("--"+e);super.setDrawingDensity(e)}}class HTMLPageCollection extends PageCollection{constructor(e,t,i,a){super(e,t);this.element=i;this.pagesElement=a}load(){for(const e of this.pagesElement){const t=new HTMLPage(this.render,e,"hard"===e.dataset.density?"hard":"soft");t.load();this.pages.push(t)}this.createSpread()}}class FlipCalculation{constructor(e,t,i,a){this.direction=e;this.corner=t;this.topIntersectPoint=null;this.sideIntersectPoint=null;this.bottomIntersectPoint=null;this.pageWidth=parseInt(i,10);this.pageHeight=parseInt(a,10)}calc(e){try{this.position=this.calcAngleAndPosition(e);this.calculateIntersectPoint(this.position);return!0}catch(e){return!1}}getFlippingClipArea(){const e=[];let t=!1;e.push(this.rect.topLeft);e.push(this.topIntersectPoint);if(null===this.sideIntersectPoint)t=!0;else{e.push(this.sideIntersectPoint);null===this.bottomIntersectPoint&&(t=!1)}e.push(this.bottomIntersectPoint);(t||"bottom"===this.corner)&&e.push(this.rect.bottomLeft);return e}getBottomClipArea(){const e=[];e.push(this.topIntersectPoint);if("top"===this.corner)e.push({x:this.pageWidth,y:0});else{null!==this.topIntersectPoint&&e.push({x:this.pageWidth,y:0});e.push({x:this.pageWidth,y:this.pageHeight})}null!==this.sideIntersectPoint?Helper.GetDistanceBetweenTwoPoint(this.sideIntersectPoint,this.topIntersectPoint)>=10&&e.push(this.sideIntersectPoint):"top"===this.corner&&e.push({x:this.pageWidth,y:this.pageHeight});e.push(this.bottomIntersectPoint);e.push(this.topIntersectPoint);return e}getAngle(){return 0===this.direction?-this.angle:this.angle}getRect(){return this.rect}getPosition(){return this.position}getActiveCorner(){return 0===this.direction?this.rect.topLeft:this.rect.topRight}getDirection(){return this.direction}getFlippingProgress(){return Math.abs((this.position.x-this.pageWidth)/(2*this.pageWidth)*100)}getCorner(){return this.corner}getBottomPagePosition(){return 1===this.direction?{x:this.pageWidth,y:0}:{x:0,y:0}}getShadowStartPoint(){return"top"===this.corner?this.topIntersectPoint:null!==this.sideIntersectPoint?this.sideIntersectPoint:this.topIntersectPoint}getShadowAngle(){const e=Helper.GetAngleBetweenTwoLine(this.getSegmentToShadowLine(),[{x:0,y:0},{x:this.pageWidth,y:0}]);return 0===this.direction?e:Math.PI-e}calcAngleAndPosition(e){let t=e;this.updateAngleAndGeometry(t);t="top"===this.corner?this.checkPositionAtCenterLine(t,{x:0,y:0},{x:0,y:this.pageHeight}):this.checkPositionAtCenterLine(t,{x:0,y:this.pageHeight},{x:0,y:0});if(Math.abs(t.x-this.pageWidth)<1&&Math.abs(t.y)<1)throw new Error("Point is too small");return t}updateAngleAndGeometry(e){this.angle=this.calculateAngle(e);this.rect=this.getPageRect(e)}calculateAngle(e){const t=this.pageWidth-e.x+1,i="bottom"===this.corner?this.pageHeight-e.y:e.y;let a=2*Math.acos(t/Math.sqrt(i*i+t*t));i<0&&(a=-a);const s=Math.PI-a;if(!isFinite(a)||s>=0&&s<.003)throw new Error("The G point is too small");"bottom"===this.corner&&(a=-a);return a}getPageRect(e){return"top"===this.corner?this.getRectFromBasePoint([{x:0,y:0},{x:this.pageWidth,y:0},{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}],e):this.getRectFromBasePoint([{x:0,y:-this.pageHeight},{x:this.pageWidth,y:-this.pageHeight},{x:0,y:0},{x:this.pageWidth,y:0}],e)}getRectFromBasePoint(e,t){return{topLeft:this.getRotatedPoint(e[0],t),topRight:this.getRotatedPoint(e[1],t),bottomLeft:this.getRotatedPoint(e[2],t),bottomRight:this.getRotatedPoint(e[3],t)}}getRotatedPoint(e,t){return{x:e.x*Math.cos(this.angle)+e.y*Math.sin(this.angle)+t.x,y:e.y*Math.cos(this.angle)-e.x*Math.sin(this.angle)+t.y}}calculateIntersectPoint(e){const t={left:-1,top:-1,width:this.pageWidth+2,height:this.pageHeight+2};if("top"===this.corner){this.topIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[e,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]);this.sideIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[e,this.rect.bottomLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]);this.bottomIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}])}else{this.topIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[this.rect.topLeft,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]);this.sideIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[e,this.rect.topLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]);this.bottomIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}])}}checkPositionAtCenterLine(e,t,i){let a=e;const s=Helper.LimitPointToCircle(t,this.pageWidth,a);if(a!==s){a=s;this.updateAngleAndGeometry(a)}const n=Math.sqrt(Math.pow(this.pageWidth,2)+Math.pow(this.pageHeight,2));let r=this.rect.bottomRight,o=this.rect.topLeft;if("bottom"===this.corner){r=this.rect.topRight;o=this.rect.bottomLeft}if(r.x<=0){const e=Helper.LimitPointToCircle(i,n,o);if(e!==a){a=e;this.updateAngleAndGeometry(a)}}return a}getSegmentToShadowLine(){const e=this.getShadowStartPoint();return[e,e!==this.sideIntersectPoint&&null!==this.sideIntersectPoint?this.sideIntersectPoint:this.bottomIntersectPoint]}}class Flip{constructor(e,t){this.flippingPage=null;this.bottomPage=null;this.calc=null;this.state="read";this.render=e;this.app=t}fold(e){this.setState("user_fold");null===this.calc&&this.start(e);this.do(this.render.convertToPage(e))}flip(e){if(this.app.getSettings().disableFlipByClick&&!this.isPointOnCorners(e))return;null!==this.calc&&this.render.finishAnimation();if(!this.start(e))return;const t=this.getBoundsRect();this.setState("flipping");const i=t.height/10,a="bottom"===this.calc.getCorner()?t.height-i:i,s="bottom"===this.calc.getCorner()?t.height:0;this.calc.calc({x:t.pageWidth-i,y:a});this.animateFlippingTo({x:t.pageWidth-i,y:a},{x:-t.pageWidth,y:s},!0)}start(e){this.reset();const t=this.render.convertToBook(e),i=this.getBoundsRect(),a=this.getDirectionByPoint(t),s=t.y>=i.height/2?"bottom":"top";if(!this.checkDirection(a))return!1;try{this.flippingPage=this.app.getPageCollection().getFlippingPage(a);this.bottomPage=this.app.getPageCollection().getBottomPage(a);if("landscape"===this.render.getOrientation())if(1===a){const e=this.app.getPageCollection().nextBy(this.flippingPage);if(null!==e&&this.flippingPage.getDensity()!==e.getDensity()){this.flippingPage.setDrawingDensity("hard");e.setDrawingDensity("hard")}}else{const e=this.app.getPageCollection().prevBy(this.flippingPage);if(null!==e&&this.flippingPage.getDensity()!==e.getDensity()){this.flippingPage.setDrawingDensity("hard");e.setDrawingDensity("hard")}}this.render.setDirection(a);this.calc=new FlipCalculation(a,s,i.pageWidth.toString(10),i.height.toString(10));return!0}catch(e){return!1}}do(e){if(null!==this.calc&&this.calc.calc(e)){const e=this.calc.getFlippingProgress();this.bottomPage.setArea(this.calc.getBottomClipArea());this.bottomPage.setPosition(this.calc.getBottomPagePosition());this.bottomPage.setAngle(0);this.bottomPage.setHardAngle(0);this.flippingPage.setArea(this.calc.getFlippingClipArea());this.flippingPage.setPosition(this.calc.getActiveCorner());this.flippingPage.setAngle(this.calc.getAngle());0===this.calc.getDirection()?this.flippingPage.setHardAngle(90*(200-2*e)/100):this.flippingPage.setHardAngle(-90*(200-2*e)/100);this.render.setPageRect(this.calc.getRect());this.render.setBottomPage(this.bottomPage);this.render.setFlippingPage(this.flippingPage);this.render.setShadowData(this.calc.getShadowStartPoint(),this.calc.getShadowAngle(),e,this.calc.getDirection())}}flipToPage(e,t){const i=this.app.getPageCollection().getCurrentSpreadIndex(),a=this.app.getPageCollection().getSpreadIndexByPage(e);try{if(a>i){this.app.getPageCollection().setCurrentSpreadIndex(a-1);this.flipNext(t)}if(a<i){this.app.getPageCollection().setCurrentSpreadIndex(a+1);this.flipPrev(t)}}catch(e){}}flipNext(e){this.flip({x:this.render.getRect().left+2*this.render.getRect().pageWidth-10,y:"top"===e?1:this.render.getRect().height-2})}flipPrev(e){this.flip({x:10,y:"top"===e?1:this.render.getRect().height-2})}stopMove(){if(null===this.calc)return;const e=this.calc.getPosition(),t=this.getBoundsRect(),i="bottom"===this.calc.getCorner()?t.height:0;e.x<=0?this.animateFlippingTo(e,{x:-t.pageWidth,y:i},!0):this.animateFlippingTo(e,{x:t.pageWidth,y:i},!1)}showCorner(e){if(!this.checkState("read","fold_corner"))return;const t=this.getBoundsRect(),i=t.pageWidth;if(this.isPointOnCorners(e))if(null===this.calc){if(!this.start(e))return;this.setState("fold_corner");this.calc.calc({x:i-1,y:1});const a=50,s="bottom"===this.calc.getCorner()?t.height-1:1,n="bottom"===this.calc.getCorner()?t.height-a:a;this.animateFlippingTo({x:i-1,y:s},{x:i-a,y:n},!1,!1)}else this.do(this.render.convertToPage(e));else{this.setState("read");this.render.finishAnimation();this.stopMove()}}animateFlippingTo(e,t,i){let a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=Helper.GetCordsFromTwoPoint(e,t),n=[];for(const e of s)n.push(()=>this.do(e));const r=this.getAnimationDuration(s.length);this.render.startAnimation(n,r,()=>{if(this.calc){i&&(1===this.calc.getDirection()?this.app.turnToPrevPage():this.app.turnToNextPage());if(a){this.render.setBottomPage(null);this.render.setFlippingPage(null);this.render.clearShadow();this.setState("read");this.reset()}}})}getCalculation(){return this.calc}getState(){return this.state}setState(e){if(this.state!==e){this.app.updateState(e);this.state=e}}getDirectionByPoint(e){const t=this.getBoundsRect();if("portrait"===this.render.getOrientation()){if(e.x-t.pageWidth<=t.width/5)return 1}else if(e.x<t.width/2)return 1;return 0}getAnimationDuration(e){const t=this.app.getSettings().flippingTime;return e>=1e3?t:e/1e3*t}checkDirection(e){return 0===e?this.app.getCurrentPageIndex()<this.app.getPageCount()-1:this.app.getCurrentPageIndex()>=1}reset(){this.calc=null;this.flippingPage=null;this.bottomPage=null}getBoundsRect(){return this.render.getRect()}checkState(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];for(const e of t)if(this.state===e)return!0;return!1}isPointOnCorners(e){const t=this.getBoundsRect(),i=t.pageWidth,a=Math.sqrt(Math.pow(i,2)+Math.pow(t.height,2))/5,s=this.render.convertToBook(e);return s.x>0&&s.y>0&&s.x<t.width&&s.y<t.height&&(s.x<a||s.x>t.width-a)&&(s.y<a||s.y>t.height-a)}}class Render{constructor(e,t){this.leftPage=null;this.rightPage=null;this.flippingPage=null;this.bottomPage=null;this.direction=null;this.orientation=null;this.shadow=null;this.animation=null;this.pageRect=null;this.boundsRect=null;this.timer=0;this.safari=!1;this.setting=t;this.app=e;const i=new RegExp("Version\\/[\\d\\.]+.*Safari/");this.safari=null!==i.exec(window.navigator.userAgent)}render(e){if(null!==this.animation){const t=Math.round((e-this.animation.startedAt)/this.animation.durationFrame);if(t<this.animation.frames.length)this.animation.frames[t]();else{this.animation.onAnimateEnd();this.animation=null}}this.timer=e;this.drawFrame()}start(){this.update();const loop=e=>{this.render(e);requestAnimationFrame(loop)};requestAnimationFrame(loop)}startAnimation(e,t,i){this.finishAnimation();this.animation={frames:e,duration:t,durationFrame:t/e.length,onAnimateEnd:i,startedAt:this.timer}}finishAnimation(){if(null!==this.animation){this.animation.frames[this.animation.frames.length-1]();null!==this.animation.onAnimateEnd&&this.animation.onAnimateEnd()}this.animation=null}update(){this.boundsRect=null;const e=this.calculateBoundsRect();if(this.orientation!==e){this.orientation=e;this.app.updateOrientation(e)}}calculateBoundsRect(){let e="landscape";const t=this.getBlockWidth(),i=t/2,a=this.getBlockHeight()/2,s=this.setting.width/this.setting.height;let n=this.setting.width,r=this.setting.height,o=i-n;if("stretch"===this.setting.size){t<2*this.setting.minWidth&&this.app.getSettings().usePortrait&&(e="portrait");n="portrait"===e?this.getBlockWidth():this.getBlockWidth()/2;n>this.setting.maxWidth&&(n=this.setting.maxWidth);r=n/s;if(r>this.getBlockHeight()){r=this.getBlockHeight();n=r*s}o="portrait"===e?i-n/2-n:i-n}else if(t<2*n&&this.app.getSettings().usePortrait){e="portrait";o=i-n/2-n}this.boundsRect={left:o,top:a-r/2,width:2*n,height:r,pageWidth:n};return e}setShadowData(e,t,i,a){if(!this.app.getSettings().drawShadow)return;const s=100*this.getSettings().maxShadowOpacity;this.shadow={pos:e,angle:t,width:3*this.getRect().pageWidth/4*i/100,opacity:(100-i)*s/100/100,direction:a,progress:2*i}}clearShadow(){this.shadow=null}getBlockWidth(){return this.app.getUI().getDistElement().offsetWidth}getBlockHeight(){return this.app.getUI().getDistElement().offsetHeight}getDirection(){return this.direction}getRect(){null===this.boundsRect&&this.calculateBoundsRect();return this.boundsRect}getSettings(){return this.app.getSettings()}getOrientation(){return this.orientation}setPageRect(e){this.pageRect=e}setDirection(e){this.direction=e}setRightPage(e){null!==e&&e.setOrientation(1);this.rightPage=e}setLeftPage(e){null!==e&&e.setOrientation(0);this.leftPage=e}setBottomPage(e){null!==e&&e.setOrientation(1===this.direction?0:1);this.bottomPage=e}setFlippingPage(e){null!==e&&e.setOrientation(0===this.direction&&"portrait"!==this.orientation?0:1);this.flippingPage=e}convertToBook(e){const t=this.getRect();return{x:e.x-t.left,y:e.y-t.top}}isSafari(){return this.safari}convertToPage(e,t){t||(t=this.direction);const i=this.getRect();return{x:0===t?e.x-i.left-i.width/2:i.width/2-e.x+i.left,y:e.y-i.top}}convertToGlobal(e,t){t||(t=this.direction);if(null==e)return null;const i=this.getRect();return{x:0===t?e.x+i.left+i.width/2:i.width/2-e.x+i.left,y:e.y+i.top}}convertRectToGlobal(e,t){t||(t=this.direction);return{topLeft:this.convertToGlobal(e.topLeft,t),topRight:this.convertToGlobal(e.topRight,t),bottomLeft:this.convertToGlobal(e.bottomLeft,t),bottomRight:this.convertToGlobal(e.bottomRight,t)}}}class UI{constructor(e,t,i){this.cspPolicyService=t.cspPolicyService;this.touchPoint=null;this.swipeTimeout=250;this.onResize=()=>{this.update()};this.onMouseDown=e=>{if(this.checkTarget(e.target)){if(!this.app.getSettings().enableFlipByDrag){this._clickStartPos=this.getMousePos(e.clientX,e.clientY);this._clickStartClientX=e.clientX;this._clickStartClientY=e.clientY;return}const t=this.getMousePos(e.clientX,e.clientY);this.app.startUserTouch(t);e.preventDefault()}};this.onTouchStart=e=>{if(this.checkTarget(e.target)){if(!this.app.getSettings().enableFlipByDrag)return;if(e.changedTouches.length>0){const t=e.changedTouches[0],i=this.getMousePos(t.clientX,t.clientY);this.touchPoint={point:i,time:Date.now()};setTimeout(()=>{null!==this.touchPoint&&this.app.startUserTouch(i)},this.swipeTimeout);this.app.getSettings().mobileScrollSupport||e.preventDefault()}}};this.onMouseUp=e=>{if(this._clickStartPos){const t=e.clientX-this._clickStartClientX,i=e.clientY-this._clickStartClientY;if(t*t+i*i<25){const e=this._clickStartPos;this.app.startUserTouch(e);this.app.userStop(e)}this._clickStartPos=null;return}const t=this.getMousePos(e.clientX,e.clientY);this.app.userStop(t)};this.onMouseMove=e=>{if(!this.app.getSettings().enableFlipByDrag)return;const t=this.getMousePos(e.clientX,e.clientY);this.app.userMove(t,!1)};this.onTouchMove=e=>{if(e.changedTouches.length>0){const t=e.changedTouches[0],i=this.getMousePos(t.clientX,t.clientY);if(this.app.getSettings().mobileScrollSupport){null!==this.touchPoint&&(Math.abs(this.touchPoint.point.x-i.x)>10||"read"!==this.app.getState())&&e.cancelable&&this.app.userMove(i,!0);"read"!==this.app.getState()&&e.preventDefault()}else this.app.userMove(i,!0)}};this.onTouchEnd=e=>{if(e.changedTouches.length>0){const t=e.changedTouches[0],i=this.getMousePos(t.clientX,t.clientY);let a=!1;if(null!==this.touchPoint){const e=i.x-this.touchPoint.point.x,t=Math.abs(i.y-this.touchPoint.point.y);if(Math.abs(e)>this.swipeDistance&&t<2*this.swipeDistance&&Date.now()-this.touchPoint.time<this.swipeTimeout){e>0?this.app.flipPrev(this.touchPoint.point.y<this.app.getRender().getRect().height/2?"top":"bottom"):this.app.flipNext(this.touchPoint.point.y<this.app.getRender().getRect().height/2?"top":"bottom");a=!0}this.touchPoint=null}this.app.userStop(i,a)}};this.parentElement=e;e.classList.add("stf__parent");const a=this.cspPolicyService.createTrustedHTML('<div class="stf__wrapper"></div>');e.insertAdjacentHTML("afterbegin",a);this.wrapper=e.querySelector(".stf__wrapper");this.app=t;const s=this.app.getSettings().usePortrait?1:2;e.style.minWidth=i.minWidth*s+"px";e.style.minHeight=i.minHeight+"px";if("fixed"===i.size){e.style.minWidth=i.width*s+"px";e.style.minHeight=i.height+"px"}if(i.autoSize){e.style.width="100%";e.style.maxWidth=2*i.maxWidth+"px"}e.style.display="block";window.addEventListener("resize",this.onResize,!1);this.swipeDistance=i.swipeDistance}destroy(){this.app.getSettings().useMouseEvents&&this.removeHandlers();this.distElement.remove();this.wrapper.remove()}getDistElement(){return this.distElement}getWrapper(){return this.wrapper}setOrientationStyle(e){this.wrapper.classList.remove("--portrait","--landscape");if("portrait"===e){this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/this.app.getSettings().width*100+"%");this.wrapper.classList.add("--portrait")}else{this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/(2*this.app.getSettings().width)*100+"%");this.wrapper.classList.add("--landscape")}this.update()}removeHandlers(){window.removeEventListener("resize",this.onResize);this.distElement.removeEventListener("mousedown",this.onMouseDown);this.distElement.removeEventListener("touchstart",this.onTouchStart);window.removeEventListener("mousemove",this.onMouseMove);window.removeEventListener("touchmove",this.onTouchMove);window.removeEventListener("mouseup",this.onMouseUp);window.removeEventListener("touchend",this.onTouchEnd)}setHandlers(){window.addEventListener("resize",this.onResize,!1);if(this.app.getSettings().useMouseEvents){this.distElement.addEventListener("mousedown",this.onMouseDown);this.distElement.addEventListener("touchstart",this.onTouchStart);window.addEventListener("mousemove",this.onMouseMove);window.addEventListener("touchmove",this.onTouchMove,{passive:!this.app.getSettings().mobileScrollSupport});window.addEventListener("mouseup",this.onMouseUp);window.addEventListener("touchend",this.onTouchEnd)}}getMousePos(e,t){const i=this.distElement.getBoundingClientRect();return{x:e-i.left,y:t-i.top}}checkTarget(e){return!this.app.getSettings().clickEventForward||!["a","button"].includes(e.tagName.toLowerCase())}}class HTMLUI extends UI{constructor(e,t,i,a,s){super(e,t,i);this.cspPolicyService=s;const n=this.cspPolicyService.createTrustedHTML('<div class="stf__block"></div>');this.wrapper.insertAdjacentHTML("afterbegin",n);this.distElement=e.querySelector(".stf__block");this.items=a;for(const e of a)this.distElement.appendChild(e);this.setHandlers()}clear(){for(const e of this.items)this.parentElement.appendChild(e)}updateItems(e){this.removeHandlers();this.distElement.innerHTML="";for(const t of e)this.distElement.appendChild(t);this.items=e;this.setHandlers()}update(){this.app.getRender().update()}}class EventObject{constructor(){this.events=new Map}on(e,t){this.events.has(e)?this.events.get(e).push(t):this.events.set(e,[t]);return this}off(e){this.events.delete(e)}trigger(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(this.events.has(e))for(const a of this.events.get(e))a({data:i,object:t})}}class HTMLRender extends Render{constructor(e,t,i){super(e,t);this.outerShadow=null;this.innerShadow=null;this.hardShadow=null;this.hardInnerShadow=null;this.element=i;this.createShadows()}createShadows(){const e=this.app.cspPolicyService.createTrustedHTML('<div class="stf__outerShadow"></div>\n             <div class="stf__innerShadow"></div>\n             <div class="stf__hardShadow"></div>\n             <div class="stf__hardInnerShadow"></div>');this.element.insertAdjacentHTML("beforeend",e);this.outerShadow=this.element.querySelector(".stf__outerShadow");this.innerShadow=this.element.querySelector(".stf__innerShadow");this.hardShadow=this.element.querySelector(".stf__hardShadow");this.hardInnerShadow=this.element.querySelector(".stf__hardInnerShadow")}clearShadow(){super.clearShadow();this.outerShadow.style.cssText="display: none";this.innerShadow.style.cssText="display: none";this.hardShadow.style.cssText="display: none";this.hardInnerShadow.style.cssText="display: none"}reload(){this.element.querySelector(".stf__outerShadow")||this.createShadows()}drawHardInnerShadow(){const e=this.getRect(),t=this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress;let i=(100-t)*(2.5*e.pageWidth)/100+20;i>e.pageWidth&&(i=e.pageWidth);let a=`\n            display: block;\n            z-index: ${(this.getSettings().startZIndex+5).toString(10)};\n            width: ${i}px;\n            height: ${e.height}px;\n            background: linear-gradient(to right,\n                rgba(0, 0, 0, ${this.shadow.opacity*t/100}) 5%,\n                rgba(0, 0, 0, 0) 100%);\n            left: ${e.left+e.width/2}px;\n            transform-origin: 0 0;\n        `;a+=0===this.getDirection()&&this.shadow.progress>100||1===this.getDirection()&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0);":"transform: translate3d(0, 0, 0) rotateY(180deg);";this.hardInnerShadow.style.cssText=a}drawHardOuterShadow(){const e=this.getRect();let t=(100-(this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress))*(2.5*e.pageWidth)/100+20;t>e.pageWidth&&(t=e.pageWidth);let i=`\n            display: block;\n            z-index: ${(this.getSettings().startZIndex+4).toString(10)};\n            width: ${t}px;\n            height: ${e.height}px;\n            background: linear-gradient(to left, rgba(0, 0, 0, ${this.shadow.opacity}) 5%, rgba(0, 0, 0, 0) 100%);\n            left: ${e.left+e.width/2}px;\n            transform-origin: 0 0;\n        `;i+=0===this.getDirection()&&this.shadow.progress>100||1===this.getDirection()&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0) rotateY(180deg);":"transform: translate3d(0, 0, 0);";this.hardShadow.style.cssText=i}drawInnerShadow(){const e=this.getRect(),t=3*this.shadow.width/4,i=0===this.getDirection()?t:0,a=0===this.getDirection()?"to left":"to right",s=this.convertToGlobal(this.shadow.pos),n=this.shadow.angle+3*Math.PI/2,r=[this.pageRect.topLeft,this.pageRect.topRight,this.pageRect.bottomRight,this.pageRect.bottomLeft];let o="polygon( ";for(const e of r){let t=1===this.getDirection()?{x:-e.x+this.shadow.pos.x,y:e.y-this.shadow.pos.y}:{x:e.x-this.shadow.pos.x,y:e.y-this.shadow.pos.y};t=Helper.GetRotatedPoint(t,{x:i,y:100},n);o+=t.x+"px "+t.y+"px, "}o=o.slice(0,-2);o+=")";const l=`\n            display: block;\n            z-index: ${(this.getSettings().startZIndex+10).toString(10)};\n            width: ${t}px;\n            height: ${2*e.height}px;\n            background: linear-gradient(${a},\n                rgba(0, 0, 0, ${this.shadow.opacity}) 5%,\n                rgba(0, 0, 0, 0.05) 15%,\n                rgba(0, 0, 0, ${this.shadow.opacity}) 35%,\n                rgba(0, 0, 0, 0) 100%);\n            transform-origin: ${i}px 100px;\n            transform: translate3d(${s.x-i}px, ${s.y-100}px, 0) rotate(${n}rad);\n            clip-path: ${o};\n            -webkit-clip-path: ${o};\n        `;this.innerShadow.style.cssText=l}drawOuterShadow(){const e=this.getRect(),t=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y}),i=this.shadow.angle+3*Math.PI/2,a=1===this.getDirection()?this.shadow.width:0,s=0===this.getDirection()?"to right":"to left",n=[{x:0,y:0},{x:e.pageWidth,y:0},{x:e.pageWidth,y:e.height},{x:0,y:e.height}];let r="polygon( ";for(const e of n)if(null!==e){let t=1===this.getDirection()?{x:-e.x+this.shadow.pos.x,y:e.y-this.shadow.pos.y}:{x:e.x-this.shadow.pos.x,y:e.y-this.shadow.pos.y};t=Helper.GetRotatedPoint(t,{x:a,y:100},i);r+=t.x+"px "+t.y+"px, "}r=r.slice(0,-2);r+=")";const o=`\n            display: block;\n            z-index: ${(this.getSettings().startZIndex+10).toString(10)};\n            width: ${this.shadow.width}px;\n            height: ${2*e.height}px;\n            background: linear-gradient(${s}, rgba(0, 0, 0, ${this.shadow.opacity}), rgba(0, 0, 0, 0));\n            transform-origin: ${a}px 100px;\n            transform: translate3d(${t.x-a}px, ${t.y-100}px, 0) rotate(${i}rad);\n            clip-path: ${r};\n            -webkit-clip-path: ${r};\n        `;this.outerShadow.style.cssText=o}drawLeftPage(){if("portrait"!==this.orientation&&null!==this.leftPage)if(1===this.direction&&null!==this.flippingPage&&"hard"===this.flippingPage.getDrawingDensity()){if(this.flippingPage.getHardAngle()<-90){this.leftPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.leftPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle());this.leftPage.draw(this.flippingPage.getDrawingDensity())}else this.leftPage.getElement().style.display="none"}else this.leftPage.simpleDraw(0)}drawRightPage(){if(null!==this.rightPage)if(0===this.direction&&null!==this.flippingPage&&"hard"===this.flippingPage.getDrawingDensity()){if(this.flippingPage.getHardAngle()>90){this.rightPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.rightPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle());this.rightPage.draw(this.flippingPage.getDrawingDensity())}else this.rightPage.getElement().style.display="none"}else this.rightPage.simpleDraw(1)}drawBottomPage(){if(null===this.bottomPage)return;const e=null!=this.flippingPage?this.flippingPage.getDrawingDensity():null;if("portrait"!==this.orientation||1!==this.direction){this.bottomPage.getElement().style.zIndex=(this.getSettings().startZIndex+3).toString(10);this.bottomPage.draw(e)}}drawFrame(){if(null!==this.flippingPage){if(this.flippingPage.getHardAngle()===this.lastAngle)return;this.lastAngle=this.flippingPage.getHardAngle()}else this.lastAngle=-1234;this.clear();this.drawLeftPage();this.drawRightPage();this.drawBottomPage();if(null!=this.flippingPage){if(this.flippingPage.state.hardDrawingAngle<=90){this.flippingPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.flippingPage.draw()}else this.flippingPage.getElement().style.display="none"}if(null!=this.shadow&&null!==this.flippingPage)if("soft"===this.flippingPage.getDrawingDensity()){this.drawOuterShadow();this.drawInnerShadow()}else{this.drawHardOuterShadow();this.drawHardInnerShadow()}}clear(){for(const e of this.app.getPageCollection().getPages()){if(e!==this.leftPage&&e!==this.rightPage&&e!==this.flippingPage&&e!==this.bottomPage){const t=e.getElement().style;"none"!==t.display&&(t.cssText="display: none")}e.getTemporaryCopy()!==this.flippingPage&&e.hideTemporaryCopy()}}update(){super.update();null!==this.rightPage&&this.rightPage.setOrientation(1);null!==this.leftPage&&this.leftPage.setOrientation(0)}}class Settings{constructor(){this._default={startPage:0,size:"fixed",width:0,height:0,minWidth:0,maxWidth:0,minHeight:0,maxHeight:0,drawShadow:!0,flippingTime:1e3,usePortrait:!0,startZIndex:0,autoSize:!0,maxShadowOpacity:1,showCover:!1,mobileScrollSupport:!0,swipeDistance:30,clickEventForward:!0,useMouseEvents:!0,showPageCorners:!0,disableFlipByClick:!1,enableFlipByDrag:!0}}getSettings(e){const t=this._default;Object.assign(t,e);if("stretch"!==t.size&&"fixed"!==t.size)throw new Error('Invalid size type. Available only "fixed" and "stretch" value');if(t.width<=0||t.height<=0)throw new Error("Invalid width or height");if(t.flippingTime<=0)throw new Error("Invalid flipping time");if("stretch"===t.size){t.minWidth<=0&&(t.minWidth=100);t.maxWidth<t.minWidth&&(t.maxWidth=2e3);t.minHeight<=0&&(t.minHeight=100);t.maxHeight<t.minHeight&&(t.maxHeight=2e3)}else{t.minWidth=t.width;t.maxWidth=t.width;t.minHeight=t.height;t.maxHeight=t.height}return t}}class PageFlip extends EventObject{constructor(e,t,i){super();this.isUserTouch=!1;this.isUserMove=!1;this.setting=null;this.pages=null;this.setting=(new Settings).getSettings(t);this.block=e;this.cspPolicyService=i}destroy(){this.ui.destroy();this.render=void 0}update(){this.render.update();this.pages.show()}loadFromHTML(e){this.ui=new HTMLUI(this.block,this,this.setting,e,this.cspPolicyService);this.render=new HTMLRender(this,this.setting,this.ui.getDistElement());this.flipController=new Flip(this.render,this);this.pages=new HTMLPageCollection(this,this.render,this.ui.getDistElement(),e);this.pages.load();this.render.start();this.pages.show(this.setting.startPage);setTimeout(()=>{this.ui.update();this.trigger("init",this,{page:this.setting.startPage,mode:this.render.getOrientation()})},1)}updateFromHtml(e){const t=this.pages.getCurrentPageIndex();this.pages.destroy();this.pages=new HTMLPageCollection(this,this.render,this.ui.getDistElement(),e);this.pages.load();this.ui.updateItems(e);this.render.reload();this.pages.show(t);this.trigger("update",this,{page:t,mode:this.render.getOrientation()})}clear(){this.pages.destroy();this.ui.clear()}turnToPrevPage(){this.pages.showPrev()}turnToNextPage(){this.pages.showNext()}turnToPage(e){this.pages.show(e)}flipNext(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"top";this.flipController.flipNext(e)}flipPrev(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"top";this.flipController.flipPrev(e)}flip(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top";this.flipController.flipToPage(e,t)}updateState(e){this.trigger("changeState",this,e)}updatePageIndex(e){this.trigger("flip",this,e)}updateOrientation(e){this.ui.setOrientationStyle(e);this.update();this.trigger("changeOrientation",this,e)}getPageCount(){return this.pages.getPageCount()}getCurrentPageIndex(){return this.pages.getCurrentPageIndex()}getPage(e){return this.pages.getPage(e)}getRender(){return this.render}getFlipController(){return this.flipController}getOrientation(){return this.render.getOrientation()}getBoundsRect(){return this.render.getRect()}getSettings(){return this.setting}getUI(){return this.ui}getState(){return this.flipController.getState()}getPageCollection(){return this.pages}startUserTouch(e){this.mousePosition=e;this.isUserTouch=!0;this.isUserMove=!1}userMove(e,t){if(this.isUserTouch||t||!this.setting.showPageCorners){if(this.isUserTouch&&Helper.GetDistanceBetweenTwoPoint(this.mousePosition,e)>5){this.isUserMove=!0;this.flipController.fold(e)}}else this.flipController.showCorner(e)}userStop(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.isUserTouch){this.isUserTouch=!1;t||(this.isUserMove?this.flipController.stopMove():this.flipController.flip(e))}}}function annotation_editor_layer_builder_classPrivateFieldInitSpec(e,t,i){(function annotation_editor_layer_builder_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function annotation_editor_layer_builder_classPrivateFieldGet(e,t){return e.get(annotation_editor_layer_builder_assertClassBrand(e,t))}function annotation_editor_layer_builder_classPrivateFieldSet(e,t,i){return e.set(annotation_editor_layer_builder_assertClassBrand(e,t),i),i}function annotation_editor_layer_builder_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var fm=new WeakMap,mm=new WeakMap,vm=new WeakMap,Pm=new WeakMap,wm=new WeakMap,Fm=new WeakMap;class AnnotationEditorLayerBuilder{constructor(e){annotation_editor_layer_builder_classPrivateFieldInitSpec(this,fm,null);annotation_editor_layer_builder_classPrivateFieldInitSpec(this,mm,null);annotation_editor_layer_builder_classPrivateFieldInitSpec(this,vm,null);annotation_editor_layer_builder_classPrivateFieldInitSpec(this,Pm,null);annotation_editor_layer_builder_classPrivateFieldInitSpec(this,wm,null);annotation_editor_layer_builder_classPrivateFieldInitSpec(this,Fm,void 0);this.pageIndex=e.pageIndex;this.accessibilityManager=e.accessibilityManager;this.l10n=e.l10n;this.l10n||=new genericl10n_GenericL10n;this.annotationEditorLayer=null;this.div=null;this._cancelled=!1;annotation_editor_layer_builder_classPrivateFieldSet(Fm,this,e.uiManager);annotation_editor_layer_builder_classPrivateFieldSet(fm,this,e.annotationLayer||null);annotation_editor_layer_builder_classPrivateFieldSet(wm,this,e.textLayer||null);annotation_editor_layer_builder_classPrivateFieldSet(mm,this,e.drawLayer||null);annotation_editor_layer_builder_classPrivateFieldSet(vm,this,e.onAppend||null);this.eventBus=e.eventBus;annotation_editor_layer_builder_classPrivateFieldSet(Pm,this,e.structTreeLayer||null)}updatePageIndex(e){this.pageIndex=e;this.annotationEditorLayer?.updatePageIndex(e)}async render(e){let{viewport:t,intent:i="display"}=e;if("display"!==i)return;if(this._cancelled)return;const a=t.clone({dontFlip:!0});if(this.div){this.annotationEditorLayer.update({viewport:a});this.show();return}const s=this.div=document.createElement("div");s.className="annotationEditorLayer";s.hidden=!0;s.dir=annotation_editor_layer_builder_classPrivateFieldGet(Fm,this).direction;annotation_editor_layer_builder_classPrivateFieldGet(vm,this)?.call(this,s);this.annotationEditorLayer=new AnnotationEditorLayer({uiManager:annotation_editor_layer_builder_classPrivateFieldGet(Fm,this),div:s,structTreeLayer:annotation_editor_layer_builder_classPrivateFieldGet(Pm,this),accessibilityManager:this.accessibilityManager,pageIndex:this.pageIndex,l10n:this.l10n,viewport:a,annotationLayer:annotation_editor_layer_builder_classPrivateFieldGet(fm,this),textLayer:annotation_editor_layer_builder_classPrivateFieldGet(wm,this),drawLayer:annotation_editor_layer_builder_classPrivateFieldGet(mm,this),eventBus:this.eventBus});const n={viewport:a,div:s,annotations:null,intent:i};await this.annotationEditorLayer.render(n);this.show()}cancel(){this._cancelled=!0;this.div&&this.annotationEditorLayer.destroy()}hide(){if(this.div){this.annotationEditorLayer.pause(!0);this.div.hidden=!0}}show(){if(this.div&&!this.annotationEditorLayer.isInvisible){this.div.hidden=!1;this.annotationEditorLayer.pause(!1)}}}function annotation_layer_builder_classPrivateFieldInitSpec(e,t,i){annotation_layer_builder_checkPrivateRedeclaration(e,t),t.set(e,i)}function annotation_layer_builder_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function annotation_layer_builder_classPrivateFieldGet(e,t){return e.get(annotation_layer_builder_assertClassBrand(e,t))}function annotation_layer_builder_classPrivateFieldSet(e,t,i){return e.set(annotation_layer_builder_assertClassBrand(e,t),i),i}function annotation_layer_builder_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var bm=new WeakMap,ym=new WeakMap,Sm=new WeakMap,Cm=new WeakMap,xm=new WeakMap,km=new WeakMap,Em=new WeakSet;class AnnotationLayerBuilder{constructor(e){let{pdfPage:t,linkService:i,downloadManager:a,annotationStorage:s=null,imageResourcesPath:n="",renderForms:r=!0,enableComment:o=!1,commentManager:l=null,enableScripting:d=!1,hasJSActionsPromise:c=null,fieldObjectsPromise:h=null,annotationCanvasMap:u=null,accessibilityManager:_=null,annotationEditorUIManager:p=null,onAppend:g=null}=e;!function annotation_layer_builder_classPrivateMethodInitSpec(e,t){annotation_layer_builder_checkPrivateRedeclaration(e,t),t.add(e)}(this,Em);annotation_layer_builder_classPrivateFieldInitSpec(this,bm,null);annotation_layer_builder_classPrivateFieldInitSpec(this,ym,null);annotation_layer_builder_classPrivateFieldInitSpec(this,Sm,!1);annotation_layer_builder_classPrivateFieldInitSpec(this,Cm,null);annotation_layer_builder_classPrivateFieldInitSpec(this,xm,null);annotation_layer_builder_classPrivateFieldInitSpec(this,km,!1);this.pdfPage=t;this.linkService=i;this.downloadManager=a;this.imageResourcesPath=n;this.renderForms=r;this.annotationStorage=s;this.enableComment=o;annotation_layer_builder_classPrivateFieldSet(ym,this,l);this.enableScripting=d;this._hasJSActionsPromise=c||Promise.resolve(!1);this._fieldObjectsPromise=h||Promise.resolve(null);this._annotationCanvasMap=u;this._accessibilityManager=_;this._annotationEditorUIManager=p;annotation_layer_builder_classPrivateFieldSet(Cm,this,g);this.annotationLayer=null;this.div=null;this._cancelled=!1;this._eventBus=i.eventBus}async render(e){let{viewport:t,intent:i="display",structTreeLayer:a=null}=e;if(this.div){if(this._cancelled||!this.annotationLayer)return;this.annotationLayer.update({viewport:t.clone({dontFlip:!0})});return}const[s,n,r]=await Promise.all([this.pdfPage.getAnnotations({intent:i}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled)return;const o=this.div=document.createElement("div");o.className="annotationLayer";annotation_layer_builder_classPrivateFieldGet(Cm,this)?.call(this,o);annotation_layer_builder_assertClassBrand(Em,this,_initAnnotationLayer).call(this,t,a);if(0!==s.length){await this.annotationLayer.render({annotations:s,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,downloadManager:this.downloadManager,enableComment:this.enableComment,enableScripting:this.enableScripting,hasJSActions:n,fieldObjects:r});annotation_layer_builder_classPrivateFieldSet(bm,this,s);this.linkService.isInPresentationMode&&annotation_layer_builder_assertClassBrand(Em,this,_updatePresentationModeState).call(this,Wc);if(!annotation_layer_builder_classPrivateFieldGet(xm,this)){annotation_layer_builder_classPrivateFieldSet(xm,this,new AbortController);this._eventBus?._on("presentationmodechanged",e=>{annotation_layer_builder_assertClassBrand(Em,this,_updatePresentationModeState).call(this,e.state)},{signal:annotation_layer_builder_classPrivateFieldGet(xm,this).signal})}}else{annotation_layer_builder_classPrivateFieldSet(bm,this,s);setLayerDimensions(this.div,t)}}cancel(){this._cancelled=!0;annotation_layer_builder_classPrivateFieldGet(xm,this)?.abort();annotation_layer_builder_classPrivateFieldSet(xm,this,null)}hide(){annotation_layer_builder_classPrivateFieldSet(Sm,this,!(arguments.length>0&&void 0!==arguments[0]&&arguments[0]));this.div&&(document.querySelector("[data-pdfjsprinting=true]")||(this.div.hidden=!0))}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}async injectLinkAnnotations(e){if(null===annotation_layer_builder_classPrivateFieldGet(bm,this)||this._cancelled||annotation_layer_builder_classPrivateFieldGet(km,this))return;annotation_layer_builder_classPrivateFieldSet(km,this,!0);const t=annotation_layer_builder_classPrivateFieldGet(bm,this).length?annotation_layer_builder_assertClassBrand(Em,this,_checkInferredLinks).call(this,e):e;if(t.length){await this.annotationLayer.addLinkAnnotations(t);annotation_layer_builder_classPrivateFieldGet(Sm,this)||(this.div.hidden=!1)}}}function _initAnnotationLayer(e,t){this.annotationLayer=new AnnotationLayer({div:this.div,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,annotationEditorUIManager:this._annotationEditorUIManager,annotationStorage:this.annotationStorage,page:this.pdfPage,viewport:e.clone({dontFlip:!0}),structTreeLayer:t,commentManager:annotation_layer_builder_classPrivateFieldGet(ym,this),linkService:this.linkService})}function _updatePresentationModeState(e){if(!this.div)return;let t=!1;switch(e){case Wc:t=!0;break;case Nc:break;default:return}for(const e of this.div.childNodes)e.hasAttribute("data-internal-link")||(e.inert=t)}function _checkInferredLinks(e){function annotationRects(e){if(!e.quadPoints)return[e.rect];const t=[];for(let i=2,a=e.quadPoints.length;i<a;i+=8){const a=e.quadPoints[i],s=e.quadPoints[i+1],n=e.quadPoints[i+2],r=e.quadPoints[i+3];t.push([n,r,a,s])}return t}function intersectAnnotations(e,t){const i=[],a=annotationRects(e),s=annotationRects(t);for(const e of a)for(const t of s){const a=Util.intersect(e,t);a&&i.push(a)}return i}function areaRects(e){let t=0;for(const i of e)t+=Math.abs((i[2]-i[0])*(i[3]-i[1]));return t}return e.filter(e=>{let t;for(const i of annotation_layer_builder_classPrivateFieldGet(bm,this)){if(i.annotationType!==A.LINK||!i.url)continue;const a=intersectAnnotations(i,e);if(0!==a.length){t??=areaRects(annotationRects(e));if(areaRects(a)/t>.5)return!1}}return!0})}function autolinker_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function DOMRectToPDF(e,t){let{width:i,height:a,left:s,top:n}=e;if(0===i||0===a)return null;const r=t.textLayer.div.getBoundingClientRect(),o=t.getPagePoint(s-r.left,n-r.top),l=t.getPagePoint(s-r.left+i,n-r.top+a);return Util.normalizeRect([o[0],o[1],l[0],l[1]])}function calculateLinkPosition(e,t){const i=e.getClientRects();if(1===i.length)return{rect:DOMRectToPDF(i[0],t)};const a=[1/0,1/0,-1/0,-1/0],s=[];let n=0;for(const e of i){const i=DOMRectToPDF(e,t);if(null!==i){s[n]=s[n+4]=i[0];s[n+1]=s[n+3]=i[3];s[n+2]=s[n+6]=i[2];s[n+5]=s[n+7]=i[1];Util.rectBoundingBox(...i,a);n+=8}}return{quadPoints:s,rect:a}}function textPosition(e,t){let i=e;do{if(i.nodeType===Node.TEXT_NODE){const e=i.textContent.length;if(t<=e)return[i,t];t-=e}else if(i.firstChild){i=i.firstChild;continue}for(;!i.nextSibling&&i!==e;)i=i.parentNode;i!==e&&(i=i.nextSibling)}while(i!==e);throw new Error("Offset is bigger than container's contents length.")}class Autolinker{static findLinks(e){autolinker_assertClassBrand(Autolinker,this,Gm)._??(Gm._=autolinker_assertClassBrand(Autolinker,this,/\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));const[t,i]=normalize(e,{ignoreDashEOL:!0}),a=t.matchAll(autolinker_assertClassBrand(Autolinker,this,Gm)._),s=[];for(const e of a){const[t,a]=e;let n;if(t.startsWith("www.")||t.startsWith("http://")||t.startsWith("https://"))n=t;else if(a){const e=URL.parse(`http://${a}`)?.hostname;if(!e)continue;autolinker_assertClassBrand(Autolinker,this,Bm)._??(Bm._=autolinker_assertClassBrand(Autolinker,this,/\.\d+$/));if(autolinker_assertClassBrand(Autolinker,this,Bm)._.test(e))continue}n??=t.startsWith("mailto:")?t:`mailto:${t}`;const r=createValidAbsoluteUrl(n,null,{addDefaultProtocol:!0});if(r){const[a,n]=getOriginalIndex(i,e.index,t.length);s.push({url:r.href,index:a,length:n})}}return s}static processLinks(e){return this.findLinks(e._textHighlighter.textContentItemsStr.join("\n")).map(t=>{var i,a;return function createLinkAnnotation(e,t,i){let{url:a,index:s,length:n}=e;const r=t._textHighlighter,[{begin:o,end:l}]=r._convertMatches([s],[n]),d=new Range;d.setStart(...textPosition(r.textDivs[o.divIdx],o.offset));d.setEnd(...textPosition(r.textDivs[l.divIdx],l.offset));return{id:`inferred_link_${i}`,unsafeUrl:a,url:a,annotationType:A.LINK,rotation:0,...calculateLinkPosition(d,t),borderStyle:null}}(t,e,(Am._=autolinker_assertClassBrand(Autolinker,this,(i=autolinker_assertClassBrand(Autolinker,this,Am)._,a=i++,i)),a))})}}var Am={_:0},Gm={_:void 0},Bm={_:void 0};function base_pdf_page_view_defineProperty(e,t,i){return(t=function base_pdf_page_view_toPropertyKey(e){var t=function base_pdf_page_view_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function base_pdf_page_view_classPrivateFieldInitSpec(e,t,i){base_pdf_page_view_checkPrivateRedeclaration(e,t),t.set(e,i)}function base_pdf_page_view_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function base_pdf_page_view_classPrivateFieldSet(e,t,i){return e.set(base_pdf_page_view_assertClassBrand(e,t),i),i}function base_pdf_page_view_classPrivateFieldGet(e,t){return e.get(base_pdf_page_view_assertClassBrand(e,t))}function base_pdf_page_view_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Mm=new WeakMap,Im=new WeakMap,Tm=new WeakMap,Dm=new WeakMap,Lm=new WeakMap,Rm=new WeakMap,Nm=new WeakMap,Om=new WeakSet;class BasePDFPageView extends RenderableView{constructor(e){super();!function base_pdf_page_view_classPrivateMethodInitSpec(e,t){base_pdf_page_view_checkPrivateRedeclaration(e,t),t.add(e)}(this,Om);base_pdf_page_view_classPrivateFieldInitSpec(this,Mm,null);base_pdf_page_view_classPrivateFieldInitSpec(this,Im,null);base_pdf_page_view_classPrivateFieldInitSpec(this,Tm,Yg.INITIAL);base_pdf_page_view_classPrivateFieldInitSpec(this,Dm,null);base_pdf_page_view_classPrivateFieldInitSpec(this,Lm,0);base_pdf_page_view_classPrivateFieldInitSpec(this,Rm,null);base_pdf_page_view_defineProperty(this,"canvas",null);base_pdf_page_view_defineProperty(this,"div",null);base_pdf_page_view_defineProperty(this,"enableOptimizedPartialRendering",!1);base_pdf_page_view_defineProperty(this,"imagesRightClickMinSize",-1);base_pdf_page_view_defineProperty(this,"eventBus",null);base_pdf_page_view_defineProperty(this,"id",null);base_pdf_page_view_defineProperty(this,"imageCoordinates",null);base_pdf_page_view_defineProperty(this,"pageColors",null);base_pdf_page_view_defineProperty(this,"recordedBBoxes",null);base_pdf_page_view_defineProperty(this,"renderingQueue",null);base_pdf_page_view_classPrivateFieldInitSpec(this,Nm,e=>{base_pdf_page_view_classPrivateFieldGet(Dm,this)?.call(this,!1);if(!this.renderingQueue||this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=Yg.PAUSED;this.resume=()=>{this.renderingState=Yg.RUNNING;e()}}});this.eventBus=e.eventBus;this.id=e.id;this.pageColors=e.pageColors||null;this.renderingQueue=e.renderingQueue;this.enableOptimizedPartialRendering=e.enableOptimizedPartialRendering??!1;this.imagesRightClickMinSize=e.imagesRightClickMinSize??-1;this.minDurationToUpdateCanvas=e.minDurationToUpdateCanvas??500}get renderingState(){return base_pdf_page_view_classPrivateFieldGet(Tm,this)}set renderingState(e){if(e!==base_pdf_page_view_classPrivateFieldGet(Tm,this)){base_pdf_page_view_classPrivateFieldSet(Tm,this,e);if(base_pdf_page_view_classPrivateFieldGet(Mm,this)){clearTimeout(base_pdf_page_view_classPrivateFieldGet(Mm,this));base_pdf_page_view_classPrivateFieldSet(Mm,this,null)}switch(e){case Yg.PAUSED:this.div.classList.remove("loading");base_pdf_page_view_classPrivateFieldSet(Lm,this,0);base_pdf_page_view_classPrivateFieldGet(Dm,this)?.call(this,!1);break;case Yg.RUNNING:this.div.classList.add("loadingIcon");base_pdf_page_view_classPrivateFieldSet(Mm,this,setTimeout(()=>{this.div.classList.add("loading");base_pdf_page_view_classPrivateFieldSet(Mm,this,null)},0));base_pdf_page_view_classPrivateFieldSet(Lm,this,Date.now());break;case Yg.INITIAL:case Yg.FINISHED:this.div.classList.remove("loadingIcon","loading");base_pdf_page_view_classPrivateFieldSet(Lm,this,0)}}}_createCanvas(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{pageColors:i}=this,a=!(!i?.background||!i?.foreground),s=this.canvas,n=!s&&!a&&!t;let r=this.canvas=document.createElement("canvas");base_pdf_page_view_classPrivateFieldSet(Dm,this,t=>{if(n){let i=base_pdf_page_view_classPrivateFieldGet(Rm,this);if(!t&&this.minDurationToUpdateCanvas>0){if(Date.now()-base_pdf_page_view_classPrivateFieldGet(Lm,this)<this.minDurationToUpdateCanvas)return;if(!i){i=base_pdf_page_view_classPrivateFieldSet(Rm,this,r);r=this.canvas=r.cloneNode(!1);e(r)}}if(i){r.getContext("2d",{alpha:!1}).drawImage(i,0,0);t?base_pdf_page_view_assertClassBrand(Om,this,_resetTempCanvas).call(this):base_pdf_page_view_classPrivateFieldSet(Lm,this,Date.now());return}e(r);base_pdf_page_view_classPrivateFieldSet(Dm,this,null);return}if(t)if(s){s.parentNode?s.replaceWith(r):e(r);s.width=s.height=0}else e(r)});return{canvas:r,prevCanvas:s}}_resetCanvas(){const{canvas:e}=this;if(e){e.remove();e.width=e.height=0;this.canvas=null;base_pdf_page_view_assertClassBrand(Om,this,_resetTempCanvas).call(this)}}async _drawCanvas(e,t,i){const a=this.renderTask=this.pdfPage.render(e);a.onContinue=base_pdf_page_view_classPrivateFieldGet(Nm,this);a.onError=e=>{if(e instanceof RenderingCancelledException){t();base_pdf_page_view_classPrivateFieldSet(Im,this,null)}};let s=null;try{await a.promise;base_pdf_page_view_classPrivateFieldGet(Dm,this)?.call(this,!0)}catch(e){if(e instanceof RenderingCancelledException)return;s=e;base_pdf_page_view_classPrivateFieldGet(Dm,this)?.call(this,!0)}finally{base_pdf_page_view_classPrivateFieldSet(Im,this,s);if(a===this.renderTask){this.renderTask=null;this.enableOptimizedPartialRendering&&(this.recordedBBoxes??=a.recordedBBoxes);-1!==this.imagesRightClickMinSize&&(this.imageCoordinates??=this.pdfPage.imageCoordinates)}}this.renderingState=Yg.FINISHED;i(a);if(s)throw s}cancelRendering(){let{cancelExtraDelay:e=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.renderTask){this.renderTask.cancel(e);this.renderTask=null}this.resume=null}dispatchPageRender(){this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id})}dispatchPageRendered(e,t){this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:e,isDetailView:t,timestamp:performance.now(),error:base_pdf_page_view_classPrivateFieldGet(Im,this)})}}function _resetTempCanvas(){if(base_pdf_page_view_classPrivateFieldGet(Rm,this)){base_pdf_page_view_classPrivateFieldGet(Rm,this).width=base_pdf_page_view_classPrivateFieldGet(Rm,this).height=0;base_pdf_page_view_classPrivateFieldSet(Rm,this,null)}}function draw_layer_builder_classPrivateFieldInitSpec(e,t,i){(function draw_layer_builder_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function draw_layer_builder_classPrivateFieldSet(e,t,i){return e.set(draw_layer_builder_assertClassBrand(e,t),i),i}function draw_layer_builder_classPrivateFieldGet(e,t){return e.get(draw_layer_builder_assertClassBrand(e,t))}function draw_layer_builder_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Wm=new WeakMap;class DrawLayerBuilder{constructor(){draw_layer_builder_classPrivateFieldInitSpec(this,Wm,null)}async render(e){let{intent:t="display"}=e;"display"!==t||draw_layer_builder_classPrivateFieldGet(Wm,this)||this._cancelled||draw_layer_builder_classPrivateFieldSet(Wm,this,new DrawLayer)}cancel(){this._cancelled=!0;if(draw_layer_builder_classPrivateFieldGet(Wm,this)){draw_layer_builder_classPrivateFieldGet(Wm,this).destroy();draw_layer_builder_classPrivateFieldSet(Wm,this,null)}}setParent(e){draw_layer_builder_classPrivateFieldGet(Wm,this)?.setParent(e)}getDrawLayer(){return draw_layer_builder_classPrivateFieldGet(Wm,this)}}function pdf_page_detail_view_defineProperty(e,t,i){return(t=function pdf_page_detail_view_toPropertyKey(e){var t=function pdf_page_detail_view_toPrimitive(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var a=i.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function pdf_page_detail_view_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_page_detail_view_classPrivateFieldGet(e,t){return e.get(pdf_page_detail_view_assertClassBrand(e,t))}function pdf_page_detail_view_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var jm=new WeakMap,Vm=new WeakSet;class PDFPageDetailView extends BasePDFPageView{constructor(e){let{pageView:t}=e;super(t);!function pdf_page_detail_view_classPrivateMethodInitSpec(e,t){pdf_page_detail_view_checkPrivateRedeclaration(e,t),t.add(e)}(this,Vm);!function pdf_page_detail_view_classPrivateFieldInitSpec(e,t,i){pdf_page_detail_view_checkPrivateRedeclaration(e,t),t.set(e,i)}(this,jm,null);pdf_page_detail_view_defineProperty(this,"renderingCancelled",!1);this.pageView=t;this.renderingId="detail"+this.id;this.div=t.div}setPdfPage(e){this.pageView.setPdfPage(e)}get pdfPage(){return this.pageView.pdfPage}get renderingState(){return super.renderingState}set renderingState(e){this.renderingCancelled=!1;super.renderingState=e}reset(){let{keepCanvas:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this.renderingCancelled||this.renderingState===Yg.RUNNING||this.renderingState===Yg.PAUSED;this.cancelRendering();this.renderingState=Yg.INITIAL;this.renderingCancelled=t;e||this._resetCanvas()}update(){let{visibleArea:e=null,underlyingViewUpdated:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t){this.cancelRendering();this.renderingState=Yg.INITIAL;return}if(!pdf_page_detail_view_assertClassBrand(Vm,this,_shouldRenderDifferentArea).call(this,e))return;const{viewport:i,maxCanvasPixels:a,capCanvasAreaFactor:s}=this.pageView,n=e.maxX-e.minX,r=e.maxY-e.minY,o=n*r*OutputScale.pixelRatio**2,l=(Math.sqrt(OutputScale.capPixels(a,s)/o)-1)/2;let d=Math.min(1,l);d<0&&(d=0);const c=n*d,h=r*d,u=Math.max(0,e.minX-c),_=Math.min(i.width,e.maxX+c),p=Math.max(0,e.minY-h),g=Math.min(i.height,e.maxY+h);!function pdf_page_detail_view_classPrivateFieldSet(e,t,i){return e.set(pdf_page_detail_view_assertClassBrand(e,t),i),i}(jm,this,{minX:u,minY:p,width:_-u,height:g-p,scale:i.scale});this.reset({keepCanvas:!0})}_getRenderingContext(e,t){const i=this.pageView._getRenderingContext(e,t,!1),a=this.pdfPage.recordedBBoxes;if(!a||!this.enableOptimizedPartialRendering)return i;const{viewport:{width:s,height:n}}=this.pageView,{width:r,height:o,minX:l,minY:d}=pdf_page_detail_view_classPrivateFieldGet(jm,this),c=l/s,h=d/n,u=(l+r)/s,_=(d+o)/n;return{...i,operationsFilter:e=>!a.isEmpty(e)&&(a.minX(e)<=u&&a.maxX(e)>=c&&a.minY(e)<=_&&a.maxY(e)>=h)}}async draw(){if(this.pageView.detailView!==this)return;const e=this.pageView.renderingState===Yg.FINISHED||this.renderingState===Yg.FINISHED;if(this.renderingState!==Yg.INITIAL){NgxConsole.error("Must be in new state before drawing");this.reset()}const{div:t,pdfPage:i,viewport:a}=this.pageView;if(!i){this.renderingState=Yg.FINISHED;throw new Error("pdfPage is not loaded")}this.renderingState=Yg.RUNNING;const s=this.pageView._ensureCanvasWrapper(),{canvas:n,prevCanvas:r}=this._createCanvas(e=>{"CANVAS"===s.firstElementChild?.tagName?s.firstElementChild.after(e):s.prepend(e)},e);n.ariaHidden=!0;this.enableOptimizedPartialRendering&&(n.className="detailView");const{width:o,height:l}=a,d=pdf_page_detail_view_classPrivateFieldGet(jm,this),{pixelRatio:c}=OutputScale,h=[c,0,0,c,-d.minX*c,-d.minY*c];n.width=d.width*c;n.height=d.height*c;const{style:u}=n;u.width=100*d.width/o+"%";u.height=100*d.height/l+"%";u.top=100*d.minY/l+"%";u.left=100*d.minX/o+"%";const _=this._drawCanvas(this._getRenderingContext(n,h),()=>{this.canvas?.remove();this.canvas=r},()=>{this.dispatchPageRendered(!1,!0)});t.setAttribute("data-loaded",!0);this.dispatchPageRender();return _}}function _shouldRenderDifferentArea(e){if(!pdf_page_detail_view_classPrivateFieldGet(jm,this))return!0;const t=pdf_page_detail_view_classPrivateFieldGet(jm,this).minX,i=pdf_page_detail_view_classPrivateFieldGet(jm,this).minY,a=pdf_page_detail_view_classPrivateFieldGet(jm,this).width+t,s=pdf_page_detail_view_classPrivateFieldGet(jm,this).height+i;if(e.minX<t||e.minY<i||e.maxX>a||e.maxY>s)return!0;const{width:n,height:r,scale:o}=this.pageView.viewport;if(pdf_page_detail_view_classPrivateFieldGet(jm,this).scale!==o)return!0;const l=e.minX-t,d=a-e.maxX,c=e.minY-i,h=s-e.maxY;return t>0&&d/l>3||a<n&&l/d>3||i>0&&h/c>3||s<r&&c/h>3}function struct_tree_layer_builder_classPrivateFieldInitSpec(e,t,i){struct_tree_layer_builder_checkPrivateRedeclaration(e,t),t.set(e,i)}function struct_tree_layer_builder_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function struct_tree_layer_builder_classPrivateFieldGet(e,t){return e.get(struct_tree_layer_builder_assertClassBrand(e,t))}function struct_tree_layer_builder_classPrivateFieldSet(e,t,i){return e.set(struct_tree_layer_builder_assertClassBrand(e,t),i),i}function struct_tree_layer_builder_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Um={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"rowgroup",TBody:"rowgroup",TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},zm=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"]),Hm="http://www.w3.org/1998/Math/MathML";class MathMLSanitizer{static get sanitizer(){return shadow(this,"sanitizer",FeatureTest.isSanitizerSupported?new Sanitizer({elements:[...zm].map(e=>({name:e,namespace:Hm})),replaceWithChildrenElements:[{name:"maction",namespace:Hm}],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"],comments:!1}):null)}}const $m=/^H(\d+)$/;var qm=new WeakMap,Xm=new WeakMap,Km=new WeakMap,Ym=new WeakMap,Zm=new WeakMap,Jm=new WeakMap,Qm=new WeakMap,ev=new WeakMap,tv=new WeakSet;class StructTreeLayerBuilder{constructor(e,t){!function struct_tree_layer_builder_classPrivateMethodInitSpec(e,t){struct_tree_layer_builder_checkPrivateRedeclaration(e,t),t.add(e)}(this,tv);struct_tree_layer_builder_classPrivateFieldInitSpec(this,qm,void 0);struct_tree_layer_builder_classPrivateFieldInitSpec(this,Xm,null);struct_tree_layer_builder_classPrivateFieldInitSpec(this,Km,void 0);struct_tree_layer_builder_classPrivateFieldInitSpec(this,Ym,new Map);struct_tree_layer_builder_classPrivateFieldInitSpec(this,Zm,void 0);struct_tree_layer_builder_classPrivateFieldInitSpec(this,Jm,null);struct_tree_layer_builder_classPrivateFieldInitSpec(this,Qm,null);struct_tree_layer_builder_classPrivateFieldInitSpec(this,ev,null);struct_tree_layer_builder_classPrivateFieldSet(qm,this,e.getStructTree());struct_tree_layer_builder_classPrivateFieldSet(Zm,this,t)}async render(){if(struct_tree_layer_builder_classPrivateFieldGet(Km,this))return struct_tree_layer_builder_classPrivateFieldGet(Km,this);const{promise:e,resolve:t,reject:i}=Promise.withResolvers();struct_tree_layer_builder_classPrivateFieldSet(Km,this,e);try{struct_tree_layer_builder_classPrivateFieldSet(Xm,this,struct_tree_layer_builder_assertClassBrand(tv,this,_walk).call(this,await struct_tree_layer_builder_classPrivateFieldGet(qm,this)))}catch(e){i(e)}struct_tree_layer_builder_classPrivateFieldSet(qm,this,null);struct_tree_layer_builder_classPrivateFieldGet(Xm,this)?.classList.add("structTree");t(struct_tree_layer_builder_classPrivateFieldGet(Xm,this));return e}async getAriaAttributes(e){try{await this.render();return struct_tree_layer_builder_classPrivateFieldGet(Ym,this).get(e)}catch{}return null}hide(){struct_tree_layer_builder_classPrivateFieldGet(Xm,this)&&!struct_tree_layer_builder_classPrivateFieldGet(Xm,this).hidden&&(struct_tree_layer_builder_classPrivateFieldGet(Xm,this).hidden=!0)}show(){struct_tree_layer_builder_classPrivateFieldGet(Xm,this)?.hidden&&(struct_tree_layer_builder_classPrivateFieldGet(Xm,this).hidden=!1)}updateTextLayer(){if(struct_tree_layer_builder_classPrivateFieldGet(Jm,this)){for(const[e,t]of struct_tree_layer_builder_classPrivateFieldGet(Jm,this))document.getElementById(e)?.append(t);struct_tree_layer_builder_classPrivateFieldGet(Jm,this).clear();struct_tree_layer_builder_classPrivateFieldSet(Jm,this,null)}if(struct_tree_layer_builder_classPrivateFieldGet(Qm,this)){for(const e of struct_tree_layer_builder_classPrivateFieldGet(Qm,this)){const t=document.getElementById(e);t&&(t.ariaHidden=!0)}struct_tree_layer_builder_classPrivateFieldGet(Qm,this).length=0;struct_tree_layer_builder_classPrivateFieldSet(Qm,this,null)}if(struct_tree_layer_builder_classPrivateFieldGet(ev,this)){for(let e=0,t=struct_tree_layer_builder_classPrivateFieldGet(ev,this).length;e<t;e+=2){const t=struct_tree_layer_builder_classPrivateFieldGet(ev,this)[e],i=struct_tree_layer_builder_classPrivateFieldGet(ev,this)[e+1];let a="";for(const e of i){const t=document.getElementById(e);if(t){a+=t.textContent.trim()||"";t.ariaHidden="true"}}a&&(t.textContent=a)}struct_tree_layer_builder_classPrivateFieldGet(ev,this).length=0;struct_tree_layer_builder_classPrivateFieldSet(ev,this,null)}}}function _setAttributes(e,t){const{alt:i,id:a,lang:s}=e;if(void 0!==i){let a=!1;const s=removeNullCharacters(i);for(const t of e.children)if("annotation"===t.type){struct_tree_layer_builder_classPrivateFieldGet(Ym,this).getOrInsertComputed(t.id,makeMap).set("aria-label",s);a=!0}a||t.setAttribute("aria-label",s)}void 0!==a&&t.setAttribute("aria-owns",a);void 0!==s&&t.setAttribute("lang",removeNullCharacters(s,!0))}function _addImageInTextLayer(e,t){const{alt:i,bbox:a,children:s}=e,n=s?.[0];if(!struct_tree_layer_builder_classPrivateFieldGet(Zm,this)||!i||!a||"content"!==n?.type)return!1;const{id:r}=n;if(!r)return!1;t.setAttribute("aria-owns",r);const o=document.createElement("span");(struct_tree_layer_builder_classPrivateFieldGet(Jm,this)||struct_tree_layer_builder_classPrivateFieldSet(Jm,this,new Map)).set(r,o);o.setAttribute("role","img");o.setAttribute("aria-label",removeNullCharacters(i));const{pageHeight:l,pageX:d,pageY:c}=struct_tree_layer_builder_classPrivateFieldGet(Zm,this),h="calc(var(--total-scale-factor) *",{style:u}=o;u.width=`${h}${a[2]-a[0]}px)`;u.height=`${h}${a[3]-a[1]}px)`;u.left=`${h}${a[0]-d}px)`;u.top=`${h}${l-a[3]+c}px)`;return!0}function _collectIds(e,t){if(e){"id"in e&&t.push(e.id);for(const i of e.children||[])struct_tree_layer_builder_assertClassBrand(tv,this,_collectIds).call(this,i,t)}}function _walk(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!e)return null;let a=!0;if("role"in e){const{role:s}=e;if(zm.has(s)){t=document.createElementNS(Hm,s);const i=[];(struct_tree_layer_builder_classPrivateFieldGet(ev,this)||struct_tree_layer_builder_classPrivateFieldSet(ev,this,[])).push(t,i);for(const{type:t,id:a}of e.children||[])"content"===t&&a&&i.push(a)}else t=document.createElement("span");const n=s.match($m);if(n){t.setAttribute("role","heading");t.setAttribute("aria-level",n[1])}else Um[s]&&t.setAttribute("role","TH"===s&&"TR"===i.at(-1)?.role&&"TBody"===i.at(-2)?.role?"rowheader":Um[s]);if("Figure"===s&&struct_tree_layer_builder_assertClassBrand(tv,this,_addImageInTextLayer).call(this,e,t))return t;if("Formula"===s){if(e.mathML&&MathMLSanitizer.sanitizer){a=!1;t.setHTML(e.mathML,{sanitizer:MathMLSanitizer.sanitizer});struct_tree_layer_builder_assertClassBrand(tv,this,_collectIds).call(this,e,struct_tree_layer_builder_classPrivateFieldGet(Qm,this)||struct_tree_layer_builder_classPrivateFieldSet(Qm,this,[]));delete e.alt}if(!e.mathML&&1===e.children.length&&"math"!==e.children[0].role){t=document.createElementNS(Hm,"math");delete e.alt}}}t||=document.createElement("span");struct_tree_layer_builder_assertClassBrand(tv,this,_setAttributes).call(this,e,t);if(e.children)if(1===e.children.length&&"id"in e.children[0])struct_tree_layer_builder_assertClassBrand(tv,this,_setAttributes).call(this,e.children[0],t);else if(a){i.push(e);for(const a of e.children)t.append(struct_tree_layer_builder_assertClassBrand(tv,this,_walk).call(this,a,i));i.pop()}return t}function text_accessibility_classPrivateFieldInitSpec(e,t,i){text_accessibility_checkPrivateRedeclaration(e,t),t.set(e,i)}function text_accessibility_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function text_accessibility_classPrivateFieldGet(e,t){return e.get(text_accessibility_assertClassBrand(e,t))}function text_accessibility_classPrivateFieldSet(e,t,i){return e.set(text_accessibility_assertClassBrand(e,t),i),i}function text_accessibility_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var iv=new WeakMap,av=new WeakMap,sv=new WeakMap,nv=new WeakMap,rv=new WeakSet;class TextAccessibilityManager{constructor(){!function text_accessibility_classPrivateMethodInitSpec(e,t){text_accessibility_checkPrivateRedeclaration(e,t),t.add(e)}(this,rv);text_accessibility_classPrivateFieldInitSpec(this,iv,!1);text_accessibility_classPrivateFieldInitSpec(this,av,null);text_accessibility_classPrivateFieldInitSpec(this,sv,new Map);text_accessibility_classPrivateFieldInitSpec(this,nv,new Map)}setTextMapping(e){text_accessibility_classPrivateFieldSet(av,this,e)}enable(){if(text_accessibility_classPrivateFieldGet(iv,this))throw new Error("TextAccessibilityManager is already enabled.");if(!text_accessibility_classPrivateFieldGet(av,this))throw new Error("Text divs and strings have not been set.");text_accessibility_classPrivateFieldSet(iv,this,!0);text_accessibility_classPrivateFieldSet(av,this,text_accessibility_classPrivateFieldGet(av,this).slice());text_accessibility_classPrivateFieldGet(av,this).sort(_compareElementPositions);if(text_accessibility_classPrivateFieldGet(sv,this).size>0){const e=text_accessibility_classPrivateFieldGet(av,this);for(const[t,i]of text_accessibility_classPrivateFieldGet(sv,this)){document.getElementById(t)?text_accessibility_assertClassBrand(rv,this,_addIdToAriaOwns).call(this,t,e[i]):text_accessibility_classPrivateFieldGet(sv,this).delete(t)}}for(const[e,t]of text_accessibility_classPrivateFieldGet(nv,this))this.addPointerInTextLayer(e,t);text_accessibility_classPrivateFieldGet(nv,this).clear()}disable(){if(text_accessibility_classPrivateFieldGet(iv,this)){text_accessibility_classPrivateFieldGet(nv,this).clear();text_accessibility_classPrivateFieldSet(av,this,null);text_accessibility_classPrivateFieldSet(iv,this,!1)}}removePointerInTextLayer(e){if(!text_accessibility_classPrivateFieldGet(iv,this)){text_accessibility_classPrivateFieldGet(nv,this).delete(e);return}const t=text_accessibility_classPrivateFieldGet(av,this);if(!t||0===t.length)return;const{id:i}=e,a=text_accessibility_classPrivateFieldGet(sv,this).get(i);if(void 0===a)return;const s=t[a];text_accessibility_classPrivateFieldGet(sv,this).delete(i);let n=s.getAttribute("aria-owns");if(n?.includes(i)){n=n.split(" ").filter(e=>e!==i).join(" ");if(n)s.setAttribute("aria-owns",n);else{s.removeAttribute("aria-owns");s.setAttribute("role","presentation")}}}addPointerInTextLayer(e,t){const{id:i}=e;if(!i)return null;if(!text_accessibility_classPrivateFieldGet(iv,this)){text_accessibility_classPrivateFieldGet(nv,this).set(e,t);return null}t&&this.removePointerInTextLayer(e);const a=text_accessibility_classPrivateFieldGet(av,this);if(!a||0===a.length)return null;const s=binarySearchFirstItem(a,t=>_compareElementPositions.call(TextAccessibilityManager,e,t)<0),n=Math.max(0,s-1),r=a[n];text_accessibility_assertClassBrand(rv,this,_addIdToAriaOwns).call(this,i,r);text_accessibility_classPrivateFieldGet(sv,this).set(i,n);const o=r.parentNode;return o?.classList.contains("markedContent")?o.id:null}moveElementInDOM(e,t,i,a){const s=this.addPointerInTextLayer(i,a);if(!e.hasChildNodes()){e.append(t);return s}const n=Array.from(e.childNodes).filter(e=>e!==t);if(0===n.length)return s;const r=binarySearchFirstItem(n,e=>_compareElementPositions.call(TextAccessibilityManager,t,e)<0);0===r?n[0].before(t):n[r-1].after(t);return s}}function _compareElementPositions(e,t){const i=e.getBoundingClientRect(),a=t.getBoundingClientRect();if(0===i.width&&0===i.height)return 1;if(0===a.width&&0===a.height)return-1;const s=i.y,n=i.y+i.height,r=i.y+i.height/2,o=a.y,l=a.y+a.height,d=a.y+a.height/2;if(r<=o&&d>=n)return-1;if(d<=s&&r>=l)return 1;return i.x+i.width/2-(a.x+a.width/2)}function _addIdToAriaOwns(e,t){const i=t.getAttribute("aria-owns");i?.includes(e)||t.setAttribute("aria-owns",i?`${i} ${e}`:e);t.removeAttribute("role")}function text_highlighter_classPrivateFieldInitSpec(e,t,i){(function text_highlighter_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function text_highlighter_classPrivateFieldSet(e,t,i){return e.set(text_highlighter_assertClassBrand(e,t),i),i}function text_highlighter_classPrivateFieldGet(e,t){return e.get(text_highlighter_assertClassBrand(e,t))}function text_highlighter_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var ov,lv=new WeakMap;class TextHighlighter{constructor(e){let{findController:t,customFindController:i,eventBus:a,pageIndex:s}=e;text_highlighter_classPrivateFieldInitSpec(this,lv,null);this.findController=t;this.customFindController=i;this.matches=[];this.eventBus=a;this.pageIdx=s;this.textDivs=null;this.textContentItemsStr=null;this.enabled=!1}setTextMapping(e,t){this.textDivs=e;this.textContentItemsStr=t}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(!this.enabled){this.enabled=!0;if(!text_highlighter_classPrivateFieldGet(lv,this)){text_highlighter_classPrivateFieldSet(lv,this,new AbortController);this.eventBus._on("updatetextlayermatches",e=>{e.pageIndex!==this.pageIdx&&-1!==e.pageIndex||this._updateMatches()},{signal:text_highlighter_classPrivateFieldGet(lv,this).signal})}this._updateMatches()}}disable(){if(this.enabled){this.enabled=!1;text_highlighter_classPrivateFieldGet(lv,this)?.abort();text_highlighter_classPrivateFieldSet(lv,this,null);this._updateMatches(!0)}}_convertMatches(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"highlight",a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:-1,r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;if(!e)return[];const{textContentItemsStr:o}=this;let l=0,d=0;const c=o.length-1,h=[];for(let u=0,_=e.length;u<_;u++){let _=e[u];for(;l!==c&&_>=d+o[l].length;){d+=o[l].length;l++}l===o.length&&ngx_console_NgxConsole.error("Could not find a matching mapping");const p={begin:{divIdx:l,offset:_-d},cssClass:i+(r?` color${r[u]}`:""),highlightAll:a,selected:s&&u===n};_+=t[u];for(;l!==c&&_>d+o[l].length;){d+=o[l].length;l++}p.end={divIdx:l,offset:_-d};h.push(p)}return h}_renderMatches(e,t){if(0===e.length)return;const{pageIdx:i}=this,{textContentItemsStr:a,textDivs:s}=this;let n=null;const r={divIdx:-1,offset:void 0};function beginText(e,t){const i=e.divIdx;s[i].textContent="";return appendTextToDiv(i,0,e.offset,t)}function appendTextToDiv(e,t,i,n){let r=s[e];if(r.nodeType===Node.TEXT_NODE){const t=document.createElement("span");r.before(t);t.append(r);s[e]=t;r=t}const o=a[e].substring(t,i),l=document.createTextNode(o);if(n){const e=document.createElement("span");e.className=`${n} appended`;e.append(l);r.append(e);return n.includes("selected")?e:null}r.append(l);return 0}let o=-1,l=-1;for(let a=0;a<e.length;a++){const d=e[a];if(!d.selected&&!d.highlightAll)continue;const c=d.begin;if(c.divIdx===o&&c.offset===l)continue;o=c.divIdx;l=c.offset;const h=d.end,u=d.selected?" selected":"";let _=null;if(n&&c.divIdx===n.divIdx)appendTextToDiv(n.divIdx,n.offset,c.offset);else{null!==n&&appendTextToDiv(n.divIdx,n.offset,r.offset);beginText(c)}if(c.divIdx===h.divIdx)_=appendTextToDiv(c.divIdx,c.offset,h.offset,d.cssClass+u);else{_=appendTextToDiv(c.divIdx,c.offset,r.offset,d.cssClass+" begin"+u);for(let e=c.divIdx+1,t=h.divIdx;e<t;e++)s[e].className=d.cssClass+" middle"+u;beginText(h,d.cssClass+" end"+u)}n=h;d.selected&&t.scrollMatchIntoView({element:_,pageIndex:i,matchIndex:a});if(this.textDivs.length>0){const e=this.textDivs[0].closest(".textLayer").querySelectorAll(`.${d.cssClass}`);this.eventBus.dispatch("renderedtextlayerhighlights",{pageIndex:i,highlights:e})}}n&&appendTextToDiv(n.divIdx,n.offset,r.offset)}_updateMatches(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.enabled&&!e)return;const{findController:t,customFindController:i,matches:a,pageIdx:s}=this,{textContentItemsStr:n,textDivs:r}=this;let o=-1;for(const e of a){for(let t=Math.max(o,e.begin.divIdx),i=e.end.divIdx;t<=i;t++){const e=r[t];e.textContent=n[t];e.className=""}o=e.end.divIdx+1}if(e)return;const l=i.pageMatches[s]||null,d=i.pageMatchesLength[s]||null,c=i.pageMatchesColor?.[s]||null,h=t.pageMatches[s]||null,u=this._convertMatches(l,d,"customHighlight",i.state?.highlightAll,s===i.selected.pageIdx,i.selected.matchIdx,c);this.matches=[...u];t?.highlightMatches&&!e||e||this._renderMatches(this.matches,this.customFindController);const _=t.pageMatchesLength[s]||null,p=t.pageMatchesColor?.[s]||null,g=this._convertMatches(h,_,"highlight",t.state?.highlightAll,s===t.selected.pageIdx,t.selected.matchIdx,p);this.matches.push(...g);this.matches.sort((e,t)=>{const i=e.begin.divIdx-t.begin.divIdx;return 0===i?e.begin.offset-t.begin.offset:i});this._renderMatches(this.matches,this.findController)}}function text_layer_builder_classPrivateFieldInitSpec(e,t,i){text_layer_builder_checkPrivateRedeclaration(e,t),t.set(e,i)}function text_layer_builder_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function text_layer_builder_classPrivateFieldGet(e,t){return e.get(text_layer_builder_assertClassBrand(e,t))}function text_layer_builder_classPrivateFieldSet(e,t,i){return e.set(text_layer_builder_assertClassBrand(e,t),i),i}function text_layer_builder_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var dv=new WeakMap,cv=new WeakMap,hv=new WeakMap,uv=new WeakMap,_v=new WeakMap,pv=new WeakSet;class TextLayerBuilder{constructor(e){let{pdfPage:t,highlighter:i=null,accessibilityManager:a=null,enablePermissions:s=!1,onAppend:n=null,abortSignal:r=null}=e;!function text_layer_builder_classPrivateMethodInitSpec(e,t){text_layer_builder_checkPrivateRedeclaration(e,t),t.add(e)}(this,pv);text_layer_builder_classPrivateFieldInitSpec(this,dv,null);text_layer_builder_classPrivateFieldInitSpec(this,cv,!1);text_layer_builder_classPrivateFieldInitSpec(this,hv,null);text_layer_builder_classPrivateFieldInitSpec(this,uv,!1);text_layer_builder_classPrivateFieldInitSpec(this,_v,null);this.pdfPage=t;this.highlighter=i;this.accessibilityManager=a;text_layer_builder_classPrivateFieldSet(cv,this,!0===s);text_layer_builder_classPrivateFieldSet(hv,this,n);text_layer_builder_classPrivateFieldSet(dv,this,r);this.div=document.createElement("div");this.div.tabIndex=0;this.div.className="textLayer"}async render(e){let{viewport:t,images:i,textContentParams:a=null}=e;if(text_layer_builder_classPrivateFieldGet(uv,this)&&text_layer_builder_classPrivateFieldGet(_v,this)){text_layer_builder_classPrivateFieldGet(_v,this).update({viewport:t,onBefore:this.hide.bind(this)});this.show();return}this.cancel();text_layer_builder_classPrivateFieldSet(_v,this,new TextLayer({textContentSource:this.pdfPage.streamTextContent(a||{includeMarkedContent:!0,disableNormalization:!0}),images:i,container:this.div,viewport:t}));const{textDivs:s,textContentItemsStr:n}=text_layer_builder_classPrivateFieldGet(_v,this);this.highlighter?.setTextMapping(s,n);this.accessibilityManager?.setTextMapping(s);await text_layer_builder_classPrivateFieldGet(_v,this).render();text_layer_builder_classPrivateFieldSet(uv,this,!0);const r=document.createElement("div");r.className="endOfContent";this.div.append(r);text_layer_builder_assertClassBrand(pv,this,_bindMouse).call(this,r);text_layer_builder_classPrivateFieldGet(hv,this)?.call(this,this.div);this.highlighter?.enable();this.accessibilityManager?.enable()}hide(){if(!this.div.hidden&&text_layer_builder_classPrivateFieldGet(uv,this)){this.highlighter?.disable();this.div.hidden=!0}}show(){if(this.div.hidden&&text_layer_builder_classPrivateFieldGet(uv,this)){this.div.hidden=!1;this.highlighter?.enable()}}cancel(){text_layer_builder_classPrivateFieldGet(_v,this)?.cancel();text_layer_builder_classPrivateFieldSet(_v,this,null);this.highlighter?.disable();this.accessibilityManager?.disable();_removeGlobalSelectionListener.call(TextLayerBuilder,this.div)}}ov=TextLayerBuilder;function _bindMouse(e){const{div:t}=this,i=text_layer_builder_classPrivateFieldGet(dv,this),a=i?{signal:i}:null;t.addEventListener("mousedown",()=>{t.classList.add("selecting")},a);t.addEventListener("copy",e=>{if(!text_layer_builder_classPrivateFieldGet(cv,this)){const t=document.getSelection();e.clipboardData.setData("text/plain",removeNullCharacters(normalizeUnicode(t.toString())))}stopEvent(e)},a);gv._.set(t,e);_enableGlobalSelectionListener.call(ov,i)}function _removeGlobalSelectionListener(e){text_layer_builder_assertClassBrand(ov,this,gv)._.delete(e);if(0===text_layer_builder_assertClassBrand(ov,this,gv)._.size){text_layer_builder_assertClassBrand(ov,this,fv)._?.abort();fv._=text_layer_builder_assertClassBrand(ov,this,null)}}function _enableGlobalSelectionListener(e){if(text_layer_builder_assertClassBrand(ov,this,fv)._)return;fv._=text_layer_builder_assertClassBrand(ov,this,new AbortController);const t=e?AbortSignal.any([text_layer_builder_assertClassBrand(ov,this,fv)._.signal,e]):text_layer_builder_assertClassBrand(ov,this,fv)._.signal,reset=(e,t)=>{t.append(e);e.style.width="";e.style.height="";t.classList.remove("selecting")};let i=!1;document.addEventListener("pointerdown",()=>{i=!0},{signal:t});document.addEventListener("pointerup",()=>{i=!1;text_layer_builder_assertClassBrand(ov,this,gv)._.forEach(reset)},{signal:t});window.addEventListener("blur",()=>{i=!1;text_layer_builder_assertClassBrand(ov,this,gv)._.forEach(reset)},{signal:t});document.addEventListener("keyup",()=>{i||text_layer_builder_assertClassBrand(ov,this,gv)._.forEach(reset)},{signal:t});var a,s;document.addEventListener("selectionchange",()=>{const e=document.getSelection();if(0===e.rangeCount){text_layer_builder_assertClassBrand(ov,this,gv)._.forEach(reset);return}if(0===text_layer_builder_assertClassBrand(ov,this,gv)._.size)return;const t=new Set;for(let i=0;i<e.rangeCount;i++){const a=e.getRangeAt(i);for(const e of text_layer_builder_assertClassBrand(ov,this,gv)._.keys())!t.has(e)&&a.intersectsNode(e)&&t.add(e)}for(const[e,i]of text_layer_builder_assertClassBrand(ov,this,gv)._)t.has(e)?e.classList.add("selecting"):reset(i,e);a??="none"===getComputedStyle(text_layer_builder_assertClassBrand(ov,this,gv)._.values().next().value).getPropertyValue("-moz-user-select");if(a)return;const i=e.getRangeAt(0),n=s&&(0===i.compareBoundaryPoints(Range.END_TO_END,s)||0===i.compareBoundaryPoints(Range.START_TO_END,s));let r=n?i.startContainer:i.endContainer;r.nodeType===Node.TEXT_NODE&&(r=r.parentNode);r.classList?.contains("highlight")&&(r=r.parentNode);if(!n&&0===i.endOffset)do{for(;!r.previousSibling;)r=r.parentNode;r=r.previousSibling}while(!r.childNodes.length);const o=r.parentElement?.closest(".textLayer"),l=text_layer_builder_assertClassBrand(ov,this,gv)._.get(o);if(l){l.style.width=o.style.width;l.style.height=o.style.height;l.style.userSelect="text";r.parentElement.insertBefore(l,n?r:r.nextSibling)}s=i.cloneRange()},{signal:t})}var gv={_:new Map},fv={_:null};function pdf_page_view_classPrivateFieldInitSpec(e,t,i){pdf_page_view_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_page_view_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_page_view_classPrivateFieldGet(e,t){return e.get(pdf_page_view_assertClassBrand(e,t))}function pdf_page_view_classPrivateFieldSet(e,t,i){return e.set(pdf_page_view_assertClassBrand(e,t),i),i}function pdf_page_view_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const mv=new Map([["canvasWrapper",0],["textLayer",1],["annotationLayer",2],["annotationEditorLayer",3],["xfaLayer",3]]);var vv=new WeakMap,Pv=new WeakMap,wv=new WeakMap,Fv=new WeakMap,bv=new WeakMap,yv=new WeakMap,Sv=new WeakMap,Cv=new WeakMap,xv=new WeakMap,kv=new WeakMap,Ev=new WeakMap,Av=new WeakMap,Gv=new WeakMap,Bv=new WeakMap,Mv=new WeakMap,Iv=new WeakMap,Tv=new WeakMap,Dv=new WeakSet;class PDFPageView extends BasePDFPageView{constructor(e){super(e);!function pdf_page_view_classPrivateMethodInitSpec(e,t){pdf_page_view_checkPrivateRedeclaration(e,t),t.add(e)}(this,Dv);pdf_page_view_classPrivateFieldInitSpec(this,vv,null);pdf_page_view_classPrivateFieldInitSpec(this,Pv,p.ENABLE_FORMS);pdf_page_view_classPrivateFieldInitSpec(this,wv,null);pdf_page_view_classPrivateFieldInitSpec(this,Fv,null);pdf_page_view_classPrivateFieldInitSpec(this,bv,!0);pdf_page_view_classPrivateFieldInitSpec(this,yv,!1);pdf_page_view_classPrivateFieldInitSpec(this,Sv,!1);pdf_page_view_classPrivateFieldInitSpec(this,Cv,null);pdf_page_view_classPrivateFieldInitSpec(this,xv,!1);pdf_page_view_classPrivateFieldInitSpec(this,kv,null);pdf_page_view_classPrivateFieldInitSpec(this,Ev,null);pdf_page_view_classPrivateFieldInitSpec(this,Av,1);pdf_page_view_classPrivateFieldInitSpec(this,Gv,1);pdf_page_view_classPrivateFieldInitSpec(this,Bv,Xc);pdf_page_view_classPrivateFieldInitSpec(this,Mv,1);pdf_page_view_classPrivateFieldInitSpec(this,Iv,{directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0});pdf_page_view_classPrivateFieldInitSpec(this,Tv,[null,null,null,null]);const{container:t,defaultViewport:i}=e;this.renderingId="page"+this.id;pdf_page_view_classPrivateFieldSet(Cv,this,e.layerProperties||null);pdf_page_view_classPrivateFieldSet(vv,this,e.abortSignal||null);this.pdfPage=null;this.pageLabel=null;this.rotation=0;this.scale=e.scale||1;this.viewport=i;this.pdfPageRotate=i.rotation;this._optionalContentConfigPromise=e.optionalContentConfigPromise||null;pdf_page_view_classPrivateFieldSet(Bv,this,e.textLayerMode??Xc);pdf_page_view_classPrivateFieldSet(Pv,this,e.annotationMode??p.ENABLE_FORMS);this.imageResourcesPath=e.imageResourcesPath||"";this.enableDetailCanvas=e.enableDetailCanvas??!0;this.maxCanvasPixels=e.maxCanvasPixels??AppOptions.get("maxCanvasPixels");this.maxCanvasDim=e.maxCanvasDim||AppOptions.get("maxCanvasDim");this.capCanvasAreaFactor=e.capCanvasAreaFactor??AppOptions.get("capCanvasAreaFactor");pdf_page_view_classPrivateFieldSet(bv,this,!1!==e.enableAutoLinking);pdf_page_view_classPrivateFieldSet(Fv,this,e.commentManager||null);this.l10n=e.l10n;this.l10n||=new genericl10n_GenericL10n;this._isStandalone=!this.renderingQueue?.hasViewer();this._container=t;this._annotationCanvasMap=null;this.annotationLayer=null;this.annotationEditorLayer=null;this.textLayer=null;this.xfaLayer=null;this.structTreeLayer=null;this.drawLayer=null;this.detailView=null;const a=document.createElement("div");a.className="page";a.setAttribute("data-page-number",this.id);a.setAttribute("role","region");a.setAttribute("data-l10n-id","pdfjs-page-landmark");a.setAttribute("data-l10n-args",JSON.stringify({page:this.id}));this.div=a;pdf_page_view_assertClassBrand(Dv,this,_setDimensions).call(this);t?.append(a);if(this._isStandalone){t?.style.setProperty("--scale-factor",this.scale*PixelsPerInch.PDF_TO_CSS_UNITS);this.pageColors?.background&&t?.style.setProperty("--page-bg-color",this.pageColors.background);const{optionalContentConfigPromise:i}=e;i&&i.then(e=>{i===this._optionalContentConfigPromise&&(pdf_page_view_classPrivateFieldGet(Iv,this).initialOptionalContent=e.hasInitialVisibility)});e.l10n||this.l10n.translate(this.div)}}clone(e){const t=new PDFPageView({container:null,eventBus:this.eventBus,pagesColors:this.pageColors,renderingQueue:this.renderingQueue,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,minDurationToUpdateCanvas:this.minDurationToUpdateCanvas,defaultViewport:this.viewport,id:e,layerProperties:pdf_page_view_classPrivateFieldGet(Cv,this),abortSignal:pdf_page_view_classPrivateFieldGet(vv,this),scale:this.scale,optionalContentConfigPromise:this._optionalContentConfigPromise,textLayerMode:pdf_page_view_classPrivateFieldGet(Bv,this),annotationMode:pdf_page_view_classPrivateFieldGet(Pv,this),imageResourcesPath:this.imageResourcesPath,enableDetailCanvas:this.enableDetailCanvas,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableAutoLinking:pdf_page_view_classPrivateFieldGet(bv,this),commentManager:pdf_page_view_classPrivateFieldGet(Fv,this),l10n:this.l10n});t.setPdfPage(this.pdfPage.clone(e-1));return t}updatePageNumber(e){if(this.id===e)return;const t=this.id;this.id=e;this.renderingId=`page${e}`;this.pdfPage&&(this.pdfPage.pageNumber=e);this.setPageLabel(this.pageLabel);const{div:i}=this;i.setAttribute("data-page-number",e);i.setAttribute("data-l10n-args",JSON.stringify({page:e}));this._textHighlighter.pageIdx=e-1;pdf_page_view_classPrivateFieldGet(Cv,this).annotationEditorUIManager?.updatePageIndex(t-1,e-1)}setPdfPage(e){if(this._isStandalone&&("CanvasText"===this.pageColors?.foreground||"Canvas"===this.pageColors?.background)){this._container?.style.setProperty("--hcm-highlight-filter",e.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight"));this._container?.style.setProperty("--hcm-highlight-selected-filter",e.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","Highlight"))}this.pdfPage=e;this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*PixelsPerInch.PDF_TO_CSS_UNITS,rotation:t});pdf_page_view_assertClassBrand(Dv,this,_setDimensions).call(this);this.reset()}destroy(){this.reset();this.pdfPage?.cleanup()}deleteMe(e){if(e)this.div.remove();else{this.destroy();pdf_page_view_classPrivateFieldGet(Cv,this).annotationEditorUIManager?.deletePage(this.id)}}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}get _textHighlighter(){return shadow(this,"_textHighlighter",new TextHighlighter({pageIndex:this.id-1,eventBus:this.eventBus,findController:pdf_page_view_classPrivateFieldGet(Cv,this).findController,customFindController:pdf_page_view_classPrivateFieldGet(Cv,this).customFindController}))}_resetCanvas(){super._resetCanvas();pdf_page_view_classPrivateFieldSet(kv,this,null)}reset(){let{keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:i=!1,keepTextLayer:a=!1,keepCanvasWrapper:s=!1,preserveDetailViewState:n=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=this.pdfPage?._pdfBug??!1;this.cancelRendering({keepAnnotationLayer:e,keepAnnotationEditorLayer:t,keepXfaLayer:i,keepTextLayer:a});this.renderingState=Yg.INITIAL;const o=this.div,l=o.childNodes,d=e&&this.annotationLayer?.div||null,c=t&&this.annotationEditorLayer?.div||null,h=i&&this.xfaLayer?.div||null,u=a&&this.textLayer?.div||null,_=s&&pdf_page_view_classPrivateFieldGet(wv,this)||null;for(let e=l.length-1;e>=0;e--){const t=l[e];switch(t){case d:case c:case h:case u:case _:continue}if(r&&t.classList.contains("pdfBugGroupsLayer"))continue;t.remove();const i=pdf_page_view_classPrivateFieldGet(Tv,this).indexOf(t);i>=0&&(pdf_page_view_classPrivateFieldGet(Tv,this)[i]=null)}o.removeAttribute("data-loaded");d&&this.annotationLayer.hide();c&&this.annotationEditorLayer.hide();h&&this.xfaLayer.hide();u&&this.textLayer.hide();this.structTreeLayer?.hide();if(!s&&pdf_page_view_classPrivateFieldGet(wv,this)){pdf_page_view_classPrivateFieldSet(wv,this,null);this._resetCanvas()}if(!n){this.detailView?.reset({keepCanvas:s});s||(this.detailView=null)}}toggleEditingMode(e){pdf_page_view_classPrivateFieldSet(Sv,this,e);this.hasEditableAnnotations()&&this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0})}updateVisibleArea(e){if(this.enableDetailCanvas)if(pdf_page_view_classPrivateFieldGet(xv,this)&&this.maxCanvasPixels>0&&e){this.detailView??=new PDFPageDetailView({pageView:this,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,imagesRightClickMinSize:-1});this.detailView.update({visibleArea:e})}else if(this.detailView){this.detailView.reset();this.detailView=null}}update(e){let{scale:t=0,rotation:i=null,optionalContentConfigPromise:a=null,drawingDelay:s=-1}=e;this.scale=t||this.scale;"number"==typeof i&&(this.rotation=i);const n=s>=0&&s<1e3;if(n&&!this.canvas)return;if(a instanceof Promise){this._optionalContentConfigPromise=a;a.then(e=>{a===this._optionalContentConfigPromise&&(pdf_page_view_classPrivateFieldGet(Iv,this).initialOptionalContent=e.hasInitialVisibility)})}pdf_page_view_classPrivateFieldGet(Iv,this).directDrawing=!0;const r=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:this.scale*PixelsPerInch.PDF_TO_CSS_UNITS,rotation:r});pdf_page_view_assertClassBrand(Dv,this,_setDimensions).call(this);this._isStandalone&&this._container?.style.setProperty("--scale-factor",this.viewport.scale);pdf_page_view_assertClassBrand(Dv,this,_computeScale).call(this);if(this.canvas){const e=pdf_page_view_classPrivateFieldGet(yv,this)&&pdf_page_view_classPrivateFieldGet(xv,this);if(n||e){if(n&&!e&&this.renderingState!==Yg.FINISHED){this.cancelRendering({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:s});this.renderingState=Yg.FINISHED;pdf_page_view_classPrivateFieldGet(Iv,this).directDrawing=!1}this.cssTransform({redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!n,hideTextLayer:n});if(!n){this.detailView?.update({underlyingViewUpdated:!0});this.dispatchPageRendered(!0,!1)}return}}this.cssTransform({});this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0,preserveDetailViewState:!0});this.detailView?.update({underlyingViewUpdated:!0})}cancelRendering(){let{keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:i=!1,keepTextLayer:a=!1,cancelExtraDelay:s=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super.cancelRendering({cancelExtraDelay:s});if(this.textLayer&&(!a||!this.textLayer.div)){this.textLayer.cancel();this.textLayer=null}if(this.annotationLayer&&(!e||!this.annotationLayer.div)){this.annotationLayer.cancel();this.annotationLayer=null;this._annotationCanvasMap=null}this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null);if(this.annotationEditorLayer&&(!t||!this.annotationEditorLayer.div)){if(this.drawLayer){this.drawLayer.cancel();this.drawLayer=null}this.annotationEditorLayer.cancel();this.annotationEditorLayer=null}if(this.xfaLayer&&(!i||!this.xfaLayer.div)){this.xfaLayer.cancel();this.xfaLayer=null;this._textHighlighter?.disable()}}cssTransform(e){let{redrawAnnotationLayer:t=!1,redrawAnnotationEditorLayer:i=!1,redrawXfaLayer:a=!1,redrawTextLayer:s=!1,hideTextLayer:n=!1}=e;const{canvas:r}=this;if(!r)return;const o=pdf_page_view_classPrivateFieldGet(kv,this);if(this.viewport!==o){const e=(360+this.viewport.rotation-o.rotation)%360;if(90===e||270===e){const{width:t,height:i}=this.viewport,a=i/t,s=t/i;r.style.transform=`rotate(${e}deg) scale(${a},${s})`}else r.style.transform=0===e?"":`rotate(${e}deg)`}t&&this.annotationLayer&&pdf_page_view_assertClassBrand(Dv,this,_renderAnnotationLayer).call(this);if(i&&this.annotationEditorLayer){this.drawLayer&&pdf_page_view_assertClassBrand(Dv,this,_renderDrawLayer).call(this);pdf_page_view_assertClassBrand(Dv,this,_renderAnnotationEditorLayer).call(this)}a&&this.xfaLayer&&pdf_page_view_assertClassBrand(Dv,this,_renderXfaLayer).call(this);if(this.textLayer)if(n){this.textLayer.hide();this.structTreeLayer?.hide()}else s&&pdf_page_view_assertClassBrand(Dv,this,_renderTextLayer).call(this)}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}_ensureCanvasWrapper(){let e=pdf_page_view_classPrivateFieldGet(wv,this);if(!e){e=pdf_page_view_classPrivateFieldSet(wv,this,document.createElement("div"));e.classList.add("canvasWrapper");pdf_page_view_assertClassBrand(Dv,this,_addLayer).call(this,e,"canvasWrapper")}return e}_getRenderingContext(e,t,i,a){const s=AppOptions.get("pdfBackgroundColor");return{canvas:e,transform:t,viewport:this.viewport,annotationMode:pdf_page_view_classPrivateFieldGet(Pv,this),optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors,isEditing:pdf_page_view_classPrivateFieldGet(Sv,this),background:s||null,recordOperations:i,recordImages:a}}async draw(){if(this.renderingState!==Yg.INITIAL){ngx_console_NgxConsole.error("Must be in new state before drawing");this.reset()}const{div:e,l10n:t,pdfPage:i,viewport:a}=this;if(!i){this.renderingState=Yg.FINISHED;throw new Error("pdfPage is not loaded")}this.renderingState=Yg.RUNNING;const s=this._ensureCanvasWrapper();if(!this.textLayer&&pdf_page_view_classPrivateFieldGet(Bv,this)!==qc&&!i.isPureXfa){this._accessibilityManager||=new TextAccessibilityManager;this.textLayer=new TextLayerBuilder({pdfPage:i,highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,enablePermissions:pdf_page_view_classPrivateFieldGet(Bv,this)===Kc,onAppend:e=>{this.l10n.pause();pdf_page_view_assertClassBrand(Dv,this,_addLayer).call(this,e,"textLayer");this.l10n.resume()},abortSignal:pdf_page_view_classPrivateFieldGet(vv,this)})}if(!this.annotationLayer&&pdf_page_view_classPrivateFieldGet(Pv,this)!==p.DISABLE){const{annotationStorage:e,annotationEditorUIManager:t,downloadManager:a,enableComment:s,enableScripting:n,fieldObjectsPromise:r,hasJSActionsPromise:o,linkService:l}=pdf_page_view_classPrivateFieldGet(Cv,this);this._annotationCanvasMap||=new Map;this.annotationLayer=new AnnotationLayerBuilder({pdfPage:i,annotationStorage:e,imageResourcesPath:this.imageResourcesPath,renderForms:pdf_page_view_classPrivateFieldGet(Pv,this)===p.ENABLE_FORMS,linkService:l,downloadManager:a,enableComment:s,enableScripting:n,hasJSActionsPromise:o,fieldObjectsPromise:r,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager,annotationEditorUIManager:t,commentManager:pdf_page_view_classPrivateFieldGet(Fv,this),onAppend:e=>{pdf_page_view_assertClassBrand(Dv,this,_addLayer).call(this,e,"annotationLayer")}})}const{width:n,height:r}=a;pdf_page_view_classPrivateFieldSet(kv,this,a);const{canvas:o,prevCanvas:l}=this._createCanvas(e=>{s.prepend(e)});o.setAttribute("role","presentation");this.outputScale||pdf_page_view_assertClassBrand(Dv,this,_computeScale).call(this);const{outputScale:d}=this;pdf_page_view_classPrivateFieldSet(yv,this,pdf_page_view_classPrivateFieldGet(xv,this));const c=approximateFraction(d.sx),h=approximateFraction(d.sy);let u=floorToDivide(n*d.sx,c[0]),_=floorToDivide(r*d.sy,h[0]);const g=await MaxCanvasSize.reduceToMaxCanvasSize(u,_);if(g>1){u/=g;u*=.95;_/=g;_*=.95;const e=Math.round(100*(g/.95-1));warn(`Page ${this.id}: Reduced the maximum resolution by ${e}% because the browser can't render larger canvases.`)}o.width=u;o.height=_;const f=floorToDivide(lh(n),c[1]),m=floorToDivide(lh(r),h[1]);d.sx=u/f;d.sy=_/m;if(pdf_page_view_classPrivateFieldGet(Av,this)!==c[1]){e.style.setProperty("--scale-round-x",`${c[1]}px`);pdf_page_view_classPrivateFieldSet(Av,this,c[1])}if(pdf_page_view_classPrivateFieldGet(Gv,this)!==h[1]){e.style.setProperty("--scale-round-y",`${h[1]}px`);pdf_page_view_classPrivateFieldSet(Gv,this,h[1])}const v=this.enableOptimizedPartialRendering&&pdf_page_view_classPrivateFieldGet(yv,this)&&!this.recordedBBoxes,P=-1!==this.imagesRightClickMinSize&&!this.imageCoordinates,w=d.scaled?[d.sx,0,0,d.sy,0,0]:null,b=o,y=this._drawCanvas(this._getRenderingContext(o,w,v,P),()=>{l?.remove();this.canvas===b&&this._resetCanvas()},e=>{pdf_page_view_classPrivateFieldGet(Iv,this).regularAnnotations=!e.separateAnnots;this.dispatchPageRendered(!1,!1)}).then(async()=>{if(this.renderingState!==Yg.FINISHED)return;this.structTreeLayer||=new StructTreeLayerBuilder(i,a.rawDims);const e=pdf_page_view_assertClassBrand(Dv,this,_renderTextLayer).call(this);if(this.annotationLayer){await pdf_page_view_assertClassBrand(Dv,this,_renderAnnotationLayer).call(this);pdf_page_view_classPrivateFieldGet(bv,this)&&this.annotationLayer&&this.textLayer&&await pdf_page_view_assertClassBrand(Dv,this,_injectLinkAnnotations).call(this,e)}const{annotationEditorUIManager:n}=pdf_page_view_classPrivateFieldGet(Cv,this);if(n){this.drawLayer||=new DrawLayerBuilder;await pdf_page_view_assertClassBrand(Dv,this,_renderDrawLayer).call(this);this.drawLayer.setParent(s);if(this.annotationLayer||pdf_page_view_classPrivateFieldGet(Pv,this)===p.DISABLE){this.annotationEditorLayer||=new AnnotationEditorLayerBuilder({uiManager:n,pageIndex:this.id-1,l10n:t,structTreeLayer:this.structTreeLayer,accessibilityManager:this._accessibilityManager,annotationLayer:this.annotationLayer?.annotationLayer,textLayer:this.textLayer,drawLayer:this.drawLayer.getDrawLayer(),onAppend:e=>{pdf_page_view_assertClassBrand(Dv,this,_addLayer).call(this,e,"annotationEditorLayer")},eventBus:this.eventBus});pdf_page_view_assertClassBrand(Dv,this,_renderAnnotationEditorLayer).call(this)}}});if(i.isPureXfa){if(!this.xfaLayer){const{annotationStorage:e,linkService:t}=pdf_page_view_classPrivateFieldGet(Cv,this);this.xfaLayer=new XfaLayerBuilder({pdfPage:i,annotationStorage:e,linkService:t})}pdf_page_view_assertClassBrand(Dv,this,_renderXfaLayer).call(this)}e.setAttribute("data-loaded",!0);this.dispatchPageRender();return y}setPageLabel(e){this.pageLabel="string"==typeof e?e:null;this.div.setAttribute("data-l10n-args",JSON.stringify({page:this.pageLabel??this.id}));null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{directDrawing:e,initialOptionalContent:t,regularAnnotations:i}=pdf_page_view_classPrivateFieldGet(Iv,this);return e&&t&&i?this.canvas:null}}function _addLayer(e,t){const i=mv.get(t),a=pdf_page_view_classPrivateFieldGet(Tv,this)[i];pdf_page_view_classPrivateFieldGet(Tv,this)[i]=e;if(a)a.replaceWith(e);else{for(let t=i-1;t>=0;t--){const i=pdf_page_view_classPrivateFieldGet(Tv,this)[t];if(i){i.after(e);return}}this.div.prepend(e)}}function _setDimensions(){const{div:e,viewport:t}=this;if(t.userUnit!==pdf_page_view_classPrivateFieldGet(Mv,this)){1!==t.userUnit?e.style.setProperty("--user-unit",t.userUnit):e.style.removeProperty("--user-unit");pdf_page_view_classPrivateFieldSet(Mv,this,t.userUnit)}if(this.pdfPage){if(pdf_page_view_classPrivateFieldGet(Ev,this)===t.rotation)return;pdf_page_view_classPrivateFieldSet(Ev,this,t.rotation)}setLayerDimensions(e,t,!0,!1)}function _dispatchLayerRendered(e,t,i){this.eventBus.dispatch(e,{source:this,pageNumber:this.id,error:t,layer:i})}async function _renderAnnotationLayer(){let e=null;try{await this.annotationLayer.render({viewport:this.viewport,intent:"display",structTreeLayer:this.structTreeLayer})}catch(t){ngx_console_NgxConsole.error("#renderAnnotationLayer:",t);e=t}finally{pdf_page_view_assertClassBrand(Dv,this,_dispatchLayerRendered).call(this,"annotationlayerrendered",e,this.annotationLayer)}}async function _renderAnnotationEditorLayer(){let e=null;try{await this.annotationEditorLayer.render({viewport:this.viewport,intent:"display"})}catch(t){ngx_console_NgxConsole.error("#renderAnnotationEditorLayer:",t);e=t}finally{pdf_page_view_assertClassBrand(Dv,this,_dispatchLayerRendered).call(this,"annotationeditorlayerrendered",e,this.annotationEditorLayer)}}async function _renderDrawLayer(){try{await this.drawLayer.render({intent:"display"})}catch(e){ngx_console_NgxConsole.error("#renderDrawLayer:",e)}}async function _renderXfaLayer(){let e=null;try{const e=await this.xfaLayer.render({viewport:this.viewport,intent:"display"});e?.textDivs&&this._textHighlighter&&pdf_page_view_assertClassBrand(Dv,this,_buildXfaTextContentItems).call(this,e.textDivs)}catch(t){ngx_console_NgxConsole.error("#renderXfaLayer:",t);e=t}finally{if(this.xfaLayer?.div){this.l10n.pause();pdf_page_view_assertClassBrand(Dv,this,_addLayer).call(this,this.xfaLayer.div,"xfaLayer");this.l10n.resume()}pdf_page_view_assertClassBrand(Dv,this,_dispatchLayerRendered).call(this,"xfalayerrendered",e,this.xfaLayer)}}async function _renderTextLayer(){if(!this.textLayer)return;let e=null;try{await this.textLayer.render({viewport:this.viewport,images:this.imageCoordinates?new TextLayerImages(this.imagesRightClickMinSize,this.imageCoordinates,this.viewport,()=>this.canvas):null})}catch(t){if(t instanceof AbortException)return;ngx_console_NgxConsole.error("#renderTextLayer:",t);e=t}pdf_page_view_assertClassBrand(Dv,this,_dispatchLayerRendered).call(this,"textlayerrendered",e,this.textLayer);pdf_page_view_assertClassBrand(Dv,this,_renderStructTreeLayer).call(this)}async function _renderStructTreeLayer(){if(!this.textLayer)return;const e=await(this.structTreeLayer?.render());if(e){this.l10n.pause();this.structTreeLayer?.updateTextLayer();this.canvas&&e.parentNode!==this.canvas&&this.canvas.append(e);this.l10n.resume()}this.structTreeLayer?.show()}async function _buildXfaTextContentItems(e){const t=await this.pdfPage.getTextContent(),i=[];for(const e of t.items)i.push(e.str);this._textHighlighter.setTextMapping(e,i);this._textHighlighter.enable()}async function _injectLinkAnnotations(e){let t=null;try{await e;if(!this.annotationLayer)return;await this.annotationLayer.injectLinkAnnotations(Autolinker.processLinks(this))}catch(e){ngx_console_NgxConsole.error("#injectLinkAnnotations:",e);t=e}pdf_page_view_assertClassBrand(Dv,this,_dispatchLayerRendered).call(this,"linkannotationsadded",t)}function _computeScale(){const{width:e,height:t}=this.viewport,i=this.outputScale=new OutputScale;if(0===this.maxCanvasPixels){const e=1/this.scale;i.sx*=e;i.sy*=e;pdf_page_view_classPrivateFieldSet(xv,this,!0)}else{pdf_page_view_classPrivateFieldSet(xv,this,i.limitCanvas(e,t,this.maxCanvasPixels,this.maxCanvasDim,this.capCanvasAreaFactor));if(pdf_page_view_classPrivateFieldGet(xv,this)&&this.enableDetailCanvas){const e=this.enableOptimizedPartialRendering?4:2;i.sx/=e;i.sy/=e}}}function pdf_viewer_classPrivateMethodInitSpec(e,t){pdf_viewer_checkPrivateRedeclaration(e,t),t.add(e)}function pdf_viewer_classPrivateFieldInitSpec(e,t,i){pdf_viewer_checkPrivateRedeclaration(e,t),t.set(e,i)}function pdf_viewer_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pdf_viewer_classPrivateFieldGet(e,t){return e.get(pdf_viewer_assertClassBrand(e,t))}function pdf_viewer_classPrivateFieldSet(e,t,i){return e.set(pdf_viewer_assertClassBrand(e,t),i),i}function pdf_viewer_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Lv=1e4,Rv=5e3,Nv=250;function isValidAnnotationEditorMode(e){return Object.values(f).includes(e)&&e!==f.DISABLE}var Ov=new WeakMap,Wv=new WeakMap,jv=new WeakSet;class PDFPageViewBuffer{constructor(e){pdf_viewer_classPrivateMethodInitSpec(this,jv);pdf_viewer_classPrivateFieldInitSpec(this,Ov,new Set);pdf_viewer_classPrivateFieldInitSpec(this,Wv,0);pdf_viewer_classPrivateFieldSet(Wv,this,e)}push(e){const t=pdf_viewer_classPrivateFieldGet(Ov,this);t.has(e)&&t.delete(e);t.add(e);t.size>pdf_viewer_classPrivateFieldGet(Wv,this)&&pdf_viewer_assertClassBrand(jv,this,_destroyFirstView).call(this)}resize(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;pdf_viewer_classPrivateFieldSet(Wv,this,e);const i=pdf_viewer_classPrivateFieldGet(Ov,this);if(t){const e=i.size;let a=1;for(const s of i){if(t.has(s.id)){i.delete(s);i.add(s)}if(++a>e)break}}for(;i.size>pdf_viewer_classPrivateFieldGet(Wv,this);)pdf_viewer_assertClassBrand(jv,this,_destroyFirstView).call(this)}has(e){return pdf_viewer_classPrivateFieldGet(Ov,this).has(e)}[Symbol.iterator](){return pdf_viewer_classPrivateFieldGet(Ov,this).keys()}}function _destroyFirstView(){const e=pdf_viewer_classPrivateFieldGet(Ov,this).keys().next().value;e?.destroy();pdf_viewer_classPrivateFieldGet(Ov,this).delete(e)}var Vv=new WeakMap,Uv=new WeakMap,zv=new WeakMap,Hv=new WeakMap,$v=new WeakMap,qv=new WeakMap,Xv=new WeakMap,Kv=new WeakMap,Yv=new WeakMap,Zv=new WeakMap,Jv=new WeakMap,Qv=new WeakMap,eP=new WeakMap,tP=new WeakMap,iP=new WeakMap,aP=new WeakMap,sP=new WeakMap,nP=new WeakMap,rP=new WeakMap,oP=new WeakMap,lP=new WeakMap,dP=new WeakMap,cP=new WeakMap,hP=new WeakMap,uP=new WeakMap,_P=new WeakMap,pP=new WeakMap,gP=new WeakMap,fP=new WeakMap,mP=new WeakMap,vP=new WeakMap,PP=new WeakMap,wP=new WeakMap,FP=new WeakMap,bP=new WeakMap,yP=new WeakMap,SP=new WeakMap,CP=new WeakMap,xP=new WeakMap,kP=new WeakMap,EP=new WeakMap,AP=new WeakMap,GP=new WeakSet,BP=new WeakMap;class PDFViewer{constructor(e){pdf_viewer_classPrivateMethodInitSpec(this,GP);pdf_viewer_classPrivateFieldInitSpec(this,Vv,null);pdf_viewer_classPrivateFieldInitSpec(this,Uv,null);pdf_viewer_classPrivateFieldInitSpec(this,zv,null);pdf_viewer_classPrivateFieldInitSpec(this,Hv,f.NONE);pdf_viewer_classPrivateFieldInitSpec(this,$v,null);pdf_viewer_classPrivateFieldInitSpec(this,qv,p.ENABLE_FORMS);pdf_viewer_classPrivateFieldInitSpec(this,Xv,null);pdf_viewer_classPrivateFieldInitSpec(this,Kv,null);pdf_viewer_classPrivateFieldInitSpec(this,Yv,null);pdf_viewer_classPrivateFieldInitSpec(this,Zv,!1);pdf_viewer_classPrivateFieldInitSpec(this,Jv,!1);pdf_viewer_classPrivateFieldInitSpec(this,Qv,!1);pdf_viewer_classPrivateFieldInitSpec(this,eP,!1);pdf_viewer_classPrivateFieldInitSpec(this,tP,!0);pdf_viewer_classPrivateFieldInitSpec(this,iP,null);pdf_viewer_classPrivateFieldInitSpec(this,aP,null);pdf_viewer_classPrivateFieldInitSpec(this,sP,0);pdf_viewer_classPrivateFieldInitSpec(this,nP,null);pdf_viewer_classPrivateFieldInitSpec(this,rP,!0);pdf_viewer_classPrivateFieldInitSpec(this,oP,null);pdf_viewer_classPrivateFieldInitSpec(this,lP,null);pdf_viewer_classPrivateFieldInitSpec(this,dP,null);pdf_viewer_classPrivateFieldInitSpec(this,cP,!1);pdf_viewer_classPrivateFieldInitSpec(this,hP,null);pdf_viewer_classPrivateFieldInitSpec(this,uP,0);pdf_viewer_classPrivateFieldInitSpec(this,_P,new ResizeObserver(pdf_viewer_assertClassBrand(GP,this,pdf_viewer_resizeObserverCallback).bind(this)));pdf_viewer_classPrivateFieldInitSpec(this,pP,null);pdf_viewer_classPrivateFieldInitSpec(this,gP,null);pdf_viewer_classPrivateFieldInitSpec(this,fP,null);pdf_viewer_classPrivateFieldInitSpec(this,mP,null);pdf_viewer_classPrivateFieldInitSpec(this,vP,null);pdf_viewer_classPrivateFieldInitSpec(this,PP,!0);pdf_viewer_classPrivateFieldInitSpec(this,wP,Xc);pdf_viewer_classPrivateFieldInitSpec(this,FP,void 0);pdf_viewer_classPrivateFieldInitSpec(this,bP,0);pdf_viewer_classPrivateFieldInitSpec(this,yP,"multiple");pdf_viewer_classPrivateFieldInitSpec(this,SP,25);pdf_viewer_classPrivateFieldInitSpec(this,CP,Lc);pdf_viewer_classPrivateFieldInitSpec(this,xP,null);pdf_viewer_classPrivateFieldInitSpec(this,kP,null);pdf_viewer_classPrivateFieldInitSpec(this,EP,null);pdf_viewer_classPrivateFieldInitSpec(this,AP,null);pdf_viewer_classPrivateFieldInitSpec(this,BP,!1);0;this.container=e.container;this.viewer=e.viewer||e.container.firstElementChild;pdf_viewer_classPrivateFieldSet(xP,this,e.viewerAlert||null);this.eventBus=e.eventBus;this.pageViewMode=e.pageViewMode||"multiple";this.defaultCacheSize=e.defaultCacheSize;pdf_viewer_classPrivateFieldSet(SP,this,e.maxZoom);pdf_viewer_classPrivateFieldSet(CP,this,e.minZoom);if("DIV"!==this.container?.tagName||"DIV"!==this.viewer?.tagName)throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&"absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");pdf_viewer_classPrivateFieldGet(_P,this).observe(this.container);this.linkService=e.linkService||new SimpleLinkService;this.downloadManager=e.downloadManager||null;this.findController=e.findController||null;this.customFindController=e.customFindController||null;pdf_viewer_classPrivateFieldSet(Uv,this,e.altTextManager||null);pdf_viewer_classPrivateFieldSet(Xv,this,e.commentManager||null);pdf_viewer_classPrivateFieldSet(vP,this,e.signatureManager||null);pdf_viewer_classPrivateFieldSet(Yv,this,e.editorUndoBar||null);this.findController&&(this.findController.onIsPageVisible=e=>this._getVisiblePages().ids.has(e));this._scriptingManager=e.scriptingManager||null;pdf_viewer_classPrivateFieldSet(wP,this,e.textLayerMode??Xc);pdf_viewer_classPrivateFieldSet(qv,this,e.annotationMode??p.ENABLE_FORMS);pdf_viewer_classPrivateFieldSet(Hv,this,e.annotationEditorMode??f.NONE);pdf_viewer_classPrivateFieldSet(zv,this,e.annotationEditorHighlightColors||null);pdf_viewer_classPrivateFieldSet(Zv,this,!0===e.enableHighlightFloatingButton);pdf_viewer_classPrivateFieldSet(Qv,this,!0===e.enableUpdatedAddImage);pdf_viewer_classPrivateFieldSet(eP,this,!0===e.enableNewAltTextWhenAddingImage);this.imageResourcesPath=e.imageResourcesPath||"";this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1;this.removePageBorders=e.removePageBorders||!1;this.maxCanvasPixels=e.maxCanvasPixels;this.maxCanvasDim=e.maxCanvasDim;this.capCanvasAreaFactor=e.capCanvasAreaFactor;this.enableDetailCanvas=e.enableDetailCanvas??!0;this.enableOptimizedPartialRendering=e.enableOptimizedPartialRendering??!1;this.imagesRightClickMinSize=e.imagesRightClickMinSize??-1;this.l10n=e.l10n;this.l10n||=new genericl10n_GenericL10n;pdf_viewer_classPrivateFieldSet(Jv,this,e.enablePermissions||!1);this.pageColors=e.pageColors||null;pdf_viewer_classPrivateFieldSet(nP,this,e.mlManager||null);pdf_viewer_classPrivateFieldSet(PP,this,!1!==e.supportsPinchToZoom);pdf_viewer_classPrivateFieldSet(tP,this,!1!==e.enableAutoLinking);pdf_viewer_classPrivateFieldSet(sP,this,e.minDurationToUpdateCanvas??500);this._enableFlipByDrag=!0;this.defaultRenderingQueue=!e.renderingQueue;if(this.defaultRenderingQueue){this.renderingQueue=new PDFRenderingQueue;this.renderingQueue.setViewer(this)}else this.renderingQueue=e.renderingQueue;const{abortSignal:t}=e;pdf_viewer_classPrivateFieldSet(iP,this,t||null);t?.addEventListener("abort",()=>{pdf_viewer_classPrivateFieldGet(_P,this).disconnect();pdf_viewer_classPrivateFieldSet(_P,this,null)},{once:!0});this.scroll=watchScroll(this.container,this._scrollUpdate.bind(this),t);this.presentationModeState=Rc;this._resetView();this.removePageBorders&&this.viewer.classList.add("removePageBorders");pdf_viewer_assertClassBrand(GP,this,_updateContainerHeightCss).call(this);this.eventBus._on("thumbnailrendered",e=>{let{pageNumber:t,pdfPage:i}=e;const a=this._pages[t-1];pdf_viewer_classPrivateFieldGet(Vv,this).has(a)||i?.cleanup()});e.l10n||this.l10n.translate(this.container);this.cspPolicyService=e.cspPolicyService}get maxZoom(){return pdf_viewer_classPrivateFieldGet(SP,this)}set maxZoom(e){pdf_viewer_classPrivateFieldSet(SP,this,e)}get minZoom(){return pdf_viewer_classPrivateFieldGet(CP,this)}set minZoom(e){pdf_viewer_classPrivateFieldSet(CP,this,e)}setTextLayerMode(e){pdf_viewer_classPrivateFieldSet(wP,this,e)}get pageViewMode(){return pdf_viewer_classPrivateFieldGet(yP,this)}set pageViewMode(e){if(pdf_viewer_classPrivateFieldGet(yP,this)!==e){const t=this._currentPageNumber;pdf_viewer_classPrivateFieldSet(yP,this,e);pdf_viewer_classPrivateFieldSet(FP,this,void 0);"infinite-scroll"===e&&pdf_viewer_assertClassBrand(GP,this,_initOuterScrollListener).call(this);this.eventBus.dispatch("pageviewmodechanged",{source:this,pageViewMode:e});if("infinite-scroll"===e&&t>1){pdf_viewer_classPrivateFieldSet(bP,this,Date.now());setTimeout(()=>{pdf_viewer_classPrivateFieldSet(bP,this,Date.now());pdf_viewer_assertClassBrand(GP,this,_scrollIntoView).call(this,this._pages[t-1])},200)}}}get printingAllowed(){return pdf_viewer_classPrivateFieldGet(rP,this)}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}swapPages(e,t){const i=this._pages[e].pdfPage,a=this._pages[t].pdfPage;this._pages[e].setPdfPage(a);this._pages[t].setPdfPage(i);this.refresh()}getCachedPageViews(){return new Set(pdf_viewer_classPrivateFieldGet(Vv,this))}get pageViewsReady(){return this._pages.every(e=>e?.pdfPage)}get renderForms(){return pdf_viewer_classPrivateFieldGet(qv,this)===p.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(e){if(!Number.isInteger(e))throw new Error("Invalid page number.");if(!this.pdfDocument)return;const t=this._currentPageNumber!==e,i=t&&Math.abs(this._currentPageNumber-e)<=2;this._setCurrentPageNumber(e,!0)||ngx_console_NgxConsole.error(`currentPageNumber: "${e}" is not a valid page.`);if(this.pageFlip&&t){i?this.pageFlip.flip(e-1):this.pageFlip.turnToPage(e-1);this.ensureAdjacentPagesAreLoaded()}}hidePagesDependingOnpageViewMode(){"book"===this.pageViewMode&&(this.pageFlip||setTimeout(()=>{if(!this.pageFlip){const e=this._pages[0].div,t=e.parentElement,i=t.parentElement;i.style.width=2*e.clientWidth+"px";i.style.overflow="hidden";i.style.marginLeft="auto";i.style.marginRight="auto";this.pageFlip=new PageFlip(t,{width:e.clientWidth,height:e.clientHeight,showCover:!0,size:"fixed",enableFlipByDrag:this._enableFlipByDrag},this.cspPolicyService);this.pageFlip.loadFromHTML(this.container.querySelectorAll(".page"));this.pageFlip.on("flip",e=>{this._currentPageNumber!==e.data+1&&this._setCurrentPageNumber(e.data+1,!1)})}},100))}async _setCurrentPageNumber(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this._currentPageNumber===e){t&&pdf_viewer_assertClassBrand(GP,this,_resetCurrentPageView).call(this);return!0}if(!(0<e&&e<=this.pagesCount))return!1;const i=this._currentPageNumber;this._currentPageNumber=e;this.hidePagesDependingOnpageViewMode();if("book"===this.pageViewMode||"infinite-scroll"===this.pageViewMode){const e=this._pages[this.currentPageNumber-1];if(e.div.parentElement.classList.contains("spread"))e.div.parentElement.childNodes.forEach(async e=>{const t=Number(e.getAttribute("data-page-number")),i=this._pages[t-1];await pdf_viewer_assertClassBrand(GP,this,pdf_viewer_ensurePdfPageLoaded).call(this,i);this.renderingQueue.renderView(i);e.style.display="inline-block"});else{await pdf_viewer_assertClassBrand(GP,this,pdf_viewer_ensurePdfPageLoaded).call(this,e);this.renderingQueue.renderView(e);"book"===pdf_viewer_classPrivateFieldGet(yP,this)&&this.ensureAdjacentPagesAreLoaded()}}this.eventBus.dispatch("pagechanging",{source:this,pageNumber:e,pageLabel:this._pageLabels?.[e-1]??null,previous:i});t&&pdf_viewer_assertClassBrand(GP,this,_resetCurrentPageView).call(this);return!0}addPageToRenderQueue(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(e>=0&&e<=this._pages.length-1){const t=this._pages[e];if(t.renderingState===Yg.INITIAL){pdf_viewer_assertClassBrand(GP,this,pdf_viewer_ensurePdfPageLoaded).call(this,t).then(()=>{this.renderingQueue.renderView(t)});return!0}}return!1}async ensureAdjacentPagesAreLoaded(){const e=[0,1,-1,2,-2,-3];let t=0;this.currentPageNumber%2==1&&(t=-1);let i=!1;for(const a of e){const e=this.currentPageNumber+a+t;if(e>=0&&e<this._pages.length)try{const t=this._pages[e];await pdf_viewer_assertClassBrand(GP,this,pdf_viewer_ensurePdfPageLoaded).call(this,t);if(this._pages.some(e=>e.renderingState===Yg.RUNNING||e.renderingState===Yg.PAUSED)||i){const loader=()=>this.adjacentPagesRenderer(loader,e);this.eventBus._on("pagerendered",loader);this.eventBus._on("thumbnailRendered",loader)}else i=this.adjacentPagesRenderer(null,e)}catch(t){ngx_console_NgxConsole.log("Exception during pre-rendering page %s",e,t)}}}adjacentPagesRenderer(e,t){if(this._pages.find(e=>e.renderingState===Yg.RUNNING))return!0;const i=this._pages.find(e=>e.renderingState===Yg.PAUSED);if(i){this.renderingQueue.renderView(i);return!0}if(e){this.eventBus._off("pagerendered",e);this.eventBus._off("thumbnailRendered",e)}if(t>=0&&t<this._pages.length){const e=this._pages[t];if(e.renderingState===Yg.INITIAL){this.renderingQueue.renderView(e);return!0}}return!1}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(e){if(!this.pdfDocument)return;let t=0|e;if(this._pageLabels){const i=this._pageLabels.indexOf(e);i>=0&&(t=i+1)}this._setCurrentPageNumber(t,!0)||ngx_console_NgxConsole.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return 0!==this._currentScale?this._currentScale:1}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&pdf_viewer_assertClassBrand(GP,this,_setScale).call(this,e,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&pdf_viewer_assertClassBrand(GP,this,_setScale).call(this,e,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!isValidRotation(e))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument)return;(e%=360)<0&&(e+=360);if(this._pagesRotation===e)return;this._pagesRotation=e;const t=this._currentPageNumber;this.refresh(!0,{rotation:e});this._currentScaleValue&&pdf_viewer_assertClassBrand(GP,this,_setScale).call(this,this._currentScaleValue,{noScroll:!0});this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:e,pageNumber:t});this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _layerProperties(){const e=this;return shadow(this,"_layerProperties",{get annotationEditorUIManager(){return pdf_viewer_classPrivateFieldGet($v,e)},get annotationStorage(){return e.pdfDocument?.annotationStorage},get downloadManager(){return e.downloadManager},get enableComment(){return!!pdf_viewer_classPrivateFieldGet(Xv,e)},get enableScripting(){return!!e._scriptingManager},get fieldObjectsPromise(){return e.pdfDocument?.getFieldObjects()},get findController(){return e.findController},get customFindController(){return e.customFindController},get hasJSActionsPromise(){return e.pdfDocument?.hasJSActions()},get linkService(){return e.linkService}})}async getAllText(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const t=[],i=[];for(let a=1,s=this.pdfDocument.numPages;a<=s;++a){if(e?.aborted)return null;i.length=0;const s=await this.pdfDocument.getPage(a),{items:n}=await s.getTextContent();for(const e of n){e.str&&i.push(e.str);e.hasEOL&&i.push("\n")}t.push(removeNullCharacters(i.join("")))}return t.join("\n")}setDocument(e){if(this.pdfDocument){this.eventBus.dispatch("pagesdestroy",{source:this});this._cancelRendering();this._resetView();this.findController?.setDocument(null);this.customFindController?.setDocument(null);this._scriptingManager?.setDocument(null);pdf_viewer_classPrivateFieldGet($v,this)?.destroy();pdf_viewer_classPrivateFieldSet($v,this,null);pdf_viewer_classPrivateFieldSet(Hv,this,f.NONE);pdf_viewer_classPrivateFieldSet(rP,this,!0)}this.pdfDocument=e;if(!e)return;const t=e.numPages,i=e.getPage(1),a=e.getOptionalContentConfig({intent:"display"}),s=pdf_viewer_classPrivateFieldGet(Jv,this)?e.getPermissions():Promise.resolve(),{eventBus:n,pageColors:r,viewer:o}=this;pdf_viewer_classPrivateFieldSet(aP,this,new AbortController);const{signal:l}=pdf_viewer_classPrivateFieldGet(aP,this);if(t>Lv){ngx_console_NgxConsole.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const e=this._scrollMode=Yc.PAGE;n.dispatch("scrollmodechanged",{source:this,mode:e})}this._pagesCapability.promise.then(()=>{n.dispatch("pagesloaded",{source:this,pagesCount:t})},()=>{});n._on("pagerender",e=>{const t=this._pages[e.pageNumber-1];t&&pdf_viewer_classPrivateFieldGet(Vv,this).push(t)},{signal:l});const onAfterDraw=e=>{if(!e.cssTransform&&!e.isDetailView){this._onePageRenderedCapability.resolve({timestamp:e.timestamp});n._off("pagerendered",onAfterDraw)}};n._on("pagerendered",onAfterDraw,{signal:l});Promise.all([i,s]).then(i=>{let[s,d]=i;if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(s);this._optionalContentConfigPromise=a;const{annotationEditorMode:c,annotationMode:h,textLayerMode:u}=pdf_viewer_assertClassBrand(GP,this,_initializePermissions).call(this,d);if(u!==qc){const e=pdf_viewer_classPrivateFieldSet(hP,this,document.createElement("div"));e.id="hiddenCopyElement";o.before(e)}if(c!==f.DISABLE){const t=c;if(e.isPureXfa)ngx_console_NgxConsole.warn("Warning: XFA-editing is not implemented.");else if(isValidAnnotationEditorMode(t)){pdf_viewer_classPrivateFieldSet($v,this,new AnnotationEditorUIManager(this.container,o,pdf_viewer_classPrivateFieldGet(xP,this),pdf_viewer_classPrivateFieldGet(Uv,this),pdf_viewer_classPrivateFieldGet(Xv,this),pdf_viewer_classPrivateFieldGet(vP,this),n,e,r,pdf_viewer_classPrivateFieldGet(zv,this),pdf_viewer_classPrivateFieldGet(Zv,this),pdf_viewer_classPrivateFieldGet(Qv,this),pdf_viewer_classPrivateFieldGet(eP,this),pdf_viewer_classPrivateFieldGet(nP,this),pdf_viewer_classPrivateFieldGet(Yv,this),pdf_viewer_classPrivateFieldGet(PP,this)));n.dispatch("annotationeditoruimanager",{source:this,uiManager:pdf_viewer_classPrivateFieldGet($v,this)});if(t!==f.NONE){pdf_viewer_assertClassBrand(GP,this,_preloadEditingData).call(this,t);pdf_viewer_classPrivateFieldGet($v,this).updateMode(t)}}else ngx_console_NgxConsole.error(`Invalid AnnotationEditor mode: ${t}`)}const _=this._scrollMode===Yc.PAGE?null:o,p=this.currentScale,g=s.getViewport({scale:p*PixelsPerInch.PDF_TO_CSS_UNITS});o.style.setProperty("--scale-factor",g.scale);r?.background&&o.style.setProperty("--page-bg-color",r.background);if("CanvasText"===r?.foreground||"Canvas"===r?.background){o.style.setProperty("--hcm-highlight-filter",e.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight"));o.style.setProperty("--hcm-highlight-selected-filter",e.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","ButtonText"))}for(let e=1;e<=t;++e){const t=new PDFPageView({container:_,eventBus:n,id:e,scale:p,defaultViewport:g.clone(),optionalContentConfigPromise:a,renderingQueue:this.renderingQueue,textLayerMode:u,annotationMode:h,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableDetailCanvas:this.enableDetailCanvas,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,imagesRightClickMinSize:this.imagesRightClickMinSize,pageColors:r,l10n:this.l10n,layerProperties:this._layerProperties,enableAutoLinking:pdf_viewer_classPrivateFieldGet(tP,this),minDurationToUpdateCanvas:pdf_viewer_classPrivateFieldGet(sP,this),commentManager:pdf_viewer_classPrivateFieldGet(Xv,this),abortSignal:pdf_viewer_classPrivateFieldGet(iP,this)});this._pages.push(t)}this._pages[0]?.setPdfPage(s);this._scrollMode===Yc.PAGE?pdf_viewer_assertClassBrand(GP,this,_ensurePageViewVisible).call(this):this._spreadMode!==Zc.NONE&&this._updateSpreadMode();n._on("annotationeditorlayerrendered",e=>{pdf_viewer_classPrivateFieldGet($v,this)&&n.dispatch("annotationeditormodechanged",{source:this,mode:pdf_viewer_classPrivateFieldGet(Hv,this)})},{once:!0,signal:l});pdf_viewer_assertClassBrand(GP,this,_onePageRenderedOrForceFetch).call(this,l).then(async()=>{if(e!==this.pdfDocument)return;this.findController?.setDocument(e);this.customFindController?.setDocument(e);this._scriptingManager?.setDocument(e);pdf_viewer_classPrivateFieldGet(hP,this)&&document.addEventListener("copy",pdf_viewer_assertClassBrand(GP,this,_copyCallback).bind(this,u),{signal:l});if(e.loadingParams.disableAutoFetch||t>Rv){this._pagesCapability.resolve();return}let i=t-1;if(i<=0)this._pagesCapability.resolve();else{"book"===pdf_viewer_classPrivateFieldGet(yP,this)&&await this.ensureAdjacentPagesAreLoaded();for(let a=2;a<=t;++a){const t=e.getPage(a).then(e=>{const t=this._pages[a-1];t.pdfPage||t.setPdfPage(e);0===--i&&this._pagesCapability.resolve()},e=>{ngx_console_NgxConsole.error(`Unable to get page ${a} to initialize viewer`,e);0===--i&&this._pagesCapability.resolve()});a%Nv===0&&await t}}});this.hidePagesDependingOnpageViewMode();n.dispatch("pagesinit",{source:this});e.getMetadata().then(t=>{let{info:i}=t;e===this.pdfDocument&&i.Language&&(o.lang=i.Language)});this.defaultRenderingQueue&&this.update()}).catch(e=>{ngx_console_NgxConsole.error("Unable to initialize viewer",e);this._pagesCapability.reject(e)})}onPagesEdited(e){let{pagesMapper:t,type:i,hasBeenCut:a,pageNumbers:s}=e;if("copy"===i){pdf_viewer_classPrivateFieldSet(kP,this,new Map);for(const e of s)pdf_viewer_classPrivateFieldGet(kP,this).set(e,this._pages[e-1]);return}if("cancelCopy"===i){pdf_viewer_classPrivateFieldSet(kP,this,null);return}if("cut"===i||"delete"===i){pdf_viewer_classPrivateFieldSet(EP,this,this._pages);pdf_viewer_classPrivateFieldSet(AP,this,s)}if("cancelDelete"===i){pdf_viewer_classPrivateFieldSet(AP,this,null);if(!pdf_viewer_classPrivateFieldGet(EP,this))return;const e=this._scrollMode===Yc.PAGE?null:this.viewer;if(e){pdf_viewer_classPrivateFieldGet($v,this)?.startUpdatePages();const t=document.createDocumentFragment();for(let e=0,i=pdf_viewer_classPrivateFieldGet(EP,this).length;e<i;e++){const i=pdf_viewer_classPrivateFieldGet(EP,this)[e];i.updatePageNumber(e+1);t.append(i.div)}e.replaceChildren(t);pdf_viewer_classPrivateFieldGet($v,this)?.endUpdatePages()}this._pages=pdf_viewer_classPrivateFieldGet(EP,this);pdf_viewer_classPrivateFieldSet(EP,this,null);return}if("cleanSavedData"===i){if(pdf_viewer_classPrivateFieldGet(AP,this)){if(pdf_viewer_classPrivateFieldGet(EP,this)){for(const e of pdf_viewer_classPrivateFieldGet(AP,this))pdf_viewer_classPrivateFieldGet(EP,this)[e-1].deleteMe();pdf_viewer_classPrivateFieldSet(EP,this,null)}pdf_viewer_classPrivateFieldSet(AP,this,null)}return}this._currentPageNumber=0;const n=this._pages,r=this._pages=[];pdf_viewer_classPrivateFieldGet($v,this)?.startUpdatePages();for(let e=1,i=t.pagesNumber;e<=i;e++){const i=t.getPrevPageNumber(e);if(i<0){let t=pdf_viewer_classPrivateFieldGet(kP,this).get(-i);if(a)t.updatePageNumber(e);else{pdf_viewer_classPrivateFieldGet($v,this)?.clonePage(-i-1,e-1);t=t.clone(e)}r.push(t);continue}const s=n[i-1];r.push(s);s.updatePageNumber(e)}pdf_viewer_classPrivateFieldGet($v,this)?.endUpdatePages();"paste"===i&&pdf_viewer_classPrivateFieldSet(kP,this,null);const o=this._scrollMode===Yc.PAGE?null:this.viewer;if(o){const e=document.createDocumentFragment();for(const{div:t}of r)e.append(t);o.replaceChildren(e)}setTimeout(()=>{this.forceRendering()})}setPageLabels(e){if(this.pdfDocument){if(e)if(Array.isArray(e)&&this.pdfDocument.numPages===e.length)this._pageLabels=e;else{this._pageLabels=null;ngx_console_NgxConsole.error("setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(let e=0,t=this._pages.length;e<t;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[];this._currentPageNumber=1;this._currentScale=0;this._currentScaleValue=null;this._pageLabels=null;const e=this.defaultCacheSize||10;pdf_viewer_classPrivateFieldSet(Vv,this,new PDFPageViewBuffer(e));this._location=null;this._pagesRotation=0;this._optionalContentConfigPromise=null;this._firstPageCapability=Promise.withResolvers();this._onePageRenderedCapability=Promise.withResolvers();this._pagesCapability=Promise.withResolvers();this._scrollMode=Yc.VERTICAL;this._previousScrollMode=Yc.UNKNOWN;this._spreadMode=Zc.NONE;pdf_viewer_classPrivateFieldSet(pP,this,{previousPageNumber:1,scrollDown:!0,pages:[]});pdf_viewer_classPrivateFieldGet(aP,this)?.abort();pdf_viewer_classPrivateFieldSet(aP,this,null);this.viewer.textContent="";this._updateScrollMode();this.viewer.removeAttribute("lang");pdf_viewer_classPrivateFieldGet(hP,this)?.remove();pdf_viewer_classPrivateFieldSet(hP,this,null);pdf_viewer_assertClassBrand(GP,this,_cleanupTimeouts).call(this);pdf_viewer_assertClassBrand(GP,this,_cleanupSwitchAnnotationEditorMode).call(this)}_scrollUpdate(){if(0!==this.pagesCount){pdf_viewer_classPrivateFieldGet(oP,this)&&clearTimeout(pdf_viewer_classPrivateFieldGet(oP,this));pdf_viewer_classPrivateFieldSet(oP,this,setTimeout(()=>{pdf_viewer_classPrivateFieldSet(oP,this,null);this.update()},100));"infinite-scroll"===this.pageViewMode?this.update(!0):this.update()}}scrollPagePosIntoView(e,t){const i=this._pages[e-1].div;if(t){const a={...t};if("string"==typeof a.top&&a.top.endsWith("%")){const e=Number(a.top.replace("%","")),t=this.viewer.querySelector(".page")?.clientHeight;let s=i.clientHeight??t;const n=this.viewer.parentElement.clientHeight;s=Math.max(0,s-n);a.top=e*s/100}if("string"==typeof a.left&&a.left.endsWith("%")){const e=Number(a.left.replace("%","")),t=this.viewer.querySelector(".page")?.clientWidth,s=i.clientWidth??t;a.left=e*s/100}pdf_viewer_assertClassBrand(GP,this,_scrollIntoView).call(this,{div:i,id:e},a)}else pdf_viewer_assertClassBrand(GP,this,_scrollIntoView).call(this,{div:i,id:e})}pageLabelToPageNumber(e){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView(e){let{pageNumber:t,destArray:i=null,allowNegativeOffset:a=!1,ignoreDestinationZoom:s=!1,center:n=null}=e;if(!this.pdfDocument)return;const r=Number.isInteger(t)&&this._pages[t-1];if(!r){ngx_console_NgxConsole.error(`scrollPageIntoView: "${t}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!i){this._setCurrentPageNumber(t,!0);return}let o,l,d=0,c=0,h=0,u=0;const _=r.rotation%180!=0,p=(_?r.height:r.width)/r.scale/PixelsPerInch.PDF_TO_CSS_UNITS,g=(_?r.width:r.height)/r.scale/PixelsPerInch.PDF_TO_CSS_UNITS;let f=0;switch(i[1].name){case"XYZ":d=i[2];c=i[3];f=i[4];d=null!==d?d:0;c=null!==c?c:g;break;case"Fit":case"FitB":f="page-fit";break;case"FitH":case"FitBH":c=i[2];f="page-width";if(null===c&&this._location){d=this._location.left;c=this._location.top}else("number"!=typeof c||c<0)&&(c=g);break;case"FitV":case"FitBV":d=i[2];h=p;u=g;f="page-height";break;case"FitR":d=i[2];c=i[3];h=i[4]-d;u=i[5]-c;let e=40,t=5;this.removePageBorders&&(e=t=0);o=(this.container.clientWidth-e)/h/PixelsPerInch.PDF_TO_CSS_UNITS;l=(this.container.clientHeight-t)/u/PixelsPerInch.PDF_TO_CSS_UNITS;f=Math.min(Math.abs(o),Math.abs(l));break;default:ngx_console_NgxConsole.error(`scrollPageIntoView: "${i[1].name}" is not a valid destination type.`);return}s||(f&&f!==this._currentScale?this.currentScaleValue=f:0===this._currentScale&&(this.currentScaleValue=Dc));pdf_viewer_assertClassBrand(GP,this,pdf_viewer_ensurePdfPageLoaded).call(this,r).then(()=>{this.renderingQueue.renderView(r);"single"===this.pageViewMode&&this.currentPageNumber!==t&&(this.currentPageNumber=t)});if("page-fit"===f&&!i[4]){pdf_viewer_assertClassBrand(GP,this,_scrollIntoView).call(this,r);return}const m=[r.viewport.convertToViewportPoint(d,c),r.viewport.convertToViewportPoint(d+h,c+u)];let v=Math.min(m[0][0],m[1][0]),P=Math.min(m[0][1],m[1][1]);if(n){"both"!==n&&"vertical"!==n||(P-=(this.container.clientHeight-Math.abs(m[1][1]-m[0][1]))/2);"both"!==n&&"horizontal"!==n||(v-=(this.container.clientWidth-Math.abs(m[1][0]-m[0][0]))/2)}else if(!a){v=Math.max(v,0);P=Math.max(P,0)}pdf_viewer_assertClassBrand(GP,this,_scrollIntoView).call(this,r,{left:v,top:P})}_updateLocation(e){const t=this._currentScale,i=this._currentScaleValue,a=parseFloat(i)===t?Math.round(1e4*t)/100:i,s=e.id,n=this._pages[s-1],r=this.container;let o,l;if("infinite-scroll"===this.pageViewMode){const e=r.getBoundingClientRect();pdf_viewer_classPrivateFieldGet(FP,this)||pdf_viewer_classPrivateFieldSet(FP,this,pdf_viewer_assertClassBrand(GP,this,_findAncestorWithScrollbar).call(this,this.container));const t=pdf_viewer_classPrivateFieldGet(FP,this);if(t){const i=t.getBoundingClientRect();o=i.left-e.left;l=i.top-e.top}else{o=-e.left;l=-e.top}}else{o=r.scrollLeft;l=r.scrollTop}const d=n.getPagePoint(o-e.x,l-e.y),c=Math.round(d[0]),h=Math.round(d[1]);let u=`#page=${s}`;this.isInPresentationMode||(u+=`&zoom=${a},${c},${h}`);this._location={pageNumber:s,scale:a,top:h,left:c,rotation:this._pagesRotation,pdfOpenParams:u}}update(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.scrollMode===Yc.PAGE?this.viewer.classList.add("singlePageView"):this.viewer.classList.remove("singlePageView");const t=this._getVisiblePages(),i=t.views,a=i.length;if(0===a)return;const s=this.defaultCacheSize||10,n=Math.max(s,2*a+1);pdf_viewer_classPrivateFieldGet(Vv,this).resize(n,t.ids);for(const{view:e,visibleArea:t}of i)e.updateVisibleArea(t);for(const e of pdf_viewer_classPrivateFieldGet(Vv,this))t.ids.has(e.id)||e.updateVisibleArea(null);this.renderingQueue.renderHighestPriority(t);const r=this._spreadMode===Zc.NONE&&(this._scrollMode===Yc.PAGE||this._scrollMode===Yc.VERTICAL),o=this._currentPageNumber;let l=!1;for(const e of i){if(e.percent<100)break;if(e.id===o&&r){l=!0;break}}const d="infinite-scroll"===this.pageViewMode&&Date.now()-pdf_viewer_classPrivateFieldGet(bP,this)<500;this.scrollMode===Yc.PAGE||e||d||this._setCurrentPageNumber(l?this._currentPageNumber:i[0].id);this._updateLocation(t.first);this.eventBus.dispatch("updateviewarea",{source:this,location:this._location});this.hidePagesDependingOnpageViewMode()}async updateBookModeScale(e){if("book"===this.pageViewMode&&this.pageFlip&&e.scale&&e.scale!==e.previousScale){const t=this._pages[0];if(t.pdfPage){const e=t.width,i=t.height,a=t.div.parentElement,s=this.removePageBorders?1:40;a.style.width=`${2*e+s}px`;a.style.height=`${i}px`;this.pageFlip.render.setting.width=e;this.pageFlip.render.setting.height=i;this.pageFlip.render.update()}if(this._enableFlipByDrag){let i=40,a=5;this.removePageBorders&&(i=a=0);const s=(this.container.clientWidth-i)/t.width*t.scale/2,n=(this.container.clientHeight-a)/t.height*t.scale,r=Math.min(s,n),o=e.scale>r+.01;this.pageFlip.setting.enableFlipByDrag=!o}}}set enableFlipByDrag(e){this._enableFlipByDrag=e;this.pageFlip&&(this.pageFlip.setting.enableFlipByDrag=e)}get enableFlipByDrag(){return this._enableFlipByDrag}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return this.presentationModeState===Wc}get isChangingPresentationMode(){return this.presentationModeState===Oc}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const e=this._scrollMode===Yc.PAGE?pdf_viewer_classPrivateFieldGet(pP,this).pages:this._pages,t=this._scrollMode===Yc.HORIZONTAL,i=t&&this._isContainerRtl;return this._isContainerRtl&&(t||this._scrollMode===Yc.WRAPPED)?this._getVisiblePagesRtl(e):"infinite-scroll"===this.pageViewMode?pdf_viewer_assertClassBrand(GP,this,_getVisiblePagesInfiniteScroll).call(this,e):getVisibleElements({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:i})}_getVisiblePagesRtl(e){const t=this.container.getBoundingClientRect(),i=[],a=new Set;for(const s of e){const e=s.div.getBoundingClientRect(),n=Math.max(e.left,t.left),r=Math.min(e.right,t.right),o=Math.max(e.top,t.top),l=Math.min(e.bottom,t.bottom),d=Math.max(0,r-n),c=Math.max(0,l-o);if(0===d||0===c)continue;const h=d/e.width,u=h*(c/e.height)*100|0;i.push({id:s.id,x:e.left-t.left,y:e.top-t.top,view:s,percent:u,widthPercent:100*h|0});a.add(s.id)}i.sort((e,t)=>t.x-e.x);return{first:i[0],last:i.at(-1),views:i,ids:a}}cleanup(){for(const e of this._pages)e.renderingState!==Yg.FINISHED&&e.reset()}_cancelRendering(){for(const e of this._pages)e.cancelRendering()}forceRendering(e){const t=e||this._getVisiblePages(),i=pdf_viewer_assertClassBrand(GP,this,pdf_viewer_getScrollAhead).call(this,t),a=this._spreadMode!==Zc.NONE&&this._scrollMode!==Yc.HORIZONTAL,s=null!==pdf_viewer_classPrivateFieldGet(gP,this)||null!==pdf_viewer_classPrivateFieldGet(oP,this)&&t.views.some(e=>e.detailView?.renderingCancelled),n=this.renderingQueue.getHighestPriority(t,this._pages,i,a,s);if(n){pdf_viewer_assertClassBrand(GP,this,pdf_viewer_ensurePdfPageLoaded).call(this,n).then(()=>{this.renderingQueue.renderView(n)});return!0}return!1}get hasEqualPageSizes(){const e=this._pages[0];for(let t=1,i=this._pages.length;t<i;++t){const i=this._pages[t];if(i.width!==e.width||i.height!==e.height)return!1}return!0}getPagesOverview(){let e;return this._pages.map(t=>{const i=t.pdfPage.getViewport({scale:1}),a=isPortraitOrientation(i);if(void 0===e)e=a;else if(this.enablePrintAutoRotate&&a!==e)return{width:i.height,height:i.width,rotation:(i.rotation-90)%360};return{width:i.width,height:i.height,rotation:i.rotation}})}get optionalContentConfigPromise(){if(!this.pdfDocument)return Promise.resolve(null);if(!this._optionalContentConfigPromise){ngx_console_NgxConsole.error("optionalContentConfigPromise: Not initialized yet.");return this.pdfDocument.getOptionalContentConfig({intent:"display"})}return this._optionalContentConfigPromise}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${e}`);if(this.pdfDocument&&this._optionalContentConfigPromise){this._optionalContentConfigPromise=e;this.refresh(!1,{optionalContentConfigPromise:e});this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:e})}}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!isValidScrollMode(e))throw new Error(`Invalid scroll mode: ${e}`);if(!(this.pagesCount>Lv)){this._previousScrollMode=this._scrollMode;this._scrollMode=e;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e});if(e===Yc.PAGE&&"infinite-scroll"===pdf_viewer_classPrivateFieldGet(yP,this)){pdf_viewer_classPrivateFieldSet(yP,this,"single");this.hidePagesDependingOnpageViewMode();queueMicrotask(()=>{this.eventBus.dispatch("pageviewmodechanged",{source:this,mode:pdf_viewer_classPrivateFieldGet(yP,this)})})}this._updateScrollMode(this._currentPageNumber)}}}_updateScrollMode(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const t=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",t===Yc.HORIZONTAL);i.classList.toggle("scrollWrapped",t===Yc.WRAPPED);if(this.pdfDocument&&e){t===Yc.PAGE?pdf_viewer_assertClassBrand(GP,this,_ensurePageViewVisible).call(this):this._previousScrollMode===Yc.PAGE&&this._updateSpreadMode();this._currentScaleValue&&isNaN(this._currentScaleValue)&&pdf_viewer_assertClassBrand(GP,this,_setScale).call(this,this._currentScaleValue,{noScroll:!0});this._setCurrentPageNumber(e,!0);this.update()}}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!isValidSpreadMode(e))throw new Error(`Invalid spread mode: ${e}`);this._spreadMode=e;this.eventBus.dispatch("spreadmodechanged",{source:this,mode:e});this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!this.pdfDocument)return;const t=this.viewer,i=this._pages;if(this._scrollMode===Yc.PAGE)pdf_viewer_assertClassBrand(GP,this,_ensurePageViewVisible).call(this);else{t.textContent="";if(this._spreadMode===Zc.NONE)for(const e of this._pages)t.append(e.div);else{const e=this._spreadMode-1;let a=null;for(let s=0,n=i.length;s<n;++s){if(null===a){a=document.createElement("div");a.className="spread";t.append(a)}else if(s%2===e){a=a.cloneNode(!1);t.append(a)}a.append(i[s].div)}}}this.hidePagesDependingOnpageViewMode();if(e){this._currentScaleValue&&isNaN(this._currentScaleValue)&&pdf_viewer_assertClassBrand(GP,this,_setScale).call(this,this._currentScaleValue,{noScroll:!0});this._setCurrentPageNumber(e,!0);this.update()}}nextPage(){const e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;const i=pdf_viewer_assertClassBrand(GP,this,_getPageAdvance).call(this,e,!1)||1;this.currentPageNumber=Math.min(e+i,t);return!0}previousPage(){const e=this._currentPageNumber;if(e<=1)return!1;const t=pdf_viewer_assertClassBrand(GP,this,_getPageAdvance).call(this,e,!0)||1;this.currentPageNumber=Math.max(e-t,1);return!0}updateScale(e){let{drawingDelay:t,scaleFactor:i=null,steps:a=null,origin:s}=e;if(null===a&&null===i)throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let n=this._currentScale;if(i>0&&1!==i)n=Math.round(n*i*1e3)/1e3;else if(a){const e=a>0?1.1:1/1.1,t=a>0?Math.ceil:Math.floor;a=Math.abs(a);do{n=t(10*(n*e).toFixed(2))/10}while(--a>0)}n=MathClamp(n,Number(this.minZoom)??Lc,Number(this.maxZoom)??25);pdf_viewer_assertClassBrand(GP,this,_setScale).call(this,n,{noScroll:!1,drawingDelay:t,origin:s})}increaseScale(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.updateScale({...e,steps:e.steps??1})}decreaseScale(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.updateScale({...e,steps:-(e.steps??1)})}get containerTopLeft(){return pdf_viewer_classPrivateFieldGet(Kv,this)||pdf_viewer_classPrivateFieldSet(Kv,this,[this.container.offsetTop,this.container.offsetLeft])}get annotationEditorMode(){return pdf_viewer_classPrivateFieldGet($v,this)?pdf_viewer_classPrivateFieldGet(Hv,this):f.DISABLE}set annotationEditorMode(e){let{mode:t,editId:i=null,isFromKeyboard:a=!1,mustEnterInEditMode:s=!1,editComment:n=!1}=e;if(!pdf_viewer_classPrivateFieldGet($v,this))throw new Error("The AnnotationEditor is not enabled.");if(pdf_viewer_classPrivateFieldGet(Hv,this)===t)return;if(!isValidAnnotationEditorMode(t))throw new Error(`Invalid AnnotationEditor mode: ${t}`);if(!this.pdfDocument)return;pdf_viewer_assertClassBrand(GP,this,_preloadEditingData).call(this,t);const{eventBus:r,pdfDocument:o}=this,updater=async()=>{pdf_viewer_assertClassBrand(GP,this,_cleanupSwitchAnnotationEditorMode).call(this);pdf_viewer_classPrivateFieldSet(Hv,this,t);await pdf_viewer_classPrivateFieldGet($v,this).updateMode(t,i,!0,a,s,n);t===pdf_viewer_classPrivateFieldGet(Hv,this)&&o===this.pdfDocument&&r.dispatch("annotationeditormodechanged",{source:this,mode:t})};if(t===f.NONE||pdf_viewer_classPrivateFieldGet(Hv,this)===f.NONE){const e=t!==f.NONE;e||this.pdfDocument.annotationStorage.resetModifiedIds();this.cleanup();for(const t of this._pages)t.toggleEditingMode(e);const i=pdf_viewer_assertClassBrand(GP,this,_switchToEditAnnotationMode).call(this);if(e&&i){pdf_viewer_assertClassBrand(GP,this,_cleanupSwitchAnnotationEditorMode).call(this);pdf_viewer_classPrivateFieldSet(lP,this,new AbortController);const e=AbortSignal.any([pdf_viewer_classPrivateFieldGet(aP,this).signal,pdf_viewer_classPrivateFieldGet(lP,this).signal]);r._on("pagerendered",e=>{let{pageNumber:t}=e;i.delete(t);0===i.size&&pdf_viewer_classPrivateFieldSet(dP,this,setTimeout(updater,0))},{signal:e});return}}updater()}refresh(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.create(null);if(this.pdfDocument){for(const e of this._pages)e.update(t);pdf_viewer_assertClassBrand(GP,this,_cleanupTimeouts).call(this);e||this.update()}}getSerializedAnnotations(){const e=this.pdfDocument.annotationStorage;if(0===e.size)return null;const t=[];for(const[i,a]of e)if(a&&"function"==typeof a.serialize){const e=a.serialize(!0,null,!0);e&&void 0!==e.annotationType&&t.push(e)}return t.length>0?t:null}async addEditorAnnotation(e){try{"string"==typeof e&&(e=JSON.parse(e))}catch(e){ngx_console_NgxConsole.error(`Please pass a JSON string or an Array of JSON objects to addEditorAnnotation: "${e.message}".`);return}Array.isArray(e)||(e=[e]);const convertArrayLikeObjectToArray=e=>{if(!e||"object"!=typeof e||Array.isArray(e))return e;const t=Object.keys(e);if(t.length>0&&t.every(e=>/^\d+$/.test(e))){const i=[];for(let a=0;a<t.length;a++)i[a]=e[a];return i}return e};let t=!1;e?.forEach(e=>{e.isCopy=!0;if(15===e.annotationType&&e.paths){if(e.paths.lines){const i=e.paths.lines.map(convertArrayLikeObjectToArray);if(i.some((t,i)=>t!==e.paths.lines[i])){t=!0;e.paths.lines=i}}if(e.paths.points){const i=e.paths.points.map(convertArrayLikeObjectToArray);if(i.some((t,i)=>t!==e.paths.points[i])){t=!0;e.paths.points=i}}}});t&&ngx_console_NgxConsole.warn("Detected and converted legacy ink annotation format (object-with-numeric-keys) to arrays. This format was used in ngx-extended-pdf-viewer versions 22.x - 25.5.x. Please re-export or convert your annotations to use the correct format. The objects with numeric keys were always meant to be arrays.");await pdf_viewer_classPrivateFieldGet($v,this).addSerializedEditor(e,!0,!0,!1)}removeEditorAnnotations(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>!0;pdf_viewer_classPrivateFieldGet($v,this).removeEditors(e)}destroyBookMode(){if(this.pageFlip){this.pageFlip.destroy();this.pageFlip=null}}stopRendering(){this._cancelRendering()}}function _findAncestorWithScrollbar(e){let t=e?.parentElement;for(;t;){if(t===document.body||t===document.documentElement)return null;const e=getComputedStyle(t).overflowY;if(("auto"===e||"scroll"===e)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}function _initOuterScrollListener(){if(!pdf_viewer_classPrivateFieldGet(BP,this)){pdf_viewer_classPrivateFieldSet(BP,this,!0);document.addEventListener("scroll",e=>{const t=e.target;(t===document||t===document.documentElement||t===document.body||t?.contains?.(this.container))&&this._scrollUpdate()},{capture:!0});window.addEventListener("scroll",()=>this._scrollUpdate())}}function _initializePermissions(e){const t={annotationEditorMode:pdf_viewer_classPrivateFieldGet(Hv,this),annotationMode:pdf_viewer_classPrivateFieldGet(qv,this),textLayerMode:pdf_viewer_classPrivateFieldGet(wP,this)};if(!e){pdf_viewer_classPrivateFieldSet(rP,this,!0);this.eventBus.dispatch("printingallowed",{source:this,isAllowed:pdf_viewer_classPrivateFieldGet(rP,this)});return t}pdf_viewer_classPrivateFieldSet(rP,this,e.includes(v.PRINT_HIGH_QUALITY)||e.includes(v.PRINT));this.eventBus.dispatch("printingallowed",{source:this,isAllowed:pdf_viewer_classPrivateFieldGet(rP,this)});e.includes(v.COPY)||pdf_viewer_classPrivateFieldGet(wP,this)!==Xc||(t.textLayerMode=Kc);e.includes(v.MODIFY_CONTENTS)||(t.annotationEditorMode=f.DISABLE);e.includes(v.MODIFY_ANNOTATIONS)||e.includes(v.FILL_INTERACTIVE_FORMS)||pdf_viewer_classPrivateFieldGet(qv,this)!==p.ENABLE_FORMS||(t.annotationMode=p.ENABLE);return t}async function _onePageRenderedOrForceFetch(e){if("hidden"===document.visibilityState||!this.container.offsetParent||0===this._getVisiblePages().views.length)return;const t=Promise.withResolvers(),i=new AbortController;document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&t.resolve()},{signal:AbortSignal.any([e,i.signal])});await Promise.race([this._onePageRenderedCapability.promise,t.promise]);i.abort()}function _copyCallback(e,t){const i=document.getSelection(),{focusNode:a,anchorNode:s}=i;if(s&&a&&i.containsNode(pdf_viewer_classPrivateFieldGet(hP,this))){if(pdf_viewer_classPrivateFieldGet(cP,this)||e===Kc){stopEvent(t);return}pdf_viewer_classPrivateFieldSet(cP,this,!0);const{classList:i}=this.viewer;i.add("copyAll");const a=new AbortController,s=new AbortController;window.addEventListener("keydown",e=>{"Escape"===e.key&&s.abort()},{signal:a.signal});this.getAllText(s.signal).then(async e=>{null!==e&&await navigator.clipboard.writeText(e)}).catch(e=>{ngx_console_NgxConsole.warn(`Something goes wrong when extracting the text: ${e.message}`)}).finally(()=>{pdf_viewer_classPrivateFieldSet(cP,this,!1);a.abort();i.remove("copyAll")});stopEvent(t)}}function _ensurePageViewVisible(){if(this._scrollMode!==Yc.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const e=this._currentPageNumber,t=pdf_viewer_classPrivateFieldGet(pP,this),i=this.viewer;i.textContent="";t.pages.length=0;if(this._spreadMode!==Zc.NONE||this.isInPresentationMode){const a=new Set,s=this._spreadMode-1;if(-1===s)a.add(e-1);else if(e%2!==s){a.add(e-1);a.add(e)}else{a.add(e-2);a.add(e-1)}const n=document.createElement("div");n.className="spread";if(this.isInPresentationMode){const e=document.createElement("div");e.className="dummyPage";n.append(e)}for(const e of a){const i=this._pages[e];if(i){n.append(i.div);t.pages.push(i)}}i.append(n)}else{const a=this._pages[e-1];i.append(a.div);t.pages.push(a)}t.scrollDown=e>=t.previousPageNumber;t.previousPageNumber=e}function _scrollIntoView(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e)return;"infinite-scroll"===this.pageViewMode&&pdf_viewer_classPrivateFieldSet(bP,this,Date.now());const{div:i,id:a}=e;this._currentPageNumber!==a&&this._setCurrentPageNumber(a);if(this._scrollMode===Yc.PAGE){pdf_viewer_assertClassBrand(GP,this,_ensurePageViewVisible).call(this);this.update()}if(!t&&!this.isInPresentationMode){const e=i.offsetLeft+i.clientLeft,a=e+i.clientWidth,{scrollLeft:s,clientWidth:n}=this.container;(this._scrollMode===Yc.HORIZONTAL||e<s||a>s+n)&&(t={left:0,top:0})}!this._isContainerRtl||this._scrollMode!==Yc.HORIZONTAL&&this._scrollMode!==Yc.WRAPPED?scrollIntoView(i,t,!1,"infinite-scroll"===this.pageViewMode):i.scrollIntoView({block:"nearest",inline:"end"});!this._currentScaleValue&&this._location&&(this._location=null)}function _isSameScale(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15}function _setScaleUpdatePages(e,t,i){let{noScroll:a=!1,preset:s=!1,drawingDelay:n=-1,origin:r=null}=i;const o=isNaN(Number(this.currentScale))?void 0:Number(this.currentScale),l=this.currentScaleValue;this._currentScaleValue=t.toString();if(pdf_viewer_assertClassBrand(GP,this,_isSameScale).call(this,e)){s&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t,previousScale:o,previousPresetValue:l,noScroll:a});return}const d=n>=0&&n<1e3;this.viewer.style.setProperty("--scale-factor",e*PixelsPerInch.PDF_TO_CSS_UNITS);this.refresh(!0,{scale:e,drawingDelay:d?n:-1});if(d){if(!pdf_viewer_classPrivateFieldGet(fP,this)&&this._location){pdf_viewer_classPrivateFieldSet(fP,this,{...this._location});pdf_viewer_classPrivateFieldSet(mP,this,o)}null!==pdf_viewer_classPrivateFieldGet(gP,this)&&clearTimeout(pdf_viewer_classPrivateFieldGet(gP,this));pdf_viewer_classPrivateFieldSet(gP,this,setTimeout(()=>{pdf_viewer_classPrivateFieldSet(gP,this,null);pdf_viewer_classPrivateFieldSet(fP,this,null);pdf_viewer_classPrivateFieldSet(mP,this,null);const e=Math.round(100*this._currentScale)/100;e===this._currentScale?this.refresh():pdf_viewer_assertClassBrand(GP,this,_setScale).call(this,e,{noScroll:!0,drawingDelay:-1})},n))}this._currentScale=e;if(!a)if("infinite-scroll"===this.pageViewMode){pdf_viewer_classPrivateFieldGet(FP,this)||pdf_viewer_classPrivateFieldSet(FP,this,pdf_viewer_assertClassBrand(GP,this,_findAncestorWithScrollbar).call(this,this.container));const t=pdf_viewer_classPrivateFieldGet(FP,this),i=e/o;if(t){const e=this.container.getBoundingClientRect();if(Array.isArray(r)){t.scrollTop+=(i-1)*(r[1]-e.top);t.scrollLeft+=(i-1)*(r[0]-e.left)}else{const a=t.getBoundingClientRect();t.scrollTop+=(i-1)*(a.top-e.top);t.scrollLeft+=(i-1)*(a.left-e.left)}}else{const e=this.container.getBoundingClientRect();if(Array.isArray(r)){const t=i-1;window.scrollBy(t*(r[0]-e.left),t*(r[1]-e.top))}else{const t=i-1;window.scrollBy(t*(0-e.left),t*(0-e.top))}}}else{const t=this.container,i=pdf_viewer_classPrivateFieldGet(fP,this)||this._location;let a,s=this._currentPageNumber;if(i&&!this.isInPresentationMode&&!this.isChangingPresentationMode){s=i.pageNumber;a=[null,{name:"XYZ"},i.left,i.top,null]}this.scrollPageIntoView({pageNumber:s,destArray:a,allowNegativeOffset:!0});if(Array.isArray(r)){const i=e/(pdf_viewer_classPrivateFieldGet(mP,this)||o)-1,a=t.getBoundingClientRect();t.scrollLeft+=(r[0]-a.left)*i;t.scrollTop+=(r[1]-a.top)*i}}this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:s?t:void 0,previousScale:o,previousPresetValue:l,noScroll:a});this.defaultRenderingQueue&&this.update()}function _get_pageWidthScaleFactor(e){return e._spreadMode!==Zc.NONE&&e._scrollMode!==Yc.HORIZONTAL?2:1}function _setScale(e,t){e||(e="auto");this.maxZoom&&this.maxZoom===this.minZoom&&(e=this.maxZoom);let i=parseFloat(e);if(this._currentScale!==i)if(i>0){t.preset=!1;pdf_viewer_assertClassBrand(GP,this,_setScaleUpdatePages).call(this,i,e,t)}else{const a=this._pages[this._currentPageNumber-1];if(!a)return;let s=40,n=5;if(this.isInPresentationMode){s=n=4;this._spreadMode!==Zc.NONE&&(s*=2)}else this.removePageBorders?s=n=0:this._scrollMode===Yc.HORIZONTAL&&([s,n]=[n,s]);let r=(this.container.clientWidth-s)/a.width*a.scale/function pdf_viewer_classPrivateGetter(e,t,i){return i(pdf_viewer_assertClassBrand(e,t))}(GP,this,_get_pageWidthScaleFactor);"book"===this.pageViewMode&&(r/=2);const o=(this.container.clientHeight-n)/a.height*a.scale;switch(e){case"page-actual":i=1;break;case"page-width":i=r;break;case"page-height":i=o;break;case"page-fit":i=Math.min(r,o);break;case"auto":const t=isPortraitOrientation(a)?r:Math.min(o,r);i=Math.min(1.25,t);break;default:ngx_console_NgxConsole.error(`#setScale: "${e}" is an unknown zoom value.`);return}t.preset=!0;pdf_viewer_assertClassBrand(GP,this,_setScaleUpdatePages).call(this,i,e,t)}}function _resetCurrentPageView(){const e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&pdf_viewer_assertClassBrand(GP,this,_setScale).call(this,this._currentScaleValue,{noScroll:!0});pdf_viewer_assertClassBrand(GP,this,_scrollIntoView).call(this,e)}function _switchToEditAnnotationMode(){const e=this._getVisiblePages(),t=[],{ids:i,views:a}=e;for(const e of a){const{view:a}=e;a.hasEditableAnnotations()?t.push(e):i.delete(a.id)}if(0===t.length)return null;this.renderingQueue.renderHighestPriority({first:t[0],last:t.at(-1),views:t,ids:i});return i}function _getVisiblePagesInfiniteScroll(e){pdf_viewer_classPrivateFieldGet(FP,this)||pdf_viewer_classPrivateFieldSet(FP,this,pdf_viewer_assertClassBrand(GP,this,_findAncestorWithScrollbar).call(this,this.container));const t=pdf_viewer_classPrivateFieldGet(FP,this);let i;i=t?t.getBoundingClientRect():{top:0,left:0,bottom:window.innerHeight,right:window.innerWidth};const a=[],s=new Set;for(const t of e){const e=t.div,n=e.getBoundingClientRect(),r=Math.max(n.left,i.left),o=Math.min(n.right,i.right),l=Math.max(n.top,i.top),d=Math.min(n.bottom,i.bottom),c=Math.max(0,o-r),h=Math.max(0,d-l);if(0===c||0===h)continue;const u=c/n.width,_=u*(h/n.height)*100|0,p=Math.max(0,i.left-n.left),g=Math.max(0,i.top-n.top),f=Math.min(n.width,i.right-n.left),m=Math.min(n.height,i.bottom-n.top);a.push({id:t.id,x:e.offsetLeft+e.clientLeft,y:e.offsetTop+e.clientTop,visibleArea:100===_?null:{minX:p,minY:g,maxX:f,maxY:m},view:t,percent:_,widthPercent:100*u|0});s.add(t.id)}a.sort((e,t)=>{const i=e.percent-t.percent;return Math.abs(i)>.001?-i:e.id-t.id});return{first:a[0],last:a.at(-1),views:a,ids:s}}async function pdf_viewer_ensurePdfPageLoaded(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);e.pdfPage||e.setPdfPage(t);return t}catch(e){ngx_console_NgxConsole.error("Unable to get page for page view",e);return null}}function pdf_viewer_getScrollAhead(e){if(1===e.first?.id)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case Yc.PAGE:return pdf_viewer_classPrivateFieldGet(pP,this).scrollDown;case Yc.HORIZONTAL:return this.scroll.right}return this.scroll.down}function _getPageAdvance(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("book"===this.pageViewMode)return 2;switch(this._scrollMode){case Yc.WRAPPED:{const{views:i}=this._getVisiblePages(),a=new Map;for(const{id:e,y:t,percent:s,widthPercent:n}of i)0===s||n<100||a.getOrInsertComputed(t,makeArr).push(e);for(const i of a.values()){const a=i.indexOf(e);if(-1===a)continue;const s=i.length;if(1===s)break;if(t)for(let t=a-1,s=0;t>=s;t--){const a=i[t],s=i[t+1]-1;if(a<s)return e-s}else for(let t=a+1,n=s;t<n;t++){const a=i[t],s=i[t-1]+1;if(a>s)return s-e}if(t){const t=i[0];if(t<e)return e-t+1}else{const t=i[s-1];if(t>e)return t-e+1}break}break}case Yc.HORIZONTAL:break;case Yc.PAGE:case Yc.VERTICAL:{if(this._spreadMode===Zc.NONE)break;const i=this._spreadMode-1;if(t&&e%2!==i)break;if(!t&&e%2===i)break;const{views:a}=this._getVisiblePages(),s=t?e-1:e+1;for(const{id:e,percent:t,widthPercent:i}of a)if(e===s){if(t>0&&100===i)return 2;break}break}}return 1}function _updateContainerHeightCss(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.container.clientHeight;if(e!==pdf_viewer_classPrivateFieldGet(uP,this)){pdf_viewer_classPrivateFieldSet(uP,this,e);ih.setProperty("--viewer-container-height",`${e}px`)}}function pdf_viewer_resizeObserverCallback(e){for(const t of e)if(t.target===this.container){pdf_viewer_assertClassBrand(GP,this,_updateContainerHeightCss).call(this,Math.floor(t.borderBoxSize[0].blockSize));pdf_viewer_classPrivateFieldSet(Kv,this,null);break}}function _cleanupTimeouts(){if(null!==pdf_viewer_classPrivateFieldGet(gP,this)){clearTimeout(pdf_viewer_classPrivateFieldGet(gP,this));pdf_viewer_classPrivateFieldSet(gP,this,null)}if(null!==pdf_viewer_classPrivateFieldGet(oP,this)){clearTimeout(pdf_viewer_classPrivateFieldGet(oP,this));pdf_viewer_classPrivateFieldSet(oP,this,null)}}function _cleanupSwitchAnnotationEditorMode(){pdf_viewer_classPrivateFieldGet(lP,this)?.abort();pdf_viewer_classPrivateFieldSet(lP,this,null);if(null!==pdf_viewer_classPrivateFieldGet(dP,this)){clearTimeout(pdf_viewer_classPrivateFieldGet(dP,this));pdf_viewer_classPrivateFieldSet(dP,this,null)}}function _preloadEditingData(e){switch(e){case f.STAMP:pdf_viewer_classPrivateFieldGet(nP,this)?.loadModel("altText");break;case f.SIGNATURE:pdf_viewer_classPrivateFieldGet(vP,this)?.loadSignatures()}}function secondary_toolbar_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function secondary_toolbar_classPrivateFieldGet(e,t){return e.get(secondary_toolbar_assertClassBrand(e,t))}function secondary_toolbar_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var MP=new WeakMap,IP=new WeakSet;class SecondaryToolbar{constructor(e,t){!function secondary_toolbar_classPrivateMethodInitSpec(e,t){secondary_toolbar_checkPrivateRedeclaration(e,t),t.add(e)}(this,IP);!function secondary_toolbar_classPrivateFieldInitSpec(e,t,i){secondary_toolbar_checkPrivateRedeclaration(e,t),t.set(e,i)}(this,MP,void 0);!function secondary_toolbar_classPrivateFieldSet(e,t,i){return e.set(secondary_toolbar_assertClassBrand(e,t),i),i}(MP,this,e);const i=[{element:e.presentationModeButton,eventName:"presentationmode",close:!0},{element:e.printButton,eventName:"print",close:!0},{element:e.downloadButton,eventName:"download",close:!0},{element:e.viewBookmarkButton,eventName:null,close:!0},{element:e.firstPageButton,eventName:"firstpage",close:!0},{element:e.lastPageButton,eventName:"lastpage",close:!0},{element:e.pageRotateCwButton,eventName:"rotatecw",close:!1},{element:e.pageRotateCcwButton,eventName:"rotateccw",close:!1},{element:e.cursorSelectToolButton,eventName:"switchcursortool",eventDetails:{tool:Jc.SELECT},close:!0},{element:e.cursorHandToolButton,eventName:"switchcursortool",eventDetails:{tool:Jc.HAND},close:!0},{element:e.scrollPageButton,eventName:"switchscrollmode",eventDetails:{mode:Yc.PAGE},close:!0},{element:e.scrollVerticalButton,eventName:"switchscrollmode",eventDetails:{mode:Yc.VERTICAL},close:!0},{element:e.scrollHorizontalButton,eventName:"switchscrollmode",eventDetails:{mode:Yc.HORIZONTAL},close:!0},{element:e.scrollWrappedButton,eventName:"switchscrollmode",eventDetails:{mode:Yc.WRAPPED},close:!0},{element:e.spreadNoneButton,eventName:"switchspreadmode",eventDetails:{mode:Zc.NONE},close:!0},{element:e.spreadOddButton,eventName:"switchspreadmode",eventDetails:{mode:Zc.ODD},close:!0},{element:e.spreadEvenButton,eventName:"switchspreadmode",eventDetails:{mode:Zc.EVEN},close:!0},{element:e.imageAltTextSettingsButton,eventName:"imagealttextsettings",close:!0},{element:e.documentPropertiesButton,eventName:"documentproperties",close:!0}];i.push({element:e.openFileButton,eventName:"openfile",close:!0});this.eventBus=t;this.opened=!1;secondary_toolbar_assertClassBrand(IP,this,secondary_toolbar_bindListeners).call(this,i);this.reset()}get isOpen(){return this.opened}setPageNumber(e){this.pageNumber=e;secondary_toolbar_assertClassBrand(IP,this,secondary_toolbar_updateUIState).call(this)}setPagesCount(e){this.pagesCount=e;secondary_toolbar_assertClassBrand(IP,this,secondary_toolbar_updateUIState).call(this)}reset(){this.pageNumber=0;this.pagesCount=0;secondary_toolbar_assertClassBrand(IP,this,secondary_toolbar_updateUIState).call(this);this.eventBus.dispatch("switchcursortool",{source:this,reset:!0});secondary_toolbar_assertClassBrand(IP,this,_scrollModeChanged).call(this,{mode:Yc.VERTICAL});secondary_toolbar_assertClassBrand(IP,this,_spreadModeChanged).call(this,{mode:Zc.NONE})}open(){if(this.opened)return;this.eventBus.dispatch("closeopenpopovers",{source:this});this.opened=!0;const{toggleButton:e,toolbar:t}=secondary_toolbar_classPrivateFieldGet(MP,this);toggleExpandedBtn(e,!0,t)}close(){if(!this.opened)return;this.opened=!1;const{toggleButton:e,toolbar:t}=secondary_toolbar_classPrivateFieldGet(MP,this);toggleExpandedBtn(e,!1,t)}toggle(){this.opened?this.close():this.open()}}function secondary_toolbar_updateUIState(){const{firstPageButton:e,lastPageButton:t,pageRotateCwButton:i,pageRotateCcwButton:a}=secondary_toolbar_classPrivateFieldGet(MP,this);e.disabled=this.pageNumber<=1;t.disabled=this.pageNumber>=this.pagesCount;i.disabled=0===this.pagesCount;a.disabled=0===this.pagesCount}function secondary_toolbar_bindListeners(e){const{eventBus:t}=this,{toggleButton:i}=secondary_toolbar_classPrivateFieldGet(MP,this);i.addEventListener("click",this.toggle.bind(this));for(const{element:i,eventName:a,close:s,eventDetails:n}of e)i&&i.addEventListener("click",e=>{null!==a&&t.dispatch(a,{source:this,...n});s&&this.close();t.dispatch("reporttelemetry",{source:this,details:{type:"buttons",data:{id:i.id}}})});t._on("cursortoolchanged",secondary_toolbar_assertClassBrand(IP,this,_cursorToolChanged).bind(this));t._on("scrollmodechanged",secondary_toolbar_assertClassBrand(IP,this,_scrollModeChanged).bind(this));t._on("spreadmodechanged",secondary_toolbar_assertClassBrand(IP,this,_spreadModeChanged).bind(this));t._on("closeopenpopovers",e=>{let{source:t}=e;t!==this&&this.close()})}function _cursorToolChanged(e){let{tool:t,disabled:i}=e;const{cursorSelectToolButton:a,cursorHandToolButton:s}=secondary_toolbar_classPrivateFieldGet(MP,this);toggleCheckedBtn(a,t===Jc.SELECT);toggleCheckedBtn(s,t===Jc.HAND);a.disabled=i;s.disabled=i}function _scrollModeChanged(e){let{mode:t}=e;const{scrollPageButton:i,scrollVerticalButton:a,scrollHorizontalButton:s,scrollWrappedButton:n,spreadNoneButton:r,spreadOddButton:o,spreadEvenButton:l}=secondary_toolbar_classPrivateFieldGet(MP,this);toggleCheckedBtn(i,t===Yc.PAGE);toggleCheckedBtn(a,t===Yc.VERTICAL);toggleCheckedBtn(s,t===Yc.HORIZONTAL);toggleCheckedBtn(n,t===Yc.WRAPPED);const d=this.pagesCount>Lv;i.disabled=d;a.disabled=d;s.disabled=d;n.disabled=d;const c=t===Yc.HORIZONTAL;r.disabled=c;o.disabled=c;l.disabled=c}function _spreadModeChanged(e){let{mode:t}=e;const{spreadNoneButton:i,spreadOddButton:a,spreadEvenButton:s}=secondary_toolbar_classPrivateFieldGet(MP,this);toggleCheckedBtn(i,t===Zc.NONE);toggleCheckedBtn(a,t===Zc.ODD);toggleCheckedBtn(s,t===Zc.EVEN)}function signature_manager_classPrivateMethodInitSpec(e,t){signature_manager_checkPrivateRedeclaration(e,t),t.add(e)}function signature_manager_classPrivateFieldInitSpec(e,t,i){signature_manager_checkPrivateRedeclaration(e,t),t.set(e,i)}function signature_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function signature_manager_classPrivateFieldGet(e,t){return e.get(signature_manager_assertClassBrand(e,t))}function signature_manager_classPrivateFieldSet(e,t,i){return e.set(signature_manager_assertClassBrand(e,t),i),i}function signature_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var TP=new WeakMap,DP=new WeakMap,LP=new WeakMap,RP=new WeakMap,NP=new WeakMap,OP=new WeakMap,WP=new WeakMap,jP=new WeakMap,VP=new WeakMap,UP=new WeakMap,zP=new WeakMap,HP=new WeakMap,$P=new WeakMap,qP=new WeakMap,XP=new WeakMap,KP=new WeakMap,YP=new WeakMap,ZP=new WeakMap,JP=new WeakMap,QP=new WeakMap,ew=new WeakMap,tw=new WeakMap,iw=new WeakMap,aw=new WeakMap,sw=new WeakMap,nw=new WeakMap,rw=new WeakMap,ow=new WeakMap,lw=new WeakMap,dw=new WeakMap,cw=new WeakMap,hw=new WeakMap,uw=new WeakMap,_w=new WeakMap,pw=new WeakMap,gw=new WeakMap,fw=new WeakMap,mw=new WeakMap,vw=new WeakMap,Pw=new WeakSet;class SignatureManager{constructor(e,t,i,a,s,n,r){let{dialog:o,panels:l,typeButton:d,typeInput:c,drawButton:h,drawPlaceholder:u,drawSVG:_,drawThickness:p,imageButton:g,imageSVG:f,imagePlaceholder:m,imagePicker:v,imagePickerLink:P,description:w,clearButton:b,cancelButton:y,addButton:S,errorCloseButton:C,errorBar:x,errorTitle:k,errorDescription:E,saveCheckbox:A,saveContainer:G}=e;signature_manager_classPrivateMethodInitSpec(this,Pw);signature_manager_classPrivateFieldInitSpec(this,TP,void 0);signature_manager_classPrivateFieldInitSpec(this,DP,null);signature_manager_classPrivateFieldInitSpec(this,LP,void 0);signature_manager_classPrivateFieldInitSpec(this,RP,void 0);signature_manager_classPrivateFieldInitSpec(this,NP,void 0);signature_manager_classPrivateFieldInitSpec(this,OP,void 0);signature_manager_classPrivateFieldInitSpec(this,WP,void 0);signature_manager_classPrivateFieldInitSpec(this,jP,null);signature_manager_classPrivateFieldInitSpec(this,VP,void 0);signature_manager_classPrivateFieldInitSpec(this,UP,null);signature_manager_classPrivateFieldInitSpec(this,zP,"");signature_manager_classPrivateFieldInitSpec(this,HP,null);signature_manager_classPrivateFieldInitSpec(this,$P,void 0);signature_manager_classPrivateFieldInitSpec(this,qP,void 0);signature_manager_classPrivateFieldInitSpec(this,XP,void 0);signature_manager_classPrivateFieldInitSpec(this,KP,void 0);signature_manager_classPrivateFieldInitSpec(this,YP,void 0);signature_manager_classPrivateFieldInitSpec(this,ZP,null);signature_manager_classPrivateFieldInitSpec(this,JP,null);signature_manager_classPrivateFieldInitSpec(this,QP,void 0);signature_manager_classPrivateFieldInitSpec(this,ew,void 0);signature_manager_classPrivateFieldInitSpec(this,tw,void 0);signature_manager_classPrivateFieldInitSpec(this,iw,void 0);signature_manager_classPrivateFieldInitSpec(this,aw,void 0);signature_manager_classPrivateFieldInitSpec(this,sw,void 0);signature_manager_classPrivateFieldInitSpec(this,nw,void 0);signature_manager_classPrivateFieldInitSpec(this,rw,void 0);signature_manager_classPrivateFieldInitSpec(this,ow,null);signature_manager_classPrivateFieldInitSpec(this,lw,void 0);signature_manager_classPrivateFieldInitSpec(this,dw,null);signature_manager_classPrivateFieldInitSpec(this,cw,null);signature_manager_classPrivateFieldInitSpec(this,hw,!1);signature_manager_classPrivateFieldInitSpec(this,uw,void 0);signature_manager_classPrivateFieldInitSpec(this,_w,!1);signature_manager_classPrivateFieldInitSpec(this,pw,void 0);signature_manager_classPrivateFieldInitSpec(this,gw,void 0);signature_manager_classPrivateFieldInitSpec(this,fw,void 0);signature_manager_classPrivateFieldInitSpec(this,mw,void 0);signature_manager_classPrivateFieldInitSpec(this,vw,null);signature_manager_classPrivateFieldSet(TP,this,S);signature_manager_classPrivateFieldSet(LP,this,b);signature_manager_classPrivateFieldSet(RP,this,w.lastElementChild);signature_manager_classPrivateFieldSet(OP,this,w.firstElementChild);signature_manager_classPrivateFieldSet(WP,this,o);signature_manager_classPrivateFieldSet($P,this,_);signature_manager_classPrivateFieldSet(VP,this,u);signature_manager_classPrivateFieldSet(qP,this,p);signature_manager_classPrivateFieldSet(XP,this,x);signature_manager_classPrivateFieldSet(YP,this,k);signature_manager_classPrivateFieldSet(KP,this,E);signature_manager_classPrivateFieldSet(iw,this,f);signature_manager_classPrivateFieldSet(tw,this,m);signature_manager_classPrivateFieldSet(QP,this,v);signature_manager_classPrivateFieldSet(ew,this,P);signature_manager_classPrivateFieldSet(gw,this,a);signature_manager_classPrivateFieldSet(aw,this,A);signature_manager_classPrivateFieldSet(sw,this,G);signature_manager_classPrivateFieldSet(rw,this,i);signature_manager_classPrivateFieldSet(lw,this,c);signature_manager_classPrivateFieldSet(pw,this,s);signature_manager_classPrivateFieldSet(mw,this,n);signature_manager_classPrivateFieldSet(uw,this,r);signature_manager_classPrivateFieldSet(fw,this,new EditDescriptionDialog(t,a));ww._||(ww._=Object.freeze({signature:"pdfjs-editor-add-signature-description-default-when-drawing",errorUploadTitle:"pdfjs-editor-add-signature-image-upload-error-title",errorUploadDescription:"pdfjs-editor-add-signature-image-upload-error-description",errorNoDataTitle:"pdfjs-editor-add-signature-image-no-data-error-title",errorNoDataDescription:"pdfjs-editor-add-signature-image-no-data-error-description"}));o.addEventListener("close",signature_manager_assertClassBrand(Pw,this,signature_manager_close).bind(this));o.addEventListener("contextmenu",e=>{const{target:t}=e;t!==signature_manager_classPrivateFieldGet(lw,this)&&t!==signature_manager_classPrivateFieldGet(OP,this)&&e.preventDefault()});o.addEventListener("drop",e=>{stopEvent(e)});y.addEventListener("click",signature_manager_assertClassBrand(Pw,this,signature_manager_cancel).bind(this));S.addEventListener("click",signature_manager_assertClassBrand(Pw,this,_add).bind(this));b.addEventListener("click",()=>{signature_manager_assertClassBrand(Pw,this,signature_manager_reportTelemetry).call(this,{type:"signature",action:"pdfjs.signature.clear",data:{type:signature_manager_classPrivateFieldGet(dw,this)}});signature_manager_assertClassBrand(Pw,this,_initTab).call(this,null)},{passive:!0});signature_manager_classPrivateFieldGet(OP,this).addEventListener("input",()=>{signature_manager_classPrivateFieldGet(RP,this).disabled=""===signature_manager_classPrivateFieldGet(OP,this).value},{passive:!0});signature_manager_classPrivateFieldGet(RP,this).addEventListener("click",()=>{signature_manager_classPrivateFieldGet(OP,this).value="";signature_manager_classPrivateFieldGet(RP,this).disabled=!0},{passive:!0});C.addEventListener("click",()=>{x.hidden=!0},{passive:!0});signature_manager_assertClassBrand(Pw,this,_initTabButtons).call(this,d,h,g,l);v.accept=Q.join(",");r._on("storedsignatureschanged",signature_manager_assertClassBrand(Pw,this,_signaturesChanged).bind(this));a.register(o)}getSignature(e){return this.open(e)}async loadSignatures(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!signature_manager_classPrivateFieldGet(rw,this)||!e&&signature_manager_classPrivateFieldGet(rw,this).previousElementSibling||!signature_manager_classPrivateFieldGet(mw,this))return;if(!signature_manager_classPrivateFieldGet(ow,this)){signature_manager_classPrivateFieldSet(ow,this,signature_manager_classPrivateFieldGet(mw,this).getAll().then(async e=>[e,await Promise.all(Array.from(e.values(),e=>{let{signatureData:t}=e;return SignatureExtractor.decompressSignature(t)}))]));if(!e)return}const[t,i]=await signature_manager_classPrivateFieldGet(ow,this);signature_manager_classPrivateFieldSet(ow,this,null);let a=0;for(const[e,{description:s}]of t){const t=i[a++];if(t){t.curves=t.outlines.map(e=>({points:e}));delete t.outlines;signature_manager_assertClassBrand(Pw,this,_addToolbarButton).call(this,t,e,s)}}}async renderEditButton(e){const t=document.createElement("button");t.classList.add("altText","editDescription");t.tabIndex=0;e.description&&(t.title=e.description);const i=document.createElement("span");t.append(i);i.setAttribute("data-l10n-id","pdfjs-editor-add-signature-edit-button-label");t.addEventListener("click",()=>{signature_manager_classPrivateFieldGet(fw,this).open(e)},{passive:!0});return t}async open(e){let{uiManager:t,editor:i}=e;signature_manager_classPrivateFieldGet(DP,this)||signature_manager_classPrivateFieldSet(DP,this,new Map(signature_manager_classPrivateFieldGet(nw,this).keys().map(e=>[e,{value:"",default:""}])));signature_manager_classPrivateFieldSet(vw,this,t);signature_manager_classPrivateFieldSet(NP,this,i);signature_manager_classPrivateFieldGet(vw,this).removeEditListeners();const a=signature_manager_classPrivateFieldSet(_w,this,await signature_manager_classPrivateFieldGet(mw,this).isFull());signature_manager_classPrivateFieldGet(sw,this).classList.toggle("fullStorage",a);signature_manager_classPrivateFieldGet(aw,this).checked=!a;await signature_manager_classPrivateFieldGet(gw,this).open(signature_manager_classPrivateFieldGet(WP,this));const s=signature_manager_classPrivateFieldGet(nw,this).get("type");s.focus();s.click()}destroy(){signature_manager_classPrivateFieldSet(vw,this,null);signature_manager_assertClassBrand(Pw,this,signature_manager_finish).call(this)}}function _initTabButtons(e,t,i,a){const s=signature_manager_classPrivateFieldSet(nw,this,new Map([["type",e],["draw",t],["image",i]])),tabCallback=e=>{for(const[t,i]of s)if(i===e.target){i.setAttribute("aria-selected",!0);i.setAttribute("tabindex",0);a.setAttribute("data-selected",t);signature_manager_assertClassBrand(Pw,this,_initTab).call(this,t)}else{i.setAttribute("aria-selected",!1);i.setAttribute("tabindex",-1)}},n=Array.from(s.values());for(let e=0,t=n.length;e<t;e++){const t=n[e];t.addEventListener("click",tabCallback,{passive:!0});t.addEventListener("keydown",t=>{let{key:i}=t;"ArrowLeft"!==i&&"ArrowRight"!==i||n[e+("ArrowLeft"===i?-1:1)]?.focus()},{passive:!0})}}function _resetCommon(){signature_manager_classPrivateFieldSet(hw,this,!1);signature_manager_classPrivateFieldGet(OP,this).value="";signature_manager_classPrivateFieldGet(dw,this)&&(signature_manager_classPrivateFieldGet(DP,this).get(signature_manager_classPrivateFieldGet(dw,this)).value="")}function _resetTab(e){switch(e){case"type":signature_manager_classPrivateFieldGet(lw,this).value="";break;case"draw":signature_manager_classPrivateFieldSet(jP,this,null);signature_manager_classPrivateFieldSet(HP,this,null);signature_manager_classPrivateFieldSet(zP,this,"");signature_manager_classPrivateFieldGet(UP,this)?.remove();signature_manager_classPrivateFieldSet(UP,this,null);signature_manager_classPrivateFieldGet(VP,this).hidden=!1;signature_manager_classPrivateFieldGet(qP,this).value=1;break;case"image":signature_manager_classPrivateFieldGet(tw,this).hidden=!1;signature_manager_classPrivateFieldGet(JP,this)?.remove();signature_manager_classPrivateFieldSet(JP,this,null)}}function _initTab(e){if(e&&signature_manager_classPrivateFieldGet(dw,this)===e)return;signature_manager_classPrivateFieldGet(dw,this)&&(signature_manager_classPrivateFieldGet(DP,this).get(signature_manager_classPrivateFieldGet(dw,this)).value=signature_manager_classPrivateFieldGet(OP,this).value);e&&signature_manager_classPrivateFieldSet(dw,this,e);signature_manager_classPrivateFieldGet(XP,this).hidden=!0;const t=!e;t?signature_manager_assertClassBrand(Pw,this,_resetCommon).call(this):signature_manager_classPrivateFieldGet(OP,this).value=signature_manager_classPrivateFieldGet(DP,this).get(signature_manager_classPrivateFieldGet(dw,this)).value;signature_manager_classPrivateFieldGet(RP,this).disabled=""===signature_manager_classPrivateFieldGet(OP,this).value;signature_manager_classPrivateFieldGet(cw,this)?.abort();signature_manager_classPrivateFieldSet(cw,this,new AbortController);switch(signature_manager_classPrivateFieldGet(dw,this)){case"type":signature_manager_assertClassBrand(Pw,this,_initTypeTab).call(this,t);break;case"draw":signature_manager_assertClassBrand(Pw,this,_initDrawTab).call(this,t);break;case"image":signature_manager_assertClassBrand(Pw,this,_initImageTab).call(this,t)}}function _disableButtons(e){e&&signature_manager_classPrivateFieldGet(_w,this)||(signature_manager_classPrivateFieldGet(aw,this).disabled=!e);signature_manager_classPrivateFieldGet(LP,this).disabled=signature_manager_classPrivateFieldGet(TP,this).disabled=signature_manager_classPrivateFieldGet(OP,this).disabled=!e}function _initTypeTab(e){e&&signature_manager_assertClassBrand(Pw,this,_resetTab).call(this,"type");signature_manager_assertClassBrand(Pw,this,_disableButtons).call(this,signature_manager_classPrivateFieldGet(lw,this).value);const{signal:t}=signature_manager_classPrivateFieldGet(cw,this),i={passive:!0,signal:t};signature_manager_classPrivateFieldGet(lw,this).addEventListener("input",()=>{const{value:e}=signature_manager_classPrivateFieldGet(lw,this);if(!signature_manager_classPrivateFieldGet(hw,this)){signature_manager_classPrivateFieldGet(DP,this).get("type").default=signature_manager_classPrivateFieldGet(OP,this).value=e;signature_manager_classPrivateFieldGet(RP,this).disabled=""===e}signature_manager_assertClassBrand(Pw,this,_disableButtons).call(this,e)},i);signature_manager_classPrivateFieldGet(OP,this).addEventListener("input",()=>{signature_manager_classPrivateFieldSet(hw,this,signature_manager_classPrivateFieldGet(lw,this).value!==signature_manager_classPrivateFieldGet(OP,this).value)},i)}function _initDrawTab(e){e&&signature_manager_assertClassBrand(Pw,this,_resetTab).call(this,"draw");signature_manager_assertClassBrand(Pw,this,_disableButtons).call(this,signature_manager_classPrivateFieldGet(UP,this));const{signal:t}=signature_manager_classPrivateFieldGet(cw,this),i={signal:t};let a=NaN;const drawCallback=e=>{const{pointerId:s}=e;if(!isNaN(a)&&a!==s)return;a=s;e.preventDefault();signature_manager_classPrivateFieldGet($P,this).setPointerCapture(s);const{width:n,height:r}=signature_manager_classPrivateFieldGet($P,this).getBoundingClientRect();let{offsetX:o,offsetY:l}=e;o=Math.round(o);l=Math.round(l);e.target===signature_manager_classPrivateFieldGet(VP,this)&&(signature_manager_classPrivateFieldGet(VP,this).hidden=!0);if(!signature_manager_classPrivateFieldGet(jP,this)){signature_manager_classPrivateFieldSet(jP,this,{width:n,height:r,thickness:parseInt(signature_manager_classPrivateFieldGet(qP,this).value),curves:[]});signature_manager_assertClassBrand(Pw,this,_disableButtons).call(this,!0);const e=new DOMSVGFactory,t=signature_manager_classPrivateFieldSet(UP,this,e.createElement("path"));t.setAttribute("stroke-width",signature_manager_classPrivateFieldGet(qP,this).value);signature_manager_classPrivateFieldGet($P,this).append(t);signature_manager_classPrivateFieldGet($P,this).addEventListener("pointerdown",drawCallback,i);signature_manager_classPrivateFieldGet(VP,this).removeEventListener("pointerdown",drawCallback);""===signature_manager_classPrivateFieldGet(OP,this).value&&signature_manager_classPrivateFieldGet(pw,this).get(ww._.signature).then(e=>{signature_manager_classPrivateFieldGet(DP,this).get("draw").default=e;signature_manager_classPrivateFieldGet(OP,this).value||=e;signature_manager_classPrivateFieldGet(RP,this).disabled=""===signature_manager_classPrivateFieldGet(OP,this).value})}signature_manager_classPrivateFieldSet(HP,this,[o,l]);signature_manager_classPrivateFieldGet(jP,this).curves.push({points:signature_manager_classPrivateFieldGet(HP,this)});signature_manager_classPrivateFieldSet(zP,this,signature_manager_classPrivateFieldGet(zP,this)+`M ${o} ${l}`);signature_manager_classPrivateFieldGet(UP,this).setAttribute("d",signature_manager_classPrivateFieldGet(zP,this));const d=new AbortController,c={signal:AbortSignal.any([t,d.signal])};signature_manager_classPrivateFieldGet($P,this).addEventListener("contextmenu",noContextMenu,c);signature_manager_classPrivateFieldGet($P,this).addEventListener("pointermove",e=>{e.preventDefault();let{offsetX:t,offsetY:i}=e;t=Math.round(t);i=Math.round(i);const a=signature_manager_classPrivateFieldGet(HP,this);if(!(t<0||i<0||t>n||i>r||t===a.at(-2)&&i===a.at(-1))){if(a.length>=4){const[e,s,n,r]=a.slice(-4);signature_manager_classPrivateFieldSet(zP,this,signature_manager_classPrivateFieldGet(zP,this)+`C${(e+5*n)/6} ${(s+5*r)/6} ${(5*n+t)/6} ${(5*r+i)/6} ${(n+t)/2} ${(r+i)/2}`)}else signature_manager_classPrivateFieldSet(zP,this,signature_manager_classPrivateFieldGet(zP,this)+`L${t} ${i}`);a.push(t,i);signature_manager_classPrivateFieldGet(UP,this).setAttribute("d",signature_manager_classPrivateFieldGet(zP,this))}},c);signature_manager_classPrivateFieldGet($P,this).addEventListener("pointerup",e=>{const{pointerId:t}=e;if(isNaN(a)||a===t){a=NaN;e.preventDefault();signature_manager_classPrivateFieldGet($P,this).releasePointerCapture(t);d.abort();if(2===signature_manager_classPrivateFieldGet(HP,this).length){signature_manager_classPrivateFieldSet(zP,this,signature_manager_classPrivateFieldGet(zP,this)+`L${signature_manager_classPrivateFieldGet(HP,this)[0]} ${signature_manager_classPrivateFieldGet(HP,this)[1]}`);signature_manager_classPrivateFieldGet(UP,this).setAttribute("d",signature_manager_classPrivateFieldGet(zP,this))}}},c)};signature_manager_classPrivateFieldGet(jP,this)?signature_manager_classPrivateFieldGet($P,this).addEventListener("pointerdown",drawCallback,i):signature_manager_classPrivateFieldGet(VP,this).addEventListener("pointerdown",drawCallback,i);signature_manager_classPrivateFieldGet(qP,this).addEventListener("input",()=>{const{value:e}=signature_manager_classPrivateFieldGet(qP,this);signature_manager_classPrivateFieldGet(qP,this).setAttribute("data-l10n-args",JSON.stringify({thickness:e}));if(signature_manager_classPrivateFieldGet(jP,this)){signature_manager_classPrivateFieldGet(UP,this).setAttribute("stroke-width",e);signature_manager_classPrivateFieldGet(jP,this).thickness=e}},i)}function _showError(e){signature_manager_classPrivateFieldGet(YP,this).setAttribute("data-l10n-id",ww._[`error${e}Title`]);signature_manager_classPrivateFieldGet(KP,this).setAttribute("data-l10n-id",ww._[`error${e}Description`]);signature_manager_classPrivateFieldGet(XP,this).hidden=!1}function _initImageTab(e){e&&signature_manager_assertClassBrand(Pw,this,_resetTab).call(this,"image");signature_manager_assertClassBrand(Pw,this,_disableButtons).call(this,signature_manager_classPrivateFieldGet(JP,this));const{signal:t}=signature_manager_classPrivateFieldGet(cw,this),i={signal:t},a={passive:!0,signal:t};signature_manager_classPrivateFieldGet(ew,this).addEventListener("keydown",e=>{const{key:t}=e;if("Enter"===t||" "===t){stopEvent(e);signature_manager_classPrivateFieldGet(QP,this).click()}},i);signature_manager_classPrivateFieldGet(QP,this).addEventListener("click",()=>{signature_manager_classPrivateFieldGet(WP,this).classList.toggle("waiting",!0)},a);signature_manager_classPrivateFieldGet(QP,this).addEventListener("change",async()=>{const e=signature_manager_classPrivateFieldGet(QP,this).files?.[0];if(e&&Q.includes(e.type))await signature_manager_assertClassBrand(Pw,this,_extractSignature).call(this,e);else{signature_manager_assertClassBrand(Pw,this,_showError).call(this,"Upload");signature_manager_classPrivateFieldGet(WP,this).classList.toggle("waiting",!1)}},a);signature_manager_classPrivateFieldGet(QP,this).addEventListener("cancel",()=>{signature_manager_classPrivateFieldGet(WP,this).classList.toggle("waiting",!1)},a);signature_manager_classPrivateFieldGet(tw,this).addEventListener("dragover",e=>{const{dataTransfer:t}=e;for(const{type:i}of t.items)if(Q.includes(i)){t.dropEffect="copy"===t.effectAllowed?"copy":"move";stopEvent(e);return}t.dropEffect="none"},i);signature_manager_classPrivateFieldGet(tw,this).addEventListener("drop",e=>{const{dataTransfer:{files:t}}=e;if(t?.length){for(const e of t)if(Q.includes(e.type)){signature_manager_assertClassBrand(Pw,this,_extractSignature).call(this,e);break}stopEvent(e);signature_manager_classPrivateFieldGet(WP,this).classList.toggle("waiting",!0)}},i)}async function _extractSignature(e){let t;try{t=await signature_manager_classPrivateFieldGet(vw,this).imageManager.getFromFile(e)}catch(e){ngx_console_NgxConsole.error("SignatureManager.#extractSignature.",e)}if(!t){signature_manager_assertClassBrand(Pw,this,_showError).call(this,"Upload");signature_manager_classPrivateFieldGet(WP,this).classList.toggle("waiting",!1);return}const i=signature_manager_classPrivateFieldSet(ZP,this,signature_manager_classPrivateFieldGet(NP,this).getFromImage(t.bitmap));if(!i){signature_manager_assertClassBrand(Pw,this,_showError).call(this,"NoData");signature_manager_classPrivateFieldGet(WP,this).classList.toggle("waiting",!1);return}const{outline:a}=i;signature_manager_classPrivateFieldGet(tw,this).hidden=!0;signature_manager_assertClassBrand(Pw,this,_disableButtons).call(this,!0);const s=new DOMSVGFactory,n=signature_manager_classPrivateFieldSet(JP,this,s.createElement("path"));signature_manager_classPrivateFieldGet(iw,this).setAttribute("viewBox",a.viewBox);signature_manager_classPrivateFieldGet(iw,this).setAttribute("preserveAspectRatio","xMidYMid meet");signature_manager_classPrivateFieldGet(iw,this).append(n);n.setAttribute("d",a.toSVGPath());signature_manager_classPrivateFieldGet(DP,this).get("image").default=e.name;if(""===signature_manager_classPrivateFieldGet(OP,this).value){signature_manager_classPrivateFieldGet(OP,this).value=e.name||"";signature_manager_classPrivateFieldGet(RP,this).disabled=""===signature_manager_classPrivateFieldGet(OP,this).value}signature_manager_classPrivateFieldGet(WP,this).classList.toggle("waiting",!1)}function _getOutlineForType(){return signature_manager_classPrivateFieldGet(NP,this).getFromText(signature_manager_classPrivateFieldGet(lw,this).value,window.getComputedStyle(signature_manager_classPrivateFieldGet(lw,this)))}function _getOutlineForDraw(){const{width:e,height:t}=signature_manager_classPrivateFieldGet($P,this).getBoundingClientRect();return signature_manager_classPrivateFieldGet(NP,this).getDrawnSignature(signature_manager_classPrivateFieldGet(jP,this),e,t)}function signature_manager_reportTelemetry(e){signature_manager_classPrivateFieldGet(uw,this).dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}function _addToolbarButton(e,t,i){const{curves:a,areContours:s,thickness:n,width:r,height:o}=e,l=Math.max(r,o),d=SignatureExtractor.processDrawnLines({lines:{curves:a,thickness:n,width:r,height:o},pageWidth:l,pageHeight:l,rotation:0,innerMargin:0,mustSmooth:!1,areContours:s});if(!d)return;const{outline:c}=d,h=new DOMSVGFactory,u=document.createElement("div"),_=document.createElement("button");_.addEventListener("click",()=>{signature_manager_classPrivateFieldGet(uw,this).dispatch("switchannotationeditorparams",{source:this,type:m.CREATE,value:{signatureData:{lines:{curves:a,thickness:n,width:r,height:o},mustSmooth:!1,areContours:s,description:i,uuid:t,heightInPage:40}}})});u.append(_);u.classList.add("toolbarAddSignatureButtonContainer");const p=h.create(1,1,!0);_.append(p);const g=document.createElement("span");g.ariaHidden=!0;_.append(g);_.classList.add("toolbarAddSignatureButton");_.type="button";g.textContent=i;_.setAttribute("data-l10n-id","pdfjs-editor-add-saved-signature-button");_.setAttribute("data-l10n-args",JSON.stringify({description:i}));_.tabIndex=0;const f=h.createElement("path");p.append(f);p.setAttribute("viewBox",c.viewBox);p.setAttribute("preserveAspectRatio","xMidYMid meet");s&&f.classList.add("contours");f.setAttribute("d",c.toSVGPath());const v=document.createElement("button");u.append(v);v.classList.add("toolbarButton","deleteButton");v.setAttribute("data-l10n-id","pdfjs-editor-delete-signature-button1");v.type="button";v.tabIndex=0;v.addEventListener("click",async()=>{if(await signature_manager_classPrivateFieldGet(mw,this).delete(t)){u.remove();signature_manager_assertClassBrand(Pw,this,signature_manager_reportTelemetry).call(this,{type:"signature",action:"pdfjs.signature.delete_saved",data:{savedCount:await signature_manager_classPrivateFieldGet(mw,this).size()}})}});const P=document.createElement("span");v.append(P);P.setAttribute("data-l10n-id","pdfjs-editor-delete-signature-button-label1");signature_manager_classPrivateFieldGet(rw,this).before(u)}async function _signaturesChanged(){const e=signature_manager_classPrivateFieldGet(rw,this).parentElement;for(;e.firstElementChild!==signature_manager_classPrivateFieldGet(rw,this);)e.firstElementChild.remove();signature_manager_classPrivateFieldSet(ow,this,null);await this.loadSignatures(!0)}function signature_manager_cancel(){signature_manager_assertClassBrand(Pw,this,signature_manager_finish).call(this)}function signature_manager_finish(){signature_manager_classPrivateFieldGet(gw,this).closeIfActive(signature_manager_classPrivateFieldGet(WP,this))}function signature_manager_close(){null===signature_manager_classPrivateFieldGet(NP,this)._drawId&&signature_manager_classPrivateFieldGet(NP,this).remove();signature_manager_classPrivateFieldGet(vw,this)?.addEditListeners();signature_manager_classPrivateFieldGet(cw,this)?.abort();signature_manager_classPrivateFieldSet(cw,this,null);signature_manager_classPrivateFieldSet(vw,this,null);signature_manager_classPrivateFieldSet(NP,this,null);signature_manager_assertClassBrand(Pw,this,_resetCommon).call(this);for(const[e]of signature_manager_classPrivateFieldGet(nw,this))signature_manager_assertClassBrand(Pw,this,_resetTab).call(this,e);signature_manager_assertClassBrand(Pw,this,_disableButtons).call(this,!1);signature_manager_classPrivateFieldSet(dw,this,null);signature_manager_classPrivateFieldSet(DP,this,null)}async function _add(){let e;const t=signature_manager_classPrivateFieldGet(dw,this);switch(t){case"type":e=signature_manager_assertClassBrand(Pw,this,_getOutlineForType).call(this);break;case"draw":e=signature_manager_assertClassBrand(Pw,this,_getOutlineForDraw).call(this);break;case"image":e=signature_manager_classPrivateFieldGet(ZP,this)}let i=null;const a=signature_manager_classPrivateFieldGet(OP,this).value;if(signature_manager_classPrivateFieldGet(aw,this).checked){const{newCurves:t,areContours:s,thickness:n,width:r,height:o}=e,l=await SignatureExtractor.compressSignature({outlines:t,areContours:s,thickness:n,width:r,height:o});i=await signature_manager_classPrivateFieldGet(mw,this).create({description:a,signatureData:l});i?signature_manager_assertClassBrand(Pw,this,_addToolbarButton).call(this,{curves:t.map(e=>({points:e})),areContours:s,thickness:n,width:r,height:o},i,a):ngx_console_NgxConsole.warn("SignatureManager.add: cannot save the signature.")}const s=signature_manager_classPrivateFieldGet(DP,this).get(t);signature_manager_assertClassBrand(Pw,this,signature_manager_reportTelemetry).call(this,{type:"signature",action:"pdfjs.signature.created",data:{type:t,saved:!!i,savedCount:await signature_manager_classPrivateFieldGet(mw,this).size(),descriptionChanged:a!==s.default}});signature_manager_classPrivateFieldGet(NP,this).addSignature(e,40,signature_manager_classPrivateFieldGet(OP,this).value,i);signature_manager_assertClassBrand(Pw,this,signature_manager_finish).call(this)}var ww={_:null},Fw=new WeakMap,bw=new WeakMap,yw=new WeakMap,Sw=new WeakMap,Cw=new WeakMap,xw=new WeakMap,kw=new WeakMap,Ew=new WeakSet;class EditDescriptionDialog{constructor(e,t){let{dialog:i,description:a,cancelButton:s,updateButton:n,editSignatureView:r}=e;signature_manager_classPrivateMethodInitSpec(this,Ew);signature_manager_classPrivateFieldInitSpec(this,Fw,void 0);signature_manager_classPrivateFieldInitSpec(this,bw,void 0);signature_manager_classPrivateFieldInitSpec(this,yw,void 0);signature_manager_classPrivateFieldInitSpec(this,Sw,void 0);signature_manager_classPrivateFieldInitSpec(this,Cw,void 0);signature_manager_classPrivateFieldInitSpec(this,xw,void 0);signature_manager_classPrivateFieldInitSpec(this,kw,void 0);const o=signature_manager_classPrivateFieldSet(yw,this,a.firstElementChild);signature_manager_classPrivateFieldSet(xw,this,r);signature_manager_classPrivateFieldSet(Sw,this,i);signature_manager_classPrivateFieldSet(Cw,this,t);i.addEventListener("close",signature_manager_assertClassBrand(Ew,this,_close2).bind(this));i.addEventListener("contextmenu",e=>{e.target!==signature_manager_classPrivateFieldGet(yw,this)&&e.preventDefault()});s.addEventListener("click",signature_manager_assertClassBrand(Ew,this,_cancel2).bind(this));n.addEventListener("click",signature_manager_assertClassBrand(Ew,this,_update).bind(this));const l=a.lastElementChild;l.addEventListener("click",()=>{o.value="";l.disabled=!0;n.disabled=""===signature_manager_classPrivateFieldGet(bw,this)});o.addEventListener("input",()=>{const{value:e}=o;l.disabled=""===e;n.disabled=e===signature_manager_classPrivateFieldGet(bw,this);r.setAttribute("aria-label",e)},{passive:!0});t.register(i)}async open(e){signature_manager_classPrivateFieldSet(kw,this,e._uiManager);signature_manager_classPrivateFieldSet(Fw,this,e);signature_manager_classPrivateFieldSet(bw,this,signature_manager_classPrivateFieldGet(yw,this).value=e.description);signature_manager_classPrivateFieldGet(yw,this).dispatchEvent(new Event("input"));signature_manager_classPrivateFieldGet(kw,this).removeEditListeners();const{areContours:t,outline:i}=e.getSignaturePreview(),a=(new DOMSVGFactory).createElement("path");signature_manager_classPrivateFieldGet(xw,this).append(a);signature_manager_classPrivateFieldGet(xw,this).setAttribute("viewBox",i.viewBox);a.setAttribute("d",i.toSVGPath());t&&a.classList.add("contours");await signature_manager_classPrivateFieldGet(Cw,this).open(signature_manager_classPrivateFieldGet(Sw,this))}}async function _update(){signature_manager_classPrivateFieldGet(Fw,this)._reportTelemetry({action:"pdfjs.signature.edit_description",data:{hasBeenChanged:!0}});signature_manager_classPrivateFieldGet(Fw,this).description=signature_manager_classPrivateFieldGet(yw,this).value;signature_manager_assertClassBrand(Ew,this,signature_manager_finish2).call(this)}function _cancel2(){signature_manager_classPrivateFieldGet(Fw,this)._reportTelemetry({action:"pdfjs.signature.edit_description",data:{hasBeenChanged:!1}});signature_manager_assertClassBrand(Ew,this,signature_manager_finish2).call(this)}function signature_manager_finish2(){signature_manager_classPrivateFieldGet(Cw,this).closeIfActive(signature_manager_classPrivateFieldGet(Sw,this))}function _close2(){signature_manager_classPrivateFieldGet(kw,this)?.addEditListeners();signature_manager_classPrivateFieldSet(kw,this,null);signature_manager_classPrivateFieldSet(Fw,this,null);signature_manager_classPrivateFieldGet(xw,this).firstElementChild.remove()}function web_toolbar_classPrivateFieldInitSpec(e,t,i){web_toolbar_checkPrivateRedeclaration(e,t),t.set(e,i)}function web_toolbar_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function web_toolbar_classPrivateFieldGet(e,t){return e.get(web_toolbar_assertClassBrand(e,t))}function toolbar_classPrivateFieldSet(e,t,i){return e.set(web_toolbar_assertClassBrand(e,t),i),i}function web_toolbar_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Aw=new WeakMap,Gw=new WeakMap,Bw=new WeakMap,Mw=new WeakMap,Iw=new WeakMap,Tw=new WeakSet;class Toolbar{constructor(e,t,i,a,s){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;!function toolbar_classPrivateMethodInitSpec(e,t){web_toolbar_checkPrivateRedeclaration(e,t),t.add(e)}(this,Tw);web_toolbar_classPrivateFieldInitSpec(this,Aw,null);web_toolbar_classPrivateFieldInitSpec(this,Gw,void 0);web_toolbar_classPrivateFieldInitSpec(this,Bw,Dc);web_toolbar_classPrivateFieldInitSpec(this,Mw,25);web_toolbar_classPrivateFieldInitSpec(this,Iw,Lc);toolbar_classPrivateFieldSet(Gw,this,e);toolbar_classPrivateFieldSet(Bw,this,i);toolbar_classPrivateFieldSet(Mw,this,s);toolbar_classPrivateFieldSet(Iw,this,a);this.eventBus=t;const r=[{element:e.previous,eventName:"previouspage"},{element:e.next,eventName:"nextpage"},{element:e.print,eventName:"print"},{element:e.presentationModeButton,eventName:"presentationmode"},{element:e.download,eventName:"download"},{element:e.movePageUp,eventName:"movePageUp"},{element:e.movePageDown,eventName:"movePageDown"}];web_toolbar_assertClassBrand(Tw,this,toolbar_bindListeners).call(this,r);web_toolbar_assertClassBrand(Tw,this,_updateToolbarDensity).call(this,{value:n});this.reset()}get maxZoom(){return web_toolbar_classPrivateFieldGet(Mw,this)}set maxZoom(e){toolbar_classPrivateFieldSet(Mw,this,e)}get minZoom(){return web_toolbar_classPrivateFieldGet(Iw,this)}set minZoom(e){toolbar_classPrivateFieldSet(Iw,this,e)}setPageNumber(e,t){this.pageNumber=e;this.pageLabel=t;web_toolbar_assertClassBrand(Tw,this,toolbar_updateUIState).call(this,!1)}setPagesCount(e,t){this.pagesCount=e;this.hasPageLabels=t;web_toolbar_assertClassBrand(Tw,this,toolbar_updateUIState).call(this,!0)}setPageScale(e,t){this.pageScaleValue=(e||t).toString();this.pageScale=t;web_toolbar_assertClassBrand(Tw,this,toolbar_updateUIState).call(this,!1)}reset(){toolbar_classPrivateFieldSet(Aw,this,null);this.pageNumber=0;this.pageLabel=null;this.hasPageLabels=!1;this.pagesCount=0;const e=web_toolbar_classPrivateFieldGet(Bw,this)||Dc;this.pageScaleValue=e;Number(e)&&(this.pageScale=Number(e));web_toolbar_assertClassBrand(Tw,this,toolbar_updateUIState).call(this,!0);this.updateLoadingIndicatorState();web_toolbar_assertClassBrand(Tw,this,_editorModeChanged).call(this,{mode:f.DISABLE})}updateLoadingIndicatorState(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{pageNumber:t}=web_toolbar_classPrivateFieldGet(Gw,this);t.classList.toggle("loading",e)}}function _updateToolbarDensity(e){let{value:t}=e,i="normal";switch(t){case 1:i="compact";break;case 2:i="touch"}document.documentElement.setAttribute("data-toolbar-density",i)}function toolbar_bindListeners(e){const{eventBus:t}=this,{editorHighlightColorPicker:i,editorHighlightButton:a,pageNumber:s,scaleSelect:n}=web_toolbar_classPrivateFieldGet(Gw,this),r=this;for(const{element:i,eventName:a,eventDetails:s,telemetry:n}of e)i&&i.addEventListener("click",e=>{null!==a&&t.dispatch(a,{source:this,...s,isFromKeyboard:0===e.detail});n&&t.dispatch("reporttelemetry",{source:this,details:n})});s.addEventListener("click",function(){this.select()});s.addEventListener("change",function(){t.dispatch("pagenumberchanged",{source:r,value:this.value})});t._on("pagesedited",e=>{let{pagesMapper:t}=e;const i=t.pagesNumber;i!==this.pagesCount&&this.setPagesCount(i,this.hasPageLabels)});n.addEventListener("change",function(){"custom"!==this.value&&t.dispatch("scalechanged",{source:r,value:this.value})});n.addEventListener("click",function(e){let{target:t}=e;this.value===r.pageScaleValue&&"OPTION"===t.tagName.toUpperCase()&&this.blur()});n.oncontextmenu=noContextMenu;t._on("annotationeditormodechanged",web_toolbar_assertClassBrand(Tw,this,_editorModeChanged).bind(this));t._on("closeopenpopovers",e=>{let{source:i}=e;i!==this&&t.dispatch("switchannotationeditormode",{source:this,mode:f.NONE})});t._on("showannotationeditorui",e=>{let{mode:t}=e;if(t===f.HIGHLIGHT)a.click()});t._on("toolbardensity",web_toolbar_assertClassBrand(Tw,this,_updateToolbarDensity).bind(this));t._on("spreadmodechanged",()=>{web_toolbar_assertClassBrand(Tw,this,toolbar_updateUIState).call(this,!1)});t._on("scrollmodechanged",()=>{web_toolbar_assertClassBrand(Tw,this,toolbar_updateUIState).call(this,!1)});if(i){t._on("annotationeditoruimanager",e=>{let{uiManager:t}=e;const a=toolbar_classPrivateFieldSet(Aw,this,new ColorPicker({uiManager:t}));t.setMainHighlightColorPicker(a);i.append(a.renderMainDropdown())});t._on("mainhighlightcolorpickerupdatecolor",e=>{let{value:t}=e;web_toolbar_classPrivateFieldGet(Aw,this)?.updateColor(t)})}}function _editorModeChanged(e){let{mode:t}=e;t!==f.NONE&&t!==f.DISABLE&&this.eventBus.dispatch("closeopenpopovers",{source:this});const{editorCommentButton:i,editorCommentParamsToolbar:a,editorFreeTextButton:s,editorFreeTextParamsToolbar:n,editorHighlightButton:r,editorHighlightParamsToolbar:o,editorInkButton:l,editorInkParamsToolbar:d,editorStampButton:c,editorStampParamsToolbar:h,editorSignatureButton:u,editorSignatureParamsToolbar:_}=web_toolbar_classPrivateFieldGet(Gw,this);toggleExpandedBtn(i,t===f.POPUP,a);toggleExpandedBtn(s,t===f.FREETEXT,n);toggleExpandedBtn(r,t===f.HIGHLIGHT,o);toggleExpandedBtn(l,t===f.INK,d);toggleExpandedBtn(c,t===f.STAMP,h);toggleExpandedBtn(u,t===f.SIGNATURE,_);const p=t===f.DISABLE;i&&(i.disabled=p);s&&(s.disabled=p);r&&(r.disabled=p);l&&(l.disabled=p);c&&(c.disabled=p);u&&(u.disabled=p)}function toolbar_updateUIState(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{pageNumber:t,pagesCount:i,pageScaleValue:a,pageScale:s}=this,n=web_toolbar_classPrivateFieldGet(Gw,this);if(e){if(this.hasPageLabels){n.pageNumber.type="text";n.numPages.setAttribute("data-l10n-id","pdfjs-page-of-pages")}else{n.pageNumber.type="number";n.numPages.setAttribute("data-l10n-id","pdfjs-of-pages");n.numPages.setAttribute("data-l10n-args",JSON.stringify({pagesCount:i}))}n.pageNumber.max=i}if(this.hasPageLabels){n.pageNumber.value=this.pageLabel;n.numPages.setAttribute("data-l10n-args",JSON.stringify({pageNumber:t,pagesCount:i}))}else n.pageNumber.value=t;n.previous.disabled=t<=1;n.next.disabled=t>=i;const r=Number(this.minZoom)??Lc,o=Number(this.maxZoom)??25;n.zoomOut&&(n.zoomOut.disabled=s<=r);n.zoomIn&&(n.zoomIn.disabled=s>=o);let l=!1;if(n.scaleSelect.options)for(const e of n.scaleSelect.options){const t=parseFloat(e.value),i=parseFloat(a);if(!isNaN(t)&&!isNaN(i)&&Math.abs(t-i)<1e-4||e.value===a){e.selected=!0;l=!0}else e.selected=!1}l||(n.customScaleOption.selected=!0);const d="number"!=typeof s||Number.isNaN(s)?0:Math.round(1e4*s)/100;n.customScaleOption.setAttribute("data-l10n-args",JSON.stringify({scale:d}));this.eventBus.dispatch("updateuistate",{source:this,widget:"Toolbar",pageNumber:t,pagesCount:i,pageScaleValue:a,pageScale:s})}class ViewHistory{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20;this.fingerprint=e;this.cacheSize=t;this._initializedPromise=this._readFromStorage().then(e=>{const t=JSON.parse(e||"{}");let i=-1;if(Array.isArray(t.files)){for(;t.files.length>=this.cacheSize;)t.files.shift();for(let e=0,a=t.files.length;e<a;e++){if(t.files[e].fingerprint===this.fingerprint){i=e;break}}}else t.files=[];-1===i&&(i=t.files.push({fingerprint:this.fingerprint})-1);this.file=t.files[i];this.database=t})}async _writeToStorage(){if(AppOptions.get("disableHistory"))return;const e=JSON.stringify(this.database);try{localStorage.setItem("pdfjs.history",e)}catch(e){}}async _readFromStorage(){if(!AppOptions.get("disableHistory"))try{return localStorage.getItem("pdfjs.history")}catch(e){return}}async set(e,t){await this._initializedPromise;this.file[e]=t;return this._writeToStorage()}async setMultiple(e){await this._initializedPromise;for(const t in e)this.file[t]=e[t];return this._writeToStorage()}async get(e,t){await this._initializedPromise;const i=this.file[e];return void 0!==i?i:t}async getMultiple(e){await this._initializedPromise;const t=Object.create(null);for(const i in e){const a=this.file[i];t[i]=void 0!==a?a:e[i]}return t}}function views_manager_checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function views_manager_classPrivateFieldGet(e,t){return e.get(views_manager_assertClassBrand(e,t))}function views_manager_assertClassBrand(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}const Dw="viewsManagerResizing",Lw="pdfSidebarNotification";var Rw=new WeakMap,Nw=new WeakSet;class ViewsManager extends Sidebar{constructor(e){let{elements:{outerContainer:t,sidebarContainer:i,toggleButton:a,resizer:s,thumbnailButton:n,outlineButton:r,attachmentsButton:o,layersButton:l,thumbnailsView:d,outlinesView:c,attachmentsView:h,layersView:u,viewsManagerAddFileButton:_,viewsManagerCurrentOutlineButton:p,viewsManagerSelectorButton:g,viewsManagerSelectorOptions:f,viewsManagerHeaderLabel:m,viewsManagerStatus:v},eventBus:P,l10n:w,enableSplitMerge:b=!1,globalAbortSignal:y}=e;super({sidebar:i,resizer:s,toggleButton:a},"ltr"===w.getDirection(),!1,y);!function views_manager_classPrivateMethodInitSpec(e,t){views_manager_checkPrivateRedeclaration(e,t),t.add(e)}(this,Nw);!function views_manager_classPrivateFieldInitSpec(e,t,i){views_manager_checkPrivateRedeclaration(e,t),t.set(e,i)}(this,Rw,!window.matchMedia("(prefers-reduced-motion: reduce)").matches);this.isOpen=!1;this.active=Uc;this.isInitialViewSet=!1;this.isInitialEventDispatched=!1;this.onToggled=null;this.onUpdateThumbnails=null;this.outerContainer=t;this.sidebarContainer=i;this.toggleButton=a;this.resizer=s;this.thumbnailButton=n;this.outlineButton=r;this.attachmentsButton=o;this.layersButton=l;this.thumbnailsView=d;this.outlinesView=c;this.attachmentsView=h;this.layersView=u;this.viewsManagerAddFileButton=_;this.viewsManagerCurrentOutlineButton=p;this.viewsManagerHeaderLabel=m;this.viewsManagerStatus=v;this.eventBus=P;!b&&v&&(v.hidden=!0);this._enableSplitMerge=b;this.menu=f&&g?new Menu(f,g,[n,r,o,l]):null;Ow._||(Ow._=Object.freeze({pagesTitle:"pdfjs-views-manager-pages-title",outlinesTitle:"pdfjs-views-manager-outlines-title1",attachmentsTitle:"pdfjs-views-manager-attachments-title",layersTitle:"pdfjs-views-manager-layers-title1",notificationButton:"pdfjs-toggle-views-manager-notification-button",toggleButton:"pdfjs-toggle-views-manager-button"}));views_manager_assertClassBrand(Nw,this,views_manager_addEventListeners).call(this)}reset(){this.isInitialViewSet=!1;this.isInitialEventDispatched=!1;views_manager_assertClassBrand(Nw,this,_hideUINotification).call(this,!0);this.switchView(Uc);this.outlineButton.disabled=this.attachmentsButton.disabled=this.layersButton.disabled=!1;this.outlineButton.hidden=!1;this.attachmentsButton.hidden=!1;this.layersButton.hidden=!1;this.viewsManagerCurrentOutlineButton&&(this.viewsManagerCurrentOutlineButton.disabled=!0)}get visibleView(){return this.isOpen?this.active:Vc}setInitialView(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Vc;if(!this.isInitialViewSet){this.isInitialViewSet=!0;if(e!==Vc&&e!==jc){this.switchView(e,!0);this.isInitialEventDispatched||views_manager_assertClassBrand(Nw,this,_dispatchEvent).call(this)}else views_manager_assertClassBrand(Nw,this,_dispatchEvent).call(this)}}switchView(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=e!==this.active;let a=!1,s=null;switch(e){case Vc:this.isOpen&&this.close();return;case Uc:s="pagesTitle";this.isOpen&&i&&(a=!0);break;case zc:s="outlinesTitle";if(this.outlineButton.disabled)return;break;case Hc:s="attachmentsTitle";if(this.attachmentsButton.disabled)return;break;case $c:s="layersTitle";if(this.layersButton.disabled)return;break;default:ngx_console_NgxConsole.error(`PDFSidebar.switchView: "${e}" is not a valid view.`);return}this._enableSplitMerge&&this.viewsManagerStatus&&(this.viewsManagerStatus.hidden=e!==Uc);this.viewsManagerAddFileButton&&(this.viewsManagerAddFileButton.hidden=e!==Uc);this.viewsManagerCurrentOutlineButton&&(this.viewsManagerCurrentOutlineButton.hidden=e!==zc);this.viewsManagerHeaderLabel&&this.viewsManagerHeaderLabel.setAttribute("data-l10n-id",Ow._[s]||"");this.active=e;toggleSelectedBtn(this.thumbnailButton,e===Uc,this.thumbnailsView);toggleSelectedBtn(this.outlineButton,e===zc,this.outlinesView);toggleSelectedBtn(this.attachmentsButton,e===Hc,this.attachmentsView);toggleSelectedBtn(this.layersButton,e===$c,this.layersView);if(!t||this.isOpen){if(a){this.onUpdateThumbnails();this.onToggled()}i&&views_manager_assertClassBrand(Nw,this,_dispatchEvent).call(this)}else this.open()}open(){if(!this.isOpen&&this._sidebar){this.isOpen=!0;this.onResizing(this.width);this._sidebar.hidden=!1;toggleExpandedBtn(this.toggleButton,!0);this.switchView(this.active);if(views_manager_classPrivateFieldGet(Rw,this))queueMicrotask(()=>{this.outerContainer.classList.add("viewsManagerMoving","viewsManagerOpen")});else{this.outerContainer.classList.add("viewsManagerOpen");this.eventBus.dispatch("resize",{source:this,sidebarToggle:!0})}this.active===Uc&&this.onUpdateThumbnails();this.onToggled();views_manager_assertClassBrand(Nw,this,_dispatchEvent).call(this);views_manager_assertClassBrand(Nw,this,_hideUINotification).call(this)}}close(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.isOpen&&this._sidebar){this.isOpen=!1;this._sidebar.hidden=!0;toggleExpandedBtn(this.toggleButton,!1);this.outerContainer.classList.add("viewsManagerMoving");this.outerContainer.classList.remove("viewsManagerOpen");this.onToggled();views_manager_assertClassBrand(Nw,this,_dispatchEvent).call(this);this.eventBus.dispatch("resize",{source:this,sidebarToggle:!0});e?.detail>0&&this.toggleButton.blur()}}toggle(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;super.toggle();this.isOpen?this.close(e):this.open()}onStartResizing(){this.outerContainer.classList.add(Dw)}onStopResizing(){this.eventBus.dispatch("resize",{source:this});this.outerContainer.classList.remove(Dw)}onResizing(e){ih.setProperty("--viewsManager-width",`${e}px`)}}function _dispatchEvent(){this.isInitialViewSet&&(this.isInitialEventDispatched||=!0);this.eventBus.dispatch("sidebarviewchanged",{source:this,view:this.visibleView})}function _showUINotification(){this.toggleButton.setAttribute("data-l10n-id",Ow._.notificationButton);this.isOpen||this.toggleButton.classList.add(Lw)}function _hideUINotification(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(this.isOpen||e)&&this.toggleButton.classList.remove(Lw);e&&this.toggleButton.setAttribute("data-l10n-id",Ow._.toggleButton)}function views_manager_addEventListeners(){const{eventBus:e,outerContainer:t}=this;views_manager_classPrivateFieldGet(Rw,this)&&this.sidebarContainer&&this.sidebarContainer.addEventListener("transitionend",i=>{if(i.target===this.sidebarContainer){t.classList.remove("viewsManagerMoving");e.dispatch("resize",{source:this,sidebarToggle:!0})}});this.viewsManagerHeaderLabel?.addEventListener("dblclick",t=>{this.active!==zc?this.active===$c&&e.dispatch("resetlayers",{source:this}):e.dispatch("toggleoutlinetree",{source:this})});this.thumbnailButton?.addEventListener("click",()=>{this.switchView(Uc)});this.outlineButton?.addEventListener("click",()=>{this.switchView(zc)});this.attachmentsButton?.addEventListener("click",()=>{this.switchView(Hc)});this.layersButton?.addEventListener("click",()=>{this.switchView($c)});this.viewsManagerCurrentOutlineButton?.addEventListener("click",()=>{e.dispatch("currentoutlineitem",{source:this})});const onTreeLoaded=(e,t,i)=>{t.disabled=!e;t.hidden=!e;e?views_manager_assertClassBrand(Nw,this,_showUINotification).call(this):this.active===i&&this.switchView(Uc)};e._on("outlineloaded",e=>{onTreeLoaded(e.outlineCount,this.outlineButton,zc);e.currentOutlineItemPromise.then(e=>{this.isInitialViewSet&&this.viewsManagerCurrentOutlineButton&&(this.viewsManagerCurrentOutlineButton.disabled=!e)})});e._on("attachmentsloaded",e=>{onTreeLoaded(e.attachmentsCount,this.attachmentsButton,Hc)});e._on("layersloaded",e=>{onTreeLoaded(e.layersCount,this.layersButton,$c)});e._on("presentationmodechanged",e=>{e.state===Nc&&this.visibleView===Uc&&this.onUpdateThumbnails()})}var Ow={_:null};const Ww=-1,jw=1,Vw={initialBookmark:document.location.hash.substring(1),_initializedCapability:{...Promise.withResolvers(),settled:!1},appConfig:null,pdfDocument:null,pdfLoadingTask:null,printService:null,pdfViewer:null,pdfThumbnailViewer:null,pdfRenderingQueue:null,pdfPresentationMode:null,pdfDocumentProperties:null,pdfLinkService:null,pdfTextExtractor:null,pdfHistory:null,viewsManager:null,pdfOutlineViewer:null,pdfAttachmentViewer:null,pdfLayerViewer:null,pdfCursorTools:null,pdfScriptingManager:null,pdfWorker:null,store:null,downloadManager:null,overlayManager:null,preferences:new class Preferences extends BasePreferences{async _writeToStorage(e){try{localStorage.setItem("pdfjs.preferences",JSON.stringify(e))}catch(e){}}async _readFromStorage(e){try{return{prefs:JSON.parse(localStorage.getItem("pdfjs.preferences"))}}catch(e){return{}}}},toolbar:null,secondaryToolbar:null,eventBus:null,l10n:null,annotationEditorParams:null,imageAltTextSettings:null,isInitialViewSet:!1,isViewerEmbedded:window.parent!==window,url:"",baseUrl:"",mlManager:null,_downloadUrl:"",_eventBusAbortController:null,_windowAbortController:null,_globalAbortController:new AbortController,documentInfo:null,metadata:null,_contentDispositionFilename:null,_contentLength:null,_saveInProgress:!1,_wheelUnusedTicks:0,_wheelUnusedFactor:1,_touchManager:null,_touchUnusedTicks:0,_touchUnusedFactor:1,_PDFBug:null,_hasAnnotationEditors:!1,_title:document.title,_printAnnotationStoragePromise:null,_isCtrlKeyDown:!1,_caretBrowsing:null,_isScrolling:!1,editorUndoBar:null,pageOrder:null,_printPermissionPromise:null,async initialize(e){this.appConfig=e;this.cspPolicyService=e.cspPolicyService;try{await this.preferences.initializedPromise}catch(e){ngx_console_NgxConsole.error("initialize:",e)}AppOptions.get("pdfBugEnabled")&&await this._parseHashParams();let t;switch(AppOptions.get("viewerCssTheme")){case 1:t="light";break;case 2:t="dark"}t&&ih.setProperty("color-scheme",t);this.l10n=await this.externalServices.createL10n();document.getElementsByTagName("html")[0].dir=this.l10n.getDirection();this.l10n.translate(e.appContainer||document.documentElement);this.isViewerEmbedded&&AppOptions.get("externalLinkTarget")===dh.NONE&&AppOptions.set("externalLinkTarget",dh.TOP);await this._initializeViewerComponents();this.bindEvents();this.bindWindowEvents();this._initializedCapability.settled=!0;this._initializedCapability.resolve();this.initializeLoadingBar()},async _parseHashParams(){const e=document.location.hash.substring(1);if(!e)return;const{mainContainer:t,viewerContainer:i}=this.appConfig,a=parseQueryString(e),loadPDFBug=async()=>{if(this._PDFBug)return;const{PDFBug:e}=await import(
/*webpackIgnore: true*/
/*@vite-ignore*/
AppOptions.get("debuggerSrc"));this._PDFBug=e};if("true"===a.get("disableworker"))try{GlobalWorkerOptions.workerSrc||=AppOptions.get("workerSrc");await import(
/*webpackIgnore: true*/
/*@vite-ignore*/
PDFWorker.workerSrc);AppOptions.set("workerPort",null)}catch(e){ngx_console_NgxConsole.error("_parseHashParams:",e)}if(a.has("textlayer"))switch(a.get("textlayer")){case"off":AppOptions.set("textLayerMode",qc);break;case"visible":case"shadow":case"hover":i.classList.add(`textLayer-${a.get("textlayer")}`);try{await loadPDFBug();this._PDFBug.loadCSS()}catch(e){ngx_console_NgxConsole.error("_parseHashParams:",e)}}if(a.has("pdfbug")){const e=a.get("pdfbug").split(",");try{await loadPDFBug();this._PDFBug.init(t,e)}catch(e){ngx_console_NgxConsole.error("_parseHashParams:",e)}const i={pdfBug:!0,fontExtraProperties:!0};globalThis.StepperManager?.enabled&&(i.minDurationToUpdateCanvas=0);AppOptions.setAll(i)}a.has("locale")&&AppOptions.set("localeProperties",{lang:a.get("locale")});const s={disableAutoFetch:e=>"true"===e,disableFontFace:e=>"true"===e,disableHistory:e=>"true"===e,disableRange:e=>"true"===e,disableStream:e=>"true"===e,verbosity:e=>0|e};for(const e in s){const t=s[e],i=e.toLowerCase();a.has(i)&&AppOptions.set(e,t(a.get(i)))}},async _initializeViewerComponents(){const{appConfig:e,externalServices:t,l10n:i,mlManager:a}=this,s=this._globalAbortController.signal,n=new EventBus;this.eventBus=AppOptions.eventBus=n;a?.setEventBus(n,s);const r=this.overlayManager=new OverlayManager,o=this.pdfRenderingQueue=new PDFRenderingQueue;o.onIdle=this._cleanup.bind(this);const l=this.pdfLinkService=new PDFLinkService({eventBus:n,externalLinkTarget:AppOptions.get("externalLinkTarget"),externalLinkRel:AppOptions.get("externalLinkRel"),ignoreDestinationZoom:AppOptions.get("ignoreDestinationZoom")}),d=this.downloadManager=new DownloadManager;let c=PDFFindController;AppOptions.get("findController")&&(c=AppOptions.get("findController"));const h=new c({linkService:l,eventBus:n,pageViewMode:AppOptions.get("pageViewMode"),updateMatchesCountOnProgress:!0,listenToEventBus:!1});this.customFindController=h;const u=new c({linkService:l,eventBus:n,pageViewMode:AppOptions.get("pageViewMode"),updateMatchesCountOnProgress:!0,listenToEventBus:!0});this.findController=u;const _=this.pdfScriptingManager=new PDFScriptingManager({eventBus:n,externalServices:t,docProperties:this._scriptingDocProperties.bind(this)}),p=e.mainContainer,g=e.viewerContainer,m=AppOptions.get("annotationEditorMode"),v=AppOptions.get("forcePageColors")||window.matchMedia("(forced-colors: active)").matches,P=v?{background:AppOptions.get("pageColorsBackground"),foreground:AppOptions.get("pageColorsForeground")}:null,w=AppOptions.get("enableSplitMerge");let b;b=AppOptions.get("enableUpdatedAddImage")?e.newAltTextDialog?new NewAltTextManager(e.newAltTextDialog,r,n):null:e.altTextDialog?new AltTextManager(e.altTextDialog,p,r,n):null;e.editorUndoBar&&(this.editorUndoBar=new EditorUndoBar(e.editorUndoBar,n));const y=AppOptions.get("enableSignatureEditor")&&e.addSignatureDialog?new SignatureManager(e.addSignatureDialog,e.editSignatureDialog,e.annotationEditorParams?.editorSignatureAddSignature||null,r,i,t.createSignatureStorage(n,s),n):null,S=AppOptions.get("enableComment")&&e.editCommentDialog?new CommentManager(e.editCommentDialog,{learnMoreUrl:AppOptions.get("commentLearnMoreUrl"),sidebar:e.annotationEditorParams?.editorCommentsSidebar||null,sidebarResizer:e.annotationEditorParams?.editorCommentsSidebarResizer||null,commentsList:e.annotationEditorParams?.editorCommentsSidebarList||null,commentCount:e.annotationEditorParams?.editorCommentsSidebarCount||null,sidebarTitle:e.annotationEditorParams?.editorCommentsSidebarTitle||null,closeButton:e.annotationEditorParams?.editorCommentsSidebarCloseButton||null,commentToolbarButton:e.toolbar?.editorCommentButton||null},n,l,r,"ltr"===i.getDirection(),v,s):null,C=AppOptions.get("maxCanvasPixels"),x=AppOptions.get("maxCanvasDim"),k=AppOptions.get("capCanvasAreaFactor"),E=this.pdfViewer=new PDFViewer({container:p,viewer:g,viewerAlert:e.viewerAlert,eventBus:n,renderingQueue:o,linkService:l,downloadManager:d,altTextManager:b,commentManager:S,signatureManager:y,editorUndoBar:this.editorUndoBar,findController:u,customFindController:h,scriptingManager:AppOptions.get("enableScripting")&&_,l10n:i,textLayerMode:AppOptions.get("textLayerMode"),annotationMode:AppOptions.get("annotationMode"),annotationEditorMode:m,annotationEditorHighlightColors:AppOptions.get("highlightEditorColors"),enableHighlightFloatingButton:AppOptions.get("enableHighlightFloatingButton"),enableUpdatedAddImage:AppOptions.get("enableUpdatedAddImage"),enableNewAltTextWhenAddingImage:AppOptions.get("enableNewAltTextWhenAddingImage"),imageResourcesPath:AppOptions.get("imageResourcesPath"),removePageBorders:AppOptions.get("removePageBorders"),enablePrintAutoRotate:AppOptions.get("enablePrintAutoRotate"),maxCanvasPixels:C,maxCanvasDim:x,capCanvasAreaFactor:k,enableDetailCanvas:AppOptions.get("enableDetailCanvas"),pageViewMode:AppOptions.get("pageViewMode"),enablePermissions:AppOptions.get("enablePermissions"),enableOptimizedPartialRendering:AppOptions.get("enableOptimizedPartialRendering"),imagesRightClickMinSize:AppOptions.get("imagesRightClickMinSize"),pageColors:P,mlManager:a,abortSignal:s,defaultCacheSize:AppOptions.get("defaultCacheSize"),minZoom:AppOptions.get("minZoom"),maxZoom:AppOptions.get("maxZoom"),cspPolicyService:this.cspPolicyService,supportsPinchToZoom:this.supportsPinchToZoom,enableAutoLinking:AppOptions.get("enableAutoLinking"),minDurationToUpdateCanvas:AppOptions.get("minDurationToUpdateCanvas")});o.setViewer(E);l.setViewer(E);_.setViewer(E);if(e.viewsManager?.thumbnailsView){const{viewsManager:t}=e;this.pdfThumbnailViewer=new PDFThumbnailViewer({container:t.thumbnailsView,eventBus:n,renderingQueue:o,linkService:l,maxCanvasPixels:C,maxCanvasDim:x,pageColors:P,abortSignal:s,enableSplitMerge:w,enablePageReordering:AppOptions.get("enablePageReordering"),enableNewBadge:AppOptions.get("enableNewBadge"),statusBar:t.viewsManagerStatusBar,undoBar:t.viewsManagerUndoBar,manageMenu:t.manageMenu,addFileButton:t.viewsManagerAddFileButton});o.setThumbnailViewer(this.pdfThumbnailViewer)}if(!this.isViewerEmbedded&&!AppOptions.get("disableHistory")){this.pdfHistory=new PDFHistory({linkService:l,eventBus:n});l.setHistory(this.pdfHistory)}!this.supportsIntegratedFind&&e.findBar&&(this.findBar=new PDFFindBar(e.findBar,e.principalContainer,n));if(e.annotationEditorParams)if(m!==f.DISABLE){const t=e.toolbar?.editorSignatureButton;t&&AppOptions.get("enableSignatureEditor")&&(t.parentElement.hidden=!1);const i=document.getElementById("movePageUp"),a=document.getElementById("movePageDown");if(i&&a)if(AppOptions.get("enablePageReordering")){i.hidden=!1;a.hidden=!1}else{i.hidden=!0;a.hidden=!0}const s=e.toolbar?.editorCommentButton;s&&AppOptions.get("enableComment")&&(s.parentElement.hidden=!1);this.annotationEditorParams=new AnnotationEditorParams(e.annotationEditorParams,n)}else for(const e of["editorModeButtons","editorModeSeparator"])document.getElementById(e)?.classList.add("hidden");a&&e.secondaryToolbar?.imageAltTextSettingsButton&&(this.imageAltTextSettings=new ImageAltTextSettings(e.altTextSettingsDialog,r,n,a));e.documentProperties&&(this.pdfDocumentProperties=new PDFDocumentProperties(e.documentProperties,r,n,i,()=>this._docFilename,()=>this._docTitle));e.secondaryToolbar?.cursorHandToolButton&&(this.pdfCursorTools=new PDFCursorTools({container:p,eventBus:n,cursorToolOnLoad:AppOptions.get("cursorToolOnLoad")}));e.toolbar&&(this.toolbar=new Toolbar(e.toolbar,n,AppOptions.get("defaultZoomValue"),AppOptions.get("minZoom"),AppOptions.get("maxZoom"),AppOptions.get("toolbarDensity")));if(e.secondaryToolbar){if(AppOptions.get("enableAltText")){e.secondaryToolbar.imageAltTextSettingsButton?.classList.remove("hidden");e.secondaryToolbar.imageAltTextSettingsSeparator?.classList.remove("hidden")}this.secondaryToolbar=new SecondaryToolbar(e.secondaryToolbar,n)}this.supportsFullscreen&&(e.toolbar?.presentationModeButton||e.secondaryToolbar?.presentationModeButton)&&(this.pdfPresentationMode=new PDFPresentationMode({container:p,pdfViewer:E,eventBus:n}));const A=AppOptions.get("passwordPrompt");A?this.passwordPrompt=A:e.passwordOverlay&&(this.passwordPrompt=new PasswordPrompt(e.passwordOverlay,r,this.isViewerEmbedded));e.viewsManager?.outlinesView&&(this.pdfOutlineViewer=new PDFOutlineViewer({container:e.viewsManager.outlinesView,eventBus:n,l10n:i,linkService:l,downloadManager:d}));e.viewsManager?.attachmentsView&&(this.pdfAttachmentViewer=new PDFAttachmentViewer({container:e.viewsManager.attachmentsView,eventBus:n,l10n:i,downloadManager:d}));e.viewsManager?.layersView&&(this.pdfLayerViewer=new PDFLayerViewer({container:e.viewsManager.layersView,eventBus:n,l10n:i}));if(e.viewsManager){this.viewsManager=new ViewsManager({elements:e.viewsManager,eventBus:n,l10n:i,enableSplitMerge:w,globalAbortSignal:s});this.viewsManager.onToggled=this.forceRendering.bind(this);this.viewsManager.onUpdateThumbnails=()=>{for(const e of E.getCachedPageViews())e.renderingState===Yg.FINISHED&&this.pdfThumbnailViewer.getThumbnail(e.id-1)?.setImage(e);this.pdfThumbnailViewer.scrollThumbnailIntoView(E.currentPageNumber)}}},async run(e){await this.initialize(e);const{appConfig:t,eventBus:i}=this;let a;a=parseQueryString(document.location.search.substring(1)).get("file")??AppOptions.get("defaultUrl");try{a=new URL(a).href}catch{a=encodeURIComponent(a).replaceAll("%2F","/")}validateFileURL(a);const s=this._openFileInput=document.createElement("input");s.id="fileInput";s.className="ngx-extended-pdf-viewer-file-input";s.hidden=!0;s.type="file";s.value=null;s.accept=".pdf,application/pdf";document.body.append(s);s.addEventListener("change",function(e){const{files:t}=e.target;t&&0!==t.length&&i.dispatch("fileinputchange",{source:this,fileInput:e.target})});t.mainContainer.addEventListener("dragover",function(e){if(AppOptions.get("enableDragAndDrop")){if(!e.dataTransfer?.items)return;for(const t of e.dataTransfer.items)if("application/pdf"===t.type){e.dataTransfer.dropEffect="copy"===e.dataTransfer.effectAllowed?"copy":"move";stopEvent(e);return}}});t.mainContainer.addEventListener("drop",function(e){if(AppOptions.get("enableDragAndDrop")){const t=e.dataTransfer?.files;if(!t||0===t.length||"application/pdf"!==t[0].type)return;stopEvent(e);i.dispatch("fileinputchange",{source:this,fileInput:e.dataTransfer,dropEvent:e})}});if(!AppOptions.get("supportsDocumentFonts")){AppOptions.set("disableFontFace",!0);this.l10n.get("pdfjs-web-fonts-disabled").then(e=>{ngx_console_NgxConsole.warn(e)})}const togglePrintingButtons=e=>{t.toolbar?.print?.classList.toggle("hidden",!e);t.secondaryToolbar?.printButton?.classList.toggle("hidden",!e)};this.supportsPrinting?i.on("printingallowed",e=>{let{isAllowed:t}=e;return togglePrintingButtons(t)}):togglePrintingButtons(!1);if(!this.supportsFullscreen){t.toolbar.presentationModeButton.classList.add("hidden");t.secondaryToolbar?.presentationModeButton?.classList.add("hidden")}this.supportsIntegratedFind&&t.findBar?.toggleButton?.classList.add("hidden");a?this.open({url:a}):this._hideViewBookmark();const n=new CustomEvent("webviewerinitialized",{bubbles:!0,cancelable:!0,detail:{source:window}});document.dispatchEvent(n)},get externalServices(){return shadow(this,"externalServices",new ExternalServices)},get initialized(){return this._initializedCapability.settled},get initializedPromise(){return this._initializedCapability.promise},updateZoom(e,t,i){this.pdfViewer.isInPresentationMode||this.pdfViewer.updateScale({drawingDelay:AppOptions.get("defaultZoomDelay"),steps:e,scaleFactor:t,origin:i})},zoomIn(){this.updateZoom(1)},zoomOut(){this.updateZoom(-1)},zoomReset(){this.pdfViewer.isInPresentationMode||(this.pdfViewer.currentScaleValue=Dc)},touchPinchCallback(e,t,i){if(this.supportsPinchToZoom){const a=this._accumulateFactor(this.pdfViewer.currentScale,i/t,"_touchUnusedFactor");this.updateZoom(null,a,e)}else{const a=30,s=this._accumulateTicks((i-t)/a,"_touchUnusedTicks");this.updateZoom(s,null,e)}},touchPinchEndCallback(){this._touchUnusedTicks=0;this._touchUnusedFactor=1},get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0},get page(){return this.pdfViewer.currentPageNumber},set page(e){this.pdfViewer.currentPageNumber=e},get supportsPrinting(){return shadow(this,"supportsPrinting",AppOptions.get("supportsPrinting")&&PDFPrintServiceFactory.supportsPrinting)},get supportsFullscreen(){return shadow(this,"supportsFullscreen",document.fullscreenEnabled)},get supportsPinchToZoom(){return shadow(this,"supportsPinchToZoom",AppOptions.get("supportsPinchToZoom"))},get supportsIntegratedFind(){return shadow(this,"supportsIntegratedFind",AppOptions.get("supportsIntegratedFind"))},initializeLoadingBar(){const e=document.getElementById("loadingBar"),t=e?new ProgressBar(e):null;t?.hide();return shadow(this,"loadingBar",t)},get supportsMouseWheelZoomCtrlKey(){return shadow(this,"supportsMouseWheelZoomCtrlKey",AppOptions.get("supportsMouseWheelZoomCtrlKey"))},get supportsMouseWheelZoomMetaKey(){return shadow(this,"supportsMouseWheelZoomMetaKey",AppOptions.get("supportsMouseWheelZoomMetaKey"))},get supportsCaretBrowsingMode(){return AppOptions.get("supportsCaretBrowsingMode")},moveCaret(e,t){this._caretBrowsing||=new CaretBrowsingMode(this._globalAbortController.signal,this.appConfig.mainContainer,this.appConfig.viewerContainer,this.appConfig.toolbar?.container);this._caretBrowsing.moveCaret(e,t)},setTitleUsingUrl(){},setTitle(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._title;this._title=e;if(this.isViewerEmbedded)return;const t=this._hasChanges()&&!this.pdfRenderingQueue.printing;document.title=`${t?"* ":""}${e}`},get _docFilename(){return this._contentDispositionFilename||getPdfFilenameFromUrl(this.url,Vw.appConfig.filenameForDownload)},get _docTitle(){const{documentInfo:e,metadata:t}=this,i=t?.get("dc:title");return i&&"Untitled"!==i&&!/[\uFFF0-\uFFFF]/g.test(i)?i:e.Title},_hideViewBookmark(){if(!this.appConfig)return;const{secondaryToolbar:e}=this.appConfig;e?.viewBookmarkButton.classList.add("hidden");e?.presentationModeButton?.classList.contains("hidden")&&document.getElementById("viewBookmarkSeparator")?.classList.add("hidden")},async close(){this._unblockDocumentLoadEvent();this._hideViewBookmark();if(!this.pdfLoadingTask)return;if(this._hasChanges()&&this._hasRealAnnotationChanges())try{await this.downloadOrSave()}catch{}const e=[];e.push(this.pdfLoadingTask.destroy());this.pdfLoadingTask=null;if(this.pdfDocument){this.pdfDocument=null;this.pdfThumbnailViewer?.setDocument(null);this.pdfViewer.setDocument(null);this.pdfLinkService.setDocument(null);this.pdfDocumentProperties?.setDocument(null)}this.pdfLinkService.externalLinkEnabled=!0;this.store=null;this.isInitialViewSet=!1;this.url="";this.baseUrl="";this._downloadUrl="";this.documentInfo=null;this.metadata=null;this._contentDispositionFilename=null;this._contentLength=null;this._saveInProgress=!1;this._hasAnnotationEditors=!1;e.push(this.pdfScriptingManager.destroyPromise,this.passwordPrompt.close());this.setTitle();this.viewsManager?.reset();this.pdfOutlineViewer?.reset();this.pdfAttachmentViewer?.reset();this.pdfLayerViewer?.reset();this.pdfHistory?.reset();this.findBar?.reset();this.toolbar?.reset();this.secondaryToolbar?.reset();this._PDFBug?.cleanup();await Promise.all(e)},async open(e){this.pdfViewer?.destroyBookMode();this.pdfLoadingTask&&await this.close();const t=AppOptions.getAll(ir);t.cspPolicyService=e.cspPolicyService;if(e.workerSrc&&e.workerSrc!==t.workerSrc){t.workerSrc=e.workerSrc;this.pdfWorker=null}Object.assign(GlobalWorkerOptions,t);t.port=t.port??GlobalWorkerOptions.workerPort;t.cspPolicyService=this.cspPolicyService;null===this.pdfWorker&&(this.pdfWorker=t.port?PDFWorker.fromPort(t):new PDFWorker(t));e.url&&this.setTitleUsingUrl(e.originalUrl||e.url,e.url);const i=getDocument({...AppOptions.getAll(tr),...e,worker:this.pdfWorker,cspPolicyService:e.cspPolicyService});this.pdfLoadingTask=i;i.onPassword=(e,t)=>{this.isViewerEmbedded&&this._unblockDocumentLoadEvent();this.pdfLinkService.externalLinkEnabled=!1;this.passwordPrompt.setUpdateCallback(e,t);this.passwordPrompt.open()};i.onProgress=e=>{this.progress(e.percent);this.eventBus?.dispatch("progress",{source:this,type:"load",total:e.total,loaded:e.loaded,percent:e.percent})};const a=this.serviceWorkerOptions.showUnverifiedSignatures;return i.promise.then(e=>{e._transport.messageHandler.send("showUnverifiedSignatures",a);this.load(e)},e=>{if(i!==this.pdfLoadingTask)return;this.loadingBar&&(this.loadingBar.percent||=0);let t="pdfjs-loading-error";e instanceof InvalidPDFException?t="pdfjs-invalid-file-error":e instanceof ResponseException&&(t=e.missing?"pdfjs-missing-file-error":"pdfjs-unexpected-response-error");Vw.onError&&Vw.onError(e);return this._documentError(t,{message:e.message}).then(()=>{throw e})})},async download(){let e;try{e=await(this.pdfDocument?this.pdfDocument.getData():this.pdfLoadingTask.getData())}catch{}this.downloadManager.download(e,this._downloadUrl,this._docFilename)},async save(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this._saveInProgress)return;this._saveInProgress=!0;await this.pdfScriptingManager.dispatchWillSave();try{const t=await this.pdfDocument.saveDocument(e);this.downloadManager.download(t,this._downloadUrl,this._docFilename)}catch(e){ngx_console_NgxConsole.error("Error when saving the document:",e);await this.download()}finally{await this.pdfScriptingManager.dispatchDidSave();this._saveInProgress=!1}const t=this.pdfDocument?.annotationStorage.editorStats;t&&this.externalServices.reportTelemetry({type:"editing",data:{type:"save",stats:t}})},async downloadOrSave(){const{classList:e}=this.appConfig.appContainer;e.add("wait");if(this.pdfThumbnailViewer?.hasStructuralChanges()){this.externalServices.reportTelemetry({type:"pageOrganization",data:{action:"save"}});await this.onSavePages({data:this.pdfThumbnailViewer.getStructuralChanges()})}else{const e=this.pdfDocument?.annotationStorage.size>0||!this.pageOrder.every((e,t,i)=>0===t||e>=i[t-1]);await(e?this.save(this.pageOrder):this.download())}e.remove("wait")},movePageUp(e){if(!(e.source.pageNumber<=1)){this.pdfViewer.swapPages(e.source.pageNumber-1,e.source.pageNumber-2);this.pdfThumbnailViewer.swapThumbnails(e.source.pageNumber-1,e.source.pageNumber-2);this.page=e.source.pageNumber-1;[this.pageOrder[e.source.pageNumber-2],this.pageOrder[e.source.pageNumber-1]]=[this.pageOrder[e.source.pageNumber-1],this.pageOrder[e.source.pageNumber-2]]}},movePageDown(e){if(e.source.pageNumber!==this.pdfDocument.numPages){this.pdfViewer.swapPages(e.source.pageNumber-1,e.source.pageNumber);this.pdfThumbnailViewer.swapThumbnails(e.source.pageNumber-1,e.source.pageNumber);this.page=e.source.pageNumber+1;[this.pageOrder[e.source.pageNumber-1],this.pageOrder[e.source.pageNumber]]=[this.pageOrder[e.source.pageNumber],this.pageOrder[e.source.pageNumber-1]]}},movePage(e,t){if(e<1||e>this.pdfDocument.numPages||t<1||t>this.pdfDocument.numPages)return;const i=e-1,a=t-1;if(i<a)for(let e=i;e<a;e++){this.pdfViewer.swapPages(e,e+1);this.pdfThumbnailViewer.swapThumbnails(e,e+1);[this.pageOrder[e],this.pageOrder[e+1]]=[this.pageOrder[e+1],this.pageOrder[e]]}else if(i>a)for(let e=i;e>a;e--){this.pdfViewer.swapPages(e,e-1);this.pdfThumbnailViewer.swapThumbnails(e,e-1);[this.pageOrder[e],this.pageOrder[e-1]]=[this.pageOrder[e-1],this.pageOrder[e]]}this.page=t},async _exportWithAnnotations(){if(this._saveInProgress)throw new Error("Already downloading");this._saveInProgress=!0;await this.pdfScriptingManager.dispatchWillSave();try{this._ensureDownloadComplete();const e=await this.pdfDocument.saveDocument();return new Blob([e],{type:"application/pdf"})}catch(e){throw new Error(`Error when saving the document: ${e.message}`)}finally{await this.pdfScriptingManager.dispatchDidSave();this._saveInProgress=!1}},_ensureDownloadComplete(){if(!this.pdfDocument)throw new Error("PDF document not downloaded.")},async _exportWithoutAnnotations(){try{this._ensureDownloadComplete();const e=await this.pdfDocument.getData();return new Blob([e],{type:"application/pdf"})}catch(e){throw new Error(`Error when saving the document: ${e.message}`)}},async export(){return this.pdfDocument?.annotationStorage.size>0?this._exportWithAnnotations():this._exportWithoutAnnotations()},openInExternalApp(){this.downloadOrSave({openInExternalApp:!0})},async _documentError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this._unblockDocumentLoadEvent();const i=await this._otherError(e||"pdfjs-loading-error",t);this.eventBus.dispatch("documenterror",{source:this,message:i,reason:t?.message??null})},async _otherError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=await this.l10n.get(e),a=[`PDF.js v${Rr||"?"} (build: ${Nr||"?"})`];if(t){a.push(`Message: ${t.message}`);if(t.stack)a.push(`Stack: ${t.stack}`);else{t.filename&&a.push(`File: ${t.filename}`);t.lineNumber&&a.push(`Line: ${t.lineNumber}`)}}ngx_console_NgxConsole.error(`${i}\n\n${a.join("\n")}`);return i},progress(e){if(this.loadingBar&&!(e<=this.loadingBar.percent)){this.loadingBar.percent=e;(this.pdfDocument?.loadingParams.disableAutoFetch??AppOptions.get("disableAutoFetch"))&&this.loadingBar.setDisableAutoFetch()}},load(e){this.pdfDocument=e;this._printPermissionPromise=new Promise(e=>{this.eventBus.on("printingallowed",t=>{let{isAllowed:i}=t;e(i)},{once:!0})});e.getDownloadInfo().then(e=>{let{length:t}=e;this._contentLength=t;this.loadingBar?.hide();n.then(()=>{this.eventBus?.dispatch("documentloaded",{source:this})})});const t=e.getPageLayout().catch(()=>{}),i=e.getPageMode().catch(()=>{}),a=e.getOpenAction().catch(()=>{});this.toolbar?.setPagesCount(e.numPages,!1);this.secondaryToolbar?.setPagesCount(e.numPages);this.pdfLinkService.setDocument(e);this.pdfDocumentProperties?.setDocument(e);const s=this.pdfViewer;s.setDocument(e);const{firstPagePromise:n,onePageRendered:r,pagesPromise:o}=s;this.pdfThumbnailViewer?.setDocument(e);const l=(this.store=new ViewHistory(e.fingerprints[0])).getMultiple({page:null,zoom:Dc,scrollLeft:"0",scrollTop:"0",rotation:null,sidebarView:jc,scrollMode:Yc.UNKNOWN,spreadMode:Zc.UNKNOWN}).catch(()=>{});n.then(n=>{this.loadingBar?.setWidth(this.appConfig.viewerContainer);this._initializeAnnotationStorageCallbacks(e);Promise.all([th,l,t,i,a]).then(async t=>{let[i,a,n,r,l]=t;const d=AppOptions.get("viewOnLoad");this._initializePdfHistory({fingerprint:e.fingerprints[0],viewOnLoad:d,initialDest:l?.dest});const c=this.initialBookmark;let h=AppOptions.get("defaultZoomValue");if(!h||""===h)try{h=await this.store.get("zoom");"string"==typeof h&&(h=h?.replace("%",""));isNaN(Number(h))||(h=Number(h)/100)}catch(e){}!s.currentScaleValue&&h&&""!==h&&(s.currentScaleValue=h);let u=h?`zoom=${h}`:null,_=null,p=AppOptions.get("sidebarViewOnLoad"),g=AppOptions.get("scrollModeOnLoad"),f=AppOptions.get("spreadModeOnLoad");this.eventBus&&this.eventBus.dispatch("storedvaluesavailable",{source:this,fingerprint:e.fingerprints[0],storedZoom:a?.zoom,storedPage:a?.page,defaultZoom:AppOptions.get("defaultZoomValue")});if(a?.page&&d!==jw){u=`page=${a.page}&zoom=${h||a.zoom},${a.scrollLeft},${a.scrollTop}`;_=parseInt(a.rotation,10);p===jc&&(p=0|a.sidebarView);g===Yc.UNKNOWN&&(g=0|a.scrollMode);f===Zc.UNKNOWN&&(f=0|a.spreadMode)}r&&p===jc&&(p=function apiPageModeToSidebarView(e){switch(e){case"UseNone":return Vc;case"UseThumbs":return Uc;case"UseOutlines":return zc;case"UseAttachments":return Hc;case"UseOC":return $c}return Vc}(r));if(n&&g===Yc.UNKNOWN&&f===Zc.UNKNOWN){f=apiPageLayoutToViewerModes(n).spreadMode}this.setInitialView(u,{rotation:_,sidebarView:p,scrollMode:g,spreadMode:f});this.eventBus.dispatch("documentinit",{source:this});await Promise.race([o,new Promise(e=>{setTimeout(e,10)})]);if((c||u)&&!s.hasEqualPageSizes){this.initialBookmark=c;s.currentScaleValue=s.currentScaleValue;this.setInitialView(u)}}).catch(()=>{this.setInitialView()}).then(function(){s.update()})});o.then(()=>{this._unblockDocumentLoadEvent();this._initializeAutoPrint(e,a)},e=>{Vw.onError&&Vw.onError(e);this._documentError("pdfjs-loading-error",{message:e.message})});r.then(t=>{this.externalServices.reportTelemetry({type:"pageInfo",timestamp:t.timestamp});this.pdfOutlineViewer&&e.getOutline().then(t=>{e===this.pdfDocument&&this.pdfOutlineViewer.render({outline:t,pdfDocument:e})});this.pdfAttachmentViewer&&e.getAttachments().then(t=>{e===this.pdfDocument&&this.pdfAttachmentViewer.render({attachments:t})});this.pdfLayerViewer&&s.optionalContentConfigPromise.then(t=>{e===this.pdfDocument&&this.pdfLayerViewer.render({optionalContentConfig:t,pdfDocument:e})})});this._initializePageLabels(e);this._initializeMetadata(e);this._initializePageOrder(e)},async _scriptingDocProperties(e){if(!this.documentInfo){await new Promise(e=>{this.eventBus._on("metadataloaded",e,{once:!0})});if(e!==this.pdfDocument)return null}if(!this._contentLength){await new Promise(e=>{this.eventBus._on("documentloaded",e,{once:!0})});if(e!==this.pdfDocument)return null}return{...this.documentInfo,baseURL:this.baseUrl,filesize:this._contentLength,filename:this._docFilename,metadata:this.metadata?.getRaw(),authors:this.metadata?.get("dc:creator"),numPages:this.pagesCount,URL:this.url}},async _initializeAutoPrint(e,t){const[i,a]=await Promise.all([t,this.pdfViewer.enableScripting?null:e.getJSActions()]);if(e!==this.pdfDocument)return;let s="Print"===i?.action;if(a){ngx_console_NgxConsole.warn("Warning: JavaScript support is not enabled");for(const e in a){if(s)break;switch(e){case"WillClose":case"WillSave":case"DidSave":case"WillPrint":case"DidPrint":continue}s=a[e].some(e=>Qc.test(e))}}s&&this.triggerPrinting()},async _initializeMetadata(e){const{info:t,metadata:i,contentDispositionFilename:a,contentLength:s,hasStructTree:n}=await e.getMetadata();if(e!==this.pdfDocument)return;this.externalServices.reportTelemetry({type:"taggedPDF",data:n});this.documentInfo=t;this.metadata=i;this._contentDispositionFilename??=a;this._contentLength??=s;AppOptions?.get("verbosity")>0&&ngx_console_NgxConsole.log(`PDF ${e.fingerprints[0]} [${t.PDFFormatVersion} ${(i?.get("pdf:producer")||t.Producer||"-").trim()} / ${(i?.get("xmp:creatortool")||t.Creator||"-").trim()}] (PDF.js: ${Rr||"?"} [${Nr||"?"}])  modified by ngx-extended-pdf-viewer 27.0.0`);const r=this._docTitle;r?this.setTitle(`${r} - ${this._contentDispositionFilename||this._title}`):this._contentDispositionFilename&&this.setTitle(this._contentDispositionFilename);!t.IsXFAPresent||t.IsAcroFormPresent||e.isPureXfa?!t.IsAcroFormPresent&&!t.IsXFAPresent||this.pdfViewer.renderForms||ngx_console_NgxConsole.warn("Warning: Interactive form support is not enabled"):e.loadingParams.enableXfa?ngx_console_NgxConsole.warn("Warning: XFA Foreground documents are not supported"):ngx_console_NgxConsole.warn("Warning: XFA support is not enabled");t.IsSignaturesPresent&&ngx_console_NgxConsole.warn("Warning: Digital signatures validation is not supported");this.eventBus.dispatch("metadataloaded",{source:this})},async _initializePageOrder(e){e===this.pdfDocument&&(this.pageOrder=Array.from({length:this.pdfDocument.numPages},(e,t)=>t+1))},async _initializePageLabels(e){const t=await e.getPageLabels();if(e!==this.pdfDocument)return;if(!t||AppOptions.get("disablePageLabels"))return;const i=t.length;let a=0,s=0;for(let e=0;e<i;e++){const i=t[e];if(i===(e+1).toString())a++;else{if(""!==i)break;s++}}if(a>=i||s>=i)return;const{pdfViewer:n,pdfThumbnailViewer:r,toolbar:o}=this;n.setPageLabels(t);r?.setPageLabels(t);o?.setPagesCount(i,!0);o?.setPageNumber(n.currentPageNumber,n.currentPageLabel)},_initializePdfHistory(e){let{fingerprint:t,viewOnLoad:i,initialDest:a=null}=e;if(this.pdfHistory){this.pdfHistory.initialize({fingerprint:t,resetHistory:i===jw,updateUrl:AppOptions.get("historyUpdateUrl")});if(this.pdfHistory.initialBookmark){this.initialBookmark=this.pdfHistory.initialBookmark;this.initialRotation=this.pdfHistory.initialRotation}if(a&&!this.initialBookmark&&i===Ww){this.initialBookmark=JSON.stringify(a);this.pdfHistory.push({explicitDest:a,pageNumber:null})}}},_hasChanges(){return this.pdfDocument?.annotationStorage.size>0||this.pdfThumbnailViewer?.hasStructuralChanges()},_initialAnnotationValues:null,_initializeAnnotationStorageCallbacks(e){if(e!==this.pdfDocument)return;const{annotationStorage:t}=e;t.onSetModified=()=>{this._annotationStorageModified=!0};t.onResetModified=()=>{delete this._annotationStorageModified;this._initialAnnotationValues=null};t.onAnnotationEditor=e=>{this._hasAnnotationEditors=!!e;this.setTitle()};this.eventBus._on("pagesloaded",()=>{setTimeout(()=>{this._captureInitialAnnotationValues()},200)})},_captureInitialAnnotationValues(){if(!this.pdfDocument?.annotationStorage)return;const e=this.pdfDocument.annotationStorage;this._initialAnnotationValues=new Map;for(const[t,i]of e)this._initialAnnotationValues.set(t,JSON.parse(JSON.stringify(i)))},setInitialAnnotationValues(){if(!this.pdfDocument?.annotationStorage)return;this._initialAnnotationValues=new Map;const e=this.pdfDocument.annotationStorage;for(const[t,i]of e)this._initialAnnotationValues.set(t,JSON.parse(JSON.stringify(i)))},_hasRealAnnotationChanges(){if(!this.pdfDocument?.annotationStorage||!this._initialAnnotationValues)return this._annotationStorageModified;const e=this.pdfDocument.annotationStorage,t=new Map;for(const[i,a]of e)t.set(i,a);if(t.size!==this._initialAnnotationValues.size)return!0;for(const[e,i]of t){const t=this._initialAnnotationValues.get(e);if(!t)return!0;if(JSON.stringify(i)!==JSON.stringify(t))return!0}for(const e of this._initialAnnotationValues.keys())if(!t.has(e))return!0;return!1},setInitialView(e){let{rotation:t,sidebarView:i,scrollMode:a,spreadMode:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const setRotation=e=>{isValidRotation(e)&&(this.pdfViewer.pagesRotation=e)};this.isInitialViewSet=!0;this.viewsManager?.setInitialView(i);((e,t)=>{isValidScrollMode(e)&&(this.pdfViewer.scrollMode=e);isValidSpreadMode(t)&&(this.pdfViewer.spreadMode=t)})(a,s);if(this.initialBookmark){setRotation(this.initialRotation);delete this.initialRotation;this.pdfLinkService.setHash&&this.pdfLinkService.setHash(this.initialBookmark);this.initialBookmark=null}else if(e){setRotation(t);this.pdfLinkService.setHash&&this.pdfLinkService.setHash(e)}this.toolbar?.setPageNumber(this.pdfViewer.currentPageNumber,this.pdfViewer.currentPageLabel);this.secondaryToolbar?.setPageNumber(this.pdfViewer.currentPageNumber);if(!this.pdfViewer.currentScaleValue){const e=AppOptions?.get("defaultZoomValue");e&&(this.pdfViewer.currentScaleValue=e)}},_cleanup(){if(this.resizeObserver){this.resizeObserver.disconnect();this.resizeObserver=null}if(this.pdfDocument){this.pdfViewer.cleanup();this.pdfThumbnailViewer?.cleanup();this.pdfDocument.cleanup(AppOptions.get("fontExtraProperties"))}},forceRendering(){this.pdfRenderingQueue.printing=!!this.printService;this.pdfRenderingQueue.isThumbnailViewEnabled=this.viewsManager?.visibleView===Uc;this.pdfRenderingQueue.renderHighestPriority()},beforePrint(){this._printAnnotationStoragePromise=this.pdfScriptingManager.dispatchWillPrint().catch(()=>{}).then(()=>this.pdfDocument?.annotationStorage.print);if(!this.printService)if(this.supportsPrinting&&this.pdfViewer.printingAllowed)if(this.pdfViewer.pageViewsReady){this.printService=PDFPrintServiceFactory.createPrintService({pdfDocument:this.pdfDocument,pagesOverview:this.pdfViewer.getPagesOverview(),printResolution:AppOptions.get("printResolution"),printAnnotationStoragePromise:this._printAnnotationStoragePromise,pageOrder:this.pageOrder,eventBus:this.pdfViewer.eventBus,cspPolicyService:this.cspPolicyService});this.forceRendering();this.setTitle();this.printService.layout();this._hasAnnotationEditors&&this.externalServices.reportTelemetry({type:"editing",data:{type:"print",stats:this.pdfDocument?.annotationStorage.editorStats}})}else this.l10n.get("pdfjs-printing-not-ready").then(e=>{window.alert(e)});else this._otherError("pdfjs-printing-not-supported")},afterPrint(){if(this._printAnnotationStoragePromise){this._printAnnotationStoragePromise.then(()=>{this.pdfScriptingManager.dispatchDidPrint()});this._printAnnotationStoragePromise=null}if(this.printService){this.printService.destroy();this.printService=null;this.pdfDocument?.annotationStorage.resetModified()}this.forceRendering();this.setTitle()},rotatePages(e){this.pdfViewer.pagesRotation+=e},requestPresentationMode(){this.pdfPresentationMode?.request()},async triggerPrinting(){this.supportsPrinting&&await this._printPermissionPromise&&this.printPdf()},bindEvents(){if(this._eventBusAbortController)return;const e={signal:(this._eventBusAbortController=new AbortController).signal},{eventBus:t,externalServices:i,pdfDocumentProperties:a,pdfViewer:s,preferences:n}=this;t._on("resize",onResize.bind(this),e);t._on("hashchange",onHashchange.bind(this),e);t._on("beforeprint",this.beforePrint.bind(this),e);t._on("afterprint",this.afterPrint.bind(this),e);t._on("pagerender",onPageRender.bind(this),e);t._on("pagerendered",onPageRendered.bind(this),e);t._on("updateviewarea",onUpdateViewarea.bind(this),e);t._on("pagechanging",onPageChanging.bind(this),e);t._on("scalechanging",onScaleChanging.bind(this),e);t._on("rotationchanging",onRotationChanging.bind(this),e);t._on("sidebarviewchanged",onSidebarViewChanged.bind(this),e);t._on("pagemode",onPageMode.bind(this),e);t._on("namedaction",onNamedAction.bind(this),e);t._on("toggleSidebar",function(e){let{visible:t}=e;this.viewsManager&&(t?this.viewsManager.open():this.viewsManager.close())}.bind(this),e);t._on("presentationmodechanged",e=>s.presentationModeState=e.state,e);t._on("presentationmode",this.requestPresentationMode.bind(this),e);t._on("switchannotationeditormode",e=>s.annotationEditorMode=e,e);t._on("print",this.triggerPrinting.bind(this),e);t._on("download",this.downloadOrSave.bind(this),e);t._on("movePageUp",this.movePageUp.bind(this),e);t._on("movePageDown",this.movePageDown.bind(this),e);t._on("firstpage",()=>this.page=1,e);t._on("lastpage",()=>this.page=this.pagesCount,e);t._on("nextpage",()=>s.nextPage(),e);t._on("previouspage",()=>s.previousPage(),e);t._on("zoomin",this.zoomIn.bind(this),e);t._on("zoomout",this.zoomOut.bind(this),e);t._on("zoomreset",this.zoomReset.bind(this),e);t._on("pagenumberchanged",onPageNumberChanged.bind(this),e);t._on("scalechanged",e=>s.currentScaleValue=e.value,e);t._on("rotatecw",this.rotatePages.bind(this,90),e);t._on("rotateccw",this.rotatePages.bind(this,-90),e);t._on("optionalcontentconfig",e=>s.optionalContentConfigPromise=e.promise,e);t._on("switchscrollmode",e=>s.scrollMode=e.mode,e);t._on("scrollmodechanged",onViewerModesChanged.bind(this,"scrollMode"),e);t._on("switchspreadmode",e=>s.spreadMode=e.mode,e);t._on("spreadmodechanged",onViewerModesChanged.bind(this,"spreadMode"),e);t._on("imagealttextsettings",onImageAltTextSettings.bind(this),e);t._on("documentproperties",()=>a?.open(),e);t._on("findfromurlhash",onFindFromUrlHash.bind(this),e);t._on("updatefindmatchescount",onUpdateFindMatchesCount.bind(this),e);t._on("updatefindcontrolstate",onUpdateFindControlState.bind(this),e);t._on("fileinputchange",onFileInputChange.bind(this),e);t._on("openfile",onOpenFile.bind(this),e);t._on("pagesedited",this.onPagesEdited.bind(this),e);t._on("saveextractedpages",this.onSavePages.bind(this),e)},bindWindowEvents(){if(this._windowAbortController)return;this._windowAbortController=new AbortController;const{eventBus:e,appConfig:{mainContainer:t},pdfViewer:i,_windowAbortController:{signal:a}}=this;this._touchManager=new TouchManager({container:window,isPinchingDisabled:()=>i.isInPresentationMode,isPinchingStopped:()=>this.overlayManager?.active,onPinching:this.touchPinchCallback.bind(this),onPinchEnd:this.touchPinchEndCallback.bind(this),signal:a});!function addWindowResolutionChange(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)&&i.refresh();window.matchMedia(`(resolution: ${OutputScale.pixelRatio}dppx)`).addEventListener("change",addWindowResolutionChange,{once:!0,signal:a})}();const s=document.getElementById("viewerContainer");s?.addEventListener("wheel",onWheel.bind(this),{passive:!1,signal:a});window.addEventListener("wheel",onWheel.bind(this),{passive:!1,signal:a});window.addEventListener("click",onClick.bind(this),{signal:a});window.addEventListener("keydown",onKeyDown.bind(this),{signal:a});window.addEventListener("keyup",onKeyUp.bind(this),{signal:a});if(s){let i,a=t.clientWidth,s=t.clientHeight;this.resizeObserver=new ResizeObserver(n=>{const r=t.clientWidth,o=t.clientHeight;if(r!==a||o!==s){clearTimeout(i);i=setTimeout(()=>{t.offsetParent&&e.dispatch("resize",{source:t})},50);a=r;s=o}});this.resizeObserver.observe(t)}else window.addEventListener("resize",()=>e.dispatch("resize",{source:window}),{signal:a});window.addEventListener("hashchange",()=>{e.dispatch("hashchange",{source:window,hash:document.location.hash.substring(1)})},{signal:a});window.addEventListener("beforeprint",()=>e.dispatch("beforeprint",{source:window}),{signal:a});window.addEventListener("afterprint",()=>e.dispatch("afterprint",{source:window}),{signal:a});window.addEventListener("updatefromsandbox",t=>{e.dispatch("updatefromsandbox",{source:window,detail:t.detail})},{signal:a});window.addEventListener("beforeunload",onBeforeUnload.bind(this),{signal:a});if(!("onscrollend"in document.documentElement))return;({scrollTop:this._lastScrollTop,scrollLeft:this._lastScrollLeft}=t);let n,r;const scrollend=()=>{({scrollTop:this._lastScrollTop,scrollLeft:this._lastScrollLeft}=t);clearTimeout(n);if(this._isScrolling){r.abort();r=null;this._isScrolling=!1}};t.addEventListener("scroll",()=>{if(!this._isCtrlKeyDown&&(this._lastScrollTop!==t.scrollTop||this._lastScrollLeft!==t.scrollLeft)){if(!this._isScrolling){r=new AbortController;const e=AbortSignal.any([r.signal,a]);t.addEventListener("scrollend",scrollend,{signal:e});t.addEventListener("blur",scrollend,{signal:e});this._isScrolling=!0}clearTimeout(n);n=setTimeout(scrollend,100)}},{passive:!0,signal:a})},unbindEvents(){this._eventBusAbortController?.abort();this._eventBusAbortController=null},unbindWindowEvents(){this._windowAbortController?.abort();this._windowAbortController=null;this._touchManager=null},async testingClose(){this.unbindEvents();this.unbindWindowEvents();this._globalAbortController?.abort();this._globalAbortController=null;this.findBar?.close();await Promise.all([this.l10n?.destroy(),this.close()])},onPagesEdited(e){this.pdfViewer.onPagesEdited(e)},async onSavePages(e){let{data:t}=e;if(!this.pdfDocument)return;const i=await this.pdfDocument.extractPages(t);i?this.downloadManager.download(i,this._downloadUrl,this._docFilename):console.error("Something wrong happened when saving the edited PDF.\nPlease file a bug.")},_accumulateTicks(e,t){(this[t]>0&&e<0||this[t]<0&&e>0)&&(this[t]=0);this[t]+=e;const i=Math.trunc(this[t]);this[t]-=i;return i},_accumulateFactor(e,t,i){if(1===t)return 1;(this[i]>1&&t<1||this[i]<1&&t>1)&&(this[i]=1);const a=Math.floor(e*t*this[i]*1e3)/(1e3*e);this[i]=t/a;return a},_unblockDocumentLoadEvent(){document.blockUnblockOnload?.(!1);this._unblockDocumentLoadEvent=()=>{}},get scriptingReady(){return this.pdfScriptingManager.ready}};PDFPrintServiceFactory.initGlobals(Vw);{const e=new Set(["null","http://mozilla.github.io","https://mozilla.github.io"]);var validateFileURL=function(t){if(!t)return;const i=URL.parse(window.location)?.origin||"null";if(e.has(i))return;const a=URL.parse(t,window.location)?.origin;if(a===i)return;const s=new Error("file origin does not match viewer's");Vw._documentError("pdfjs-loading-error",{message:s.message});Vw.onError&&Vw.onError(s);throw s},onFileInputChange=function(e){if(this.pdfViewer?.isInPresentationMode)return;const t=e.fileInput.files[0];this.open({url:URL.createObjectURL(t),originalUrl:encodeURIComponent(t.name)})},onOpenFile=function(e){this._openFileInput?.click()}}function onPageRender(e){let{pageNumber:t}=e;t===this.page&&this.toolbar?.updateLoadingIndicatorState(!0)}function onPageRendered(e){let{pageNumber:t,isDetailView:i,error:a}=e;t===this.page&&this.toolbar?.updateLoadingIndicatorState(!1);if(!i&&this.viewsManager?.visibleView===Uc){const e=this.pdfViewer.getPageView(t-1),i=this.pdfThumbnailViewer?.getThumbnail(t-1);e&&i?.setImage(e)}a&&this._otherError("pdfjs-rendering-error",a)}function onPageMode(e){let t,{mode:i}=e;switch(i){case"thumbs":t=Uc;break;case"bookmarks":case"outline":t=zc;break;case"attachments":t=Hc;break;case"layers":t=$c;break;case"none":t=Vc;break;default:ngx_console_NgxConsole.error('Invalid "pagemode" hash parameter: '+i);return}this.viewsManager?.switchView(t,!0)}function onNamedAction(e){switch(e.action){case"GoToPage":this.appConfig.toolbar?.pageNumber.select();break;case"Find":this.supportsIntegratedFind||this.findBar?.toggle();break;case"Print":this.triggerPrinting();break;case"SaveAs":this.downloadOrSave()}}function onSidebarViewChanged(e){let{view:t}=e;this.pdfRenderingQueue.isThumbnailViewEnabled=t===Uc;this.isInitialViewSet&&this.store?.set("sidebarView",t).catch(()=>{})}function onUpdateViewarea(e){let{location:t}=e;if(this.isInitialViewSet){const e={};void 0===t.pageNumber&&null===t.pageNumber||(e.page=t.pageNumber);t.scale&&(e.zoom=t.scale);t.left&&(e.scrollLeft=t.left);t.top&&(e.scrollTop=t.top);void 0===t.rotation&&null===t.rotation||(e.rotation=t.rotation);Vw.store?.setMultiple(e).catch(()=>{})}this.appConfig.secondaryToolbar&&(this.appConfig.secondaryToolbar.viewBookmarkButton.href=this.pdfLinkService.getAnchorUrl(t.pdfOpenParams))}function onViewerModesChanged(e,t){this.isInitialViewSet&&!this.pdfViewer.isInPresentationMode&&this.store?.set(e,t.mode).catch(()=>{})}function onResize(e){const{pdfDocument:t,pdfViewer:i,pdfRenderingQueue:a}=this;if(a.printing&&window.matchMedia("print").matches)return;if(!t)return;const s=e?.sidebarToggle?i.currentPageNumber:0,n=i.currentScaleValue;"auto"!==n&&"page-fit"!==n&&"page-width"!==n||(i.currentScaleValue=n);i.update();s&&i.currentPageNumber!==s&&(i.currentPageNumber=s)}function onHashchange(e){const t=e.hash;t&&(this.isInitialViewSet?this.pdfHistory?.popStateInProgress||this.pdfLinkService.setHash&&this.pdfLinkService.setHash(t):this.initialBookmark=t)}function onPageNumberChanged(e){const{pdfViewer:t}=this;""!==e.value&&this.pdfLinkService.goToPage(e.value);e.value!==t.currentPageNumber.toString()&&e.value!==t.currentPageLabel&&this.toolbar?.setPageNumber(t.currentPageNumber,t.currentPageLabel)}function onImageAltTextSettings(){this.imageAltTextSettings?.open({enableGuessAltText:AppOptions.get("enableGuessAltText"),enableNewAltTextWhenAddingImage:AppOptions.get("enableNewAltTextWhenAddingImage")})}function onFindFromUrlHash(e){this.eventBus.dispatch("find",{source:e.source,type:"",query:e.query,caseSensitive:!1,entireWord:!1,highlightAll:!0,findPrevious:!1,matchDiacritics:!0})}function onUpdateFindMatchesCount(e){let{matchesCount:t}=e;this.supportsIntegratedFind?this.externalServices.updateFindMatchesCount(t):this.findBar?.updateResultsCount(t)}function onUpdateFindControlState(e){let{state:t,previous:i,entireWord:a,matchesCount:s,rawQuery:n}=e;this.supportsIntegratedFind?this.externalServices.updateFindControlState({result:t,findPrevious:i,entireWord:a,matchesCount:s,rawQuery:n}):this.findBar?.updateUIState(t,i,s)}function onScaleChanging(e){this.toolbar?.setPageScale(e.presetValue,e.scale);this.pdfViewer.update(e.noScroll);this.pdfViewer.updateBookModeScale(e)}function onRotationChanging(e){this.pdfThumbnailViewer&&(this.pdfThumbnailViewer.pagesRotation=e.pagesRotation);this.forceRendering();this.pdfViewer.currentPageNumber=e.pageNumber}function onPageChanging(e){let{pageNumber:t,pageLabel:i}=e;this.toolbar?.setPageNumber(t,i);this.secondaryToolbar?.setPageNumber(t);this.viewsManager?.visibleView===Uc&&this.pdfThumbnailViewer?.scrollThumbnailIntoView(t);const a=this.pdfViewer.getPageView(t-1);this.toolbar?.updateLoadingIndicatorState(a?.renderingState===Yg.RUNNING);const s=document.getElementById("pageNumber");if(s){const e=new CustomEvent("page-change");s.dispatchEvent(e)}}function onWheel(e){const t=document.getElementById("viewerContainer");if(t.parentNode.querySelector(":hover")!==t)return;const{pdfViewer:i,supportsMouseWheelZoomCtrlKey:a,supportsMouseWheelZoomMetaKey:s,supportsPinchToZoom:n}=this;if(i.isInPresentationMode)return;const r=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0);if(Vw?.isKeyIgnored&&Vw.isKeyIgnored(r,"WHEEL"))return;const o=e.deltaMode;let l=Math.exp(-e.deltaY/100);const d=e.ctrlKey&&!this._isCtrlKeyDown&&o===WheelEvent.DOM_DELTA_PIXEL&&0===e.deltaX&&(Math.abs(l-1)<.05||!1)&&0===e.deltaZ,c=[e.clientX,e.clientY];if(d||e.ctrlKey&&a||e.metaKey&&s){e.preventDefault();if(this._isScrolling||"hidden"===document.visibilityState||this.overlayManager.active)return;if(d&&n){l=this._accumulateFactor(i.currentScale,l,"_wheelUnusedFactor");this.updateZoom(null,l,c)}else{const t=normalizeWheelEventDirection(e);let i=0;if(o===WheelEvent.DOM_DELTA_LINE||o===WheelEvent.DOM_DELTA_PAGE)i=Math.abs(t)>=1?Math.sign(t):this._accumulateTicks(t,"_wheelUnusedTicks");else{const e=30;i=this._accumulateTicks(t/e,"_wheelUnusedTicks")}this.updateZoom(i,null,c)}}}function closeSecondaryToolbar(e){let{target:t}=e;if(!this.secondaryToolbar?.isOpen)return;const{toolbar:i,secondaryToolbar:a}=this.appConfig;if(this.pdfViewer.containsElement(t)||i?.container.contains(t)&&!a?.toolbar.contains(t)&&!a?.toggleButton.contains(t)){if(t&&t.parentElement===a.toggleButton)return;if(t&&t.parentElement&&t.parentElement.parentElement===a.toggleButton)return;this.secondaryToolbar.close()}}function closeEditorUndoBar(e){this.editorUndoBar?.isOpen&&this.appConfig.secondaryToolbar?.toolbar.contains(e.target)&&this.editorUndoBar.hide()}function onBeforeUnload(e){if(this._hasChanges()){e.preventDefault();e.returnValue="";return!1}return!0}function onClick(e){closeSecondaryToolbar.call(this,e);closeEditorUndoBar.call(this,e)}function onKeyUp(e){"Control"===e.key&&(this._isCtrlKeyDown=!1)}function onKeyDown(e){this._isCtrlKeyDown="Control"===e.key;this.editorUndoBar?.isOpen&&9!==e.keyCode&&16!==e.keyCode&&(13!==e.keyCode&&32!==e.keyCode||getActiveOrFocusedElement()!==this.appConfig.editorUndoBar.undoButton)&&this.editorUndoBar.hide();if(this.overlayManager.active)return;const{eventBus:t,pdfViewer:i}=this,a=i.isInPresentationMode;let s=!1,n=!1;const r=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0);if(Vw.ngxKeyboardManager&&Vw.ngxKeyboardManager.isKeyIgnored.bind(Vw.ngxKeyboardManager)(r,e.keyCode))return;if(1===r||8===r||5===r||12===r)switch(e.keyCode){case 70:if(!this.supportsIntegratedFind&&!e.shiftKey){if(AppOptions.get("textLayerMode")!==qc){let e=!1;const t=this.pdfViewer.viewer.closest("#outerContainer")?.querySelector("#primaryViewFind");t&&(e||=!t?.classList.contains("dummy-component"));const i=this.pdfViewer.viewer.closest("#outerContainer")?.querySelector("#secondaryToolbarToggle");if(!i.hidden){const t=this.pdfViewer.viewer.closest("#outerContainer")?.querySelector("#secondaryViewFind");t&&(e||=!t?.classList.contains("dummy-component"))}e&&this.findBar?.open()}s=!0}break;case 71:if(!this.supportsIntegratedFind){const{state:e}=this.findController;if(e){const i={source:window,type:"again",findPrevious:5===r||12===r};t.dispatch("find",{...e,...i})}s=!0}break;case 61:case 107:case 187:case 171:this.zoomIn();s=!0;break;case 173:case 109:case 189:this.zoomOut();s=!0;break;case 48:case 96:if(!a){setTimeout(()=>{this.zoomReset()});s=!1}break;case 38:if(a||this.page>1){this.page=1;s=!0;n=!0}break;case 40:if(a||this.page<this.pagesCount){this.page=this.pagesCount;s=!0;n=!0}}if(1===r||8===r)switch(e.keyCode){case 83:t.dispatch("download",{source:window});s=!0;break;case 79:t.dispatch("openfile",{source:window});s=!0}if(3===r||10===r)switch(e.keyCode){case 80:this.requestPresentationMode();s=!0;this.externalServices.reportTelemetry({type:"buttons",data:{id:"presentationModeKeyboard"}});break;case 71:if(this.appConfig.toolbar){this.appConfig.toolbar.pageNumber.select();s=!0}}if(s){n&&!a&&i.focus();e.preventDefault();return}const o=getActiveOrFocusedElement(),l=o?.tagName.toUpperCase();if(!("INPUT"===l||"TEXTAREA"===l||"SELECT"===l||"BUTTON"===l&&32===e.keyCode||o?.isContentEditable)||27===e.keyCode){if(0===r){let t=0,r=!1;switch(e.keyCode){case 38:if(this.supportsCaretBrowsingMode){this.moveCaret(!0,!1);s=!0;break}case 33:i.isVerticalScrollbarEnabled&&(r=!0);t=-1;break;case 8:a||(r=!0);t=-1;break;case 37:if(this.supportsCaretBrowsingMode)return;i.isHorizontalScrollbarEnabled&&(r=!0);case 75:case 80:t=-1;break;case 27:if(this.secondaryToolbar?.isOpen){this.secondaryToolbar.close();s=!0}if(!this.supportsIntegratedFind&&this.findBar?.opened){this.findBar.close();s=!0}if(!s){if([document.getElementById("editorHighlightParamsToolbar"),document.getElementById("editorFreeTextParamsToolbar"),document.getElementById("editorInkParamsToolbar"),document.getElementById("editorStampParamsToolbar"),document.getElementById("editorCommentParamsToolbar"),document.getElementById("editorSignatureParamsToolbar")].find(e=>e&&!e.classList.contains("hidden"))){this.eventBus.dispatch("switchannotationeditormode",{source:this,mode:f.NONE});s=!0}}break;case 40:if(this.supportsCaretBrowsingMode){this.moveCaret(!1,!1);s=!0;break}case 34:i.isVerticalScrollbarEnabled&&(r=!0);t=1;break;case 32:a||(r=!0);t=1;break;case 39:if(this.supportsCaretBrowsingMode)return;i.isHorizontalScrollbarEnabled&&(r=!0);case 74:case 78:t=1;break;case 36:if(a||this.page>1){this.page=1;s=!0;n=!0}break;case 35:if(a||this.page<this.pagesCount){this.page=this.pagesCount;s=!0;n=!0}break;case 83:this.pdfCursorTools?.switchTool(Jc.SELECT);break;case 72:this.pdfCursorTools?.switchTool(Jc.HAND);break;case 82:this.rotatePages(90);break;case 115:this.viewsManager?.toggle()}0!==t&&"rtl"===AppOptions.get("readingDirection")&&(t=-t);if(0!==t&&(!r||"page-fit"===i.currentScaleValue)){const{mainContainer:e}=this.appConfig;(function viewerIsAllowedToCaptureKeyEvent(e){let t=document.activeElement;const i=e.closest("ngx-extended-pdf-viewer");for(;t&&t!==document.body;){if(t===i)return!0;if(-1!==t.tabIndex)return!1;t=t.parentElement}return!0})(e)&&(t>0?i.nextPage():i.previousPage());s=!0}}if(4===r)switch(e.keyCode){case 32:if(!a&&"page-fit"!==i.currentScaleValue)break;i.previousPage();s=!0;break;case 38:this.moveCaret(!0,!0);s=!0;break;case 40:this.moveCaret(!1,!0);s=!0;break;case 82:this.rotatePages(-90)}n&&!i.containsElement(o)&&i.focus();s&&e.preventDefault()}}Vw.printPdf=function printPdf(){if(this.enablePrint)if(zg)ngx_console_NgxConsole.warn("Ignored this.printPDF() because of a pending print job.");else{ensureOverlay().then(function(){zg&&$g.open(Hg)});try{dispatchEvent("beforeprint")}finally{if(zg){const e=zg,t=document.createElement("div");t.id="printContainer";document.body.append(t);e.printContainer=t;zg.renderPages().then(function(){const t=document.getElementById("printServiceDialog");t&&t.classList.add("hidden");return e.performPrint()}).catch(()=>{}).then(()=>{e.active&&abort()})}else{ngx_console_NgxConsole.error("Expected print service to be initialized.");ensureOverlay().then(function(){$g.closeIfActive(Hg)})}}}};Vw.PDFPrintServiceFactory=PDFPrintServiceFactory;Vw.ngxConsole=new ngx_console_NgxConsole;Vw.serviceWorkerOptions={showUnverifiedSignatures:!1};const Uw={LinkTarget:dh,RenderingStates:Yg,ScrollMode:Yc,SpreadMode:Zc};HTMLCollection.prototype[Symbol.iterator]||(HTMLCollection.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator]);"function"!=typeof window.CustomEvent&&(window.CustomEvent=function CustomEvent(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};const i=document.createEvent("CustomEvent");i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail);return i});function webViewerLoad(e){const t=function getViewerConfiguration(){return{appContainer:document.getElementsByClassName("body")[0]??document.body,principalContainer:document.getElementById("mainContainer"),mainContainer:document.getElementById("viewerContainer"),viewerContainer:document.getElementById("viewer"),viewerAlert:document.getElementById("viewer-alert"),toolbar:{container:document.getElementById("toolbarContainer"),numPages:document.getElementById("numPages"),pageNumber:document.getElementById("pageNumber"),scaleSelect:document.getElementById("scaleSelect"),customScaleOption:document.getElementById("customScaleOption"),previous:document.getElementById("previous"),next:document.getElementById("next"),zoomIn:document.getElementById("primaryZoomIn")??document.getElementById("zoomInButton"),zoomOut:document.getElementById("primaryZoomOut")??document.getElementById("zoomOutButton"),print:document.getElementById("printButton"),editorCommentButton:document.getElementById("editorCommentButton"),editorCommentParamsToolbar:document.getElementById("editorCommentParamsToolbar"),editorFreeTextButton:document.getElementById("primaryEditorFreeText")??document.getElementById("editorFreeTextButton"),editorFreeTextParamsToolbar:document.getElementById("editorFreeTextParamsToolbar"),editorHighlightButton:document.getElementById("primaryEditorHighlight")??document.getElementById("editorHighlightButton"),editorHighlightParamsToolbar:document.getElementById("editorHighlightParamsToolbar"),editorHighlightColorPicker:document.getElementById("editorHighlightColorPicker"),editorInkButton:document.getElementById("primaryEditorInk")??document.getElementById("editorInkButton"),editorInkParamsToolbar:document.getElementById("editorInkParamsToolbar"),editorStampButton:document.getElementById("primaryEditorStamp")??document.getElementById("editorStampButton"),presentationModeButton:document.getElementById("presentationMode"),editorStampParamsToolbar:document.getElementById("editorStampParamsToolbar"),editorSignatureButton:document.getElementById("primaryEditorSignatureButton")??document.getElementById("editorSignatureButton"),editorSignatureParamsToolbar:document.getElementById("editorSignatureParamsToolbar"),download:document.getElementById("downloadButton"),movePageUp:document.getElementById("movePageUpButton"),movePageDown:document.getElementById("movePageDownButton")},secondaryToolbar:{toolbar:document.getElementById("secondaryToolbar"),toggleButton:document.getElementById("secondaryToolbarToggle"),presentationModeButton:document.getElementById("secondaryPresentationMode"),openFileButton:document.getElementById("secondaryOpenFile"),printButton:document.getElementById("secondaryPrintButton"),downloadButton:document.getElementById("secondaryDownload"),viewBookmarkButton:document.getElementById("viewBookmark"),firstPageButton:document.getElementById("firstPage"),lastPageButton:document.getElementById("lastPage"),pageRotateCwButton:document.getElementById("pageRotateCw"),pageRotateCcwButton:document.getElementById("pageRotateCcw"),cursorSelectToolButton:document.getElementById("cursorSelectTool"),cursorHandToolButton:document.getElementById("cursorHandTool"),scrollPageButton:document.getElementById("scrollPage"),scrollVerticalButton:document.getElementById("scrollVertical"),scrollHorizontalButton:document.getElementById("scrollHorizontal"),scrollWrappedButton:document.getElementById("scrollWrapped"),spreadNoneButton:document.getElementById("spreadNone"),spreadOddButton:document.getElementById("spreadOdd"),spreadEvenButton:document.getElementById("spreadEven"),imageAltTextSettingsButton:document.getElementById("imageAltTextSettings"),imageAltTextSettingsSeparator:document.getElementById("imageAltTextSettingsSeparator"),documentPropertiesButton:document.getElementById("documentProperties")},viewsManager:{outerContainer:document.getElementById("outerContainer"),toggleButton:document.getElementById("viewsManagerToggleButton")??document.getElementById("primarySidebarToggle")??document.getElementById("sidebarToggleButton"),sidebarContainer:document.getElementById("viewsManager")??document.getElementById("sidebarContainer"),resizer:document.getElementById("viewsManagerResizer")??document.getElementById("sidebarResizer"),thumbnailButton:document.getElementById("thumbnailsViewMenu")??document.getElementById("viewThumbnail"),outlineButton:document.getElementById("outlinesViewMenu")??document.getElementById("viewOutline"),attachmentsButton:document.getElementById("attachmentsViewMenu")??document.getElementById("viewAttachments"),layersButton:document.getElementById("layersViewMenu")??document.getElementById("viewLayers"),viewsManagerSelectorButton:document.getElementById("viewsManagerSelectorButton"),viewsManagerSelectorOptions:document.getElementById("viewsManagerSelectorOptions"),thumbnailsView:document.getElementById("thumbnailsView")??document.getElementById("thumbnailView"),outlinesView:document.getElementById("outlinesView")??document.getElementById("outlineView"),attachmentsView:document.getElementById("attachmentsView"),layersView:document.getElementById("layersView"),viewsManagerAddFileButton:document.getElementById("viewsManagerAddFileButton"),viewsManagerCurrentOutlineButton:document.getElementById("viewsManagerCurrentOutlineButton")??document.getElementById("currentOutlineItem"),viewsManagerHeaderLabel:document.getElementById("viewsManagerHeaderLabel"),viewsManagerStatus:document.getElementById("viewsManagerStatus"),viewsManagerStatusBar:{viewsManagerStatusAction:document.getElementById("viewsManagerStatusAction"),viewsManagerStatusActionDeselectButton:document.getElementById("viewsManagerStatusActionDeselectButton"),viewsManagerStatusActionLabel:document.getElementById("viewsManagerStatusActionLabel")},viewsManagerUndoBar:{viewsManagerStatusUndo:document.getElementById("viewsManagerStatusUndo"),viewsManagerStatusUndoLabel:document.getElementById("viewsManagerStatusUndoLabel"),viewsManagerStatusUndoButton:document.getElementById("viewsManagerStatusUndoButton"),viewsManagerStatusUndoCloseButton:document.getElementById("viewsManagerStatusUndoCloseButton")},manageMenu:{button:document.getElementById("viewsManagerStatusActionButton"),menu:document.getElementById("viewsManagerStatusActionOptions"),copy:document.getElementById("viewsManagerStatusActionCopy"),cut:document.getElementById("viewsManagerStatusActionCut"),delete:document.getElementById("viewsManagerStatusActionDelete"),exportSelected:document.getElementById("viewsManagerStatusActionExport")}},findBar:{bar:document.getElementById("findbar"),toggleButton:document.getElementById("primaryViewFind")??document.getElementById("viewFindButton"),findField:document.getElementById("findInput"),highlightAllCheckbox:document.getElementById("findHighlightAll"),caseSensitiveCheckbox:document.getElementById("findMatchCase"),findMultipleCheckbox:document.getElementById("findMultiple"),matchRegExpCheckbox:document.getElementById("matchRegExp"),matchDiacriticsCheckbox:document.getElementById("findMatchDiacritics"),entireWordCheckbox:document.getElementById("findEntireWord"),findMsg:document.getElementById("findMsg"),findResultsCount:document.getElementById("findResultsCount"),findPreviousButton:document.getElementById("findPreviousButton")??document.getElementById("findPrevious"),findNextButton:document.getElementById("findNextButton")??document.getElementById("findNext")},passwordOverlay:{dialog:document.getElementById("passwordDialog"),label:document.getElementById("passwordText"),input:document.getElementById("password"),submitButton:document.getElementById("passwordSubmit"),cancelButton:document.getElementById("passwordCancel")},documentProperties:{dialog:document.getElementById("documentPropertiesDialog"),closeButton:document.getElementById("documentPropertiesClose"),fields:{fileName:document.getElementById("fileNameField"),fileSize:document.getElementById("fileSizeField"),title:document.getElementById("titleField"),author:document.getElementById("authorField"),subject:document.getElementById("subjectField"),keywords:document.getElementById("keywordsField"),creationDate:document.getElementById("creationDateField"),modificationDate:document.getElementById("modificationDateField"),creator:document.getElementById("creatorField"),producer:document.getElementById("producerField"),version:document.getElementById("versionField"),pageCount:document.getElementById("pageCountField"),pageSize:document.getElementById("pageSizeField"),linearized:document.getElementById("linearizedField")}},altTextDialog:{dialog:document.getElementById("altTextDialog"),optionDescription:document.getElementById("descriptionButton"),optionDecorative:document.getElementById("decorativeButton"),textarea:document.getElementById("descriptionTextarea"),cancelButton:document.getElementById("altTextCancel"),saveButton:document.getElementById("altTextSave")},newAltTextDialog:{dialog:document.getElementById("newAltTextDialog"),title:document.getElementById("newAltTextTitle"),descriptionContainer:document.getElementById("newAltTextDescriptionContainer"),textarea:document.getElementById("newAltTextDescriptionTextarea"),disclaimer:document.getElementById("newAltTextDisclaimer"),learnMore:document.getElementById("newAltTextLearnMore"),imagePreview:document.getElementById("newAltTextImagePreview"),createAutomatically:document.getElementById("newAltTextCreateAutomatically"),createAutomaticallyButton:document.getElementById("newAltTextCreateAutomaticallyButton"),downloadModel:document.getElementById("newAltTextDownloadModel"),downloadModelDescription:document.getElementById("newAltTextDownloadModelDescription"),error:document.getElementById("newAltTextError"),errorCloseButton:document.getElementById("newAltTextCloseButton"),cancelButton:document.getElementById("newAltTextCancel"),notNowButton:document.getElementById("newAltTextNotNow"),saveButton:document.getElementById("newAltTextSave")},altTextSettingsDialog:{dialog:document.getElementById("altTextSettingsDialog"),createModelButton:document.getElementById("createModelButton"),learnMore:document.getElementById("altTextSettingsLearnMore"),showAltTextDialogButton:document.getElementById("showAltTextDialogButton"),altTextSettingsCloseButton:document.getElementById("altTextSettingsCloseButton"),closeButton:document.getElementById("altTextSettingsCloseButton")},addSignatureDialog:{dialog:document.getElementById("addSignatureDialog"),panels:document.getElementById("addSignatureActionContainer"),typeButton:document.getElementById("addSignatureTypeButton"),typeInput:document.getElementById("addSignatureTypeInput"),drawButton:document.getElementById("addSignatureDrawButton"),drawSVG:document.getElementById("addSignatureDraw"),drawPlaceholder:document.getElementById("addSignatureDrawPlaceholder"),drawThickness:document.getElementById("addSignatureDrawThickness"),imageButton:document.getElementById("addSignatureImageButton"),imageSVG:document.getElementById("addSignatureImage"),imagePlaceholder:document.getElementById("addSignatureImagePlaceholder"),imagePicker:document.getElementById("addSignatureFilePicker"),imagePickerLink:document.getElementById("addSignatureImageBrowse"),description:document.getElementById("addSignatureDescription"),clearButton:document.getElementById("clearSignatureButton"),saveContainer:document.getElementById("addSignatureSaveContainer"),saveCheckbox:document.getElementById("addSignatureSaveCheckbox"),errorBar:document.getElementById("addSignatureError"),errorTitle:document.getElementById("addSignatureErrorTitle"),errorDescription:document.getElementById("addSignatureErrorDescription"),errorCloseButton:document.getElementById("addSignatureErrorCloseButton"),cancelButton:document.getElementById("addSignatureCancelButton"),addButton:document.getElementById("addSignatureAddButton")},editSignatureDialog:{dialog:document.getElementById("editSignatureDescriptionDialog"),description:document.getElementById("editSignatureDescription"),editSignatureView:document.getElementById("editSignatureView"),cancelButton:document.getElementById("editSignatureCancelButton"),updateButton:document.getElementById("editSignatureUpdateButton")},annotationEditorParams:{editorCommentsSidebar:document.getElementById("editorCommentsSidebar"),editorCommentsSidebarCount:document.getElementById("editorCommentsSidebarCount"),editorCommentsSidebarTitle:document.getElementById("editorCommentsSidebarTitle"),editorCommentsSidebarCloseButton:document.getElementById("editorCommentsSidebarCloseButton"),editorCommentsSidebarList:document.getElementById("editorCommentsSidebarList"),editorCommentsSidebarResizer:document.getElementById("editorCommentsSidebarResizer"),editorFreeTextFontSize:document.getElementById("editorFreeTextFontSize"),editorFreeTextColor:document.getElementById("editorFreeTextColor"),editorInkColor:document.getElementById("editorInkColor"),editorInkThickness:document.getElementById("editorInkThickness"),editorInkOpacity:document.getElementById("editorInkOpacity"),editorStampAddImage:document.getElementById("editorStampAddImage"),editorSignatureAddSignature:document.getElementById("editorSignatureAddSignature"),editorFreeHighlightThickness:document.getElementById("editorFreeHighlightThickness"),editorHighlightShowAll:document.getElementById("editorHighlightShowAll")},editorUndoBar:{container:document.getElementById("editorUndoBar"),message:document.getElementById("editorUndoBarMessage"),undoButton:document.getElementById("editorUndoBarUndoButton"),closeButton:document.getElementById("editorUndoBarCloseButton")},editCommentDialog:{dialog:document.getElementById("commentManagerDialog"),toolbar:document.getElementById("commentManagerToolbar"),title:document.getElementById("commentManagerTitle"),textInput:document.getElementById("commentManagerTextInput"),cancelButton:document.getElementById("commentManagerCancelButton"),saveButton:document.getElementById("commentManagerSaveButton")}}}(),i=new CustomEvent("webviewerloaded",{bubbles:!0,cancelable:!0,detail:{source:window}});document.dispatchEvent(i);t.cspPolicyService=e;Vw.run(t)}document.blockUnblockOnload?.(!0);globalThis.STANDALONE_VIEWER&&("interactive"===document.readyState||"complete"===document.readyState?webViewerLoad():document.addEventListener("DOMContentLoaded",webViewerLoad,!0));const zw=new CustomEvent("ngxViewerFileHasBeenLoaded",{detail:{PDFViewerApplication:Vw,PDFViewerApplicationConstants:Uw,PDFViewerApplicationOptions:AppOptions,webViewerLoad}});document.dispatchEvent(zw);export{Vw as PDFViewerApplication,Uw as PDFViewerApplicationConstants,AppOptions as PDFViewerApplicationOptions,webViewerLoad};