PageSourceSearch

https://elysiatools.com/_next/static/chunks/51fb665c.cd0a51d87e5d6d56.js

js elysiatools.com collected 2026-10-02 00:17:11 UTC 455,015 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2213],{89139:(t,e,i)=>{i.d(e,{EA:()=>eV,YE:()=>iy,lf:()=>Y,nS:()=>iS,rE:()=>iM});var r=i(70636),s=i(10823).Buffer,n={34(t,e,i){var r=i(4901);t.exports=function(t){return"object"==typeof t?null!==t:r(t)}},81(t,e,i){var r=i(9565),s=i(9306),n=i(8551),a=i(6823),o=i(851),l=TypeError;t.exports=function(t,e){var i=arguments.length<2?o(t):e;if(s(i))return n(r(i,t));throw new l(a(t)+" is not iterable")}},116(t,e,i){var r=i(6518),s=i(9565),n=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),d=i(4549)("find",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:d},{find:function(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(d)return s(d,this,t);var e=l(this),i=0;return n(e,function(e,r){if(t(e,i++))return r(e)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})},283(t,e,i){var r=i(9504),s=i(9039),n=i(4901),a=i(9297),o=i(3724),l=i(350).CONFIGURABLE,h=i(3706),d=i(1181),c=d.enforce,u=d.get,p=String,g=Object.defineProperty,m=r("".slice),f=r("".replace),b=r([].join),v=o&&!s(function(){return 8!==g(function(){},"length",{value:8}).length}),y=String(String).split("String"),A=t.exports=function(t,e,i){"Symbol("===m(p(e),0,7)&&(e="["+f(p(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!a(t,"name")||l&&t.name!==e)&&(o?g(t,"name",{value:e,configurable:!0}):t.name=e),v&&i&&a(i,"arity")&&t.length!==i.arity&&g(t,"length",{value:i.arity});try{i&&a(i,"constructor")&&i.constructor?o&&g(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=c(t);return a(r,"source")||(r.source=b(y,"string"==typeof e?e:"")),t};Function.prototype.toString=A(function(){return n(this)&&u(this).source||h(this)},"toString")},350(t,e,i){var r=i(3724),s=i(9297),n=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,o=s(n,"name"),l=o&&(!r||r&&a(n,"name").configurable);t.exports={EXISTS:o,PROPER:o&&"something"===(function(){}).name,CONFIGURABLE:l}},397(t,e,i){t.exports=i(7751)("document","documentElement")},421(t){t.exports={}},456(t,e,i){var r=i(6518),s=i(4576),n=i(9504),a=i(4154),o=i(5169),l=n(1.1.toString),h=s.Uint8Array,d=!h||!h.prototype.toHex||!function(){try{var t=new h([255,255,255,255,255,255,255,255]);return"ffffffffffffffff"===t.toHex()}catch(t){return!1}}();h&&r({target:"Uint8Array",proto:!0,forced:d},{toHex:function(){a(this),o(this.buffer);for(var t="",e=0,i=this.length;e<i;e++){var r=l(this[e],16);t+=1===r.length?"0"+r:r}return t}})},507(t,e,i){var r=i(9565);t.exports=function(t,e,i){for(var s,n,a=i?t:t.iterator,o=t.next;!(s=r(o,a)).done;)if(void 0!==(n=e(s.value)))return n}},531(t,e,i){var r=i(6518),s=i(9565),n=i(9306),a=i(8551),o=i(1767),l=i(8646),h=i(9462),d=i(9539),c=i(6395),u=i(684),p=i(4549),g=!c&&!u("flatMap",function(){}),m=!c&&!g&&p("flatMap",TypeError),f=c||g||m,b=h(function(){for(var t,e,i=this.iterator,r=this.mapper;;){if(e=this.inner)try{if(!(t=a(s(e.next,e.iterator))).done)return t.value;this.inner=null}catch(t){d(i,"throw",t)}if(t=a(s(this.next,i)),this.done=!!t.done)return;try{this.inner=l(r(t.value,this.counter++),!1)}catch(t){d(i,"throw",t)}}});r({target:"Iterator",proto:!0,real:!0,forced:f},{flatMap:function(t){a(this);try{n(t)}catch(t){d(this,"throw",t)}return m?s(m,this,t):new b(o(this),{mapper:t,inner:null})}})},616(t,e,i){t.exports=!i(9039)(function(){var t=(function(){}).bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},655(t,e,i){var r=i(6955),s=String;t.exports=function(t){if("Symbol"===r(t))throw TypeError("Cannot convert a Symbol value to a string");return s(t)}},679(t,e,i){var r=i(1625),s=TypeError;t.exports=function(t,e){if(r(e,t))return t;throw new s("Incorrect invocation")}},684(t){t.exports=function(t,e){var i="function"==typeof Iterator&&Iterator.prototype[t];if(i)try{i.call({next:null},e).next()}catch(t){return!0}}},741(t){var e=Math.ceil,i=Math.floor;t.exports=Math.trunc||function(t){var r=+t;return(r>0?i:e)(r)}},757(t,e,i){var r=i(7751),s=i(4901),n=i(1625),a=i(7040),o=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=r("Symbol");return s(e)&&n(e.prototype,o(t))}},851(t,e,i){var r=i(6955),s=i(5966),n=i(4117),a=i(6269),o=i(8227)("iterator");t.exports=function(t){if(!n(t))return s(t,o)||s(t,"@@iterator")||a[r(t)]}},944(t){var e=TypeError;t.exports=function(t){var i=t&&t.alphabet;if(void 0===i||"base64"===i||"base64url"===i)return i||"base64";throw new e("Incorrect `alphabet` option")}},1072(t,e,i){var r=i(1828),s=i(8727);t.exports=Object.keys||function(t){return r(t,s)}},1103(t){t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},1108(t,e,i){var r=i(6955);t.exports=function(t){var e=r(t);return"BigInt64Array"===e||"BigUint64Array"===e}},1148(t,e,i){var r=i(6518),s=i(9565),n=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),d=i(4549)("every",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:d},{every:function(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(d)return s(d,this,t);var e=l(this),i=0;return!n(e,function(e,r){if(!t(e,i++))return r()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1181(t,e,i){var r,s,n,a=i(8622),o=i(4576),l=i(34),h=i(6699),d=i(9297),c=i(7629),u=i(6119),p=i(421),g="Object already initialized",m=o.TypeError,f=o.WeakMap;if(a||c.state){var b=c.state||(c.state=new f);b.get=b.get,b.has=b.has,b.set=b.set,r=function(t,e){if(b.has(t))throw new m
1(g);return e.facade=t,b.set(t,e),e},s=function(t){return b.get(t)||{}},n=function(t){return b.has(t)}}else{var v=u("state");p[v]=!0,r=function(t,e){if(d(t,v))throw new m(g);return e.facade=t,h(t,v,e),e},s=function(t){return d(t,v)?t[v]:{}},n=function(t){return d(t,v)}}t.exports={set:r,get:s,has:n,enforce:function(t){return n(t)?s(t):r(t,{})},getterFor:function(t){return function(e){var i;if(!l(e)||(i=s(e)).type!==t)throw new m("Incompatible receiver, "+t+" required");return i}}}},1291(t,e,i){var r=i(741);t.exports=function(t){var e=+t;return e!=e||0===e?0:r(e)}},1385(t,e,i){var r=i(9539);t.exports=function(t,e,i){for(var s=t.length-1;s>=0;s--)if(void 0!==t[s])try{i=r(t[s].iterator,e,i)}catch(t){e="throw",i=t}if("throw"===e)throw i;return i}},1548(t,e,i){var r=i(4576),s=i(9039),n=i(9519),a=i(4215),o=r.structuredClone;t.exports=!!o&&!s(function(){if("DENO"===a&&n>92||"NODE"===a&&n>94||"BROWSER"===a&&n>97)return!1;var t=new ArrayBuffer(8),e=o(t,{transfer:[t]});return 0!==t.byteLength||8!==e.byteLength})},1549(t,e,i){i(6632)},1625(t,e,i){t.exports=i(9504)({}.isPrototypeOf)},1689(t,e,i){var r=i(6518),s=i(4576),n=i(8745),a=i(7680),o=i(6043),l=i(9306),h=i(1103),d=s.Promise,c=!1;r({target:"Promise",stat:!0,forced:!d||!d.try||h(function(){d.try(function(t){c=8===t},8)}).error||!c},{try:function(t){var e=arguments.length>1?a(arguments,1):[],i=o.f(this),r=h(function(){return n(l(t),void 0,e)});return(r.error?i.reject:i.resolve)(r.value),i.promise}})},1698(t,e,i){var r=i(6518),s=i(4204),n=i(9835);r({target:"Set",proto:!0,real:!0,forced:!i(4916)("union")||!n("union")},{union:s})},1701(t,e,i){var r=i(6518),s=i(9565),n=i(9306),a=i(8551),o=i(1767),l=i(9462),h=i(6319),d=i(9539),c=i(684),u=i(4549),p=i(6395),g=!p&&!c("map",function(){}),m=!p&&!g&&u("map",TypeError),f=p||g||m,b=l(function(){var t=this.iterator,e=a(s(this.next,t));if(!(this.done=!!e.done))return h(t,this.mapper,[e.value,this.counter++],!0)});r({target:"Iterator",proto:!0,real:!0,forced:f},{map:function(t){a(this);try{n(t)}catch(t){d(this,"throw",t)}return m?s(m,this,t):new b(o(this),{mapper:t})}})},1767(t){t.exports=function(t){return{iterator:t,next:t.next,done:!1}}},1828(t,e,i){var r=i(9504),s=i(9297),n=i(5397),a=i(9617).indexOf,o=i(421),l=r([].push);t.exports=function(t,e){var i,r=n(t),h=0,d=[];for(i in r)!s(o,i)&&s(r,i)&&l(d,i);for(;e.length>h;)s(r,i=e[h++])&&(~a(d,i)||l(d,i));return d}},2106(t,e,i){var r=i(283),s=i(4913);t.exports=function(t,e,i){return i.get&&r(i.get,e,{getter:!0}),i.set&&r(i.set,e,{setter:!0}),s.f(t,e,i)}},2140(t,e,i){var r=i(8227)("toStringTag"),s={};s[r]="z",t.exports="[object z]"===String(s)},2195(t,e,i){var r=i(9504),s=r({}.toString),n=r("".slice);t.exports=function(t){return n(s(t),8,-1)}},2211(t,e,i){t.exports=!i(9039)(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})},2303(t,e,i){var r=i(4576),s=i(9504),n=r.Uint8Array,a=r.SyntaxError,o=r.parseInt,l=Math.min,h=/[^\da-f]/i,d=s(h.exec),c=s("".slice);t.exports=function(t,e){var i=t.length;if(i%2!=0)throw new a("String should be an even number of characters");for(var r=e?l(e.length,i/2):i/2,s=e||new n(r),u=0,p=0;p<r;){var g=c(t,u,u+=2);if(d(h,g))throw new a("String should only contain hex characters");s[p++]=o(g,16)}return{bytes:s,read:u}}},2360(t,e,i){var r,s=i(8551),n=i(6801),a=i(8727),o=i(421),l=i(397),h=i(4055),d=i(6119),c="prototype",u="script",p=d("IE_PROTO"),g=function(){},m=function(t){return"<"+u+">"+t+"</"+u+">"},f=function(t){t.write(m("")),t.close();var e=t.parentWindow.Object;return t=null,e},b=function(){var t,e=h("iframe");return e.style.display="none",l.appendChild(e),e.src=String("java"+u+":"),(t=e.contentWindow.document).open(),t.write(m("document.F=Object")),t.close(),t.F},v=function(){try{r=new ActiveXObject("htmlfile")}catch(t){}v="undefined"!=typeof document?document.domain&&r?f(r):b():f(r);for(var t=a.length;t--;)delete v[c][a[t]];return v()};o[p]=!0,t.exports=Object.create||function(t,e){var i;return null!==t?(g[c]=s(t),i=new g,g[c]=null,i[p]=t):i=v(),void 0===e?i:n.f(i,e)}},2475(t,e,i){var r=i(6518),s=i(8527);r({target:"Set",proto:!0,real:!0,forced:!i(4916)("isSupersetOf",function(t){return!t})},{isSupersetOf:s})},2489(t,e,i){var r=i(6518),s=i(9565),n=i(9306),a=i(8551),o=i(1767),l=i(9462),h=i(6319),d=i(6395),c=i(9539),u=i(684),p=i(4549),g=!d&&!u("filter",function(){}),m=!d&&!g&&p("filter",TypeError),f=d||g||m,b=l(function(){for(var t,e,i=this.iterator,r=this.predicate,n=this.next;;){if(t=a(s(n,i)),this.done=!!t.done)return;if(h(i,r,[e=t.value,this.counter++],!0))return e}});r({target:"Iterator",proto:!0,real:!0,forced:f},{filter:function(t){a(this);try{n(t)}catch(t){c(this,"throw",t)}return m?s(m,this,t):new b(o(this),{predicate:t})}})},2529(t){t.exports=function(t,e){return{value:t,done:e}}},2603(t,e,i){var r=i(655);t.exports=function(t,e){return void 0===t?arguments.length<2?"":e:r(t)}},2652(t,e,i){var r=i(6080),s=i(9565),n=i(8551),a=i(6823),o=i(4209),l=i(6198),h=i(1625),d=i(81),c=i(851),u=i(9539),p=TypeError,g=function(t,e){this.stopped=t,this.result=e},m=g.prototype;
1t.exports=function(t,e,i){var f,b,v,y,A,w,x,E=i&&i.that,S=!!(i&&i.AS_ENTRIES),_=!!(i&&i.IS_RECORD),T=!!(i&&i.IS_ITERATOR),C=!!(i&&i.INTERRUPTED),M=r(e,E),D=function(t){return f&&u(f,"normal"),new g(!0,t)},P=function(t){return S?(n(t),C?M(t[0],t[1],D):M(t[0],t[1])):C?M(t,D):M(t)};if(_)f=t.iterator;else if(T)f=t;else{if(!(b=c(t)))throw new p(a(t)+" is not iterable");if(o(b)){for(v=0,y=l(t);y>v;v++)if((A=P(t[v]))&&h(m,A))return A;return new g(!1)}f=d(t,b)}for(w=_?t.next:f.next;!(x=s(w,f)).done;){try{A=P(x.value)}catch(t){u(f,"throw",t)}if("object"==typeof A&&A&&h(m,A))return A}return new g(!1)}},2777(t,e,i){var r=i(9565),s=i(34),n=i(757),a=i(5966),o=i(4270),l=i(8227),h=TypeError,d=l("toPrimitive");t.exports=function(t,e){if(!s(t)||n(t))return t;var i,l=a(t,d);if(l){if(void 0===e&&(e="default"),!s(i=r(l,t,e))||n(i))return i;throw new h("Can't convert object to primitive value")}return void 0===e&&(e="number"),o(t,e)}},2787(t,e,i){var r=i(9297),s=i(4901),n=i(8981),a=i(6119),o=i(2211),l=a("IE_PROTO"),h=Object,d=h.prototype;t.exports=o?h.getPrototypeOf:function(t){var e=n(t);if(r(e,l))return e[l];var i=e.constructor;return s(i)&&e instanceof i?i.prototype:e instanceof h?d:null}},2796(t,e,i){var r=i(9039),s=i(4901),n=/#|\.prototype\./,a=function(t,e){var i=l[o(t)];return i===d||i!==h&&(s(e)?r(e):!!e)},o=a.normalize=function(t){return String(t).replace(n,".").toLowerCase()},l=a.data={},h=a.NATIVE="N",d=a.POLYFILL="P";t.exports=a},2804(t){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=e+"+/",r=e+"-_",s=function(t){for(var e={},i=0;i<64;i++)e[t.charAt(i)]=i;return e};t.exports={i2c:i,c2i:s(i),i2cUrl:r,c2iUrl:s(r)}},2812(t){var e=TypeError;t.exports=function(t,i){if(t<i)throw new e("Not enough arguments");return t}},2839(t,e,i){var r=i(4576).navigator,s=r&&r.userAgent;t.exports=s?String(s):""},2967(t,e,i){var r=i(6706),s=i(34),n=i(7750),a=i(3506);
1t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=r(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,r){return n(i),a(r),s(i)&&(e?t(i,r):i.__proto__=r),i}}():void 0)},3068(t,e,i){var r=i(6518),s=i(9504),n=i(2652),a=RangeError,o=TypeError,l=1/0,h=NaN,d=Math.abs,c=Math.pow,u=s([].push),p=c(2,1023),g=c(2,53)-1,m=Number.MAX_VALUE,f=c(2,971),b={},v={},y={},A={},w={},x=function(t,e){var i=t+e;return{hi:i,lo:e-(i-t)}};r({target:"Math",stat:!0},{sumPrecise:function(t){var e,i,r,s,c,E,S=[],_=0,T=A;switch(n(t,function(t){if(++_>=g)throw new a("Maximum allowed index exceeded");if("number"!=typeof t)throw new o("Value is not a number");T!==b&&(t!=t?T=b:t===l?T=T===v?b:y:t===-l?T=T===y?b:v:(0!==t||1/t===l)&&(T===A||T===w)&&(T=w,u(S,t)))}),T){case b:return h;case v:return-l;case y:return l;case A:return -0}for(var C=[],M=0,D=0;D<S.length;D++){e=S[D];for(var P=0,I=0;I<C.length;I++){if(i=C[I],d(e)<d(i)&&(E=e,e=i,i=E),s=(r=x(e,i)).hi,c=r.lo,d(s)===l){var k=s===l?1:-1;M+=k,d(e=e-k*p-k*p)<d(i)&&(E=e,e=i,i=E),s=(r=x(e,i)).hi,c=r.lo}0!==c&&(C[P++]=c),e=s}C.length=P,0!==e&&u(C,e)}var R=C.length-1;if(s=0,c=0,0!==M){var L=R>=0?C[R]:0;if(R--,d(M)>1||M>0&&L>0||M<0&&L<0)return M>0?l:-l;if(s=(r=x(M*p,L/2)).hi,c=2*r.lo,d(2*s)===l)return s>0?s===p&&c===-(f/2)&&R>=0&&C[R]<0?m:l:s===-p&&c===f/2&&R>=0&&C[R]>0?-m:-l;0!==c&&(C[++R]=c,c=0),s*=2}for(;R>=0&&(s=(r=x(s,C[R--])).hi,0===(c=r.lo)););return R>=0&&(c<0&&C[R]<0||c>0&&C[R]>0)&&(e=s+(i=2*c),i===e-s&&(s=e)),s}})},3167(t,e,i){var r=i(4901),s=i(34),n=i(2967);t.exports=function(t,e,i){var a,o;return n&&r(a=e.constructor)&&a!==i&&s(o=a.prototype)&&o!==i.prototype&&n(t,o),t}},3238(t,e,i){var r=i(4576),s=i(7811),n=i(7394),a=r.DataView;t.exports=function(t){if(!s||0!==n(t))return!1;try{return new a(t),!1}catch(t){return!0}}},3392(t,e,i){var r=i(9504),s=0,n=Math.random(),a=r(1.1.toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++s+n,36)}},3440(t,e,i){var r=i(7080),s=i(4402),n=i(9286),a=i(5170),o=i(3789),l=i(8469),h=i(507),d=s.has,c=s.remove;t.exports=function(t){var e=r(this),i=o(t),s=n(e);return a(e)<=i.size?l(e,function(t){i.includes(t)&&c(s,t)}):h(i.getIterator(),function(t){d(s,t)&&c(s,t)}),s}},3463(t){var e=TypeError;t.exports=function(t){if("string"==typeof t)return t;throw new e("Argument is not a string")}},3506(t,e,i){var r=i(3925),s=String,n=TypeError;t.exports=function(t){if(r(t))return t;throw new n("Can't set "+s(t)+" as a prototype")}},3579(t,e,i){var r=i(6518),s=i(9565),n=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),d=i(4549)("some",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:d},{some:function(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(d)return s(d,this,t);var e=l(this),i=0;return n(e,function(e,r){if(t(e,i++))return r()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},3650(t,e,i){var r=i(7080),s=i(4402),n=i(9286),a=i(3789),o=i(507),l=s.add,h=s.has,d=s.remove;t.exports=function(t){var e=r(this),i=a(t).getIterator(),s=n(e);return o(i,function(t){h(e,t)?d(s,t):l(s,t)}),s}},3706(t,e,i){var r=i(9504),s=i(4901),n=i(7629),a=r(Function.toString);s(n.inspectSource)||(n.inspectSource=function(t){return a(t)}),t.exports=n.inspectSource},3717(t,e){e.f=Object.getOwnPropertySymbols},3724(t,e,i){t.exports=!i(9039)(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},3789(t,e,i){var r=i(9306),s=i(8551),n=i(9565),a=i(1291),o=i(1767),l="Invalid size",h=RangeError,d=TypeError,c=Math.max,u=function(t,e){this.set=t,this.size=c(e,0),this.has=r(t.has),this.keys=r(t.keys)};u.prototype={getIterator:function(){return o(s(n(this.keys,this.set)))},includes:function(t){return n(this.has,this.set,t)}},t.exports=function(t){s(t);var e=+t.size;if(e!=e)throw new d(l);var i=a(e);if(i<0)throw new h(l);return new u(t,i)}},3838(t,e,i){var r=i(7080),s=i(5170),n=i(8469),a=i(3789);t.exports=function(t){var e=r(this),i=a(t);return!(s(e)>i.size)&&!1!==n(e,function(t){if(!i.includes(t))return!1},!0)}},3853(t,e,i){var r=i(6518),s=i(4449);r({target:"Set",proto:!0,real:!0,forced:!i(4916)("isDisjointFrom",function(t){return!t})},{isDisjointFrom:s})}
vendor: 6,420 bytes, line 1
1,3925(t,e,i){var r=i(34);t.exports=function(t){return r(t)||null===t}},3972(t,e,i){var r=i(34),s=String,n=TypeError;t.exports=function(t){if(void 0===t||r(t))return t;throw new n(s(t)+" is not an object or undefined")}},4055(t,e,i){var r=i(4576),s=i(34),n=r.document,a=s(n)&&s(n.createElement);t.exports=function(t){return a?n.createElement(t):{}}},4114(t,e,i){var r=i(6518),s=i(8981),n=i(6198),a=i(4527),o=i(6837);r({target:"Array",proto:!0,arity:1,forced:i(9039)(function(){return 0x100000001!==[].push.call({length:0x100000000},1)})||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}}()},{push:function(t){var e=s(this),i=n(e),r=arguments.length;o(i+r);for(var l=0;l<r;l++)e[i]=arguments[l],i++;return a(e,i),i}})},4117(t){t.exports=function(t){return null==t}},4149(t){var e=RangeError;t.exports=function(t){if(t==t)return t;throw new e("NaN is not allowed")}},4154(t,e,i){var r=i(6955),s=TypeError;t.exports=function(t){if("Uint8Array"===r(t))return t;throw new s("Argument is not an Uint8Array")}},4204(t,e,i){var r=i(7080),s=i(4402).add,n=i(9286),a=i(3789),o=i(507);t.exports=function(t){var e=r(this),i=a(t).getIterator(),l=n(e);return o(i,function(t){s(l,t)}),l}},4209(t,e,i){var r=i(8227),s=i(6269),n=r("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(s.Array===t||a[n]===t)}},4215(t,e,i){var r=i(4576),s=i(2839),n=i(2195),a=function(t){return s.slice(0,t.length)===t};t.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":r.Bun&&"string"==typeof Bun.version?"BUN":r.Deno&&"object"==typeof Deno.version?"DENO":"process"===n(r.process)?"NODE":r.window&&r.document?"BROWSER":"REST"},4226(t,e,i){var r=i(6518),s=i(4576),n=i(3463),a=i(4154),o=i(5169),l=i(2303);s.Uint8Array&&r({target:"Uint8Array",proto:!0},{setFromHex:function(t){a(this),n(t),o(this.buffer);var e=l(t,this).read;return{read:e,written:e/2}}})},4235(t,e,i){i(3068)},4270(t,e,i){var r=i(9565),s=i(4901),n=i(34),a=TypeError;t.exports=function(t,e){var i,o;if("string"===e&&s(i=t.toString)&&!n(o=r(i,t))||s(i=t.valueOf)&&!n(o=r(i,t))||"string"!==e&&s(i=t.toString)&&!n(o=r(i,t)))return o;throw new a("Can't convert object to primitive value")}},4376(t,e,i){var r=i(2195);t.exports=Array.isArray||function(t){return"Array"===r(t)}},4402(t,e,i){var r=i(9504),s=Set.prototype;t.exports={Set:Set,add:r(s.add),has:r(s.has),remove:r(s.delete),proto:s}},4449(t,e,i){var r=i(7080),s=i(4402).has,n=i(5170),a=i(3789),o=i(8469),l=i(507),h=i(9539);t.exports=function(t){var e=r(this),i=a(t);if(n(e)<=i.size)return!1!==o(e,function(t){if(i.includes(t))return!1},!0);var d=i.getIterator();return!1!==l(d,function(t){if(s(e,t))return h(d,"normal",!1)})}},4483(t,e,i){var r,s,n,a,o=i(4576),l=i(9429),h=i(1548),d=o.structuredClone,c=o.ArrayBuffer,u=o.MessageChannel,p=!1;if(h)p=function(t){d(t,{transfer:[t]})};else if(c)try{!u&&(r=l("worker_threads"))&&(u=r.MessageChannel),u&&(s=new u,n=new c(2),a=function(t){s.port1.postMessage(null,[t])},2===n.byteLength&&(a(n),0===n.byteLength&&(p=a)))}catch(t){}t.exports=p},4495(t,e,i){var r=i(9519),s=i(9039),n=i(4576).String;t.exports=!!Object.getOwnPropertySymbols&&!s(function(){var t=Symbol("symbol detection");return!n(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41})},4527(t,e,i){var r=i(3724),s=i(4376),n=TypeError,a=Object.getOwnPropertyDescriptor;t.exports=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}()?function(t,e){if(s(t)&&!a(t,"length").writable)throw new n("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},4549(t,e,i){var r=i(4576);t.exports=function(t,e){var i=r.Iterator,s=i&&i.prototype,n=s&&s[t],a=!1;if(n)try{n.call({next:function(){return{done:!0}},return:function(){a=!0}},-1)}catch(t){t instanceof e||(a=!1)}if(!a)return n}},4576(t){var e=function(t){return t&&t.Math===Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof global&&global)||e("object"==typeof this&&this)||function(){return this}()||Function("return this")()},4603(t,e,i){var r=i(6840),s=i(9504),n=i(655),a=i(2812),o=URLSearchParams,l=o.prototype,h=s(l.append),d=s(l.delete),c=s(l.forEach),u=s([].push),p=new o("a=1&a=2&b=3");p.delete("a",1),p.delete("b",void 0),p+""!="a=2"&&r(l,"delete",function(t){var e,i=arguments.length,r=i<2?void 0:arguments[1];if(i&&void 0===r)return d(this,t);var s=[];c(this,function(t,e){u(s,{key:e,value:t})}),a(i,1);for(var o=n(t),l=n(r),p=0,g=0,m=!1,f=s.length;p<f;)e=s[p++],m||e.key===o?(m=!0,d(this,e.key)):g++;for(;g<f;)((e=s[g++]).key!==o||e.value!==l)&&h(this,e.key,e.value)},{enumerable:!0,unsafe:!0})},4628(t,e,i){var r=i(6518),s=i(6043);r({target:"Promise",stat:!0},{withResolvers:function(){var t=s.f(this);return{promise:t.promise,resolve:t.resolve,reject:t.reject}}})},4644(t,e,i){var r,s,n,a=i(7811),o=i(3724),l=i(4576),h=i(4901),d=i(34),c=i(9297),u=i(6955),p=i(6823),g=i(6699),m=i(6840),f=i(2106),b=i(1625),v=i(2787),y=i(2967),A=i(8227),w=i(3392),x=i(1181),E=x.enforce,S=x.get,_=l.Int8Array,T=_&&_.prototype,C=l.Uint8ClampedArray,M=C&&C.prototype,D=_&&v(_),P=T&&v(T),I=Object.prototype,k=l.TypeError,R=A("toStringTag"),L=w("TYPED_ARRAY_TAG"),B="TypedArrayConstructor",F=a&&!!y&&"Opera"!==u(l.opera),O=!1,N={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},U={BigInt64Array:8,BigUint64Array:8},z=function(t){var e=v(t);if(d(e)){var i=S(e);return i&&c(i,B)?i[B]:z(e)}},H=function(t){if(!d(t))return!1;var e=u(t);return c(N,e)||c(U,e)};for(r in N)(n=(s=l[r])&&s.prototype)?E(n)[B]=s:F=!1;for(r in U)(n=(s=l[r])&&s.prototype)&&(E(n)[B]=s);if((!F||!h(D)||D===Function.prototype)&&(D=function(){throw new k("Incorrect invocation")},F))for(r in N)l[r]&&y(l[r],D);if((!F||!P||P===I)&&(P=D.prototype,F))for(r in N)l[r]&&y(l[r].prototype,P);if(F&&v(M)!==P&&y(M,P),o&&!c(P,R))for(r in O=!0,f(P,R,{configurable:!0,get:function(){return d(this)?this[L]:void 0}}),N)l[r]&&g(l[r],L,r);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:F,TYPED_ARRAY_TAG:O&&L,aTypedArray:function(t){if(H(t))return t;throw new k("Target is not a typed array")},aTypedArrayConstructor:function(t){if(h(t)&&(!y||b(D,t)))return t;throw new k(p(t)+" is not a typed array constructor")}
1,exportTypedArrayMethod:function(t,e,i,r){if(o){if(i)for(var s in N){var n=l[s];if(n&&c(n.prototype,t))try{delete n.prototype[t]}catch(i){try{n.prototype[t]=e}catch(t){}}}(!P[t]||i)&&m(P,t,i?e:F&&T[t]||e,r)}},exportTypedArrayStaticMethod:function(t,e,i){var r,s;if(o){if(y){if(i){for(r in N)if((s=l[r])&&c(s,t))try{delete s[t]}catch(t){}}if(D[t]&&!i)return;try{return m(D,t,i?e:F&&D[t]||e)}catch(t){}}for(r in N)(s=l[r])&&(!s[t]||i)&&m(s,t,e)}},getTypedArrayConstructor:z,isView:function(t){if(!d(t))return!1;var e=u(t);return"DataView"===e||c(N,e)||c(U,e)},isTypedArray:H,TypedArray:D,TypedArrayPrototype:P}},4659(t,e,i){var r=i(3724),s=i(4913),n=i(6980);t.exports=function(t,e,i){r?s.f(t,e,n(0,i)):t[e]=i}},4901(t){var e="object"==typeof document&&document.all;t.exports=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(t){return"function"==typeof t}},4913(t,e,i){var r=i(3724),s=i(5917),n=i(8686),a=i(8551),o=i(6969),l=TypeError,h=Object.defineProperty,d=Object.getOwnPropertyDescriptor,c="enumerable",u="configurable",p="writable";e.f=r?n?function(t,e,i){if(a(t),e=o(e),a(i),"function"==typeof t&&"prototype"===e&&"value"in i&&p in i&&!i[p]){var r=d(t,e);r&&r[p]&&(t[e]=i.value,i={configurable:u in i?i[u]:r[u],enumerable:c in i?i[c]:r[c],writable:!1})}return h(t,e,i)}:h:function(t,e,i){if(a(t),e=o(e),a(i),s)try{return h(t,e,i)}catch(t){}if("get"in i||"set"in i)throw new l("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},4916(t,e,i){var r=i(7751),s=function(t){return{size:t,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},n=function(t){return{size:t,has:function(){return!0},keys:function(){throw Error("e")}}};t.exports=function(t,e){var i=r("Set");try{new i()[t](s(0));try{return new i()[t](s(-1)),!1}catch(r){if(!e)return!0;try{return new i()[t](n(-1/0)),!1}catch(r){var a=new i([1,2]);return e(a[t](n(1/0)))}}}catch(t){return!1}}},4972(t,e,i){var r=i(6518),s=i(9565),n=i(8551),a=i(1767),o=i(4149),l=i(9590),h=i(9462),d=i(9539),c=i(4549),u=i(6395),p=!u&&c("take",RangeError),g=h(function(){var t=this.iterator;if(!this.remaining--)return this.done=!0,d(t,"normal",void 0);var e=n(s(this.next,t));if(!(this.done=!!e.done))return e.value});r({target:"Iterator",proto:!0,real:!0,forced:u||p},{take:function(t){var e;n(this);try{e=l(o(+t))}catch(t){d(this,"throw",t)}return p?s(p,this,e):new g(a(this),{remaining:e})}})},4979(t,e,i){var r=i(6518),s=i(4576),n=i(7751),a=i(6980),o=i(4913).f,l=i(9297),h=i(679),d=i(3167),c=i(2603),u=i(5002),p=i(8574),g=i(3724),m=i(6395),f="DOMException",b=n("Error"),v=n(f),y=function(){h(this,A);var t=arguments.length,e=c(t<1?void 0:arguments[0]),i=c(t<2?void 0:arguments[1],"Error"),r=new v(e,i),s=new b(e);return s.name=f,o(r,"stack",a(1,p(s.stack,1))),d(r,this,y),r},A=y.prototype=v.prototype,w="stack"in new b(f),x="stack"in new v(1,2),E=v&&g&&Object.getOwnPropertyDescriptor(s,f),S=!!E&&!(E.writable&&E.configurable),_=w&&!S&&!x;r({global:!0,constructor:!0,forced:m||_},{DOMException:_?y:v});var T=n(f),C=T.prototype;if(C.constructor!==T){for(var M in m||o(C,"constructor",a(1,T)),u)if(l(u,M)){var D=u[M],P=D.s;l(T,P)||o(T,P,a(6,D.c))}}},5002(t){t.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}
1,NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},5024(t,e,i){var r=i(6518),s=i(3650),n=i(9835);r({target:"Set",proto:!0,real:!0,forced:!i(4916)("symmetricDifference")||!n("symmetricDifference")},{symmetricDifference:s})},5031(t,e,i){var r=i(7751),s=i(9504),n=i(8480),a=i(3717),o=i(8551),l=s([].concat);t.exports=r("Reflect","ownKeys")||function(t){var e=n.f(o(t)),i=a.f;return i?l(e,i(t)):e}},5169(t,e,i){var r=i(3238),s=TypeError;t.exports=function(t){if(r(t))throw new s("ArrayBuffer is detached");return t}},5170(t,e,i){t.exports=i(6706)(i(4402).proto,"size","get")||function(t){return t.size}},5213(t,e,i){var r=i(6518),s=i(4576),n=i(5370),a=i(9143),o=s.Uint8Array,l=!o||!o.fromBase64||!function(){try{o.fromBase64("a");return}catch(t){}try{o.fromBase64("",null)}catch(t){return!0}}();o&&r({target:"Uint8Array",stat:!0,forced:l},{fromBase64:function(t){var e=a(t,arguments.length>1?arguments[1]:void 0,null,0x1fffffffffffff);return n(o,e.bytes)}})},5370(t,e,i){var r=i(6198);t.exports=function(t,e,i){for(var s=0,n=arguments.length>2?i:r(e),a=new t(n);n>s;)a[s]=e[s++];return a}},5397(t,e,i){var r=i(7055),s=i(7750);t.exports=function(t){return r(s(t))}},5610(t,e,i){var r=i(1291),s=Math.max,n=Math.min;t.exports=function(t,e){var i=r(t);return i<0?s(i+e,0):n(i,e)}},5623(t,e,i){i(456)},5636(t,e,i){var r=i(4576),s=i(9504),n=i(6706),a=i(7696),o=i(5169),l=i(7394),h=i(4483),d=i(1548),c=r.structuredClone,u=r.ArrayBuffer,p=r.DataView,g=Math.min,m=u.prototype,f=p.prototype,b=s(m.slice),v=n(m,"resizable","get"),y=n(m,"maxByteLength","get"),A=s(f.getInt8),w=s(f.setInt8);t.exports=(d||h)&&function(t,e,i){var r,s=l(t),n=void 0===e?s:a(e),m=!v||!v(t);if(o(t),d&&(t=c(t,{transfer:[t]}),s===n&&(i||m)))return t;if(s>=n&&(!i||m))r=b(t,0,n);else{r=new u(n,i&&!m&&y?{maxByteLength:y(t)}:void 0);for(var f=new p(t),x=new p(r),E=g(n,s),S=0;S<E;S++)w(x,S,A(f,S))}return d||h(t),r}},5745(t,e,i){var r=i(7629);t.exports=function(t,e){return r[t]||(r[t]=e||{})}},5781(t,e,i){var r=i(6518),s=i(7751),n=i(2812),a=i(655),o=i(7416),l=s("URL");r({target:"URL",stat:!0,forced:!o},{parse:function(t){var e=n(arguments.length,1),i=a(t),r=e<2||void 0===arguments[1]?void 0:a(arguments[1]);try{return new l(i,r)}catch(t){return null}}})},5854(t,e,i){var r=i(2777),s=TypeError;t.exports=function(t){var e=r(t,"number");if("number"==typeof e)throw new s("Can't convert number to bigint");return BigInt(e)}},5876(t,e,i){var r=i(6518),s=i(3838);r({target:"Set",proto:!0,real:!0,forced:!i(4916)("isSubsetOf",function(t){return t})},{isSubsetOf:s})},5917(t,e,i){var r=i(3724),s=i(9039),n=i(4055);t.exports=!r&&!s(function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a})},5966(t,e,i){var r=i(9306),s=i(4117);t.exports=function(t,e){var i=t[e];return s(i)?void 0:r(i)}},6043(t,e,i){var r=i(9306),s=TypeError,n=function(t){var e,i;this.promise=new t(function(t,r){if(void 0!==e||void 0!==i)throw new s("Bad Promise constructor");e=t,i=r}),this.resolve=r(e),this.reject=r(i)};t.exports.f=function(t){return new n(t)}},6080(t,e,i){var r=i(7476),s=i(9306),n=i(616),a=r(r.bind);t.exports=function(t,e){return s(t),void 0===e?t:n?a(t,e):function(){return t.apply(e,arguments)}}},6119(t,e,i){var r=i(5745),s=i(3392),n=r("keys");t.exports=function(t){return n[t]||(n[t]=s(t))}},6193(t,e,i){t.exports="NODE"===i(4215)},6198(t,e,i){var r=i(8014);t.exports=function(t){return r(t.length)}},6269(t){t.exports={}},6279(t,e,i){var r=i(6840);t.exports=function(t,e,i){for(var s in e)r(t,s,e[s],i);return t}},6319(t,e,i){var r=i(8551),s=i(9539);t.exports=function(t,e,i,n){try{return n?e(r(i)[0],i[1]):e(i)}catch(e){s(t,"throw",e)}}},6395(t){t.exports=!1},6518(t,e,i){var r=i(4576),s=i(7347).f,n=i(6699),a=i(6840),o=i(9433),l=i(7740),h=i(2796);t.exports=function(t,e){var i,d,c,u,p,g=t.target,m=t.global,f=t.stat;if(i=m?r:f?r[g]||o(g,{}):r[g]&&r[g].prototype)for(d in e){if(u=e[d],c=t.dontCallGetSet?(p=s(i,d))&&p.value:i[d],!h(m?d:g+(f?".":"#")+d,t.forced)&&void 0!==c){if(typeof u==typeof c)continue;l(u,c)}(t.sham||c&&c.sham)&&n(u,"sham",!0),a(i,d,u,t)}}},6573(t,e,i){var r=i(3724),s=i(2106),n=i(3238),a=ArrayBuffer.prototype;!r||"detached"in a||s(a,"detached",{configurable:!0,get:function(){return n(this)}})},6632(t,e,i){var r=i(6518),s=i(4576),n=i(9143),a=i(4154),o=s.Uint8Array,l=!o||!o.prototype.setFromBase64||!function(){var t=new o([255,255,255,255,255]);try{t.setFromBase64("",null);return}catch(t){}try{t.setFromBase64("a");return}catch(t){}try{t.setFromBase64("MjYyZg===")}catch(e){return 50===t[0]&&54===t[1]&&50===t[2]&&255===t[3]&&255===t[4]}}();o&&r({target:"Uint8Array",proto:!0,forced:l},{setFromBase64:function(t){a(this);var e=n(t,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:e.read,written:e.written}}})},6699(t,e,i){var r=i(3724),s=i(4913),n=i(6980);
vendor: 5,190 bytes, line 1
1t.exports=r?function(t,e,i){return s.f(t,e,n(1,i))}:function(t,e,i){return t[e]=i,t}},6706(t,e,i){var r=i(9504),s=i(9306);t.exports=function(t,e,i){try{return r(s(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}}},6801(t,e,i){var r=i(3724),s=i(8686),n=i(4913),a=i(8551),o=i(5397),l=i(1072);e.f=r&&!s?Object.defineProperties:function(t,e){a(t);for(var i,r=o(e),s=l(e),h=s.length,d=0;h>d;)n.f(t,i=s[d++],r[i]);return t}},6823(t){var e=String;t.exports=function(t){try{return e(t)}catch(t){return"Object"}}},6837(t){var e=TypeError;t.exports=function(t){if(t>0x1fffffffffffff)throw e("Maximum allowed index exceeded");return t}},6840(t,e,i){var r=i(4901),s=i(4913),n=i(283),a=i(9433);t.exports=function(t,e,i,o){o||(o={});var l=o.enumerable,h=void 0!==o.name?o.name:e;if(r(i)&&n(i,h,o),o.global)l?t[e]=i:a(e,i);else{try{o.unsafe?t[e]&&(l=!0):delete t[e]}catch(t){}l?t[e]=i:s.f(t,e,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return t}},6955(t,e,i){var r=i(2140),s=i(4901),n=i(2195),a=i(8227)("toStringTag"),o=Object,l="Arguments"===n(function(){return arguments}()),h=function(t,e){try{return t[e]}catch(t){}};t.exports=r?n:function(t){var e,i,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=h(e=o(t),a))?i:l?n(e):"Object"===(r=n(e))&&s(e.callee)?"Arguments":r}},6969(t,e,i){var r=i(2777),s=i(757);t.exports=function(t){var e=r(t,"string");return s(e)?e:e+""}},6980(t){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},7040(t,e,i){t.exports=i(4495)&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},7055(t,e,i){var r=i(9504),s=i(9039),n=i(2195),a=Object,o=r("".split);t.exports=s(function(){return!a("z").propertyIsEnumerable(0)})?function(t){return"String"===n(t)?o(t,""):a(t)}:a},7080(t,e,i){var r=i(4402).has;t.exports=function(t){return r(t),t}},7347(t,e,i){var r=i(3724),s=i(9565),n=i(8773),a=i(6980),o=i(5397),l=i(6969),h=i(9297),d=i(5917),c=Object.getOwnPropertyDescriptor;e.f=r?c:function(t,e){if(t=o(t),e=l(e),d)try{return c(t,e)}catch(t){}if(h(t,e))return a(!s(n.f,t,e),t[e])}},7394(t,e,i){var r=i(4576),s=i(6706),n=i(2195),a=r.ArrayBuffer,o=r.TypeError;t.exports=a&&s(a.prototype,"byteLength","get")||function(t){if("ArrayBuffer"!==n(t))throw new o("ArrayBuffer expected");return t.byteLength}},7416(t,e,i){var r=i(9039),s=i(8227),n=i(3724),a=i(6395),o=s("iterator");t.exports=!r(function(){var t=new URL("b?a=1&b=2&c=3","https://a"),e=t.searchParams,i=new URLSearchParams("a=1&a=2&b=3"),r="";return t.pathname="c%20d",e.forEach(function(t,i){e.delete("b"),r+=i+t}),i.delete("a",2),i.delete("b",void 0),a&&(!t.toJSON||!i.has("a",1)||i.has("a",2)||!i.has("a",void 0)||i.has("b"))||!e.size&&(a||!n)||!e.sort||"https://a/c%20d?a=1&c=3"!==t.href||"3"!==e.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!e[o]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==r||"x"!==new URL("https://x",void 0).host})},7476(t,e,i){var r=i(2195),s=i(9504);t.exports=function(t){if("Function"===r(t))return s(t)}},7566(t,e,i){var r=i(6840),s=i(9504),n=i(655),a=i(2812),o=URLSearchParams,l=o.prototype,h=s(l.getAll),d=s(l.has),c=new o("a=1");(c.has("a",2)||!c.has("a",void 0))&&r(l,"has",function(t){var e=arguments.length,i=e<2?void 0:arguments[1];if(e&&void 0===i)return d(this,t);var r=h(this,t);a(e,1);for(var s=n(i),o=0;o<r.length;)if(r[o++]===s)return!0;return!1},{enumerable:!0,unsafe:!0})},7588(t,e,i){var r=i(6518),s=i(9565),n=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),d=i(4549)("forEach",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:d},{forEach:function(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(d)return s(d,this,t);var e=l(this),i=0;n(e,function(e){t(e,i++)},{IS_RECORD:!0})}})},7629(t,e,i){var r=i(6395),s=i(4576),n=i(9433),a="__core-js_shared__",o=t.exports=s[a]||n(a,{});(o.versions||(o.versions=[])).push({version:"3.47.0",mode:r?"pure":"global",copyright:"\xa9 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",license:"https://github.com/zloirock/core-js/blob/v3.47.0/LICENSE",source:"https://github.com/zloirock/core-js"})},7642(t,e,i){var r=i(6518),s=i(3440),n=i(9039);r({target:"Set",proto:!0,real:!0,forced:!i(4916)("difference",function(t){return 0===t.size})||n(function(){var t=new Set([1,2,3,4]);return 3!==t.difference({size:1,has:function(){return!0},keys:function(){var e=0;return{next:function(){var i=e++>1;return t.has(1)&&t.clear(),{done:i,value:2}}}}}).size})},{difference:s})},7657(t,e,i){var r,s,n,a=i(9039),o=i(4901),l=i(34),h=i(2360),d=i(2787),c=i(6840),u=i(8227),p=i(6395),g=u("iterator"),m=!1;[].keys&&("next"in(n=[].keys())?(s=d(d(n)))!==Object.prototype&&(r=s):m=!0),!l(r)||a(function(){var t={};return r[g].call(t)!==t})?r={}:p&&(r=h(r)),o(r[g])||c(r,g,function(){return this}),t.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:m}},7680(t,e,i){t.exports=i(9504)([].slice)},7696(t,e,i){var r=i(1291),s=i(8014),n=RangeError;t.exports=function(t){if(void 0===t)return 0;var e=r(t),i=s(e);if(e!==i)throw new n("Wrong length or index");return i}}
vendor: 4,805 bytes, line 1
1,7740(t,e,i){var r=i(9297),s=i(5031),n=i(7347),a=i(4913);t.exports=function(t,e,i){for(var o=s(e),l=a.f,h=n.f,d=0;d<o.length;d++){var c=o[d];r(t,c)||i&&r(i,c)||l(t,c,h(e,c))}}},7750(t,e,i){var r=i(4117),s=TypeError;t.exports=function(t){if(r(t))throw new s("Can't call method on "+t);return t}},7751(t,e,i){var r=i(4576),s=i(4901);t.exports=function(t,e){var i;return arguments.length<2?s(i=r[t])?i:void 0:r[t]&&r[t][e]}},7811(t){t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},7936(t,e,i){var r=i(6518),s=i(5636);s&&r({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return s(this,arguments.length?arguments[0]:void 0,!1)}})},8004(t,e,i){var r=i(6518),s=i(9039),n=i(8750);r({target:"Set",proto:!0,real:!0,forced:!i(4916)("intersection",function(t){return 2===t.size&&t.has(1)&&t.has(2)})||s(function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))})},{intersection:n})},8014(t,e,i){var r=i(1291),s=Math.min;t.exports=function(t){var e=r(t);return e>0?s(e,0x1fffffffffffff):0}},8100(t,e,i){var r=i(6518),s=i(5636);s&&r({target:"ArrayBuffer",proto:!0},{transfer:function(){return s(this,arguments.length?arguments[0]:void 0,!0)}})},8111(t,e,i){var r=i(6518),s=i(4576),n=i(679),a=i(8551),o=i(4901),l=i(2787),h=i(2106),d=i(4659),c=i(9039),u=i(9297),p=i(8227),g=i(7657).IteratorPrototype,m=i(3724),f=i(6395),b="constructor",v="Iterator",y=p("toStringTag"),A=TypeError,w=s[v],x=f||!o(w)||w.prototype!==g||!c(function(){w({})}),E=function(){if(n(this,g),l(this)===g)throw new A("Abstract class Iterator not directly constructable")},S=function(t,e){m?h(g,t,{configurable:!0,get:function(){return e},set:function(e){if(a(this),this===g)throw new A("You can't redefine this property");u(this,t)?this[t]=e:d(this,t,e)}}):g[t]=e};u(g,y)||S(y,v),(x||!u(g,b)||g[b]===Object)&&S(b,E),E.prototype=g,r({global:!0,constructor:!0,forced:x},{Iterator:E})},8227(t,e,i){var r=i(4576),s=i(5745),n=i(9297),a=i(3392),o=i(4495),l=i(7040),h=r.Symbol,d=s("wks"),c=l?h.for||h:h&&h.withoutSetter||a;t.exports=function(t){return n(d,t)||(d[t]=o&&n(h,t)?h[t]:c("Symbol."+t)),d[t]}},8235(t,e,i){var r=i(9504),s=i(9297),n=SyntaxError,a=parseInt,o=String.fromCharCode,l=r("".charAt),h=r("".slice),d=r(/./.exec),c={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"	"},u=/^[\da-f]{4}$/i,p=/^[\u0000-\u001F]$/;t.exports=function(t,e){for(var i=!0,r="";e<t.length;){var g=l(t,e);if("\\"===g){var m=h(t,e,e+2);if(s(c,m))r+=c[m],e+=2;else if("\\u"===m){var f=h(t,e+=2,e+4);if(!d(u,f))throw new n("Bad Unicode escape at: "+e);r+=o(a(f,16)),e+=4}else throw new n('Unknown escape sequence: "'+m+'"')}else if('"'===g){i=!1,e++;break}else{if(d(p,g))throw new n("Bad control character in string literal at: "+e);r+=g,e++}}if(i)throw new n("Unterminated string at: "+e);return{value:r,end:e}}},8237(t,e,i){var r=i(6518),s=i(2652),n=i(9306),a=i(8551),o=i(1767),l=i(9539),h=i(4549),d=i(8745),c=i(9039),u=TypeError,p=c(function(){[].keys().reduce(function(){},void 0)}),g=!p&&h("reduce",u);r({target:"Iterator",proto:!0,real:!0,forced:p||g},{reduce:function(t){a(this);try{n(t)}catch(t){l(this,"throw",t)}var e=arguments.length<2,i=e?void 0:arguments[1];if(g)return d(g,this,e?[t]:[t,i]);var r=o(this),h=0;if(s(r,function(r){e?(e=!1,i=r):i=t(i,r,h),h++},{IS_RECORD:!0}),e)throw new u("Reduce of empty iterator with no initial value");return i}})},8335(t,e,i){i(9112)},8469(t,e,i){var r=i(9504),s=i(507),n=i(4402),a=n.Set,o=n.proto,l=r(o.forEach),h=r(o.keys),d=h(new a).next;t.exports=function(t,e,i){return i?s({iterator:h(t),next:d},e):l(t,e)}},8480(t,e,i){var r=i(1828),s=i(8727).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,s)}},8527(t,e,i){var r=i(7080),s=i(4402).has,n=i(5170),a=i(3789),o=i(507),l=i(9539);t.exports=function(t){var e=r(this),i=a(t);if(n(e)<i.size)return!1;var h=i.getIterator();return!1!==o(h,function(t){if(!s(e,t))return l(h,"normal",!1)})}},8551(t,e,i){var r=i(34),s=String,n=TypeError;t.exports=function(t){if(r(t))return t;throw new n(s(t)+" is not an object")}},8574(t,e,i){var r=i(9504),s=Error,n=r("".replace),a=String(new s("zxcasd").stack),o=/\n\s*at [^:]*:[^\n]*/,l=o.test(a);t.exports=function(t,e){if(l&&"string"==typeof t&&!s.prepareStackTrace)for(;e--;)t=n(t,o,"");return t}},8622(t,e,i){var r=i(4576),s=i(4901),n=r.WeakMap;t.exports=s(n)&&/native code/.test(String(n))},8646(t,e,i){var r=i(9565),s=i(8551),n=i(1767),a=i(851);t.exports=function(t,e){e&&"string"==typeof t||s(t);var i=a(t);return n(s(void 0!==i?r(i,t):t))}},8686(t,e,i){var r=i(3724),s=i(9039);t.exports=r&&s(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},8721(t,e,i){var r=i(3724),s=i(9504),n=i(2106),a=URLSearchParams.prototype,o=s(a.forEac
1h);!r||"size"in a||n(a,"size",{get:function(){var t=0;return o(this,function(){t++}),t},configurable:!0,enumerable:!0})},8727(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},8745(t,e,i){var r=i(616),s=Function.prototype,n=s.apply,a=s.call;t.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(n):function(){return a.apply(n,arguments)})},8750(t,e,i){var r=i(7080),s=i(4402),n=i(5170),a=i(3789),o=i(8469),l=i(507),h=s.Set,d=s.add,c=s.has;t.exports=function(t){var e=r(this),i=a(t),s=new h;return n(e)>i.size?l(i.getIterator(),function(t){c(e,t)&&d(s,t)}):o(e,function(t){i.includes(t)&&d(s,t)}),s}},8773(t,e){var i={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor;e.f=r&&!i.call({1:2},1)?function(t){var e=r(this,t);return!!e&&e.enumerable}:i},8981(t,e,i){var r=i(7750),s=Object;t.exports=function(t){return s(r(t))}},9039(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},9112(t,e,i){var r=i(6518),s=i(3724),n=i(4576),a=i(7751),o=i(9504),l=i(9565),h=i(4901),d=i(34),c=i(4376),u=i(9297),p=i(655),g=i(6198),m=i(4659),f=i(9039),b=i(8235),v=i(4495),y=n.JSON,A=n.Number,w=n.SyntaxError,x=y&&y.parse,E=a("Object","keys"),S=Object.getOwnPropertyDescriptor,_=o("".charAt),T=o("".slice),C=o(/./.exec),M=o([].push),D=/^\d$/,P=/^[1-9]$/,I=/^[\d-]$/,k=/^[\t\n\r ]$/,R=function(t,e){var i=new O(t=p(t),0,""),r=i.parse(),s=r.value,n=i.skip(k,r.end);if(n<t.length)throw new w('Unexpected extra character: "'+_(t,n)+'" after the parsed data at: '+n);return h(e)?L({"":s},"",e,r):s},L=function(t,e,i,r){var s,n,a,o,h,p=t[e],m=r&&p===r.value,f=m&&"string"==typeof r.source?{source:r.source}:{};if(d(p)){var b=c(p),v=m?r.nodes:b?[]:{};if(b)for(o=0,s=v.length,a=g(p);o<a;o++)B(p,o,L(p,""+o,i,o<s?v[o]:void 0));else for(o=0,a=g(n=E(p));o<a;o++)B(p,h=n[o],L(p,h,i,u(v,h)?v[h]:void 0))}return l(i,t,e,p,f)},B=function(t,e,i){if(s){var r=S(t,e);if(r&&!r.configurable)return}void 0===i?delete t[e]:m(t,e,i)},F=function(t,e,i,r){this.value=t,this.end=e,this.source=i,this.nodes=r},O=function(t,e){this.source=t,this.index=e};O.prototype={fork:function(t){return new O(this.source,t)},parse:function(){var t=this.source,e=this.skip(k,this.index),i=this.fork(e),r=_(t,e);if(C(I,r))return i.number();switch(r){case"{":return i.object();case"[":return i.array();case'"':return i.string();case"t":return i.keyword(!0);case"f":return i.keyword(!1);case"n":return i.keyword(null)}throw new w('Unexpected character: "'+r+'" at: '+e)},node:function(t,e,i,r,s){return new F(e,r,t?null:T(this.source,i,r),s)},object:function(){for(var t=this.source,e=this.index+1,i=!1,r={},s={};e<t.length;){if("}"===_(t,e=this.until(['"',"}"],e))&&!i){e++;break}var n=this.fork(e).string(),a=n.value;e=n.end,e=this.until([":"],e)+1,e=this.skip(k,e),m(s,a,n=this.fork(e).parse()),m(r,a,n.value);var o=_(t,e=this.until([",","}"],n.end));if(","===o)i=!0,e++;else if("}"===o){e++;break}}return this.node(1,r,this.index,e,s)},array:function(){for(var t=this.source,e=this.index+1,i=!1,r=[],s=[];e<t.length;){if("]"===_(t,e=this.skip(k,e))&&!i){e++;break}var n=this.fork(e).parse();if(M(s,n),M(r,n.value),","===_(t,e=this.until([",","]"],n.end)))i=!0,e++;else if("]"===_(t,e)){e++;break}}return this.node(1,r,this.index,e,s)},string:function(){var t=this.index,e=b(this.source,this.index+1);return this.node(0,e.value,t,e.end)},number:function(){var t=this.source,e=this.index,i=e;if("-"===_(t,i)&&i++,"0"===_(t,i))i++;else if(C(P,_(t,i)))i=this.skip(D,i+1);else throw new w("Failed to parse number at: "+i);if("."===_(t,i)&&(i=this.skip(D,i+1)),("e"===_(t,i)||"E"===_(t,i))&&(("+"===_(t,++i)||"-"===_(t,i))&&i++,i===(i=this.skip(D,i))))throw new w("Failed to parse number's exponent value at: "+i);return this.node(0,A(T(t,e,i)),e,i)},keyword:function(t){var e=""+t,i=this.index,r=i+e.length;if(T(this.source,i,r)!==e)throw new w("Failed to parse value at: "+i);return this.node(0,t,i,r)},skip:function(t,e){for(var i=this.source;e<i.length&&C(t,_(i,e));e++);return e},until:function(t,e){e=this.skip(k,e);for(var i=_(this.source,e),r=0;r<t.length;r++)if(t[r]===i)return e;throw new w('Unexpected character: "'+i+'" at: '+e)}};var N=f(function(){var t,e="9007199254740993";return x(e,function(e,i,r){t=r.source}),t!==e}),U=v&&!f(function(){return 1/x("-0 	")!=-1/0});r({target:"JSON",stat:!0,forced:N},{parse:function(t,e){return U&&!h(e)?x(t):R(t,e)}})},9143(t,e,i){var r=i(4576),s=i(9504),n=i(3972),a=i(3463),o=i(9297),l=i(2804),h=i(944),d=i(5169),c=l.c2i,u=l.c2iUrl,p=r.SyntaxError,g=r.TypeError,m=s("".charAt),f=function(t,e){for(var i=t.length;e<i;e++){var r=m(t,e);if(" "!==r&&"	"!==r&&"\n"!==r&&"\f"!==r&&"\r"!==r)break}return e}
vendor: 4,321 bytes, line 1
1,b=function(t,e,i){var r=t.length;r<4&&(t+=2===r?"AA":"A");var s=(e[m(t,0)]<<18)+(e[m(t,1)]<<12)+(e[m(t,2)]<<6)+e[m(t,3)],n=[s>>16&255,s>>8&255,255&s];if(2===r){if(i&&0!==n[1])throw new p("Extra bits");return[n[0]]}if(3===r){if(i&&0!==n[2])throw new p("Extra bits");return[n[0],n[1]]}return n},v=function(t,e,i){for(var r=e.length,s=0;s<r;s++)t[i+s]=e[s];return i+r};t.exports=function(t,e,i,r){a(t),n(e);var s="base64"===h(e)?c:u,l=e?e.lastChunkHandling:void 0;if(void 0===l&&(l="loose"),"loose"!==l&&"strict"!==l&&"stop-before-partial"!==l)throw new g("Incorrect `lastChunkHandling` option");i&&d(i.buffer);var y=t.length,A=i||[],w=0,x=0,E="",S=0;if(r)for(;;){if((S=f(t,S))===y){if(E.length>0){if("stop-before-partial"===l)break;if("loose"===l){if(1===E.length)throw new p("Malformed padding: exactly one additional character");w=v(A,b(E,s,!1),w)}else throw new p("Missing padding")}x=y;break}var _=m(t,S);if(++S,"="===_){if(E.length<2)throw new p("Padding is too early");if(S=f(t,S),2===E.length){if(S===y){if("stop-before-partial"===l)break;throw new p("Malformed padding: only one =")}"="===m(t,S)&&(S=f(t,++S))}if(S<y)throw new p("Unexpected character after padding");w=v(A,b(E,s,"strict"===l),w),x=y;break}if(!o(s,_))throw new p("Unexpected character");var T=r-w;if(1===T&&2===E.length||2===T&&3===E.length||4===(E+=_).length&&(w=v(A,b(E,s,!1),w),E="",x=S,w===r))break}return{bytes:A,read:x,written:w}}},9286(t,e,i){var r=i(4402),s=i(8469),n=r.Set,a=r.add;t.exports=function(t){var e=new n;return s(t,function(t){a(e,t)}),e}},9297(t,e,i){var r=i(9504),s=i(8981),n=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return n(s(t),e)}},9306(t,e,i){var r=i(4901),s=i(6823),n=TypeError;t.exports=function(t){if(r(t))return t;throw new n(s(t)+" is not a function")}},9314(t,e,i){var r=i(6518),s=i(9565),n=i(8551),a=i(1767),o=i(4149),l=i(9590),h=i(9539),d=i(9462),c=i(684),u=i(4549),p=i(6395),g=!p&&!c("drop",0),m=!p&&!g&&u("drop",RangeError),f=p||g||m,b=d(function(){for(var t,e,i=this.iterator,r=this.next;this.remaining;)if(this.remaining--,t=n(s(r,i)),this.done=!!t.done)return;if(t=n(s(r,i)),!(this.done=!!t.done))return t.value});r({target:"Iterator",proto:!0,real:!0,forced:f},{drop:function(t){var e;n(this);try{e=l(o(+t))}catch(t){h(this,"throw",t)}return m?s(m,this,e):new b(a(this),{remaining:e})}})},9429(t,e,i){var r=i(4576),s=i(6193);t.exports=function(t){if(s){try{return r.process.getBuiltinModule(t)}catch(t){}try{return Function('return require("'+t+'")')()}catch(t){}}}},9432(t,e,i){i(5213)},9433(t,e,i){var r=i(4576),s=Object.defineProperty;t.exports=function(t,e){try{s(r,t,{value:e,configurable:!0,writable:!0})}catch(i){r[t]=e}return e}},9462(t,e,i){var r=i(9565),s=i(2360),n=i(6699),a=i(6279),o=i(8227),l=i(1181),h=i(5966),d=i(7657).IteratorPrototype,c=i(2529),u=i(9539),p=i(1385),g=o("toStringTag"),m="IteratorHelper",f="WrapForValidIterator",b="normal",v="throw",y=l.set,A=function(t){var e=l.getterFor(t?f:m);return a(s(d),{next:function(){var i=e(this);if(t)return i.nextHandler();if(i.done)return c(void 0,!0);try{var r=i.nextHandler();return i.returnHandlerResult?r:c(r,i.done)}catch(t){throw i.done=!0,t}},return:function(){var i=e(this),s=i.iterator;if(i.done=!0,t){var n=h(s,"return");return n?r(n,s):c(void 0,!0)}if(i.inner)try{u(i.inner.iterator,b)}catch(t){return u(s,v,t)}if(i.openIters)try{p(i.openIters,b)}catch(t){return u(s,v,t)}return s&&u(s,b),c(void 0,!0)}})},w=A(!0),x=A(!1);n(x,g,"Iterator Helper"),t.exports=function(t,e,i){var r=function(r,s){s?(s.iterator=r.iterator,s.next=r.next):s=r,s.type=e?f:m,s.returnHandlerResult=!!i,s.nextHandler=t,s.counter=0,s.done=!1,y(this,s)};return r.prototype=e?w:x,r}},9486(t,e,i){var r=i(6518),s=i(4576),n=i(9504),a=i(3972),o=i(4154),l=i(5169),h=i(2804),d=i(944),c=h.i2c,u=h.i2cUrl,p=n("".charAt),g=s.Uint8Array,m=!g||!g.prototype.toBase64||!function(){try{new g().toBase64(null)}catch(t){return!0}}();g&&r({target:"Uint8Array",proto:!0,forced:m},{toBase64:function(){var t,e=o(this),i=arguments.length?a(arguments[0]):void 0,r="base64"===d(i)?c:u,s=!!i&&!!i.omitPadding;l(this.buffer);for(var n="",h=0,g=e.length,m=function(e){return p(r,t>>6*e&63)};h+2<g;h+=3)t=(e[h]<<16)+(e[h+1]<<8)+e[h+2],n+=m(3)+m(2)+m(1)+m(0);return h+2===g?(t=(e[h]<<16)+(e[h+1]<<8),n+=m(3)+m(2)+m(1)+(s?"":"=")):h+1===g&&(t=e[h]<<16,n+=m(3)+m(2)+(s?""
1:"==")),n}})},9504(t,e,i){var r=i(616),s=Function.prototype,n=s.call,a=r&&s.bind.bind(n,n);t.exports=r?a:function(t){return function(){return n.apply(t,arguments)}}},9519(t,e,i){var r,s,n=i(4576),a=i(2839),o=n.process,l=n.Deno,h=o&&o.versions||l&&l.version,d=h&&h.v8;d&&(s=(r=d.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!s&&a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(s=+r[1]),t.exports=s},9539(t,e,i){var r=i(9565),s=i(8551),n=i(5966);t.exports=function(t,e,i){var a,o;s(t);try{if(!(a=n(t,"return"))){if("throw"===e)throw i;return i}a=r(a,t)}catch(t){o=!0,a=t}if("throw"===e)throw i;if(o)throw a;return s(a),i}},9565(t,e,i){var r=i(616),s=Function.prototype.call;t.exports=r?s.bind(s):function(){return s.apply(s,arguments)}},9577(t,e,i){var r=i(9928),s=i(4644),n=i(1108),a=i(1291),o=i(5854),l=s.aTypedArray,h=s.getTypedArrayConstructor,d=s.exportTypedArrayMethod,c=function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(t){return 8===t}}(),u=c&&function(){try{new Int8Array(1).with(-.5,1)}catch(t){return!0}}();d("with",{with:function(t,e){var i=l(this),s=a(t),d=n(i)?o(e):+e;return r(i,h(i),s,d)}}.with,!c||u)},9590(t,e,i){var r=i(1291),s=RangeError;t.exports=function(t){var e=r(t);if(e<0)throw new s("The argument can't be less than 0");return e}},9617(t,e,i){var r=i(5397),s=i(5610),n=i(6198),a=function(t){return function(e,i,a){var o,l=r(e),h=n(l);if(0===h)return!t&&-1;var d=s(a,h);if(t&&i!=i){for(;h>d;)if((o=l[d++])!=o)return!0}else for(;h>d;d++)if((t||d in l)&&l[d]===i)return t||d||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},9631(t,e,i){i(9486)},9797(t,e,i){i(4226)},9835(t){t.exports=function(t){try{var e=new Set,i=e[t]({size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return e.clear(),e.add(4),function(){return{done:!0}}}})}});return 1===i.size&&4===i.values().next().value}catch(t){return!1}}},9928(t,e,i){var r=i(6198),s=i(1291),n=RangeError;t.exports=function(t,e,i,a){var o=r(t),l=s(i),h=l<0?o+l:l;if(h>=o||h<0)throw new n("Incorrect index");for(var d=new e(o),c=0;c<o;c++)d[c]=c===h?a:t[c];return d}}},a={};function o(t){var e=a[t];if(void 0!==e)return e.exports;var i=a[t]={exports:{}};return n[t].call(i.exports,i,i.exports,o),i.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var e={};o(4114),o(6573),o(8100),o(7936),o(8111),o(8237),o(9577),o(4235),o(1549),o(9797),o(9631),o(5623),o(5781);let l="object"==typeof r&&r+""=="[object process]"&&!r.versions.nw&&!(r.versions.electron&&r.type&&"browser"!==r.type),h=[.001,0,0,.001,0,0],d={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},c={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},u="pdfjs_internal_editor_",p={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},g={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},m={TRIANGLES:1,LATTICE:2},f={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},b={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},v={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},y={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},A={ERRORS:0,WARNINGS:1,INFOS:5},w={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},x={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},E=A.WARNINGS;function S(t){E>=A.INFOS&&console.info(`Info: ${t}`)}function _(t){E>=A.WARNINGS&&console.warn(`Warning: ${t}`)}function T(t){throw Error(t)}function C(t,e){t||T(e)}function M(t,e=null,i=null){if(!t)return null;if(i&&"string"==typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){let e=t.match(/\./g);e?.length>=2&&(t=`http://${t}`)}if(i.tryConvertEncoding)try{var r;r=t,t=decodeURIComponent(escape(r))}catch{}}let s=e?URL.parse(t,e):URL.parse(t);return!function(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(s)?null:s}function D(t,e,i=!1){let r=URL.parse(t);return r?(r.hash=e,r.href):i&&M(t,"http://example.com")?t.split("#",1)[0]+`${e?`#${e}`:""}`:""}function P(t,e,i,r=!1){return Object.defineProperty(t,e,{value:i,enumerable:!r,configurable:!0,writable:!1}),i}let I=function(){function t(t,e){this.message=t,this.name=e}return t.prototype=Error(),t.constructor=t,t}();class k extends I{constructor(t,e){super(t,"PasswordException"),this.code=e}}class R extends I{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class L extends I{constructor(t){super(t,"InvalidPDFException")}}class B extends I{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}}class F extends I{constructor(t){super(t,"FormatError")}}class O extends I{constructor(t){super(t,"AbortException")}}function N(t){"string"!=typeof t&&T("Invalid argument for stringToBytes");let e=t.length,i=new Uint8Array(e);for(let r=0;r<e;++r)i[r]=255&t.charCodeAt(r);return i}class U{static get isLittleEndian(){return P(this,"isLittleEndian",function(){let t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return P(this,"isEvalSupported",function(){try{return Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return P(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get isImageDecoderSupported(){return P(this,"isImageDecoderSupported","undefined"!=typeof ImageDecoder)}static get isFloat16ArraySupported(){return P(this,"isFloat16ArraySupported","undefined"!=typeof Float16Array)}static get isSanitizerSupported(){return P(this,"isSanitizerSupported","undefined"!=typeof Sanitizer)}static get platform(){let{platform:t,userAgent:e}=navigator;return P(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCSSRoundSupported(){return P(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}let z=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));class H{static makeHexColor(t,e,i){return`#${z[t]}${z[e]}${z[i]}`}static domMatrixToTransform(t){return[t.a,t.b,t.c,t.d,t.e,t.f]}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e,i=0){let r=t[i],s=t[i+1];t[i]=r*e[0]+s*e[2]+e[4],t[i+1]=r*e[1]+s*e[3]+e[5]}static applyTransformToBezier(t,e,i=0){let r=e[0],s=e[1],n=e[2],a=e[3],o=e[4],l=e[5];for(let e=0;e<6;e+=2){let h=t[i+e],d=t[i+e+1];t[i+e]=h*r+d*n+o,t[i+e+1]=h*s+d*a+l}}static applyInverseTransform(t,e){let i=t[0],r=t[1],s=e[0]*e[3]-e[1]*e[2];t[0]=(i*e[3]-r*e[2]+e[2]*e[5]-e[4]*e[3])/s,t[1]=(-i*e[1]+r*e[0]+e[4]*e[1]-e[5]*e[0])/s}static axialAlignedBoundingBox(t,e,i){let r=e[0],s=e[1],n=e[2],a=e[3],o=e[4],l=e[5],h=t[0],d=t[1],c=t[2],u=t[3],p=r*h+o,g=p,m=r*c+o,f=m,b=a*d+l,v=b,y=a*u+l,A=y;if(0!==s||0!==n){let t=s*h,e=s*c,i=n*d,r=n*u;p+=i,f+=i,m+=r,g+=r,b+=t,A+=t,y+=e,v+=e}i[0]=Math.min(i[0],p,m,g,f),i[1]=Math.min(i[1],b,y,v,A),i[2]=Math.max(i[2],p,m,g,f),i[3]=Math.max(i[3],b,y,v,A)}static inverseTransform(t){let e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){let i=t[0],r=t[1],s=t[2],n=t[3],a=i**2+r**2,o=s**2+n**2,l=(a+o)/2,h=Math.sqrt(l**2-(a*o-(i*s+r*n)**2));e[0]=Math.sqrt(l+h||1),e[1]=Math.sqrt(l-h||1)}static normalizeRect(t){let e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){let i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),r
1=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>r)return null;let s=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),n=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return s>n?null:[i,s,r,n]}static pointBoundingBox(t,e,i){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}static rectBoundingBox(t,e,i,r,s){s[0]=Math.min(s[0],t,i),s[1]=Math.min(s[1],e,r),s[2]=Math.max(s[2],t,i),s[3]=Math.max(s[3],e,r)}static #t(t,e,i,r,s,n,a,o,l,h){if(l<=0||l>=1)return;let d=1-l,c=l*l,u=c*l,p=d*(d*(d*t+3*l*e)+3*c*i)+u*r,g=d*(d*(d*s+3*l*n)+3*c*a)+u*o;h[0]=Math.min(h[0],p),h[1]=Math.min(h[1],g),h[2]=Math.max(h[2],p),h[3]=Math.max(h[3],g)}static #e(t,e,i,r,s,n,a,o,l,h,d,c){if(1e-12>Math.abs(l)){Math.abs(h)>=1e-12&&this.#t(t,e,i,r,s,n,a,o,-d/h,c);return}let u=h**2-4*d*l;if(u<0)return;let p=Math.sqrt(u),g=2*l;this.#t(t,e,i,r,s,n,a,o,(-h+p)/g,c),this.#t(t,e,i,r,s,n,a,o,(-h-p)/g,c)}static bezierBoundingBox(t,e,i,r,s,n,a,o,l){l[0]=Math.min(l[0],t,a),l[1]=Math.min(l[1],e,o),l[2]=Math.max(l[2],t,a),l[3]=Math.max(l[3],e,o),this.#e(t,i,s,a,e,r,n,o,3*(-t+3*(i-s)+a),6*(t-2*i+s),3*(i-t),l),this.#e(t,i,s,a,e,r,n,o,3*(-e+3*(r-n)+o),6*(e-2*r+n),3*(r-e),l)}}let j=null,$=null;function G(){if("function"==typeof crypto.randomUUID)return crypto.randomUUID();let t=new Uint8Array(32);return crypto.getRandomValues(t),function(t){("object"!=typeof t||t?.length===void 0)&&T("Invalid argument for bytesToString");let e=t.length;if(e<8192)return String.fromCharCode.apply(null,t);let i=[];for(let r=0;r<e;r+=8192){let s=Math.min(r+8192,e),n=t.subarray(r,s);i.push(String.fromCharCode.apply(null,n))}return i.join("")}(t)}let V="pdfjs_internal_id_";function W(t,e,i){return Math.min(Math.max(t,e),i)}"function"!=typeof Math.sumPrecise&&(Math.sumPrecise=function(t){return t.reduce((t,e)=>t+e,0)}),"function"!=typeof AbortSignal.any&&(AbortSignal.any=function(t){let e=new AbortController,{signal:i}=e;for(let r of t)if(r.aborted)return e.abort(r.reason),i;for(let r of t)r.addEventListener("abort",()=>{e.abort(r.reason)},{signal:i});return i}),o(1701),o(4603),o(7566),o(8721);class K{static textContent(t){let e=[],i={items:e,styles:Object.create(null)};return!function t(i){if(!i)return;let r=null,s=i.name;if("#text"===s)r=i.value;else{if(!K.shouldBuildText(s))return;i?.attributes?.textContent?r=i.attributes.textContent:i.value&&(r=i.value)}if(null!==r&&e.push({str:r}),i.children)for(let e of i.children)t(e)}(t),i}static shouldBuildText(t){return"textarea"!==t&&"input"!==t&&"option"!==t&&"select"!==t}}class X{static setupStorage(t,e,i,r,s){let n=r.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==n.value&&(t.textContent=n.value),"print"===s)break;t.addEventListener("input",t=>{r.setValue(e,{value:t.target.value})});break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(n.value===i.attributes.xfaOn?t.setAttribute("checked",!0):n.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===s)break;t.addEventListener("change",t=>{r.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(null!==n.value&&t.setAttribute("value",n.value),"print"===s)break;t.addEventListener("input",t=>{r.setValue(e,{value:t.target.value})})}break;case"select":if(null!==n.value)for(let e of(t.setAttribute("value",n.value),i.children))e.attributes.value===n.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected;t.addEventListener("input",t=>{let i=t.target.options,s=-1===i.selectedIndex?"":i[i.selectedIndex].value;r.setValue(e,{value:s})})}}static setAttributes({html:t,element:e,storage:i=null,intent:r,linkService:s}){let{attributes:n}=e,a=t instanceof HTMLAnchorElement;for(let[e,i]of("radio"===n.type&&(n.name=`${n.name}-${r}`),Object.entries(n)))if(null!=i)switch(e){case"class":i.length&&t.setAttribute(e,i.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",i);break;case"style":Object.assign(t.style,i);break;case"textContent":t.textContent=i;break;default:a&&("href"===e||"newWindow"===e)||t.setAttribute(e,i)}a&&s.addLinkAttributes(t,n.href,n.newWindow),i&&n.dataId&&this.setupStorage(t,n.dataId,e,i)}static render(t){let e=t.annotationStorage,i=t.linkService,r=t.xfaHtml,s=t.
1intent||"display",n=document.createElement(r.name);r.attributes&&this.setAttributes({html:n,element:r,intent:s,linkService:i});let a="richText"!==s,o=t.div;if(o.append(n),t.viewport){let e=`matrix(${t.viewport.transform.join(",")})`;o.style.transform=e}a&&o.setAttribute("class","xfaLayer xfaFont");let l=[];if(0===r.children.length){if(r.value){let t=document.createTextNode(r.value);n.append(t),a&&K.shouldBuildText(r.name)&&l.push(t)}return{textDivs:l}}let h=[[r,-1,n]];for(;h.length>0;){let[t,r,n]=h.at(-1);if(r+1===t.children.length){h.pop();continue}let o=t.children[++h.at(-1)[1]];if(null===o)continue;let{name:d}=o;if("#text"===d){let t=document.createTextNode(o.value);l.push(t),n.append(t);continue}let c=o?.attributes?.xmlns?document.createElementNS(o.attributes.xmlns,d):document.createElement(d);if(n.append(c),o.attributes&&this.setAttributes({html:c,element:o,storage:e,intent:s,linkService:i}),o.children?.length>0)h.push([o,-1,c]);else if(o.value){let t=document.createTextNode(o.value);a&&K.shouldBuildText(d)&&l.push(t),c.append(t)}}for(let t of o.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))t.setAttribute("readOnly",!0);return{textDivs:l}}static update(t){let e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}let q="http://www.w3.org/2000/svg";class Y{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function Q(t,e="text"){if(tr(t,document.baseURI)){let i=await fetch(t);if(!i.ok)throw Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise((i,r)=>{let s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType=e,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(200===s.status||0===s.status){switch(e){case"arraybuffer":case"blob":case"json":i(s.response);return}i(s.responseText);return}r(Error(s.statusText))}},s.send(null)})}class J{constructor({viewBox:t,userUnit:e,scale:i,rotation:r,offsetX:s=0,offsetY:n=0,dontFlip:a=!1}){let o,l,h,d,c,u,p,g;this.viewBox=t,this.userUnit=e,this.scale=i,this.rotation=r,this.offsetX=s,this.offsetY=n,i*=e;let m=(t[2]+t[0])/2,f=(t[3]+t[1])/2;switch((r%=360)<0&&(r+=360),r){case 180:o=-1,l=0,h=0,d=1;break;case 90:o=0,l=1,h=1,d=0;break;case 270:o=0,l=-1,h=-1,d=0;break;case 0:o=1,l=0,h=0,d=-1;break;default:throw Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(h=-h,d=-d),0===o?(c=Math.abs(f-t[1])*i+s,u=Math.abs(m-t[0])*i+n,p=(t[3]-t[1])*i,g=(t[2]-t[0])*i):(c=Math.abs(m-t[0])*i+s,u=Math.abs(f-t[1])*i+n,p=(t[2]-t[0])*i,g=(t[3]-t[1])*i),this.transform=[o*i,l*i,h*i,d*i,c-o*i*m
1-h*i*f,u-l*i*m-d*i*f],this.width=p,this.height=g}get rawDims(){let t=this.viewBox;return P(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:r=this.offsetY,dontFlip:s=!1}={}){return new J({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:r,dontFlip:s})}convertToViewportPoint(t,e){let i=[t,e];return H.applyTransform(i,this.transform),i}convertToViewportRectangle(t){let e=[t[0],t[1]];H.applyTransform(e,this.transform);let i=[t[2],t[3]];return H.applyTransform(i,this.transform),[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){let i=[t,e];return H.applyInverseTransform(i,this.transform),i}}class Z extends I{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function tt(t){let e=t.length,i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function te(t){return"string"==typeof t&&/\.pdf$/i.test(t)}class ti{started=Object.create(null);times=[];time(t){t in this.started&&_(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||_(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){let t=[],e=0;for(let{name:t}of this.times)e=Math.max(t.length,e);for(let{name:i,start:r,end:s}of this.times)t.push(`${i.padEnd(e)} ${s-r}ms
2`);return t.join("")}}function tr(t,e){let i=e?URL.parse(t,e):URL.parse(t);return i?.protocol==="http:"||i?.protocol==="https:"}function ts(t){t.preventDefault()}function tn(t){t.preventDefault(),t.stopPropagation()}class ta{static #i;static toDateObject(t){if(t instanceof Date)return t;if(!t||"string"!=typeof t)return null;this.#i||=RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");let e=this.#i.exec(t);if(!e)return null;let i=parseInt(e[1],10),r=parseInt(e[2],10);r=r>=1&&r<=12?r-1:0;let s=parseInt(e[3],10);s=s>=1&&s<=31?s:1;let n=parseInt(e[4],10);n=n>=0&&n<=23?n:0;let a=parseInt(e[5],10);a=a>=0&&a<=59?a:0;let o=parseInt(e[6],10);o=o>=0&&o<=59?o:0;let l=e[7]||"Z",h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,"-"===l?(n+=h,a+=d):"+"===l&&(n-=h,a-=d),new Date(Date.UTC(i,r,s,n,a,o))}}function to(t){if(t.startsWith("#")){let e=parseInt(t.slice(1),16);return[(0xff0000&e)>>16,(65280&e)>>8,255&e]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(t=>parseInt(t)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(_(`Not a valid color format: "${t}"`),[0,0,0])}function tl(t){let{a:e,b:i,c:r,d:s,e:n,f:a}=t.getTransform();return[e,i,r,s,n,a]}function th(t){let{a:e,b:i,c:r,d:s,e:n,f:a}=t.getTransform().invertSelf();return[e,i,r,s,n,a]}function td(t,e,i=!1,r=!0){if(e instanceof J){let{pageWidth:r,pageHeight:s}=e.rawDims,{style:n}=t,a=U.isCSSRoundSupported,o=`var(--total-scale-factor) * ${r}px`,l=`var(--total-scale-factor) * ${s}px`,h=a?`round(down, ${o}, var(--scale-round-x))`:`calc(${o})`,d=a?`round(down, ${l}, var(--scale-round-y))`:`calc(${l})`;i&&e.rotation%180!=0?(n.width=d,n.height=h):(n.width=h,n.height=d)}r&&t.setAttribute("data-main-rotation",e.rotation)}class tc{constructor(){let{pixelRatio:t}=tc;this.sx=t,this.sy=t}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,i,r,s=-1){let n=1/0,a=1/0,o=1/0;(i=tc.capPixels(i,s))>0&&(n=Math.sqrt(i/(t*e))),-1!==r&&(a=r/t,o=r/e);let l=Math.min(n,a,o);return(this.sx>l||this.sy>l)&&(this.sx=l,this.sy=l,!0)}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){let i=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,i):i}return t}}let tu=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class tp{static get isDarkMode(){return P(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}}class tg{static get commentForegroundColor(){let t=document.createElement("span");t.classList.add("comment","sidebar");let{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);let{color:i}=window.getComputedStyle(t);return t.remove(),P(this,"commentForegroundColor",to(i))}}function tm(t,e){let i=t[0]/255,r=t[1]/255,s=t[2]/255,n=Math.max(i,r,s),a=Math.min(i,r,s),o=(n+a)/2;if(n===a)e[0]=e[1]=0;else{let t=n-a;switch(e[1]=o<.5?t/(n+a):t/(2-n-a),n){case i:e[0]=((r-s)/t+6*(r<s))*60;break;case r:e[0]=((s-i)/t+2)*60;break;case s:e[0]=((i-r)/t+4)*60}}e[2]=o}function tf(t,e){let i=t[0],r=t[1],s=t[2],n=(1-Math.abs(2*s-1))*r,a=n*(1-Math.abs(i/60%2-1)),o=s-n/2;switch(Math.floor(i/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;
2case 5:case 6:e[0]=n+o,e[1]=o,e[2]=a+o}}function tb(t){return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function tv(t,e,i){tf(t,i),i.map(tb);let r=.2126*i[0]+.7152*i[1]+.0722*i[2];tf(e,i),i.map(tb);let s=.2126*i[0]+.7152*i[1]+.0722*i[2];return r>s?(r+.05)/(s+.05):(s+.05)/(r+.05)}let ty=new Map;function tA({html:t,dir:e,className:i},r){let s=document.createDocumentFragment();if("string"==typeof t){let i=document.createElement("p");i.dir=e||"auto";let r=t.split(/(?:\r\n?|\n)/);for(let t=0,e=r.length;t<e;++t){let s=r[t];i.append(document.createTextNode(s)),t<e-1&&i.append(document.createElement("br"))}s.append(i)}else X.render({xfaHtml:t,div:s,intent:"richText"});s.firstElementChild.classList.add("richText",i),r.append(s)}function tw(t){let e=new Path2D;if(!t)return e;for(let i=0,r=t.length;i<r;)switch(t[i++]){case x.moveTo:e.moveTo(t[i++],t[i++]);break;case x.lineTo:e.lineTo(t[i++],t[i++]);break;case x.curveTo:e.bezierCurveTo(t[i++],t[i++],t[i++],t[i++],t[i++],t[i++]);break;case x.quadraticCurveTo:e.quadraticCurveTo(t[i++],t[i++],t[i++],t[i++]);break;case x.closePath:e.closePath();break;default:_(`Unrecognized drawing path operator: ${t[i-1]}`)}return e}class tx{static #r=null;static #s=null;static #n=null;static #a=0;static #o=[];get pagesNumber(){return tx.#a}set pagesNumber(t){tx.#a!==t&&(tx.#a=t,0===t&&(tx.#s=null,tx.#r=null))}addListener(t){tx.#o.push(t)}removeListener(t){let e=tx.#o.indexOf(t);e>=0&&tx.#o.splice(e,1)}#l(){for(let t of tx.#o)t()}#h(t){if(tx.#s)return;let e=tx.#a,i=new Uint32Array(3*e),r=tx.#s=i.subarray(0,e),s=tx.#r=i.subarray(e,2*e);if(t)for(let t=0;t<e;t++)r[t]=s[t]=t+1;tx.#n=i.subarray(2*e)}movePages(t,e,i){this.#h(!0);let r=tx.#s,s=tx.#r;tx.#n.set(s);let n=e.length,a=new Uint32Array(n),o=0;for(let t=0;t<n;t++){let s=e[t]-1;a[t]=r[s],s<i&&(o+=1)}let l=tx.#a,h=i-o,d=l-n;h=W(h,0,d);for(let e=0,i=0;e<l;e++)t.has(e+1)||(r[i++]=r[e]);r.copyWithin(h+n,h,d),r.set(a,h);let c=!1;for(let t=0;t<l;t++){let e=r[t];c||=e!==t+1,s[e-1]=t+1}this.#l(),c||(this.pagesNumber=0)}hasBeenAltered(){return null!==tx.#s}getPageMappingForSaving(){return{pageIndices:tx.#r?tx.#r.map(t=>t-1):null}}getPrevPageNumber(t){return tx.#n[tx.#s[t-1]-1]}getPageNumber(t){return tx.#r?.[t-1]??t}getPageId(t){return tx.#s?.[t-1]??t}static get instance(){return P(this,"instance",new tx)}getMapping(){return tx.#s.subarray(0,this.pagesNumber)}}o(4972),o(4628),o(7642),o(8004),o(3853),o(5876),o(2475),o(5024),o(1698),o(4979),o(9314),o(1148),o(3579),o(8335);class tE{#d=null;#c=null;#u;#p=null;#g=null;#m=null;#f=null;#b=null;static #v=null;constructor(t){this.#u=t,tE.#v||=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(){let t=this.#d=document.createElement("div");t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=this.#u._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",ts,{signal:e}),t.addEventListener("pointerdown",tE.#y,{signal:e}));let i=this.#p=document.createElement("div");i.className="buttons",t.append(i);let r=this.#u.toolbarPosition;if(r){let{style:e}=t,i="ltr"===this.#u._uiManager.direction?1-r[0]:r[0];e.insetInlineEnd=`${100*i}%`,e.top=`calc(${100*r[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return this.#d}static #y(t){t.stopPropagation()}#A(t){this.#u._focusEventsAllowed=!1,tn(t)}#w(t){this.#u._focusEventsAllowed=!0,tn(t)}#x(t){let e=this.#u._uiManager._signal;return e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("focusin",this.#A.bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",this.#w.bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",ts,{signal:e}),!0)}hide(){this.#d.classList.add("hidden"),this.#c?.hideDropdown()}show(){this.#d.classList.remove("hidden"),this.#g?.shown(),this.#m?.shown()}addDeleteButton(){let{editorType:t,_uiManager:e}=this.#u,i=document.createElement("button");i.classList.add("basic","deleteButton"),i.tabIndex=0,i.setAttribute("data-l10n-id",tE.#v[t]),this.#x(i)&&i.addEventListener("click",t=>{e.delete()},{signal:e._signal}),this.#p.append(i)}get #E(){let t=document.createElement("div");return t.className="divider",t}async addAltText(t){let e=await t.render();this.#x(e),this.#p.append(e,this.#E),this.#g=t}addComment(t,e=null){if(this.#m)return;let i=t.renderForToolbar();if(!i)return;this.#x(i);let r=this.#f=this.#E;e?(this.#p.insertBefore(i,e),this.#p.insertBefore(r,e)):this.#p.append(i,r),this.#m=t,t.toolbar=this}addColorPicker(t){if(this.#c)return;this.#c=t;let e=t.renderButton();this.#x(e),this.#p.append(e,this.#E)}async addEditSignatureButton(t){let e=this.#b=await t.renderEditButton(this.#u);this.#x(e),this.#p.append(e,this.#E)}removeButton(t){"comment"===t&&(this.#m?.removeToolbarCommentButton(),this.#m=null,this.#f?.remove(),this.#f=null)}async addButton(t,e){switch(t){case"colorPicker":e&&this.addColorPicker(e);break;case"altText":e&&await this.addAltText(e);break;case"editSignature":e&&await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":e&&this.addComment(e)}}async addButtonBefore(t,e,i){if(!e&&"comment"===t)return;let r=this.#p.querySelector(i);r&&"comment"===t&&this.addComment(e,r)}updateEditSignatureButton(t){this.#b&&(this.#b.title=t)}remove(){this.#d.remove(),this.#c?.destroy(),this.#c=null}}class tS{#p=null;#d=null;#S;constructor(t){this.#S=t}#_(){let t=this.#d=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar");let e=this.#S._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",ts,{signal:e});let i=this.#p=document.createElement("div");return i.className="buttons",t.append(i),this.#S.hasCommentManager()&&this.#T("commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{this.#S.commentSelection("floating_button")}),this.#T("highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{this.#S.highlightSelection("floating_button")}),t}#C(t,e){let i=0,r=0;for(let s of t){let t=s.y+s.height;if(t<i)continue;let n=s.x+(e?s.width:0);if(t>i){r=n,i=t;continue}e?n>r&&(r=n):n<r&&(r=n)}return[e?1-r:r,i]}
2show(t,e,i){let[r,s]=this.#C(e,i),{style:n}=this.#d||=this.#_();t.append(this.#d),n.insetInlineEnd=`${100*r}%`,n.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){this.#d.remove()}#T(t,e,i,r){let s=document.createElement("button");s.classList.add("basic",t),s.tabIndex=0,s.setAttribute("data-l10n-id",e);let n=document.createElement("span");s.append(n),n.className="visuallyHidden",n.setAttribute("data-l10n-id",i);let a=this.#S._signal;a instanceof AbortSignal&&!a.aborted&&(s.addEventListener("contextmenu",ts,{signal:a}),s.addEventListener("click",r,{signal:a})),this.#p.append(s)}}function t_(t,e,i){for(let r of i)e.addEventListener(r,t[r].bind(t))}class tT{static #M=NaN;static #D=null;static #P=NaN;static #I=null;static initializeAndAddPointerId(t){(tT.#D||=new Set).add(t)}static setPointer(t,e){tT.#M||=e,tT.#I??=t}static setTimeStamp(t){tT.#P=t}static isSamePointerId(t){return tT.#M===t}static isSamePointerIdOrRemove(t){return tT.#M===t||(tT.#D?.delete(t),!1)}static isSamePointerType(t){return tT.#I===t}static isInitializedAndDifferentPointerType(t){return null!==tT.#I&&!tT.isSamePointerType(t)}static isSameTimeStamp(t){return tT.#P===t}static isUsingMultiplePointers(){return tT.#D?.size>=1}static clearPointerType(){tT.#I=null}static clearPointerIds(){tT.#M=NaN,tT.#D=null}static clearTimeStamp(){tT.#P=NaN}}class tC{#k=0;get id(){return`${u}${this.#k++}`}}class tM{#R=G();#k=0;#L=null;static get _isSVGFittingCanvas(){let t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;return e.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',P(this,"_isSVGFittingCanvas",e.decode().then(()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0])))}async #B(t,e){this.#L||=new Map;let i=this.#L.get(t);if(null===i)return null;if(i?.bitmap)return i.refCounter+=1,i;try{let t;if(i||={bitmap:null,id:`image_${this.#R}_${this.#k++}`,refCounter:0,isSvg:!1},"string"==typeof e?(i.url=e,t=await Q(e,"blob")):e instanceof File?t=i.file=e:e instanceof Blob&&(t=e),"image/svg+xml"===t.type){let e=tM._isSVGFittingCanvas,r=new FileReader,s=new Image,n=new Promise((t,n)=>{s.onload=()=>{i.bitmap=s,i.isSvg=!0,t()},r.onload=async()=>{let t=i.svgUrl=r.result;s.src=await e?`${t}#svgView(preserveAspectRatio(none))`:t},s.onerror=r.onerror=n});r.readAsDataURL(t),await n}else i.bitmap=await createImageBitmap(t);i.refCounter=1}catch(t){_(t),i=null}return this.#L.set(t,i),i&&this.#L.set(i.id,i),i}async getFromFile(t){let{lastModified:e,name:i,size:r,type:s}=t;return this.#B(`${e}_${i}_${r}_${s}`,t)}async getFromUrl(t){return this.#B(t,t)}async getFromBlob(t,e){let i=await e;return this.#B(t,i)}async getFromId(t){this.#L||=new Map;let e=this.#L.get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){let{blobPromise:t}=e;return delete e.blobPromise,this.getFromBlob(e.id,t)}return this.getFromUrl(e.url)}getFromCanvas(t,e){this.#L||=new Map;let i=this.#L.get(t);if(i?.bitmap)return i.refCounter+=1,i;let r=new OffscreenCanvas(e.width,e.height);return r.getContext("2d").drawImage(e,0,0),i={bitmap:r.transferToImageBitmap(),id:`image_${this.#R}_${this.#k++}`,refCounter:1,isSvg:!1},this.#L.set(t,i),this.#L.set(i.id,i),i}getSvgUrl(t){let e=this.#L.get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){this.#L||=new Map;let e=this.#L.get(t);if(!e||(e.refCounter-=1,0!==e.refCounter))return;let{bitmap:i}=e;if(!e.url&&!e.file){let t=new OffscreenCanvas(i.width,i.height);t.getContext("bitmaprenderer").transferFromImageBitmap(i),e.blobPromise=t.convertToBlob()}i.close?.(),e.bitmap=null}isValidId(t){return t.startsWith(`image_${this.#R}_`)}}class tD{#F=[];#O=!1;#N;#U=-1;constructor(t=128){this.#N=t}add({cmd:t,undo:e,post:i,mustExec:r,type:s=NaN,overwriteIfSameType:n=!1,keepUndo:a=!1}){if(r&&t(),this.#O)return;let o={cmd:t,undo:e,post:i,type:s};if(-1===this.#U){this.#F.length>0&&(this.#F.length=0),this.#U=0,this.#F.push(o);return}if(n&&this.#F[this.#U].type===s){a&&(o.undo=this.#F[this.#U].undo),this.#F[this.#U]=o;return}let l=this.#U+1;l===this.#N?this.#F.splice(0,1):(this.#U=l,l<this.#F.length&&this.#F.splice(l)),this.#F.push(o)}undo(){if(-1===this.#U)return;this.#O=!0;let{undo:t,post:e}=this.#F[this.#U];t(),e?.(),this.#O=!1,this.#U-=1}redo(){if(this.#U<this.#F.length-1){this.#U+=1,this.#O=!0;let{cmd:t,post:e}=this.#F[this.#U];t(),e?.(),this.#O=!1}}hasSomethingToUndo(){return -1!==this.#U}hasSomethingToRedo(){return this.#U<this.#F.length-1}cleanType(t){if(-1!==this.#U){for(let e=this.#U;e>=0;e--)if(this.#F[e].type!==t){this.#F.splice(e+1,this.#U-e),this.#U=e;return}this.#F.length=0,this.#U=-1}}destroy(){this.#F=null}}class tP{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:e}=U.platform;for(let[i,r,s={}]of t)for(let t of i){let i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:r,options:s}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:r,options:s}),this.allKeys.add(t.split("+").at(-1)))}}#z(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);let e=this.buffer.join("+");return this.buffer.length=0,e}exec(t,e){if(!this.allKeys.has(e.key))return;let i=this.callbacks.get(this.#z(e));if(!i)return;let{callback:r,options:{bubbles:s=!1,args:n=[],checker:a=null}}=i;(!a||a(t,e))&&(r.bind(t,...n,e)(),s||tn(e))}}class tI{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]),e=document.createElement("span");for(let i of(e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e),t.keys())){e.style.color=i;let r=window.getComputedStyle(e).color;t.set(i,to(r))}return e.remove(),P(this,"_colors",t)}convert(t){let e=to(t);
vendor: 4,392 bytes, line 2
2if(!window.matchMedia("(forced-colors: active)").matches)return e;for(let[t,i]of this._colors)if(i.every((t,i)=>t===e[i]))return tI._colorsMapping.get(t);return e}getHexCode(t){let e=this._colors.get(t);return e?H.makeHexColor(...e):t}}class tk{#H=new AbortController;#j=null;#$=null;#G=new Map;#V=new Map;#W=null;#K=null;#X=null;#q=new tD;#Y=null;#Q=null;#J=null;#Z=0;#tt=new Set;#te=null;#ti=null;#tr=new Set;_editorUndoBar=null;#ts=!1;#tn=!1;#ta=!1;#to=null;#tl=null;#th=null;#td=null;#tc=!1;#tu=null;#tp=new tC;#tg=!1;#tm=!1;#tf=!1;#tb=null;#tv=null;#ty=null;#tA=null;#tw=null;#tx=p.NONE;#tE=new Set;#tS=null;#t_=null;#tT=null;#tC=null;#tM=null;#tD={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#tP=[0,0];#tI=null;#tk=null;#tR=null;#tL=null;#tB=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let t=tk.prototype,e=t=>t.#tk.contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,{target:e})=>{if(e instanceof HTMLInputElement){let{type:t}=e;return"text"!==t&&"number"!==t}return!0},r=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return P(this,"_keyboardManager",new tP([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(t,{target:e})=>!(e instanceof HTMLButtonElement)&&t.#tk.contains(e)&&!t.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,{target:e})=>!(e instanceof HTMLButtonElement)&&t.#tk.contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-r,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[r,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-r],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,r],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}]]))}constructor(t,e,i,r,s,n,a,o,l,h,d,c,u,p,g,m){let f=this._signal=this.#H.signal;this.#tk=t,this.#tR=e,this.#tL=i,this.#W=r,this.#Y=s,this.#t_=n,this.#tM=o,this._eventBus=a,a._on("editingaction",this.onEditingAction.bind(this),{signal:f}),a._on("pagechanging",this.onPageChanging.bind(this),{signal:f}),a._on("scalechanging",this.onScaleChanging.bind(this),{signal:f}),a._on("rotationchanging",this.onRotationChanging.bind(this),{signal:f}),a._on("setpreference",this.onSetPreference.bind(this),{signal:f}),a._on("switchannotationeditorparams",t=>this.updateParams(t.type,t.value),{signal:f}),a._on("pagesedited",this.onPagesEdited.bind(this),{signal:f}),window.addEventListener("pointerdown",()=>{this.#tm=!0},{capture:!0,signal:f}),window.addEventListener("pointerup",()=>{this.#tm=!1},{capture:!0,signal:f}),this.#tF(),this.#tO(),this.#tN(),this.#K=o.annotationStorage,this.#to=o.filterFactory,this.#tT=l,this.#td=h||null,this.#ts=d,this.#tn=c,this.#ta=u,this.#tw=p||null,this.viewParameters={realScale:Y.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=g||null,this._supportsPinchToZoom=!1!==m,s?.setSidebarUiManager(this)}destroy(){for(let t of(this.#tB?.resolve(),this.#tB=null,this.#H?.abort(),this.#H=null,this._signal=null,this.#V.values()))t.destroy();this.#V.clear(),this.#G.clear(),this.#tr.clear(),this.#tA?.clear(),this.#j=null,this.#tE.clear(),this.#q.destroy(),this.#W?.destroy(),this.#Y?.destroy(),this.#t_?.destroy(),this.#tu?.hide(),this.#tu=null,this.#ty?.destroy(),this.#ty=null,this.#$=null,this.#tl&&(clearTimeout(this.#tl),this.#tl=null),this.#tI&&(clearTimeout(this.#tI),this.#tI=null),this._editorUndoBar?.destroy(),this.#tM=null}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}
2get mlManager(){return this.#tw}get useNewAltTextFlow(){return this.#tn}get useNewAltTextWhenAddingImage(){return this.#ta}get hcmFilter(){return P(this,"hcmFilter",this.#tT?this.#to.addHCMFilter(this.#tT.foreground,this.#tT.background):"none")}get direction(){return P(this,"direction",getComputedStyle(this.#tk).direction)}get _highlightColors(){return P(this,"_highlightColors",this.#td?new Map(this.#td.split(",").map(t=>((t=t.split("=").map(t=>t.trim()))[1]=t[1].toUpperCase(),t))):null)}get highlightColors(){let{_highlightColors:t}=this;if(!t)return P(this,"highlightColors",null);let e=new Map,i=!!this.#tT;for(let[r,s]of t){let t=r.endsWith("_HCM");if(i&&t){e.set(r.replace("_HCM",""),s);continue}i||t||e.set(r,s)}return P(this,"highlightColors",e)}get highlightColorNames(){return P(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;let e=this.highlightColorNames.get(t);return this._highlightColors.get(e)||t}getNonHCMColorName(t){return this.highlightColorNames.get(t)||t}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),this.#J=t}setMainHighlightColorPicker(t){this.#ty=t}editAltText(t,e=!1){this.#W?.editAltText(this,t,e)}hasCommentManager(){return!!this.#Y}editComment(t,e,i,r){this.#Y?.showDialog(this,t,e,i,r)}selectComment(t,e){let i=this.#V.get(t),r=i?.getEditorByUID(e);r?.toggleComment(!0,!0)}updateComment(t){this.#Y?.updateComment(t.getData())}updatePopupColor(t){this.#Y?.updatePopupColor(t)}removeComment(t){this.#Y?.removeComments([t.uid])}deleteComment(t,e){let i=()=>{t.comment=e},r=()=>{this._editorUndoBar?.show(i,"comment"),this.toggleComment(null),t.comment=null};this.addCommands({cmd:r,undo:i,mustExec:!0})}toggleComment(t,e,i){this.#Y?.toggleCommentPopup(t,e,i)}makeCommentColor(t,e){return t&&this.#Y?.makeCommentColor(t,e)||null}getCommentDialogElement(){return this.#Y?.dialogElement||null}async waitForEditorsRendered(t){if(this.#V.has(t-1))return;let{resolve:e,promise:i}=Promise.withResolvers(),r=i=>{i.pageNumber===t&&(this._eventBus._off("editorsrendered",r),e())};this._eventBus.on("editorsrendered",r),await i}getSignature(t){this.#t_?.getSignature({uiManager:this,editor:t})}get signatureManager(){return this.#t_}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){"enableNewAltTextWhenAddingImage"===t&&(this.#ta=e)}onPagesEdited({pagesMapper:t}){for(let e of this.#G.values())e.updatePageIndex(t.getPrevPageNumber(e.pageIndex+1)-1);let e=this.#V,i=this.#V=new Map;for(let[r,s]of e){let e=t.getPrevPageNumber(r+1)-1;if(-1===e){s.destroy();continue}i.set(e,s),s.updatePageIndex(e)}}onPageChanging({pageNumber:t}){this.#Z=t-1}focusMainContainer(){this.#tk.focus()}findParent(t,e){for(let i of this.#V.values()){let{x:r,y:s,width:n,height:a}=i.div.getBoundingClientRect();if(t>=r&&t<=r+n&&e>=s&&e<=s+a)return i}return null}disableUserSelect(t=!1){this.#tR.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#tr.add(t)}removeShouldRescale(t){this.#tr.delete(t)}onScaleChanging({scale:t}){for(let e of(this.commitOrRemove(),this.viewParameters.realScale=t*Y.PDF_TO_CSS_UNITS,this.#tr))e.onScaleChanging();this.#J?.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#tU({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t}#tz(t){let{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(let e of this.#V.values())if(e.hasTextLayer(t))return e;return null}highlightSelection(t="",e=!1){let i=document.getSelection();if(!i||i.isCollapsed)return;let{anchorNode:r,anchorOffset:s,focusNode:n,focusOffset:a}=i,o=i.toString(),l=this.#tU(i).closest(".textLayer"),h=this.getSelectionBoxes(l);if(!h)return;i.empty();let d=this.#tz(l),c=this.#tx===p.NONE,u=()=>{let i=d?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:r,anchorOffset:s,focusNode:n,focusOffset:a,text:o});c&&this.showAllEditors("highlight",!0,!0),e&&i?.editComment()};if(c)return void this.switchToMode(p.HIGHLIGHT,u);u()}commentSelection(t=""){this.highlightSelection(t,!0)}#tH(){let t=document.getSelection();if(!t||t.isCollapsed)return;let e=this.#tU(t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&(this.#tu||=new tS(this),this.#tu.show(e,i,"ltr"===this.direction))}getAndRemoveDataFromAnnotationStorage(t){if(!this.#K)return null;let e=`${u}${t}`,i=this.#K.getRawValue(e);return i&&this.#K.remove(e),i}addToAnnotationStorage(t){t.isEmpty()||!this.#K||this.#K.has(t.id)||this.#K.setValue(t.id,t)}a11yAlert(t,e=null){let i=this.#tL;i&&(i.setAttribute("data-l10n-id",t),e?i.setAttribute("data-l10n-args",JSON.stringify(e)):i.removeAttribute("data-l10n-args"))}#tj(){let t=document.getSelection();if(!t||t.isCollapsed){this.#tS&&(this.#tu?.hide(),this.#tS=null,this.#t$({hasSelectedText:!1}));return}let{anchorNode:e}=t;if(e===this.#tS)return;let i=this.#tU(t).closest(".textLayer");if(!i){this.#tS&&(this.#tu?.hide(),this.#tS=null,this.#t$({hasSelectedText:!1}));return}if(this.#tu?.hide(),this.#tS=e,this.#t$({hasSelectedText:!0}),(this.#tx===p.HIGHLIGHT||this.#tx===p.NONE)&&(this.#tx===p.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#tc=this.isShiftKeyDown,!this.isShiftKeyDown)){let t=this.#tx===p.HIGHLIGHT?this.#tz(i):null;if(t?.toggleDrawing(),this.#tm){let e=new AbortController,i=this.combinedSignal(e),r=i=>{("pointerup"!==i.type||0===i.button)&&(e.abort(),t?.toggleDrawing(!0),"pointerup"===i.t
2ype&&this.#tG("main_toolbar"))};window.addEventListener("pointerup",r,{signal:i}),window.addEventListener("blur",r,{signal:i})}else t?.toggleDrawing(!0),this.#tG("main_toolbar")}}#tG(t=""){this.#tx===p.HIGHLIGHT?this.highlightSelection(t):this.#ts&&this.#tH()}#tF(){document.addEventListener("selectionchange",this.#tj.bind(this),{signal:this._signal})}#tV(){if(this.#th)return;this.#th=new AbortController;let t=this.combinedSignal(this.#th);window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}#tW(){this.#th?.abort(),this.#th=null}blur(){if(this.isShiftKeyDown=!1,this.#tc&&(this.#tc=!1,this.#tG("main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of this.#tE)if(e.div.contains(t)){this.#tv=[e,t],e._focusEventsAllowed=!1;break}}focus(){if(!this.#tv)return;let[t,e]=this.#tv;this.#tv=null,e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}#tN(){if(this.#tb)return;this.#tb=new AbortController;let t=this.combinedSignal(this.#tb);window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}#tK(){this.#tb?.abort(),this.#tb=null}#tX(){if(this.#Q)return;this.#Q=new AbortController;let t=this.combinedSignal(this.#Q);document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})}#tq(){this.#Q?.abort(),this.#Q=null}#tO(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}addEditListeners(){this.#tN(),this.setEditingState(!0)}removeEditListeners(){this.#tK(),this.setEditingState(!1)}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let i of this.#ti)if(i.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(let e of t.dataTransfer.items)for(let i of this.#ti)if(i.isHandlingMimeForPasting(e.type)){i.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),this.#j?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let t of this.#tE){let i=t.serialize(!0);i&&e.push(i)}0!==e.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();let{clipboardData:e}=t;for(let t of e.items)for(let e of this.#ti)if(e.isHandlingMimeForPasting(t.type))return void e.paste(t,this.currentLayer);let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(t){_(`paste: "${t.message}".`);return}if(!Array.isArray(i))return;this.unselectAll();let r=this.currentLayer;try{let t=[];for(let e of i){let i=await r.deserialize(e);if(!i)return;t.push(i)}let e=()=>{for(let e of t)this.#tY(e);this.#tQ(t)};this.addCommands({cmd:e,undo:()=>{for(let e of t)e.remove()},mustExec:!0})}catch(t){_(`paste: "${t.message}".`)}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),this.#tx===p.NONE||this.isEditorHandlingKeyboard||tk._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,this.#tc&&(this.#tc=!1,this.#tG("main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu")}}#t$(t){Object.entries(t).some(([t,e])=>this.#tD[t]!==e)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#tD,t)}),this.#tx===p.HIGHLIGHT&&!1===t.hasSelectedEditor&&this.#tJ([[g.HIGHLIGHT_FREE,!0]]))}#tJ(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#tV(),this.#tX(),this.#t$({isEditing:this.#tx!==p.NONE,isEmpty:this.#tZ(),hasSomethingToUndo:this.#q.hasSomethingToUndo(),hasSomethingToRedo:this.#q.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#tW(),this.#tq(),this.#t$({isEditing:!1}),this.disableUserSelect(!1))}
2registerEditorTypes(t){if(!this.#ti)for(let e of(this.#ti=t,this.#ti))this.#tJ(e.defaultPropertiesToUpdate)}getId(){return this.#tp.id}get currentLayer(){return this.#V.get(this.#Z)}getLayer(t){return this.#V.get(t)}get currentPageIndex(){return this.#Z}addLayer(t){this.#V.set(t.pageIndex,t),this.#tg?t.enable():t.disable()}removeLayer(t){this.#V.delete(t.pageIndex)}async updateMode(t,e=null,i=!1,r=!1,s=!1,n=!1){if(this.#tx!==t&&(!this.#tB||(await this.#tB.promise,this.#tB))){if(this.#tB=Promise.withResolvers(),this.#J?.commitOrRemove(),this.#tx===p.POPUP&&this.#Y?.hideSidebar(),this.#Y?.destroyPopup(),this.#tx=t,t===p.NONE){for(let t of(this.setEditingState(!1),this.#t0(),this.#G.values()))t.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#tB.resolve();return}for(let t of this.#G.values())t.addStandaloneCommentButton();for(let e of(t===p.SIGNATURE&&await this.#t_?.loadSignatures(),i&&tT.clearPointerType(),this.setEditingState(!0),await this.#t1(),this.unselectAll(),this.#V.values()))e.updateMode(t);if(t===p.POPUP){this.#$||=await this.#tM.getAnnotationsByType(new Set(this.#ti.map(t=>t._editorType)));let t=new Set,e=[];for(let i of this.#G.values()){let{annotationElementId:r,hasComment:s,deleted:n}=i;r&&t.add(r),s&&!n&&e.push(i.getData())}for(let i of this.#$){let{id:r,popupRef:s,contentsObj:n}=i;s&&n?.str&&!t.has(r)&&!this.#tt.has(r)&&e.push(i)}this.#Y?.showSidebar(e)}if(!e){r&&this.addNewEditorFromKeyboard(),this.#tB.resolve();return}for(let t of this.#G.values())t.uid===e?(this.setSelected(t),n?t.editComment():s?t.enterInEditMode():t.focus()):t.unselect();this.#tB.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==this.#tx&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(this.#ti){switch(t){case g.CREATE:this.currentLayer.addNewEditor(e);return;case g.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#tC||=new Map).set(t,e),this.showAllEditors("highlight",e)}if(this.hasSelection)for(let i of this.#tE)i.updateParams(t,e);else for(let i of this.#ti)i.updateDefaultParams(t,e)}}showAllEditors(t,e,i=!1){for(let i of this.#G.values())i.editorType===t&&i.show(e);(this.#tC?.get(g.HIGHLIGHT_SHOW_ALL)??!0)!==e&&this.#tJ([[g.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(this.#tf!==t)for(let e of(this.#tf=t,this.#V.values()))t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}async #t1(){if(!this.#tg){this.#tg=!0;let t=[];for(let e of this.#V.values())t.push(e.enable());for(let e of(await Promise.all(t),this.#G.values()))e.enable()}}#t0(){if(this.unselectAll(),this.#tg){for(let t of(this.#tg=!1,this.#V.values()))t.disable();for(let t of this.#G.values())t.disable()}}*getEditors(t){for(let e of this.#G.values())e.pageIndex===t&&(yield e)}getEditor(t){return this.#G.get(t)}addEditor(t){this.#G.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#tl&&clearTimeout(this.#tl),this.#tl=setTimeout(()=>{this.focusMainContainer(),this.#tl=null},0)),this.#G.delete(t.id),t.annotationElementId&&this.#tA?.delete(t.annotationElementId),this.unselect(t),t.annotationElementId&&this.#tt.has(t.annotationElementId)||this.#K?.remove(t.id)}addDeletedAnnotationElement(t){this.#tt.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#tt.has(t)}removeDeletedAnnotationElement(t){this.#tt.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#tY(t){let e=this.#V.get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#j!==t&&(this.#j=t,t&&this.#tJ(t.propertiesToUpdate))}get #t2(){let t=null;for(t of this.#tE);return t}updateUI(t){this.#t2===t&&this.#tJ(t.propertiesToUpdate)}updateUIForDefaultProperties(t){this.#tJ(t.defaultPropertiesToUpdate)}toggleSelected(t){if(this.#tE.has(t)){this.#tE.delete(t),t.unselect(),this.#t$({hasSelectedEditor:this.hasSelection});return}this.#tE.add(t),t.select(),this.#tJ(t.propertiesToUpdate),this.#t$({hasSelectedEditor:!0})}setSelected(t){for(let e of(this.updateToolbar({mode:t.mode,editId:t.uid}),this.#J?.commitOrRemove(),this.#tE))e!==t&&e.unselect();this.#tE.clear(),this.#tE.add(t),t.select(),this.#tJ(t.propertiesToUpdate),this.#t$({hasSelectedEditor:!0})}isSelected(t){return this.#tE.has(t)}get firstSelectedEditor(){return this.#tE.values().next().value}unselect(t){t.unselect(),this.#tE.delete(t),this.#t$({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#tE.size}get isEnterHandled(){return 1===this.#tE.size&&this.firstSelectedEditor.isEnterHandled}undo(){this.#q.undo(),this.#t$({hasSomethingToUndo:this.#q.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#tZ()}),this._editorUndoBar?.hide()}redo(){this.#q.redo(),this.#t$({hasSomethingToUndo:!0,hasSomethingToRedo:this.#q.hasSomethingToRedo(),isEmpty:this.#tZ()})}addCommands(t){this.#q.add(t),this.#t$({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#tZ()})}cleanUndoStack(t){this.#q.cleanType(t)}#tZ(){if(0===this.#G.size)return!0;
2if(1===this.#G.size)for(let t of this.#G.values())return t.isEmpty();return!1}delete(){this.commitOrRemove();let t=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!t)return;let e=t?[t]:[...this.#tE],i=()=>{for(let t of(this._editorUndoBar?.show(r,1===e.length?e[0].editorType:e.length),e))t.remove()},r=()=>{for(let t of e)this.#tY(t)};this.addCommands({cmd:i,undo:r,mustExec:!0})}commitOrRemove(){this.#j?.commitOrRemove()}hasSomethingToControl(){return this.#j||this.hasSelection}#tQ(t){for(let t of this.#tE)t.unselect();for(let e of(this.#tE.clear(),t))e.isEmpty()||(this.#tE.add(e),e.select());this.#t$({hasSelectedEditor:this.hasSelection})}selectAll(){for(let t of this.#tE)t.commit();this.#tQ(this.#G.values())}unselectAll(){if(!this.#j||(this.#j.commitOrRemove(),this.#tx===p.NONE)){if(!this.#J?.commitOrRemove()&&this.hasSelection){for(let t of this.#tE)t.unselect();this.#tE.clear(),this.#t$({hasSelectedEditor:!1})}}}translateSelectedEditors(t,e,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;this.#tP[0]+=t,this.#tP[1]+=e;let[r,s]=this.#tP,n=[...this.#tE];for(let i of(this.#tI&&clearTimeout(this.#tI),this.#tI=setTimeout(()=>{this.#tI=null,this.#tP[0]=this.#tP[1]=0,this.addCommands({cmd:()=>{for(let t of n)this.#G.has(t.id)&&(t.translateInPage(r,s),t.translationDone())},undo:()=>{for(let t of n)this.#G.has(t.id)&&(t.translateInPage(-r,-s),t.translationDone())},mustExec:!1})},1e3),n))i.translateInPage(t,e),i.translationDone()}setUpDragSession(){if(this.hasSelection)for(let t of(this.disableUserSelect(!0),this.#te=new Map,this.#tE))this.#te.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}endDragSession(){if(!this.#te)return!1;this.disableUserSelect(!1);let t=this.#te;this.#te=null;let e=!1;for(let[{x:i,y:r,pageIndex:s},n]of t)n.newX=i,n.newY=r,n.newPageIndex=s,e||=i!==n.savedX||r!==n.savedY||s!==n.savedPageIndex;if(!e)return!1;let i=(t,e,i,r)=>{if(this.#G.has(t.id)){let s=this.#V.get(r);s?t._setParentAndPosition(s,e,i):(t.pageIndex=r,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(let[e,{newX:r,newY:s,newPageIndex:n}]of t)i(e,r,s,n)},undo:()=>{for(let[e,{savedX:r,savedY:s,savedPageIndex:n}]of t)i(e,r,s,n)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(this.#te)for(let i of this.#te.keys())i.drag(t,e)}rebuild(t){if(null===t.parent){let e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||1===this.#tE.size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#j===t}getActive(){return this.#j}getMode(){return this.#tx}isEditingMode(){return this.#tx!==p.NONE}get imageManager(){return P(this,"imageManager",new tM)}getSelectionBoxes(t){let e;if(!t)return null;let i=document.getSelection();for(let e=0,r=i.rangeCount;e<r;e++)if(!t.contains(i.getRangeAt(e).commonAncestorContainer))return null;let{x:r,y:s,width:n,height:a}=t.getBoundingClientRect();switch(t.getAttribute("data-main-rotation")){case"90":e=(t,e,i,o)=>({x:(e-s)/a,y:1-(t+i-r)/n,width:o/a,height:i/n});break;case"180":e=(t,e,i,o)=>({x:1-(t+i-r)/n,y:1-(e+o-s)/a,width:i/n,height:o/a});break;case"270":e=(t,e,i,o)=>({x:1-(e+o-s)/a,y:(t-r)/n,width:o/a,height:i/n});break;default:e=(t,e,i,o)=>({x:(t-r)/n,y:(e-s)/a,width:i/n,height:o/a})}let o=[];for(let t=0,r=i.rangeCount;t<r;t++){let r=i.getRangeAt(t);if(!r.collapsed)for(let{x:t,y:i,width:s,height:n}of r.getClientRects())0!==s&&0!==n&&o.push(e(t,i,s,n))}return 0===o.length?null:o}addChangedExistingAnnotation({annotationElementId:t,id:e}){(this.#X||=new Map).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){this.#X?.delete(t)}renderAnnotationElement(t){let e=this.#X?.get(t.data.id);if(!e)return;let i=this.#K.getRawValue(e);i&&(this.#tx!==p.NONE||i.hasBeenModified)&&i.renderAnnotationElement(t)}setMissingCanvas(t,e,i){let r=this.#tA?.get(t);r&&(r.setCanvas(e,i),this.#tA.delete(t))}addMissingCanvas(t,e){(this.#tA||=new Map).set(t,e)}}class tR{#g=null;#t5=!1;#t3=null;#t6=null;#t4=null;#t9=null;#t8=!1;#t7=null;#u=null;#et=null;#ee=null;#ei=!1;static #er=null;static _l10n=null;constructor(t){this.#u=t,this.#ei=t._uiManager.useNewAltTextFlow,tR.#er||=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(t){tR._l10n??=t}async render(){let t=this.#t3=document.createElement("button");t.className="altText",t.tabIndex="0";let e=this.#t6=document.createElement("span");t.append(e),this.#ei?(t.classList.add("new"),t.setAttribute("data-l10n-id",tR.#er.missing),e.setAttribute("data-l10n-id",tR.#er["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));let i=this.#u._uiManager._signal;t.addEventListener("contextmenu",ts,{signal:i}),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});let r=t=>{t.preventDefault(),this.#u._uiManager.editAltText(this.#u),this.#ei&&this.#u._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#es}})};return t.addEventListener("click",r,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&(this.#t8=!0,r(e))},{signal:i}),await this.#en(),t}get #es(){return this.#g&&"added"||null===this.#g&&this.guessedText&&"review"||"missing"}finish(){this.#t3&&(this.#t3.focus({focusVisible:this.#t8}),this.#t8=!1)}isEmpty(){return this.#ei?null===this.#g:!this.#g&&!this.#t5}hasData(){return this.#ei?null!==this.#g||!!this.#et:this.isEmpty()}get guessedText(){return this.#et}async setGuessedText(t){null===this.#g&&(this.#et=t,this.#ee=await tR._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t}),this.#en())}toggleAltTextBadge(t=!1){if(!this.#ei||this.#g){this.#t7?.remove(),this.#t7=null;return}if(!this.#t7){let t=this.#t7=document.createElement("div");t.className="noAltTextBadge",this.#u.div.append(t)}this.#t7.classList.toggle("hidden",!t)}serialize(t){let e=this.#g;return t||this.#et!==e||(e=this.#ee),{altText:e,decorative:this.#t5,guessedText:this.#et,textWithDisclaimer:this.#ee}}get data(){return{altText:this.#g,decorative:this.#t5}}set data({altText:t,decorative:e,guessedText:i,textWithDisclaimer:r,cancel:s=!1}){i&&(this.#et=i,this.#ee=r),(this.#g!==t||this.#t5!==e)&&(s||(this.#g=t,this.#t5=e),this.#en())}toggle(t=!1){this.#t3&&(!t&&this.#t9&&(clearTimeout(this.#t9),this.#t9=null),this.#t3.disabled=!t)}shown(){this.#u._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#es}})}destroy(){this.#t3?.remove(),this.#t3=null,this.#t6=null,this.#t4=null,this.#t7?.remove(),this.#t7=null}async #en(){let t=this.#t3;if(!t)return;
vendor: 5,473 bytes, line 2
2if(this.#ei){if(t.classList.toggle("done",!!this.#g),t.setAttribute("data-l10n-id",tR.#er[this.#es]),this.#t6?.setAttribute("data-l10n-id",tR.#er[`${this.#es}-label`]),!this.#g)return void this.#t4?.remove()}else{if(!this.#g&&!this.#t5){t.classList.remove("done"),this.#t4?.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=this.#t4;if(!e){this.#t4=e=document.createElement("span"),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${this.#u.id}`;let i=this.#u._uiManager._signal;i.addEventListener("abort",()=>{clearTimeout(this.#t9),this.#t9=null},{once:!0}),t.addEventListener("mouseenter",()=>{this.#t9=setTimeout(()=>{this.#t9=null,this.#t4.classList.add("show"),this.#u._reportTelemetry({action:"alt_text_tooltip"})},100)},{signal:i}),t.addEventListener("mouseleave",()=>{this.#t9&&(clearTimeout(this.#t9),this.#t9=null),this.#t4?.classList.remove("show")},{signal:i})}this.#t5?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=this.#g),e.parentNode||t.append(e);let i=this.#u.getElementForAltText();i?.setAttribute("aria-describedby",e.id)}}class tL{#ea=null;#eo=null;#el=!1;#u=null;#eh=null;#ed=null;#ec=null;#eu=null;#ep=!1;#eg=null;constructor(t){this.#u=t}renderForToolbar(){let t=this.#eo=document.createElement("button");return t.className="comment",this.#_(t,!1)}renderForStandalone(){let t=this.#ea=document.createElement("button");t.className="annotationCommentButton";let e=this.#u.commentButtonPosition;if(e){let{style:i}=t;i.insetInlineEnd=`calc(${100*("ltr"===this.#u._uiManager.direction?1-e[0]:e[0])}% - var(--comment-button-dim))`,i.top=`calc(${100*e[1]}% - var(--comment-button-dim))`;let r=this.#u.commentButtonColor;r&&(i.backgroundColor=r)}return this.#_(t,!0)}focusButton(){setTimeout(()=>{(this.#ea??this.#eo)?.focus()},0)}onUpdatedColor(){if(!this.#ea)return;let t=this.#u.commentButtonColor;t&&(this.#ea.style.backgroundColor=t),this.#u._uiManager.updatePopupColor(this.#u)}get commentButtonWidth(){return(this.#ea?.getBoundingClientRect().width??0)/this.#u.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#eg)return this.#eg;if(!this.#ea)return null;let{x:t,y:e,height:i}=this.#ea.getBoundingClientRect(),{x:r,y:s,width:n,height:a}=this.#u.parent.boundingClientRect;return[(t-r)/n,(e+i-s)/a]}set commentPopupPositionInLayer(t){this.#eg=t}hasDefaultPopupPosition(){return null===this.#eg}removeStandaloneCommentButton(){this.#ea?.remove(),this.#ea=null}removeToolbarCommentButton(){this.#eo?.remove(),this.#eo=null}setCommentButtonStates({selected:t,hasPopup:e}){this.#ea&&(this.#ea.classList.toggle("selected",t),this.#ea.ariaExpanded=e)}#_(t,e){if(!this.#u._uiManager.hasCommentManager())return null;t.tabIndex="0",t.ariaHasPopup="dialog",e?(t.ariaControls="commentPopup",t.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(t.ariaControlsElements=[this.#u._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));let i=this.#u._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return t;t.addEventListener("contextmenu",ts,{signal:i}),e&&(t.addEventListener("focusin",t=>{this.#u._focusEventsAllowed=!1,tn(t)},{capture:!0,signal:i}),t.addEventListener("focusout",t=>{this.#u._focusEventsAllowed=!0,tn(t)},{capture:!0,signal:i})),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});let r=e=>{e.preventDefault(),t===this.#eo?this.edit():this.#u.toggleComment(!0)};return t.addEventListener("click",r,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&(this.#el=!0,r(e))},{signal:i}),t.addEventListener("pointerenter",()=>{this.#u.toggleComment(!1,!0)},{signal:i}),t.addEventListener("pointerleave",()=>{this.#u.toggleComment(!1,!1)},{signal:i}),t}edit(t){let e,i,r=this.commentPopupPositionInLayer;if(r)[e,i]=r;else{[e,i]=this.#u.commentButtonPosition;let{width:t,height:r,x:s,y:n}=this.#u;e=s+e*t,i=n+i*r}let s=this.#u.parent.boundingClientRect,{x:n,y:a,width:o,height:l}=s;this.#u._uiManager.editComment(this.#u,n+e*o,a+i*l,{...t,parentDimensions:s})}finish(){this.#eo&&(this.#eo.focus({focusVisible:this.#el}),this.#el=!1)}isDeleted(){return this.#ep||""===this.#ec}isEmpty(){return null===this.#ec}hasBeenEdited(){return this.isDeleted()||this.#ec!==this.#eh}serialize(){return this.data}get data(){return{text:this.#ec,richText:this.#ed,date:this.#eu,deleted:this.isDeleted()}}set data(t){if(t!==this.#ec&&(this.#ed=null),null===t){this.#ec="",this.#ep=!0;return}this.#ec=t,this.#eu=new Date,this.#ep=!1}restoreData({text:t,richText:e,date:i}){this.#ec=t,this.#ed=e,this.#eu=i,this.#ep=!1}setInitialText(t,e=null){this.#eh=t,this.data=t,this.#eu=null,this.#ed=e}shown(){}destroy(){this.#eo?.remove(),this.#eo=null,this.#ea?.remove(),this.#ea=null,this.#ec="",this.#ed=null,this.#eu=null,this.#u=null,this.#el=!1,this.#ep=!1}}class tB{#tk;#em=!1;#ef=null;#eb;#ev;#ey;#eA;#ew=null;#ex;#eE=null;#eS;#e_=null;constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:i=null,onPinchStart:r=null,onPinching:s=null,onPinchEnd:n=null,signal:a}){this.#tk=t,this.#ef=i,this.#eb=e,this.#ev=r,this.#ey=s,this.#eA=n,this.#eS=new AbortController,this.#ex=AbortSignal.any([a,this.#eS.signal]),t.addEventListener("touchstart",this.#eT.bind(this),{passive:!1,signal:this.#ex})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/tc.pixelRatio}
2#eT(t){if(this.#eb?.())return;if(1===t.touches.length){if(this.#ew)return;let t=this.#ew=new AbortController,e=AbortSignal.any([this.#ex,t.signal]),i=this.#tk,r={capture:!0,signal:e,passive:!1},s=t=>{"touch"===t.pointerType&&(this.#ew?.abort(),this.#ew=null)};i.addEventListener("pointerdown",t=>{"touch"===t.pointerType&&(tn(t),s(t))},r),i.addEventListener("pointerup",s,r),i.addEventListener("pointercancel",s,r);return}if(!this.#e_){this.#e_=new AbortController;let t=AbortSignal.any([this.#ex,this.#e_.signal]),e=this.#tk,i={signal:t,capture:!1,passive:!1};e.addEventListener("touchmove",this.#eC.bind(this),i);let r=this.#eM.bind(this);e.addEventListener("touchend",r,i),e.addEventListener("touchcancel",r,i),i.capture=!0,e.addEventListener("pointerdown",tn,i),e.addEventListener("pointermove",tn,i),e.addEventListener("pointercancel",tn,i),e.addEventListener("pointerup",tn,i),this.#ev?.()}if(tn(t),2!==t.touches.length||this.#ef?.()){this.#eE=null;return}let[e,i]=t.touches;e.identifier>i.identifier&&([e,i]=[i,e]),this.#eE={touch0X:e.screenX,touch0Y:e.screenY,touch1X:i.screenX,touch1Y:i.screenY}}#eC(t){if(!this.#eE||2!==t.touches.length)return;tn(t);let[e,i]=t.touches;e.identifier>i.identifier&&([e,i]=[i,e]);let{screenX:r,screenY:s}=e,{screenX:n,screenY:a}=i,o=this.#eE,{touch0X:l,touch0Y:h,touch1X:d,touch1Y:c}=o,u=Math.hypot(n-r,a-s)||1,p=Math.hypot(d-l,c-h)||1;if(!this.#em&&Math.abs(p-u)<=tB.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(o.touch0X=r,o.touch0Y=s,o.touch1X=n,o.touch1Y=a,!this.#em){this.#em=!0;return}let g=[(r+n)/2,(s+a)/2];this.#ey?.(g,p,u)}#eM(t){!(t.touches.length>=2)&&(this.#e_&&(this.#e_.abort(),this.#e_=null,this.#eA?.()),this.#eE&&(tn(t),this.#eE=null,this.#em=!1))}destroy(){this.#eS?.abort(),this.#eS=null,this.#ew?.abort(),this.#ew=null}}class tF{#eD=null;#eP=null;#g=null;#m=null;#ea=null;#eI=!1;#ek=null;#eR="";#eL=null;#eB=null;#eF=null;#eO=null;#eN=null;#eU="";#ez=!1;#eH=null;#ej=!1;#e$=!1;#eG=!1;#eV=null;#eW=0;#eK=0;#eX=null;#eq=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#eY=!1;#eQ=tF._zIndex++;static _borderLineWidth=-1;static _colorManager=new tI;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let t=tF.prototype._resizeWithKeyboard,e=tk.TRANSLATE_SMALL,i=tk.TRANSLATE_BIG;return P(this,"_resizerKeyboardManager",new tP([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],tF.prototype._stopResizingWithKeyboard]]))}constructor(t){this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null,this.annotationElementId=t.annotationElementId||null,this.creationDate=t.creationDate||new Date,this.modificationDate=t.modificationDate||null,this.canAddComment=!0;let{rotation:e,rawDims:{pageWidth:i,pageHeight:r,pageX:s,pageY:n}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,r],this.pageTranslation=[s,n];let[a,o]=this.parentDimensions;this.x=t.x/a,this.y=t.y/o,this.isAttachedToDOM=!1,this.deleted=!1}updatePageIndex(t){this.pageIndex=t}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 P(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new tO({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(tF._l10n??=t,tF._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"}),-1!==tF._borderLineWidth)return;let i=getComputedStyle(document.documentElement);tF._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){T("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#eY}set _isDraggable(t){this.#eY=t,this.div?.classList.toggle("draggable",t)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}
vendor: 5,951 bytes, line 2
2setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#eQ}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(this.#eJ(),this.#eO?.remove(),this.#eO=null),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#ez?this.#ez=!1:this.parent.setSelected(this))}focusout(t){if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;let e=t.relatedTarget;!e?.closest(`#${this.id}`)&&(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,r){let[s,n]=this.parentDimensions;[i,r]=this.screenToPageTranslation(i,r),this.x=(t+i)/s,this.y=(e+r)/n,this.fixAndSetPosition()}_moveAfterPaste(t,e){let[i,r]=this.parentDimensions;this.setAt(t*i,e*r,this.width*i,this.height*r),this._onTranslated()}#eZ([t,e],i,r){[i,r]=this.screenToPageTranslation(i,r),this.x+=i/t,this.y+=r/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(t,e){this.#eZ(this.parentDimensions,t,e)}translateInPage(t,e){this.#eH||=[this.x,this.y,this.width,this.height],this.#eZ(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){this.#eH||=[this.x,this.y,this.width,this.height];let{div:i,parentDimensions:[r,s]}=this;if(this.x+=t/r,this.y+=e/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:n,y:a}=this,[o,l]=this.getBaseTranslation();n+=o,a+=l;let{style:h}=i;h.left=`${(100*n).toFixed(2)}%`,h.top=`${(100*a).toFixed(2)}%`,this._onTranslating(n,a),i.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!this.#eH&&(this.#eH[0]!==this.x||this.#eH[1]!==this.y)}get _hasBeenResized(){return!!this.#eH&&(this.#eH[2]!==this.width||this.#eH[3]!==this.height)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:i}=tF,r=i/t,s=i/e;switch(this.rotation){case 90:return[-r,s];case 180:return[r,s];case 270:return[r,-s];default:return[-r,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){let{div:{style:e},pageDimensions:[i,r]}=this,{x:s,y:n,width:a,height:o}=this;if(a*=i,o*=r,s*=i,n*=r,this._mustFixPosition)switch(t){case 0:s=W(s,0,i-a),n=W(n,0,r-o);break;case 90:s=W(s,0,i-o),n=W(n,a,r);break;case 180:s=W(s,a,i),n=W(n,o,r);break;case 270:s=W(s,o,i),n=W(n,0,r-a)}this.x=s/=i,this.y=n/=r;let[l,h]=this.getBaseTranslation();s+=l,n+=h,e.left=`${(100*s).toFixed(2)}%`,e.top=`${(100*n).toFixed(2)}%`,this.moveInDOM()}static #e0(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}screenToPageTranslation(t,e){return tF.#e0(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return tF.#e0(t,e,360-this.parentRotation)}#e1(t){switch(t){case 90:{let[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{let[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:t,pageDimensions:[e,i]}=this;return[e*t,i*t]}setDims(){let{div:{style:t},width:e,height:i}=this;t.width=`${(100*e).toFixed(2)}%`,t.height=`${(100*i).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#e2(){if(this.#eL)return;this.#eL=document.createElement("div"),this.#eL.classList.add("resizers");let t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(let i of t){let t=document.createElement("div");this.#eL.append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",this.#e5.bind(this,i),{signal:e}),t.addEventListener("contextmenu",ts,{signal:e}),t.tabIndex=-1}this.div.prepend(this.#eL)}#e5(t,e){e.preventDefault();let{isMac:i}=U.platform;if(0!==e.button||e.ctrlKey&&i)return;this.#g?.toggle(!1);let r=this._isDraggable;this._isDraggable=!1,this.#eB=[e.screenX,e.screenY];let s=new AbortController,n=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#e3.bind(this,t),{passive:!0,capture:!0,signal:n}),window.addEventListener("touchmove",tn,{passive:!1,signal:n}),window.addEventListener("contextmenu",ts,{signal:n}),this.#eF={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let a=this.parent.div.style.cursor,o=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;let l=()=>{s.abort(),this.parent.togglePointerEvents(!0),this.#g?.toggle(!0),this._isDraggable=r,this.parent.div.style.cursor=a,this.div.style.cursor=o,this.#e6()};window.addEventListener("pointerup",l,{signal:n}),window.addEventListener("blur",l,{signal:n})}#e4(t,e,i,r){this.width=i,this.height=r,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#e6(){if(!this.#eF)return;let{savedX:t,savedY:e,savedWidth:i,savedHeight:r}=this.#eF;this.#eF=null;let s=this.x,n=this.y,a=this.width,o=this.height;(s!==t||n!==e||a!==i||o!==r)&&this.addCommands({cmd:this.#e4.bind(this,s,n,a,o),undo:this.#e4.bind(this,t,e,i,r),mustExec:!0})}static _round(t){return Math.round(1e4*t)/1e4}#e3(t,e){let i,r,s,n,a,o,[l,h]=this.parentDimensions,d=this.x,c=this.y,u=this.width,p=this.height,g=tF.MIN_SIZE/l,m=tF.MIN_SIZE/h,f=this.#e1(this.rotation),b=(t,e)=>[f[0]*t+f[2]*e,f[1]*t+f[3]*e],v=this.#e1(360-this.rotation),y=!1,A=!1;switch(t){case"topLeft":y=!0,i=(t,e)=>
2[0,0],r=(t,e)=>[t,e];break;case"topMiddle":i=(t,e)=>[t/2,0],r=(t,e)=>[t/2,e];break;case"topRight":y=!0,i=(t,e)=>[t,0],r=(t,e)=>[0,e];break;case"middleRight":A=!0,i=(t,e)=>[t,e/2],r=(t,e)=>[0,e/2];break;case"bottomRight":y=!0,i=(t,e)=>[t,e],r=(t,e)=>[0,0];break;case"bottomMiddle":i=(t,e)=>[t/2,e],r=(t,e)=>[t/2,0];break;case"bottomLeft":y=!0,i=(t,e)=>[0,e],r=(t,e)=>[t,0];break;case"middleLeft":A=!0,i=(t,e)=>[0,e/2],r=(t,e)=>[t,e/2]}let w=i(u,p),x=r(u,p),E=b(...x),S=tF._round(d+E[0]),_=tF._round(c+E[1]),T=1,C=1;if(e.fromKeyboard)({deltaX:s,deltaY:n}=e);else{let{screenX:t,screenY:i}=e,[r,a]=this.#eB;[s,n]=this.screenToPageTranslation(t-r,i-a),this.#eB[0]=t,this.#eB[1]=i}if([s,n]=(a=s/l,o=n/h,[v[0]*a+v[2]*o,v[1]*a+v[3]*o]),y){let t=Math.hypot(u,p);T=C=Math.max(Math.min(Math.hypot(x[0]-w[0]-s,x[1]-w[1]-n)/t,1/u,1/p),g/u,m/p)}else A?T=W(Math.abs(x[0]-w[0]-s),g,1)/u:C=W(Math.abs(x[1]-w[1]-n),m,1)/p;let M=tF._round(u*T),D=tF._round(p*C),P=S-(E=b(...r(M,D)))[0],I=_-E[1];this.#eH||=[this.x,this.y,this.width,this.height],this.width=M,this.height=D,this.x=P,this.y=I,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#g?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#e$)return this._editToolbar;this._editToolbar=new tE(this),this.div.append(this._editToolbar.render());let{toolbarButtons:t}=this;if(t)for(let[e,i]of t)await this._editToolbar.addButton(e,i);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton("comment")}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,this.#g?.destroy()}addContainer(t){let e=this._editToolbar?.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return!this.#g&&(tR.initialize(tF._l10n),this.#g=new tR(this),this.#eD&&(this.#g.data=this.#eD,this.#eD=null)),this.#g}get altTextData(){return this.#g?.data}set altTextData(t){this.#g&&(this.#g.data=t)}get guessedAltText(){return this.#g?.guessedText}async setGuessedAltText(t){await this.#g?.setGuessedText(t)}serializeAltText(t){return this.#g?.serialize(t)}hasAltText(){return!!this.#g&&!this.#g.isEmpty()}hasAltTextData(){return this.#g?.hasData()??!1}focusCommentButton(){this.#m?.focusButton()}addCommentButton(){return this.canAddComment?this.#m||=new tL(this):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(this.#ea){this._uiManager.isEditingMode()&&this.#ea.classList.remove("hidden");return}this.hasComment&&(this.#ea=this.#m.renderForStandalone(),this.div.append(this.#ea))}}removeStandaloneCommentButton(){this.#m.removeStandaloneCommentButton(),this.#ea=null}hideStandaloneCommentButton(){this.#ea?.classList.add("hidden")}get comment(){if(!this.#m)return null;let{data:{richText:t,text:e,date:i,deleted:r}}=this.#m;return{text:e,richText:t,date:i,deleted:r,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){this.#m||=new tL(this),"object"==typeof t&&null!==t?this.#m.restoreData(t):this.#m.data=t,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:t,popupRef:e,richText:i}){if(!e||(this.#m||=new tL(this),this.#m.setInitialText(t,i),!this.annotationElementId))return;let r=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);r&&this.updateFromAnnotationLayer(r)}get hasEditedComment(){return this.#m?.hasBeenEdited()}get hasDeletedComment(){return this.#m?.isDeleted()}get hasComment(){return!!this.#m&&!this.#m.isEmpty()&&!this.#m.isDeleted()}async editComment(t){this.#m||=new tL(this),this.#m.edit(t)}toggleComment(t,e){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){this.#m.setSelectedButton(t)}addComment(t){if(this.hasEditedComment){let[,,,e]=t.rect,[i]=this.pageDimensions,[r]=this.pageTranslation,s=r+i+1;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[s,e-100,s+180,e]}}}updateFromAnnotationLayer({popup:{contents:t,deleted:e}}){this.#m.data=e?null:t}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let t=this.div=document.createElement("div");t.setAttribute("data-editor-rotation",(360-this.rotation)%360),t.className=this.name,t.setAttribute("id",this.id),t.tabIndex=this.#eI?-1:0,t.setAttribute("role","application"),this.defaultL10nId&&t.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||t.classList.add("hidden"),this.setInForeground(),this.#e9();let[e,i]=this.parentDimensions;this.parentRotation%180!=0&&(t.style.maxWidth=`${(100*i/e).toFixed(2)}%`,t.style.maxHeight=`${(100*e/i).toFixed(2)}%`);let[r,s]=this.getInitialTranslation();return this.translate(r,s),t_(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(this.#eq||=new tB({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#e8.bind(this),onPinching:this.#e7.bind(this),onPinchEnd:this.#it.bind(this),signal:this._uiManager._signal})),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),t}#e8(){this.#eF={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#g?.toggle(!1),this.parent.togglePointerEvents(!1)}#e7(t,e,i){let r=i/e*.7+1-.7;
2if(1===r)return;let s=this.#e1(this.rotation),n=(t,e)=>[s[0]*t+s[2]*e,s[1]*t+s[3]*e],[a,o]=this.parentDimensions,l=this.x,h=this.y,d=this.width,c=this.height;r=Math.max(Math.min(r,1/d,1/c),tF.MIN_SIZE/a/d,tF.MIN_SIZE/o/c);let u=tF._round(d*r),p=tF._round(c*r);if(u===d&&p===c)return;this.#eH||=[l,h,d,c];let g=n(d/2,c/2),m=tF._round(l+g[0]),f=tF._round(h+g[1]),b=n(u/2,p/2);this.x=m-b[0],this.y=f-b[1],this.width=u,this.height=p,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#it(){this.#g?.toggle(!0),this.parent.togglePointerEvents(!0),this.#e6()}pointerdown(t){let{isMac:e}=U.platform;return 0!==t.button||t.ctrlKey&&e?void t.preventDefault():(this.#ez=!0,this._isDraggable)?void this.#ie(t):void this.#ii(t)}#ii(t){let{isMac:e}=U.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#ie(t){let{isSelected:e}=this;this._uiManager.setUpDragSession();let i=!1,r=new AbortController,s=this._uiManager.combinedSignal(r),n={capture:!0,passive:!1,signal:s},a=t=>{r.abort(),this.#ek=null,this.#ez=!1,this._uiManager.endDragSession()||this.#ii(t),i&&this._onStopDragging()};e&&(this.#eW=t.clientX,this.#eK=t.clientY,this.#ek=t.pointerId,this.#eR=t.pointerType,window.addEventListener("pointermove",t=>{i||(i=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:e,clientY:r,pointerId:s}=t;if(s!==this.#ek)return void tn(t);let[n,a]=this.screenToPageTranslation(e-this.#eW,r-this.#eK);this.#eW=e,this.#eK=r,this._uiManager.dragSelectedEditors(n,a)},n),window.addEventListener("touchmove",tn,n),window.addEventListener("pointerdown",t=>{t.pointerType===this.#eR&&(this.#eq||t.isPrimary)&&a(t),tn(t)},n));let o=t=>{if(!this.#ek||this.#ek===t.pointerId)return void a(t);tn(t)};window.addEventListener("pointerup",o,{signal:s}),window.addEventListener("blur",o,{signal:s})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#eV&&clearTimeout(this.#eV),this.#eV=setTimeout(()=>{this.#eV=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,i=this.rotation){let r=this.parentScale,[s,n]=this.pageDimensions,[a,o]=this.pageTranslation,l=t/r,h=e/r,d=this.x*s,c=this.y*n,u=this.width*s,p=this.height*n;switch(i){case 0:return[d+l+a,n-c-h-p+o,d+l+u+a,n-c-h+o];case 90:return[d+h+a,n-c+l+o,d+h+p+a,n-c+l+u+o];case 180:return[d-l-u+a,n-c+h+o,d-l+a,n-c+h+p+o];case 270:return[d-h-p+a,n-c-l-u+o,d-h+a,n-c-l+o];default:throw Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[i,r,s,n]=t,a=s-i,o=n-r;switch(this.rotation){case 0:return[i,e-n,a,o];case 90:return[i,e-r,o,a];case 180:return[s,e-r,a,o];case 270:return[s,e-n,o,a];default:throw Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&tF._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#m?.onUpdatedColor()}getData(){let{comment:{text:t,color:e,date:i,opacity:r,deleted:s,richText:n},uid:a,pageIndex:o,creationDate:l,modificationDate:h}=this;return{id:a,pageIndex:o,rect:this.getPDFRect(),richText:n,contentsObj:{str:t},creationDate:l,modificationDate:i||h,popupRef:!s,color:e,opacity:r}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return!this.isInEditMode()&&(this.parent.setEditingState(!1),this.#e$=!0,!0)}disableEditMode(){return!!this.isInEditMode()&&(this.parent.setEditingState(!0),this.#e$=!1,!0)}isInEditMode(){return this.#e$}shouldGetKeyboardEvents(){return this.#eG}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:t,left:e,bottom:i,right:r}=this.getClientDimensions(),{innerHeight:s,innerWidth:n}=window;return e<n&&r>0&&t<s&&i>0}#e9(){if(this.#eN||!this.div)return;this.#eN=new AbortController;let t=this._uiManager.combinedSignal(this.#eN);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}rebuild(){this.#e9()}rotate(t){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(t=!1,e=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||""}}static async deserialize(t,e,i){let r=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});r.rotation=t.rotation,r.#eD=t.accessibilityData,r._isCopy=t.isCopy||!1;let[s,n]=r.pageDimensions,[a,o,l,h]=r.getRectInCurrentCoords(t.rect,n);
vendor: 4,932 bytes, line 2
2return r.x=a/s,r.y=o/n,r.width=l/s,r.height=h/n,r}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){if(this.#eN?.abort(),this.#eN=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),this.#eV&&(clearTimeout(this.#eV),this.#eV=null),this.#eJ(),this.removeEditToolbar(),this.#eX){for(let t of this.#eX.values())clearTimeout(t);this.#eX=null}this.parent=null,this.#eq?.destroy(),this.#eq=null,this.#eO?.remove(),this.#eO=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#e2(),this.#eL.classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return"ltr"===this._uiManager.direction?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[t,e]}=this,[i,r,s,n]=this.getPDFRect();return[tF._round(i+(s-i)*t),tF._round(r+(n-r)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#m.commentPopupPositionInLayer}set commentPopupPosition(t){this.#m.commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return this.#m.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#m.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){this.#m?.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),this.#eF={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let e=this.#eL.children;if(!this.#eP){this.#eP=Array.from(e);let t=this.#ir.bind(this),i=this.#is.bind(this),r=this._uiManager._signal;for(let e of this.#eP){let s=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t,{signal:r}),e.addEventListener("blur",i,{signal:r}),e.addEventListener("focus",this.#ia.bind(this,s),{signal:r}),e.setAttribute("data-l10n-id",tF._l10nResizer[s])}}let i=this.#eP[0],r=0;for(let t of e){if(t===i)break;r++}let s=(360-this.rotation+this.parentRotation)%360/90*(this.#eP.length/4);if(s!==r){if(s<r)for(let t=0;t<r-s;t++)this.#eL.append(this.#eL.firstElementChild);else if(s>r)for(let t=0;t<s-r;t++)this.#eL.firstElementChild.before(this.#eL.lastElementChild);let t=0;for(let i of e){let e=this.#eP[t++].getAttribute("data-resizer-name");i.setAttribute("data-l10n-id",tF._l10nResizer[e])}}this.#io(0),this.#eG=!0,this.#eL.firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#ir(t){tF._resizerKeyboardManager.exec(this,t)}#is(t){this.#eG&&t.relatedTarget?.parentNode!==this.#eL&&this.#eJ()}#ia(t){this.#eU=this.#eG?t:""}#io(t){if(this.#eP)for(let e of this.#eP)e.tabIndex=t}_resizeWithKeyboard(t,e){this.#eG&&this.#e3(this.#eU,{deltaX:t,deltaY:e,fromKeyboard:!0})}#eJ(){this.#eG=!1,this.#io(-1),this.#e6()}_stopResizingWithKeyboard(){this.#eJ(),this.div.focus()}select(){return this.isSelected&&this._editToolbar?void this._editToolbar.show():(this.isSelected=!0,this.makeResizable(),this.div?.classList.add("selectedEditor"),this._editToolbar)?void(this._editToolbar?.show(),this.#g?.toggleAltTextBadge(!1)):void this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()})}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){this.isSelected&&(this.isSelected=!1,this.#eL?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#g?.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){"BUTTON"!==t.target.nodeName&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#ej}set isEditing(t){this.#ej=t,this.parent&&(t?(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(t,e=!1){if(e){this.#eX||=new Map;let{action:e}=t,i=this.#eX.get(e);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),this.#eX.delete(e),0===this.#eX.size&&(this.#eX=null)},tF._telemetryTimeout),this.#eX.set(e,i);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}
2show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#eI=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#eI=!0}updateFakeAnnotationElement(t){if(!this.#eO&&!this.deleted){this.#eO=t.addFakeAnnotation(this);return}if(this.deleted){this.#eO.remove(),this.#eO=null;return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&this.#eO.updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){let t=e;(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.before(e)}}else(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){let{firstElementChild:e}=t.container;e?.nodeName==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}}class tO extends tF{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}class tN{constructor(t){this.h1=t?0|t:0xc3d2e1f0,this.h2=t?0|t:0xc3d2e1f0}update(t){let e,i;if("string"==typeof t){e=new Uint8Array(2*t.length),i=0;for(let r=0,s=t.length;r<s;r++){let s=t.charCodeAt(r);s<=255?e[i++]=s:(e[i++]=s>>>8,e[i++]=255&s)}}else if(ArrayBuffer.isView(t))i=(e=t.slice()).byteLength;else throw Error("Invalid data format, must be a string or TypedArray.");let r=i>>2,s=i-4*r,n=new Uint32Array(e.buffer,0,r),a=0,o=0,l=this.h1,h=this.h2;for(let t=0;t<r;t++)1&t?(l^=a=0x1b873593*(a=(a=0xcc9e2d51*(a=n[t])&0xffff0000|11601*a&65535)<<15|a>>>17)&0xffff0000|13715*a&65535,l=5*(l=l<<13|l>>>19)+0xe6546b64):(h^=o=0x1b873593*(o=(o=0xcc9e2d51*(o=n[t])&0xffff0000|11601*o&65535)<<15|o>>>17)&0xffff0000|13715*o&65535,h=5*(h=h<<13|h>>>19)+0xe6546b64);switch(a=0,s){case 3:a^=e[4*r+2]<<16;case 2:a^=e[4*r+1]<<8;case 1:a^=e[4*r],a=0x1b873593*(a=(a=0xcc9e2d51*a&0xffff0000|11601*a&65535)<<15|a>>>17)&0xffff0000|13715*a&65535,1&r?l^=a:h^=a}this.h1=l,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,e=0xff51afd7*e&0xffff0000|((e<<16|(t=0xed558ccd*t&0xffff0000|36045*t&65535)>>>16)*0xafd7ed55&0xffff0000)>>>16,t^=e>>>1,e=0xc4ceb9fe*e&0xffff0000|((e<<16|(t=0x1a85ec53*t&0xffff0000|60499*t&65535)>>>16)*0xb9fe1a85&0xffff0000)>>>16,((t^=e>>>1)>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}let tU=Object.freeze({map:null,hash:"",transfer:void 0});class tz{#il=!1;#ih=null;#id=null;#ic=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){let i=this.#ic.get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return this.#ic.get(t)}remove(t){let e=this.#ic.get(t);if(void 0!==e&&(e instanceof tF&&this.#id.delete(e.annotationElementId),this.#ic.delete(t),0===this.#ic.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor)){for(let t of this.#ic.values())if(t instanceof tF)return;this.onAnnotationEditor(null)}}setValue(t,e){let i=this.#ic.get(t),r=!1;if(void 0!==i)for(let[t,s]of Object.entries(e))i[t]!==s&&(r=!0,i[t]=s);else r=!0,this.#ic.set(t,e);r&&this.#iu(),e instanceof tF&&((this.#id||=new Map).set(e.annotationElementId,e),"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type))}has(t){return this.#ic.has(t)}get size(){return this.#ic.size}#iu(){this.#il||(this.#il=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#il&&(this.#il=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new tH(this)}get serializable(){if(0===this.#ic.size)return tU;let t=new Map,e=new tN,i=[],r=Object.create(null),s=!1;for(let[i,n]of this.#ic){let a=n instanceof tF?n.serialize(!1,r):n;n.page&&(n.pageIndex=n.page._pageIndex,delete n.page),a&&(t.set(i,a),e.update(`${i}:${JSON.stringify(a)}`),s||=!!a.bitmap)}if(s)for(let e of t.values())e.bitmap&&i.push(e.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:tU}get editorStats(){let t=null,e=new Map,i=0,r=0;for(let s of this.#ic.values()){if(!(s instanceof tF)){s.popup&&(s.popup.deleted?r+=1:i+=1);continue}s.isCommentDeleted?r+=1:s.hasEditedComment&&(i+=1);let n=s.telemetryFinalData;if(!n)continue;let{type:a}=n;e.has(a)||e.set(a,Object.getPrototypeOf(s).constructor),t||=Object.create(null);let o=t[a]||=new Map;for(let[t,e]of Object.entries(n)){if("type"===t)continue;let i=o.get(t);i||(i=new Map,o.set(t,i));let r=i.get(e)??0;i.set(e,r+1)}}if((r>0||i>0)&&((t||=Object.create(null)).comments={deleted:r,edited:i}),!t)return null;for(let[i,r]of e)t[i]=r.computeTelemetryFinalData(t[i]);return t}resetModifiedIds(){this.#ih=null}updateEditor(t,e){let i=this.#id?.get(t);return!!i&&(i.updateFromAnnotationLayer(e),!0)}getEditor(t){return this.#id?.get(t)||null}get modifiedIds(){if(this.#ih)return this.#ih;let t=[];
2if(this.#id)for(let e of this.#id.values())e.serialize()&&t.push(e.annotationElementId);return this.#ih={ids:new Set(t),hash:t.join(",")}}[Symbol.iterator](){return this.#ic.entries()}}class tH extends tz{#ip;constructor(t){super();let{map:e,hash:i,transfer:r}=t.serializable,s=structuredClone(e,r?{transfer:r}:null);this.#ip={map:s,hash:i,transfer:r}}get print(){T("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#ip}get modifiedIds(){return P(this,"modifiedIds",{ids:new Set,hash:""})}}class tj{#ig=new Set;constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));let e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(let t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),this.#ig.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:i}){if(!(!t||this.#ig.has(t.loadedName))){if(C(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:e,src:r,style:s}=t,n=new FontFace(e,r,s);this.addNativeFontFace(n);try{await n.load(),this.#ig.add(e),i?.(t)}catch{_(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(n)}return}T("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo)return void await this.loadSystemFont(t);if(this.isFontLoadingAPISupported){let e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(i){throw _(`Failed to load font '${e.family}': '${i}'.`),t.disableFontFace=!0,i}}return}let e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(e=>{let i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){return P(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){return P(this,"isSyncFontLoadingSupported",l||U.platform.isFirefox)}_queueLoadingCallback(t){let{loadingRequests:e}=this,i={done:!1,complete:function(){for(C(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;)setTimeout(e.shift().callback,0)},callback:t};return e.push(i),i}get _loadTestFont(){return P(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){var i;let r,s;function n(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function a(t,e,i,r){return t.substring(0,e)+r+t.substring(e+i)}let o=this._document.createElement("canvas");o.width=1,o.height=1;let l=o.getContext("2d"),h=0,d=`lt${Date.now()}${this.loadTestFontId++}`,c=this._loadTestFont,u=n(c=a(c,976,d.length,d),16);for(r=0,s=d.length-3;r<s;r+=4)u=u-0x58585858+n(d,r)|0;r<d.length&&(u=u-0x58585858+n(d+"XXX",r)|0),c=a(c,16,4,String.fromCharCode((i=u)>>24&255,i>>16&255,i>>8&255,255&i));let p=`url(data:font/opentype;base64,${btoa(c)});`,g=`@font-face {font-family:"${d}";src:${p}}`;this.insertRule(g);let m=this._document.createElement("div");for(let e of(m.style.visibility="hidden",m.style.width=m.style.height="10px",m.style.position="absolute",m.style.top=m.style.left="0px",[t.loadedName,d])){let t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=e,m.append(t)}this._document.body.append(m),function t(e,i){if(++h>30){_("Load test font never loaded."),i();return}if(l.font="30px "+e,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0)return void i();setTimeout(t.bind(null,e,i))}(d,()=>{m.remove(),e.complete()})}}class t${#im;constructor(t,e=null,i,r){this.compiledGlyphs=Object.create(null),this.#im=t,this._inspectFont=e,i&&Object.assign(this,i),r&&(this.charProcOperatorList=r)}createNativeFontFace(){let t;if(!this.data||this.disableFontFace)return null;if(this.cssFontInfo){let e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}else t=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),t}createFontFaceRule(){let t;if(!this.data||this.disableFontFace)return null;let e=`url(data:${this.mimetype};base64,${this.data.toBase64()});`;if(this.cssFontInfo){let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${e}}`}else t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;return this._inspectFont?.(this,e),t}getPathGenerator(t,e){let i;if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];let r=this.loadedName+"_path_"+e;try{i=t.get(r)}catch(t){_(`getPathGenerator - ignoring character: "${t}".`)}let s=tw(i?.path);return this.fontExtraProperties||t.delete(r),this.compiledGlyphs[e]=s}get black(){return this.#im.black}get bold(){return this.#im.bold}get disableFontFace(){return this.#im.disableFontFace??!1}set disableFontFace(t){P(this,"disableFontFace",!!t)}get fontExtraProperties(){return this.#im.fontExtraProperties??!1}get isInvalidPDFjsFont(){return this.#im.isInvalidPDFjsFont}get isType3Font(){return this.#im.isType3Font}get italic(){return this.#im.italic}get missingFile(){return this.#im.missingFile}get remeasure(){return this.#im.remeasure}get vertical(){return this.#im.vertical}get ascent(){return this.#im.ascent}get defaultWidth(){return this.#im.defaultWidth}get descent(){return this.#im.descent}get bbox(){return this.#im.bbox}set bbox(t){P(this,"bbox",t)}get fontMatrix(){return this.#im.fontMatrix}get fallbackName(){return this.#im.fallbackName}get loadedName(){return this.#im.loadedName}get mimetype(){return this.#im.mimetype}get name(){return this.#im.name}get data(){return this.#im.data}clearData(){this.#im.clearData()}get cssFontInfo(){return this.#im.cssFontInfo}get systemFontInfo(){return this.#im.systemFontInfo}get defaultVMetrics(){return this.#im.defaultVMetrics}}class tG{#ib;#iv;#iy;static strings=["fontFamily","fontWeight","italicAngle"];static write(t){let e=new TextEncoder,i={},r=0;for(let s of tG.strings){let n=e.encode(t[s]);i[s]=n,r+=4+n.length}let s=new ArrayBuffer(r),n=new Uint8Array(s),a=new DataView(s),o=0;for(let t of tG.strings){let e=i[t],r=e.length;a.setUint32(o,r),n.set(e,o+4),o+=4+r}return C(o===s.byteLength,"CssFontInfo.write: Buffer overflow"),s}constructor(t){this.#ib=t,this.#iv=new DataView(this.#ib),this.#iy=new TextDecoder}#iA(t){C(t<tG.strings.length,"Invalid string index");let e=0;for(let i=0;i<t;i++)e+=this.#iv.getUint32(e)+4;let i=this.#iv.getUint32(e);return this.#iy.decode(new Uint8Array(this.#ib,e+4,i))}get fontFamily(){return this.#iA(0)}get fontWeight(){return this.#iA(1)}get italicAngle(){return this.#iA(2)}}class tV{#ib;#iv;#iy;static strings=["css","loadedName","baseFontName","src"];static write(t){let e=new TextEncoder,i={},r=0;for(let s of tV.strings){let n=e.encode(t[s]);i[s]=n,r+=4+n.length}let s,n,a=1+(r+=4);t.style&&(s=e.encode(t.style.style),n=e.encode(t.style.weight),a+=4+s.length+4+n.length);let o=new ArrayBuffer(a),l=new Uint8Array(o),h=new DataView(o),d=0;for(let e of(h.setUint8(d++,+!!t.guessFallback),h.setUint32(d,0),d+=4,r=0,tV.strings)){let t=i[e],s=t.length;r+=4+s,h.setUint32(d,s),l.set(t,d+4),d+=4+s}return h.setUint32(d-r-4,r),t.style&&(h.setUint32(d,s.length),l.set(s,d+4),d+=4+s.length,h.setUint32(d,n.length),l.set(n,d+4),d+=4+n.length),C(d<=o.byteLength,"SubstitionInfo.write: Buffer overflow"),o.transferTo
2FixedLength(d)}constructor(t){this.#ib=t,this.#iv=new DataView(this.#ib),this.#iy=new TextDecoder}get guessFallback(){return 0!==this.#iv.getUint8(0)}#iA(t){C(t<tV.strings.length,"Invalid string index");let e=5;for(let i=0;i<t;i++)e+=this.#iv.getUint32(e)+4;let i=this.#iv.getUint32(e);return this.#iy.decode(new Uint8Array(this.#ib,e+4,i))}get css(){return this.#iA(0)}get loadedName(){return this.#iA(1)}get baseFontName(){return this.#iA(2)}get src(){return this.#iA(3)}get style(){let t=1;t+=4+this.#iv.getUint32(t);let e=this.#iv.getUint32(t),i=this.#iy.decode(new Uint8Array(this.#ib,t+4,e));t+=4+e;let r=this.#iv.getUint32(t),s=this.#iy.decode(new Uint8Array(this.#ib,t+4,r));return{style:i,weight:s}}}class tW{static bools=["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"];static numbers=["ascent","defaultWidth","descent"];static strings=["fallbackName","loadedName","mimetype","name"];static #iw=Math.ceil(2*this.bools.length/8);static #ix=this.#iw+8*this.numbers.length;static #iE=this.#ix+1+8;static #iS=this.#iE+1+48;static #i_=this.#iS+1+6;#ib;#iy;#iv;constructor({data:t,extra:e}){this.#ib=t,this.#iy=new TextDecoder,this.#iv=new DataView(this.#ib),e&&Object.assign(this,e)}#iT(t){C(t<tW.bools.length,"Invalid boolean index");let e=Math.floor(t/4),i=this.#iv.getUint8(e)>>2*t%8&3;return 0===i?void 0:2===i}get black(){return this.#iT(0)}get bold(){return this.#iT(1)}get disableFontFace(){return this.#iT(2)}get fontExtraProperties(){return this.#iT(3)}get isInvalidPDFjsFont(){return this.#iT(4)}get isType3Font(){return this.#iT(5)}get italic(){return this.#iT(6)}get missingFile(){return this.#iT(7)}get remeasure(){return this.#iT(8)}get vertical(){return this.#iT(9)}#iC(t){return C(t<tW.numbers.length,"Invalid number index"),this.#iv.getFloat64(tW.#iw+8*t)}get ascent(){return this.#iC(0)}get defaultWidth(){return this.#iC(1)}get descent(){return this.#iC(2)}get bbox(){let t=tW.#ix;if(0===this.#iv.getUint8(t))return;t+=1;let e=[];for(let i=0;i<4;i++)e.push(this.#iv.getInt16(t,!0)),t+=2;return e}get fontMatrix(){let t=tW.#iE;if(0===this.#iv.getUint8(t))return;t+=1;let e=[];for(let i=0;i<6;i++)e.push(this.#iv.getFloat64(t,!0)),t+=8;return e}get defaultVMetrics(){let t=tW.#iS;if(0===this.#iv.getUint8(t))return;t+=1;let e=[];for(let i=0;i<3;i++)e.push(this.#iv.getInt16(t,!0)),t+=2;return e}#iA(t){C(t<tW.strings.length,"Invalid string index");let e=tW.#i_+4;for(let i=0;i<t;i++)e+=this.#iv.getUint32(e)+4;let i=this.#iv.getUint32(e),r=new Uint8Array(i);return r.set(new Uint8Array(this.#ib,e+4,i)),this.#iy.decode(r)}get fallbackName(){return this.#iA(0)}get loadedName(){return this.#iA(1)}get mimetype(){return this.#iA(2)}get name(){return this.#iA(3)}get data(){let t=tW.#i_,e=this.#iv.getUint32(t);t+=4+e;let i=this.#iv.getUint32(t);t+=4+i;let r=this.#iv.getUint32(t);t+=4+r;let s=this.#iv.getUint32(t);if(0!==s)return new Uint8Array(this.#ib,t+4,s)}clearData(){let t=tW.#i_,e=this.#iv.getUint32(t);t+=4+e;let i=this.#iv.getUint32(t);t+=4+i;let r=this.#iv.getUint32(t);t+=4+r;let s=this.#iv.getUint32(t);new Uint8Array(this.#ib,t+4,s).fill(0),this.#iv.setUint32(t,0)}get cssFontInfo(){let t=tW.#i_,e=this.#iv.getUint32(t);t+=4+e;let i=this.#iv.getUint32(t);t+=4+i;let r=this.#iv.getUint32(t);if(0===r)return null;let s=new Uint8Array(r);return s.set(new Uint8Array(this.#ib,t+4,r)),new tG(s.buffer)}get systemFontInfo(){let t=tW.#i_,e=this.#iv.getUint32(t);t+=4+e;let i=this.#iv.getUint32(t);if(0===i)return null;let r=new Uint8Array(i);return r.set(new Uint8Array(this.#ib,t+4,i)),new tV(r.buffer)}static write(t){let e=t.systemFontInfo?tV.write(t.systemFontInfo):null,i=t.cssFontInfo?tG.write(t.cssFontInfo):null,r=new TextEncoder,s={},n=0;for(let e of tW.strings)s[e]=r.encode(t[e]),n+=4+s[e].length;let a=new ArrayBuffer(tW.#i_+4+n+4+(e?e.byteLength:0)+4+(i?i.byteLength:0)+4+(t.data?t.data.length:0)),o=new Uint8Array(a),l=new DataView(a),h=0,d=tW.bools.length,c=0,u=0;for(let e=0;e<d;e++){let i=t[tW.bools[e]];c|=(void 0===i?0:i?2:1)<<u,(8===(u+=2)||e===d-1)&&(l.setUint8(h++,c),c=0,u=0)}for(let e of(C(h===tW.#iw,"FontInfo.write: Boolean properties offset mismatch"),tW.numbers))l.setFloat64(h,t[e]),h+=8;if(C(h===tW.#ix,"FontInfo.write: Number properties offset mismatch"),t.bbox)for(let e of(l.setUint8(h++,4),t.bbox))l.setInt16(h,e,!0),h+=2;else l.setUint8(h++,0),h+=8;if(C(h===tW.#iE,"FontInfo.write: BBox properties offset mismatch"),t.fontMatrix)for(let e of(l.setUint8(h++,6),t.fontMatrix))l.setFloat64(h,e,!0),h+=8;else l.setUint8(h++,0),h+=48;if(C(h===tW.#iS,"FontInfo.write: FontMatrix properties offset mismatch"),t.defaultVMetrics)for(let e of(l.setUint8(h++,1),t.defaultVMetrics))l.setInt16(h,e,!0),h+=2;else l.setUint8(h++,0),h+=6;for(let t of(C(h===tW.#i_,"FontInfo.write: DefaultVMetrics properties offset mismatch"),l.setUint32(tW.#i_,0),h+=4,tW.strings)){let e=s[t],i=e.length;l.setUint32(h,i),o.set(e,h+4),h+=4+i}if(l.setUint32(tW.#i_,h-tW.#i_-4),e){let t=e.byteLength;l.setUint32(h,t),C(h+4+t<=a.byteLength,"FontInfo.write: Buffer overflow at systemFontInfo"),o.set(new Uint8Array(e),h+4),h+=4+t}else l.setUint32(h,0),h+=4;if(i){let t=i.byteLength;l.setUint32(h,t),C(h+4+t<=a.byteLength,"FontInfo.write: Buffer overflow at cssFontInfo"),o.set(new Uint8Array(i),h+4),h+=4+t}else l.setUint32(h,0),h+=4;return void 0===t.data?(l.setUint32(h,0),h+=4):(l.setUint32(h,t.data.length),o.set(t.data,h+4),h+=4+t.data.length),C(h<=a.byteLength,"FontInfo.write: Buffer overflow"),a.transferTo
2FixedLength(h)}}class tK{static #iM=0;static #iD=1;static #iP=2;static #iI=3;static #ik=4;static #iR=8;static #iL=12;static #iB=16;constructor(t){this.buffer=t,this.view=new DataView(t),this.data=new Uint8Array(t)}static write(t){let e,i=null,r=[],s=[],n=[],a=[],o=null,l=null;switch(t[0]){case"RadialAxial":e="axial"===t[1]?1:2,i=t[2],n=t[3],1===e?r.push(...t[4],...t[5]):r.push(t[4][0],t[4][1],t[6],t[5][0],t[5][1],t[7]);break;case"Mesh":e=3,o=t[1],r=t[2],s=t[3],a=t[4]||[],i=t[6],l=t[7];break;default:throw Error(`Unsupported pattern type: ${t[0]}`)}let h=Math.floor(r.length/2),d=Math.floor(s.length/3),c=n.length,u=a.length,p=0;for(let t of a)p+=1,p=4*Math.ceil(p/4)+(4+4*t.coords.length)+(4+4*t.colors.length),void 0!==t.verticesPerRow&&(p+=4);let g=new ArrayBuffer(20+8*h+3*d+8*c+16*!!i+3*!!l+p),m=new DataView(g),f=new Uint8Array(g);m.setUint8(tK.#iM,e),m.setUint8(tK.#iD,+!!i),m.setUint8(tK.#iP,+!!l),m.setUint8(tK.#iI,o),m.setUint32(tK.#ik,h,!0),m.setUint32(tK.#iR,d,!0),m.setUint32(tK.#iL,c,!0),m.setUint32(tK.#iB,u,!0);let b=20;for(let[t,e]of(new Float32Array(g,20,2*h).set(r),b+=8*h,f.set(s,b),b+=3*d,n)
2)m.setFloat32(b,t,!0),b+=4,m.setUint32(b,parseInt(e.slice(1),16),!0),b+=4;if(i)for(let t of i)m.setFloat32(b,t,!0),b+=4;l&&(f.set(l,b),b+=3);for(let t=0;t<a.length;t++){let e=a[t];m.setUint8(b,e.type),b+=1,b=4*Math.ceil(b/4),m.setUint32(b,e.coords.length,!0),new Int32Array(g,b+=4,e.coords.length).set(e.coords),b+=4*e.coords.length,m.setUint32(b,e.colors.length,!0),new Int32Array(g,b+=4,e.colors.length).set(e.colors),b+=4*e.colors.length,void 0!==e.verticesPerRow&&(m.setUint32(b,e.verticesPerRow,!0),b+=4)}return g}getIR(){let t=this.view,e=this.data[tK.#iM],i=!!this.data[tK.#iD],r=!!this.data[tK.#iP],s=t.getUint32(tK.#ik,!0),n=t.getUint32(tK.#iR,!0),a=t.getUint32(tK.#iL,!0),o=t.getUint32(tK.#iB,!0),l=20,h=new Float32Array(this.buffer,l,2*s);l+=8*s;let d=new Uint8Array(this.buffer,l,3*n);l+=3*n;let c=[];for(let e=0;e<a;++e){let e=t.getFloat32(l,!0);l+=4;let i=t.getUint32(l,!0);l+=4,c.push([e,`#${i.toString(16).padStart(6,"0")}`])}let u=null;if(i){u=[];for(let e=0;e<4;++e)u.push(t.getFloat32(l,!0)),l+=4}let p=null;r&&(p=new Uint8Array(this.buffer,l,3),l+=3);let g=[];for(let e=0;e<o;++e){let e=t.getUint8(l);l+=1,l=4*Math.ceil(l/4);let i=t.getUint32(l,!0);l+=4;let r=new Int32Array(this.buffer,l,i);l+=4*i;let s=t.getUint32(l,!0);l+=4;let n=new Int32Array(this.buffer,l,s);l+=4*s;let a={type:e,coords:r,colors:n};e===m.LATTICE&&(a.verticesPerRow=t.getUint32(l,!0),l+=4),g.push(a)}if(1===e)return["RadialAxial","axial",u,c,Array.from(h.slice(0,2)),Array.from(h.slice(2,4)),null,null];if(2===e)return["RadialAxial","radial",u,c,[h[0],h[1]],[h[3],h[4]],h[2],h[5]];if(3===e){let t=this.data[tK.#iI],e=null;if(h.length>0){let t=h[0],i=h[0],r=h[1],s=h[1];for(let e=0;e<h.length;e+=2){let n=h[e],a=h[e+1];t=t>n?n:t,r=r>a?a:r,i=i<n?n:i,s=s<a?a:s}e=[t,r,i,s]}return["Mesh",t,h,d,g,e,u,p]}throw Error(`Unsupported pattern kind: ${e}`)}}class tX{static write(t){let e;return(U.isFloat16ArraySupported?new Float16Array(e=new ArrayBuffer(2*t.length)):new Float32Array(e=new ArrayBuffer(4*t.length))).set(t),e}#ib;constructor(t){this.#ib=t}get path(){return U.isFloat16ArraySupported?new Float16Array(this.#ib):new Float32Array(this.#ib)}}function tq(t){if("string"!=typeof t)return null;if(t.endsWith("/"))return t;throw Error(`Invalid factory url: "${t}" must include trailing slash.`)}let tY=t=>"object"==typeof t&&Number.isInteger(t?.num)&&t.num>=0&&Number.isInteger(t?.gen)&&t.gen>=0,tQ=(function(t,e,i){if(!Array.isArray(i)||i.length<2)return!1;let[r,s,...n]=i;if(!t(r)&&!Number.isInteger(r)||!e(s))return!1;let a=n.length,o=!0;switch(s.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return 0===a;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(4!==a)return!1;o=!1;break;default:return!1}for(let t of n)if("number"!=typeof t&&(!o||null!==t))return!1;return!0}).bind(null,tY,t=>"object"==typeof t&&"string"==typeof t?.name);class tJ{#o=new Map;#iF=Promise.resolve();postMessage(t,e){let i={data:structuredClone(t,e?{transfer:e}:null)};this.#iF.then(()=>{for(let[t]of this.#o)t.call(this,i)})}addEventListener(t,e,i=null){let r=null;if(i?.signal instanceof AbortSignal){let{signal:s}=i;if(s.aborted)return void _("LoopbackPort - cannot use an `aborted` signal.");let n=()=>this.removeEventListener(t,e);r=()=>s.removeEventListener("abort",n),s.addEventListener("abort",n)}this.#o.set(e,r)}removeEventListener(t,e){let i=this.#o.get(e);i?.(),this.#o.delete(e)}terminate(){for(let[,t]of this.#o)t?.();this.#o.clear()}}o(1689);let tZ={DATA:1,ERROR:2},t0={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function t1(){}function t2(t){if(t instanceof O||t instanceof L||t instanceof k||t instanceof B||t instanceof R)return t;switch(!(t instanceof Error||"object"==typeof t&&null!==t)&&T('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new O(t.message);case"InvalidPDFException":return new L(t.message);case"PasswordException":return new k(t.message,t.code);case"ResponseException":return new B(t.message,t.status,t.missing);case"UnknownErrorException":return new R(t.message,t.details)}return new R(t.message,t.toString())}class t5{#iO=new AbortController;constructor(t,e,i){this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",this.#iN.bind(this),{signal:this.#iO.signal})}#iN({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream)return void this.#iU(t);if(t.callback){let e=t.callbackId,i=this.callbackCapabilities[e];if(!i)throw Error(`Cannot resolve callback ${e}`);if(delete this.callbackCapabilities[e],t.callback===tZ.DATA)i.resolve(t.data);else if(t.callback===tZ.ERROR)i.reject(t2(t.reason));else throw Error("Unexpected callback case");return}let e=this.actionHandler[t.action];if(!e)throw Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){let i=this.sourceName,r=t.sourceName,s=this.comObj;Promise.try(e,t.data).then(function(e){s.postMessage({sourceName:i,targetName:r,callback:tZ.DATA,callbackId:t.callbackId,data:e})},function(e){s.postMessage({sourceName:i,targetName:r,callback:tZ.ERROR,callbackId:t.callbackId,reason:t2(e)})});return}if(t.streamId)return void this.#iz(t);e(t.data)}on(t,e){let i=this.actionHandler;if(i[t])throw Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}
2sendWithPromise(t,e,i){let r=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[r]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:r,data:e},i)}catch(t){s.reject(t)}return s.promise}sendWithStream(t,e,i,r){let s=this.streamId++,n=this.sourceName,a=this.targetName,o=this.comObj;return new ReadableStream({start:i=>{let l=Promise.withResolvers();return this.streamControllers[s]={controller:i,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},o.postMessage({sourceName:n,targetName:a,action:t,streamId:s,data:e,desiredSize:i.desiredSize},r),l.promise},pull:t=>{let e=Promise.withResolvers();return this.streamControllers[s].pullCall=e,o.postMessage({sourceName:n,targetName:a,stream:t0.PULL,streamId:s,desiredSize:t.desiredSize}),e.promise},cancel:t=>{C(t instanceof Error,"cancel must have a valid reason");let e=Promise.withResolvers();return this.streamControllers[s].cancelCall=e,this.streamControllers[s].isClosed=!0,o.postMessage({sourceName:n,targetName:a,stream:t0.CANCEL,streamId:s,reason:t2(t)}),e.promise}},i)}#iz(t){let e=t.streamId,i=this.sourceName,r=t.sourceName,s=this.comObj,n=this,a=this.actionHandler[t.action],o={enqueue(t,n=1,a){if(this.isCancelled)return;let o=this.desiredSize;this.desiredSize-=n,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),s.postMessage({sourceName:i,targetName:r,stream:t0.ENQUEUE,streamId:e,chunk:t},a)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:r,stream:t0.CLOSE,streamId:e}),delete n.streamSinks[e])},error(t){C(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:r,stream:t0.ERROR,streamId:e,reason:t2(t)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};o.sinkCapability.resolve(),o.ready=o.sinkCapability.promise,this.streamSinks[e]=o,Promise.try(a,t.data,o).then(function(){s.postMessage({sourceName:i,targetName:r,stream:t0.START_COMPLETE,streamId:e,success:!0})},function(t){s.postMessage({sourceName:i,targetName:r,stream:t0.START_COMPLETE,streamId:e,reason:t2(t)})})}#iU(t){let e=t.streamId,i=this.sourceName,r=t.sourceName,s=this.comObj,n=this.streamControllers[e],a=this.streamSinks[e];switch(t.stream){case t0.START_COMPLETE:t.success?n.startCall.resolve():n.startCall.reject(t2(t.reason));break;case t0.PULL_COMPLETE:t.success?n.pullCall.resolve():n.pullCall.reject(t2(t.reason));break;case t0.PULL:if(!a){s.postMessage({sourceName:i,targetName:r,stream:t0.PULL_COMPLETE,streamId:e,success:!0});break}a.desiredSize<=0&&t.desiredSize>0&&a.sinkCapability.resolve(),a.desiredSize=t.desiredSize,Promise.try(a.onPull||t1).then(function(){s.postMessage({sourceName:i,targetName:r,stream:t0.PULL_COMPLETE,streamId:e,success:!0})},function(t){s.postMessage({sourceName:i,targetName:r,stream:t0.PULL_COMPLETE,streamId:e,reason:t2(t)})});break;case t0.ENQUEUE:if(C(n,"enqueue should have stream controller"),n.isClosed)break;n.controller.enqueue(t.chunk);break;case t0.CLOSE:if(C(n,"close should have stream controller"),n.isClosed)break;n.isClosed=!0,n.controller.close(),this.#iH(n,e);break;case t0.ERROR:C(n,"error should have stream controller"),n.controller.error(t2(t.reason)),this.#iH(n,e);break;case t0.CANCEL_COMPLETE:t.success?n.cancelCall.resolve():n.cancelCall.reject(t2(t.reason)),this.#iH(n,e);break;case t0.CANCEL:if(!a)break;let o=t2(t.reason);Promise.try(a.onCancel||t1,o).then(function(){s.postMessage({sourceName:i,targetName:r,stream:t0.CANCEL_COMPLETE,streamId:e,success:!0})},function(t){s.postMessage({sourceName:i,targetName:r,stream:t0.CANCEL_COMPLETE,streamId:e,reason:t2(t)})}),a.sinkCapability.reject(o),a.isCancelled=!0,delete this.streamSinks[e];break;default:throw Error("Unexpected stream case")}}async #iH(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.#iO?.abort(),this.#iO=null}}class t3{#ij=!1;constructor({enableHWA:t=!1}){this.#ij=t}create(t,e){if(t<=0||e<=0)throw Error("Invalid canvas size");let i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!this.#ij})}}reset(t,e,i){if(!t.canvas)throw Error("Canvas is not specified");if(e<=0||i<=0)throw Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){T("Abstract method `_createCanvas` called.")}}class t6 extends t3{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){let i=this._document.createElement("canvas");return i.width=t,i.height=e,i}}class t4{constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!t)throw Error("CMap name must be specified.");let e=this.baseUrl+t+(this.isCompressed?".bcmap":"");return this._fetch(e).then(t=>({cMapData:t,isCompressed:this.isCompressed})).catch(t=>{throw Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}async _fetch(t){T("Abstract method `_fetch` called.")}}class t9 extends t4{async _fetch(t){let e=await Q(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):N(e)}}o(2489);class t8{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,r,s){return"none"}destroy(t=!1){}}class t7 extends t8{#i$;#iG;#iV;#iW;#iK;#iX;#k=0;constructor({docId:t,ownerDocument:e=globalThis.document}){super(),this.#iW=t,this.#iK=e}get #L(){return this.#iG||=new Map}get #iq(){return this.#iX||=new Map}get #iY(){if(!this.#iV){let t=this.#iK.createElement("div"),{style:e}=t;e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;let i=this.#iK.createElementNS(q,"svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#iV=this.#iK.createElementNS(q,"defs"),t.append(i),i.append(this.#iV),this.#iK.body.append(t)}return this.#iV}#iQ(t){if(1===t.length){let e=t[0],i=Array(256);for(let t=0;t<256;t++)i[t]=e[t]/255;let r=i.join(",");return[r,r,r]}let[e,i,r]=t,s=Array(256),n=Array(256),a=Array(256);for(let t=0;t<256;t++)s[t]=e[t]/255,n[t]=i[t]/255,a[t]=r[t]/255;return[s.join(","),n.join(","),a.join(",")]}#iJ(t){if(void 0===this.#i$){this.#i$="";let t=this.#iK.URL;t!==this.#iK.baseURI&&(tt(t)?_('#createUrl: ignore "data:"-URL for performance reasons.'):this.#i$=D(t,""))}return`url(${this.#i$}#${t})`}addFilter(t){if(!t)return"none";let e=this.#L.get(t);if(e)return e;
2let[i,r,s]=this.#iQ(t),n=1===t.length?i:`${i}${r}${s}`;if(e=this.#L.get(n))return this.#L.set(t,e),e;let a=`g_${this.#iW}_transfer_map_${this.#k++}`,o=this.#iJ(a);this.#L.set(t,o),this.#L.set(n,o);let l=this.#iZ(a);return this.#i0(i,r,s,l),o}addHCMFilter(t,e){let i=`${t}-${e}`,r="base",s=this.#iq.get(r);if(s?.key===i||(s?(s.filter?.remove(),s.key=i,s.url="none",s.filter=null):(s={key:i,url:"none",filter:null},this.#iq.set(r,s)),!t||!e))return s.url;let n=this.#i1(t);t=H.makeHexColor(...n);let a=this.#i1(e);if(e=H.makeHexColor(...a),this.#iY.style.color="","#000000"===t&&"#ffffff"===e||t===e)return s.url;let o=Array(256);for(let t=0;t<=255;t++){let e=t/255;o[t]=e<=.03928?e/12.92:((e+.055)/1.055)**2.4}let l=o.join(","),h=`g_${this.#iW}_hcm_filter`,d=s.filter=this.#iZ(h);this.#i0(l,l,l,d),this.#i2(d);let c=(t,e)=>{let i=n[t]/255,r=a[t]/255,s=Array(e+1);for(let t=0;t<=e;t++)s[t]=i+t/e*(r-i);return s.join(",")};return this.#i0(c(0,5),c(1,5),c(2,5),d),s.url=this.#iJ(h),s.url}addAlphaFilter(t){let e=this.#L.get(t);if(e)return e;let[i]=this.#iQ([t]),r=`alpha_${i}`;if(e=this.#L.get(r))return this.#L.set(t,e),e;let s=`g_${this.#iW}_alpha_map_${this.#k++}`,n=this.#iJ(s);this.#L.set(t,n),this.#L.set(r,n);let a=this.#iZ(s);return this.#i5(i,a),n}addLuminosityFilter(t){let e,i,r=this.#L.get(t||"luminosity");if(r)return r;if(t?([e]=this.#iQ([t]),i=`luminosity_${e}`):i="luminosity",r=this.#L.get(i))return this.#L.set(t,r),r;let s=`g_${this.#iW}_luminosity_map_${this.#k++}`,n=this.#iJ(s);this.#L.set(t,n),this.#L.set(i,n);let a=this.#iZ(s);return this.#i3(a),t&&this.#i5(e,a),n}addHighlightHCMFilter(t,e,i,r,s){let n=`${e}-${i}-${r}-${s}`,a=this.#iq.get(t);if(a?.key===n||(a?(a.filter?.remove(),a.key=n,a.url="none",a.filter=null):(a={key:n,url:"none",filter:null},this.#iq.set(t,a)),!e||!i))return a.url;let[o,l]=[e,i].map(this.#i1.bind(this)),h=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),d=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[c,u]=[r,s].map(this.#i1.bind(this));d<h&&([h,d,c,u]=[d,h,u,c]),this.#iY.style.color="";let p=(t,e,i)=>{let r=Array(256),s=(d-h)/i,n=t/255,a=(e-t)/(255*i),o=0;for(let t=0;t<=i;t++){let e=Math.round(h+t*s),i=n+t*a;for(let t=o;t<=e;t++)r[t]=i;o=e+1}for(let t=o;t<256;t++)r[t]=r[o-1];return r.join(",")},g=`g_${this.#iW}_hcm_${t}_filter`,m=a.filter=this.#iZ(g);return this.#i2(m),this.#i0(p(c[0],u[0],5),p(c[1],u[1],5),p(c[2],u[2],5),m),a.url=this.#iJ(g),a.url}destroy(t=!1){t&&this.#iX?.size||(this.#iV?.parentNode.parentNode.remove(),this.#iV=null,this.#iG?.clear(),this.#iG=null,this.#iX?.clear(),this.#iX=null,this.#k=0)}#i3(t){let e=this.#iK.createElementNS(q,"feColorMatrix");e.setAttribute("type","matrix"),e.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(e)}#i2(t){let e=this.#iK.createElementNS(q,"feColorMatrix");e.setAttribute("type","matrix"),e.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(e)}#iZ(t){let e=this.#iK.createElementNS(q,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),this.#iY.append(e),e}#i6(t,e,i){let r=this.#iK.createElementNS(q,e);r.setAttribute("type","discrete"),r.setAttribute("tableValues",i),t.append(r)}#i0(t,e,i,r){let s=this.#iK.createElementNS(q,"feComponentTransfer");r.append(s),this.#i6(s,"feFuncR",t),this.#i6(s,"feFuncG",e),this.#i6(s,"feFuncB",i)}#i5(t,e){let i=this.#iK.createElementNS(q,"feComponentTransfer");e.append(i),this.#i6(i,"feFuncA",t)}#i1(t){return this.#iY.style.color=t,to(getComputedStyle(this.#iY).getPropertyValue("color"))}}class et{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!t)throw Error("Font filename must be specified.");let e=`${this.baseUrl}${t}`;return this._fetch(e).catch(t=>{throw Error(`Unable to load font data at: ${e}`)})}async _fetch(t){T("Abstract method `_fetch` called.")}}class ee extends et{async _fetch(t){return new Uint8Array(await Q(t,"arraybuffer"))}}class ei{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw Error("Ensure that the `wasmUrl` API parameter is provided.");if(!t)throw Error("Wasm filename must be specified.");let e=`${this.baseUrl}${t}`;return this._fetch(e).catch(t=>{throw Error(`Unable to load wasm data at: ${e}`)})}async _fetch(t){T("Abstract method `_fetch` called.")}}class er extends ei{async _fetch(t){return new Uint8Array(await Q(t,"arraybuffer"))}}if(l){let t;try{let e=r.getBuiltinModule("module").createRequire("file:///srv/elysia-tools/releases/dd069ad671319d6ce6a6048c8e6fabaa61db1be2/frontends/node_modules/pdfjs-dist/legacy/build/pdf.mjs");try{t=e("@napi-rs/canvas")}catch(t){_(`Cannot load "@napi-rs/canvas" package: "${t}".`)}}catch(t){_(`Cannot access the \`require\` function: "${t}".`)}globalThis.DOMMatrix||(t?.DOMMatrix?globalThis.DOMMatrix=t.DOMMatrix:_("Cannot polyfill `DOMMatrix`, rendering may be broken.")),globalThis.ImageData||(t?.ImageData?globalThis.ImageData=t.ImageData:_("Cannot polyfill `ImageData`, rendering may be broken.")),globalThis.Path2D||(t?.Path2D?globalThis.Path2D=t.Path2D:_("Cannot polyfill `Path2D`, rendering may be broken.")),globalThis.navigator?.language||(globalThis.navigator={language:"en-US",platform:"",userAgent:""})}async function es(t){let e=r.getBuiltinModule("fs");return new Uint8Array(await e.promises.readFile(t))}class en extends t8{}class ea extends t3{_createCanvas(t,e){return r.getBuiltinModule("module").createRequire("file:///srv/elysia-tools/releases/dd069ad671319d6ce6a6048c8e6fabaa61db1be2/frontends/node_modules/pdfjs-dist/legacy/build/pdf.mjs")("@napi-rs/canvas").createCanvas(t,e)}}class eo extends t4{async _fetch(t){return es(t)}}class el extends et{async _fetch(t){return es(t)}}class eh extends ei{async _fetch(t){return es(t)}}o(7588);let ed="__forcedDependency",{floor:ec,ceil:eu}=Math;function ep(t,e,i,r,s,n){t[4*e+0]=Math.min(t[4*e+0],i),t[4*e+1]=Math.min(t[4*e+1],r),t[4*e+2]=Math.max(t[4*e+2],s),t[4*e+3]=Math.max(t[4*e+3],n)}let eg=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];class em{#i4;#i9;constructor(t,e){this.#i4=t,this.#i9=e}get length(){return this.#i4.length}isEmpty(t){return this.#i4[t]===eg}minX(t){return this.#i9[4*t+0]/256}minY(t){return this.#i9[4*t+1]/256}maxX(t){return(this.#i9[4*t+2]+1)/256}maxY(t){return(this.#i9[4*t+3]+1)/256}}let ef=(t,e)=>{if(!t)return;let i=t.get(e);
2return i||(i={dependencies:new Set,isRenderingOperation:!1},t.set(e,i)),i};class eb{#i8={__proto__:null};#i7={__proto__:null,transform:[],moveText:[],sameLineText:[],[ed]:[]};#rt=new Map;#re=[];#ri=[];#rr=[[1,0,0,1,0,0]];#rs=[-1/0,-1/0,1/0,1/0];#rn=new Float64Array([1/0,1/0,-1/0,-1/0]);#ra=-1;#ro=new Set;#rl=new Map;#rh=new Map;#rd;#rc;#ru;#i4;#rp;constructor(t,e,i=!1){this.#rd=t.width,this.#rc=t.height,this.#rg(e),i&&(this.#rp=new Map)}growOperationsCount(t){t>=this.#i4.length&&this.#rg(t,this.#i4)}#rg(t,e){let i=new ArrayBuffer(4*t);this.#ru=new Uint8ClampedArray(i),this.#i4=new Uint32Array(i),e&&e.length>0?(this.#i4.set(e),this.#i4.fill(eg,e.length)):this.#i4.fill(eg)}save(t){return this.#i8={__proto__:this.#i8},this.#i7={__proto__:this.#i7,transform:{__proto__:this.#i7.transform},moveText:{__proto__:this.#i7.moveText},sameLineText:{__proto__:this.#i7.sameLineText},[ed]:{__proto__:this.#i7[ed]}},this.#rs={__proto__:this.#rs},this.#re.push(t),this}restore(t){let e=Object.getPrototypeOf(this.#i8);if(null===e)return this;this.#i8=e,this.#i7=Object.getPrototypeOf(this.#i7),this.#rs=Object.getPrototypeOf(this.#rs);let i=this.#re.pop();return void 0!==i&&(ef(this.#rp,t)?.dependencies.add(i),this.#i4[t]=this.#i4[i]),this}recordOpenMarker(t){return this.#re.push(t),this}getOpenMarker(){return 0===this.#re.length?null:this.#re.at(-1)}recordCloseMarker(t){let e=this.#re.pop();return void 0!==e&&(ef(this.#rp,t)?.dependencies.add(e),this.#i4[t]=this.#i4[e]),this}beginMarkedContent(t){return this.#ri.push(t),this}endMarkedContent(t){let e=this.#ri.pop();return void 0!==e&&(ef(this.#rp,t)?.dependencies.add(e),this.#i4[t]=this.#i4[e]),this}pushBaseTransform(t){return this.#rr.push(H.multiplyByDOMMatrix(this.#rr.at(-1),t.getTransform())),this}popBaseTransform(){return this.#rr.length>1&&this.#rr.pop(),this}recordSimpleData(t,e){return this.#i8[t]=e,this}recordIncrementalData(t,e){return this.#i7[t].push(e),this}resetIncrementalData(t,e){return this.#i7[t].length=0,this}recordNamedData(t,e){return this.#rt.set(t,e),this}recordSimpleDataFromNamed(t,e,i){this.#i8[t]=this.#rt.get(e)??i}recordFutureForcedDependency(t,e){return this.recordIncrementalData(ed,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(let e of t)e in this.#i8&&this.recordFutureForcedDependency(e,this.#i8[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let t of this.#ro)this.recordFutureForcedDependency(ed,t);return this}resetBBox(t){return this.#ra!==t&&(this.#ra=t,this.#rn[0]=1/0,this.#rn[1]=1/0,this.#rn[2]=-1/0,this.#rn[3]=-1/0),this}recordClipBox(t,e,i,r,s,n){let a=H.multiplyByDOMMatrix(this.#rr.at(-1),e.getTransform()),o=[1/0,1/0,-1/0,-1/0];H.axialAlignedBoundingBox([i,s,r,n],a,o);let l=H.intersect(this.#rs,o);return l?(this.#rs[0]=l[0],this.#rs[1]=l[1],this.#rs[2]=l[2],this.#rs[3]=l[3]):(this.#rs[0]=this.#rs[1]=1/0,this.#rs[2]=this.#rs[3]=-1/0),this}recordBBox(t,e,i,r,s,n){let a=this.#rs;if(a[0]===1/0)return this;let o=H.multiplyByDOMMatrix(this.#rr.at(-1),e.getTransform());if(a[0]===-1/0)return H.axialAlignedBoundingBox([i,s,r,n],o,this.#rn),this;let l=[1/0,1/0,-1/0,-1/0];return H.axialAlignedBoundingBox([i,s,r,n],o,l),this.#rn[0]=Math.min(this.#rn[0],Math.max(l[0],a[0])),this.#rn[1]=Math.min(this.#rn[1],Math.max(l[1],a[1])),this.#rn[2]=Math.max(this.#rn[2],Math.min(l[2],a[2])),this.#rn[3]=Math.max(this.#rn[3],Math.min(l[3],a[3])),this}recordCharacterBBox(t,e,i,r=1,s=0,n=0,a){let o,l,h=i.bbox;if(h&&!1!==(o=h[2]!==h[0]&&h[3]!==h[1]&&this.#rh.get(i))&&(l=[0,0,0,0],H.axialAlignedBoundingBox(h,i.fontMatrix,l),(1!==r||0!==s||
20!==n)&&H.scaleMinMax([r,0,0,-r,s,n],l),o))return this.recordBBox(t,e,l[0],l[2],l[1],l[3]);if(!a)return this.recordFullPageBBox(t);let d=a();return h&&l&&void 0===o&&(o=l[0]<=s-d.actualBoundingBoxLeft&&l[2]>=s+d.actualBoundingBoxRight&&l[1]<=n-d.actualBoundingBoxAscent&&l[3]>=n+d.actualBoundingBoxDescent,this.#rh.set(i,o),o)?this.recordBBox(t,e,l[0],l[2],l[1],l[3]):this.recordBBox(t,e,s-d.actualBoundingBoxLeft,s+d.actualBoundingBoxRight,n-d.actualBoundingBoxAscent,n+d.actualBoundingBoxDescent)}recordFullPageBBox(t){return this.#rn[0]=Math.max(0,this.#rs[0]),this.#rn[1]=Math.max(0,this.#rs[1]),this.#rn[2]=Math.min(this.#rd,this.#rs[2]),this.#rn[3]=Math.min(this.#rc,this.#rs[3]),this}getSimpleIndex(t){return this.#i8[t]}recordDependencies(t,e){let i=this.#ro,r=this.#i8,s=this.#i7;for(let t of e)t in this.#i8?i.add(r[t]):t in s&&s[t].forEach(i.add,i);return this}recordNamedDependency(t,e){return this.#rt.has(e)&&this.#ro.add(this.#rt.get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[ed]),this.#rp){let e=ef(this.#rp,t),{dependencies:i}=e;this.#ro.forEach(i.add,i),this.#re.forEach(i.add,i),this.#ri.forEach(i.add,i),i.delete(t),e.isRenderingOperation=!0}if(this.#ra===t){let i=ec(256*this.#rn[0]/this.#rd),r=ec(256*this.#rn[1]/this.#rc),s=eu(256*this.#rn[2]/this.#rd),n=eu(256*this.#rn[3]/this.#rc);for(let e of(ep(this.#ru,t,i,r,s,n),this.#ro))e!==t&&ep(this.#ru,e,i,r,s,n);for(let e of this.#re)e!==t&&ep(this.#ru,e,i,r,s,n);for(let e of this.#ri)e!==t&&ep(this.#ru,e,i,r,s,n);e||(this.#ro.clear(),this.#ra=-1)}return this}recordShowTextOperation(t,e=!1){let i=Array.from(this.#ro);for(let r of(this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t),i))this.recordIncrementalData("sameLineText",r);return this}bboxToClipBoxDropOperation(t,e=!1){return this.#ra===t&&(this.#ra=-1,this.#rs[0]=Math.max(this.#rs[0],this.#rn[0]),this.#rs[1]=Math.max(this.#rs[1],this.#rn[1]),this.#rs[2]=Math.min(this.#rs[2],this.#rn[2]),this.#rs[3]=Math.min(this.#rs[3],this.#rn[3]),e||this.#ro.clear()),this}_takePendingDependencies(){let t=this.#ro;return this.#ro=new Set,t}_extractOperation(t){let e=this.#rl.get(t);return this.#rl.delete(t),e}_pushPendingDependencies(t){for(let e of t)this.#ro.add(e)}take(){return this.#rh.clear(),new em(this.#i4,this.#ru)}takeDebugMetadata(){return this.#rp}}class ev{#rm;#rf;#rb;#rv=0;#ry=0;constructor(t,e,i){if(t instanceof ev&&!!i===t.#rb)return t;this.#rm=t,this.#rf=e,this.#rb=!!i}growOperationsCount(){throw Error("Unreachable")}save(t){return this.#ry++,this.#rm.save(this.#rf),this}restore(t){return this.#ry>0&&(this.#rm.restore(this.#rf),this.#ry--),this}recordOpenMarker(t){return this.#rv++,this}getOpenMarker(){return this.#rv>0?this.#rf:this.#rm.getOpenMarker()}recordCloseMarker(t){return this.#rv--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return this.#rm.pushBaseTransform(t),this}popBaseTransform(){return this.#rm.popBaseTransform(),this}recordSimpleData(t,e){return this.#rm.recordSimpleData(t,this.#rf),this}recordIncrementalData(t,e){return this.#rm.recordIncrementalData(t,this.#rf),this}resetIncrementalData(t,e){return this.#rm.resetIncrementalData(t,this.#rf),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,i){return this.#rm.recordSimpleDataFromNamed(t,e,this.#rf),this}recordFutureForcedDependency(t,e){return this.#rm.recordFutureForcedDependency(t,this.#rf),this}inheritSimpleDataAsFutureForcedDependencies(t){return this.#rm.inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#rm.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return this.#rb||this.#rm.resetBBox(this.#rf),this}recordClipBox(t,e,i,r,s,n){return this.#rb||this.#rm.recordClipBox(this.#rf,e,i,r,s,n),this}recordBBox(t,e,i,r,s,n){return this.#rb||this.#rm.recordBBox(this.#rf,e,i,r,s,n),this}recordCharacterBBox(t,e,i,r,s,n,a){return this.#rb||this.#rm.recordCharacterBBox(this.#rf,e,i,r,s,n,a),this}recordFullPageBBox(t){return this.#rb||this.#rm.recordFullPageBBox(this.#rf),this}getSimpleIndex(t){return this.#rm.getSimpleIndex(t)}recordDependencies(t,e){return this.#rm.recordDependencies(this.#rf,e),this}recordNamedDependency(t,e){return this.#rm.recordNamedDependency(this.#rf,e),this}recordOperation(t){return this.#rm.recordOperation(this.#rf,!0),this}recordShowTextOperation(t){return this.#rm.recordShowTextOperation(this.#rf,!0),this}bboxToClipBoxDropOperation(t){return this.#rb||this.#rm.bboxToClipBoxDropOperation(this.#rf,!0),this}take(){throw Error("Unreachable")}takeDebugMetadata(){throw Error("Unreachable")}}let ey={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:["f
2ilter","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"]},eA={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function ew(t,e){if(!e)return;let i=e[2]-e[0],r=e[3]-e[1],s=new Path2D;s.rect(e[0],e[1],i,r),t.clip(s)}class ex{isModifyingCurrentTransform(){return!1}getPattern(){T("Abstract method `getPattern` called.")}}class eE extends ex{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}isOriginBased(){return 0===this._p0[0]&&0===this._p0[1]&&(!this.isRadial()||0===this._p1[0]&&0===this._p1[1])}isRadial(){return"radial"===this._type}_createGradient(t,e=null){let i,r=this._p0,s=this._p1;if(e&&(r=r.slice(),s=s.slice(),H.applyTransform(r,e),H.applyTransform(s,e)),"axial"===this._type)i=t.createLinearGradient(r[0],r[1],s[0],s[1]);else if("radial"===this._type){let n=this._r0,a=this._r1;if(e){let t=new Float32Array(2);H.singularValueDecompose2dScale(e,t),n*=t[0],a*=t[0]}i=t.createRadialGradient(r[0],r[1],n,s[0],s[1],a)}for(let t of this._colorStops)i.addColorStop(t[0],t[1]);return i}getPattern(t,e,i,r){let s;if(r===eA.STROKE||r===eA.FILL){if(this.isOriginBased()){let r=H.transform(i,e.baseTransform);this.matrix&&(r=H.transform(r,this.matrix));let s=Math.hypot(r[0],r[1]),n=Math.hypot(r[2],r[3]);if(.001>Math.abs((r[0]*r[2]+r[1]*r[3])/(s*n))){if(!this.isRadial())return this._createGradient(t,r);else if(.001>Math.abs(s-n))return this._createGradient(t,r)}}let n=e.current.getClippedPathBoundingBox(r,tl(t))||[0,0,0,0],a=Math.ceil(n[2]-n[0])||1,o=Math.ceil(n[3]-n[1])||1,l=e.cachedCanvases.getCanvas("pattern",a,o),h=l.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-n[0],-n[1]),i=H.transform(i,[1,0,0,1,n[0],n[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),ew(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),s=t.createPattern(l.canvas,"no-repeat");let d=new DOMMatrix(i);s.setTransform(d)}else ew(t,this._bbox),s=this._createGradient(t);return s}}function eS(t,e,i,r,s,n,a,o){let l,h,d,c,u,p,g,m,f,b=e.coords,v=e.colors,y=t.data,A=4*t.width;b[i+1]>b[r+1]&&(l=i,i=r,r=l,l=n,n=a,a=l),b[r+1]>b[s+1]&&(l=r,r=s,s=l,l=a,a=o,o=l),b[i+1]>b[r+1]&&(l=i,i=r,r=l,l=n,n=a,a=l);let w=(b[i]+e.offsetX)*e.scaleX,x=(b[i+1]+e.offsetY)*e.scaleY,E=(b[r]+e.offsetX)*e.scaleX,S=(b[r+1]+e.offsetY)*e.scaleY,_=(b[s]+e.offsetX)*e.scaleX,T=(b[s+1]+e.offsetY)*e.scaleY;if(x>=T)return;let C=v[n],M=v[n+1],D=v[n+2],P=v[a],I=v[a+1],k=v[a+2],R=v[o],L=v[o+1],B=v[o+2],F=Math.round(x),O=Math.round(T);for(let t=F;t<=O;t++){let e;if(t<S){let e=t<x?0:(x-t)/(x-S);h=w-(w-E)*e,d=C-(C-P)*e,c=M-(M-I)*e,u=D-(D-k)*e}else{let e;h=E-(E-_)*(e=t>T?1:S===T?0:(S-t)/(S-T)),d=P-(P-R)*e,c=I-(I-L)*e,u=k-(k-B)*e}p=w-(w-_)*(e=t<x?0:t>T?1:(x-t)/(x-T)),g=C-(C-R)*e,m=M-(M-L)*e,f=D-(D-B)*e;let i=Math.round(Math.min(h,p)),r=Math.round(Math.max(h,p)),s=A*t+4*i;for(let t=i;t<=r;t++)(e=(h-t)/(h-p))<0?e=0:e>1&&(e=1),y[s++]=d-(d-g)*e|0,y[s++]=c-(c-m)*e|0,y[s++]=u-(u-f)*e|0,y[s++]=255}}class e_ extends ex{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],this.matrix=null}_createMeshCanvas(t,e,i){let r=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),n=Math.ceil(this._bounds[2])-r,a=Math.ceil(this._bounds[3])-s,o=Math.min(Math.ceil(Math.abs(n*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(a*t[1]*1.1)),3e3),h=n/o,d=a/l,c={coords:this._coords,colors:this._colors,offsetX:-r,offsetY:-s,scaleX:1/h,scaleY:1/d},u=o+4,p=l+4,g=i.getCanvas("mesh",u,p),f=g.context,b=f.createImageData(o,l);if(e){let t=b.data;for(let i=0,r=t.length;i<r;i+=4)t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=255}for(let t of this._figures)!function(t,e,i){let r,s,n=e.coords,a=e.colors;switch(e.type){case m.LATTICE:let o=e.verticesPerRow,l=Math.floor(n.length/o)-1,h=o-1;for(r=0;r<l;r++){let e=r*o;for(let r=0;r<h;r++,e++)eS(t,i,n[e],n[e+1],n[e+o],a[e],a[e+1],a[e+o]),eS(t,i,n[e+o+1],n[e+1],n[e+o],a[e+o+1],a[e+1],a[e+o])}break;case m.TRIANGLES:for(r=0,s=n.length;r<s;r+=3)eS(t,i,n[r],n[r+1],n[r+2],a[r],a[r+1],a[r+2]);break;default:throw Error("illegal figure")}}(b,t,c);return f.putImageData(b,2,2),{canvas:g.canvas,offsetX:r-2*h,offsetY:s-2*d,scaleX:h,scaleY:d}}isModifyingCurrentTransform(){return!0}getPattern(t,e,i,r){ew(t,this._bbox);let s=new Float32Array(2);if(r===eA.SHADING)H.singularValueDecompose2dScale(tl(t),s);
2else if(this.matrix){H.singularValueDecompose2dScale(this.matrix,s);let[t,i]=s;H.singularValueDecompose2dScale(e.baseTransform,s),s[0]*=t,s[1]*=i}else H.singularValueDecompose2dScale(e.baseTransform,s);let n=this._createMeshCanvas(s,r===eA.SHADING?null:this._background,e.cachedCanvases);return r!==eA.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(n.offsetX,n.offsetY),t.scale(n.scaleX,n.scaleY),t.createPattern(n.canvas,"no-repeat")}}class eT extends ex{getPattern(){return"hotpink"}}let eC={COLORED:1,UNCOLORED:2};class eM{static MAX_PATTERN_SIZE=3e3;constructor(t,e,i,r){this.color=t[1],this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.ctx=e,this.canvasGraphicsFactory=i,this.baseTransform=r}createPatternCanvas(t,e){let{bbox:i,operatorList:r,paintType:s,tilingType:n,color:a,canvasGraphicsFactory:o}=this,{xstep:l,ystep:h}=this;l=Math.abs(l),h=Math.abs(h),S("TilingType: "+n);let d=i[0],c=i[1],u=i[2],p=i[3],g=u-d,m=p-c,f=new Float32Array(2);H.singularValueDecompose2dScale(this.matrix,f);let[b,v]=f;H.singularValueDecompose2dScale(this.baseTransform,f);let y=b*f[0],A=v*f[1],w=g,x=m,E=!1,_=!1,T=Math.ceil(h*A),C=Math.ceil(m*A);Math.ceil(l*y)>=Math.ceil(g*y)?w=l:E=!0,T>=C?x=h:_=!0;let M=this.getSizeAndScale(w,this.ctx.canvas.width,y),D=this.getSizeAndScale(x,this.ctx.canvas.height,A),P=t.cachedCanvases.getCanvas("pattern",M.size,D.size),I=P.context,k=o.createCanvasGraphics(I,e);if(k.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(k,s,a),I.translate(-M.scale*d,-D.scale*c),k.transform(0,M.scale,0,0,D.scale,0,0),I.save(),k.dependencyTracker?.save(),this.clipBbox(k,d,c,u,p),k.baseTransform=tl(k.ctx),k.executeOperatorList(r),k.endDrawing(),k.dependencyTracker?.restore(),I.restore(),E||_){let e=P.canvas;E&&(w=l),_&&(x=h);let i=this.getSizeAndScale(w,this.ctx.canvas.width,y),r=this.getSizeAndScale(x,this.ctx.canvas.height,A),s=i.size,n=r.size,a=t.cachedCanvases.getCanvas("pattern-workaround",s,n),o=a.context,u=E?Math.floor(g/l):0,p=_?Math.floor(m/h):0;for(let t=0;t<=u;t++)for(let i=0;i<=p;i++)o.drawImage(e,s*t,n*i,s,n,0,0,s,n);return{canvas:a.canvas,scaleX:i.scale,scaleY:r.scale,offsetX:d,offsetY:c}}return{canvas:P.canvas,scaleX:M.scale,scaleY:D.scale,offsetX:d,offsetY:c}}getSizeAndScale(t,e,i){let r=Math.max(eM.MAX_PATTERN_SIZE,e),s=Math.ceil(t*i);return s>=r?s=r:i=s/t,{scale:i,size:s}}clipBbox(t,e,i,r,s){let n=r-e,a=s-i;t.ctx.rect(e,i,n,a),H.axialAlignedBoundingBox([e,i,r,s],tl(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){let r=t.ctx,s=t.current;switch(e){case eC.COLORED:let{fillStyle:n,strokeStyle:a}=this.ctx;r.fillStyle=s.fillColor=n,r.strokeStyle=s.strokeColor=a;break;case eC.UNCOLORED:r.fillStyle=r.strokeStyle=i,s.fillColor=s.strokeColor=i;break;default:throw new F(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,i,r,s){let n=i;r!==eA.SHADING&&(n=H.transform(n,e.baseTransform),this.matrix&&(n=H.transform(n,this.matrix)));let a=this.createPatternCanvas(e,s),o=new DOMMatrix(n);o=(o=o.translate(a.offsetX,a.offsetY)).scale(1/a.scaleX,1/a.scaleY);let l=t.createPattern(a.canvas,"repeat");return l.setTransform(o),l}}let eD=new DOMMatrix,eP=new Float32Array(2),eI=new Float32Array([1/0,1/0,-1/0,-1/0]);class ek{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let r;return void 0!==this.cache[t]?(r=this.cache[t],this.canvasFactory.reset(r,e,i)):(r=this.canvasFactory.create(e,i),this.cache[t]=r),r}delete(t){delete this.cache[t]}clear(){for(let t in this.cache){let e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function eR(t,e,i,r,s,n,a,o,l,h){let[d,c,u,p,g,m]=tl(t);if(0===c&&0===u){let f=Math.round(a*d+g),b=Math.round(o*p+m),v=Math.abs(Math.round((a+l)*d+g)-f)||1,y=Math.abs(Math.round((o+h)*p+m)-b)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(p),f,b),t.drawImage(e,i,r,s,n,0,0,v,y),t.setTransform(d,c,u,p,g,m),[v,y]}if(0===d&&0===p){let f=Math.round(o*u+g),b=Math.round(a*c+m),v=Math.abs(Math.round((o+h)*u+g)-f)||1,y=Math.abs(Math.round((a+l)*c+m)-b)||1;return t.setTransform(0,Math.sign(c),Math.sign(u),0,f,b),t.drawImage(e,i,r,s,n,0,0,y,v),t.setTransform(d,c,u,p,g,m),[y,v]}return t.drawImage(e,i,r,s,n,a,o,l,h),[Math.hypot(d,c)*l,Math.hypot(u,p)*h]}class eL{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=h;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=f.FILL;textRise=0;fillColor="#000000";strokeColor="#000000";patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps="none";constructor(t,e,i){i?.(this),this.clipBox=new Float32Array([0,0,t,e]),this.minMax=eI.slice()}clone(){let t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t}getPathBoundingBox(t=eA.FILL,e=null){let i=this.minMax.slice();if(t===eA.STROKE){e||T("Stroke bounding box must include transform."),H.singularValueDecompose2dScale(e,eP);let t=eP[0]*this.lineWidth/2,r=eP[1]*this.lineWidth/2;i[0]-=t,i[1]-=r,i[2]+=t,i[3]+=r}return i}updateClipFromPath(){let t=H.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(eI,0)}getClippedPathBoundingBox(t=eA.FILL,e=null){return H.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function eB(t,e){let i,r,s,n;if(e instanceof ImageData)return void t.putImageData(e,0,0);let a=e.height,o=e.width,l=a%16,h=(a-l)/16,d=0===l?h:h+1,c=t.createImageData(o,16),u=0,p,g=e.data,m=c.data;if(e.kind===b.GRAYSCALE_1BPP){let e=g.byteLength,n=new Uint32Array(m.buffer,0,m.byteLength>>2),a=n.length,f=o+7>>3,b=U.isLittleEndian?0xff000000:255;for(i=0;i<d;i++){for(r=0,s=i<h?16:l,p=0;r<s;r++){let t=e-u,i=0,r=t>f?o:8*t-7,s=-8&r,a=0,l=0;for(;i<s;i+=8)l=g[u++],n[p++]=128&l?0xffffffff:b,n[p++]=64&l?0xffffffff:b,n[p++]=32&l?0xffffffff:b,n[p++]=16&l?0xffffffff:b,n[p++]=8&l?0xffffffff:b,n[p++]=4&l?0xffffffff:b,n[p++]=2&l?0xffffffff:b,n[p++]=1&l?0xffffffff:b;for(;i<r;i++)0===a&&(l=g[u++],a=128),n[p++]=l&a?0xffffffff:b,a>
2>=1}for(;p<a;)n[p++]=0;t.putImageData(c,0,16*i)}}else if(e.kind===b.RGBA_32BPP){for(i=0,r=0,n=16*o*4;i<h;i++)m.set(g.subarray(u,u+n)),u+=n,t.putImageData(c,0,r),r+=16;i<d&&(n=o*l*4,m.set(g.subarray(u,u+n)),t.putImageData(c,0,r))}else if(e.kind===b.RGB_24BPP)for(i=0,n=o*(s=16);i<d;i++){for(i>=h&&(n=o*(s=l)),p=0,r=n;r--;)m[p++]=g[u++],m[p++]=g[u++],m[p++]=g[u++],m[p++]=255;t.putImageData(c,0,16*i)}else throw Error(`bad image kind: ${e.kind}`)}function eF(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);let i=e.height,r=e.width,s=i%16,n=(i-s)/16,a=0===s?n:n+1,o=t.createImageData(r,16),l=0,h=e.data,d=o.data;for(let e=0;e<a;e++){let i=e<n?16:s;({srcPos:l}=function({src:t,srcPos:e=0,dest:i,width:r,height:s,nonBlackColor:n=0xffffffff,inverseDecode:a=!1}){let o=U.isLittleEndian?0xff000000:255,[l,h]=a?[n,o]:[o,n],d=r>>3,c=7&r,u=t.length;i=new Uint32Array(i.buffer);let p=0;for(let r=0;r<s;r++){for(let r=e+d;e<r;e++){let r=e<u?t[e]:255;i[p++]=128&r?h:l,i[p++]=64&r?h:l,i[p++]=32&r?h:l,i[p++]=16&r?h:l,i[p++]=8&r?h:l,i[p++]=4&r?h:l,i[p++]=2&r?h:l,i[p++]=1&r?h:l}if(0===c)continue;let r=e<u?t[e++]:255;for(let t=0;t<c;t++)i[p++]=r&1<<7-t?h:l}return{srcPos:e,destPos:p}}({src:h,srcPos:l,dest:d,width:r,height:i,nonBlackColor:0})),t.putImageData(o,0,16*e)}}function eO(t,e){for(let i of["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"])void 0!==t[i]&&(e[i]=t[i]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function eN(t){t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0);let{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}function eU(t,e){if(e)return!0;H.singularValueDecompose2dScale(t,eP);let i=Math.fround(tc.pixelRatio*Y.PDF_TO_CSS_UNITS);return eP[0]<=i&&eP[1]<=i}let ez=["butt","round","square"],eH=["miter","round","bevel"],ej={},e$={};class eG{constructor(t,e,i,r,s,{optionalContentConfig:n,markedContentStack:a=null},o,l,h){this.ctx=t,this.current=new eL(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=i,this.canvasFactory=r,this.filterFactory=s,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=a||[],this.optionalContentConfig=n,this.cachedCanvases=new ek(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=o,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=h??null}getObject(t,e,i=null){return"string"==typeof e?(this.dependencyTracker?.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):i}beginDrawing({transform:t,viewport:e,transparency:i=!1,background:r=null}){let s=this.ctx.canvas.width,n=this.ctx.canvas.height,a=this.ctx.fillStyle;if(this.ctx.fillStyle=r||"#ffffff",this.ctx.fillRect(0,0,s,n),this.ctx.fillStyle=a,i){let t=this.cachedCanvases.getCanvas("transparent",s,n);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...tl(this.compositeCtx))}this.ctx.save(),eN(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=tl(this.ctx)}executeOperatorList(t,e,i,r,s){let n,a,o=t.argsArray,l=t.fnArray,h=e||0,d=o.length;if(d===h)return h;let c=d-h>10&&"function"==typeof i,u=c?Date.now()+15:0,p=0,g=this.commonObjs,m=this.objs;for(;;){if(void 0!==r&&h===r.nextBreakPoint)return r.breakIt(h,i),h;if(!s||s(h))if(n=l[h],a=o[h]??null,n!==w.dependency)null===a?this[n](h):this[n](h,...a);else for(let t of a){this.dependencyTracker?.recordNamedData(t,h);let e=t.startsWith("g_")?g:m;if(!e.has(t))return e.get(t,i),h}if(++h===d)return h;if(c&&++p>10){if(Date.now()>u)return i(),h;p=0}}}#rA(){for(;this.stateStack.length||this.inSMaskMode;
2)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.transparentCanvas=null)}endDrawing(){for(let t of(this.#rA(),this.cachedCanvases.clear(),this.cachedPatterns.clear(),this._cachedBitmapsMap.values())){for(let e of t.values())"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#rw()}#rw(){if(this.pageColors){let t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){let e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}_scaleImage(t,e){let i,r,s=t.width??t.displayWidth,n=t.height??t.displayHeight,a=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),l=s,h=n,d="prescale1";for(;a>2&&l>1||o>2&&h>1;){let e=l,s=h;a>2&&l>1&&(e=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),a/=l/e),o>2&&h>1&&(s=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h)/2,o/=h/s),(r=(i=this.cachedCanvases.getCanvas(d,e,s)).context).clearRect(0,0,e,s),r.drawImage(t,0,0,l,h,0,0,e,s),t=i.canvas,l=e,h=s,d="prescale1"===d?"prescale2":"prescale1"}return{img:t,paintWidth:l,paintHeight:h}}_createMaskCanvas(t,e){let i,r,s,n,a=this.ctx,{width:o,height:l}=e,h=this.current.fillColor,d=this.current.patternFill,c=tl(a);if((e.bitmap||e.data)&&e.count>1){let n=e.bitmap||e.data.buffer;r=JSON.stringify(d?c:[c.slice(0,4),h]),(i=this._cachedBitmapsMap.get(n))||(i=new Map,this._cachedBitmapsMap.set(n,i));let a=i.get(r);if(a&&!d){let e=Math.round(Math.min(c[0],c[2])+c[4]),i=Math.round(Math.min(c[1],c[3])+c[5]);return this.dependencyTracker?.recordDependencies(t,ey.transformAndFill),{canvas:a,offsetX:e,offsetY:i}}s=a}s||eF((n=this.cachedCanvases.getCanvas("maskCanvas",o,l)).context,e);let u=H.transform(c,[1/o,0,0,-1/l,0,0]);u=H.transform(u,[1,0,0,1,0,-l]);let p=eI.slice();H.axialAlignedBoundingBox([0,0,o,l],u,p);let[g,m,f,b]=p,v=Math.round(f-g)||1,y=Math.round(b-m)||1,A=this.cachedCanvases.getCanvas("fillCanvas",v,y),w=A.context;w.translate(-g,-m),w.transform(...u),!s&&(s=(s=this._scaleImage(n.canvas,th(w))).img,i&&d&&i.set(r,s)),w.imageSmoothingEnabled=eU(tl(w),e.interpolate),eR(w,s,0,0,s.width,s.height,0,0,o,l),w.globalCompositeOperation="source-in";let x=H.transform(th(w),[1,0,0,1,-g,-m]);return w.fillStyle=d?h.getPattern(a,this,x,eA.FILL,t):h,w.fillRect(0,0,o,l),i&&!d&&(this.cachedCanvases.delete("fillCanvas"),i.set(r,A.canvas)),this.dependencyTracker?.recordDependencies(t,ey.transformAndFill),{canvas:A.canvas,offsetX:Math.round(g),offsetY:Math.round(m)}}setLineWidth(t,e){this.dependencyTracker?.recordSimpleData("lineWidth",t),e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(t,e){this.dependencyTracker?.recordSimpleData("lineCap",t),this.ctx.lineCap=ez[e]}setLineJoin(t,e){this.dependencyTracker?.recordSimpleData("lineJoin",t),this.ctx.lineJoin=eH[e]}setMiterLimit(t,e){this.dependencyTracker?.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,i){this.dependencyTracker?.recordSimpleData("dash",t);let r=this.ctx;void 0!==r.setLineDash&&(r.setLineDash(e),r.lineDashOffset=i)}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){for(let[i,r]of e)switch(i){case"LW":this.setLineWidth(t,r);break;case"LC":this.setLineCap(t,r);break;case"LJ":this.setLineJoin(t,r);break;case"ML":this.setMiterLimit(t,r);break;case"D":this.setDash(t,r[0],r[1]);break;case"RI":this.setRenderingIntent(t,r);break;case"FL":this.setFlatness(t,r);break;case"Font":this.setFont(t,r[0],r[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=r;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=r;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=r;break;case"SMask":this.dependencyTracker?.recordSimpleData("SMask",t),this.current.activeSMask=r?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.dependencyTracker?.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(r)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(t){if(this.inSMaskMode)throw Error("beginSMaskMode called while already in smask mode");let e=this.ctx.canvas.width,i=this.ctx.canvas.height,r="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(r,e,i);this.suspendedCtx=this.ctx;let n=this.ctx=s.context;n.setTransform(this.suspendedCtx.getTransform()),eO(this.suspendedCtx,n);var a=this.suspendedCtx;if(n._removeMirroring)throw Error("Context is already forwarding operations.");n.__originalSave=n.save,n.__originalRestore=n.restore,n.__originalRotate=n.rotate,n.__originalScale=n.scale,n.__originalTranslate=n.translate,n.__originalTransform=n.transform,n.__originalSetTransform=n.setTransform,n.__originalResetTransform=n.resetTransform,n.__originalClip=n.clip,n.__originalMoveTo=n.moveTo,n.__originalLineTo=n.lineTo,n.__originalBezierCurveTo=n.bezierCurveTo,n.__originalRect=n.rect,n.__originalClosePath=n.closePath,n.__originalBeginPath=n.beginPath,n._removeMirroring=()=>{n.save=n.__originalSave,n.restore=n.__originalRestore,n.rotate=n.__originalRotate,n.scale=n.__originalScale,n.translate=n.__originalTranslate,n.transform=n.__originalTransform,n.setTransform=n.__originalSetTransform,n.resetTransform=n.__originalResetTransform,n.clip=n.__originalClip,n.moveTo=n.__originalMoveTo,n.lineTo=n.__originalLineTo,n.bezierCurveTo=n.__originalBezierCurveTo,n.rect=n.__originalRect,n.closePath=n.__originalClosePath,n.beginPath=n.__originalBeginPath,delete n._removeMirroring},n.save=function(){a.save(),this.__originalSave()}
2,n.restore=function(){a.restore(),this.__originalRestore()},n.translate=function(t,e){a.translate(t,e),this.__originalTranslate(t,e)},n.scale=function(t,e){a.scale(t,e),this.__originalScale(t,e)},n.transform=function(t,e,i,r,s,n){a.transform(t,e,i,r,s,n),this.__originalTransform(t,e,i,r,s,n)},n.setTransform=function(t,e,i,r,s,n){a.setTransform(t,e,i,r,s,n),this.__originalSetTransform(t,e,i,r,s,n)},n.resetTransform=function(){a.resetTransform(),this.__originalResetTransform()},n.rotate=function(t){a.rotate(t),this.__originalRotate(t)},n.clip=function(t){a.clip(t),this.__originalClip(t)},n.moveTo=function(t,e){a.moveTo(t,e),this.__originalMoveTo(t,e)},n.lineTo=function(t,e){a.lineTo(t,e),this.__originalLineTo(t,e)},n.bezierCurveTo=function(t,e,i,r,s,n){a.bezierCurveTo(t,e,i,r,s,n),this.__originalBezierCurveTo(t,e,i,r,s,n)},n.rect=function(t,e,i,r){a.rect(t,e,i,r),this.__originalRect(t,e,i,r)},n.closePath=function(){a.closePath(),this.__originalClosePath()},n.beginPath=function(){a.beginPath(),this.__originalBeginPath()},this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),eO(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let e=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,e,this.ctx,t),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(t,e,i,r){let s=r[0],n=r[1],a=r[2]-s,o=r[3]-n;0!==a&&0!==o&&(this.genericComposeSMask(e.context,i,a,o,e.subtype,e.backdrop,e.transferMap,s,n,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,e,i,r,s,n,a,o,l,h,d){let c=t.canvas,u=o-h,p=l-d;if(n)if(u<0||p<0||u+i>c.width||p+r>c.height){let t=this.cachedCanvases.getCanvas("maskExtension",i,r),e=t.context;e.drawImage(c,-u,-p),e.globalCompositeOperation="destination-atop",e.fillStyle=n,e.fillRect(0,0,i,r),e.globalCompositeOperation="source-over",c=t.canvas,u=p=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let e=new Path2D;e.rect(u,p,i,r),t.clip(e),t.globalCompositeOperation="destination-atop",t.fillStyle=n,t.fillRect(u,p,i,r),t.restore()}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===s&&a?e.filter=this.filterFactory.addAlphaFilter(a):"Luminosity"===s&&(e.filter=this.filterFactory.addLuminosityFilter(a));let g=new Path2D;g.rect(o,l,i,r),e.clip(g),e.globalCompositeOperation="destination-in",e.drawImage(c,u,p,i,r,o,l,i,r),e.restore()}save(t){this.inSMaskMode&&eO(this.ctx,this.suspendedCtx),this.ctx.save();let e=this.current;this.stateStack.push(e),this.current=e.clone(),this.dependencyTracker?.save(t)}restore(t){if(this.dependencyTracker?.restore(t),0===this.stateStack.length){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&eO(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(t,e,i,r,s,n,a){this.dependencyTracker?.recordIncrementalData("transform",t),this.ctx.transform(e,i,r,s,n,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i,r){let[s]=i;if(!r){s||=i[0]=new Path2D,this[e](t,s);return}if(null!==this.dependencyTracker){let i=e===w.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,r[0]-i,r[2]+i,r[1]-i,r[3]+i).recordDependencies(t,["transform"])}s instanceof Path2D||(s=i[0]=tw(s)),H.axialAlignedBoundingBox(r,tl(this.ctx),this.current.minMax),this[e](t,s),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e,i=!0){let r=this.ctx,s=this.current.strokeColor;if(r.globalAlpha=this.current.strokeAlpha,this.contentVisible)if("object"==typeof s&&s?.getPattern){let i=s.isModifyingCurrentTransform()?r.getTransform():null;if(r.save(),r.strokeStyle=s.getPattern(r,this,th(r),eA.STROKE,t),i){let t=new Path2D;t.addPath(e,r.getTransform().invertSelf().multiplySelf(i)),e=t}
2this.rescaleAndStroke(e,!1),r.restore()}else this.rescaleAndStroke(e,!0);this.dependencyTracker?.recordDependencies(t,ey.stroke),i&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(eA.STROKE,tl(this.ctx))),r.globalAlpha=this.current.fillAlpha}closeStroke(t,e){this.stroke(t,e)}fill(t,e,i=!0){let r=this.ctx,s=this.current.fillColor,n=this.current.patternFill,a=!1;if(n){let i=s.isModifyingCurrentTransform()?r.getTransform():null;if(this.dependencyTracker?.save(t),r.save(),r.fillStyle=s.getPattern(r,this,th(r),eA.FILL,t),i){let t=new Path2D;t.addPath(e,r.getTransform().invertSelf().multiplySelf(i)),e=t}a=!0}let o=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==o&&(this.pendingEOFill?(r.fill(e,"evenodd"),this.pendingEOFill=!1):r.fill(e)),this.dependencyTracker?.recordDependencies(t,ey.fill),a&&(r.restore(),this.dependencyTracker?.restore(t)),i&&this.consumePath(t,e,o)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e)}eoFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}closeFillStroke(t,e){this.fillStroke(t,e)}closeEOFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}endPath(t,e){this.consumePath(t,e)}rawFillPath(t,e){this.ctx.fill(e),this.dependencyTracker?.recordDependencies(t,ey.rawFillPath).recordOperation(t)}clip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=ej}eoClip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=e$}beginText(t){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.dependencyTracker?.recordOpenMarker(t).resetIncrementalData("sameLineText").resetIncrementalData("moveText",t)}endText(t){let e=this.pendingTextPaths,i=this.ctx;if(this.dependencyTracker){let{dependencyTracker:i}=this;void 0!==e&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",t),i.recordCloseMarker(t)}if(void 0!==e){let t=new Path2D,r=i.getTransform().invertSelf();for(let{transform:i,x:s,y:n,fontSize:a,path:o}of e)o&&t.addPath(o,new DOMMatrix(i).preMultiplySelf(r).translate(s,n).scale(a,-a));i.clip(t)}delete this.pendingTextPaths}setCharSpacing(t,e){this.dependencyTracker?.recordSimpleData("charSpacing",t),this.current.charSpacing=e}setWordSpacing(t,e){this.dependencyTracker?.recordSimpleData("wordSpacing",t),this.current.wordSpacing=e}setHScale(t,e){this.dependencyTracker?.recordSimpleData("hScale",t),this.current.textHScale=e/100}setLeading(t,e){this.dependencyTracker?.recordSimpleData("leading",t),this.current.leading=-e}setFont(t,e,i){this.dependencyTracker?.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);let r=this.commonObjs.get(e),s=this.current;if(!r)throw Error(`Can't find font for ${e}`);if(s.fontMatrix=r.fontMatrix||h,(0===s.fontMatrix[0]||0===s.fontMatrix[3])&&_("Invalid font matrix for font "+e),i<0?(i=-i,s.fontDirection=-1):s.fontDirection=1,this.current.font=r,this.current.fontSize=i,r.isType3Font)return;let n=r.loadedName||"sans-serif",a=r.systemFontInfo?.css||`"${n}", ${r.fallbackName}`,o="normal";r.black?o="900":r.bold&&(o="bold");let l=r.italic?"italic":"normal",d=i;i<16?d=16:i>100&&(d=100),this.current.fontSizeScale=i/d,this.ctx.font=`${l} ${o} ${d}px ${a}`}setTextRenderingMode(t,e){this.dependencyTracker?.recordSimpleData("textRenderingMode",t),this.current.textRenderingMode=e}setTextRise(t,e){this.dependencyTracker?.recordSimpleData("textRise",t),this.current.textRise=e}moveText(t,e,i){this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=i}setLeadingMoveText(t,e,i){this.setLeading(t,-i),this.moveText(t,e,i)}setTextMatrix(t,e){this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",t);let{current:i}=this;i.textMatrix=e,i.textMatrixScale=Math.hypot(e[0],e[1]),i.x=i.lineX=0,i.y=i.lineY=0}nextLine(t){this.moveText(t,0,this.current.leading),this.dependencyTracker?.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??t)}#rx(t,e,i){let r=new Path2D;return r.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),r}paintChar(t,e,i,r,s,n){let a,o=this.ctx,l=this.current,h=l.font,d=l.textRenderingMode,c=l.fontSize/l.fontSizeScale,u=d&f.FILL_STROKE_MASK,p=!!(d&f.ADD_TO_PATH_FLAG),g=l.patternFill&&!h.missingFile,m=l.patternStroke&&!h.missingFile;if((h.disableFontFace||p||g||m)&&!h.missingFile&&(a=h.getPathGenerator(this.commonObjs,e)),a&&(h.disableFontFace||g||m)){let e;if(o.save(),o.translate(i,r),o.scale(c,-c),this.dependencyTracker?.recordCharacterBBox(t,o,h),u===f.FILL||u===f.FILL_STROKE)if(s){e=o.getTransform(),o.setTransform(...s);let t=this.#rx(a,e,s);o.fill(t)}else o.fill(a);if(u===f.STROKE||u===f.FILL_STROKE)if(n){e||=o.getTransform(),o.setTransform(...n);let{a:t,b:i,c:r,d:s}=e,l=H.inverseTransform(n),h=H.transform([t,i,r,s,0,0],l);H.singularValueDecompose2dScale(h,eP),o.lineWidth*=Math.max(eP[0],eP[1])/c,o.stroke(this.#rx(a,e,n))}else o.lineWidth/=c,o.stroke(a);
2o.restore()}else(u===f.FILL||u===f.FILL_STROKE)&&(o.fillText(e,i,r),this.dependencyTracker?.recordCharacterBBox(t,o,h,c,i,r,()=>o.measureText(e))),(u===f.STROKE||u===f.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(t,o,h,c,i,r,()=>o.measureText(e)).recordDependencies(t,ey.stroke),o.strokeText(e,i,r));p&&((this.pendingTextPaths||=[]).push({transform:tl(o),x:i,y:r,fontSize:c,path:a}),this.dependencyTracker?.recordCharacterBBox(t,o,h,c,i,r))}get isFontSubpixelAAEnabled(){let{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);let e=t.getImageData(0,0,10,10).data,i=!1;for(let t=3;t<e.length;t+=4)if(e[t]>0&&e[t]<255){i=!0;break}return P(this,"isFontSubpixelAAEnabled",i)}showText(t,e){let i,r;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,ey.showText).resetBBox(t),this.current.textRenderingMode&f.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());let s=this.current,n=s.font;if(n.isType3Font){this.showType3Text(t,e),this.dependencyTracker?.recordShowTextOperation(t);return}let a=s.fontSize;if(0===a)return void this.dependencyTracker?.recordOperation(t);let o=this.ctx,l=s.fontSizeScale,h=s.charSpacing,d=s.wordSpacing,c=s.fontDirection,u=s.textHScale*c,p=e.length,g=n.vertical,m=g?1:-1,b=n.defaultVMetrics,v=a*s.fontMatrix[0],y=s.textRenderingMode===f.FILL&&!n.disableFontFace&&!s.patternFill;o.save(),s.textMatrix&&o.transform(...s.textMatrix),o.translate(s.x,s.y+s.textRise),c>0?o.scale(u,-1):o.scale(u,1);let A=s.textRenderingMode&f.FILL_STROKE_MASK,w=A===f.FILL||A===f.FILL_STROKE,x=A===f.STROKE||A===f.FILL_STROKE;if(w&&s.patternFill){o.save();let e=s.fillColor.getPattern(o,this,th(o),eA.FILL,t);i=tl(o),o.restore(),o.fillStyle=e}if(x&&s.patternStroke){o.save();let e=s.strokeColor.getPattern(o,this,th(o),eA.STROKE,t);r=tl(o),o.restore(),o.strokeStyle=e}let E=s.lineWidth,S=s.textMatrixScale;if(0===S||0===E?x&&(E=this.getSinglePixelWidth()):E/=S,1!==l&&(o.scale(l,l),E/=l),o.lineWidth=E,n.isInvalidPDFjsFont){let i=[],r=0;for(let t of e)i.push(t.unicode),r+=t.width;let n=i.join("");if(o.fillText(n,0,0),null!==this.dependencyTracker){let e=o.measureText(n);this.dependencyTracker.recordBBox(t,this.ctx,-e.actualBoundingBoxLeft,e.actualBoundingBoxRight,-e.actualBoundingBoxAscent,e.actualBoundingBoxDescent).recordShowTextOperation(t)}
2s.x+=r*v*u,o.restore(),this.compose();return}let _=0,T;for(T=0;T<p;++T){let s,u,p,f=e[T];if("number"==typeof f){_+=m*f*a/1e3;continue}let A=!1,w=(f.isSpace?d:0)+h,x=f.fontChar,E=f.accent,S=f.width;if(g){let t=f.vmetric||b,e=-(f.vmetric?t[1]:.5*S)*v,i=t[2]*v;S=t?-t[0]:S,s=e/l,u=(_+i)/l}else s=_/l,u=0;if(n.remeasure&&S>0){let t=1e3*(p=o.measureText(x)).width/a*l;if(S<t&&this.isFontSubpixelAAEnabled){let e=S/t;A=!0,o.save(),o.scale(e,1),s/=e}else S!==t&&(s+=(S-t)/2e3*a/l)}if(this.contentVisible&&(f.isInFont||n.missingFile)){if(y&&!E)o.fillText(x,s,u),this.dependencyTracker?.recordCharacterBBox(t,o,p?{bbox:null}:n,a/l,s,u,()=>p??o.measureText(x));else if(this.paintChar(t,x,s,u,i,r),E){let e=s+a*E.offset.x/l,n=u-a*E.offset.y/l;this.paintChar(t,E.fontChar,e,n,i,r)}}_+=g?S*v-w*c:S*v+w*c,A&&o.restore()}g?s.y-=_:s.x+=_*u,o.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(t)}showType3Text(t,e){let i,r,s,n,a=this.ctx,o=this.current,l=o.font,d=o.fontSize,c=o.fontDirection,u=l.vertical?1:-1,p=o.charSpacing,g=o.wordSpacing,m=o.textHScale*c,b=o.fontMatrix||h,v=e.length;if(o.textRenderingMode===f.INVISIBLE||0===d)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,a.save(),o.textMatrix&&a.transform(...o.textMatrix),a.translate(o.x,o.y+o.textRise),a.scale(m,c);let y=this.dependencyTracker;for(i=0,this.dependencyTracker=y?new ev(y,t):null;i<v;++i){if("number"==typeof(r=e[i])){n=u*r*d/1e3,this.ctx.translate(n,0),o.x+=n*m;continue}let t=(r.isSpace?g:0)+p,h=l.charProcOperatorList[r.operatorListId];h?this.contentVisible&&(this.save(),a.scale(d,d),a.transform(...b),this.executeOperatorList(h),this.restore()):_(`Type3 character "${r.operatorListId}" is not available.`);let c=[r.width,0];H.applyTransform(c,b),s=c[0]*d+t,a.translate(s,0),o.x+=s*m}a.restore(),y&&(this.dependencyTracker=y)}setCharWidth(t,e,i){}
2setCharWidthAndBounds(t,e,i,r,s,n,a){let o=new Path2D;o.rect(r,s,n-r,a-s),this.ctx.clip(o),this.dependencyTracker?.recordBBox(t,this.ctx,r,n,s,a).recordClipBox(t,this.ctx,r,n,s,a),this.endPath(t)}getColorN_Pattern(t,e){let i;if("TilingPattern"===e[0]){let t=this.baseTransform||tl(this.ctx);i=new eM(e,this.ctx,{createCanvasGraphics:(t,e)=>new eG(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new ev(this.dependencyTracker,e,!0):null)},t)}else i=this._getPattern(t,e[1],e[2]);return i}setStrokeColorN(t,...e){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.current.strokeColor=this.getColorN_Pattern(t,e),this.current.patternStroke=!0}setFillColorN(t,...e){this.dependencyTracker?.recordSimpleData("fillColor",t),this.current.fillColor=this.getColorN_Pattern(t,e),this.current.patternFill=!0}setStrokeRGBColor(t,e){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}
2setStrokeTransparent(t){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1}setFillTransparent(t){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e,i=null){let r;return this.cachedPatterns.has(e)?r=this.cachedPatterns.get(e):(r=function(t){switch(t[0]){case"RadialAxial":return new eE(t);case"Mesh":return new e_(t);case"Dummy":return new eT}throw Error(`Unknown IR type: ${t[0]}`)}(this.getObject(t,e)),this.cachedPatterns.set(e,r)),i&&(r.matrix=i),r}shadingFill(t,e){if(!this.contentVisible)return;let i=this.ctx;this.save(t),i.fillStyle=this._getPattern(t,e).getPattern(i,this,th(i),eA.SHADING,t);let r=th(i);if(r){let{width:t,height:e}=i.canvas,s=eI.slice();H.axialAlignedBoundingBox([0,0,t,e],r,s);let[n,a,o,l]=s;this.ctx.fillRect(n,a,o-n,l-a)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,ey.transform).recordDependencies(t,ey.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){T("Should not call beginInlineImage")}beginImageData(){T("Should not call beginImageData")}
2paintFormXObjectBegin(t,e,i){if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=tl(this.ctx),i)){H.axialAlignedBoundingBox(i,this.baseTransform,this.current.minMax);let[e,r,s,n]=i,a=new Path2D;a.rect(e,r,s-e,n-r),this.ctx.clip(a),this.dependencyTracker?.recordClipBox(t,this.ctx,e,s,r,n),this.endPath(t)}}paintFormXObjectEnd(t){this.contentVisible&&(this.restore(t),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t,e){if(!this.contentVisible)return;this.save(t),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let i=this.ctx;e.isolated||S("TODO: Support non-isolated groups."),e.knockout&&_("Knockout groups not supported.");let r=tl(i);if(e.matrix&&i.transform(...e.matrix),!e.bbox)throw Error("Bounding box is required.");let s=eI.slice();H.axialAlignedBoundingBox(e.bbox,tl(i),s);let n=[0,0,i.canvas.width,i.canvas.height],a=Math.floor((s=H.intersect(s,n)||[0,0,0,0])[0]),o=Math.floor(s[1]),l=Math.max(Math.ceil(s[2])-a,1),h=Math.max(Math.ceil(s[3])-o,1);this.current.startNewPathAndClipBox([0,0,l,h]);let d="groupAt"+this.groupLevel;e.smask&&(d+="_smask_"+this.smaskCounter++%2);let c=this.cachedCanvases.getCanvas(d,l,h),u=c.context;u.translate(-a,-o),u.transform(...r);let p=new Path2D,[g,m,f,b]=e.bbox;if(p.rect(g,m,f-g,b-m),e.matrix){let t=new Path2D;t.addPath(p,new DOMMatrix(e.matrix)),p=t}u.clip(p),e.smask&&this.smaskStack.push({canvas:c.canvas,context:u,offsetX:a,offsetY:o,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}),(!e.smask||this.dependencyTracker)&&(i.setTransform(1,0,0,1,0,0),i.translate(a,o),i.save()),eO(i,u),this.ctx=u,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(i),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(i),this.groupLevel++}endGroup(t,e){if(!this.contentVisible)return;this.groupLevel--;let i=this.ctx,r=this.groupStack.pop();if(this.ctx=r,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();let e=tl(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...e);let r=eI.slice();H.axialAlignedBoundingBox([0,0,i.canvas.width,i.canvas.height],e,r),this.ctx.drawImage(i.canvas,0,0),this.ctx.restore(),this.compose(r)}}beginAnnotation(t,e,i,r,s,n){if(this.#rA(),eN(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),i){let s=i[2]-i[0],a=i[3]-i[1];if(n&&this.annotationCanvasMap){r=r.slice(),r[4]-=i[0],r[5]-=i[1],(i=i.slice())[0]=i[1]=0,i[2]=s,i[3]=a,H.singularValueDecompose2dScale(tl(this.ctx),eP);let{viewportScale:t}=this,n=Math.ceil(s*this.outputScaleX*t),o=Math.ceil(a*this.outputScaleY*t);this.annotationCanvas=this.canvasFactory.create(n,o);let{canvas:l,context:h}=this.annotationCanvas;this.annotationCanvasMap.set(e,l),this.annotationCanvas.savedCtx=this.ctx,this.ctx=h,this.ctx.save(),this.ctx.setTransform(eP[0],0,0,-eP[1],0,a*eP[1]),eN(this.ctx)}else{eN(this.ctx),this.endPath(t);let e=new Path2D;e.rect(i[0],i[1],s,a),this.ctx.clip(e)}}this.current=new eL(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(t,...r),this.transform(t,...s)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),this.#rw(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t,e){if(!this.contentVisible)return;let i=e.count;(e=this.getObject(t,e.data,e)).count=i;let r=this.ctx,s=this._createMaskCanvas(t,e),n=s.canvas;r.save(),r.setTransform(1,0,0,1,0,0),r.drawImage(n,s.offsetX,s.offsetY),this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,s.offsetX,s.offsetX+n.width,s.offsetY,s.offsetY+n.height).recordOperation(t),r.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,i,r=0,s=0,n,a){if(!this.contentVisible)return;e=this.getObject(t,e.data,e);let o=this.ctx;o.save();let l=tl(o);o.transform(i,r,s,n,0,0);let h=this._createMaskCanvas(t,e);o.setTransform(1,0,0,1,h.offsetX-l[4],h.offsetY-l[5]),this.dependencyTracker?.resetBBox(t);for(let e=0,d=a.length;e<d;e+=2){let d=H.transform(l,[i,r,s,n,a[e],a[e+1]]);o.drawImage(h.canvas,d[4],d[5]),this.dependencyTracker?.recordBBox(t,this.ctx,d[4],d[4]+h.canvas.width,d[5],d[5]+h.canvas.height)}
2o.restore(),this.compose(),this.dependencyTracker?.recordOperation(t)}paintImageMaskXObjectGroup(t,e){if(!this.contentVisible)return;let i=this.ctx,r=this.current.fillColor,s=this.current.patternFill;for(let n of(this.dependencyTracker?.resetBBox(t).recordDependencies(t,ey.transformAndFill),e)){let{data:e,width:a,height:o,transform:l}=n,h=this.cachedCanvases.getCanvas("maskCanvas",a,o),d=h.context;d.save(),eF(d,this.getObject(t,e,n)),d.globalCompositeOperation="source-in",d.fillStyle=s?r.getPattern(d,this,th(i),eA.FILL,t):r,d.fillRect(0,0,a,o),d.restore(),i.save(),i.transform(...l),i.scale(1,-1),eR(i,h.canvas,0,0,a,o,0,-1,1,1),this.dependencyTracker?.recordBBox(t,i,0,a,0,o),i.restore()}this.compose(),this.dependencyTracker?.recordOperation(t)}paintImageXObject(t,e){if(!this.contentVisible)return;let i=this.getObject(t,e);if(!i)return void _("Dependent image isn't ready yet");this.paintInlineImageXObject(t,i)}paintImageXObjectRepeat(t,e,i,r,s){if(!this.contentVisible)return;let n=this.getObject(t,e);if(!n)return void _("Dependent image isn't ready yet");let a=n.width,o=n.height,l=[];for(let t=0,e=s.length;t<e;t+=2)l.push({transform:[i,0,0,r,s[t],s[t+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(t,n,l)}applyTransferMapsToCanvas(t){return"none"!==this.current.transferMaps&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if("none"===this.current.transferMaps)return t.bitmap;let{bitmap:e,width:i,height:r}=t,s=this.cachedCanvases.getCanvas("inlineImage",i,r),n=s.context;return n.filter=this.current.transferMaps,n.drawImage(e,0,0),n.filter="none",s.canvas}paintInlineImageXObject(t,e){let i;if(!this.contentVisible)return;let r=e.width,s=e.height,n=this.ctx;this.save(t);let{filter:a}=n;if("none"!==a&&""!==a&&(n.filter="none"),n.scale(1/r,-1/s),e.bitmap)i=this.applyTransferMapsToBitmap(e);else if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)i=e;else{let t=this.cachedCanvases.getCanvas("inlineImage",r,s).context;eB(t,e),i=this.applyTransferMapsToCanvas(t)}let o=this._scaleImage(i,th(n));n.imageSmoothingEnabled=eU(tl(n),e.interpolate),this.dependencyTracker?.resetBBox(t).recordBBox(t,n,0,r,-s,0).recordDependencies(t,ey.imageXObject).recordOperation(t),eR(n,o.img,0,0,o.paintWidth,o.paintHeight,0,-s,r,s),this.compose(),this.restore(t)}paintInlineImageXObjectGroup(t,e,i){let r;if(!this.contentVisible)return;let s=this.ctx;if(e.bitmap)r=e.bitmap;else{let t=e.width,i=e.height,s=this.cachedCanvases.getCanvas("inlineImage",t,i).context;eB(s,e),r=this.applyTransferMapsToCanvas(s)}for(let e of(this.dependencyTracker?.resetBBox(t),i))s.save(),s.transform(...e.transform),s.scale(1,-1),eR(s,r,e.x,e.y,e.w,e.h,0,-1,1,1),this.dependencyTracker?.recordBBox(t,s,0,1,-1,0),s.restore();this.dependencyTracker?.recordOperation(t),this.compose()}paintSolidColorImageMask(t){this.contentVisible&&(this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,ey.fill).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t,e){}
2markPointProps(t,e,i){}beginMarkedContent(t,e){this.dependencyTracker?.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,i){this.dependencyTracker?.beginMarkedContent(t),"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(i)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(t){this.dependencyTracker?.endMarkedContent(t),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(t){}endCompat(t){}consumePath(t,e,i){let r=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(i);let s=this.ctx;this.pendingClip?(r||(this.pendingClip===e$?s.clip(e,"evenodd"):s.clip(e)),this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(t).recordFutureForcedDependency("clipPath",t)):this.dependencyTracker?.recordOperation(t),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let t=tl(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{let e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),r=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,r)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){let t,e,{lineWidth:i}=this.current,{a:r,b:s,c:n,d:a}=this.ctx.getTransform();if(0===s&&0===n){let s=Math.abs(r),n=Math.abs(a);if(s===n)if(0===i)t=e=1/s;else{let r=s*i;t=e=r<1?1/r:1}else if(0===i)t=1/s,e=1/n;else{let r=s*i,a=n*i;t=r<1?1/r:1,e=a<1?1/a:1}}else{let o=Math.abs(r*a-s*n),l=Math.hypot(r,s),h=Math.hypot(n,a);if(0===i)t=h/o,e=l/o;else{let r=i*o;t=h>r?h/r:1,e=l>r?l/r:1}}this._cachedScaleForStroking[0]=t,this._cachedScaleForStroking[1]=e}return this._cachedScaleForStroking}rescaleAndStroke(t,e){let{ctx:i,current:{lineWidth:r}}=this,[s,n]=this.getScaleForStroking();if(s===n){i.lineWidth=(r||1)*s,i.stroke(t);return}let a=i.getLineDash();e&&i.save(),i.scale(s,n),eD.a=1/s,eD.d=1/n;let o=new Path2D;if(o.addPath(t,eD),a.length>0){let t=Math.max(s,n);i.setLineDash(a.map(e=>e/t)),i.lineDashOffset/=t}i.lineWidth=r||1,i.stroke(o),e&&i.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}for(let t in w)void 0!==eG.prototype[t]&&(eG.prototype[w[t]]=eG.prototype[t]);class eV{static #rE=null;static #rS="";static get workerPort(){return this.#rE}static set workerPort(t){if(!("undefined"!=typeof Worker&&t instanceof Worker)&&null!==t)throw Error("Invalid `workerPort` type.");this.#rE=t}static get workerSrc(){return this.#rS}static set workerSrc(t){if("string"!=typeof t)throw Error("Invalid `workerSrc` type.");this.#rS=t}}class eW{#r_;#rT;constructor({parsedData:t,rawData:e}){this.#r_=t,this.#rT=e}getRaw(){return this.#rT}get(t){return this.#r_.get(t)??null}[Symbol.iterator](){return this.#r_.entries()}}let eK=Symbol("INTERNAL");class eX{#rC=!1;#rM=!1;#rD=!1;#rP=!0;constructor(t,{name:e,intent:i,usage:r,rbGroups:s}){this.#rC=!!(t&d.DISPLAY),this.#rM=!!(t&d.PRINT),this.name=e,this.intent=i,this.usage=r,this.rbGroups=s}get visible(){if(this.#rD)return this.#rP;if(!this.#rP)return!1;let{print:t,view:e}=this.usage;return this.#rC?e?.viewState!=="OFF":!this.#rM||t?.printState!=="OFF"}_setVisible(t,e,i=!1){t!==eK&&T("Internal method `_setVisible` called."),this.#rD=i,this.#rP=e}}class eq{#rI=null;#rk=new Map;#rR=null;#rL=null;constructor(t,e=d.DISPLAY){if(this.renderingIntent=e,this.name=null,this.creator=null,null===t)return;for(let i of(this.name=t.name,this.creator=t.creator,this.#rL=t.order,t.groups))this.#rk.set(i.id,new eX(e,i));if("OFF"===t.baseState)for(let t of this.#rk.values())t._setVisible(eK,!1);for(let e of t.on)this.#rk.get(e)._setVisible(eK,!0);for(let e of t.off)this.#rk.get(e)._setVisible(eK,!1);this.#rR=this.getHash()}#rB(t){let e=t.length;if(e<2)return!0;let i=t[0];for(let r=1;r<e;r++){let e,s=t[r];if(Array.isArray(s))e=this.#rB(s);else{if(!this.#rk.has(s))return _(`Optional content group not found: ${s}`),!0;e=this.#rk.get(s).visible}switch(i){case"And":if(!e)return!1;break;case"Or":if(e)return!0;break;case"Not":return!e;default:return!0}}return"And"===i}isVisible(t){if(0===this.#rk.size)return!0;
2if(!t)return S("Optional content group not defined."),!0;if("OCG"===t.type)return this.#rk.has(t.id)?this.#rk.get(t.id).visible:(_(`Optional content group not found: ${t.id}`),!0);if("OCMD"===t.type){if(t.expression)return this.#rB(t.expression);if(t.policy&&"AnyOn"!==t.policy){if("AllOn"===t.policy){for(let e of t.ids){if(!this.#rk.has(e)){_(`Optional content group not found: ${e}`);break}if(!this.#rk.get(e).visible)return!1}return!0}else if("AnyOff"===t.policy){for(let e of t.ids){if(!this.#rk.has(e))return _(`Optional content group not found: ${e}`),!0;if(!this.#rk.get(e).visible)return!0}return!1}else if("AllOff"===t.policy){for(let e of t.ids){if(!this.#rk.has(e)){_(`Optional content group not found: ${e}`);break}if(this.#rk.get(e).visible)return!1}return!0}}else{for(let e of t.ids){if(!this.#rk.has(e))return _(`Optional content group not found: ${e}`),!0;if(this.#rk.get(e).visible)return!0}return!1}return _(`Unknown optional content policy ${t.policy}.`),!0}return _(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,i=!0){let r=this.#rk.get(t);if(!r)return void _(`Optional content group not found: ${t}`);if(i&&e&&r.rbGroups.length)for(let e of r.rbGroups)for(let i of e)i!==t&&this.#rk.get(i)?._setVisible(eK,!1,!0);r._setVisible(eK,!!e,!0),this.#rI=null}setOCGState({state:t,preserveRB:e}){let i;for(let r of t){switch(r){case"ON":case"OFF":case"Toggle":i=r;continue}let t=this.#rk.get(r);if(t)switch(i){case"ON":this.setVisibility(r,!0,e);break;case"OFF":this.setVisibility(r,!1,e);break;case"Toggle":this.setVisibility(r,!t.visible,e)}}this.#rI=null}get hasInitialVisibility(){return null===this.#rR||this.getHash()===this.#rR}getOrder(){return this.#rk.size?this.#rL?this.#rL.slice():[...this.#rk.keys()]:null}getGroup(t){return this.#rk.get(t)||null}getHash(){if(null!==this.#rI)return this.#rI;let t=new tN;for(let[e,i]of this.#rk)t.update(`${e}:${i.visible}`);return this.#rI=t.hexdigest()}[Symbol.iterator](){return this.#rk.entries()}}o(116);class eY{#rF=null;#rO=null;_fullReader=null;_rangeReaders=new Set;_source=null;constructor(t,e,i){this._source=t,this.#rF=e,this.#rO=i}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return C(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new this.#rF(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new this.#rO(this,t,e);return this._rangeReaders.add(i),i}cancelAllRequests(t){for(let e of(this._fullReader?.cancel(t),new Set(this._rangeReaders)))e.cancel(t)}}class eQ{onProgress=null;_contentLength=0;_filename=null;_headersCapability=Promise.withResolvers();_isRangeSupported=!1;_isStreamingSupported=!1;_loaded=0;_stream=null;constructor(t){this._stream=t}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(){T("Abstract method `read` called")}cancel(t){T("Abstract method `cancel` called")}}class eJ{_stream=null;constructor(t,e,i){this._stream=t}async read(){T("Abstract method `read` called")}cancel(t){T("Abstract method `cancel` called")}}function eZ(t){return t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer}class e0 extends eY{_progressiveDone=!1;_queuedChunks=[];constructor(t){super(t,e1,e2);let{pdfDataRangeTransport:e}=t,{initialData:i,progressiveDone:r}=e;if(i?.length>0){let t=eZ(i);this._queuedChunks.push(t)}this._progressiveDone=r,e.addRangeListener((t,e)=>{this.#rN(t,e)}),e.addProgressListener((t,e)=>{void 0!==e&&this._fullReader?.onProgress?.({loaded:t,total:e})}),e.addProgressiveReadListener(t=>{this.#rN(void 0,t)}),e.addProgressiveDoneListener(()=>{this._fullReader?.progressiveDone(),this._progressiveDone=!0}),e.transportReady()}#rN(t,e){let i=eZ(e);if(void 0===t)this._fullReader?this._fullReader._enqueue(i):this._queuedChunks.push(i);else{let e=this._rangeReaders.keys().find(e=>e._begin===t);C(e,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),e._enqueue(i)}}getFullReader(){let t=super.getFullReader();return this._queuedChunks=null,t}getRangeReader(t,e){let i=super.getRangeReader(t,e);return i&&(i.onDone=()=>this._rangeReaders.delete(i),this._source.pdfDataRangeTransport.requestDataRange(t,e)),i}cancelAllRequests(t){super.cancelAllRequests(t),this._source.pdfDataRangeTransport.abort()}}class e1 extends eQ{_done=!1;_queuedChunks=null;_requests=[];constructor(t){super(t);let{pdfDataRangeTransport:e,disableRange:i,disableStream:r}=t._source,{length:s,contentDispositionFilename:n}=e;for(let e of(this._queuedChunks=t._queuedChunks||[],this._queuedChunks))this._loaded+=e.byteLength;this._done=t._progressiveDone,this._contentLength=s,this._isStreamingSupported=!r,this._isRangeSupported=!i,te(n)&&(this._filename=n),this._headersCapability.resolve()}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||=!0}}class e2 extends eJ{onDone=null;_begin=-1;_done=!1;_queuedChunk=null;_requests=[];constructor(t,e,i){super(t,e,i),this._begin=e}_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{for(let e of(this._requests.shift().resolve({value:t,done:!1}),this._requests))e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this.onDone?.()}}async read(){if(this._queuedChunk){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this.onDone?.()}}function e5(t,e){let i=new Headers;if(!t||!e||"object"!=typeof e)return i;for(let t in e){let r=e[t];void 0!==r&&i.append(t,r)}return i}function e3(t){return URL.parse(t)?.origin??null}function e6({responseHeaders:t,isHttp:e,rangeChunkSize:i,disableRange:r}){let s={allowRangeRequests:!1,suggestedLength:void 0},n=parseInt(t.get("Content-Length"),10);return Number.isInteger(n)&&(s.suggestedLength=n,n<=2*i||r||!e||"bytes"!==t.get("Accept-Ranges")||"identity"!==(t.get("Content-Encoding")||"identity")||(s.allowRangeRequests=!0)),s}function e4(t){let e=t.get("Content-Disposition");if(e){let t=function(t){let e=!0,i=r("filename\\*","i").exec(t);if(i){let t=a(i=i[1]);return n(t=l(t=o(t=unescape(t))))}if(i=function(t){let e,i=[],s=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(e=s.exec(t));){let[,t,r,s]=e;if((t=parseInt(t,10))in i){if(0===t)break;continue}i[t]=[r,s]}let n=[];for(let t=0;t<i.length&&t in i;++t){let[e,r]=i[t];r=a(r),e&&(r=unescape(r),0===t&&(r=o(r))),n.push(r)}return n.join("")}(t))return n(l(i));
2if(i=r("filename","i").exec(t)){let t=a(i=i[1]);return n(t=l(t))}function r(t,e){return RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function s(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{let r=new TextDecoder(t,{fatal:!0}),s=N(i);i=r.decode(s),e=!1}catch{}}return i}function n(t){return e&&/[\x80-\xff]/.test(t)&&(t=s("utf-8",t),e&&(t=s("iso-8859-1",t))),t}function a(t){if(t.startsWith('"')){let e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){let i=e[t].indexOf('"');-1!==i&&(e[t]=e[t].slice(0,i),e.length=t+1),e[t]=e[t].replaceAll(/\\(.)/g,"$1")}t=e.join('"')}return t}function o(t){let e=t.indexOf("'");return -1===e?t:s(t.slice(0,e),t.slice(e+1).replace(/^[^']*'/,""))}function l(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(t,e,i,r){if("q"===i||"Q"===i)return s(e,r=(r=r.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(t,e){return String.fromCharCode(parseInt(e,16))}));try{r=atob(r)}catch{}return s(e,r)})}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(te(t))return t}return null}function e9(t,e){return new B(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t,404===t||0===t&&e.startsWith("file:"))}function e8(t,e){if(t!==e)throw Error(`Expected range response-origin "${t}" to match "${e}".`)}function e7(t,e,i,r){return fetch(t,{method:"GET",headers:e,signal:r.signal,mode:"cors",credentials:i?"include":"same-origin",redirect:"follow"})}function it(t,e){if(200!==t&&206!==t)throw e9(t,e)}function ie(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(_(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class ii extends eY{_responseOrigin=null;constructor(t){super(t,ir,is),this.isHttp=/^https?:/i.test(t.url),this.headers=e5(this.isHttp,t.httpHeaders)}}class ir extends eQ{_abortController=new AbortController;_reader=null;constructor(t){super(t);let{disableRange:e,disableStream:i,length:r,rangeChunkSize:s,url:n,withCredentials:a}=t._source;this._contentLength=r,this._isStreamingSupported=!i,this._isRangeSupported=!e,e7(n,new Headers(t.headers),a,this._abortController).then(i=>{t._responseOrigin=e3(i.url),it(i.status,n),this._reader=i.body.getReader();let r=i.headers,{allowRangeRequests:a,suggestedLength:o}=e6({responseHeaders:r,isHttp:t.isHttp,rangeChunkSize:s,disableRange:e});this._isRangeSupported=a,this._contentLength=o||this._contentLength,this._filename=e4(r),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new O("Streaming is disabled.")),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:ie(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class is extends eJ{_abortController=new AbortController;_readCapability=Promise.withResolvers();_reader=null;constructor(t,e,i){super(t,e,i);let{url:r,withCredentials:s}=t._source,n=new Headers(t.headers);n.append("Range",`bytes=${e}-${i-1}`),e7(r,n,s,this._abortController).then(e=>{e8(e3(e.url),t._responseOrigin),it(e.status,r),this._reader=e.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:{value:ie(t),done:!1}}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class ia extends eY{#rU=new WeakMap;_responseOrigin=null;constructor(t){super(t,io,il),this.url=t.url,this.isHttp=/^https?:/i.test(this.url),this.headers=e5(this.isHttp,t.httpHeaders)}_request(t){let e=new XMLHttpRequest,i={validateStatus:null,onHeadersReceived:t.onHeadersReceived,onDone:t.onDone,onError:t.onError,onProgress:t.onProgress};for(let[t,r]of(this.#rU.set(e,i),e.open("GET",this.url),e.withCredentials=this._source.withCredentials,this.headers))e.setRequestHeader(t,r);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.validateStatus=t=>206===t||200===t):i.validateStatus=t=>200===t,e.responseType="arraybuffer",C(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>t.onError(e.status),e.onreadystatechange=this.#rz.bind(this,e),e.onprogress=this.#rH.bind(this,e),e.send(null),e}#rH(t,e){let i=this.#rU.get(t);i?.onProgress?.(e)}#rz(t,e){var i;let r=this.#rU.get(t);if(!r||(t.readyState>=2&&r.onHeadersReceived&&(r.onHeadersReceived(),delete r.onHeadersReceived),4!==t.readyState||!this.#rU.has(t)))return;if(this.#rU.delete(t),0===t.status&&this.isHttp)return void r.onError(t.status);let s=t.status||200;if(!r.validateStatus(s))return void r.onError(t.status);let n="string"!=typeof(i=t.response)?i:N(i).buffer;if(206===s){let e=t.getResponseHeader("Content-Range");/bytes (\d+)-(\d+)\/(\d+)/.test(e)?r.onDone(n):(_('Missing or invalid "Content-Range" header.'),r.onError(0))}else n?r.onDone(n):r.onError(t.status)}
2_abortRequest(t){this.#rU.has(t)&&(this.#rU.delete(t),t.abort())}getRangeReader(t,e){let i=super.getRangeReader(t,e);return i&&(i.onClosed=()=>this._rangeReaders.delete(i)),i}}class io extends eQ{_cachedChunks=[];_done=!1;_requests=[];_storedError=null;constructor(t){super(t);let{length:e}=t._source;this._contentLength=e,this._fullRequestXhr=t._request({onHeadersReceived:this.#rj.bind(this),onDone:this.#r$.bind(this),onError:this.#rG.bind(this),onProgress:this.#rH.bind(this)})}#rj(){let t=this._stream,{disableRange:e,rangeChunkSize:i}=t._source,r=this._fullRequestXhr;t._responseOrigin=e3(r.responseURL);let s=r.getAllResponseHeaders(),n=new Headers(s?s.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(t=>{let[e,...i]=t.split(": ");return[e,i.join(": ")]}):[]),{allowRangeRequests:a,suggestedLength:o}=e6({responseHeaders:n,isHttp:t.isHttp,rangeChunkSize:i,disableRange:e});a&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=e4(n),this._isRangeSupported&&t._abortRequest(r),this._headersCapability.resolve()}#r$(t){if(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._cachedChunks.push(t),this._done=!0,!(this._cachedChunks.length>0)){for(let t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}#rG(t){for(let e of(this._storedError=e9(t,this._stream.url),this._headersCapability.reject(this._storedError),this._requests))e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}#rH(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}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};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let e of(this._done=!0,this._headersCapability.reject(t),this._requests))e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}}class il extends eJ{onClosed=null;_done=!1;_queuedChunk=null;_requests=[];_storedError=null;constructor(t,e,i){super(t,e,i),this._requestXhr=t._request({begin:e,end:i,onHeadersReceived:this.#rj.bind(this),onDone:this.#r$.bind(this),onError:this.#rG.bind(this),onProgress:null})}#rj(){let t=e3(this._requestXhr?.responseURL);try{e8(t,this._stream._responseOrigin)}catch(t){this._storedError=t,this.#rG(0)}}#r$(t){for(let e of(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0,this._requests))e.resolve({value:void 0,done:!0});this._requests.length=0,this.onClosed?.()}#rG(t){for(let e of(this._storedError??=e9(t,this._stream.url),this._requests))e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._abortRequest(this._requestXhr),this.onClosed?.()}}let ih=/^[a-z][a-z0-9\-+.]+:/i;function id(t){let{Readable:e}=r.getBuiltinModule("stream");return"function"==typeof e.toWeb?e.toWeb(t):r.getBuiltinModule("module").createRequire("file:///srv/elysia-tools/releases/dd069ad671319d6ce6a6048c8e6fabaa61db1be2/frontends/node_modules/pdfjs-dist/legacy/build/pdf.mjs")("node-readable-to-web-readable-stream").makeDefaultReadableStreamFromNodeReadable(t)}function ic(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(_(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class iu extends eY{constructor(t){super(t,ip,ig),this.url=function(t){return new URL(ih.test(t)?t:r.getBuiltinModule("url").pathToFileURL(t))}(t.url),C("file:"===this.url.protocol,"PDFNodeStream only supports file:// URLs.")}}class ip extends eQ{_reader=null;constructor(t){super(t);let{disableRange:e,disableStream:i,length:s,rangeChunkSize:n}=t._source;this._contentLength=s,this._isStreamingSupported=!i,this._isRangeSupported=!e;let a=t.url,o=r.getBuiltinModule("fs");o.promises.lstat(a).then(t=>{let e=id(o.createReadStream(a));this._reader=e.getReader();let{size:i}=t;i<=2*n&&(this._isRangeSupported=!1),this._contentLength=i,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new O("Streaming is disabled.")),this._headersCapability.resolve()}).catch(t=>{"ENOENT"===t.code&&(t=e9(0,a.href)),this._headersCapability.reject(t)})}async read(){await this._headersCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:ic(t),done:!1})}cancel(t){this._reader?.cancel(t)}}class ig extends eJ{_readCapability=Promise.withResolvers();_reader=null;constructor(t,e,i){super(t,e,i);let s=t.url,n=r.getBuiltinModule("fs");try{let t=n.createReadStream(s,{start:e,end:i-1}),r=id(t);this._reader=r.getReader(),this._readCapability.resolve()}catch(t){this._readCapability.reject(t)}}async read(){await this._readCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:{value:ic(t),done:!1}}cancel(t){this._reader?.cancel(t)}}let im=Symbol("INITIAL_DATA");class ib{#rV=Object.create(null);#rW(t){return this.#rV[t]||={...Promise.withResolvers(),data:im}}get(t,e=null){if(e){let i=this.#rW(t);return i.promise.then(()=>e(i.data)),null}let i=this.#rV[t];if(!i||i.data===im)throw Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){let e=this.#rV[t];return!!e&&e.data!==im}delete(t){let e=this.#rV[t];return!!e&&e.data!==im&&(delete this.#rV[t],!0)}resolve(t,e=null){let i=this.#rW(t);i.data=e,i.resolve()}clear(){for(let t in this.#rV){let{data:e}=this.#rV[t];e?.bitmap?.close()}this.#rV=Object.create(null)}*[Symbol.iterator](){for(let t in this.#rV){let{data:e}=this.#rV[t];e!==im&&(yield[t,e])}}}class iv{#rK=Promise.withResolvers();#tk=null;#rX=!1;#rq=!!globalThis.FontInspector?.enabled;#rY=null;#rQ=null;#rJ=0;#rZ=0;#r0=null;#r1=null;#r2=0;#r5=0;#r3=Object.create(null);#r6=[];#r4=null;#r9=[];
2#r8=new WeakMap;#r7=null;static #st=new Map;static #se=new Map;static #si=new WeakMap;static #sr=null;static #ss=new Set;constructor({textContentSource:t,container:e,viewport:i}){if(t instanceof ReadableStream)this.#r4=t;else if("object"==typeof t)this.#r4=new ReadableStream({start(e){e.enqueue(t),e.close()}});else throw Error('No "textContentSource" parameter specified.');this.#tk=this.#r1=e,this.#r5=i.scale*tc.pixelRatio,this.#r2=i.rotation,this.#rQ={div:null,properties:null,ctx:null};let{pageWidth:r,pageHeight:s,pageX:n,pageY:a}=i.rawDims;this.#r7=[1,0,0,-1,-n,a+s],this.#rZ=r,this.#rJ=s,iv.#sn(),e.style.setProperty("--min-font-size",iv.#sr),td(e,i),this.#rK.promise.finally(()=>{iv.#ss.delete(this),this.#rQ=null,this.#r3=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=U.platform;return P(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){let t=()=>{this.#r0.read().then(({value:e,done:i})=>{if(i)return void this.#rK.resolve();this.#rY??=e.lang,Object.assign(this.#r3,e.styles),this.#sa(e.items),t()},this.#rK.reject)};return this.#r0=this.#r4.getReader(),iv.#ss.add(this),t(),this.#rK.promise}update({viewport:t,onBefore:e=null}){let i=t.scale*tc.pixelRatio,r=t.rotation;if(r!==this.#r2&&(e?.(),this.#r2=r,td(this.#r1,{rotation:r})),i!==this.#r5){e?.(),this.#r5=i;let t={div:null,properties:null,ctx:iv.#so(this.#rY)};for(let e of this.#r9)t.properties=this.#r8.get(e),t.div=e,this.#sl(t)}}cancel(){let t=new O("TextLayer task cancelled.");this.#r0?.cancel(t).catch(()=>{}),this.#r0=null,this.#rK.reject(t)}get textDivs(){return this.#r9}get textContentItemsStr(){return this.#r6}#sa(t){if(this.#rX)return;this.#rQ.ctx??=iv.#so(this.#rY);let e=this.#r9,i=this.#r6;for(let r of t){if(e.length>1e5){_("Ignoring additional textDivs for performance reasons."),this.#rX=!0;return}if(void 0===r.str){if("beginMarkedContentProps"===r.type||"beginMarkedContent"===r.type){let t=this.#tk;this.#tk=document.createElement("span"),this.#tk.classList.add("markedContent"),r.id&&this.#tk.setAttribute("id",`${r.id}`),"Artifact"===r.tag&&(this.#tk.ariaHidden=!0),t.append(this.#tk)}else"endMarkedContent"===r.type&&(this.#tk=this.#tk.parentNode);continue}i.push(r.str),this.#sh(r)}}#sh(t){let e,i,r=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};this.#r9.push(r);let n=H.transform(this.#r7,t.transform),a=Math.atan2(n[1],n[0]),o=this.#r3[t.fontName];o.vertical&&(a+=Math.PI/2);let l=this.#rq&&o.fontSubstitution||o.fontFamily;l=iv.fontFamilyMap.get(l)||l;let h=Math.hypot(n[2],n[3]),d=h*iv.#sd(l,o,this.#rY);0===a?(e=n[4],i=n[5]-d):(e=n[4]+d*Math.sin(a),i=n[5]-d*Math.cos(a));let c=r.style;c.left=`${(100*e/this.#rZ).toFixed(2)}%`,c.top=`${(100*i/this.#rJ).toFixed(2)}%`,c.setProperty("--font-height",`${h.toFixed(2)}px`),c.fontFamily=l,s.fontSize=h,r.setAttribute("role","presentation"),r.textContent=t.str,r.dir=t.dir,this.#rq&&(r.dataset.fontName=o.fontSubstitutionLoadedName||t.fontName),0!==a&&(s.angle=180/Math.PI*a);let u=!1;if(t.str.length>1)u=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){let e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(u=!0)}if(u&&(s.canvasWidth=o.vertical?t.height:t.width),this.#r8.set(r,s),this.#rQ.div=r,this.#rQ.properties=s,this.#sl(this.#rQ),s.hasText&&this.#tk.append(r),s.hasEOL){let t=document.createElement("br");t.setAttribute("role","presentation"),this.#tk.append(t)}}#sl(t){let{div:e,properties:i,ctx:r}=t,{style:s}=e;if(0!==i.canvasWidth&&i.hasText){let{fontFamily:t}=s,{canvasWidth:n,fontSize:a}=i;iv.#sc(r,a*this.#r5,t);let{width:o}=r.measureText(e.textContent);o>0&&s.setProperty("--scale-x",n*this.#r5/o)}0!==i.angle&&s.setProperty("--rotate",`${i.angle}deg`)}static cleanup(){if(!(this.#ss.size>0)){for(let{canvas:t}of(this.#st.clear(),this.#se.values()))t.remove();this.#se.clear()}}static #so(t=null){let e=this.#se.get(t||="");if(!e){let i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#se.set(t,e),this.#si.set(e,{size:0,family:""})}return e}static #sc(t,e,i){let r=this.#si.get(t);(e!==r.size||i!==r.family)&&(t.font=`${e}px ${i}`,r.size=e,r.family=i)}static #sn(){if(null!==this.#sr)return;let t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),this.#sr=t.getBoundingClientRect().height,t.remove()}static #sd(t,e,i){let r=this.#st.get(t);if(r)return r;let s=this.#so(i);s.canvas.width=s.canvas.height=30,this.#sc(s,30,t);let n=s.measureText(""),a=n.fontBoundingBoxAscent,o=Math.abs(n.fontBoundingBoxDescent);s.canvas.width=s.canvas.height=0;let l=.8;return a?l=a/(a+o):(U.platform.isFirefox&&_("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?l=e.ascent:e.descent&&(l=1+e.desce
2nt)),this.#st.set(t,l),l}}function iy(t={}){"string"==typeof t||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});let e=new iA,{docId:i}=e,r=t.url?function(t){if(t instanceof URL)return t.href;if("string"==typeof t){if(l)return t;let e=URL.parse(t,window.location);if(e)return e.href}throw Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(t.url):null,n=t.data?function(t){if(l&&void 0!==s&&t instanceof s)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"==typeof t)return N(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"==typeof t&&!isNaN(t?.length))return new Uint8Array(t);throw Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(t.data):null,a=t.httpHeaders||null,o=!0===t.withCredentials,h=t.password??null,d=t.range instanceof iw?t.range:null,c=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:65536,u=t.worker instanceof iS?t.worker:null,p=t.verbosity,g="string"!=typeof t.docBaseUrl||tt(t.docBaseUrl)?null:t.docBaseUrl,m=tq(t.cMapUrl),f=!1!==t.cMapPacked,b=t.CMapReaderFactory||(l?eo:t9),v=tq(t.iccUrl),y=tq(t.standardFontDataUrl),A=t.StandardFontDataFactory||(l?el:ee),w=tq(t.wasmUrl),x=t.WasmFactory||(l?eh:er),S=!0!==t.stopAtErrors,_=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,T=!1!==t.isEvalSupported,C="boolean"==typeof t.isOffscreenCanvasSupported?t.isOffscreenCanvasSupported:!l,M="boolean"==typeof t.isImageDecoderSupported?t.isImageDecoderSupported:!l&&(U.platform.isFirefox||!globalThis.chrome),D=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,P="boolean"==typeof t.disableFontFace?t.disableFontFace:l,I=!0===t.fontExtraProperties,k=!0===t.enableXfa,R=t.ownerDocument||globalThis.document,L=!0===t.disableRange,B=!0===t.disableStream,F=!0===t.disableAutoFetch,O=!0===t.pdfBug,z=t.CanvasFactory||(l?ea:t6),H=t.FilterFactory||(l?en:t7),j=!0===t.enableHWA,$=!1!==t.useWasm,G=d?d.length:t.length??NaN,V="boolean"==typeof t.useSystemFonts?t.useSystemFonts:!l&&!P,W="boolean"==typeof t.useWorkerFetch?t.useWorkerFetch:!!(b===t9&&A===ee&&x===er&&m&&y&&w&&tr(m,document.baseURI)&&tr(y,document.baseURI)&&tr(w,document.baseURI));Number.isInteger(p)&&(E=p);let K={canvasFactory:new z({ownerDocument:R,enableHWA:j}),filterFactory:new H({docId:i,ownerDocument:R}),cMapReaderFactory:W?null:new b({baseUrl:m,isCompressed:f}),standardFontDataFactory:W?null:new A({baseUrl:y}),wasmFactory:W?null:new x({baseUrl:w})};u||(e._worker=u=iS.create({verbosity:p,port:eV.workerPort}));let X={docId:i,apiVersion:"5.4.624",data:n,password:h,disableAutoFetch:F,rangeChunkSize:c,length:G,docBaseUrl:g,enableXfa:k,evaluatorOptions:{maxImageSize:_,disableFontFace:P,ignoreErrors:S,isEvalSupported:T,isOffscreenCanvasSupported:C,isImageDecoderSupported:M,canvasMaxAreaInBytes:D,fontExtraProperties:I,useSystemFonts:V,useWasm:$,useWorkerFetch:W,cMapUrl:m,iccUrl:v,standardFontDataUrl:y,wasmUrl:w}},q={ownerDocument:R,pdfBug:O,styleElement:null,enableHWA:j,loadingParams:{disableAutoFetch:F,enableXfa:k}};return u.promise.then(function(){let t;if(e.destroyed)throw Error("Loading aborted");if(u.destroyed)throw Error("Worker was destroyed");let s=u.messageHandler.sendWithPromise("GetDocRequest",X,n?[n.buffer]:null);if(d)t=new e0({pdfDataRangeTransport:d,disableRange:L,disableStream:B});else if(!n){if(!r)throw Error("getDocument - no `url` parameter provided.");t=new(tr(r)?ii:l?iu:ia)({url:r,length:G,httpHeaders:a,withCredentials:o,rangeChunkSize:c,disableRange:L,disableStream:B})}return s.then(r=>{if(e.destroyed)throw Error("Loading aborted");if(u.destroyed)throw Error("Worker was destroyed");let s=new t5(i,r,u.port),n=new i_(s,e,t,q,K);e._transport=n,s.send("Ready",null)})}).catch(e._capability.reject),e}class iA{static #iW=0;_capability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${iA.#iW++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(t){throw this._worker?.port&&delete this._worker._pendingDestroy,t}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}}class iw{#rK=Promise.withResolvers();#su=[];#sp=[];#sg=[];#sm=[];constructor(t,e,i=!1,r=null){this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=r}addRangeListener(t){this.#sm.push(t)}addProgressListener(t){this.#sg.push(t)}addProgressiveReadListener(t){this.#sp.push(t)}
2addProgressiveDoneListener(t){this.#su.push(t)}onDataRange(t,e){for(let i of this.#sm)i(t,e)}onDataProgress(t,e){this.#rK.promise.then(()=>{for(let i of this.#sg)i(t,e)})}onDataProgressiveRead(t){this.#rK.promise.then(()=>{for(let e of this.#sp)e(t)})}onDataProgressiveDone(){this.#rK.promise.then(()=>{for(let t of this.#su)t()})}transportReady(){this.#rK.resolve()}requestDataRange(t,e){T("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class ix{constructor(t,e){this._pdfInfo=t,this._transport=e}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 P(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAnnotationsByType(t,e){return this._transport.getAnnotationsByType(t,e)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}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(t){return this._transport.extractPages(t)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class iE{#sf=!1;#sb=tx.instance;constructor(t,e,i,r=!1){this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=r?new ti:null,this._pdfBug=r,this.commonObjs=i.commonObjs,this.objs=new ib,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null}get pageNumber(){return this._pageIndex+1}set pageNumber(t){this._pageIndex=t-1}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:t,rotation:e=this.rotate,offsetX:i=0,offsetY:r=0,dontFlip:s=!1}={}){return new J({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:r,dontFlip:s})}getAnnotations({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return P(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}
2render({canvasContext:t,canvas:e=t.canvas,viewport:i,intent:r="display",annotationMode:s=c.ENABLE,transform:n=null,background:a=null,optionalContentConfigPromise:o=null,annotationCanvasMap:l=null,pageColors:h=null,printAnnotationStorage:u=null,isEditing:p=!1,recordOperations:g=!1,operationsFilter:m=null}){this._stats?.time("Overall");let f=this._transport.getRenderingIntent(r,s,u,p),{renderingIntent:b,cacheKey:v}=f;this.#sf=!1,o||=this._transport.getOptionalContentConfig(b);let y=this._intentStates.get(v);y||(y=Object.create(null),this._intentStates.set(v,y)),y.streamReaderCancelTimeout&&(clearTimeout(y.streamReaderCancelTimeout),y.streamReaderCancelTimeout=null);let A=!!(b&d.PRINT);y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(f));let w=!!(this._pdfBug&&globalThis.StepperManager?.enabled),x=!this.recordedBBoxes&&(g||w),E=t=>{if(y.renderTasks.delete(S),x){let t=S.gfx?.dependencyTracker.take();t&&(S.stepper&&S.stepper.setOperatorBBoxes(t,S.gfx.dependencyTracker.takeDebugMetadata()),g&&(this.recordedBBoxes=t))}A&&(this.#sf=!0),this.#sv(),t?(S.capability.reject(t),this._abortOperatorList({intentState:y,reason:t instanceof Error?t:Error(t)})):S.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},S=new iC({callback:E,params:{canvas:e,canvasContext:t,dependencyTracker:x?new eb(e,y.operatorList.length,w):null,viewport:i,transform:n,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!A,pdfBug:this._pdfBug,pageColors:h,enableHWA:this._transport.enableHWA,operationsFilter:m});(y.renderTasks||=new Set).add(S);let _=S.task;return Promise.all([y.displayReadyCapability.promise,o]).then(([t,e])=>{if(this.destroyed)return void E();if(this._stats?.time("Rendering"),!(e.renderingIntent&b))throw Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");S.initializeGraphics({transparency:t,optionalContentConfig:e}),S.operatorListChanged()}).catch(E),_}getOperatorList({intent:t="display",annotationMode:e=c.ENABLE,printAnnotationStorage:i=null,isEditing:r=!1}={}){let s,n=this._transport.getRenderingIntent(t,e,i,r,!0),a=this._intentStates.get(n.cacheKey);return a||(a=Object.create(null),this._intentStates.set(n.cacheKey,a)),a.opListReadCapability||((s=Object.create(null)).operatorListChanged=function(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(s))},a.opListReadCapability=Promise.withResolvers(),(a.renderTasks||=new Set).add(s),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(n)),a.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:this.#sb.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(t=>K.textContent(t));let e=this.streamTextContent(t);return new Promise(function(t,i){let r=e.getReader(),s={items:[],styles:Object.create(null),lang:null};!function e(){r.read().then(function({value:i,done:r}){if(r)return void t(s);s.lang??=i.lang,Object.assign(s.styles,i.styles),s.items.push(...i.items),e()},i)}()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let t=[];for(let e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(let i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),this.#sf=!1,Promise.all(t)}cleanup(t=!1){this.#sf=!0;let e=this.#sv();
2return t&&e&&(this._stats&&=new ti),e}#sv(){if(!this.#sf||this.destroyed)return!1;for(let{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#sf=!1,!0}_startRenderPage(t,e){let i=this._intentStates.get(e);i&&(this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(t))}_renderPageChunk(t,e){for(let i=0,r=t.length;i<r;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);for(let i of(e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots,e.renderTasks))i.operatorListChanged();t.lastChunk&&this.#sv()}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:i,modifiedIds:r}){let{map:s,transfer:n}=i,a=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:this.#sb.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:s,modifiedIds:r},n).getReader(),o=this._intentStates.get(e);o.streamReader=a;let l=()=>{a.read().then(({value:t,done:e})=>{if(e){o.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(t,o),l())},t=>{if(o.streamReader=null,!this._transport.destroyed){if(o.operatorList){for(let t of(o.operatorList.lastChunk=!0,o.renderTasks))t.operatorListChanged();this.#sv()}if(o.displayReadyCapability)o.displayReadyCapability.reject(t);else if(o.opListReadCapability)o.opListReadCapability.reject(t);else throw t}})};l()}_abortOperatorList({intentState:t,reason:e,force:i=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!i){if(t.renderTasks.size>0)return;if(e instanceof Z){let i=100;e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new O(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(let[e,i]of this._intentStates)if(i===t){this._intentStates.delete(e);break}this.cleanup()}}}get stats(){return this._stats}}class iS{#rK=Promise.withResolvers();#sy=null;#rE=null;#sA=null;static #sw=0;static #sx=!1;static #sE=new WeakMap;static{l&&(this.#sx=!0,eV.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(t,e)=>{let i=URL.parse(t);if(!i?.origin||"null"===i.origin)return!1;let r=new URL(e,i);return i.origin===r.origin},this._createCDNWrapper=t=>{let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},this.fromPort=t=>{if(console.log("Deprecated API usage: `PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!t?.port)throw Error("PDFWorker.fromPort - invalid method signature.");return this.create(t)}}constructor({name:t=null,port:e=null,verbosity:i=E}={}){if(this.name=t,this.destroyed=!1,this.verbosity=i,e){if(iS.#sE.has(e))throw Error("Cannot use more than one PDFWorker per port.");iS.#sE.set(e,this),this.#sS(e)}else this.#s_()}get promise(){return this.#rK.promise}#sT(){this.#rK.resolve(),this.#sy.send("configure",{verbosity:this.verbosity})}get port(){return this.#rE}get messageHandler(){return this.#sy}#sS(t){this.#rE=t,this.#sy=new t5("main","worker",t),this.#sy.on("ready",()=>{}),this.#sT()}#s_(){if(iS.#sx||iS.#sC)return void this.#sM();let{workerSrc:t}=iS;try{iS._isSameOrigin(window.location,t)||(t=iS._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),i=new t5("main","worker",e),r=()=>{s.abort(),i.destroy(),e.terminate(),this.destroyed?this.#rK.reject(Error("Worker was destroyed")):this.#sM()},s=new AbortController;e.addEventListener("error",()=>{this.#sA||r()},{signal:s.signal}),i.on("test",t=>{if(s.abort(),this.destroyed||!t)return void r();this.#sy=i,this.#rE=e,this.#sA=e,this.#sT()}),i.on("ready",t=>{if(s.abort(),this.destroyed)return void r();try{n()}catch{this.#sM()}});let n=()=>{let t=new Uint8Array;i.send("test",t,[t.buffer])};n();return}catch{S("The worker has been disabled.")}this.#sM()}#sM(){iS.#sx||(_("Setting up fake worker."),iS.#sx=!0),iS._setupFakeWorkerGlobal.then(t=>{if(this.destroyed)return void this.#rK.reject(Error("Worker was destroyed"));let e=new tJ;this.#rE=e;let i=`fake${iS.#sw++}`,r=new t5(i+"_worker",i,e);t.setup(r,e),this.#sy=new t5(i,i+"_worker",e),this.#sT()}).catch(t=>{this.#rK.reject(Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this.#sA?.terminate(),this.#sA=null,iS.#sE.delete(this.#rE),this.#rE=null,this.#sy?.destroy(),this.#sy=null}static create(t){let e=this.#sE.get(t?.port);
2if(e){if(e._pendingDestroy)throw Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new iS(t)}static get workerSrc(){if(eV.workerSrc)return eV.workerSrc;throw Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get #sC(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return P(this,"_setupFakeWorkerGlobal",(async()=>this.#sC?this.#sC:(await import(this.workerSrc)).WorkerMessageHandler)())}}class i_{downloadInfoCapability=Promise.withResolvers();#sD=null;#sP=new Map;#sI=null;#sk=new Map;#sR=new Map;#sL=new Map;#sB=null;#sb=tx.instance;constructor(t,e,i,r,s){this.messageHandler=t,this.loadingTask=e,this.#sI=i,this.commonObjs=new ib,this.fontLoader=new tj({ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this.enableHWA=r.enableHWA,this.loadingParams=r.loadingParams,this._params=r,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.wasmFactory=s.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler(),this.#sb.addListener(this.#sF.bind(this))}#sF(){let t=new Map,e=new Map;for(let i=0,r=this.#sb.pagesNumber;i<r;i++){let r=this.#sb.getPrevPageNumber(i+1)-1,s=this.#sk.get(r);s&&t.set(i,s);let n=this.#sR.get(r);n&&e.set(i,n)}this.#sk=t,this.#sR=e}#sO(t,e=null){let i=this.#sP.get(t);if(i)return i;let r=this.messageHandler.sendWithPromise(t,e);return this.#sP.set(t,r),r}#rH({loaded:t,total:e}){this.loadingTask.onProgress?.({loaded:t,total:e,percent:W(Math.round(t/e*100),0,100)})}get annotationStorage(){return P(this,"annotationStorage",new tz)}getRenderingIntent(t,e=c.ENABLE,i=null,r=!1,s=!1){let n=d.DISPLAY,a=tU;switch(t){case"any":n=d.ANY;break;case"display":break;case"print":n=d.PRINT;break;default:_(`getRenderingIntent - invalid intent: ${t}`)}let o=n&d.PRINT&&i instanceof tH?i:this.annotationStorage;switch(e){case c.DISABLE:n+=d.ANNOTATIONS_DISABLE;break;case c.ENABLE:break;case c.ENABLE_FORMS:n+=d.ANNOTATIONS_FORMS;break;case c.ENABLE_STORAGE:n+=d.ANNOTATIONS_STORAGE,a=o.serializable;break;default:_(`getRenderingIntent - invalid annotationMode: ${e}`)}r&&(n+=d.IS_EDITING),s&&(n+=d.OPLIST);let{ids:l,hash:h}=o.modifiedIds,u=[n,a.hash,h];return{renderingIntent:n,cacheKey:u.join("_"),annotationStorageSerializable:a,modifiedIds:l}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#sB?.reject(Error("Worker was destroyed during onPassword callback"));let t=[];for(let e of this.#sk.values())t.push(e._destroy());this.#sk.clear(),this.#sR.clear(),this.#sL.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#sP.clear(),this.filterFactory.destroy(),iv.cleanup(),this.#sI?.cancelAllRequests(new O("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(t,e)=>{C(this.#sI,"GetReader - no `BasePDFStream` instance available."),this.#sD=this.#sI.getFullReader(),this.#sD.onProgress=t=>this.#rH(t),e.onPull=()=>{this.#sD.read().then(function({value:t,done:i}){if(i)return void e.close();C(t instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t])}).catch(t=>{e.error(t)})},e.onCancel=t=>{this.#sD.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("ReaderHeadersReady",async t=>{await this.#sD.headersReady;let{isStreamingSupported:e,isRangeSupported:i,contentLength:r}=this.#sD;return e&&i&&(this.#sD.onProgress=null),{isStreamingSupported:e,isRangeSupported:i,contentLength:r}}),t.on("GetRangeReader",(t,e)=>{C(this.#sI,"GetRangeReader - no `BasePDFStream` instance available.");let i=this.#sI.getRangeReader(t.begin,t.end);if(!i)return void e.close();e.onPull=()=>{i.read().then(function({value:t,done:i}){if(i)return void e.close();C(t instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t])}).catch(t=>{e.error(t)})},e.onCancel=t=>{i.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("GetDoc",({pdfInfo:t})=>{this.#sb.pagesNumber=t.numPages,this._numPages=t.numPages,this._htmlForXfa=t.htmlForXfa,delete t.htmlForXfa,e._capability.resolve(new ix(t,this))}),t.on("DocException",t=>{e._capability.reject(t2(t))}
2),t.on("PasswordRequest",t=>{this.#sB=Promise.withResolvers();try{if(!e.onPassword)throw t2(t);let i=t=>{t instanceof Error?this.#sB.reject(t):this.#sB.resolve({password:t})};e.onPassword(i,t.code)}catch(t){this.#sB.reject(t)}return this.#sB.promise}),t.on("DataLoaded",t=>{this.#rH({loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)}),t.on("StartRenderPage",t=>{this.destroyed||this.#sk.get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)}),t.on("commonobj",([e,i,r])=>{if(this.destroyed||this.commonObjs.has(e))return null;switch(i){case"Font":if("error"in r){let t=r.error;_(`Error during font loading: ${t}`),this.commonObjs.resolve(e,t);break}let s=new t$(new tW(r),this._params.pdfBug&&globalThis.FontInspector?.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,r.extra,r.charProcOperatorList);this.fontLoader.bind(s).catch(()=>t.sendWithPromise("FontFallback",{id:e})).finally(()=>{!s.fontExtraProperties&&s.data&&s.clearData(),this.commonObjs.resolve(e,s)});break;case"CopyLocalImage":let{imageRef:n}=r;for(let t of(C(n,"The imageRef must be defined."),this.#sk.values()))for(let[,i]of t.objs)if(i?.ref===n){if(!i.dataLen)return null;return this.commonObjs.resolve(e,structuredClone(i)),i.dataLen}break;case"FontPath":this.commonObjs.resolve(e,new tX(r));break;case"Image":this.commonObjs.resolve(e,r);break;case"Pattern":let a=new tK(r);this.commonObjs.resolve(e,a.getIR());break;default:throw Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([t,e,i,r])=>{if(this.destroyed)return;let s=this.#sk.get(e);if(!s.objs.has(t)){if(0===s._intentStates.size)return void r?.bitmap?.close();switch(i){case"Image":case"Pattern":s.objs.resolve(t,r);break;default:throw Error(`Got unknown object type ${i}`)}}}),t.on("DocProgress",t=>{this.destroyed||this.#rH(t)}),t.on("FetchBinaryData",async t=>{if(this.destroyed)throw Error("Worker was destroyed.");let e=this[t.type];if(!e)throw Error(`${t.type} not initialized, see the \`useWorkerFetch\` parameter.`);return e.fetch(t)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&_("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this.#sD?.filename??null},e).finally(()=>{this.annotationStorage.resetModified()})}extractPages(t){return this.messageHandler.sendWithPromise("ExtractPages",{pageInfos:t})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this.#sb.pagesNumber)return Promise.reject(Error("Invalid page request."));let e=t-1,i=this.#sb.getPageId(t)-1,r=this.#sR.get(e);if(r)return r;let s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:i}).then(t=>{if(this.destroyed)throw Error("Transport destroyed");t.refStr&&this.#sL.set(t.refStr,i);let r=new iE(e,t,this,this._params.pdfBug);return this.#sk.set(e,r),r});return this.#sR.set(e,s),s}async getPageIndex(t){if(!tY(t))throw Error("Invalid pageIndex request.");let e=await this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen});return this.#sb.getPageNumber(e+1)-1}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.#sb.getPageId(t+1)-1,intent:e})}getFieldObjects(){return this.#sO("GetFieldObjects")}hasJSActions(){return this.#sO("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!=typeof t?Promise.reject(Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}
2getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return this.#sO("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.#sb.getPageId(t+1)-1})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.#sb.getPageId(t+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#sO("GetOptionalContentConfig").then(e=>new eq(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata",e=this.#sP.get(t);if(e)return e;let i=this.messageHandler.sendWithPromise(t,null).then(t=>({info:t[0],metadata:t[1]?new eW(t[1]):null,contentDispositionFilename:this.#sD?.filename??null,contentLength:this.#sD?.contentLength??null,hasStructTree:t[2]}));return this.#sP.set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){for(let t of(await this.messageHandler.sendWithPromise("Cleanup",null),this.#sk.values()))if(!t.cleanup())throw Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#sP.clear(),this.filterFactory.destroy(!0),iv.cleanup()}}
2cachedPageNumber(t){if(!tY(t))return null;let e=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`,i=this.#sL.get(e);return i>=0?this.#sb.getPageNumber(i+1):null}}class iT{_internalRenderTask=null;onContinue=null;onError=null;constructor(t){this._internalRenderTask=t}get promise(){return this._internalRenderTask.capability.promise}cancel(t=0){this._internalRenderTask.cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=this._internalRenderTask.operatorList;if(!t)return!1;let{annotationCanvasMap:e}=this._internalRenderTask;return t.form||t.canvas&&e?.size>0}}class iC{#sN=null;static #sU=new WeakSet;constructor({callback:t,params:e,objs:i,commonObjs:r,annotationCanvasMap:s,operatorList:n,pageIndex:a,canvasFactory:o,filterFactory:l,useRequestAnimationFrame:h=!1,pdfBug:d=!1,pageColors:c=null,enableHWA:u=!1,operationsFilter:p=null}){this.callback=t,this.params=e,this.objs=i,this.commonObjs=r,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=n,this._pageIndex=a,this.canvasFactory=o,this.filterFactory=l,this._pdfBug=d,this.pageColors=c,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===h&&"undefined"!=typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new iT(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=e.canvas,this._canvasContext=e.canvas?null:e.canvasContext,this._enableHWA=u,this._dependencyTracker=e.dependencyTracker,this._operationsFilter=p}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(iC.#sU.has(this._canvas))throw Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");iC.#sU.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{viewport:i,transform:r,background:s,dependencyTracker:n}=this.params,a=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new eG(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors,n),this.gfx.beginDrawing({transform:r,viewport:i,transparency:t,background:s}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,e=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#sN&&(window.cancelAnimationFrame(this.#sN),this.#sN=null),iC.#sU.delete(this._canvas),t||=new Z(`Rendering cancelled, page ${this._pageIndex+1}`,e),this.callback(t),this.task.onError?.(t)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.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?this.#sN=window.requestAnimationFrame(()=>{this.#sN=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(),iC.#sU.delete(this._canvas),this.callback())))}}let iM="5.4.624";class iD{#sz=null;#sH=null;#sj;#s$=null;#sG=!1;#sV=!1;#u=null;#sW;#sK=null;#S=null;static #sX=null;static get _keyboardManager(){return P(this,"_keyboardManager",new tP([[["Escape","mac+Escape"],iD.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],iD.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],iD.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],iD.prototype._moveToPrevious],[["Home","mac+Home"],iD.prototype._moveToBeginning],[["End","mac+End"],iD.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:e=null}){t?(this.#sV=!1,this.#u=t):this.#sV=!0,this.#S=t?._uiManager||e,this.#sW=this.#S._eventBus,this.#sj=t?.color?.toUpperCase()||this.#S?.highlightColors.values().next().value||"#FFFF98",iD.#sX||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){let t=this.#sz=document.createElement("button");
2t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",this.#u&&(t.ariaControls=`${this.#u.id}_colorpicker_dropdown`);let e=this.#S._signal;t.addEventListener("click",this.#sq.bind(this),{signal:e}),t.addEventListener("keydown",this.#sY.bind(this),{signal:e});let i=this.#sH=document.createElement("span");return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=this.#sj,t.append(i),t}renderMainDropdown(){let t=this.#s$=this.#sQ();return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}#sQ(){let t=document.createElement("div"),e=this.#S._signal;for(let[i,r]of(t.addEventListener("contextmenu",ts,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),this.#u&&(t.id=`${this.#u.id}_colorpicker_dropdown`),this.#S.highlightColors)){let s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",r),s.title=i,s.setAttribute("data-l10n-id",iD.#sX[i]);let n=document.createElement("span");s.append(n),n.className="swatch",n.style.backgroundColor=r,s.ariaSelected=r===this.#sj,s.addEventListener("click",this.#sJ.bind(this,r),{signal:e}),t.append(s)}return t.addEventListener("keydown",this.#sY.bind(this),{signal:e}),t}#sJ(t,e){e.stopPropagation(),this.#sW.dispatch("switchannotationeditorparams",{source:this,type:g.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)}_colorSelectFromKeyboard(t){if(t.target===this.#sz)return void this.#sq(t);let e=t.target.getAttribute("data-color");e&&this.#sJ(e,t)}_moveToNext(t){return this.#sZ?t.target===this.#sz?void this.#s$.firstElementChild?.focus():void t.target.nextSibling?.focus():void this.#sq(t)}_moveToPrevious(t){if(t.target===this.#s$?.firstElementChild||t.target===this.#sz){this.#sZ&&this._hideDropdownFromKeyboard();return}this.#sZ||this.#sq(t),t.target.previousSibling?.focus()}_moveToBeginning(t){if(!this.#sZ)return void this.#sq(t);this.#s$.firstElementChild?.focus()}_moveToEnd(t){if(!this.#sZ)return void this.#sq(t);this.#s$.lastElementChild?.focus()}#sY(t){iD._keyboardManager.exec(this,t)}#sq(t){if(this.#sZ)return void this.hideDropdown();if(this.#sG=0===t.detail,this.#sK||(this.#sK=new AbortController,window.addEventListener("pointerdown",this.#y.bind(this),{signal:this.#S.combinedSignal(this.#sK)})),this.#sz.ariaExpanded="true",this.#s$)return void this.#s$.classList.remove("hidden");let e=this.#s$=this.#sQ();this.#sz.append(e)}#y(t){this.#s$?.contains(t.target)||this.hideDropdown()}hideDropdown(){this.#s$?.classList.add("hidden"),this.#sz.ariaExpanded="false",this.#sK?.abort(),this.#sK=null}get #sZ(){return this.#s$&&!this.#s$.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(!this.#sV){if(!this.#sZ)return void this.#u?.unselect();this.hideDropdown(),this.#sz.focus({preventScroll:!0,focusVisible:this.#sG})}}updateColor(t){if(this.#sH&&(this.#sH.style.backgroundColor=t),!this.#s$)return;let e=this.#S.highlightColors.values();for(let i of this.#s$.children)i.ariaSelected=e.next().value===t.toUpperCase()}destroy(){this.#sz?.remove(),this.#sz=null,this.#sH=null,this.#s$?.remove(),this.#s$=null}}class iP{#s0=null;#u=null;#S=null;static #sX=null;constructor(t){this.#u=t,this.#S=t._uiManager,iP.#sX||=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"})}renderButton(){if(this.#s0)return this.#s0;let{editorType:t,colorType:e,color:i}=this.#u,r=this.#s0=document.createElement("input");return r.type="color",r.value=i||"#000000",r.className="basicColorPicker",r.tabIndex=0,r.setAttribute("data-l10n-id",iP.#sX[t]),r.addEventListener("input",()=>{this.#S.updateParams(e,r.value)},{signal:this.#S._signal}),r}update(t){this.#s0&&(this.#s0.value=t)}destroy(){this.#s0?.remove(),this.#s0=null}hideDropdown(){}}function iI(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function ik(t){return Math.max(0,Math.min(255,255*t))}o(531);class iR{static CMYK_G([t,e,i,r]){return["G",1-Math.min(1,.3*t+.59*i+.11*e+r)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return[t=ik(t),t,t]}static G_HTML([t]){let e=iI(t);return`#${e}${e}${e}`}static RGB_G([t,e,i]){return["G",.3*t+.59*e+.11*i]}static RGB_rgb(t){return t.map(ik)}static RGB_HTML(t){return`#${t.map(iI).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,i,r]){return["RGB",1-Math.min(1,t+r),1-Math.min(1,i+r),1-Math.min(1,e+r)]}static CMYK_rgb([t,e,i,r]){return[ik(1-Math.min(1,t+r)),ik(1-Math.min(1,i+r)),ik(1-Math.min(1,e+r))]}static CMYK_HTML(t){let e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,i]){let r=1-t,s=1-e,n=1-i,a=Math.min(r,s,n);return["CMYK",r,s,n,a]}}class iL{create(t,e,i=!1){if(t<=0||e<=0)throw Error("Invalid SVG dimensions");let r=this._createSVG("svg:svg");return r.setAttribute("version","1.1"),i||(r.setAttribute("width",`${t}px`),r.setAttribute("height",`${e}px`)),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${t} ${e}`),r}createElement(t){if("string"!=typeof t)throw Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){T("Abstract method `_createSVG` called.")}}class iB extends iL{_createSVG(t){return document.createElementNS(q,t)}}let iF=new WeakSet,iO=60*new Date().getTimezoneOffset()*1e3;class iN{static create(t){switch(t.data.annotationType){case v.LINK:return new iH(t);case v.TEXT:return new ij(t);case v.WIDGET:switch(t.data.fieldType){case"Tx":return new iG(t);case"Btn":if(t.data.radioButton)return new iK(t);if(t.data.checkBox)return new iW(t);return new iX(t);case"Ch":return new iq(t);case"Sig":return new iV(t)}return new i$(t);case v.POPUP:return new iY(t);case v.FREETEXT:return new iJ(t);case v.LINE:return new iZ(t);case v.SQUARE:return new i0(t);case v.CIRCLE:return new i1(t);case v.POLYLINE:return new i2(t);case v.CARET:return new i3(t);case v.INK:return new i6(t);case v.POLYGON:return new i5(t);case v.HIGHLIGHT:return new i4(t);case v.UNDERLINE:return new i9(t);case v.SQUIGGLY:return new i8(t);case v.STRIKEOUT:return new i7(t);case v.STAMP:return new rt(t);case v.FILEATTACHMENT:return new re(t);default:return new iU(t)}}}class iU{#s1=null;#s2=!1;#s5=null;constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:r=!1}={}){this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableComment=t.enableComment,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,this.hasOwnCommentButton=!1,e&&(this.contentElement=this.container=this._createContainer(i)),r&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!!(t?.str||e?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return iU._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){let{data:t}=this,e=this.annotationStorage?.getEditor(t.id);return e?e.getData():t}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}
2get commentButtonPosition(){let t=this.annotationStorage?.getEditor(this.data.id);if(t)return t.commentButtonPositionInPage;let{quadPoints:e,inkLists:i,rect:r}=this.data,s=-1/0,n=-1/0;if(e?.length>=8){for(let t=0;t<e.length;t+=8)e[t+1]>n?(n=e[t+1],s=e[t+2]):e[t+1]===n&&(s=Math.max(s,e[t+2]));return[s,n]}if(i?.length>=1){for(let t of i)for(let e=0,i=t.length;e<i;e+=2)t[e+1]>n?(n=t[e+1],s=t[e]):t[e+1]===n&&(s=Math.max(s,t[e]));if(s!==1/0)return[s,n]}return r?[r[2],r[3]]:null}_normalizePoint(t){let{page:{view:e},viewport:{rawDims:{pageWidth:i,pageHeight:r,pageX:s,pageY:n}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-s)/i,t[1]=100*(t[1]-n)/r,t}get commentText(){let{data:t}=this;return this.annotationStorage.getRawValue(`${u}${t.id}`)?.popup?.contents||t.contentsObj?.str||""}set commentText(t){let{data:e}=this,i={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:i})||this.annotationStorage.setValue(`${u}${e.id}`,{id:e.id,annotationType:e.annotationType,page:this.parent.page,popup:i,popupRef:e.popupRef,modificationDate:new Date}),t||this.removePopup()}removePopup(){(this.#s5?.popup||this.popup)?.remove(),this.#s5=this.popup=null}updateEdited(t){if(!this.container)return;t.rect&&(this.#s1||={rect:this.data.rect.slice(0)});let{rect:e,popup:i}=t;e&&this.#s3(e);let r=this.#s5?.popup||this.popup;!r&&i?.text&&(this._createPopup(i),r=this.#s5.popup),r&&(r.updateEdited(t),i?.deleted&&(r.remove(),this.#s5=null,this.popup=null))}resetEdited(){this.#s1&&(this.#s3(this.#s1.rect),this.#s5?.popup.resetEdited(),this.#s1=null)}#s3(t){let{container:{style:e},data:{rect:i,rotation:r},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:n,pageX:a,pageY:o}}}}=this;i?.splice(0,4,...t),e.left=`${100*(t[0]-a)/s}%`,e.top=`${100*(n-t[3]+o)/n}%`,0===r?(e.width=`${100*(t[2]-t[0])/s}%`,e.height=`${100*(t[3]-t[1])/n}%`):this.setRotation(r)}_createContainer(t){let{data:e,parent:{page:i,viewport:r}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",e.id),this instanceof i$||this instanceof iH||(s.tabIndex=0);let{style:n}=s;if(n.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(s.title=e.alternativeText),e.noRotate&&s.classList.add("norotate"),!e.rect||this instanceof iY){let{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,s),s}let{width:a,height:o}=this;if(!t&&e.borderStyle.width>0){n.borderWidth=`${e.borderStyle.width}px`;let t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;switch(t>0||i>0?n.borderRadius=`calc(${t}px * var(--total-scale-factor)) / calc(${i}px * var(--total-scale-factor))`:this instanceof iK&&(n.borderRadius=`calc(${a}px * var(--total-scale-factor)) / calc(${o}px * var(--total-scale-factor))`),e.borderStyle.style){case y.SOLID:n.borderStyle="solid";break;case y.DASHED:n.borderStyle="dashed";break;case y.BEVELED:_("Unimplemented border style: beveled");break;case y.INSET:_("Unimplemented border style: inset");break;case y.UNDERLINE:n.borderBottomStyle="solid"}let r=e.borderColor||null;r?(this.#s2=!0,n.borderColor=H.makeHexColor(0|r[0],0|r[1],0|r[2])):n.borderWidth=0}let l=H.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:h,pageHeight:d,pageX:c,pageY:u}=r.rawDims;n.left=`${100*(l[0]-c)/h}%`,n.top=`${100*(l[1]-u)/d}%`;let{rotation:p}=e;return e.hasOwnCanvas||0===p?(n.width=`${100*a/h}%`,n.height=`${100*o/d}%`):this.setRotation(p,s),s}setRotation(t,e=this.container){if(!this.data.rect)return;let{pageWidth:i,pageHeight:r}=this.parent.viewport.rawDims,{width:s,height:n}=this;t%180!=0&&([s,n]=[n,s]),e.style.width=`${100*s/i}%`,e.style.height=`${100*n/r}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){let t=(t,e,i)=>{let r=i.detail[t],s=r[0],n=r.slice(1);i.target.style[e]=iR[`${s}_HTML`](n),this.annotationStorage.setValue(this.data.id,{[e]:iR[`${s}_rgb`](n)})};return P(this,"_commonActions",{display:t=>{let{display:e}=t.detail,i=e%2==1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===e||2===e})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{let{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout(()=>
2t.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:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{let e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){let i=this._commonActions;for(let r of Object.keys(e.detail)){let s=t[r]||i[r];s?.(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;let e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;let i=this._commonActions;for(let[r,s]of Object.entries(e)){let n=i[r];n&&(n({detail:{[r]:s},target:t}),delete e[r])}}_createQuadrilaterals(){let t;if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[i,r,s,n]=this.data.rect.map(t=>Math.fround(t));if(8===e.length){let[t,a,o,l]=e.subarray(2,6);if(s===t&&n===a&&i===o&&r===l)return}let{style:a}=this.container;if(this.#s2){let{borderColor:e,borderWidth:i}=a;a.borderWidth=0,t=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${e}" stroke-width="${i}">`],this.container.classList.add("hasBorder")}let o=s-i,l=n-r,{svgFactory:h}=this,d=h.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0),d.role="none";let c=h.createElement("defs");d.append(c);let u=h.createElement("clipPath"),p=`clippath_${this.data.id}`;u.setAttribute("id",p),u.setAttribute("clipPathUnits","objectBoundingBox"),c.append(u);for(let r=2,s=e.length;r<s;r+=8){let s=e[r],a=e[r+1],d=e[r+2],c=e[r+3],p=h.createElement("rect"),g=(d-i)/o,m=(n-a)/l,f=(s-d)/o,b=(a-c)/l;p.setAttribute("x",g),p.setAttribute("y",m),p.setAttribute("width",f),p.setAttribute("height",b),u.append(p),t?.push(`<rect vector-effect="non-scaling-stroke" x="${g}" y="${m}" width="${f}" height="${b}"/>`)}this.#s2&&(t.push("</g></svg>')"),a.backgroundImage=t.join("")),this.container.append(d),this.container.style.clipPath=`url(#${p})`}_createPopup(t=null){let e,i,{data:r}=this;t?(e={str:t.text},i=t.date):(e=r.contentsObj,i=r.modificationDate),this.#s5=new iY({data:{color:r.color,titleObj:r.titleObj,modificationDate:i,contentsObj:e,richText:r.richText,parentRect:r.rect,borderStyle:0,id:`popup_${r.id}`,rotation:r.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]})}get hasPopupElement(){return!!(this.#s5||this.popup||this.data.popupRef)}get extraPopupElement(){return this.#s5}render(){T("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){let i=[];if(this._fieldObjects){let r=this._fieldObjects[t];if(r)for(let{page:t,id:s,exportValues:n}of r){if(-1===t||s===e)continue;let r="string"==typeof n?n:null,a=document.querySelector(`[data-element-id="${s}"]`);if(a&&!iF.has(a)){_(`_getElementsByName - element not allowed: ${s}`);continue}i.push({id:s,exportValue:r,domElement:a})}return i}for(let r of document.getElementsByName(t)){let{exportValue:t}=r,s=r.getAttribute("data-element-id");s!==e&&iF.has(r)&&i.push({id:s,exportValue:t,domElement:r})}return i}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(let e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}}class iz extends iU{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.editor=t.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){let{editor:t}=this;t.hasComment&&this._createPopup(t.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}
2get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(t){this.editor.comment=t,t||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}}class iH extends iU{constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!e?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){let{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let r=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),r=!0):t.action?(this._bindNamedAction(i,t.action,t.overlaidText),r=!0):t.attachment?(this.#s6(i,t.attachment,t.overlaidText,t.attachmentDest),r=!0):t.setOCGState?(this.#s4(i,t.setOCGState,t.overlaidText),r=!0):t.dest?(this._bindLink(i,t.dest,t.overlaidText),r=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),r=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(i,""),r=!0)),this.container.classList.add("linkAnnotation"),r&&(this.contentElement=i,this.container.append(i)),this.container}#s9(){this.container.setAttribute("data-internal-link","")}_bindLink(t,e,i=""){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&this.#s9(),i&&(t.title=i)}_bindNamedAction(t,e,i=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),i&&(t.title=i),this.#s9()}#s6(t,e,i="",r=null){t.href=this.linkService.getAnchorUrl(""),e.description?t.title=e.description:i&&(t.title=i),t.onclick=()=>(this.downloadManager?.openOrDownloadData(e.content,e.filename,r),!1),this.#s9()}#s4(t,e,i=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),i&&(t.title=i),this.#s9()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");let i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let r of Object.keys(e.actions)){let s=i.get(r);s&&(t[s]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:r}}),!1))}e.overlaidText&&(t.title=e.overlaidText),t.onclick||(t.onclick=()=>!1),this.#s9()}_bindResetFormAction(t,e){let i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),this.#s9(),!this._fieldObjects){_('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(t.onclick=()=>!1);return}t.onclick=()=>{i?.();let{fields:t,refs:r,include:s}=e,n=[];if(0!==t.length||0!==r.length){let e=new Set(r);for(let i of t)for(let{id:t}of this._fieldObjects[i]||[])e.add(t);for(let t of Object.values(this._fieldObjects))for(let i of t)e.has(i.id)===s&&n.push(i)}else for(let t of Object.values(this._fieldObjects))n.push(...t);let a=this.annotationStorage,o=[];for(let t of n){let{id:e}=t;switch(o.push(e),t.type){case"text":{let i=t.defaultValue||"";a.setValue(e,{value:i});break}case"checkbox":case"radiobutton":{let i=t.defaultValue===t.exportValues;a.setValue(e,{value:i});break}case"combobox":case"listbox":{let i=t.defaultValue||"";a.setValue(e,{value:i});break}default:continue}let i=document.querySelector(`[data-element-id="${e}"]`);if(i){if(!iF.has(i)){_(`_bindResetFormAction - element not allowed: ${e}`);continue}i.dispatchEvent(new Event("resetform"))}}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}}),!1}}}class ij extends iU{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(t),this.container}}
2class i$ extends iU{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return U.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,r,s){i.includes("mouse")?t.addEventListener(i,t=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:r,value:s(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})}):t.addEventListener(i,t=>{if("blur"===i){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:r,value:s(t)}})})}_setEventListeners(t,e,i,r){for(let[s,n]of i)("Action"===n||this.data.actions?.[n])&&(("Focus"===n||"Blur"===n)&&(e||={focused:!1}),this._setEventListener(t,e,s,n,r),"Focus"!==n||this.data.actions?.Blur?"Blur"!==n||this.data.actions?.Focus||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null))}_setBackgroundColor(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":H.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){let e,{fontColor:i}=this.data.defaultAppearanceData,r=this.data.defaultAppearanceData.fontSize||9,s=t.style,n=t=>Math.round(10*t)/10;if(this.data.multiLine){let t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),i=Math.round(t/(1.35*r))||1;e=Math.min(r,n(t/i/1.35))}else e=Math.min(r,n(Math.abs(this.data.rect[3]-this.data.rect[1]-2)/1.35));s.fontSize=`calc(${e}px * var(--total-scale-factor))`,s.color=H.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(s.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class iG extends i${constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,i,r){let s=this.annotationStorage;
2for(let n of this._getElementsByName(t.name,t.id))n.domElement&&(n.domElement[e]=i),s.setValue(n.id,{[r]:i})}render(){let t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){let r=t.getValue(e,{value:this.data.fieldValue}),s=r.value||"",n=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;n&&s.length>n&&(s=s.slice(0,n));let a=r.formattedValue||this.data.textContent?.join("\n")||null;a&&this.data.comb&&(a=a.replaceAll(/\s+/g,""));let o={userValue:s,formattedValue:a,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?((i=document.createElement("textarea")).textContent=a??s,this.data.doNotScroll&&(i.style.overflowY="hidden")):((i=document.createElement("input")).type=this.data.password?"password":"text",i.setAttribute("value",a??s),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),iF.add(i),this.contentElement=i,i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=0;let{datetimeFormat:l,datetimeType:h,timeStep:d}=this.data,c=!!h&&this.enableScripting;l&&(i.title=l),this._setRequired(i,this.data.required),n&&(i.maxLength=n),i.addEventListener("input",r=>{t.setValue(e,{value:r.target.value}),this.setPropertyOnSiblings(i,"value",r.target.value,"value"),o.formattedValue=null}),i.addEventListener("resetform",t=>{let e=this.data.defaultFieldValue??"";i.value=o.userValue=e,o.formattedValue=null});let u=t=>{let{formattedValue:e}=o;null!=e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",t=>{if(o.focused)return;let{target:e}=t;if(c&&(e.type=h,d&&(e.step=d)),o.userValue){let t=o.userValue;if(c)if("time"===h){let i=new Date(t);e.value=[i.getHours(),i.getMinutes(),i.getSeconds()].map(t=>t.toString().padStart(2,"0")).join(":")}else e.value=new Date(t-iO).toISOString().split("date"===h?"T":".",1)[0];else e.value=t}o.lastCommittedValue=e.value,o.commitKey=1,this.data.actions?.Focus||(o.focused=!0)}),i.addEventListener("updatefromsandbox",i=>{this.showElementAndHideCanvas(i.target),this._dispatchEventFromSandbox({value(i){o.userValue=i.detail.value??"",c||t.setValue(e,{value:o.userValue.toString()}),i.target.value=o.userValue},formattedValue(i){let{formattedValue:r}=i.detail;o.formattedValue=r,null!=r&&i.target!==document.activeElement&&(i.target.value=r);let s={formattedValue:r};c&&(s.value=r),t.setValue(e,s)},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{let{charLimit:r}=i.detail,{target:s}=i;if(0===r)return void s.removeAttribute("maxLength");s.setAttribute("maxLength",r);let n=o.userValue;n&&!(n.length<=r)&&(s.value=o.userValue=n=n.slice(0,r),t.setValue(e,{value:n}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,willCommit:!0,commitKey:1,selStart:s.selectionStart,selEnd:s.selectionEnd}}))}},i)}),i.addEventListener("keydown",t=>{o.commitKey=1;let i=-1;if("Escape"===t.key?i=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(o.commitKey=3):i=2,-1===i)return;let{value:r}=t.target;o.lastCommittedValue!==r&&(o.lastCommittedValue=r,o.userValue=r,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:i,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))});let r=u;u=null,i.addEventListener("blur",t=>{if(!o.focused||!t.relatedTarget)return;this.data.actions?.Blur||(o.focused=!1);let{target:i}=t,{value:s}=i;if(c){if(s&&"time"===h){let t=s.split(":").map(t=>parseInt(t,10));s=new Date(2e3,0,1,t[0],t[1],t[2]||0).valueOf(),i.step=""}else s.includes("T")||(s=`${s}T00:00`),s=new Date(s).valueOf();i.type="text"}o.userValue=s,o.lastCommittedValue!==s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,willCommit:!0,commitKey:o.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}),r(t)}),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",t=>{o.lastCommittedValue=null;let{data:i,target:r}=t,{value:s,selectionStart:n,selectionEnd:a}=r,l=n,h=a;switch(t.inputType){case"deleteWordBackward":{let t=s.substring(0,n).match(/\w*[^\
2w]*$/);t&&(l-=t[0].length);break}case"deleteWordForward":{let t=s.substring(n).match(/^[^\w]*\w*/);t&&(h+=t[0].length);break}case"deleteContentBackward":n===a&&(l-=1);break;case"deleteContentForward":n===a&&(h+=1)}t.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,change:i||"",willCommit:!1,selStart:l,selEnd:h}})}),this._setEventListeners(i,o,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.value)}if(u&&i.addEventListener("blur",u),this.data.comb){let t=(this.data.rect[2]-this.data.rect[0])/n;i.classList.add("comb"),i.style.letterSpacing=`calc(${t}px * var(--total-scale-factor) - 1ch)`}}else(i=document.createElement("div")).textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class iV extends i${constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class iW extends i${constructor(t){super(t,{isRenderable:t.renderForms})}render(){let t=this.annotationStorage,e=this.data,i=e.id,r=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"==typeof r&&(r="Off"!==r,t.setValue(i,{value:r})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let s=document.createElement("input");return iF.add(s),s.setAttribute("data-element-id",i),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=e.fieldName,r&&s.setAttribute("checked",!0),s.setAttribute("exportValue",e.exportValue),s.tabIndex=0,s.addEventListener("change",r=>{let{name:s,checked:n}=r.target;for(let r of this._getElementsByName(s,i)){let i=n&&r.exportValue===e.exportValue;r.domElement&&(r.domElement.checked=i),t.setValue(r.id,{value:i})}t.setValue(i,{value:n})}),s.addEventListener("resetform",t=>{let i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue}),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}},e)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class iK extends i${constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let t=this.annotationStorage,e=this.data,i=e.id,r=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"==typeof r&&(r=r!==e.buttonValue,t.setValue(i,{value:r})),r)for(let r of this._getElementsByName(e.fieldName,i))t.setValue(r.id,{value:!1});let s=document.createElement("input");if(iF.add(s),s.setAttribute("data-element-id",i),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=e.fieldName,r&&s.setAttribute("checked",!0),s.tabIndex=0,s.addEventListener("change",e=>{let{name:r,checked:s}=e.target;for(let e of this._getElementsByName(r,i))t.setValue(e.id,{value:!1});t.setValue(i,{value:s})}),s.addEventListener("resetform",t=>{let i=e.defaultFieldValue;t.target.checked=null!=i&&i===e.buttonValue}),this.enableScripting&&this.hasJSActions){let r=e.buttonValue;s.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value:e=>{let s=r===e.detail.value;for(let r of this._getElementsByName(e.target.name)){let e=s&&r.id===i;r.domElement&&(r.domElement.checked=e),t.setValue(r.id,{value:e})}}},e)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)}
2return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class iX extends iH{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){let t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");let e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({},t)})),t}}class iq extends i${constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),r=document.createElement("select");iF.add(r),r.setAttribute("data-element-id",e),r.disabled=this.data.readOnly,this._setRequired(r,this.data.required),r.name=this.data.fieldName,r.tabIndex=0;let s=this.data.combo&&this.data.options.length>0;for(let t of(!this.data.combo&&(r.size=this.data.options.length,this.data.multiSelect&&(r.multiple=!0)),r.addEventListener("resetform",t=>{let e=this.data.defaultFieldValue;for(let t of r.options)t.selected=t.value===e}),this.data.options)){let e=document.createElement("option");e.textContent=t.displayValue,e.value=t.exportValue,i.value.includes(t.exportValue)&&(e.setAttribute("selected",!0),s=!1),r.append(e)}let n=null;if(s){let t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),r.prepend(t),n=()=>{t.remove(),r.removeEventListener("input",n),n=null},r.addEventListener("input",n)}let a=t=>{let e=t?"value":"textContent",{options:i,multiple:s}=r;return s?Array.prototype.filter.call(i,t=>t.selected).map(t=>t[e]):-1===i.selectedIndex?null:i[i.selectedIndex][e]},o=a(!1),l=t=>{let e=t.target.options;return Array.prototype.map.call(e,t=>({displayValue:t.textContent,exportValue:t.value}))};return this.enableScripting&&this.hasJSActions?(r.addEventListener("updatefromsandbox",i=>{this._dispatchEventFromSandbox({value(i){n?.();let s=i.detail.value,l=new Set(Array.isArray(s)?s:[s]);for(let t of r.options)t.selected=l.has(t.value);t.setValue(e,{value:a(!0)}),o=a(!1)},multipleSelection(t){r.multiple=!0},remove(i){let s=r.options,n=i.detail.remove;s[n].selected=!1,r.remove(n),s.length>0&&-1===Array.prototype.findIndex.call(s,t=>t.selected)&&(s[0].selected=!0),t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},clear(i){for(;0!==r.length;)r.remove(0);t.setValue(e,{value:null,items:[]}),o=a(!1)},insert(i){let{index:s,displayValue:n,exportValue:h}=i.detail.insert,d=r.children[s],c=document.createElement("option");c.textContent=n,c.value=h,d?d.before(c):r.append(c),t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},items(i){let{items:s}=i.detail;for(;0!==r.length;)r.remove(0);for(let t of s){let{displayValue:e,exportValue:i}=t,s=document.createElement("option");s.textContent=e,s.value=i,r.append(s)}r.options.length>0&&(r.options[0].selected=!0),t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},indices(i){let r=new Set(i.detail.indices);for(let t of i.target.options)t.selected=r.has(t.index);t.setValue(e,{value:a(!0)}),o=a(!1)},editable(t){t.target.disabled=!t.detail.editable}},i)}),r.addEventListener("input",i=>{let r=a(!0),s=a(!1);t.setValue(e,{value:r}),i.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:s,changeEx:r,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(r,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],t=>t.target.value)):r.addEventListener("input",function(i){t.setValue(e,{value:a(!0)})}),this.data.combo&&this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class iY extends iU{constructor(t){let{data:e,elements:i,parent:r}=t,s=!!r._commentManager;if(super(t,{isRenderable:!s&&iU._hasPopupData(e)}),this.elements=i,s&&iU._hasPopupData(e)){let t=this.popup=this.#s8();for(let e of i)e.popup=t}else this.popup=null}#s8(){return new iQ({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,c
2ommentManager:this.parent._commentManager})}render(){let{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";let e=this.popup=this.#s8(),i=[];for(let t of this.elements)t.popup=e,t.container.ariaHasPopup="dialog",i.push(t.data.id),t.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(t=>`${V}${t}`).join(",")),this.container}}class iQ{#Y=null;#s7=this.#sY.bind(this);#nt=this.#ne.bind(this);#ni=this.#nr.bind(this);#ns=this.#nn.bind(this);#na=null;#tk=null;#no=null;#nl=null;#nh=null;#nd=null;#nc=null;#nu=!1;#np=null;#ng=null;#U=null;#nm=null;#nf=null;#eg=null;#nb=null;#ed=null;#nv=null;#s1=null;#ny=!1;#nA=null;#nw=null;constructor({container:t,color:e,elements:i,titleObj:r,modificationDate:s,contentsObj:n,richText:a,parent:o,rect:l,parentRect:h,open:d,commentManager:c=null}){this.#tk=t,this.#nv=r,this.#no=n,this.#ed=a,this.#nd=o,this.#na=e,this.#nb=l,this.#nc=h,this.#nh=i,this.#Y=c,this.#nA=i[0],this.#nl=ta.toDateObject(s),this.trigger=i.flatMap(t=>t.getElementsToTriggerPopup()),!c&&(this.#nx(),this.#tk.hidden=!0,d&&this.#nn())}#nx(){if(this.#ng)return;this.#ng=new AbortController;let{signal:t}=this.#ng;for(let e of this.trigger)e.addEventListener("click",this.#ns,{signal:t}),e.addEventListener("pointerenter",this.#ni,{signal:t}),e.addEventListener("pointerleave",this.#nt,{signal:t}),e.classList.add("popupTriggerArea");for(let e of this.#nh)e.container?.addEventListener("keydown",this.#s7,{signal:t})}#nE(){let t=this.#nh.find(t=>t.hasCommentButton);t&&(this.#nf=t._normalizePoint(t.commentButtonPosition))}renderCommentButton(){if(this.#nm){this.#nm.parentNode||this.#nA.container.after(this.#nm);return}if(this.#nf||this.#nE(),!this.#nf)return;let{signal:t}=this.#ng=new AbortController,e=this.#nA.hasOwnCommentButton,i=()=>{this.#Y.toggleCommentPopup(this,!0,void 0,!e)},r=()=>{this.#Y.toggleCommentPopup(this,!1,!0,!e)},s=()=>{this.#Y.toggleCommentPopup(this,!1,!1)};if(e)for(let e of(this.#nm=this.#nA.container,this.trigger))e.ariaHasPopup="dialog",e.ariaControls="commentPopup",e.addEventListener("keydown",this.#s7,{signal:t}),e.addEventListener("click",i,{signal:t}),e.addEventListener("pointerenter",r,{signal:t}),e.addEventListener("pointerleave",s,{signal:t}),e.classList.add("popupTriggerArea");else{let e=this.#nm=document.createElement("button");e.className="annotationCommentButton";let n=this.#nA.container;e.style.zIndex=n.style.zIndex+1,e.tabIndex=0,e.ariaHasPopup="dialog",e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button"),this.#nS(),this.#n_(),e.addEventListener("keydown",this.#s7,{signal:t}),e.addEventListener("click",i,{signal:t}),e.addEventListener("pointerenter",r,{signal:t}),e.addEventListener("pointerleave",s,{signal:t}),n.after(e)}}#n_(){if(this.#nA.extraPopupElement&&!this.#nA.editor)return;this.#nm||this.renderCommentButton();let[t,e]=this.#nf,{style:i}=this.#nm;i.left=`calc(${t}%)`,i.top=`calc(${e}% - var(--comment-button-dim))`}#nS(){this.#nA.extraPopupElement||(this.#nm||this.renderCommentButton(),this.#nm.style.backgroundColor=this.commentButtonColor||"")}get commentButtonColor(){let{color:t,opacity:e}=this.#nA.commentData;return t?this.#nd._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{this.#nm?.focus()},0)}getData(){let{richText:t,color:e,opacity:i,creationDate:r,modificationDate:s}=this.#nA.commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:i,creationDate:r,modificationDate:s}}get elementBeforePopup(){return this.#nm}get comment(){return this.#nw||=this.#nA.commentText,this.#nw}set comment(t){t!==this.comment&&(this.#nA.commentText=this.#nw=t)}focus(){this.#nA.container?.focus()}get parentBoundingClientRect(){return this.#nA.layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){this.#nm&&(this.#nm.classList.toggle("selected",t),this.#nm.ariaExpanded=e)}setSelectedCommentButton(t){this.#nm.classList.toggle("selected",t)}get commentPopupPosition(){if(this.#eg)return this.#eg;let{x:t,y:e,height:i}=this.#nm.getBoundingClientRect(),{x:r,y:s,width:n,height:a}=this.#nA.layer.getBoundingClientRect();return[(t-r)/n,(e+i-s)/a]}set commentPopupPosition(t){this.#eg=t}hasDefaultPopupPosition(){return null===this.#eg}get commentButtonPosition(){return this.#nf}
2get commentButtonWidth(){return this.#nm.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){let[e,i]=this.#eg||this.commentButtonPosition.map(t=>t/100),r=this.parentBoundingClientRect,{x:s,y:n,width:a,height:o}=r;this.#Y.showDialog(null,this,s+e*a,n+i*o,{...t,parentDimensions:r})}render(){if(this.#np)return;let t=this.#np=document.createElement("div");if(t.className="popup",this.#na){let e=t.style.outlineColor=H.makeHexColor(...this.#na);t.style.backgroundColor=`color-mix(in srgb, ${e} 30%, white)`}let e=document.createElement("span");if(e.className="header",this.#nv?.str){let t=document.createElement("span");t.className="title",e.append(t),{dir:t.dir,str:t.textContent}=this.#nv}if(t.append(e),this.#nl){let t=document.createElement("time");t.className="popupDate",t.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),t.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#nl.valueOf()})),t.dateTime=this.#nl.toISOString(),e.append(t)}tA({html:this.#nT||this.#no.str,dir:this.#no?.dir,className:"popupContent"},t),this.#tk.append(t)}get #nT(){let t=this.#ed,e=this.#no;return t?.str&&(!e?.str||e.str===t.str)&&this.#ed.html||null}get #nC(){return this.#nT?.attributes?.style?.fontSize||0}get #nM(){return this.#nT?.attributes?.style?.color||null}#nD(t){let e=[],i={style:{color:this.#nM,fontSize:this.#nC?`calc(${this.#nC}px * var(--total-scale-factor))`:""}};for(let r of t.split("\n"))e.push({name:"span",value:r,attributes:i});return{str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}}}#sY(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&this.#nu)&&this.#nn()}updateEdited({rect:t,popup:e,deleted:i}){if(this.#Y){i?(this.remove(),this.#nw=null):e&&(e.deleted?this.remove():(this.#nS(),this.#nw=e.text)),t&&(this.#nf=null,this.#nE(),this.#n_());return}if(i||e?.deleted)return void this.remove();this.#nx(),this.#s1||={contentsObj:this.#no,richText:this.#ed},t&&(this.#U=null),e&&e.text&&(this.#ed=this.#nD(e.text),this.#nl=ta.toDateObject(e.date),this.#no=null),this.#np?.remove(),this.#np=null}resetEdited(){this.#s1&&({contentsObj:this.#no,richText:this.#ed}=this.#s1,this.#s1=null,this.#np?.remove(),this.#np=null,this.#U=null)}remove(){if(this.#ng?.abort(),this.#ng=null,this.#np?.remove(),this.#np=null,this.#ny=!1,this.#nu=!1,this.#nm?.remove(),this.#nm=null,this.trigger)for(let t of this.trigger)t.classList.remove("popupTriggerArea")}#nP(){if(null!==this.#U)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:r,pageY:s}}}=this.#nd,n=!!this.#nc,a=n?this.#nc:this.#nb;for(let t of this.#nh)if(!a||null!==H.intersect(t.data.rect,a)){a=t.data.rect,n=!0;break}let o=H.normalizeRect([a[0],t[3]-a[1]+t[1],a[2],t[3]-a[3]+t[1]]),l=n?a[2]-a[0]+5:0,h=o[0]+l,d=o[1];this.#U=[100*(h-r)/e,100*(d-s)/i];let{style:c}=this.#tk;c.left=`${this.#U[0]}%`,c.top=`${this.#U[1]}%`}#nn(){if(this.#Y)return void this.#Y.toggleCommentPopup(this,!1);this.#nu=!this.#nu,this.#nu?(this.#nr(),this.#tk.addEventListener("click",this.#ns),this.#tk.addEventListener("keydown",this.#s7)):(this.#ne(),this.#tk.removeEventListener("click",this.#ns),this.#tk.removeEventListener("keydown",this.#s7))}#nr(){this.#np||this.render(),this.isVisible?this.#nu&&this.#tk.classList.add("focused"):(this.#nP(),this.#tk.hidden=!1,this.#tk.style.zIndex=parseInt(this.#tk.style.zIndex)+1e3)}#ne(){this.#tk.classList.remove("focused"),!this.#nu&&this.isVisible&&(this.#tk.hidden=!0,this.#tk.style.zIndex=parseInt(this.#tk.style.zIndex)-1e3)}forceHide(){this.#ny=this.isVisible,this.#ny&&(this.#tk.hidden=!0)}maybeShow(){!this.#Y&&(this.#nx(),this.#ny&&(this.#np||this.#nr(),this.#ny=!1,this.#tk.hidden=!1))}get isVisible(){return!this.#Y&&!1===this.#tk.hidden}}class iJ extends iU{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=p.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let t=this.contentElement=document.createElement("div");for(let e of(t.classList.add("annotationTextContent"),t.setAttribute("role","comment"),this.textContent)){let i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}
2class iZ extends iU{#nI=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");let{data:t,width:e,height:i}=this,r=this.svgFactory.create(e,i,!0),s=this.#nI=this.svgFactory.createElement("svg:line");return s.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),s.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),s.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),s.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),s.setAttribute("stroke-width",t.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),r.append(s),this.container.append(r),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#nI}addHighlightArea(){this.container.classList.add("highlightArea")}}class i0 extends iU{#nk=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");let{data:t,width:e,height:i}=this,r=this.svgFactory.create(e,i,!0),s=t.borderStyle.width,n=this.#nk=this.svgFactory.createElement("svg:rect");return n.setAttribute("x",s/2),n.setAttribute("y",s/2),n.setAttribute("width",e-s),n.setAttribute("height",i-s),n.setAttribute("stroke-width",s||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),r.append(n),this.container.append(r),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#nk}addHighlightArea(){this.container.classList.add("highlightArea")}}class i1 extends iU{#nR=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");let{data:t,width:e,height:i}=this,r=this.svgFactory.create(e,i,!0),s=t.borderStyle.width,n=this.#nR=this.svgFactory.createElement("svg:ellipse");return n.setAttribute("cx",e/2),n.setAttribute("cy",i/2),n.setAttribute("rx",e/2-s/2),n.setAttribute("ry",i/2-s/2),n.setAttribute("stroke-width",s||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),r.append(n),this.container.append(r),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#nR}addHighlightArea(){this.container.classList.add("highlightArea")}}class i2 extends iU{#nL=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,vertices:e,borderStyle:i,popupRef:r},width:s,height:n}=this;if(!e)return this.container;let a=this.svgFactory.create(s,n,!0),o=[];for(let i=0,r=e.length;i<r;i+=2){let r=e[i]-t[0],s=t[3]-e[i+1];o.push(`${r},${s}`)}o=o.join(" ");let l=this.#nL=this.svgFactory.createElement(this.svgElementName);return l.setAttribute("points",o),l.setAttribute("stroke-width",i.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),a.append(l),this.container.append(a),!r&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#nL}addHighlightArea(){this.container.classList.add("highlightArea")}}class i5 extends i2{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class i3 extends iU{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}}class i6 extends iU{#nB=null;#nF=[];constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?p.HIGHLIGHT:p.INK}#nO(t,e){switch(t){case 90:return{transform:`rotate(90) translate(${-e[0]},${e[1]}) scale(1,-1)`,width:e[3]-e[1],height:e[2]-e[0]};case 180:return{transform:`rotate(180) translate(${-e[2]},${e[1]}) scale(1,-1)`,width:e[2]-e[0],height:e[3]-e[1]};case 270:return{transform:`rotate(270) translate(${-e[2]},${e[3]}) scale(1,-1)`,width:e[3]-e[1],height:e[2]-e[0]};default:return{transform:`translate(${-e[0]},${e[3]}) scale(1,-1)`,width:e[2]-e[0],height:e[3]-e[1]}}}render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,rotation:e,inkLists:i,borderStyle:r,popupRef:s}}=this,{transform:n,width:a,height:o}=this.#nO(e,t),l=this.svgFactory.create(a,o,!0),h=this.#nB=this.svgFactory.createElement("svg:g");l.append(h),h.setAttribute("stroke-width",r.width||1),h.setAttribute("stroke-linecap","round"),h.setAttribute("stroke-linejoin","round"),h.setAttribute("stroke-miterlimit",10),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),h.setAttribute("transform",n);for(let t=0,e=i.length;t<e;t++){let e=this.svgFactory.createElement(this.svgElementName);this.#nF.push(e),e.setAttribute("points",i[t].join(",")),h.append(e)}return!s&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(l),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);let{thickness:e,points:i,rect:r}=t,s=this.#nB;if(e>=0&&s.setAttribute("stroke-width",e||1),i)for(let t=0,e=this.#nF.length;t<e;t++)this.#nF[t].setAttribute("points",i[t].join(","));if(r){let{transform:t,width:e,height:i}=this.#nO(this.data.rotation,r);s.parentElement.setAttribute("viewBox",`0 0 ${e} ${i}`),s.setAttribute("transform",t)}}getElementsToTriggerPopup(){return this.#nF}addHighlightArea(){this.container.classList.add("highlightArea")}}class i4 extends iU{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=p.HIGHLIGHT}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){let e=document.createElement("mark");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}
2class i9 extends iU{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("underlineAnnotation"),t){let e=document.createElement("u");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class i8 extends iU{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("squigglyAnnotation"),t){let e=document.createElement("u");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class i7 extends iU{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("strikeoutAnnotation"),t){let e=document.createElement("s");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class rt extends iU{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=p.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}}class re extends iU{#nN=null;constructor(t){super(t,{isRenderable:!0});let{file:e}=this.data;this.filename=e.filename,this.content=e.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...e})}render(){let t;this.container.classList.add("fileAttachmentAnnotation");let{container:e,data:i}=this;i.hasAppearance||0===i.fillAlpha?t=document.createElement("div"):((t=document.createElement("img")).src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(i.name)?"paperclip":"pushpin"}.svg`,i.fillAlpha&&i.fillAlpha<1&&(t.style=`filter: opacity(${Math.round(100*i.fillAlpha)}%);`)),t.addEventListener("dblclick",this.#nU.bind(this)),this.#nN=t;let{isMac:r}=U.platform;return e.addEventListener("keydown",t=>{"Enter"===t.key&&(r?t.metaKey:t.ctrlKey)&&this.#nU()}),!i.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):t.classList.add("popupTriggerArea"),e.append(t),e}getElementsToTriggerPopup(){return this.#nN}addHighlightArea(){this.container.classList.add("highlightArea")}#nU(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class ri{#nz=null;#nH=null;#K=null;#nj=new Map;#n$=null;#nG=null;#nh=[];#nV=!1;constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:r,page:s,viewport:n,structTreeLayer:a,commentManager:o,linkService:l,annotationStorage:h}){this.div=t,this.#nz=e,this.#nH=i,this.#n$=a||null,this.#nG=l||null,this.#K=h||new tz,this.page=s,this.viewport=n,this.zIndex=0,this._annotationEditorUIManager=r,this._commentManager=o||null}hasEditableAnnotations(){return this.#nj.size>0}async render(t){let{annotations:e}=t,i=this.div;td(i,this.viewport);let r=new Map,s=[],n={data:null,layer:i,linkService:this.#nG,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new iB,annotationStorage:this.#K,enableComment:!0===t.enableComment,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(let t of e){if(t.noHTML)continue;let e=t.annotationType===v.POPUP;if(e){let e=r.get(t.id);if(!e)continue;if(!this._commentManager){s.push(t);continue}n.elements=e}else if(t.rect[2]===t.rect[0]||t.rect[3]===t.rect[1])continue;n.data=t;let i=iN.create(n);if(!i.isRenderable)continue;if(!e&&(this.#nh.push(i),t.popupRef)){let e=r.get(t.popupRef);e?e.push(i):r.set(t.popupRef,[i])}let a=i.render();t.hidden&&(a.style.visibility="hidden"),i._isEditable&&(this.#nj.set(i.data.id,i),this._annotationEditorUIManager?.renderAnnotationElement(i))}
2for(let t of(await this.#nW(),s)){let e=n.elements=r.get(t.id);n.data=t;let i=iN.create(n);if(!i.isRenderable)continue;let s=i.render();i.contentElement.id=`${V}${t.id}`,t.hidden&&(s.style.visibility="hidden"),e.at(-1).container.after(s)}this.#nK()}async #nW(){if(0===this.#nh.length)return;this.div.replaceChildren();let t=[];if(!this.#nV)for(let{contentElement:e,data:{id:i}}of(this.#nV=!0,this.#nh)){let r=e.id=`${V}${i}`;t.push(this.#n$?.getAriaAttributes(r).then(t=>{if(t)for(let[i,r]of t)e.setAttribute(i,r)}))}this.#nh.sort(({data:{rect:[t,e,i,r]}},{data:{rect:[s,n,a,o]}})=>{if(t===i&&e===r)return 1;if(s===a&&n===o)return -1;let l=(e+r)/2,h=(n+o)/2;return l>=o&&h<=e?-1:h>=r&&l<=n?1:(t+i)/2-(s+a)/2});let e=document.createDocumentFragment();for(let t of this.#nh)e.append(t.container),this._commentManager?(t.extraPopupElement?.popup||t.popup)?.renderCommentButton():t.extraPopupElement&&e.append(t.extraPopupElement.render());if(this.div.append(e),await Promise.all(t),this.#nz)for(let t of this.#nh)this.#nz.addPointerInTextLayer(t.contentElement,!1)}async addLinkAnnotations(t){let e={data:null,layer:this.div,linkService:this.#nG,svgFactory:new iB,parent:this};for(let i of t){i.borderStyle||=ri._defaultBorderStyle,e.data=i;let t=iN.create(e);t.isRenderable&&(t.render(),t.contentElement.id=`${V}${i.id}`,this.#nh.push(t))}await this.#nW()}update({viewport:t}){let e=this.div;this.viewport=t,td(e,{rotation:t.rotation}),this.#nK(),e.hidden=!1}#nK(){if(!this.#nH)return;let t=this.div;for(let[e,i]of this.#nH){let r=t.querySelector(`[data-annotation-id="${e}"]`);if(!r)continue;i.className="annotationContent";let{firstChild:s}=r;s?"CANVAS"===s.nodeName?s.replaceWith(i):s.classList.contains("annotationContent")?s.after(i):s.before(i):r.append(i);let n=this.#nj.get(e);n&&(n._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(e,r.id,i),n._hasNoCanvas=!1):n.canvas=i)}this.#nH.clear()}getEditableAnnotations(){return Array.from(this.#nj.values())}getEditableAnnotation(t){return this.#nj.get(t)}addFakeAnnotation(t){let{div:e}=this,{id:i,rotation:r}=t,s=new iz({data:{id:i,rect:t.getPDFRect(),rotation:r},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:this.#nG,annotationStorage:this.#K});return s.render(),s.contentElement.id=`${V}${i}`,s.createOrUpdatePopup(),this.#nh.push(s),s}removeAnnotation(t){let e=this.#nh.findIndex(e=>e.data.id===t);if(e<0)return;let[i]=this.#nh.splice(e,1);this.#nz?.removePointerInTextLayer(i.contentElement)}updateFakeAnnotations(t){if(0!==t.length){for(let e of t)e.updateFakeAnnotationElement(this);this.#nW()}}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}static get _defaultBorderStyle(){return P(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:y.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}}let rr=/\r\n?|\n/g;class rs extends tF{#nX="";#nq=`${this.id}-editor`;#nY=null;#nC;_colorPicker=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let t=rs.prototype,e=t=>t.isEmpty(),i=tk.TRANSLATE_SMALL,r=tk.TRANSLATE_BIG;return P(this,"_keyboardManager",new tP([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-r,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[r,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-r],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,r],checker:e}]]))}static _type="freetext";static _editorType=p.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.color=t.color||rs._defaultColor||tF._defaultLineColor,this.#nC=t.fontSize||rs._defaultFontSize,this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert"),this.canAddComment=!1}static initialize(t,e){tF.initialize(t,e);let i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}
2static updateDefaultParams(t,e){switch(t){case g.FREETEXT_SIZE:rs._defaultFontSize=e;break;case g.FREETEXT_COLOR:rs._defaultColor=e}}updateParams(t,e){switch(t){case g.FREETEXT_SIZE:this.#nQ(e);break;case g.FREETEXT_COLOR:this.#nS(e)}}static get defaultPropertiesToUpdate(){return[[g.FREETEXT_SIZE,rs._defaultFontSize],[g.FREETEXT_COLOR,rs._defaultColor||tF._defaultLineColor]]}get propertiesToUpdate(){return[[g.FREETEXT_SIZE,this.#nC],[g.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new iP(this),[["colorPicker",this._colorPicker]]}get colorType(){return g.FREETEXT_COLOR}#nQ(t){let e=t=>{this.editorDiv.style.fontSize=`calc(${t}px * var(--total-scale-factor))`,this.translate(0,-(t-this.#nC)*this.parentScale),this.#nC=t,this.#nJ()},i=this.#nC;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:g.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}#nS(t){let e=t=>{this.color=t,this.onUpdatedColor()},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:g.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){let t=this.parentScale;return[-rs._internalPadding*t,-(rs._internalPadding+this.#nC)*t]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.#nY=new AbortController;let t=this._uiManager.combinedSignal(this.#nY);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(){return!!super.disableEditMode()&&(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#nq),this._isDraggable=!0,this.#nY?.abort(),this.#nY=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0)}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(t){this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),this._initialOptions?.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()}#nZ(){let t=[];this.editorDiv.normalize();let e=null;for(let i of this.editorDiv.childNodes)(e?.nodeType!==Node.TEXT_NODE||"BR"!==i.nodeName)&&(t.push(rs.#n0(i)),e=i);return t.join("\n")}#nJ(){let t,[e,i]=this.parentDimensions;if(this.isAttachedToDOM)t=this.div.getBoundingClientRect();else{let{currentLayer:e,div:i}=this,r=i.style.display,s=i.classList.contains("hidden");i.classList.remove("hidden"),i.style.display="hidden",e.div.append(this.div),t=i.getBoundingClientRect(),i.remove(),i.style.display=r,i.classList.toggle("hidden",s)}this.rotation%180==this.parentRotation%180?(this.width=t.width/e,this.height=t.height/i):(this.width=t.height/e,this.height=t.width/i),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let t=this.#nX,e=this.#nX=this.#nZ().trimEnd();if(t===e)return;let i=t=>{if(this.#nX=t,!t)return void this.remove();this.#n1(),this._uiManager.rebuild(this),this.#nJ()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),this.#nJ()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){rs._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}render(){let t,e;if(this.div)return this.div;(this._isCopy||this.annotationElementId)&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#nq),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#nC}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){let[i,r]=this.parentDimensions;
2if(this.annotationElementId){let s,n,{position:a}=this._initialData,[o,l]=this.getInitialTranslation();[o,l]=this.pageTranslationToScreen(o,l);let[h,d]=this.pageDimensions,[c,u]=this.pageTranslation;switch(this.rotation){case 0:s=t+(a[0]-c)/h,n=e+this.height-(a[1]-u)/d;break;case 90:s=t+(a[0]-c)/h,n=e-(a[1]-u)/d,[o,l]=[l,-o];break;case 180:s=t-this.width+(a[0]-c)/h,n=e-(a[1]-u)/d,[o,l]=[-o,-l];break;case 270:s=t+(a[0]-c-this.height*d)/h,n=e+(a[1]-u-this.width*h)/d,[o,l]=[-l,o]}this.setAt(s*i,n*r,o,l)}else this._moveAfterPaste(t,e);this.#n1(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static #n0(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(rr,"")}editorDivPaste(t){let e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();let r=rs.#n2(e.getData("text")||"").replaceAll(rr,"\n");if(!r)return;let s=window.getSelection();if(!s.rangeCount)return;this.editorDiv.normalize(),s.deleteFromDocument();let n=s.getRangeAt(0);if(!r.includes("\n")){n.insertNode(document.createTextNode(r)),this.editorDiv.normalize(),s.collapseToStart();return}let{startContainer:a,startOffset:o}=n,l=[],h=[];if(a.nodeType===Node.TEXT_NODE){let t=a.parentElement;if(h.push(a.nodeValue.slice(o).replaceAll(rr,"")),t!==this.editorDiv){let e=l;for(let i of this.editorDiv.childNodes){if(i===t){e=h;continue}e.push(rs.#n0(i))}}l.push(a.nodeValue.slice(0,o).replaceAll(rr,""))}else if(a===this.editorDiv){let t=l,e=0;for(let i of this.editorDiv.childNodes)e++===o&&(t=h),t.push(rs.#n0(i))}this.#nX=`${l.join("\n")}${r}${h.join("\n")}`,this.#n1();let d=new Range,c=Math.sumPrecise(l.map(t=>t.length));for(let{firstChild:t}of this.editorDiv.childNodes)if(t.nodeType===Node.TEXT_NODE){let e=t.nodeValue.length;if(c<=e){d.setStart(t,c),d.setEnd(t,c);break}c-=e}s.removeAllRanges(),s.addRange(d)}#n1(){if(this.editorDiv.replaceChildren(),this.#nX)for(let t of this.#nX.split("\n")){let e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#n5(){return this.#nX.replaceAll("\xa0"," ")}static #n2(t){return t.replaceAll(" ","\xa0")}get contentDiv(){return this.editorDiv}getPDFRect(){let t=rs._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,e,i){let r=null;if(t instanceof iJ){let{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:s,rotation:n,id:a,popupRef:o,richText:l,contentsObj:h,creationDate:d,modificationDate:c},textContent:u,textPosition:g,parent:{page:{pageNumber:m}}}=t;if(!u||0===u.length)return null;r=t={annotationType:p.FREETEXT,color:Array.from(i),fontSize:e,value:u.join("\n"),position:g,pageIndex:m-1,rect:s.slice(0),rotation:n,annotationElementId:a,id:a,deleted:!1,popupRef:o,comment:h?.str||null,richText:l,creationDate:d,modificationDate:c}}let s=await super.deserialize(t,e,i);return s.#nC=t.fontSize,s.color=H.makeHexColor(...t.color),s.#nX=rs.#n2(t.value),s._initialData=r,t.comment&&s.setCommentData(t),s}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let e=tF._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(t),{color:e,fontSize:this.#nC,value:this.#n5()});return(this.addComment(i),t)?(i.isCopy=!0,i):this.annotationElementId&&!this.#n3(i)?null:(i.id=this.annotationElementId,i)}#n3(t){let{value:e,fontSize:i,color:r,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((t,e)=>t!==r[e])||t.pageIndex!==s}renderAnnotationElement(t){let e=super.renderAnnotationElement(t);if(!e)return null;let{style:i}=e;for(let t of(i.fontSize=`calc(${this.#nC}px * var(--total-scale-factor))`,i.color=this.color,e.replaceChildren(),this.#nX.split("\n"))){let i=document.createElement("div");i.append(t?document.createTextNode(t):document.createElement("br")),e.append(i)}return t.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#nX}}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}class rn{static PRECISION=1e-4;toSVGPath(){T("Abstract method `toSVGPath` must be implemented.")}get box(){T("Abstract getter `box` must be implemented.")}serialize(t,e){T("Abstract method `serialize` must be implemented.")}static _rescale(t,e,i,r,s,n){n||=new Float32Array(t.length);for(let a=0,o=t.length;a<o;a+=2)n[a]=e+t[a]*r,n[a+1]=i+t[a+1]*s;return n}static _rescaleAndSwap(t,e,i,r,s,n){n||=new Float32Array(t.length);for(let a=0,o=t.length;a<o;a+=2)n[a]=e+t[a+1]*r,n[a+1]=i+t[a]*s;return n}static _translate(t,e,i,r){r||=new Float32Array(t.length);for(let s=0,n=t.length;s<n;s+=2)r[s]=e+t[s],r[s+1]=i+t[s+1];return r}static svgRound(t){return Math.round(1e4*t)}static _normalizePoint(t,e,i,r,s){switch(s){case 90:return[1-e/i,t/r];case 180:return[1-t/i,1-e/r];case 270:return[e/i,1-t/r];default:return[t/i,e/r]}}static _normalizePagePoint(t,e,i){switch(i){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,i,r,s,n){return[(t+5*i)/6,(e+5*r)/6,(5*i+s)/6,(5*r+n)/6,(i+s)/2,(r+n)/2]}}class ra{#n6;#n4=[];#n9;#n8;#n7=[];#at=new Float32Array(18);#ae;#ai;#ar;#as;#an;#aa;#ao=[];
2static #al=8;static #ah=2;static #ad=ra.#al+ra.#ah;constructor({x:t,y:e},i,r,s,n,a=0){this.#n6=i,this.#aa=s*r,this.#n8=n,this.#at.set([NaN,NaN,NaN,NaN,t,e],6),this.#n9=a,this.#as=ra.#al*r,this.#ar=ra.#ad*r,this.#an=r,this.#ao.push(t,e)}isEmpty(){return isNaN(this.#at[8])}#ac(){let t=this.#at.subarray(4,6),e=this.#at.subarray(16,18),[i,r,s,n]=this.#n6;return[(this.#ae+(t[0]-e[0])/2-i)/s,(this.#ai+(t[1]-e[1])/2-r)/n,(this.#ae+(e[0]-t[0])/2-i)/s,(this.#ai+(e[1]-t[1])/2-r)/n]}add({x:t,y:e}){this.#ae=t,this.#ai=e;let[i,r,s,n]=this.#n6,[a,o,l,h]=this.#at.subarray(8,12),d=t-l,c=e-h,u=Math.hypot(d,c);if(u<this.#ar)return!1;let p=u-this.#as,g=p/u,m=g*d,f=g*c,b=a,v=o;a=l,o=h,l+=m,h+=f,this.#ao?.push(t,e);let y=-f/p*this.#aa,A=m/p*this.#aa;return(this.#at.set(this.#at.subarray(2,8),0),this.#at.set([l+y,h+A],4),this.#at.set(this.#at.subarray(14,18),12),this.#at.set([l-y,h-A],16),isNaN(this.#at[6]))?(0===this.#n7.length&&(this.#at.set([a+y,o+A],2),this.#n7.push(NaN,NaN,NaN,NaN,(a+y-i)/s,(o+A-r)/n),this.#at.set([a-y,o-A],14),this.#n4.push(NaN,NaN,NaN,NaN,(a-y-i)/s,(o-A-r)/n)),this.#at.set([b,v,a,o,l,h],6),!this.isEmpty()):((this.#at.set([b,v,a,o,l,h],6),Math.abs(Math.atan2(v-o,b-a)-Math.atan2(f,m))<Math.PI/2)?([a,o,l,h]=this.#at.subarray(2,6),this.#n7.push(NaN,NaN,NaN,NaN,((a+l)/2-i)/s,((o+h)/2-r)/n),[a,o,b,v]=this.#at.subarray(14,18),this.#n4.push(NaN,NaN,NaN,NaN,((b+a)/2-i)/s,((v+o)/2-r)/n)):([b,v,a,o,l,h]=this.#at.subarray(0,6),this.#n7.push(((b+5*a)/6-i)/s,((v+5*o)/6-r)/n,((5*a+l)/6-i)/s,((5*o+h)/6-r)/n,((a+l)/2-i)/s,((o+h)/2-r)/n),[l,h,a,o,b,v]=this.#at.subarray(12,18),this.#n4.push(((b+5*a)/6-i)/s,((v+5*o)/6-r)/n,((5*a+l)/6-i)/s,((5*o+h)/6-r)/n,((a+l)/2-i)/s,((o+h)/2-r)/n)),!0)}toSVGPath(){if(this.isEmpty())return"";let t=this.#n7,e=this.#n4;if(isNaN(this.#at[6])&&!this.isEmpty())return this.#au();let i=[];i.push(`M${t[4]} ${t[5]}`);for(let e=6;e<t.length;e+=6)isNaN(t[e])?i.push(`L${t[e+4]} ${t[e+5]}`):i.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);this.#ap(i);for(let t=e.length-6;t>=6;t-=6)isNaN(e[t])?i.push(`L${e[t+4]} ${e[t+5]}`):i.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);return this.#ag(i),i.join(" ")}#au(){let[t,e,i,r]=this.#n6,[s,n,a,o]=this.#ac();return`M${(this.#at[2]-t)/i} ${(this.#at[3]-e)/r} L${(this.#at[4]-t)/i} ${(this.#at[5]-e)/r} L${s} ${n} L${a} ${o} L${(this.#at[16]-t)/i} ${(this.#at[17]-e)/r} L${(this.#at[14]-t)/i} ${(this.#at[15]-e)/r} Z`}#ag(t){let e=this.#n4;t.push(`L${e[4]} ${e[5]} Z`)}#ap(t){let[e,i,r,s]=this.#n6,n=this.#at.subarray(4,6),a=this.#at.subarray(16,18),[o,l,h,d]=this.#ac();t.push(`L${(n[0]-e)/r} ${(n[1]-i)/s} L${o} ${l} L${h} ${d} L${(a[0]-e)/r} ${(a[1]-i)/s}`)}newFreeDrawOutline(t,e,i,r,s,n){return new ro(t,e,i,r,s,n)}getOutlines(){let t=this.#n7,e=this.#n4,i=this.#at,[r,s,n,a]=this.#n6,o=new Float32Array((this.#ao?.length??0)+2);for(let t=0,e=o.length-2;t<e;t+=2)o[t]=(this.#ao[t]-r)/n,o[t+1]=(this.#ao[t+1]-s)/a;if(o[o.length-2]=(this.#ae-r)/n,o[o.length-1]=(this.#ai-s)/a,isNaN(i[6])&&!this.isEmpty())return this.#am(o);let l=new Float32Array(this.#n7.length+24+this.#n4.length),h=t.length;for(let e=0;e<h;e+=2){if(isNaN(t[e])){l[e]=l[e+1]=NaN;continue}l[e]=t[e],l[e+1]=t[e+1]}h=this.#af(l,h);for(let t=e.length-6;t>=6;t-=6)for(let i=0;i<6;i+=2){if(isNaN(e[t+i])){l[h]=l[h+1]=NaN,h+=2;continue}l[h]=e[t+i],l[h+1]=e[t+i+1],h+=2}return this.#ab(l,h),this.newFreeDrawOutline(l,o,this.#n6,this.#an,this.#n9,this.#n8)}#am(t){let e=this.#at,[i,r,s,n]=this.#n6,[a,o,l,h]=this.#ac(),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(e[2]-i)/s,(e[3]-r)/n,NaN,NaN,NaN,NaN,(e[4]-i)/s,(e[5]-r)/n,NaN,NaN,NaN,NaN,a,o,NaN,NaN,NaN,NaN,l,h,NaN,NaN,NaN,NaN,(e[16]-i)/s,(e[17]-r)/n,NaN,NaN,NaN,NaN,(e[14]-i)/s,(e[15]-r)/n],0),this.newFreeDrawOutline(d,t,this.#n6,this.#an,this.#n9,this.#n8)}#ab(t,e){let i=this.#n4;return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+=6}#af(t,e){let i=this.#at.subarray(4,6),r=this.#at.subarray(16,18),[s,n,a,o]=this.#n6,[l,h,d,c]=this.#ac();return t.set([NaN,NaN,NaN,NaN,(i[0]-s)/a,(i[1]-n)/o,NaN,NaN,NaN,NaN,l,h,NaN,NaN,NaN,NaN,d,c,NaN,NaN,NaN,NaN,(r[0]-s)/a,(r[1]-n)/o],e),e+=24}}class ro extends rn{#n6;#av=new Float32Array(4);#n9;#n8;#ao;#an;#ay;constructor(t,e,i,r,s,n){super(),this.#ay=t,this.#ao=e,this.#n6=i,this.#an=r,this.#n9=s,this.#n8=n,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#aA(n);let[a,o,l,h]=this.#av;for(let e=0,i=t.length;e<i;e+=2)t[e]=(t[e]-a)/l,t[e+1]=(t[e+1]-o)/h;for(let t=0,i=e.length;t<i;t+=2)e[t]=(e[t]-a)/l,e[t+1]=(e[t+1]-o)/h}toSVGPath(){let t=[`M${this.#ay[4]} ${this.#ay[5]}`];for(let e=6,i=this.#ay.length;e<i;e+=6){if(isNaN(this.#ay[e])){t.push(`L${this.#ay[e+4]} ${this.#ay[e+5]}`);continue}t.push(`C${this.#ay[e]} ${this.#ay[e+1]} ${this.#ay[e+2]} ${this.#ay[e+3]} ${this.#ay[e+4]} ${this.#ay[e+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,e,i,r],s){let n,a,o=i-t,l=r-e;switch(s){case 0:n=rn._rescale(this.#ay,t,r,o,-l),a=rn._rescale(this.#ao,t,r,o,-l);break;case 90:n=rn._rescaleAndSwap(this.#ay,t,e,o,l),a=rn._rescaleAndSwap(this.#ao,t,e,o,l);break;case 180:n=rn._rescale(this.#ay,i,e,-o,l),a=rn._rescale(this.#ao,i,e,-
2o,l);break;case 270:n=rn._rescaleAndSwap(this.#ay,i,r,-o,-l),a=rn._rescaleAndSwap(this.#ao,i,r,-o,-l)}return{outline:Array.from(n),points:[Array.from(a)]}}#aA(t){let e=this.#ay,i=e[4],r=e[5],s=[i,r,i,r],n=i,a=r,o=i,l=r,h=t?Math.max:Math.min,d=new Float32Array(4);for(let t=6,c=e.length;t<c;t+=6){let c=e[t+4],u=e[t+5];isNaN(e[t])?(H.pointBoundingBox(c,u,s),a>u?(n=c,a=u):a===u&&(n=h(n,c)),l<u?(o=c,l=u):l===u&&(o=h(o,c))):(d[0]=d[1]=1/0,d[2]=d[3]=-1/0,H.bezierBoundingBox(i,r,...e.slice(t,t+6),d),H.rectBoundingBox(d[0],d[1],d[2],d[3],s),a>d[1]?(n=d[0],a=d[1]):a===d[1]&&(n=h(n,d[0])),l<d[3]?(o=d[2],l=d[3]):l===d[3]&&(o=h(o,d[2]))),i=c,r=u}let c=this.#av;c[0]=s[0]-this.#n9,c[1]=s[1]-this.#n9,c[2]=s[2]-s[0]+2*this.#n9,c[3]=s[3]-s[1]+2*this.#n9,this.firstPoint=[n,a],this.lastPoint=[o,l]}get box(){return this.#av}newOutliner(t,e,i,r,s,n=0){return new ra(t,e,i,r,s,n)}getNewOutline(t,e){let[i,r,s,n]=this.#av,[a,o,l,h]=this.#n6,d=s*l,c=n*h,u=i*l+a,p=r*h+o,g=this.newOutliner({x:this.#ao[0]*d+u,y:this.#ao[1]*c+p},this.#n6,this.#an,t,this.#n8,e??this.#n9);for(let t=2;t<this.#ao.length;t+=2)g.add({x:this.#ao[t]*d+u,y:this.#ao[t+1]*c+p});return g.getOutlines()}}class rl{#n6;#aw;#ax;#aE=[];#aS=[];constructor(t,e=0,i=0,r=!0){let s=[1/0,1/0,-1/0,-1/0];for(let{x:i,y:r,width:n,height:a}of t){let t=1e-4*Math.floor((i-e)/1e-4),o=1e-4*Math.ceil((i+n+e)/1e-4),l=1e-4*Math.floor((r-e)/1e-4),h=1e-4*Math.ceil((r+a+e)/1e-4),d=[t,l,h,!0],c=[o,l,h,!1];this.#aE.push(d,c),H.rectBoundingBox(t,l,o,h,s)}let n=s[2]-s[0]+2*i,a=s[3]-s[1]+2*i,o=s[0]-i,l=s[1]-i,h=r?-1/0:1/0,d=1/0,c=this.#aE.at(r?-1:-2),u=[c[0],c[2]];for(let t of this.#aE){let[e,i,s,c]=t;!c&&r?i<d?(d=i,h=e):i===d&&(h=Math.max(h,e)):c&&!r&&(i<d?(d=i,h=e):i===d&&(h=Math.min(h,e))),t[0]=(e-o)/n,t[1]=(i-l)/a,t[2]=(s-l)/a}this.#n6=new Float32Array([o,l,n,a]),this.#aw=[h,d],this.#ax=u}getOutlines(){this.#aE.sort((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]);let t=[];for(let e of this.#aE)e[3]?(t.push(...this.#a_(e)),this.#aT(e)):(this.#aC(e),t.push(...this.#a_(e)));return this.#aM(t)}#aM(t){let e,i=[],r=new Set;for(let e of t){let[t,r,s]=e;i.push([t,r,e],[t,s,e])}i.sort((t,e)=>t[1]-e[1]||t[0]-e[0]);for(let t=0,e=i.length;t<e;t+=2){let e=i[t][2],s=i[t+1][2];e.push(s),s.push(e),r.add(e),r.add(s)}let s=[];for(;r.size>0;){let t=r.values().next().value,[i,n,a,o,l]=t;r.delete(t);let h=i,d=n;for(e=[i,a],s.push(e);;){let t;if(r.has(o))t=o;else if(r.has(l))t=l;else break;r.delete(t),[i,n,a,o,l]=t,h!==i&&(e.push(h,d,i,d===n?n:a),h=i),d=d===n?a:n}e.push(h,d)}return new rh(s,this.#n6,this.#aw,this.#ax)}#aD(t){let e=this.#aS,i=0,r=e.length-1;for(;i<=r;){let s=i+r>>1,n=e[s][0];if(n===t)return s;n<t?i=s+1:r=s-1}return r+1}#aT([,t,e]){let i=this.#aD(t);this.#aS.splice(i,0,[t,e])}#aC([,t,e]){let i=this.#aD(t);for(let r=i;r<this.#aS.length;r++){let[i,s]=this.#aS[r];if(i!==t)break;if(i===t&&s===e)return void this.#aS.splice(r,1)}for(let r=i-1;r>=0;r--){let[i,s]=this.#aS[r];if(i!==t)break;if(i===t&&s===e)return void this.#aS.splice(r,1)}}#a_(t){let[e,i,r]=t,s=[[e,i,r]],n=this.#aD(r);for(let t=0;t<n;t++){let[i,r]=this.#aS[t];for(let t=0,n=s.length;t<n;t++){let[,a,o]=s[t];if(!(r<=a)&&!(o<=i)){if(a>=i){if(o>r)s[t][1]=r;else{if(1===n)return[];s.splice(t,1),t--,n--}continue}s[t][2]=i,o>r&&s.push([e,r,o])}}}return s}}class rh extends rn{#n6;#aP;constructor(t,e,i,r){super(),this.#aP=t,this.#n6=e,this.firstPoint=i,this.lastPoint=r}toSVGPath(){let t=[];for(let e of this.#aP){let[i,r]=e;t.push(`M${i} ${r}`);for(let s=2;s<e.length;s+=2){let n=e[s],a=e[s+1];n===i?(t.push(`V${a}`),r=a):a===r&&(t.push(`H${n}`),i=n)}t.push("Z")}return t.join(" ")}serialize([t,e,i,r],s){let n=[],a=i-t,o=r-e;for(let e of this.#aP){let i=Array(e.length);for(let s=0;s<e.length;s+=2)i[s]=t+e[s]*a,i[s+1]=r-e[s+1]*o;n.push(i)}return n}get box(){return this.#n6}get classNamesForOutlining(){return["highlightOutline"]}}class rd extends ra{newFreeDrawOutline(t,e,i,r,s,n){return new rc(t,e,i,r,s,n)}}class rc extends ro{newOutliner(t,e,i,r,s,n=0){return new rd(t,e,i,r,s,n)}}class ru extends tF{#aI=null;#ak=0;#aR;#aL=null;#c=null;#aB=null;#aF=null;#aO=0;#aN=null;#aU=null;#k=null;#az=!1;#aw=null;#ax=null;#aH=null;#ec="";#aa;#aj="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=p.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){let t=ru.prototype;return P(this,"_keyboardManager",new tP([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super({...t,name:"highlightEditor"}),this.color=t.color||ru._defaultColor,this.#aa=t.thickness||ru._defaultThickness,this.opacity=t.opacity||ru._defaultOpacity,this.#aR=t.boxes||null,this.#aj=t.methodOfCreation||"",this.#ec=t.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?(this.#az=!0,this.#a$(t),this.#aG()):this.#aR&&(this.#aI=t.anchorNode,this.#ak=t.anchorOffset,this.#aF=t.focusNode,this.#aO=t.focusOffset,this.#aV(),this.#aG(),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}get telemetryInitialData(){return{action:"added",type:this.#az?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this.#aa,methodOfCreation:this.#aj}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#aV(){let t=new rl(this.#aR,.001);this.#aU=t.getOutlines(),[this.x,this.y,this.width,this.height]=this.#aU.box;let e=new rl(this.#aR,.0025,.001,"ltr"===this._uiManager.direction);this.#aB=e.getOutlines();let{firstPoint:i}=this.#aU;this.#aw=[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height];let{lastPoint:r}=this.#aB;this.#ax=[(r[0]-this.x)/this.width,(r[1]-this.y)/this.height]}#a$({highlightOutlines:t,highlightId:e,clipPathId:i}){if(this.#aU=t,this.#aB=t.getNewOutline(this.#aa/2+1.5,.0025),e>=0)this.#k=e,this.#aL=i,this.parent.drawLayer.finalizeDraw(e,{bbox:t.box,path:{d:t.toSVGPath()}}),this.#aH=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#aB.box,path:{d:this.#aB.toSVGPath()}},!0);else if(this.parent){let e=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#k,{bbox:ru.#aW(this.#aU.box,(e-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#aH,{bbox:ru.#aW(this.#aB.box,e),path:{d:this.#aB.toSVGPath()}})}let[r,s,n,a]=t.box;switch(this.rotation){case 0:this.x=r,this.y=s,this.width=n,this.height=a;break;case 90:{let[t,e]=this.parentDimensions;this.x=s,this.y=1-r,this.width=n*e/t,this.height=a*t/e;break}case 180:this.x=1-r,this.y=1-s,this.width=n,this.height=a;break;case 270:{let[t,e]=this.parentDimensions;this.x=1-s,this.y=r,this.width=n*e/t,this.height=a*t/e}}let{firstPoint:o}=t;this.#aw=[(o[0]-r)/n,(o[1]-s)/a];let{lastPoint:l}=this.#aB;this.#ax=[(l[0]-r)/n,(l[1]-s)/a]}static initialize(t,e){tF.initialize(t,e),ru._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case g.HIGHLIGHT_COLOR:ru._defaultColor=e;break;case g.HIGHLIGHT_THICKNESS:ru._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return this.#ax}get commentButtonPosition(){return this.#aw}updateParams(t,e){switch(t){case g.HIGHLIGHT_COLOR:this.#nS(e);break;case g.HIGHLIGHT_THICKNESS:this.#aK(e)}}static get defaultPropertiesToUpdate(){return[[g.HIGHLIGHT_COLOR,ru._defaultColor],[g.HIGHLIGHT_THICKNESS,ru._defaultThickness]]}get propertiesToUpdate(){return[[g.HIGHLIGHT_COLOR,this.color||ru._defaultColor],[g.HIGHLIGHT_THICKNESS,this.#aa||ru._defaultThickness],[g.HIGHLIGHT_FREE,this.#az]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(this.#k,{root:{fill:this.color,"fill-opacity":this.opacity}}),this.#c?.updateColor(this.color),super.onUpdatedColor()}#nS(t){let e=(t,e)=>{this.color=t,this.opacity=e,this.onUpdatedColor()},i=this.color,r=this.opacity;this.addCommands({cmd:e.bind(this,t,ru._defaultOpacity),undo:e.bind(this,i,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:g.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(t)},!0)}#aK(t){let e=this.#aa,i=t=>{this.#aa=t,this.#aX(t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:g.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",this.#c=new iD({editor:this})]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#aq())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#aq())}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){this.#aY(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.#aG(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?this.#aY():t&&(this.#aG(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#aX(t){this.#az&&(this.#a$({highlightOutlines:this.#aU.getNewOutline(t/2)}),this.fixAndSetPosition(),this.setDims())}#aY(){null!==this.#k&&this.parent&&(this.parent.drawLayer.remove(this.#k),this.#k=null,this.parent.drawLayer.remove(this.#aH),this.#aH=null)}#aG(t=this.parent){null===this.#k&&({id:this.#k,clipPathId:this.#aL}=t.drawLayer.draw({bbox:this.#aU.box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:this.#az},path:{d:this.#aU.toSVGPath()}},!1,!0),this.#aH=t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#az},bbox:this.#aB.box,path:{d:this.#aB.toSVGPath()}},this.#az),this.#aN&&(this.#aN.style.clipPath=this.#aL))}static #aW([t,e,i,r],s){switch(s){case 90:return[1-e-r,t,r,i];case 180:return[1-t-i,1-e-r,i,r];case 270:return[e,1-t-i,r,i]}return[t,e,i,r]}rotate(t){let e,{drawLayer:i}
2=this.parent;this.#az?(t=(t-this.rotation+360)%360,e=ru.#aW(this.#aU.box,t)):e=ru.#aW([this.x,this.y,this.width,this.height],t),i.updateProperties(this.#k,{bbox:e,root:{"data-main-rotation":t}}),i.updateProperties(this.#aH,{bbox:ru.#aW(this.#aB.box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;let t=super.render();this.#ec&&(t.setAttribute("aria-label",this.#ec),t.setAttribute("role","mark")),this.#az?t.classList.add("free"):this.div.addEventListener("keydown",this.#aQ.bind(this),{signal:this._uiManager._signal});let e=this.#aN=document.createElement("div");return t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#aL,this.setDims(),t_(this,this.#aN,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#aH,{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#aH,{rootClass:{hovered:!1}})}#aQ(t){ru._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#aJ(!0);break;case 1:case 3:this.#aJ(!1)}}#aJ(t){if(!this.#aI)return;let e=window.getSelection();t?e.setPosition(this.#aI,this.#ak):e.setPosition(this.#aF,this.#aO)}select(){super.select(),this.#aH&&this.parent?.drawLayer.updateProperties(this.#aH,{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),this.#aH&&(this.parent?.drawLayer.updateProperties(this.#aH,{rootClass:{selected:!1}}),this.#az||this.#aJ(!1))}get _mustFixPosition(){return!this.#az}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(this.#k,{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(this.#aH,{rootClass:{hidden:!t}}))}#aq(){return this.#az?this.rotation:0}#aZ(){if(this.#az)return null;let[t,e]=this.pageDimensions,[i,r]=this.pageTranslation,s=this.#aR,n=new Float32Array(8*s.length),a=0;for(let{x:o,y:l,width:h,height:d}of s){let s=o*t+i,c=(1-l)*e+r;n[a]=n[a+4]=s,n[a+1]=n[a+3]=c,n[a+2]=n[a+6]=s+h*t,n[a+5]=n[a+7]=c-d*e,a+=8}return n}#a0(t){return this.#aU.serialize(t,this.#aq())}static startHighlighting(t,e,{target:i,x:r,y:s}){let{x:n,y:a,width:o,height:l}=i.getBoundingClientRect(),h=new AbortController,d=t.combinedSignal(h),c=e=>{h.abort(),this.#a1(t,e)};window.addEventListener("blur",c,{signal:d}),window.addEventListener("pointerup",c,{signal:d}),window.addEventListener("pointerdown",tn,{capture:!0,passive:!1,signal:d}),window.addEventListener("contextmenu",ts,{signal:d}),i.addEventListener("pointermove",this.#a2.bind(this,t),{signal:d}),this._freeHighlight=new rd({x:r,y:s},[n,a,o,l],t.scale,this._defaultThickness/2,e,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static #a2(t,e){this._freeHighlight.add(e)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}static #a1(t,e){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(t,e,i){let r=null;if(t instanceof i4){let{data:{quadPoints:e,rect:i,rotation:s,id:n,color:a,opacity:o,popupRef:l,richText:h,contentsObj:d,creationDate:c,modificationDate:u},parent:{page:{pageNumber:g}}}=t;r=t={annotationType:p.HIGHLIGHT,color:Array.from(a),opacity:o,quadPoints:e,boxes:null,pageIndex:g-1,rect:i.slice(0),rotation:s,annotationElementId:n,id:n,deleted:!1,popupRef:l,richText:h,comment:d?.str||null,creationDate:c,modificationDate:u}}else if(t instanceof i6){let{data:{inkLists:e,rect:i,rotation:s,id:n,color:a,borderStyle:{rawWidth:o},popupRef:l,richText:h,contentsObj:d,creationDate:c,modificationDate:u},parent:{page:{pageNumber:g}}}=t;r=t={annotationType:p.HIGHLIGHT,color:Array.from(a),thickness:o,inkLists:e,boxes:null,pageIndex:g-1,rect:i.slice(0),rotation:s,annotationElementId:n,id:n,deleted:!1,popupRef:l,richText:h,comment:d?.str||null,creationDate:c,modificationDate:u}}let{color:s,quadPoints:n,inkLists:a,opacity:o}=t,l=await super.deserialize(t,e,i);l.color=H.makeHexColor(...s),l.opacity=o||1,a&&(l.#aa=t.thickness),l._initialData=r,t.comment&&l.setCommentData(t);let[h,d]=l.pageDimensions,[c,u]=l.pageTranslation;if(n){let t=l.#aR=[];for(let e=0;e<n.length;e+=8)t.push({x:(n[e]-c)/h,y:1-(n[e+1]-u)/d,width:(n[e+2]-n[e])/h,height:(n[e+1]-n[e+5])/d});l.#aV(),l.#aG(),l.rotate(l.rotation)}else if(a){l.#az=!0;let t=a[0],i={x:t[0]-c,y:d-(t[1]-u)}
2,r=new rd(i,[0,0,h,d],1,l.#aa/2,!0,.001);for(let e=0,s=t.length;e<s;e+=2)i.x=t[e]-c,i.y=d-(t[e+1]-u),r.add(i);let{id:s,clipPathId:n}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:l.color,"fill-opacity":l._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:r.toSVGPath()}},!0,!0);l.#a$({highlightOutlines:r.getOutlines(),highlightId:s,clipPathId:n}),l.#aG(),l.rotate(l.parentRotation)}return l}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();let e=tF._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),i=super.serialize(t);return(Object.assign(i,{color:e,opacity:this.opacity,thickness:this.#aa,quadPoints:this.#aZ(),outlines:this.#a0(i.rect)}),this.addComment(i),this.annotationElementId&&!this.#n3(i))?null:(i.id=this.annotationElementId,i)}#n3(t){let{color:e}=this._initialData;return this.hasEditedComment||t.color.some((t,i)=>t!==e[i])}renderAnnotationElement(t){return this.deleted?t.hide():t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null}static canCreateNewEmptyEditor(){return!1}}class rp{#a5=Object.create(null);updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(let[e,i]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,i)}updateSVGProperty(t,e){this.#a5[t]=e}toSVGProperties(){let t=this.#a5;return this.#a5=Object.create(null),{root:t}}reset(){this.#a5=Object.create(null)}updateAll(t=this){this.updateProperties(t)}clone(){T("Not implemented")}}class rg extends tF{#a3=null;#a6;_colorPicker=null;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static #a4=null;static #a9=null;static #a8=null;static _INNER_MARGIN=3;constructor(t){super(t),this.#a6=t.mustBeCommitted||!1,this._addOutlines(t)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}_addOutlines(t){t.drawOutlines&&(this.#a7(t),this.#aG())}#a7({drawOutlines:t,drawId:e,drawingOptions:i}){this.#a3=t,this._drawingOptions||=i,this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),e>=0?(this._drawId=e,this.parent.drawLayer.finalizeDraw(e,t.defaultProperties)):this._drawId=this.#ot(t,this.parent),this.#oe(t.box)}#ot(t,e){let{id:i}=e.drawLayer.draw(rg._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return i}static _mergeSVGProperties(t,e){let i=new Set(Object.keys(t));for(let[r,s]of Object.entries(e))i.has(r)?Object.assign(t[r],s):t[r]=s;return t}static getDefaultDrawingOptions(t){T("Not implemented")}static get typesMap(){T("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,e){let i=this.typesMap.get(t);i&&this._defaultDrawingOptions.updateProperty(i,e),this._currentParent&&(rg.#a4.updateProperty(i,e),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,e){let i=this.constructor.typesMap.get(t);i&&this._updateProperty(t,i,e)}static get defaultPropertiesToUpdate(){let t=[],e=this._defaultDrawingOptions;for(let[i,r]of this.typesMap)t.push([i,e[r]]);return t}get propertiesToUpdate(){let t=[],{_drawingOptions:e}=this;for(let[i,r]of this.constructor.typesMap)t.push([i,e[r]]);return t}_updateProperty(t,e,i){let r=this._drawingOptions,s=r[e],n=i=>{r.updateProperty(e,i);let s=this.#a3.updateProperty(e,i);s&&this.#oe(s),this.parent?.drawLayer.updateProperties(this._drawId,r.toSVGProperties()),t===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:n.bind(this,i),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,rg._mergeSVGProperties(this.#a3.getPathResizingSVGProperties(this.#oi()),{bbox:this.#or()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,rg._mergeSVGProperties(this.#a3.getPathResizedSVGProperties(this.#oi()),{bbox:this.#or()}))}_onTranslating(t,e){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#or()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,rg._mergeSVGProperties(this.#a3.getPathTranslatedSVGProperties(this.#oi(),this.parentDimensions),{bbox:this.#or()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#a6&&(this.#a6=!1,this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){this.#aY(),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.#aG(),this.#oe(this.#a3.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),this.#aY()):t&&(this._uiManager.addShouldRescale(this),this.#aG(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),e&&this.select()}#aY(){null!==this._drawId&&this.parent&&(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}#aG(t=this.parent){if(null===this._drawId||this.parent!==t){if(null!==this._drawId)return void this.parent.drawLayer.updateParent(this._drawId,t.drawLayer);this._drawingOptions.updateAll(),this._drawId=this.#ot(this.#a3,t)}}#os([t,e,i,r]){let{parentDimensions:[s,n],rotation:a}=this;switch(a){case 90:return[e,1-t,n/s*i,s/n*r];case 180:return[1-t,1-e,i,r];case 270:return[1-e,t,n/s*i,s/n*r];default:return[t,e,i,r]}}#oi(){let{x:t,y:e,width:i,height:r,parentDimensions:[s,n],rotation:a}=this;switch(a){case 90:return[1-e,t,s/n*i,n/s*r];case 180:return[1-t,1-e,i,r];case 270:return[e,1-t,s/n*i,n/s*r];default:return[t,e,i,r]}}#oe(t){[this.x,this.y,this.width,this.height]=this.#os(t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#or(){let{x:t,y:e,width:i,height:r,rotation:s,parentRotation:n,parentDimensions:[a,o]}=this;switch((4*s+n)/90){case 1:return[1-e-r,t,r,i];case 2:return[1-t-i,1-e-r,i,r];case 3:return[e,1-t-i,r,i];case 4:return[t,e-a/o*i,o/a*r,a/o*i];case 5:return[1-e,t,a/o*i,o/a*r];case 6:return[1-t-o/a*r,1-e,o/a*r,a/o*i];case 7:return[e-a/o*i,1-t-o/a*r,a/o*i,o/a*r];case 8:return[t-i,e-r,i,r];case 9:return[1-e,t-i,r,i];case 10:return[1-t,1-e,i,r];case 11:return[e-r,1-t,r,i];case 12:return[t-o/a*r,e,o/a*r,a/o*i];case 13:return[1-e-a/o*i,t-o/a*r,a/o*i,o/a*r];case 14:return[1-t,1-e-a/o*i,o/a*r,a/o*i];case 15:return[e,1-t,a/o*i,o/a*r];default:return[t,e,i,r]}}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,rg._mergeSVGProperties({bbox:this.#or()},this.#a3.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&this.#oe(this.#a3.updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){let t,e;if(this.div)return this.div;this._isCopy&&(t=this.x,e=this.y);let i=super.render();i.classList.add("draw");let r=document.createElement("div");return i.append(r),r.setAttribute("aria-hidden","true"),r.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,e),i}static createDrawerInstance(t,e,i,r,s){T("Not implemented")}static startDrawing(t,e,i,r){let{target:s,offsetX:n,offsetY:a,pointerId:o,pointerType:l}=r;if(tT.isInitializedAndDifferentPointerType(l))return;let{viewport:{rotation:h}}=t,{width:d,height:c}=s.getBoundingClientRect(),u=rg.#a9=new AbortController,p=t.combinedSignal(u);if(tT.setPointer(l,o),window.addEventListener("pointerup",t=>{tT.isSamePointerIdOrRemove(t.pointerId)&&this._endDraw(t)},{signal:p}),window.addEventListener("pointercancel",t=>{tT.isSamePointerIdOrRemove(t.pointerId)&&this._currentParent.endDrawingSession()},{signal:p}),window.addEventListener("pointerdown",t=>{tT.isSamePointerType(t.pointerType)&&(tT.initializeAndAddPointerId(t.pointerId),rg.#a4.isCancellable()&&(rg.#a4.removeLastElement(),rg.#a4.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:p}),window.addEventListener("contextmenu",ts,{signal:p}),s.addEventListener("pointermove",this._drawMove.bind(this),{signal:p}),s.addEventListener("touchmove",t=>{tT.isSameTimeStamp(t.timeStamp)&&tn(t)},{signal:p}),t.toggleDrawing(),e._editorUndoBar?.hide(),rg.#a4)return void t.drawLayer.updateProperties(this._currentDrawId,rg.#a4.startNew(n,a,d,c,h));e.updateUIForDefaultProperties(this),rg.#a4=this.createDrawerInstance(n,a,d,c,h),rg.#a8=this.getDefaultDrawingOptions(),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(rg.#a8.toSVGProperties(),rg.#a4.defaultSVGProperties),!0,!1)}static _drawMove(t){if(tT.isSameTimeStamp(t.timeStamp),!rg.#a4)return;let{offsetX:e,offsetY:i,pointerId:r}=t;if(tT.isSamePointerId(r)){if(tT.isUsingMultiplePointers())return void this._endDraw(t);this._currentParent.drawLayer.updateProperties(this._currentDrawId,rg.#a4.add(e,i)),tT.setTimeStamp(t.timeStamp),tn(t)}}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,rg.#a4=null,rg.#a8=null,tT.clearTimeStamp()),rg.#a9&&(rg.#a9.abort(),rg.#a9=null,tT.clearPointerIds())}static _endDraw(t){let e=this._currentParent;if(e){if(e.toggleDrawing(!0),this._cleanup(!1),t?.target===e.div&&e.drawLayer.updateProperties(this._currentDrawId,rg.#a4.end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){let t=rg.#a4,i=this._currentDrawId,r=t.getLastElement();e.addCommands({cmd:()=>{e.drawLayer.updateProperties(i,t.setLastElement(r))},undo:()=>{e.drawLayer.updateProperties(i,t.removeLastElement())},mustExec:!1,type:g.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){let e=this._currentParent;if(!e)return null;if(e.toggleDrawing(!0),e.cleanUndoStack(g.DRAW_STEP),!rg.#a4.isEmpty()){let{pageDimensions:[i,r],scale:s}=e,n=e.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:rg.#a4.getOutlines(i*s,r*s,s,this._INNER_MARGIN),drawingOptions:rg.#a8,mustBeCommitted:!t});return this._cleanup(!0),n}return e.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,e,i,r,s,n){T("Not implemented")}static async deserialize(t,e,i){let{rawDims:{pageWidth:r,pageHeight:s,pageX:n,pageY:a}}=e.viewport,o=this.deserializeDraw(n,a,r,s,this._INNER_MARGIN,t),l=await super.deserialize(t,e,i);return l.createDrawingOptions(t),l.#a7({drawOutlines:o}),l.#aG(),l.onScaleChanging(),l.rotate(),l}serializeDraw(t){let[e,i]=this.pageTranslation,[r,s]=this.pageDimensions;return this.#a3.serialize([e,i,r,s],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}}class rm{#at=new Float64Array(6);#nI;#on;#r2;#aa;#ao;#oa="";#oo=0;#aP=new rf;#ol;#oh;constructor(t,e,i,r,s,n){this.#ol=i,this.#oh=r,this.#r2=s,this.#aa=n,[t,e]=this.#od(t,e);let a=this.#nI=[NaN,NaN,NaN,NaN,t,e];this.#ao=[t,e],this.#on=[{line:a,points:this.#ao}],this.#at.set(a,0)}updateProperty(t,e){"stroke-width"===t&&(this.#aa=e)}#od(t,e){return rn._normalizePoint(t,e,this.#ol,this.#oh,this.#r2)}
2isEmpty(){return!this.#on||0===this.#on.length}isCancellable(){return this.#ao.length<=10}add(t,e){[t,e]=this.#od(t,e);let[i,r,s,n]=this.#at.subarray(2,6),a=t-s,o=e-n;return 2>=Math.hypot(this.#ol*a,this.#oh*o)?null:((this.#ao.push(t,e),isNaN(i))?(this.#at.set([s,n,t,e],2),this.#nI.push(NaN,NaN,NaN,NaN,t,e)):(isNaN(this.#at[0])&&this.#nI.splice(6,6),this.#at.set([i,r,s,n,t,e],0),this.#nI.push(...rn.createBezierPoints(i,r,s,n,t,e))),{path:{d:this.toSVGPath()}})}end(t,e){let i=this.add(t,e);return i||(2===this.#ao.length?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,i,r,s){this.#ol=i,this.#oh=r,this.#r2=s,[t,e]=this.#od(t,e);let n=this.#nI=[NaN,NaN,NaN,NaN,t,e];this.#ao=[t,e];let a=this.#on.at(-1);return a&&(a.line=new Float32Array(a.line),a.points=new Float32Array(a.points)),this.#on.push({line:n,points:this.#ao}),this.#at.set(n,0),this.#oo=0,this.toSVGPath(),null}getLastElement(){return this.#on.at(-1)}setLastElement(t){return this.#on?(this.#on.push(t),this.#nI=t.line,this.#ao=t.points,this.#oo=0,{path:{d:this.toSVGPath()}}):this.#aP.setLastElement(t)}removeLastElement(){if(!this.#on)return this.#aP.removeLastElement();this.#on.pop(),this.#oa="";for(let t=0,e=this.#on.length;t<e;t++){let{line:e,points:i}=this.#on[t];this.#nI=e,this.#ao=i,this.#oo=0,this.toSVGPath()}return{path:{d:this.#oa}}}toSVGPath(){let t=rn.svgRound(this.#nI[4]),e=rn.svgRound(this.#nI[5]);if(2===this.#ao.length)return this.#oa=`${this.#oa} M ${t} ${e} Z`,this.#oa;if(this.#ao.length<=6){let i=this.#oa.lastIndexOf("M");this.#oa=`${this.#oa.slice(0,i)} M ${t} ${e}`,this.#oo=6}if(4===this.#ao.length){let t=rn.svgRound(this.#nI[10]),e=rn.svgRound(this.#nI[11]);return this.#oa=`${this.#oa} L ${t} ${e}`,this.#oo=12,this.#oa}let i=[];0===this.#oo&&(i.push(`M ${t} ${e}`),this.#oo=6);for(let t=this.#oo,e=this.#nI.length;t<e;t+=6){let[e,r,s,n,a,o]=this.#nI.slice(t,t+6).map(rn.svgRound);i.push(`C${e} ${r} ${s} ${n} ${a} ${o}`)}return this.#oa+=i.join(" "),this.#oo=this.#nI.length,this.#oa}getOutlines(t,e,i,r){let s=this.#on.at(-1);return s.line=new Float32Array(s.line),s.points=new Float32Array(s.points),this.#aP.build(this.#on,t,e,i,this.#r2,this.#aa,r),this.#at=null,this.#nI=null,this.#on=null,this.#oa=null,this.#aP}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}class rf extends rn{#av;#oc=0;#n9;#on;#ol;#oh;#ou;#r2;#aa;build(t,e,i,r,s,n,a){this.#ol=e,this.#oh=i,this.#ou=r,this.#r2=s,this.#aa=n,this.#n9=a??0,this.#on=t,this.#op()}get thickness(){return this.#aa}setLastElement(t){return this.#on.push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#on.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let t=[];for(let{line:e}of this.#on){if(t.push(`M${rn.svgRound(e[4])} ${rn.svgRound(e[5])}`),6===e.length){t.push("Z");continue}if(12===e.length&&isNaN(e[6])){t.push(`L${rn.svgRound(e[10])} ${rn.svgRound(e[11])}`);continue}for(let i=6,r=e.length;i<r;i+=6){let[r,s,n,a,o,l]=e.subarray(i,i+6).map(rn.svgRound);t.push(`C${r} ${s} ${n} ${a} ${o} ${l}`)}}return t.join("")}serialize([t,e,i,r],s){let n,a,o,l,h,d,c,u,p,g=[],m=[],[f,b,v,y]=this.#og();switch(this.#r2){case 0:p=rn._rescale,n=t,a=e+r,o=i,l=-r,h=t+f*i,d=e+(1-b-y)*r,c=t+(f+v)*i,u=e+(1-b)*r;break;case 90:p=rn._rescaleAndSwap,n=t,a=e,o=i,l=r,h=t+b*i,d=e+f*r,c=t+(b+y)*i,u=e+(f+v)*r;break;case 180:p=rn._rescale,n=t+i,a=e,o=-i,l=r,h=t+(1-f-v)*i,d=e+b*r,c=t+(1-f)*i,u=e+(b+y)*r;break;case 270:p=rn._rescaleAndSwap,n=t+i,a=e+r,o=-i,l=-r,h=t+(1-b-y)*i,d=e+(1-f-v)*r,c=t+(1-b)*i,u=e+(1-f)*r}for(let{line:t,points:e}of this.#on)g.push(p(t,n,a,o,l,s?Array(t.length):null)),m.push(p(e,n,a,o,l,s?Array(e.length):null));return{lines:g,points:m,rect:[h,d,c,u]}}static deserialize(t,e,i,r,s,{paths:{lines:n,points:a},rotation:o,thickness:l}){let h,d,c,u,p,g=[];switch(o){case 0:p=rn._rescale,h=-t/i,d=e/r+1,c=1/i,u=-1/r;break;case 90:p=rn._rescaleAndSwap,h=-e/r,d=-t/i,c=1/r,u=1/i;break;case 180:p=rn._rescale,h=t/i+1,d=-e/r,c=-1/i,u=1/r;break;case 270:p=rn._rescaleAndSwap,h=e/r+1,d=t/i+1,c=-1/r,u=-1/i}if(!n)for(let t of(n=[],a)){let e=t.length;if(2===e){n.push(new Float32Array([NaN,NaN,NaN,NaN,t[0],t[1]]));continue}if(4===e){n.push(new Float32Array([NaN,NaN,NaN,NaN,t[0],t[1],NaN,NaN,NaN,NaN,t[2],t[3]]));continue}let i=new Float32Array(3*(e-2));n.push(i);let[r,s,a,o]=t.subarray(0,4);i.set([NaN,NaN,NaN,NaN,r,s],0);for(let n=4;n<e;n+=2){let e=t[n],l=t[n+1];i.set(rn.createBezierPoints(r,s,a,o,e,l),(n-2)*3),[r,s,a,o]=[a,o,e,l]}}for(let t=0,e=n.length;t<e;t++)g.push({line:p(n[t].map(t=>t??NaN),h,d,c,u),points:p(a[t].map(t=>t??NaN),h,d,c,u)});let m=new this.prototype.constructor;return m.build(g,i,r,1,o,l,s),m}#om(t=this.#aa){let e=this.#n9+t/2*this.#ou;return this.#r2%180==0?[e/this.#ol,e/this.#oh]:[e/this.#oh,e/this.#ol]}
2#og(){let[t,e,i,r]=this.#av,[s,n]=this.#om(0);return[t+s,e+n,i-2*s,r-2*n]}#op(){let t=this.#av=new Float32Array([1/0,1/0,-1/0,-1/0]);for(let{line:e}of this.#on){if(e.length<=12){for(let i=4,r=e.length;i<r;i+=6)H.pointBoundingBox(e[i],e[i+1],t);continue}let i=e[4],r=e[5];for(let s=6,n=e.length;s<n;s+=6){let[n,a,o,l,h,d]=e.subarray(s,s+6);H.bezierBoundingBox(i,r,n,a,o,l,h,d,t),i=h,r=d}}let[e,i]=this.#om();t[0]=W(t[0]-e,0,1),t[1]=W(t[1]-i,0,1),t[2]=W(t[2]+e,0,1),t[3]=W(t[3]+i,0,1),t[2]-=t[0],t[3]-=t[1]}get box(){return this.#av}updateProperty(t,e){return"stroke-width"===t?this.#aK(e):null}#aK(t){let[e,i]=this.#om();this.#aa=t;let[r,s]=this.#om(),[n,a]=[r-e,s-i],o=this.#av;return o[0]-=n,o[1]-=a,o[2]+=2*n,o[3]+=2*a,o}updateParentDimensions([t,e],i){let[r,s]=this.#om();this.#ol=t,this.#oh=e,this.#ou=i;let[n,a]=this.#om(),o=n-r,l=a-s,h=this.#av;return h[0]-=o,h[1]-=l,h[2]+=2*o,h[3]+=2*l,h}updateRotation(t){return this.#oc=t,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#av.map(rn.svgRound).join(" ")}get defaultProperties(){let[t,e]=this.#av;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${rn.svgRound(t)} ${rn.svgRound(e)}`}}}get rotationTransform(){let[,,t,e]=this.#av,i=0,r=0,s=0,n=0,a=0,o=0;switch(this.#oc){case 90:r=e/t,s=-t/e,a=t;break;case 180:i=-1,n=-1,a=t,o=e;break;case 270:r=-e/t,s=t/e,o=e;break;default:return""}return`matrix(${i} ${r} ${s} ${n} ${rn.svgRound(a)} ${rn.svgRound(o)})`}getPathResizingSVGProperties([t,e,i,r]){let[s,n]=this.#om(),[a,o,l,h]=this.#av;if(Math.abs(l-s)<=rn.PRECISION||Math.abs(h-n)<=rn.PRECISION){let s=t+i/2-(a+l/2),n=e+r/2-(o+h/2);return{path:{"transform-origin":`${rn.svgRound(t)} ${rn.svgRound(e)}`,transform:`${this.rotationTransform} translate(${s} ${n})`}}}let d=(i-2*s)/(l-2*s),c=(r-2*n)/(h-2*n);return{path:{"transform-origin":`${rn.svgRound(a)} ${rn.svgRound(o)}`,transform:`${this.rotationTransform} scale(${l/i} ${h/r}) translate(${rn.svgRound(s)} ${rn.svgRound(n)}) scale(${d} ${c}) translate(${rn.svgRound(-s)} ${rn.svgRound(-n)})`}}}getPathResizedSVGProperties([t,e,i,r]){let[s,n]=this.#om(),a=this.#av,[o,l,h,d]=a;if(a[0]=t,a[1]=e,a[2]=i,a[3]=r,Math.abs(h-s)<=rn.PRECISION||Math.abs(d-n)<=rn.PRECISION){let s=t+i/2-(o+h
2/2),n=e+r/2-(l+d/2);for(let{line:t,points:e}of this.#on)rn._translate(t,s,n,t),rn._translate(e,s,n,e);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${rn.svgRound(t)} ${rn.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let c=(i-2*s)/(h-2*s),u=(r-2*n)/(d-2*n),p=-c*(o+s)+t+s,g=-u*(l+n)+e+n;if(1!==c||1!==u||0!==p||0!==g)for(let{line:t,points:e}of this.#on)rn._rescale(t,p,g,c,u,t),rn._rescale(e,p,g,c,u,e);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${rn.svgRound(t)} ${rn.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,e],i){let[r,s]=i,n=this.#av,a=t-n[0],o=e-n[1];if(this.#ol===r&&this.#oh===s)for(let{line:t,points:e}of this.#on)rn._translate(t,a,o,t),rn._translate(e,a,o,e);else{let t=this.#ol/r,e=this.#oh/s;for(let{line:i,points:n}of(this.#ol=r,this.#oh=s,this.#on))rn._rescale(i,a,o,t,e,i),rn._rescale(n,a,o,t,e,n);n[2]*=t,n[3]*=e}return n[0]=t,n[1]=e,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${rn.svgRound(t)} ${rn.svgRound(e)}`}}}get defaultSVGProperties(){let t=this.#av;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${rn.svgRound(t[0])} ${rn.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}}class rb extends rp{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:tF._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){"stroke-width"===t&&(e??=this["stroke-width"],e*=this._viewParameters.realScale),super.updateSVGProperty(t,e)}clone(){let t=new rb(this._viewParameters);return t.updateAll(this),t}}class rv extends rg{static _type="ink";static _editorType=p.INK;static _defaultDrawingOptions=null;constructor(t){super({...t,name:"inkEditor"}),this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,e){tF.initialize(t,e),this._defaultDrawingOptions=new rb(e.viewParameters)}static getDefaultDrawingOptions(t){let e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!0}static get typesMap(){return P(this,"typesMap",new Map([[g.INK_THICKNESS,"stroke-width"],[g.INK_COLOR,"stroke"],[g.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,e,i,r,s){return new rm(t,e,i,r,s,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,e,i,r,s,n){return rf.deserialize(t,e,i,r,s,n)}static async deserialize(t,e,i){let r=null;if(t instanceof i6){let{data:{inkLists:e,rect:i,rotation:s,id:n,color:a,opacity:o,borderStyle:{rawWidth:l},popupRef:h,richText:d,contentsObj:c,creationDate:u,modificationDate:g},parent:{page:{pageNumber:m}}}=t;r=t={annotationType:p.INK,color:Array.from(a),thickness:l,opacity:o,paths:{points:e},boxes:null,pageIndex:m-1,rect:i.slice(0),rotation:s,annotationElementId:n,id:n,deleted:!1,popupRef:h,richText:d,comment:c?.str||null,creationDate:u,modificationDate:g}}let s=await super.deserialize(t,e,i);return s._initialData=r,t.comment&&s.setCommentData(t),s}get toolbarButtons(){return this._colorPicker||=new iP(this),[["colorPicker",this._colorPicker]]}get colorType(){return g.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:t,_drawingOptions:e,parent:i}=this;e.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(t,e.toSVGProperties())}static onScaleChangingWhenDrawing(){let t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:e,opacity:i}){this._drawingOptions=rv.getDefaultDrawingOptions({stroke:H.makeHexColor(...t),"stroke-width":e,"stroke-opacity":i})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:e,points:i}=this.serializeDraw(t),{_drawingOptions:{stroke:r,"stroke-opacity":s,"stroke-width":n}}=this,a=Object.assign(super.serialize(t),{color:tF._colorManager.convert(r),opacity:s,thickness:n,paths:{lines:e,points:i}});return(this.addComment(a),t)?(a.isCopy=!0,a):this.annotationElementId&&!this.#n3(a)?null:(a.id=this.annotationElementId,a)}#n3(t){let{color:e,thickness:i,opacity:r,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((t,i)=>t!==e[i])||t.thickness!==i||t.opacity!==r||t.pageIndex!==s}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let{points:e,rect:i}=this.serializeDraw(!1);return t.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:e,popup:this.comment}),null}}class ry extends rf{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}}o(9432);class rA{static #of={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static #ob(t,e,i,r){return(i-=t,r-=e,0===i)?r>0?0:4:1===i?r+6:2-r}static #ov=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static #oy(t,e,i,r,s,n,a){let o=this.#ob(i,r,s,n);for(let s=0;s<8;s++){let n=(-s+o-a+16)%8;if(0!==t[(i+this.#ov[2*n])*e+(r+this.#ov[2*n+1])])return n}return -1}static #oA(t,e,i,r,s,n,a){let o=this.#ob(i,r,s,n);for(let s=0;s<8;s++){let n=(s+o+a+16)%8;if(0!==t[(i+this.#ov[2*n])*e+(r+this.#ov[2*n+1])])return n}return -1}static #ow(t,e,i,r){let s,n=t.length,a=new Int32Array(n);for(let e=0;e<n;e++)a[e]=+(t[e]<=r);for(let t=1;t<i-1;t++)a[t*e]=a[t*e+e-1]=0;for(let t=0;t<e;t++)a[t]=a[e*i-1-t]=0;let o=1,l=[];for(let t=1;t<i-1;t++){s=1;for(let i=1;i<e-1;i++){let r,n=t*e+i,h=a[n];if(0===h)continue;let d=t,c=i;if(1===h&&0===a[n-1])o+=1,c-=1;else if(h>=1&&0===a[n+1])o+=1,c+=1,h>1&&(s=h);else{1!==h&&(s=Math.abs(h));continue}let u=[i,t],p=c===i+1,g={isHole:p,points:u,id:o,parent:0};for(let t of(l.push(g),l))if(t.id===s){r=t;break}r?r.isHole?g.parent=p?r.parent:s:g.parent=p?s:r.parent:g.parent=p?s:0;let m=this.#oy(a,e,t,i,d,c,0);
2if(-1===m){a[n]=-o,1!==a[n]&&(s=Math.abs(a[n]));continue}let f=this.#ov[2*m],b=this.#ov[2*m+1],v=t+f,y=i+b;d=v,c=y;let A=t,w=i;for(;;){let r=this.#oA(a,e,A,w,d,c,1);f=this.#ov[2*r],b=this.#ov[2*r+1];let l=A+f,h=w+b;u.push(h,l);let p=A*e+w;if(0===a[p+1]?a[p]=-o:1===a[p]&&(a[p]=o),l===t&&h===i&&A===v&&w===y){1!==a[n]&&(s=Math.abs(a[n]));break}d=A,c=w,A=l,w=h}}}return l}static #ox(t,e,i,r){if(i-e<=4){for(let s=e;s<i-2;s+=2)r.push(t[s],t[s+1]);return}let s=t[e],n=t[e+1],a=t[i-4]-s,o=t[i-3]-n,l=Math.hypot(a,o),h=a/l,d=o/l,c=h*n-d*s,u=1/l,p=Math.atan(o/a),g=Math.cos(p),m=Math.sin(p),f=u*(Math.abs(g)+Math.abs(m)),b=u*(1-f+f**2),v=Math.max(Math.atan(Math.abs(m+g)*b),Math.atan(Math.abs(m-g)*b)),y=0,A=e;for(let r=e+2;r<i-2;r+=2){let e=Math.abs(c-h*t[r+1]+d*t[r]);e>y&&(A=r,y=e)}y>(l*v)**2?(this.#ox(t,e,A+2,r),this.#ox(t,A,i,r)):r.push(s,n)}static #oE(t){let e=[],i=t.length;return this.#ox(t,0,i,e),e.push(t[i-2],t[i-1]),e.length<=4?null:e}static #oS(t,e,i,r,s,n){let a=new Float32Array(n**2),o=-2*r**2,l=n>>1;for(let t=0;t<n;t++){let e=(t-l)**2;for(let i=0;i<n;i++)a[t*n+i]=Math.exp((e+(i-l)**2)/o)}let h=new Float32Array(256),d=-2*s**2;for(let t=0;t<256;t++)h[t]=Math.exp(t**2/d);let c=new Uint8Array(t.length),u=new Uint32Array(256);for(let r=0;r<i;r++)for(let s=0;s<e;s++){let o=r*e+s,d=t[o],p=0,g=0;for(let o=0;o<n;o++){let c=r+o-l;if(!(c<0)&&!(c>=i))for(let i=0;i<n;i++){let r=s+i-l;if(r<0||r>=e)continue;let u=t[c*e+r],m=a[o*n+i]*h[Math.abs(u-d)];p+=u*m,g+=m}}let m=c[o]=Math.round(p/g);u[m]++}return[c,u]}static #o_(t){let e=new Uint32Array(256);for(let i of t)e[i]++;return e}static #oT(t){let e=new Uint8ClampedArray(t.length>>2),i=-1/0,r=1/0;for(let s=0,n=e.length;s<n;s++){let n=e[s]=t[s<<2];i=Math.max(i,n),r=Math.min(r,n)}let s=255/(i-r);for(let t=0,i=e.length;t<i;t++)e[t]=(e[t]-r)*s;return e}static #oC(t){let e,i=-1/0,r=-1/0,s=t.findIndex(t=>0!==t),n=s,a=s;for(e=s;e<256;e++){let s=t[e];s>i&&(e-n>r&&(r=e-n,a=e-1),i=s,n=e)}for(e=a-1;e>=0&&!(t[e]>t[e+1]);e--);return e}static #oM(t){let e=t,{width:i,height:r}=t,{maxDim:s}=this.#of,n=i,a=r;if(i>s||r>s){let o=i,l=r,h=Math.log2(Math.max(i,r)/s),d=Math.floor(h);h=h===d?d-1:d;for(let i=0;i<h;i++){let i=new OffscreenCanvas(n=Math.ceil(o/2),a=Math.ceil(l/2));i.getContext("2d").drawImage(t,0,0,o,l,0,0,n,a),o=n,l=a,t!==e&&t.close(),t=i.transferToImageBitmap()}let c=Math.min(s/n,s/a);n=Math.round(n*c),a=Math.round(a*c)}let o=new OffscreenCanvas(n,a).getContext("2d",{willReadFrequently:!0});o.fillStyle="white",o.fillRect(0,0,n,a),o.filter="grayscale(1)",o.drawImage(t,0,0,t.width,t.height,0,0,n,a);let l=o.getImageData(0,0,n,a).data;return[this.#oT(l),n,a]}static extractContoursFromText(t,{fontFamily:e,fontStyle:i,fontWeight:r},s,n,a,o){let l=new OffscreenCanvas(1,1),h=l.getContext("2d",{alpha:!1}),d=h.font=`${i} ${r} 200px ${e}`,{actualBoundingBoxLeft:c,actualBoundingBoxRight:u,actualBoundingBoxAscent:p,actualBoundingBoxDescent:g,fontBoundingBoxAscent:m,fontBoundingBoxDescent:f,width:b}=h.measureText(t),v=Math.ceil(1.5*Math.max(Math.abs(c)+Math.abs(u)||0,b)),y=Math.ceil(1.5*Math.max(Math.abs(p)+Math.abs(g)||200,Math.abs(m)+Math.abs(f)||200));(h=(l=new OffscreenCanvas(v,y)).getContext("2d",{alpha:!0,willReadFrequently:!0})).font=d,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,v,y),h.fillStyle="black",h.fillText(t,.5*v/2,1.5*y/2);let A=this.#oT(h.getImageData(0,0,v,y).data),w=this.#o_(A),x=this.#oC(w),E=this.#ow(A,v,y,x);return this.processDrawnLines({lines:{curves:E,width:v,height:y},pageWidth:s,pageHeight:n,rotation:a,innerMargin:o,mustSmooth:!0,areContours:!0})}static process(t,e,i,r,s){let[n,a,o]=this.#oM(t),[l,h]=this.#oS(n,a,o,Math.hypot(a,o)*this.#of.sigmaSFactor,this.#of.sigmaR,this.#of.kernelSize),d=this.#oC(h),c=this.#ow(l,a,o,d);return this.processDrawnLines({lines:{curves:c,width:a,height:o},pageWidth:e,pageHeight:i,rotation:r,innerMargin:s,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:i,rotation:r,innerMargin:s,mustSmooth:n,areContours:a}){r%180!=0&&([e,i]=[i,e]);let{curves:o,width:l,height:h}=t,d=t.thickness??0,c=[],u=Math.min(e/l,i/h),p=u/e,g=u/i,m=[];for(let{points:t}of o){let e=n?this.#oE(t):t;if(!e)continue;m.push(e);let i=e.length,r=new Float32Array(i),s=new Float32Array(3*(2===i?2:i-2));if(c.push({line:s,points:r}),2===i){r[0]=e[0]*p,r[1]=e[1]*g,s.set([NaN,NaN,NaN,NaN,r[0],r[1]],0
2);continue}let[a,o,l,h]=e;a*=p,o*=g,l*=p,h*=g,r.set([a,o,l,h],0),s.set([NaN,NaN,NaN,NaN,a,o],0);for(let t=4;t<i;t+=2){let i=r[t]=e[t]*p,n=r[t+1]=e[t+1]*g;s.set(rn.createBezierPoints(a,o,l,h,i,n),(t-2)*3),[a,o,l,h]=[l,h,i,n]}}if(0===c.length)return null;let f=a?new ry:new rf;return f.build(c,e,i,1,r,a?0:d,s),{outline:f,newCurves:m,areContours:a,thickness:d,width:l,height:h}}static async compressSignature({outlines:t,areContours:e,thickness:i,width:r,height:s}){let n,a=1/0,o=-1/0,l=0;for(let e of t){l+=e.length;for(let t=2,i=e.length;t<i;t++){let i=e[t]-e[t-2];a=Math.min(a,i),o=Math.max(o,i)}}n=a>=-128&&o<=127?Int8Array:a>=-32768&&o<=32767?Int16Array:Int32Array;let h=t.length,d=8+3*h,c=new Uint32Array(d),u=0;for(let a of(c[u++]=d*Uint32Array.BYTES_PER_ELEMENT+(l-2*h)*n.BYTES_PER_ELEMENT,c[u++]=0,c[u++]=r,c[u++]=s,c[u++]=+!e,c[u++]=Math.max(0,Math.floor(i??0)),c[u++]=h,c[u++]=n.BYTES_PER_ELEMENT,t))c[u++]=a.length-2,c[u++]=a[0],c[u++]=a[1];let p=new CompressionStream("deflate-raw"),g=p.writable.getWriter();await g.ready,g.write(c);let m=n.prototype.constructor;for(let e of t){let t=new m(e.length-2);for(let i=2,r=e.length;i<r;i++)t[i-2]=e[i]-e[i-2];g.write(t)}return g.close(),new Uint8Array(await new Response(p.readable).arrayBuffer()).toBase64()}static async decompressSignature(t){try{let e,i=Uint8Array.fromBase64(t),{readable:r,writable:s}=new DecompressionStream("deflate-raw"),n=s.getWriter();await n.ready,n.write(i).then(async()=>{await n.ready,await n.close()}).catch(()=>{});let a=null,o=0;for await(let t of r)(a||=new Uint8Array(new Uint32Array(t.buffer,0,4)[0])).set(t,o),o+=t.length;let l=new Uint32Array(a.buffer,0,a.length>>2),h=l[1];if(0!==h)throw Error(`Invalid version: ${h}`);let d=l[2],c=l[3],u=0===l[4],p=l[5],g=l[6],m=l[7],f=[],b=(8+3*g)*Uint32Array.BYTES_PER_ELEMENT;switch(m){case Int8Array.BYTES_PER_ELEMENT:e=new Int8Array(a.buffer,b);break;case Int16Array.BYTES_PER_ELEMENT:e=new Int16Array(a.buffer,b);break;case Int32Array.BYTES_PER_ELEMENT:e=new Int32Array(a.buffer,b)}o=0;for(let t=0;t<g;t++){let i=l[3*t+8],r=new Float32Array(i+2);f.push(r);for(let e=0;e<2;e++)r[e]=l[3*t+8+e+1];for(let t=0;t<i;t++)r[t+2]=r[t]+e[o++]}return{areContours:u,thickness:p,outlines:f,width:d,height:c}}catch(t){return _(`decompressSignature: ${t}`),null}}}class rw extends rp{constructor(){super(),super.updateProperties({fill:tF._defaultLineColor,"stroke-width":0})}clone(){let t=new rw;return t.updateAll(this),t}}class rx extends rb{constructor(t){super(t),super.updateProperties({stroke:tF._defaultLineColor,"stroke-width":1})}clone(){let t=new rx(this._viewParameters);return t.updateAll(this),t}}class rE extends rg{#oD=!1;#oP=null;#oI=null;#ok=null;static _type="signature";static _editorType=p.SIGNATURE;static _defaultDrawingOptions=null;constructor(t){super({...t,mustBeCommitted:!0,name:"signatureEditor"}),this._willKeepAspectRatio=!0,this.#oI=t.signatureData||null,this.#oP=null,this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,e){tF.initialize(t,e),this._defaultDrawingOptions=new rw,this._defaultDrawnSignatureOptions=new rx(e.viewParameters)}static getDefaultDrawingOptions(t){let e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!1}static get typesMap(){return P(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!this.#oP}}static computeTelemetryFinalData(t){let e=t.get("hasDescription");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){null!==this._drawId&&super.onScaleChanging()}render(){let t,e;if(this.div)return this.div;let{_isCopy:i}=this;if(i&&(this._isCopy=!1,t=this.x,e=this.y),super.render(),null===this._drawId)if(this.#oI){let{lines:t,mustSmooth:e,areContours:i,description:r,uuid:s,heightInPage:n}=this.#oI,{rawDims:{pageWidth:a,pageHeight:o},rotation:l}=this.parent.viewport,h=rA.processDrawnLines({lines:t,pageWidth:a,pageHeight:o,rotation:l,innerMargin:rE._INNER_MARGIN,mustSmooth:e,areContours:i});this.addSignature(h,n,r,s)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:this.#oP||""}));return i&&(this._isCopy=!0,this._moveAfterPaste(t,e)),this.div}setUuid(t){this.#ok=t,this.addEditToolbar()}getUuid(){return this.#ok}get description(){return this.#oP}set description(t){this.#oP=t,this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:t})),super.addEditToolbar().then(e=>{e?.updateEditSignatureButton(t)}))}getSignaturePreview(){let{newCurves:t,areContours:e,thickness:i,width:r,height:s}=this.#oI,n=Math.max(r,s),a=rA.processDrawnLines({lines:{curves:t.map(t=>({points:t})),thickness:i,width:r,height:s},pageWidth:n,pageHeight:n,rotation:0,innerMargin:0,mustSmooth:!1,areContours:e});return{areContours:e,outline:a.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,e,i,r){let s,{x:n,y:a}=this,{outline:o}=this.#oI=t;this.#oD=o instanceof ry,this.description=i,this.#oD?s=rE.getDefaultDrawingOptions():(s=rE._defaultDrawnSignatureOptions.clone()).updateProperties({"stroke-width":o.thickness}),this._addOutlines({drawOutlines:o,drawingOptions:s});let[,l]=this.pageDimensions,h=e/l;h=h>=1?.5:h,this.width*=h/this.height,this.width>=1&&(h*=.9/this.width,this.width=.9),this.height=h,this.setDims(),this.x=n,this.y=a,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(r),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!r,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(t){let{rawDims:{pageWidth:e,pageHeight:i},rotation:r}=this.parent.viewport;
2return rA.process(t,e,i,r,rE._INNER_MARGIN)}getFromText(t,e){let{rawDims:{pageWidth:i,pageHeight:r},rotation:s}=this.parent.viewport;return rA.extractContoursFromText(t,e,i,r,s,rE._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:e,pageHeight:i},rotation:r}=this.parent.viewport;return rA.processDrawnLines({lines:t,pageWidth:e,pageHeight:i,rotation:r,innerMargin:rE._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:e}){t?this._drawingOptions=rE.getDefaultDrawingOptions():(this._drawingOptions=rE._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":e}))}serialize(t=!1){if(this.isEmpty())return null;let{lines:e,points:i}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":r}}=this,s=Object.assign(super.serialize(t),{isSignature:!0,areContours:this.#oD,color:[0,0,0],thickness:this.#oD?0:r});return this.addComment(s),t?(s.paths={lines:e,points:i},s.uuid=this.#ok,s.isCopy=!0):s.lines=e,this.#oP&&(s.accessibilityData={type:"Figure",alt:this.#oP}),s}static deserializeDraw(t,e,i,r,s,n){return n.areContours?ry.deserialize(t,e,i,r,s,n):rf.deserialize(t,e,i,r,s,n)}static async deserialize(t,e,i){let r=await super.deserialize(t,e,i);return r.#oD=t.areContours,r.description=t.accessibilityData?.alt||"",r.#ok=t.uuid,r}}class rS extends tF{#oR=null;#oL=null;#oB=null;#oF=null;#oO=null;#oN="";#oU=null;#oz=!1;#oH=null;#oj=!1;#o$=!1;static _type="stamp";static _editorType=p.STAMP;constructor(t){super({...t,name:"stampEditor"}),this.#oF=t.bitmapUrl,this.#oO=t.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,e){tF.initialize(t,e)}static isHandlingMimeForPasting(t){return tu.includes(t)}static paste(t,e){e.pasteEditor({mode:p.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(t){let e=t.get("hasAltText");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}#oG(t,e=!1){if(!t)return void this.remove();this.#oR=t.bitmap,e||(this.#oL=t.id,this.#oj=t.isSvg),t.file&&(this.#oN=t.file.name),this.#oV()}#oW(){if(this.#oB=null,this._uiManager.enableWaiting(!1),this.#oU){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#oR)return void this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#oR){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(t=null,e=!0){if(this.hasAltTextData())return null;let{mlManager:i}=this._uiManager;if(!i)throw Error("No ML.");if(!await i.isEnabledFor("altText"))throw Error("ML isn't enabled for alt text.");let{data:r,width:s,height:n}=t||this.copyCanvas(null,null,!0).imageData,a=await i.guess({name:"altText",request:{data:r,width:s,height:n,channels:r.length/(s*n)}});if(!a)throw Error("No response from the AI service.");if(a.error)throw Error("Error from the AI service.");if(a.cancel)return null;if(!a.output)throw Error("No valid response from the AI service.");let o=a.output;return await this.setGuessedAltText(o),e&&!this.hasAltTextData()&&(this.altTextData={alt:o,decorative:!1}),o}#oK(){if(this.#oL){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#oL).then(t=>this.#oG(t,!0)).finally(()=>this.#oW());return}if(this.#oF){let t=this.#oF;this.#oF=null,this._uiManager.enableWaiting(!0),this.#oB=this._uiManager.imageManager.getFromUrl(t).then(t=>this.#oG(t)).finally(()=>this.#oW());return}if(this.#oO){let t=this.#oO;this.#oO=null,this._uiManager.enableWaiting(!0),this.#oB=this._uiManager.imageManager.getFromFile(t).then(t=>this.#oG(t)).finally(()=>this.#oW());return}let t=document.createElement("input");t.type="file",t.accept=tu.join(",");let e=this._uiManager._signal;this.#oB=new Promise(i=>{t.addEventListener("change",async()=>
2{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);let e=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#oG(e)}else this.remove();i()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:e})}).finally(()=>this.#oW()),t.click()}remove(){this.#oL&&(this.#oR=null,this._uiManager.imageManager.deleteId(this.#oL),this.#oU?.remove(),this.#oU=null,this.#oH&&(clearTimeout(this.#oH),this.#oH=null)),super.remove()}rebuild(){if(!this.parent){this.#oL&&this.#oK();return}super.rebuild(),null!==this.div&&(this.#oL&&null===this.#oU&&this.#oK(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(this.#oB||this.#oR||this.#oF||this.#oO||this.#oL||this.#oz)}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){let t,e;return this.div||(this._isCopy&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#oz||(this.#oR?this.#oV():this.#oK()),this._isCopy&&this._moveAfterPaste(t,e),this._uiManager.addShouldRescale(this)),this.div}setCanvas(t,e){let{id:i,bitmap:r}=this._uiManager.imageManager.getFromCanvas(t,e);e.remove(),i&&this._uiManager.imageManager.isValidId(i)&&(this.#oL=i,r&&(this.#oR=r),this.#oz=!1,this.#oV())}_onResized(){this.onScaleChanging()}onScaleChanging(){this.parent&&(null!==this.#oH&&clearTimeout(this.#oH),this.#oH=setTimeout(()=>{this.#oH=null,this.#oX()},200))}#oV(){let{div:t}=this,{width:e,height:i}=this.#oR,[r,s]=this.pageDimensions;if(this.width)e=this.width*r,i=this.height*s;else if(e>.75*r||i>.75*s){let t=Math.min(.75*r/e,.75*s/i);e*=t,i*=t}this._uiManager.enableWaiting(!1);let n=this.#oU=document.createElement("canvas");n.setAttribute("role","img"),this.addContainer(n),this.width=e/r,this.height=i/s,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(t.hidden=!1),this.#oX(),this.#o$||(this.parent.addUndoableEditor(this),this.#o$=!0),this._reportTelemetry({action:"inserted_image"}),this.#oN&&this.div.setAttribute("aria-description",this.#oN),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")}copyCanvas(t,e,i=!1){t||(t=224);let{width:r,height:s}=this.#oR,n=new tc,a=this.#oR,o=r,l=s,h=null;if(e){if(r>e||s>e){let t=Math.min(e/r,e/s);o=Math.floor(r*t),l=Math.floor(s*t)}let t=(h=document.createElement("canvas")).width=Math.ceil(o*n.sx),i=h.height=Math.ceil(l*n.sy);this.#oj||(a=this.#oq(t,i));let d=h.getContext("2d");d.filter=this._uiManager.hcmFilter;let c="white",u="#cfcfd8";"none"!==this._uiManager.hcmFilter?u="black":tp.isDarkMode&&(c="#8f8f9d",u="#42414d");let p=15*n.sx,g=15*n.sy,m=new OffscreenCanvas(2*p,2*g),f=m.getContext("2d");f.fillStyle=c,f.fillRect(0,0,2*p,2*g),f.fillStyle=u,f.fillRect(0,0,p,g),f.fillRect(p,g,p,g),d.fillStyle=d.createPattern(m,"repeat"),d.fillRect(0,0,t,i),d.drawImage(a,0,0,a.width,a.height,0,0,t,i)}let d=null;if(i){let e,i;if(n.symmetric&&a.width<t&&a.height<t)e=a.width,i=a.height;else if(a=this.#oR,r>t||s>t){let n=Math.min(t/r,t/s);e=Math.floor(r*n),i=Math.floor(s*n),this.#oj||(a=this.#oq(e,i))}let o=new OffscreenCanvas(e,i).getContext("2d",{willReadFrequently:!0});o.drawImage(a,0,0,a.width,a.height,0,0,e,i),d={width:e,height:i,data:o.getImageData(0,0,e,i).data}}return{canvas:h,width:o,height:l,imageData:d}}#oq(t,e){let{width:i,height:r}=this.#oR,s=i,n=r,a=this.#oR;for(;s>2*t||n>2*e;){let i=s,r=n;s>2*t&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2)),n>2*e&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2));let o=new OffscreenCanvas(s,n);o.getContext("2d").drawImage(a,0,0,i,r,0,0,s,n),a=o.transferToImageBitmap()}return a}#oX(){let[t,e]=this.parentDimensions,{width:i,height:r}=this,s=new tc,n=Math.ceil(i*t*s.sx),a=Math.ceil(r*e*s.sy),o=this.#oU;if(!o||o.width===n&&o.height===a)return;o.width=n,o.height=a;let l=this.#oj?this.#oR:this.#oq(n,a),h=o.getContext("2d");h.filter=this._uiManager.hcmFilter,h.drawImage(l,0,0,l.width,l.height,0,0,n,a)}#oY(t){if(t){if(this.#oj){let t=this._uiManager.imageManager.getSvgUrl(this.#oL);if(t)return t}let t=document.createElement("canvas");return{width:t.width,height:t.height}=this.#oR,t.getContext("2d").drawImage(this.#oR,0,0),t.toDataURL()}if(this.#oj){let[t,e]=this.pageDimensions,i=Math.round(this.width*t*Y.PDF_TO_CSS_UNITS),r=Math.round(this.height*e*Y.PDF_TO_CSS_UNITS),s=new OffscreenCanvas(i,r);return s.getContext("2d").drawImage(this.#oR,0,0,this.#oR.width,this.#oR.height,0,0,i,r),s.transferToImageBitmap()}return structuredClone(this.#oR)}static async deserialize(t,e,i){let r=null,s=!1;if(t instanceof rt){let n,a,{data:{rect:o,rotation:l,id:h,structParent:d,popupRef:c,richText:u,contentsObj:g,creationDate:m,modificationDate:f},container:b,parent:{page:{pageNumber:v}},canvas:y}=t;y?(delete t.canvas,{id:n,bitmap:a}=i.imageManager.getFromCanvas(b.id,y),y.remove()):(s=!0,t._hasNoCanvas=!0);let A=(await e._structTree.getAriaAttributes(`${V}${h}`))?.get("aria-label")||"";r=t={annotationType:p.STAMP,bitmapId:n,bitmap:a,pageIndex:v-1,rect:o.slice(0),rotation:l,annotationElementId:h,id:h,deleted:!1,accessibilityData:{decorative:!1,altText:A},isSvg:!1,structParent:d,popupRef:c,richText:u,comment:g?.str||null,creationDate:m,modificationDate:f}}let n=await super.deserialize(t,e,i),{rect:a,bitmap:o,bitmapUrl:l,bitmapId:h,isSvg:d,accessibilityData:c}=t;s?(i.addMissingCanvas(t.id,n),n.#oz=!0):h&&i.imageManager.isValidId(h)?(n.#oL=h,o&&(n.#oR=o)):n.#oF=l,n.#oj=d;let[u,g]=n.pageDimensions;return n.width=(a[2]-a[0])/u,n.height=(a[3]-a[1])/g,c&&(n.altTextData=c),n._initialData=r,t.comment&&n.setCommentData(t),n.#o$=!!r,n}serialize(t=!1,e=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let i=Object.assign(super.serialize(t),{bitmapId:this.#oL,isSvg:this.#oj});if(this.addComment(i),t)return i.bitmapUrl=this.#oY(!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;let{decorative:r,altText:s}=this.serializeAltText(!1);if(!r&&s&&(i.accessibilityData={type:"Figure",alt:s}
2),this.annotationElementId){let t=this.#n3(i);return t.isSame?null:(t.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1,i.id=this.annotationElementId,delete i.bitmapId,i)}if(null===e)return i;e.stamps||=new Map;let n=this.#oj?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has(this.#oL)){if(this.#oj){let t=e.stamps.get(this.#oL);n>t.area&&(t.area=n,t.serialized.bitmap.close(),t.serialized.bitmap=this.#oY(!1))}}else e.stamps.set(this.#oL,{area:n,serialized:i}),i.bitmap=this.#oY(!1);return i}#n3(t){let{pageIndex:e,accessibilityData:{altText:i}}=this._initialData,r=t.pageIndex===e,s=(t.accessibilityData?.alt||"")===i;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&r&&s,isSameAltText:s}}renderAnnotationElement(t){return this.deleted?t.hide():t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null}}class r_{#nz;#oQ=!1;#oJ=null;#oZ=null;#o0=null;#o1=new Map;#o2=!1;#o5=!1;#o3=!1;#o6=null;#o4=null;#o9=null;#o8=null;#o7=null;#lt=-1;#S;static _initialized=!1;static #ti=new Map([rs,rv,rS,ru,rE].map(t=>[t._editorType,t]));constructor({uiManager:t,pageIndex:e,div:i,structTreeLayer:r,accessibilityManager:s,annotationLayer:n,drawLayer:a,textLayer:o,viewport:l,l10n:h}){let d=[...r_.#ti.values()];if(!r_._initialized)for(let e of(r_._initialized=!0,d))e.initialize(h,t);t.registerEditorTypes(d),this.#S=t,this.pageIndex=e,this.div=i,this.#nz=s,this.#oJ=n,this.viewport=l,this.#o9=o,this.drawLayer=a,this._structTree=r,this.#S.addLayer(this)}updatePageIndex(t){this.pageIndex=t}get isEmpty(){return 0===this.#o1.size}get isInvisible(){return this.isEmpty&&this.#S.getMode()===p.NONE}updateToolbar(t){this.#S.updateToolbar(t)}updateMode(t=this.#S.getMode()){switch(this.#le(),t){case p.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case p.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case p.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:e}=this.div;if(e.toggle("nonEditing",!1),t===p.POPUP)e.toggle("commentEditing",!0);else for(let i of(e.toggle("commentEditing",!1),r_.#ti.values()))e.toggle(`${i._type}Editing`,t===i._editorType);this.div.hidden=!1}hasTextLayer(t){return t===this.#o9?.div}setEditingState(t){this.#S.setEditingState(t)}addCommands(t){this.#S.addCommands(t)}cleanUndoStack(t){this.#S.cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){this.#oJ?.togglePointerEvents(t)}get #li(){return 0!==this.#o1.size?this.#o1.values():this.#S.getEditors(this.pageIndex)}async enable(){this.#o3=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),this.#o7?.abort(),this.#o7=null;let t=new Set;for(let e of this.#li)e.enableEditing(),e.show(!0),e.annotationElementId&&(this.#S.removeChangedExistingAnnotation(e),t.add(e.annotationElementId));let e=this.#oJ;if(e)for(let i of e.getEditableAnnotations()){if(i.hide(),this.#S.isDeletedAnnotationElement(i.data.id)||t.has(i.data.id))continue;let e=await this.deserialize(i);e&&(this.addOrRebuild(e),e.enableEditing())}this.#o3=!1,this.#S._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#o5=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),this.#o9&&!this.#o7){this.#o7=new AbortController;let t=this.#S.combinedSignal(this.#o7);this.#o9.div.addEventListener("pointerdown",t=>{let e,{clientX:i,clientY:r,timeStamp:s}=t;if(s-this.#lt>500){this.#lt=s;return}this.#lt=-1;let{classList:n}=this.div;n.toggle("getElements",!0);let a=document.elementsFromPoint(i,r);if(n.toggle("getElements",!1),!this.div.contains(a[0]))return;let o=RegExp(`^${u}[0-9]+$`);for(let t of a)if(o.test(t.id)){e=t.id;break}if(!e)return;let l=this.#o1.get(e);l?.annotationElementId===null&&(t.stopPropagation(),t.preventDefault(),l.dblclick(t))},{signal:t,capture:!0})}let t=this.#oJ,e=[];if(t){let i=new Map,r=new Map;
2for(let t of this.#li){if(t.disableEditing(),!t.annotationElementId){e.push(t);continue}if(null!==t.serialize()){i.set(t.annotationElementId,t);continue}r.set(t.annotationElementId,t),this.getEditableAnnotation(t.annotationElementId)?.show(),t.remove()}for(let e of t.getEditableAnnotations()){let{id:t}=e.data;if(this.#S.isDeletedAnnotationElement(t)){e.updateEdited({deleted:!0});continue}let s=r.get(t);if(s){s.resetAnnotationElement(e),s.show(!1),e.show();continue}(s=i.get(t))&&(this.#S.addChangedExistingAnnotation(s),s.renderAnnotationElement(e)&&s.show(!1)),e.show()}}this.#le(),this.isEmpty&&(this.div.hidden=!0);let{classList:i}=this.div;for(let t of r_.#ti.values())i.remove(`${t._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(e),this.#o5=!1}getEditableAnnotation(t){return this.#oJ?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#S.getActive()!==t&&this.#S.setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,this.#o9?.div&&!this.#o8){this.#o8=new AbortController;let t=this.#S.combinedSignal(this.#o8);this.#o9.div.addEventListener("pointerdown",this.#lr.bind(this),{signal:t}),this.#o9.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#o9?.div&&this.#o8&&(this.#o8.abort(),this.#o8=null,this.#o9.div.classList.remove("highlighting"))}#lr(t){this.#S.unselectAll();let{target:e}=t;if(e===this.#o9.div||("img"===e.getAttribute("role")||e.classList.contains("endOfContent"))&&this.#o9.div.contains(e)){let{isMac:e}=U.platform;if(0!==t.button||t.ctrlKey&&e)return;this.#S.showAllEditors("highlight",!0,!0),this.#o9.div.classList.add("free"),this.toggleDrawing(),ru.startHighlighting(this,"ltr"===this.#S.direction,{target:this.#o9.div,x:t.x,y:t.y}),this.#o9.div.addEventListener("pointerup",()=>{this.#o9.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#S._signal}),t.preventDefault()}}enableClick(){if(this.#oZ)return;this.#oZ=new AbortController;let t=this.#S.combinedSignal(this.#oZ);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});let e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){this.#oZ?.abort(),this.#oZ=null}attach(t){this.#o1.set(t.id,t);let{annotationElementId:e}=t;e&&this.#S.isDeletedAnnotationElement(e)&&this.#S.removeDeletedAnnotationElement(t)}detach(t){this.#o1.delete(t.id),this.#nz?.removePointerInTextLayer(t.contentDiv),!this.#o5&&t.annotationElementId&&this.#S.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#S.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(this.#S.addDeletedAnnotationElement(t),tF.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(t.parent!==this||!t.isAttachedToDOM){if(this.changeParent(t),this.#S.addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!this.#o3),this.#S.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;t.div.contains(e)&&!this.#o0&&(t._focusEventsAllowed=!1,this.#o0=setTimeout(()=>{this.#o0=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this.#S._signal}),e.focus())},0)),t._structTreeParentId=this.#nz?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getEditorByUID(t){for(let e of this.#o1.values())if(e.uid===t)return e;return null}getNextId(){return this.#S.getId()}get #ls(){return r_.#ti.get(this.#S.getMode())}combinedSignal(t){return this.#S.combinedSignal(t)}#ln(t){let e=this.#ls;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#ls?.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await this.#S.updateMode(t.mode);let{offsetX:i,offsetY:r}=this.#la(),s=this.getNextId(),n=this.#ln({parent:this,id:s,x:i,y:r,uiManager:this.#S,isCentered:!0,...e});n&&this.add(n)}async deserialize(t){return await r_.#ti.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#S)||null}createAndAddNewEditor(t,e,i={}){let r=this.getNextId(),s=this.#ln({parent:this,id:r,x:t.offsetX,y:t.offsetY,uiManager:this.#S,isCentered:e,...i});return s&&this.add(s),s}get boundingClientRect(){return this.div.getBoundingClientRect()}#la(){let{x:t,y:e,width:i,height:r}=this.boundingClientRect,s=Math.max(0,t),n=Math.max(0,e),a=Math.min(window.innerWidth,t+i),o=Math.min(window.innerHeight,e+r),l=(s+a)/2-t,h=(n+o)/2-e,[d,c]=this.viewport.rotation%180==0?[l,h]:[h,l];return{offsetX:d,offsetY:c}}addNewEditor(t={}){this.createAndAddNewEditor(this.#la(),!0,t)}setSelected(t){this.#S.setSelected(t)}toggleSelected(t){this.#S.toggleSelected(t)}unselect(t){this.#S.unselect(t)}pointerup(t){let{isMac:e}=U.platform;if(0!==t.button||t.ctrlKey&&e||t.target!==this.div||!this.#o2||(this.#o2=!1,this.#ls?.isDrawer&&this.#ls.supportMultipleDrawings))return;if(!this.#oQ){this.#oQ=!0;return}let i=this.#S.getMode();if(i===p.STAMP||i===p.SIGNATURE)return void this.#S.unselectAll();this.createAndAddNewEditor(t,!1)}pointerdown(t){if(this.#S.getMode()===p.HIGHLIGHT&&this.enableTextSelection(),this.#o2){this.#o2=!1;return}let{isMac:e}=U.platform;if(0!==t.button||t.ctrlKey&&e||t.target!==this.div)return;if(this.#o2=!0,this.#ls?.isDrawer)return void this.startDrawingSession(t);let i=this.#S.getActive();this.#oQ=!i||i.isEmpty()}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),this.#o6)return void this.#ls.startDrawing(this,this.#S,!1,t);this.#S.setCurrentDrawingSession(this),this.#o6=new AbortController;let e=this.#S.combinedSignal(this.#o6);this.div.addEventListener("blur",({relatedTarget:t})=>{t&&!this.div.contains(t)&&(this.#o4=null,this.commitOrRemove())},{signal:e}),this.#ls.startDrawing(this,this.#S,!1,t)}pause(t){if(t){let{activeElement:t}=document;this.div.contains(t)&&(this.#o4=t);return}this.#o4&&setTimeout(()=>{this.#o4?.focus(),this.#o4=null},0)}endDrawingSession(t=!1){return this.#o6?(this.#S.setCurrentDrawingSession(null),this.#o6.abort(),this.#o6=null,this.#o4=null,this.#ls.endDrawing(t)):null}findNewParent(t,e,i){let r=this.#S.findParent(e,i);return null!==r&&r!==this&&(r.changeParent(t),!0)}commitOrRemove(){return!!this.#o6&&(this.endDrawingSession(),!0)}onScaleChanging(){this.#o6&&this.#ls.onScaleChangingWhenDrawing(this)}destroy(){for(let t of(this.commitOrRemove(),this.#S.getActive()?.parent===this&&(this.#S.commitOrRemove(),this.#S.setActiveEditor(null)),this.#o0&&(clearTimeout(this.#o0),this.#o0=null),this.#o1.values())
2)this.#nz?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#o1.clear(),this.#S.removeLayer(this)}#le(){for(let t of this.#o1.values())t.isEmpty()&&t.remove()}render({viewport:t}){for(let e of(this.viewport=t,td(this.div,t),this.#S.getEditors(this.pageIndex)))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){this.#S.commitOrRemove(),this.#le();let e=this.viewport.rotation,i=t.rotation;if(this.viewport=t,td(this.div,{rotation:i}),e!==i)for(let t of this.#o1.values())t.rotate(i)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return this.#S.viewParameters.realScale}}class rT{#nd=null;#lo=new Map;#ll=new Map;static #k=0;setParent(t){if(!this.#nd){this.#nd=t;return}if(this.#nd!==t){if(this.#lo.size>0)for(let e of this.#lo.values())e.remove(),t.append(e);this.#nd=t}}static get _svgFactory(){return P(this,"_svgFactory",new iB)}static #lh(t,[e,i,r,s]){let{style:n}=t;n.top=`${100*i}%`,n.left=`${100*e}%`,n.width=`${100*r}%`,n.height=`${100*s}%`}#ld(){let t=rT._svgFactory.create(1,1,!0);return this.#nd.append(t),t.setAttribute("aria-hidden",!0),t}#lc(t,e){let i=rT._svgFactory.createElement("clipPath");t.append(i);let r=`clip_${e}`;i.setAttribute("id",r),i.setAttribute("clipPathUnits","objectBoundingBox");let s=rT._svgFactory.createElement("use");return i.append(s),s.setAttribute("href",`#${e}`),s.classList.add("clip"),r}#lu(t,e){for(let[i,r]of Object.entries(e))null===r?t.removeAttribute(i):t.setAttribute(i,r)}draw(t,e=!1,i=!1){let r=rT.#k++,s=this.#ld(),n=rT._svgFactory.createElement("defs");s.append(n);let a=rT._svgFactory.createElement("path");n.append(a);let o=`path_${r}`;a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke"),e&&this.#ll.set(r,a);let l=i?this.#lc(n,o):null,h=rT._svgFactory.createElement("use");return s.append(h),h.setAttribute("href",`#${o}`),this.updateProperties(s,t),this.#lo.set(r,s),{id:r,clipPathId:`url(#${l})`}}drawOutline(t,e){let i,r=rT.#k++,s=this.#ld(),n=rT._svgFactory.createElement("defs");s.append(n);let a=rT._svgFactory.createElement("path");n.append(a);let o=`path_${r}`;if(a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke"),e){let t=rT._svgFactory.createElement("mask");n.append(t),i=`mask_${r}`,t.setAttribute("id",i),t.setAttribute("maskUnits","objectBoundingBox");let e=rT._svgFactory.createElement("rect");t.append(e),e.setAttribute("width","1"),e.setAttribute("height","1"),e.setAttribute("fill","white");let s=rT._svgFactory.createElement("use");t.append(s),s.setAttribute("href",`#${o}`),s.setAttribute("stroke","none"),s.setAttribute("fill","black"),s.setAttribute("fill-rule","nonzero"),s.classList.add("mask")}let l=rT._svgFactory.createElement("use");s.append(l),l.setAttribute("href",`#${o}`),i&&l.setAttribute("mask",`url(#${i})`);let h=l.cloneNode();return s.append(h),l.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.updateProperties(s,t),this.#lo.set(r,s),r}finalizeDraw(t,e){this.#ll.delete(t),this.updateProperties(t,e)}updateProperties(t,e){if(!e)return;let{root:i,bbox:r,rootClass:s,path:n}=e,a="number"==typeof t?this.#lo.get(t):t;if(a){if(i&&this.#lu(a,i),r&&rT.#lh(a,r),s){let{classList:t}=a;for(let[e,i]of Object.entries(s))t.toggle(e,i)}if(n){let t=a.firstElementChild.firstElementChild;this.#lu(t,n)}}}updateParent(t,e){if(e===this)return;let i=this.#lo.get(t);i&&(e.#nd.append(i),this.#lo.delete(t),e.#lo.set(t,i))}remove(t){this.#ll.delete(t),null!==this.#nd&&(this.#lo.get(t).remove(),this.#lo.delete(t))}destroy(){for(let t of(this.#nd=null,this.#lo.values()))t.remove();this.#lo.clear(),this.#ll.clear()}}globalThis._pdfjsTestingUtils={HighlightOutliner:rl},globalThis.pdfjsLib={AbortException:O,AnnotationEditorLayer:r_,AnnotationEditorParamsType:g,AnnotationEditorType:p,AnnotationEditorUIManager:tk,AnnotationLayer:ri,AnnotationMode:c,AnnotationType:v,applyOpacity:function(t,e,i,r){let s=255*(1-(r=Math.min(Math.max(r??1,0),1)));return[t=Math.round(t*r+s),e=Math.round(e*r+s),i=Math.round(i*r+s)]},build:"384c6208b",ColorPicker:iD,createValidAbsoluteUrl:M,CSSConstants:tg,DOMSVGFactory:iB,DrawLayer:rT,FeatureTest:U,fetchData:Q,findContrastColor:function(t,e){let i=t[0]+256*t[1]+65536*t[2]+0x1000000*e[0]+0x100000000*e[1]+0x10000000000*e[2],r=ty.get(i);if(r)return r;let s=new Float32Array(9),n=s.subarray(0,3),a=s.subarray(3,6);tm(t,a);let o=s.subarray(6,9);tm(e,o);let l=o[2]<.5,h=l?12:4.5;
2if(a[2]=l?Math.sqrt(a[2]):1-Math.sqrt(1-a[2]),tv(a,o,n)<h){let t,e;for(l?(t=a[2],e=1):(t=0,e=a[2]);e-t>.005;){let i=a[2]=(t+e)/2;l===tv(a,o,n)<h?t=i:e=i}a[2]=l?e:t}return tf(a,n),r=H.makeHexColor(Math.round(255*n[0]),Math.round(255*n[1]),Math.round(255*n[2])),ty.set(i,r),r},getDocument:iy,getFilenameFromUrl:function(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)},getPdfFilenameFromUrl:function(t,e="document.pdf"){if("string"!=typeof t)return e;if(tt(t))return _('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;let i=(t=>{try{return new URL(t)}catch{try{return new URL(decodeURIComponent(t))}catch{try{return new URL(t,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(t),"https://foo.bar")}catch{return null}}}}})(t);if(!i)return e;let r=t=>{try{let e=decodeURIComponent(t);if(e.includes("/")){if((e=e.split("/").at(-1)).test(/^\.pdf$/i))return e;return t}return e}catch{return t}},s=/\.pdf$/i,n=i.pathname.split("/").at(-1);if(s.test(n))return r(n);if(i.searchParams.size>0){for(let t of Array.from(i.searchParams.values()).reverse())if(s.test(t))return r(t);for(let t of Array.from(i.searchParams.keys()).reverse())if(s.test(t))return r(t)}if(i.hash){let t=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(i.hash);if(t)return r(t[0])}return e},getRGB:to,getUuid:G,getXfaPageViewport:function(t,{scale:e=1,rotation:i=0}){let{width:r,height:s}=t.attributes.style;return new J({viewBox:[0,0,parseInt(r),parseInt(s)],userUnit:1,scale:e,rotation:i})},GlobalWorkerOptions:eV,ImageKind:b,InvalidPDFException:L,isDataScheme:tt,isPdfFile:te,isValidExplicitDest:tQ,MathClamp:W,noContextMenu:ts,normalizeUnicode:function(t){return j||(j=/([\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,$=new Map([["ſt","ſt"]])),t.replaceAll(j,(t,e,i)=>e?e.normalize("NFKC"):$.get(i))},OPS:w,OutputScale:tc,PagesMapper:tx,PasswordResponses:{NEED_PASSWORD:1,INCORRECT_PASSWORD:2},PDFDataRangeTransport:iw,PDFDateString:ta,PDFWorker:iS,PermissionFlag:{PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},PixelsPerInch:Y,RenderingCancelledException:Z,renderRichText:tA,ResponseException:B,setLayerDimensions:td,shadow:P,SignatureExtractor:rA,stopEvent:tn,SupportedImageMimeTypes:tu,TextLayer:iv,TouchManager:tB,updateUrlHash:D,Util:H,VerbosityLevel:A,version:iM,XfaLayer:X}}}]);

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.