1var iA=Object.defineProperty;var Km=d=>{throw TypeError(d)};var nA=(d,e,t)=>e in d?iA(d,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[e]=t;var R=(d,e,t)=>nA(d,typeof e!="symbol"?e+"":e,t),yp=(d,e,t)=>e.has(d)||Km("Cannot "+t);var r=(d,e,t)=>(yp(d,e,"read from private field"),t?t.call(d):e.get(d)),y=(d,e,t)=>e.has(d)?Km("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(d):e.set(d,t),g=(d,e,t,s)=>(yp(d,e,"write to private field"),s?s.call(d,t):e.set(d,t),t),b=(d,e,t)=>(yp(d,e,"access private method"),t);var Xt=(d,e,t,s)=>({set _(i){g(d,e,i,t)},get _(){return r(d,e,s)}});import{u as rA,r as Te,A as aA,j as Ce,s as ca}from"./index-TQVWzZ9o.js";var oA={9306(d,e,t){var s=t(4901),i=t(6823),n=TypeError;d.exports=function(a){if(s(a))return a;throw new n(i(a)+" is not a function")}},3506(d,e,t){var s=t(3925),i=String,n=TypeError;d.exports=function(a){if(s(a))return a;throw new n("Can't set "+i(a)+" as a prototype")}},7080(d,e,t){var s=t(4402).has;d.exports=function(i){return s(i),i}},3463(d){var e=TypeError;d.exports=function(t){if(typeof t=="string")return t;throw new e("Argument is not a string")}},4328(d,e,t){var s=t(4995),i=new s.WeakMap,n=s.set,a=s.remove;d.exports=function(o){return n(i,o,1),a(i,o),o}},6557(d,e,t){var s=t(4995).has;d.exports=function(i){return s(i),i}},6469(d,e,t){var s=t(8227),i=t(2360),n=t(4913).f,a=s("unscopables"),o=Array.prototype;o[a]===void 0&&n(o,a,{configurable:!0,value:i(null)}),d.exports=function(l){o[a][l]=!0}},679(d,e,t){var s=t(1625),i=TypeError;d.exports=function(n,a){if(s(a,n))return n;throw new i("Incorrect invocation")}},3972(d,e,t){var s=t(34),i=String,n=TypeError;d.exports=function(a){if(a===void 0||s(a))return a;throw new n(i(a)+" is not an object or undefined")}},8551(d,e,t){var s=t(34),i=String,n=TypeError;d.exports=function(a){if(s(a))return a;throw new n(i(a)+" is not an object")}},4154(d,e,t){var s=t(6955),i=TypeError;d.exports=function(n){if(s(n)==="Uint8Array")return n;throw new i("Argument is not an Uint8Array")}},7811(d){d.exports=typeof ArrayBuffer<"u"&&typeof DataView<"u"},7394(d,e,t){var s=t(4576),i=t(6706),n=t(2195),a=s.ArrayBuffer,o=s.TypeError;d.exports=a&&i(a.prototype,"byteLength","get")||function(l){if(n(l)!=="ArrayBuffer")throw new o("ArrayBuffer expected");return l.byteLength}},3238(d,e,t){var s=t(4576),i=t(7811),n=t(7394),a=s.DataView;d.exports=function(o){if(!i||n(o)!==0)return!1;try{return new a(o),!1}catch{return!0}}},5169(d,e,t){var s=t(3238),i=TypeError;d.exports=function(n){if(s(n))throw new i("ArrayBuffer is detached");return n}},4644(d,e,t){var s=t(7811),i=t(3724),n=t(4576),a=t(4901),o=t(34),l=t(9297),h=t(6955),c=t(6823),u=t(6699),f=t(6840),p=t(2106),m=t(1625),v=t(2787),A=t(2967),w=t(8227),S=t(3392),x=t(1181),T=x.enforce,E=x.get,C=n.Int8Array,P=C&&C.prototype,O=n.Uint8ClampedArray,I=O&&O.prototype,D=C&&v(C),M=P&&v(P),U=Object.prototype,L=n.TypeError,B=w("toStringTag"),W=S("TYPED_ARRAY_TAG"),k="TypedArrayConstructor",N=s&&!!A&&h(n.opera)!=="Opera",X=!1,z,lt,vt,dt={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},rt={BigInt64Array:8,BigUint64Array:8},bt=function(ut){if(!o(ut))return!1;var kt=h(ut);return kt==="DataView"||l(dt,kt)||l(rt,kt)},He=function(q){var ut=v(q);if(o(ut)){var kt=E(ut);return kt&&l(kt,k)?kt[k]:He(ut)}},H=function(q){if(!o(q))return!1;var ut=h(q);return l(dt,ut)||l(rt,ut)},F=function(q){if(H(q))return q;throw new L("Target is not a typed array")},$=function(q){if(a(q)&&(!A||m(D,q)))return q;throw new L(c(q)+" is not a typed array constructor")},it=function(q,ut,kt,Pe){if(i){if(kt)for(var Ie in dt){var ae=n[Ie];if(ae&&l(ae.prototype,q))try{delete ae.prototype[q]}catch{try{ae.prototype[q]=ut}catch{}}}(!M[q]||kt)&&f(M,q,kt?ut:N&&P[q]||ut,Pe)}},yt=function(q,ut,kt){var Pe,Ie;if(i){if(A){if(kt){for(Pe in dt)if(Ie=n[Pe],Ie&&l(Ie,q))try{delete Ie[q]}catch{}}if(!D[q]||kt)try{return f(D,q,kt?ut:N&&D[q]||ut)}catch{}else return}for(Pe in dt)Ie=n[Pe],Ie&&(!Ie[q]||kt)&&f(Ie,q,ut)}};for(z in dt)lt=n[z],vt=lt&<.prototype,vt?T(vt)[k]=lt:N=!1;for(z in rt)lt=n[z],vt=lt&<.prototype,vt&&(T(vt)[k]=lt);if((!N||!a(D)||D===Function.prototype)&&(D=function(){throw new L("Incorrect invocation")},N))for(z in dt)n[z]&&A(n[z],D);if((!N||!M||M===U)&&(M=D.prototype,N))for(z in dt)n[z]&&A(n[z].prototype,M);if(N&&v(I)!==M&&A(I,M),i&&!l(M,B)){X=!0,p(M,B,{configurable:!0,get:function(){return o(this)?this[W]:void 0}});for(z in dt)n[z]&&u(n[z].prototype,W,z)}d.exports={NATIVE_ARRAY_BUFFER_VIEWS:N,TYPED_ARRAY_TAG:X&&W,aTypedArray:F,aTypedArrayConstructor:$,exportTypedArrayMethod:it,exportTypedArrayStaticMethod:yt,getTypedArrayConstructor:He,isView:bt,isTypedArray:H,TypedArray:D,TypedArrayPrototype:M}},5370(d,e,t){var s=t(6198);d.exports=function(i,n,a){for(var o=0,l=arguments.length>2?a:s(n),h=new i(l);l>o;)h[o]=n[o++];return h}},9617(d,e,t){var s=t(5397),i=t(5610),n=t(6198),a=function(o){return function(l,h,c){var u=s(l),f=n(u);if(f===0)return!o&&-1;var p=i(c,f),m;if(o&&h!==h){for(;f>p;)if(m=u[p++],m!==m)return!0}else for(;f>p;p++)if((o||p in u)&&u[p]===h)return o||p||0;return!o&&-1}};d.exports={includes:a(!0),indexOf:a(!1)}},4527(d,e,t){var s=t(3724),i=t(4376),n=TypeError,a=Object.getOwnPropertyDescriptor,o=s&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(l){return l instanceof TypeError}}();d.exports=o?function(l,h){if(i(l)&&!a(l,"length").writable)throw new n("Cannot set read only .length");return l.length=h}:function(l,h){return l.length=h}},7680(d,e,t){var s=t(9504);d.exports=s([].slice)},2804(d){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=e+"+/",s=e+"-_",i=function(n){for(var a={},o=0;o<64;o++)a[n.charAt(o)]=o;return a};d.exports={i2c:t,c2i:i(t),i2cUrl:s,c2iUrl:i(s)}},6319(d,e,t){var s=t(8551),i=t(9539);d.exports=function(n,a,o,l){try{return l?a(s(o)[0],o[1]):a(o)}catch(h){i(n,"throw",h)}}},2195(d,e,t){var s=t(9504),i=s({}.toString),n=s("".slice);d.exports=function(a){return n(i(a),8,-1)}}
1,6955(d,e,t){var s=t(2140),i=t(4901),n=t(2195),a=t(8227),o=a("toStringTag"),l=Object,h=n(function(){return arguments}())==="Arguments",c=function(u,f){try{return u[f]}catch{}};d.exports=s?n:function(u){var f,p,m;return u===void 0?"Undefined":u===null?"Null":typeof(p=c(f=l(u),o))=="string"?p:h?n(f):(m=n(f))==="Object"&&i(f.callee)?"Arguments":m}},7740(d,e,t){var s=t(9297),i=t(5031),n=t(7347),a=t(4913);d.exports=function(o,l,h){for(var c=i(l),u=a.f,f=n.f,p=0;p<c.length;p++){var m=c[p];!s(o,m)&&!(h&&s(h,m))&&u(o,m,f(l,m))}}},2211(d,e,t){var s=t(9039);d.exports=!s(function(){function i(){}return i.prototype.constructor=null,Object.getPrototypeOf(new i)!==i.prototype})},2529(d){d.exports=function(e,t){return{value:e,done:t}}},6699(d,e,t){var s=t(3724),i=t(4913),n=t(6980);d.exports=s?function(a,o,l){return i.f(a,o,n(1,l))}:function(a,o,l){return a[o]=l,a}},6980(d){d.exports=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}}},4659(d,e,t){var s=t(3724),i=t(4913),n=t(6980);d.exports=function(a,o,l){s?i.f(a,o,n(0,l)):a[o]=l}},2106(d,e,t){var s=t(283),i=t(4913);d.exports=function(n,a,o){return o.get&&s(o.get,a,{getter:!0}),o.set&&s(o.set,a,{setter:!0}),i.f(n,a,o)}},6840(d,e,t){var s=t(4901),i=t(4913),n=t(283),a=t(9433);d.exports=function(o,l,h,c){c||(c={});var u=c.enumerable,f=c.name!==void 0?c.name:l;if(s(h)&&n(h,f,c),c.global)u?o[l]=h:a(l,h);else{try{c.unsafe?o[l]&&(u=!0):delete o[l]}catch{}u?o[l]=h:i.f(o,l,{value:h,enumerable:!1,configurable:!c.nonConfigurable,writable:!c.nonWritable})}return o}},6279(d,e,t){var s=t(6840);d.exports=function(i,n,a){for(var o in n)s(i,o,n[o],a);return i}},9433(d,e,t){var s=t(4576),i=Object.defineProperty;d.exports=function(n,a){try{i(s,n,{value:a,configurable:!0,writable:!0})}catch{s[n]=a}return a}},3724(d,e,t){var s=t(9039);d.exports=!s(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})},4055(d,e,t){var s=t(4576),i=t(34),n=s.document,a=i(n)&&i(n.createElement);d.exports=function(o){return a?n.createElement(o):{}}},6837(d){var e=TypeError,t=9007199254740991;d.exports=function(s){if(s>t)throw new e("Maximum allowed index exceeded");return s}},5002(d){d.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}
1,InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},8727(d){d.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2839(d,e,t){var s=t(4576),i=s.navigator,n=i&&i.userAgent;d.exports=n?String(n):""},9519(d,e,t){var s=t(4576),i=t(2839),n=s.process,a=s.Deno,o=n&&n.versions||a&&a.version,l=o&&o.v8,h,c;l&&(h=l.split("."),c=h[0]>0&&h[0]<4?1:+(h[0]+h[1])),!c&&i&&(h=i.match(/Edge\/(\d+)/),(!h||h[1]>=74)&&(h=i.match(/Chrome\/(\d+)/),h&&(c=+h[1]))),d.exports=c},6193(d,e,t){var s=t(9504),i=Error,n=s("".replace),a=function(h){return String(new i(h).stack)}("zxcasd"),o=/\n\s*at [^:]*:[^\n]*/,l=o.test(a);d.exports=function(h,c){if(l&&typeof h=="string"&&!i.prepareStackTrace)for(;c--;)h=n(h,o,"");return h}},6518(d,e,t){var s=t(4576),i=t(7347).f,n=t(6699),a=t(6840),o=t(9433),l=t(7740),h=t(2796);d.exports=function(c,u){var f=c.target,p=c.global,m=c.stat,v,A,w,S,x,T;if(p?A=s:m?A=s[f]||o(f,{}):A=s[f]&&s[f].prototype,A)for(w in u){if(x=u[w],c.dontCallGetSet?(T=i(A,w),S=T&&T.value):S=A[w],v=h(p?w:f+(m?".":"#")+w,c.forced),!v&&S!==void 0){if(typeof x==typeof S)continue;l(x,S)}(c.sham||S&&S.sham)&&n(x,"sham",!0),a(A,w,x,c)}}},9039(d){d.exports=function(e){try{return!!e()}catch{return!0}}},8745(d,e,t){var s=t(616),i=Function.prototype,n=i.apply,a=i.call;d.exports=typeof Reflect=="object"&&Reflect.apply||(s?a.bind(n):function(){return a.apply(n,arguments)})},6080(d,e,t){var s=t(7476),i=t(9306),n=t(616),a=s(s.bind);d.exports=function(o,l){return i(o),l===void 0?o:n?a(o,l):function(){return o.apply(l,arguments)}}},616(d,e,t){var s=t(9039);d.exports=!s(function(){var i=(function(){}).bind();return typeof i!="function"||i.hasOwnProperty("prototype")})},9565(d,e,t){var s=t(616),i=Function.prototype.call;d.exports=s?i.bind(i):function(){return i.apply(i,arguments)}},350(d,e,t){var s=t(3724),i=t(9297),n=Function.prototype,a=s&&Object.getOwnPropertyDescriptor,o=i(n,"name"),l=o&&(function(){}).name==="something",h=o&&(!s||s&&a(n,"name").configurable);d.exports={EXISTS:o,PROPER:l,CONFIGURABLE:h}},6706(d,e,t){var s=t(9504),i=t(9306);d.exports=function(n,a,o){try{return s(i(Object.getOwnPropertyDescriptor(n,a)[o]))}catch{}}},7476(d,e,t){var s=t(2195),i=t(9504);d.exports=function(n){if(s(n)==="Function")return i(n)}},9504(d,e,t){var s=t(616),i=Function.prototype,n=i.call,a=s&&i.bind.bind(n,n);d.exports=s?a:function(o){return function(){return n.apply(o,arguments)}}},944(d){var e=TypeError;d.exports=function(t){var s=t&&t.alphabet;if(s===void 0||s==="base64"||s==="base64url")return s||"base64";throw new e("Incorrect `alphabet` option")}},7751(d,e,t){var s=t(4576),i=t(4901),n=function(a){return i(a)?a:void 0};d.exports=function(a,o){return arguments.length<2?n(s[a]):s[a]&&s[a][o]}},1767(d){d.exports=function(e){return{iterator:e,next:e.next,done:!1}}},8646(d,e,t){var s=t(9565),i=t(8551),n=t(1767),a=t(3085);d.exports=function(o,l){(!l||typeof o!="string")&&i(o);var h=a(o);return n(i(h!==void 0?s(h,o):o))}},8563(d,e,t){var s=t(9565),i=t(4901),n=t(8551),a=t(6823),o=t(3085),l=TypeError;d.exports=function(h,c){var u=arguments.length<2?o(h):c;if(i(u))return n(s(u,h));throw new l(a(h)+" is not iterable")}},3085(d,e,t){var s=t(2195),i=t(4117),n=t(5966),a=t(8227),o=a("iterator"),l=Array.prototype;d.exports=function(h){if(!i(h))return n(h,o)||n(h,"@@iterator")||(s(h)==="Arguments"?l[o]:void 0)}},5966(d,e,t){var s=t(9306),i=t(4117);d.exports=function(n,a){var o=n[a];return i(o)?void 0:s(o)}},3789(d,e,t){var s=t(9306),i=t(8551),n=t(9565),a=t(1291),o=t(1767),l="Invalid size",h=RangeError,c=TypeError,u=Math.max,f=function(p,m){this.set=p,this.size=u(m,0),this.has=s(p.has),this.keys=s(p.keys)};f.prototype={getIterator:function(){return o(i(n(this.keys,this.set)))},includes:function(p){return n(this.has,this.set,p)}},d.exports=function(p){i(p);var m=+p.size;if(m!==m)throw new c(l);var v=a(m);if(v<0)throw new h(l);return new f(p,v)}},4576(d){var e=function(t){return t&&t.Math===Math&&t};d.exports=e(typeof globalThis=="object"&&globalThis)||e(typeof window=="object"&&window)||e(typeof self=="object"&&self)||e(typeof global=="object"&&global)||e(typeof this=="object"&&this)||function(){return this}()||Function("return this")()},9297(d,e,t){var s=t(9504),i=t(8981),n=s({}.hasOwnProperty);d.exports=Object.hasOwn||function(o,l){return n(i(o),l)}},421(d){d.exports={}},397(d,e,t){var s=t(7751);d.exports=s("document","documentElement")},5917(d,e,t){var s=t(3724),i=t(9039),n=t(4055);d.exports=!s&&!i(function(){return Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a!==7})},7055(d,e,t){var s=t(9504),i=t(9039),n=t(2195),a=Object,o=s("".split);d.exports=i(function(){return!a("z").propertyIsEnumerable(0)})?function(l){return n(l)==="String"?o(l,""):a(l)}:a},3167(d,e,t){var s=t(4901),i=t(34),n=t(2967);d.exports=function(a,o,l){var h,c;
1return n&&s(h=o.constructor)&&h!==l&&i(c=h.prototype)&&c!==l.prototype&&n(a,c),a}},3706(d,e,t){var s=t(9504),i=t(4901),n=t(7629),a=s(Function.toString);i(n.inspectSource)||(n.inspectSource=function(o){return a(o)}),d.exports=n.inspectSource},1181(d,e,t){var s=t(8622),i=t(4576),n=t(34),a=t(6699),o=t(9297),l=t(7629),h=t(6119),c=t(421),u="Object already initialized",f=i.TypeError,p=i.WeakMap,m,v,A,w=function(E){return A(E)?v(E):m(E,{})},S=function(E){return function(C){var P;if(!n(C)||(P=v(C)).type!==E)throw new f("Incompatible receiver, "+E+" required");return P}};if(s||l.state){var x=l.state||(l.state=new p);x.get=x.get,x.has=x.has,x.set=x.set,m=function(E,C){if(x.has(E))throw new f(u);return C.facade=E,x.set(E,C),C},v=function(E){return x.get(E)||{}},A=function(E){return x.has(E)}}else{var T=h("state");c[T]=!0,m=function(E,C){if(o(E,T))throw new f(u);return C.facade=E,a(E,T,C),C},v=function(E){return o(E,T)?E[T]:{}},A=function(E){return o(E,T)}}d.exports={set:m,get:v,has:A,enforce:w,getterFor:S}},4209(d,e,t){var s=t(8227),i=t(6269),n=s("iterator"),a=Array.prototype;d.exports=function(o){return o!==void 0&&(i.Array===o||a[n]===o)}},4376(d,e,t){var s=t(2195);d.exports=Array.isArray||function(n){return s(n)==="Array"}},1108(d,e,t){var s=t(6955);d.exports=function(i){var n=s(i);return n==="BigInt64Array"||n==="BigUint64Array"}},4901(d){var e=typeof document=="object"&&document.all;d.exports=typeof e>"u"&&e!==void 0?function(t){return typeof t=="function"||t===e}:function(t){return typeof t=="function"}},2796(d,e,t){var s=t(9039),i=t(4901),n=/#|\.prototype\./,a=function(u,f){var p=l[o(u)];return p===c?!0:p===h?!1:i(f)?s(f):!!f},o=a.normalize=function(u){return String(u).replace(n,".").toLowerCase()},l=a.data={},h=a.NATIVE="N",c=a.POLYFILL="P";d.exports=a},4117(d){d.exports=function(e){return e==null}},34(d,e,t){var s=t(4901);d.exports=function(i){return typeof i=="object"?i!==null:s(i)}},3925(d,e,t){var s=t(34);d.exports=function(i){return s(i)||i===null}},6395(d){d.exports=!1},5810(d,e,t){var s=t(34),i=t(1181).get;d.exports=function(a){if(!s(a))return!1;var o=i(a);return!!o&&o.type==="RawJSON"}},757(d,e,t){var s=t(7751),i=t(4901),n=t(1625),a=t(7040),o=Object;d.exports=a?function(l){return typeof l=="symbol"}:function(l){var h=s("Symbol");return i(h)&&n(h.prototype,o(l))}},507(d,e,t){var s=t(9565);d.exports=function(i,n,a){for(var o=a?i:i.iterator,l=i.next,h,c;!(h=s(l,o)).done;)if(c=n(h.value),c!==void 0)return c}},2652(d,e,t){var s=t(6080),i=t(9565),n=t(8551),a=t(6823),o=t(4209),l=t(6198),h=t(1625),c=t(8563),u=t(3085),f=t(9539),p=TypeError,m=function(A,w){this.stopped=A,this.result=w},v=m.prototype;d.exports=function(A,w,S){var x=S&&S.that,T=!!(S&&S.AS_ENTRIES),E=!!(S&&S.IS_RECORD),C=!!(S&&S.IS_ITERATOR),P=!!(S&&S.INTERRUPTED),O=s(w,x),I,D,M,U,L,B,W,k=function(z){var lt=I;return I=void 0,lt&&f(lt,"normal"),new m(!0,z)},N=function(z){return T?(n(z),P?O(z[0],z[1],k):O(z[0],z[1])):P?O(z,k):O(z)};if(E)I=A.iterator;else if(C)I=A;else{if(D=u(A),!D)throw new p(a(A)+" is not iterable");if(o(D)){for(M=0,U=l(A);U>M;M++)if(L=N(A[M]),L&&h(v,L))return L;return new m(!1)}I=c(A,D)}for(B=E?A.next:I.next;!(W=i(B,I)).done;){var X=W.value;try{L=N(X)}catch(z){if(I)f(I,"throw",z);else throw z}if(typeof L=="object"&&L&&h(v,L))return L}return new m(!1)}},6859(d){d.exports=function(e){e.iterator=e.next=e.nextHandler=e.mapper=e.predicate=e.inner=e.iterables=e.iters=e.openIters=e.padding=e.finishResults=e.buffer=null}},1385(d,e,t){var s=t(9539);d.exports=function(i,n,a){for(var o=i.length-1;o>=0;o--)if(i[o]!==void 0)try{a=s(i[o].iterator,n,a)}catch(l){n="throw",a=l}if(n==="throw")throw a;return a}},9539(d,e,t){var s=t(9565),i=t(8551),n=t(5966);d.exports=function(a,o,l){var h,c;i(a);try{if(h=n(a,"return"),!h){if(o==="throw")throw l;return l}h=s(h,a)}catch(u){c=!0,h=u}if(o==="throw")throw l;if(c)throw h;return i(h),l}},9462(d,e,t){var s=t(9565),i=t(2360),n=t(6699),a=t(6279),o=t(8227),l=t(1181),h=t(5966),c=t(7657).IteratorPrototype,u=t(2529),f=t(9539),p=t(1385),m=t(6859),v=o("toStringTag"),A="IteratorHelper",w="WrapForValidIterator",S="normal",x="throw",T=l.set,E=function(O){var I=l.getterFor(O?w:A);return a(i(c),{next:function(){var M=I(this);if(O)return M.nextHandler();if(M.done)return u(void 0,!0);try{var U=M.nextHandler();return M.done&&m(M),M.returnHandlerResult?U:u(U,M.done)}catch(L){throw M.done=!0,m(M),L}},return:function(){var D=I(this),M=D.iterator,U=D.inner,L=D.openIters,B=D.done;if(D.done=!0,O){var W=h(M,"return");return W?s(W,M):u(void 0,!0)}if(m(D),B)return u(void 0,!0);if(U)try{f(U.iterator,S)}
1catch(k){return f(M,x,k)}if(L)try{p(L,S)}catch(k){if(M)return f(M,x,k);throw k}return M&&f(M,S),u(void 0,!0)}})},C=E(!0),P=E(!1);n(P,v,"Iterator Helper"),d.exports=function(O,I,D){var M=function(L,B){B?(B.iterator=L.iterator,B.next=L.next):B=L,B.type=I?w:A,B.returnHandlerResult=!!D,B.nextHandler=O,B.counter=0,B.done=!1,T(this,B)};return M.prototype=I?C:P,M}},684(d){d.exports=function(e,t){var s=typeof Iterator=="function"&&Iterator.prototype[e];if(s)try{s.call({next:null},t).next()}catch{return!0}}},4549(d,e,t){var s=t(4576);d.exports=function(i,n){var a=s.Iterator,o=a&&a.prototype,l=o&&o[i],h=!1;if(l)try{l.call({next:function(){return{done:!0}},return:function(){h=!0}},-1)}catch(c){c instanceof n||(h=!1)}if(!h)return l}},7657(d,e,t){var s=t(9039),i=t(4901),n=t(34),a=t(2360),o=t(2787),l=t(6840),h=t(8227),c=t(6395),u=h("iterator"),f=!1,p,m,v;[].keys&&(v=[].keys(),"next"in v?(m=o(o(v)),m!==Object.prototype&&(p=m)):f=!0);var A=!n(p)||s(function(){var w={};return p[u].call(w)!==w});A?p={}:c&&(p=a(p)),i(p[u])||l(p,u,function(){return this}),d.exports={IteratorPrototype:p,BUGGY_SAFARI_ITERATORS:f}},6269(d){d.exports=Object.create?Object.create(null):{}},6198(d,e,t){var s=t(8014);d.exports=function(i){return s(i.length)}},283(d,e,t){var s=t(9504),i=t(9039),n=t(4901),a=t(9297),o=t(3724),l=t(350).CONFIGURABLE,h=t(3706),c=t(1181),u=c.enforce,f=c.get,p=String,m=Object.defineProperty,v=s("".slice),A=s("".replace),w=s([].join),S=o&&!i(function(){return m(function(){},"length",{value:8}).length!==8}),x=String(String).split("String"),T=d.exports=function(E,C,P){v(p(C),0,7)==="Symbol("&&(C="["+A(p(C),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),P&&P.getter&&(C="get "+C),P&&P.setter&&(C="set "+C),(!a(E,"name")||l&&E.name!==C)&&(o?m(E,"name",{value:C,configurable:!0}):E.name=C),S&&P&&a(P,"arity")&&E.length!==P.arity&&m(E,"length",{value:P.arity});try{P&&a(P,"constructor")&&P.constructor?o&&m(E,"prototype",{writable:!1}):E.prototype&&(E.prototype=void 0)}catch{}var O=u(E);return a(O,"source")||(O.source=w(x,typeof C=="string"?C:"")),E};Function.prototype.toString=T(function(){return n(this)&&f(this).source||h(this)},"toString")},2248(d,e,t){var s=t(9504),i=Map.prototype;d.exports={Map,set:s(i.set),get:s(i.get),has:s(i.has),remove:s(i.delete),proto:i}},741(d){var e=Math.ceil,t=Math.floor;d.exports=Math.trunc||function(i){var n=+i;return(n>0?t:e)(n)}},7819(d,e,t){var s=t(9039);d.exports=!s(function(){var i="9007199254740993",n=JSON.rawJSON(i);return!JSON.isRawJSON(n)||JSON.stringify(n)!==i})},6043(d,e,t){var s=t(9306),i=TypeError,n=function(a){var o,l;this.promise=new a(function(h,c){if(o!==void 0||l!==void 0)throw new i("Bad Promise constructor");o=h,l=c}),this.resolve=s(o),this.reject=s(l)};d.exports.f=function(a){return new n(a)}},2603(d,e,t){var s=t(655);d.exports=function(i,n){return i===void 0?arguments.length<2?"":n:s(i)}},4149(d){var e=RangeError;d.exports=function(t){if(t===t)return t;throw new e("NaN is not allowed")}},2360(d,e,t){var s=t(8551),i=t(6801),n=t(8727),a=t(421),o=t(397),l=t(4055),h=t(6119),c=">",u="<",f="prototype",p="script",m=h("IE_PROTO"),v=function(){},A=function(E){return u+p+c+E+u+"/"+p+c},w=function(E){E.write(A("")),E.close();var C=E.parentWindow.Object;return E=null,C},S=function(){var E=l("iframe"),C="java"+p+":",P;return E.style.display="none",o.appendChild(E),E.src=String(C),P=E.contentWindow.document,P.open(),P.write(A("document.F=Object")),P.close(),P.F},x,T=function(){try{x=new ActiveXObject("htmlfile")}catch{}T=typeof document<"u"?document.domain&&x?w(x):S():w(x);for(var E=n.length;E--;)delete T[f][n[E]];return T()};a[m]=!0,d.exports=Object.create||function(C,P){var O;return C!==null?(v[f]=s(C),O=new v,v[f]=null,O[m]=C):O=T(),P===void 0?O:i.f(O,P)}},6801(d,e,t){var s=t(3724),i=t(8686),n=t(4913),a=t(8551),o=t(5397),l=t(1072);e.f=s&&!i?Object.defineProperties:function(c,u){a(c);for(var f=o(u),p=l(u),m=p.length,v=0,A;m>v;)n.f(c,A=p[v++],f[A]);return c}},4913(d,e,t){var s=t(3724),i=t(5917),n=t(8686),a=t(8551),o=t(6969),l=TypeError,h=Object.defineProperty,c=Object.getOwnPropertyDescriptor,u="enumerable",f="configurable",p="writable";e.f=s?n?function(v,A,w){if(a(v),A=o(A),a(w),typeof v=="function"&&A==="prototype"&&"value"in w&&p in w&&!w[p]){var S=c(v,A);
1S&&S[p]&&(v[A]=w.value,w={configurable:f in w?w[f]:S[f],enumerable:u in w?w[u]:S[u],writable:!1})}return h(v,A,w)}:h:function(v,A,w){if(a(v),A=o(A),a(w),i)try{return h(v,A,w)}catch{}if("get"in w||"set"in w)throw new l("Accessors not supported");return"value"in w&&(v[A]=w.value),v}},7347(d,e,t){var s=t(3724),i=t(9565),n=t(8773),a=t(6980),o=t(5397),l=t(6969),h=t(9297),c=t(5917),u=Object.getOwnPropertyDescriptor;e.f=s?u:function(p,m){if(p=o(p),m=l(m),c)try{return u(p,m)}catch{}if(h(p,m))return a(!i(n.f,p,m),p[m])}},8480(d,e,t){var s=t(1828),i=t(8727),n=i.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(o){return s(o,n)}},3717(d,e){e.f=Object.getOwnPropertySymbols},2787(d,e,t){var s=t(9297),i=t(4901),n=t(8981),a=t(6119),o=t(2211),l=a("IE_PROTO"),h=Object,c=h.prototype;d.exports=o?h.getPrototypeOf:function(u){var f=n(u);if(s(f,l))return f[l];var p=f.constructor;return i(p)&&f instanceof p?p.prototype:f instanceof h?c:null}},1625(d,e,t){var s=t(9504);d.exports=s({}.isPrototypeOf)},1828(d,e,t){var s=t(9504),i=t(9297),n=t(5397),a=t(9617).indexOf,o=t(421),l=s([].push);d.exports=function(h,c){var u=n(h),f=0,p=[],m;for(m in u)!i(o,m)&&i(u,m)&&l(p,m);for(;c.length>f;)i(u,m=c[f++])&&(~a(p,m)||l(p,m));return p}},1072(d,e,t){var s=t(1828),i=t(8727);d.exports=Object.keys||function(a){return s(a,i)}},8773(d,e){var t={}.propertyIsEnumerable,s=Object.getOwnPropertyDescriptor,i=s&&!t.call({1:2},1);e.f=i?function(a){var o=s(this,a);return!!o&&o.enumerable}:t},2967(d,e,t){var s=t(6706),i=t(34),n=t(7750),a=t(3506);
1d.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var o=!1,l={},h;try{h=s(Object.prototype,"__proto__","set"),h(l,[]),o=l instanceof Array}catch{}return function(u,f){return n(u),a(f),i(u)&&(o?h(u,f):u.__proto__=f),u}}():void 0)},4270(d,e,t){var s=t(9565),i=t(4901),n=t(34),a=TypeError;d.exports=function(o,l){var h,c;if(l==="string"&&i(h=o.toString)&&!n(c=s(h,o))||i(h=o.valueOf)&&!n(c=s(h,o))||l!=="string"&&i(h=o.toString)&&!n(c=s(h,o)))return c;throw new a("Can't convert object to primitive value")}},5031(d,e,t){var s=t(7751),i=t(9504),n=t(8480),a=t(3717),o=t(8551),l=i([].concat);d.exports=s("Reflect","ownKeys")||function(c){var u=n.f(o(c)),f=a.f;return f?l(u,f(c)):u}},8235(d,e,t){var s=t(9504),i=t(9297),n=SyntaxError,a=parseInt,o=String.fromCharCode,l=s("".charAt),h=s("".slice),c=s(/./.exec),u={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":` 2`,"\\r":"\r","\\t":" "},f=/^[\da-f]{4}$/i,p=/^[\u0000-\u001F]$/;d.exports=function(m,v){for(var A=!0,w="";v<m.length;){var S=l(m,v);if(S==="\\"){var x=h(m,v,v+2);if(i(u,x))w+=u[x],v+=2;else if(x==="\\u"){v+=2;var T=h(m,v,v+4);if(!c(f,T))throw new n("Bad Unicode escape at: "+v);w+=o(a(T,16)),v+=4}else throw new n('Unknown escape sequence: "'+x+'"')}else if(S==='"'){A=!1,v++;break}else{if(c(p,S))throw new n("Bad control character in string literal at: "+v);w+=S,v++}}if(A)throw new n("Unterminated string at: "+v);return{value:w,end:v}}},1103(d){d.exports=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}}},3438(d,e,t){var s=t(8551),i=t(34),n=t(6043);d.exports=function(a,o){if(s(a),i(o)&&o.constructor===a)return o;var l=n.f(a),h=l.resolve;return h(o),l.promise}},7750(d,e,t){var s=t(4117),i=TypeError;d.exports=function(n){if(s(n))throw new i("Can't call method on "+n);return n}},9286(d,e,t){var s=t(4402),i=t(8469),n=s.Set,a=s.add;d.exports=function(o){var l=new n;return i(o,function(h){a(l,h)}),l}},3440(d,e,t){var s=t(7080),i=t(4402),n=t(9286),a=t(5170),o=t(3789),l=t(8469),h=t(507),c=i.has,u=i.remove;d.exports=function(p){var m=s(this),v=o(p),A=n(m);return a(A)<=v.size?l(A,function(w){v.includes(w)&&u(A,w)}):h(v.getIterator(),function(w){c(A,w)&&u(A,w)}),A}},4402(d,e,t){var s=t(9504),i=Set.prototype;d.exports={Set,add:s(i.add),has:s(i.has),remove:s(i.delete),proto:i}},8750(d,e,t){var s=t(7080),i=t(4402),n=t(5170),a=t(3789),o=t(8469),l=t(507),h=i.Set,c=i.add,u=i.has;d.exports=function(p){var m=s(this),v=a(p),A=new h;return n(m)>v.size?l(v.getIterator(),function(w){u(m,w)&&c(A,w)}):o(m,function(w){v.includes(w)&&c(A,w)}),A}},4449(d,e,t){var s=t(7080),i=t(4402).has,n=t(5170),a=t(3789),o=t(8469),l=t(507),h=t(9539);d.exports=function(u){var f=s(this),p=a(u);if(n(f)<=p.size)return o(f,function(v){if(p.includes(v))return!1},!0)!==!1;var m=p.getIterator();return l(m,function(v){if(i(f,v))return h(m.iterator,"normal",!1)})!==!1}},3838(d,e,t){var s=t(7080),i=t(5170),n=t(8469),a=t(3789);d.exports=function(l){var h=s(this),c=a(l);return i(h)>c.size?!1:n(h,function(u){if(!c.includes(u))return!1},!0)!==!1}},8527(d,e,t){var s=t(7080),i=t(4402).has,n=t(5170),a=t(3789),o=t(507),l=t
2(9539);d.exports=function(c){var u=s(this),f=a(c);if(n(u)<f.size)return!1;var p=f.getIterator();return o(p,function(m){if(!i(u,m))return l(p.iterator,"normal",!1)})!==!1}},8469(d,e,t){var s=t(9504),i=t(507),n=t(4402),a=n.Set,o=n.proto,l=s(o.forEach),h=s(o.keys),c=h(new a).next;d.exports=function(u,f,p){return p?i({iterator:h(u),next:c},f):l(u,f)}},4916(d,e,t){var s=t(7751),i=function(a){return{size:a,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},n=function(a){return{size:a,has:function(){return!0},keys:function(){throw new Error("e")}}};d.exports=function(a,o){var l=s("Set");try{new l()[a](i(0));try{return new l()[a](i(-1)),!1}catch{if(!o)return!0;try{return new l()[a](n(-1/0)),!1}catch{var h=new l([1,2]);return o(h[a](n(1/0)))}}}catch{return!1}}},9835(d){d.exports=function(e){try{var t=new Set,s={size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return t.clear(),t.add(4),function(){return{done:!0}}}})}},i=t[e](s);return i.size===1&&i.values().next().value===4}catch{return!1}}},5170(d,e,t){var s=t(6706),i=t(4402);d.exports=s(i.proto,"size","get")||function(n){return n.size}},3650(d,e,t){var s=t(7080),i=t(4402),n=t(9286),a=t(3789),o=t(507),l=i.add,h=i.has,c=i.remove;d.exports=function(f){var p=s(this),m=a(f).getIterator(),v=n(p);return o(m,function(A){h(p,A)?c(v,A):l(v,A)}),v}},4204(d,e,t){var s=t(7080),i=t(4402).add,n=t(9286),a=t(3789),o=t(507);d.exports=function(h){var c=s(this),u=a(h).getIterator(),f=n(c);return o(u,function(p){i(f,p)}),f}},6119(d,e,t){var s=t(5745),i=t(3392),n=s("keys");d.exports=function(a){return n[a]||(n[a]=i(a))}},7629(d,e,t){var s=t(6395),i=t(4576),n=t(9433),a="__core-js_shared__",o=d.exports=i[a]||n(a,{});(o.versions||(o.versions=[])).push({version:"3.50.0",mode:s?"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.50.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745(d,e,t){var s=t(7629),i=Object.create||Object;d.exports=function(n,a){return s[n]||(s[n]=a||i(null))}},4495(d,e,t){var s=t(9519),i=t(9039),n=t(4576),a=n.String;d.exports=!!Object.getOwnPropertySymbols&&!i(function(){var o=Symbol("symbol detection");return!a(o)||!(Object(o)instanceof Symbol)||!Symbol.sham&&s&&s<41})},1240(d,e,t){var s=t(9504);d.exports=s(1.1.valueOf)},5610(d,e,t){var s=t(1291),i=Math.max,n=Math.min;d.exports=function(a,o){var l=s(a);return l<0?i(l+o,0):n(l,o)}},5854(d,e,t){var s=t(2777),i=TypeError;d.exports=function(n){var a=s(n,"number");if(typeof a=="number")throw new i("Can't convert number to bigint");return BigInt(a)}},5397(d,e,t){var s=t(7055),i=t(7750);d.exports=function(n){return s(i(n))}},1291(d,e,t){var s=t(741);d.exports=function(i){var n=+i;return n!==n||n===0?0:s(n)}},8014(d,e,t){var s=t(1291),i=Math.min;d.exports=function(n){var a=s(n);return a>0?i(a,9007199254740991):0}},8981(d,e,t){var s=t(7750),i=Object;d.exports=function(n){return i(s(n))}},9590(d,e,t){var s=t(1291),i=RangeError;d.exports=function(n){var a=s(n);if(a<0)throw new i("The argument can't be less than 0");return a}},2777(d,e,t){var s=t(9565),i=t(34),n=t(757),a=t(5966),o=t(4270),l=t(8227),h=TypeError,c=l("toPrimitive");d.exports=function(u,f){if(!i(u)||n(u))return u;var p=a(u,c),m;if(p){if(f===void 0&&(f="default"),m=s(p,u,f),!i(m)||n(m))return m;throw new h("Can't convert object to primitive value")}return f===void 0&&(f="number"),o(u,f)}},6969(d,e,t){var s=t(2777),i=t(757);d.exports=function(n){var a=s(n,"string");return i(a)?a:a+""}},2140(d,e,t){var s=t(8227),i=s("toStringTag"),n={};n[i]="z",d.exports=String(n)==="[object z]"},655(d,e,t){var s=t(6955),i=String;d.exports=function(n){if(s(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return i(n)}},6823(d){var e=String;d.exports=function(t){try{return e(t)}catch{return"Object"}}},3392(d,e,t){var s=t(9504),i=0,n=Math.random(),a=s(1.1.toString);d.exports=function(o){return"Symbol("+(o===void 0?"":o)+")_"+a(++i+n,36)}},9143(d,e,t){var s=t(4576),i=t(9504),n=t(3972),a=t(3463),o=t(9297),l=t(2804),h=t(944),c=t(5169),u=l.c2i,f=l.c2iUrl,p=s.SyntaxError,m=s.TypeError,v=s.Array,A=i("".charAt),w=Math.floor,S=function(E,C){for(var P=E.length;C<P;C++){var O=A(E,C);if(O!==" "&&O!==" "&&O!==` 3`&&O!=="\f"&&O!=="\r")break}return C},x=function(E,C,P){var O=E.length;O<4&&(E+=O===2?"AA":"A");var I=(C[A(E,0)]<<18)+(C[A(E,1)]<<12)+(C[A(E,2)]<<6)+C[A(E,3)],D=[I>>16&255,I>>8&255,I&255];if(O===2){if(P&&D[1]!==0)throw new p("Extra bits");return[D[0]]}if(O===3){if(P&&D[2]!==0)throw new p("Extra bits");return[D[0],D[1]]}return D},T=function(E,C,P){for(var O=C.length,I=0;I<O;I++)E[P+I]=C[I];return P+O};d.exports=function(E,C,P,O){a(E),n(C);var I=h(C)==="base64"?u:f,D=C?C.lastChunkHandling:void 0;
vendor: 19,110 bytes, line 3
3if(D===void 0&&(D="loose"),D!=="loose"&&D!=="strict"&&D!=="stop-before-partial")throw new m("Incorrect `lastChunkHandling` option");P&&c(P.buffer);var M=E.length,U=P||v(w(M*3/4)),L=0,B=0,W="",k=0;if(O)for(;;){if(k=S(E,k),k===M){if(W.length>0){if(D==="stop-before-partial")break;if(D==="loose"){if(W.length===1)throw new p("Malformed padding: exactly one additional character");L=T(U,x(W,I,!1),L)}else throw new p("Missing padding")}B=M;break}var N=A(E,k);if(++k,N==="="){if(W.length<2)throw new p("Padding is too early");if(k=S(E,k),W.length===2){if(k===M){if(D==="stop-before-partial")break;throw new p("Malformed padding: only one =")}A(E,k)==="="&&(++k,k=S(E,k))}if(k<M)throw new p("Unexpected character after padding");L=T(U,x(W,I,D==="strict"),L),B=M;break}if(!o(I,N))throw new p("Unexpected character");var X=O-L;if(X===1&&W.length===2||X===2&&W.length===3||(W+=N,W.length===4&&(L=T(U,x(W,I,!1),L),W="",B=k,L===O)))break}return P||(U.length=L),{bytes:U,read:B,written:L}}},2303(d,e,t){var s=t(4576),i=t(9504),n=s.Uint8Array,a=s.SyntaxError,o=Math.min,l=i("".match);d.exports=function(h,c){var u=h.length;if(u%2!==0)throw new a("String should be an even number of characters");for(var f=c?o(c.length,u/2):u/2,p=c||new n(f),m=l(h,/[\S\s]{2}/g),v=0;v<f;v++){var A=+("0x"+m[v]+"0");if(A!==A)throw new a("String should only contain hex characters");p[v]=A>>4}return{bytes:p,read:v<<1}}},7416(d,e,t){var s=t(9039),i=t(8227),n=t(3724),a=t(6395),o=i("iterator");d.exports=!s(function(){var l=new URL("b?a=1&b=2&c=3","https://a"),h=l.searchParams,c=new URLSearchParams("a=1&a=2&b=3"),u="";return l.pathname="c%20d",h.forEach(function(f,p){h.delete("b"),u+=p+f}),c.delete("a",2),c.delete("b",void 0),a&&(!l.toJSON||!c.has("a",1)||c.has("a",2)||!c.has("a",void 0)||c.has("b"))||!h.size&&(a||!n)||!h.sort||l.href!=="https://a/c%20d?a=1&c=3"||h.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!h[o]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("https://ÑеÑÑ").host!=="xn--e1aybc"||new URL("https://a#б").hash!=="#%D0%B1"||u!=="a1c3"||new URL("https://x",void 0).host!=="x"})},7040(d,e,t){var s=t(4495);d.exports=s&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},8686(d,e,t){var s=t(3724),i=t(9039);d.exports=s&&i(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})},2812(d){var e=TypeError;d.exports=function(t,s){if(t<s)throw new e("Not enough arguments");return t}},8622(d,e,t){var s=t(4576),i=t(4901),n=s.WeakMap;d.exports=i(n)&&/native code/.test(String(n))},4995(d,e,t){var s=t(9504),i=WeakMap.prototype;d.exports={WeakMap,set:s(i.set),get:s(i.get),has:s(i.has),remove:s(i.delete)}},8227(d,e,t){var s=t(4576),i=t(5745),n=t(9297),a=t(3392),o=t(4495),l=t(7040),h=s.Symbol,c=i("wks"),u=l?h.for||h:h&&h.withoutSetter||a;d.exports=function(f){return n(c,f)||(c[f]=o&&n(h,f)?h[f]:u("Symbol."+f)),c[f]}},4423(d,e,t){var s=t(6518),i=t(9617).includes,n=t(9039),a=t(6469),o=n(function(){return!Array(1).includes()}),l=n(function(){return[,1].includes(void 0,1)});s({target:"Array",proto:!0,forced:o||l},{includes:function(c){return i(this,c,arguments.length>1?arguments[1]:void 0)}}),a("includes")},4114(d,e,t){var s=t(6518),i=t(8981),n=t(6198),a=t(4527),o=t(6837),l=t(9039),h=l(function(){return[].push.call({length:4294967296},1)!==4294967297}),c=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(f){return f instanceof TypeError}},u=h||!c();s({target:"Array",proto:!0,arity:1,forced:u},{push:function(p){var m=i(this),v=n(m),A=arguments.length;o(v+A);for(var w=0;w<A;w++)m[v]=arguments[w],v++;return a(m,v),v}})},8111(d,e,t){var s=t(6518),i=t(4576),n=t(679),a=t(8551),o=t(4901),l=t(2787),h=t(2106),c=t(4659),u=t(9039),f=t(9297),p=t(8227),m=t(7657).IteratorPrototype,v=t(3724),A=t(6395),w="constructor",S="Iterator",x=p("toStringTag"),T=TypeError,E=i[S],C=A||!o(E)||E.prototype!==m||!u(function(){E({})}),P=function(){if(n(this,m),l(this)===m)throw new T("Abstract class Iterator not directly constructable")},O=function(I,D){v?h(m,I,{configurable:!0,get:function(){return D},set:function(M){if(a(this),this===m)throw new T("You can't redefine this property");f(this,I)?this[I]=M:c(this,I,M)}}):m[I]=D};f(m,x)||O(x,S),(C||!f(m,w)||m[w]===Object)&&O(w,P),P.prototype=m,s({global:!0,constructor:!0,forced:C},{Iterator:P})},9314(d,e,t){var s=t(6518),i=t(9565),n=t(8551),a=t(1767),o=t(4149),l=t(9590),h=t(9539),c=t(9462),u=t(684),f=t(4549),p=t(6395),m=RangeError,v=1/0,A=!p&&!u("drop",0),w=!p&&!A&&f("drop",RangeError),S=p||A||w||!function(){try{Iterator.prototype.drop.call({next:function(){return{done:!0}}},9007199254740992)}catch(T){return T instanceof m}}(),x=c(function(){for(var T=this.iterator,E=this.next,C,P;this.remaining;)if(this.remaining--,C=n(i(E,T)),P=this.done=!!C.done,P)return;if(C=n(i(E,T)),P=this.done=!!C.done,!P)return C.value});s({target:"Iterator",proto:!0,real:!0,forced:S},{drop:function(E){n(this);var C;try{if(C=l(o(+E)),C>9007199254740991&&C!==v)throw new m("The argument should be a safe integer")}catch(P){h(this,"throw",P)}return w?i(w,this,C):new x(a(this),{remaining:C})}})},1148(d,e,t){var s=t(6518),i=t(9565),n=t(2652),a=t(9306),o=t(8551),l=t(1767),h=t(9539),c=t(4549),u=c("every",TypeError);s({target:"Iterator",proto:!0,real:!0,forced:u},{every:function(p){o(this);try{a(p)}catch(A){h(this,"throw",A)}if(u)return i(u,this,p);var m=l(this),v=0;return!n(m,function(A,w){if(!p(A,v++))return w()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},2489(d,e,t){var s=t(6518),i=t(9565),n=t(9306),a=t(8551),o=t(1767),l=t(9462),h=t(6319),c=t(6395),u=t(9539),f=t(684),p=t(4549),m=!c&&!f("filter",function(){}),v=!c&&!m&&p("filter",TypeError),A=c||m||v,w=l(function(){for(var S=this.iterator,x=this.predicate,T=this.next,E,C,P;;){if(E=a(i(T,S)),C=this.done=!!E.done,C)return;if(P=E.value,h(S,x,[P,this.counter++],!0))return P}});s({target:"Iterator",proto:!0,real:!0,forced:A},{filter:function(x){a(this);try{n(x)}catch(T){u(this,"throw",T)}return v?i(v,this,x):new w(o(this),{predicate:x})}})},116(d,e,t){var s=t(6518),i=t(9565),n=t(2652),a=t(9306),o=t(8551),l=t(1767),h=t(9539),c=t(4549),u=c("find",TypeError);s({target:"Iterator",proto:!0,real:!0,forced:u},{find:function(p){o(this);try{a(p)}catch(A){h(this,"throw",A)}if(u)return i(u,this,p);var m=l(this),v=0;return n(m,function(A,w){if(p(A,v++))return w(A)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})},531(d,e,t){var s=t(6518),i=t(9565),n=t(9306),a=t(8551),o=t(1767),l=t(8646),h=t(9462),c=t(9539),u=t(9039),f=t(6395),p=t(684),m=t(4549),v=!f&&u(function(){return[1].values().flatMap(function(){return[1]}).find(function(){return!0})!==1}),A=!f&&!v&&!p("flatMap",function(){}),w=!f&&!v&&!A&&m("flatMap",TypeError),S=f||v||A||w,x=h(function(){for(var T=this.iterator,E=this.mapper,C,P;;){if(P=this.inner)try{if(C=a(i(P.next,P.iterator)),!C.done)return C.value;this.inner=null}catch(O){c(T,"throw",O)}if(C=a(i(this.next,T)),this.done=!!C.done)return;try{this.inner=l(E(C.value,this.counter++),!1)}catch(O){c(T,"throw",O)}}});s({target:"Iterator",proto:!0,real:!0,forced:S},{flatMap:function(E){a(this);try{n(E)}catch(C){c(this,"throw",C)}return w?i(w,this,E):new x(o(this),{mapper:E,inner:null})}})},7588(d,e,t){var s=t(6518),i=t(9565),n=t(2652),a=t(9306),o=t(8551),l=t(1767),h=t(9539),c=t(4549),u=c("forEach",TypeError);s({target:"Iterator",proto:!0,real:!0,forced:u},{forEach:function(p){o(this);try{a(p)}catch(A){h(this,"throw",A)}if(u)return i(u,this,p);var m=l(this),v=0;n(m,function(A){p(A,v++)},{IS_RECORD:!0})}})},1701(d,e,t){var s=t(6518),i=t(9565),n=t(9306),a=t(8551),o=t(1767),l=t(9462),h=t(6319),c=t(9539),u=t(684),f=t(4549),p=t(6395),m=!p&&!u("map",function(){}),v=!p&&!m&&f("map",TypeError),A=p||m||v,w=l(function(){var S=this.iterator,x=a(i(this.next,S)),T=this.done=!!x.done;if(!T)return h(S,this.mapper,[x.value,this.counter++],!0)});s({target:"Iterator",proto:!0,real:!0,forced:A},{map:function(x){a(this);try{n(x)}catch(T){c(this,"throw",T)}return v?i(v,this,x):new w(o(this),{mapper:x})}})},3579(d,e,t){var s=t(6518),i=t(9565),n=t(2652),a=t(9306),o=t(8551),l=t(1767),h=t(9539),c=t(4549),u=c("some",TypeError);s({target:"Iterator",proto:!0,real:!0,forced:u},{some:function(p){o(this);try{a(p)}catch(A){h(this,"throw",A)}if(u)return i(u,this,p);var m=l(this),v=0;return n(m,function(A,w){if(p(A,v++))return w()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},4972(d,e,t){var s=t(6518),i=t(9565),n=t(8551),a=t(1767),o=t(4149),l=t(9590),h=t(9462),c=t(9539),u=t(684),f=t(4549),p=t(6395),m=RangeError,v=1/0,A=!p&&!u("take",1),w=!p&&!A&&f("take",RangeError),S=p||A||w||!function(){try{Iterator.prototype.take.call({next:function(){return{done:!0}}},9007199254740992)}catch(T){return T instanceof m}}(),x=h(function(){var T=this.iterator;if(!this.remaining--)return this.done=!0,c(T,"normal",void 0);var E=n(i(this.next,T)),C=this.done=!!E.done;if(!C)return E.value});s({target:"Iterator",proto:!0,real:!0,forced:S},{take:function(E){n(this);var C;try{if(C=l(o(+E)),C>9007199254740991&&C!==v)throw new m("The argument should be a safe integer")}catch(P){c(this,"throw",P)}return w?i(w,this,C):new x(a(this),{remaining:C})}})},1806(d,e,t){var s=t(6518),i=t(8551),n=t(4659),a=t(2652),o=t(1767);s({target:"Iterator",proto:!0,real:!0},{toArray:function(){var h=[],c=0;return a(o(i(this)),function(u){n(h,c++,u)},{IS_RECORD:!0}),h}})},9112(d,e,t){var s=t(6518),i=t(3724),n=t(4576),a=t(7751),o=t(9504),l=t(9565),h=t(4901),c=t(34),u=t(4376),f=t(9297),p=t(655),m=t(6198),v=t(4659),A=t(9039),w=t(8235),S=t(4495),x=n.JSON,T=n.Number,E=n.SyntaxError,C=x&&x.parse,P=a("Object","keys"),O=Object.getOwnPropertyDescriptor,I=o("".charAt),D=o("".slice),M=o(/./.exec),U=o([].push),L=/^\d$/,B=/^[1-9]$/,W=/^[\d-]$/,k=/^[\t\n\r ]$/,N=0,X=1,z=function(H,F){H=p(H);var $=new rt(H,0),it=$.parse(),yt=it.value,q=$.skip(k,it.end);if(q<H.length)throw new E('Unexpected extra character: "'+I(H,q)+'" after the parsed data at: '+q);return h(F)?lt({"":yt},"",F,it):yt},lt=function(H,F,$,it){var yt=H[F],q=it&&yt===it.value,ut=q&&typeof it.source=="string"?{source:it.source}:{},kt,Pe,Ie,ae,ai;if(c(yt)){var Xh=u(yt),nl=q?it.nodes:Xh?[]:{};if(Xh)for(kt=nl.length,Ie=m(yt),ae=0;ae<Ie;ae++)vt(yt,ae,lt(yt,""+ae,$,ae<kt?nl[ae]:void 0));else for(Pe=P(yt),Ie=m(Pe),ae=0;ae<Ie;ae++)ai=Pe[ae],vt(yt,ai,lt(yt,ai,$,f(nl,ai)?nl[ai]:void 0))}return l($,H,F,yt,ut)},vt=function(H,F,$){if(i){var it=O(H,F);if(it&&!it.configurable)return}$===void 0?delete H[F]:v(H,F,$)},dt=function(H,F,$,it){this.value=H,this.end=F,this.source=$,this.nodes=it},rt=function(H,F){this.source=H,this.index=F};rt.prototype={fork:function(H){return new rt(this.source,H)},parse:function(){var H=this.source,F=this.skip(k,this.index),$=this.fork(F),it=I(H,F);if(M(W,it))return $.number();switch(it){case"{":return $.object();case"[":return $.array();case'"':return $.string();case"t":return $.keyword(!0);case"f":return $.keyword(!1);case"n":return $.keyword(null)}throw new E('Unexpected character: "'+it+'" at: '+F)},node:function(H,F,$,it,yt){return new dt(F,it,H?null:D(this.source,$,it),yt)},object:function(){for(var H=this.source,F=this.index+1,$=!1,it={},yt={},q=!1;F<H.length;){if(F=this.until(['"',"}"],F),I(H,F)==="}"&&!$){F++,q=!0;break}var ut=this.fork(F).string(),kt=ut.value;F=ut.end,F=this.until([":"],F)+1,F=this.skip(k,F),ut=this.fork(F).parse(),v(yt,kt,ut),v(it,kt,ut.value),F=this.until([",","}"],ut.end);var Pe=I(H,F);if(Pe===",")$=!0,F++;else if(Pe==="}"){F++,q=!0;break}}if(!q)throw new E("Unterminated object at: "+F);return this.node(X,it,this.index,F,yt)},array:function(){for(var H=this.source,F=this.index+1,$=!1,it=[],yt=[],q=!1;F<H.length;){if(F=this.skip(k,F),I(H,F)==="]"&&!$){F++,q=!0;break}var ut=this.fork(F).parse();if(U(yt,ut),U(it,ut.value),F=this.until([",","]"],ut.end),I(H,F)===",")$=!0,F++;else if(I(H,F)==="]"){F++,q=!0;break}}if(!q)throw new E("Unterminated array at: "+F);return this.node(X,it,this.index,F,yt)},string:function(){var H=this.index,F=w(this.source,this.index+1);return this.node(N,F.value,H,F.end)},number:function(){var H=this.source,F=this.index,$=F;if(I(H,$)==="-"&&$++,I(H,$)==="0")$++;else if(M(B,I(H,$)))$=this.skip(L,$+1);else throw new E("Failed to parse number at: "+$);if(I(H,$)==="."){var it=$+1;if($=this.skip(L,it),it===$)throw new E("Failed to parse number's fraction at: "+$)}if(I(H,$)==="e"||I(H,$)==="E"){$++,(I(H,$)==="+"||I(H,$)==="-")&&$++;var yt=$;if($=this.skip(L,$),yt===$)throw new E("Failed to parse number's exponent value at: "+$)}return this.node(N,T(D(H,F,$)),F,$)},keyword:function(H){var F=""+H,$=this.index,it=$+F.length;if(D(this.source,$,it)!==F)throw new E("Failed to parse value at: "+$);return this.node(N,H,$,it)},skip:function(H,F){for(var $=this.source;F<$.length&&M(H,I($,F));F++);return F},until:function(H,F){F=this.skip(k,F);for(var $=I(this.source,F),it=0;it<H.length;it++)if(H[it]===$)return F;throw new E('Unexpected character: "'+$+'" at: '+F)}};var bt=A(function(){var H="9007199254740993",F;return C(H,function($,it,yt){F=yt.source}),F!==H}),He=S&&!A(function(){return 1/C("-0 ")!==-1/0});s({target:"JSON",stat:!0,forced:bt},{parse:function(F,$){return He&&!h($)?C(F):z(F,$)}})},3110(d,e,t){var s=t(6518),i=t(7751),n=t(9565),a=t(9504),o=t(9039),l=t(4376),h=t(4901),c=t(34),u=t(2360),f=t(5810),p=t(757),m=t(2195),v=t(1240),A=t(9617).includes,w=t(9297),S=t(655),x=t(8235),T=t(3392),E=t(4495),C=t(7819),P=String,O=TypeError,I=i("JSON","stringify"),D=i("BigInt"),M=a("".valueOf),U=a((!0).valueOf),L=D&&a(D.prototype.valueOf),B=a(/./.exec),W=a("".charAt),k=a("".charCodeAt),N=a("".replace),X=a("".slice),z=a([].push),lt=a([].pop),vt=a(1.1.toString),dt=/[\uD800-\uDFFF]/g,rt=/^[\uD800-\uDBFF]$/,bt=/^[\uDC00-\uDFFF]$/,He=/^\d+$/,H=T(),F=T(),$=T(),it=H.length,yt=F.length,q=!E||o(function(){var pt=i("Symbol")("stringify detection");return I([pt])!=="[null]"||I({a:pt})!=="{}"||I(Object(pt))!=="{}"}),ut=o(function(){return I("\uDF06\uD834")!=='"\\udf06\\ud834"'||I("\uDEAD")!=='"\\udead"'}),kt=C?i("JSON","isRawJSON"):f,Pe=q?function(pt,Lt,Wt){return I(pt,function(Ye,Ke){var ye=n(Lt,this,Ye,Ke);if(!p(ye))return ye},Wt)}:I,Ie=function(pt,Lt,Wt){var Ye=W(Wt,Lt-1),Ke=W(Wt,Lt+1);return B(rt,pt)&&!B(bt,Ke)||B(bt,pt)&&!B(rt,Ye)?"\\u"+vt(k(pt,0),16):pt},ae=function(pt){if(l(pt)){for(var Lt=pt.length,Wt=[],Ye=u(null),Ke=0;Ke<Lt;Ke++){var ye=pt[Ke],oi;if(typeof ye=="string")oi=ye;else if(typeof ye=="number"||m(ye)==="Number"||m(ye)==="String")oi=S(ye);else continue;w(Ye,oi)||(Ye[oi]=!0,z(Wt,oi))}return Wt}},ai=function(pt,Lt){try{return pt(Lt),!0}catch{return!1}},Xh=function(pt){var Lt=m(pt);return Lt==="Number"&&ai(v,pt)||Lt==="String"&&ai(M,pt)||Lt==="Boolean"&&ai(U,pt)||!!L&&Lt==="BigInt"&&ai(L,pt)},nl=function(pt){if(!c(pt)||h(pt)||l(pt))return!1;try{return!Xh(pt)}catch{return!0}},qb=function(pt,Lt){return{toJSON:function(){var Wt=pt[Lt];if(c(Wt)||typeof Wt=="bigint"){var Ye=Wt.toJSON;h(Ye)&&(Wt=n(Ye,Wt,Lt))}return Wt}}},tA=function(pt){for(var Lt=0,Wt=pt.length;Lt<Wt;Lt++)if(B(He,pt[Lt]))return F;return""},eA=function(pt,Lt,Wt){for(var Ye=u(null),Ke=0,ye=Lt.length;Ke<ye;Ke++){var oi=Lt[Ke];Ye[Wt+oi]=qb(pt,oi)}return Ye[$]=null,Ye};I&&s({target:"JSON",stat:!0,arity:3,forced:q||ut||!C},{stringify:function(Lt,Wt,Ye){var Ke=h(Wt)?Wt:void 0,ye=Ke?void 0:ae(Wt),oi=ye&&tA(ye),Gm=[],mp=[],Vm=[],Su,vp=!1,zm=!0,dn=Pe(Lt,function(Jh,Pi){if(Jh=P(Jh),ye){if(Jh===$){lt(mp),Su=lt(Vm);return}if(zm)zm=!1;else if(this!==Su&&!l(this)&&!A(ye,Jh))return}else Ke&&(Pi=n(Ke,this,Jh,Pi));if(kt(Pi))return C?Pi:(vp=!0,H+(z(Gm,Pi.rawJSON)-1));if(ye&&nl(Pi)){if(A(mp,Pi))throw new O("Converting circular structure to JSON");var Ym=eA(Pi,ye,oi);return z(mp,Pi),z(Vm,Su),Su=Ym,oi&&(vp=!0),Ym}return Pi},Ye);if(typeof dn!="string"||(ut&&(dn=N(dn,dt,Ie)),!vp))return dn;for(var Yh="",sA=dn.length,rl=0;rl<sA;rl++){var Wm=W(dn,rl);if(Wm==='"'){var Xm=x(dn,++rl).end-1,Kh=X(dn,rl,Xm);X(Kh,0,it)===H?Yh+=Gm[X(Kh,it)]:X(Kh,0,yt)===F?Yh+='"'+X(Kh,yt)+'"':Yh+='"'+Kh+'"',rl=Xm}else Yh+=Wm}return Yh}})},2731(d,e,t){var s=t(6518),i=t(9306),n=t(2248),a=t(6395),o=n.get,l=n.has,h=n.set;s({target:"Map",proto:!0,real:!0,forced:a},{getOrInsertComputed:function(u,f){var p=l(this,u);if(i(f),p)return o(this,u);u===0&&1/u===-1/0&&(u=0);var m=f(u);return h(this,u,m),m}})},5367(d,e,t){var s=t(6518),i=t(2248),n=t(6395),a=i.get,o=i.has,l=i.set;s({target:"Map",proto:!0,real:!0,forced:n},{getOrInsert:function(c,u){return o(this,c)?a(this,c):(l(this,c,u),u)}})},3068(d,e,t){var s=t(6518),i=t(9504),n=t(2652),a=RangeError,o=TypeError,l=1/0,h=NaN,c=Math.abs,u=Math.pow,f=i([].push),p=u(2,1023),m=u(2,53)-1,v=Number.MAX_VALUE,A=u(2,971),w={},S={},x={},T={},E={},C=function(P,O){var I=P+O,D=O-(I-P);return{hi:I,lo:D}};s({target:"Math",stat:!0},{sumPrecise:function(O){var I=[],D=0,M=T;switch(n(O,function(H){if(++D>m)throw new a("Maximum allowed index exceeded");if(typeof H!="number")throw new o("Value is not a number");M!==w&&(H!==H?M=w:H===l?M=M===S?w:x:H===-l?M=M===x?w:S:(H!==0||1/H===l)&&(M===T||M===E)&&(M=E,f(I,H)))}),M){case w:return h;case S:return-l;case x:return l;case T:return-0}for(var U=[],L=0,B,W,k,N,X,z,lt=0;lt<I.length;lt++){B=I[lt];for(var vt=0,dt=0;dt<U.length;dt++){if(W=U[dt],c(B)<c(W)&&(z=B,B=W,W=z),k=C(B,W),N=k.hi,X=k.lo,c(N)===l){var rt=N===l?1:-1;L+=rt,B=B-rt*p-rt*p,c(B)<c(W)&&(z=B,B=W,W=z),k=C(B,W),N=k.hi,X=k.lo}X!==0&&(U[vt++]=X),B=N}U.length=vt,B!==0&&f(U,B)}var bt=U.length-1;if(N=0,X=0,L!==0){var He=bt>=0?U[bt]:0;if(bt--,c(L)>1||L>0&&He>0||L<0&&He<0)return L>0?l:-l;if(k=C(L*p,He/2),N=k.hi,X=k.lo,X*=2,c(2*N)===l)return N>0?N===p&&X===-(A/2)&&bt>=0&&U[bt]<0?v:l:N===-p&&X===A/2&&bt>=0&&U[bt]>0?-v:-l;X!==0&&(U[++bt]=X,X=0),N*=2}for(;bt>=0&&(k=C(N,U[bt--]),N=k.hi,X=k.lo,X===0););return bt>=0&&(X<0&&U[bt]<0||X>0&&U[bt]>0)&&(W=X*2,B=N+W,W===B-N&&(N=B)),N}})},1689(d,e,t){var s=t(6518),i=t(4576),n=t(8745),a=t(7680),o=t(3438),l=t(6043),h=t(9306),c=t(1103),u=t(9039),f=i.Promise,p=!1,m=!f||!f.try||u(function(){var v=f.resolve();return f.try(function(A){return p=A===8,v},8)!==v})||!p;s({target:"Promise",stat:!0,forced:m},{try:function(v){var A=arguments.length>1?a(arguments,1):[],w=c(function(){return n(h(v),void 0,A)});if(!w.error)return o(this,w.value);var S=l.f(this),x=S.reject;return x(w.value),S.promise}})},7642(d,e,t){var s=t(6518),i=t(3440),n=t(9039),a=t(4916),o=!a("difference",function(h){return h.size===0}),l=o||n(function(){var h={size:1,has:function(){return!0},keys:function(){var u=0;return{next:function(){var f=u++>1;return c.has(1)&&c.clear(),{done:f,value:2}}}}},c=new Set([1,2,3,4]);return c.difference(h).size!==3});s({target:"Set",proto:!0,real:!0,forced:l},{difference:i})},8004(d,e,t){var s=t(6518),i=t(9039),n=t(8750),a=t(4916),o=!a("intersection",function(l){return l.size===2&&l.has(1)&&l.has(2)})||i(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});s({target:"Set",proto:!0,real:!0,forced:o},{intersection:n})},3853(d,e,t){var s=t(6518),i=t(4449),n=t(4916),a=!n("isDisjointFrom",function(o){return!o});s({target:"Set",proto:!0,real:!0,forced:a},{isDisjointFrom:i})},5876(d,e,t){var s=t(6518),i=t(3838),n=t(4916),a=!n("isSubsetOf",function(o){return o}
3);s({target:"Set",proto:!0,real:!0,forced:a},{isSubsetOf:i})},2475(d,e,t){var s=t(6518),i=t(8527),n=t(4916),a=!n("isSupersetOf",function(o){return!o});s({target:"Set",proto:!0,real:!0,forced:a},{isSupersetOf:i})},5024(d,e,t){var s=t(6518),i=t(3650),n=t(9835),a=t(4916),o=!a("symmetricDifference")||!n("symmetricDifference");s({target:"Set",proto:!0,real:!0,forced:o},{symmetricDifference:i})},1698(d,e,t){var s=t(6518),i=t(4204),n=t(9835),a=t(4916),o=!a("union")||!n("union");s({target:"Set",proto:!0,real:!0,forced:o},{union:i})},9577(d,e,t){var s=t(4644),i=t(1108),n=t(6198),a=t(1291),o=t(5854),l=s.aTypedArray,h=s.getTypedArrayConstructor,c=s.exportTypedArrayMethod,u=RangeError,f=function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(m){return m===8}}(),p=f&&function(){try{new Int8Array(1).with(-.5,1)}catch{return!0}}();c("with",function(m,v){var A=l(this),w=n(A),S=a(m),x=S<0?w+S:S,T=i(A)?o(v):+v;if(x>=w||x<0)throw new u("Incorrect index");for(var E=new(h(A))(w),C=0;C<w;C++)E[C]=C===x?T:A[C];return E},!f||p)},5213(d,e,t){var s=t(6518),i=t(4576),n=t(5370),a=t(9143),o=i.Uint8Array,l=!o||!o.fromBase64||!function(){try{o.fromBase64("a");return}catch{}try{o.fromBase64("",null)}catch{return!0}}();o&&s({target:"Uint8Array",stat:!0,forced:l},{fromBase64:function(c){var u=a(c,arguments.length>1?arguments[1]:void 0,null,9007199254740991);return n(o,u.bytes)}})},6632(d,e,t){var s=t(6518),i=t(4576),n=t(9143),a=t(4154),o=i.Uint8Array,l=!o||!o.prototype.setFromBase64||!function(){var h=new o([255,255,255,255,255]);try{h.setFromBase64("",null);return}catch{}try{h.setFromBase64("a");return}catch{}try{h.setFromBase64("MjYyZg===")}catch{return h[0]===50&&h[1]===54&&h[2]===50&&h[3]===255&&h[4]===255}}();o&&s({target:"Uint8Array",proto:!0,forced:l},{setFromBase64:function(c){a(this);var u=n(c,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:u.read,written:u.written}}})},4226(d,e,t){var s=t(6518),i=t(4576),n=t(3463),a=t(4154),o=t(5169),l=t(2303);function h(){try{var c=new ArrayBuffer(16,{maxByteLength:1024});new Uint8Array(c).setFromHex("cafed00d")}catch{return!0}}i.Uint8Array&&s({target:"Uint8Array",proto:!0,forced:h()},{setFromHex:function(u){a(this),n(u),o(this.buffer);var f=l(u,this).read;return{read:f,written:f/2}}})},9486(d,e,t){var s=t(6518),i=t(4576),n=t(9504),a=t(3972),o=t(4154),l=t(5169),h=t(2804),c=t(944),u=h.i2c,f=h.i2cUrl,p=Math.floor,m=Math.ceil,v=n("".charAt),A=i.Uint8Array,w=i.Array,S=n([].join),x=!A||!A.prototype.toBase64||!function(){try{var T=new A;T.toBase64(null)}catch{return!0}}();A&&s({target:"Uint8Array",proto:!0,forced:x},{toBase64:function(){var E=o(this),C=arguments.length?a(arguments[0]):void 0,P=c(C)==="base64"?u:f,O=!!C&&!!C.omitPadding;l(this.buffer);for(var I=0,D=E.length,M=w(O?p(D/3)*4+(D%3?D%3+1:0):m(D/3)*4),U=0,L,B=function(W){return v(P,L>>6*W&63)};I+2<D;I+=3)L=(E[I]<<16)+(E[I+1]<<8)+E[I+2],M[U++]=B(3),M[U++]=B(2),M[U++]=B(1),M[U++]=B(0);return I+2===D?(L=(E[I]<<16)+(E[I+1]<<8),M[U++]=B(3),M[U++]=B(2),M[U++]=B(1),O||(M[U++]="=")):I+1===D&&(L=E[I]<<16,M[U++]=B(3),M[U++]=B(2),O||(M[U++]="=",M[U++]="=")),S(M,"")}})},456(d,e,t){var s=t(6518),i=t(4576),n=t(9504),a=t(4154),o=t(5169),l=n(1.1.toString),h=n([].join),c=Array,u=i.Uint8Array,f=!u||!u.prototype.toHex||!function(){try{var p=new u([255,255,255,255,255,255,255,255]);return p.toHex()==="ffffffffffffffff"}catch{return!1}}();u&&s({target:"Uint8Array",proto:!0,forced:f},{toHex:function(){a(this),o(this.buffer);for(var m=c(this.length),v=0,A=this.length;v<A;v++){var w=l(this[v],16);m[v]=w.length===1?"0"+w:w}return h(m,"")}})},9452(d,e,t){var s=t(6518),i=t(9306),n=t(6557),a=t(4328),o=t(4995),l=t(6395),h=o.get,c=o.has,u=o.set,f=l||!function(){try{WeakMap.prototype.getOrInsertComputed&&new WeakMap().getOrInsertComputed(1,function(){throw 1})}catch(p){return p instanceof TypeError}}();s({target:"WeakMap",proto:!0,real:!0,forced:f},{getOrInsertComputed:function(m,v){if(l||n(this),a(m),i(v),c(this,m))return h(this,m);var A=v(m);return u(this,m,A),A}})},8454(d,e,t){var s=t(6518),i=t(4995),n=t(6395),a=i.get,o=i.has,l=i.set;s({target:"WeakMap",proto:!0,real:!0,forced:n},{getOrInsert:function(c,u){return o(this,c)?a(this,c):(l(this,c,u),u)}})},4979(d,e,t){var s=t(6518),i=t(4576),n=t(7751),a=t(6980),o=t(4913).f,l=t(9297),h=t(679),c=t(3167),u=t(2603),f=t(5002),p=t(6193),m=t(3724),v=t(6395),A="DOMException",w=n("Error"),S=n(A),x=function(){h(this,T);var k=arguments.length,N=u(k<1?void 0:arguments[0]),X=u(k<2?void 0:arguments[1],"Error"),z=new S(N,X),lt=new w(N);return lt.name=A,o(z,"stack",a(1,p(lt.stack,1))),c(z,this,x),z},T=x.prototype=S.prototype,E="stack"in new w(A),C="stack"in new S(1,2),P=S&&m&&Object.getOwnPropertyDescriptor(i,A),O=!!P&&!(P.writable&&P.configurable),I=E&&!O&&!C;s({global:!0,constructor:!0,forced:v||I},{DOMException:I?x:S});var D=n(A),M=D.prototype;if(M.constructor!==D){v||o(M,"constructor",a(1,D));for(var U in f)if(l(f,U)){var L=f[U],B=L.s;l(D,B)||o(D,B,a(6,L.c))}}},5781(d,e,t){var s=t(6518),i=t(7751),n=t(2812),a=t(655),o=t(7416),l=i("URL");s({target:"URL",stat:!0,forced:!o},{parse:function(c){var u=n(arguments.length,1),f=a(c),p=u<2||arguments[1]===void 0?void 0:a(arguments[1]);try{return new l(f,p)}catch{return null}}})}};const Jm={};function ot(d){const e=Jm[d];if(e!==void 0)return e.exports;const t=Jm[d]={exports:{}};
3return oA[d].call(t.exports,t,t.exports,ot),t.exports}ot.d=(d,e)=>{if(Array.isArray(e))for(var t=0;t<e.length;){var s=e[t++],i=e[t++];ot.o(d,s)?i===0&&t++:i===0?Object.defineProperty(d,s,{enumerable:!0,value:e[t++]}):Object.defineProperty(d,s,{enumerable:!0,get:i})}else for(var s in e)ot.o(e,s)&&!ot.o(d,s)&&Object.defineProperty(d,s,{enumerable:!0,get:e[s]})};ot.o=(d,e)=>Object.prototype.hasOwnProperty.call(d,e);ot(4423);ot(4114);ot(8111);ot(2489);ot(5367);ot(2731);ot(7642);ot(8004);ot(3853);ot(5876);ot(2475);ot(5024);ot(1698);ot(9577);ot(6632);ot(4226);ot(9486);ot(456);ot(5781);const Ls=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Zn=[1/0,1/0,-1/0,-1/0],Ea=new Float32Array(Zn),Cp=[.001,0,0,.001,0,0],is="http://www.w3.org/2000/svg",Fs={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},rr={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},ul="pdfjs_internal_id_",Gh="pdfjs_internal_editor_",nt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},ft={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},lA={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},fe={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Du={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Yt={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,RICHMEDIA:27},ol={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},sp={ERRORS:0,WARNINGS:1,INFOS:5},Di={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},Qh={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},hA={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let ip=sp.WARNINGS;function cA(d){Number.isInteger(d)&&(ip=d)}function dA(){return ip}function np(d){ip>=sp.INFOS&&console.info(`Info: ${d}`)}function st(d){ip>=sp.WARNINGS&&console.warn(`Warning: ${d}`)}function gt(d){throw new Error(d)}function qt(d,e){d||gt(e)}function uA(d){switch(d==null?void 0:d.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Mv(d,e=null,t=null){if(!d)return null;
3if(t&&typeof d=="string"){if(t.addDefaultProtocol&&d.startsWith("www.")){const i=d.match(/\./g);(i==null?void 0:i.length)>=2&&(d=`http://${d}`)}if(t.tryConvertEncoding)try{d=gA(d)}catch{}}const s=e?URL.parse(d,e):URL.parse(d);return uA(s)?s:null}function Rv(d,e,t=!1){const s=URL.parse(d);return s?(s.hash=e,s.href):t&&Mv(d,"http://example.com")?d.split("#",1)[0]+`${e?`#${e}`:""}`:""}function Pp(d){return d.substring(d.lastIndexOf("/")+1)}function Q(d,e,t,s=!1){return Object.defineProperty(d,e,{value:t,enumerable:!s,configurable:!0,writable:!1}),t}const sl=function(){function e(t,s){this.message=t,this.name=s}return e.prototype=new Error,e.constructor=e,e}();class Ip extends sl{constructor(e,t){super(e,"PasswordException"),this.code=t}}class bp extends sl{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class Op extends sl{constructor(e){super(e,"InvalidPDFException")}}class Af extends sl{constructor(e,t,s){super(e,"ResponseException"),this.status=t,this.missing=s}}class fA extends sl{constructor(e){super(e,"FormatError")}}class da extends sl{constructor(e){super(e,"AbortException")}}function pA(d){(typeof d!="object"||(d==null?void 0:d.length)===void 0)&>("Invalid argument for bytesToString");const e=d.length,t=8192;if(e<t)return String.fromCharCode.apply(null,d);const s=[];for(let i=0;i<e;i+=t){const n=Math.min(i+t,e),a=d.subarray(i,n);s.push(String.fromCharCode.apply(null,a))}return s.join("")}function rp(d){typeof d!="string"&>("Invalid argument for stringToBytes");const e=d.length,t=new Uint8Array(e);for(let s=0;s<e;++s)t[s]=d.charCodeAt(s)&255;return t}class Mt{static get isLittleEndian(){const e=new Uint8Array(4);e[0]=1;const t=new Uint32Array(e.buffer,0,1);return Q(this,"isLittleEndian",t[0]===1)}static get isOffscreenCanvasSupported(){return Q(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Q(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return Q(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return Q(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){const{platform:e,userAgent:t}=navigator;return Q(this,"platform",{isAndroid:t.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:t.includes("Firefox")})}static get isCanvasFilterSupported(){let e;return this.isOffscreenCanvasSupported?e=new OffscreenCanvas(1,1).getContext("2d"):typeof document<"u"&&(e=document.createElement("canvas").getContext("2d")),Q(this,"isCanvasFilterSupported",(e==null?void 0:e.filter)!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>"u")return Q(this,"isAlphaColorInputSupported",!1);const e=document.createElement("input");return e.type="color",e.setAttribute("alpha",""),e.value="#ff000080",Q(this,"isAlphaColorInputSupported",e.value!=="#ff0000")}static get isBackdropFilterSupported(){return Q(this,"isBackdropFilterSupported",typeof CSS<"u"&&CSS.supports("backdrop-filter","blur(1px)"))}}var qn,ku,Mp;class _{static get hexNums(){return Q(this,"hexNums",Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")))}static makeHexColor(e,t,s){return`#${this.hexNums[e]}${this.hexNums[t]}${this.hexNums[s]}`}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,s=0){const i=e[s],n=e[s+1];e[s]=i*t[0]+n*t[2]+t[4],e[s+1]=i*t[1]+n*t[3]+t[5]}static applyTransformToBezier(e,t,s=0){const i=t[0],n=t[1],a=t[2],o=t[3],l=t[4],h=t[5];for(let c=0;c<6;c+=2){const u=e[s+c],f=e[s+c+1];e[s+c]=u*i+f*a+l,e[s+c+1]=u*n+f*o+h}}static applyInverseTransform(e,t){const s=e[0],i=e[1],n=t[0]*t[3]-t[1]*t[2];e[0]=(s*t[3]-i*t[2]+t[2]*t[5]-t[4]*t[3])/n,e[1]=(-s*t[1]+i*t[0]+t[4]*t[1]-t[5]*t[0])/n}static axialAlignedBoundingBox(e,t,s){const i=t[0],n=t[1],a=t[2],o=t[3],l=t[4],h=t[5],c=e[0],u=e[1],f=e[2],p=e[3];let m=i*c+l,v=m,A=i*f+l,w=A,S=o*u+h,x=S,T=o*p+h,E=T;
3if(n!==0||a!==0){const C=n*c,P=n*f,O=a*u,I=a*p;m+=O,w+=O,A+=I,v+=I,S+=C,E+=C,T+=P,x+=P}s[0]=Math.min(s[0],m,A,v,w),s[1]=Math.min(s[1],S,T,x,E),s[2]=Math.max(s[2],m,A,v,w),s[3]=Math.max(s[3],S,T,x,E)}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 s=e[0],i=e[1],n=e[2],a=e[3],o=s**2+i**2,l=s*n+i*a,h=n**2+a**2,c=(o+h)/2,u=Math.sqrt(c**2-(o*h-l**2));t[0]=Math.sqrt(c+u||1),t[1]=Math.sqrt(c-u||1)}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const s=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),i=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(s>i)return null;const n=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return n>a?null:[s,n,i,a]}static pointBoundingBox(e,t,s){s[0]=Math.min(s[0],e),s[1]=Math.min(s[1],t),s[2]=Math.max(s[2],e),s[3]=Math.max(s[3],t)}static rectBoundingBox(e,t,s,i,n){n[0]=Math.min(n[0],e,s),n[1]=Math.min(n[1],t,i),n[2]=Math.max(n[2],e,s),n[3]=Math.max(n[3],t,i)}static bezierBoundingBox(e,t,s,i,n,a,o,l,h){h[0]=Math.min(h[0],e,o),h[1]=Math.min(h[1],t,l),h[2]=Math.max(h[2],e,o),h[3]=Math.max(h[3],t,l),b(this,qn,Mp).call(this,e,s,n,o,t,i,a,l,3*(-e+3*(s-n)+o),6*(e-2*s+n),3*(s-e),h),b(this,qn,Mp).call(this,e,s,n,o,t,i,a,l,3*(-t+3*(i-a)+l),6*(t-2*i+a),3*(i-t),h)}}qn=new WeakSet,ku=function(e,t,s,i,n,a,o,l,h,c){if(h<=0||h>=1)return;const u=1-h,f=h*h,p=f*h,m=u*(u*(u*e+3*h*t)+3*f*s)+p*i,v=u*(u*(u*n+3*h*a)+3*f*o)+p*l;c[0]=Math.min(c[0],m),c[1]=Math.min(c[1],v),c[2]=Math.max(c[2],m),c[3]=Math.max(c[3],v)}
3,Mp=function(e,t,s,i,n,a,o,l,h,c,u,f){if(Math.abs(h)<1e-12){Math.abs(c)>=1e-12&&b(this,qn,ku).call(this,e,t,s,i,n,a,o,l,-u/c,f);return}const p=c**2-4*u*h;if(p<0)return;const m=Math.sqrt(p),v=2*h;b(this,qn,ku).call(this,e,t,s,i,n,a,o,l,(-c+m)/v,f),b(this,qn,ku).call(this,e,t,s,i,n,a,o,l,(-c-m)/v,f)},y(_,qn);function gA(d){return decodeURIComponent(escape(d))}let Ap=null,Qm=null;function mA(d){return Ap||(Ap=/([\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,Qm=new Map([["ï¬
","ſt"]])),d.replaceAll(Ap,(e,t,s)=>t?t.normalize("NFKC"):Qm.get(s))}function Dv(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const d=new Uint8Array(32);return crypto.getRandomValues(d),pA(d)}function vA(d,e,t){if(!Array.isArray(t)||t.length<2)return!1;const[s,i,...n]=t;if(!d(s)&&!Number.isInteger(s)||!e(i))return!1;const a=n.length;let o=!0;switch(i.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return a===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(a!==4)return!1;o=!1;break;default:return!1}for(const l of n)if(!(typeof l=="number"||o&&l===null))return!1;return!0}const Wh=()=>[],Em=()=>new Map,Rp=()=>Object.create(null),yA=()=>new Set;typeof Blob.prototype.bytes!="function"&&(Blob.prototype.bytes=async function(){return new Uint8Array(await this.arrayBuffer())});typeof Response.prototype.bytes!="function"&&(Response.prototype.bytes=async function(){return new Uint8Array(await this.arrayBuffer())});typeof Iterator.prototype.join!="function"&&(Iterator.prototype.join=function(d){return[...this].join(d)});ot(1701);function _t(d,e,t){return Math.min(Math.max(d,e),t)}class yu{constructor({viewBox:e,userUnit:t,scale:s,rotation:i,offsetX:n=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=t,this.scale=s,this.rotation=i,this.offsetX=n,this.offsetY=a,s*=t;const l=(e[2]+e[0])/2,h=(e[3]+e[1])/2;let c,u,f,p;switch(i%=360,i<0&&(i+=360),i){case 180:c=-1,u=0,f=0,p=1;break;case 90:c=0,u=1,f=1,p=0;break;case 270:c=0,u=-1,f=-1,p=0;break;case 0:c=1,u=0,f=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(f=-f,p=-p);let m,v,A,w;c===0?(m=Math.abs(h-e[1])*s+n,v=Math.abs(l-e[0])*s+a,A=(e[3]-e[1])*s,w=(e[2]-e[0])*s):(m=Math.abs(l-e[0])*s+n,v=Math.abs(h-e[1])*s+a,A=(e[2]-e[0])*s,w=(e[3]-e[1])*s),this.transform=[c*s,u*s,f*s,p*s,m-c*s*l-f*s*h,v-u*s*l-p*s*h],this.width=A,this.height=w}get rawDims(){const e=this.viewBox;return Q(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:n=!1}={}){return new yu({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:s,offsetY:i,dontFlip:n})}convertToViewportPoint(e,t){const s=[e,t];return _.applyTransform(s,this.transform),s}convertToPdfPoint(e,t){const s=[e,t];return _.applyInverseTransform(s,this.transform),s}}class Tc{static textContent(e){const t=[],s={items:t,styles:Object.create(null)};function i(n){var l;if(!n)return;let a=null;const o=n.name;if(o==="#text")a=n.value;else if(Tc.shouldBuildText(o))(l=n==null?void 0:n.attributes)!=null&&l.textContent?a=n.attributes.textContent:n.value&&(
3a=n.value);else return;if(a!==null&&t.push({str:a}),!!n.children)for(const h of n.children)i(h)}return i(e),s}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}const bA=/url\(|image-set\(/i,AA=/^on/i;var Rc,Dp;class xm{static get _allowedHtmlElements(){return Q(this,"_allowedHtmlElements",new Set(["a","b","br","button","div","i","img","input","label","li","ol","option","p","select","span","sub","sup","textarea","ul"]))}static get _allowedSvgElements(){return Q(this,"_allowedSvgElements",new Set(["ellipse","line","path","rect","svg"]))}static get _allowedRichTextElements(){return Q(this,"_allowedRichTextElements",new Set(["a","b","br","div","i","li","ol","p","span","sub","sup","ul"]))}static get _allowedRichTextAttributes(){return Q(this,"_allowedRichTextAttributes",new Set(["class","dir","style"]))}static get _allowedRichTextStyles(){return Q(this,"_allowedRichTextStyles",new Set(["color","font","fontFamily","fontSize","fontStretch","fontStyle","fontWeight","kerningMode","letterSpacing","lineHeight","margin","marginBottom","marginLeft","marginRight","marginTop","orphans","paddingLeft","paddingRight","breakAfter","breakBefore","breakInside","tabInterval","tabStop","textAlign","textDecoration","textIndent","transform","verticalAlign","widows"]))}static setupStorage(e,t,s,i,n){const a=i.getValue(t,{value:null});switch(s.name){case"textarea":if(a.value!==null&&(e.textContent=a.value),n==="print")break;e.addEventListener("input",o=>{i.setValue(t,{value:o.target.value})});break;case"input":if(s.attributes.type==="radio"||s.attributes.type==="checkbox"){if(a.value===s.attributes.xfaOn?e.setAttribute("checked",!0):a.value===s.attributes.xfaOff&&e.removeAttribute("checked"),n==="print")break;e.addEventListener("change",o=>{i.setValue(t,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&e.setAttribute("value",a.value),n==="print")break;e.addEventListener("input",o=>{i.setValue(t,{value:o.target.value})})}break;case"select":if(a.value!==null){e.setAttribute("value",a.value);for(const o of s.children)o.attributes.value===a.value?o.attributes.selected=!0:Object.hasOwn(o.attributes,"selected")&&delete o.attributes.selected}e.addEventListener("input",o=>{const l=o.target.options,h=l.selectedIndex===-1?"":l[l.selectedIndex].value;i.setValue(t,{value:h})});break}}static setAttributes({html:e,element:t,storage:s=null,intent:i,linkService:n}){const{attributes:a}=t,o=e instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${i}`);for(const[l,h]of Object.entries(a))if(h!=null&&!AA.test(l)&&!(i==="richText"&&!this._allowedRichTextAttributes.has(l)))switch(l){case"class":h.length&&e.setAttribute(l,h.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",h);break;case"style":if(i==="richText"){const c=this._allowedRichTextStyles;for(const[u,f]of Object.entries(h))c.has(u)&&!bA.test(f)&&(e.style[u]=f)}else Object.assign(e.style,h);break;case"textContent":e.textContent=h;break;default:(!o||l!=="href"&&l!=="newWindow")&&e.setAttribute(l,h)}o&&(n==null||n.addLinkAttributes(e,a.href,a.newWindow)),s&&a.dataId&&this.setupStorage(e,a.dataId,t,s)}static render(e){var u,f,p;const t=e.annotationStorage,s=e.linkService,i=e.xfaHtml,n=e.intent||"display",a=b(this,Rc,Dp).call(this,i.name,(u=i.attributes)==null?void 0:u.xmlns,n)??document.createElement("div");i.attributes&&this.setAttributes({html:a,element:i,intent:n,linkService:s});const o=n!=="richText",l=e.div;if(l.append(a),e.viewport){const m=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=m}o&&l.setAttribute("class","xfaLayer xfaFont");const h=[];if(i.children.length===0){if(i.value){const m=document.createTextNode(i.value);a.append(m),o&&Tc.shouldBuildText(i.name)&&h.push(m)}return{textDivs:h}}const c=[[i,-1,a]];for(;c.length>0;){const[m,v,A]=c.at(-1);if(v+1===m.children.length){c.pop();continue}const w=m.children[++c.at(-1)[1]];if(w===null)continue;const{name:S}=w;if(S==="#text"){const T=document.createTextNode(w.value);h.push(T),A.append(T);continue}const x=b(this,Rc,Dp).call(this,S,(f=w.attributes)==null?void 0:f.xmlns,n);if(x){if(A.append(x),w.attributes&&this.setAttributes({html:x,element:w,storage:t,intent:n,linkService:s}),((p=w.children)==null?void 0:p.length)>0)c.push([w,-1,x]);else if(w.value){const T=document.createTextNode(w.value);o&&Tc.shouldBuildText(S)&&h.push(T),x.append(T)}}}for(const m of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))m.setAttribute("readOnly",!0);return{textDivs:h}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}static getPageViewport(e,{scale:t=1,rotation:s=0}){const{width:i,height:n}=e.attributes.style;return new yu({viewBox:[0,0,parseInt(i,10),parseInt(n,10)],userUnit:1,scale:t,rotation:s})}}Rc=new WeakSet,Dp=function(e,t,s){return s==="richText"?!t&&this._allowedRichTextElements.has(e)?document.createElement(e):null:t?t===is&&this._allowedSvgElements.has(e)?document.createElementNS(is,e):null:this._allowedHtmlElements.has(e)?document.createElement(e):null},y(xm,Rc);const ba=class ba{};R(ba,"CSS",96),R(ba,"PDF",72),R(ba,"PDF_TO_CSS_UNITS",ba.CSS/ba.PDF);let ua=ba;async function Tm(d,e="text"){if(wc(d,document.baseURI)){const t=await fetch(d);if(!t.ok)throw new Error(t.statusText);switch(e){case"blob":return t.blob();case"bytes":return t.bytes();case"json":return t.json()}return t.text()}return new Promise((t,s)=>{const i=new XMLHttpRequest;i.open("GET",d,!0),i.responseType=e==="bytes"?"arraybuffer":e,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(e){case"bytes":t(new
3Uint8Array(i.response));return;case"blob":case"json":t(i.response);return}t(i.responseText);return}s(new Error(i.statusText))}},i.send(null)})}class Cm extends sl{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function ap(d){const e=d.length;let t=0;for(;t<e&&d[t].trim()==="";)t++;return d.substring(t,t+5).toLowerCase()==="data:"}function Pm(d){return typeof d=="string"&&/\.pdf$/i.test(d)}function wA(d){return[d]=d.split(/[#?]/,1),Pp(d)}function SA(d,e="document.pdf"){if(typeof d!="string")return e;if(ap(d))return st('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const s=(o=>{try{return new URL(o)}catch{}try{return new URL(decodeURIComponent(o))}catch{}try{return new URL(o,"https://foo.bar")}catch{}try{return new URL(decodeURIComponent(o),"https://foo.bar")}catch{}return null})(d);if(!s)return e;const i=o=>{try{let l=decodeURIComponent(o);return l.includes("/")&&(l=Pp(l),l.length===4&&n.test(l))?o:l}catch{return o}},n=/\.pdf$/i,a=Pp(s.pathname);if(n.test(a))return i(a);if(s.searchParams.size>0){const o=h=>[...h].findLast(c=>n.test(c)),l=o(s.searchParams.values())??o(s.searchParams.keys());if(l)return i(l)}if(s.hash){const{hash:o}=s;let l=-1;for(const{index:h}of o.matchAll(/\.pdf\b/gi))l=h;if(l>0){let h=l;for(;h>0&&!"/?#=".includes(o[h-1]);)h--;if(h<l)return i(o.slice(h,l+4))}}return e}var ar;class Zm{constructor(){y(this,ar,new Map);R(this,"times",[])}time(e){r(this,ar).has(e)&&st(`Timer is already running for ${e}`),r(this,ar).set(e,Date.now())}timeEnd(e){r(this,ar).has(e)||st(`Timer has not been started for ${e}`),this.times.push({name:e,start:r(this,ar).get(e),end:Date.now()}),r(this,ar).delete(e)}toString(){const e=Math.max(...this.times.map(t=>t.name.length));return this.times.map(t=>`${t.name.padEnd(e)} ${t.end-t.start}ms 4`).join("")}}ar=new WeakMap;function wc(d,e){const t=e?URL.parse(d,e):URL.parse(d);return/https?:/.test((t==null?void 0:t.protocol)??"")}function Ti(d){d.preventDefault()}function me(d){d.preventDefault(),d.stopPropagation()}var Dc;class wf{static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!="string")return null;r(this,Dc)||g(this,Dc,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+\\-])?(\\d{2})?'?(\\d{2})?'?"));const t=r(this,Dc).exec(e);if(!t)return null;const s=parseInt(t[1],10);let i=parseInt(t[2],10);i=i>=1&&i<=12?i-1:0;let n=parseInt(t[3],10);n=n>=1&&n<=31?n:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(t[6],10);l=l>=0&&l<=59?l:0;const h=t[7]||"Z";let c=parseInt(t[8],10);c=c>=0&&c<=23?c:0;let u=parseInt(t[9],10)||0;return u=u>=0&&u<=59?u:0,h==="-"?(a+=c,o+=u):h==="+"&&(a-=c,o-=u),new Date(Date.UTC(s,i,n,a,o,l))}}Dc=new WeakMap,y(wf,Dc);function bu(d){if(d.startsWith("#")){const t=d.slice(1);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),t.length>=8?parseInt(t.slice(6,8),16)/255:1]}if(d.startsWith("rgb(")){const[t,s,i]=d.slice(4,-1).split(",").map(n=>parseInt(n,10));return[t,s,i,1]}if(d.startsWith("rgba(")){const t=d.slice(5,-1).split(",");return[parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3])]}const e=d.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return e?[Math.round(parseFloat(e[1])*255),Math.round(parseFloat(e[2])*255),Math.round(parseFloat(e[3])*255),e[4]!==void 0&&e[4]!=="none"?parseFloat(e[4]):1]:null}function Au(d){const e=bu(d);return e?e.slice(0,3):(st(`Not a valid color format: "${d}"`),[0,0,0])}function EA(d){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const t of d.keys()){e.style.color=t;const s=window.getComputedStyle(e).color;d.set(t,Au(s))}e.remove()}function Bt(d){const{a:e,b:t,c:s,d:i,e:n,f:a}=d.getTransform();return[e,t,s,i,n,a]}function Ii(d){const{a:e,b:t,c:s,d:i,e:n,f:a}=d.getTransform().invertSelf();return[e,t,s,i,n,a]}function Qo(d,e,t=!1,s=!0){if(e instanceof yu){const{pageWidth:i,pageHeight:n}=e.rawDims,{style:a}=d,o=`round(down, var(--total-scale-factor) * ${i}px, var(--scale-round-x))`,l=`round(down, var(--total-scale-factor) * ${n}px, var(--scale-round-y))`;!t||e.rotation%180===0?(a.width=o,a.height=l):(a.width=l,a.height=o
4)}s&&d.setAttribute("data-main-rotation",e.rotation)}class Ci{constructor(){const{pixelRatio:e}=Ci;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,t,s,i,n=-1){let a=1/0,o=1/0,l=1/0;s=Ci.capPixels(s,n),s>0&&(a=Math.sqrt(s/(e*t))),i!==-1&&(o=i/e,l=i/t);const h=Math.min(a,o,l);return this.sx>h||this.sy>h?(this.sx=h,this.sy=h,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){const s=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,s):s}return e}}const kp=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class xA{static get isDarkMode(){var e;return Q(this,"isDarkMode",!!((e=window==null?void 0:window.matchMedia)!=null&&e.call(window,"(prefers-color-scheme: dark)").matches))}}class TA{static get commentForegroundColor(){const e=document.createElement("span");e.classList.add("comment","sidebar");const{style:t}=e;t.width=t.height="0",t.display="none",t.color="var(--comment-fg-color)",document.body.append(e);const{color:s}=window.getComputedStyle(e);return e.remove(),Q(this,"commentForegroundColor",Au(s))}}function CA(d,e){e=_t(e??1,0,1);const t=255*(1-e);return d.map(s=>Math.round(s*e+t))}function qm(d,e){const t=d[0]/255,s=d[1]/255,i=d[2]/255,n=Math.max(t,s,i),a=Math.min(t,s,i),o=(n+a)/2;if(n===a)e[0]=e[1]=0;else{const l=n-a;switch(e[1]=o<.5?l/(n+a):l/(2-n-a),n){case t:e[0]=((s-i)/l+(s<i?6:0))*60;break;case s:e[0]=((i-t)/l+2)*60;break;case i:e[0]=((t-s)/l+4)*60;break}}e[2]=o}function Fp(d,e){const t=d[0],s=d[1],i=d[2],n=(1-Math.abs(2*i-1))*s,a=n*(1-Math.abs(t/60%2-1)),o=i-n/2;switch(Math.floor(t/60)){case 0:e[0]=n+o,e[1]=a+o,e[2]=o;break;case 1:e[0]=a+o,e[1]=n+o,e[2]=o;break;case 2:e[0]=o,e[1]=n+o,e[2]=a+o;break;case 3:e[0]=o,e[1]=a+o,e[2]=n+o;break;case 4:e[0]=a+o,e[1]=o,e[2]=n+o;break;case 5:case 6:e[0]=n+o,e[1]=o,e[2]=a+o;break}}function Lp(d){return d<=.03928?d/12.92:((d+.055)/1.055)**2.4}function tv(d,e,t){Fp(d,t),t.map(Lp);const s=.2126*t[0]+.7152*t[1]+.0722*t[2];Fp(e,t),t.map(Lp);const i=.2126*t[0]+.7152*t[1]+.0722*t[2];return s>i?(s+.05)/(i+.05):(i+.05)/(s+.05)}const ev=new Map;function PA(d,e){const t=d[0]+d[1]*256+d[2]*65536+e[0]*16777216+e[1]*4294967296+e[2]*1099511627776;let s=ev.get(t);if(s)return s;const i=new Float32Array(9),n=i.subarray(0,3),a=i.subarray(3,6);qm(d,a);const o=i.subarray(6,9);qm(e,o);const l=o[2]<.5,h=l?12:4.5;if(a[2]=l?Math.sqrt(a[2]):1-Math.sqrt(1-a[2]),tv(a,o,n)<h){let c,u;l?(c=a[2],u=1):(c=0,u=a[2]);const f=.005;for(;u-c>f;){const p=a[2]=(c+u)/2;l===tv(a,o,n)<h?c=p:u=p}a[2]=l?u:c}return Fp(a,n),s=_.makeHexColor(Math.round(n[0]*255),Math.round(n[1]*255),Math.round(n[2]*255)),ev.set(t,s),s}function kv({html:d,dir:e,className:t},s){const i=document.createDocumentFragment();if(typeof d=="string"){const n=document.createElement("p");n.dir=e||"auto";const a=d.split(/\r\n?|\n/);for(let o=0,l=a.length;o<l;++o){const h=a[o];n.append(document.createTextNode(h)),o<l-1&&n.append(document.createElement("br"))}i.append(n)}else xm.render({xfaHtml:d,div:i,intent:"richText"});i.firstElementChild.classList.add("richText",t),s.append(i)}function Fv(d){const e=new Path2D;if(!d)return e;for(let t=0,s=d.length;t<s;)switch(d[t++]){case Qh.moveTo:e.moveTo(d[t++],d[t++]);break;case Qh.lineTo:e.lineTo(d[t++],d[t++]);break;case Qh.curveTo:e.bezierCurveTo(d[t++],d[t++],d[t++],d[t++],d[t++],d[t++]);break;case Qh.quadraticCurveTo:e.quadraticCurveTo(d[t++],d[t++],d[t++],d[t++]);break;case Qh.closePath:e.closePath();break;default:st(`Unrecognized drawing path operator: ${d[t-1]}`);break}return e}ot(4972);ot(8454);ot(9452);ot(4979);ot(3579);ot(3110);ot(9314);ot(1148);ot(116);ot(9112);var or,lr,Gs,Vs,kc,hr,ml,vl,Fc,Of,Lv,Be,Nv,Bv,ll,tc;const pn=class pn{constructor(e){y(this,Be);y(this,or,null);y(this,lr,null);y(this,Gs);y(this,Vs,null);y(this,kc,null);y(this,hr,null);y(this,ml,null);y(this,vl,null);g(this,Gs,e),r(pn,Fc)||g(pn,Fc,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=g(this,or,document.createElement("div"));e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const t=r(this,Gs)._uiManager._signal;t instanceof AbortSignal&&!t.aborted&&(e.addEventListener("contextmenu",Ti,{signal:t}),e.addEventListener("pointerdown",b(pn,Of,Lv),{signal:t}));const s=g(this,Vs,document.createElement("div"));s.className="buttons",e.append(s);const i=r(this,Gs).toolbarPosition;if(i){const{style:n}=e,a=r(this,Gs)._uiManager.direction==="ltr"?1-i[0]:i[0];n.insetInlineEnd=`${100*a}%`,n.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return r(this,or)}hide(){var e;r(this,or).classList.add("hidden"),(e=r(this,lr))==null||e.hideDropdown()}show(){var e,t;r(this,or).classList.remove("hidden"),(e=r(this,kc))==null||e.shown(),(t=r(this,hr))==null||t.shown()}
4addDeleteButton(){const{editorType:e,_uiManager:t}=r(this,Gs),s=document.createElement("button");s.classList.add("basic","deleteButton"),s.tabIndex=0,s.setAttribute("data-l10n-id",r(pn,Fc)[e]),b(this,Be,ll).call(this,s)&&s.addEventListener("click",i=>{t.delete()},{signal:t._signal}),r(this,Vs).append(s)}async addAltText(e){const t=await e.render();b(this,Be,ll).call(this,t),r(this,Vs).append(t,r(this,Be,tc)),g(this,kc,e)}addComment(e,t=null){if(r(this,hr))return;const s=e.renderForToolbar();if(!s)return;b(this,Be,ll).call(this,s);const i=g(this,ml,r(this,Be,tc));t?(r(this,Vs).insertBefore(s,t),r(this,Vs).insertBefore(i,t)):r(this,Vs).append(s,i),g(this,hr,e),e.toolbar=this}addColorPicker(e){if(r(this,lr))return;g(this,lr,e);const t=e.renderButton();b(this,Be,ll).call(this,t),r(this,Vs).append(t,r(this,Be,tc))}async addEditSignatureButton(e){const t=g(this,vl,await e.renderEditButton(r(this,Gs)));b(this,Be,ll).call(this,t),r(this,Vs).append(t,r(this,Be,tc))}removeButton(e){var t,s;switch(e){case"comment":(t=r(this,hr))==null||t.removeToolbarCommentButton(),g(this,hr,null),(s=r(this,ml))==null||s.remove(),g(this,ml,null);break}}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);break}}async addButtonBefore(e,t,s){if(!t&&e==="comment")return;const i=r(this,Vs).querySelector(s);i&&e==="comment"&&this.addComment(t,i)}updateEditSignatureButton(e){r(this,vl)&&(r(this,vl).title=e)}remove(){var e;r(this,or).remove(),(e=r(this,lr))==null||e.destroy(),g(this,lr,null)}};or=new WeakMap,lr=new WeakMap,Gs=new WeakMap,Vs=new WeakMap,kc=new WeakMap,hr=new WeakMap,ml=new WeakMap,vl=new WeakMap,Fc=new WeakMap,Of=new WeakSet,Lv=function(e){e.stopPropagation()},Be=new WeakSet,Nv=function(e){r(this,Gs)._focusEventsAllowed=!1,me(e)},Bv=function(e){r(this,Gs)._focusEventsAllowed=!0,me(e)},ll=function(e){const t=r(this,Gs)._uiManager._signal;return!(t instanceof AbortSignal)||t.aborted?!1:(e.addEventListener("focusin",b(this,Be,Nv).bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",b(this,Be,Bv).bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",Ti,{signal:t}),!0)},tc=function(){const e=document.createElement("div");return e.className="divider",e},y(pn,Of),y(pn,Fc,null);let Np=pn;var Lc,xa,ki,er,Uv,Hv,Bp;class IA{constructor(e){y(this,er);y(this,Lc,null);y(this,xa,null);y(this,ki);g(this,ki,e)}show(e,t,s){const[i,n]=b(this,er,Hv).call(this,t,s),{style:a}=r(this,xa)||g(this,xa,b(this,er,Uv).call(this));e.append(r(this,xa)),a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){r(this,xa).remove()}}Lc=new WeakMap,xa=new WeakMap,ki=new WeakMap,er=new WeakSet,Uv=function(){const e=g(this,xa,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar"),e.dir=r(this,ki).direction;const t=r(this,ki)._signal;t instanceof AbortSignal&&!t.aborted&&e.addEventListener("contextmenu",Ti,{signal:t});const s=g(this,Lc,document.createElement("div"));return s.className="buttons",e.append(s),r(this,ki).hasCommentManager()&&b(this,er,Bp).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{r(this,ki).commentSelection("floating_button")}),b(this,er,Bp).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{r(this,ki).highlightSelection("floating_button")}),e},Hv=function(e,t){let s=0,i=0;for(const n of e){const a=n.y+n.height;if(a<s)continue;const o=n.x+(t?n.width:0);if(a>s){i=o,s=a;continue}t?o>i&&(i=o):o<i&&(i=o)}return[t?1-i:i,s]},Bp=function(e,t,s,i){const n=document.createElement("button");n.classList.add("basic",e),n.tabIndex=0,n.setAttribute("data-l10n-id",t);const a=document.createElement("span");n.append(a),a.className="visuallyHidden",a.setAttribute("data-l10n-id",s);const o=r(this,ki)._signal;o instanceof AbortSignal&&!o.aborted&&(n.addEventListener("contextmenu",Ti,{signal:o}),n.addEventListener("click",i,{signal:o})),r(this,Lc).append(n)};
4const OA="59968104-cc61-4cf9-b570-014b35b3709c",wp=Object.freeze({internal:OA});function _v(d,e,t){for(const s of t)e.addEventListener(s,d[s].bind(d))}var Ta,Ca,yl,Pa;const Tt=class Tt{static initializeAndAddPointerId(e){(r(Tt,Ca)||g(Tt,Ca,new Set)).add(e)}static setPointer(e,t){r(Tt,Ta)||g(Tt,Ta,t),r(Tt,Pa)??g(Tt,Pa,e)}static setTimeStamp(e){g(Tt,yl,e)}static isSamePointerId(e){return r(Tt,Ta)===e}static isSamePointerIdOrRemove(e){var t;return r(Tt,Ta)===e?!0:((t=r(Tt,Ca))==null||t.delete(e),!1)}static isSamePointerType(e){return r(Tt,Pa)===e}static isInitializedAndDifferentPointerType(e){return r(Tt,Pa)!==null&&!Tt.isSamePointerType(e)}static isSameTimeStamp(e){return r(Tt,yl)===e}static isUsingMultiplePointers(){var e;return((e=r(Tt,Ca))==null?void 0:e.size)>=1}static clearPointerType(){g(Tt,Pa,null)}static clearPointerIds(){g(Tt,Ta,NaN),g(Tt,Ca,null)}static clearTimeStamp(){g(Tt,yl,NaN)}};Ta=new WeakMap,Ca=new WeakMap,yl=new WeakMap,Pa=new WeakMap,y(Tt,Ta,NaN),y(Tt,Ca,null),y(Tt,yl,NaN),y(Tt,Pa,null);let $e=Tt;var Mf;class MA{constructor(){y(this,Mf,0)}get id(){return`${Gh}${Xt(this,Mf)._++}`}}Mf=new WeakMap;var bl,Nc,Ge,Al,Fu;const Bm=class Bm{constructor(){y(this,Al);y(this,bl,Dv());y(this,Nc,0);y(this,Ge,null)}static get _isSVGFittingCanvas(){const e=`data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="${is}"><rect width="1" height="1" style="fill:red;"/></svg>`,s=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.src=e;const n=i.decode().then(()=>(s.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(s.getImageData(0,0,1,1).data.buffer)[0]===0));return Q(this,"_isSVGFittingCanvas",n)}async getFromFile(e){const{lastModified:t,name:s,size:i,type:n}=e;return b(this,Al,Fu).call(this,`${t}_${s}_${i}_${n}`,e)}async getFromUrl(e){return b(this,Al,Fu).call(this,e,e)}async getFromBlob(e,t){const s=await t;return b(this,Al,Fu).call(this,e,s)}async getFromId(e){r(this,Ge)||g(this,Ge,new Map);const t=r(this,Ge).get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){const{blobPromise:s}=t;return delete t.blobPromise,this.getFromBlob(t.id,s)}return this.getFromUrl(t.url)}getFromCanvas(e,t){r(this,Ge)||g(this,Ge,new Map);let s=r(this,Ge).get(e);if(s!=null&&s.bitmap)return s.refCounter+=1,s;const i=new OffscreenCanvas(t.width,t.height);return i.getContext("2d").drawImage(t,0,0),s={bitmap:i.transferToImageBitmap(),id:`image_${r(this,bl)}_${Xt(this,Nc)._++}`,refCounter:1,isSvg:!1},r(this,Ge).set(e,s),r(this,Ge).set(s.id,s),s}getSvgUrl(e){const t=r(this,Ge).get(e);return t!=null&&t.isSvg?t.svgUrl:null}deleteId(e){var i;r(this,Ge)||g(this,Ge,new Map);const t=r(this,Ge).get(e);if(!t||(t.refCounter-=1,t.refCounter!==0))return;const{bitmap:s}=t;if(!t.url&&!t.file){const n=new OffscreenCanvas(s.width,s.height);n.getContext("bitmaprenderer").transferFromImageBitmap(s),t.blobPromise=n.convertToBlob()}(i=s.close)==null||i.call(s),t.bitmap=null}isValidId(e){return e.startsWith(`image_${r(this,bl)}_`)}};bl=new WeakMap,Nc=new WeakMap,Ge=new WeakMap,Al=new WeakSet,Fu=async function(e,t){r(this,Ge)||g(this,Ge,new Map);let s=r(this,Ge).get(e);if(s===null)return null;if(s!=null&&s.bitmap)return s.refCounter+=1,s;try{s||(s={bitmap:null,id:`image_${r(this,bl)}_${Xt(this,Nc)._++}`,refCounter:0,isSvg:!1});let i;if(typeof t=="string"?(s.url=t,i=await Tm(t,"blob")):t instanceof File?i=s.file=t:t instanceof Blob&&(i=t),i.type==="image/svg+xml"){const n=Bm._isSVGFittingCanvas,a=new FileReader,o=new Image,l=new Promise((h,c)=>{o.onload=()=>{s.bitmap=o,s.isSvg=!0,h()},a.onload=async()=>{const u=s.svgUrl=a.result;o.src=await n?`${u}#svgView(preserveAspectRatio(none))`:u},o.onerror=a.onerror=c});a.readAsDataURL(i),await l}else s.bitmap=await createImageBitmap(i);s.refCounter=1}catch(i){st(i),s=null}return r(this,Ge).set(e,s),s&&r(this,Ge).set(s.id,s),s};let Up=Bm;var ne,cr,Bc,Kt;class RA{constructor(e=128){y(this,ne,[]);y(this,cr,!1);y(this,Bc);y(this,Kt,-1);g(this,Bc,e)}add({cmd:e,undo:t,post:s,mustExec:i,type:n=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(i&&e(),r(this,cr))return;const l={cmd:e,undo:t,post:s,type:n};if(r(this,Kt)===-1){r(this,ne).length>0&&(r(this,ne).length=0),g(this,Kt,0),r(this,ne).push(l);return}if(a&&r(this,ne)[r(this,Kt)].type===n){o&&(l.undo=r(this,ne)[r(this,Kt)].undo),r(this,ne)[r(this,Kt)]=l;return}const h=r(this,Kt)+1;h===r(this,Bc)?r(this,ne).splice(0,1):(g(this,Kt,h),h<r(this,ne).length&&r(this,ne).splice(h)),r(this,ne).push(l)}undo(){if(r(this,Kt)===-1)return;g(this,cr,!0);const{undo:e,post:t}=r(this,ne)[r(this,Kt)];e(),t==null||t(),g(this,cr,!1),g(this,Kt,r(this,Kt)-1)}redo(){if(r(this,Kt)<r(this,ne).length-1){g(this,Kt,r(this,Kt)+1),g(this,cr,!0);const{cmd:e,post:t}=r(this,ne)[r(this,Kt)];e(),t==null||t(),g(this,cr,!1)}}hasSomethingToUndo(){return r(this,Kt)!==-1}hasSomethingToRedo(){return r(this,Kt)<r(this,ne).length-1}cleanType(e){if(r(this,Kt)!==-1){for(let t=r(this,Kt);t>=0;t--)if(r(this,ne)[t].type!==e){r(this,ne).splice(t+1,r(this,Kt)-t),g(this,Kt,t);return}r(this,ne).length=0,g(this,Kt,-1)}}destroy(){g(this,ne,null)}}
4ne=new WeakMap,cr=new WeakMap,Bc=new WeakMap,Kt=new WeakMap;var Vh,jv,$v;const hs=class hs{constructor(e){var s;this.callbacks=new Map;const{isMac:t}=Mt.platform;for(const[i,n,a={}]of e){const o=i.some(l=>l.startsWith("mac+"));for(const l of i){let h=l;if(o){const f=l.startsWith("mac+");if(t!==f)continue;f&&(h=l.slice(4))}const[c,u]=b(s=hs,Vh,jv).call(s,h);c!==null&&this.callbacks.getOrInsertComputed(c,Wh).push({callback:n,options:a,modifiers:u})}}}exec(e,t){var c;let s=this.callbacks.get(t.key);if(!s){if(/^[a-z]$/i.test(t.key))return;const u=b(c=hs,Vh,$v).call(c,t.code);if(u===null||u===t.key||(s=this.callbacks.get(u),!s))return}const i=(t.altKey?hs.ALT:0)|(t.ctrlKey?hs.CTRL:0)|(t.metaKey?hs.META:0)|(t.shiftKey?hs.SHIFT:0),n=s.find(u=>u.modifiers===i);if(!n)return;const{callback:a,options:{bubbles:o=!1,args:l=[],checker:h=null}}=n;h&&!h(e,t)||(a.bind(e,...l,t)(),o||me(t))}};Vh=new WeakSet,jv=function(e){let t=null,s=0;for(let i of e.split("+")){if(i=i.trim(),!i)continue;const n=i.toUpperCase(),a=hs[n];if(a){s|=a;continue}if(t!==null){st(`KeyboardManager: multiple keys in shortcut "${e}"`);break}t=n==="SPACE"?" ":i}return t===null&&st(`KeyboardManager: no key found in shortcut "${e}"`),[t,s]},$v=function(e){var s;const t=/^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(e);return t?((s=t[1])==null?void 0:s.toLowerCase())??t[2]:null},y(hs,Vh),R(hs,"ALT",1),R(hs,"CTRL",2),R(hs,"META",4),R(hs,"SHIFT",8);let Zo=hs;const Rf=class Rf{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return EA(e),Q(this,"_colors",e)}convert(e){const t=Au(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[s,i]of this._colors)if(i.every((n,a)=>n===t[a]))return Rf._colorsMapping.get(s);return t}getHexCode(e){const t=this._colors.get(e);return t?_.makeHexColor(...t):e}};R(Rf,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let Hp=Rf;var wl,bs,Sl,jt,Jt,El,xl,Tl,Ve,Cl,zs,Ae,dr,ur,fr,pr,Fi,Ws,Ia,Uc,Hc,Pl,_c,Li,gr,Il,mr,Ni,Df,mn,Ol,jc,vr,Oa,Ml,yr,$c,le,Ct,vn,br,Ar,Gc,Rl,Vc,wr,Bi,yn,zc,Wc,Xs,G,Lu,_p,Gv,Vv,ec,zv,Wv,Xv,jp,Yv,Kv,Jv,Qv,Je,un,Zv,qv,$p,ty,sc,Gp;const fl=class fl{constructor(e,t,s,i,n,a,o,l,h,c,u,f,p,m,v,A){y(this,G);y(this,wl,new AbortController);y(this,bs,null);y(this,Sl,null);y(this,jt,new Map);y(this,Jt,new Map);y(this,El,null);y(this,xl,null);y(this,Tl,null);y(this,Ve,null);y(this,Cl,null);y(this,zs,new RA);y(this,Ae,null);y(this,dr,null);y(this,ur,null);y(this,fr,0);y(this,pr,new Set);y(this,Fi,null);y(this,Ws,null);y(this,Ia,new Set);R(this,"_editorUndoBar",null);y(this,Uc,!1);y(this,Hc,!1);y(this,Pl,!1);y(this,_c,null);y(this,Li,null);y(this,gr,null);y(this,Il,null);y(this,mr,!1);y(this,Ni,null);y(this,Df,new MA);y(this,mn,!1);y(this,Ol,!1);y(this,jc,!1);y(this,vr,null);y(this,Oa,null);y(this,Ml,null);y(this,yr,null);y(this,$c,null);y(this,le,nt.NONE);y(this,Ct,new Set);y(this,vn,null);y(this,br,null);y(this,Ar,null);y(this,Gc,null);y(this,Rl,null);y(this,Vc,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});y(this,wr,[0,0]);y(this,Bi,null);y(this,yn,null);y(this,zc,null);y(this,Wc,null);y(this,Xs,null);const w=this._signal=r(this,wl).signal;g(this,yn,e),g(this,zc,t),g(this,Wc,s),g(this,Tl,i),g(this,Ae,n),g(this,br,a),g(this,Rl,l),this._eventBus=o;const S={signal:w,...wp};o.on("editingaction",this.onEditingAction.bind(this),S),o.on("pagechanging",this.onPageChanging.bind(this),S),o.on("scalechanging",this.onScaleChanging.bind(this),S),o.on("rotationchanging",this.onRotationChanging.bind(this),S),o.on("setpreference",this.onSetPreference.bind(this),S),o.on("switchannotationeditorparams",x=>this.updateParams(x.type,x.value),S),window.addEventListener("pointerdown",()=>{g(this,Ol,!0)},{capture:!0,signal:w}),window.addEventListener("pointerup",()=>{g(this,Ol,!1)},{capture:!0,signal:w}),window.addEventListener("beforeunload",this.endCurrentEditing.bind(this),{capture:!0,signal:w}),b(this,G,zv).call(this),b(this,G,Qv).call(this),b(this,G,jp).call(this),g(this,Ve,l.annotationStorage),g(this,_c,l.filterFactory),g(this,Ar,h),g(this,Il,c||null),g(this,Uc,u),g(this,Hc,f),g(this,Pl,p),g(this,$c,m||null),this.viewParameters={realScale:ua.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=v||null,this._supportsPinchToZoom=A!==!1,n==null||n.setSidebarUiManager(this)}static get _keyboardManager(){const e=fl.prototype,t=a=>r(a,yn).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),s=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},i=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return Q(this,"_keyboardManager",new Zo([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:s}],[["ctrl+z","mac+meta+z"],e.undo,{checker:s}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:s}],[["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:s}
4],[["Enter"],e.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,yn).contains(o)&&!a.isEnterHandled}],[["Space"],e.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,yn).contains(document.activeElement)}],[["Escape"],e.unselectAll],[["ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-n,0],checker:t}],[["ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[n,0],checker:t}],[["ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-n],checker:t}],[["ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,n],checker:t}]]))}destroy(){var e,t,s,i,n,a,o,l,h;(e=r(this,Xs))==null||e.resolve(),g(this,Xs,null),(t=r(this,wl))==null||t.abort(),g(this,wl,null),this._signal=null;for(const c of r(this,Jt).values())c.destroy();r(this,Jt).clear(),r(this,jt).clear(),r(this,Ia).clear(),(s=r(this,yr))==null||s.clear(),g(this,bs,null),r(this,Ct).clear(),r(this,zs).destroy(),(i=r(this,Tl))==null||i.destroy(),(n=r(this,Ae))==null||n.destroy(),(a=r(this,br))==null||a.destroy(),(o=r(this,Ni))==null||o.hide(),g(this,Ni,null),(l=r(this,Ml))==null||l.destroy(),g(this,Ml,null),g(this,Sl,null),r(this,Li)&&(clearTimeout(r(this,Li)),g(this,Li,null)),r(this,Bi)&&(clearTimeout(r(this,Bi)),g(this,Bi,null)),(h=this._editorUndoBar)==null||h.destroy(),g(this,Rl,null)}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return r(this,$c)}get useNewAltTextFlow(){return r(this,Hc)}get useNewAltTextWhenAddingImage(){return r(this,Pl)}get hcmFilter(){return Q(this,"hcmFilter",r(this,Ar)?r(this,_c).addHCMFilter(r(this,Ar).foreground,r(this,Ar).background):"none")}get direction(){return Q(this,"direction",getComputedStyle(r(this,yn)).direction)}get _highlightColors(){return Q(this,"_highlightColors",r(this,Il)?new Map(r(this,Il).split(",").map(e=>(e=e.split("=").map(t=>t.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){const{_highlightColors:e}=this;if(!e)return Q(this,"highlightColors",null);const t=new Map,s=!!r(this,Ar);for(const[i,n]of e){const a=i.endsWith("_HCM");if(s&&a){t.set(i.replace("_HCM",""),n);continue}!s&&!a&&t.set(i,n)}return Q(this,"highlightColors",t)}get highlightColorNames(){return Q(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){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),g(this,ur,e)}setMainHighlightColorPicker(e){g(this,Ml,e)}editAltText(e,t=!1){var s;(s=r(this,Tl))==null||s.editAltText(this,e,t)}hasCommentManager(){return!!r(this,Ae)}editComment(e,t,s,i){var n;(n=r(this,Ae))==null||n.showDialog(this,e,t,s,i)}selectComment(e,t){const s=r(this,Jt).get(e),i=s==null?void 0:s.getEditorByUID(t);i==null||i.toggleComment(!0,!0)}updateComment(e){var t;(t=r(this,Ae))==null||t.updateComment(e.getData())}updatePopupColor(e){var t;(t=r(this,Ae))==null||t.updatePopupColor(e)}removeComment(e){var t;(t=r(this,Ae))==null||t.removeComments([e.uid])}deleteComment(e,t){const s=()=>{e.comment=t},i=()=>{var n;(n=this._editorUndoBar)==null||n.show(s,"comment"),this.toggleComment(null),e.comment=null};this.addCommands({cmd:i,undo:s,mustExec:!0})}toggleComment(e,t,s=void 0){var i;(i=r(this,Ae))==null||i.toggleCommentPopup(e,t,s)}makeCommentColor(e,t){var s;return e&&((s=r(this,Ae))==null?void 0:s.makeCommentColor(e,t))||null}getCommentDialogElement(){var e;return((e=r(this,Ae))==null?void 0:e.dialogElement)||null}async waitForEditorsRendered(e){if(r(this,Jt).has(e-1))return;const{resolve:t,promise:s}=Promise.withResolvers(),i=n=>{n.pageNumber===e&&(this._eventBus.off("editorsrendered",i),t())};this._eventBus.on("editorsrendered",i,wp),await s}getSignature(e){var t;(t=r(this,br))==null||t.getSignature({uiManager:this,editor:e})}get signatureManager(){return r(this,br)}switchToMode(e,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal,...wp}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch("setpreference",{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){switch(e){case"enableNewAltTextWhenAddingImage":g(this,Pl,t);break}}onPageChanging({pageNumber:e}){g(this,fr,e-1)}deletePage(e){for(const t of this.getEditors(e))t.remove();r(this,Jt).delete(e),r(this,fr)===e&&g(this,fr,0)}focusMainContainer(){r(this,yn).focus()}findParent(e,t){for(const s of r(this,Jt).values()){const{x:i,y:n,width:a,height:o}=s.div.getBoundingClientRect();if(e>=i&&e<=i+a&&t>=n&&t<=n+o)return s}return null}disableUserSelect(e=!1){r(this,zc).classList.toggle("noUserSelect",e)}addShouldRescale(e){r(this,Ia).add(e)}removeShouldRescale(e){r(this,Ia).delete(e)}onScaleChanging({scale:e}){var t;this.commitOrRemove(),this.viewParameters.realScale=e*ua.PDF_TO_CSS_UNITS;for(const s of r(this,Ia))s.onScaleChanging();(t=r(this,ur))==null||t.onScaleChanging()}
4onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e="",t=!1){const s=document.getSelection();if(!s||s.isCollapsed)return;const{anchorNode:i,anchorOffset:n,focusNode:a,focusOffset:o}=s,l=s.toString(),c=b(this,G,Lu).call(this,s).closest(".textLayer"),u=this.getSelectionBoxes(c);if(!u)return;s.empty();const f=b(this,G,_p).call(this,c),p=r(this,le)===nt.NONE,m=()=>{const v=f==null?void 0:f.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:u,anchorNode:i,anchorOffset:n,focusNode:a,focusOffset:o,text:l});p&&this.showAllEditors("highlight",!0,!0),t&&(v==null||v.editComment())};if(p){this.switchToMode(nt.HIGHLIGHT,m);return}m()}commentSelection(e=""){this.highlightSelection(e,!0)}endCurrentEditing(){var e;this.commitOrRemove(),(e=this.currentLayer)==null||e.endDrawingSession(!1)}getAndRemoveDataFromAnnotationStorage(e){if(!r(this,Ve))return null;const t=`${Gh}${e}`,s=r(this,Ve).getRawValue(t);return s&&r(this,Ve).remove(t),s}addToAnnotationStorage(e){!e.isEmpty()&&r(this,Ve)&&!r(this,Ve).has(e.id)&&r(this,Ve).setValue(e.id,e)}a11yAlert(e,t=null){const s=r(this,Wc);s&&(s.setAttribute("data-l10n-id",e),t?s.setAttribute("data-l10n-args",JSON.stringify(t)):s.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,r(this,mr)&&(g(this,mr,!1),b(this,G,ec).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const t of r(this,Ct))if(t.div.contains(e)){g(this,Oa,[t,e]),t._focusEventsAllowed=!1;break}}focus(){if(!r(this,Oa))return;const[e,t]=r(this,Oa);g(this,Oa,null),t.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}addEditListeners(){b(this,G,jp).call(this),this.setEditingState(!0)}removeEditListeners(){b(this,G,Yv).call(this),this.setEditingState(!1)}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const s of r(this,Ws))if(s.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const t of e.dataTransfer.items)for(const s of r(this,Ws))if(s.isHandlingMimeForPasting(t.type)){s.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){var s;if(e.preventDefault(),(s=r(this,bs))==null||s.commitOrRemove(),!this.hasSelection)return;const t=[];for(const i of r(this,Ct)){const n=i.serialize(!0);n&&t.push(n)}t.length!==0&&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 n of t.items)for(const a of r(this,Ws))if(a.isHandlingMimeForPasting(n.type)){a.paste(n,this.currentLayer);return}let s=t.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(n){st(`paste: "${n.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();const i=this.currentLayer;try{const n=[];for(const l of s){const h=await i.deserialize(l);if(!h)return;n.push(h)}const a=()=>{for(const l of n)b(this,G,$p).call(this,l);b(this,G,Gp).call(this,n)},o=()=>{for(const l of n)l.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(n){st(`paste: "${n.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),r(this,le)!==nt.NONE&&!this.isEditorHandlingKeyboard&&fl._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,r(this,mr)&&(g(this,mr,!1),b(this,G,ec).call(this,"main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}updatePageIndex(e,t){for(const i of r(this,xl).get(e)||[])i.pageIndex=t;const s=r(this,El).get(e);s&&(s.pageIndex=t,r(this,Jt).set(t,s),r(this,mn)?s.enable():s.disable())}startUpdatePages(){g(this,El,new Map(r(this,Jt))),r(this,Jt).clear();const e=g(this,xl,new Map),t=s=>{e.getOrInsertComputed(s.pageIndex,Wh).push(s)};for(const s of r(this,jt).values())t(s);for(const[s,i]of r(this,Ve))s.startsWith(Gh)&&!r(this,jt).has(s)&&Number.isInteger(i==null?void 0:i.pageIndex)&&t(i)}endUpdatePages(){g(this,El,null),g(this,xl,null)}clonePage(e,t){for(const s of this.getEditors(e)){const i=s.serialize(s.mode!==nt.HIGHLIGHT);i&&(i.pageIndex=t,i.id=this.getId(),i.isClone=!0,delete i.popupRef,r(this,Ve).setValue(i.id,i))}}findClonesForPage(e){const t=[],{pageIndex:s}=e;for(const[i,n]of r(this,Ve))n.pageIndex===s&&n.isClone&&(r(this,Ve).remove(i),t.push(e.deserialize(n).then(a=>{a&&(a.isClone=!0,e.addOrRebuild(a))})));return Promise.all(t)}setEditingState(e){e?(b(this,G,Wv).call(this),b(this,G,Kv).call(this),b(this,G,Je).call(this,{isEditing:r(this,le)!==nt.NONE,isEmpty:b(this,G,sc).call(this),hasSomethingToUndo:r(this,zs).hasSomethingToUndo(),hasSomethingToRedo:r(this,zs).hasSomethingToRedo(),hasSelectedEditor:!1}
4)):(b(this,G,Xv).call(this),b(this,G,Jv).call(this),b(this,G,Je).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!r(this,Ws)){g(this,Ws,e);for(const t of r(this,Ws))b(this,G,un).call(this,t.defaultPropertiesToUpdate)}}getId(){return r(this,Df).id}get currentLayer(){return r(this,Jt).get(r(this,fr))}getLayer(e){return r(this,Jt).get(e)}get currentPageIndex(){return r(this,fr)}addLayer(e){r(this,Jt).set(e.pageIndex,e),r(this,mn)?e.enable():e.disable()}removeLayer(e){r(this,Jt).delete(e.pageIndex)}async updateMode(e,t=null,s=!1,i=!1,n=!1,a=!1){var o,l,h,c,u,f;if(r(this,le)!==e&&!(r(this,Xs)&&(await r(this,Xs).promise,!r(this,Xs)))){if(g(this,Xs,Promise.withResolvers()),(o=r(this,ur))==null||o.commitOrRemove(),r(this,le)===nt.POPUP&&((l=r(this,Ae))==null||l.hideSidebar()),(h=r(this,Ae))==null||h.destroyPopup(),g(this,le,e),e===nt.NONE){this.setEditingState(!1),b(this,G,qv).call(this);for(const p of r(this,jt).values())p.hideStandaloneCommentButton();(c=this._editorUndoBar)==null||c.hide(),this.toggleComment(null),r(this,Xs).resolve();return}for(const p of r(this,jt).values())p.addStandaloneCommentButton();e===nt.SIGNATURE&&await((u=r(this,br))==null?void 0:u.loadSignatures()),s&&$e.clearPointerType(),this.setEditingState(!0),await b(this,G,Zv).call(this),this.unselectAll();for(const p of r(this,Jt).values())p.updateMode(e);if(e===nt.POPUP){r(this,Sl)||g(this,Sl,await r(this,Rl).getAnnotationsByType(new Set(r(this,Ws).map(v=>v._editorType))));const p=new Set,m=[];for(const v of r(this,jt).values()){const{annotationElementId:A,hasComment:w,deleted:S}=v;A&&p.add(A),w&&!S&&m.push(v.getData())}for(const v of r(this,Sl)){const{id:A,popupRef:w,contentsObj:S}=v;w&&(S!=null&&S.str)&&!p.has(A)&&!r(this,pr).has(A)&&m.push(v)}(f=r(this,Ae))==null||f.showSidebar(m)}if(!t){i&&this.addNewEditorFromKeyboard(),r(this,Xs).resolve();return}for(const p of r(this,jt).values())p.uid===t?(this.setSelected(p),a?p.editComment():n?p.enterInEditMode():p.focus()):p.unselect();r(this,Xs).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==r(this,le)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,t){if(r(this,Ws)){switch(e){case ft.CREATE:this.currentLayer.addNewEditor(t);return;case ft.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(r(this,Gc)||g(this,Gc,new Map)).set(e,t),this.showAllEditors("highlight",t);break}if(this.hasSelection)for(const s of r(this,Ct))s.updateParams(e,t);else for(const s of r(this,Ws))s.updateDefaultParams(e,t)}}showAllEditors(e,t,s=!1){var n;for(const a of r(this,jt).values())a.editorType===e&&a.show(t);(((n=r(this,Gc))==null?void 0:n.get(ft.HIGHLIGHT_SHOW_ALL))??!0)!==t&&b(this,G,un).call(this,[[ft.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(r(this,jc)!==e){g(this,jc,e);for(const t of r(this,Jt).values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}*getEditors(e){for(const t of r(this,jt).values())t.pageIndex===e&&(yield t)}getEditor(e){return r(this,jt).get(e)}addEditor(e){r(this,jt).set(e.id,e)}removeEditor(e){var t,s;e.div.contains(document.activeElement)&&(r(this,Li)&&clearTimeout(r(this,Li)),g(this,Li,setTimeout(()=>{this.focusMainContainer(),g(this,Li,null)},0))),r(this,jt).delete(e.id),e.annotationElementId&&((t=r(this,yr))==null||t.delete(e.annotationElementId)),this.unselect(e),(!e.annotationElementId||!r(this,pr).has(e.annotationElementId))&&((s=r(this,Ve))==null||s.remove(e.id))}addDeletedAnnotationElement(e){r(this,pr).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return r(this,pr).has(e)}removeDeletedAnnotationElement(e){r(this,pr).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){r(this,bs)!==e&&(g(this,bs,e),e&&b(this,G,un).call(this,e.propertiesToUpdate))}updateUI(e){r(this,G,ty)===e&&b(this,G,un).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){b(this,G,un).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(r(this,Ct).has(e)){r(this,Ct).delete(e),e.unselect(),b(this,G,Je).call(this,{hasSelectedEditor:this.hasSelection});return}r(this,Ct).add(e),e.select(),b(this,G,un).call(this,e.propertiesToUpdate),b(this,G,Je).call(this,{hasSelectedEditor:!0})}setSelected(e){var t,s;this.updateToolbar({mode:e.mode,editId:e.uid}),(t=r(this,ur))==null||t.commitOrRemove();for(const i of r(this,Ct))i!==e&&i.unselect();(s=r(this,Ae))==null||s.destroyPopup(),r(this,Ct).clear(),r(this,Ct).add(e),e.select(),b(this,G,un).call(this,e.propertiesToUpdate),b(this,G,Je).call(this,{hasSelectedEditor:!0})}get firstSelectedEditor(){return r(this,Ct).values().next().value}unselect(e){e.unselect(),r(this,Ct).delete(e),b(this,G,Je).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return r(this,Ct).size!==0}get isEnterHandled(){return r(this,Ct).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;r(this,zs).undo(),b(this,G,Je).call(this,{hasSomethingToUndo:r(this,zs).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,G,sc).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){r(this,zs).redo(),b(this,G,Je).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:r(this,zs).hasSomethingToRedo(),isEmpty:b(this,G,sc).call(this)})}addCommands(e){r(this,zs).add(e),b(this,G,Je).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,G,sc).call(this)})}cleanUndoStack(e){r(this,zs).cleanType(e)}delete(){var n;this.commitOrRemove();const e=(n=this.currentLayer)==null?void 0:n.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const t=e?[e]:[...r(this,Ct)],s=()=>{var a;(a=this._editorUndoBar)==null||a.show(i,t.length===1?t[0].editorType:t.length);for(const o of t)o.remove()},i=()=>{for(const a of t)b(this,G,$p).call(this,a)};this.addCommands({cmd:s,undo:i,mustExec:!0})}commitOrRemove(){var e;(e=r(this,bs))==null||e.commitOrRemove()}hasSomethingToControl(){return r(this,bs)||this.hasSelection}selectAll(){for(const e of r(this,Ct))e.commit();b(this,G,Gp).call(this,r(this,jt).values())}unselectAll(){var e,t;if(!(r(this,bs)&&(r(this,bs).commitOrRemove(),r(this,le)!==nt.NONE))&&!((e=r(this,ur))!=null&&e.commitOrRemove())&&((t=r(this,Ae))==null||t.destroyPopup(),!!this.hasSelection)){for(const s of r(this,Ct))s.unselect();r(this,Ct).clear(),b(this,G,Je).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,t,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;r(this,wr)[0]+=e,r(this,wr)[1]+=t;const[i,n]=r(this,wr),a=[...r(this,Ct)],o=1e3;r(this,Bi)&&clearTimeout(r(this,Bi)),g(this,Bi,setTimeout(()=>{g(this,Bi,null),r(this,wr)[0]=r(this,wr)[1]=0,this.addCommands({cmd:()=>{for(const l of a)r(this,jt).has(l.id)&&(l.translateInPage(i,n),l.translationDone())},undo:()=>{for(const l of a)r(this,jt).has(l.id)&&(l.translateInPage(-i,-n),l.translationDone())},mustExec:!1})},o));for(const l of a)l.translateInPage(e,t),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),g(this,Fi,new Map);for(const e of r(this,Ct))r(this,Fi).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!r(this,Fi))return!1;this.disableUserSelect(!1);const e=r(this,Fi);g(this,Fi,null);let t=!1;for(const[{x:i,y:n,pageIndex:a},o]of e)o.newX=i,o.newY=n,o.newPageIndex=a,t||(t=i!==o.savedX||n!==o.savedY||a!==o.savedPageIndex);if(!t)return!1;const s=(i,n,a,o)=>
4{if(r(this,jt).has(i.id)){const l=r(this,Jt).get(o);l?i._setParentAndPosition(l,n,a):(i.pageIndex=o,i.x=n,i.y=a)}};return this.addCommands({cmd:()=>{for(const[i,{newX:n,newY:a,newPageIndex:o}]of e)s(i,n,a,o)},undo:()=>{for(const[i,{savedX:n,savedY:a,savedPageIndex:o}]of e)s(i,n,a,o)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(r(this,Fi))for(const s of r(this,Fi).keys())s.drag(e,t)}rebuild(e){if(e.parent===null){const t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||r(this,Ct).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return r(this,bs)===e}getActive(){return r(this,bs)}getMode(){return r(this,le)}isEditingMode(){return r(this,le)!==nt.NONE}get imageManager(){return Q(this,"imageManager",new Up)}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let h=0,c=t.rangeCount;h<c;h++)if(!e.contains(t.getRangeAt(h).commonAncestorContainer))return null;const{x:s,y:i,width:n,height:a}=e.getBoundingClientRect();let o;switch(e.getAttribute("data-main-rotation")){case"90":o=(h,c,u,f)=>({x:(c-i)/a,y:1-(h+u-s)/n,width:f/a,height:u/n});break;case"180":o=(h,c,u,f)=>({x:1-(h+u-s)/n,y:1-(c+f-i)/a,width:u/n,height:f/a});break;case"270":o=(h,c,u,f)=>({x:1-(c+f-i)/a,y:(h-s)/n,width:f/a,height:u/n});break;default:o=(h,c,u,f)=>({x:(h-s)/n,y:(c-i)/a,width:u/n,height:f/a});break}const l=[];for(let h=0,c=t.rangeCount;h<c;h++){const u=t.getRangeAt(h);if(!u.collapsed)for(const{x:f,y:p,width:m,height:v}of u.getClientRects())m===0||v===0||l.push(o(f,p,m,v))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:e,id:t}){(r(this,Cl)||g(this,Cl,new Map)).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){var t;(t=r(this,Cl))==null||t.delete(e)}renderAnnotationElement(e){var i;const t=(i=r(this,Cl))==null?void 0:i.get(e.data.id);if(!t)return;const s=r(this,Ve).getRawValue(t);s&&(r(this,le)===nt.NONE&&!s.hasBeenModified||s.renderAnnotationElement(e))}setMissingCanvas(e,t,s){var n;const i=(n=r(this,yr))==null?void 0:n.get(e);i&&(i.setCanvas(t,s),r(this,yr).delete(e))}addMissingCanvas(e,t){(r(this,yr)||g(this,yr,new Map)).set(e,t)}};wl=new WeakMap,bs=new WeakMap,Sl=new WeakMap,jt=new WeakMap,Jt=new WeakMap,El=new WeakMap,xl=new WeakMap,Tl=new WeakMap,Ve=new WeakMap,Cl=new WeakMap,zs=new WeakMap,Ae=new WeakMap,dr=new WeakMap,ur=new WeakMap,fr=new WeakMap,pr=new WeakMap,Fi=new WeakMap,Ws=new WeakMap,Ia=new WeakMap,Uc=new WeakMap,Hc=new WeakMap,Pl=new WeakMap,_c=new WeakMap,Li=new WeakMap,gr=new WeakMap,Il=new WeakMap,mr=new WeakMap,Ni=new WeakMap,Df=new WeakMap,mn=new WeakMap,Ol=new WeakMap,jc=new WeakMap,vr=new WeakMap,Oa=new WeakMap,Ml=new WeakMap,yr=new WeakMap,$c=new WeakMap,le=new WeakMap,Ct=new WeakMap,vn=new WeakMap,br=new WeakMap,Ar=new WeakMap,Gc=new WeakMap,Rl=new WeakMap,Vc=new WeakMap,wr=new WeakMap,Bi=new WeakMap,yn=new WeakMap,zc=new WeakMap,Wc=new WeakMap,Xs=new WeakMap,G=new WeakSet,Lu=function({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e},_p=function(e){const{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(const s of r(this,Jt).values())if(s.hasTextLayer(e))return s;return null},Gv=function(){const e=document.getSelection();if(!e||e.isCollapsed)return;const s=b(this,G,Lu).call(this,e).closest(".textLayer"),i=this.getSelectionBoxes(s);i&&(r(this,Ni)||g(this,Ni,new IA(this)),r(this,Ni).show(s,i,this.direction==="ltr"))},Vv=function(){var n,a,o;const e=document.getSelection();if(!e||e.isCollapsed){r(this,vn)&&((n=r(this,Ni))==null||n.hide(),g(this,vn,null),b(this,G,Je).call(this,{hasSelectedText:!1}));return}const{anchorNode:t}=e;if(t===r(this,vn))return;const i=b(this,G,Lu).call(this,e).closest(".textLayer");if(!i){r(this,vn)&&((a=r(this,Ni))==null||a.hide(),g(this,vn,null),b(this,G,Je).call(this,{hasSelectedText:!1}));return}if((o=r(this,Ni))==null||o.hide(),g(this,vn,t),b(this,G,Je).call(this,{hasSelectedText:!0}),!(r(this,le)!==nt.HIGHLIGHT&&r(this,le)!==nt.NONE)&&(r(this,le)===nt.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),g(this,mr,this.isShiftKeyDown),!this.isShiftKeyDown)){const l=r(this,le)===nt.HIGHLIGHT?b(this,G,_p).call(this,i):null;if(l==null||l.toggleDrawing(),r(this,Ol)){const h=new AbortController,c=this.combinedSignal(h),u=f=>{f.type==="pointerup"&&f.button!==0||(h.abort(),l==null||l.toggleDrawing(!0),f.type==="pointerup"&&b(this,G,ec).call(this,"main_toolbar"))};window.addEventListener("pointerup",u,{signal:c}),window.addEventListener("blur",u,{signal:c})}else l==null||l.toggleDrawing(!0),b(this,G,ec).call(this,"main_toolbar")}},ec=function(e=""){r(this,le)===nt.HIGHLIGHT?this.highlightSelection(e):r(this,Uc)&&b(this,G,Gv).call(this)},zv=function(){document.addEventListener("selectionchange",b(this,G,Vv).bind(this),{signal:this._signal})},Wv=function(){if(r(this,gr))return;g(this,gr,new AbortController);const e=this.combinedSignal(r(this,gr));window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})},Xv=function(){var e;(e=r(this,gr))==null||e.abort(),g(this,gr,null)},jp=function(){if(r(this,vr))return;g(this,vr,new AbortController);const e=this.combinedSignal(r(this,vr));window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})},Yv=function(){var e;(e=r(this,vr))==null||e.abort(),g(this,vr,null)},Kv=function(){if(r(this,dr))return;g(this,dr,new AbortController);const e=this.combinedSignal(r(this,dr));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})},Jv=function(){var e;(e=r(this,dr))==null||e.abort(),g(this,dr,null)},Qv=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},Je=function(e){Object.entries(e).some(([s,i])=>r(this,Vc)[s]!==i)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(r(this,Vc),e)}),r(this,le)===nt.HIGHLIGHT&&e.hasSelectedEditor===!1&&b(this,G,un).call(this,[[ft.HIGHLIGHT_FREE,!0]]))},un=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},Zv=async function(){if(!r(this,mn)){g(this,mn,!0);const e=[];for(const t of r(this,Jt).values())e.push(t.enable());await Promise.all(e);for(const t of r(this,jt).values())t.enable()}},qv=function(){if(this.unselectAll(),r(this,mn)){g(this,mn,!1);for(const e of r(this,Jt).values())e.disable();for(const e of r(this,jt).values())e.disable()}},$p=function(e){const t=r(this,Jt).get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},ty=function(){let e=null;for(e of r(this,Ct));return e},sc=function(){if(r(this,jt).size===0)return!0;
4if(r(this,jt).size===1)for(const e of r(this,jt).values())return e.isEmpty();return!1},Gp=function(e){for(const t of r(this,Ct))t.unselect();r(this,Ct).clear();for(const t of e)t.isEmpty()||(r(this,Ct).add(t),t.select());b(this,G,Je).call(this,{hasSelectedEditor:this.hasSelection})},R(fl,"TRANSLATE_SMALL",1),R(fl,"TRANSLATE_BIG",10);let qo=fl;var we,Ui,ci,Dl,Hi,As,kl,_i,ds,bn,Ma,ji,Sr,xi,ic,Nu;const Qe=class Qe{constructor(e){y(this,xi);y(this,we,null);y(this,Ui,!1);y(this,ci,null);y(this,Dl,null);y(this,Hi,null);y(this,As,null);y(this,kl,!1);y(this,_i,null);y(this,ds,null);y(this,bn,null);y(this,Ma,null);y(this,ji,!1);g(this,ds,e),g(this,ji,e._uiManager.useNewAltTextFlow),r(Qe,Sr)||g(Qe,Sr,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){Qe._l10n??(Qe._l10n=e)}async render(){const e=g(this,ci,document.createElement("button"));e.className="altText",e.tabIndex="0";const t=g(this,Dl,document.createElement("span"));e.append(t),r(this,ji)?(e.classList.add("new"),e.setAttribute("data-l10n-id",r(Qe,Sr).missing),t.setAttribute("data-l10n-id",r(Qe,Sr)["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const s=r(this,ds)._uiManager._signal;e.addEventListener("contextmenu",Ti,{signal:s}),e.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});const i=n=>{n.preventDefault(),r(this,ds)._uiManager.editAltText(r(this,ds)),r(this,ji)&&r(this,ds)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:r(this,xi,ic)}})};return e.addEventListener("click",i,{capture:!0,signal:s}),e.addEventListener("keydown",n=>{n.target===e&&n.key==="Enter"&&(g(this,kl,!0),i(n))},{signal:s}),await b(this,xi,Nu).call(this),e}finish(){r(this,ci)&&(r(this,ci).focus({focusVisible:r(this,kl)}),g(this,kl,!1))}isEmpty(){return r(this,ji)?r(this,we)===null:!r(this,we)&&!r(this,Ui)}hasData(){return r(this,ji)?r(this,we)!==null||!!r(this,bn):this.isEmpty()}get guessedText(){return r(this,bn)}async setGuessedText(e){r(this,we)===null&&(g(this,bn,e),g(this,Ma,await Qe._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e})),b(this,xi,Nu).call(this))}toggleAltTextBadge(e=!1){var t;if(!r(this,ji)||r(this,we)){(t=r(this,_i))==null||t.remove(),g(this,_i,null);return}if(!r(this,_i)){const s=g(this,_i,document.createElement("div"));s.className="noAltTextBadge",r(this,ds).div.append(s)}r(this,_i).classList.toggle("hidden",!e)}serialize(e){let t=r(this,we);return!e&&r(this,bn)===t&&(t=r(this,Ma)),{altText:t,decorative:r(this,Ui),guessedText:r(this,bn),textWithDisclaimer:r(this,Ma)}}get data(){return{altText:r(this,we),decorative:r(this,Ui)}}set data({altText:e,decorative:t,guessedText:s,textWithDisclaimer:i,cancel:n=!1}){s&&(g(this,bn,s),g(this,Ma,i)),!(r(this,we)===e&&r(this,Ui)===t)&&(n||(g(this,we,e),g(this,Ui,t)),b(this,xi,Nu).call(this))}toggle(e=!1){r(this,ci)&&(!e&&r(this,As)&&(clearTimeout(r(this,As)),g(this,As,null)),r(this,ci).disabled=!e)}shown(){r(this,ds)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:r(this,xi,ic)}})}destroy(){var e,t;(e=r(this,ci))==null||e.remove(),g(this,ci,null),g(this,Dl,null),g(this,Hi,null),(t=r(this,_i))==null||t.remove(),g(this,_i,null)}};we=new WeakMap,Ui=new WeakMap,ci=new WeakMap,Dl=new WeakMap,Hi=new WeakMap,As=new WeakMap,kl=new WeakMap,_i=new WeakMap,ds=new WeakMap,bn=new WeakMap,Ma=new WeakMap,ji=new WeakMap,Sr=new WeakMap,xi=new WeakSet,ic=function(){return r(this,we)&&"added"||r(this,we)===null&&this.guessedText&&"review"||"missing"},Nu=async function(){var i,n,a;const e=r(this,ci);if(!e)return;if(r(this,ji)){if(e.classList.toggle("done",!!r(this,we)),e.setAttribute("data-l10n-id",r(Qe,Sr)[r(this,xi,ic)]),(i=r
4(this,Dl))==null||i.setAttribute("data-l10n-id",r(Qe,Sr)[`${r(this,xi,ic)}-label`]),!r(this,we)){(n=r(this,Hi))==null||n.remove();return}}else{if(!r(this,we)&&!r(this,Ui)){e.classList.remove("done"),(a=r(this,Hi))==null||a.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let t=r(this,Hi);if(!t){g(this,Hi,t=document.createElement("span")),t.className="tooltip",t.setAttribute("role","tooltip"),t.id=`alt-text-tooltip-${r(this,ds).id}`;const o=100,l=r(this,ds)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(r(this,As)),g(this,As,null)},{once:!0}),e.addEventListener("mouseenter",()=>{g(this,As,setTimeout(()=>{g(this,As,null),r(this,Hi).classList.add("show"),r(this,ds)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),e.addEventListener("mouseleave",()=>{var h;r(this,As)&&(clearTimeout(r(this,As)),g(this,As,null)),(h=r(this,Hi))==null||h.classList.remove("show")},{signal:l})}r(this,Ui)?t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(t.removeAttribute("data-l10n-id"),t.textContent=r(this,we)),t.parentNode||e.append(t);const s=r(this,ds).getElementForAltText();s==null||s.setAttribute("aria-describedby",t.id)},y(Qe,Sr,null),R(Qe,"_l10n",null);let Sf=Qe;var Me,Ys,Ra,Nt,Xc,Er,Ks,xr,Tr,Da,Yc,Vp;class Eu{constructor(e){y(this,Yc);y(this,Me,null);y(this,Ys,null);y(this,Ra,!1);y(this,Nt,null);y(this,Xc,null);y(this,Er,null);y(this,Ks,null);y(this,xr,null);y(this,Tr,!1);y(this,Da,null);g(this,Nt,e)}renderForToolbar(){const e=g(this,Ys,document.createElement("button"));return e.className="comment",b(this,Yc,Vp).call(this,e,!1)}renderForStandalone(){const e=g(this,Me,document.createElement("button"));e.className="annotationCommentButton";const t=r(this,Nt).commentButtonPosition;if(t){const{style:s}=e;s.insetInlineEnd=`calc(${100*(r(this,Nt)._uiManager.direction==="ltr"?1-t[0]:t[0])}% - var(--comment-button-dim))`,s.top=`calc(${100*t[1]}% - var(--comment-button-dim))`;const i=r(this,Nt).commentButtonColor;i&&(s.backgroundColor=i)}return b(this,Yc,Vp).call(this,e,!0)}focusButton(){setTimeout(()=>{var e;(e=r(this,Me)??r(this,Ys))==null||e.focus()},0)}onUpdatedColor(){if(!r(this,Me))return;const e=r(this,Nt).commentButtonColor;e&&(r(this,Me).style.backgroundColor=e),r(this,Nt)._uiManager.updatePopupColor(r(this,Nt))}get commentButtonWidth(){var e;return(((e=r(this,Me))==null?void 0:e.getBoundingClientRect().width)??0)/r(this,Nt).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(r(this,Da))return r(this,Da);if(!r(this,Me))return null;const{x:e,y:t,height:s}=r(this,Me).getBoundingClientRect(),{x:i,y:n,width:a,height:o}=r(this,Nt).parent.boundingClientRect;return[(e-i)/a,(t+s-n)/o]}set commentPopupPositionInLayer(e){g(this,Da,e)}hasDefaultPopupPosition(){return r(this,Da)===null}removeStandaloneCommentButton(){var e;(e=r(this,Me))==null||e.remove(),g(this,Me,null)}removeToolbarCommentButton(){var e;(e=r(this,Ys))==null||e.remove(),g(this,Ys,null)}setCommentButtonStates({selected:e,hasPopup:t}){r(this,Me)&&(r(this,Me).classList.toggle("selected",e),r(this,Me).ariaExpanded=t)}edit(e){const t=this.commentPopupPositionInLayer;let s,i;if(t)[s,i]=t;else{[s,i]=r(this,Nt).commentButtonPosition;const{width:c,height:u,x:f,y:p}=r(this,Nt);s=f+s*c,i=p+i*u}const n=r(this,Nt).parent.boundingClientRect,{x:a,y:o,width:l,height:h}=n;r(this,Nt)._uiManager.editComment(r(this,Nt),a+s*l,o+i*h,{...e,parentDimensions:n})}finish(){r(this,Ys)&&(r(this,Ys).focus({focusVisible:r(this,Ra)}),g(this,Ra,!1))}isDeleted(){return r(this,Tr)||r(this,Ks)===""}isEmpty(){return r(this,Ks)===null}hasBeenEdited(){return this.isDeleted()||r(this,Ks)!==r(this,Xc)}serialize(){return this.data}get data(){return{text:r(this,Ks),richText:r(this,Er),date:r(this,xr),deleted:this.isDeleted()}}set data(e){if(e!==r(this,Ks)&&g(this,Er,null),e===null){g(this,Ks,""),g(this,Tr,!0);return}g(this,Ks,e),g(this,xr,new Date),g(this,Tr,!1)}restoreData({text:e,richText:t,date:s}){g(this,Ks,e),g(this,Er,t),g(this,xr,s),g(this,Tr,!1)}setInitialText(e,t=null){g(this,Xc,e),this.data=e,g(this,xr,null),g(this,Er,t)}shown(){}destroy(){var e,t;(e=r(this,Ys))==null||e.remove(),g(this,Ys,null),(t=r(this,Me))==null||t.remove(),g(this,Me,null),g(this,Ks,""),g(this,Er,null),g(this,xr,null),g(this,Nt,null),g(this,Ra,!1),g(this,Tr,!1)}}
4Me=new WeakMap,Ys=new WeakMap,Ra=new WeakMap,Nt=new WeakMap,Xc=new WeakMap,Er=new WeakMap,Ks=new WeakMap,xr=new WeakMap,Tr=new WeakMap,Da=new WeakMap,Yc=new WeakSet,Vp=function(e,t){if(!r(this,Nt)._uiManager.hasCommentManager())return null;e.tabIndex="0",e.ariaHasPopup="dialog",t?(e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(e.ariaControlsElements=[r(this,Nt)._uiManager.getCommentDialogElement()],e.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));const s=r(this,Nt)._uiManager._signal;if(!(s instanceof AbortSignal)||s.aborted)return e;e.addEventListener("contextmenu",Ti,{signal:s}),t&&(e.addEventListener("focusin",n=>{r(this,Nt)._focusEventsAllowed=!1,me(n)},{capture:!0,signal:s}),e.addEventListener("focusout",n=>{r(this,Nt)._focusEventsAllowed=!0,me(n)},{capture:!0,signal:s})),e.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});const i=n=>{n.preventDefault(),e===r(this,Ys)?this.edit():r(this,Nt).toggleComment(!0)};return e.addEventListener("click",i,{capture:!0,signal:s}),e.addEventListener("keydown",n=>{n.target===e&&n.key==="Enter"&&(g(this,Ra,!0),i(n))},{signal:s}),e.addEventListener("pointerenter",()=>{r(this,Nt).toggleComment(!1,!0)},{signal:s}),e.addEventListener("pointerleave",()=>{r(this,Nt).toggleComment(!1,!1)},{signal:s}),e};function sv(d){d.preventDefault()}const iv=1e-4;function Sp(d){return d.cancelable?(me(d),!0):(d.stopPropagation(),!1)}var Fl,Cr,Kc,Jc,Qc,Zc,qc,ka,Pr,An,Fa,$i,wn,La,Sn,Ir,zt,sy,zp,Wp,Xp,Bu,iy,ny,Yp;class ey{constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:s=null,onPinchStart:i=null,onPinching:n=null,onPinchEnd:a=null,onPanning:o=null,signal:l}){y(this,zt);y(this,Fl);y(this,Cr,!1);y(this,Kc,null);y(this,Jc);y(this,Qc);y(this,Zc);y(this,qc);y(this,ka);y(this,Pr,!1);y(this,An,null);y(this,Fa);y(this,$i,new Set);y(this,wn,null);y(this,La);y(this,Sn,null);y(this,Ir,0);g(this,Fl,e),g(this,Kc,s),g(this,Jc,t),g(this,Qc,i),g(this,Zc,n),g(this,qc,a),g(this,ka,o),g(this,La,new AbortController),g(this,Fa,AbortSignal.any([l,r(this,La).signal])),e.addEventListener("touchstart",b(this,zt,sy).bind(this),{passive:!1,signal:r(this,Fa)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Ci.pixelRatio}get MIN_TOUCH_DISTANCE_TO_SCALE(){return 4/Ci.pixelRatio}destroy(){var e,t;b(this,zt,Yp).call(this),r(this,$i).clear(),(e=r(this,La))==null||e.abort(),g(this,La,null),(t=r(this,An))==null||t.abort(),g(this,An,null)}}Fl=new WeakMap,Cr=new WeakMap,Kc=new WeakMap,Jc=new WeakMap,Qc=new WeakMap,Zc=new WeakMap,qc=new WeakMap,ka=new WeakMap,Pr=new WeakMap,An=new WeakMap,Fa=new WeakMap,$i=new WeakMap,wn=new WeakMap,La=new WeakMap,Sn=new WeakMap,Ir=new WeakMap,zt=new WeakSet,sy=function(e){var s,i;if((s=r(this,Jc))!=null&&s.call(this))return;b(this,zt,Wp).call(this,e);const t=r(this,$i);for(const{identifier:n}of e.changedTouches)t.add(n);if(t.size===1){b(this,zt,zp).call(this);return}if(!r(this,Sn)){g(this,Sn,new AbortController);const n=AbortSignal.any([r(this,Fa),r(this,Sn).signal]),a=r(this,Fl),o={signal:n,capture:!1,passive:!1};a.addEventListener("touchmove",b(this,zt,iy).bind(this),o);const l=b(this,zt,ny).bind(this);a.addEventListener("touchend",l,o),a.addEventListener("touchcancel",l,o),o.capture=!0,a.addEventListener("pointerdown",me,o),a.addEventListener("pointermove",me,o),a.addEventListener("pointercancel",sv,o),a.addEventListener("pointerup",sv,o),(i=r(this,Qc))==null||i.call(this)}g(this,Pr,Sp(e)),b(this,zt,Bu).call(this,e)},zp=function(){if(r(this,An))return;const e=g(this,An,new AbortController),t=AbortSignal.any([r(this,Fa),e.signal]),s=r(this,Fl),i={capture:!0,signal:t,passive:!1},n=a=>{var o;a.pointerType==="touch"&&((o=r(this,An))==null||o.abort(),g(this,An,null))};s.addEventListener("pointerdown",a=>{a.pointerType==="touch"&&(me(a),n(a))},i),s.addEventListener("pointerup",n,i),s.addEventListener("pointercancel",n,i)},Wp=function(e){const t=r(this,$i);if(t.size===0)return;const s=g(this,$i,new Set);for(const{identifier:i}of e.touches)t.has(i)&&s.add(i)},Xp=function(e){const t=r(this,$i),s=[];for(const i of e.touches)t.has(i.identifier)&&s.push(i);return s},Bu=function(e){var n;const t=b(this,zt,Xp).call(this,e);if(t.length!==2||(n=r(this,Kc))!=null&&n.call(this)){g(this,wn,null);return}const[s,i]=t;g(this,wn,{touch0X:s.screenX,touch0Y:s.screenY,touch1X:i.screenX,touch1Y:i.screenY,panX:(s.clientX+i.clientX)/2,panY:(s.clientY+i.clientY)/2,screenPanX:(s.screenX+i.screenX)/2,screenPanY:(s.screenY+i.screenY)/2})},iy=function(e){var k,N,X,z;if(!r(this,wn))return;const t=b(this,zt,Xp).call(this,e);if(t.length!==2)return;const s=r(this,Pr);if(g(this,Pr,Sp(e)),!r(this,Pr))return;if(!s){b(this,zt,Bu).call(this,e);return}const[i,n]=t,{screenX:a,screenY:o}=i,{screenX:l,screenY:h}=n,c=r(this,wn),{touch0X:u,touch0Y:f,touch1X:p,touch1Y:m,panX:v,panY:A}=c,w=p-u,S=m-f,x=l-a,T=h-o,E=(i.clientX+n.clientX)/2,C=(i.clientY+n.clientY)/2;c.panX=E,c.panY=C;const P=E-v,O=C-A,I=(a+l)/2,D=(o+h)/2,M=Math.hypot(I-c.screenPanX,D-c.screenPanY);c.screenPanX=I,c.screenPanY=D;const U=Math.hypot(x,T),L=Math.hypot(w,S),B=r(this,Cr)?this.MIN_TOUCH_DISTANCE_TO_SCALE:this.MIN_TOUCH_DISTANCE_TO_PINCH+2*M;
4if(U<iv||L<iv||Math.abs(L-U)<=B){(P||O)&&((k=r(this,ka))==null||k.call(this,P,O));return}c.touch0X=a,c.touch0Y=o,c.touch1X=l,c.touch1Y=h;const W=Math.sign(U-L);if(!r(this,Cr)){g(this,Cr,!0),g(this,Ir,W),(P||O)&&((N=r(this,ka))==null||N.call(this,P,O));return}if(r(this,Ir)){const lt=r(this,Ir);if(g(this,Ir,0),W!==lt&&Math.abs(U-L)<=2*M){g(this,Cr,!1),(P||O)&&((X=r(this,ka))==null||X.call(this,P,O));return}}(z=r(this,Zc))==null||z.call(this,[v,A],L,U,P,O)},ny=function(e){if(b(this,zt,Wp).call(this,e),r(this,$i).size>=2){b(this,zt,Bu).call(this,e);return}const t=!!r(this,wn);b(this,zt,Yp).call(this),r(this,$i).size===1&&b(this,zt,zp).call(this),t&&Sp(e)},Yp=function(){var e;g(this,wn,null),g(this,Cr,!1),g(this,Ir,0),g(this,Pr,!1),r(this,Sn)&&(r(this,Sn).abort(),g(this,Sn,null),(e=r(this,qc))==null||e.call(this))};var Na,di,$t,Et,En,Ll,Or,td,Re,Ba,xn,Js,Mr,ed,Ua,ws,sd,Ha,Tn,Gi,Nl,Bl,Qs,Rr,id,kf,Z,Kp,nd,Jp,Uu,ry,ay,Qp,Hu,Zp,oy,ly,hy,qp,cy,tg,eg,dy,uy,fy,sg,nc;const et=class et{constructor(e){y(this,Z);y(this,Na,null);y(this,di,null);y(this,$t,null);y(this,Et,null);y(this,En,null);y(this,Ll,!1);y(this,Or,null);y(this,td,"");y(this,Re,null);y(this,Ba,null);y(this,xn,null);y(this,Js,null);y(this,Mr,null);y(this,ed,"");y(this,Ua,!1);y(this,ws,null);y(this,sd,!1);y(this,Ha,!1);y(this,Tn,!1);y(this,Gi,null);y(this,Nl,0);y(this,Bl,0);y(this,Qs,null);y(this,Rr,null);R(this,"isSelected",!1);R(this,"_isCopy",!1);R(this,"_editToolbar",null);R(this,"_initialOptions",Object.create(null));R(this,"_initialData",null);R(this,"_isVisible",!0);R(this,"_uiManager",null);R(this,"_focusEventsAllowed",!0);y(this,id,!1);y(this,kf,et._zIndex++);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:s,pageHeight:i,pageX:n,pageY:a}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,i],this.pageTranslation=[n,a];const[o,l]=this.parentDimensions;this.x=e.x/o,this.y=e.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=et.prototype._resizeWithKeyboard,t=qo.TRANSLATE_SMALL,s=qo.TRANSLATE_BIG;return Q(this,"_resizerKeyboardManager",new Zo([[["ArrowLeft"],e,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-s,0]}],[["ArrowRight"],e,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[s,0]}],[["ArrowUp"],e,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-s]}],[["ArrowDown"],e,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,s]}],[["Escape"],et.prototype._stopResizingWithKeyboard]]))}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 Q(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new DA({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){if(et._l10n??(et._l10n=e),et._l10nAlert??(et._l10nAlert=Object.freeze({highlight:"pdfjs-editor-highlight-added-alert",freetext:"pdfjs-editor-freetext-added-alert",ink:"pdfjs-editor-ink-added-alert",stamp:"pdfjs-editor-stamp-added-alert",signature:"pdfjs-editor-signature-added-alert"})),et._l10nResizer??(et._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"})),et._borderLineWidth!==-1)return;const s=getComputedStyle(document.documentElement);et._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){gt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return r(this,id)}set _isDraggable(e){var t;g(this,id,e),(t=this.div)==null||t.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/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}
4setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=r(this,kf)}setParent(e){var t;e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):(b(this,Z,nc).call(this),(t=r(this,Js))==null||t.remove(),g(this,Js,null)),this.parent=e}focusin(e){this._focusEventsAllowed&&(r(this,Ua)?g(this,Ua,!1):this.parent.setSelected(this))}focusout(e){var s;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const t=e.relatedTarget;t!=null&&t.closest(`#${this.id}`)||(e.preventDefault(),(s=this.parent)!=null&&s.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,s,i){const[n,a]=this.parentDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(e+s)/n,this.y=(t+i)/a,this.fixAndSetPosition()}_moveAfterPaste(e,t){if(this.isClone){delete this.isClone;return}const[s,i]=this.parentDimensions;this.setAt(e*s,t*i,this.width*s,this.height*i),this._onTranslated()}translate(e,t){b(this,Z,Kp).call(this,this.parentDimensions,e,t)}translateInPage(e,t){r(this,ws)||g(this,ws,[this.x,this.y,this.width,this.height]),b(this,Z,Kp).call(this,this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){r(this,ws)||g(this,ws,[this.x,this.y,this.width,this.height]);const{div:s,parentDimensions:[i,n]}=this;if(this.x+=e/i,this.y+=t/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:f}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,f)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this;const[l,h]=this.getBaseTranslation();a+=l,o+=h;const{style:c}=s;c.left=`${(100*a).toFixed(2)}%`,c.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o)}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!r(this,ws)&&(r(this,ws)[0]!==this.x||r(this,ws)[1]!==this.y)}get _hasBeenResized(){return!!r(this,ws)&&(r(this,ws)[2]!==this.width||r(this,ws)[3]!==this.height)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:s}=et,i=s/e,n=s/t;switch(this.rotation){case 90:return[-i,n];case 180:return[i,n];case 270:return[i,-n];default:return[-i,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:t},pageDimensions:[s,i]}=this;let{x:n,y:a,width:o,height:l}=this;if(o*=s,l*=i,n*=s,a*=i,this._mustFixPosition)switch(e){case 0:n=_t(n,0,s-o),a=_t(a,0,i-l);break;case 90:n=_t(n,0,s-l),a=_t(a,o,i);break;case 180:n=_t(n,o,s),a=_t(a,l,i);break;case 270:n=_t(n,l,s),a=_t(a,0,i-o);break}this.x=n/=s,this.y=a/=i;const[h,c]=this.getBaseTranslation();n+=h,a+=c,t.left=`${(100*n).toFixed(2)}%`,t.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,t){var s;return b(s=et,nd,Jp).call(s,e,t,this.parentRotation)}pageTranslationToScreen(e,t){var s;return b(s=et,nd,Jp).call(s,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,s]}=this;return[t*e,s*e]}setDims(){const{div:{style:e},width:t,height:s}=this;e.width=`${(100*t).toFixed(2)}%`,e.height=`${(100*s).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(e){return Math.round(e*1e4)/1e4}_onResizing(){}altTextFinish(){var e;(e=r(this,$t))==null||e.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||r(this,Ha))return this._editToolbar;this._editToolbar=new Np(this),this.div.append(this._editToolbar.render());const{toolbarButtons:e}=this;if(e)for(const[t,s]of e)await this._editToolbar.addButton(t,s);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){var e;(e=this._editToolbar)==null||e.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}
4removeCommentButtonFromToolbar(){var e;(e=this._editToolbar)==null||e.removeButton("comment")}removeEditToolbar(){var e,t;(e=this._editToolbar)==null||e.remove(),this._editToolbar=null,(t=r(this,$t))==null||t.destroy()}addContainer(e){var s;const t=(s=this._editToolbar)==null?void 0:s.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return r(this,$t)||(Sf.initialize(et._l10n),g(this,$t,new Sf(this)),r(this,Na)&&(r(this,$t).data=r(this,Na),g(this,Na,null))),r(this,$t)}get altTextData(){var e;return(e=r(this,$t))==null?void 0:e.data}set altTextData(e){r(this,$t)&&(r(this,$t).data=e)}get guessedAltText(){var e;return(e=r(this,$t))==null?void 0:e.guessedText}async setGuessedAltText(e){var t;await((t=r(this,$t))==null?void 0:t.setGuessedText(e))}serializeAltText(e){var t;return(t=r(this,$t))==null?void 0:t.serialize(e)}hasAltText(){return!!r(this,$t)&&!r(this,$t).isEmpty()}hasAltTextData(){var e;return((e=r(this,$t))==null?void 0:e.hasData())??!1}focusCommentButton(){var e;(e=r(this,Et))==null||e.focusButton()}addCommentButton(){return this.canAddComment?r(this,Et)||g(this,Et,new Eu(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(r(this,En)){this._uiManager.isEditingMode()&&r(this,En).classList.remove("hidden");return}this.hasComment&&(g(this,En,r(this,Et).renderForStandalone()),this.div.append(r(this,En)))}}removeStandaloneCommentButton(){r(this,Et).removeStandaloneCommentButton(),g(this,En,null)}hideStandaloneCommentButton(){var e;(e=r(this,En))==null||e.classList.add("hidden")}get comment(){if(!r(this,Et))return null;const{data:{richText:e,text:t,date:s,deleted:i}}=r(this,Et);return{text:t,richText:e,date:s,deleted:i,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){r(this,Et)||g(this,Et,new Eu(this)),typeof e=="object"&&e!==null?r(this,Et).restoreData(e):r(this,Et).data=e,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:e,popupRef:t,richText:s}){if(!t||(r(this,Et)||g(this,Et,new Eu(this)),r(this,Et).setInitialText(e,s),!this.annotationElementId))return;const i=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);i&&this.updateFromAnnotationLayer(i)}get hasEditedComment(){var e;return(e=r(this,Et))==null?void 0:e.hasBeenEdited()}get hasDeletedComment(){var e;return(e=r(this,Et))==null?void 0:e.isDeleted()}get hasComment(){return!!r(this,Et)&&!r(this,Et).isEmpty()&&!r(this,Et).isDeleted()}async editComment(e){r(this,Et)||g(this,Et,new Eu(this)),r(this,Et).edit(e)}
4toggleComment(e,t=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,t)}setSelectedCommentButton(e){r(this,Et).setSelectedButton(e)}addComment(e){if(this.hasEditedComment){const[,,,i]=e.rect,[n]=this.pageDimensions,[a]=this.pageTranslation,o=a+n+1,l=i-100,h=o+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[o,l,h,i]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:t}}){r(this,Et).data=t?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var a;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=r(this,Ll)?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),b(this,Z,tg).call(this);const[t,s]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth=`${(100*s/t).toFixed(2)}%`,e.style.maxHeight=`${(100*t/s).toFixed(2)}%`);const[i,n]=this.getInitialTranslation();return this.translate(i,n),_v(this,e,["keydown","pointerdown","dblclick"]),b(this,Z,eg).call(this),this.addStandaloneCommentButton(),(a=this._uiManager._editorUndoBar)==null||a.hide(),e}pointerdown(e){const{isMac:t}=Mt.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(g(this,Ua,!0),this._isDraggable){b(this,Z,cy).call(this,e);return}b(this,Z,qp).call(this,e)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){r(this,Gi)&&clearTimeout(r(this,Gi)),g(this,Gi,setTimeout(()=>{var e;g(this,Gi,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,t,s){e.changeParent(this),this.x=t,this.y=s,this.fixAndSetPosition(),this._onTranslated()}getRect(e,t,s=this.rotation){const i=this.parentScale,[n,a]=this.pageDimensions,[o,l]=this.pageTranslation,h=e/i,c=t/i,u=this.x*n,f=this.y*a,p=this.width*n,m=this.height*a;switch(s){case 0:return[u+h+o,a-f-c-m+l,u+h+p+o,a-f-c+l];case 90:return[u+c+o,a-f+h+l,u+c+m+o,a-f+h+p+l];case 180:return[u-h-p+o,a-f+c+l,u-h+o,a-f+c+m+l];case 270:return[u-c-m+o,a-f-h-p+l,u-c+o,a-f-h+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[s,i,n,a]=e,o=n-s,l=a-i;switch(this.rotation){case 0:return[s,t-a,o,l];case 90:return[s,t-i,l,o];case 180:return[n,t-i,o,l];case 270:return[n,t-a,l,o];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&et._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var e;(e=r(this,Et))==null||e.onUpdatedColor()}getData(){const{comment:{text:e,color:t,date:s,opacity:i,deleted:n,richText:a},uid:o,pageIndex:l,creationDate:h,modificationDate:c}=this;return{id:o,pageIndex:l,rect:this.getPDFRect(),richText:a,contentsObj:{str:e},creationDate:h,modificationDate:s||c,popupRef:!n,color:t,opacity:i}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),g(this,Ha,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),g(this,Ha,!1),!0):!1}isInEditMode(){return r(this,Ha)}shouldGetKeyboardEvents(){return r(this,Tn)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:t,bottom:s,right:i}=this.getClientDimensions(),{innerHeight:n,innerWidth:a}=window;return t<a&&i>0&&e<n&&s>0}rebuild(){b(this,Z,tg).call(this),b(this,Z,eg).call(this)}rotate(e){}resize(){}serializeDeleted(){var e;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((e=this._initialData)==null?void 0:e.popupRef)||""}}serialize(e=!1,t=null){var s;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:((s=this._initialData)==null?void 0:s.popupRef)||""}}static async deserialize(e,t,s){const i=new this.prototype.constructor({parent:t,id:s.getId(),uiManager:s,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});i.rotation=e.rotation,g(i,Na,e.accessibilityData),i._isCopy=e.isCopy||!1;const[n,a]=i.pageDimensions,[o,l,h,c]=i.getRectInCurrentCoords(e.rect,a);return i.x=o/n,i.y=l/a,i.width=h/n,i.height=c/a,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e,t,s;if((e=r(this,Mr))==null||e.abort(),g(this,Mr,null),this.isEmpty()||this.commit(),(t=r(this,Rr))==null||t.destroy(),g(this,Rr,null),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),r(this,Gi)&&(clearTimeout(r(this,Gi)),g(this,Gi,null)),b(this,Z,nc).call(this),this.removeEditToolbar(),r(this,Qs)){for(const i of r(this,Qs).values())clearTimeout(i);g(this,Qs,null)}this.parent=null,(s=r(this,Js))==null||s.remove(),g(this,Js,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(b(this,Z,ry).call(this),r(this,Re).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[e,t]}=this,[s,i,n,a]=this.getPDFRect();return[et._round(s+(n-s)*e),et._round(i+(a-i)*(1-t))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return r(this,Et).commentPopupPositionInLayer}set commentPopupPosition(e){r(this,Et).commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return r(this,Et).hasDefaultPopupPosition()}get commentButtonWidth(){return r(this,Et).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){var t;(t=r(this,Et))==null||t.setCommentButtonStates(e)}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),g(this,xn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const t=r(this,Re).children;if(!r(this,di)){g(this,di,Array.from(t));const a=b(this,Z,dy).bind(this),o=b(this,Z,uy).bind(this),l=this._uiManager._signal;for(const h of r(this,di)){const c=h.getAttribute("data-resizer-name");h.setAttribute("role","spinbutton"),h.addEventListener("keydown",a,{signal:l}),h.addEventListener("blur",o,{signal:l}),h.addEventListener("focus",b(this,Z,fy).bind(this,c),{signal:l}),h.setAttribute("data-l10n-id",et._l10nResizer[c])}}const s=r(this,di)[0];let i=0;for(const a of t){if(a===s)break;i++}const n=(360-this.rotation+this.parentRotation)%360/90*(r(this,di).length/4);if(n!==i){if(n<i)for(let o=0;o<i-n;o++)r(this,Re).append(r(this,Re).firstElementChild);else if(n>i)for(let o=0;o<n-i;o++)r(this,Re).firstElementChild.before(r(this,Re).lastElementChild);let a=0;for(const o of t){const h=r(this,di)[a++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",et._l10nResizer[h])}}b(this,Z,sg).call(this,0),g(this,Tn,!0),r(this,Re).firstElementChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,t){r(this,Tn)&&b(this,Z,Zp).call(this,r(this,ed),{deltaX:e,deltaY:t,fromKeyboard:!0})}_stopResizingWithKeyboard(){b(this,Z,nc).call(this),this.div.focus()}select(){var e,t,s;if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var i,n;(i=this.div)!=null&&i.classList.contains("selectedEditor")&&((n=this._editToolbar)==null||n.show())});return}(t=this._editToolbar)==null||t.show(),(s=r(this,$t))==null||s.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>{var e;return(e=this.div)==null?void 0:e.focus({preventScroll:!0})},0)}unselect(){var e,t,s,i,n;this.isSelected&&(this.isSelected=!1,(e=r(this,Re))==null||e.classList.add("hidden"),(t=this.div)==null||t.classList.remove("selectedEditor"),(s=this.div)!=null&&s.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(i=this._editToolbar)==null||i.hide(),(n=r(this,$t))==null||n.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){e.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return r(this,sd)}set isEditing(e){g(this,sd,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):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,t=!1){if(t){r(this,Qs)||g(this,Qs,new Map);const{action:s}=e;let i=r(this,Qs).get(s);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(e),r(this,Qs).delete(s),r(this,Qs).size===0&&g(this,Qs,null)},et._telemetryTimeout),r(this,Qs).set(s,i);return}e.type||(e.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),g(this,Ll,!1)}disable(){this.div&&(this.div.tabIndex=-1),g(this,Ll,!0)}updateFakeAnnotationElement(e){if(!r(this,Js)&&!this.deleted){g(this,Js,e.addFakeAnnotation(this));return}if(this.deleted){r(this,Js).remove(),g(this,Js,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&r(this,Js).updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let t=e.container.querySelector(".annotationContent");
4if(!t)t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.container.prepend(t);else if(t.nodeName==="CANVAS"){const s=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),s.before(t)}return t}resetAnnotationElement(e){const{firstElementChild:t}=e.container;(t==null?void 0:t.nodeName)==="DIV"&&t.classList.contains("annotationContent")&&t.remove()}};Na=new WeakMap,di=new WeakMap,$t=new WeakMap,Et=new WeakMap,En=new WeakMap,Ll=new WeakMap,Or=new WeakMap,td=new WeakMap,Re=new WeakMap,Ba=new WeakMap,xn=new WeakMap,Js=new WeakMap,Mr=new WeakMap,ed=new WeakMap,Ua=new WeakMap,ws=new WeakMap,sd=new WeakMap,Ha=new WeakMap,Tn=new WeakMap,Gi=new WeakMap,Nl=new WeakMap,Bl=new WeakMap,Qs=new WeakMap,Rr=new WeakMap,id=new WeakMap,kf=new WeakMap,Z=new WeakSet,Kp=function([e,t],s,i){[s,i]=this.screenToPageTranslation(s,i),this.x+=s/e,this.y+=i/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},nd=new WeakSet,Jp=function(e,t,s){switch(s){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}},Uu=function(e){switch(e){case 90:{const[t,s]=this.pageDimensions;return[0,-t/s,s/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,s]=this.pageDimensions;return[0,t/s,-s/t,0]}default:return[1,0,0,1]}},ry=function(){if(r(this,Re))return;g(this,Re,document.createElement("div")),r(this,Re).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 s of e){const i=document.createElement("div");r(this,Re).append(i),i.classList.add("resizer",s),i.setAttribute("data-resizer-name",s),i.addEventListener("pointerdown",b(this,Z,ay).bind(this,s),{signal:t}),i.addEventListener("contextmenu",Ti,{signal:t}),i.tabIndex=-1}this.div.prepend(r(this,Re))},ay=function(e,t){var c;t.preventDefault();const{isMac:s}=Mt.platform;if(t.button!==0||t.ctrlKey&&s)return;(c=r(this,$t))==null||c.toggle(!1);const i=this._isDraggable;this._isDraggable=!1,g(this,Ba,[t.screenX,t.screenY]);const n=new AbortController,a=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",b(this,Z,Zp).bind(this,e),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",me,{passive:!1,signal:a}),window.addEventListener("contextmenu",Ti,{signal:a}),g(this,xn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const h=()=>{var u;n.abort(),this.parent.togglePointerEvents(!0),(u=r(this,$t))==null||u.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=o,this.div.style.cursor=l,b(this,Z,Hu).call(this)};window.addEventListener("pointerup",h,{signal:a}),window.addEventListener("blur",h,{signal:a})},Qp=function(e,t,s,i){this.width=s,this.height=i,this.x=e,this.y=t,this.setDims(),this.fixAndSetPosition(),this._onResized()},Hu=function(){if(!r(this,xn))return;const{savedX:e,savedY:t,savedWidth:s,savedHeight:i}=r(this,xn);g(this,xn,null);const n=this.x,a=this.y,o=this.width,l=this.height;n===e&&a===t&&o===s&&l===i||this.addCommands({cmd:b(this,Z,Qp).bind(this,n,a,o,l),undo:b(this,Z,Qp).bind(this,e,t,s,i),mustExec:!0})},Zp=function(e,t){const[s,i]=this.parentDimensions,n=this.x,a=this.y,o=this.width,l=this.height,h=et.MIN_SIZE/s,c=et.MIN_SIZE/i,u=b(this,Z,Uu).call(this,this.rotation),f=(k,N)=>[u[0]*k+u[2]*N,u[1]*k+u[3]*N],p=b(this,Z,Uu).call(this,360-this.rotation),m=(k,N)=>[p[0]*k+p[2]*N,p[1]*k+p[3]*N];let v,A,w=!1,S=!1;switch(e){case"topLeft":w=!0,v=(k,N)=>[0,0],A=(k,N)=>[k,N];break;case"topMiddle":v=(k,N)=>[k/2,0],A=(k,N)=>[k/2,N];break;case"topRight":w=!0,v=(k,N)=>[k,0],A=(k,N)=>[0,N];break;case"middleRight":S=!0,v=(k,N)=>[k,N/2],A=(k,N)=>[0,N/2];break;case"bottomRight":w=!0,v=(k,N)=>[k,N],A=(k,N)=>[0,0];break;case"bottomMiddle":v=(k,N)=>[k/2,N],A=(k,N)=>[k/2,0];break;case"bottomLeft":w=!0,v=(k,N)=>[0,N],A=(k,N)=>[k,0];break;case"middleLeft":S=!0,v=(k,N)=>[0,N/2],A=(k,N)=>[k,N/2];break}const x=v(o,l),T=A(o,l);let E=f(...T);const C=et._round(n+E[0]),P=et._round(a+E[1]);let O=1,I=1,D,M;if(t.fromKeyboard)({deltaX:D,deltaY:M}=t);else{const{screenX:k,screenY:N}=t,[X,z]=r(this,Ba);[D,M]=this.screenToPageTranslation(k-X,N-z),r(this,Ba)[0]=k,r(this,Ba)[1]=N}if([D,M]=m(D/s,M/i),w){const k=Math.hypot(o,l);O=I=Math.max(Math.min(Math.hypot(T[0]-x[0]-D,T[1]-x[1]-M)/k,1/o,1/l),h/o,c/l)}else S?O=_t(Math.abs(T[0]-x[0]-D),h,1)/o:I=_t(Math.abs(T[1]-x[1]-M),c,1)/l;const U=et._round(o*O),L=et._round(l*I);E=f(...A(U,L));const B=C-E[0],W=P-E[1];r(this,ws)||g(this,ws,[this.x,this.y,this.width,this.height]),this.width=U,this.height=L,this.x=B,this.y=W,this.setDims(),this.fixAndSetPosition(),this._onResizing()},oy=function(){var e;g(this,xn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(e=r(this,$t))==null||e.toggle(!1),this.parent.togglePointerEvents(!1)},ly=function(e,t,s){let n=.7*(s/t)+1-.7;
4if(n===1)return;const a=b(this,Z,Uu).call(this,this.rotation),o=(C,P)=>[a[0]*C+a[2]*P,a[1]*C+a[3]*P],[l,h]=this.parentDimensions,c=this.x,u=this.y,f=this.width,p=this.height,m=et.MIN_SIZE/l,v=et.MIN_SIZE/h;n=Math.max(Math.min(n,1/f,1/p),m/f,v/p);const A=et._round(f*n),w=et._round(p*n);if(A===f&&w===p)return;r(this,ws)||g(this,ws,[c,u,f,p]);const S=o(f/2,p/2),x=et._round(c+S[0]),T=et._round(u+S[1]),E=o(A/2,w/2);this.x=x-E[0],this.y=T-E[1],this.width=A,this.height=w,this.setDims(),this.fixAndSetPosition(),this._onResizing()},hy=function(){var e;(e=r(this,$t))==null||e.toggle(!0),this.parent.togglePointerEvents(!0),b(this,Z,Hu).call(this)},qp=function(e){const{isMac:t}=Mt.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)},cy=function(e){const{isSelected:t}=this;this._uiManager.setUpDragSession();let s=!1;const i=new AbortController,n=this._uiManager.combinedSignal(i),a={capture:!0,passive:!1,signal:n},o=h=>{i.abort(),g(this,Or,null),g(this,Ua,!1),this._uiManager.endDragSession()||b(this,Z,qp).call(this,h),s&&this._onStopDragging()};t&&(g(this,Nl,e.clientX),g(this,Bl,e.clientY),g(this,Or,e.pointerId),g(this,td,e.pointerType),window.addEventListener("pointermove",h=>{s||(s=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:c,clientY:u,pointerId:f}=h;if(f!==r(this,Or)){me(h);return}const[p,m]=this.screenToPageTranslation(c-r(this,Nl),u-r(this,Bl));g(this,Nl,c),g(this,Bl,u),this._uiManager.dragSelectedEditors(p,m),this.div.scrollIntoView({block:"nearest"})},a),window.addEventListener("touchmove",me,a),window.addEventListener("pointerdown",h=>{h.pointerType===r(this,td)&&(r(this,Rr)||h.isPrimary)&&o(h),me(h)},a));const l=h=>{if(!r(this,Or)||r(this,Or)===h.pointerId){o(h);return}me(h)};window.addEventListener("pointerup",l,{signal:n}),window.addEventListener("blur",l,{signal:n})},tg=function(){if(r(this,Mr)||!this.div)return;g(this,Mr,new AbortController);const e=this._uiManager.combinedSignal(r(this,Mr));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})},eg=function(){r(this,Rr)||!this.div||!this.isResizable||!this._uiManager._supportsPinchToZoom||g(this,Rr,new ey({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:b(this,Z,oy).bind(this),onPinching:b(this,Z,ly).bind(this),onPinchEnd:b(this,Z,hy).bind(this),signal:this._uiManager._signal}))},dy=function(e){et._resizerKeyboardManager.exec(this,e)},uy=function(e){var t;r(this,Tn)&&((t=e.relatedTarget)==null?void 0:t.parentNode)!==r(this,Re)&&b(this,Z,nc).call(this)},fy=function(e){g(this,ed,r(this,Tn)?e:"")},sg=function(e){if(r(this,di))for(const t of r(this,di))t.tabIndex=e},nc=function(){g(this,Tn,!1),b(this,Z,sg).call(this,-1),b(this,Z,Hu).call(this)},y(et,nd),R(et,"_l10n",null),R(et,"_l10nAlert",null),R(et,"_l10nResizer",null),R(et,"_borderLineWidth",-1),R(et,"_colorManager",new Hp),R(et,"_zIndex",1),R(et,"_telemetryTimeout",1e3);let Dt=et;class DA extends Dt{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const nv=3285377520,js=4294901760,Oi=65535;class ig{constructor(e){this.h1=e?e&4294967295:nv,this.h2=e?e&4294967295:nv}update(e){let t,s;if(typeof e=="string"){t=new Uint8Array(e.length*2),s=0;for(let v=0,A=e.length;v<A;v++){const w=e.charCodeAt(v);w<=255?t[s++]=w:(t[s++]=w>>>8,t[s++]=w&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),s=t.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const i=s>>2,n=s-i*4,a=new Uint32Array(t.buffer,0,i);let o=0,l=0,h=this.h1,c=this.h2;const u=3432918353,f=461845907,p=u&Oi,m=f&Oi;for(let v=0;v<i;v++)v&1?(o=a[v],o=o*u&js|o*p&Oi,o=o<<15|o>>>17,o=o*f&js|o*m&Oi,h^=o,h=h<<13|h>>>19,h=h*5+3864292196):(l=a[v],l=l*u&js|l*p&Oi,l=l<<15|l>>>17,l=l*f&js|l*m&Oi,c^=l,c=c<<13|c>>>19,c=c*5+3864292196);switch(o=0,n){case 3:o^=t[i*4+2]<<16;case 2:o^=t[i*4+1]<<8;case 1:o^=t[i*4],o=o*u&js|o*p&Oi,o=o<<15|o>>>17,o=o*f&js|o*m&Oi,i&1?h^=o:c^=o}this.h1=h,this.h2=c}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&js|e*36045&Oi,t=t*4283543511&js|((t<<16|e>>>
416)*2950163797&js)>>>16,e^=t>>>1,e=e*444984403&js|e*60499&Oi,t=t*3301882366&js|((t<<16|e>>>16)*3120437893&js)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const Cc=Object.freeze({map:null,hash:"",transfer:void 0});var _a,ja,Cn,De,Ff,py;class Im{constructor(){y(this,Ff);y(this,_a,!1);y(this,ja,null);y(this,Cn,null);y(this,De,new Map);R(this,"onSetModified",null);R(this,"onResetModified",null);R(this,"onAnnotationEditor",null)}getValue(e,t){const s=r(this,De).get(e);return s===void 0?t:Object.assign(t,s)}getRawValue(e){return r(this,De).get(e)}remove(e){var s;const t=r(this,De).get(e);t!==void 0&&(t instanceof Dt&&r(this,Cn).delete(t.annotationElementId),r(this,De).delete(e),r(this,De).size===0&&this.resetModified(),!r(this,De).values().some(i=>i instanceof Dt)&&((s=this.onAnnotationEditor)==null||s.call(this,null)))}setValue(e,t){var n;const s=r(this,De).get(e);let i=!1;if(s!==void 0)for(const[a,o]of Object.entries(t))s[a]!==o&&(i=!0,s[a]=o);else i=!0,r(this,De).set(e,t);i&&b(this,Ff,py).call(this),t instanceof Dt&&((r(this,Cn)||g(this,Cn,new Map)).set(t.annotationElementId,t),(n=this.onAnnotationEditor)==null||n.call(this,t.constructor._type))}has(e){return r(this,De).has(e)}get size(){return r(this,De).size}resetModified(){var e;r(this,_a)&&(g(this,_a,!1),(e=this.onResetModified)==null||e.call(this))}get print(){return new gy(this)}get serializable(){if(r(this,De).size===0)return Cc;const e=new Map,t=new ig,s=[],i=Object.create(null);let n=!1;for(const[a,o]of r(this,De)){const l=o instanceof Dt?o.serialize(!1,i):o;o.page&&(o.pageIndex=o.page._pageIndex,delete o.page),l&&(e.set(a,l),t.update(`${a}:${JSON.stringify(l)}`),n||(n=!!l.bitmap))}if(n)for(const a of e.values())a.bitmap&&s.push(a.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:s}:Cc}get editorStats(){let e=null;const t=new Map;let s=0,i=0;for(const n of r(this,De).values()){if(!(n instanceof Dt)){n.popup&&(n.popup.deleted?i+=1:s+=1);continue}n.isCommentDeleted?i+=1:n.hasEditedComment&&(s+=1);const a=n.telemetryFinalData;if(!a)continue;const{type:o}=a;t.getOrInsertComputed(o,()=>Object.getPrototypeOf(n).constructor),e||(e=Object.create(null));const l=e[o]||(e[o]=new Map);for(const[h,c]of Object.entries(a)){if(h==="type")continue;const u=l.getOrInsertComputed(h,Em);u.set(c,(u.get(c)??0)+1)}}if((i>0||s>0)&&(e||(e=Object.create(null)),e.comments={deleted:i,edited:s}),!e)return null;for(const[n,a]of t)e[n]=a.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){g(this,ja,null)}updateEditor(e,t){var i;const s=(i=r(this,Cn))==null?void 0:i.get(e);return s?(s.updateFromAnnotationLayer(t),!0):!1}getEditor(e){var t;return((t=r(this,Cn))==null?void 0:t.get(e))||null}get modifiedIds(){if(r(this,ja))return r(this,ja);const e=[];if(r(this,Cn))for(const s of r(this,Cn).values())s.serialize()&&e.push(s.annotationElementId);let t="";if(e.length){const s=new ig;s.update(e.join(",")),t=s.hexdigest()}return g(this,ja,{ids:new Set(e),hash:t})}[Symbol.iterator](){return r(this,De).entries()}}_a=new WeakMap,ja=new WeakMap,Cn=new WeakMap,De=new WeakMap,Ff=new WeakSet,py=function(){var e;r(this,_a)||(g(this,_a,!0),(e=this.onSetModified)==null||e.call(this))};var rd;class gy extends Im{constructor(t){super();y(this,rd,Cc);const{serializable:s}=t;if(s===Cc)return;const{map:i,hash:n,transfer:a}=s,o=structuredClone(i,a?{transfer:a}:null);g(this,rd,{map:o,hash:n,transfer:[]})}get print(){gt("Should not call PrintAnnotationStorage.print")}get serializable(){return r(this,rd)}get modifiedIds(){return Q(this,"modifiedIds",{ids:new Set,hash:""})}}rd=new WeakMap;ot(7588);const al="__forcedDependency",{floor:rv,ceil:av}=Math;function ov(d,e,t,s,i,n){d[e*4+0]=Math.min(d[e*4+0],t),d[e*4+1]=Math.min(d[e*4+1],s),d[e*4+2]=Math.max(d[e*4+2],i),d[e*4+3]=Math.max(d[e*4+3],n)}function kA(d,e,t,s,i){let n;d?(d<0&&(n=i[0],i[0]=i[2],i[2]=n),i[0]*=d,i[2]*=d,e<0&&(n=i[1],i[1]=i[3],i[3]=n),i[1]*=e,i[3]*=e):i.fill(0),i[0]+=t,i[1]+=s,i[2]+=t,i[3]+=s}const ng=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];var Ul,Dr;class FA{constructor(e,t){y(this,Ul);y(this,Dr);g(this,Ul,e),g(this,Dr,t)}get length(){return r(this,Ul).length}isEmpty(e){return r(this,Ul)[e]===ng}minX(e){return r(this,Dr)[e*4+0]/256}minY(e){return r(this,Dr)[e*4+1]/256}maxX(e){return(r(this,Dr)[e*4+2]+1)/256}maxY(e){return(r(this,Dr)[e*4+3]+1)/256}}Ul=new WeakMap,Dr=new WeakMap;const lv=(d,e)=>d==null?void 0:d.getOrInsertComputed(e,()=>({dependencies:new Set,isRenderingOperation:!1}));var Pn,wt,Ht,$a,Ga,Va,ze,ad,rg;class LA{constructor(e,t){y(this,ad);y(this,Pn,[[1,0,0,1,0,0]]);y(this,wt,[-1/0,-1/0,1/0,1/0]);y(this,Ht,new Float64Array(Zn));R(this,"_pendingBBoxIdx",-1);y(this,$a);y(this,Ga);y(this,Va);y(this,ze);R(this,"_savesStack",[]);R(this,"_markedContentStack",[]);g(this,$a,e.width),g(this,Ga,e.height),b(this,ad,rg).call(this,t)}growOperationsCount(e){e>=r(this,ze).length&&b(this,ad,rg).call(this,e,r(this,ze))}get clipBox(){return r(this,wt)}save(e){return g(this,wt,{__proto__:r(this,wt)}),this._savesStack.push(e),this}restore(e,t){const s=Object.getPrototypeOf(r(this,wt));if(s===null)return this;g(this,wt,s);const i=this._savesStack.pop();return i!==void 0&&(t==null||t(i,e),r(this,ze)[e]=r(this,ze)[i]),this}recordOpenMarker(e){return this._savesStack.push(e),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(e,t){const s=this._savesStack.pop();return s!==void 0&&(t==null||t(s,e),r(this,ze)[e]=r(this,ze)[s]),this}beginMarkedContent(e){return this._markedContentStack.push(e),this}endMarkedContent(e,t){const s=this._markedContentStack.pop();return s!==void 0&&(t==null||t(s,e),r(this,ze)[e]=r(this,ze)[s]),this}pushBaseTransform(e){return r(this,Pn).push(_.multiplyByDOMMatrix(r(this,Pn).at(-1),e.getTransform())),this}popBaseTransform(){return r(this,Pn).length>1&&r(this,Pn).pop(),this}
4resetBBox(e){return this._pendingBBoxIdx!==e&&(this._pendingBBoxIdx=e,r(this,Ht).set(Zn,0)),this}recordClipBox(e,t,s,i,n,a){const o=_.multiplyByDOMMatrix(r(this,Pn).at(-1),t.getTransform()),l=Zn.slice();_.axialAlignedBoundingBox([s,n,i,a],o,l);const h=_.intersect(r(this,wt),l);return h?(r(this,wt)[0]=h[0],r(this,wt)[1]=h[1],r(this,wt)[2]=h[2],r(this,wt)[3]=h[3]):(r(this,wt)[0]=r(this,wt)[1]=1/0,r(this,wt)[2]=r(this,wt)[3]=-1/0),this}recordBBox(e,t,s,i,n,a){const o=r(this,wt);if(o[0]===1/0)return this;const l=_.multiplyByDOMMatrix(r(this,Pn).at(-1),t.getTransform());if(o[0]===-1/0)return _.axialAlignedBoundingBox([s,n,i,a],l,r(this,Ht)),this;const h=Zn.slice();return _.axialAlignedBoundingBox([s,n,i,a],l,h),r(this,Ht)[0]=_t(h[0],o[0],r(this,Ht)[0]),r(this,Ht)[1]=_t(h[1],o[1],r(this,Ht)[1]),r(this,Ht)[2]=_t(h[2],r(this,Ht)[2],o[2]),r(this,Ht)[3]=_t(h[3],r(this,Ht)[3],o[3]),this}recordFullPageBBox(e){return r(this,Ht)[0]=Math.max(0,r(this,wt)[0]),r(this,Ht)[1]=Math.max(0,r(this,wt)[1]),r(this,Ht)[2]=Math.min(r(this,$a),r(this,wt)[2]),r(this,Ht)[3]=Math.min(r(this,Ga),r(this,wt)[3]),this}recordOperation(e,t=!1,s){if(this._pendingBBoxIdx!==e)return this;const i=rv(r(this,Ht)[0]*256/r(this,$a)),n=rv(r(this,Ht)[1]*256/r(this,Ga)),a=av(r(this,Ht)[2]*256/r(this,$a)),o=av(r(this,Ht)[3]*256/r(this,Ga));if(ov(r(this,Va),e,i,n,a,o),s)for(const l of s)for(const h of l)h!==e&&ov(r(this,Va),h,i,n,a,o);return t||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(e){return this._pendingBBoxIdx===e&&(this._pendingBBoxIdx=-1,r(this,wt)[0]=Math.max(r(this,wt)[0],r(this,Ht)[0]),r(this,wt)[1]=Math.max(r(this,wt)[1],r(this,Ht)[1]),r(this,wt)[2]=Math.min(r(this,wt)[2],r(this,Ht)[2]),r(this,wt)[3]=Math.min(r(this,wt)[3],r(this,Ht)[3])),this}take(){return new FA(r(this,ze),r(this,Va))}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,s){return this}recordFutureForcedDependency(e,t){return this}inheritSimpleDataAsFutureForcedDependencies(e){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(e,t,s,i=1,n=0,a=0,o){return this}getSimpleIndex(e){}recordDependencies(e,t){return this}recordNamedDependency(e,t){return this}recordShowTextOperation(e,t=!1){return this}}Pn=new WeakMap,wt=new WeakMap,Ht=new WeakMap,$a=new WeakMap,Ga=new WeakMap,Va=new WeakMap,ze=new WeakMap,ad=new WeakSet,rg=function(e,t){const s=new ArrayBuffer(e*4);g(this,Va,new Uint8ClampedArray(s)),g(this,ze,new Uint32Array(s)),t&&t.length>0?(r(this,ze).set(t),r(this,ze).fill(ng,t.length)):r(this,ze).fill(ng)};var us,fs,za,ui,Hl,kr,Fr,Pt;class NA{constructor(e,t=!1){y(this,us,{__proto__:null});y(this,fs,{__proto__:null,transform:[],moveText:[],sameLineText:[],[al]:[]});y(this,za,new Map);y(this,ui,new Set);y(this,Hl,new Map);y(this,kr);y(this,Fr);y(this,Pt);g(this,Pt,e),t&&(g(this,kr,new Map),g(this,Fr,(s,i)=>{lv(r(this,kr),i).dependencies.add(s)}))}get clipBox(){return r(this,Pt).clipBox}growOperationsCount(e){r(this,Pt).growOperationsCount(e)}save(e){return g(this,us,{__proto__:r(this,us)}),g(this,fs,{__proto__:r(this,fs),transform:{__proto__:r(this,fs).transform},moveText:{__proto__:r(this,fs).moveText},sameLineText:{__proto__:r(this,fs).sameLineText},[al]:{__proto__:r(this,fs)[al]}}),r(this,Pt).save(e),this}restore(e){r(this,Pt).restore(e,r(this,Fr));const t=Object.getPrototypeOf(r(this,us));return t===null?this:(g(this,us,t),g(this,fs,Object.getPrototypeOf(r(this,fs))),this)}recordOpenMarker(e){return r(this,Pt).recordOpenMarker(e,r(this,Fr)),this}getOpenMarker(){return r(this,Pt).getOpenMarker()}recordCloseMarker(e){return r(this,Pt).recordCloseMarker(e,r(this,Fr)),this}beginMarkedContent(e){return r(this,Pt).beginMarkedContent(e),this}endMarkedContent(e){return r(this,Pt).endMarkedContent(e,r(this,Fr)),this}pushBaseTransform(e){return r(this,Pt).pushBaseTransform(e),this}popBaseTransform(){return r(this,Pt).popBaseTransform(),this}recordSimpleData(e,t){return r(this,us)[e]=t,this}recordIncrementalData(e,t){return r(this,fs)[e].push(t),this}resetIncrementalData(e,t){return r(this,fs)[e].length=0,this}recordNamedData(e,t){return r(this,za).set(e,t),this}recordSimpleDataFromNamed(e,t,s){r(this,us)[e]=r(this,za).get(t)??s}recordFutureForcedDependency(e,t){return this.recordIncrementalData(al,t),this}inheritSimpleDataAsFutureForcedDependencies(e){for(const t of e)t in r(this,us)&&this.recordFutureForcedDependency(t,r(this,us)[t]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const e of r(this,ui))this.recordFutureForcedDependency(al,e);return this}resetBBox(e){return r(this,Pt).resetBBox(e),this}recordClipBox(e,t,s,i,n,a){return r(this,Pt).recordClipBox(e,t,s,i,n,a),this}recordBBox(e,t,s,i,n,a){return r(this,Pt).recordBBox(e,t,s,i,n,a),this}recordCharacterBBox(e,t,s,i=1,n=0,a=0,o){const l=s.bbox;let h,c;if(l&&(h=l[2]!==l[0]&&l[3]!==l[1]&&r(this,Hl).get(s),h!==!1&&(c=[0,0,0,0],_.axialAlignedBoundingBox(l,s.fontMatrix,c),(i!==1||n!==0||a!==0)&&kA(i,-i,n,a,c),h)))return this.recordBBox(e,t,c[0],c[2],c[1],c[3]);if(!o)return this.recordFullPageBBox(e);const u=o();return l&&c&&h===void 0&&(h=c[0]<=n-u.actualBoundingBoxLeft&&c[2]>=n+u.actualBoundingBoxRight&&c[1]<=a-u.actualBoundingBoxAscent&&c[3]>=a+u.actualBoundingBoxDescent,r(this,Hl).set(s,h),h)?this.recordBBox(e,t,c[0],c[2],c[1],c[3]):this.recordBBox(e,t,n-u.actualBoundingBoxLeft,n+u.actualBoundingBoxRight,a-u.actualBoundingBoxAscent,a+u.actualBoundingBoxDescent)}recordFullPageBBox(e){return r(this,Pt).recordFullPageBBox(e),this}getSimpleIndex(e){return r(this,us)[e]}recordDependencies(e,t){const s=r(this,ui),i=r(this,us),n=r(this,fs);for(const a of t)a in r(this,us)?s.add(i[a]):a in n&&n[a].forEac
4h(s.add,s);return this}recordNamedDependency(e,t){return r(this,za).has(t)&&r(this,ui).add(r(this,za).get(t)),this}recordOperation(e,t=!1){if(this.recordDependencies(e,[al]),r(this,kr)){const i=lv(r(this,kr),e),{dependencies:n}=i;r(this,ui).forEach(n.add,n),r(this,Pt)._savesStack.forEach(n.add,n),r(this,Pt)._markedContentStack.forEach(n.add,n),n.delete(e),i.isRenderingOperation=!0}const s=!t&&e===r(this,Pt)._pendingBBoxIdx;return r(this,Pt).recordOperation(e,t,[r(this,ui),r(this,Pt)._savesStack,r(this,Pt)._markedContentStack]),s&&r(this,ui).clear(),this}recordShowTextOperation(e,t=!1){const s=Array.from(r(this,ui));this.recordOperation(e,t),this.recordIncrementalData("sameLineText",e);for(const i of s)this.recordIncrementalData("sameLineText",i);return this}bboxToClipBoxDropOperation(e,t=!1){const s=!t&&e===r(this,Pt)._pendingBBoxIdx;return r(this,Pt).bboxToClipBoxDropOperation(e),s&&r(this,ui).clear(),this}take(){return r(this,Hl).clear(),r(this,Pt).take()}takeDebugMetadata(){return r(this,kr)}}us=new WeakMap,fs=new WeakMap,za=new WeakMap,ui=new WeakMap,Hl=new WeakMap,kr=new WeakMap,Fr=new WeakMap,Pt=new WeakMap;var It,ee,fi,_l,jl;const Um=class Um{constructor(e,t,s){y(this,It);y(this,ee);y(this,fi);y(this,_l,0);y(this,jl,0);
4if(e instanceof Um&&r(e,fi)===!!s)return e;g(this,It,e),g(this,ee,t),g(this,fi,!!s)}get clipBox(){return r(this,It).clipBox}growOperationsCount(){throw new Error("Unreachable")}save(e){return Xt(this,jl)._++,r(this,It).save(r(this,ee)),this}restore(e){return r(this,jl)>0&&(r(this,It).restore(r(this,ee)),Xt(this,jl)._--),this}recordOpenMarker(e){return Xt(this,_l)._++,this}getOpenMarker(){return r(this,_l)>0?r(this,ee):r(this,It).getOpenMarker()}recordCloseMarker(e){return Xt(this,_l)._--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return r(this,It).pushBaseTransform(e),this}popBaseTransform(){return r(this,It).popBaseTransform(),this}recordSimpleData(e,t){return r(this,It).recordSimpleData(e,r(this,ee)),this}recordIncrementalData(e,t){return r(this,It).recordIncrementalData(e,r(this,ee)),this}resetIncrementalData(e,t){return r(this,It).resetIncrementalData(e,r(this,ee)),this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,s){return r(this,It).recordSimpleDataFromNamed(e,t,r(this,ee)),this}recordFutureForcedDependency(e,t){return r(this,It).recordFutureForcedDependency(e,r(this,ee)),this}inheritSimpleDataAsFutureForcedDependencies(e){return r(this,It).inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return r(this,It).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return r(this,fi)||r(this,It).resetBBox(r(this,ee)),this}recordClipBox(e,t,s,i,n,a){return r(this,fi)||r(this,It).recordClipBox(r(this,ee),t,s,i,n,a),this}recordBBox(e,t,s,i,n,a){return r(this,fi)||r(this,It).recordBBox(r(this,ee),t,s,i,n,a),this}recordCharacterBBox(e,t,s,i,n,a,o){return r(this,fi)||r(this,It).recordCharacterBBox(r(this,ee),t,s,i,n,a,o),this}recordFullPageBBox(e){return r(this,fi)||r(this,It).recordFullPageBBox(r(this,ee)),this}getSimpleIndex(e){return r(this,It).getSimpleIndex(e)}recordDependencies(e,t){return r(this,It).recordDependencies(r(this,ee),t),this}recordNamedDependency(e,t){return r(this,It).recordNamedDependency(r(this,ee),t),this}recordOperation(e){return r(this,It).recordOperation(r(this,ee),!0),this}recordShowTextOperation(e){return r(this,It).recordShowTextOperation(r(this,ee),!0),this}bboxToClipBoxDropOperation(e){return r(this,fi)||r(this,It).bboxToClipBoxDropOperation(r(this,ee),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};It=new WeakMap,ee=new WeakMap,fi=new WeakMap,_l=new WeakMap,jl=new WeakMap;let Pc=Um;const $s={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["filter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","fillColor"]};var Wa,Xa,Ya,Ka,Ja,od;const Ec=class Ec{constructor(e){y(this,Wa);y(this,Xa);y(this,Ya,4);y(this,Ka,0);y(this,Ja,new(r(Ec,od))(r(this,Ya)*6));g(this,Wa,e.width),g(this,Xa,e.height)}record(e,t,s,i){if(r(this,Ka)===r(this,Ya)){g(this,Ya,r(this,Ya)*2);const o=new(r(Ec,od))(r(this,Ya)*6);o.set(r(this,Ja)),g(this,Ja,o)}const n=Bt(e);let a;if(i[0]!==1/0){const o=Zn.slice();_.axialAlignedBoundingBox([0,-s,t,0],n,o);const l=_.intersect(i,o);if(!l)return;const[h,c,u,f]=l;if(h!==o[0]||c!==o[1]||u!==o[2]||f!==o[3]){const p=Math.atan2(n[1],n[0]),m=Math.abs(Math.sin(p)),v=Math.abs(Math.cos(p));if(m<1e-6||v<1e-6||Math.abs(m-v)<1e-6)a=[h,c,h,f,u,c];else{const A=u-h,w=f-c,S=m*m,x=v*v,T=v*m,E=x-S,C=(w*x-A*T)/E,P=(w*T-A*S)/E;a=[h+P,c,h,c+C,u,f-C]}}}a||(a=[0,-s,0,0,t,-s],_.applyTransform(a,n,0),_.applyTransform(a,n,2),_.applyTransform(a,n,4)),a[0]/=r(this,Wa),a[1]/=r(this,Xa),a[2]/=r(this,Wa),a[3]/=r(this,Xa),a[4]/=r(this,Wa),a[5]/=r(this,Xa),r(this,Ja).set(a,r(this,Ka)*6),Xt(this,Ka)._++}take(){return r(this,Ja).subarray(0,r(this,Ka)*6)}};Wa=new WeakMap,Xa=new WeakMap,Ya=new WeakMap,Ka=new WeakMap,Ja=new WeakMap,od=new WeakMap,y(Ec,od,Mt.isFloat16ArraySupported?Float16Array:Float32Array);let ag=Ec;const hv=new RegExp("\\p{Cc}","u");function BA(d){const e=d[0];if(d.length<2||e!=='"'&&e!=="'"||d.at(-1)!==e)return!1;const t=d.length-1;for(let s=1;s<t;s++){const i=d[s];if(i===e||hv.test(i)||i==="\\"&&(++s>=t||hv.test(d[s])))return!1}return!0}function cv(d){return BA(d)?d:`"${d.replaceAll(/["\\\p{Cc}]/gu,t=>t==='"'||t==="\\"?`\\${t}`:`\\${t.codePointAt(0).toString(16)} `)}"`}var $l,pi,Lf,my;class UA{constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){y(this,Lf);y(this,$l,new Set);y(this,pi,null);this._document=e,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){const t=b(this,Lf,my).call(this);t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);
4if(this.nativeFontFaces.clear(),r(this,$l).clear(),r(this,pi)){const{adoptedStyleSheets:e}=this._document;e!=null&&e.includes(r(this,pi))&&(this._document.adoptedStyleSheets=e.filter(t=>t!==r(this,pi))),g(this,pi,null)}this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:s}){if(!(!e||r(this,$l).has(e.loadedName))){if(qt(!t,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:i,src:n,style:a}=e,o=new FontFace(i,n,a);this.addNativeFontFace(o);try{await o.load(),r(this,$l).add(i),s==null||s(e)}catch{st(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}gt("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){const s=e.createNativeFontFace();if(s){this.addNativeFontFace(s);try{await s.loaded}catch(i){throw st(`Failed to load font '${s.family}': '${i}'.`),e.disableFontFace=!0,i}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(s=>{const i=this._queueLoadingCallback(s);this._prepareFontLoadEvent(e,i)})}}get isFontLoadingAPISupported(){var t;const e=!!((t=this._document)!=null&&t.fonts);return Q(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return Q(this,"isSyncFontLoadingSupported",Ls||Mt.platform.isFirefox)}_queueLoadingCallback(e){function t(){for(qt(!i.done,"completeRequest() cannot be called twice."),i.done=!0;s.length>0&&s[0].done;){const n=s.shift();setTimeout(n.callback,0)}}const{loadingRequests:s}=this,i={done:!1,complete:t,callback:e};return s.push(i),i}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Q(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,t){function s(E,C){return E.charCodeAt(C)<<24|E.charCodeAt(C+1)<<16|E.charCo
4deAt(C+2)<<8|E.charCodeAt(C+3)&255}function i(E){return String.fromCharCode(E>>24&255,E>>16&255,E>>8&255,E&255)}function n(E,C,P,O){const I=E.substring(0,C),D=E.substring(C+P);return I+O+D}let a,o;const l=this._document.createElement("canvas");l.width=1,l.height=1;const h=l.getContext("2d");let c=0;function u(E,C){if(++c>30){st("Load test font never loaded."),C();return}if(h.font="30px "+E,h.fillText(".",0,20),h.getImageData(0,0,1,1).data[3]>0){C();return}setTimeout(u.bind(null,E,C))}const f=`lt${Date.now()}${this.loadTestFontId++}`;let p=this._loadTestFont;p=n(p,976,f.length,f);const v=16,A=1482184792;let w=s(p,v);for(a=0,o=f.length-3;a<o;a+=4)w=w-A+s(f,a)|0;a<f.length&&(w=w-A+s(f+"XXX",a)|0),p=n(p,v,4,i(w));const S=`url(data:font/opentype;base64,${btoa(p)});`,x=`@font-face {font-family:"${f}";src:${S}}`;this.insertRule(x);const T=this._document.createElement("div");T.style.visibility="hidden",T.style.width=T.style.height="10px",T.style.position="absolute",T.style.top=T.style.left="0px";for(const E of[e.loadedName,f]){const C=this._document.createElement("span");C.textContent="Hi",C.style.fontFamily=E,T.append(C)}this._document.body.append(T),u(f,()=>{T.remove(),t.complete()})}}$l=new WeakMap,pi=new WeakMap,Lf=new WeakSet,my=function(){var t;if(r(this,pi))return r(this,pi);const e=((t=this._document.defaultView)==null?void 0:t.CSSStyleSheet)||globalThis.CSSStyleSheet;if(!this.styleElement&&e){const{adoptedStyleSheets:s}=this._document;if(s){const i=new e;return s.push(i),g(this,pi,i)}}return this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement)),g(this,pi,this.styleElement.sheet)};var Ot;class HA{constructor(e,t=null,s,i){R(this,"compiledGlyphs",Object.create(null));y(this,Ot);g(this,Ot,e),this._inspectFont=t,s&&(this.charProcOperatorList=s),i&&Object.assign(this,i)}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const s={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(s.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(cv(this.cssFontInfo.fontFamily),this.data,s)}return(t=this._inspectFont)==null||t.call(this,this),e}createFontFaceRule(){var s;if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${this.data.toBase64()});`;let t;if(!this.cssFontInfo)t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:${cv(this.cssFontInfo.fontFamily)};${i}src:${e}}`}return(s=this._inspectFont)==null||s.call(this,this,e),t}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];const s=this.loadedName+"_path_"+t;let i;try{i=e.get(s)}catch(a){st(`getPathGenerator - ignoring character: "${a}".`)}const n=Fv(i==null?void 0:i.path);return this.fontExtraProperties||e.delete(s),this.compiledGlyphs[t]=n}get black(){return r(this,Ot).black}get bold(){return r(this,Ot).bold}get disableFontFace(){return r(this,Ot).disableFontFace}set disableFontFace(e){Q(this,"disableFontFace",!!e)}get fontExtraProperties(){return r(this,Ot).fontExtraProperties}get isInvalidPDFjsFont(){return r(this,Ot).isInvalidPDFjsFont}get isType3Font(){return r(this,Ot).isType3Font}get italic(){return r(this,Ot).italic}get missingFile(){return r(this,Ot).missingFile}get remeasure(){return r(this,Ot).remeasure}get vertical(){return r(this,Ot).vertical}get ascent(){return r(this,Ot).ascent}get defaultWidth(){return r(this,Ot).defaultWidth}get descent(){return r(this,Ot).descent}get bbox(){return r(this,Ot).bbox}get fontMatrix(){return r(this,Ot).fontMatrix}get fallbackName(){return r(this,Ot).fallbackName}get loadedName(){return r(this,Ot).loadedName}get mimetype(){return r(this,Ot).mimetype}get name(){return r(this,Ot).name}get data(){return r(this,Ot).data}clearData(){r(this,Ot).clearData()}get cssFontInfo(){return r(this,Ot).cssFontInfo}get systemFontInfo(){return r(this,Ot).systemFontInfo}get defaultVMetrics(){return r(this,Ot).defaultVMetrics}}Ot=new WeakMap;class vy{}R(vy,"strings",["fontFamily","fontWeight","italicAngle"]);class yy{}R(yy,"strings",["css","loadedName","baseFontName","src"]);const je=class je{};
4R(je,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),R(je,"numbers",["ascent","defaultWidth","descent"]),R(je,"strings",["fallbackName","loadedName","mimetype","name"]),R(je,"OFFSET_NUMBERS",Math.ceil(je.bools.length*2/8)),R(je,"OFFSET_BBOX",je.OFFSET_NUMBERS+je.numbers.length*8),R(je,"OFFSET_FONT_MATRIX",je.OFFSET_BBOX+1+2*4),R(je,"OFFSET_DEFAULT_VMETRICS",je.OFFSET_FONT_MATRIX+1+8*6),R(je,"OFFSET_STRINGS",je.OFFSET_DEFAULT_VMETRICS+1+2*3);let vs=je;class ns{}R(ns,"KIND",0),R(ns,"HAS_BBOX",1),R(ns,"HAS_BACKGROUND",2),R(ns,"SHADING_TYPE",3),R(ns,"N_COORD",4),R(ns,"N_COLOR",8),R(ns,"N_STOP",12),R(ns,"N_FIGURES",16);class Ef{static get decoder(){return Q(this,"decoder",new TextDecoder)}static get encoder(){return Q(this,"encoder",new TextEncoder)}}var ld,Gl,Vl,_u;class _A{constructor(e){y(this,Vl);y(this,ld);y(this,Gl);g(this,ld,e),g(this,Gl,new DataView(e))}get fontFamily(){return b(this,Vl,_u).call(this,0)}get fontWeight(){return b(this,Vl,_u).call(this,1)}get italicAngle(){return b(this,Vl,_u).call(this,2)}}ld=new WeakMap,Gl=new WeakMap,Vl=new WeakSet,_u=function(e){qt(e<vy.strings.length,"Invalid string index");const{decoder:t}=Ef;let s=0;for(let n=0;n<e;n++)s+=r(this,Gl).getUint32(s)+4;const i=r(this,Gl).getUint32(s);return t.decode(new Uint8Array(r(this,ld),s+4,i))};var Qa,Vi,Za,rc;class jA{constructor(e){y(this,Za);y(this,Qa);y(this,Vi);g(this,Qa,e),g(this,Vi,new DataView(e))}get guessFallback(){return r(this,Vi).getUint8(0)!==0}get css(){return b(this,Za,rc).call(this,0)}get loadedName(){return b(this,Za,rc).call(this,1)}get baseFontName(){return b(this,Za,rc).call(this,2)}get src(){return b(this,Za,rc).call(this,3)}get style(){const{decoder:e}=Ef;let t=1;t+=4+r(this,Vi).getUint32(t);const s=r(this,Vi).getUint32(t),i=e.decode(new Uint8Array(r(this,Qa),t+4,s));t+=4+s;const n=r(this,Vi).getUint32(t),a=e.decode(new Uint8Array(r(this,Qa),t+4,n));return{style:i,weight:a}}}Qa=new WeakMap,Vi=new WeakMap,Za=new WeakSet,rc=function(e){qt(e<yy.strings.length,"Invalid string index");const{decoder:t}=Ef;let s=5;for(let n=0;n<e;n++)s+=r(this,Vi).getUint32(s)+4;const i=r(this,Vi).getUint32(s);return t.decode(new Uint8Array(r(this,Qa),s+4,i))};var gi,re,xt,li,ju,$u,ac,og;class $A{constructor({buffer:e,extra:t}){y(this,xt);y(this,gi);y(this,re);g(this,gi,e),g(this,re,new DataView(e)),t&&Object.assign(this,t)}get black(){return b(this,xt,li).call(this,0)}get bold(){return b(this,xt,li).call(this,1)}get disableFontFace(){return b(this,xt,li).call(this,2)}get fontExtraProperties(){return b(this,xt,li).call(this,3)}get isInvalidPDFjsFont(){return b(this,xt,li).call(this,4)}get isType3Font(){return b(this,xt,li).call(this,5)}get italic(){return b(this,xt,li).call(this,6)}get missingFile(){return b(this,xt,li).call(this,7)}get remeasure(){return b(this,xt,li).call(this,8)}get vertical(){return b(this,xt,li).call(this,9)}get ascent(){return b(this,xt,ju).call(this,0)}get defaultWidth(){return b(this,xt,ju).call(this,1)}get descent(){return b(this,xt,ju).call(this,2)}get bbox(){return b(this,xt,$u).call(this,vs.OFFSET_BBOX,4,"getInt16",2)}get fontMatrix(){return b(this,xt,$u).call(this,vs.OFFSET_FONT_MATRIX,6,"getFloat64",8)}get defaultVMetrics(){return b(this,xt,$u).call(this,vs.OFFSET_DEFAULT_VMETRICS,3,"getInt16",2)}get fallbackName(){return b(this,xt,ac).call(this,0)}get loadedName(){return b(this,xt,ac).call(this,1)}get mimetype(){return b(this,xt,ac).call(this,2)}get name(){return b(this,xt,ac).call(this,3)}get data(){const{offset:e,length:t}=b(this,xt,og).call(this);return t===0?void 0:new Uint8Array(r(this,gi),e+4,t)}clearData(){const{offset:e,length:t}=b(this,xt,og).call(this);t!==0&&(r(this,re).setUint32(e,0),g(this,gi,new Uint8Array(r(this,gi),0,e+4).slice().buffer),g(this,re,new DataView(r(this,gi))))}get cssFontInfo(){let e=vs.OFFSET_STRINGS;const t=r(this,re).getUint32(e);e+=4+t;const s=r(this,re).getUint32(e);e+=4+s;const i=r(this,re).getUint32(e);if(i===0)return null;const n=new Uint8Array(i);return n.set(new Uint8Array(r(this,gi),e+4,i)),new _A(n.buffer)}get systemFontInfo(){let e=vs.OFFSET_STRINGS;const t=r(this,re).getUint32(e);e+=4+t;const s=r(this,re).getUint32(e);if(s===0)return null;const i=new Uint8Array(s);return i.set(new Uint8Array(r(this,gi),e+4,s)),new jA(i.buffer)}}gi=new WeakMap,re=new WeakMap,xt=new WeakSet,li=function(e){qt(e<vs.bools.length,"Invalid boolean index");const t=Math.floor(e/4),s=e*2%8,i=r(this,re).getUint8(t)>>s&3;return i===0?void 0:i===2},ju=function(e){return qt(e<vs.numbers.length,"Invalid number index"),r(this,re).getFloat64(vs.OFFSET_NUMBERS+e*8)},$u=function(e,t,s,i){const n=r(this,re).getUint8(e);if(n===0)return;qt(n===t,"Invalid array length."),e+=1;const a=new Array(n);for(let o=0;o<n;o++)a[o]=r(this,re)[s](e,!0),e+=i;return a},ac=function(e){qt(e<vs.strings.length,"Invalid string index");const{decoder:t}=Ef;let s=vs.OFFSET_STRINGS+4;for(let n=0;n<e;n++)s+=r(this,re).getUint32(s)+4;const i=r(this,re).getUint32(s);return t.decode(new Uint8Array(r(this,gi),s+4,i))},og=function(){let e=vs.OFFSET_STRINGS;const t=r(this,re).getUint32(e);e+=4+t;const s=r(this,re).getUint32(e);e+=4+s;const i=r(this,re).getUint32(e);e+=4+i;const n=r(this,re).getUint32(e);return{offset:e,length:n}};class GA{constructor(e){this.buffer=e,this.view=new DataView(e),this.data=new Uint8Array(e)}getIR(){const e=this.view,t=this.data[ns.KIND],s=!!this.data[ns.HAS_BBOX],i=!!this.data[ns.HAS_BACKGROUND],n=e.getUint32(ns.N_COORD,!0),a=e.getUint32(ns.N_COLOR,!0),o=e.getUint32(ns.N_STOP,!0);let l=20;const h=new Float32Array(this.buffer,l,n*2);l+=n*8;const c=new Uint8Array(this.buffer,l,a*4);l+=a*4;const u=[];for(let m=0;m<o;++m){const v=e.getFloat32(l,!0);l+=4;
4const A=e.getUint32(l,!0);l+=4,u.push([v,`#${A.toString(16).padStart(6,"0")}`])}let f=null;if(s){f=[];for(let m=0;m<4;++m)f.push(e.getFloat32(l,!0)),l+=4}let p=null;if(i&&(p=new Uint8Array(this.buffer,l,3),l+=3),t===1)return["RadialAxial","axial",f,u,Array.from(h.slice(0,2)),Array.from(h.slice(2,4)),null,null];if(t===2)return["RadialAxial","radial",f,u,[h[0],h[1]],[h[3],h[4]],h[2],h[5]];if(t===3){const m=this.data[ns.SHADING_TYPE];let v=null;if(h.length>0){v=Zn.slice();for(let A=0,w=h.length;A<w;A+=2)_.pointBoundingBox(h[A],h[A+1],v)}return["Mesh",m,h,c,n,v,f,p]}throw new Error(`Unsupported pattern kind: ${t}`)}}var zl;class VA{constructor(e){y(this,zl);g(this,zl,e)}get path(){return Mt.isFloat16ArraySupported?new Float16Array(r(this,zl)):new Float32Array(r(this,zl))}}zl=new WeakMap;function zA(d){if(d instanceof URL)return d;if(typeof d=="string"){if(Ls){if(/^[a-z][a-z0-9\-+.]+:/i.test(d))return new URL(d);const t=process.getBuiltinModule("url");return new URL(t.pathToFileURL(d))}const e=URL.parse(d,window.location);if(e)return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function WA(d){if(Ls&&typeof Buffer<"u"&&d instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(d instanceof Uint8Array&&d.byteLength===d.buffer.byteLength)return d;if(typeof d=="string")return rp(d);if(d instanceof ArrayBuffer||ArrayBuffer.isView(d)||typeof d=="object"&&!isNaN(d==null?void 0:d.length))return new Uint8Array(d);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function xu(d){if(typeof d!="string")return null;if(d.endsWith("/"))return d;throw new Error(`Invalid factory url: "${d}" must include trailing slash.`)}const lg=d=>typeof d=="object"&&Number.isInteger(d==null?void 0:d.num)&&d.num>=0&&Number.isInteger(d==null?void 0:d.gen)&&d.gen>=0,XA=d=>typeof d=="object"&&typeof(d==null?void 0:d.name)=="string",YA=vA.bind(null,lg,XA);var In,Nf;class KA{constructor(){y(this,In,new Map);y(this,Nf,Promise.resolve())}postMessage(e,t){const s={data:structuredClone(e,t?{transfer:t}:null)};r(this,Nf).then(()=>{for(const[i]of r(this,In))i.call(this,s)})}addEventListener(e,t,s=null){let i=null;if((s==null?void 0:s.signal)instanceof AbortSignal){const{signal:n}=s;if(n.aborted){st("LoopbackPort - cannot use an `aborted` signal.");return}const a=()=>this.removeEventListener(e,t);i=()=>n.removeEventListener("abort",a),n.addEventListener("abort",a)}r(this,In).set(t,i)}removeEventListener(e,t){const s=r(this,In).get(t);s==null||s(),r(this,In).delete(t)}terminate(){for(const[,e]of r(this,In))e==null||e();r(this,In).clear()}}In=new WeakMap,Nf=new WeakMap;ot(1689);const Tu={DATA:1,ERROR:2},oe={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function dv(){}function ls(d){if(d instanceof da||d instanceof Op||d instanceof Ip||d instanceof Af||d instanceof bp)return d;switch(d instanceof Error||typeof d=="object"&&d!==null||gt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),d.name){case"AbortException":return new da(d.message);case"InvalidPDFException":return new Op(d.message);case"PasswordException":return new Ip(d.message,d.code);case"ResponseException":return new Af(d.message,d.status,d.missing);case"UnknownErrorException":return new bp(d.message,d.details)}return new bp(d.message,d.toString())}var Wl,ri,by,Ay,wy,Gu;class oc{constructor(e,t,s){y(this,ri);y(this,Wl,new AbortController);this.sourceName=e,this.targetName=t,this.comObj=s,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),s.addEventListener("message",b(this,ri,by).bind(this),{signal:r(this,Wl).signal})}on(e,t){const s=this.actionHandler;if(s[e])throw new Error(`There is already an actionName called "${e}"`);s[e]=t}send(e,t,s){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},s)}
4sendWithPromise(e,t,s){const i=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[i]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:i,data:t},s)}catch(a){n.reject(a)}return n.promise}sendWithStream(e,t,s,i){const n=this.streamId++,a=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:h=>{const c=Promise.withResolvers();return this.streamControllers[n]={controller:h,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:a,targetName:o,action:e,streamId:n,data:t,desiredSize:h.desiredSize},i),c.promise},pull:h=>{const c=Promise.withResolvers();return this.streamControllers[n].pullCall=c,l.postMessage({sourceName:a,targetName:o,stream:oe.PULL,streamId:n,desiredSize:h.desiredSize}),c.promise},cancel:h=>{qt(h instanceof Error,"cancel must have a valid reason");const c=Promise.withResolvers();return this.streamControllers[n].cancelCall=c,this.streamControllers[n].isClosed=!0,l.postMessage({sourceName:a,targetName:o,stream:oe.CANCEL,streamId:n,reason:ls(h)}),c.promise}},s)}destroy(){var e;(e=r(this,Wl))==null||e.abort(),g(this,Wl,null)}}Wl=new WeakMap,ri=new WeakSet,by=function({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){b(this,ri,wy).call(this,e);return}if(e.callback){const s=e.callbackId,i=this.callbackCapabilities[s];if(!i)throw new Error(`Cannot resolve callback ${s}`);if(delete this.callbackCapabilities[s],e.callback===Tu.DATA)i.resolve(e.data);else if(e.callback===Tu.ERROR)i.reject(ls(e.reason));else throw new Error("Unexpected callback case");return}const t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const s=this.sourceName,i=e.sourceName,n=this.comObj;Promise.try(t,e.data).then(function(a){n.postMessage({sourceName:s,targetName:i,callback:Tu.DATA,callbackId:e.callbackId,data:a})},function(a){n.postMessage({sourceName:s,targetName:i,callback:Tu.ERROR,callbackId:e.callbackId,reason:ls(a)})});return}if(e.streamId){b(this,ri,Ay).call(this,e);return}t(e.data)},Ay=function(e){const t=e.streamId,s=this.sourceName,i=e.sourceName,n=this.comObj,a=this,o=this.actionHandler[e.action],l={enqueue(h,c=1,u){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=c,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:s,targetName:i,stream:oe.ENQUEUE,streamId:t,chunk:h},u)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:oe.CLOSE,streamId:t}),delete a.streamSinks[t])},error(h){qt(h instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:oe.ERROR,streamId:t,reason:ls(h)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[t]=l,Promise.try(o,e.data,l).then(function(){n.postMessage({sourceName:s,targetName:i,stream:oe.START_COMPLETE,streamId:t,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:oe.START_COMPLETE,streamId:t,reason:ls(h)})})},wy=function(e){const t=e.streamId,s=this.sourceName,i=e.sourceName,n=this.comObj,a=this.streamControllers[t],o=this.streamSinks[t];switch(e.stream){case oe.START_COMPLETE:e.success?a.startCall.resolve():a.startCall.reject(ls(e.reason));break;case oe.PULL_COMPLETE:e.success?a.pullCall.resolve():a.pullCall.reject(ls(e.reason));break;case oe.PULL:if(!o){n.postMessage({sourceName:s,targetName:i,stream:oe.PULL_COMPLETE,streamId:t,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,Promise.try(o.onPull||dv).then(function(){n.postMessage({sourceName:s,targetName:i,stream:oe.PULL_COMPLETE,streamId:t,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:oe.PULL_COMPLETE,streamId:t,reason:ls(h)})});break;case oe.ENQUEUE:if(qt(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(e.chunk);break;case oe.CLOSE:if(qt(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),b(this,ri,Gu).call(this,a,t);break;case oe.ERROR:qt(a,"error should have stream controller"),a.controller.error(ls(e.reason)),b(this,ri,Gu).call(this,a,t);break;case oe.CANCEL_COMPLETE:e.success?a.cancelCall.resolve():a.cancelCall.reject(ls(e.reason)),b(this,ri,Gu).call(this,a,t);break;case oe.CANCEL:if(!o)break;const l=ls(e.reason);Promise.try(o.onCancel||dv,l).then(function(){n.postMessage({sourceName:s,targetName:i,stream:oe.CANCEL_COMPLETE,streamId:t,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:oe.CANCEL_COMPLETE,streamId:t,reason:ls(h)})}),o.sinkCapability.reject(l),o.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}},Gu=async function(e,t){var s,i,n;await Promise.allSettled([(s=e.startCall)==null?void 0:s.promise,(i=e.pullCall)==null?void 0:i.promise,(n=e.cancelCall)==null?void 0:n.promise]),delete this.streamControllers[t]};var Bf;class Sy{constructor({cMapUrl:e=null,standardFontDataUrl:t=null,wasmUrl:s=null}){y(this,Bf,Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"}));this.cMapUrl=e,this.standardFontDataUrl=t,this.wasmUrl=s}async fetch({kind:e,filename:t}){switch(e){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:gt(`Not implemented: ${e}`)}const s=this[e];if(!s)throw new Error(`Ensure that the \`${e}\` API parameter is provided.`);const i=`${s}${t}`;
4return this._fetch(i,e).catch(n=>{throw new Error(`Unable to load ${r(this,Bf)[e]} data at: ${i}`)})}async _fetch(e,t){gt("Abstract method `_fetch` called.")}}Bf=new WeakMap;class uv extends Sy{async _fetch(e,t){const s=t==="cMapUrl"&&!e.endsWith(".bcmap")?"text":"bytes",i=await Tm(e,s);return i instanceof Uint8Array?i:rp(i)}}var hd;class Ey{constructor({enableHWA:e=!1}){y(this,hd,!1);g(this,hd,e)}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const s=this._createCanvas(e,t);return{canvas:s,context:s.getContext("2d",{willReadFrequently:!r(this,hd)})}}reset({canvas:e},t,s){if(!e)throw new Error("Canvas is not specified");if(t<=0||s<=0)throw new Error("Invalid canvas size");e.width=t,e.height=s}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){gt("Abstract method `_createCanvas` called.")}}hd=new WeakMap;class JA extends Ey{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){const s=this._document.createElement("canvas");return s.width=e,s.height=t,s}}class xy{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addKnockoutFilter(e=0){return"none"}addHighlightHCMFilter(e,t,s,i,n){return"none"}addSelectionHCMFilter(e,t){return"none"}addSelectionFilter(){return"none"}createSelectionStyle(e=null){return null}destroy(e=!1){}}var qa,Xl,On,zi,Se,to,Lr,j,be,lc,Mi,Vu,pa,Ty,hg,ga,hc,cc,cg,dc,Cy,dg,Py;class QA extends xy{constructor({docId:t,ownerDocument:s=globalThis.document}){super();y(this,j);y(this,qa);y(this,Xl);y(this,On);y(this,zi);y(this,Se);y(this,to);y(this,Lr,0);g(this,zi,t),g(this,Se,s)}addFilter(t){if(!t)return"none";let s=r(this,j,be).get(t);if(s)return s;const[i,n,a]=b(this,j,Vu).call(this,t),o=t.length===1?i:`${i}${n}${a}`;if(s=r(this,j,be).get(o),s)return r(this,j,be).set(t,s),s;const l=`g_${r(this,zi)}_transfer_map_${Xt(this,Lr)._++}`,h=b(this,j,pa).call(this,l);r(this,j,be).set(t,h),r(this,j,be).set(o,h);const c=b(this,j,ga).call(this,l);return b(this,j,cc).call(this,i,n,a,c),h}addHCMFilter(t,s){var m;const i=`${t}-${s}`,n="base";let a=r(this,j,lc).get(n);if((a==null?void 0:a.key)===i||(a?((m=a.filter)==null||m.remove(),a.key=i,a.url="none",a.filter=null):(a={key:i,url:"none",filter:null},r(this,j,lc).set(n,a)),!t||!s))return a.url;const o=b(this,j,dc).call(this,t);t=_.makeHexColor(...o);const l=b(this,j,dc).call(this,s);if(s=_.makeHexColor(...l),b(this,j,dg).call(this),t==="#000000"&&s==="#ffffff"||t===s)return a.url;const c=Array.from({length:256},(v,A)=>Lp(A/255)).join(","),u=`g_${r(this,zi)}_hcm_filter`,f=a.filter=b(this,j,ga).call(this,u);b(this,j,cc).call(this,c,c,c,f),b(this,j,hg).call(this,f);const p=(v,A)=>{const w=o[v]/255,S=l[v]/255,x=new Array(A+1);for(let T=0;T<=A;T++)x[T]=w+T/A*(S-w);return x.join(",")};return b(this,j,cc).call(this,p(0,5),p(1,5),p(2,5),f),a.url=b(this,j,pa).call(this,u),a.url}addSelectionHCMFilter(t,s){return this.addHighlightHCMFilter("selection",t,s,"HighlightText","Highlight")}addSelectionFilter(){return this.addHighlightHCMFilter("selection_default","black","white","HighlightText","Highlight")}createSelectionStyle(t=null){const s=t?this.addSelectionHCMFilter(t.foreground,t.background):this.addSelectionFilter();return s==="none"||!Mt.platform.isFirefox?null:{"backdrop-filter":s,"background-color":"transparent"}}addAlphaFilter(t){let s=r(this,j,be).get(t);if(s)return s;const[i]=b(this,j,Vu).call(this,[t]),n=`alpha_${i}`;if(s=r(this,j,be).get(n),s)return r(this,j,be).set(t,s),s;const a=`g_${r(this,zi)}_alpha_map_${Xt(this,Lr)._++}`,o=b(this,j,pa).call(this,a);r(this,j,be).set(t,o),r(this,j,be).set(n,o);const l=b(this,j,ga).call(this,a);return b(this,j,cg).call(this,i,l),o}addLuminosityFilter(t){let s=r(this,j,be).get(t||"luminosity");if(s)return s;let i,n;if(t?([i]=b(this,j,Vu).call(this,[t]),n=`luminosity_${i}`):n="luminosity",s=r(this,j,be).get(n),s)return r(this,j,be).set(t,s),s;const a=`g_${r(this,zi)}_luminosity_map_${Xt(this,Lr)._++}`,o=b(this,j,pa).call(this,a);r(this,j,be).set(t,o),r(this,j,be).set(n,o);const l=b(this,j,ga).call(this,a);return b(this,j,Ty).call(this,l),t&&b(this,j,cg).call(this,i,l),o}addKnockoutFilter(t=0){const s=t>0?Math.min(1/t,1e6):1e6,i=`knockout_${s}`,n=r(this,j,be).get(i);if(n)return n;const a=`g_${r(this,zi)}_knockout_filter_${Xt(this,Lr)._++}`,o=b(this,j,pa).call(this,a);r(this,j,be).set(i,o);const l=b(this,j,ga).call(this,a),h=r(this,Se).createElementNS(is,"feComponentTransfer");l.append(h);const c=r(this,Se).createElementNS(is,"feFuncA");return c.setAttribute("type","linear"),c.setAttribute("slope",`${s}`),c.setAttribute("intercept","0"),h.append(c),o}addHighlightHCMFilter(t,s,i,n,a){var S;const o=`${s}-${i}-${n}-${a}`;
4let l=r(this,j,lc).get(t);if((l==null?void 0:l.key)===o||(l?((S=l.filter)==null||S.remove(),l.key=o,l.url="none",l.filter=null):(l={key:o,url:"none",filter:null},r(this,j,lc).set(t,l)),!s||!i))return l.url;const[h,c]=[s,i].map(b(this,j,dc).bind(this));let u=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),f=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[p,m]=[n,a].map(b(this,j,Py).bind(this));f<u&&([u,f,p,m]=[f,u,m,p]),b(this,j,dg).call(this);const v=(x,T,E)=>{const C=new Array(256),P=(f-u)/E,O=x/255,I=(T-x)/(255*E);let D=0;for(let M=0;M<=E;M++){const U=Math.round(u+M*P),L=O+M*I;for(let B=D;B<=U;B++)C[B]=L;D=U+1}for(let M=D;M<256;M++)C[M]=C[D-1];return C.join(",")},A=`g_${r(this,zi)}_hcm_${t}_filter`,w=l.filter=b(this,j,ga).call(this,A);return b(this,j,hg).call(this,w),b(this,j,cc).call(this,v(p[0],m[0],5),v(p[1],m[1],5),v(p[2],m[2],5),w),l.url=b(this,j,pa).call(this,A),l.url}destroy(t=!1){var s,i,n,a;t&&((s=r(this,to))!=null&&s.size)||((i=r(this,On))==null||i.parentNode.parentNode.remove(),g(this,On,null),(n=r(this,Xl))==null||n.clear(),g(this,Xl,null),(a=r(this,to))==null||a.clear(),g(this,to,null),g(this,Lr,0))}}qa=new WeakMap,Xl=new WeakMap,On=new WeakMap,zi=new WeakMap,Se=new WeakMap,to=new WeakMap,Lr=new WeakMap,j=new WeakSet,be=function(){return r(this,Xl)||g(this,Xl,new Map)},lc=function(){return r(this,to)||g(this,to,new Map)},Mi=function(){if(!r(this,On)){const t=r(this,Se).createElement("div"),{style:s}=t;s.colorScheme="only light",s.visibility="hidden",s.contain="strict",s.width=s.height=0,s.position="absolute",s.top=s.left=0,s.zIndex=-1;const i=r(this,Se).createElementNS(is,"svg");i.setAttribute("width",0),i.setAttribute("height",0),g(this,On,r(this,Se).createElementNS(is,"defs")),t.append(i),i.append(r(this,On)),r(this,Se).body.append(t)}return r(this,On)},Vu=function(t){if(t.length===1){const h=t[0],c=new Array(256);for(let f=0;f<256;f++)c[f]=h[f]/255;const u=c.join(",");return[u,u,u]}const[s,i,n]=t,a=new Array(256),o=new Array(256),l=new Array(256);for(let h=0;h<256;h++)a[h]=s[h]/255,o[h]=i[h]/255,l[h]=n[h]/255;return[a.join(","),o.join(","),l.join(",")]},pa=function(t){if(r(this,qa)===void 0){g(this,qa,"");const s=r(this,Se).URL;s!==r(this,Se).baseURI&&(ap(s)?st('#createUrl: ignore "data:"-URL for performance reasons.'):g(this,qa,Rv(s,"")))}return`url(${r(this,qa)}#${t})`},Ty=function(t){const s=r(this,Se).createElementNS(is,"feColorMatrix");s.setAttribute("type","matrix"),s.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"),t.append(s)},hg=function(t){const s=r(this,Se).createElementNS(is,"feColorMatrix");s.setAttribute("type","matrix"),s.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"),t.append(s)},ga=function(t){const s=r(this,Se).createElementNS(is,"filter");return s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("id",t),r(this,j,Mi).append(s),s},hc=function(t,s,i){const n=r(this,Se).createElementNS(is,s);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),t.append(n)},cc=function(t,s,i,n){const a=r(this,Se).createElementNS(is,"feComponentTransfer");n.append(a),b(this,j,hc).call(this,a,"feFuncR",t),b(this,j,hc).call(this,a,"feFuncG",s),b(this,j,hc).call(this,a,"feFuncB",i)},cg=function(t,s){const i=r(this,Se).createElementNS(is,"feComponentTransfer");
4s.append(i),b(this,j,hc).call(this,i,"feFuncA",t)},dc=function(t){return r(this,j,Mi).style.color="CanvasText",r(this,j,Mi).style.backgroundColor=t,Au(getComputedStyle(r(this,j,Mi)).getPropertyValue("background-color"))},Cy=function(t){return r(this,j,Mi).style.color="CanvasText",r(this,j,Mi).style.backgroundColor=t,bu(getComputedStyle(r(this,j,Mi)).getPropertyValue("background-color"))},dg=function(){r(this,j,Mi).style.color="",r(this,j,Mi).style.backgroundColor=""},Py=function(t){const[s,i,n,a]=b(this,j,Cy).call(this,t);if(a===1)return[s,i,n];const[o,l,h]=b(this,j,dc).call(this,"Canvas");return[Ep(s,o,a),Ep(i,l,a),Ep(n,h,a)]};function Ep(d,e,t){return Math.round(t*d+(1-t)*e)}var Iv;if(Ls){let d;try{const e=process.getBuiltinModule("module").createRequire(import.meta.url);try{d=e("@napi-rs/canvas")}catch(t){st(`Cannot load "@napi-rs/canvas" package: "${t}".`)}}catch(e){st(`Cannot access the \`require\` function: "${e}".`)}globalThis.DOMMatrix||(d!=null&&d.DOMMatrix?globalThis.DOMMatrix=d.DOMMatrix:st("Cannot polyfill `DOMMatrix`, rendering may be broken.")),globalThis.Path2D||(d!=null&&d.Path2D?globalThis.Path2D=d.Path2D:st("Cannot polyfill `Path2D`, rendering may be broken.")),(Iv=globalThis.navigator)!=null&&Iv.language||(globalThis.navigator={language:"en-US",platform:"",userAgent:""})}async function ZA(d){const t=await process.getBuiltinModule("fs/promises").readFile(d);return new Uint8Array(t)}class qA extends xy{}class t0 extends Ey{_createCanvas(e,t){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,t)}}class e0 extends Sy{async _fetch(e,t){return ZA(e)}}function Iy({src:d,srcPos:e=0,dest:t,width:s,height:i,nonBlackColor:n=4294967295,inverseDecode:a=!1}){const o=Mt.isLittleEndian?4278190080:255,[l,h]=a?[n,o]:[o,n],c=s>>3,u=s&7,f=l^h,p=d.length;t=new Uint32Array(t.buffer);let m=0;for(let v=0;v<i;++v){for(const w=e+c;e<w;++e,m+=8){const S=d[e];t[m]=l^-(S>>7&1)&f,t[m+1]=l^-(S>>6&1)&f,t[m+2]=l^-(S>>5&1)&f,t[m+3]=l^-(S>>4&1)&f,t[m+4]=l^-(S>>3&1)&f,t[m+5]=l^-(S>>2&1)&f,t[m+6]=l^-(S>>1&1)&f,t[m+7]=l^-(S&1)&f}if(u===0)continue;const A=e<p?d[e++]:255;for(let w=0;w<u;++w,++m)t[m]=l^-(A>>7-w&1)&f}return{srcPos:e,destPos:m}}function s0({src:d,srcPos:e=0,dest:t,destPos:s=0,width:i,height:n}){let a=0;const o=i*n*3,l=o>>2,h=new Uint32Array(d.buffer,e,l),c=Mt.isLittleEndian?4278190080:255;if(Mt.isLittleEndian){for(;a<l-2;a+=3,s+=4){const u=h[a],f=h[a+1],p=h[a+2];t[s]=u|c,t[s+1]=u>>>24|f<<8|c,t[s+2]=f>>>16|p<<16|c,t[s+3]=p>>>8|c}for(let u=a*4,f=e+o;u<f;u+=3)t[s++]=d[u]|d[u+1]<<8|d[u+2]<<16|c}else{for(;a<l-2;a+=3,s+=4){const u=h[a],f=h[a+1],p=h[a+2];t[s]=u|c,t[s+1]=u<<24|f>>>8|c,t[s+2]=f<<16|p>>>16|c,t[s+3]=p<<8|c}for(let u=a*4,f=e+o;u<f;u+=3)t[s++]=d[u]<<24|d[u+1]<<16|d[u+2]<<8|c}return{srcPos:e+o,destPos:s}}const i0=` 5struct Uniforms { 6 offsetX : f32, 7 offsetY : f32, 8 scaleX : f32, 9 scaleY : f32, 10 paddedWidth : f32, 11 paddedHeight : f32, 12 borderSize : f32, 13 _pad : f32, 14}; 15 16@group(0) @binding(0) var<uniform> u : Uniforms; 17 18struct VertexInput { 19 @location(0) position : vec2<f32>, 20 @location(1) color : vec4<f32>, 21}; 22 23struct VertexOutput { 24 @builtin(position) position : vec4<f32>, 25 @location(0) color : vec3<f32>, 26}; 27 28@vertex 29fn vs_main(in : VertexInput) -> VertexOutput { 30 var out : VertexOutput; 31 let cx = (in.position.x + u.offsetX) * u.scaleX; 32 let cy = (in.position.y + u.offsetY) * u.scaleY; 33 out.position = vec4<f32>( 34 ((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0, 35 1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0, 36 0.0, 37 1.0 38 ); 39 out.color = in.color.rgb; 40 return out; 41} 42 43@fragment 44fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> { 45 return vec4<f32>(in.color, 1.0); 46} 47`;var Uf,Mn,eo,Yl,Hf,Oy;class n0{constructor(){y(this,Hf);y(this,Uf,null);y(this,Mn,null);y(this,eo,null);y(this,Yl,null)}init(){return r(this,Uf)||g(this,Uf,b(this,Hf,Oy).call(this))}get isReady(){return r(this,Mn)!==null}loadMeshShader(){if(!r(this,Mn)||r(this,eo))return;const e=r(this,Mn).createShaderModule({code:i0});g(this,eo,r(this,Mn).createRenderPipeline({layout:"auto",vertex:{module:e,entryPoint:"vs_main",buffers:[{arrayStri
47de:2*4,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:e,entryPoint:"fs_main",targets:[{format:r(this,Yl)}]},primitive:{topology:"triangle-list"}}))}draw(e,t,s,i,n,a,o,l){this.loadMeshShader();const h=r(this,Mn),{offsetX:c,offsetY:u,scaleX:f,scaleY:p}=i,m=h.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});e.byteLength>0&&h.queue.writeBuffer(m,0,e);const v=h.createBuffer({size:Math.max(t.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});t.byteLength>0&&h.queue.writeBuffer(v,0,t);const A=h.createBuffer({size:8*4,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});h.queue.writeBuffer(A,0,new Float32Array([c,u,f,p,a,o,l,0]));const w=h.createBindGroup({layout:r(this,eo).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:A}}]}),S=new OffscreenCanvas(a,o),x=S.getContext("webgpu");x.configure({device:h,format:r(this,Yl),alphaMode:n?"opaque":"premultiplied"});const T=n?{r:n[0]/255,g:n[1]/255,b:n[2]/255,a:1}:{r:0,g:0,b:0,a:0},E=h.createCommandEncoder(),C=E.beginRenderPass({colorAttachments:[{view:x.getCurrentTexture().createView(),clearValue:T,loadOp:"clear",storeOp:"store"}]});return s>0&&(C.setPipeline(r(this,eo)),C.setBindGroup(0,w),C.setVertexBuffer(0,m),C.setVertexBuffer(1,v),C.draw(s)),C.end(),h.queue.submit([E.finish()]),m.destroy(),v.destroy(),A.destroy(),S.transferToImageBitmap()}}Uf=new WeakMap,Mn=new WeakMap,eo=new WeakMap,Yl=new WeakMap,Hf=new WeakSet,Oy=async function(){var e;if(!((e=globalThis.navigator)!=null&&e.gpu))return!1;try{const t=await navigator.gpu.requestAdapter();return t?(g(this,Yl,navigator.gpu.getPreferredCanvasFormat()),g(this,Mn,await t.requestDevice()),!0):!1}catch{return!1}};const op=new n0;function r0(){return op.init()}function a0(){return op.isReady}function o0(){op.loadMeshShader()}function l0(d,e,t,s,i,n,a,o){return op.draw(d,e,t,s,i,n,a,o)}const Le={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function zu(d,e){if(!e)return;const t=e[2]-e[0],s=e[3]-e[1],i=new Path2D;i.rect(e[0],e[1],t,s),d.clip(i)}class Om{constructor(){R(this,"matrix",null)}isModifyingCurrentTransform(){return!1}getPattern(){gt("Abstract method `getPattern` called.")}}class h0 extends Om{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]}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type==="radial"}areConic(){if(!this.isRadial())return!1;const e=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return e+this._r1>this._r0&&e+this._r0>this._r1}_createGradient(e,t=null){let s,i=this._p0,n=this._p1;if(t&&(i=i.slice(),n=n.slice(),_.applyTransform(i,t),_.applyTransform(n,t)),this._type==="axial")s=e.createLinearGradient(i[0],i[1],n[0],n[1]);else if(this._type==="radial"){let a=this._r0,o=this._r1;if(t){const l=new Float32Array(2);_.singularValueDecompose2dScale(t,l),a*=l[0],o*=l[0]}s=e.createRadialGradient(i[0],i[1],a,n[0],n[1],o)}for(const a of this._colorStops)s.addColorStop(a[0],a[1]);return s}_createReversedGradient(e,t=null){let s=this._p1,i=this._p0;t&&(s=s.slice(),i=i.slice(),_.applyTransform(s,t),_.applyTransform(i,t));let n=this._r1,a=this._r0;if(t){const h=new Float32Array(2);_.singularValueDecompose2dScale(t,h),n*=h[0],a*=h[0]}const o=e.createRadialGradient(s[0],s[1],n,i[0],i[1],a),l=this._colorStops.map(([h,c])=>[1-h,c]).reverse();for(const[h,c]of l)o.addColorStop(h,c);return o}getPattern(e,t,s,i){let n;if(i===Le.STROKE||i===Le.FILL){if(this.isOriginBased()){let f=_.transform(s,t.baseTransform);this.matrix&&(f=_.transform(f,this.matrix));const p=.001,m=Math.hypot(f[0],f[1]),v=Math.hypot(f[2],f[3]),A=(f[0]*f[2]+f[1]*f[3])/(m*v);if(Math.abs(A)<p)if(this.isRadial()){if(Math.abs(m-v)<p)return this._createGradient(e,f)}else return this._createGradient(e,f)}const a=t.current.getClippedPathBoundingBox(i,Bt(e))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,l=Math.ceil(a[3]-a[1])||1,h=t.canvasFactory.create(o,l),c=h.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-a[0],-a[1]),s=_.transform(s,[1,0,0,1,a[0],a[1]]),c.transform(...t.baseTransform),this.matrix&&c.transform(...this.matrix
47),zu(c,this._bbox),this.areConic()&&(c.fillStyle=this._createReversedGradient(c),c.fill()),c.fillStyle=this._createGradient(c),c.fill(),n=e.createPattern(h.canvas,"no-repeat"),t.canvasFactory.destroy(h);const u=new DOMMatrix(s);n.setTransform(u)}else this.areConic()&&(e.save(),zu(e,this._bbox),e.fillStyle=this._createReversedGradient(e),e.fillRect(-1e10,-1e10,2e10,2e10),e.restore()),zu(e,this._bbox),n=this._createGradient(e);return n}}function c0(d,e,t,s,i,n,a,o){const l=e.coords,h=e.colors,c=d.data,u=d.width*4;let f;l[t*2+1]>l[s*2+1]&&(f=t,t=s,s=f,f=n,n=a,a=f),l[s*2+1]>l[i*2+1]&&(f=s,s=i,i=f,f=a,a=o,o=f),l[t*2+1]>l[s*2+1]&&(f=t,t=s,s=f,f=n,n=a,a=f);const p=(l[t*2]+e.offsetX)*e.scaleX,m=(l[t*2+1]+e.offsetY)*e.scaleY,v=(l[s*2]+e.offsetX)*e.scaleX,A=(l[s*2+1]+e.offsetY)*e.scaleY,w=(l[i*2]+e.offsetX)*e.scaleX,S=(l[i*2+1]+e.offsetY)*e.scaleY;if(m>=S)return;const x=h[n*4],T=h[n*4+1],E=h[n*4+2],C=h[a*4],P=h[a*4+1],O=h[a*4+2],I=h[o*4],D=h[o*4+1],M=h[o*4+2],U=Math.round(m),L=Math.round(S);let B,W,k,N,X,z,lt,vt;for(let dt=U;dt<=L;dt++){if(dt<A){const F=dt<m?0:(m-dt)/(m-A);B=p-(p-v)*F,W=x-(x-C)*F,k=T-(T-P)*F,N=E-(E-O)*F}else{let F;dt>S?F=1:A===S?F=0:F=(A-dt)/(A-S),B=v-(v-w)*F,W=C-(C-I)*F,k=P-(P-D)*F,N=O-(O-M)*F}let rt;dt<m?rt=0:dt>S?rt=1:rt=(m-dt)/(m-S),X=p-(p-w)*rt,z=x-(x-I)*rt,lt=T-(T-D)*rt,vt=E-(E-M)*rt;const bt=Math.round(Math.min(B,X)),He=Math.round(Math.max(B,X));let H=u*dt+bt*4;for(let F=bt;F<=He;F++)rt=(B-F)/(B-X),rt<0?rt=0:rt>1&&(rt=1),c[H++]=W-(W-z)*rt|0,c[H++]=k-(k-lt)*rt|0,c[H++]=N-(N-vt)*rt|0,c[H++]=255}}class d0 extends Om{constructor(e){super(),this._posData=e[2],this._colData=e[3],this._vertexCount=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],o0()}_createMeshCanvas(e,t,s){const o=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),h=Math.ceil(this._bounds[2])-o,c=Math.ceil(this._bounds[3])-l,u=Math.min(Math.ceil(Math.abs(h*e[0]*1.1)),3e3)||1,f=Math.min(Math.ceil(Math.abs(c*e[1]*1.1)),3e3)||1,p=h?h/u:1,m=c?c/f:1,v={coords:this._posData,colors:this._colData,offsetX:-o,offsetY:-l,scaleX:1/p,scaleY:1/m},A=u+2*2,w=f+2*2,S=s.create(A,w);if(a0()&&this._vertexCount>48)S.context.drawImage(l0(this._posData,this._colData,this._vertexCount,v,t,A,w,2),0,0);else{const x=S.context.createImageData(u,f);if(t){const T=x.data;for(let E=0,C=T.length;E<C;E+=4)T[E]=t[0],T[E+1]=t[1],T[E+2]=t[2],T[E+3]=255}for(let T=0,E=this._vertexCount;T<E;T+=3)c0(x,v,T,T+1,T+2,T,T+1,T+2);S.context.putImageData(x,2,2)}return{canvas:S.canvas,offsetX:o-2*p,offsetY:l-2*m,scaleX:p,scaleY:m}}isModifyingCurrentTransform(){return!0}getPattern(e,t,s,i){zu(e,this._bbox);const n=new Float32Array(2);if(i===Le.SHADING)_.singularValueDecompose2dScale(Bt(e),n);else if(this.matrix){_.singularValueDecompose2dScale(this.matrix,n);const[l,h]=n;_.singularValueDecompose2dScale(t.baseTransform,n),n[0]*=l,n[1]*=h}else _.singularValueDecompose2dScale(t.baseTransform,n);const a=this._createMeshCanvas(n,i===Le.SHADING?null:this._background,t.canvasFactory);i!==Le.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(a.offsetX,a.offsetY),e.scale(a.scaleX,a.scaleY);const o=e.createPattern(a.canvas,"no-repeat");return t.canvasFactory.destroy(a),o}}class u0 extends Om{getPattern(){return"hotpink"}}function f0(d){switch(d[0]){case"RadialAxial":return new h0(d);case"Mesh":return new d0(d);case"Dummy":return new u0}throw new Error(`Unknown IR type: ${d[0]}`)}const fv={COLORED:1,UNCOLORED:2},_f=class _f{constructor(e,t,s,i){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.needsIsolation=e[9]??!0,this.ctx=t,this.canvasGraphicsFactory=s,this.baseTransform=i,this.patternBaseMatrix=this.matrix?_.transform(i,this.matrix):i}canSkipPatternCanvas([e,t,s,i]){const[n,a,o,l]=this.bbox,h=Math.abs(this.xstep),c=Math.abs(this.ystep);if(e>h+1e-6||t>c+1e-6)return null;const u=Math.floor((s-o)/h)+1,f=Math.ceil((s+e-n)/h)-1,p=Math.floor((i-l)/c)+1,m=Math.ceil((i+t-a)/c)-1;return f<=u&&m<=p?[u,p]:null}updatePatternDims(e,t){const s=_.inverseTransform(this.patternBaseMatrix),i=[e[0],e[1]],n=[e[2],e[3]];_.applyTransform(i,s),_.applyTransform(n,s),t[0]=Math.abs(n[0]-i[0]),t[1]=Math.abs(n[1]-i[1]),t[2]=Math.min(i[0],n[0]),t[3]=Math.min(i[1],n[1])}_renderTileCanvas(e,t,s,i){var f,p;const[n,a,o,l]=this.bbox,h=e.canvasFactory.create(s.size,i.size),c=h.context,u=this.canvasGraphicsFactory.createCanvasGraphics(c,t);return u.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(u,this.paintType,this.color),c.translate(-s.scale*n,-i.scale*a),u.transform(0,s.scale,0,0,i.scale,0,0),c.save(),(f=u.depen
47dencyTracker)==null||f.save(),this.clipBbox(u,n,a,o,l),u.baseTransform=Bt(u.ctx),u.executeOperatorList(this.operatorList),u.endDrawing(),(p=u.dependencyTracker)==null||p.restore(),c.restore(),h}_getCombinedScales(){const e=new Float32Array(2);_.singularValueDecompose2dScale(this.matrix,e);const[t,s]=e;return _.singularValueDecompose2dScale(this.baseTransform,e),[t*e[0],s*e[1]]}drawPattern(e,t,s=!1,[i,n],a){const[o,l,h,c]=this.bbox,u=e.dependencyTracker;if(u&&(e.dependencyTracker=new Pc(u,a)),e.save(),s?e.ctx.clip(t,"evenodd"):e.ctx.clip(t),e.ctx.setTransform(...this.patternBaseMatrix),e.ctx.translate(i*this.xstep,n*this.ystep),this.needsIsolation||e.ctx.globalAlpha!==1||e.ctx.globalCompositeOperation!=="source-over"||e.inSMaskMode){const f=h-o,p=c-l,[m,v]=this._getCombinedScales(),A=this.getSizeAndScale(f,this.ctx.canvas.width,m),w=this.getSizeAndScale(p,this.ctx.canvas.height,v),S=this._renderTileCanvas(e,a,A,w);e.ctx.drawImage(S.canvas,o,l,f,p),e.canvasFactory.destroy(S)}else this.setFillAndStrokeStyleToContext(e,this.paintType,this.color),this.clipBbox(e,o,l,h,c),e.baseTransformStack.push(e.baseTransform),e.baseTransform=Bt(e.ctx),e.executeOperatorList(this.operatorList),e.baseTransform=e.baseTransformStack.pop();e.restore(),u&&(e.dependencyTracker=u)}createPatternCanvas(e,t){const[s,i,n,a]=this.bbox,o=n-s,l=a-i;let{xstep:h,ystep:c}=this;h=Math.abs(h),c=Math.abs(c),np("TilingType: "+this.tilingType);const[u,f]=this._getCombinedScales();let p=o,m=l,v=!1,A=!1;Math.ceil(h*u)>=Math.ceil(o*u)?p=h:v=!0,Math.ceil(c*f)>=Math.ceil(l*f)?m=c:A=!0;const w=this.getSizeAndScale(p,this.ctx.canvas.width,u),S=this.getSizeAndScale(m,this.ctx.canvas.height,f),x=this._renderTileCanvas(e,t,w,S);if(v||A){const T=x.canvas;v&&(p=h),A&&(m=c);const E=this.getSizeAndScale(p,this.ctx.canvas.width,u),C=this.getSizeAndScale(m,this.ctx.canvas.height,f),P=E.size,O=C.size,I=e.canvasFactory.create(P,O),D=I.context,M=v?Math.floor(o/h):0,U=A?Math.floor(l/c):0;for(let L=0;L<=M;L++)for(let B=0;B<=U;B++)D.drawImage(T,P*L,O*B,P,O,0,0,P,O);return e.canvasFactory.destroy(x),{canvas:I.canvas,canvasEntry:I,scaleX:E.scale,scaleY:C.scale,offsetX:s,offsetY:i}}return{canvas:x.canvas,canvasEntry:x,scaleX:w.scale,scaleY:S.scale,offsetX:s,offsetY:i}}getSizeAndScale(e,t,s){const i=Math.max(_f.MAX_PATTERN_SIZE,t);let n=Math.ceil(e*s);return n>=i?n=i:s=n/e,{scale:s,size:n}}clipBbox(e,t,s,i,n){const a=i-t,o=n-s,l=new Path2D;l.rect(t,s,a,o),_.axialAlignedBoundingBox([t,s,i,n],Bt(e.ctx),e.current.minMax),e.ctx.clip(l),e.current.updateClipFromPath()}setFillAndStrokeStyleToContext(e,t,s){const i=e.ctx,n=e.current;switch(n.patternFill=n.patternStroke=!1,t){case fv.COLORED:const{fillStyle:a,strokeStyle:o}=this.ctx;i.fillStyle=n.fillColor=a,i.strokeStyle=n.strokeColor=o;break;case fv.UNCOLORED:i.fillStyle=i.strokeStyle=s,n.fillColor=n.strokeColor=s;break;default:throw new fA(`Unsupported paint type: ${t}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,t,s,i,n){const a=i!==Le.SHADING?_.transform(s,this.patternBaseMatrix):s,o=this.createPatternCanvas(t,n);let l=new DOMMatrix(a);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const h=e.createPattern(o.canvas,"repeat");return t.canvasFactory.destroy(o.canvasEntry),h.setTransform(l),h}};R(_f,"MAX_PATTERN_SIZE",3e3);let Sc=_f;const p0=16,g0=100,m0=15,pv=10,ms=16,Ns=new Float32Array(2);function gv(d,e){if(d._removeMirroring)throw new Error("Context is already forwarding operations.");const t=new Map;for(const s of["save","restore","rotate","scale","translate","transform","setTransform","resetTransform","clip","moveTo","lineTo","bezierCurveTo","quadraticCurveTo","arc","arcTo","ellipse","rect","roundRect","closePath","beginPath"]){const i=d[s];typeof i!="function"||typeof e[s]!="function"||(t.set(s,i),d[s]=function(...n){return e[s](...n),i.apply(this,n)})}d._removeMirroring=()=>{for(const[s,i]of t)d[s]=i;delete d._removeMirroring}}function Cu(d,e,t,s,i,n,a,o,l,h){const[c,u,f,p,m,v]=Bt(d);if(u===0&&f===0){const S=a*c+m,x=Math.round(S),T=o*p+v,E=Math.round(T),C=(a+l)*c+m,P=Math.abs(Math.round(C)-x)||1,O=(o+h)*p+v,I=Math.abs(Math.round(O)-E)||1;return d.setTransform(Math.sign(c),0,0,Math.sign(p),x,E),d.drawImage(e,t,s,i,n,0,0,P,I),d.setTransform(c,u,f,p,m,v),[P,I]}if(c===0&&p===0){const S=o*f+m,x=Math.round(S),T=a*u+v,E=Math.round(T),C=(o+h)*f+m,P=M
47ath.abs(Math.round(C)-x)||1,O=(a+l)*u+v,I=Math.abs(Math.round(O)-E)||1;return d.setTransform(0,Math.sign(u),Math.sign(f),0,x,E),d.drawImage(e,t,s,i,n,0,0,I,P),d.setTransform(c,u,f,p,m,v),[I,P]}d.drawImage(e,t,s,i,n,a,o,l,h);const A=Math.hypot(c,u),w=Math.hypot(f,p);return[A*l,w*h]}class mv{constructor(e,t){R(this,"alphaIsShape",!1);R(this,"fontSize",0);R(this,"fontSizeScale",1);R(this,"textMatrix",null);R(this,"textMatrixScale",1);R(this,"fontMatrix",Cp);R(this,"leading",0);R(this,"x",0);R(this,"y",0);R(this,"lineX",0);R(this,"lineY",0);R(this,"charSpacing",0);R(this,"wordSpacing",0);R(this,"textHScale",1);R(this,"textRenderingMode",fe.FILL);R(this,"textRise",0);R(this,"fillColor","#000000");R(this,"strokeColor","#000000");R(this,"tilingPatternDims",null);R(this,"patternFill",!1);R(this,"patternStroke",!1);R(this,"fillAlpha",1);R(this,"strokeAlpha",1);R(this,"lineWidth",1);R(this,"activeSMask",null);R(this,"transferMaps","none");R(this,"minMax",Ea.slice());this.clipBox=new Float32Array([0,0,e,t])}clone(){var t;const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e.tilingPatternDims=(t=this.tilingPatternDims)==null?void 0:t.slice(),e}getPathBoundingBox(e=Le.FILL,t=null){const s=this.minMax.slice();if(e===Le.STROKE){t||gt("Stroke bounding box must include transform."),_.singularValueDecompose2dScale(t,Ns);const i=Ns[0]*this.lineWidth/2,n=Ns[1]*this.lineWidth/2;s[0]-=i,s[1]-=n,s[2]+=i,s[3]+=n}return s}updateClipFromPath(){const e=_.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(Ea,0)}getClippedPathBoundingBox(e=Le.FILL,t=null){return _.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function vv(d,e){const{width:t,height:s,kind:i}=e,n=s%ms,a=(s-n)/ms,o=n===0?a:a+1,l=d.createImageData(t,ms);let h=0;const c=e.data,u=l.data;let f;if(i===Du.GRAYSCALE_1BPP)for(f=0;f<o;f++)({srcPos:h}=Iy({src:c,srcPos:h,dest:u,width:t,height:f<a?ms:n})),d.putImageData(l,0,f*ms);else if(i===Du.RGBA_32BPP){let p=0,m=t*ms*4;for(f=0;f<a;f++)u.set(c.subarray(h,h+m)),h+=m,d.putImageData(l,0,p),p+=ms;f<o&&(m=t*n*4,u.set(c.subarray(h,h+m)),d.putImageData(l,0,p))}else if(i===Du.RGB_24BPP)for(f=0;f<o;f++)({srcPos:h}=s0({src:c,srcPos:h,dest:new Uint32Array(u.buffer),width:t,height:f<a?ms:n})),d.putImageData(l,0,f*ms);else throw new Error(`bad image kind: ${i}`)}function yv(d,e){if(e.bitmap){d.drawImage(e.bitmap,0,0);return}const{width:t,height:s}=e,i=s%ms,n=(s-i)/ms,a=i===0?n:n+1,o=d.createImageData(t,ms);let l=0;const h=e.data,c=o.data;for(let u=0;u<a;u++)({srcPos:l}=Iy({src:h,srcPos:l,dest:c,width:t,height:u<n?ms:i,nonBlackColor:0})),d.putImageData(o,0,u*ms)}function fa(d,e){const t=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of t)d[s]!==void 0&&(e[s]=d[s]);d.setLineDash!==void 0&&(e.setLineDash(d.getLineDash()),e.lineDashOffset=d.lineDashOffset)}function Pu(d){d.strokeStyle=d.fillStyle="#000000",d.fillRule="nonzero",d.globalAlpha=1,d.lineWidth=1,d.lineCap="butt",d.lineJoin="miter",d.miterLimit=10,d.globalCompositeOperation="source-over",d.font="10px sans-serif",d.setLineDash!==void 0&&(d.setLineDash([]),d.lineDashOffset=0);const{filter:e}=d;e!=="none"&&e!==""&&(d.filter="none")}function bv(d,e){if(e)return!0;_.singularValueDecompose2dScale(d,Ns);const t=Math.fround(Ci.pixelRatio*ua.PDF_TO_CSS_UNITS);return Ns[0]<=t&&Ns[1]<=t}const v0=["butt","round","square"],y0=["miter","round","bevel"],b0={},Av={};var jf,Ss,Nr,so,io,no,ro,ao,oo,lo,Wi,K,ug,fg,pg,gg,mg,os,_e,vg,My,Wu;const Aa=class Aa{constructor(e,t,s,i,n,{optionalContentConfig:a,markedContentStack:o=null},l,h,c,u){y(this,K);y(this,Ss,0);y(this,Nr,0);y(this,so,null);y(this,io,null);y(this,no,null);y(this,ro,null);y(this,ao,1);y(this,oo);y(this,lo,null);y(this,Wi,[]);this.ctx=e,this.current=new mv(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=t,this.objs=s,this.canvasFactory=i,this.filterFactory=n,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.tempSMask=null,this.smaskGroupCanvases=[],this.smaskPreparedEntry=null,this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=h,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=c??null,this.imagesTracker=u??null}getObject(e,t,s=null){var i;return typeof t=="string"?((i=this.dependencyTracker)==null||i.recordNamedDependency(e,t),t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t)):s}beginDrawing({transform:e,viewport:t,transparency:s=!1,background:i=null}){const n=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,n,a),this.ctx.fillStyle=o,s){const l=this.transparentCanvasEntry=this.canvasFactory.create(n,a);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=l,this.ctx.save(),this.ctx.transform(...Bt(this.compositeCtx))}this.ctx.save(),Pu(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[3]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=Bt(this.ctx)}executeOperatorList(e,t,s,i,n){var w;const a=e.argsArray,o=e.fnArray;let l=t||0;const h=a.length;if(h===l)return l;const c=h-l>pv&&typeof s=="function",u=c?Date.now()+m0:0;let f=0;const p=this.commonObjs,m=this.objs;let v,A;for(;;){if(i!==void 0){if(l===i.nextBreakPoint)return i.breakIt(l,s),l;if(i.shouldSkip(l)){if(++l===h)return l;continue}}if(!n||n(l))if(v=o[l],A=a[l]??null,v!==Di.dependency)A===null?this[v](l):this[v](l,...A);else for(const S of A){(w=this.dependencyTracker)==null||w.recordNamedData(S,l);const x=S.startsWith("g_")?p:m;if(!x.has(S))return x.get(S,s),l}if(l++,l===h)return l;if(c&&++f>pv){if(Date.now()>u)return s(),l;f=0}}}endDrawing(){b(this,K,ug).call(this);for(const e of this.smaskGroupCanvases)this.canvasFactory.destroy(e);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0;for(const e of r(this,Wi))b(this,K,Wu).call(this,e);r(this,Wi).length=0,g(this,so,null),g(this,io,null),g(this,no,null),g(this,ro,null),g(this,ao,1),g(this,lo,null),g(this,Nr,0),g(this,Ss,0),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),b(this,K,fg).call(this)}
47_scaleImage(e,t){const s=e.width??e.displayWidth,i=e.height??e.displayHeight,n=Math.max(Math.hypot(t[0],t[1]),1),a=Math.max(Math.hypot(t[2],t[3]),1),o=[];let l=n,h=a,c=s,u=i;for(;l>2&&c>1||h>2&&u>1;){let w=c,S=u;l>2&&c>1&&(w=Math.ceil(c/2),l/=c/w),h>2&&u>1&&(S=Math.ceil(u/2),h/=u/S),o.push({newWidth:w,newHeight:S}),c=w,u=S}if(o.length===0)return{img:e,paintWidth:s,paintHeight:i,tmpCanvas:null};if(o.length===1){const{newWidth:w,newHeight:S}=o[0],x=this.canvasFactory.create(w,S);return x.context.drawImage(e,0,0,s,i,0,0,w,S),{img:x.canvas,paintWidth:w,paintHeight:S,tmpCanvas:x}}let f=this.canvasFactory.create(1,1),p=this.canvasFactory.create(1,1),m=s,v=i,A=e;for(const{newWidth:w,newHeight:S}of o)this.canvasFactory.reset(p,w,S),p.context.drawImage(A,0,0,m,v,0,0,w,S),[f,p]=[p,f],A=f.canvas,m=w,v=S;return this.canvasFactory.destroy(p),{img:f.canvas,paintWidth:m,paintHeight:v,tmpCanvas:f}}_createMaskCanvas(e,t){var M,U;const s=this.ctx,{width:i,height:n}=t,a=this.current.fillColor,o=this.current.patternFill,l=Bt(s);let h,c,u,f;if((t.bitmap||t.data)&&t.count>1){const L=t.bitmap||t.data.buffer;c=JSON.stringify(o?l:[l.slice(0,4),a]),h=this._cachedBitmapsMap.getOrInsertComputed(L,Em);const B=h.get(c);if(B&&!o){const W=Math.round(Math.min(l[0],l[2])+l[4]),k=Math.round(Math.min(l[1],l[3])+l[5]);return(M=this.dependencyTracker)==null||M.recordDependencies(e,$s.transformAndFill),{canvas:B,offsetX:W,offsetY:k}}u=B}u||(f=this.canvasFactory.create(i,n),yv(f.context,t));let p=_.transform(l,[1/i,0,0,-1/n,0,0]);p=_.transform(p,[1,0,0,1,0,-n]);const m=Ea.slice();_.axialAlignedBoundingBox([0,0,i,n],p,m);const[v,A,w,S]=m,x=Math.round(w-v)||1,T=Math.round(S-A)||1,E=this.canvasFactory.create(x,T),C=E.context,P=v,O=A;C.translate(-P,-O),C.transform(...p);let I=null;if(!u){const L=this._scaleImage(f.canvas,Ii(C));u=L.img,I=L.tmpCanvas,u!==f.canvas&&(this.canvasFactory.destroy(f),f=null),h&&o&&(h.set(c,u),I=null,f=null)}C.imageSmoothingEnabled=bv(Bt(C),t.interpolate),Cu(C,u,0,0,u.width,u.height,0,0,i,n),I&&this.canvasFactory.destroy(I),f&&this.canvasFactory.destroy(f),C.globalCompositeOperation="source-in";const D=_.transform(Ii(C),[1,0,0,1,-P,-O]);return C.fillStyle=o?a.getPattern(s,this,D,Le.FILL,e):a,C.fillRect(0,0,i,n),h&&!o&&h.set(c,E.canvas),(U=this.dependencyTracker)==null||U.recordDependencies(e,$s.transformAndFill),{canvas:E.canvas,canvasEntry:h&&!o?null:E,offsetX:Math.round(P),offsetY:Math.round(O)}}setLineWidth(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("lineWidth",e),t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("lineCap",e),this.ctx.lineCap=v0[t]}setLineJoin(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("lineJoin",e),this.ctx.lineJoin=y0[t]}setMiterLimit(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("miterLimit",e),this.ctx.miterLimit=t}setDash(e,t,s){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("dash",e);const i=this.ctx;i.setLineDash!==void 0&&(i.setLineDash(t),i.lineDashOffset=s)}setRenderingIntent(e,t){}setFlatness(e,t){}setGState(e,t){var s,i,n,a,o;for(const[l,h]of t)switch(l){case"LW":this.setLineWidth(e,h);break;case"LC":this.setLineCap(e,h);break;case"LJ":this.setLineJoin(e,h);break;case"ML":this.setMiterLimit(e,h);break;case"D":this.setDash(e,h[0],h[1]);break;case"RI":this.setRenderingIntent(e,h);break;case"FL":this.setFlatness(e,h);break;case"Font":this.setFont(e,h[0],h[1]);break;case"CA":(s=this.dependencyTracker)==null||s.recordSimpleData("strokeAlpha",e),this.current.strokeAlpha=h;break;case"ca":(i=this.dependencyTracker)==null||i.recordSimpleData("fillAlpha",e),this.ctx.globalAlpha=this.current.fillAlpha=h;break;case"BM":(n=this.dependencyTracker)==null||n.recordSimpleData("globalCompositeOperation",e),this.ctx.globalCompositeOperation=h;break;case"SMask":(a=this.dependencyTracker)==null||a.recordSimpleData("SMask",e),this.current.activeSMask=h?this.tempSMask:null,this.current.activeSMask&&(this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation),this.tempSMask=null,this.checkSMaskState(e);break;case"TR":(o=this.dependencyTracker)==null||o.recordSimpleData("filter",e),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(h);break}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){this.smaskPreparedEntry&&(this.canvasFactory.destroy(this.smaskPreparedEntry),this.smaskPreparedEntry=null),this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null}_ensurePreparedSMask(e){e!==this.smaskPreparedFor&&(this._clearPreparedSMask(),this._prepareSMaskCanvas(e))}checkSMaskState(e){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode(e):!this.current.activeSMask&&t?this.endSMaskMode():this.current.activeSMask&&t&&this._ensurePreparedSMask(this.current.activeSMask)}_prepareSMaskCanvas(e){const{canvas:t,subtype:s,backdrop:i,transferMap:n}=e,a=s==="Luminosity"||s==="Alpha"&&n;
47if(!a&&!(s==="Luminosity"&&i)){this.smaskPreparedFor=e;return}let o;if(s==="Luminosity"&&i){const[S,x,T]=bu(i),E=Math.round(.3*S+.59*x+.11*T);o=(n==null?void 0:n[E])??E}else o=(n==null?void 0:n[0])??0;const l=4,{width:h,height:c}=this.ctx.canvas,u=t.width*t.height,f=h*c<l*u,p=a?{url:s==="Alpha"?this.filterFactory.addAlphaFilter(n):this.filterFactory.addLuminosityFilter(n),subtype:s,transferMap:n}:null,m=s==="Luminosity"?i:null;let v,A,w;f?(v=this._bakeSMaskCanvas(t,e.offsetX,e.offsetY,h,c,m,p),A=0,w=0):(v=this._bakeSMaskCanvas(t,0,0,t.width,t.height,m,p),A=e.offsetX,w=e.offsetY),this.smaskPreparedEntry=v,this.smaskPreparedFor=e,this.smaskPreparedOffsetX=A,this.smaskPreparedOffsetY=w,this.smaskPreparedOOBAlpha=!f&&o!==0?o:null}_bakeSMaskCanvas(e,t,s,i,n,a,o){!a&&!o&>("_bakeSMaskCanvas with neither backdrop nor filter");const l=this.canvasFactory.create(i,n),h=l.context;if(h.drawImage(e,t,s),a&&(h.globalCompositeOperation="destination-atop",h.fillStyle=a,h.fillRect(0,0,i,n)),!o)return l;const c=this.canvasFactory.create(i,n),u=c.context;u.filter=o.url;const f=Mt.isCanvasFilterSupported&&u.filter!=="none"&&u.filter!=="";if(u.drawImage(l.canvas,0,0),Mt.isCanvasFilterSupported&&(u.filter="none"),!f){const p=u.getImageData(0,0,i,n),{data:m}=p,{transferMap:v}=o;if(o.subtype==="Luminosity")for(let A=0,w=m.length;A<w;A+=4){const S=.3*m[A]+.59*m[A+1]+.11*m[A+2]+.5|0;m[A]=m[A+1]=m[A+2]=0,m[A+3]=(v==null?void 0:v[S])??S}else for(let A=3,w=m.length;A<w;A+=4)m[A]=v[m[A]];u.putImageData(p,0,0)}return this.canvasFactory.destroy(l),c}beginSMaskMode(e){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const{width:t,height:s}=this.ctx.canvas,i=this.canvasFactory.create(t,s);this.smaskScratchCanvas=i,this.suspendedCtx=this.ctx;const n=this.ctx=i.context;n.setTransform(this.suspendedCtx.getTransform()),fa(this.suspendedCtx,n),gv(n,this.suspendedCtx),this._ensurePreparedSMask(this.current.activeSMask),this.setGState(e,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),fa(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null,this._clearPreparedSMask()}compose(e){if(!this.current.activeSMask)return;e=e?[Math.floor(e[0]),Math.floor(e[1]),Math.ceil(e[2]),Math.ceil(e[3])]:[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,s=this.suspendedCtx,i=r(this,Nr)>0&&s===this.ctx;this.composeSMask(i?null:s,t,this.ctx,e),!i&&(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,s,i){const n=i[0],a=i[1],o=i[2]-n,l=i[3]-a;if(o===0||l===0)return;const h=this.smaskPreparedEntry;if(h){let c=n,u=a,f=o,p=l;const m=this.smaskPreparedOOBAlpha,v=m!==null;if(v){c=Math.max(n,t.offsetX),u=Math.max(a,t.offsetY);const A=Math.min(n+o,t.offsetX+t.canvas.width),w=Math.min(a+l,t.offsetY+t.canvas.height);f=A-c,p=w-u}if(f>0&&p>0){const A=c-this.smaskPreparedOffsetX,w=u-this.smaskPreparedOffsetY;s.save(),s.globalAlpha=1,s.setTransform(1,0,0,1,0,0);const S=new Path2D;S.rect(c,u,f,p),s.clip(S),s.globalCompositeOperation="destination-in",s.drawImage(h.canvas,A,w,f,p,c,u,f,p),s.restore()}v&&m<255&&this._applySMaskOOBAlpha(s,n,a,o,l,c,u,c+f,u+p,m)}else this.genericComposeSMask(t,s,o,l,n,a);e&&(e.save(),e.globalAlpha=1,e.globalCompositeOperation=t.blendMode||"source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(s.canvas,n,a,o,l,n,a,o,l),e.restore())}_applySMaskOOBAlpha(e,t,s,i,n,a,o,l,h,c){const u=a<l&&o<h;if(u&&a===t&&o===s&&l===t+i&&h===s+n)return;const f=new Path2D;f.rect(t,s,i,n),u&&f.rect(a,o,l-a,h-o),e.save(),e.globalAlpha=c/255,e.setTransform(1,0,0,1,0,0),e.clip(f,"evenodd"),e.globalCompositeOperation="destination-in",e.fillStyle="#000000",e.fillRect(t,s,i,n),e.restore()}genericComposeSMask(e,t,s,i,n,a){const{context:o,offsetX:l,offsetY:h}=e;t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const c=new Path2D;c.rect(n,a,s,i),t.clip(c),t.globalCompositeOperation="destination-in",t.drawImage(o.canvas,n-l,a-h,s,i,n,a,s,i),t.restore(
47)}save(e){var s;this.inSMaskMode&&fa(this.ctx,this.suspendedCtx),this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone(),(s=this.dependencyTracker)==null||s.save(e)}restore(e){var t;if((t=this.dependencyTracker)==null||t.restore(e),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&(fa(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform())),this.checkSMaskState(e),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,t,s,i,n,a,o){var l;(l=this.dependencyTracker)==null||l.recordIncrementalData("transform",e),this.ctx.transform(t,s,i,n,a,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,s,i){let[n]=s;if(!i){n||(n=s[0]=new Path2D),t!==Di.stroke&&t!==Di.closeStroke&&(this.current.tilingPatternDims=null),this[t](e,n);return}if(this.dependencyTracker!==null){const o=t===Di.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,i[0]-o,i[2]+o,i[1]-o,i[3]+o).recordDependencies(e,["transform"])}n instanceof Path2D||(n=s[0]=Fv(n)),_.axialAlignedBoundingBox(i,Bt(this.ctx),this.current.minMax);const a=this.current.tilingPatternDims;if(a&&t!==Di.stroke&&t!==Di.closeStroke&&this.current.fillColor instanceof Sc){const o=_.intersect(this.current.clipBox,this.current.minMax);o?this.current.fillColor.updatePatternDims(o,a):this.current.tilingPatternDims=null}this[t](e,n),this._pathStartIdx=e}closePath(e){this.ctx.closePath()}stroke(e,t,s=!0){var o;const i=s&&b(this,K,os).call(this,this.current.strokeAlpha),n=this.ctx,a=this.current.strokeColor;if(n.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof a=="object"&&(a!=null&&a.getPattern)){const l=a.isModifyingCurrentTransform()?n.getTransform():null;if(n.save(),n.strokeStyle=a.getPattern(n,this,Ii(n),Le.STROKE,e),l){const h=new Path2D;h.addPath(t,n.getTransform().invertSelf().multiplySelf(l)),t=h}this.rescaleAndStroke(t,!1),n.restore()}else this.rescaleAndStroke(t,!0);(o=this.dependencyTracker)==null||o.recordDependencies(e,$s.stroke),s&&this.consumePath(e,t,this.current.getClippedPathBoundingBox(Le.STROKE,Bt(this.ctx))),n.globalAlpha=this.current.fillAlpha,b(this,K,_e).call(this,i)}closeStroke(e,t){this.stroke(e,t)}fill(e,t,s=!0){var c,u,f;const i=s&&b(this,K,os).call(this,this.current.fillAlpha),n=this.ctx,a=this.current.fillColor,o=this.current.patternFill;let l=!1;const h=this.current.getClippedPathBoundingBox();if((c=this.dependencyTracker)==null||c.recordDependencies(e,$s.fill),o){const p=this.current.tilingPatternDims,m=p&&a.canSkipPatternCanvas(p);if(m){a.drawPattern(this,t,this.pendingEOFill,m,e),this.pendingEOFill=!1,s&&this.consumePath(e,t,h),this.current.tilingPatternDims=null,b(this,K,_e).call(this,i);return}const v=a.isModifyingCurrentTransform()?n.getTransform():null;if((u=this.dependencyTracker)==null||u.save(e),n.save(),n.fillStyle=a.getPattern(n,this,Ii(n),Le.FILL,e),v){const A=new Path2D;A.addPath(t,n.getTransform().invertSelf().multiplySelf(v)),t=A}l=!0}this.contentVisible&&h!==null&&(this.pendingEOFill?(n.fill(t,"evenodd"),this.pendingEOFill=!1):n.fill(t)),l&&(n.restore(),(f=this.dependencyTracker)==null||f.restore(e)),s&&this.consumePath(e,t,h),b(this,K,_e).call(this,i)}eoFill(e,t){this.pendingEOFill=!0,this.fill(e,t)}fillStroke(e,t){const s=b(this,K,os).call(this,Math.min(this.current.fillAlpha,this.current.strokeAlpha));this.fill(e,t,!1),this.stroke(e,t,!1),this.consumePath(e,t),b(this,K,_e).call(this,s)}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){var i;const s=b(this,K,os).call(this,this.current.fillAlpha);this.ctx.fill(t),(i=this.dependencyTracker)==null||i.recordDependencies(e,$s.rawFillPath).recordOperation(e),b(this,K,_e).call(this,s)}clip(e){var t;(t=this.dependencyTracker)==null||t.recordFutureForcedDependency("clipMode",e),this.pendingClip=b0}eoClip(e){var t;(t=this.dependencyTracker)==null||t.recordFutureForcedDependency("clipMode",e),this.pendingClip=Av}beginText(e){var t;this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,
47(t=this.dependencyTracker)==null||t.recordOpenMarker(e).resetIncrementalData("sameLineText").resetIncrementalData("moveText",e)}endText(e){const t=this.pendingTextPaths,s=this.ctx;if(this.dependencyTracker){const{dependencyTracker:i}=this;t!==void 0&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",e),i.recordCloseMarker(e)}if(t!==void 0){const i=new Path2D,n=s.getTransform().invertSelf();for(const{transform:a,x:o,y:l,fontSize:h,path:c}of t)c&&i.addPath(c,new DOMMatrix(a).preMultiplySelf(n).translate(o,l).scale(h,-h));s.clip(i)}delete this.pendingTextPaths}setCharSpacing(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("charSpacing",e),this.current.charSpacing=t}setWordSpacing(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("wordSpacing",e),this.current.wordSpacing=t}setHScale(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("hScale",e),this.current.textHScale=t/100}setLeading(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("leading",e),this.current.leading=-t}setFont(e,t,s){var u,f;(u=this.dependencyTracker)==null||u.recordSimpleData("font",e).recordSimpleDataFromNamed("fontObj",t,e);const i=this.commonObjs.get(t),n=this.current;if(!i)throw new Error(`Can't find font for ${t}`);if(n.fontMatrix=i.fontMatrix||Cp,(n.fontMatrix[0]===0||n.fontMatrix[3]===0)&&st("Invalid font matrix for font "+t),s<0?(s=-s,n.fontDirection=-1):n.fontDirection=1,this.current.font=i,this.current.fontSize=s,i.isType3Font)return;const a=i.loadedName||"sans-serif",o=((f=i.systemFontInfo)==null?void 0:f.css)||`"${a}", ${i.fallbackName}`;let l="normal";i.black?l="900":i.bold&&(l="bold");const h=i.italic?"italic":"normal",c=_t(s,p0,g0);this.current.fontSizeScale=s/c,this.ctx.font=`${h} ${l} ${c}px ${o}`}setTextRenderingMode(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("textRenderingMode",e),this.current.textRenderingMode=t}setTextRise(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("textRise",e),this.current.textRise=t}moveText(e,t,s){var i;(i=this.dependencyTracker)==null||i.resetIncrementalData("sameLineText").recordIncrementalData("moveText",e),this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=s}setLeadingMoveText(e,t,s){this.setLeading(e,-s),this.moveText(e,t,s)}setTextMatrix(e,t){var i;(i=this.dependencyTracker)==null||i.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",e);const{current:s}=this;s.textMatrix=t,s.textMatrixScale=Math.hypot(t[0],t[1]),s.x=s.lineX=0,s.y=s.lineY=0}nextLine(e){var t;this.moveText(e,0,this.current.leading),(t=this.dependencyTracker)==null||t.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??e)}paintChar(e,t,s,i,n,a){var w,S,x,T;const o=this.ctx,l=this.current,h=l.font,c=l.textRenderingMode,u=l.fontSize/l.fontSizeScale,f=c&fe.FILL_STROKE_MASK,p=!!(c&fe.ADD_TO_PATH_FLAG),m=l.patternFill&&!h.missingFile,v=l.patternStroke&&!h.missingFile;let A;if((h.disableFontFace||p||m||v)&&!h.missingFile&&(A=h.getPathGenerator(this.commonObjs,t)),A&&(h.disableFontFace||m||v)){o.save(),o.translate(s,i),o.scale(u,-u),(w=this.dependencyTracker)==null||w.recordCharacterBBox(e,o,h);let E;if(f===fe.FILL||f===fe.FILL_STROKE)if(n){E=o.getTransform(),o.setTransform(...n);const C=b(this,K,vg).call(this,A,E,n);o.fill(C)}else o.fill(A);if(f===fe.STROKE||f===fe.FILL_STROKE)if(a){E||(E=o.getTransform()),o.setTransform(...a);const{a:C,b:P,c:O,d:I}=E,D=_.inverseTransform(a),M=_.transform([C,P,O,I,0,0],D);_.singularValueDecompose2dScale(M,Ns),o.lineWidth*=Math.max(Ns[0],Ns[1])/u,o.stroke(b(this,K,vg).call(this,A,E,a))}else o.lineWidth/=u,o.stroke(A);o.restore()}else(f===fe.FILL||f===fe.FILL_STROKE)&&(o.fillText(t,s,i),(S=this.dependencyTracker)==null||S.recordCharacterBBox(e,o,h,u,s,i,()=>o.measureText(t))),(f===fe.STROKE||f===fe.FILL_STROKE)&&(this.dependencyTracker&&((x=this.dependencyTracker)==null||x.recordCharacterBBox(e,o,h,u,s,i,()=>o.measureText(t)).recordDependencies(e,$s.stroke)),o.strokeText(t,s,i));p&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Bt(o),x:s,y:i,fontSize:u,path:A}),(T=this.dependencyTracker)==null||T.recordCharacterBBox(e,o,h,u,s,i))}get isFontSubpixelAAEnabled(){const e=this.canvasFactory.create(10,
4710),t=e.context;t.scale(1.5,1),t.fillText("I",0,10);const s=t.getImageData(0,0,10,10).data;this.canvasFactory.destroy(e);let i=!1;for(let n=3;n<s.length;n+=4)if(s[n]>0&&s[n]<255){i=!0;break}return Q(this,"isFontSubpixelAAEnabled",i)}showText(e,t){var U,L,B,W;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(e,$s.showText).resetBBox(e),this.current.textRenderingMode&fe.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",e).inheritPendingDependenciesAsFutureForcedDependencies());const s=this.current,i=s.font;if(i.isType3Font){const k=b(this,K,os).call(this,s.fillAlpha);this.showType3Text(e,t),(U=this.dependencyTracker)==null||U.recordShowTextOperation(e),b(this,K,_e).call(this,k);return}const n=s.fontSize;if(n===0){(L=this.dependencyTracker)==null||L.recordOperation(e);return}const a=b(this,K,os).call(this,s.fillAlpha),o=this.ctx,l=s.fontSizeScale,h=s.charSpacing,c=s.wordSpacing,u=s.fontDirection,f=s.textHScale*u,p=t.length,m=i.vertical,v=m?1:-1,A=i.defaultVMetrics,w=n*s.fontMatrix[0],S=s.textRenderingMode===fe.FILL&&!i.disableFontFace&&!s.patternFill;o.save(),s.textMatrix&&o.transform(...s.textMatrix),o.translate(s.x,s.y+s.textRise),u>0?o.scale(f,-1):o.scale(f,1);let x,T;const E=s.textRenderingMode&fe.FILL_STROKE_MASK,C=E===fe.FILL||E===fe.FILL_STROKE,P=E===fe.STROKE||E===fe.FILL_STROKE;let O=s.lineWidth;const I=s.textMatrixScale;if(I===0||O===0?P&&(O=this.getSinglePixelWidth()):O/=I,l!==1&&(o.scale(l,l),O/=l),o.lineWidth=O,C&&s.patternFill){o.save();const k=s.fillColor.getPattern(o,this,Ii(o),Le.FILL,e);x=Bt(o),o.restore(),o.fillStyle=k}if(P&&s.patternStroke){o.save();const k=s.strokeColor.getPattern(o,this,Ii(o),Le.STROKE,e);T=Bt(o),o.restore(),o.strokeStyle=k}if(i.isInvalidPDFjsFont){const k=[];let N=0;for(const z of t)k.push(z.unicode),N+=z.width;const X=k.join("");if(o.fillText(X,0,0),this.dependencyTracker!==null){const z=o.measureText(X);this.dependencyTracker.recordBBox(e,this.ctx,-z.actualBoundingBoxLeft,z.actualBoundingBoxRight,-z.actualBoundingBoxAscent,z.actualBoundingBoxDescent).recordShowTextOperation(e)}s.x+=N*w*f,o.restore(),this.compose(),b(this,K,_e).call(this,a);return}let D=0,M;for(M=0;M<p;++M){const k=t[M];if(typeof k=="number"){D+=v*k*n/1e3;continue}let N=!1;const X=(k.isSpace?c:0)+h,z=k.fontChar,lt=k.accent;let vt,dt,rt=k.width;if(m){const H=k.vmetric||A,F=-(k.vmetric?H[1]:rt*.5)*w,$=H[2]*w;rt=H?-H[0]:rt,vt=F/l,dt=(D+$)/l}else vt=D/l,dt=0;let bt;if(i.remeasure&&rt>0){bt=o.measureText(z);const H=bt.width*1e3/n*l;if(rt<H&&this.isFontSubpixelAAEnabled){const F=rt/H;N=!0,o.save(),o.scale(F,1),vt/=F}else rt!==H&&(vt+=(rt-H)/2e3*n/l)}if(this.contentVisible&&(k.isInFont||i.missingFile)){if(S&&!lt)o.fillText(z,vt,dt),(B=this.dependencyTracker)==null||B.recordCharacterBBox(e,o,bt?{bbox:null}:i,n/l,vt,dt,()=>bt??o.measureText(z));else if(this.paintChar(e,z,vt,dt,x,T),lt){const H=vt+n*lt.offset.x/l,F=dt-n*lt.offset.y/l;this.paintChar(e,lt.fontChar,H,F,x,T)}}const He=m?rt*w-X*u:rt*w+X*u;D+=He,N&&o.restore()}m?s.y-=D:s.x+=D*f,o.restore(),this.compose(),(W=this.dependencyTracker)==null||W.recordShowTextOperation(e),b(this,K,_e).call(this,a)}showType3Text(e,t){const s=this.ctx,i=this.current,n=i.font,a=i.fontSize,o=i.fontDirection,l=n.vertical?1:-1,h=i.charSpacing,c=i.wordSpacing,u=i.textHScale*o,f=i.fontMatrix||Cp,p=t.length,m=i.textRenderingMode===fe.INVISIBLE;let v,A,w,S;if(m||a===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,s.save(),i.textMatrix&&s.transform(...i.textMatrix),s.translate(i.x,i.y+i.textRise),s.scale(u,o);const x=this.dependencyTracker;for(this.dependencyTracker=x?new Pc(x,e):null,v=0;v<p;++v){if(A=t[v],typeof A=="number"){S=l*A*a/1e3,this.ctx.translate(S,0),i.x+=S*u;continue}const T=(A.isSpace?c:0)+h,E=n.charProcOperatorList.get(A.operatorListId);E?this.contentVisible&&(this.save(),E.fnArray[0]===Di.setCharWidth&&(i.fillAlpha=i.strokeAlpha=1,s.globalAlpha=1),s.scale(a,a),s.transform(...f),this.executeOperatorList(E),this.restore()):st(`Type3 character "${A.operatorListId}" is not available.`);const C=[A.width,0];_.applyTransform(C,f),w=C[0]*a+T,s.translate(w,0),i.x+=w*u}
47s.restore(),x&&(this.dependencyTracker=x)}setCharWidth(e,t,s){}setCharWidthAndBounds(e,t,s,i,n,a,o){var h;const l=new Path2D;l.rect(i,n,a-i,o-n),this.ctx.clip(l),(h=this.dependencyTracker)==null||h.recordBBox(e,this.ctx,i,a,n,o).recordClipBox(e,this.ctx,i,a,n,o),this.endPath(e)}getColorN_Pattern(e,t){let s;if(t[0]==="TilingPattern"){const i=this.baseTransform||Bt(this.ctx),n={createCanvasGraphics:(a,o)=>new Aa(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new Pc(this.dependencyTracker,o,!0):null)};s=new Sc(t,this.ctx,n,i)}else s=this._getPattern(e,t[1],t[2]);return s}setStrokeColorN(e,...t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("strokeColor",e),this.current.strokeColor=this.getColorN_Pattern(e,t),this.current.patternStroke=!0}setFillColorN(e,...t){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("fillColor",e);const s=this.current.fillColor=this.getColorN_Pattern(e,t);this.current.patternFill=!0,this.current.tilingPatternDims=s instanceof Sc?[0,0,0,0]:null}setStrokeRGBColor(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor=t,this.current.patternStroke=!1}
47setStrokeTransparent(e){var t;(t=this.dependencyTracker)==null||t.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor=t,this.current.patternFill=!1,this.current.tilingPatternDims=null}setFillTransparent(e){var t;(t=this.dependencyTracker)==null||t.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1,this.current.tilingPatternDims=null}_getPattern(e,t,s=null){const i=this.cachedPatterns.getOrInsertComputed(t,()=>f0(this.getObject(e,t)));return s&&(i.matrix=s),i}shadingFill(e,t){var o;if(!this.contentVisible)return;const s=b(this,K,os).call(this,this.current.fillAlpha),i=this.ctx;this.save(e);const n=this._getPattern(e,t);i.fillStyle=n.getPattern(i,this,Ii(i),Le.SHADING,e);const a=Ii(i);if(a){const{width:l,height:h}=i.canvas,c=Ea.slice();_.axialAlignedBoundingBox([0,0,l,h],a,c);const[u,f,p,m]=c;this.ctx.fillRect(u,f,p-u,m-f)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);(o=this.dependencyTracker)==null||o.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,$s.transform).recordDependencies(e,$s.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e),b(this,K,_e).call(this,s)}beginInlineImage(){gt("Should not call beginInlineImage")}beginImageData(){gt("Should not call beginImageData")}paintFormXObjectBegin(e,t,s){var i;if(this.contentVisible&&(this.save(e),this.baseTransformStack.push(this.baseTransform),t&&this.transform(e,...t),this.baseTransform=Bt(this.ctx),s)){_.axialAlignedBoundingBox(s,this.baseTransform,this.current.minMax);const[n,a,o,l]=s,h=new Path2D;h.rect(n,a,o-n,l-a),this.ctx.clip(h),(i=this.dependencyTracker)==null||i.recordClipBox(e,this.ctx,n,o,a,l),this.endPath(e)}}paintFormXObjectEnd(e){this.contentVisible&&(this.restore(e),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e,t){var T;if(!this.contentVisible)return;this.save(e);const{inSMaskMode:s}=this;s&&(this.endSMaskMode(),this.current.activeSMask=null);const i=this.ctx;if((!t.needsIsolation||!t.isolated&&!t.hasSoftMask)&&!t.knockout&&!t.isGray&&r(this,Ss)===0&&i.globalAlpha===1&&i.globalCompositeOperation==="source-over"&&!s){if(t.bbox){let E=new Path2D;const[C,P,O,I]=t.bbox;if(E.rect(C,P,O-C,I-P),t.matrix){const D=new Path2D;D.addPath(E,new DOMMatrix(t.matrix)),E=D}i.clip(E)}this.groupStack.push(null),r(this,Wi).push(null),this.groupLevel++;return}!t.isolated&&!t.knockout&&r(this,Ss)===0&&np("TODO: Fully support non-isolated non-knockout groups.");const n=Bt(i);t.matrix&&i.transform(...t.matrix);const a=[0,0,i.canvas.width,i.canvas.height];let o;t.bbox?(o=Ea.slice(),_.axialAlignedBoundingBox(t.bbox,Bt(i),o),o=_.intersect(o,a)||[0,0,0,0]):o=a;const l=Math.floor(o[0]),h=Math.floor(o[1]),c=Math.max(Math.ceil(o[2])-l,1),u=Math.max(Math.ceil(o[3])-h,1);this.current.startNewPathAndClipBox([0,0,c,u]);const f=this.canvasFactory.create(c,u);t.smask&&this.smaskGroupCanvases.push(f);const p=f.context,m=t.knockout&&!t.isolated?i:null,v=!t.isolated&&!t.knockout&&!t.smask&&t.needsIsolation&&r(this,Ss)>0,A=t.knockout?this.canvasFactory.create(c,u):null,w=r(this,Ss);t.knockout?Xt(this,Ss)._++:g(this,Ss,0),p.translate(-l,-h),p.transform(...n);const S=!t.isolated&&!t.smask&&t.needsIsolation,x=S&&!s&&w===0&&!t.knockout&&!t.isGray&&t.hasSoftMask&&i.globalAlpha===1&&i.globalCompositeOperation==="source-over"&&this.current.transferMaps==="none";if(S&&(s||x)&&(p.save(),p.setTransform(1,0,0,1,0,0),p.drawImage(i.canvas,-l,-h),p.restore()),t.bbox){let E=new Path2D;const[C,P,O,I]=t.bbox;if(E.rect(C,P,O-C,I-P),t.matrix){const D=new Path2D;D.addPath(E,new DOMMatrix(t.matrix)),E=D}p.clip(E)}t.smask&&this.smaskStack.push({canvas:f.canvas,context:p,offsetX:l,offsetY:h,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null}),(!t.smask||this.dependencyTracker)&&(i.setTransform(1,0,0,1,0,0),i.translate(l,h),i.save()),fa(i,p),this.ctx=p,(T=this.dependencyTracker)==null||T.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(i),this.setGState(e,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]),this.groupStack.push(i),r(this,Wi).push({backdropCtx:m,savedKnockoutLevel:w,offsetX:l,offsetY:h,hasInnerBackdrop:v,replaceBackdrop:x,knockoutMaskEntry:A,knockoutTempEntry:null,knockoutBackdropEntry:null}),this.groupLevel++}endGroup(e,t){var a;if(!this.contentVisible)return;this.groupLevel--;const s=this.ctx,i=this.groupStack.pop(),n=r(this,Wi).pop();if(n&&g(this,Ss,n.savedKnockoutLevel),i===null){this.restore(e);return}if(t.isGray&&b(this,K,My).call(this,s),this.ctx=i,this.ctx.imageSmoothingEnabled=!1,(a=this.dependencyTracker)==null||a.popBaseTransform(),t.smask)this.tempSMask=this.smaskStack.pop(),this.restore(e),this.dependencyTracker&&(this.ctx.restore(
47),this.inSMaskMode&&this.ctx.setTransform(this.suspendedCtx.getTransform())),b(this,K,Wu).call(this,n);else{this.ctx.restore();const o=Bt(this.ctx);this.restore(e),this.ctx.save(),this.ctx.setTransform(...o);const l=Ea.slice();_.axialAlignedBoundingBox([0,0,s.canvas.width,s.canvas.height],o,l);const h=r(this,Wi).at(-1);if(r(this,Ss)>0)if(n.hasInnerBackdrop){const{width:c,height:u}=s.canvas,f=this.canvasFactory.create(c,u),p=f.context;p.drawImage(i.canvas,n.offsetX,n.offsetY,c,u,0,0,c,u),p.globalCompositeOperation="source-over",p.drawImage(s.canvas,0,0);const m=b(this,K,pg).call(this,s.canvas);p.globalCompositeOperation="destination-in",p.drawImage(m.canvas,0,0);const v=this.ctx.globalCompositeOperation,A=this.ctx.globalAlpha,w=this.ctx.filter;this.ctx.save(),this.ctx.setTransform(...o),this.ctx.globalAlpha=1,Mt.isCanvasFilterSupported&&(this.ctx.filter="none"),this.ctx.globalCompositeOperation="destination-out",this.ctx.drawImage(m.canvas,0,0),this.ctx.globalCompositeOperation=v,this.ctx.globalAlpha=A,Mt.isCanvasFilterSupported&&(this.ctx.filter=w??"none"),this.ctx.drawImage(f.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(m),this.canvasFactory.destroy(f)}else{const c=(h==null?void 0:h.backdropCtx)??null;b(this,K,mg).call(this,this.ctx,s.canvas,{backdropCanvas:(c==null?void 0:c.canvas)??null,destTransform:o,backdropOffset:c?[h.offsetX+n.offsetX,h.offsetY+n.offsetY]:[0,0],sourceAlpha:this.ctx.globalAlpha,sourceFilter:this.ctx.filter})}else{if(n.replaceBackdrop){const c=new Path2D;c.rect(0,0,s.canvas.width,s.canvas.height),this.ctx.clip(c),this.ctx.globalCompositeOperation="copy"}this.ctx.drawImage(s.canvas,0,0)}this.ctx.restore(),this.canvasFactory.destroy({canvas:s.canvas,context:s}),b(this,K,Wu).call(this,n),this.compose(l)}}beginAnnotation(e,t,s,i,n,a,o){if(b(this,K,ug).call(this),Pu(this.ctx),this.ctx.save(),this.save(e),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),s){const l=s[2]-s[0],h=s[3]-s[1];if(a&&this.annotationCanvasMap){i=i.slice(),i[4]-=s[0],i[5]-=s[1],_.singularValueDecompose2dScale(Bt(this.ctx),Ns);const{viewportScale:c}=this,u=Math.ceil(l*this.outputScaleX*c),f=Math.ceil(h*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(u,f);const{canvas:p,context:m}=this.annotationCanvas;if(o){const v=this.annotationCanvasMap.getOrInsertComputed(t,Wh);p.setAttribute("data-canvas-name",o);const A=v.findIndex(w=>w.getAttribute("data-canvas-name")===o);A===-1?v.push(p):v[A]=p}else this.annotationCanvasMap.set(t,p);this.annotationCanvas.savedCtx=this.ctx,this.ctx=m,this.ctx.save(),this.ctx.setTransform(Ns[0],0,0,-Ns[1],0,h*Ns[1]),Pu(this.ctx)}else{Pu(this.ctx),this.endPath(e);const c=new Path2D;c.rect(s[0],s[1],l,h),this.ctx.clip(c)}}this.current=new mv(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(e,...i),this.transform(e,...n),this.baseTransform=Bt(this.ctx)}endAnnotation(e){this.annotationCanvas&&(this.ctx.restore(),b(this,K,fg).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas),this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(e,t){var l;if(!this.contentVisible)return;const s=t.count;t=this.getObject(e,t.data,t),t.count=s;const i=b(this,K,os).call(this,this.current.fillAlpha),n=this.ctx,a=this._createMaskCanvas(e,t),o=a.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(o,a.offsetX,a.offsetY),(l=this.dependencyTracker)==null||l.resetBBox(e).recordBBox(e,this.ctx,a.offsetX,a.offsetX+o.width,a.offsetY,a.offsetY+o.height).recordOperation(e),n.restore(),a.canvasEntry&&this.canvasFactory.destroy(a.canvasEntry),this.compose(),b(this,K,_e).call(this,i)}paintImageMaskXObjectRepeat(e,t,s,i=0,n=0,a,o){var f,p,m;if(!this.contentVisible)return;t=this.getObject(e,t.data,t);const l=b(this,K,os).call(this,this.current.fillAlpha),h=this.ctx;h.save();const c=Bt(h);h.transform(s,i,n,a,0,0);const u=this._createMaskCanvas(e,t);h.setTransform(1,0,0,1,u.offsetX-c[4],u.offsetY-c[5]),(f=this.dependencyTracker)==null||f.resetBBox(e);for(let v=0,A=o.length;v<A;v+=2){const w=_.transform(c,[s,i,n,a,o[v],o[v+1]]);h.drawImage(u.canvas,w[4],w[5]),(p=this.dependencyTracker)==null||p.recordBBox(e,this.ctx,w[4],w[4]+u.canvas.width,w[5],w[5]+u.canvas.height)}
47h.restore(),u.canvasEntry&&this.canvasFactory.destroy(u.canvasEntry),this.compose(),(m=this.dependencyTracker)==null||m.recordOperation(e),b(this,K,_e).call(this,l)}paintImageMaskXObjectGroup(e,t){var o,l,h;if(!this.contentVisible)return;const s=b(this,K,os).call(this,this.current.fillAlpha),i=this.ctx,n=this.current.fillColor,a=this.current.patternFill;(o=this.dependencyTracker)==null||o.resetBBox(e).recordDependencies(e,$s.transformAndFill);for(const c of t){const{data:u,width:f,height:p,transform:m}=c,v=this.canvasFactory.create(f,p),A=v.context;A.save();const w=this.getObject(e,u,c);yv(A,w),A.globalCompositeOperation="source-in",A.fillStyle=a?n.getPattern(A,this,Ii(i),Le.FILL,e):n,A.fillRect(0,0,f,p),A.restore(),i.save(),i.transform(...m),i.scale(1,-1),Cu(i,v.canvas,0,0,f,p,0,-1,1,1),this.canvasFactory.destroy(v),(l=this.dependencyTracker)==null||l.recordBBox(e,i,0,f,0,p),i.restore()}this.compose(),(h=this.dependencyTracker)==null||h.recordOperation(e),b(this,K,_e).call(this,s)}paintImageXObject(e,t){if(!this.contentVisible)return;const s=this.getObject(e,t);if(!s){st("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e,s)}paintImageXObjectRepeat(e,t,s,i,n){if(!this.contentVisible)return;const a=this.getObject(e,t);if(!a){st("Dependent image isn't ready yet");return}const o=a.width,l=a.height,h=[];for(let c=0,u=n.length;c<u;c+=2)h.push({transform:[s,0,0,i,n[c],n[c+1]],x:0,y:0,w:o,h:l});this.paintInlineImageXObjectGroup(e,a,h)}applyTransferMapsToCanvas(e){return this.current.transferMaps!=="none"&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return{img:e.bitmap,canvasEntry:null};const{bitmap:t,width:s,height:i}=e,n=this.canvasFactory.create(s,i),a=n.context;return a.filter=this.current.transferMaps,a.drawImage(t,0,0),a.filter="none",{img:n.canvas,canvasEntry:n}}paintInlineImageXObject(e,t){var u;if(!this.contentVisible)return;const s=t.width,i=t.height,n=b(this,K,os).call(this,this.current.fillAlpha),a=this.ctx;this.save(e);const{filter:o}=a;o!=="none"&&o!==""&&(a.filter="none"),a.scale(1/s,-1/i);let l,h=null;if(t.bitmap){const f=this.applyTransferMapsToBitmap(t);l=f.img,h=f.canvasEntry}else{const f=this.canvasFactory.create(s,i);vv(f.context,t),l=this.applyTransferMapsToCanvas(f.context),h=f}const c=this._scaleImage(l,Ii(a));a.imageSmoothingEnabled=bv(Bt(a),t.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(e).recordBBox(e,a,0,s,-i,0).recordDependencies(e,$s.imageXObject).recordOperation(e),(u=this.imagesTracker)==null||u.record(a,s,i,this.dependencyTracker.clipBox)),Cu(a,c.img,0,0,c.paintWidth,c.paintHeight,0,-i,s,i),c.tmpCanvas&&this.canvasFactory.destroy(c.tmpCanvas),h&&this.canvasFactory.destroy(h),this.compose(),this.restore(e),b(this,K,_e).call(this,n)}paintInlineImageXObjectGroup(e,t,s){var l,h,c;if(!this.contentVisible)return;const i=b(this,K,os).call(this,this.current.fillAlpha),n=this.ctx;let a,o=null;if(t.bitmap)a=t.bitmap;else{const u=t.width,f=t.height,p=this.canvasFactory.create(u,f);vv(p.context,t),a=this.applyTransferMapsToCanvas(p.context),o=p}(l=this.dependencyTracker)==null||l.resetBBox(e);for(const u of s)n.save(),n.transform(...u.transform),n.scale(1,-1),Cu(n,a,u.x,u.y,u.w,u.h,0,-1,1,1),(h=this.dependencyTracker)==null||h.recordBBox(e,n,0,1,-1,0),n.restore();o&&this.canvasFactory.destroy(o),(c=this.dependencyTracker)==null||c.recordOperation(e),this.compose(),b(this,K,_e).call(this,i)}paintSolidColorImageMask(e){var s;if(!this.contentVisible)return;const t=b(this,K,os).call(this,this.current.fillAlpha);(s=this.dependencyTracker)==null||s.resetBBox(e).recordBBox(e,this.ctx,0,1,0,1).recordDependencies(e,$s.fill).recordOperation(e),this.ctx.fillRect(0,0,1,1),this.compose(),b(this,K,_e).call(this,t)}markPoint(e,t){}markPointProps(e,t,s){}beginMarkedContent(e,t){var s;(s=this.dependencyTracker)==null||s.beginMarkedContent(e),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t,s){var i;(i=this.dependencyTracker)==null||i.beginMarkedContent(e),t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(s)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(e){var t;(t=this.dependencyTracker)==null||t.endMarkedContent(e),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(e){}endCompat(e){}consumePath(e,t,s){var a,o;const i=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(s);const n=this.ctx;this.pendingClip?(i||(this.pendingClip===Av?n.clip(t,"evenodd"):n.clip(t)),this.pendingClip=null,(a=this.dependencyTracker)==null||a.bboxToClipBoxDropOperation(e).recordFutureForcedDependency("clipPath",e)):(o=this.dependencyTracker)==null||o.recordOperation(e),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=Bt(this.ctx);if(e[1]===0&&e[2]===0)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]),s=Math.hypot(e[0],e[2]),i=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(s,i)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:t,b:s,c:i,d:n}=this.ctx.getTransform();let a,o;if(s===0&&i===0){const l=Math.abs(t),h=Math.abs(n);if(l===h)if(e===0)a=o=1/l;else{const c=l*e;a=o=c<1?1/c:1}else if(e===0)a=1/l,o=1/h;else{const c=l*e,u=h*e;a=c<1?1/c:1,o=u<1?1/u:1}}else{const l=Math.abs(t*n-s*i),h=Math.hypot(t,s),c=Math.hypot(i,n);if(e===0)a=c/l,o=h/l;else{const u=e*l;a=c>u?c/u:1,o=h>u?h/u:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(e,t){const{ctx:s,current:{lineWidth:i}}=this,[n,a]=this.getScaleForStroking();if(n===a){s.lineWidth=(i||1)*n,s.stroke(e);return}const o=r(Aa,jf)??g(Aa,jf,new DOMMatrix),l=s.getLineDash();t&&s.save(),s.scale(n,a),o.a=1/n,o.d=1/a;const h=new Path2D;if(h.addPath(e,o),l.length>0){const c=Math.max(n,a);
47s.setLineDash(l.map(u=>u/c)),s.lineDashOffset/=c}s.lineWidth=i||1,s.stroke(h),t&&s.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};jf=new WeakMap,Ss=new WeakMap,Nr=new WeakMap,so=new WeakMap,io=new WeakMap,no=new WeakMap,ro=new WeakMap,ao=new WeakMap,oo=new WeakMap,lo=new WeakMap,Wi=new WeakMap,K=new WeakSet,ug=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),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)},fg=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}},pg=function(e,t=null,s=1){const{width:i,height:n}=e,a=t??this.canvasFactory.create(i,n),o=a.context;s=Math.round(s*255)/255;const l=s<1;l&&r(this,oo)===void 0&&g(this,oo,Mt.isCanvasFilterSupported?new Map:"none");let h="none";if(l&&r(this,oo)instanceof Map&&(h=r(this,oo).getOrInsertComputed(s,()=>this.filterFactory.addKnockoutFilter(s))),!l||h!=="none")return t&&(o.save(),o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,i,n),o.restore()),o.filter=h,o.drawImage(e,0,0),o.filter="none",a;const c=e.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,i,n),u=o.createImageData(i,n),f=c.data,p=u.data,m=s>0?1/s:1e6;for(let v=3,A=f.length;v<A;v+=4)p[v]=Math.min(Math.round(f[v]*m),255);return o.putImageData(u,0,0),a},gg=function(e,t,s,i){let n=(e==null?void 0:e[t])??null;if(n&&(n.canvas.width!==s||n.canvas.height!==i)&&(this.canvasFactory.destroy(n),n=null),!n)return n=this.canvasFactory.create(s,i),e&&(e[t]=n),n;const a=n.context;return a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,s,i),a.restore(),n},mg=function(e,t,s={}){const{backdropCanvas:i=null,destTransform:n=[1,0,0,1,0,0],backdropOffset:a=[0,0],reuseMaskEntry:o=null,poolMeta:l=null,sourceAlpha:h=1,sourceFilter:c="none",knockoutAlpha:u=1}=s,{width:f,height:p}=t,m=b(this,K,pg).call(this,t,o,u),v=e.globalCompositeOperation;if(e.save(),e.setTransform(...n),e.globalAlpha=1,Mt.isCanvasFilterSupported&&(e.filter="none"),e.globalCompositeOperation="destination-out",e.drawImage(m.canvas,0,0),i){const[A,w]=a,S=b(this,K,gg).call(this,l,"knockoutBackdropEntry",f,p),x=S.context;x.drawImage(i,A,w,f,p,0,0,f,p),x.globalCompositeOperation="destination-in",x.drawImage(m.canvas,0,0),x.globalCompositeOperation="source-over",e.globalCompositeOperation="destination-over",e.drawImage(S.canvas,0,0),l||this.canvasFactory.destroy(S)}e.globalCompositeOperation=v,e.globalAlpha=h,Mt.isCanvasFilterSupported&&(e.filter=c??"none"),e.drawImage(t,0,0),e.restore(),o||this.canvasFactory.destroy(m)},os=function(e=1){if(r(this,Ss)===0||r(this,Nr)>0||!this.contentVisible)return!1;Xt(this,Nr)._++,g(this,ao,e);const t=r(this,Wi).at(-1),{canvas:s}=this.ctx,i=b(this,K,gg).call(this,t,"knockoutTempEntry",s.width,s.height);g(this,so,i);const n=i.context;return n.save(),n.setTransform(this.ctx.getTransform()),fa(this.ctx,n),g(this,ro,n.globalCompositeOperation),n.globalCompositeOperation="source-over",gv(n,this.ctx),g(this,lo,t),g(this,io,this.ctx),g(this,no,this.suspendedCtx),this.ctx=n,this.inSMaskMode&&(this.suspendedCtx=n),!0},_e=function(e){var l;if(!e)return;const t=r(this,so),s=r(this,io),i=r(this,no),n=t.context;g(this,so,null),g(this,io,null),g(this,no,null),this.inSMaskMode&&this.suspendedCtx===n&&this.ctx!==n&&this.endSMaskMode(),this.inSMaskMode&&(this.suspendedCtx=i),this.ctx._removeMirroring(),this.ctx.globalCompositeOperation=r(this,ro),g(this,ro,null),fa(this.ctx,s),this.ctx=s;const a=r(this,lo);g(this,lo,null);const o=r(this,ao);g(this,ao,1);try{b(this,K,mg).call(this,i??s,t.canvas,{backdropCanvas:((l=a==null?void 0:a.backdropCtx)==null?void 0:l.canvas)??null,backdropOffset:a!=null&&a.backdropCtx?[a.offsetX,a.offsetY]:[0,0],reuseMaskEntry:(a==null?void 0:a.knockoutMaskEntry)??null,poolMeta:a,
47knockoutAlpha:o})}finally{n.restore(),Xt(this,Nr)._--,a||this.canvasFactory.destroy(t)}},vg=function(e,t,s){const i=new Path2D;return i.addPath(e,new DOMMatrix(s).invertSelf().multiplySelf(t)),i},My=function(e){const{canvas:t}=e,{width:s,height:i}=t;if(Mt.isCanvasFilterSupported){e.save(),e.setTransform(1,0,0,1,0,0),e.filter="grayscale(1)",e.globalAlpha=1,e.globalCompositeOperation="copy",e.drawImage(t,0,0),e.restore();return}const n=e.getImageData(0,0,s,i),{data:a}=n;for(let o=0,l=a.length;o<l;o+=4){const h=a[o]*.2126+a[o+1]*.7152+a[o+2]*.0722+.5|0;a[o]=a[o+1]=a[o+2]=h}e.putImageData(n,0,0)},Wu=function(e){e&&(e.knockoutMaskEntry&&(this.canvasFactory.destroy(e.knockoutMaskEntry),e.knockoutMaskEntry=null),e.knockoutTempEntry&&(this.canvasFactory.destroy(e.knockoutTempEntry),e.knockoutTempEntry=null),e.knockoutBackdropEntry&&(this.canvasFactory.destroy(e.knockoutBackdropEntry),e.knockoutBackdropEntry=null))},y(Aa,jf,null);let gl=Aa;for(const d in Di)gl.prototype[d]!==void 0&&(gl.prototype[Di[d]]=gl.prototype[d]);var cd,dd;class lp{constructor(e,t,s){y(this,cd,null);y(this,dd,null);R(this,"_fullReader",null);R(this,"_rangeReaders",new Set);R(this,"_source",null);this._source=e,g(this,cd,t),g(this,dd,s)}get _progressiveDataLength(){var e;return((e=this._fullReader)==null?void 0:e._loaded)??0}getFullReader(){return qt(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new(r(this,cd))(this)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const s=new(r(this,dd))(this,e,t);return this._rangeReaders.add(s),s}cancelAllRequests(e){var t;(t=this._fullReader)==null||t.cancel(e);for(const s of new Set(this._rangeReaders))s.cancel(e)}}cd=new WeakMap,dd=new WeakMap;class hp{constructor(e){R(this,"onProgress",null);R(this,"_contentLength",0);R(this,"_filename",null);R(this,"_headersCapability",Promise.withResolvers());R(this,"_isRangeSupported",!1);R(this,"_isStreamingSupported",!1);R(this,"_loaded",0);R(this,"_stream",null);this._stream=e}_callOnProgress(){var e;(e=this.onProgress)==null||e.call(this,{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(){gt("Abstract method `read` called")}cancel(e){gt("Abstract method `cancel` called")}}class cp{constructor(e,t,s){R(this,"_stream",null);this._stream=e}async read(){gt("Abstract method `read` called")}cancel(e){gt("Abstract method `cancel` called")}}function A0(d){let e=!0,t=s("filename\\*","i").exec(d);if(t){t=t[1];let c=o(t);return c=unescape(c),c=l(c),c=h(c),n(c)}if(t=a(d),t){const c=h(t);return n(c)}if(t=s("filename","i").exec(d),t){t=t[1];let c=o(t);return c=h(c),n(c)}function s(c,u){return new RegExp("(?:^|;)\\s*"+c+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',u)}function i(c,u){if(c){if(!/^[\x00-\xFF]+$/.test(u))return u;try{const f=new TextDecoder(c,{fatal:!0}),p=rp(u);u=f.decode(p),e=!1}catch{}}return u}function n(c){return e&&/[\x80-\xff]/.test(c)&&(c=i("utf-8",c),e&&(c=i("iso-8859-1",c))),c}function a(c){const u=[];let f;const p=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=p.exec(c))!==null;){let[,v,A,w]=f;if(v=parseInt(v,10),v in u){if(v===0)break;continue}u[v]=[A,w]}const m=[];for(let v=0;v<u.length&&v in u;++v){let[A,w]=u[v];w=o(w),A&&(w=unescape(w),v===0&&(w=l(w))),m.push(w)}return m.join("")}function o(c){if(c.startsWith('"')){const u=c.slice(1).split('\\"');for(let f=0;f<u.length;++f){const p=u[f].indexOf('"');p!==-1&&(u[f]=u[f].slice(0,p),u.length=f+1),u[f]=u[f].replaceAll(/\\(.)/g,"$1")}c=u.join('"')}return c}function l(c){const u=c.indexOf("'");if(u===-1)return c;const f=c.slice(0,u),m=c.slice(u+1).replace(/^[^']*'/,"");return i(f,m)}function h(c){return!c.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(c)?c:c.replaceAll(/=\?([\w-]*)\?([QB])\?((?:[^?]|\?(?!=))*)\?=/gi,function(u,f,p,m){if(p==="q"||p==="Q")return m=m.replaceAll("_"," "),m=m.replaceAll(/=([0-9a-f]{2})/gi,function(v,A){return String.fromCharCode(parseInt(A,16))}),i(f,m);try{m=atob(m)}catch{}return i(f,m)})}return""}function Ry(d,e){const t=new Headers;if(!d||!e||typeof e!="object")return t;for(const s in e){const i=e[s];i!==void 0&&t.append(s,i)}return t}function w0(d){let e=d.length;for(;e>0&&d[e-1]!==" "&&/\s/.test(d[e-1]);)e--;return d.slice(0,e)}function dp(d){var e;return((e=URL.parse(d))==null?void 0:e.origin)??null}function Dy({responseHeaders:d,isHttp:e,rangeChunkSize:t,disableRange:s}){const i={contentLength:0,isRangeSupported:!1},n=parseInt(d.get("Content-Length"),10);return!Number.isInteger(n)||(i.contentLength=n,n<=2*t)||s||!e||d.get("Accept-Ranges")!=="bytes"||(d.get("Content-Encoding")||"identity")==="identity"&&(i.isRangeSupported=!0),i}function ky(d){const e=d.get("Content-Disposition");if(e){let t=A0(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(Pm(t))return t}return null}
47function up(d,e){return new Af(`Unexpected server response (${d}) while retrieving PDF "${e.href}".`,d,d===404||d===0&&e.protocol==="file:")}function Fy(d,e){if(d!==e)throw new Error(`Expected range response-origin "${d}" to match "${e}".`)}function Ly(d,e,t,s){return fetch(d,{method:"GET",headers:e,signal:s.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"})}function Ny(d,e){if(d!==200&&d!==206)throw up(d,e)}function fp(d){if(d instanceof Uint8Array)return d.buffer;if(d instanceof ArrayBuffer)return d;throw new Error(`getArrayBuffer - unexpected data: ${d}`)}class S0 extends lp{constructor(t){super(t,E0,x0);R(this,"_responseOrigin",null);const{httpHeaders:s,url:i}=t;qt(/https?:/.test(i.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=Ry(!0,s)}}class E0 extends hp{constructor(t){super(t);R(this,"_abortController",new AbortController);R(this,"_reader",null);const{disableRange:s,disableStream:i,rangeChunkSize:n,url:a,withCredentials:o}=t._source;this._isStreamingSupported=!i;const l=new Headers(t.headers);Ly(a,l,o,this._abortController).then(h=>{t._responseOrigin=dp(h.url),Ny(h.status,a),this._reader=h.body.getReader();const c=h.headers,{contentLength:u,isRangeSupported:f}=Dy({responseHeaders:c,isHttp:!0,rangeChunkSize:n,disableRange:s});this._contentLength=u,this._isRangeSupported=f,this._filename=ky(c),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new da("Streaming is disabled.")),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;const{value:t,done:s}=await this._reader.read();return s?{value:t,done:s}:(this._loaded+=t.byteLength,this._callOnProgress(),{value:fp(t),done:!1})}cancel(t){var s;(s=this._reader)==null||s.cancel(t),this._abortController.abort()}}class x0 extends cp{constructor(t,s,i){super(t,s,i);R(this,"_abortController",new AbortController);R(this,"_readCapability",Promise.withResolvers());R(this,"_reader",null);const{url:n,withCredentials:a}=t._source,o=new Headers(t.headers);o.append("Range",`bytes=${s}-${i-1}`),Ly(n,o,a,this._abortController).then(l=>{const h=dp(l.url);Fy(h,t._responseOrigin),Ny(l.status,n),this._reader=l.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;const{value:t,done:s}=await this._reader.read();return s?{value:t,done:s}:{value:fp(t),done:!1}}cancel(t){var s;(s=this._reader)==null||s.cancel(t),this._abortController.abort()}}function wv(d){return d instanceof Uint8Array&&d.byteLength===d.buffer.byteLength?d.buffer:new Uint8Array(d).buffer}function pp(){for(const d of this._requests)d.resolve({value:void 0,done:!0});this._requests.length=0}var $f,By;class T0 extends lp{constructor(t){super(t,C0,P0);y(this,$f);R(this,"_progressiveDone",!1);R(this,"_queuedChunks",[]);const{pdfDataRangeTransport:s}=t,{initialData:i,progressiveDone:n}=s;if((i==null?void 0:i.length)>0){const o=wv(i);this._queuedChunks.push(o)}this._progressiveDone=n;const a=o=>{var l;switch(o.type){case"range":case"progressiveRead":b(this,$f,By).call(this,o.begin,o.chunk);break;case"progressiveDone":(l=this._fullReader)==null||l.progressiveDone(),this._progressiveDone=!0;break}};s.transportReady(a)}getFullReader(){const t=super.getFullReader();return this._queuedChunks=null,t}getRangeReader(t,s){const i=super.getRangeReader(t,s);return i&&(i.onDone=()=>this._rangeReaders.delete(i),this._source.pdfDataRangeTransport.requestDataRange(t,s)),i}cancelAllRequests(t){super.cancelAllRequests(t),this._source.pdfDataRangeTransport.abort()}}$f=new WeakSet,By=function(t,s){const i=wv(s);if(t===void 0)this._fullReader?this._fullReader._enqueue(i):this._queuedChunks.push(i);else{const n=this._rangeReaders.keys().find(a=>a._begin===t);qt(n,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),n._enqueue(i)}};var ud;class C0 extends hp{constructor(t){super(t);y(this,ud,pp.bind(this));R(this,"_done",!1);R(this,"_queuedChunks",null);R(this,"_requests",[]);const{pdfDataRangeTransport:s,disableRange:i,disableStream:n}=t._source,{length:a,contentDispositionFilename:o}=s;this._queuedChunks=t._queuedChunks||[];for(const h of this._queuedChunks)this._loaded+=h.byteLength;this._done=t._progressiveDone,this._contentLength=a,this._isStreamingSupported=!n,this._isRangeSupported=!i,Pm(o)&&(this._filename=o),this._headersCapability.resolve();const l=this._loaded;Promise.resolve().then(()=>{l>0&&this._loaded===l&&this._callOnProgress()})}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.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 t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,r(this,ud).call(this)}progressiveDone(){this._done||(this._done=!0),this._queuedChunks.length===0&&r(this,ud).call(this)}}ud=new WeakMap;var fd;class P0 extends cp{constructor(t,s,i){super(t,s,i);y(this,fd,pp.bind(this));R(this,"onDone",null);R(this,"_begin",-1);R(this,"_done",!1);R(this,"_queuedChunk",null);R(this,"_requests",[]);this._begin=s}_enqueue(t){var s;this._done||(this._requests.length===0?this._queuedChunk=t:(this._requests.shift().resolve({value:t,done:!1}),r(this,fd).call(this)),this._done=!0,(s=this.onDone)==null||s.call(this))}async read(){if(this._queuedChunk){const s=this._queuedChunk;return this._queuedChunk=null,{value:s,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){var s;this._done=!0,r(this,fd).call(this),(s=this.onDone)==null||s.call(this)}}fd=new WeakMap;const xp=200,Sv=206;function I0(d){return typeof d!="string"?d:rp(d).buffer}var Xi,zh,Uy,Hy;class O0 extends lp{constructor(t){super(t,M0,R0);y(this,zh);y(this,Xi,new WeakMap);R(this,"_responseOrigin",null);const{httpHeaders:s,url:i}=t;this.url=i,this.isHttp=/https?:/.test(i.protocol),this.headers=Ry(this.isHttp,s)}_request(t){const s=new XMLHttpRequest,i={validateStatus:null,onHeadersReceived:t.onHeadersReceived,onDone:t.onDone,onError:t.onError,onProgress:t.onProgress};r(this,Xi).set(s,i),s.open("GET",this.url),s.withCredentials=this._source.withCredentials;for(const[n,a]of this.headers)s.setRequestHeader(n,a);return this.isHttp&&"begin"in t&&"end"in t?(s.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.validateStatus=n=>n===Sv||n===xp):i.validateStatus=n=>n===xp,s.responseType="arraybuffer",qt(t.onError,"Expected `onError` callback to be provided."),s.onerror=()=>t.onError(s.status),s.onreadystatechange=b(this,zh,Hy).bind(this,s),s.onprogress=b(this,zh,Uy).bind(this,s),s.send(null),s}
47_abortRequest(t){r(this,Xi).has(t)&&(r(this,Xi).delete(t),t.abort())}getRangeReader(t,s){const i=super.getRangeReader(t,s);return i&&(i.onClosed=()=>this._rangeReaders.delete(i)),i}}Xi=new WeakMap,zh=new WeakSet,Uy=function(t,s){var n;const i=r(this,Xi).get(t);(n=i==null?void 0:i.onProgress)==null||n.call(i,s)},Hy=function(t,s){const i=r(this,Xi).get(t);if(!i||(t.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),t.readyState!==4)||!r(this,Xi).has(t))return;if(r(this,Xi).delete(t),t.status===0&&this.isHttp){i.onError(t.status);return}const n=t.status||xp;if(!i.validateStatus(n)){i.onError(t.status);return}const a=I0(t.response);if(n===Sv){const o=t.getResponseHeader("Content-Range");/bytes \d+-\d+\/\d+/.test(o)?i.onDone(a):(st('Missing or invalid "Content-Range" header.'),i.onError(0))}else a?i.onDone(a):i.onError(t.status)};var pd,hn,_y,jy,$y,Gy;class M0 extends hp{constructor(t){super(t);y(this,hn);y(this,pd,pp.bind(this));R(this,"_cachedChunks",[]);R(this,"_done",!1);R(this,"_requests",[]);R(this,"_storedError",null);this._fullRequestXhr=t._request({onHeadersReceived:b(this,hn,_y).bind(this),onDone:b(this,hn,jy).bind(this),onError:b(this,hn,$y).bind(this),onProgress:b(this,hn,Gy).bind(this)})}async read(){if(await this._headersCapability.promise,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 t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t),r(this,pd).call(this),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}}pd=new WeakMap,hn=new WeakSet,_y=function(){const t=this._stream,{disableRange:s,rangeChunkSize:i}=t._source,n=this._fullRequestXhr;t._responseOrigin=dp(n.responseURL);const a=n.getAllResponseHeaders(),o=new Headers(a?w0(a.trimStart()).split(/[\r\n]+/).map(c=>{const[u,...f]=c.split(": ");return[u,f.join(": ")]}):[]),{contentLength:l,isRangeSupported:h}=Dy({responseHeaders:o,isHttp:t.isHttp,rangeChunkSize:i,disableRange:s});this._contentLength=l,this._isRangeSupported=h,this._filename=ky(o),this._isRangeSupported&&t._abortRequest(n),this._headersCapability.resolve()},jy=function(t){this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._cachedChunks.push(t),this._done=!0,this._cachedChunks.length===0&&r(this,pd).call(this)},$y=function(t){this._storedError=up(t,this._stream.url),this._headersCapability.reject(this._storedError);for(const s of this._requests)s.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0},Gy=function(t){var s;(s=this.onProgress)==null||s.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})};var gd,sr,Vy,zy,yg;class R0 extends cp{constructor(t,s,i){super(t,s,i);y(this,sr);y(this,gd,pp.bind(this));R(this,"onClosed",null);R(this,"_done",!1);R(this,"_queuedChunk",null);R(this,"_requests",[]);R(this,"_storedError",null);this._requestXhr=t._request({begin:s,end:i,onHeadersReceived:b(this,sr,Vy).bind(this),onDone:b(this,sr,zy).bind(this),onError:b(this,sr,yg).bind(this),onProgress:null})}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const s=this._queuedChunk;return this._queuedChunk=null,{value:s,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){var s;this._done=!0,r(this,gd).call(this),this._stream._abortRequest(this._requestXhr),(s=this.onClosed)==null||s.call(this)}}gd=new WeakMap,sr=new WeakSet,Vy=function(){var s;const t=dp((s=this._requestXhr)==null?void 0:s.responseURL);try{Fy(t,this._stream._responseOrigin)}catch(i){this._storedError=i,b(this,sr,yg).call(this,0)}},zy=function(t){var s;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0,r(this,gd).call(this),(s=this.onClosed)==null||s.call(this)},yg=function(t){this._storedError??(this._storedError=up(t,this._stream.url));for(const s of this._requests)s.reject(this._storedError);this._requests.length=0,this._queuedChunk=null};function Wy(d,e=null){const t=process.getBuiltinModule("fs"),{Readable:s}=process.getBuiltinModule("stream"),i=t.createReadStream(d,e);return s.toWeb(i)}class D0 extends lp{constructor(e){super(e,k0,F0);const{url:t}=e;qt(t.protocol==="file:","PDFNodeStream only supports file:// URLs.")}}class k0 extends hp{constructor(t){super(t);R(this,"_reader",null);const{disableRange:s,disableStream:i,rangeChunkSize:n,url:a}=t._source;this._isStreamingSupported=!i,process.getBuiltinModule("fs/promises").lstat(a).then(l=>{const h=Wy(a);this._reader=h.getReader();const{size:c}=l;this._contentLength=c,this._isRangeSupported=!s&&c>2*n,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new da("Streaming is disabled.")),this._headersCapability.resolve()}).catch(l=>{l.code==="ENOENT"&&(l=up(0,a)),this._headersCapability.reject(l)})}async read(){await this._headersCapability.promise;const{value:t,done:s}=await this._reader.read();return s?{value:t,done:s}:(this._loaded+=t.byteLength,this._callOnProgress(),{value:fp(t),done:!1})}cancel(t){var s;(s=this._reader)==null||s.cancel(t)}}class F0 extends cp{constructor(t,s,i){super(t,s,i);R(this,"_readCapability",Promise.withResolvers());R(this,"_reader",null);const{url:n}=t._source;try{const a=Wy(n,{start:s,end:i-1});this._reader=a.getReader(),this._readCapability.resolve()}catch(a){this._readCapability.reject(a)}}async read(){await this._readCapability.promise;const{value:t,done:s}=await this._reader.read();return s?{value:t,done:s}:{value:fp(t),done:!1}}cancel(t){var s;(s=this._reader)==null||s.cancel(t)}}function L0(d){return wc(d)?S0:Ls?D0:O0}var md,vd;class on{static get workerPort(){return r(this,md)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");g(this,md,e)}static get workerSrc(){return r(this,vd)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");g(this,vd,e)}}md=new WeakMap,vd=new WeakMap,y(on,md,null),y(on,vd,"");var Kl,yd;class N0{constructor({parsedData:e,rawData:t}){y(this,Kl);y(this,yd);g(this,Kl,e),g(this,yd,t)}getRaw(){return r(this,yd)}get(e){return r(this,Kl).get(e)??null}[Symbol.iterator](){return r(this,Kl).entries()}}Kl=new WeakMap,yd=new WeakMap;const ma=Symbol("INTERNAL");var bd,Ad,Jl,ho;class B0{constructor(e,{name:t,intent:s,usage:i,rbGroups:n}){y(this,bd,!1);
47y(this,Ad,!1);y(this,Jl,!1);y(this,ho,!0);g(this,bd,!!(e&Fs.DISPLAY)),g(this,Ad,!!(e&Fs.PRINT)),this.name=t,this.intent=s,this.usage=i,this.rbGroups=n}get visible(){if(r(this,Jl))return r(this,ho);if(!r(this,ho))return!1;const{print:e,view:t}=this.usage;return r(this,bd)?(t==null?void 0:t.viewState)!=="OFF":r(this,Ad)?(e==null?void 0:e.printState)!=="OFF":!0}_setVisible(e,t,s=!1){e!==ma&>("Internal method `_setVisible` called."),g(this,Jl,s),g(this,ho,t)}get serializable(){return{userSet:r(this,Jl),visible:r(this,ho)}}}bd=new WeakMap,Ad=new WeakMap,Jl=new WeakMap,ho=new WeakMap;var Br,At,Ql,Zl,wd,Sd,Ag;const Hm=class Hm{constructor(e,t=Fs.DISPLAY,s=null){y(this,Sd);y(this,Br,null);y(this,At,new Map);y(this,Ql,null);y(this,Zl,null);y(this,wd);R(this,"creator",null);R(this,"name",null);if(g(this,wd,e),this.renderingIntent=t,e!==null){this.name=e.name,this.creator=e.creator,g(this,Zl,e.order);for(const i of e.groups)r(this,At).set(i.id,new B0(t,i));if(s){s.size!==r(this,At).size&>("Incorrect serialized groupState.");for(const[i,n]of s)r(this,At).get(i)._setVisible(ma,n.visible,n.userSet)}else{if(e.baseState==="OFF")for(const i of r(this,At).values())i._setVisible(ma,!1);for(const i of e.on)r(this,At).get(i)._setVisible(ma,!0);for(const i of e.off)r(this,At).get(i)._setVisible(ma,!1)}g(this,Ql,this.getHash())}}isVisible(e){if(r(this,At).size===0)return!0;if(!e)return np("Optional content group not defined."),!0;if(e.type==="OCG")return r(this,At).has(e.id)?r(this,At).get(e.id).visible:(st(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return b(this,Sd,Ag).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const t of e.ids){if(!r(this,At).has(t))return st(`Optional content group not found: ${t}`),!0;if(r(this,At).get(t).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const t of e.ids){if(!r(this,At).has(t))return st(`Optional content group not found: ${t}`),!0;if(!r(this,At).get(t).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const t of e.ids){if(!r(this,At).has(t))return st(`Optional content group not found: ${t}`),!0;if(!r(this,At).get(t).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const t of e.ids){if(!r(this,At).has(t))return st(`Optional content group not found: ${t}`),!0;if(r(this,At).get(t).visible)return!1}return!0}return st(`Unknown optional content policy ${e.policy}.`),!0}return st(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,s=!0){var n;const i=r(this,At).get(e);if(!i){st(`Optional content group not found: ${e}`);return}if(s&&t&&i.rbGroups.length)for(const a of i.rbGroups)for(const o of a)o!==e&&((n=r(this,At).get(o))==null||n._setVisible(ma,!1,!0));i._setVisible(ma,!!t,!0),g(this,Br,null)}setOCGState({state:e,preserveRB:t}){let s;for(const i of e){switch(i){case"ON":case"OFF":case"Toggle":s=i;continue}const n=r(this,At).get(i);if(n)switch(s){case"ON":this.setVisibility(i,!0,t);break;case"OFF":this.setVisibility(i,!1,t);break;case"Toggle":this.setVisibility(i,!n.visible,t);break}}g(this,Br,null)}get hasInitialVisibility(){return r(this,Ql)===null||this.getHash()===r(this,Ql)}getOrder(){return r(this,At).size?r(this,Zl)?r(this,Zl).slice():[...r(this,At).keys()]:null}getGroup(e){return r(this,At).get(e)||null}getHash(){if(r(this,Br)!==null)return r(this,Br);const e=new ig;for(const[t,s]of r(this,At))e.update(`${t}:${s.visible}`);return g(this,Br,e.hexdigest())}[Symbol.iterator](){return r(this,At).entries()}get serializable(){const e=new Map;for(const[t,s]of r(this,At))e.set(t,s.serializable);return{data:r(this,wd),renderingIntent:this.renderingIntent,groupState:e}}static fromSerializable({data:e,renderingIntent:t,groupState:s}){return new Hm(e,t,s)}};Br=new WeakMap,At=new WeakMap,Ql=new WeakMap,Zl=new WeakMap,wd=new WeakMap,Sd=new WeakSet,Ag=function(e){const t=e.length;if(t<2)return!0;const s=e[0];for(let i=1;i<t;i++){const n=e[i];let a;if(Array.isArray(n))a=b(this,Sd,Ag).call(this,n);else if(r(this,At).has(n))a=r(this,At).get(n).visible;else return st(`Optional content group not found: ${n}`),!0;switch(s){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return s==="And"};let bg=Hm;var Qt,Zs,pe,co,Yi,Ue,uc,Xu,wg,Sg;class U0{constructor(){y(this,Ue);y(this,Qt,null);y(this,Zs,null);y(this,pe,0);y(this,co,null);y(this,Yi,null)}get pagesNumber(){return r(this,pe)}set pagesNumber(e){r(this,pe)!==e&&(g(this,pe,e),g(this,Qt,null),g(this,Zs,null))}
47movePages(e,t,s){b(this,Ue,uc).call(this);const i=r(this,Qt),n=t.length,a=new Uint32Array(n);let o=0;for(let f=0;f<n;f++){const p=t[f]-1;a[f]=i[p],p<s&&o++}const l=r(this,pe),h=l-n,c=new Int32Array(l),u=_t(s-o,0,h);for(let f=0,p=0;f<l;f++)e.has(f+1)||(i[p]=i[f],c[p++]=f+1);i.copyWithin(u+n,u,h),i.set(a,u),c.copyWithin(u+n,u,h),c.set(t,u),g(this,Zs,c),i.every((f,p)=>f===p+1)&&g(this,Qt,null)}deletePages(e){b(this,Ue,uc).call(this);const t=r(this,Qt),s=b(this,Ue,Xu).call(this);g(this,Yi,{pageNumberToId:t.slice(),pagesNumber:r(this,pe),prevPageNumbers:r(this,Zs).slice()});const i=r(this,pe)-e.length;g(this,pe,i);const n=g(this,Qt,new Uint32Array(i));g(this,Zs,new Int32Array(i));let a=0,o=0;for(const l of e){const h=l-1;h!==a&&(n.set(t.subarray(a,h),o),o+=h-a),a=h+1}a<t.length&&n.set(t.subarray(a),o),b(this,Ue,wg).call(this,s,new Set(e))}cancelDelete(){r(this,Yi)&&(g(this,Qt,r(this,Yi).pageNumberToId),g(this,pe,r(this,Yi).pagesNumber),g(this,Zs,r(this,Yi).prevPageNumbers),g(this,Yi,null))}cleanSavedData(){g(this,Yi,null)}copyPages(e){b(this,Ue,uc).call(this),g(this,co,{pageNumbers:e,pageIds:e.map(t=>r(this,Qt)[t-1])})}cancelCopy(){g(this,co,null)}pastePages(e){b(this,Ue,uc).call(this);const t=r(this,Qt),s=b(this,Ue,Xu).call(this),{pageNumbers:i,pageIds:n}=r(this,co),a=r(this,pe)+i.length;g(this,pe,a);const o=g(this,Qt,new Uint32Array(a));g(this,Zs,new Int32Array(a)),o.set(t.subarray(0,e),0),o.set(n,e),o.set(t.subarray(e),e+i.length),b(this,Ue,wg).call(this,s,null,e,i),g(this,co,null)}hasBeenAltered(){return r(this,Qt)!==null}getPageMappingForSaving(e=null,t=b(this,Ue,Sg).call(this)){e??(e=b(this,Ue,Xu).call(this));let s=0;for(const n of e.values())s=Math.max(s,n.length);const i=new Array(s);for(let n=0;n<s;n++)i[n]={document:null,pageIndices:[],includePages:[]};for(const[n,a]of e)for(let o=0,l=a.length;o<l;o++)i[o].includePages.push([n-1,a[o]-1]);for(const{includePages:n,pageIndices:a}of i){n.sort((o,l)=>o[0]-l[0]);for(let o=0,l=n.length;o<l;o++)a.push(n[o][1]),n[o]=n[o][0]}return{pageInfos:i,copyLevels:t}}extractPages(e){e=Array.from(e).sort((s,i)=>s-i);const t=new Map;for(let s=0,i=e.length;s<i;s++){const n=this.getPageId(e[s]);t.getOrInsertComputed(n,Wh).push(s+1)}return this.getPageMappingForSaving(t,b(this,Ue,Sg).call(this,e))}getPrevPageNumber(e){var t;return((t=r(this,Zs))==null?void 0:t[e-1])??0}getPageNumber(e){if(!r(this,Qt))return e;const t=r(this,Qt);for(let s=0,i=r(this,pe);s<i;s++)if(t[s]===e)return s+1;return 0}getPageId(e){var t;return((t=r(this,Qt))==null?void 0:t[e-1])??e}getMapping(){var e;return(e=r(this,Qt))==null?void 0:e.subarray(0,this.pagesNumber)}}Qt=new WeakMap,Zs=new WeakMap,pe=new WeakMap,co=new WeakMap,Yi=new WeakMap,Ue=new WeakSet,uc=function(){if(r(this,Qt))return;const e=r(this,pe),t=g(this,Qt,new Uint32Array(e));for(let s=0;s<e;s++)t[s]=s+1;g(this,Zs,new Int32Array(t))},Xu=function(){const e=new Map,t=r(this,Qt);for(let s=0,i=r(this,pe);s<i;s++){const n=t[s],a=e.get(n);a?a.push(s+1):e.set(n,[s+1])}return e},wg=function(e,t=null,s=-1,i=null){const n=r(this,Zs),a=r(this,Qt),o=s+((i==null?void 0:i.length)??0),l=new Map;for(let h=0,c=r(this,pe);h<c;h++){if(h>=s&&h<o){n[h]=-i[h-s];continue}const u=a[h],f=e.get(u);let p=l.get(u)||0;if(t&&f)for(;p<f.length&&t.has(f[p]);)p++;n[h]=f==null?void 0:f[p],l.set(u,p+1)}},Sg=function(e=null){if(!r(this,Qt))return null;const t=new Int32Array(r(this,pe)).fill(-1),s=new Map;if(e)for(const i of e){const n=this.getPageId(i),a=s.get(n)??0;s.set(n,a+1),t[i-1]=a}else for(let i=0,n=r(this,pe);i<n;i++){const a=r(this,Qt)[i],o=s.get(a)??0;s.set(a,o+1),t[i]=o}return t};const hl=Symbol("INITIAL_DATA"),Ev=()=>({...Promise.withResolvers(),data:hl});var qs;class Xy{constructor(){y(this,qs,new Map)}get(e,t=null){if(t){const i=r(this,qs).getOrInsertComputed(e,Ev);return i.promise.then(()=>t(i.data)),null}const s=r(this,qs).get(e);if(!s||s.data===hl)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return s.data}has(e){const t=r(this,qs).get(e);return!!t&&t.data!==hl}delete(e){const t=r(this,qs).get(e);return!t||t.data===hl?!1:(r(this,qs).delete(e),!0)}resolve(e,t=null){const s=r(this,qs).getOrInsertComputed(e,Ev);if(s.data!==hl)throw new Error(`Object already resolved ${e}.`);s.data=t,s.resolve()}clear(){var e;
47for(const{data:t}of r(this,qs).values())(e=t==null?void 0:t.bitmap)==null||e.close();r(this,qs).clear()}*[Symbol.iterator](){for(const[e,{data:t}]of r(this,qs))t!==hl&&(yield[e,t])}}qs=new WeakMap;const H0=1e5,xv=30;var Ov,Ur,qe,Ed,xd,ql,uo,Rn,Td,Cd,fo,Pd,th,Hr,eh,Id,sh,po,Od,Md,ih,go,Rd,nh,rh,ir,Yy,Ky,Eg,Us,Yu,xg,Jy,Qy;const Oe=class Oe{constructor({textContentSource:e,images:t,container:s,viewport:i}){y(this,ir);y(this,Ur,Promise.withResolvers());y(this,qe,null);y(this,Ed,!1);y(this,xd,!!((Ov=globalThis.FontInspector)!=null&&Ov.enabled));y(this,ql,null);y(this,uo,null);y(this,Rn,null);y(this,Td,0);y(this,Cd,0);y(this,fo,null);y(this,Pd,null);y(this,th,0);y(this,Hr,0);y(this,eh,Object.create(null));y(this,Id,[]);y(this,sh,null);y(this,po,[]);y(this,Od,new WeakMap);y(this,Md,null);var h;if(e instanceof ReadableStream)g(this,sh,e);else if(typeof e=="object")g(this,sh,new ReadableStream({start(c){c.enqueue(e),c.close()}}));else throw new Error('No "textContentSource" parameter specified.');g(this,qe,g(this,Pd,s)),g(this,ql,t),g(this,Hr,i.scale*Ci.pixelRatio),g(this,th,i.rotation),g(this,Rn,{div:null,properties:null,ctx:null});const{pageWidth:n,pageHeight:a,pageX:o,pageY:l}=i.rawDims;g(this,Md,[1,0,0,-1,-o,l+a]),g(this,Cd,n),g(this,Td,a),b(h=Oe,Us,Jy).call(h),s.style.setProperty("--min-font-size",r(Oe,nh)),Qo(s,i),r(this,Ur).promise.finally(()=>{r(Oe,rh).delete(this),g(this,Rn,null),g(this,eh,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=Mt.platform;return Q(this,"fontFamilyMap",new Map([["sans-serif",`${e&&t?"Calibri, ":""}sans-serif`],["monospace",`${e&&t?"Lucida Console, ":""}monospace`]]))}render(){r(this,ql)&&r(this,qe).append(r(this,ql).render());const e=()=>{r(this,fo).read().then(({value:t,done:s})=>{if(s){r(this,Ur).resolve();return}r(this,uo)??g(this,uo,t.lang),Object.assign(r(this,eh),t.styles),b(this,ir,Yy).call(this,t.items),e()},r(this,Ur).reject)};return g(this,fo,r(this,sh).getReader()),r(Oe,rh).add(this),e(),r(this,Ur).promise}update({viewport:e,onBefore:t=null}){var n;const s=e.scale*Ci.pixelRatio,i=e.rotation;if(i!==r(this,th)&&(t==null||t(),g(this,th,i),Qo(r(this,Pd),{rotation:i})),s!==r(this,Hr)){t==null||t(),g(this,Hr,s);const a={div:null,properties:null,ctx:b(n=Oe,Us,Yu).call(n,r(this,uo))};for(const o of r(this,po))a.properties=r(this,Od).get(o),a.div=o,b(this,ir,Eg).call(this,a)}}cancel(){var t;const e=new da("TextLayer task cancelled.");(t=r(this,fo))==null||t.cancel(e).catch(()=>{}),g(this,fo,null),r(this,Ur).reject(e)}get textDivs(){return r(this,po)}get textContentItemsStr(){return r(this,Id)}static cleanup(){if(!(r(this,rh).size>0)){r(this,ih).clear();for(const{canvas:e}of r(this,go).values())e.remove();r(this,go).clear()}}};Ur=new WeakMap,qe=new WeakMap,Ed=new WeakMap,xd=new WeakMap,ql=new WeakMap,uo=new WeakMap,Rn=new WeakMap,Td=new WeakMap,Cd=new WeakMap,fo=new WeakMap,Pd=new WeakMap,th=new WeakMap,Hr=new WeakMap,eh=new WeakMap,Id=new WeakMap,sh=new WeakMap,po=new WeakMap,Od=new WeakMap,Md=new WeakMap,ih=new WeakMap,go=new WeakMap,Rd=new WeakMap,nh=new WeakMap,rh=new WeakMap,ir=new WeakSet,Yy=function(e){var i,n;if(r(this,Ed))return;(n=r(this,Rn)).ctx??(n.ctx=b(i=Oe,Us,Yu).call(i,r(this,uo)));const t=r(this,po),s=r(this,Id);for(const a of e){if(t.length>H0){st("Ignoring additional textDivs for performance reasons."),g(this,Ed,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const o=r(this,qe);g(this,qe,document.createElement("span")),r(this,qe).classList.add("markedContent"),a.id&&r(this,qe).setAttribute("id",a.id),a.tag==="Artifact"&&(r(this,qe).ariaHidden=!0),o.append(r(this,qe))}else a.type==="endMarkedContent"&&g(this,qe,r(this,qe).parentNode);continue}s.push(a.str),b(this,ir,Ky).call(this,a)}},Ky=function(e){var m;const t=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};r(this,po).push(t);const i=_.transform(r(this,Md),e.transform);let n=Math.atan2(i[1],i[0]);const a=r(this,eh)[e.fontName];a.vertical&&(n+=Math.PI/2);let o=r(this,xd)&&a.fontSubstitution||a.fontFamily;o=Oe.fontFamilyMap.get(o)||o;const l=Math.hypot(i[2],i[3]),h=l*b(m=Oe,Us,Qy).call(m,o,a,r(this,uo));let c,u;n===0?(c=i[4],u=i[5]-h):(c=i[4]+h*Math.sin(n),u=i[5]-h*Math.cos(n));const f=t.style;f.left=`${(100*c/r(this,Cd)).toFixed(2)}
47%`,f.top=`${(100*u/r(this,Td)).toFixed(2)}%`,f.setProperty("--font-height",`${l.toFixed(2)}px`),f.fontFamily=o,s.fontSize=l,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,r(this,xd)&&(t.dataset.fontName=a.fontSubstitutionLoadedName||e.fontName),n!==0&&(s.angle=n*(180/Math.PI));let p=!1;if(e.str.length>1)p=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const v=Math.abs(e.transform[0]),A=Math.abs(e.transform[3]);v!==A&&Math.max(v,A)/Math.min(v,A)>1.5&&(p=!0)}if(p&&(s.canvasWidth=a.vertical?e.height:e.width),r(this,Od).set(t,s),r(this,Rn).div=t,r(this,Rn).properties=s,b(this,ir,Eg).call(this,r(this,Rn)),s.hasText&&r(this,qe).append(t),s.hasEOL){const v=document.createElement("br");v.setAttribute("role","presentation"),r(this,qe).append(v)}},Eg=function(e){var a;const{div:t,properties:s,ctx:i}=e,{style:n}=t;if(s.canvasWidth!==0&&s.hasText){const{fontFamily:o}=n,{canvasWidth:l,fontSize:h}=s;b(a=Oe,Us,xg).call(a,i,h*r(this,Hr),o);const{width:c}=i.measureText(t.textContent);c>0&&n.setProperty("--scale-x",l*r(this,Hr)/c)}s.angle!==0&&n.setProperty("--rotate",`${s.angle}deg`)},Us=new WeakSet,Yu=function(e=null){let t=r(this,go).get(e||(e=""));if(!t){const s=document.createElement("canvas");s.style.cssText="position:absolute;top:0;left:0;width:0;height:0;display:none;letter-spacing:normal;word-spacing:normal",s.lang=e,document.body.append(s),t=s.getContext("2d",{alpha:!1,willReadFrequently:!0}),r(this,go).set(e,t),r(this,Rd).set(t,{size:0,family:""})}return t},xg=function(e,t,s){const i=r(this,Rd).get(e);t===i.size&&s===i.family||(e.font=`${t}px ${s}`,i.size=t,i.family=s)},Jy=function(){if(r(this,nh)!==null)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),g(this,nh,e.getBoundingClientRect().height),e.remove()},Qy=function(e,t,s){const i=r(this,ih).get(e);if(i)return i;const n=b(this,Us,Yu).call(this,s);n.canvas.width=n.canvas.height=xv,b(this,Us,xg).call(this,n,xv,e);const a=n.measureText(""),o=a.fontBoundingBoxAscent,l=Math.abs(a.fontBoundingBoxDescent);n.canvas.width=n.canvas.height=0;let h=.8;return o?h=o/(o+l):(Mt.platform.isFirefox&&st("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),t.ascent?h=t.ascent:t.descent&&(h=1+t.descent)),r(this,ih).set(e,h),h},y(Oe,Us),y(Oe,ih,new Map),y(Oe,go,new Map),y(Oe,Rd,new WeakMap),y(Oe,nh,null),y(Oe,rh,new Set);let Ic=Oe;const _0=100;function Zy(d={}){const e=new Tg,{docId:t}=e,s=d.url?zA(d.url):null,i=d.data?WA(d.data):null,n=d.httpHeaders||null,a=d.withCredentials===!0,o=d.password??null,l=d.range instanceof qy?d.range:null,h=Number.isInteger(d.rangeChunkSize)&&d.rangeChunkSize>0?d.rangeChunkSize:2**16;let c=d.worker instanceof Oc?d.worker:null;const u=d.verbosity,f=typeof d.docBaseUrl=="string"&&!ap(d.docBaseUrl)?d.docBaseUrl:null,p=xu(d.cMapUrl),m=d.cMapPacked!==!1,v=xu(d.iccUrl),A=xu(d.standardFontDataUrl),w=xu(d.wasmUrl),S=d.stopAtErrors!==!0,x=Number.isInteger(d.maxImageSize)&&d.maxImageSize>-1?d.maxImageSize:-1,T=typeof d.isOffscreenCanvasSupported=="boolean"?d.isOffscreenCanvasSupported:!Ls,E=typeof d.isImageDecoderSupported=="boolean"?d.isImageDecoderSupported:!Ls,C=Number.isInteger(d.canvasMaxAreaInBytes)?d.canvasMaxAreaInBytes:-1,P=typeof d.disableFontFace=="boolean"?d.disableFontFace:Ls,O=d.fontExtraProperties===!0,I=d.enableXfa===!0,D=d.ownerDocument||globalThis.document,M=d.disableRange===!0,U=d.disableStream===!0,L=d.disableAutoFetch===!0,B=d.pdfBug===!0,W=d.CanvasFactory||(Ls?t0:JA),k=d.FilterFactory||(Ls?qA:QA),N=d.BinaryDataFactory||(Ls?e0:uv),X=d.enableHWA===!0,lt=d.enableWebGPU===!0?r0():Promise.resolve(!1),vt=d.useWasm!==!1,dt=d.pagesMapper||new U0,rt=typeof d.useSystemFonts=="boolean"?d.useSystemFonts:!Ls&&!P,bt=typeof d.useWorkerFetch=="boolean"?d.useWorkerFetch:!!(N===uv&&p&&m&&A&&w&&wc(p,document.baseURI)&&wc(A,document.baseURI)&&wc(w,document.baseURI)),He=null;cA(u);const H={canvasFactory:new W({ownerDocument:D,enableHWA:X}),filterFactory:new k({docId:t,ownerDocument:D}),binaryDataFactory:bt?null:new N({cMapUrl:p,standardFontDataUrl:A,wasmUrl:w})};c||(c=Oc.create({verbosity:u,port:on.workerPort}),e._worker=c);const F={docId:t,apiVersion:"6.3.289",data:i,password:o,disableAutoFetch:L,rangeChunkSize:h,docBaseUrl:f,enableXfa:I,evaluatorOptions:{maxImageSize:x,disableFontFace:P,ignoreErrors:S,isOffscreenCanvasSupported:T,isImageDecoderSupported:E,canvasMaxAreaInBytes:C,fontExtraProperties:O,useSystemFonts:rt,useWasm:vt,useWorkerFetch:bt,cMapUrl:p,cMapPacked:m,iccUrl:v,standardFontDataUrl:A,wasmUrl:w,hasGPU:!1}},$={ownerDocument:D,pdfBug:B,styleElement:He,enableHWA:X,loadingParams:{disableAutoFetch:L,enableXfa:I}};return Promise.all([c.promise,lt]).then(function([,it]){if(c.destroyed)throw new Error("Worker was destroyed");F.evaluatorOptions.hasGPU=it;
47const yt=c.messageHandler.sendWithPromise("GetDocRequest",F,i?[i.buffer]:null);let q;if(!i)if(l)q=new T0({pdfDataRangeTransport:l,disableRange:M,disableStream:U});else if(s){const ut=L0(s);q=new ut({url:s,httpHeaders:n,withCredentials:a,rangeChunkSize:h,disableRange:M,disableStream:U})}else throw new Error("getDocument - expected either `data`, `range`, or `url` parameter.");return yt.then(ut=>{if(c.destroyed)throw new Error("Worker was destroyed");const kt=new oc(t,ut,c.port),Pe=new $0(kt,e,q,$,H,dt);if(e._transport=Pe,e.destroyed)throw new Error("Loading aborted");kt.send("Ready",null)})}).catch(e._capability.reject).finally(e._setupCapability.resolve),e}var Gf;const Vf=class Vf{constructor(){R(this,"_capability",Promise.withResolvers());R(this,"_setupCapability",Promise.withResolvers());R(this,"_transport",null);R(this,"_worker",null);R(this,"docId",`d${Xt(Vf,Gf)._++}`);R(this,"destroyed",!1);R(this,"onPassword",null);R(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var e,t,s,i;this.destroyed=!0,this._capability.promise.catch(()=>{});try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await this._setupCapability.promise,await((t=this._transport)==null?void 0:t.destroy())}catch(n){throw(s=this._worker)!=null&&s.port&&delete this._worker._pendingDestroy,n}this._transport=null,(i=this._worker)==null||i.destroy(),this._worker=null}async getData(){return this._transport.getData()}};Gf=new WeakMap,y(Vf,Gf,0);let Tg=Vf;var ah,mo;class qy{constructor(e,t,s=!1,i=null){y(this,ah,Promise.withResolvers());y(this,mo,null);this.length=e,this.initialData=t,this.progressiveDone=s,this.contentDispositionFilename=i}onDataRange(e,t){r(this,mo).call(this,{type:"range",begin:e,chunk:t})}onDataProgressiveRead(e){r(this,ah).promise.then(()=>{r(this,mo).call(this,{type:"progressiveRead",chunk:e})})}onDataProgressiveDone(){r(this,ah).promise.then(()=>{r(this,mo).call(this,{type:"progressiveDone"})})}transportReady(e){g(this,mo,e),r(this,ah).resolve()}requestDataRange(e,t){gt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}ah=new WeakMap,mo=new WeakMap;class j0{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 Q(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)}
47getDestinations(){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()}getAttachmentContent(e){return this._transport.getAttachmentContent(e)}getAnnotationsByType(e,t){return this._transport.getAnnotationsByType(e,t)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){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(){return this._transport.saveDocument()}extractPages(e,t=null){return this._transport.extractPages(e,t)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}getSignatures(){return this._transport.getSignatures()}getSignatureData(e){return this._transport.getSignatureData(e)}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var Dn,vo,yo,fc;const _m=class _m{constructor(e,t,s,i,n=!1){y(this,yo);y(this,Dn,!1);y(this,vo,null);this._pageIndex=e,this._pageInfo=t,this._transport=s,this._stats=n?new Zm:null,this._pdfBug=n,this.commonObjs=s.commonObjs,this.objs=new Xy,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,g(this,vo,i),this.imageCoordinates=null}clone(e){const t=new _m(e,this._pageInfo,this._transport,r(this,vo),this._pdfBug);return t.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(t),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({scale:e,rotation:t=this.rotate,offsetX:s=0,offsetY:i=0,dontFlip:n=!1}={}){return new yu({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:s,offsetY:i,dontFlip:n})}getAnnotations({intent:e="display"}={}){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 Q(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var e;return((e=this._transport._htmlForXfa)==null?void 0:e.children[this._pageIndex])||null}render({canvasContext:e,canvas:t=e.canvas,viewport:s,intent:i="display",annotationMode:n=rr.ENABLE,transform:a=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:h=null,pageColors:c=null,printAnnotationStorage:u=null,isEditing:f=!1,recordImages:p=!1,recordOperations:m=!1,operationsFilter:v=null}){var L,B,W;(L=this._stats)==null||L.time("Overall");const A=this._transport.getRenderingIntent(i,n,u,f),{renderingIntent:w,cacheKey:S}=A;g(this,Dn,!1),l||(l=this._transport.getOptionalContentConfig(w));const x=this._intentStates.getOrInsertComputed(S,Rp);x.streamReaderCancelTimeout&&(clearTimeout(x.streamReaderCancelTimeout),x.streamReaderCancelTimeout=null);const T=!!(w&Fs.PRINT);x.displayReadyCapability||(x.displayReadyCapability=Promise.withResolvers(),x.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(B=this._stats)==null||B.time("Page Request"),this._pumpOperatorList(A));const E=!!(this._pdfBug&&((W=globalThis.StepperManager)!=null&&W.enabled)),C=!!t&&!this.recordedBBoxes&&(m||E),P=!!t&&!this.imageCoordinates&&p,O=k=>{var N,X,z,lt;if(x.renderTasks.delete(M),C){const vt=(N=M.gfx)==null?void 0:N.dependencyTracker.take();vt&&((X=M.stepper)==null||X.setOperatorBBoxes(vt,M.gfx.dependencyTracker.takeDebugMetadata()),m&&(this.recordedBBoxes=vt))}P&&!k&&(this.imageCoordinates=(z=M.gfx)==null?void 0:z.imagesTracker.take()),T&&g(this,Dn,!0),b(this,yo,fc).call(this),k?(M.capability.reject(k),this._abortOperatorList({intentState:x,reason:k instanceof Error?k:new Error(k)})):M.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(lt=globalThis.Stats)!=null&<.enabled&&globalThis.Stats.add(this.pageNumber,this._stats)
47)};let I=null,D=null;(C||P)&&(D=new LA(t,x.operatorList.length)),C&&(I=new NA(D,E));const M=new Pg({callback:O,params:{canvas:t,canvasContext:e,dependencyTracker:I??D,imagesTracker:P?new ag(t):null,viewport:s,transform:a,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:h,operatorList:x.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!T,pdfBug:this._pdfBug,pageColors:c,enableHWA:this._transport.enableHWA,operationsFilter:v});(x.renderTasks||(x.renderTasks=new Set)).add(M);const U=M.task;return Promise.all([x.displayReadyCapability.promise,l]).then(([k,N])=>{var X;if(this.destroyed){O();return}if((X=this._stats)==null||X.time("Rendering"),!(N.renderingIntent&w))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");M.initializeGraphics({transparency:k,optionalContentConfig:N}),M.operatorListChanged()}).catch(O),U}getOperatorList({intent:e="display",annotationMode:t=rr.ENABLE,printAnnotationStorage:s=null,isEditing:i=!1}={}){var h;function n(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}const a=this._transport.getRenderingIntent(e,t,s,i,!0),o=this._intentStates.getOrInsertComputed(a.cacheKey,Rp);let l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=n,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(h=this._stats)==null||h.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:r(this,vo).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size(i){return i.items.length}})}async getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(i=>Tc.textContent(i));const t=this.streamTextContent(e),s={items:[],styles:Object.create(null),lang:null};for await(const i of t)s.lang??(s.lang=i.lang),Object.assign(s.styles,i.styles),s.items.push(...i.items);return s}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const s of t.renderTasks)e.push(s.completed),s.cancel();return this.objs.clear(),g(this,Dn,!1),Promise.all(e)}cleanup(e=!1){g(this,Dn,!0);const t=b(this,yo,fc).call(this);return e&&t&&this._stats&&(this._stats=new Zm),t}_startRenderPage(e,t){var i,n;const s=this._intentStates.get(t);s&&((i=this._stats)==null||i.timeEnd("Page Request"),(n=s.displayReadyCapability)==null||n.resolve(e))}_renderPageChunk(e,t){for(let s=0,i=e.length;s<i;s++)t.operatorList.fnArray.push(e.fnArray[s]),t.operatorList.argsArray.push(e.argsArray[s]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const s of t.renderTasks)s.operatorListChanged();e.lastChunk&&b(this,yo,fc).call(this)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:s,modifiedIds:i}){const{map:n,transfer:a}=s,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:r(this,vo).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:n,modifiedIds:i},void 0,a).getReader(),h=this._intentStates.get(t);h.streamReader=l;const c=()=>{l.read().then(({value:u,done:f})=>{if(f){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(u,h),c())},u=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const f of h.renderTasks)f.operatorListChanged();b(this,yo,fc).call(this)}if(h.displayReadyCapability)h.displayReadyCapability.reject(u);else if(h.opListReadCapability)h.opListReadCapability.reject(u);else throw u}})};c()}_abortOperatorList({intentState:e,reason:t,force:s=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!s){if(e.renderTasks.size>0)return;if(t instanceof Cm){let i=_0;t.extraDelay>0&&t.extraDelay<1e3&&(i+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},i);return}}if(e.streamReader.cancel(new da(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[i,n]of this._intentStates)if(n===e){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}};Dn=new WeakMap,vo=new WeakMap,yo=new WeakSet,fc=function(){if(!r(this,Dn)||this.destroyed)return!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),g(this,Dn,!1),!0};let Cg=_m;
47var _r,mi,kn,bo,zf,Ao,wo,rs,Ku,tb,eb,pc,oh,Ju;const te=class te{constructor({name:e=null,port:t=null,verbosity:s=dA()}={}){y(this,rs);y(this,_r,Promise.withResolvers());y(this,mi,null);y(this,kn,null);y(this,bo,null);if(this.name=e,this.destroyed=!1,this.verbosity=s,t){if(r(te,wo).has(t))throw new Error("Cannot use more than one PDFWorker per port.");r(te,wo).set(t,this),b(this,rs,tb).call(this,t)}else b(this,rs,eb).call(this)}get promise(){return r(this,_r).promise}get port(){return r(this,kn)}get messageHandler(){return r(this,mi)}destroy(){var e,t;this.destroyed=!0,(e=r(this,bo))==null||e.terminate(),g(this,bo,null),r(te,wo).delete(r(this,kn)),g(this,kn,null),(t=r(this,mi))==null||t.destroy(),g(this,mi,null)}static create(e){const t=r(this,wo).get(e==null?void 0: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 te(e)}static get workerSrc(){if(on.workerSrc)return on.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Q(this,"_setupFakeWorkerGlobal",(async()=>r(this,oh,Ju)?r(this,oh,Ju):(await import(this.workerSrc)).WorkerMessageHandler)())}};_r=new WeakMap,mi=new WeakMap,kn=new WeakMap,bo=new WeakMap,zf=new WeakMap,Ao=new WeakMap,wo=new WeakMap,rs=new WeakSet,Ku=function(){r(this,_r).resolve(),r(this,mi).send("configure",{verbosity:this.verbosity})},tb=function(e){g(this,kn,e),g(this,mi,new oc("main","worker",e)),r(this,mi).on("ready",()=>{}),b(this,rs,Ku).call(this)},eb=function(){if(r(te,Ao)||r(te,oh,Ju)){b(this,rs,pc).call(this);return}let{workerSrc:e}=te;try{te._isSameOrigin(window.location,e)||(e=te._createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e,{type:"module"}),s=new oc("main","worker",t),i=()=>{n.abort(),s.destroy(),t.terminate(),this.destroyed?r(this,_r).reject(new Error("Worker was destroyed")):b(this,rs,pc).call(this)},n=new AbortController;t.addEventListener("error",()=>{r(this,bo)||i()},{signal:n.signal}),s.on("test",o=>{if(n.abort(),this.destroyed||!o){i();return}g(this,mi,s),g(this,kn,t),g(this,bo,t),b(this,rs,Ku).call(this)}),s.on("ready",o=>{if(n.abort(),this.destroyed){i();return}try{a()}catch{b(this,rs,pc).call(this)}});const a=()=>{const o=new Uint8Array;s.send("test",o,[o.buffer])};a();return}catch{np("The worker has been disabled.")}b(this,rs,pc).call(this)},pc=function(){r(te,Ao)||(st("Setting up fake worker."),g(te,Ao,!0)),te._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){r(this,_r).reject(new Error("Worker was destroyed"));return}const t=new KA;g(this,kn,t);const s=`fake${Xt(te,zf)._++}`,i=new oc(s+"_worker",s,t);e.setup(i,t),g(this,mi,new oc(s,s+"_worker",t)),b(this,rs,Ku).call(this)}).catch(e=>{r(this,_r).reject(new Error(`Setting up fake worker failed: "${e.message}".`))})},oh=new WeakSet,Ju=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},y(te,oh),y(te,zf,0),y(te,Ao,!1),y(te,wo,new WeakMap),Ls&&(g(te,Ao,!0),on.workerSrc||(on.workerSrc="./pdf.worker.mjs")),te._isSameOrigin=(e,t)=>{const s=URL.parse(e);if(!(s!=null&&s.origin)||s.origin==="null")return!1;const i=new URL(t,s);return s.origin===i.origin},te._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};let Oc=te;var Es,So,Fn,vi,Eo,lh,Ln,ni,cl,Qu;class $0{constructor(e,t,s,i,n,a){y(this,ni);R(this,"downloadInfoCapability",Promise.withResolvers());y(this,Es,null);y(this,So,new Map);y(this,Fn,null);y(this,vi,new Map);y(this,Eo,new Map);y(this,lh,new Map);y(this,Ln,null);this.messageHandler=e,this.loadingTask=t,g(this,Fn,s),this.commonObjs=new Xy,this.fontLoader=new UA({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.enableHWA=i.enableHWA,this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.binaryDataFactory=n.binaryDataFactory,this.pagesMapper=a,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(e){const{_pageIndex:t}=e;r(this,vi).set(t,e),r(this,Eo).set(t,Promise.resolve(e))}get annotationStorage(){return Q(this,"annotationStorage",new Im)}
47getRenderingIntent(e,t=rr.ENABLE,s=null,i=!1,n=!1){let a=Fs.DISPLAY,o=Cc;switch(e){case"any":a=Fs.ANY;break;case"display":break;case"print":a=Fs.PRINT;break;default:st(`getRenderingIntent - invalid intent: ${e}`)}const l=a&Fs.PRINT&&s instanceof gy?s:this.annotationStorage;switch(t){case rr.DISABLE:a+=Fs.ANNOTATIONS_DISABLE;break;case rr.ENABLE:break;case rr.ENABLE_FORMS:a+=Fs.ANNOTATIONS_FORMS;break;case rr.ENABLE_STORAGE:a+=Fs.ANNOTATIONS_STORAGE,o=l.serializable;break;default:st(`getRenderingIntent - invalid annotationMode: ${t}`)}i&&(a+=Fs.IS_EDITING),n&&(a+=Fs.OPLIST);const{ids:h,hash:c}=l.modifiedIds,u=[a,o.hash,c];return{renderingIntent:a,cacheKey:u.join("_"),annotationStorageSerializable:o,modifiedIds:h}}destroy(){var s;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(s=r(this,Ln))==null||s.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const i of r(this,vi).values())e.push(i._destroy());r(this,vi).clear(),r(this,Eo).clear(),r(this,lh).clear(),Object.hasOwn(this,"annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then(()=>{var i,n;this.commonObjs.clear(),this.fontLoader.clear(),r(this,So).clear(),this.filterFactory.destroy(),Ic.cleanup(),(i=r(this,Fn))==null||i.cancelAllRequests(new da("Worker was terminated.")),(n=this.messageHandler)==null||n.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",(s,i)=>{qt(r(this,Fn),"GetReader - no `BasePDFStream` instance available."),g(this,Es,r(this,Fn).getFullReader()),r(this,Es).onProgress=n=>b(this,ni,Qu).call(this,n),i.onPull=()=>{r(this,Es).read().then(function({value:n,done:a}){if(a){i.close();return}qt(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{i.error(n)})},i.onCancel=n=>{r(this,Es).cancel(n),i.ready.catch(a=>{if(!this.destroyed)throw a})}}),e.on("ReaderHeadersReady",async s=>{await r(this,Es).headersReady;const{isStreamingSupported:i,isRangeSupported:n,contentLength:a}=r(this,Es);return i&&n&&(r(this,Es).onProgress=null),{isStreamingSupported:i,isRangeSupported:n,contentLength:a}}),e.on("GetRangeReader",(s,i)=>{qt(r(this,Fn),"GetRangeReader - no `BasePDFStream` instance available.");const n=r(this,Fn).getRangeReader(s.begin,s.end);if(!n){i.close();return}i.onPull=()=>{n.read().then(function({value:a,done:o}){if(o){i.close();return}qt(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{i.error(a)})},i.onCancel=a=>{n.cancel(a),i.ready.catch(o=>{if(!this.destroyed)throw o})}}),e.on("GetDoc",({pdfInfo:s})=>{this.pagesMapper.pagesNumber=s.numPages,this._numPages=s.numPages,this._htmlForXfa=s.htmlForXfa,delete s.htmlForXfa,t._capability.resolve(new j0(s,this))}),e.on("DocException",s=>{t._capability.reject(ls(s))}),e.on("PasswordRequest",s=>{g(this,Ln,Promise.withResolvers());try{if(!t.onPassword)throw ls(s);const i=n=>{n instanceof Error?r(this,Ln).reject(n):r(this,Ln).resolve({password:n})};t.onPassword(i,s.code)}catch(i){r(this,Ln).reject(i)}return r(this,Ln).promise}),e.on("DataLoaded",s=>{b(this,ni,Qu).call(this,{loaded:s.length,total:s.length}),this.downloadInfoCapability.resolve(s)}),e.on("StartRenderPage",s=>{if(this.destroyed)return;r(this,vi).get(s.pageIndex)._startRenderPage(s.transparency,s.cacheKey)}),e.on("commonobj",([s,i,n])=>{var a;if(this.destroyed||this.commonObjs.has(s))return null;switch(i){case"Font":if("error"in n){const f=n.error;st(`Error during font loading: ${f}`),this.commonObjs.resolve(s,f);break}const o=new $A(n),l=this._params.pdfBug&&((a=globalThis.FontInspector)!=null&&a.enabled)?(f,p)=>globalThis.FontInspector.fontAdded(f,p):null,h=new HA(o,l,n.charProcOperatorList,n.extra);this.fontLoader.bind(h).catch(()=>e.sendWithPromise("FontFallback",{id:s})).finally(()=>{h.fontExtraProperties||h.clearData(),this.commonObjs.resolve(s,h)});break;case"CopyLocalImage":const{imageRef:c}=n;qt(c,"The imageRef must be defined.");for(const f of r(this,vi).values())for(const[,p]of f.objs){if((p==null?void 0:p.ref)!==c)continue;
47if(!p.dataLen)return null;const m=structuredClone(p);return this.commonObjs.resolve(s,m),p.dataLen}break;case"FontPath":this.commonObjs.resolve(s,new VA(n));break;case"Image":this.commonObjs.resolve(s,n);break;case"Pattern":const u=new GA(n);this.commonObjs.resolve(s,u.getIR());break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),e.on("obj",([s,i,n,a])=>{var l;if(this.destroyed)return;const o=r(this,vi).get(i);if(!o.objs.has(s)){if(o._intentStates.size===0){(l=a==null?void 0:a.bitmap)==null||l.close();return}switch(n){case"Image":case"Pattern":o.objs.resolve(s,a);break;default:throw new Error(`Got unknown object type ${n}`)}}}),e.on("DocProgress",s=>{this.destroyed||b(this,ni,Qu).call(this,s)}),e.on("FetchBinaryData",async s=>{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(s)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var s;this.annotationStorage.size<=0&&st("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:((s=r(this,Es))==null?void 0:s.filename)??null},t).finally(()=>{this.annotationStorage.resetModified()})}extractPages(e,t=null){var a;const s={pageInfos:e};let i;const n=globalThis.ImageBitmap;if(typeof n=="function"){const o=Array.isArray(e)?e:[e];for(const l of o)(l==null?void 0:l.image)instanceof n&&(i||(i=[])).push(l.image)}if(this.annotationStorage.size>0){const o=this.annotationStorage.serializable;let{map:l}=o;(a=o.transfer)!=null&&a.length&&(i?i.push(...o.transfer):i=o.transfer);const h=this.pagesMapper.getMapping();if(h){const c=new Map;for(const[u,f]of l){if((f==null?void 0:f.pageIndex)!==void 0&&f.pageIndex>=0&&f.pageIndex<h.length){const p=(t==null?void 0:t[f.pageIndex])??0,m=h[f.pageIndex]-1;if(m!==f.pageIndex||p!==0){c.set(u,{...f,pageIndex:m,copyLevel:p});continue}}c.set(u,f)}l=c}s.annotationStorage=l}return this.messageHandler.sendWithPromise("ExtractPages",s,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,s=this.pagesMapper.getPageId(e)-1,i=r(this,Eo).get(t);if(i)return i;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:s}).then(a=>{if(this.destroyed)throw new Error("Transport destroyed");a.refStr&&r(this,lh).set(a.refStr,s);const o=new Cg(t,a,this,this.pagesMapper,this._params.pdfBug);return r(this,vi).set(t,o),o});return r(this,Eo).set(t,n),n}async getPageIndex(e){if(!lg(e))throw new Error("Invalid pageIndex request.");const t=await this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}),s=this.pagesMapper.getPageNumber(t+1);if(s===0)throw new Error("GetPageIndex: page has been removed.");return s-1}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(e+1)-1,intent:t})}getFieldObjects(){return b(this,ni,cl).call(this,"GetFieldObjects")}getSignatures(){return b(this,ni,cl).call(this,"GetSignatures")}getSignatureData(e){return this.messageHandler.sendWithPromise("GetSignatureData",e)}hasJSActions(){return b(this,ni,cl).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return typeof e!="string"?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)}
47getPageMode(){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)}getAttachmentContent(e){return this.messageHandler.sendWithPromise("GetAttachmentContent",e)}getAnnotationsByType(e,t){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:e,pageIndexesToSkip:t})}getDocJSActions(){return b(this,ni,cl).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 b(this,ni,cl).call(this,"GetOptionalContentConfig").then(t=>new bg(t,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata";return r(this,So).getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,null).then(t=>{var s,i;return{info:t[0],metadata:t[1]?new N0(t[1]):null,contentDispositionFilename:((s=r(this,Es))==null?void 0:s.filename)??null,contentLength:((i=r(this,Es))==null?void 0:i.contentLength)??null,hasStructTree:t[2]}}))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of r(this,vi).values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),r(this,So).clear(),this.filterFactory.destroy(!0),Ic.cleanup()}}cachedPageNumber(e){if(!lg(e))return null;const t=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`,s=r(this,lh).get(t);if(s>=0){const i=this.pagesMapper.getPageNumber(s+1);if(i!==0)return i}return null}}Es=new WeakMap,So=new WeakMap,Fn=new WeakMap,vi=new WeakMap,Eo=new WeakMap,lh=new WeakMap,Ln=new WeakMap,ni=new WeakSet,cl=function(e,t=null){return r(this,So).getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,t))},Qu=function({loaded:e,total:t}){var s,i;(i=(s=this.loadingTask).onProgress)==null||i.call(s,{loaded:e,total:t,percent:t?_t(Math.round(e/t*100),0,100):NaN})};class G0{constructor(e){R(this,"_internalRenderTask",null);R(this,"onContinue",null);R(this,"onError",null);this._internalRenderTask=e}get promise(){return this._internalRenderTask.capability.promise}cancel(e=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==null?void 0:t.size)>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}}var jr,xo;const wa=class wa{constructor({callback:e,params:t,objs:s,commonObjs:i,annotationCanvasMap:n,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:h,useRequestAnimationFrame:c=!1,pdfBug:u=!1,pageColors:f=null,enableHWA:p=!1,operationsFilter:m=null}){y(this,jr,null);this.callback=e,this.params=t,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=h,this._pdfBug=u,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=c===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new G0(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=t.canvas,this._canvasContext=t.canvas?null:t.canvasContext,this._enableHWA=p,this._dependencyTracker=t.dependencyTracker,this._imagesTracker=t.imagesTracker,this._operationsFilter=m}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){var h,c;if(this.cancelled)return;
47if(this._canvas){if(r(wa,xo).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.");r(wa,xo).add(this._canvas)}this._pdfBug&&((h=globalThis.StepperManager)!=null&&h.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:s,transform:i,background:n,dependencyTracker:a,imagesTracker:o}=this.params,l=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new gl(l,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors,a,o),this.gfx.beginDrawing({transform:i,viewport:s,transparency:e,background:n}),this.operatorListIdx=0,this.graphicsReady=!0,(c=this.graphicsReadyCallback)==null||c.call(this)}cancel(e=null,t=0){var s,i,n;this.running=!1,this.cancelled=!0,(s=this.gfx)==null||s.endDrawing(),r(this,jr)&&(window.cancelAnimationFrame(r(this,jr)),g(this,jr,null)),r(wa,xo).delete(this._canvas),e||(e=new Cm(`Rendering cancelled, page ${this._pageIndex+1}`,t)),this.callback(e),(n=(i=this.task).onError)==null||n.call(i,e)}operatorListChanged(){var e,t;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(e=this.gfx.dependencyTracker)==null||e.growOperationsCount(this.operatorList.fnArray.length),(t=this.stepper)==null||t.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?g(this,jr,window.requestAnimationFrame(()=>{g(this,jr,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),r(wa,xo).delete(this._canvas),this.callback())))}};jr=new WeakMap,xo=new WeakMap,y(wa,xo,new WeakSet);let Pg=wa;const V0="6.3.289",z0="1c8020a7d";ot(3068);var xs,To,hh,ge,Dd,ch,Nn,kd,$r,yi,Fd,Rt,Ig,Og,Mg,va,sb,nr;const cs=class cs{constructor({editor:e=null,uiManager:t=null}){y(this,Rt);y(this,xs,null);y(this,To,null);y(this,hh);y(this,ge,null);y(this,Dd,!1);y(this,ch,!1);y(this,Nn,null);y(this,kd);y(this,$r,null);y(this,yi,null);var s,i;e?(g(this,ch,!1),g(this,Nn,e)):g(this,ch,!0),g(this,yi,(e==null?void 0:e._uiManager)||t),g(this,kd,r(this,yi)._eventBus),g(this,hh,((s=e==null?void 0:e.color)==null?void 0:s.toUpperCase())||((i=r(this,yi))==null?void 0:i.highlightColors.values().next().value)||"#FFFF98"),r(cs,Fd)||g(cs,Fd,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"}))}static get _keyboardManager(){return Q(this,"_keyboardManager",new Zo([[["Escape"],cs.prototype._hideDropdownFromKeyboard],[["Space"],cs.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight"],cs.prototype._moveToNext],[["ArrowUp","ArrowLeft"],cs.prototype._moveToPrevious],[["Home"],cs.prototype._moveToBeginning],[["End"],cs.prototype._moveToEnd]]))}renderButton(){const e=g(this,xs,document.createElement("button"));e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",r(this,Nn)&&(e.ariaControls=`${r(this,Nn).id}_colorpicker_dropdown`);const t=r(this,yi)._signal;e.addEventListener("click",b(this,Rt,va).bind(this),{signal:t}),e.addEventListener("keydown",b(this,Rt,Mg).bind(this),{signal:t});const s=g(this,To,document.createElement("span"));return s.className="swatch",s.ariaHidden="true",s.style.backgroundColor=r(this,hh),e.append(s),e}renderMainDropdown(){const e=g(this,ge,b(this,Rt,Ig).call(this));return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}_colorSelectFromKeyboard(e){if(e.target===r(this,xs)){b(this,Rt,va).call(this,e);return}const t=e.target.getAttribute("data-color");t&&b(this,Rt,Og).call(this,t,e)}_moveToNext(e){var t,s;if(!r(this,Rt,nr)){b(this,Rt,va).call(this,e);return}if(e.target===r(this,xs)){(t=r(this,ge).firstElementChild)==null||t.focus();return}(s=e.target.nextSibling)==null||s.focus()}_moveToPrevious(e){var t,s;if(e.target===((t=r(this,ge))==null?void 0:t.firstElementChild)||e.target===r(this,xs)){r(this,Rt,nr)&&this._hideDropdownFromKeyboard();return}r(this,Rt,nr)||b(this,Rt,va).call(this,e),(s=e.target.previousSibling)==null||s.focus()}_moveToBeginning(e){var t;if(!r(this,Rt,nr)){b(this,Rt,va).call(this,e);return}(t=r(this,ge).firstElementChild)==null||t.focus()}_moveToEnd(e){var t;if(!r(this,Rt,nr)){b(this,Rt,va).call(this,e);return}(t=r(this,ge).lastElementChild)==null||t.focus()}hideDropdown(){var e,t;(e=r(this,ge))==null||e.classList.add("hidden"),r(this,xs).ariaExpanded="false",(t=r(this,$r))==null||t.abort(),g(this,$r,null)}_hideDropdownFromKeyboard(){var e;if(!r(this,ch)){if(!r(this,Rt,nr)){(e=r(this,Nn))==null||e.unselect();return}this.hideDropdown(),r(this,xs).focus({preventScroll:!0,focusVisible:r(this,Dd)})}}update(e){if(r(this,To)&&(r(this,To).style.backgroundColor=e),!r(this,ge))return;const t=r(this,yi).highlightColors.values();for(const s of r(this,ge).children)s.ariaSelected=t.next().value===e.toUpperCase()}destroy(){var e,t;(e=r(this,xs))==null||e.remove(),g(this,xs,null),g(this,To,null),(t=r(this,ge))==null||t.remove(),g(this,ge,null)}};xs=new WeakMap,To=new WeakMap,hh=new WeakMap,ge=new WeakMap,Dd=new WeakMap,ch=new WeakMap,Nn=new WeakMap,kd=new WeakMap,$r=new WeakMap,yi=new WeakMap,Fd=new WeakMap,Rt=new WeakSet,Ig=function(){const e=document.createElement("div"),t=r(this,yi)._signal;e.addEventListener("contextmenu",Ti,{signal:t}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),r(this,Nn)&&(e.id=`${r(this,Nn).id}_colorpicker_dropdown`);for(const[s,i]of r(this,yi).highlightColors){const n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",i),n.title=s,n.setAttribute("data-l10n-id",r(cs,Fd)[s]);const a=document.createElement("span");n.append(a),a.className="swatch",a.style.backgroundColor=i,n.ariaSelected=i===r(this,hh),n.addEventListener("click",b(this,Rt,Og).bind(this,i),{signal:t}),e.append(n)}return e.addEventListener("keydown",b(this,Rt,Mg).bind(this),{signal:t}),e},Og=function(e,t){t.stopPropagation(),r(this,kd).dispatch("switchannotationeditorparams",{source:this,type:ft.HIGHLIGHT_COLOR,value:e}),this.update(e)},Mg=function(e){cs._keyboardManager.exec(this,e)},va=function(e){if(r(this,Rt,nr)){this.hideDropdown();return}if(g(this,Dd,e.detail===0),r(this,$r)||(g(this,$r,new AbortController),window.addEventListener("pointerdown",b(this,Rt,sb).bind(this),{signal:r(this,yi).combinedSignal(r(this,$r))})),r(this,xs).ariaExpanded="true",r(this,ge)){r(this,ge).classList.remove("hidden");return}const t=g(this,ge,b(this,Rt,Ig).call(this));r(this,xs).append(t)},sb=function(e){var t;(t=r(this,ge))!=null&&t.contains(e.target)||this.hideDropdown()},nr=function(){return r(this,ge)&&!r(this,ge).classList.contains("hidden")},y(cs,Fd,null);let xf=cs;var Ts,dh,Co,Bn,Ld;const Sa=class Sa{constructor(e){y(this,Ts,null);y(this,dh,!1);
47y(this,Co,null);y(this,Bn,null);g(this,Co,e),g(this,Bn,e._uiManager),r(Sa,Ld)||g(Sa,Ld,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(r(this,Ts))return r(this,Ts);const{editorType:e,colorType:t,colorAndOpacityType:s,opacityType:i,color:n,opacity:a}=r(this,Co),o=g(this,dh,Mt.isAlphaColorInputSupported&&i!==void 0),l=g(this,Ts,document.createElement("input"));if(l.type="color",o){l.setAttribute("alpha","");const h=_.hexNums[Math.round((a??1)*255)];l.value=(n||"#000000")+h}else l.value=n||"#000000";return l.className="basicColorPicker",l.tabIndex=0,l.setAttribute("data-l10n-id",r(Sa,Ld)[e]),l.addEventListener("input",()=>{if(o){const h=bu(l.value);if(!h)return;const[c,u,f,p]=h,m=_.makeHexColor(c,u,f);s!==void 0?r(this,Bn).updateParams(s,{color:m,opacity:p}):(r(this,Bn).updateParams(t,m),r(this,Bn).updateParams(i,p))}else r(this,Bn).updateParams(t,l.value)},{signal:r(this,Bn)._signal}),l}update(e){if(r(this,Ts))if(r(this,dh)){const t=_.hexNums[Math.round(r(this,Co).opacity*255)];r(this,Ts).value=e+t}else r(this,Ts).value=e}updateOpacity(e){if(!r(this,Ts)||!r(this,dh))return;const t=_.hexNums[Math.round(e*255)];r(this,Ts).value=r(this,Co).color+t}destroy(){var e;(e=r(this,Ts))==null||e.remove(),g(this,Ts,null)}hideDropdown(){}};Ts=new WeakMap,dh=new WeakMap,Co=new WeakMap,Bn=new WeakMap,Ld=new WeakMap,y(Sa,Ld,null);let Tf=Sa;ot(531);function Tv(d){return Math.floor(_t(d,0,1)*255).toString(16).padStart(2,"0")}function Zh(d){return _t(d,0,1)*255}class Cv{static CMYK_G([e,t,s,i]){return["G",1-Math.min(1,.3*e+.59*s+.11*t+i)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return e=Zh(e),[e,e,e]}static G_HTML([e]){const t=Tv(e);return`#${t}${t}${t}`}static RGB_G([e,t,s]){return["G",.3*e+.59*t+.11*s]}static RGB_rgb(e){return e.map(Zh)}static RGB_HTML(e){return`#${e.map(Tv).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,s,i]){return["RGB",1-Math.min(1,e+i),1-Math.min(1,s+i),1-Math.min(1,t+i)]}static CMYK_rgb([e,t,s,i]){return[Zh(1-Math.min(1,e+i)),Zh(1-Math.min(1,s+i)),Zh(1-Math.min(1,t+i))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,s]){const i=1-e,n=1-t,a=1-s,o=Math.min(i,n,a);return["CMYK",i,n,a,o]}}class W0{create(e,t,s=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),s||(i.setAttribute("width",`${e}px`),i.setAttribute("height",`${t}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${e} ${t}`),i}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){gt("Abstract method `_createSVG` called.")}}class Cf extends W0{_createSVG(e){return document.createElementNS(is,e)}}const X0=9,tl=new WeakSet,Y0=new Date().getTimezoneOffset()*60*1e3;class Tp{static create(e){switch(e.data.annotationType){case Yt.LINK:return new Mm(e);case Yt.TEXT:return new J0(e);case Yt.WIDGET:switch(e.data.fieldType){case"Tx":return new Q0(e);case"Btn":return e.data.radioButton?new tw(e):e.data.checkBox?new q0(e):new ew(e);case"Ch":return new sw(e);case"Sig":return new Z0(e)}return new il(e);case Yt.POPUP:return new Dg(e);case Yt.FREETEXT:return new hb(e);case Yt.LINE:return new nw(e);case Yt.SQUARE:return new rw(e);case Yt.CIRCLE:return new aw(e);case Yt.POLYLINE:return new cb(e);case Yt.CARET:return new lw(e);case Yt.INK:return new Rm(e);case Yt.POLYGON:return new ow(e);case Yt.HIGHLIGHT:return new db(e);case Yt.UNDERLINE:return new hw(e);case Yt.SQUIGGLY:return new cw(e);case Yt.STRIKEOUT:return new dw(e);case Yt.STAMP:return new ub(e);case Yt.FILEATTACHMENT:return new uw(e);case Yt.RICHMEDIA:case Yt.SCREEN:case Yt.SOUND:return new fb(e);default:return new Vt(e)}}}var Po,uh,ti,Nd,Rg;const jm=class jm{constructor(e,{isRenderable:t=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){y(this,Nd);y(this,Po,null);y(this,uh,!1);y(this,ti,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(s)),i&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:t}){return!!(e!=null&&e.str||t!=null&&t.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return jm._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){var s;const{data:e}=this,t=(s=this.annotationStorage)==null?void 0:s.getEditor(e.id);return t?t.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}
47get commentButtonPosition(){var o;const e=(o=this.annotationStorage)==null?void 0:o.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;const{quadPoints:t,inkLists:s,rect:i}=this.data;let n=-1/0,a=-1/0;if((t==null?void 0:t.length)>=8){for(let l=0;l<t.length;l+=8)t[l+1]>a?(a=t[l+1],n=t[l+2]):t[l+1]===a&&(n=Math.max(n,t[l+2]));return[n,a]}if((s==null?void 0:s.length)>=1){for(const l of s)for(let h=0,c=l.length;h<c;h+=2)l[h+1]>a?(a=l[h+1],n=l[h]):l[h+1]===a&&(n=Math.max(n,l[h]));if(n!==1/0)return[n,a]}return i?[i[2],i[3]]:null}_normalizePoint(e){const{page:{view:t},viewport:{rawDims:{pageWidth:s,pageHeight:i,pageX:n,pageY:a}}}=this.parent;return e[1]=t[3]-e[1]+t[1],e[0]=100*(e[0]-n)/s,e[1]=100*(e[1]-a)/i,e}get commentText(){var t,s,i;const{data:e}=this;return((s=(t=this.annotationStorage.getRawValue(`${Gh}${e.id}`))==null?void 0:t.popup)==null?void 0:s.contents)||((i=e.contentsObj)==null?void 0:i.str)||""}set commentText(e){const{data:t}=this,s={deleted:!e,contents:e||""};this.annotationStorage.updateEditor(t.id,{popup:s})||this.annotationStorage.setValue(`${Gh}${t.id}`,{id:t.id,annotationType:t.annotationType,page:this.parent.page,popup:s,popupRef:t.popupRef,modificationDate:new Date}),e||this.removePopup()}removePopup(){var e,t;(t=((e=r(this,ti))==null?void 0:e.popup)||this.popup)==null||t.remove(),g(this,ti,this.popup=null)}updateEdited(e){var n;if(!this.container)return;e.rect&&(r(this,Po)||g(this,Po,{rect:this.data.rect.slice(0)}));const{rect:t,popup:s}=e;t&&b(this,Nd,Rg).call(this,t);let i=((n=r(this,ti))==null?void 0:n.popup)||this.popup;!i&&(s!=null&&s.text)&&(this._createPopup(s),i=r(this,ti).popup),i&&(i.updateEdited(e),s!=null&&s.deleted&&(i.remove(),g(this,ti,null),this.popup=null))}resetEdited(){var e;r(this,Po)&&(b(this,Nd,Rg).call(this,r(this,Po).rect),(e=r(this,ti))==null||e.popup.resetEdited(),g(this,Po,null))}_createContainer(e){const{data:t,parent:{page:s,viewport:i}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",t.id),!(this instanceof il)&&!(this instanceof Mm)&&!(this instanceof fb)&&(n.tabIndex=0);const{style:a}=n;if(a.zIndex=this.parent.zIndex,this.parent.zIndex+=2,t.alternativeText&&(n.title=t.alternativeText),t.noRotate&&n.classList.add("norotate"),!t.rect||this instanceof Dg){const{rotation:v}=t;return!t.hasOwnCanvas&&v!==0&&this.setRotation(v,n),n}const{width:o,height:l}=this;if(!e&&t.borderStyle.width>0){a.borderWidth=`${t.borderStyle.width}px`;const v=t.borderStyle.horizontalCornerRadius,A=t.borderStyle.verticalCornerRadius;if(v>0||A>0){const S=`calc(${v}px * var(--total-scale-factor)) / calc(${A}px * var(--total-scale-factor))`;a.borderRadius=S}switch(t.borderStyle.style){case ol.SOLID:a.borderStyle="solid";break;case ol.DASHED:a.borderStyle="dashed";break;case ol.BEVELED:st("Unimplemented border style: beveled");break;case ol.INSET:st("Unimplemented border style: inset");break;case ol.UNDERLINE:a.borderBottomStyle="solid";break}const w=t.borderColor||null;w?(g(this,uh,!0),a.borderColor=_.makeHexColor(...w)):a.borderWidth=0}const h=_.normalizeRect([t.rect[0],s.view[3]-t.rect[1]+s.view[1],t.rect[2],s.view[3]-t.rect[3]+s.view[1]]),{pageWidth:c,pageHeight:u,pageX:f,pageY:p}=i.rawDims;a.left=`${100*(h[0]-f)/c}%`,a.top=`${100*(h[1]-p)/u}%`;const{rotation:m}=t;return t.hasOwnCanvas||m===0?(a.width=`${100*o/c}%`,a.height=`${100*l/u}%`):this.setRotation(m,n),n}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:i}=this.parent.viewport.rawDims;let{width:n,height:a}=this;e%180!==0&&([n,a]=[a,n]),t.style.width=`${100*n/s}%`,t.style.height=`${100*a/i}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(t,s,i)=>{const n=i.detail[t],a=n[0],o=n.slice(1);i.target.style[s]=Cv[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[s]:Cv[`${a}_rgb`](o)})};return Q(this,"_commonActions",{display:t=>{const{display:s}=t.detail,i=s%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:s===1||s===2})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:s}=t.detail;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:s,noView:s})},focus:t=>{setTimeout(()=>
47t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:t=>{const s=t.detail.rotation;this.setRotation(s),this.annotationStorage.setValue(this.data.id,{rotation:s})}})}_dispatchEventFromSandbox(e,t){const s=this._commonActions;for(const i of Object.keys(t.detail)){const n=e[i]||s[i];n==null||n(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const s=this._commonActions;for(const[i,n]of Object.entries(t)){const a=s[i];if(a){const o={detail:{[i]:n},target:e};a(o),delete t[i]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,s,i,n]=this.data.rect.map(Math.fround);if(e.length===8){const[v,A,w,S]=e.subarray(2,6);if(i===v&&n===A&&t===w&&s===S)return}const{style:a}=this.container;let o;if(r(this,uh)){const{borderColor:v,borderWidth:A}=a;a.borderWidth=0,o=["url('data:image/svg+xml;utf8,",`<svg xmlns="${is}" preserveAspectRatio="none" viewBox="0 0 1 1">`,`<g fill="transparent" stroke="${v}" stroke-width="${A}">`],this.container.classList.add("hasBorder")}const l=i-t,h=n-s,{svgFactory:c}=this,u=c.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0),u.role="none";const f=c.createElement("defs");u.append(f);const p=c.createElement("clipPath"),m=`clippath_${this.data.id}`;p.setAttribute("id",m),p.setAttribute("clipPathUnits","objectBoundingBox"),f.append(p);for(let v=2,A=e.length;v<A;v+=8){const w=e[v],S=e[v+1],x=e[v+2],T=e[v+3],E=c.createElement("rect"),C=(x-t)/l,P=(n-S)/h,O=(w-x)/l,I=(S-T)/h;E.setAttribute("x",C),E.setAttribute("y",P),E.setAttribute("width",O),E.setAttribute("height",I),p.append(E),o==null||o.push(`<rect vector-effect="non-scaling-stroke" x="${C}" y="${P}" width="${O}" height="${I}"/>`)}r(this,uh)&&(o.push("</g></svg>')"),a.backgroundImage=o.join("")),this.container.append(u),this.container.style.clipPath=`url(#${m})`}_createPopup(e=null){const{data:t}=this;let s,i;e?(s={str:e.text},i=e.date):(s=t.contentsObj,i=t.modificationDate),g(this,ti,new Dg({data:{color:t.color,titleObj:t.titleObj,modificationDate:i,contentsObj:s,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!!(r(this,ti)||this.popup||this.data.popupRef)}get extraPopupElement(){return r(this,ti)}render(){gt("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const s=[];if(this._fieldObjects){const i=this._fieldObjects.get(e)||[];for(const{page:n,id:a,exportValues:o}of i){if(n===-1||a===t)continue;const l=typeof o=="string"?o:null,h=document.querySelector(`[data-element-id="${a}"]`);
47if(h&&!tl.has(h)){st(`_getElementsByName - element not allowed: ${a}`);continue}s.push({id:a,exportValue:l,domElement:h})}return s}for(const i of document.getElementsByName(e)){const{exportValue:n}=i,a=i.getAttribute("data-element-id");a!==t&&tl.has(i)&&s.push({id:a,exportValue:n,domElement:i})}return s}show(){var e;this.container&&(this.container.hidden=!1),(e=this.popup)==null||e.maybeShow()}hide(){var e;this.container&&(this.container.hidden=!0),(e=this.popup)==null||e.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",()=>{var s;(s=this.linkService.eventBus)==null||s.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t,mustEnterInEditMode:!0})})}updateOC(e){if(!this.data.oc||!e)return;e.isVisible(this.data.oc)?this.show():this.hide()}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?"transparent":_.makeHexColor(...t)}};Po=new WeakMap,uh=new WeakMap,ti=new WeakMap,Nd=new WeakSet,Rg=function(e){const{container:{style:t},data:{rect:s,rotation:i},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:a,pageX:o,pageY:l}}}}=this;s==null||s.splice(0,4,...e),t.left=`${100*(e[0]-o)/n}%`,t.top=`${100*(a-e[3]+l)/a}%`,i===0?(t.width=`${100*(e[2]-e[0])/n}%`,t.height=`${100*(e[3]-e[1])/a}%`):this.setRotation(i)};let Vt=jm;class K0 extends Vt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.editor=e.editor}render(){return this.container.className="editorAnnotation",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 Bs,ya,ib,nb;class Mm extends Vt{constructor(t,s=null){super(t,{isRenderable:!0,ignoreBorder:!!(s!=null&&s.ignoreBorder),createQuadrilaterals:!0});y(this,Bs);this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:s}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let n=!1;return t.url?(s.addLinkAttributes(i,t.url,t.newWindow),n=!0):t.action?(this._bindNamedAction(i,t.action,t.overlaidText),n=!0):t.attachment?(b(this,Bs,ib).call(this,i,t.attachmentId,t.attachment,t.overlaidText,t.attachmentDest),n=!0):t.setOCGState?(b(this,Bs,nb).call(this,i,t.setOCGState,t.overlaidText),n=!0):t.dest?(this._bindLink(i,t.dest,t.overlaidText),n=!0):(t.actions&&(t.actions.has("Action")||t.actions.has("Mouse Up")||t.actions.has("Mouse Down"))&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),n=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&(this.contentElement=i,this.container.append(i)),this.container}_bindLink(t,s,i=""){t.href=this.linkService.getDestinationHash(s),t.onclick=()=>(s&&this.linkService.goToDestination(s),!1),(s||s==="")&&b(this,Bs,ya).call(this),i&&(t.title=i)}_bindNamedAction(t,s,i=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(s),!1),i&&(t.title=i),b(this,Bs,ya).call(this)}_bindJSAction(t,{actions:s,id:i,overlaidText:n}){t.href=this.linkService.getAnchorUrl("");const a=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const o of s.keys()){const l=a.get(o);l&&(t[l]=()=>{var h;return(h=this.linkService.eventBus)==null||h.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:o}}),!1})}n&&(t.title=n),t.onclick||(t.onclick=()=>!1),b(this,Bs,ya).call(this)}_bindResetFormAction(t,s){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),b(this,Bs,ya).call(this),!this._fieldObjects){st('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(t.onclick=()=>!1);return}t.onclick=()=>{var u;i==null||i();const{fields:n,refs:a,include:o}=s,l=[];
47if(n.length!==0||a.length!==0){const f=new Set(a);for(const p of n){const m=this._fieldObjects.get(p)||[];for(const{id:v}of m)f.add(v)}for(const p of this._fieldObjects.values())for(const m of p)f.has(m.id)===o&&l.push(m)}else for(const f of this._fieldObjects.values())l.push(...f);const h=this.annotationStorage,c=[];for(const f of l){const{id:p}=f;switch(c.push(p),f.type){case"text":{const v=f.defaultValue||"";h.setValue(p,{value:v});break}case"checkbox":case"radiobutton":{const v=f.defaultValue===f.exportValues;h.setValue(p,{value:v});break}case"combobox":case"listbox":{const v=f.defaultValue||"";h.setValue(p,{value:v});break}default:continue}const m=document.querySelector(`[data-element-id="${p}"]`);if(m){if(!tl.has(m)){st(`_bindResetFormAction - element not allowed: ${p}`);continue}}else continue;m.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((u=this.linkService.eventBus)==null||u.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:c,name:"ResetForm"}})),!1}}}Bs=new WeakSet,ya=function(){this.container.setAttribute("data-internal-link","")},ib=function(t,s,i,n="",a=null){t.href=this.linkService.getAnchorUrl(""),i.description?t.title=i.description:n&&(t.title=n);const o=async()=>{var h;const l=await this.linkService.getAttachmentContent(s);l&&((h=this.downloadManager)==null||h.openOrDownloadData(l,i.filename,a))};t.onclick=()=>(o(),!1),b(this,Bs,ya).call(this)},nb=function(t,s,i=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(s),!1),i&&(t.title=i),b(this,Bs,ya).call(this)};class J0 extends Vt{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return 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})),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(e),this.container}}class il extends Vt{render(){return this.container}_getKeyModifier(e){return Mt.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,s,i,n){s.includes("mouse")?e.addEventListener(s,a=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):e.addEventListener(s,a=>{var o;if(s==="blur"){if(!t.focused||!a.relatedTarget)return;t.focused=!1}else if(s==="focus"){if(t.focused)return;t.focused=!0}n&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(a)}}))})}_setEventListeners(e,t,s,i){const{actions:n}=this.data;for(const[a,o]of s)(o==="Action"||n!=null&&n.has(o))&&((o==="Focus"||o==="Blur")&&(t||(t={focused:!1})),this._setEventListener(e,t,a,o,i),o==="Focus"&&!(n!=null&&n.has("Blur"))?this._setEventListener(e,t,"blur","Blur",null):o==="Blur"&&!(n!=null&&n.has("Focus"))&&this._setEventListener(e,t,"focus","Focus",null))}_setTextStyle(e){const t=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||X0,n=e.style;let a;const o=2,l=h=>Math.round(10*h)/10;if(this.data.multiLine){const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o),c=Math.round(h/(1.35*i))||1,u=h/c;a=Math.min(i,l(u/1.35))}else{const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(i,l(h/1.35))}n.fontSize=`calc(${a}px * var(--total-scale-factor))`,n.color=_.makeHexColor(...s),this.data.textAlignment!==null&&!this.data.comb&&(n.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class Q0 extends il{constructor(e){const t=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,s,i){const n=this.annotationStorage;
47for(const a of this._getElementsByName(e.name,e.id))a.domElement&&(a.domElement[t]=s),n.setValue(a.id,{[i]:s})}render(){var i,n;const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){const a=e.getValue(t,{value:this.data.fieldValue});let o=a.value||"";const l=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;l&&o.length>l&&(o=o.slice(0,l));let h=a.formattedValue||((i=this.data.textContent)==null?void 0:i.join(` 48`))||null;h&&this.data.comb&&(h=h.replaceAll(/\s+/g,""));const c={userValue:o,formattedValue:h,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=h??o,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type=this.data.password?"password":"text",s.setAttribute("value",h??o),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(this.container.classList.add("hasOwnCanvas"),e.has(t)&&this.container.classList.add("sandboxModified")),tl.add(s),this.contentElement=s,s.setAttribute("data-element-id",t),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=0;const{datetimeFormat:u,datetimeType:f,timeStep:p}=this.data,m=!!f&&this.enableScripting;u&&(s.title=u),this._setRequired(s,this.data.required),l&&(s.maxLength=l),s.addEventListener("input",A=>{e.setValue(t,{value:A.target.value}),this.setPropertyOnSiblings(s,"value",A.target.value,"value"),c.formattedValue=null}),s.addEventListener("resetform",A=>{const w=this.data.defaultFieldValue??"";s.value=c.userValue=w,c.formattedValue=null});let v=A=>{const{formattedValue:w}=c;w!=null&&(A.target.value=w),A.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",w=>{var x;if(c.focused)return;const{target:S}=w;if(m&&(S.type=f,p&&(S.step=p)),c.userValue){const T=c.userValue;if(m)if(f==="time"){const E=new Date(T),C=[E.getHours(),E.getMinutes(),E.getSeconds()];S.value=C.map(P=>P.toString().padStart(2,"0")).join(":")}else S.value=new Date(T-Y0).toISOString().split(f==="date"?"T":".",1)[0];else S.value=T}c.lastCommittedValue=S.value,c.commitKey=1,(x=this.data.actions)!=null&&x.has("Focus")||(c.focused=!0)}),s.addEventListener("updatefromsandbox",w=>{this.container.classList.add("sandboxModified");const S={value(x){c.userValue=x.detail.value??"",m||e.setValue(t,{value:c.userValue.toString()}),x.target.value=c.userValue},formattedValue(x){const{formattedValue:T}=x.detail;c.formattedValue=T,T!=null&&x.target!==document.activeElement&&(x.target.value=T);const E={formattedValue:T};m&&(E.value=T),e.setValue(t,E)},selRange(x){x.target.setSelectionRange(...x.detail.selRange)},charLimit:x=>{var P;const{charLimit:T}=x.detail,{target:E}=x;if(T===0){E.removeAttribute("maxLength");return}E.setAttribute("maxLength",T);let C=c.userValue;!C||C.length<=T||(C=C.slice(0,T),E.value=c.userValue=C,e.setValue(t,{value:C}),(P=this.linkService.eventBus)==null||P.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:C,willCommit:!0,commitKey:1,selStart:E.selectionStart,selEnd:E.selectionEnd}}))}};this._dispatchEventFromSandbox(S,w)}),s.addEventListener("keydown",w=>{var T;c.commitKey=1;let S=-1;if(w.key==="Escape"?S=0:w.key==="Enter"&&!this.data.multiLine?S=2:w.key==="Tab"&&(c.commitKey=3),S===-1)return;const{value:x}=w.target;c.lastCommittedValue!==x&&(c.lastCommittedValue=x,c.userValue=x,(T=this.linkService.eventBus)==null||T.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:x,willCommit:!0,commitKey:S,selStart:w.target.selectionStart,selEnd:w.target.selectionEnd}}))});const A=v;v=null,s.addEventListener("blur",w=>{var T,E;if(!c.focused||!w.relatedTarget)return;(T=this.data.actions)!=null&&T.has("Blur")||(c.focused=!1);const{target:S}=w;let{value:x}=S;if(m){if(x&&f==="time"){const C=x.split(":").map(P=>parseInt(P,10));x=new Date(2e3,0,1,C[0],C[1],C[2]||0).valueOf(),S.step=""}else x.includes("T")||(x=`${x}T00:00`),x=new Date(x).valueOf();S.type="text"}c.userValue=x,c.lastCommittedValue!==x&&((E=this.linkService.eventBus)==null||E.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:x,willCommit:!0,
48commitKey:c.commitKey,selStart:w.target.selectionStart,selEnd:w.target.selectionEnd}})),A(w)}),(n=this.data.actions)!=null&&n.has("Keystroke")&&s.addEventListener("beforeinput",w=>{var I;c.lastCommittedValue=null;const{data:S,target:x}=w,{value:T,selectionStart:E,selectionEnd:C}=x;let P=E,O=C;switch(w.inputType){case"deleteWordBackward":{const D=/\w/;for(;P>0&&!D.test(T[P-1]);)P--;for(;P>0&&D.test(T[P-1]);)P--;break}case"deleteWordForward":{const D=T.substring(E).match(/^\W*\w*/);D&&(O+=D[0].length);break}case"deleteContentBackward":E===C&&(P-=1);break;case"deleteContentForward":E===C&&(O+=1);break}w.preventDefault(),(I=this.linkService.eventBus)==null||I.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:T,change:S||"",willCommit:!1,selStart:P,selEnd:O}})}),this._setEventListeners(s,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],w=>w.target.value)}if(v&&s.addEventListener("blur",v),this.data.comb){const w=(this.data.rect[2]-this.data.rect[0])/l;s.classList.add("comb"),s.style.setProperty("--comb-width",`calc(${w}px * var(--total-scale-factor))`);const S=this.data.textAlignment;if(S===1||S===2){const x=()=>{const T=l-s.value.length;s.style.setProperty("--comb-offset",`${S===1?T>>1:T}`)};x();for(const T of["input","blur","resetform","updatefromsandbox"])s.addEventListener(T,x)}}}else s=document.createElement("div"),s.textContent=this.data.fieldValue,s.style.verticalAlign="middle",s.style.display="table-cell",this.data.hasOwnCanvas&&(s.hidden=!0);return this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Z0 extends il{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class q0 extends il{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,s=t.id;let i=e.getValue(s,{value:t.exportValue===t.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",e.setValue(s,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return tl.add(n),n.setAttribute("data-element-id",s),n.disabled=t.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=t.fieldName,i&&n.setAttribute("checked",!0),n.setAttribute("exportValue",t.exportValue),n.tabIndex=0,n.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,s)){const c=l&&h.exportValue===t.exportValue;h.domElement&&(h.domElement.checked=c),e.setValue(h.id,{value:c})}e.setValue(s,{value:l})}),n.addEventListener("resetform",a=>{const o=t.defaultFieldValue||"Off";a.target.checked=o===t.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",a=>{const o={value(l){l.target.checked=l.detail.value!=="Off",e.setValue(s,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,a)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class tw extends il{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,s=t.id;let i=e.getValue(s,{value:t.buttonValue!==null&&t.fieldValue===t.buttonValue}).value;if(typeof i=="string"&&(i=i!==t.buttonValue,e.setValue(s,{value:i})),i)for(const a of this._getElementsByName(t.fieldName,s))e.setValue(a.id,{value:!1});const n=document.createElement("input");if(tl.add(n),n.setAttribute("data-element-id",s),n.disabled=t.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=t.fieldName,i&&n.setAttribute("checked",!0),n.tabIndex=0,n.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,s))e.setValue(h.id,{value:!1});e.setValue(s,{value:l})}),n.addEventListener("resetform",a=>{const o=t.defaultFieldValue;a.target.checked=o!=null&&o===t.buttonValue}),this.enableScripting&&this.hasJSActions){const a=t.buttonValue;n.addEventListener("updatefromsandbox",o=>{const l={value:h=>{const c=a===h.detail.value;for(const u of this._getElementsByName(h.target.name)){const f=c&&u.id===s;u.domElement&&(u.domElement.checked=f),e.setValue(u.id,{value:f})}}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)}return this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}
48class ew extends Mm{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",s=>{this._dispatchEventFromSandbox({},s)})),e}}class sw extends il{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,s=e.getValue(t,{value:this.data.fieldValue}),i=document.createElement("select");tl.add(i),i.setAttribute("data-element-id",t),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=0;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",u=>{const f=this.data.defaultFieldValue;for(const p of i.options)p.selected=p.value===f});const a=(u,f)=>{const p=f.replaceAll(" ","Â ");u.textContent=p,p!==f&&u.setAttribute("display-value",f)};for(const u of this.data.options){const f=document.createElement("option");a(f,u.displayValue),f.value=u.exportValue,s.value.includes(u.exportValue)&&(f.setAttribute("selected",!0),n=!1),i.append(f)}let o=null;if(n){const u=document.createElement("option");u.value=" ",u.setAttribute("hidden",!0),u.setAttribute("selected",!0),i.prepend(u),o=()=>{u.remove(),i.removeEventListener("input",o),o=null},i.addEventListener("input",o)}const l=u=>{const f=u?"value":"textContent",{options:p,multiple:m}=i;return m?Array.prototype.filter.call(p,v=>v.selected).map(v=>v[f]):p.selectedIndex===-1?null:p[p.selectedIndex][f]};let h=l(!1);const c=u=>{const f=u.target.options;return Array.prototype.map.call(f,p=>({displayValue:p.getAttribute("display-value")||p.textContent,exportValue:p.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",u=>{const f={value(p){o==null||o();const m=p.detail.value,v=new Set(Array.isArray(m)?m:[m]);for(const A of i.options)A.selected=v.has(A.value);e.setValue(t,{value:l(!0)}),h=l(!1)},multipleSelection(p){i.multiple=!0},remove(p){const m=i.options,v=p.detail.remove;m[v].selected=!1,i.remove(v),m.length>0&&Array.prototype.findIndex.call(m,w=>w.selected)===-1&&(m[0].selected=!0),e.setValue(t,{value:l(!0),items:c(p)}),h=l(!1)},clear(p){for(;i.length!==0;)i.remove(0);e.setValue(t,{value:null,items:[]}),h=l(!1)},insert(p){const{index:m,displayValue:v,exportValue:A}=p.detail.insert,w=i.children[m],S=document.createElement("option");a(S,v),S.value=A,w?w.before(S):i.append(S),e.setValue(t,{value:l(!0),items:c(p)}),h=l(!1)},items(p){const{items:m}=p.detail;for(;i.length!==0;)i.remove(0);for(const v of m){const{displayValue:A,exportValue:w}=v,S=document.createElement("option");a(S,A),S.value=w,i.append(S)}i.options.length>0&&(i.options[0].selected=!0),e.setValue(t,{value:l(!0),items:c(p)}),h=l(!1)},indices(p){const m=new Set(p.detail.indices);for(const v of p.target.options)v.selected=m.has(v.index);e.setValue(t,{value:l(!0)}),h=l(!1)},editable(p){p.target.disabled=!p.detail.editable}};this._dispatchEventFromSandbox(f,u)}),i.addEventListener("input",u=>{var m;const f=l(!0),p=l(!1);e.setValue(t,{value:f}),u.preventDefault(),(m=this.linkService.eventBus)==null||m.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:h,change:p,changeEx:f,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],u=>u.target.value)):i.addEventListener("input",function(u){e.setValue(t,{value:l(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}var Bd,kg;class Dg extends Vt{constructor(t){const{data:s,elements:i,parent:n}=t,a=!!n._commentManager;super(t,{isRenderable:!a&&Vt._hasPopupData(s)});y(this,Bd);if(this.elements=i,a&&Vt._hasPopupData(s)){const o=this.popup=b(this,Bd,kg).call(this);for(const l of i)l.popup=o}else this.popup=null}render(){const{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";
48const s=this.popup=b(this,Bd,kg).call(this),i=[];for(const n of this.elements)n.popup=s,n.container.ariaHasPopup="dialog",i.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(n=>`${ul}${n}`).join(",")),this.container}}Bd=new WeakSet,kg=function(){return new iw({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 Cs,Gr,Wf,Xf,fh,ph,se,Ki,Vr,Io,gh,mh,Ji,Ps,Un,Hn,ie,_n,zr,Ud,jn,vh,Oo,Wr,Ee,Xr,ht,Zu,Fg,Lg,Ng,qu,Bg,rb,ab,ob,lb,tf,ef,Ug;class iw{constructor({container:e,color:t,elements:s,titleObj:i,modificationDate:n,contentsObj:a,richText:o,parent:l,rect:h,parentRect:c,open:u,commentManager:f=null}){y(this,ht);y(this,Cs,null);y(this,Gr,b(this,ht,ob).bind(this));y(this,Wf,b(this,ht,Ug).bind(this));y(this,Xf,b(this,ht,ef).bind(this));y(this,fh,b(this,ht,tf).bind(this));y(this,ph,null);y(this,se,null);y(this,Ki,null);y(this,Vr,null);y(this,Io,null);y(this,gh,null);y(this,mh,null);y(this,Ji,!1);y(this,Ps,null);y(this,Un,null);y(this,Hn,null);y(this,ie,null);y(this,_n,null);y(this,zr,null);y(this,Ud,null);y(this,jn,null);y(this,vh,null);y(this,Oo,null);y(this,Wr,!1);y(this,Ee,null);y(this,Xr,null);g(this,se,e),g(this,vh,i),g(this,Ki,a),g(this,jn,o),g(this,gh,l),g(this,ph,t),g(this,Ud,h),g(this,mh,c),g(this,Io,s),g(this,Cs,f),g(this,Ee,s[0]),g(this,Vr,wf.toDateObject(n)),this.trigger=s.flatMap(p=>p.getElementsToTriggerPopup()),f||(b(this,ht,Zu).call(this),r(this,se).hidden=!0,u&&b(this,ht,tf).call(this))}renderCommentButton(){if(r(this,ie)){r(this,ie).parentNode||r(this,Ee).container.after(r(this,ie));return}if(r(this,_n)||b(this,ht,Fg).call(this),!r(this,_n))return;const{signal:e}=g(this,Un,new AbortController),t=r(this,Ee).hasOwnCommentButton,s=()=>{r(this,Cs).toggleCommentPopup(this,!0,void 0,!t)},i=()=>{r(this,Cs).toggleCommentPopup(this,!1,!0,!t)},n=()=>{r(this,Cs).toggleCommentPopup(this,!1,!1)};if(t){g(this,ie,r(this,Ee).container);for(const a of this.trigger)a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.addEventListener("keydown",r(this,Gr),{signal:e}),a.addEventListener("click",s,{signal:e}),a.addEventListener("pointerenter",i,{signal:e}),a.addEventListener("pointerleave",n,{signal:e}),a.classList.add("popupTriggerArea")}else{const a=g(this,ie,document.createElement("button"));a.className="annotationCommentButton";const o=r(this,Ee).container;a.style.zIndex=parseInt(o.style.zIndex,10)+1,a.tabIndex=0,a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.setAttribute("data-l10n-id","pdfjs-show-comment-button"),b(this,ht,Ng).call(this),b(this,ht,Lg).call(this),a.addEventListener("keydown",r(this,Gr),{signal:e}),a.addEventListener("click",s,{signal:e}),a.addEventListener("pointerenter",i,{signal:e}),a.addEventListener("pointerleave",n,{signal:e}),o.after(a)}}get commentButtonColor(){const{color:e,opacity:t}=r(this,Ee).commentData;return e?r(this,gh)._commentManager.makeCommentColor(e,t):null}focusCommentButton(){setTimeout(()=>{var e;(e=r(this,ie))==null||e.focus()},0)}
48getData(){const{richText:e,color:t,opacity:s,creationDate:i,modificationDate:n}=r(this,Ee).commentData;return{contentsObj:{str:this.comment},richText:e,color:t,opacity:s,creationDate:i,modificationDate:n}}get elementBeforePopup(){return r(this,ie)}get comment(){return r(this,Xr)||g(this,Xr,r(this,Ee).commentText),r(this,Xr)}set comment(e){e!==this.comment&&(r(this,Ee).commentText=g(this,Xr,e))}focus(){var e;(e=r(this,Ee).container)==null||e.focus()}get parentBoundingClientRect(){return r(this,Ee).layer.getBoundingClientRect()}setCommentButtonStates({selected:e,hasPopup:t}){r(this,ie)&&(r(this,ie).classList.toggle("selected",e),r(this,ie).ariaExpanded=t)}setSelectedCommentButton(e){r(this,ie).classList.toggle("selected",e)}get commentPopupPosition(){if(r(this,zr))return r(this,zr);const{x:e,y:t,height:s}=r(this,ie).getBoundingClientRect(),{x:i,y:n,width:a,height:o}=r(this,Ee).layer.getBoundingClientRect();return[(e-i)/a,(t+s-n)/o]}set commentPopupPosition(e){g(this,zr,e)}hasDefaultPopupPosition(){return r(this,zr)===null}get commentButtonPosition(){return r(this,_n)}get commentButtonWidth(){return r(this,ie).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){const[t,s]=r(this,zr)||this.commentButtonPosition.map(h=>h/100),i=this.parentBoundingClientRect,{x:n,y:a,width:o,height:l}=i;r(this,Cs).showDialog(null,this,n+t*o,a+s*l,{...e,parentDimensions:i})}render(){var s,i;if(r(this,Ps))return;const e=g(this,Ps,document.createElement("div"));if(e.className="popup",r(this,ph)){const n=e.style.outlineColor=_.makeHexColor(...r(this,ph));e.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`}const t=document.createElement("span");if(t.className="header",(s=r(this,vh))!=null&&s.str){const n=document.createElement("span");n.className="title",t.append(n),{dir:n.dir,str:n.textContent}=r(this,vh)}if(e.append(t),r(this,Vr)){const n=document.createElement("time");n.className="popupDate",n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:r(this,Vr).valueOf()})),n.dateTime=r(this,Vr).toISOString(),t.append(n)}kv({html:r(this,ht,qu)||r(this,Ki).str,dir:(i=r(this,Ki))==null?void 0:i.dir,className:"popupContent"},e),r(this,se).append(e)}updateEdited({rect:e,popup:t,deleted:s}){var i;if(r(this,Cs)){s?(this.remove(),g(this,Xr,null)):t&&(t.deleted?this.remove():(b(this,ht,Ng).call(this),g(this,Xr,t.text))),e&&(g(this,_n,null),b(this,ht,Fg).call(this),b(this,ht,Lg).call(this));return}if(s||t!=null&&t.deleted){this.remove();return}b(this,ht,Zu).call(this),r(this,Oo)||g(this,Oo,{contentsObj:r(this,Ki),richText:r(this,jn)}),e&&g(this,Hn,null),t&&t.text&&(g(this,jn,b(this,ht,ab).call(this,t.text)),g(this,Vr,wf.toDateObject(t.date)),g(this,Ki,null)),(i=r(this,Ps))==null||i.remove(),g(this,Ps,null)}resetEdited(){var e;r(this,Oo)&&({contentsObj:Xt(this,Ki)._,richText:Xt(this,jn)._}=r(this,Oo),g(this,Oo,null),(e=r(this,Ps))==null||e.remove(),g(this,Ps,null),g(this,Hn,null))}remove(){var e,t,s;if((e=r(this,Un))==null||e.abort(),g(this,Un,null),(t=r(this,Ps))==null||t.remove(),g(this,Ps,null),g(this,Wr,!1),g(this,Ji,!1),(s=r(this,ie))==null||s.remove(),g(this,ie,null),this.trigger)for(const i of this.trigger)i.classList.remove("popupTriggerArea")}forceHide(){g(this,Wr,this.isVisible),r(this,Wr)&&(r(this,se).hidden=!0)}maybeShow(){r(this,Cs)||(b(this,ht,Zu).call(this),r(this,Wr)&&(r(this,Ps)||b(this,ht,ef).call(this),g(this,Wr,!1),r(this,se).hidden=!1))}get isVisible(){return!r(this,Cs)&&r(this,se).hidden===!1}}Cs=new WeakMap,Gr=new WeakMap,Wf=new WeakMap,Xf=new WeakMap,fh=new WeakMap,ph=new WeakMap,se=new WeakMap,Ki=new WeakMap,Vr=new WeakMap,Io=new WeakMap,gh=new WeakMap,mh=new WeakMap,Ji=new WeakMap,Ps=new WeakMap,Un=new WeakMap,Hn=new WeakMap,ie=new WeakMap,_n=new WeakMap,zr=new WeakMap,Ud=new WeakMap,jn=new WeakMap,vh=new WeakMap,Oo=new WeakMap,Wr=new WeakMap,Ee=new WeakMap,Xr=new WeakMap,ht=new WeakSet,Zu=function(){var t;if(r(this,Un))return;g(this,Un,new AbortController);const{signal:e}=r(this,Un);for(const s of this.trigger)s.addEventListener("click",r(this,fh),{signal:e}),s.addEventListener("pointerenter",r(this,Xf),{signal:e}),s.addEventListener("pointerleave",r(this,Wf),{signal:e}),s.classList.add("popupTriggerArea");for(const s of r(this,Io))(t=s.container)==null||t.addEventListener("keydown",r(this,Gr),{signal:e})},Fg=function(){const e=r(this,Io).find(t=>t.hasCommentButton);e&&g(this,_n,e._normalizePoint(e.commentButtonPosition))},Lg=function(){if(r(this,Ee).extraPopupElement&&!r(this,Ee).editor)return;r(this,ie)||this.renderCommentButton();const[e,t]=r(this,_n),{style:s}=r(this,ie);s.left=`calc(${e}%)`,s.top=`calc(${t}% - var(--comment-button-dim))`},Ng=function(){r(this,Ee).extraPopupElement||(r(this,ie)||this.renderCommentButton(),r(this,ie).style.backgroundColor=this.commentButtonColor||"")},qu=function(){const e=r(this,jn),t=r(this,Ki);return e!=null&&e.str&&(!(t!=null&&t.str)||t.str===e.str)&&r(this,jn).html||null},Bg=function(){var e,t,s;return((s=(t=(e=r(this,ht,qu))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:s.fontSize)||0},rb=function(){var e,t,s;return((s=(t=(e=r(this,ht,qu))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:s.color)||null},ab=function(e){const t=[],s={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},i={style:{color:r(this,ht,rb),fontSize:r(this,ht,Bg)?`calc(${r(this,ht,Bg)}px * var(--total-scale-factor))`:""}};for(const n of e.split(` 49`))t.push({name:"span",value:n,attributes:i});return s},ob=function(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&r(this,Ji))&&b(this,ht,tf).call(this)},lb=function(){if(r(this,Hn)!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:s,pageX:i,pageY:n}}}=r(this,gh);let a=!!r(this,mh),o=a?r(this,mh):r(this,Ud);for(const m of r(this,Io))if(!o||_.intersect(m.data.rect,o)!==null){o=m.data.rect,a=!0;break}const l=_.normalizeRect([o[0],e[3]-o[1]+e[1],o[2],e[3]-o[3]+e[1]]),c=a?o[2]-o[0]+5:0,u=l[0]+c,f=l[1];g(this,Hn,[100*(u-i)/t,100*(f-n)/s]);const{style:p}=r(this,se);
49p.left=`${r(this,Hn)[0]}%`,p.top=`${r(this,Hn)[1]}%`},tf=function(){if(r(this,Cs)){r(this,Cs).toggleCommentPopup(this,!1);return}g(this,Ji,!r(this,Ji)),r(this,Ji)?(b(this,ht,ef).call(this),r(this,se).addEventListener("click",r(this,fh)),r(this,se).addEventListener("keydown",r(this,Gr))):(b(this,ht,Ug).call(this),r(this,se).removeEventListener("click",r(this,fh)),r(this,se).removeEventListener("keydown",r(this,Gr)))},ef=function(){r(this,Ps)||this.render(),this.isVisible?r(this,Ji)&&r(this,se).classList.add("focused"):(b(this,ht,lb).call(this),r(this,se).hidden=!1,r(this,se).style.zIndex=parseInt(r(this,se).style.zIndex,10)+1e3)},Ug=function(){r(this,se).classList.remove("focused"),!(r(this,Ji)||!this.isVisible)&&(r(this,se).hidden=!0,r(this,se).style.zIndex=parseInt(r(this,se).style.zIndex,10)-1e3)};class hb extends Vt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=nt.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=this.contentElement=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const t of this.textContent){const s=document.createElement("span");s.textContent=t,e.append(s)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}var Hd;class nw extends Vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});y(this,Hd,null)}render(){this.container.classList.add("lineAnnotation");const{data:t,width:s,height:i}=this,n=this.svgFactory.create(s,i,!0),a=g(this,Hd,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),a.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),a.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),a.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),a.setAttribute("stroke-width",t.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),n.append(a),this.container.append(n),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return r(this,Hd)}addHighlightArea(){this.container.classList.add("highlightArea")}}Hd=new WeakMap;var _d;class rw extends Vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});y(this,_d,null)}render(){this.container.classList.add("squareAnnotation");const{data:t,width:s,height:i}=this,n=this.svgFactory.create(s,i,!0),a=t.borderStyle.width,o=g(this,_d,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",s-a),o.setAttribute("height",i-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return r(this,_d)}addHighlightArea(){this.container.classList.add("highlightArea")}}_d=new WeakMap;var jd;class aw extends Vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});y(this,jd,null)}render(){this.container.classList.add("circleAnnotation");const{data:t,width:s,height:i}=this,n=this.svgFactory.create(s,i,!0),a=t.borderStyle.width,o=g(this,jd,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",s/2),o.setAttribute("cy",i/2),o.setAttribute("rx",s/2-a/2),o.setAttribute("ry",i/2-a/2),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return r(this,jd)}addHighlightArea(){this.container.classList.add("highlightArea")}}jd=new WeakMap;var $d;class cb extends Vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});y(this,$d,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:s,borderStyle:i,popupRef:n},width:a,height:o}=this;if(!s)return this.container;const l=this.svgFactory.create(a,o,!0);let h=[];for(let u=0,f=s.length;u<f;u+=2){const p=s[u]-t[0],m=t[3]-s[u+1];h.push(`${p},${m}`)}h=h.join(" ");const c=g(this,$d,this.svgFactory.createElement(this.svgElementName));return c.setAttribute("points",h),c.setAttribute("stroke-width",i.width||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),l.append(c),this.container.append(l),!n&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return r(this,$d)}addHighlightArea(){this.container.classList.add("highlightArea")}}$d=new WeakMap;class ow extends cb{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class lw extends Vt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}}
49var Gd,Mo,Vd,Hg;class Rm extends Vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});y(this,Vd);y(this,Gd,null);y(this,Mo,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?nt.HIGHLIGHT:nt.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,rotation:s,inkLists:i,borderStyle:n,popupRef:a}}=this,{transform:o,width:l,height:h}=b(this,Vd,Hg).call(this,s,t),c=this.svgFactory.create(l,h,!0),u=g(this,Gd,this.svgFactory.createElement("svg:g"));c.append(u),u.setAttribute("stroke-width",n.width||1),u.setAttribute("stroke-linecap","round"),u.setAttribute("stroke-linejoin","round"),u.setAttribute("stroke-miterlimit",10),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),u.setAttribute("transform",o);for(const f of i){const p=this.svgFactory.createElement(this.svgElementName);r(this,Mo).push(p),p.setAttribute("points",f.join(",")),u.append(p)}return!a&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(c),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);const{thickness:s,points:i,rect:n}=t,a=r(this,Gd);if(s>=0&&a.setAttribute("stroke-width",s||1),i)for(let o=0,l=r(this,Mo).length;o<l;o++)r(this,Mo)[o].setAttribute("points",i[o].join(","));if(n){const{transform:o,width:l,height:h}=b(this,Vd,Hg).call(this,this.data.rotation,n);a.parentElement.setAttribute("viewBox",`0 0 ${l} ${h}`),a.setAttribute("transform",o)}}getElementsToTriggerPopup(){return r(this,Mo)}addHighlightArea(){this.container.classList.add("highlightArea")}}Gd=new WeakMap,Mo=new WeakMap,Vd=new WeakSet,Hg=function(t,s){switch(t){case 90:return{transform:`rotate(90) translate(${-s[0]},${s[1]}) scale(1,-1)`,width:s[3]-s[1],height:s[2]-s[0]};case 180:return{transform:`rotate(180) translate(${-s[2]},${s[1]}) scale(1,-1)`,width:s[2]-s[0],height:s[3]-s[1]};case 270:return{transform:`rotate(270) translate(${-s[2]},${s[3]}) scale(1,-1)`,width:s[3]-s[1],height:s[2]-s[0]};default:return{transform:`translate(${-s[0]},${s[3]}) scale(1,-1)`,width:s[2]-s[0],height:s[3]-s[1]}}};class db extends Vt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=nt.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(),e){const s=document.createElement("mark");s.classList.add("overlaidText"),s.textContent=e,this.container.append(s)}return this.container}}class hw extends Vt{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"),e){const s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=e,this.container.append(s)}return this.container}}class cw extends Vt{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"),e){const s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=e,this.container.append(s)}return this.container}}class dw extends Vt{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"),e){const s=document.createElement("s");s.classList.add("overlaidText"),s.textContent=e,this.container.append(s)}return this.container}}class ub extends Vt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=nt.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}
49var zd,Wd,_g;class uw extends Vt{constructor(t){var n;super(t,{isRenderable:!0});y(this,Wd);y(this,zd,null);const{fileId:s,file:i}=this.data;this.filename=i.filename,this.content=i.content,this.fileId=s,(n=this.linkService.eventBus)==null||n.dispatch("fileattachmentannotation",{source:this,attachmentId:this.fileId,...i})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:s}=this;let i;s.hasAppearance||s.fillAlpha===0?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(s.name)?"paperclip":"pushpin"}.svg`,s.fillAlpha&&s.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(s.fillAlpha*100)}%);`)),i.addEventListener("dblclick",b(this,Wd,_g).bind(this)),g(this,zd,i);const{isMac:n}=Mt.platform;return t.addEventListener("keydown",a=>{a.key==="Enter"&&(n?a.metaKey:a.ctrlKey)&&b(this,Wd,_g).call(this)}),!s.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return r(this,zd)}addHighlightArea(){this.container.classList.add("highlightArea")}}zd=new WeakMap,Wd=new WeakSet,_g=async function(){var a;const{fileId:t,filename:s,content:i}=this,n=await this.linkService.getAttachmentContent(t)||i;n&&((a=this.downloadManager)==null||a.openOrDownloadData(n,s))};var yh,Ro,$n,el,pb,jg;class fb extends Vt{constructor(t){super(t,{isRenderable:!!t.data.richMedia});y(this,el);y(this,yh,new AbortController);y(this,Ro,null);y(this,$n,null)}render(){this.container.classList.add("mediaAnnotation");const{filename:t}=this.data.richMedia,s=document.createElement("button");return s.className="mediaPlayButton",s.type="button",s.title=s.ariaLabel=t,s.addEventListener("click",()=>b(this,el,pb).call(this,s),{signal:r(this,yh).signal}),this.container.append(s),this.container}destroy(){r(this,yh).abort(),r(this,$n)&&(r(this,$n).pause(),r(this,$n).removeAttribute("src"),r(this,$n).load(),g(this,$n,null)),b(this,el,jg).call(this)}}yh=new WeakMap,Ro=new WeakMap,$n=new WeakMap,el=new WeakSet,pb=async function(t){const{fileId:s,filename:i,contentType:n}=this.data.richMedia;t.disabled=!0;let a;try{a=await this.linkService.getAttachmentContent(s)}catch{return}finally{t.disabled=!1}if(!a||!t.isConnected)return;const{signal:o}=r(this,yh),l=URL.createObjectURL(new Blob([a],{type:n}));g(this,Ro,l);const h=n.startsWith("audio/"),c=document.createElement(h?"audio":"video");if(g(this,$n,c),c.className="mediaContent",this._setBackgroundColor(c),c.src=l,c.title=i,c.controls=!0,c.autoplay=!0,c.tabIndex=0,h){let u=!1,f=!1;const p=()=>{c.controls=u||f};this.container.addEventListener("pointerenter",()=>{u=!0,p()},{signal:o}),this.container.addEventListener("pointerleave",()=>{u=!1,p()},{signal:o}),this.container.addEventListener("focusin",()=>{f=!0,p()},{signal:o}),this.container.addEventListener("focusout",()=>{f=!1,p()},{signal:o})}c.addEventListener("emptied",()=>b(this,el,jg).call(this,l),{once:!0,signal:o}),t.replaceWith(c),c.play().catch(()=>{})},jg=function(t=r(this,Ro)){t&&t===r(this,Ro)&&(URL.revokeObjectURL(t),g(this,Ro,null))};var Yr,Do,bh,Gn,Ah,ko,We,Xd,ln,sf,nf;const $m=class $m{constructor({div:e,accessibilityManager:t,annotationCanvasMap:s,annotationEditorUIManager:i,page:n,viewport:a,structTreeLayer:o,commentManager:l,linkService:h,annotationStorage:c}){y(this,ln);y(this,Yr,null);y(this,Do,null);y(this,bh,null);y(this,Gn,new Map);y(this,Ah,null);y(this,ko,null);y(this,We,[]);y(this,Xd,!1);R(this,"zIndex",0);this.div=e,g(this,Yr,t),g(this,Do,s),g(this,Ah,o||null),g(this,ko,h||null),g(this,bh,c||new Im),this.page=n,this.viewport=a,this._annotationEditorUIManager=i,this._commentManager=l||null}hasEditableAnnotations(){return r(this,Gn).size>0}async render(e){var l;const{annotations:t,optionalContentConfig:s}=e,i=this.div;Qo(i,this.viewport);const n=new Map,a=[],o={data:null,layer:i,linkService:r(this,ko),downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new Cf,annotationStorage:r(this,bh),enableComment:e.enableComment===!0,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const h of t){if(h.noHTML)continue;const c=h.annotationType===Yt.POPUP;if(c){const p=n.get(h.id);if(!p)continue;if(!this._commentManager){a.push(h);continue}o.elements=p}else if(h.rect[2]===h.rect[0]||h.rect[3]===h.rect[1])continue;o.data=h;const u=Tp.create(o);if(!u.isRenderable)continue;c||(r(this,We).push(u),h.popupRef&&n.getOrInsertComputed(h.popupRef,Wh).push(u));const f=u.render();h.hidden&&(f.style.visibility="hidden"),u.updateOC(s),u._isEditable&&(r(this,Gn).set(u.data.id,u),(l=this._annotationEditorUIManager)==null||l.renderAnnotationElement(u))}await b(this,ln,sf).call(this);for(const h of a){const c=o.elements=n.get(h.id);o.data=h;const u=Tp.create(o);if(!u.isRenderable)continue;const f=u.render();u.contentElement.id=`${ul}${h.id}`,h.hidden&&(f.style.visibility="hidden"),c.at(-1).container.after(f)}b(this,ln,nf).call(this)}async addLinkAnnotations(e){const t={data:null,layer:this.div,linkService:r(this,ko),svgFactory:new Cf,parent:this};for(const s of e){s.borderStyle||(s.borderStyle=$m._defaultBorderStyle),t.data=s;const i=Tp.create(t);i.isRenderable&&(i.render(),i.contentElement.id=`${ul}${s.id}`,r(this,We).push(i))}await b(this,ln,sf).call(this)}update({viewport:e,optionalContentConfig:t}){const s=this.div;this.viewport=e,Qo(s,{rotation:e.rotation});for(const i of r(this,We))i.updateOC(t);b(this,ln,nf).call(this),s.hidden=!1}destroy(){var e,t;for(const s of r(this,We))(e=s.destroy)==null||e.call(s),(t=r(this,Yr))==null||t.removePointerInTextLayer(s.contentElement);r(this,We).length=0,r(this,Gn).clear(),this.div.replaceChildren()}refreshCanvases(){b(this,ln,nf).call(this)}getEditableAnnotations(){return r(this,Gn).values()}getEditableAnnotation(e){return r(this,Gn).get(e)}addFakeAnnotation(e){const{div:t}=this,{id:s,rotation:i}=e,n=new K0({data:{id:s,rect:e.getPDFRect(),rotation:i},editor:e,layer:t,parent:this,enableComment:!!this._commentManager,linkService:r(this,ko),annotationStorage:r(this,bh)});return n.render(),n.contentElement.id=`${ul}${s}`,n.createOrUpdatePopup(),r(this,We).push(n),n}removeAnnotation(e){var i;const t=r(this,We).findIndex(n=>n.data.id===e);if(t<0)return;const[s]=r(this,We).splice(t,1);(i=r(this,Yr))==null||i.removePointerInTextLayer(s.contentElement)}updateFakeAnnotations(e){if(e.length!==0){for(const t of e)t.updateFakeAnnotationElement(this);b(this,ln,sf).call(this)}}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}static get _defaultBorderStyle(){return Q(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:ol.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}};Yr=new WeakMap,Do=new WeakMap,bh=new WeakMap,Gn=new WeakMap,Ah=new WeakMap,ko=new WeakMap,We=new WeakMap,Xd=new WeakMap,ln=new WeakSet,sf=async function(){var s,i,n,a;if(r(this,We).length===0)return;this.div.replaceChildren();const e=[];
49if(!r(this,Xd)){g(this,Xd,!0);for(const{contentElement:o,data:{hidden:l,id:h,oc:c}}of r(this,We)){const u=o.id=`${ul}${h}`,f=o.localName==="a"&&!l&&!c;e.push((s=r(this,Ah))==null?void 0:s.getAriaAttributes(u,{enableLinkOwnership:f}).then(p=>{if(p)for(const[m,v]of p)o.setAttribute(m,v)}))}}r(this,We).sort(({data:{rect:[o,l,h,c]}},{data:{rect:[u,f,p,m]}})=>{if(o===h&&l===c)return 1;if(u===p&&f===m)return-1;const v=c,A=l,w=(l+c)/2,S=m,x=f,T=(f+m)/2;if(w>=S&&T<=A)return-1;if(T>=v&&w<=x)return 1;const E=(o+h)/2,C=(u+p)/2;return E-C});const t=document.createDocumentFragment();for(const o of r(this,We))t.append(o.container),this._commentManager?(n=((i=o.extraPopupElement)==null?void 0:i.popup)||o.popup)==null||n.renderCommentButton():o.extraPopupElement&&t.append(o.extraPopupElement.render());if(this.div.append(t),await Promise.all(e),r(this,Yr)){const o=await((a=r(this,Ah))==null?void 0:a.getAnnotationIds());for(const{contentElement:l}of r(this,We))o!=null&&o.has(l.id)||r(this,Yr).addPointerInTextLayer(l,!1)}},nf=function(){var t;if(!r(this,Do))return;const e=this.div;for(const[s,i]of r(this,Do)){const n=e.querySelector(`[data-annotation-id="${s}"]`);if(!n)continue;if(Array.isArray(i))for(const c of i)c.className="annotationContent",c.ariaHidden=!0;else i.className="annotationContent",i.ariaHidden=!0;const a=[];for(const c of n.children)c.nodeName==="CANVAS"&&a.push(c);for(const c of a)c.remove();const o=Array.isArray(i)?i[0]:i,{firstChild:l}=n;if(l?l.classList.contains("annotationContent")?l.after(o):l.before(o):n.append(o),Array.isArray(i)){let c=o;for(let u=1,f=i.length;u<f;u++)c.after(i[u]),c=i[u]}r(this,Do).delete(s);const h=r(this,Gn).get(s);h&&(h._hasNoCanvas?((t=this._annotationEditorUIManager)==null||t.setMissingCanvas(s,n.id,i),h._hasNoCanvas=!1):h.canvas=i)}};let $g=$m;const Iu=/\r\n?|\n/g;var Is,Yd,Fo,Os,ue,gb,mb,vb,rf,tr,af,of,yb,Vg,bb;const Ut=class Ut extends Dt{constructor(t){super({...t,name:"freeTextEditor"});y(this,ue);y(this,Is,"");y(this,Yd,`${this.id}-editor`);y(this,Fo,null);y(this,Os);R(this,"_colorPicker",null);this.color=t.color||Ut._defaultColor||Dt._defaultLineColor,g(this,Os,t.fontSize||Ut._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert(Dt._l10nAlert.freetext),this.canAddComment=!1}static get _keyboardManager(){const t=Ut.prototype,s=a=>a.isEmpty(),i=qo.TRANSLATE_SMALL,n=qo.TRANSLATE_BIG;return Q(this,"_keyboardManager",new Zo([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter"],t.commitOrRemove],[["Escape"],t.commitOrRemove],[["ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:s}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-n,0],checker:s}],[["ArrowRight"],t._translateEmpty,{args:[i,0],checker:s}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[n,0],checker:s}],[["ArrowUp"],t._translateEmpty,{args:[0,-i],checker:s}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-n],checker:s}],[["ArrowDown"],t._translateEmpty,{args:[0,i],checker:s}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,n],checker:s}]]))}static initialize(t,s){Dt.initialize(t,s);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,s){switch(t){case ft.FREETEXT_SIZE:Ut._defaultFontSize=s;break;case ft.FREETEXT_COLOR:Ut._defaultColor=s;break}}updateParams(t,s){switch(t){case ft.FREETEXT_SIZE:b(this,ue,gb).call(this,s);break;case ft.FREETEXT_COLOR:b(this,ue,mb).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[ft.FREETEXT_SIZE,Ut._defaultFontSize],[ft.FREETEXT_COLOR,Ut._defaultColor||Dt._defaultLineColor]]}get propertiesToUpdate(){return[[ft.FREETEXT_SIZE,r(this,Os)],[ft.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new Tf(this)),[["colorPicker",this._colorPicker]]}get colorType(){return ft.FREETEXT_COLOR}onUpdatedColor(){var t;this.editorDiv.style.color=this.color,(t=this._colorPicker)==null||t.update(this.color),super.onUpdatedColor()}_translateEmpty(t,s){this._uiManager.translateSelectedEditors(t,s,!0)}getInitialTranslation(){const t=this.parentScale;return[-Ut._internalPadding*t,-(Ut._internalPadding+r(this,Os))*t]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(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"),g(this,Fo,new AbortController);const t=this._uiManager.combinedSignal(r(this,Fo));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t}),!0}disableEditMode(){var t;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",r(this,Yd)),this._isDraggable=!0,(t=r(this,Fo))==null||t.abort(),g(this,Fo,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(t){var s;this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),(s=this._initialOptions)!=null&&s.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=r(this,Is),s=g(this,Is,b(this,ue,vb).call(this).trimEnd());if(t===s)return;const i=n=>{if(g(this,Is,n),!n){this.remove();return}b(this,ue,of).call(this),this._uiManager.rebuild(this),b(this,ue,rf).call(this)};this.addCommands({cmd:()=>{i(s)},undo:()=>{i(t)},mustExec:!1}),b(this,ue,rf).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(t){t.target===this.div&&t.key==="Enter"&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){Ut._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){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}
49render(){if(this.div)return this.div;let t,s;(this._isCopy||this.annotationElementId)&&(t=this.x,s=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",r(this,Yd)),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;if(i.fontSize=`calc(${r(this,Os)}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),this._isCopy||this.annotationElementId){const[n,a]=this.parentDimensions;if(this.annotationElementId){const{position:o}=this._initialData;let[l,h]=this.getInitialTranslation();[l,h]=this.pageTranslationToScreen(l,h);const[c,u]=this.pageDimensions,[f,p]=this.pageTranslation;let m,v;switch(this.rotation){case 0:m=t+(o[0]-f)/c,v=s+this.height-(o[1]-p)/u;break;case 90:m=t+(o[0]-f)/c,v=s-(o[1]-p)/u,[l,h]=[h,-l];break;case 180:m=t-this.width+(o[0]-f)/c,v=s-(o[1]-p)/u,[l,h]=[-l,-h];break;case 270:m=t+(o[0]-f-this.height*u)/c,v=s+(o[1]-p-this.width*c)/u,[l,h]=[-h,l];break}this.setAt(m*n,v*a,l,h)}else this._moveAfterPaste(t,s);b(this,ue,of).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){var m,v,A;const s=t.clipboardData||window.clipboardData,{types:i}=s;if(i.length===1&&i[0]==="text/plain")return;t.preventDefault();const n=b(m=Ut,tr,Vg).call(m,s.getData("text")||"").replaceAll(Iu,` 50`);if(!n)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!n.includes(` 51`)){o.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:l,startOffset:h}=o,c=[],u=[];if(l.nodeType===Node.TEXT_NODE){const w=l.parentElement;if(u.push(l.nodeValue.slice(h).replaceAll(Iu,"")),w!==this.editorDiv){let S=c;for(const x of this.editorDiv.childNodes){if(x===w){S=u;continue}S.push(b(v=Ut,tr,af).call(v,x))}}c.push(l.nodeValue.slice(0,h).replaceAll(Iu,""))}else if(l===this.editorDiv){let w=c,S=0;for(const x of this.editorDiv.childNodes)S++===h&&(w=u),w.push(b(A=Ut,tr,af).call(A,x))}g(this,Is,`${c.join(` 52`)}${n}${u.join(` 53`)}`),b(this,ue,of).call(this);const f=new Range;let p=Math.sumPrecise(c.map(w=>w.length));for(const{firstChild:w}of this.editorDiv.childNodes)if(w.nodeType===Node.TEXT_NODE){const S=w.nodeValue.length;if(p<=S){f.setStart(w,p),f.setEnd(w,p);break}p-=S}a.removeAllRanges(),a.addRange(f)}get contentDiv(){return this.editorDiv}getPDFRect(){const t=Ut._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,s,i){var o;let n=null;if(t instanceof hb){const{data:{defaultAppearanceData:{fontSize:l,fontColor:h},rect:c,rotation:u,id:f,popupRef:p,richText:m,contentsObj:v,creationDate:A,modificationDate:w},textContent:S,textPosition:x,parent:{page:{pageNumber:T}}}=t;if(!(S!=null&&S.length))return null;n=t={annotationType:nt.FREETEXT,color:Array.from(h),fontSize:l,value:S.join(` 54`),position:x,pageIndex:T-1,rect:c.slice(0),rotation:u,annotationElementId:f,id:f,deleted:!1,popupRef:p,comment:(v==null?void 0:v.str)||null,richText:m,creationDate:A,modificationDate:w}}const a=await super.deserialize(t,s,i);return g(a,Os,t.fontSize),a.color=_.makeHexColor(...t.color),g(a,Is,b(o=Ut,tr,Vg).call(o,t.value)),a._initialData=n,t.comment&&a.setCommentData(t),a}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s=Dt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(t),{color:s,fontSize:r(this,Os),value:b(this,ue,yb).call(this)});return this.addComment(i),t?(i.isCopy=!0,i):this.annotationElementId&&!b(this,ue,bb).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(t){const s=super.renderAnnotationElement(t);if(!s)return null;const{style:i}=s;i.fontSize=`calc(${r(this,Os)}px * var(--total-scale-factor))`,i.color=this.color,s.replaceChildren();for(const n of r(this,Is).split(` 55`)){const a=document.createElement("div");a.append(n?document.createTextNode(n):document.createElement("br")),s.append(a)}return t.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:r(this,Is)}}),s}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}};
55Is=new WeakMap,Yd=new WeakMap,Fo=new WeakMap,Os=new WeakMap,ue=new WeakSet,gb=function(t){const s=n=>{this.editorDiv.style.fontSize=`calc(${n}px * var(--total-scale-factor))`,this.translate(0,-(n-r(this,Os))*this.parentScale),g(this,Os,n),b(this,ue,rf).call(this)},i=r(this,Os);this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ft.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},mb=function(t){const s=n=>{this.color=n,this.onUpdatedColor()},i=this.color;this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ft.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},vb=function(){var i;const t=[];this.editorDiv.normalize();let s=null;for(const n of this.editorDiv.childNodes)(s==null?void 0:s.nodeType)===Node.TEXT_NODE&&n.nodeName==="BR"||(t.push(b(i=Ut,tr,af).call(i,n)),s=n);return t.join(` 56`)},rf=function(){const[t,s]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:n,div:a}=this,o=a.style.display,l=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",n.div.append(this.div),i=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",l)}this.rotation%180===this.parentRotation%180?(this.width=i.width/t,this.height=i.height/s):(this.width=i.height/t,this.height=i.width/s),this.fixAndSetPosition()},tr=new WeakSet,af=function(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(Iu,"")},of=function(){if(this.editorDiv.replaceChildren(),!!r(this,Is))for(const t of r(this,Is).split(` 57`)){const s=document.createElement("div");s.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(s)}},yb=function(){return r(this,Is).replaceAll("Â "," ")},Vg=function(t){return t.replaceAll(" ","Â ")},bb=function(t){const{value:s,fontSize:i,color:n,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||t.value!==s||t.fontSize!==i||t.color.some((o,l)=>o!==n[l])||t.pageIndex!==a},y(Ut,tr),R(Ut,"_freeTextDefaultContent",""),R(Ut,"_internalPadding",0),R(Ut,"_defaultColor",null),R(Ut,"_defaultFontSize",10),R(Ut,"_type","freetext"),R(Ut,"_editorType",nt.FREETEXT);let Gg=Ut;var Lo;class Dm{constructor(){y(this,Lo,Object.create(null))}updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(const[t,s]of Object.entries(e))t.startsWith("_")||this.updateProperty(t,s)}updateSVGProperty(e,t){r(this,Lo)[e]=t}toSVGProperties(){const e=r(this,Lo);return g(this,Lo,Object.create(null)),{root:e}}reset(){g(this,Lo,Object.create(null))}updateAll(e=this){this.updateProperties(e)}clone(){gt("Not implemented")}}Lo=new WeakMap;var wh,Sh,he,No,Bo,Eh,tt,zg,Wg,Xg,Yg,gc,Kg,Jg,Qg,mc,Ab,lf,vc,dl;const at=class at extends Dt{constructor(t){super(t);y(this,tt);y(this,wh,null);y(this,Sh);R(this,"_clipPathId",null);R(this,"_colorPicker",null);R(this,"_drawId",null);R(this,"_drawOutlines",null);R(this,"_focusDrawId",null);g(this,Sh,t.mustBeCommitted||!1),this._addOutlines(t)}onUpdatedColor(){var t;(t=this._colorPicker)==null||t.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){var t,s;(s=(t=this._colorPicker)==null?void 0:t.updateOpacity)==null||s.call(t,this.opacity)}_addOutlines(t){t.drawOutlines&&(b(this,tt,zg).call(this,t),b(this,tt,mc).call(this))}static _mergeSVGProperties(t,s){const i=new Set(Object.keys(t));for(const[n,a]of Object.entries(s))i.has(n)?Object.assign(t[n],a):t[n]=a;return t}static getDefaultDrawingOptions(t){gt("Not implemented")}static get typesMap(){gt("Not implemented")}static get isDrawer(){return!0}static get _hasClipPath(){return!1}static get _hasDrawClass(){return!0}static get supportMultipleDrawings(){return!1}get _drawRotation(){return this.rotation}get _opacityName(){return this.constructor.typesMap.get(this.opacityType)}static updateDefaultParams(t,s){const i=this.typesMap.get(t);i&&this._defaultDrawingOptions.updateProperty(i,s),this._currentParent&&(r(at,he).updateProperty(i,s),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,s){const i=this.constructor.typesMap.get(t);i&&this._updateProperty(t,i,s)}static get defaultPropertiesToUpdate(){const t=[],s=this._defaultDrawingOptions;for(const[i,n]of this.typesMap)t.push([i,s[n]]);return t}get propertiesToUpdate(){const t=[],{_drawingOptions:s}=this;for(const[i,n]of this.constructor.typesMap)t.push([i,s[n]]);return t}_updateProperty(t,s,i){const n=this._drawingOptions,a=n[s],o=l=>{var c;n.updateProperty(s,l);const h=this._drawOutlines.updateProperty(s,l);h&&b(this,tt,vc).call(this,h),(c=this.parent)==null||c.drawLayer.updateProperties(this._drawId,n.toSVGProperties()),t===this.colorType?this.onUpdatedColor():t===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:o.bind(this,i),undo:o.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(t,s,i=this.colorAndOpacityType){const n=this.constructor.typesMap.get(this.colorType),a=this._opacityName,o=this._drawingOptions,l=o[n],h=o[a],c=(u,f)=>{var p;o.updateProperty(n,u),o.updateProperty(a,f),this._drawOutlines.updateProperty(n,u),this._drawOutlines.updateProperty(a,f),(p=this.parent)==null||p.drawLayer.updateProperties(this._drawId,o.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};
57this.addCommands({cmd:c.bind(this,t,s),undo:c.bind(this,l,h),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:i,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,at._mergeSVGProperties(this._drawOutlines.getPathResizingSVGProperties(b(this,tt,lf).call(this)),{bbox:b(this,tt,dl).call(this)}))}_onResized(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,at._mergeSVGProperties(this._drawOutlines.getPathResizedSVGProperties(b(this,tt,lf).call(this)),{bbox:b(this,tt,dl).call(this)})),b(this,tt,Yg).call(this)}_onTranslating(t,s){var i;(i=this.parent)==null||i.drawLayer.updateProperties(this._drawId,{bbox:b(this,tt,dl).call(this)})}_onTranslated(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,at._mergeSVGProperties(this._drawOutlines.getPathTranslatedSVGProperties(b(this,tt,lf).call(this),this.parentDimensions),{bbox:b(this,tt,dl).call(this)}))}_onStartDragging(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}get _mustBeDisabledOnCommit(){return!0}commit(){super.commit(),this._mustBeDisabledOnCommit&&(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(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,r(this,Sh)&&(g(this,Sh,!1),this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){this._uiManager.removeShouldRescale(this),b(this,tt,Qg).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,tt,mc).call(this),b(this,tt,vc).call(this,this._drawOutlines.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var i;let s=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),b(this,tt,Qg).call(this)):t&&(this._uiManager.addShouldRescale(this),b(this,tt,mc).call(this,t),s=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(t),b(this,tt,Kg).call(this),s&&this.select()}rotate(t=this.parentRotation){if(!this.parent||this._drawId===null)return;const s=(t-this._drawRotation+360)%360;this.parent.drawLayer.updateProperties(this._drawId,at._mergeSVGProperties({bbox:b(this,tt,dl).call(this,t)},this._drawOutlines.updateRotation(s))),b(this,tt,Yg).call(this,s)}show(t=this._isVisible){super.show(t),b(this,tt,Kg).call(this)}select(){super.select(),b(this,tt,gc).call(this,{hovered:!1,selected:!0})}unselect(){super.unselect(),b(this,tt,gc).call(this,{selected:!1})}pointerover(){this.isSelected||b(this,tt,gc).call(this,{hovered:!0})}pointerleave(){this.isSelected||b(this,tt,gc).call(this,{hovered:!1})}onScaleChanging(){if(!this.parent)return;const t=this._drawOutlines.updateParentDimensions(this.parentDimensions,this.parent.scale);t&&b(this,tt,vc).call(this,t)}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,s;this._isCopy&&(t=this.x,s=this.y);const i=super.render();this.constructor._hasDrawClass&&i.classList.add("draw");const n=g(this,wh,document.createElement("div"));return i.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",this._clipPathId&&(n.style.clipPath=this._clipPathId),_v(this,n,["pointerover","pointerleave"]),this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,s),i}static createDrawerInstance(t){gt("Not implemented")}static _getDrawingTarget(t,{target:s}){return s}static _getPointerCoords({offsetX:t,offsetY:s,clientX:i,clientY:n},a=null){if(!a)return[t,s];let o=i-a.clientX,l=n-a.clientY;switch(this._currentParent.viewport.rotation){case 90:[o,l]=[l,-o];break;case 180:[o,l]=[-o,-l];break;case 270:[o,l]=[-l,o];break}return[a.offsetX+o,a.offsetY+l]}static _addDrawingListeners(t,s){}static _endDrawingSession(t=!1){return this._currentParent.endDrawingSession(t)}static startDrawing(t,s,i,n){var T;const{pointerId:a,pointerType:o}=n;
57if($e.isInitializedAndDifferentPointerType(o))return;const l=this._getDrawingTarget(t,n),[h,c]=this._getPointerCoords(n),{viewport:{rotation:u}}=t,{x:f,y:p,width:m,height:v}=l.getBoundingClientRect(),A=g(at,No,new AbortController),w=t.combinedSignal(A);if($e.setPointer(o,a),window.addEventListener("pointerup",E=>{$e.isSamePointerIdOrRemove(E.pointerId)&&this._endDraw(E)},{signal:w}),window.addEventListener("pointercancel",E=>{$e.isSamePointerIdOrRemove(E.pointerId)&&this._endDrawingSession()},{signal:w}),window.addEventListener("pointerdown",E=>{$e.isSamePointerType(E.pointerType)&&($e.initializeAndAddPointerId(E.pointerId),r(at,he).isCancellable()&&(r(at,he).removeLastElement(),r(at,he).isEmpty()?this._endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:w}),window.addEventListener("contextmenu",Ti,{signal:w}),l.addEventListener("pointermove",this._drawMove.bind(this),{signal:w}),l.addEventListener("touchmove",E=>{$e.isSameTimeStamp(E.timeStamp)&&me(E)},{signal:w}),this._addDrawingListeners(l,w),t.toggleDrawing(),(T=s._editorUndoBar)==null||T.hide(),r(at,he)){t.drawLayer.updateProperties(this._currentDrawId,r(at,he).startNew(h,c,m,v,u));return}s.updateUIForDefaultProperties(this),g(at,he,this.createDrawerInstance({x:h,y:c,box:[f,p,m,v],rotation:u,parent:t,isLTR:i})),g(at,Bo,this.getDefaultDrawingOptions()),this._currentParent=t;const{id:S,clipPathId:x}=t.drawLayer.draw(this._mergeSVGProperties(r(at,Bo).toSVGProperties(),r(at,he).defaultSVGProperties),!0,this._hasClipPath);this._currentDrawId=S,g(at,Eh,this._hasClipPath?x:null)}static _drawMove(t){var n;if($e.isSameTimeStamp(t.timeStamp),!r(at,he)||!$e.isSamePointerId(t.pointerId))return;if($e.isUsingMultiplePointers()){this._endDraw(t);return}let s;const i=(n=t.getCoalescedEvents)==null?void 0:n.call(t);if(i!=null&&i.length){const a=[];for(const o of i)a.push(...this._getPointerCoords(o,t));s=r(at,he).addPoints(a)}else s=r(at,he).add(...this._getPointerCoords(t));this._currentParent.drawLayer.updateProperties(this._currentDrawId,s),$e.setTimeStamp(t.timeStamp),me(t)}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,g(at,he,null),g(at,Bo,null),g(at,Eh,null),$e.clearTimeStamp()),r(at,No)&&(r(at,No).abort(),g(at,No,null),$e.clearPointerIds())}static _endDraw(t){const s=this._currentParent;if(s){if(s.toggleDrawing(!0),this._cleanup(!1),s.drawLayer.updateProperties(this._currentDrawId,(t==null?void 0:t.target)===s.div?r(at,he).end(...this._getPointerCoords(t)):r(at,he).end()),this.supportMultipleDrawings){const i=r(at,he),n=this._currentDrawId,a=i.getLastElement();s.addCommands({cmd:()=>{s.drawLayer.updateProperties(n,i.setLastElement(a))},undo:()=>{s.drawLayer.updateProperties(n,i.removeLastElement())},mustExec:!1,type:ft.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){const s=this._currentParent;if(!s)return null;if(s.toggleDrawing(!0),s.cleanUndoStack(ft.DRAW_STEP),!r(at,he).isEmpty()){const{pageDimensions:[i,n],scale:a}=s,o=s.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,clipPathId:r(at,Eh),drawOutlines:r(at,he).getOutlines(i*a,n*a,a,this._INNER_MARGIN),drawingOptions:r(at,Bo),mustBeCommitted:!t});return this._cleanup(!0),o}return s.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,s,i,n,a,o,l){gt("Not implemented")}static async deserialize(t,s,i){var u,f;const{rawDims:{pageWidth:n,pageHeight:a,pageX:o,pageY:l}}=s.viewport,h=this.deserializeDraw(o,l,n,a,this._INNER_MARGIN,t,i),c=await super.deserialize(t,s,i);return c.createDrawingOptions(t),b(u=c,tt,zg).call(u,{drawOutlines:h}),b(f=c,tt,mc).call(f),c.onScaleChanging(),c.rotate(),c}serializeDraw(t){const[s,i]=this.pageTranslation,[n,a]=this.pageDimensions;return this._drawOutlines.serialize([s,i,n,a],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};wh=new WeakMap,Sh=new WeakMap,he=new WeakMap,No=new WeakMap,Bo=new WeakMap,Eh=new WeakMap,tt=new WeakSet,zg=function({drawOutlines:t,drawId:s,drawingOptions:i,clipPathId:n}){this._drawOutlines=t,this._drawingOptions||(this._drawingOptions=i),this.annotationElementId||this._uiManager.a11yAlert(Dt._l10nAlert[this.editorType]),s>=0?(this._drawId=s,this._clipPathId=n??null,this.parent.drawLayer.finalizeDraw(s,t.defaultProperties),b(this,tt,Xg).call(this,this.parent)):this._drawId=b(this,tt,Wg).call(this,t,this.parent),b(this,tt,vc).call(this,t.box)},Wg=function(t,s){const{id:i,clipPathId:n}=s.drawLayer.draw(at._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,this.constructor._hasCl
57ipPath);return this.constructor._hasClipPath&&(this._clipPathId=n),b(this,tt,Xg).call(this,s),i},Xg=function(t){const s=this._drawOutlines.getFocusSVGProperties(r(this,tt,Jg));s&&(this._focusDrawId=t.drawLayer.drawOutline(s,this._drawOutlines.focusMustRemoveSelfIntersections))},Yg=function(t=r(this,tt,Jg)){var s;this._focusDrawId!==null&&((s=this.parent)==null||s.drawLayer.updateProperties(this._focusDrawId,this._drawOutlines.getFocusSVGProperties(t)))},gc=function(t){var s;this._focusDrawId!==null&&((s=this.parent)==null||s.drawLayer.updateProperties(this._focusDrawId,{rootClass:t}))},Kg=function(){const{parent:t,_drawId:s,_focusDrawId:i,_isVisible:n}=this;if(!t||s===null)return;const a={hidden:!n};t.drawLayer.updateProperties(s,{rootClass:a}),i!==null&&t.drawLayer.updateProperties(i,{rootClass:a})},Jg=function(){return(this.parentRotation-this._drawRotation+360)%360},Qg=function(){if(this._drawId===null||!this.parent)return;const{drawLayer:t}=this.parent;t.remove(this._drawId),this._drawId=null,this._focusDrawId!==null&&(t.remove(this._focusDrawId),this._focusDrawId=null),this._drawingOptions.reset()},mc=function(t=this.parent){if(!(this._drawId!==null&&this.parent===t)){if(this._drawId!==null){const{drawLayer:s}=this.parent;s.updateParent(this._drawId,t.drawLayer),this._focusDrawId!==null&&s.updateParent(this._focusDrawId,t.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=b(this,tt,Wg).call(this,this._drawOutlines,t),this._clipPathId&&r(this,wh)&&(r(this,wh).style.clipPath=this._clipPathId)}},Ab=function([t,s,i,n]){const{parentDimensions:[a,o],_drawRotation:l}=this;switch(l){case 90:return[s,1-t,i*(o/a),n*(a/o)];case 180:return[1-t,1-s,i,n];case 270:return[1-s,t,i*(o/a),n*(a/o)];default:return[t,s,i,n]}},lf=function(){const{x:t,y:s,width:i,height:n,parentDimensions:[a,o],_drawRotation:l}=this;switch(l){case 90:return[1-s,t,i*(a/o),n*(o/a)];case 180:return[1-t,1-s,i,n];case 270:return[s,1-t,i*(a/o),n*(o/a)];default:return[t,s,i,n]}},vc=function(t){[this.x,this.y,this.width,this.height]=b(this,tt,Ab).call(this,t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},dl=function(t=this.parentRotation){const{x:s,y:i,width:n,height:a,_drawRotation:o,parentDimensions:[l,h]}=this;switch((o*4+t)/90){case 1:return[1-i-a,s,a,n];case 2:return[1-s-n,1-i-a,n,a];case 3:return[i,1-s-n,a,n];case 4:return[s,i-n*(l/h),a*(h/l),n*(l/h)];case 5:return[1-i,s,n*(l/h),a*(h/l)];case 6:return[1-s-a*(h/l),1-i,a*(h/l),n*(l/h)];case 7:return[i-n*(l/h),1-s-a*(h/l),n*(l/h),a*(h/l)];case 8:return[s-n,i-a,n,a];case 9:return[1-i,s-n,a,n];case 10:return[1-s,1-i,n,a];case 11:return[i-a,1-s,a,n];case 12:return[s-a*(h/l),i,a*(h/l),n*(l/h)];case 13:return[1-i-n*(l/h),s-a*(h/l),n*(l/h),a*(h/l)];case 14:return[1-s,1-i-n*(l/h),a*(h/l),n*(l/h)];case 15:return[i,1-s,n*(l/h),a*(h/l)];default:return[s,i,n,a]}},R(at,"_currentDrawId",-1),R(at,"_currentParent",null),y(at,he,null),y(at,No,null),y(at,Bo,null),y(at,Eh,null),R(at,"_INNER_MARGIN",3);let Mc=at;class V{constructor(){R(this,"focusOutline",null)}toSVGPath(){gt("Abstract method `toSVGPath` must be implemented.")}get box(){gt("Abstract getter `box` must be implemented.")}serialize(e,t){gt("Abstract method `serialize` must be implemented.")}get defaultSVGProperties(){gt("Abstract getter `defaultSVGProperties` must be implemented.")}get defaultProperties(){return this.defaultSVGProperties}getFocusSVGProperties(e){return null}get focusMustRemoveSelfIntersections(){return!1}updateProperty(e,t){return null}updateParentDimensions(e,t){return null}serializeQuadPoints(e,t){return null}updateRotation(e){return{}}getPathResizingSVGProperties(e){return{}}getPathResizedSVGProperties(e){return{}}getPathTranslatedSVGProperties(e,t){return{}}static _rotateBox([e,t,s,i],n){switch(n){case 90:return[1-t-i,e,i,s];case 180:return[1-e-s,1-t-i,s,i];case 270:return[t,1-e-s,i,s]}return[e,t,s,i]}static _rescale(e,t,s,i,n,a){a||(a=new Float32Array(e.length));for(let o=0,l=e.length;o<l;o+=2)a[o]=t+e[o]*i,a[o+1]=s+e[o+1]*n;return a}static _rescaleAndSwap(e,t,s,i,n,a){a||(a=new Float32Array(e.length));for(let o=0,l=e.length;o<l;o+=2)a[o]=t+e[o+1]*i,a[o+1]=s+e[o]*n;return a}static _translate(e,t,s,i){i||(i=new Float32Array(e.length));for(let n=0,a=e.length;n<a;n+=2)i[n]=t+e[n],i[n+1]=s+e[n+1];return i}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,s,i,n){switch(n){case 90:return[1-t/s,e/i];case 180:return[1-e/s,1-t/i];case 270:return[t/s,1-e/i];default:return[e/s,t/i]}}static createBezierPoints(e,t,s,i,n,a){return[(e+5*s)/6,(t+5*i)/6,(5*s+n)/6,(5*i+a)/6,(s+n)/2,(i+a)/2]}}R(V,"PRECISION",1e-4);var Ms,ei,xh,Th,bi,ct,Uo,Ho,Kd,Jd,Ch,Ph,Qi,Qd,Yf,Kf,ve,yc,wb,Sb,Eb,xb,Tb,Cb;const gn=class gn{constructor(e,t,s,i,n,a,o=0){y(this,ve);y(this,Ms);y(this,ei,[]);y(this,xh);y(this,Th);y(this,bi,[]);y(this,ct,new Float32Array(18));
57y(this,Uo);y(this,Ho);y(this,Kd);y(this,Jd);y(this,Ch);y(this,Ph);y(this,Qi,[]);g(this,Ms,s),g(this,Ph,n*i),g(this,Th,a),r(this,ct).set([NaN,NaN,NaN,NaN,e,t],6),g(this,xh,o),g(this,Jd,r(gn,Qd)*i),g(this,Kd,r(gn,Kf)*i),g(this,Ch,i),r(this,Qi).push(e,t)}isEmpty(){return isNaN(r(this,ct)[8])}isCancellable(){return r(this,Qi).length<=10}removeLastElement(){return r(this,ct).fill(NaN),r(this,bi).length=r(this,ei).length=r(this,Qi).length=0,{path:{d:""}}}add(e,t){var I;g(this,Uo,e),g(this,Ho,t);const[s,i,n,a]=r(this,Ms);let[o,l,h,c]=r(this,ct).subarray(8,12);const u=e-h,f=t-c,p=Math.hypot(u,f);if(p<r(this,Kd))return!1;const m=p-r(this,Jd),v=m/p,A=v*u,w=v*f;let S=o,x=l;o=h,l=c,h+=A,c+=w,(I=r(this,Qi))==null||I.push(e,t);const T=-w/m,E=A/m,C=T*r(this,Ph),P=E*r(this,Ph);return r(this,ct).set(r(this,ct).subarray(2,8),0),r(this,ct).set([h+C,c+P],4),r(this,ct).set(r(this,ct).subarray(14,18),12),r(this,ct).set([h-C,c-P],16),isNaN(r(this,ct)[6])?(r(this,bi).length===0&&(r(this,ct).set([o+C,l+P],2),r(this,bi).push(NaN,NaN,NaN,NaN,(o+C-s)/n,(l+P-i)/a),r(this,ct).set([o-C,l-P],14),r(this,ei).push(NaN,NaN,NaN,NaN,(o-C-s)/n,(l-P-i)/a)),r(this,ct).set([S,x,o,l,h,c],6),!this.isEmpty()):(r(this,ct).set([S,x,o,l,h,c],6),Math.abs(Math.atan2(x-l,S-o)-Math.atan2(w,A))<Math.PI/2?([o,l,h,c]=r(this,ct).subarray(2,6),r(this,bi).push(NaN,NaN,NaN,NaN,((o+h)/2-s)/n,((l+c)/2-i)/a),[o,l,S,x]=r(this,ct).subarray(14,18),r(this,ei).push(NaN,NaN,NaN,NaN,((S+o)/2-s)/n,((x+l)/2-i)/a),!0):([S,x,o,l,h,c]=r(this,ct).subarray(0,6),r(this,bi).push(((S+5*o)/6-s)/n,((x+5*l)/6-i)/a,((5*o+h)/6-s)/n,((5*l+c)/6-i)/a,((o+h)/2-s)/n,((l+c)/2-i)/a),[h,c,o,l,S,x]=r(this,ct).subarray(12,18),r(this,ei).push(((S+5*o)/6-s)/n,((x+5*l)/6-i)/a,((5*o+h)/6-s)/n,((5*l+c)/6-i)/a,((o+h)/2-s)/n,((l+c)/2-i)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const e=r(this,bi),t=r(this,ei);if(isNaN(r(this,ct)[6])&&!this.isEmpty())return b(this,ve,wb).call(this);const s=[];
57s.push(`M${e[4]} ${e[5]}`);for(let i=6;i<e.length;i+=6)isNaN(e[i])?s.push(`L${e[i+4]} ${e[i+5]}`):s.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);b(this,ve,Eb).call(this,s);for(let i=t.length-6;i>=6;i-=6)isNaN(t[i])?s.push(`L${t[i+4]} ${t[i+5]}`):s.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);return b(this,ve,Sb).call(this,s),s.join(" ")}newFreeDrawOutline(e,t,s,i,n,a){return new Pb(e,t,s,i,n,a)}getOutlines(){var u;const e=r(this,bi),t=r(this,ei),s=r(this,ct),[i,n,a,o]=r(this,Ms),l=new Float32Array((((u=r(this,Qi))==null?void 0:u.length)??0)+2);for(let f=0,p=l.length-2;f<p;f+=2)l[f]=(r(this,Qi)[f]-i)/a,l[f+1]=(r(this,Qi)[f+1]-n)/o;if(l[l.length-2]=(r(this,Uo)-i)/a,l[l.length-1]=(r(this,Ho)-n)/o,isNaN(s[6])&&!this.isEmpty())return b(this,ve,xb).call(this,l);const h=new Float32Array(r(this,bi).length+24+r(this,ei).length);let c=e.length;for(let f=0;f<c;f+=2){if(isNaN(e[f])){h[f]=h[f+1]=NaN;continue}h[f]=e[f],h[f+1]=e[f+1]}c=b(this,ve,Cb).call(this,h,c);for(let f=t.length-6;f>=6;f-=6)for(let p=0;p<6;p+=2){if(isNaN(t[f+p])){h[c]=h[c+1]=NaN,c+=2;continue}h[c]=t[f+p],h[c+1]=t[f+p+1],c+=2}return b(this,ve,Tb).call(this,h,c),this.newFreeDrawOutline(h,l,r(this,Ms),r(this,Ch),r(this,xh),r(this,Th))}};Ms=new WeakMap,ei=new WeakMap,xh=new WeakMap,Th=new WeakMap,bi=new WeakMap,ct=new WeakMap,Uo=new WeakMap,Ho=new WeakMap,Kd=new WeakMap,Jd=new WeakMap,Ch=new WeakMap,Ph=new WeakMap,Qi=new WeakMap,Qd=new WeakMap,Yf=new WeakMap,Kf=new WeakMap,ve=new WeakSet,yc=function(){const e=r(this,ct).subarray(4,6),t=r(this,ct).subarray(16,18),[s,i,n,a]=r(this,Ms);return[(r(this,Uo)+(e[0]-t[0])/2-s)/n,(r(this,Ho)+(e[1]-t[1])/2-i)/a,(r(this,Uo)+(t[0]-e[0])/2-s)/n,(r(this,Ho)+(t[1]-e[1])/2-i)/a]},wb=function(){const[e,t,s,i]=r(this,Ms),[n,a,o,l]=b(this,ve,yc).call(this);return`M${(r(this,ct)[2]-e)/s} ${(r(this,ct)[3]-t)/i} L${(r(this,ct)[4]-e)/s} ${(r(this,ct)[5]-t)/i} L${n} ${a} L${o} ${l} L${(r(this,ct)[16]-e)/s} ${(r(this,ct)[17]-t)/i} L${(r(this,ct)[14]-e)/s} ${(r(this,ct)[15]-t)/i} Z`},Sb=function(e){const t=r(this,ei);e.push(`L${t[4]} ${t[5]} Z`)},Eb=function(e){const[t,s,i,n]=r(this,Ms),a=r(this,ct).subarray(4,6),o=r(this,ct).subarray(16,18),[l,h,c,u]=b(this,ve,yc).call(this);e.push(`L${(a[0]-t)/i} ${(a[1]-s)/n} L${l} ${h} L${c} ${u} L${(o[0]-t)/i} ${(o[1]-s)/n}`)},xb=function(e){const t=r(this,ct),[s,i,n,a]=r(this,Ms),[o,l,h,c]=b(this,ve,yc).call(this),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(t[2]-s)/n,(t[3]-i)/a,NaN,NaN,NaN,NaN,(t[4]-s)/n,(t[5]-i)/a,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,(t[16]-s)/n,(t[17]-i)/a,NaN,NaN,NaN,NaN,(t[14]-s)/n,(t[15]-i)/a],0),this.newFreeDrawOutline(u,e,r(this,Ms),r(this,Ch),r(this,xh),r(this,Th))},Tb=function(e,t){const s=r(this,ei);return e.set([NaN,NaN,NaN,NaN,s[4],s[5]],t),t+=6},Cb=function(e,t){const s=r(this,ct).subarray(4,6),i=r(this,ct).subarray(16,18),[n,a,o,l]=r(this,Ms),[h,c,u,f]=b(this,ve,yc).call(this);return e.set([NaN,NaN,NaN,NaN,(s[0]-n)/o,(s[1]-a)/l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,u,f,NaN,NaN,NaN,NaN,(i[0]-n)/o,(i[1]-a)/l],t),t+=24},y(gn,Qd,8),y(gn,Yf,2),y(gn,Kf,r(gn,Qd)+r(gn,Yf));let Pf=gn;var Ih,Zi,Vn,Zd,Ai,qd,Zt,Jf,Ib;class Pb extends V{constructor(t,s,i,n,a,o){super();y(this,Jf);y(this,Ih);y(this,Zi,new Float32Array(4));y(this,Vn);y(this,Zd);y(this,Ai);y(this,qd);y(this,Zt);g(this,Zt,t),g(this,Ai,s),g(this,Ih,i),g(this,qd,n),g(this,Vn,a),g(this,Zd,o),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],b(this,Jf,Ib).call(this,o);const[l,h,c,u]=r(this,Zi);for(let f=0,p=t.length;f<p;f+=2)t[f]=(t[f]-l)/c,t[f+1]=(t[f+1]-h)/u;for(let f=0,p=s.length;f<p;f+=2)s[f]=(s[f]-l)/c,s[f+1]=(s[f+1]-h)/u}toSVGPath(){const t=[`M${r(this,Zt)[4]} ${r(this,Zt)[5]}`];for(let s=6,i=r(this,Zt).length;s<i;s+=6){if(isNaN(r(this,Zt)[s])){t.push(`L${r(this,Zt)[s+4]} ${r(this,Zt)[s+5]}`);continue}t.push(`C${r(this,Zt)[s]} ${r(this,Zt)[s+1]} ${r(this,Zt)[s+2]} ${r(this,Zt)[s+3]} ${r(this,Zt)[s+4]} ${r(this,Zt)[s+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,s,i,n],a){const o=i-t,l=n-s;let h,c;switch(a){case 0:h=V._rescale(r(this,Zt),t,n,o,-l),c=V._rescale(r(this,Ai),t,n,o,-l);break;case 90:h=V._rescaleAndSwap(r(this,Zt),t,s,o,l),c=V._rescaleAndSwap(r(this,Ai),t,s,o,l);break;case 180:h=V._rescale(r(this,Zt),i,s,-o,l),c=V._rescale(r(this,Ai),i,s,-o,l);break;case 270:h=V._rescaleAndSwap(r(this,Zt),i,n,-o,-l),c=V._rescaleAndSwap(r(this,Ai),i,n,-o,-l);break}return{outline:Array.from(h),points:[Array.from(c)]}}get box(){return r(this,Zi)}newOutliner(t,s,i,n,a,o,l=0){return new Pf(t,s,i,n,a,o,l)}updateThickness(t){const s=this.getNewOutline(t);return g(this,Zt,r(s,Zt)),g(this,Ai,r(s,Ai)),r(this,Zi).set(r(s,Zi)),this.firstPoint=s.firstPoint,this.lastPoint=s.lastPoint,r(this,Zi)}getNewOutline(t,s){const[i,n,a,o]=r(this,Zi),[l,h,c,u]=r(this,Ih),f=a*c,p=o*u,m=i*c+l,v=n*u+h,A=r(this,Ai),w=this.newOutliner(A[0]*f+m,A[1]*p+v,r(this,Ih),r(this,qd),t,r(this,Zd),s??r(this,Vn));for(let S=2,x=A.length;S<x;S+=2)w.add(A[S]*f+m,A[S+1]*p+v);return w.getOutlines()}}Ih=new WeakMap,Zi=new WeakMap,Vn=new WeakMap,Zd=new WeakMap,Ai=new WeakMap,qd=new WeakMap,Zt=new WeakMap,Jf=new WeakSet,Ib=function(t){const s=r(this,Zt);let i=s[4],n=s[5];const a=[i,n,i,n];let o=i,l=n,h=i,c=n;const u=t?Math.max:Math.min,f=new Float32Array(4);for(let m=6,v=s.length;m<v;m+=6){const A=s[m+4],w=s[m+5];isNaN(s[m])?(_.pointBoundingBox(A,w,a),l>w?(o=A,l=w):l===w&&(o=u(o,A)),c<w?(h=A,c=w):c===w&&(h=u(h,A))):(f.set(Zn,0),_.bezierBoundingBox(i,n,...s.slice(m,m+6),f),_.rectBoundingBox(...f,a),l>f[1]?(o=f[0],l=f[1]):l===f[1]&&(o=u(o,f[0])),c<f[3]?(h=f[2],c=f[3]):c===f[3]&&(h=u(h,f[2]))),i=A,n=w}const p=r(this,Zi);p[0]=a[0]-r(this,Vn),p[1]=a[1]-r(this,Vn),p[2]=a[2]-a[0]+2*r(this,Vn),p[3]=a[3]-a[1]+2*r(this,Vn),this.firstPoint=[o,l],this.lastPoint=[h,c]};function Ob(d){return{bbox:d.box,root:{viewBox:"0 0 1 1"},rootClass:{highlight:!0,free:d.isFree},path:{d:d.toSVGPath()}}}function Mb(d,e){const{focusOutline:t}=d;return{bbox:V._rotateBox(t.box,e),root:{"data-main-rotation":e},rootClass:{highlightOutline:!0,free:d.isFree},path:{d:t.toSVGPath()}}}var tu,eu,su,Kr,wi,as,Rb,hf,Db,kb,qg;class Zg{constructor(e,t=0,s=0,i=!0){y(this,as);y(this,tu);y(this,eu);y(this,su);y(this,Kr,[]);y(this,wi,[]);const n=Zn.slice(),a=10**-4;for(const{x:v,y:A,width:w,height:S}of e){const x=Math.floor((v-t)/a)*a,T=Math.ceil((v+w+t)/a)*a,E=Math.floor((A-t)/a)*a,C=Math.ceil((A+S+t)/a)*a,P=[x,E,C,!0],O=[T,E,C,!1];r(this,Kr).push(P,O),_.rectBoundingBox(x,E,T,C,n)}const o=n[2]-n[0]+2*s,l=n[3]-n[1]+2*s,h=n[0]-s,c=n[1]-s;let u=i?-1/0:1/0,f=1/0;const p=r(this,Kr).at(i?-1:-2),m=[p[0],p[2]];for(const v of r(this,Kr)){const[A,w,S,x]=v;!x&&i?w<f?(f=w,u=A):w===f&&(u=Math.max(u,A)):x&&!i&&(w<f?(f=w,u=A):w===f&&(u=Math.min(u,A))),v[0]=(A-h)/o,v[1]=(w-c)/l,v[2]=(S-c)/l}g(this,tu,new Float32Array([h,c,o,l])),g(this,eu,[u,f]),g(this,su,m)}getOutlines(){r(this,Kr).sort((t,s)=>t[0]-s[0]||t[1]-s[1]||t[2]-s[2]);const e=[];for(const t of r(this,Kr))t[3]?(e.push(...b(this,as,qg).call(this,t)),b(this,as,Db).call(this,t)):(b(this,as,kb).call(this,t),e.push(...b(this,as,qg).call(this,t)));return b(this,as,Rb).call(this,e)}}tu=new WeakMap,eu=new WeakMap,su=new WeakMap,Kr=new WeakMap,wi=new WeakMap,as=new WeakSet,Rb=function(e){const t=[],s=new Set;for(const a of e){const[o,l,h]=a;t.push([o,l,a],[o,h,a])}t.sort((a,o)=>a[1]-o[1]||a[0]-o[0]);for(let a=0,o=t.length;a<o;a+=2){const l=t[a][2],h=t[a+1][2];l.push(h),h.push(l),s.add(l),s.add(h)}const i=[];let n;for(;s.size>0;){const a=s.values().next().value;let[o,l,h,c,u]=a;s.delete(a);let f=o,p=l;for(n=[o,h],i.push(n);;){let m;if(s.has(c))m=c;else if(s.has(u))m=u;else break;s.delete(m),[o,l,h,c,u]=m,f!==o&&(n.push(f,p,o,p===l?l:h),f=o),p=p===l?h:l}n.push(f,p)}return new tm(i,r(this,tu),r(this,eu),r(this,su))},hf=function(e){const t=r(this,wi);let s=0,i=t.length-1;for(;s<=i;){const n=s+i>>1,a=t[n][0];if(a===e)return n;a<e?s=n+1:i=n-1}return i+1},Db=function([,e,t]){const s=b(this,as,hf).call(this,e);r(this,wi).splice(s,0,[e,t])},kb=function([,e,t]){const s=b(this,as,hf).call(this,e);for(let i=s;i<r(this,wi).length;i++){const[n,a]=r(this,wi)[i];if(n!==e)break;if(n===e&&a===t){r(this,wi).splice(i,1);return}}for(let i=s-1;i>=0;i--){const[n,a]=r(this,wi)[i];if(n!==e)break;if(n===e&&a===t){r(this,wi).splice(i,1);return}}},qg=function(e){const[t,s,i]=e,n=[[t,s,i]],a=b(this,as,hf).call(this,i);for(let o=0;o<a;o++){const[l,h]=r(this,wi)[o];for(let c=0,u=n.length;c<u;c++){const[,f,p]=n[c];if(!(h<=f||p<=l)){if(f>=l){if(p>h)n[c][1]=h;else{if(u===1)return[];n.splice(c,1),c--,u--}continue}n[c][2]=l,p>h&&n.push([t,h,p])}}}return n};var iu,nu,Oh;class tm extends V{constructor(t,s,i,n){super();y(this,iu);y(this,nu,null);y(this,Oh);g(this,Oh,t),g(this,iu,s),this.firstPoint=i,this.lastPoint=n}static build(t,s){const i=new Zg(t,.001).getOutlines();return g(i,nu,t),i.focusOutline=new Zg(t,.0025,.001,s).getOutlines(),i}get isFree(){return!1}get defaultSVGProperties(){return Ob(this)}getFocusSVGProperties(t){return Mb(this,t)}updateRotation(t){return{root:{"data-main-rotation":t}}}serializeQuadPoints([t,s],[i,n]){const a=r(this,nu),o=new Float32Array(a.length*8);let l=0;for(const{x:h,y:c,width:u,height:f}of a){const p=h*i+t,m=(1-c)*n+s;o[l]=o[l+4]=p,o[l+1]=o[l+3]=m,o[l+2]=o[l+6]=p+u*i,o[l+5]=o[l+7]=m-f*n,l+=8}return o}toSVGPath(){const t=[];for(const s of r(this,Oh)){let[i,n]=s;t.push(`M${i} ${n}`);for(let a=2;a<s.length;a+=2){const o=s[a],l=s[a+1];o===i?(t.push(`V${l}`),n=l):l===n&&(t.push(`H${o}`),i=o)}t.push("Z")}return t.join(" ")}serialize([t,s,i,n],a){const o=[],l=i-t,h=n-s;for(const c of r(this,Oh)){const u=new Array(c.length);for(let f=0;f<c.length;f+=2)u[f]=t+c[f]*l,u[f+1]=n-c[f+1]*h;o.push(u)}return o}get box(){return r(this,iu)}}iu=new WeakMap,nu=new WeakMap,Oh=new WeakMap;class km extends Pf{newFreeDrawOutline(e,t,s,i,n,a){return new em(e,t,s,i,n,a)}}var Rs,ru;class fw{constructor(e,t,s,i,n,a,o){y(this,Rs);y(this,ru);g(this,Rs,new km(e,t,s,i,n,a,o)),g(this,ru,n)}add(e,t){return r(this,Rs).add(e,t)?{path:{d:r(this,Rs).toSVGPath()}}:null}addPoints(e){let t=!1;for(let s=0,i=e.length;s<i;s+=2)t=r(this,Rs).add(e[s],e[s+1])||t;return t?{path:{d:r(this,Rs).toSVGPath()}}:null}end(e,t){return e===void 0?null:this.add(e,t)}isEmpty(){return r(this,Rs).isEmpty()}isCancellable(){return r(this,Rs).isCancellable()}removeLastElement(){return r(this,Rs).removeLastElement()}updateProperty(e,t){return null}getOutlines(){const e=r(this,Rs).getOutlines();return e.buildFocusOutline(2*r(this,ru)),e}get defaultSVGProperties(){return{bbox:[0,0,1,1],root:{viewBox:"0 0 1 1"},rootClass:{highlight:!0,free:!0},path:{d:r(this,Rs).toSVGPath()}}}}Rs=new WeakMap,ru=new WeakMap;var Qf;const Zf=class Zf extends Pb{newOutliner(e,t,s,i,n,a,o=0){return new km(e,t,s,i,n,a,o)}get isFree(){return!0}buildFocusOutline(e){this.focusOutline=this.getNewOutline(e/2+r(Zf,Qf),.0025)}get defaultSVGProperties(){return Ob(this)}getFocusSVGProperties(e){return Mb(this,e)}get focusMustRemoveSelfIntersections(){return!0}updateRotation(e){return{root:{"data-main-rotation":e}}}updateProperty(e,t){if(e!=="thickness")return null;const s=this.updateThickness(t/2);return this.buildFocusOutline(t),s}getPathResizedSVGProperties(){return{path:{d:this.toSVGPath()}}}};Qf=new WeakMap,y(Zf,Qf,1.5);let em=Zf;class Fm extends Dm{constructor(e=null){super(),super.updateProperties(e)}updateSVGProperty(e,t){e!=="thickness"&&super.updateSVGProperty(e,t)}clone(){const e=new Fm;return e.updateAll(this),e}}var Mh,au,ou,lu,hu,Rh,Hs,sm,Fb,cf,Lb;const Ze=class Ze extends Mc{constructor(t){var s;super({...t,name:"highlightEditor"});y(this,Hs);
57y(this,Mh,null);y(this,au,0);y(this,ou,null);y(this,lu,0);y(this,hu,"");y(this,Rh,"");g(this,Mh,t.anchorNode||null),g(this,au,t.anchorOffset||0),g(this,ou,t.focusNode||null),g(this,lu,t.focusOffset||0),g(this,hu,t.methodOfCreation||((s=this._drawOutlines)!=null&&s.isFree?"main_toolbar":"")),g(this,Rh,t.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",this.rotate()}static get _keyboardManager(){const t=Ze.prototype;return Q(this,"_keyboardManager",new Zo([[["ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown"],t._moveCaret,{args:[3]}]]))}static initialize(t,s){var i;Dt.initialize(t,s),this._defaultDrawingOptions||(this._defaultDrawingOptions=new Fm({fill:((i=s.highlightColors)==null?void 0:i.values().next().value)||"#fff066","fill-opacity":Ze._DEFAULT_OPACITY,thickness:Ze._DEFAULT_THICKNESS}))}static getDefaultDrawingOptions(t){const s=this._defaultDrawingOptions.clone();return s.updateProperties(t),s}static get typesMap(){return Q(this,"typesMap",new Map([[ft.HIGHLIGHT_COLOR,"fill"],[ft.HIGHLIGHT_THICKNESS,"thickness"]]))}static get isDrawer(){return!1}static get _hasClipPath(){return!0}static get _hasDrawClass(){return!1}_addOutlines(t){const{boxes:s,drawOutlines:i}=t;!s&&!i||(this._drawingOptions||(this._drawingOptions=t.drawingOptions||Ze.getDefaultDrawingOptions()),s&&(t={...t,drawOutlines:tm.build(s,this._uiManager.direction==="ltr")}),super._addOutlines(t))}get colorType(){return ft.HIGHLIGHT_COLOR}get color(){return this._drawingOptions.fill}get opacity(){return this._drawingOptions["fill-opacity"]}get _opacityName(){return"fill-opacity"}get _drawRotation(){var t;return(t=this._drawOutlines)!=null&&t.isFree?this.rotation:0}get isResizable(){return!1}get _mustBeDisabledOnCommit(){return!1}get _mustFixPosition(){var t;return!((t=this._drawOutlines)!=null&&t.isFree)}get telemetryInitialData(){return{action:"added",type:this._drawOutlines.isFree?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this._drawingOptions.thickness,methodOfCreation:r(this,hu)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}translateInPage(t,s){}get toolbarPosition(){return b(this,Hs,sm).call(this,this._drawOutlines.focusOutline.lastPoint)}get commentButtonPosition(){return b(this,Hs,sm).call(this,this._drawOutlines.firstPoint)}updateParams(t,s){switch(t){case ft.HIGHLIGHT_COLOR:this._updateColorAndOpacity(s,Ze._DEFAULT_OPACITY,t),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(s)},!0);break;case ft.HIGHLIGHT_THICKNESS:super.updateParams(t,s),this._reportTelemetry({action:"thickness_changed",thickness:s},!0);break}}get propertiesToUpdate(){const t=super.propertiesToUpdate;return t.push([ft.HIGHLIGHT_FREE,this._drawOutlines.isFree]),t}get toolbarButtons(){return this._uiManager.highlightColors?(this._colorPicker=new xf({editor:this}),[["colorPicker",this._colorPicker]]):super.toolbarButtons}fixAndSetPosition(){return super.fixAndSetPosition(this._drawRotation)}getRect(t,s){return super.getRect(t,s,this._drawRotation)}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){this._reportTelemetry({action:"deleted"}),super.remove()}render(){if(this.div)return this.div;const t=super.render();return r(this,Rh)&&(t.setAttribute("aria-label",r(this,Rh)),t.setAttribute("role","mark")),this._drawOutlines.isFree?t.classList.add("free"):t.addEventListener("keydown",b(this,Hs,Fb).bind(this),{signal:this._uiManager._signal}),this.enableEditing(),t}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:b(this,Hs,cf).call(this,!0);break;case 1:case 3:b(this,Hs,cf).call(this,!1);break}}unselect(){super.unselect(),this._drawOutlines.isFree||b(this,Hs,cf).call(this,!1)}static createDrawerInstance({x:t,y:s,box:i,parent:n,isLTR:a}){return new fw(t,s,i,n.scale,this._defaultDrawingOptions.thickness/2,a,.001)}static _getDrawingTarget(t,{target:s}){return s.closest(".textLayer")}static _getPointerCoords({x:t,y:s}){return[t,s]}static _addDrawingListeners(t,s){t.classList.add("free"),s.addEventListener("abort",()=>t.classList.remove("free"),{once:!0}),window.addEventListener("blur",()=>this._endDraw(null),{signal:s}),window.addEventListener("pointerdown",me,{capture:!0,passive:!1,signal:s})}static _endDrawingSession(t=!1){return this.endDrawing(t)}
57createDrawingOptions({color:t,opacity:s,thickness:i}){const{_defaultDrawingOptions:n,_DEFAULT_OPACITY:a}=Ze;this._drawingOptions=Ze.getDefaultDrawingOptions({fill:_.makeHexColor(...t),"fill-opacity":s||a,thickness:i||n.thickness})}static deserializeDraw(t,s,i,n,a,o,l){const{quadPoints:h}=o;if(h){const m=[];for(let v=0,A=h.length;v<A;v+=8)m.push({x:(h[v]-t)/i,y:1-(h[v+1]-s)/n,width:(h[v+2]-h[v])/i,height:(h[v+1]-h[v+5])/n});return tm.build(m,l.direction==="ltr")}const c=o.thickness||this._defaultDrawingOptions.thickness,u=(o.inkLists||o.outlines.points)[0],f=new km(u[0]-t,n-(u[1]-s),[0,0,i,n],1,c/2,!0,.001);for(let m=0,v=u.length;m<v;m+=2)f.add(u[m]-t,n-(u[m+1]-s));const p=f.getOutlines();return p.buildFocusOutline(c),p}static async deserialize(t,s,i){let n=null;if(t instanceof db){const{data:{quadPoints:o,rect:l,rotation:h,id:c,color:u,opacity:f,popupRef:p,richText:m,contentsObj:v,creationDate:A,modificationDate:w},parent:{page:{pageNumber:S}}}=t;n=t={annotationType:nt.HIGHLIGHT,color:Array.from(u),opacity:f,quadPoints:o,pageIndex:S-1,rect:l.slice(0),rotation:h,annotationElementId:c,id:c,deleted:!1,popupRef:p,richText:m,comment:(v==null?void 0:v.str)||null,creationDate:A,modificationDate:w}}else if(t instanceof Rm){const{data:{inkLists:o,rect:l,rotation:h,id:c,color:u,borderStyle:{rawWidth:f},popupRef:p,richText:m,contentsObj:v,creationDate:A,modificationDate:w},parent:{page:{pageNumber:S}}}=t;n=t={annotationType:nt.HIGHLIGHT,color:Array.from(u),thickness:f,inkLists:o,pageIndex:S-1,rect:l.slice(0),rotation:h,annotationElementId:c,id:c,deleted:!1,popupRef:p,richText:m,comment:(v==null?void 0:v.str)||null,creationDate:A,modificationDate:w}}const a=await super.deserialize(t,s,i);return a._initialData=n,t.comment&&a.setCommentData(t),a}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const s=super.serialize(t);return Object.assign(s,{color:Dt._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),opacity:this.opacity,thickness:this._drawingOptions.thickness,quadPoints:this._drawOutlines.serializeQuadPoints(this.pageTranslation,this.pageDimensions),outlines:this._drawOutlines.serialize(s.rect,this._drawRotation)}),this.addComment(s),this.annotationElementId&&!b(this,Hs,Lb).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}};Mh=new WeakMap,au=new WeakMap,ou=new WeakMap,lu=new WeakMap,hu=new WeakMap,Rh=new WeakMap,Hs=new WeakSet,sm=function([t,s]){const[i,n,a,o]=this._drawOutlines.box;return[(t-i)/a,(s-n)/o]},Fb=function(t){Ze._keyboardManager.exec(this,t)},cf=function(t){if(!r(this,Mh))return;const s=window.getSelection();t?s.setPosition(r(this,Mh),r(this,au)):s.setPosition(r(this,ou),r(this,lu))},Lb=function(t){const{color:s}=this._initialData;return this.hasEditedComment||t.color.some((i,n)=>i!==s[n])},R(Ze,"_DEFAULT_OPACITY",1),R(Ze,"_DEFAULT_THICKNESS",12),R(Ze,"_defaultDrawingOptions",null),R(Ze,"_type","highlight"),R(Ze,"_editorType",nt.HIGHLIGHT);let If=Ze;var qi,Jr,ce,ke,_o,Dh,Fe,de,si,jo,$o,Go,_s,df,uf,im;class pw{constructor(e,t,s,i,n,a){y(this,_s);y(this,qi,new Float64Array(6));y(this,Jr,new Float64Array(2));y(this,ce);y(this,ke);y(this,_o);y(this,Dh);y(this,Fe);y(this,de,"");y(this,si,0);y(this,jo,new wu);y(this,$o);y(this,Go);g(this,$o,s),g(this,Go,i),g(this,_o,n),g(this,Dh,a),[e,t]=b(this,_s,df).call(this,e,t);const o=g(this,ce,[NaN,NaN,NaN,NaN,e,t]);g(this,Fe,[e,t]),g(this,ke,[{line:o,points:r(this,Fe)}]),r(this,qi).set(o,0),r(this,Jr).set([e,t],0)}updateProperty(e,t){e==="stroke-width"&&g(this,Dh,t)}isEmpty(){var e;return!((e=r(this,ke))!=null&&e.length)}isCancellable(){return r(this,Fe).length<=10}add(e,t){return b(this,_s,uf).call(this,e,t)&&this.toSVGPath(),{path:{d:b(this,_s,im).call(this)}}}addPoints(e){let t=!1;for(let s=0,i=e.length;s<i;s+=2)b(this,_s,uf).call(this,e[s],e[s+1])&&(t=!0,r(this,Fe).length<=6&&(this.toSVGPath(),t=!1));return t&&this.toSVGPath(),{path:{d:b(this,_s,im).call(this)}}}
57end(e,t){return e!==void 0&&b(this,_s,uf).call(this,e,t)?{path:{d:this.toSVGPath()}}:r(this,Fe).length===2?{path:{d:this.toSVGPath()}}:{path:{d:r(this,de)}}}startNew(e,t,s,i,n){g(this,$o,s),g(this,Go,i),g(this,_o,n),[e,t]=b(this,_s,df).call(this,e,t);const a=g(this,ce,[NaN,NaN,NaN,NaN,e,t]);g(this,Fe,[e,t]),r(this,Jr).set([e,t],0);const o=r(this,ke).at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),r(this,ke).push({line:a,points:r(this,Fe)}),r(this,qi).set(a,0),g(this,si,0),this.toSVGPath(),null}getLastElement(){return r(this,ke).at(-1)}setLastElement(e){return r(this,ke)?(r(this,ke).push(e),g(this,ce,e.line),g(this,Fe,e.points),g(this,si,0),{path:{d:this.toSVGPath()}}):r(this,jo).setLastElement(e)}removeLastElement(){if(!r(this,ke))return r(this,jo).removeLastElement();r(this,ke).pop(),g(this,de,"");for(let e=0,t=r(this,ke).length;e<t;e++){const{line:s,points:i}=r(this,ke)[e];g(this,ce,s),g(this,Fe,i),g(this,si,0),this.toSVGPath()}return{path:{d:r(this,de)}}}toSVGPath(){const e=V.svgRound(r(this,ce)[4]),t=V.svgRound(r(this,ce)[5]);if(r(this,Fe).length===2)return g(this,de,`${r(this,de)} M ${e} ${t} Z`),r(this,de);if(r(this,Fe).length<=6){const i=r(this,de).lastIndexOf("M");g(this,de,`${r(this,de).slice(0,i)} M ${e} ${t}`),g(this,si,6)}if(r(this,Fe).length===4){const i=V.svgRound(r(this,ce)[10]),n=V.svgRound(r(this,ce)[11]);return g(this,de,`${r(this,de)} L ${i} ${n}`),g(this,si,12),r(this,de)}const s=[];r(this,si)===0&&(s.push(`M ${e} ${t}`),g(this,si,6));for(let i=r(this,si),n=r(this,ce).length;i<n;i+=6){const[a,o,l,h,c,u]=r(this,ce).slice(i,i+6).map(V.svgRound);s.push(`C${a} ${o} ${l} ${h} ${c} ${u}`)}return g(this,de,r(this,de)+s.join(" ")),g(this,si,r(this,ce).length),r(this,de)}getOutlines(e,t,s,i){const n=r(this,ke).at(-1);return n.line=new Float32Array(n.line),n.points=new Float32Array(n.points),r(this,jo).build(r(this,ke),e,t,s,r(this,_o),r(this,Dh),i),g(this,qi,null),g(this,ce,null),g(this,ke,null),g(this,de,null),r(this,jo)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}qi=new WeakMap,Jr=new WeakMap,ce=new WeakMap,ke=new WeakMap,_o=new WeakMap,Dh=new WeakMap,Fe=new WeakMap,de=new WeakMap,si=new WeakMap,jo=new WeakMap,$o=new WeakMap,Go=new WeakMap,_s=new WeakSet,df=function(e,t){return V._normalizePoint(e,t,r(this,$o),r(this,Go),r(this,_o))},uf=function(e,t){[e,t]=b(this,_s,df).call(this,e,t),r(this,Jr).set([e,t],0);const[s,i,n,a]=r(this,qi).subarray(2,6),o=e-n,l=t-a;return Math.hypot(r(this,$o)*o,r(this,Go)*l)<=2?!1:(r(this,Fe).push(e,t),isNaN(s)?(r(this,qi).set([n,a,e,t],2),r(this,ce).push(NaN,NaN,NaN,NaN,e,t),!0):(isNaN(r(this,qi)[0])&&r(this,ce).splice(6,6),r(this,qi).set([s,i,n,a,e,t],0),r(this,ce).push(...V.createBezierPoints(s,i,n,a,e,t)),!0))},im=function(){const e=V.svgRound(r(this,Jr)[0]),t=V.svgRound(r(this,Jr)[1]);if(r(this,Fe).length===2){const s=V.svgRound(r(this,ce)[4]),i=V.svgRound(r(this,ce)[5]);return`${r(this,de)} M ${s} ${i} L ${e} ${t}`}return`${r(this,de)} L ${e} ${t}`};var ts,cu,du,Ds,tn,en,kh,Fh,Vo,Ne,fn,Nb,Bb,Ub;class wu extends V{constructor(){super(...arguments);y(this,Ne);y(this,ts);y(this,cu,0);y(this,du);y(this,Ds);y(this,tn);y(this,en);y(this,kh);y(this,Fh);y(this,Vo)}build(t,s,i,n,a,o,l){g(this,tn,s),g(this,en,i),g(this,kh,n),g(this,Fh,a),g(this,Vo,o),g(this,du,l??0),g(this,Ds,t),b(this,Ne,Bb).call(this)}get thickness(){return r(this,Vo)}setLastElement(t){return r(this,Ds).push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return r(this,Ds).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const t=[];for(const{line:s}of r(this,Ds)){if(t.push(`M${V.svgRound(s[4])} ${V.svgRound(s[5])}`),s.length===6){t.push("Z");continue}if(s.length===12&&isNaN(s[6])){t.push(`L${V.svgRound(s[10])} ${V.svgRound(s[11])}`);continue}for(let i=6,n=s.length;i<n;i+=6){const[a,o,l,h,c,u]=s.subarray(i,i+6).map(V.svgRound);t.push(`C${a} ${o} ${l} ${h} ${c} ${u}`)}}return t.join("")}serialize([t,s,i,n],a){const o=[],l=[],[h,c,u,f]=b(this,Ne,Nb).call(this);let p,m,v,A,w,S,x,T,E;switch(r(this,Fh)){case 0:E=V._rescale,p=t,m=s+n,v=i,A=-n,w=t+h*i,S=s+(1-c-f)*n,x=t+(
57h+u)*i,T=s+(1-c)*n;break;case 90:E=V._rescaleAndSwap,p=t,m=s,v=i,A=n,w=t+c*i,S=s+h*n,x=t+(c+f)*i,T=s+(h+u)*n;break;case 180:E=V._rescale,p=t+i,m=s,v=-i,A=n,w=t+(1-h-u)*i,S=s+c*n,x=t+(1-h)*i,T=s+(c+f)*n;break;case 270:E=V._rescaleAndSwap,p=t+i,m=s+n,v=-i,A=-n,w=t+(1-c-f)*i,S=s+(1-h-u)*n,x=t+(1-c)*i,T=s+(1-h)*n;break}for(const{line:C,points:P}of r(this,Ds))o.push(E(C,p,m,v,A,a?new Array(C.length):null)),l.push(E(P,p,m,v,A,a?new Array(P.length):null));return{lines:o,points:l,rect:[w,S,x,T]}}static deserialize(t,s,i,n,a,{paths:{lines:o,points:l},rotation:h,thickness:c}){const u=[];let f,p,m,v,A;switch(h){case 0:A=V._rescale,f=-t/i,p=s/n+1,m=1/i,v=-1/n;break;case 90:A=V._rescaleAndSwap,f=-s/n,p=-t/i,m=1/n,v=1/i;break;case 180:A=V._rescale,f=t/i+1,p=-s/n,m=-1/i,v=1/n;break;case 270:A=V._rescaleAndSwap,f=s/n+1,p=t/i+1,m=-1/n,v=-1/i;break}if(!o){o=[];for(const S of l){const x=S.length;if(x===2){o.push(new Float32Array([NaN,NaN,NaN,NaN,S[0],S[1]]));continue}if(x===4){o.push(new Float32Array([NaN,NaN,NaN,NaN,S[0],S[1],NaN,NaN,NaN,NaN,S[2],S[3]]));continue}const T=new Float32Array(3*(x-2));o.push(T);let[E,C,P,O]=S.subarray(0,4);T.set([NaN,NaN,NaN,NaN,E,C],0);for(let I=4;I<x;I+=2){const D=S[I],M=S[I+1];T.set(V.createBezierPoints(E,C,P,O,D,M),(I-2)*3),[E,C,P,O]=[P,O,D,M]}}}for(let S=0,x=o.length;S<x;S++)u.push({line:A(o[S].map(T=>T??NaN),f,p,m,v),points:A(l[S].map(T=>T??NaN),f,p,m,v)});const w=new this.prototype.constructor;return w.build(u,i,n,1,h,c,a),w}get box(){return r(this,ts)}updateProperty(t,s){return t==="stroke-width"?b(this,Ne,Ub).call(this,s):null}updateParentDimensions([t,s],i){const[n,a]=b(this,Ne,fn).call(this);g(this,tn,t),g(this,en,s),g(this,kh,i);const[o,l]=b(this,Ne,fn).call(this),h=o-n,c=l-a,u=r(this,ts);return u[0]-=h,u[1]-=c,u[2]+=2*h,u[3]+=2*c,u}updateRotation(t){return g(this,cu,t),{path:{transform:this.rotationTransform}}}get viewBox(){return r(this,ts).map(V.svgRound).join(" ")}get defaultProperties(){const[t,s]=r(this,ts);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${V.svgRound(t)} ${V.svgRound(s)}`}}}get rotationTransform(){const[,,t,s]=r(this,ts);let i=0,n=0,a=0,o=0,l=0,h=0;switch(r(this,cu)){case 90:n=s/t,a=-t/s,l=t;break;case 180:i=-1,o=-1,l=t,h=s;break;case 270:n=-s/t,a=t/s,h=s;break;default:return""}return`matrix(${i} ${n} ${a} ${o} ${V.svgRound(l)} ${V.svgRound(h)})`}getPathResizingSVGProperties([t,s,i,n]){const[a,o]=b(this,Ne,fn).call(this),[l,h,c,u]=r(this,ts);if(Math.abs(c-a)<=V.PRECISION||Math.abs(u-o)<=V.PRECISION){const A=t+i/2-(l+c/2),w=s+n/2-(h+u/2);return{path:{"transform-origin":`${V.svgRound(t)} ${V.svgRound(s)}`,transform:`${this.rotationTransform} translate(${A} ${w})`}}}const f=(i-2*a)/(c-2*a),p=(n-2*o)/(u-2*o),m=c/i,v=u/n;return{path:{"transform-origin":`${V.svgRound(l)} ${V.svgRound(h)}`,transform:`${this.rotationTransform} scale(${m} ${v}) translate(${V.svgRound(a)} ${V.svgRound(o)}) scale(${f} ${p}) translate(${V.svgRound(-a)} ${V.svgRound(-o)})`}}}getPathResizedSVGProperties([t,s,i,n]){const[a,o]=b(this,Ne,fn).call(this),l=r(this,ts),[h,c,u,f]=l;if(l[0]=t,l[1]=s,l[2]=i,l[3]=n,Math.abs(u-a)<=V.PRECISION||Math.abs(f-o)<=V.PRECISION){const w=t+i/2-(h+u/2),S=s+n/2-(c+f/2);for(const{line:x,points:T}of r(this,Ds))V._translate(x,w,S,x),V._translate(T,w,S,T);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${V.svgRound(t)} ${V.svgRound(s)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const p=(i-2*a)/(u-2*a),m=(n-2*o)/(f-2*o),v=-p*(h+a)+t+a,A=-m*(c+o)+s+o;if(p!==1||m!==1||v!==0||A!==0)for(const{line:w,points:S}of r(this,Ds))V._rescale(w,v,A,p,m,w),V._rescale(S,v,A,p,m,S);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${V.svgRound(t)} ${V.svgRound(s)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,s],i){const[n,a]=i,o=r(this,ts),l=t-o[0],h=s-o[1];if(r(this,tn)===n&&r(this,en)===a)for(const{line:c,points:u}of r(this,Ds))V._translate(c,l,h,c),V._translate(u,l,h,u);else{const c=r(this,tn)/n,u=r(this,en)/a;g(this,tn,n),g(this,en,a);for(const{line:f,points:p}of r(this,Ds))V._rescale(f,l,h,c,u,f),V._rescale(p,l,h,c,u,p);o[2]*=c,o[3]*=u}return o[0]=t,o[1]=s,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${V.svgRound(t)} ${V.svgRound(s)}`}}}get defaultSVGProperties(){const t=r(this,ts);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${V.svgRound(t[0])} ${V.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}}ts=new WeakMap,cu=new WeakMap,du=new WeakMap,Ds=new WeakMap,tn=new WeakMap,en=new WeakMap,kh=new WeakMap,Fh=new WeakMap,Vo=new WeakMap,Ne=new WeakSet,fn=function(t=r(this,Vo)){const s=r(this,du)+t/2*r(this,kh);return r(this,Fh)%180===0?[s/r(this,tn),s/r(this,en)]:[s/r(this,en),s/r(this,tn)]}
57,Nb=function(){const[t,s,i,n]=r(this,ts),[a,o]=b(this,Ne,fn).call(this,0);return[t+a,s+o,i-2*a,n-2*o]},Bb=function(){const t=g(this,ts,Ea.slice());for(const{line:n}of r(this,Ds)){if(n.length<=12){for(let l=4,h=n.length;l<h;l+=6)_.pointBoundingBox(n[l],n[l+1],t);continue}let a=n[4],o=n[5];for(let l=6,h=n.length;l<h;l+=6){const[c,u,f,p,m,v]=n.subarray(l,l+6);_.bezierBoundingBox(a,o,c,u,f,p,m,v,t),a=m,o=v}}const[s,i]=b(this,Ne,fn).call(this);t[0]=_t(t[0]-s,0,1),t[1]=_t(t[1]-i,0,1),t[2]=_t(t[2]+s,0,1),t[3]=_t(t[3]+i,0,1),t[2]-=t[0],t[3]-=t[1]},Ub=function(t){const[s,i]=b(this,Ne,fn).call(this);g(this,Vo,t);const[n,a]=b(this,Ne,fn).call(this),[o,l]=[n-s,a-i],h=r(this,ts);return h[0]-=o,h[1]-=l,h[2]+=2*o,h[3]+=2*l,h};class gp extends Dm{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:"none",stroke:Dt._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,t){e==="stroke-width"&&(t??(t=this["stroke-width"]),t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){const e=new gp(this._viewParameters);return e.updateAll(this),e}}var qf,Hb;const pl=class pl extends Mc{constructor(t){super({...t,name:"inkEditor"});y(this,qf);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,s){Dt.initialize(t,s),this._defaultDrawingOptions=new gp(s.viewParameters)}static getDefaultDrawingOptions(t){const s=this._defaultDrawingOptions.clone();return s.updateProperties(t),s}static get supportMultipleDrawings(){return!0}static get typesMap(){return Q(this,"typesMap",new Map([[ft.INK_THICKNESS,"stroke-width"],[ft.INK_COLOR,"stroke"],[ft.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance({x:t,y:s,box:[,,i,n],rotation:a}){return new pw(t,s,i,n,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,s,i,n,a,o){return wu.deserialize(t,s,i,n,a,o)}static async deserialize(t,s,i){let n=null;if(t instanceof Rm){const{data:{inkLists:o,rect:l,rotation:h,id:c,color:u,opacity:f,borderStyle:{rawWidth:p},popupRef:m,richText:v,contentsObj:A,creationDate:w,modificationDate:S},parent:{page:{pageNumber:x}}}=t;n=t={annotationType:nt.INK,color:Array.from(u),thickness:p,opacity:f,paths:{points:o},boxes:null,pageIndex:x-1,rect:l.slice(0),rotation:h,annotationElementId:c,id:c,deleted:!1,popupRef:m,richText:v,comment:(A==null?void 0:A.str)||null,creationDate:w,modificationDate:S}}const a=await super.deserialize(t,s,i);return a._initialData=n,t.comment&&a.setCommentData(t),a}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new Tf(this)),[["colorPicker",this._colorPicker]]}get colorType(){return ft.INK_COLOR}get colorAndOpacityType(){return ft.INK_COLOR_AND_OPACITY}get opacityType(){return ft.INK_OPACITY}updateParams(t,s){if(t===ft.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(s.color,s.opacity);return}super.updateParams(t,s)}static updateDefaultParams(t,s){if(t===ft.INK_COLOR_AND_OPACITY){super.updateDefaultParams(ft.INK_COLOR,s.color),super.updateDefaultParams(ft.INK_OPACITY,s.opacity);return}super.updateDefaultParams(t,s)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:t,_drawingOptions:s,parent:i}=this;s.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(t,s.toSVGProperties())}static onScaleChangingWhenDrawing(){const t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:s,opacity:i}){this._drawingOptions=pl.getDefaultDrawingOptions({stroke:_.makeHexColor(...t),"stroke-width":s,"stroke-opacity":i})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:s,points:i}=this.serializeDraw(t),{_drawingOptions:{stroke:n,"stroke-opacity":a,"stroke-width":o}}=this,l=Object.assign(super.serialize(t),{color:Dt._colorManager.convert(n),opacity:a,thickness:o,paths:{lines:s,points:i}});return this.addComment(l),t?(l.isCopy=!0,l):this.annotationElementId&&!b(this,qf,Hb).call(this,l)?null:(l.id=this.annotationElementId,l)}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;const{points:s,rect:i}=this.serializeDraw(!1);return t.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:s,popup:this.comment}),null}};qf=new WeakSet,Hb=function(t){const{color:s,thickness:i,opacity:n,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((o,l)=>o!==s[l])||t.thickness!==i||t.opacity!==n||t.pageIndex!==a},R(pl,"_type","ink"),R(pl,"_editorType",nt.INK),R(pl,"_defaultDrawingOptions",null);let nm=pl;class rm extends wu{toSVGPath(){let e=super.toSVGPath();return e.endsWith("Z")||(e+="Z"),e}}ot(5213);const Ou=8,qh=3;var zo,St,am,Si,_b,jb,om,ff,$b,Gb,Vb,lm,hm,zb;class Qn{static extractContoursFromText(e,{fontFamily:t,fontStyle:s,fontWeight:i},n,a,o,l){let h=new OffscreenCanvas(1,1),c=h.getContext("2d",{alpha:!1});const u=200,f=c.font=`${s} ${i} ${u}px ${t}`,{actualBoundingBoxLeft:p,actualBoundingBoxRight:m,actualBoundingBoxAscent:v,actualBoundingBoxDescent:A,fontBoundingBoxAscent:w,fontBoundingBoxDescent:S,width:x}=c.measureText(e),T=1.5,E=Math.ceil(Math.max(Math.abs(p)+Math.abs(m)||0,x)*T),C=Math.ceil(Math.max(Math.abs(v)+Math.abs(A)||u,Math.abs(w)+Math.abs(S)||u)*T);h=new OffscreenCanvas(E,C),c=h.getContext("2d",{alpha:!0,willReadFrequently:!0}),c.font=f,c.filter="grayscale(1)",c.fillStyle="white",c.fillRect(0,0,E,C),c.fillStyle="black",c.fillText(e,E*(T-1)/2,C*(3-T)/2);const P=b(this,St,lm).call(this,c.getImageData(0,0,E,C).data),O=b(this,St,Vb).call(this,P),I=b(this,St,hm).call(this,O),D=b(this,St,om).call(this,P,E,C,I);return this.processDrawnLines({lines:{curves:D,width:E,height:C},pageWidth:n,pageHeight:a,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(e,t,s,i,n){const[a,o,l]=b(this,St,zb).call(this,e),[h,c]=b(this,St,Gb).call(this,a,o,l,Math.hypot(o,l)*r(this,zo).sigmaSFactor,r(this,zo).sigmaR,r(this,zo).kernelSize),u=b(this,St,hm).call(this,c),f=b(this,St,om).call(this,h,o,l,u);return this.processDrawnLines({lines:{curves:f,width:o,height:l},pageWidth:t,pageHeight:s,rotation:i,innerMargin:n,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:s,rotation:i,innerMargin:n,mustSmooth:a,areContours:o}){i%180!==0&&([t,s]=[s,t]);const{curves:l,width:h,height:c}=e,u=e.thickness??0,f=[],p=Math.min(t/h,s/c),m=p/t,v=p/s,A=[];for(const{points:S}of l){const x=a?b(this,St,$b).call(this,S):S;if(!x)continue;A.push(x);const T=x.length,E=new Float32Array(T),C=new Float32Array(3*(T===2?2:T-2));if(f.push({line:C,points:E}),T===2){E[0]=x[0]*m,E[1]=x[1]*v,C.set([NaN,NaN,NaN,NaN,E[0],E[1]],0);continue}let[P,O,I,D]=x;P*=m,O*=v,I*=m,D*=v,E.set([P,O,I,D],0),C.set([NaN,NaN,NaN,NaN,P,O],0);for(let M=4;M<T;M+=2){const U=E[M]=x[M]*m,L=E[M+1]=x[M+1]*v;C.set(V.createBezierPoints(P,O,I,D,U,L),(M-2)*3),[P,O,I,D]=[I,D,U,L]}}if(f.length===0)return null;const w=o?new rm:new wu;return w.build(f,t,s,1,i,o?0:u,n),{outline:w,newCurves:A,areContours:o,thickness:u,width:h,height:c}}static async compressSignature({outlines:e,areContours:t,thickness:s,width:i,height:n}){let a=1/0,o=-1/0,l=0;for(const S of e){l+=S.length;for(let x=2,T=S.length;x<T;x++){const E=S[x]-S[x-2];a=Math.min(a,E),o=Math.max(o,E)}}let h;a>=-128&&o<=127?h=Int8Array:a>=-32768&&o<=32767?h=Int16Array:h=Int32Array;const c=e.length,u=Ou+qh*c,f=new Uint32Array(u);let p=0;f[p++]=u*Uint32Array.BYTES_PER_ELEMENT+(l-2*c)*h.BYTES_PER_ELEMENT,f[p++]=0,f[p++]=i,f[p++]=n,f[p++]=t?0:1,f[p++]=Math.max(0,Math.floor(s??0)),f[p++]=c,f[p++]=h.BYTES_PER_ELEMENT;for(const S of e)f[p++]=S.length-2,f[p++]=S[0],f[p++]=S[1];const m=new CompressionStream("deflate-raw"),v=m.writable.getWriter();await v.ready,v.write(f);const A=h.prototype.constructor;for(const S of e){const x=new A(S.length-2);for(let T=2,E=S.length;T<E;T++)x[T-2]=S[T]-S[T-2];v.write(x)}return v.close(),(await new Response(m.readable).bytes()).toBase64()}static async decompressSignature(e){try{const t=Uint8Array.fromBase64(e),{readable:s,writable:i}=new DecompressionStream("deflate-raw"),n=i.getWriter();await n.ready,n.write(t).then(async()=>{await n.ready,await n.close()}).catch(()=>{});let a=null,o=0;for await(const x of s)a||(a=new Uint8Array(new Uint32Array(x.buffer,0,4)[0])),a.set(x,o),o+=x.length;const l=new Uint32Array(a.buffer,0,a.length>>2),h=l[1];if(h!==0)throw new Error(`Invalid version: ${h}`);const c=l[2],u=l[3],f=l[4]===0,p=l[5],m=l[6],v=l[7],A=[],w=(Ou+qh*m)*Uint32Array.BYTES_PER_ELEMENT;let S;switch(v){case Int8Array.BYTES_PER_ELEMENT:S=new Int8Array(a.buffer,w);break;case Int16Array.BYTES_PER_ELEMENT:S=new Int16Array(a.buffer,w);break;case Int32Array.BYTES_PER_ELEMENT:S=new Int32Array(a.buffer,w);break}o=0;for(let x=0;x<m;x++){const T=l[qh*x+Ou],E=new Float32Array(T+2);A.push(E);for(let C=0;C<qh-1;C++)E[C]=l[qh*x+Ou+C+1];for(let C=0;C<T;C++)E[C+2]=E[C]+S[o++]}return{areContours:f,thickness:p,outlines:A,width:c,height:u}}catch(t){return st(`decompressSignature: ${t}`),null}}}zo=new WeakMap,St=new WeakSet,am=function(e,t,s,i){return s-=e,i-=t,s===0?i>0?0:4:s===1?i+6:2-i},Si=new WeakMap,_b=function(e,t,s,i,n,a,o){const l=b(this,St,am).call(this,s,i,n,a);for(let h=0;h<8;
57h++){const c=(-h+l-o+16)%8,u=r(this,Si)[2*c],f=r(this,Si)[2*c+1];if(e[(s+u)*t+(i+f)]!==0)return c}return-1},jb=function(e,t,s,i,n,a,o){const l=b(this,St,am).call(this,s,i,n,a);for(let h=0;h<8;h++){const c=(h+l+o+16)%8,u=r(this,Si)[2*c],f=r(this,Si)[2*c+1];if(e[(s+u)*t+(i+f)]!==0)return c}return-1},om=function(e,t,s,i){const n=e.length,a=new Int32Array(n);for(let c=0;c<n;c++)a[c]=e[c]<=i?1:0;for(let c=1;c<s-1;c++)a[c*t]=a[c*t+t-1]=0;for(let c=0;c<t;c++)a[c]=a[t*s-1-c]=0;let o=1,l;const h=[];for(let c=1;c<s-1;c++){l=1;for(let u=1;u<t-1;u++){const f=c*t+u,p=a[f];if(p===0)continue;let m=c,v=u;if(p===1&&a[f-1]===0)o+=1,v-=1;else if(p>=1&&a[f+1]===0)o+=1,v+=1,p>1&&(l=p);else{p!==1&&(l=Math.abs(p));continue}const A=[u,c],w=v===u+1,S={isHole:w,points:A,id:o,parent:0};h.push(S);let x;for(const M of h)if(M.id===l){x=M;break}x?x.isHole?S.parent=w?x.parent:l:S.parent=w?l:x.parent:S.parent=w?l:0;const T=b(this,St,_b).call(this,a,t,c,u,m,v,0);if(T===-1){a[f]=-o,a[f]!==1&&(l=Math.abs(a[f]));continue}let E=r(this,Si)[2*T],C=r(this,Si)[2*T+1];const P=c+E,O=u+C;m=P,v=O;let I=c,D=u;for(;;){const M=b(this,St,jb).call(this,a,t,I,D,m,v,1);E=r(this,Si)[2*M],C=r(this,Si)[2*M+1];const U=I+E,L=D+C;A.push(L,U);const B=I*t+D;if(a[B+1]===0?a[B]=-o:a[B]===1&&(a[B]=o),U===c&&L===u&&I===P&&D===O){a[f]!==1&&(l=Math.abs(a[f]));break}else m=I,v=D,I=U,D=L}}}return h},ff=function(e,t,s,i){if(s-t<=4){for(let P=t;P<s-2;P+=2)i.push(e[P],e[P+1]);return}const n=e[t],a=e[t+1],o=e[s-4]-n,l=e[s-3]-a,h=Math.hypot(o,l),c=o/h,u=l/h,f=c*a-u*n,p=l/o,m=1/h,v=Math.atan(p),A=Math.cos(v),w=Math.sin(v),S=m*(Math.abs(A)+Math.abs(w)),x=m*(1-S+S**2),T=Math.max(Math.atan(Math.abs(w+A)*x),Math.atan(Math.abs(w-A)*x));let E=0,C=t;for(let P=t+2;P<s-2;P+=2){const O=Math.abs(f-c*e[P+1]+u*e[P]);O>E&&(C=P,E=O)}E>(h*T)**2?(b(this,St,ff).call(this,e,t,C+2,i),b(this,St,ff).call(this,e,C,s,i)):i.push(n,a)},$b=function(e){const t=[],s=e.length;return b(this,St,ff).call(this,e,0,s,t),t.push(e[s-2],e[s-1]),t.length<=4?null:t},Gb=function(e,t,s,i,n,a){const o=new Float32Array(a**2),l=-2*i**2,h=a>>1;for(let v=0;v<a;v++){const A=(v-h)**2;for(let w=0;w<a;w++)o[v*a+w]=Math.exp((A+(w-h)**2)/l)}const c=new Float32Array(256),u=-2*n**2;for(let v=0;v<256;v++)c[v]=Math.exp(v**2/u);const f=e.length,p=new Uint8Array(f),m=new Uint32Array(256);for(let v=0;v<s;v++)for(let A=0;A<t;A++){const w=v*t+A,S=e[w];let x=0,T=0;for(let C=0;C<a;C++){const P=v+C-h;if(!(P<0||P>=s))for(let O=0;O<a;O++){const I=A+O-h;if(I<0||I>=t)continue;const D=e[P*t+I],M=o[C*a+O]*c[Math.abs(D-S)];x+=D*M,T+=M}}const E=p[w]=Math.round(x/T);m[E]++}return[p,m]},Vb=function(e){const t=new Uint32Array(256);for(const s of e)t[s]++;return t},lm=function(e){const t=e.length,s=new Uint8ClampedArray(t>>2);let i=-1/0,n=1/0;for(let o=0,l=s.length;o<l;o++){const h=s[o]=e[o<<2];i=Math.max(i,h),n=Math.min(n,h)}const a=255/(i-n);for(let o=0,l=s.length;o<l;o++)s[o]=(s[o]-n)*a;return s},hm=function(e){let t,s=-1/0,i=-1/0;const n=e.findIndex(l=>l!==0);let a=n,o=n;for(t=n;t<256;t++){const l=e[t];l>s&&(t-a>i&&(i=t-a,o=t-1),s=l,a=t)}for(t=o-1;t>=0&&!(e[t]>e[t+1]);t--);return t},zb=function(e){const t=e,{width:s,height:i}=e,{maxDim:n}=r(this,zo);let a=s,o=i;if(s>n||i>n){let f=s,p=i,m=Math.log2(Math.max(s,i)/n);const v=Math.floor(m);m=m===v?v-1:v;for(let w=0;w<m;w++){a=Math.ceil(f/2),o=Math.ceil(p/2);const S=new OffscreenCanvas(a,o);S.getContext("2d").drawImage(e,0,0,f,p,0,0,a,o),f=a,p=o,e!==t&&e.close(),e=S.transferToImageBitmap()}const A=Math.min(n/a,n/o);a=Math.round(a*A),o=Math.round(o*A)}const h=new OffscreenCanvas(a,o).getContext("2d",{willReadFrequently:!0});h.fillStyle="white",h.fillRect(0,0,a,o),h.filter="grayscale(1)",h.drawImage(e,0,0,e.width,e.height,0,0,a,o);const c=h.getImageData(0,0,a,o).data;return[b(this,St,lm).call(this,c),a,o]},y(Qn,St),y(Qn,zo,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),y(Qn,Si,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class Lm extends Dm{constructor(){super(),super.updateProperties({fill:Dt._defaultLineColor,"stroke-width":0})}clone(){const e=new Lm;return e.updateAll(this),e}}class Nm extends gp{constructor(e){super(e),super.updateProperties({stroke:Dt._defaultLineColor,"stroke-width":1})}clone(){const e=new Nm(this._viewParameters);return e.updateAll(this),e}}var Qr,sn,Zr,Wo;const ys=class ys extends Mc{constructor(t){super({...t,mustBeCommitted:!0,name:"signatureEditor"});y(this,Qr,!1);y(this,sn,null);y(this,Zr,null);y(this,Wo,null);this._willKeepAspectRatio=!0,g(this,Zr,t.signatureData||null),g(this,sn,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,s){Dt.initialize(t,s),this._defaultDrawingOptions=new Lm,this._defaultDrawnSignatureOptions=new Nm(s.viewParameters)}static getDefaultDrawingOptions(t){const s=this._defaultDrawingOptions.clone();return s.updateProperties(t),s}static get supportMultipleDrawings(){return!1}static get typesMap(){return Q(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!r(this,sn)}}static computeTelemetryFinalData(t){const s=t.get("hasDescription");return{hasAltText:s.get(!0)??0,hasNoAltText:s.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}
57render(){if(this.div)return this.div;let t,s;const{_isCopy:i}=this;if(i&&(this._isCopy=!1,t=this.x,s=this.y),super.render(),this._drawId===null)if(r(this,Zr)){const{lines:n,mustSmooth:a,areContours:o,description:l,uuid:h,heightInPage:c}=r(this,Zr),{rawDims:{pageWidth:u,pageHeight:f},rotation:p}=this.parent.viewport,m=Qn.processDrawnLines({lines:n,pageWidth:u,pageHeight:f,rotation:p,innerMargin:ys._INNER_MARGIN,mustSmooth:a,areContours:o});this.addSignature(m,c,l,h)}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:r(this,sn)||""}));return i&&(this._isCopy=!0,this._moveAfterPaste(t,s)),this.div}setUuid(t){g(this,Wo,t),this.addEditToolbar()}getUuid(){return r(this,Wo)}get description(){return r(this,sn)}set description(t){g(this,sn,t),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:t})),super.addEditToolbar().then(s=>{s==null||s.updateEditSignatureButton(t)}))}getSignaturePreview(){const{newCurves:t,areContours:s,thickness:i,width:n,height:a}=r(this,Zr),o=Math.max(n,a),l=Qn.processDrawnLines({lines:{curves:t.map(h=>({points:h})),thickness:i,width:n,height:a},pageWidth:o,pageHeight:o,rotation:0,innerMargin:0,mustSmooth:!1,areContours:s});return{areContours:s,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,s,i,n){const{x:a,y:o}=this,{outline:l}=g(this,Zr,t);g(this,Qr,l instanceof rm),this.description=i;let h;r(this,Qr)?h=ys.getDefaultDrawingOptions():(h=ys._defaultDrawnSignatureOptions.clone(),h.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:h});const[,c]=this.pageDimensions;let u=s/c;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(n),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!n,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(t){const{rawDims:{pageWidth:s,pageHeight:i},rotation:n}=this.parent.viewport;return Qn.process(t,s,i,n,ys._INNER_MARGIN)}getFromText(t,s){const{rawDims:{pageWidth:i,pageHeight:n},rotation:a}=this.parent.viewport;return Qn.extractContoursFromText(t,s,i,n,a,ys._INNER_MARGIN)}getDrawnSignature(t){const{rawDims:{pageWidth:s,pageHeight:i},rotation:n}=this.parent.viewport;return Qn.processDrawnLines({lines:t,pageWidth:s,pageHeight:i,rotation:n,innerMargin:ys._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:s}){t?this._drawingOptions=ys.getDefaultDrawingOptions():(this._drawingOptions=ys._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":s}))}serialize(t=!1){if(this.isEmpty())return null;const{lines:s,points:i}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":n}}=this,a=Object.assign(super.serialize(t),{isSignature:!0,areContours:r(this,Qr),color:[0,0,0],thickness:r(this,Qr)?0:n});return this.addComment(a),t?(a.paths={lines:s,points:i},a.uuid=r(this,Wo),a.isCopy=!0):a.lines=s,r(this,sn)&&(a.accessibilityData={type:"Figure",alt:r(this,sn)}),a}static deserializeDraw(t,s,i,n,a,o){return o.areContours?rm.deserialize(t,s,i,n,a,o):wu.deserialize(t,s,i,n,a,o)}static async deserialize(t,s,i){var a;const n=await super.deserialize(t,s,i);return g(n,Qr,t.areContours),n.description=((a=t.accessibilityData)==null?void 0:a.alt)||"",g(n,Wo,t.uuid),n}};Qr=new WeakMap,sn=new WeakMap,Zr=new WeakMap,Wo=new WeakMap,R(ys,"_type","signature"),R(ys,"_editorType",nt.SIGNATURE),R(ys,"_defaultDrawingOptions",null);let cm=ys;var Gt,xe,qr,zn,ta,Lh,Wn,Xo,nn,ks,Nh,mt,bc,Ac,pf,gf,mf,um,vf,Wb;class dm extends Dt{constructor(t){super({...t,name:"stampEditor"});y(this,mt);y(this,Gt,null);y(this,xe,null);y(this,qr,null);y(this,zn,null);y(this,ta,null);y(this,Lh,"");y(this,Wn,null);y(this,Xo,!1);y(this,nn,null);y(this,ks,!1);y(this,Nh,!1);g(this,zn,t.bitmapUrl),g(this,ta,t.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,s){Dt.initialize(t,s)}static isHandlingMimeForPasting(t){return kp.includes(t)}static paste(t,s){s.pasteEditor({mode:nt.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!!((t=this.altTextData)!=null&&t.altText)}}static computeTelemetryFinalData(t){const s=t.get("hasAltText");return{hasAltText:s.get(!0)??0,hasNoAltText:s.get(!1)??0}}async mlGuessAltText(t=null,s=!0){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:n,width:a,height:o}=t||this.copyCanvas(null,null,!0).imageData,l=await i.guess({name:"altText",request:{data:n,width:a,height:o,channels:n.length/(a*o)}});if(!l)throw new Error("No response from the AI service.");if(l.error)throw new Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw new Error("No valid response from the AI service.");const h=l.output;return await this.setGuessedAltText(h),s&&!this.hasAltTextData()&&(this.altTextData={alt:h,decorative:!1}),h}remove(){var t;r(this,xe)&&(g(this,Gt,null),this._uiManager.imageManager.deleteId(r(this,xe)),(t=r(this,Wn))==null||t.remove(),g(this,Wn,null),r(this,nn)&&(clearTimeout(r(this,nn)),g(this,nn,null))),super.remove()}rebuild(){if(!this.parent){r(this,xe)&&b(this,mt,pf).call(this);return}super.rebuild(),this.div!==null&&(r(this,xe)&&r(this,Wn)===null&&b(this,mt,pf).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(r(this,qr)||r(this,Gt)||r(this,zn)||r(this,ta)||r(this,xe)||r(this,Xo))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}
57render(){if(this.div)return this.div;let t,s;return this._isCopy&&(t=this.x,s=this.y),super.render(),this.div.hidden=!0,this.createAltText(),r(this,Xo)||(r(this,Gt)?b(this,mt,gf).call(this):b(this,mt,pf).call(this)),this._isCopy&&this._moveAfterPaste(t,s),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,s){const{id:i,bitmap:n}=this._uiManager.imageManager.getFromCanvas(t,s);s.remove(),i&&this._uiManager.imageManager.isValidId(i)&&(g(this,xe,i),n&&g(this,Gt,n),g(this,Xo,!1),b(this,mt,gf).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;r(this,nn)!==null&&clearTimeout(r(this,nn)),g(this,nn,setTimeout(()=>{g(this,nn,null),b(this,mt,um).call(this)},200))}copyCanvas(t,s,i=!1){t||(t=224);const{width:n,height:a}=r(this,Gt),o=new Ci;let l=r(this,Gt),h=n,c=a,u=null;if(s){if(n>s||a>s){const P=Math.min(s/n,s/a);h=Math.floor(n*P),c=Math.floor(a*P)}u=document.createElement("canvas");const p=u.width=Math.ceil(h*o.sx),m=u.height=Math.ceil(c*o.sy);r(this,ks)||(l=b(this,mt,mf).call(this,p,m));const v=u.getContext("2d");v.filter=this._uiManager.hcmFilter;let A="white",w="#cfcfd8";this._uiManager.hcmFilter!=="none"?w="black":xA.isDarkMode&&(A="#8f8f9d",w="#42414d");const S=15,x=S*o.sx,T=S*o.sy,E=new OffscreenCanvas(x*2,T*2),C=E.getContext("2d");C.fillStyle=A,C.fillRect(0,0,x*2,T*2),C.fillStyle=w,C.fillRect(0,0,x,T),C.fillRect(x,T,x,T),v.fillStyle=v.createPattern(E,"repeat"),v.fillRect(0,0,p,m),v.drawImage(l,0,0,l.width,l.height,0,0,p,m)}let f=null;if(i){let p,m;if(o.symmetric&&l.width<t&&l.height<t)p=l.width,m=l.height;else if(l=r(this,Gt),n>t||a>t){const w=Math.min(t/n,t/a);p=Math.floor(n*w),m=Math.floor(a*w),r(this,ks)||(l=b(this,mt,mf).call(this,p,m))}const A=new OffscreenCanvas(p,m).getContext("2d",{willReadFrequently:!0});A.drawImage(l,0,0,l.width,l.height,0,0,p,m),f={width:p,height:m,data:A.getImageData(0,0,p,m).data}}return{canvas:u,width:h,height:c,imageData:f}}static async deserialize(t,s,i){var A;let n=null,a=!1;if(t instanceof ub){const{data:{rect:w,rotation:S,id:x,structParent:T,popupRef:E,richText:C,contentsObj:P,creationDate:O,modificationDate:I},container:D,parent:{page:{pageNumber:M}},canvas:U}=t;let L,B;U?(delete t.canvas,{id:L,bitmap:B}=i.imageManager.getFromCanvas(D.id,U),U.remove()):(a=!0,t._hasNoCanvas=!0);const W=((A=await s._structTree.getAriaAttributes(`${ul}${x}`))==null?void 0:A.get("aria-label"))||"";n=t={annotationType:nt.STAMP,bitmapId:L,bitmap:B,pageIndex:M-1,rect:w.slice(0),rotation:S,annotationElementId:x,id:x,deleted:!1,accessibilityData:{decorative:!1,altText:W},isSvg:!1,structParent:T,popupRef:E,richText:C,comment:(P==null?void 0:P.str)||null,creationDate:O,modificationDate:I}}const o=await super.deserialize(t,s,i),{rect:l,bitmap:h,bitmapUrl:c,bitmapId:u,isSvg:f,accessibilityData:p}=t;a?(i.addMissingCanvas(t.id,o),g(o,Xo,!0)):u&&i.imageManager.isValidId(u)?(g(o,xe,u),h&&g(o,Gt,h)):g(o,zn,c),g(o,ks,f);const[m,v]=o.pageDimensions;return o.width=(l[2]-l[0])/m,o.height=(l[3]-l[1])/v,p&&(o.altTextData=p),o._initialData=n,t.comment&&o.setCommentData(t),g(o,Nh,!!n),o}serialize(t=!1,s=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i=Object.assign(super.serialize(t),{bitmapId:r(this,xe),isSvg:r(this,ks)});if(this.addComment(i),t)return i.bitmapUrl=b(this,mt,vf).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;const{decorative:n,altText:a}=this.serializeAltText(!1);if(!n&&a&&(i.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const l=b(this,mt,Wb).call(this,i);return l.isSame?null:(l.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1,i.id=this.annotationElementId,delete i.bitmapId,i)}if(s===null)return i;s.stamps||(s.stamps=new Map);const o=r(this,ks)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!s.stamps.has(r(this,xe)))s.stamps.set(r(this,xe),{area:o,serialized:i}),i.bitmap=b(this,mt,vf).call(this,!1);else if(r(this,ks)){const l=s.stamps.get(r(this,xe));o>l.area&&(l.area=o,l.serialized.bitmap.close(),l.serialized.bitmap=b(this,mt,vf).call(this,!1))}return i}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}Gt=new WeakMap,xe=new WeakMap,qr=new WeakMap,zn=new WeakMap,ta=new WeakMap,Lh=new WeakMap,Wn=new WeakMap,Xo=new WeakMap,nn=new WeakMap,ks=new WeakMap,Nh=new WeakMap,mt=new WeakSet,bc=function(t,s=!1){if(!t){this.remove();return}g(this,Gt,t.bitmap),s||(g(this,xe,t.id),g(this,ks,t.isSvg)),t.file&&g(this,Lh,t.file.name),b(this,mt,gf).call(this)},Ac=function(){if(g(this,qr,null),this._uiManager.enableWaiting(!1),!!r(this,Wn)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,Gt)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,Gt)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},pf=function(){if(r(this,xe)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(r(this,xe)).then(i=>b(this,mt,bc).call(this,i,!0)).finally(()=>
57b(this,mt,Ac).call(this));return}if(r(this,zn)){const i=r(this,zn);g(this,zn,null),this._uiManager.enableWaiting(!0),g(this,qr,this._uiManager.imageManager.getFromUrl(i).then(n=>b(this,mt,bc).call(this,n)).finally(()=>b(this,mt,Ac).call(this)));return}if(r(this,ta)){const i=r(this,ta);g(this,ta,null),this._uiManager.enableWaiting(!0),g(this,qr,this._uiManager.imageManager.getFromFile(i).then(n=>b(this,mt,bc).call(this,n)).finally(()=>b(this,mt,Ac).call(this)));return}const t=document.createElement("input");t.type="file",t.accept=kp.join(",");const s=this._uiManager._signal;g(this,qr,new Promise(i=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const n=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),b(this,mt,bc).call(this,n)}i()},{signal:s}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:s})}).finally(()=>b(this,mt,Ac).call(this))),t.click()},gf=function(){var h;const{div:t}=this;let{width:s,height:i}=r(this,Gt);const[n,a]=this.pageDimensions,o=.75;if(this.width)s=this.width*n,i=this.height*a;else if(s>o*n||i>o*a){const c=Math.min(o*n/s,o*a/i);s*=c,i*=c}this._uiManager.enableWaiting(!1);const l=g(this,Wn,document.createElement("canvas"));l.setAttribute("role","img"),this.addContainer(l),this.width=s/n,this.height=i/a,this.setDims(),(h=this._initialOptions)!=null&&h.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),b(this,mt,um).call(this),r(this,Nh)||(this.parent.addUndoableEditor(this),g(this,Nh,!0)),this._reportTelemetry({action:"inserted_image"}),r(this,Lh)&&this.div.setAttribute("aria-description",r(this,Lh)),this.annotationElementId||this._uiManager.a11yAlert(Dt._l10nAlert.stamp)},mf=function(t,s){const{width:i,height:n}=r(this,Gt);let a=i,o=n,l=r(this,Gt);for(;a>2*t||o>2*s;){const h=a,c=o;a>2*t&&(a=Math.ceil(a/2)),o>2*s&&(o=Math.ceil(o/2));const u=new OffscreenCanvas(a,o);u.getContext("2d").drawImage(l,0,0,h,c,0,0,a,o),l=u.transferToImageBitmap()}return l},um=function(){const[t,s]=this.parentDimensions,{width:i,height:n}=this,a=new Ci,o=Math.ceil(i*t*a.sx),l=Math.ceil(n*s*a.sy),h=r(this,Wn);if(!h||h.width===o&&h.height===l)return;h.width=o,h.height=l;const c=r(this,ks)?r(this,Gt):b(this,mt,mf).call(this,o,l),u=h.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(c,0,0,c.width,c.height,0,0,o,l)},vf=function(t){if(t){if(r(this,ks)){const n=this._uiManager.imageManager.getSvgUrl(r(this,xe));if(n)return n}const s=document.createElement("canvas");return{width:s.width,height:s.height}=r(this,Gt),s.getContext("2d").drawImage(r(this,Gt),0,0),s.toDataURL()}if(r(this,ks)){const[s,i]=this.pageDimensions,n=Math.round(this.width*s*ua.PDF_TO_CSS_UNITS),a=Math.round(this.height*i*ua.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(n,a);return o.getContext("2d").drawImage(r(this,Gt),0,0,r(this,Gt).width,r(this,Gt).height,0,0,n,a),o.transferToImageBitmap()}return structuredClone(r(this,Gt))},Wb=function(t){var o;const{pageIndex:s,accessibilityData:{altText:i}}=this._initialData,n=t.pageIndex===s,a=(((o=t.accessibilityData)==null?void 0:o.alt)||"")===i;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&n&&a,isSameAltText:a}},R(dm,"_type","stamp"),R(dm,"_editorType",nt.STAMP);var Yo,Bh,ea,sa,Xn,ps,ia,Uh,Hh,Ei,Yn,gs,Kn,na,_h,Y,ra,Ft,pm,Xb,Ri,gm,mm,yf;const hi=class hi{constructor({uiManager:e,pageIndex:t,div:s,structTreeLayer:i,accessibilityManager:n,annotationLayer:a,drawLayer:o,textLayer:l,viewport:h,l10n:c}){y(this,Ft);y(this,Yo);y(this,Bh,!1);y(this,ea,null);y(this,sa,null);y(this,Xn,null);y(this,ps,new Map);y(this,ia,!1);y(this,Uh,!1);y(this,Hh,!1);y(this,Ei,null);y(this,Yn,null);y(this,gs,null);y(this,Kn,null);y(this,na,null);y(this,_h,-1);y(this,Y);const u=[...r(hi,ra).values()];if(!hi._initialized){hi._initialized=!0;for(const f of u)f.initialize(c,e)}
57e.registerEditorTypes(u),g(this,Y,e),this.pageIndex=t,this.div=s,g(this,Yo,n),g(this,ea,a),this.viewport=h,g(this,gs,l),this.drawLayer=o,this._structTree=i,r(this,Y).addLayer(this)}get isEmpty(){return r(this,ps).size===0}get isInvisible(){return this.isEmpty&&r(this,Y).getMode()===nt.NONE}updateToolbar(e){r(this,Y).updateToolbar(e)}updateMode(e=r(this,Y).getMode()){switch(b(this,Ft,yf).call(this),e){case nt.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case nt.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case nt.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;if(t.toggle("nonEditing",!1),e===nt.POPUP)t.toggle("commentEditing",!0);else{t.toggle("commentEditing",!1);for(const s of r(hi,ra).values())t.toggle(`${s._type}Editing`,e===s._editorType)}this.div.hidden=!1}hasTextLayer(e){var t;return e===((t=r(this,gs))==null?void 0:t.div)}setEditingState(e){r(this,Y).setEditingState(e)}addCommands(e){r(this,Y).addCommands(e)}cleanUndoStack(e){r(this,Y).cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var t;(t=r(this,ea))==null||t.togglePointerEvents(e)}async enable(){var s;g(this,Hh,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),(s=r(this,na))==null||s.abort(),g(this,na,null);const e=new Set;for(const i of r(this,Ft,pm))i.enableEditing(),i.show(!0),i.annotationElementId&&(r(this,Y).removeChangedExistingAnnotation(i),e.add(i.annotationElementId));const t=r(this,ea);if(t)for(const i of t.getEditableAnnotations()){if(i.hide(),r(this,Y).isDeletedAnnotationElement(i.data.id)||e.has(i.data.id))continue;const n=await this.deserialize(i);n&&(this.addOrRebuild(n),n.enableEditing())}g(this,Hh,!1),r(this,Y)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){var i;if(g(this,Uh,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),r(this,gs)&&!r(this,na)){g(this,na,new AbortController);const n=r(this,Y).combinedSignal(r(this,na));r(this,gs).div.addEventListener("pointerdown",a=>{const{clientX:l,clientY:h,timeStamp:c}=a,u=r(this,_h);if(c-u>500){g(this,_h,c);return}g(this,_h,-1);const{classList:f}=this.div;f.toggle("getElements",!0);const p=document.elementsFromPoint(l,h);if(f.toggle("getElements",!1),!this.div.contains(p[0]))return;let m;const v=new RegExp(`^${Gh}[0-9]+$`);for(const w of p)if(v.test(w.id)){m=w.id;break}if(!m)return;const A=r(this,ps).get(m);(A==null?void 0:A.annotationElementId)===null&&(me(a),A.dblclick(a))},{signal:n,capture:!0})}const e=r(this,ea),t=[];if(e){const n=new Map,a=new Map;for(const o of r(this,Ft,pm)){if(o.disableEditing(),!o.annotationElementId){t.push(o);continue}if(o.serialize()!==null){n.set(o.annotationElementId,o);continue}else a.set(o.annotationElementId,o);(i=this.getEditableAnnotation(o.annotationElementId))==null||i.show(),o.remove()}for(const o of e.getEditableAnnotations()){const{id:l}=o.data;if(r(this,Y).isDeletedAnnotationElement(l)){o.updateEdited({deleted:!0});continue}let h=a.get(l);if(h){h.resetAnnotationElement(o),h.show(!1),o.show();continue}h=n.get(l),h&&(r(this,Y).addChangedExistingAnnotation(h),h.renderAnnotationElement(o)&&h.show(!1)),o.show()}}b(this,Ft,yf).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const n of r(hi,ra).values())s.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),e==null||e.updateFakeAnnotations(t),g(this,Uh,!1)}getEditableAnnotation(e){var t;return((t=r(this,ea))==null?void 0:t.getEditableAnnotation(e))||null}setActiveEditor(e){r(this,Y).getActive()!==e&&r(this,Y).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=r(this,gs))!=null&&e.div&&!r(this,Kn)){g(this,Kn,new AbortController);const t=r(this,Y).combinedSignal(r(this,Kn));r(this,gs).div.addEventListener("pointerdown",b(this,Ft,Xb).bind(this),{signal:t}),r(this,gs).div.classList.add("highlighting")}}disableTextSelection(){var e;this.div.tabIndex=0,(e=r(this,gs))!=null&&e.div&&r(this,Kn)&&(r(this,Kn).abort(),g(this,Kn,null),r(this,gs).div.classList.remove("highlighting"))}enableClick(){if(r(this,sa))return;g(this,sa,new AbortController);const e=r(this,Y).combinedSignal(r(this,sa));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(){var e;(e=r(this,sa))==null||e.abort(),g(this,sa,null)}attach(e){r(this,ps).set(e.id,e);const{annotationElementId:t}=e;t&&r(this,Y).isDeletedAnnotationElement(t)&&r(this,Y).removeDeletedAnnotationElement(e)}detach(e){var t;r(this,ps).delete(e.id),(t=r(this,Yo))==null||t.removePointerInTextLayer(e.contentDiv),!r(this,Uh)&&e.annotationElementId&&r(this,Y).addDeletedAnnotationElement(e)}remove(e){this.detach(e),r(this,Y).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){var t;e.parent!==this&&(e.parent&&e.annotationElementId&&(r(this,Y).addDeletedAnnotationElement(e),Dt.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(t=e.parent)==null||t.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}
57add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),r(this,Y).addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!r(this,Hh)),r(this,Y).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var s;if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!r(this,Xn)&&(e._focusEventsAllowed=!1,g(this,Xn,setTimeout(()=>{g(this,Xn,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:r(this,Y)._signal}),t.focus())},0))),e._structTreeParentId=(s=r(this,Yo))==null?void 0:s.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const t=()=>e._uiManager.rebuild(e),s=()=>{e.remove()};this.addCommands({cmd:t,undo:s,mustExec:!1})}getEditorByUID(e){for(const t of r(this,ps).values())if(t.uid===e)return t;return null}combinedSignal(e){return r(this,Y).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=r(this,Ft,Ri))==null?void 0:e.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await r(this,Y).updateMode(e.mode);const{offsetX:s,offsetY:i}=b(this,Ft,mm).call(this),n=r(this,Y).getId(),a=b(this,Ft,gm).call(this,{parent:this,id:n,x:s,y:i,uiManager:r(this,Y),isCentered:!0,...t});a&&this.add(a)}async deserialize(e){var t;return await((t=r(hi,ra).get(e.annotationType??e.annotationEditorType))==null?void 0:t.deserialize(e,this,r(this,Y)))||null}createAndAddNewEditor(e,t,s={}){const i=r(this,Y).getId(),n=b(this,Ft,gm).call(this,{parent:this,id:i,x:e.offsetX,y:e.offsetY,uiManager:r(this,Y),isCentered:t,...s});return n&&this.add(n),n}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(e={}){this.createAndAddNewEditor(b(this,Ft,mm).call(this),!0,e)}setSelected(e){r(this,Y).setSelected(e)}toggleSelected(e){r(this,Y).toggleSelected(e)}unselect(e){r(this,Y).unselect(e)}pointerup(e){var i;const{isMac:t}=Mt.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!r(this,ia)||(g(this,ia,!1),(i=r(this,Ft,Ri))!=null&&i.isDrawer&&r(this,Ft,Ri).supportMultipleDrawings))return;if(!r(this,Bh)){g(this,Bh,!0);return}const s=r(this,Y).getMode();if(s===nt.STAMP||s===nt.POPUP||s===nt.SIGNATURE){r(this,Y).unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){var i;if(r(this,Y).getMode()===nt.HIGHLIGHT&&this.enableTextSelection(),r(this,ia)){g(this,ia,!1);return}const{isMac:t}=Mt.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(g(this,ia,!0),(i=r(this,Ft,Ri))!=null&&i.isDrawer){this.startDrawingSession(e);return}const s=r(this,Y).getActive();g(this,Bh,!s||s.isEmpty())}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),r(this,Ei)){r(this,Ft,Ri).startDrawing(this,r(this,Y),!1,e);return}r(this,Y).setCurrentDrawingSession(this),g(this,Ei,new AbortController);const t=r(this,Y).combinedSignal(r(this,Ei));this.div.addEventListener("blur",({relatedTarget:s})=>{s&&!this.div.contains(s)&&(g(this,Yn,null),this.commitOrRemove())},{signal:t}),r(this,Ft,Ri).startDrawing(this,r(this,Y),!1,e)}pause(e){if(e){const{activeElement:t}=document;this.div.contains(t)&&g(this,Yn,t);return}r(this,Yn)&&setTimeout(()=>{var t;(t=r(this,Yn))==null||t.focus(),g(this,Yn,null)},0)}endDrawingSession(e=!1){return r(this,Ei)?(r(this,Y).setCurrentDrawingSession(null),r(this,Ei).abort(),g(this,Ei,null),g(this,Yn,null),r(this,Ft,Ri).endDrawing(e)):null}findNewParent(e,t,s){const i=r(this,Y).findParent(t,s);return i===null||i===this?!1:(i.changeParent(e),!0)}commitOrRemove(){return r(this,Ei)?(this.endDrawingSession(),!0):!1}onScaleChanging(){r(this,Ei)&&r(this,Ft,Ri).onScaleChangingWhenDrawing(this)}destroy(){var e,t;this.commitOrRemove(),((e=r(this,Y).getActive())==null?void 0:e.parent)===this&&(r(this,Y).commitOrRemove(),r(this,Y).setActiveEditor(null)),r(this,Xn)&&(clearTimeout(r(this,Xn)),g(this,Xn,null));for(const s of r(this,ps).values())(t=r(this,Yo))==null||t.removePointerInTextLayer(s.contentDiv),s.setParent(null),s.isAttachedToDOM=!1,s.div.remove();this.div=null,r(this,ps).clear(),r(this,Y).removeLayer(this)}async render({viewport:e}){this.viewport=e,Qo(this.div,e);for(const t of r(this,Y).getEditors(this.pageIndex))this.add(t),t.rebuild();await r(this,Y).findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:e}){r(this,Y).commitOrRemove(),b(this,Ft,yf).call(this);const t=this.viewport.rotation,s=e.rotation;if(this.viewport=e,Qo(this.div,{rotation:s}),t!==s)for(const i of r(this,ps).values())i.rotate(s)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return r(this,Y).viewParameters.realScale}};Yo=new WeakMap,Bh=new WeakMap,ea=new WeakMap,sa=new WeakMap,Xn=new WeakMap,ps=new WeakMap,ia=new WeakMap,Uh=new WeakMap,Hh=new WeakMap,Ei=new WeakMap,Yn=new WeakMap,gs=new WeakMap,Kn=new WeakMap,na=new WeakMap,_h=new WeakMap,Y=ne
57w WeakMap,ra=new WeakMap,Ft=new WeakSet,pm=function(){return r(this,ps).size!==0?r(this,ps).values():r(this,Y).getEditors(this.pageIndex)},Xb=function(e){r(this,Y).unselectAll();const{target:t}=e;if(t===r(this,gs).div||(t.getAttribute("role")==="img"||t.classList.contains("endOfContent")||t.classList.contains("textLayerImages")||t.classList.contains("textLayerImagePlaceholder"))&&r(this,gs).div.contains(t)){const{isMac:s}=Mt.platform;if(e.button!==0||e.ctrlKey&&s)return;r(this,Y).showAllEditors("highlight",!0,!0),If.startDrawing(this,r(this,Y),r(this,Y).direction==="ltr",e),e.preventDefault()}},Ri=function(){return r(hi,ra).get(r(this,Y).getMode())},gm=function(e){const t=r(this,Ft,Ri);return t?new t.prototype.constructor(e):null},mm=function(){const{x:e,y:t,width:s,height:i}=this.boundingClientRect,n=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+s),l=Math.min(window.innerHeight,t+i),h=(n+o)/2-e,c=(a+l)/2-t,[u,f]=this.viewport.rotation%180===0?[h,c]:[c,h];return{offsetX:u,offsetY:f}},yf=function(){for(const e of r(this,ps).values())e.isEmpty()&&e.remove()},R(hi,"_initialized",!1),y(hi,ra,new Map([Gg,nm,dm,If,cm].map(e=>[e._editorType,e])));let fm=hi;ot(1806);function gw(d,e){return d===e?0:d.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function Mu(d){var e;return d?d.nodeType===Node.ELEMENT_NODE?d.closest(".textLayer"):((e=d.parentElement)==null?void 0:e.closest(".textLayer"))||null:null}function mw(d,e,t,s){if(d===t)return e<=s;const i=d.compareDocumentPosition(t);return i&Node.DOCUMENT_POSITION_FOLLOWING?!0:i&Node.DOCUMENT_POSITION_PRECEDING?!1:null}function Pv(d,e,t){if(d.nodeType!==Node.ELEMENT_NODE||!d.classList.contains("textLayer")||e!==d.childNodes.length)return{container:d,offset:e};let s=d.lastChild;return(s==null?void 0:s.nodeType)===Node.ELEMENT_NODE&&s.classList.contains("endOfContent")&&(s=s.previousSibling),!s||!t.contains(s)?null:s.nodeType===Node.TEXT_NODE?{container:s,offset:s.textContent.length}:{container:s,offset:s.childNodes.length}}var es,ss,ii,uu,fu,Ko,Jo,pu,tp,aa,oa,la,ha,Jn,Xe,ym,bm,Yb,bf,Kb,cn,Am,Jb,wm;const J=class J{constructor({filterFactory:e=null,pageColors:t=null,pageIndex:s,textLayer:i=null}){y(this,cn);y(this,es,null);y(this,ss,new Map);y(this,ii,null);y(this,uu,null);y(this,fu,null);y(this,Ko,null);y(this,Jo,new Map);if(this.pageIndex=s,g(this,uu,e),g(this,fu,t),i){const n=r(J,Jn).get(i);if(n!=null&&n.selectionDiv&&(n.selectionDiv.remove(),r(J,oa).delete(n.selectionDiv)),r(J,Jn).set(i,{drawLayer:this}),r(J,ha).add(i),g(this,ii,i),g(this,Ko,new MutationObserver(a=>{var o,l,h;if(!(!r(this,es)||!((o=r(this,ii))!=null&&o.isConnected)||!b(l=J,Xe,bm).call(l))){for(const{addedNodes:c}of a)for(const u of c)if(u.nodeType===Node.ELEMENT_NODE&&u.classList.contains("endOfContent")){b(h=J,Xe,bf).call(h);return}}})),r(this,Ko).observe(i,{childList:!0}),r(J,aa)===null){g(J,aa,new AbortController);const{signal:a}=r(J,aa);document.addEventListener("selectionchange",b(J,Xe,bf).bind(J),{signal:a}),document.addEventListener("pointerdown",()=>{g(J,la,!0)},{signal:a}),document.addEventListener("pointerup",()=>{g(J,la,!1)},{signal:a}),window.addEventListener("blur",()=>{g(J,la,!1)},{signal:a})}}}setParent(e){var t,s,i;if(!r(this,es)){g(this,es,e),(t=r(this,ii))!=null&&t.isConnected&&b(s=J,Xe,bm).call(s)&&b(i=J,Xe,bf).call(i);return}if(r(this,es)!==e){if(r(this,ss).size>0)for(const n of r(this,ss).values())n.remove(),e.append(n);g(this,es,e)}}static get _svgFactory(){return Q(this,"_svgFactory",new Cf)}draw(e,t=!1,s=!1){const i=Xt(J,pu)._++,n=b(this,cn,Am).call(this),a=J._svgFactory.createElement("defs");n.append(a);const o=J._svgFactory.createElement("path");a.append(o);const l=`path_${i}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),t&&r(this,Jo).set(i,o);const h=s?b(this,cn,Jb).call(this,a,l):null,c=J._svgFactory.createElement("use");return n.append(c),c.setAttribute("href",`#${l}`),this.updateProperties(n,e),r(this,ss).set(i,n),{id:i,clipPathId:`url(#${h})`}}drawOutline(e,t){const s=Xt(J,pu)._++,i=b(this,cn,Am).call(this),n=J._svgFactory.createElement("defs");i.append(n);const a=J._svgFactory.createElement("path");n.append(a);const o=`path_${s}`;a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke");let l;if(t){const u=J._svgFactory.createElement("mask");n.append(u),l=`mask_${s}`,u.setAttribute("id",l),u.setAttribute("maskUnits","objectBoundingBox");const f=J._svgFactory.createElement("rect");u.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");const p=J._svgFactory.createElement("use");u.append(p),p.setAttribute("href",`#${o}`),p.setAttribute("stroke","none"),p.setAttribute("fill","black"),p.setAttribute("fill-rule","nonzero"),p.classList.add("mask")}const h=J._svgFactory.createElement("use");i.append(h),h.setAttribute("href",`#${o}`),l&&h.setAttribute("mask",`url(#${l})`);const c=h.cloneNode();return i.append(c),h.classList.add("mainOutline"),c.classList.add("secondaryOutline"),this.updateProperties(i,e),r(this,ss).set(s,i),s}finalizeDraw(e,t){r(this,Jo).delete(e),this.updateProperties(e,t)}updateProperties(e,t){var l;if(!t)return;const{root:s,bbox:i,rootClass:n,path:a}=t,o=typeof e=="number"?r(this,ss).get(e):e;if(o){if(s&&b(this,cn,wm).call(this,o,s),i&&b(l=J,Xe,Kb).call(l,o,i),n){const{classList:h}=o;for(const[c,u]of Object.entries(n))h.toggle(c,u)}if(a){const c=o.firstElementChild.firstElementChild;b(this,cn,wm).call(this,c,a)}}}updateParent(e,t){if(t===this)return;const s=r(this,ss).get(e);s&&(r(t,es).append(s),r(this,ss).delete(e),r(t,ss).set(e,s))}remove(e){r(this,Jo).delete(e),r(this,es)!==null&&(r(this,ss).get(e).remove(),r(this,ss).delete(e))}destroy(){var e,t,s;g(this,es,null);for(const i of r(this,ss).values())i.remove();if(r(this,ss).clear(),r(this,Jo).clear(),(e=r(this,Ko))==null||e.disconnect(),g(this,Ko,null),r(this,ii)){const i=r(J,Jn).get(r(this,ii));(i==null?void 0:i.drawLayer)===this&&(b(t=J,Xe,ym).call(t,r(this,ii)),r(J,Jn).delete(r(this,ii)),r(J,ha).delete(r(this,ii)),r(J,ha).size===0&&((s=r(J,aa))==null||s.abort(),g(J,aa,null),g(J,la,!1))),g(this,ii,null)}}};es=new WeakMap,ss=new WeakMap,ii=new WeakMap,uu=new WeakMap,fu=new WeakMap,Ko=new WeakMap,Jo=new WeakMap,pu=new WeakMap,tp=new WeakMap,aa=new WeakMap,oa=new WeakMap,la=new WeakMap,ha=new WeakMap,Jn=new WeakMap,Xe=new WeakSet,ym=function(e){const t=r(this,Jn).get(e);t!=null&&t.selectionDiv&&(t.selectionDiv.remove(),r(this,oa).delete(t.selectionDiv),t.selectionDiv=null,t.path=null)},bm=function(){const e=document.getSelection();return!!e&&!e.isCollapsed},Yb=function(){return r(this,ha).keys().filter(e=>e.isConnected).toArray().sort(gw)},bf=function(){var a;const e=document.getSelection();if(!e||e.isCollapsed){for(const o of r(this,oa))o.remove();r(this,oa).clear();return}const t=new WeakMap,s=b(this,Xe,Yb).call(this),i=[];for(let o=0,l=e.rangeCount;o<l;o++){const h=e.getRangeAt(o);if(h.collapsed)continue;let{startContainer:c,startOffset:u,endContainer:f,endOffset:p}=h,m=Mu(c),v=Mu(f);const A=m===null,w=v===null;if(r(this,la)&&A!==w)return;if(e.rangeCount===1){const{anchorNode:T,anchorOffset:E,focusNode:C,focusOffset:P}=e,O=Mu(T),I=Mu(C),D=mw(T,E,C,P);O&&I&&D!==null&&(D?(c=T,u=E,m=O,f=C,p=P,v=I):(c=C,u=P,m=I,f=T,p=E,v=O))}const S=s.filter(T=>h.intersectsNode(T));if(S.length===0)continue;let x=!1;if(m||(m=S[0],c=m,u=0,x=!0),v||(v=S.at(-1),f=v,p=v.childNodes.length,x=!0),f.nodeType===Node.ELEMENT_NODE){if(f.classList.contains("endOfContent")){const T=f.previousSibling;if(!T)continue;f=T,p=T.nodeType===Node.TEXT_NODE?T.textContent.length:T.childNodes.length}else if(f.classList.contains("textLayer")&&f.childNodes.length===p){const T=Pv(f,p,v);if(!T)continue;f=T.container,p=T.offset}}if(c.nodeType===Node.ELEMENT_NODE){const T=Pv(c,u,m);if(!T)continue;c=T.container,u=T.offset}if(m===v&&!x&&S.includes(m)){i.push([h,m]);continue}for(const T of S){const E=T.firstChild;if(!E)continue;const C=document.createRange();if(T===m?C.setStart(c,u):C.setStartBefore(E),T===v)C.setEnd(f,p);else{const P=T.lastChild;if(!P)continue;if(P.nodeType===Node.ELEMENT_NODE&&P.classList.contains("endOfContent")){const O=P.previousSibling;if(!O)continue;C.setEndAfter(O)}else C.setEndAfter(P)}C.collapsed||i.push([C,T])}}const n=new Set(i.map(o=>o[1]));for(const o of r(this,ha))n.has(o)||b(this,Xe,ym).call(this,o);for(const[o,l]of i){const h=r(J,Jn).get(l);if(!h)continue;let c=t.get(l);if(!c){const v=l.getBoundingClientRect();c=(A,w,S,x)=>({x:(A-v.x)/v.width,y:(w-v.y)/v.height,width:S/v.width,height:x/v.height}),t.set(l,c)}const u=[];for(let{x:v,y:A,width:w,height:S}of o.getClientRects())w===0||S===0||({x:v,y:A,width:w,height:S}=c(v,A,w,S),!(w===1&&S===1)&&u.push(`M${v} ${A} h${w} v${S} h-${w} Z`));if(u.length===0)continue;const f=h.drawLayer;let p=h.selectionDiv,m=h.path;if(!p){const v=`clip_selection_${Xt(J,tp)._++}`;p=document.createElement("div"),p.className="selection",p.style.clipPath=`url(#${v})`;const A=(a=r(f,uu))==null?void 0:a.createSelectionStyle(r(f,fu));if(A)for(const[x,T]of Object.entries(A))p.style.setProperty(x,T);const w=J._svgFactory.create(1,1,!0);w.setAttribute("aria-hidden","true"),w.setAttribute("width","100%"),w.setAttribute("height","100%");const S=J._svgFactory.createElement("clipPath");S.setAttribute("id",v),S.setAttribute("clipPathUnits","objectBoundingBox"),m=J._svgFactory.createElement("path"),S.append(m),w.append(S),p.append(w),h.path=m,h.selectionDiv=p}r(f,es)&&p.parentNode!==r(f,es)&&(r(f,es).append(p),r(this,oa).add(p)),m.setAttribute("d",u.join(" "))}},Kb=function(e,[t,s,i,n]){const{style:a}=e;a.top=`${100*s}%`,a.left=`${100*t}%`,a.width=`${100*i}%`,a.height=`${100*n}%`},cn=new WeakSet,Am=function(){const e=J._svgFactory.create(1,1,!0);return r(this,es).append(e),e.setAttribute("aria-hidden","true"),e},Jb=function(e,t){const s=J._svgFactory.createElement("clipPath");e.append(s);const i=`clip_${t}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");const n=J._svgFactory.createElement("use");return s.append(n),n.setAttribute("href",`#${t}`),n.classList.add("clip"),i},wm=function(e,t){for(const[s,i]of Object.entries(t))i===null?e.removeAttribute(s):e.setAttribute(s,i)},y(J,Xe),y(J,pu,0),y(J,tp,0),y(J,aa,null),y(J,oa,new Set),y(J,la,!1),y(J,ha,new Set),y(J,Jn,new WeakMap);let vm=J;function Ru(d){return`${(d*100).toFixed(2)}%`}var jh,gu,mu,$h,rn,an,vu,ep,Qb;const xc=class xc{constructor(e,t,s,i){y(this,ep);y(this,jh,[]);y(this,gu,new Map);y(this,mu,null);y(this,$h,0);y(this,rn,0);y(this,an,0);g(this,$h,e),g(this,jh,t),g(this,rn,s.rawDims.pageWidth),g(this,an,s.rawDims.pageHeight),g(this,mu,i)}render(){const e=document.createElement("div");e.className="textLayerImages";for(let t=0;t<r(this,jh).length;t+=6){const s=b(this,ep,Qb).call(this,r(this,jh).subarray(t,t+6));s&&e.append(s)}return e.addEventListener("contextmenu",t=>{var w;if(!(t.target instanceof HTMLCanvasElement))return;const s=t.target,i=r(this,gu).get(s);if(!i)return;const n=(w=r(xc,vu))==null?void 0:w.deref();if(n===s)return;
57n&&(n.width=0,n.height=0),g(xc,vu,new WeakRef(s));const{inverseTransform:a,x1:o,y1:l,width:h,height:c}=i,u=r(this,mu).call(this),f=Math.ceil(o*u.width),p=Math.ceil(l*u.height),m=Math.floor((o+h/r(this,rn))*u.width),v=Math.floor((l+c/r(this,an))*u.height);s.width=m-f,s.height=v-p;const A=s.getContext("2d");A.setTransform(...a),A.translate(-f,-p),A.drawImage(u,0,0)}),e}};jh=new WeakMap,gu=new WeakMap,mu=new WeakMap,$h=new WeakMap,rn=new WeakMap,an=new WeakMap,vu=new WeakMap,ep=new WeakSet,Qb=function([e,t,s,i,n,a]){const o=Math.hypot((n-e)*r(this,rn),(a-t)*r(this,an)),l=Math.hypot((s-e)*r(this,rn),(i-t)*r(this,an));if(o<r(this,$h)||l<r(this,$h))return null;const h=[(n-e)*r(this,rn)/o,(a-t)*r(this,an)/o,(s-e)*r(this,rn)/l,(i-t)*r(this,an)/l,0,0],c=_.inverseTransform(h),u=document.createElement("canvas");return u.className="textLayerImagePlaceholder",u.width=0,u.height=0,Object.assign(u.style,{opacity:0,position:"absolute",left:Ru(e),top:Ru(t),width:Ru(o/r(this,rn)),height:Ru(l/r(this,an)),transformOrigin:"0% 0%",transform:`matrix(${h.join(",")})`}),r(this,gu).set(u,{inverseTransform:c,width:o,height:l,x1:e,y1:t}),u},y(xc,vu,null);let Sm=xc;globalThis._pdfjsTestingUtils={HighlightOutliner:Zg};globalThis.pdfjsLib={AbortException:da,AnnotationEditorLayer:fm,AnnotationEditorParamsType:ft,AnnotationEditorType:nt,AnnotationEditorUIManager:qo,AnnotationLayer:$g,AnnotationMode:rr,AnnotationType:Yt,applyOpacity:CA,build:z0,ColorPicker:xf,createValidAbsoluteUrl:Mv,CSSConstants:TA,DOMSVGFactory:Cf,DrawLayer:vm,FeatureTest:Mt,fetchData:Tm,findContrastColor:PA,getDocument:Zy,getFilenameFromUrl:wA,getPdfFilenameFromUrl:SA,getRGB:Au,getRGBA:bu,getUuid:Dv,GlobalWorkerOptions:on,ImageKind:Du,InvalidPDFException:Op,isDataScheme:ap,isPdfFile:Pm,isValidExplicitDest:YA,makeArr:Wh,makeMap:Em,makeObj:Rp,makeSet:yA,MathClamp:_t,noContextMenu:Ti,normalizeUnicode:mA,OPS:Di,OutputScale:Ci,PasswordException:Ip,PasswordResponses:hA,PDFDataRangeTransport:qy,PDFDateString:wf,PDFWorker:Oc,PermissionFlag:lA,PixelsPerInch:ua,RenderingCancelledException:Cm,renderRichText:kv,ResponseException:Af,setLayerDimensions:Qo,shadow:Q,SignatureExtractor:Qn,stopEvent:me,SupportedImageMimeTypes:kp,TextLayer:Ic,TextLayerImages:Sm,TouchManager:ey,updateUrlHash:Rv,Util:_,VerbosityLevel:sp,version:V0,XfaLayer:xm};const vw="/assets/pdf.worker.min-BmVo14Nb.mjs";on.workerSrc=vw;const yw="100% 0px",bw=2,Zb=12;function Ew(d){const{readingId:e,chunks:t,playingPageIndex:s,initialPageIndex:i,onSeek:n}=d,{authHeaders:a}=rA(),o=aA,[l,h]=Te.useState(null),[c,u]=Te.useState(null),[f,p]=Te.useState(null),[m,v]=Te.useState(!0),A=Te.useRef(null),w=Te.useRef(new Map),S=Te.useRef(!1);Te.useEffect(()=>{let O=!1,I=null;return h(null),u(null),p(null),S.current=!1,(async()=>{var D;try{const M=await fetch(`${o}/readings/${e}/pdf`,{headers:{...a()}});if(!M.ok){const z=await M.json().catch(()=>({}));throw new Error(typeof z.detail=="string"?z.detail:"Could not open the PDF")}const{url:U}=await M.json(),L=await fetch(U);if(!L.ok)throw new Error("Could not download the PDF");const B=new Uint8Array(await L.arrayBuffer());if(O)return;I=Zy({data:B});const W=await I.promise;if(O)return;const N=(await W.getPage(1)).getViewport({scale:1}),X=Math.min(((D=A.current)==null?void 0:D.clientWidth)??N.width,900)-16;if(O)return;u({width:X,height:N.height/N.width*X}),h(W)}catch(M){O||p(M instanceof Error?M.message:"Could not open the PDF")}})(),()=>{O=!0,I&&I.destroy()}},[e,o]);const x=Te.useMemo(()=>t.filter(O=>O.status==="done"&&O.offset_in_stitched!=null&&O.page_index!=null),[t]),T=x.length?x[0].page_index:null,E=x.length?x[x.length-1].page_index:null;function C(O,I){if(T==null||E==null||O<T||O>E+1)return{kind:"outside"};const D=x.find(L=>L.page_index===O);if(D)return{kind:"start",offset:D.offset_in_stitched};const M=[...x].reverse().find(L=>L.page_index<O),U=x.find(L=>L.page_index>O);return I!==!1&&M?{kind:"within",offset:M.offset_in_stitched}:U?{kind:"after",offset:U.offset_in_stitched}:{kind:"outside"}}function P(O,I){var M;const D=w.current.get(O);D&&((M=A.current)==null||M.scrollTo({top:D.offsetTop-Zb,behavior:I}))}return Te.useEffect(()=>{if(!l||!c||S.current)return;S.current=!0;const O=i??T;O!=null&&P(O,"auto")},[l,c,i,T]),Te.useEffect(()=>{!m||!l||s==null||P(s,"smooth")},[m,l,s]),f?Ce.jsx("p",{style:{...ca.caption,color:"#dc2626"},children:f}):Ce.jsxs("div",{children:[Ce.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center",margin:"0.5rem 0"},children:[Ce.jsxs("label",{style:{...ca.caption,margin:0,display:"flex",gap:"0.35rem",alignItems:"center"},children:[Ce.jsx("input",{type:"checkbox",checked:m,onChange:O=>v(O.target.checked)}),"Follow the audio"]}),l&&Ce.jsxs("span",{style:{...ca.caption,margin:0},children:[l.numPages," pages"]})]}),Ce.jsx("div",{ref:A,onWheel:()=>v(!1),onTouchMove:()=>v(!1),style:{height:"75vh",overflowY:"auto",background:"#e2e8f0",borderRadius:8,padding:8,position:"relative"},children:!l||!c?Ce.jsx("p",{style:ca.caption,children:"Loading PDFâ¦"}):Array.from({length:l.numPages},(O,I)=>{var D;return Ce.jsx(Aw,{doc:l,pageIndex:I,width:c.width,height:c.height,root:A.current,isPlaying:I===s,printedLabel:((D=x.find(M=>M.page_index===I))==null?void 0:D.page_label)??null,playTarget:C,onSeek:n,registerEl:M=>{M?w.current.set(I,M):w.current.delete(I)}},I)})})]})}function Aw(d){const{doc:e,pageIndex:t,width:s,root:i,isPlaying:n,printedLabel:a,playTarget:o,onSeek:l,registerEl:h}=d,c=Te.useRef(null),u=Te.useRef(null),[f,p]=Te.useState(!1),[m,v]=Te.useState(d.height),[A,w]=Te.useState(null);Te.useEffect(()=>{const T=c.current;if(!T)return;const E=new IntersectionObserver(C=>p(C.some(P=>P.isIntersecting)),{root:i,rootMargin:yw});return E.observe(T),()=>E.disconnect()},[i]),Te.useEffect(()=>{const T=u.current;if(!f||!T)return;let E=null,C=!1;return(async()=>{const P=await e.getPage(t+1);if(C)return;const O=P.getViewport({scale:1}),I=s/O.width,D=P.getViewport({scale:I*Math.min(window.devicePixelRatio||1,bw)});T.width=D.width,T.height=D.height,v(O.height*I),E=P.render({canvas:T,viewport:D});try{await E.promise}catch{return}if(A==null){const M=await P.getTextContent();C||w(M.items.some(U=>"str"in U&&U.str.trim()!==""))}})(),()=>{C=!0,E==null||E.cancel(),T.width=0,T.height=0}},[f,e,t,s]);const S=o(t,A),x=`Page ${t+1}${a?` · p. ${a}`:""}`;return Ce.jsxs("div",{ref:T=>{c.current=T,h(T)},style:{margin:`0 auto ${Zb}px`,width:s},children:[Ce.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",margin:"0 0 4px"},children:[Ce.jsxs("span",{style:{...ca.caption,margin:0,fontWeight:n?700:400},children:[n?"ð ":"",x]}),S.kind==="outside"?Ce.jsx("span",{style:{...ca.caption,margin:0},children:"Not in this reading"}):Ce.jsxs(Ce.Fragment,{children:[S.kind==="after"&&Ce.jsx("span",{style:{...ca.caption,margin:0},children:"No audio on this page"}),Ce.jsx("button",{style:ca.smallButton,onClick:()=>l(S.offset),children:S.kind==="after"?"â¶ Play from next page":"â¶ Play from this page"})]})]}),Ce.jsx("canvas",{ref:u,style:{width:s,height:m,display:"block",background:"#fff",outline:n?"3px solid #38bdf8":"none"}})]})}export{Ew as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.