1/*! For license information please see 8213.0f93605ad87f18f848dd.bundle.js.LICENSE.txt */ 2"use strict";(self.webpackChunkuwazi=self.webpackChunkuwazi||[]).push([[8213],{10338(t,e,i){t.exports=i.p+"4deb0d74b64a27bf5910.mjs"},12841(t,e,i){i.d(e,{sY:()=>c,f4:()=>a,rr:()=>s});var n=i(96540);const r=n.createContext(""),s=({regionId:t="selectionRegion",children:e})=>n.createElement(r.Provider,{value:t},n.createElement("div",{"data-region-selector-id":t},e)),a=({textSelection:t,color:e})=>{const i=(0,n.useContext)(r);return n.createElement(n.Fragment,null,t.selectionRectangles.filter(t=>!t.regionId||!i||t.regionId===i).map(t=>{const i={top:t.top,left:t.left,width:t.width,height:t.height,padding:0,margin:0,position:"absolute",display:"block",mixBlendMode:"darken",opacity:.5,backgroundColor:e||"orange",zIndex:1};return n.createElement("div",{className:"highlight-rectangle",style:i,key:[t.top,t.left].join("")})}))},o=()=>{const t=window.getSelection();if(!t||!t.rangeCount)return[];const e=t.getRangeAt(0).cloneContents(),i=Array.from(e.querySelectorAll("*")).filter(t=>!t.children.length),n=[];return i.forEach((t,e)=>{const r=i[e-1];if(r&&((t,e)=>{var i,n;if(!t||!e)return!1;const r=null===(i=null==t?void 0:t.style)||void 0===i?void 0:i.left,s=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.left;return parseFloat(r)>parseFloat(s)})(r,t)){const t=document.createElement("span");t.innerText=" ",n.push(t)}n.push(t)}),n},l=()=>{const t=o();if(t.length<=1){const t=window.getSelection();return t&&t.toString()||""}return t.reduce((t,e)=>{let i=t;return i+=e.innerText,"BR"===e.tagName&&(i+="\n"),i},"")},h=t=>null!==t,c=({onSelect:t,onDeselect:e=()=>{},children:i})=>{const r=(0,n.useRef)(null),s=()=>{const i=window.getSelection();if(!r.current)return;if(!(null==i?void 0:i.toString().trim()))return void e();const n=Array.from(r.current.querySelectorAll("div[data-region-selector-id]")),s=(t=>{const e=t.getRangeAt(t.rangeCount-1),i=t.getRangeAt(0),n=document.createRange();return n.setStart(i.startContainer,i.startOffset),n.setEnd(e.endContainer,e.endOffset),n})(i),a=(t=>{var e,i,n;const r=document.createNodeIterator(t.commonAncestorContainer,NodeFilter.SHOW_TEXT),s=window.getSelection();if(null===s)return[];const a=(null===(i=null===(e=s.focusNode)||void 0===e?void 0:e.childNodes)||void 0===i?void 0:i.length)||!1,o=4===(null===(n=s.anchorNode)||void 0===n?void 0:n.compareDocumentPosition(s.focusNode))?"FOLLOWING":"PRECEDING",l=a||"PRECEDING"===o?s.anchorNode:s.focusNode,h=[];for(;r.nextNode()&&(!(0===h.length&&r.referenceNode!==t.startContainer)&&h.push(r.referenceNode),l!==r.referenceNode&&l!==r.referenceNode.parentElement););return h.reduce((e,i,n)=>{const r=document.createRange();return r.selectNode(i),0===n&&r.setStart(i,t.startOffset),n===h.length-1&&r.setEnd(i,a?i.length:t.endOffset),[...e,...Array.from(r.getClientRects())]},[])})(s).map(t=>{const e=n.find((i=t,t=>{const e=t.getBoundingClientRect(),n=e.x<=i.x&&i.x<=e.x+e.width,r=e.y<=i.y&&i.y<=e.y+e.height;return n&&r}));var i;return e?((t,e)=>{const i=e.getBoundingClientRect(),n=e.getAttribute("data-region-selector-id");return Object.assign({top:t.y-i.y,left:t.x-i.x,width:t.width,height:t.height},n?{regionId:n}:{})})(t,e):null}).filter(h),o=l();t({text:o,selectionRectangles:a})};return(0,n.useEffect)(()=>{const t=r.current;if(!t)return()=>{};const e=t=>{if((t.ctrlKey||t.metaKey)&&"c"===t.key){t.preventDefault();const e=window.getSelection();if(e&&e.toString().trim()){const t=l();navigator.clipboard.writeText(t)}}};return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[r]),n.createElement("div",{role:"none",ref:r,onMouseDown:t=>{var e;0===t.button&&(t.shiftKey||null===(e=window.getSelection())||void 0===e||e.removeAllRanges())},onMouseUp:t=>{0===t.button&&s()}},i)}},15626(t,e,i){i.r(e),i.d(e,{CA:()=>Jt,Cv:()=>ft,D6:()=>Nn,D7:()=>Vt,EA:()=>en,Fd:()=>Et,G6:()=>Lt,GG:()=>$t,Gz:()=>_t,HF:()=>jt,Hw:()=>Pt,J0:()=>ut,J1:()=>Kr,KL:()=>vt,Qh:()=>is,Qi:()=>Zt,S9:()=>Bt,TV:()=>ct,Tm:()=>Un,Tw:()=>wt,YE:()=>On,YJ:()=>mt,Z7:()=>st,ZH:()=>Tt,Zu:()=>tt,_p:()=>It,bw:()=>at,dU:()=>Ir,dm:()=>Rt,e3:()=>lt,iX:()=>es,ji:()=>St,jo:()=>kt,lJ:()=>Dt,lf:()=>xt,nS:()=>Vn,oA:()=>Ut,p5:()=>ue,r7:()=>et,s4:()=>he,sk:()=>Yn,xd:()=>er,z7:()=>Z,z_:()=>Kt});var n=i(48287).Buffer,r={34(t,e,i){var n=i(4901);t.exports=function(t){return"object"==typeof t?null!==t:n(t)}},81(t,e,i){var n=i(9565),r=i(9306),s=i(8551),a=i(6823),o=i(851),l=TypeError;t.exports=function(t,e){var i=arguments.length<2?o(t):e;if(r(i))return s(n(i,t));throw new l(a(t)+" is not iterable")}},116(t,e,i){var n=i(6518),r=i(9565),s=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),c=i(4549)("find",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:c},{find:function(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(c)return r(c,this,t);var e=l(this),i=0;return s(e,function(e,n){if(t(e,i++))return n(e)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})},283(t,e,i){var n=i(9504),r=i(9039),s=i(4901),a=i(9297),o=i(3724),l=i(350).CONFIGURABLE,h=i(3706),c=i(1181),d=c.enforce,u=c.get,p=String,g=Object.defineProperty,f=n("".slice),m=n("".replace),b=n([].join),v=o&&!r(function(){return 8!==g(function(){},"length",{value:8}).length}
vendor: 4,873 bytes, line 2
2),y=String(String).split("String"),w=t.exports=function(t,e,i){"Symbol("===f(p(e),0,7)&&(e="["+m(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 n=d(t);return a(n,"source")||(n.source=b(y,"string"==typeof e?e:"")),t};Function.prototype.toString=w(function(){return s(this)&&u(this).source||h(this)},"toString")},350(t,e,i){var n=i(3724),r=i(9297),s=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,o=r(s,"name"),l=o&&"something"===function(){}.name,h=o&&(!n||n&&a(s,"name").configurable);t.exports={EXISTS:o,PROPER:l,CONFIGURABLE:h}},397(t,e,i){var n=i(7751);t.exports=n("document","documentElement")},421(t){t.exports={}},456(t,e,i){var n=i(6518),r=i(4576),s=i(9504),a=i(4154),o=i(5169),l=s(1.1.toString),h=r.Uint8Array,c=!h||!h.prototype.toHex||!function(){try{return"ffffffffffffffff"===new h([255,255,255,255,255,255,255,255]).toHex()}catch(t){return!1}}();h&&n({target:"Uint8Array",proto:!0,forced:c},{toHex:function(){a(this),o(this.buffer);for(var t="",e=0,i=this.length;e<i;e++){var n=l(this[e],16);t+=1===n.length?"0"+n:n}return t}})},507(t,e,i){var n=i(9565);t.exports=function(t,e,i){for(var r,s,a=i?t:t.iterator,o=t.next;!(r=n(o,a)).done;)if(void 0!==(s=e(r.value)))return s}},531(t,e,i){var n=i(6518),r=i(9565),s=i(9306),a=i(8551),o=i(1767),l=i(8646),h=i(9462),c=i(9539),d=i(6395),u=i(684),p=i(4549),g=!d&&!u("flatMap",function(){}),f=!d&&!g&&p("flatMap",TypeError),m=d||g||f,b=h(function(){for(var t,e,i=this.iterator,n=this.mapper;;){if(e=this.inner)try{if(!(t=a(r(e.next,e.iterator))).done)return t.value;this.inner=null}catch(t){c(i,"throw",t)}if(t=a(r(this.next,i)),this.done=!!t.done)return;try{this.inner=l(n(t.value,this.counter++),!1)}catch(t){c(i,"throw",t)}}});n({target:"Iterator",proto:!0,real:!0,forced:m},{flatMap:function(t){a(this);try{s(t)}catch(t){c(this,"throw",t)}return f?r(f,this,t):new b(o(this),{mapper:t,inner:null})}})},616(t,e,i){var n=i(9039);t.exports=!n(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},655(t,e,i){var n=i(6955),r=String;t.exports=function(t){if("Symbol"===n(t))throw new TypeError("Cannot convert a Symbol value to a string");return r(t)}},679(t,e,i){var n=i(1625),r=TypeError;t.exports=function(t,e){if(n(e,t))return t;throw new r("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 n=+t;return(n>0?i:e)(n)}},757(t,e,i){var n=i(7751),r=i(4901),s=i(1625),a=i(7040),o=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=n("Symbol");return r(e)&&s(e.prototype,o(t))}},851(t,e,i){var n=i(6955),r=i(5966),s=i(4117),a=i(6269),o=i(8227)("iterator");t.exports=function(t){if(!s(t))return r(t,o)||r(t,"@@iterator")||a[n(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 n=i(1828),r=i(8727);t.exports=Object.keys||function(t){return n(t,r)}},1103(t){t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},1108(t,e,i){var n=i(6955);t.exports=function(t){var e=n(t);return"BigInt64Array"===e||"BigUint64Array"===e}},1148(t,e,i){var n=i(6518),r=i(9565),s=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),c=i(4549)("every",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:c},{every:function(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(c)return r(c,this,t);var e=l(this),i=0;return!s(e,function(e,n){if(!t(e,i++))return n()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1181(t,e,i){var n,r,s,a=i(8622),o=i(4576),l=i(34),h=i(6699),c=i(9297),d=i(7629),u=i(6119),p=i(421),g="Object already initialized",f=o.TypeError,m=o.WeakMap;if(a||d.state){var b=d.state||(d.state=new m);b.get=b.get,b.has=b.has,b.set=b.set,n=function(t,e){if(b.has(t))throw new f(g);return e.facade=t,b.set(t,e),e},r=function(t){return b.get(t)||{}},s=function(t){return b.has(t)}}else{var v=u("state");p[v]=!0,n=function(t,e){if(c(t,v))throw new f(g);return e.facade=t,h(t,v,e),e},r=function(t){return c(t,v)?t[v]:{}},s=function(t){return c(t,v)}}t.exports={set:n,get:r,has:s,enforce:function(t){return s(t)?r(t):n(t,{})},getterFor:function(t){return function(e){var i;if(!l(e)||(i=r(e)).type!==t)throw new f("Incompatible receiver, "+t+" required");return i}}}},1291(t,e,i){var n=i(741);t.exports=function(t){var e=+t;return e!=e||0===e?0:n(e)}},1385(t,e,i){var n=i(9539);
vendor: 4,470 bytes, line 2
2t.exports=function(t,e,i){for(var r=t.length-1;r>=0;r--)if(void 0!==t[r])try{i=n(t[r].iterator,e,i)}catch(t){e="throw",i=t}if("throw"===e)throw i;return i}},1548(t,e,i){var n=i(4576),r=i(9039),s=i(9519),a=i(4215),o=n.structuredClone;t.exports=!!o&&!r(function(){if("DENO"===a&&s>92||"NODE"===a&&s>94||"BROWSER"===a&&s>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){var n=i(9504);t.exports=n({}.isPrototypeOf)},1689(t,e,i){var n=i(6518),r=i(4576),s=i(8745),a=i(7680),o=i(6043),l=i(9306),h=i(1103),c=r.Promise,d=!1;n({target:"Promise",stat:!0,forced:!c||!c.try||h(function(){c.try(function(t){d=8===t},8)}).error||!d},{try:function(t){var e=arguments.length>1?a(arguments,1):[],i=o.f(this),n=h(function(){return s(l(t),void 0,e)});return(n.error?i.reject:i.resolve)(n.value),i.promise}})},1698(t,e,i){var n=i(6518),r=i(4204),s=i(9835);n({target:"Set",proto:!0,real:!0,forced:!i(4916)("union")||!s("union")},{union:r})},1701(t,e,i){var n=i(6518),r=i(9565),s=i(9306),a=i(8551),o=i(1767),l=i(9462),h=i(6319),c=i(9539),d=i(684),u=i(4549),p=i(6395),g=!p&&!d("map",function(){}),f=!p&&!g&&u("map",TypeError),m=p||g||f,b=l(function(){var t=this.iterator,e=a(r(this.next,t));if(!(this.done=!!e.done))return h(t,this.mapper,[e.value,this.counter++],!0)});n({target:"Iterator",proto:!0,real:!0,forced:m},{map:function(t){a(this);try{s(t)}catch(t){c(this,"throw",t)}return f?r(f,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 n=i(9504),r=i(9297),s=i(5397),a=i(9617).indexOf,o=i(421),l=n([].push);t.exports=function(t,e){var i,n=s(t),h=0,c=[];for(i in n)!r(o,i)&&r(n,i)&&l(c,i);for(;e.length>h;)r(n,i=e[h++])&&(~a(c,i)||l(c,i));return c}},2106(t,e,i){var n=i(283),r=i(4913);t.exports=function(t,e,i){return i.get&&n(i.get,e,{getter:!0}),i.set&&n(i.set,e,{setter:!0}),r.f(t,e,i)}},2140(t,e,i){var n={};n[i(8227)("toStringTag")]="z",t.exports="[object z]"===String(n)},2195(t,e,i){var n=i(9504),r=n({}.toString),s=n("".slice);t.exports=function(t){return s(r(t),8,-1)}},2211(t,e,i){var n=i(9039);t.exports=!n(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})},2303(t,e,i){var n=i(4576),r=i(9504),s=n.Uint8Array,a=n.SyntaxError,o=n.parseInt,l=Math.min,h=/[^\da-f]/i,c=r(h.exec),d=r("".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 n=e?l(e.length,i/2):i/2,r=e||new s(n),u=0,p=0;p<n;){var g=d(t,u,u+=2);if(c(h,g))throw new a("String should only contain hex characters");r[p++]=o(g,16)}return{bytes:r,read:u}}},2360(t,e,i){var n,r=i(8551),s=i(6801),a=i(8727),o=i(421),l=i(397),h=i(4055),c=i(6119),d="prototype",u="script",p=c("IE_PROTO"),g=function(){},f=function(t){return"<"+u+">"+t+"</"+u+">"},m=function(t){t.write(f("")),t.close();var e=t.parentWindow.Object;return t=null,e},b=function(){try{n=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;b="undefined"!=typeof document?document.domain&&n?m(n):(e=h("iframe"),i="java"+u+":",e.style.display="none",l.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(f("document.F=Object")),t.close(),t.F):m(n);for(var r=a.length;r--;)delete b[d][a[r]];return b()};o[p]=!0,t.exports=Object.create||function(t,e){var i;return null!==t?(g[d]=r(t),i=new g,g[d]=null,i[p]=t):i=b(),void 0===e?i:s.f(i,e)}},2475(t,e,i){var n=i(6518),r=i(8527);n({target:"Set",proto:!0,real:!0,forced:!i(4916)("isSupersetOf",function(t){return!t})},{isSupersetOf:r})},2489(t,e,i){var n=i(6518),r=i(9565),s=i(9306),a=i(8551),o=i(1767),l=i(9462),h=i(6319),c=i(6395),d=i(9539),u=i(684),p=i(4549),g=!c&&!u("filter",function(){}),f=!c&&!g&&p("filter",TypeError),m=c||g||f,b=l(function(){for(var t,e,i=this.iterator,n=this.predicate,s=this.next;;){if(t=a(r(s,i)),this.done=!!t.done)return;if(e=t.value,h(i,n,[e,this.counter++],!0))return e}});n({target:"Iterator",proto:!0,real:!0,forced:m},{filter:function(t){a(this);try{s(t)}catch(t){d(this,"throw",t)}return f?r(f,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 n=i(655);t.exports=function(t,e){return void 0===t?arguments.length<2?"":e:n(t)}},2652(t,e,i){var n=i(6080),r=i(9565),s=i(8551),a=i(6823),o=i(4209),l=i(6198),h=i(1625),c=i(81),d=i(851),u=i(9539),p=TypeError,g=function(t,e){this.stopped=t,this.result=e},f=g.prototype;
2t.exports=function(t,e,i){var m,b,v,y,w,A,x,E=i&&i.that,C=!(!i||!i.AS_ENTRIES),S=!(!i||!i.IS_RECORD),_=!(!i||!i.IS_ITERATOR),T=!(!i||!i.INTERRUPTED),P=n(e,E),D=function(t){return m&&u(m,"normal"),new g(!0,t)},M=function(t){return C?(s(t),T?P(t[0],t[1],D):P(t[0],t[1])):T?P(t,D):P(t)};if(S)m=t.iterator;else if(_)m=t;else{if(!(b=d(t)))throw new p(a(t)+" is not iterable");if(o(b)){for(v=0,y=l(t);y>v;v++)if((w=M(t[v]))&&h(f,w))return w;return new g(!1)}m=c(t,b)}for(A=S?t.next:m.next;!(x=r(A,m)).done;){try{w=M(x.value)}catch(t){u(m,"throw",t)}if("object"==typeof w&&w&&h(f,w))return w}return new g(!1)}},2777(t,e,i){var n=i(9565),r=i(34),s=i(757),a=i(5966),o=i(4270),l=i(8227),h=TypeError,c=l("toPrimitive");t.exports=function(t,e){if(!r(t)||s(t))return t;var i,l=a(t,c);if(l){if(void 0===e&&(e="default"),i=n(l,t,e),!r(i)||s(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 n=i(9297),r=i(4901),s=i(8981),a=i(6119),o=i(2211),l=a("IE_PROTO"),h=Object,c=h.prototype;t.exports=o?h.getPrototypeOf:function(t){var e=s(t);if(n(e,l))return e[l];var i=e.constructor;return r(i)&&e instanceof i?i.prototype:e instanceof h?c:null}},2796(t,e,i){var n=i(9039),r=i(4901),s=/#|\.prototype\./,a=function(t,e){var i=l[o(t)];return i===c||i!==h&&(r(e)?n(e):!!e)},o=a.normalize=function(t){return String(t).replace(s,".").toLowerCase()},l=a.data={},h=a.NATIVE="N",c=a.POLYFILL="P";t.exports=a},2804(t){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=e+"+/",n=e+"-_",r=function(t){for(var e={},i=0;i<64;i++)e[t.charAt(i)]=i;return e};t.exports={i2c:i,c2i:r(i),i2cUrl:n,c2iUrl:r(n)}},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 n=i(4576).navigator,r=n&&n.userAgent;t.exports=r?String(r):""},2967(t,e,i){var n=i(6706),r=i(34),s=i(7750),a=i(3506);
vendor: 4,158 bytes, line 2
2t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=n(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return s(i),a(n),r(i)?(e?t(i,n):i.__proto__=n,i):i}}():void 0)},3068(t,e,i){var n=i(6518),r=i(9504),s=i(2652),a=RangeError,o=TypeError,l=1/0,h=Math.abs,c=Math.pow,d=r([].push),u=c(2,1023),p=c(2,53)-1,g=Number.MAX_VALUE,f=c(2,971),m={},b={},v={},y={},w={},A=function(t,e){var i=t+e;return{hi:i,lo:e-(i-t)}};n({target:"Math",stat:!0},{sumPrecise:function(t){var e=[],i=0,n=y;switch(s(t,function(t){if(++i>=p)throw new a("Maximum allowed index exceeded");if("number"!=typeof t)throw new o("Value is not a number");n!==m&&(t!=t?n=m:t===l?n=n===b?m:v:t===-1/0?n=n===v?m:b:0===t&&1/t!==l||n!==y&&n!==w||(n=w,d(e,t)))}),n){case m:return NaN;case b:return-1/0;case v:return l;case y:return-0}for(var r,c,x,E,C,S,_=[],T=0,P=0;P<e.length;P++){r=e[P];for(var D=0,M=0;M<_.length;M++){if(c=_[M],h(r)<h(c)&&(S=r,r=c,c=S),E=(x=A(r,c)).hi,C=x.lo,h(E)===l){var F=E===l?1:-1;T+=F,h(r=r-F*u-F*u)<h(c)&&(S=r,r=c,c=S),E=(x=A(r,c)).hi,C=x.lo}0!==C&&(_[D++]=C),r=E}_.length=D,0!==r&&d(_,r)}var I=_.length-1;if(E=0,C=0,0!==T){var k=I>=0?_[I]:0;if(I--,h(T)>1||T>0&&k>0||T<0&&k<0)return T>0?l:-1/0;if(E=(x=A(T*u,k/2)).hi,C=x.lo,C*=2,h(2*E)===l)return E>0?E===u&&C===-f/2&&I>=0&&_[I]<0?g:l:E===-u&&C===f/2&&I>=0&&_[I]>0?-g:-1/0;0!==C&&(_[++I]=C,C=0),E*=2}for(;I>=0&&(E=(x=A(E,_[I--])).hi,0===(C=x.lo)););return I>=0&&(C<0&&_[I]<0||C>0&&_[I]>0)&&(c=2*C)===(r=E+c)-E&&(E=r),E}})},3167(t,e,i){var n=i(4901),r=i(34),s=i(2967);t.exports=function(t,e,i){var a,o;return s&&n(a=e.constructor)&&a!==i&&r(o=a.prototype)&&o!==i.prototype&&s(t,o),t}},3238(t,e,i){var n=i(4576),r=i(7811),s=i(7394),a=n.DataView;t.exports=function(t){if(!r||0!==s(t))return!1;try{return new a(t),!1}catch(t){return!0}}},3392(t,e,i){var n=i(9504),r=0,s=Math.random(),a=n(1.1.toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++r+s,36)}},3440(t,e,i){var n=i(7080),r=i(4402),s=i(9286),a=i(5170),o=i(3789),l=i(8469),h=i(507),c=r.has,d=r.remove;t.exports=function(t){var e=n(this),i=o(t),r=s(e);return a(e)<=i.size?l(e,function(t){i.includes(t)&&d(r,t)}):h(i.getIterator(),function(t){c(r,t)&&d(r,t)}),r}},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 n=i(3925),r=String,s=TypeError;t.exports=function(t){if(n(t))return t;throw new s("Can't set "+r(t)+" as a prototype")}},3579(t,e,i){var n=i(6518),r=i(9565),s=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),c=i(4549)("some",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:c},{some:function(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(c)return r(c,this,t);var e=l(this),i=0;return s(e,function(e,n){if(t(e,i++))return n()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},3650(t,e,i){var n=i(7080),r=i(4402),s=i(9286),a=i(3789),o=i(507),l=r.add,h=r.has,c=r.remove;t.exports=function(t){var e=n(this),i=a(t).getIterator(),r=s(e);return o(i,function(t){h(e,t)?c(r,t):l(r,t)}),r}},3706(t,e,i){var n=i(9504),r=i(4901),s=i(7629),a=n(Function.toString);r(s.inspectSource)||(s.inspectSource=function(t){return a(t)}),t.exports=s.inspectSource},3717(t,e){e.f=Object.getOwnPropertySymbols},3724(t,e,i){var n=i(9039);t.exports=!n(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},3789(t,e,i){var n=i(9306),r=i(8551),s=i(9565),a=i(1291),o=i(1767),l="Invalid size",h=RangeError,c=TypeError,d=Math.max,u=function(t,e){this.set=t,this.size=d(e,0),this.has=n(t.has),this.keys=n(t.keys)};u.prototype={getIterator:function(){return o(r(s(this.keys,this.set)))},includes:function(t){return s(this.has,this.set,t)}},t.exports=function(t){r(t);var e=+t.size;if(e!=e)throw new c(l);var i=a(e);if(i<0)throw new h(l);return new u(t,i)}},3838(t,e,i){var n=i(7080),r=i(5170),s=i(8469),a=i(3789);t.exports=function(t){var e=n(this),i=a(t);return!(r(e)>i.size)&&!1!==s(e,function(t){if(!i.includes(t))return!1},!0)}},3853(t,e,i){var n=i(6518),r=i(4449);n({target:"Set",proto:!0,real:!0,forced:!i(4916)("isDisjointFrom",function(t){return!t})},{isDisjointFrom:r})}
2,3925(t,e,i){var n=i(34);t.exports=function(t){return n(t)||null===t}},3972(t,e,i){var n=i(34),r=String,s=TypeError;t.exports=function(t){if(void 0===t||n(t))return t;throw new s(r(t)+" is not an object or undefined")}},4055(t,e,i){var n=i(4576),r=i(34),s=n.document,a=r(s)&&r(s.createElement);t.exports=function(t){return a?s.createElement(t):{}}},4114(t,e,i){var n=i(6518),r=i(8981),s=i(6198),a=i(4527),o=i(6837);n({target:"Array",proto:!0,arity:1,forced:i(9039)(function(){return 4294967297!==[].push.call({length:4294967296},1)})||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}}()},{push:function(t){var e=r(this),i=s(e),n=arguments.length;o(i+n);for(var l=0;l<n;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 n=i(6955),r=TypeError;t.exports=function(t){if("Uint8Array"===n(t))return t;throw new r("Argument is not an Uint8Array")}},4204(t,e,i){var n=i(7080),r=i(4402).add,s=i(9286),a=i(3789),o=i(507);t.exports=function(t){var e=n(this),i=a(t).getIterator(),l=s(e);return o(i,function(t){r(l,t)}),l}},4209(t,e,i){var n=i(8227),r=i(6269),s=n("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||a[s]===t)}},4215(t,e,i){var n=i(4576),r=i(2839),s=i(2195),a=function(t){return r.slice(0,t.length)===t};t.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":n.Bun&&"string"==typeof Bun.version?"BUN":n.Deno&&"object"==typeof Deno.version?"DENO":"process"===s(n.process)?"NODE":n.window&&n.document?"BROWSER":"REST"},4226(t,e,i){var n=i(6518),r=i(4576),s=i(3463),a=i(4154),o=i(5169),l=i(2303);r.Uint8Array&&n({target:"Uint8Array",proto:!0},{setFromHex:function(t){a(this),s(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 n=i(9565),r=i(4901),s=i(34),a=TypeError;t.exports=function(t,e){var i,o;if("string"===e&&r(i=t.toString)&&!s(o=n(i,t)))return o;if(r(i=t.valueOf)&&!s(o=n(i,t)))return o;if("string"!==e&&r(i=t.toString)&&!s(o=n(i,t)))return o;throw new a("Can't convert object to primitive value")}},4376(t,e,i){var n=i(2195);t.exports=Array.isArray||function(t){return"Array"===n(t)}},4402(t,e,i){var n=i(9504),r=Set.prototype;t.exports={Set,add:n(r.add),has:n(r.has),remove:n(r.delete),proto:r}},4449(t,e,i){var n=i(7080),r=i(4402).has,s=i(5170),a=i(3789),o=i(8469),l=i(507),h=i(9539);t.exports=function(t){var e=n(this),i=a(t);if(s(e)<=i.size)return!1!==o(e,function(t){if(i.includes(t))return!1},!0);var c=i.getIterator();return!1!==l(c,function(t){if(r(e,t))return h(c,"normal",!1)})}},4483(t,e,i){var n,r,s,a,o=i(4576),l=i(9429),h=i(1548),c=o.structuredClone,d=o.ArrayBuffer,u=o.MessageChannel,p=!1;if(h)p=function(t){c(t,{transfer:[t]})};else if(d)try{u||(n=l("worker_threads"))&&(u=n.MessageChannel),u&&(r=new u,s=new d(2),a=function(t){r.port1.postMessage(null,[t])},2===s.byteLength&&(a(s),0===s.byteLength&&(p=a)))}catch(t){}t.exports=p},4495(t,e,i){var n=i(9519),r=i(9039),s=i(4576).String;t.exports=!!Object.getOwnPropertySymbols&&!r(function(){var t=Symbol("symbol detection");return!s(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41})},4527(t,e,i){var n=i(3724),r=i(4376),s=TypeError,a=Object.getOwnPropertyDescriptor,o=n&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=o?function(t,e){if(r(t)&&!a(t,"length").writable)throw new s("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},4549(t,e,i){var n=i(4576);t.exports=function(t,e){var i=n.Iterator,r=i&&i.prototype,s=r&&r[t],a=!1;if(s)try{s.call({next:function(){return{done:!0}},return:function(){a=!0}},-1)}catch(t){t instanceof e||(a=!1)}if(!a)return s}},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 i.g&&i.g)||e("object"==typeof this&&this)||function(){return this}()||Function("return this")()},4603(t,e,i){var n=i(6840),r=i(9504),s=i(655),a=i(2812),o=URLSearchParams,l=o.prototype,h=r(l.append),c=r(l.delete),d=r(l.forEach),u=r([].push),p=new o("a=1&a=2&b=3");p.delete("a",1),p.delete("b",void 0),p+""!="a=2"&&n(l,"delete",function(t){var e=arguments.length,i=e<2?void 0:arguments[1];if(e&&void 0===i)return c(this,t);var n=[];d(this,function(t,e){u(n,{key:e,value:t})}),a(e,1);for(var r,o=s(t),l=s(i),p=0,g=0,f=!1,m=n.length;p<m;)r=n[p++],f||r.key===o?(f=!0,c(this,r.key)):g++;for(;g<m;)(r=n[g++]).key===o&&r.value===l||h(this,r.key,r.value)},{enumerable:!0,unsafe:!0})},4628(t,e,i){var n=i(6518),r=i(6043);n({target:"Promise",stat:!0},{withResolvers:function(){var t=r.f(this);return{promise:t.promise,resolve:t.resolve,reject:t.reject}}})},4644(t,e,i){var n,r,s,a=i(7811),o=i(3724),l=i(4576),h=i(4901),c=i(34),d=i(9297),u=i(6955),p=i(6823),g=i(6699),f=i(6840),m=i(2106),b=i(1625),v=i(2787),y=i(2967),w=i(8227),A=i(3392),x=i(1181),E=x.enforce,C=x.get,S=l.Int8Array,_=S&&S.prototype,T=l.Uint8ClampedArray,P=T&&T.prototype,D=S&&v(S),M=_&&v(_),F=Object.prototype,I=l.TypeError,k=w("toStringTag"),L=A("TYPED_ARRAY_TAG"),R="TypedArrayConstructor",B=a&&!!y&&"Opera"!==u(l.opera),N=!1,O={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},j={BigInt64Array:8,BigUint64Array:8},U=function(t){var e=v(t);if(c(e)){var i=C(e);return i&&d(i,R)?i[R]:U(e)}},z=function(t){if(!c(t))return!1;var e=u(t);return d(O,e)||d(j,e)};for(n in O)(s=(r=l[n])&&r.prototype)?E(s)[R]=r:B=!1;for(n in j)(s=(r=l[n])&&r.prototype)&&(E(s)[R]=r);
vendor: 4,090 bytes, line 2
2if((!B||!h(D)||D===Function.prototype)&&(D=function(){throw new I("Incorrect invocation")},B))for(n in O)l[n]&&y(l[n],D);if((!B||!M||M===F)&&(M=D.prototype,B))for(n in O)l[n]&&y(l[n].prototype,M);if(B&&v(P)!==M&&y(P,M),o&&!d(M,k))for(n in N=!0,m(M,k,{configurable:!0,get:function(){return c(this)?this[L]:void 0}}),O)l[n]&&g(l[n],L,n);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:B,TYPED_ARRAY_TAG:N&&L,aTypedArray:function(t){if(z(t))return t;throw new I("Target is not a typed array")},aTypedArrayConstructor:function(t){if(h(t)&&(!y||b(D,t)))return t;throw new I(p(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,e,i,n){if(o){if(i)for(var r in O){var s=l[r];if(s&&d(s.prototype,t))try{delete s.prototype[t]}catch(i){try{s.prototype[t]=e}catch(t){}}}M[t]&&!i||f(M,t,i?e:B&&_[t]||e,n)}},exportTypedArrayStaticMethod:function(t,e,i){var n,r;if(o){if(y){if(i)for(n in O)if((r=l[n])&&d(r,t))try{delete r[t]}catch(t){}if(D[t]&&!i)return;try{return f(D,t,i?e:B&&D[t]||e)}catch(t){}}for(n in O)!(r=l[n])||r[t]&&!i||f(r,t,e)}},getTypedArrayConstructor:U,isView:function(t){if(!c(t))return!1;var e=u(t);return"DataView"===e||d(O,e)||d(j,e)},isTypedArray:z,TypedArray:D,TypedArrayPrototype:M}},4659(t,e,i){var n=i(3724),r=i(4913),s=i(6980);t.exports=function(t,e,i){n?r.f(t,e,s(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 n=i(3724),r=i(5917),s=i(8686),a=i(8551),o=i(6969),l=TypeError,h=Object.defineProperty,c=Object.getOwnPropertyDescriptor,d="enumerable",u="configurable",p="writable";e.f=n?s?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 n=c(t,e);n&&n[p]&&(t[e]=i.value,i={configurable:u in i?i[u]:n[u],enumerable:d in i?i[d]:n[d],writable:!1})}return h(t,e,i)}:h:function(t,e,i){if(a(t),e=o(e),a(i),r)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 n=i(7751),r=function(t){return{size:t,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},s=function(t){return{size:t,has:function(){return!0},keys:function(){throw new Error("e")}}};t.exports=function(t,e){var i=n("Set");try{(new i)[t](r(0));try{return(new i)[t](r(-1)),!1}catch(n){if(!e)return!0;try{return(new i)[t](s(-1/0)),!1}catch(n){return e(new i([1,2])[t](s(1/0)))}}}catch(t){return!1}}},4972(t,e,i){var n=i(6518),r=i(9565),s=i(8551),a=i(1767),o=i(4149),l=i(9590),h=i(9462),c=i(9539),d=i(4549),u=i(6395),p=!u&&d("take",RangeError),g=h(function(){var t=this.iterator;if(!this.remaining--)return this.done=!0,c(t,"normal",void 0);var e=s(r(this.next,t));return(this.done=!!e.done)?void 0:e.value});n({target:"Iterator",proto:!0,real:!0,forced:u||p},{take:function(t){var e;s(this);try{e=l(o(+t))}catch(t){c(this,"throw",t)}return p?r(p,this,e):new g(a(this),{remaining:e})}})},4979(t,e,i){var n=i(6518),r=i(4576),s=i(7751),a=i(6980),o=i(4913).f,l=i(9297),h=i(679),c=i(3167),d=i(2603),u=i(5002),p=i(8574),g=i(3724),f=i(6395),m="DOMException",b=s("Error"),v=s(m),y=function(){h(this,w);var t=arguments.length,e=d(t<1?void 0:arguments[0]),i=d(t<2?void 0:arguments[1],"Error"),n=new v(e,i),r=new b(e);return r.name=m,o(n,"stack",a(1,p(r.stack,1))),c(n,this,y),n},w=y.prototype=v.prototype,A="stack"in new b(m),x="stack"in new v(1,2),E=v&&g&&Object.getOwnPropertyDescriptor(r,m),C=!(!E||E.writable&&E.configurable),S=A&&!C&&!x;n({global:!0,constructor:!0,forced:f||S},{DOMException:S?y:v});var _=s(m),T=_.prototype;if(T.constructor!==_)for(var P in f||o(T,"constructor",a(1,_)),u)if(l(u,P)){var D=u[P],M=D.s;l(_,M)||o(_,M,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}
2,NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},5024(t,e,i){var n=i(6518),r=i(3650),s=i(9835);n({target:"Set",proto:!0,real:!0,forced:!i(4916)("symmetricDifference")||!s("symmetricDifference")},{symmetricDifference:r})},5031(t,e,i){var n=i(7751),r=i(9504),s=i(8480),a=i(3717),o=i(8551),l=r([].concat);t.exports=n("Reflect","ownKeys")||function(t){var e=s.f(o(t)),i=a.f;return i?l(e,i(t)):e}},5169(t,e,i){var n=i(3238),r=TypeError;t.exports=function(t){if(n(t))throw new r("ArrayBuffer is detached");return t}},5170(t,e,i){var n=i(6706),r=i(4402);t.exports=n(r.proto,"size","get")||function(t){return t.size}},5213(t,e,i){var n=i(6518),r=i(4576),s=i(5370),a=i(9143),o=r.Uint8Array,l=!o||!o.fromBase64||!function(){try{return void o.fromBase64("a")}catch(t){}try{o.fromBase64("",null)}catch(t){return!0}}();o&&n({target:"Uint8Array",stat:!0,forced:l},{fromBase64:function(t){var e=a(t,arguments.length>1?arguments[1]:void 0,null,9007199254740991);return s(o,e.bytes)}})},5370(t,e,i){var n=i(6198);t.exports=function(t,e,i){for(var r=0,s=arguments.length>2?i:n(e),a=new t(s);s>r;)a[r]=e[r++];return a}},5397(t,e,i){var n=i(7055),r=i(7750);t.exports=function(t){return n(r(t))}},5610(t,e,i){var n=i(1291),r=Math.max,s=Math.min;t.exports=function(t,e){var i=n(t);return i<0?r(i+e,0):s(i,e)}},5623(t,e,i){i(456)},5636(t,e,i){var n=i(4576),r=i(9504),s=i(6706),a=i(7696),o=i(5169),l=i(7394),h=i(4483),c=i(1548),d=n.structuredClone,u=n.ArrayBuffer,p=n.DataView,g=Math.min,f=u.prototype,m=p.prototype,b=r(f.slice),v=s(f,"resizable","get"),y=s(f,"maxByteLength","get"),w=r(m.getInt8),A=r(m.setInt8);t.exports=(c||h)&&function(t,e,i){var n,r=l(t),s=void 0===e?r:a(e),f=!v||!v(t);if(o(t),c&&(t=d(t,{transfer:[t]}),r===s&&(i||f)))return t;if(r>=s&&(!i||f))n=b(t,0,s);else{var m=i&&!f&&y?{maxByteLength:y(t)}:void 0;n=new u(s,m);for(var x=new p(t),E=new p(n),C=g(s,r),S=0;S<C;S++)A(E,S,w(x,S))}return c||h(t),n}},5745(t,e,i){var n=i(7629);t.exports=function(t,e){return n[t]||(n[t]=e||{})}},5781(t,e,i){var n=i(6518),r=i(7751),s=i(2812),a=i(655),o=i(7416),l=r("URL");n({target:"URL",stat:!0,forced:!o},{parse:function(t){var e=s(arguments.length,1),i=a(t),n=e<2||void 0===arguments[1]?void 0:a(arguments[1]);try{return new l(i,n)}catch(t){return null}}})},5854(t,e,i){var n=i(2777),r=TypeError;t.exports=function(t){var e=n(t,"number");if("number"==typeof e)throw new r("Can't convert number to bigint");return BigInt(e)}},5876(t,e,i){var n=i(6518),r=i(3838);n({target:"Set",proto:!0,real:!0,forced:!i(4916)("isSubsetOf",function(t){return t})},{isSubsetOf:r})},5917(t,e,i){var n=i(3724),r=i(9039),s=i(4055);t.exports=!n&&!r(function(){return 7!==Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a})},5966(t,e,i){var n=i(9306),r=i(4117);t.exports=function(t,e){var i=t[e];return r(i)?void 0:n(i)}},6043(t,e,i){var n=i(9306),r=TypeError,s=function(t){var e,i;this.promise=new t(function(t,n){if(void 0!==e||void 0!==i)throw new r("Bad Promise constructor");e=t,i=n}),this.resolve=n(e),this.reject=n(i)};t.exports.f=function(t){return new s(t)}},6080(t,e,i){var n=i(7476),r=i(9306),s=i(616),a=n(n.bind);t.exports=function(t,e){return r(t),void 0===e?t:s?a(t,e):function(){return t.apply(e,arguments)}}},6119(t,e,i){var n=i(5745),r=i(3392),s=n("keys");t.exports=function(t){return s[t]||(s[t]=r(t))}},6193(t,e,i){var n=i(4215);t.exports="NODE"===n},6198(t,e,i){var n=i(8014);t.exports=function(t){return n(t.length)}},6269(t){t.exports={}},6279(t,e,i){var n=i(6840);
2t.exports=function(t,e,i){for(var r in e)n(t,r,e[r],i);return t}},6319(t,e,i){var n=i(8551),r=i(9539);t.exports=function(t,e,i,s){try{return s?e(n(i)[0],i[1]):e(i)}catch(e){r(t,"throw",e)}}},6395(t){t.exports=!1},6518(t,e,i){var n=i(4576),r=i(7347).f,s=i(6699),a=i(6840),o=i(9433),l=i(7740),h=i(2796);t.exports=function(t,e){var i,c,d,u,p,g=t.target,f=t.global,m=t.stat;if(i=f?n:m?n[g]||o(g,{}):n[g]&&n[g].prototype)for(c in e){if(u=e[c],d=t.dontCallGetSet?(p=r(i,c))&&p.value:i[c],!h(f?c:g+(m?".":"#")+c,t.forced)&&void 0!==d){if(typeof u==typeof d)continue;l(u,d)}(t.sham||d&&d.sham)&&s(u,"sham",!0),a(i,c,u,t)}}},6573(t,e,i){var n=i(3724),r=i(2106),s=i(3238),a=ArrayBuffer.prototype;n&&!("detached"in a)&&r(a,"detached",{configurable:!0,get:function(){return s(this)}})},6632(t,e,i){var n=i(6518),r=i(4576),s=i(9143),a=i(4154),o=r.Uint8Array,l=!o||!o.prototype.setFromBase64||!function(){var t=new o([255,255,255,255,255]);try{return void t.setFromBase64("",null)}catch(t){}try{return void t.setFromBase64("a")}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&&n({target:"Uint8Array",proto:!0,forced:l},{setFromBase64:function(t){a(this);var e=s(t,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:e.read,written:e.written}}})},6699(t,e,i){var n=i(3724),r=i(4913),s=i(6980);t.exports=n?function(t,e,i){return r.f(t,e,s(1,i))}:function(t,e,i){return t[e]=i,t}},6706(t,e,i){var n=i(9504),r=i(9306);t.exports=function(t,e,i){try{return n(r(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}}},6801(t,e,i){var n=i(3724),r=i(8686),s=i(4913),a=i(8551),o=i(5397),l=i(1072);e.f=n&&!r?Object.defineProperties:function(t,e){a(t);for(var i,n=o(e),r=l(e),h=r.length,c=0;h>c;)s.f(t,i=r[c++],n[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>9007199254740991)throw e("Maximum allowed index exceeded");return t}},6840(t,e,i){var n=i(4901),r=i(4913),s=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(n(i)&&s(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:r.f(t,e,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return t}},6955(t,e,i){var n=i(2140),r=i(4901),s=i(2195),a=i(8227)("toStringTag"),o=Object,l="Arguments"===s(function(){return arguments}());t.exports=n?s:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=o(t),a))?i:l?s(e):"Object"===(n=s(e))&&r(e.callee)?"Arguments":n}},6969(t,e,i){var n=i(2777),r=i(757);t.exports=function(t){var e=n(t,"string");return r(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){var n=i(4495);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},7055(t,e,i){var n=i(9504),r=i(9039),s=i(2195),a=Object,o=n("".split);t.exports=r(function(){return!a("z").propertyIsEnumerable(0)})?function(t){return"String"===s(t)?o(t,""):a(t)}:a},7080(t,e,i){var n=i(4402).has;t.exports=function(t){return n(t),t}},7347(t,e,i){var n=i(3724),r=i(9565),s=i(8773),a=i(6980),o=i(5397),l=i(6969),h=i(9297),c=i(5917),d=Object.getOwnPropertyDescriptor;e.f=n?d:function(t,e){if(t=o(t),e=l(e),c)try{return d(t,e)}catch(t){}if(h(t,e))return a(!r(s.f,t,e),t[e])}},7394(t,e,i){var n=i(4576),r=i(6706),s=i(2195),a=n.ArrayBuffer,o=n.TypeError;t.exports=a&&r(a.prototype,"byteLength","get")||function(t){if("ArrayBuffer"!==s(t))throw new o("ArrayBuffer expected");return t.byteLength}},7416(t,e,i){var n=i(9039),r=i(8227),s=i(3724),a=i(6395),o=r("iterator");t.exports=!n(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"),n="";return t.pathname="c%20d",e.forEach(function(t,i){e.delete("b"),n+=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||!s)||!e.sort||"https://a/c%20d?a=1&c=3"!==t.href||"3"!==e.get("
2c")||"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"!==n||"x"!==new URL("https://x",void 0).host})},7476(t,e,i){var n=i(2195),r=i(9504);t.exports=function(t){if("Function"===n(t))return r(t)}},7566(t,e,i){var n=i(6840),r=i(9504),s=i(655),a=i(2812),o=URLSearchParams,l=o.prototype,h=r(l.getAll),c=r(l.has),d=new o("a=1");!d.has("a",2)&&d.has("a",void 0)||n(l,"has",function(t){var e=arguments.length,i=e<2?void 0:arguments[1];if(e&&void 0===i)return c(this,t);var n=h(this,t);a(e,1);for(var r=s(i),o=0;o<n.length;)if(n[o++]===r)return!0;return!1},{enumerable:!0,unsafe:!0})},7588(t,e,i){var n=i(6518),r=i(9565),s=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),c=i(4549)("forEach",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:c},{forEach:function(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(c)return r(c,this,t);var e=l(this),i=0;s(e,function(e){t(e,i++)},{IS_RECORD:!0})}})},7629(t,e,i){var n=i(6395),r=i(4576),s=i(9433),a="__core-js_shared__",o=t.exports=r[a]||s(a,{});(o.versions||(o.versions=[])).push({version:"3.47.0",mode:n?"pure":"global",copyright:"© 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 n=i(6518),r=i(3440),s=i(9039);n({target:"Set",proto:!0,real:!0,forced:!i(4916)("difference",function(t){return 0===t.size})||s(function(){var t={size:1,has:function(){return!0},keys:function(){var t=0;return{next:function(){var i=t++>1;return e.has(1)&&e.clear(),{done:i,value:2}}}}},e=new Set([1,2,3,4]);return 3!==e.difference(t).size})},{difference:r})},7657(t,e,i){var n,r,s,a=i(9039),o=i(4901),l=i(34),h=i(2360),c=i(2787),d=i(6840),u=i(8227),p=i(6395),g=u("iterator"),f=!1;[].keys&&("next"in(s=[].keys())?(r=c(c(s)))!==Object.prototype&&(n=r):f=!0),!l(n)||a(function(){var t={};return n[g].call(t)!==t})?n={}:p&&(n=h(n)),o(n[g])||d(n,g,function(){return this}),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:f}},7680(t,e,i){var n=i(9504);t.exports=n([].slice)},7696(t,e,i){var n=i(1291),r=i(8014),s=RangeError;t.exports=function(t){if(void 0===t)return 0;var e=n(t),i=r(e);if(e!==i)throw new s("Wrong length or index");return i}},7740(t,e,i){var n=i(9297),r=i(5031),s=i(7347),a=i(4913);t.exports=function(t,e,i){for(var o=r(e),l=a.f,h=s.f,c=0;c<o.length;c++){var d=o[c];n(t,d)||i&&n(i,d)||l(t,d,h(e,d))}}},7750(t,e,i){var n=i(4117),r=TypeError;t.exports=function(t){if(n(t))throw new r("Can't call method on "+t);return t}},7751(t,e,i){var n=i(4576),r=i(4901);t.exports=function(t,e){return arguments.length<2?(i=n[t],r(i)?i:void 0):n[t]&&n[t][e];var i}},7811(t){t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},7936(t,e,i){var n=i(6518),r=i(5636);r&&n({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return r(this,arguments.length?arguments[0]:void 0,!1)}})},8004(t,e,i){var n=i(6518),r=i(9039),s=i(8750);n({target:"Set",proto:!0,real:!0,forced:!i(4916)("intersection",function(t){return 2===t.size&&t.has(1)&&t.has(2)})||r(function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))})},{intersection:s})},8014(t,e,i){var n=i(1291),r=Math.min;t.exports=function(t){var e=n(t);return e>0?r(e,9007199254740991):0}},8100(t,e,i){var n=i(6518),r=i(5636);r&&n({target:"ArrayBuffer",proto:!0},{transfer:function(){return r(this,arguments.length?arguments[0]:void 0,!0)}})},8111(t,e,i){var n=i(6518),r=i(4576),s=i(679),a=i(8551),o=i(4901),l=i(2787),h=i(2106),c=i(4659),d=i(9039),u=i(9297),p=i(8227),g=i(7657).IteratorPrototype,f=i(3724),m=i(6395),b="constructor",v="Iterator",y=p("toStringTag"),w=TypeError,A=r[v],x=m||!o(A)||A.prototype!==g||!d(function(){A({})}),E=function(){if(s(this,g),l(this)===g)throw new w("Abstract class Iterator not directly constructable")},C=function(t,e){f?h(g,t,{configurable:!0,get:function(){return e},set:function(e){if(a(this),this===g)throw new w("You can't redefine this property");u(this,t)?this[t]=e:c(this,t,e)}}):g[t]=e};u(g,y)||C(y,v),!x&&u(g,b)&&g[b]!==Object||C(b,E),E.prototype=g,n({global:!0,constructor:!0,forced:x},{Iterator:E})}
2,8227(t,e,i){var n=i(4576),r=i(5745),s=i(9297),a=i(3392),o=i(4495),l=i(7040),h=n.Symbol,c=r("wks"),d=l?h.for||h:h&&h.withoutSetter||a;t.exports=function(t){return s(c,t)||(c[t]=o&&s(h,t)?h[t]:d("Symbol."+t)),c[t]}},8235(t,e,i){var n=i(9504),r=i(9297),s=SyntaxError,a=parseInt,o=String.fromCharCode,l=n("".charAt),h=n("".slice),c=n(/./.exec),d={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},u=/^[\da-f]{4}$/i,p=/^[\u0000-\u001F]$/;t.exports=function(t,e){for(var i=!0,n="";e<t.length;){var g=l(t,e);if("\\"===g){var f=h(t,e,e+2);if(r(d,f))n+=d[f],e+=2;else{if("\\u"!==f)throw new s('Unknown escape sequence: "'+f+'"');var m=h(t,e+=2,e+4);if(!c(u,m))throw new s("Bad Unicode escape at: "+e);n+=o(a(m,16)),e+=4}}else{if('"'===g){i=!1,e++;break}if(c(p,g))throw new s("Bad control character in string literal at: "+e);n+=g,e++}}if(i)throw new s("Unterminated string at: "+e);return{value:n,end:e}}},8237(t,e,i){var n=i(6518),r=i(2652),s=i(9306),a=i(8551),o=i(1767),l=i(9539),h=i(4549),c=i(8745),d=i(9039),u=TypeError,p=d(function(){[].keys().reduce(function(){},void 0)}),g=!p&&h("reduce",u);n({target:"Iterator",proto:!0,real:!0,forced:p||g},{reduce:function(t){a(this);try{s(t)}catch(t){l(this,"throw",t)}var e=arguments.length<2,i=e?void 0:arguments[1];if(g)return c(g,this,e?[t]:[t,i]);var n=o(this),h=0;if(r(n,function(n){e?(e=!1,i=n):i=t(i,n,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 n=i(9504),r=i(507),s=i(4402),a=s.Set,o=s.proto,l=n(o.forEach),h=n(o.keys),c=h(new a).next;t.exports=function(t,e,i){return i?r({iterator:h(t),next:c},e):l(t,e)}},8480(t,e,i){var n=i(1828),r=i(8727).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,r)}},8527(t,e,i){var n=i(7080),r=i(4402).has,s=i(5170),a=i(3789),o=i(507),l=i(9539);t.exports=function(t){var e=n(this),i=a(t);if(s(e)<i.size)return!1;var h=i.getIterator();return!1!==o(h,function(t){if(!r(e,t))return l(h,"normal",!1)})}},8551(t,e,i){var n=i(34),r=String,s=TypeError;t.exports=function(t){if(n(t))return t;throw new s(r(t)+" is not an object")}},8574(t,e,i){var n=i(9504),r=Error,s=n("".replace),a=String(new r("zxcasd").stack),o=/\n\s*at [^:]*:[^\n]*/,l=o.test(a);t.exports=function(t,e){if(l&&"string"==typeof t&&!r.prepareStackTrace)for(;e--;)t=s(t,o,"");return t}},8622(t,e,i){var n=i(4576),r=i(4901),s=n.WeakMap;t.exports=r(s)&&/native code/.test(String(s))},8646(t,e,i){var n=i(9565),r=i(8551),s=i(1767),a=i(851);t.exports=function(t,e){e&&"string"==typeof t||r(t);var i=a(t);return s(r(void 0!==i?n(i,t):t))}},8686(t,e,i){var n=i(3724),r=i(9039);t.exports=n&&r(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},8721(t,e,i){var n=i(3724),r=i(9504),s=i(2106),a=URLSearchParams.prototype,o=r(a.forEach);n&&!("size"in a)&&s(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 n=i(616),r=Function.prototype,s=r.apply,a=r.call;t.exports="object"==typeof Reflect&&Reflect.apply||(n?a.bind(s):function(){return a.apply(s,arguments)})},8750(t,e,i){var n=i(7080),r=i(4402),s=i(5170),a=i(3789),o=i(8469),l=i(507),h=r.Set,c=r.add,d=r.has;t.exports=function(t){var e=n(this),i=a(t),r=new h;return s(e)>i.size?l(i.getIterator(),function(t){d(e,t)&&c(r,t)}):o(e,function(t){i.includes(t)&&c(r,t)}),r}},8773(t,e){var i={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!i.call({1:2},1);e.f=r?function(t){var e=n(this,t);return!!e&&e.enumerable}:i},8981(t,e,i){var n=i(7750),r=Object;t.exports=function(t){return r(n(t))}},9039(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},9112(t,e,i){var n=i(6518),r=i(3724),s=i(4576),a=i(7751),o=i(9504),l=i(9565),h=i(4901),c=i(34),d=i(4376),u=i(9297),p=i(655),g=i(6198),f=i(4659),m=i(9039),b=i(8235),v=i(4495),y=s.JSON,w=s.Number,A=s.SyntaxError,x=y&&y.parse,E=a("Object","keys"),C=Object.getOwnPropertyDescriptor,S=o("".charAt),_=o("".slice),T=o(/./.exec),P=o([].push),D=/^\d$/,M=/^[1-9]$/,F=/^[\d-]$/,I=/^[\t\n\r ]$/,k=function(t,e,
vendor: 31,859 bytes, line 2
2i,n){var r,s,a,o,h,p=t[e],f=n&&p===n.value,m=f&&"string"==typeof n.source?{source:n.source}:{};if(c(p)){var b=d(p),v=f?n.nodes:b?[]:{};if(b)for(r=v.length,a=g(p),o=0;o<a;o++)L(p,o,k(p,""+o,i,o<r?v[o]:void 0));else for(s=E(p),a=g(s),o=0;o<a;o++)h=s[o],L(p,h,k(p,h,i,u(v,h)?v[h]:void 0))}return l(i,t,e,p,m)},L=function(t,e,i){if(r){var n=C(t,e);if(n&&!n.configurable)return}void 0===i?delete t[e]:f(t,e,i)},R=function(t,e,i,n){this.value=t,this.end=e,this.source=i,this.nodes=n},B=function(t,e){this.source=t,this.index=e};B.prototype={fork:function(t){return new B(this.source,t)},parse:function(){var t=this.source,e=this.skip(I,this.index),i=this.fork(e),n=S(t,e);if(T(F,n))return i.number();switch(n){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 A('Unexpected character: "'+n+'" at: '+e)},node:function(t,e,i,n,r){return new R(e,n,t?null:_(this.source,i,n),r)},object:function(){for(var t=this.source,e=this.index+1,i=!1,n={},r={};e<t.length;){if(e=this.until(['"',"}"],e),"}"===S(t,e)&&!i){e++;break}var s=this.fork(e).string(),a=s.value;e=s.end,e=this.until([":"],e)+1,e=this.skip(I,e),s=this.fork(e).parse(),f(r,a,s),f(n,a,s.value),e=this.until([",","}"],s.end);var o=S(t,e);if(","===o)i=!0,e++;else if("}"===o){e++;break}}return this.node(1,n,this.index,e,r)},array:function(){for(var t=this.source,e=this.index+1,i=!1,n=[],r=[];e<t.length;){if(e=this.skip(I,e),"]"===S(t,e)&&!i){e++;break}var s=this.fork(e).parse();if(P(r,s),P(n,s.value),e=this.until([",","]"],s.end),","===S(t,e))i=!0,e++;else if("]"===S(t,e)){e++;break}}return this.node(1,n,this.index,e,r)},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("-"===S(t,i)&&i++,"0"===S(t,i))i++;else{if(!T(M,S(t,i)))throw new A("Failed to parse number at: "+i);i=this.skip(D,i+1)}if(("."===S(t,i)&&(i=this.skip(D,i+1)),"e"===S(t,i)||"E"===S(t,i))&&(i++,"+"!==S(t,i)&&"-"!==S(t,i)||i++,i===(i=this.skip(D,i))))throw new A("Failed to parse number's exponent value at: "+i);return this.node(0,w(_(t,e,i)),e,i)},keyword:function(t){var e=""+t,i=this.index,n=i+e.length;if(_(this.source,i,n)!==e)throw new A("Failed to parse value at: "+i);return this.node(0,t,i,n)},skip:function(t,e){for(var i=this.source;e<i.length&&T(t,S(i,e));e++);return e},until:function(t,e){e=this.skip(I,e);for(var i=S(this.source,e),n=0;n<t.length;n++)if(t[n]===i)return e;throw new A('Unexpected character: "'+i+'" at: '+e)}};var N=m(function(){var t,e="9007199254740993";return x(e,function(e,i,n){t=n.source}),t!==e}),O=v&&!m(function(){return 1/x("-0 \t")!=-1/0});n({target:"JSON",stat:!0,forced:N},{parse:function(t,e){return O&&!h(e)?x(t):function(t,e){t=p(t);var i=new B(t,0,""),n=i.parse(),r=n.value,s=i.skip(I,n.end);if(s<t.length)throw new A('Unexpected extra character: "'+S(t,s)+'" after the parsed data at: '+s);return h(e)?k({"":r},"",e,n):r}(t,e)}})},9143(t,e,i){var n=i(4576),r=i(9504),s=i(3972),a=i(3463),o=i(9297),l=i(2804),h=i(944),c=i(5169),d=l.c2i,u=l.c2iUrl,p=n.SyntaxError,g=n.TypeError,f=r("".charAt),m=function(t,e){for(var i=t.length;e<i;e++){var n=f(t,e);if(" "!==n&&"\t"!==n&&"\n"!==n&&"\f"!==n&&"\r"!==n)break}return e},b=function(t,e,i){var n=t.length;n<4&&(t+=2===n?"AA":"A");var r=(e[f(t,0)]<<18)+(e[f(t,1)]<<12)+(e[f(t,2)]<<6)+e[f(t,3)],s=[r>>16&255,r>>8&255,255&r];if(2===n){if(i&&0!==s[1])throw new p("Extra bits");return[s[0]]}if(3===n){if(i&&0!==s[2])throw new p("Extra bits");return[s[0],s[1]]}return s},v=function(t,e,i){for(var n=e.length,r=0;r<n;r++)t[i+r]=e[r];return i+n};t.exports=function(t,e,i,n){a(t),s(e);var r="base64"===h(e)?d: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&&c(i.buffer);var y=t.length,w=i||[],A=0,x=0,E="",C=0;if(n)for(;;){if((C=m(t,C))===y){if(E.length>0){if("stop-before-partial"===l)break;if("loose"!==l)throw new p("Missing padding");if(1===E.length)throw new p("Malformed padding: exactly one additional character");A=v(w,b(E,r,!1),A)}x=y;break}var S=f(t,C);if(++C,"="===S){if(E.length<2)throw new p("Padding is too early");if(C=m(t,C),2===E.length){if(C===y){if("stop-before-partial"===l)break;throw new p("Malformed padding: only one =")}"="===f(t,C)&&(++C,C=m(t,C))}if(C<y)throw new p("Unexpected character after padding");A=v(w,b(E,r,"strict"===l),A),x=y;break}if(!o(r,S))throw new p("Unexpected character");var _=n-A;if(1===_&&2===E.length||2===_&&3===E.length)break;if(4===(E+=S).length&&(A=v(w,b(E,r,!1),A),E="",x=C,A===n))break}return{bytes:w,read:x,written:A}}},9286(t,e,i){var n=i(4402),r=i(8469),s=n.Set,a=n.add;t.exports=function(t){var e=new s;return r(t,function(t){a(e,t)}),e}},9297(t,e,i){var n=i(9504),r=i(8981),s=n({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return s(r(t),e)}},9306(t,e,i){var n=i(4901),r=i(6823),s=TypeError;t.exports=function(t){if(n(t))return t;throw new s(r(t)+" is not a function")}},9314(t,e,i){var n=i(6518),r=i(9565),s=i(8551),a=i(1767),o=i(4149),l=i(9590),h=i(9539),c=i(9462),d=i(684),u=i(4549),p=i(6395),g=!p&&!d("drop",0),f=!p&&!g&&u("drop",RangeError),m=p||g||f,b=c(function(){for(var t,e=this.iterator,i=this.next;this.remaining;)if(this.remaining--,t=s(r(i,e)),this.done=!!t.done)return;if(t=s(r(i,e)),!(this.done=!!t.done))return t.value});n({target:"Iterator",proto:!0,real:!0,forced:m},{drop:function(t){var e;s(this);try{e=l(o(+t))}catch(t){h(this,"throw",t)}return f?r(f,this,e):new b(a(this),{remaining:e})}})},9429(t,e,i){var n=i(4576),r=i(6193);t.exports=function(t){if(r){try{return n.process.getBuiltinModule(t)}catch(t){}try{return Function('return require("'+t+'")')()}catch(t){}}}},9432(t,e,i){i(5213)},9433(t,e,i){var n=i(4576),r=Object.defineProperty;t.exports=function(t,e){try{r(n,t,{value:e,configurable:!0,writable:!0})}catch(i){n[t]=e}return e}},9462(t,e,i){var n=i(9565),r=i(2360),s=i(6699),a=i(6279),o=i(8227),l=i(1181),h=i(5966),c=i(7657).IteratorPrototype,d=i(2529),u=i(9539),p=i(1385),g=o("toStringTag"),f="IteratorHelper",m="WrapForValidIterator",b="normal",v="throw",y=l.set,w=function(t){var e=l.getterFor(t?m:f);return a(r(c),{next:function(){var i=e(this);if(t)return i.nextHandler();if(i.done)return d(void 0,!0);try{var n=i.nextHandler();return i.returnHandlerResult?n:d(n,i.done)}catch(t){throw i.done=!0,t}},return:function(){var i=e(this),r=i.iterator;if(i.done=!0,t){var s=h(r,"return");return s?n(s,r):d(void 0,!0)}if(i.inner)try{u(i.inner.iterator,b)}catch(t){return u(r,v,t)}if(i.openIters)try{p(i.openIters,b)}catch(t){return u(r,v,t)}return r&&u(r,b),d(void 0,!0)}})},A=w(!0),x=w(!1);s(x,g,"Iterator Helper"),t.exports=function(t,e,i){var n=function(n,r){r?(r.iterator=n.iterator,r.next=n.next):r=n,r.type=e?m:f,r.returnHandlerResult=!!i,r.nextHandler=t,r.counter=0,r.done=!1,y(this,r)};return n.prototype=e?A:x,n}},9486(t,e,i){var n=i(6518),r=i(4576),s=i(9504),a=i(3972),o=i(4154),l=i(5169),h=i(2804),c=i(944),d=h.i2c,u=h.i2cUrl,p=s("".charAt),g=r.Uint8Array,f=!g||!g.prototype.toBase64||!function(){try{(new g).toBase64(null)}catch(t){return!0}}();g&&n({target:"Uint8Array",proto:!0,forced:f},{toBase64:function(){var t=o(this),e=arguments.length?a(arguments[0]):void 0,i="base64"===c(e)?d:u,n=!!e&&!!e.omitPadding;l(this.buffer);for(var r,s="",h=0,g=t.length,f=function(t){return p(i,r>>6*t&63)};h+2<g;h+=3)r=(t[h]<<16)+(t[h+1]<<8)+t[h+2],s+=f(3)+f(2)+f(1)+f(0);return h+2===g?(r=(t[h]<<16)+(t[h+1]<<8),s+=f(3)+f(2)+f(1)+(n?"":"=")):h+1===g&&(r=t[h]<<16,s+=f(3)+f(2)+(n?"":"==")),s}})},9504(t,e,i){var n=i(616),r=Function.prototype,s=r.call,a=n&&r.bind.bind(s,s);t.exports=n?a:function(t){return function(){return s.apply(t,arguments)}}},9519(t,e,i){var n,r,s=i(4576),a=i(2839),o=s.process,l=s.Deno,h=o&&o.versions||l&&l.version,c=h&&h.v8;c&&(r=(n=c.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!r&&a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(r=+n[1]),t.exports=r},9539(t,e,i){var n=i(9565),r=i(8551),s=i(5966);t.exports=function(t,e,i){var a,o;r(t);try{if(!(a=s(t,"return"))){if("throw"===e)throw i;return i}a=n(a,t)}catch(t){o=!0,a=t}if("throw"===e)throw i;if(o)throw a;return r(a),i}},9565(t,e,i){var n=i(616),r=Function.prototype.call;t.exports=n?r.bind(r):function(){return r.apply(r,arguments)}},9577(t,e,i){var n=i(9928),r=i(4644),s=i(1108),a=i(1291),o=i(5854),l=r.aTypedArray,h=r.getTypedArrayConstructor,c=r.exportTypedArrayMethod,d=function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(t){return 8===t}}(),u=d&&function(){try{new Int8Array(1).with(-.5,1)}catch(t){return!0}}();c("with",{with:function(t,e){var i=l(this),r=a(t),c=s(i)?o(e):+e;return n(i,h(i),r,c)}}.with,!d||u)},9590(t,e,i){var n=i(1291),r=RangeError;t.exports=function(t){var e=n(t);if(e<0)throw new r("The argument can't be less than 0");return e}},9617(t,e,i){var n=i(5397),r=i(5610),s=i(6198),a=function(t){return function(e,i,a){var o=n(e),l=s(o);if(0===l)return!t&&-1;var h,c=r(a,l);if(t&&i!=i){for(;l>c;)if((h=o[c++])!=h)return!0}else for(;l>c;c++)if((t||c in o)&&o[c]===i)return t||c||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={size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return e.clear(),e.add(4),function(){return{done:!0}}}})}},n=e[t](i);return 1===n.size&&4===n.values().next().value}catch(t){return!1}}},9928(t,e,i){var n=i(6198),r=i(1291),s=RangeError;t.exports=function(t,e,i,a){var o=n(t),l=r(i),h=l<0?o+l:l;if(h>=o||h<0)throw new s("Incorrect index");for(var c=new e(o),d=0;d<o;d++)c[d]=d===h?a:t[d];return c}}},s={};function a(t){var e=s[t];if(void 0!==e)return e.exports;var i=s[t]={exports:{}};return r[t].call(i.exports,i,i.exports,a),i.exports}a.d=(t,e)=>{for(var i in e)a.o(e,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);a(4114),a(6573),a(8100),a(7936),a(8111),a(8237),a(9577),a(4235),a(1549),a(9797),a(9631),a(5623),a(5781);const o=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),l=[.001,0,0,.001,0,0],h=1.35,c=1,d=2,u=4,p=16,g=32,f=64,m=128,b=256,v={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},y="pdfjs_internal_editor_",w={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},A={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},x={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},E=1,C=2,S=0,_=1,T=2,P=3,D=3,M=4,F={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},I={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},k=1,L=2,R=3,B=4,N=5,O={ERRORS:0,WARNINGS:1,INFOS:5},j={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},U=0,z=1,H=2,V=3,$=4,W={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let G=O.WARNINGS;function X(t){Number.isInteger(t)&&(G=t)}function q(){return G}function Y(t){G>=O.INFOS&&console.info(`Info: ${t}`)}function K(t){G>=O.WARNINGS&&console.warn(`Warning: ${t}`)}function J(t){throw new Error(t)}function Q(t,e){t||J(e)}function Z(t,e=null,i=null){if(!t)return null;if(i&&"string"==typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);e?.length>=2&&(t=`http://${t}`)}if(i.tryConvertEncoding)try{t=decodeURIComponent(escape(t))}catch{}}const n=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}}(n)?n:null}function tt(t,e,i=!1){const n=URL.parse(t);return n?(n.hash=e,n.href):i&&Z(t,"http://example.com")?t.split("#",1)[0]+""+(e?`#${e}`:""):""}function et(t,e,i,n=!1){return Object.defineProperty(t,e,{value:i,enumerable:!n,configurable:!0,writable:!1}),i}const it=function(){function t(t,e){this.message=t,this.name=e}return t.prototype=new Error,t.constructor=t,t}();class nt extends it{constructor(t,e){super(t,"PasswordException"),this.code=e}}class rt extends it{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class st extends it{constructor(t){super(t,"InvalidPDFException")}}class at extends it{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}}class ot extends it{constructor(t){super(t,"FormatError")}}class lt extends it{constructor(t){super(t,"AbortException")}}function ht(t){"string"!=typeof t&&J("Invalid argument for stringToBytes");const e=t.length,i=new Uint8Array(e);for(let n=0;n<e;++n)i[n]=255&t.charCodeAt(n);return i}class ct{static get isLittleEndian(){return et(this,"isLittleEndian",function(){const t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return et(this,"isEvalSupported",function(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return et(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get isImageDecoderSupported(){return et(this,"isImageDecoderSupported","undefined"!=typeof ImageDecoder)}static get isFloat16ArraySupported(){return et(this,"isFloat16ArraySupported","undefined"!=typeof Float16Array)}static get isSanitizerSupported(){return et(this,"isSanitizerSupported","undefined"!=typeof Sanitizer)}static get platform(){const{platform:t,userAgent:e}=navigator;return et(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 et(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const dt=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));class ut{static makeHexColor(t,e,i){return`#${dt[t]}${dt[e]}${dt[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){const n=t[i],r=t[i+1];t[i]=n*e[0]+r*e[2]+e[4],t[i+1]=n*e[1]+r*e[3]+e[5]}static applyTransformToBezier(t,e,i=0){const n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5];for(let e=0;e<6;e+=2){const h=t[i+e],c=t[i+e+1];t[i+e]=h*n+c*s+o,t[i+e+1]=h*r+c*a+l}}static applyInverseTransform(t,e){const i=t[0],n=t[1],r=e[0]*e[3]-e[1]*e[2];t[0]=(i*e[3]-n*e[2]+e[2]*e[5]-e[4]*e[3])/r,t[1]=(-i*e[1]+n*e[0]+e[4]*e[1]-e[5]*e[0])/r}static axialAlignedBoundingBox(t,e,i){const n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],h=t[0],c=t[1],d=t[2],u=t[3];let p=n*h+o,g=p,f=n*d+o,m=f,b=a*c+l,v=b,y=a*u+l,w=y;if(0!==r||0!==s){const t=r*h,e=r*d,i=s*c,n=s*u;p+=i,m+=i,f+=n,g+=n,b+=t,w+=t,y+=e,v+=e}i[0]=Math.min(i[0],p,f,g,m),i[1]=Math.min(i[1],b,y,v,w),i[2]=Math.max(i[2],p,f,g,m),i[3]=Math.max(i[3],b,y,v,w)}static inverseTransform(t){const 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){const i=t[0],n=t[1],r=t[2],s=t[3],a=i**2+n**2,o=i*r+n*s,l=r**2+s**2,h=(a+l)/2,c=Math.sqrt(h**2-(a*l-o**2));e[0]=Math.sqrt(h+c||1),e[1]=Math.sqrt(h-c||1)}static normalizeRect(t){const 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){const i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),n=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>n)return null;const r=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),s=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return r>s?null:[i,r,n,s]}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,n,r){r[0]=Math.min(r[0],t,i),r[1]=Math.min(r[1],e,n),r[2]=Math.max(r[2],t,i),r[3]=Math.max(r[3],e,n)}static#t(t,e,i,n,r,s,a,o,l,h){if(l<=0||l>=1)return;const c=1-l,d=l*l,u=d*l,p=c*(c*(c*t+3*l*e)+3*d*i)+u*n,g=c*(c*(c*r+3*l*s)+3*d*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,n,r,s,a,o,l,h,c,d){if(Math.abs(l)<1e-12)return void(Math.abs(h)>=1e-12&&this.#t(t,e,i,n,r,s,a,o,-c/h,d));const u=h**2-4*c*l;if(u<0)return;const p=Math.sqrt(u),g=2*l;this.#t(t,e,i,n,r,s,a,o,(-h+p)/g,d),this.#t(t,e,i,n,r,s,a,o,(-h-p)/g,d)}static bezierBoundingBox(t,e,i,n,r,s,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,r,a,e,n,s,o,3*(3*(i-r)-t+a),6*(t-2*i+r),3*(i-t),l),this.#e(t,i,r,a,e,n,s,o,3*(3*(n-s)-e+o),6*(e-2*n+s),3*(n-e),l)}}let pt=null,gt=null;function ft(t){return pt||(pt=/([\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,gt=new Map([["ï¬
","ſt"]])),t.replaceAll(pt,(t,e,i)=>e?e.normalize("NFKC"):gt.get(i))}function mt(){if("function"==typeof crypto.randomUUID)return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),function(t){"object"==typeof t&&void 0!==t?.length||J("Invalid argument for bytesToString");const e=t.length,i=8192;if(e<i)return String.fromCharCode.apply(null,t);const n=[];for(let r=0;r<e;r+=i){const s=Math.min(r+i,e),a=t.subarray(r,s);n.push(String.fromCharCode.apply(null,a))}return n.join("")}(t)}const bt="pdfjs_internal_id_";function vt(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){const e=new AbortController,{signal:i}=e;for(const n of t)if(n.aborted)return e.abort(n.reason),i;for(const n of t)n.addEventListener("abort",()=>{e.abort(n.reason)},{signal:i});return i});a(1701),a(4603),a(7566),a(8721);class yt{static textContent(t){const e=[],i={items:e,styles:Object.create(null)};return function t(i){if(!i)return;let n=null;const r=i.name;if("#text"===r)n=i.value;else{if(!yt.shouldBuildText(r))return;i?.attributes?.textContent?n=i.attributes.textContent:i.value&&(n=i.value)}if(null!==n&&e.push({str:n}),i.children)for(const e of i.children)t(e)}(t),i}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}class wt{static setupStorage(t,e,i,n,r){const s=n.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==s.value&&(t.textContent=s.value),"print"===r)break;t.addEventListener("input",t=>{n.setValue(e,{value:t.target.value})});break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(s.value===i.attributes.xfaOn?t.setAttribute("checked",!0):s.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===r)break;t.addEventListener("change",t=>{n.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(null!==s.value&&t.setAttribute("value",s.value),"print"===r)break;t.addEventListener("input",t=>{n.setValue(e,{value:t.target.value})})}break;case"select":if(null!==s.value){t.setAttribute("value",s.value);for(const t of i.children)t.attributes.value===s.value?t.attributes.selected=!0:t.attributes.hasOwnProperty("selected")&&delete t.attributes.selected}t.addEventListener("input",t=>{const i=t.target.options,r=-1===i.selectedIndex?"":i[i.selectedIndex].value;n.setValue(e,{value:r})})}}static setAttributes({html:t,element:e,storage:i=null,intent:n,linkService:r}){const{attributes:s}=e,a=t instanceof HTMLAnchorElement;"radio"===s.type&&(s.name=`${s.name}-${n}`);for(const[e,i]of Object.entries(s))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&&r.addLinkAttributes(t,s.href,s.newWindow),i&&s.dataId&&this.setupStorage(t,s.dataId,e,i)}static render(t){const e=t.annotationStorage,i=t.linkService,n=t.xfaHtml,r=t.intent||"display",s=document.createElement(n.name);n.attributes&&this.setAttributes({html:s,element:n,intent:r,linkService:i});const a="richText"!==r,o=t.div;if(o.append(s),t.viewport){const e=`matrix(${t.viewport.transform.join(",")})`;o.style.transform=e}a&&o.setAttribute("class","xfaLayer xfaFont");const l=[];if(0===n.children.length){if(n.value){const t=document.createTextNode(n.value);s.append(t),a&&yt.shouldBuildText(n.name)&&l.push(t)}return{textDivs:l}}const h=[[n,-1,s]];for(;h.length>0;){const[t,n,s]=h.at(-1);if(n+1===t.children.length){h.pop();continue}const o=t.children[++h.at(-1)[1]];if(null===o)continue;const{name:c}=o;if("#text"===c){const t=document.createTextNode(o.value);l.push(t),s.append(t);continue}const d=o?.attributes?.xmlns?document.createElementNS(o.attributes.xmlns,c):document.createElement(c);if(s.append(d),o.attributes&&this.setAttributes({html:d,element:o,storage:e,intent:r,linkService:i}),o.children?.length>0)h.push([o,-1,d]);else if(o.value){const t=document.createTextNode(o.value);a&&yt.shouldBuildText(c)&&l.push(t),d.append(t)}}for(const t of o.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))t.setAttribute("readOnly",!0);return{textDivs:l}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}const At="http://www.w3.org/2000/svg";class xt{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function Et(t,e="text"){if(Ft(t,document.baseURI)){const i=await fetch(t);if(!i.ok)throw new 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,n)=>{const r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType=e,r.onreadystatechange=()=>{if(r.readyState===XMLHttpRequest.DONE)if(200!==r.status&&0!==r.status)n(new Error(r.statusText));else{switch(e){case"arraybuffer":case"blob":case"json":return void i(r.response)}i(r.responseText)}},r.send(null)})}class Ct{constructor({viewBox:t,userUnit:e,scale:i,rotation:n,offsetX:r=0,offsetY:s=0,dontFlip:a=!1}){this.viewBox=t,this.userUnit=e,this.scale=i,this.rotation=n,this.offsetX=r,this.offsetY=s,i*=e;const o=(t[2]+t[0])/2,l=(t[3]+t[1])/2;let h,c,d,u,p,g,f,m;switch((n%=360)<0&&(n+=360),n){case 180:h=-1,c=0,d=0,u=1;break;case 90:h=0,c=1,d=1,u=0;break;case 270:h=0,c=-1,d=-1,u=0;break;case 0:h=1,c=0,d=0,u=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(d=-d,u=-u),0===h?(p=Math.abs(l-t[1])*i+r,g=Math.abs(o-t[0])*i+s,f=(t[3]-t[1])*i,m=(t[2]-t[0])*i):(p=Math.abs(o-t[0])*i+r,g=Math.abs(l-t[1])*i+s,f=(t[2]-t[0])*i,m=(t[3]-t[1])*i),this.transform=[h*i,c*i,d*i,u*i,p-h*i*o-d*i*l,g-c*i*o-u*i*l],this.width=f,this.height=m}get rawDims(){const t=this.viewBox;return et(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:n=this.offsetY,dontFlip:r=!1}={}){return new Ct({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:r})}convertToViewportPoint(t,e){const i=[t,e];return ut.applyTransform(i,this.transform),i}convertToViewportRectangle(t){const e=[t[0],t[1]];ut.applyTransform(e,this.transform);const i=[t[2],t[3]];return ut.applyTransform(i,this.transform),[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){const i=[t,e];return ut.applyInverseTransform(i,this.transform),i}}class St extends it{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function _t(t){const e=t.length;let i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function Tt(t){return"string"==typeof t&&/\.pdf$/i.test(t)}function Pt(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function Dt(t,e="document.pdf"){if("string"!=typeof t)return e;if(_t(t))return K('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const 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;const n=t=>{try{let e=decodeURIComponent(t);return e.includes("/")?(e=e.split("/").at(-1),e.test(/^\.pdf$/i)?e:t):e}catch{return t}},r=/\.pdf$/i,s=i.pathname.split("/").at(-1);if(r.test(s))return n(s);if(i.searchParams.size>0){const t=Array.from(i.searchParams.values()).reverse();for(const e of t)if(r.test(e))return n(e);const e=Array.from(i.searchParams.keys()).reverse();for(const t of e)if(r.test(t))return n(t)}if(i.hash){const t=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(i.hash);if(t)return n(t[0])}return e}class Mt{started=Object.create(null);times=[];time(t){t in this.started&&K(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||K(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const{name:t}of this.times)e=Math.max(t.length,e);for(const{name:i,start:n,end:r}of this.times)t.push(`${i.padEnd(e)} ${r-n}ms\n`);return t.join("")}}function Ft(t,e){const i=e?URL.parse(t,e):URL.parse(t);return"http:"===i?.protocol||"https:"===i?.protocol}function It(t){t.preventDefault()}function kt(t){t.preventDefault(),t.stopPropagation()}class Lt{static#i;static toDateObject(t){if(t instanceof Date)return t;if(!t||"string"!=typeof t)return null;this.#i||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const e=this.#i.exec(t);if(!e)return null;const i=parseInt(e[1],10);let n=parseInt(e[2],10);n=n>=1&&n<=12?n-1:0;let r=parseInt(e[3],10);r=r>=1&&r<=31?r:1;let s=parseInt(e[4],10);s=s>=0&&s<=23?s: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;const l=e[7]||"Z";let h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let c=parseInt(e[9],10)||0;return c=c>=0&&c<=59?c:0,"-"===l?(s+=h,a+=c):"+"===l&&(s-=h,a-=c),new Date(Date.UTC(i,n,r,s,a,o))}}function Rt(t,{scale:e=1,rotation:i=0}){const{width:n,height:r}=t.attributes.style,s=[0,0,parseInt(n),parseInt(r)];return new Ct({viewBox:s,userUnit:1,scale:e,rotation:i})}function Bt(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(16711680&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):(K(`Not a valid color format: "${t}"`),[0,0,0])}function Nt(t){const{a:e,b:i,c:n,d:r,e:s,f:a}=t.getTransform();return[e,i,n,r,s,a]}function Ot(t){const{a:e,b:i,c:n,d:r,e:s,f:a}=t.getTransform().invertSelf();return[e,i,n,r,s,a]}function jt(t,e,i=!1,n=!0){if(e instanceof Ct){const{pageWidth:n,pageHeight:r}=e.rawDims,{style:s}=t,a=ct.isCSSRoundSupported,o=`var(--total-scale-factor) * ${n}px`,l=`var(--total-scale-factor) * ${r}px`,h=a?`round(down, ${o}, var(--scale-round-x))`:`calc(${o})`,c=a?`round(down, ${l}, var(--scale-round-y))`:`calc(${l})`;i&&e.rotation%180!=0?(s.width=c,s.height=h):(s.width=h,s.height=c)}n&&t.setAttribute("data-main-rotation",e.rotation)}class Ut{constructor(){const{pixelRatio:t}=Ut;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,n,r=-1){let s=1/0,a=1/0,o=1/0;(i=Ut.capPixels(i,r))>0&&(s=Math.sqrt(i/(t*e))),-1!==n&&(a=n/t,o=n/e);const l=Math.min(s,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){const 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}}const zt=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class Ht{static get isDarkMode(){return et(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}}class Vt{static get commentForegroundColor(){const t=document.createElement("span");t.classList.add("comment","sidebar");const{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);const{color:i}=window.getComputedStyle(t);return t.remove(),et(this,"commentForegroundColor",Bt(i))}}function $t(t,e,i,n){const r=255*(1-(n=Math.min(Math.max(n??1,0),1)));return[t=Math.round(t*n+r),e=Math.round(e*n+r),i=Math.round(i*n+r)]}function Wt(t,e){const i=t[0]/255,n=t[1]/255,r=t[2]/255,s=Math.max(i,n,r),a=Math.min(i,n,r),o=(s+a)/2;if(s===a)e[0]=e[1]=0;else{const t=s-a;switch(e[1]=o<.5?t/(s+a):t/(2-s-a),s){case i:e[0]=60*((n-r)/t+(n<r?6:0));break;case n:e[0]=60*((r-i)/t+2);break;case r:e[0]=60*((i-n)/t+4)}}e[2]=o}function Gt(t,e){const i=t[0],n=t[1],r=t[2],s=(1-Math.abs(2*r-1))*n,a=s*(1-Math.abs(i/60%2-1)),o=r-s/2;switch(Math.floor(i/60)){case 0:e[0]=s+o,e[1]=a+o,e[2]=o;break;case 1:e[0]=a+o,e[1]=s+o,e[2]=o;break;case 2:e[0]=o,e[1]=s+o,e[2]=a+o;break;case 3:e[0]=o,e[1]=a+o,e[2]=s+o;break;case 4:e[0]=a+o,e[1]=o,e[2]=s+o;break;
2case 5:case 6:e[0]=s+o,e[1]=o,e[2]=a+o}}function Xt(t){return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function qt(t,e,i){Gt(t,i),i.map(Xt);const n=.2126*i[0]+.7152*i[1]+.0722*i[2];Gt(e,i),i.map(Xt);const r=.2126*i[0]+.7152*i[1]+.0722*i[2];return n>r?(n+.05)/(r+.05):(r+.05)/(n+.05)}const Yt=new Map;function Kt(t,e){const i=t[0]+256*t[1]+65536*t[2]+16777216*e[0]+4294967296*e[1]+1099511627776*e[2];let n=Yt.get(i);if(n)return n;const r=new Float32Array(9),s=r.subarray(0,3),a=r.subarray(3,6);Wt(t,a);const o=r.subarray(6,9);Wt(e,o);const l=o[2]<.5,h=l?12:4.5;if(a[2]=l?Math.sqrt(a[2]):1-Math.sqrt(1-a[2]),qt(a,o,s)<h){let t,e;l?(t=a[2],e=1):(t=0,e=a[2]);const i=.005;for(;e-t>i;){const i=a[2]=(t+e)/2;l===qt(a,o,s)<h?t=i:e=i}a[2]=l?e:t}return Gt(a,s),n=ut.makeHexColor(Math.round(255*s[0]),Math.round(255*s[1]),Math.round(255*s[2])),Yt.set(i,n),n}function Jt({html:t,dir:e,className:i},n){const r=document.createDocumentFragment();if("string"==typeof t){const i=document.createElement("p");i.dir=e||"auto";const n=t.split(/(?:\r\n?|\n)/);for(let t=0,e=n.length;t<e;++t){const r=n[t];i.append(document.createTextNode(r)),t<e-1&&i.append(document.createElement("br"))}r.append(i)}else wt.render({xfaHtml:t,div:r,intent:"richText"});r.firstElementChild.classList.add("richText",i),n.append(r)}function Qt(t){const e=new Path2D;if(!t)return e;for(let i=0,n=t.length;i<n;)switch(t[i++]){case U:e.moveTo(t[i++],t[i++]);break;case z:e.lineTo(t[i++],t[i++]);break;case H:e.bezierCurveTo(t[i++],t[i++],t[i++],t[i++],t[i++],t[i++]);break;case V:e.quadraticCurveTo(t[i++],t[i++],t[i++],t[i++]);break;case $:e.closePath();break;default:K(`Unrecognized drawing path operator: ${t[i-1]}`)}return e}class Zt{static#n=null;static#r=null;static#s=null;static#a=0;static#o=[];get pagesNumber(){return Zt.#a}set pagesNumber(t){Zt.#a!==t&&(Zt.#a=t,0===t&&(Zt.#r=null,Zt.#n=null))}addListener(t){Zt.#o.push(t)}removeListener(t){const e=Zt.#o.indexOf(t);e>=0&&Zt.#o.splice(e,1)}#l(){for(const t of Zt.#o)t()}#h(t){if(Zt.#r)return;const e=Zt.#a,i=new Uint32Array(3*e),n=Zt.#r=i.subarray(0,e),r=Zt.#n=i.subarray(e,2*e);if(t)for(let t=0;t<e;t++)n[t]=r[t]=t+1;Zt.#s=i.subarray(2*e)}movePages(t,e,i){this.#h(!0);const n=Zt.#r,r=Zt.#n;Zt.#s.set(r);const s=e.length,a=new Uint32Array(s);let o=0;for(let t=0;t<s;t++){const r=e[t]-1;a[t]=n[r],r<i&&(o+=1)}const l=Zt.#a;let h=i-o;const c=l-s;h=vt(h,0,c);for(let e=0,i=0;e<l;e++)t.has(e+1)||(n[i++]=n[e]);n.copyWithin(h+s,h,c),n.set(a,h);let d=!1;for(let t=0,e=l;t<e;t++){const e=n[t];d||=e!==t+1,r[e-1]=t+1}this.#l(),d||(this.pagesNumber=0)}hasBeenAltered(){return null!==Zt.#r}getPageMappingForSaving(){return{pageIndices:Zt.#n?Zt.#n.map(t=>t-1):null}}getPrevPageNumber(t){return Zt.#s[Zt.#r[t-1]-1]}getPageNumber(t){return Zt.#n?.[t-1]??t}getPageId(t){return Zt.#r?.[t-1]??t}static get instance(){return et(this,"instance",new Zt)}getMapping(){return Zt.#r.subarray(0,this.pagesNumber)}}a(4972),a(4628),a(7642),a(8004),a(3853),a(5876),a(2475),a(5024),a(1698),a(4979),a(9314),a(1148),a(3579),a(8335);class te{#c=null;#d=null;#u;#p=null;#g=null;#f=null;#m=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(){const t=this.#c=document.createElement("div");t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=this.#u._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",It,{signal:e}),t.addEventListener("pointerdown",te.#y,{signal:e}));const i=this.#p=document.createElement("div");i.className="buttons",t.append(i);const n=this.#u.toolbarPosition;if(n){const{style:e}=t,i="ltr"===this.#u._uiManager.direction?1-n[0]:n[0];e.insetInlineEnd=100*i+"%",e.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return this.#c}static#y(t){t.stopPropagation()}#w(t){this.#u._focusEventsAllowed=!1,kt(t)}#A(t){this.#u._focusEventsAllowed=!0,kt(t)}#x(t){const e=this.#u._uiManager._signal;return e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("focusin",this.#w.bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",this.#A.bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",It,{signal:e}),!0)}hide(){this.#c.classList.add("hidden"),this.#d?.hideDropdown()}show(){this.#c.classList.remove("hidden"),this.#g?.shown(),this.#f?.shown()}
vendor: 88,362 bytes, line 2
2addDeleteButton(){const{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(){const t=document.createElement("div");return t.className="divider",t}async addAltText(t){const e=await t.render();this.#x(e),this.#p.append(e,this.#E),this.#g=t}addComment(t,e=null){if(this.#f)return;const i=t.renderForToolbar();if(!i)return;this.#x(i);const n=this.#m=this.#E;e?(this.#p.insertBefore(i,e),this.#p.insertBefore(n,e)):this.#p.append(i,n),this.#f=t,t.toolbar=this}addColorPicker(t){if(this.#d)return;this.#d=t;const e=t.renderButton();this.#x(e),this.#p.append(e,this.#E)}async addEditSignatureButton(t){const e=this.#b=await t.renderEditButton(this.#u);this.#x(e),this.#p.append(e,this.#E)}removeButton(t){if("comment"===t)this.#f?.removeToolbarCommentButton(),this.#f=null,this.#m?.remove(),this.#m=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;const n=this.#p.querySelector(i);n&&"comment"===t&&this.addComment(e,n)}updateEditSignatureButton(t){this.#b&&(this.#b.title=t)}remove(){this.#c.remove(),this.#d?.destroy(),this.#d=null}}class ee{#p=null;#c=null;#C;constructor(t){this.#C=t}#S(){const t=this.#c=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar");const e=this.#C._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",It,{signal:e});const i=this.#p=document.createElement("div");return i.className="buttons",t.append(i),this.#C.hasCommentManager()&&this.#_("commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{this.#C.commentSelection("floating_button")}),this.#_("highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{this.#C.highlightSelection("floating_button")}),t}#T(t,e){let i=0,n=0;for(const r of t){const t=r.y+r.height;if(t<i)continue;const s=r.x+(e?r.width:0);t>i?(n=s,i=t):e?s>n&&(n=s):s<n&&(n=s)}return[e?1-n:n,i]}show(t,e,i){const[n,r]=this.#T(e,i),{style:s}=this.#c||=this.#S();t.append(this.#c),s.insetInlineEnd=100*n+"%",s.top=`calc(${100*r}% + var(--editor-toolbar-vert-offset))`}hide(){this.#c.remove()}#_(t,e,i,n){const r=document.createElement("button");r.classList.add("basic",t),r.tabIndex=0,r.setAttribute("data-l10n-id",e);const s=document.createElement("span");r.append(s),s.className="visuallyHidden",s.setAttribute("data-l10n-id",i);const a=this.#C._signal;a instanceof AbortSignal&&!a.aborted&&(r.addEventListener("contextmenu",It,{signal:a}),r.addEventListener("click",n,{signal:a})),this.#p.append(r)}}function ie(t,e,i){for(const n of i)e.addEventListener(n,t[n].bind(t))}class ne{static#P=NaN;static#D=null;static#M=NaN;static#F=null;static initializeAndAddPointerId(t){(ne.#D||=new Set).add(t)}static setPointer(t,e){ne.#P||=e,ne.#F??=t}static setTimeStamp(t){ne.#M=t}static isSamePointerId(t){return ne.#P===t}static isSamePointerIdOrRemove(t){return ne.#P===t||(ne.#D?.delete(t),!1)}static isSamePointerType(t){return ne.#F===t}static isInitializedAndDifferentPointerType(t){return null!==ne.#F&&!ne.isSamePointerType(t)}static isSameTimeStamp(t){return ne.#M===t}static isUsingMultiplePointers(){return ne.#D?.size>=1}static clearPointerType(){ne.#F=null}static clearPointerIds(){ne.#P=NaN,ne.#D=null}static clearTimeStamp(){ne.#M=NaN}}class re{#I=0;get id(){return`${y}${this.#I++}`}}class se{#k=mt();#I=0;#L=null;static get _isSVGFittingCanvas(){const t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;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>';return et(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#R(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.#k}_${this.#I++}`,refCounter:0,isSvg:!1},"string"==typeof e?(i.url=e,t=await Et(e,"blob")):e instanceof File?t=i.file=e:e instanceof Blob&&(t=e),"image/svg+xml"===t.type){const e=se._isSVGFittingCanvas,n=new FileReader,r=new Image,s=new Promise((t,s)=>{r.onload=()=>{i.bitmap=r,i.isSvg=!0,t()},n.onload=async()=>{const t=i.svgUrl=n.result;r.src=await e?`${t}#svgView(preserveAspectRatio(none))`:t},r.onerror=n.onerror=s});n.readAsDataURL(t),await s}else i.bitmap=await createImageBitmap(t);i.refCounter=1}catch(t){K(t),i=null}return this.#L.set(t,i),i&&this.#L.set(i.id,i),i}async getFromFile(t){const{lastModified:e,name:i,size:n,type:r}=t;return this.#R(`${e}_${i}_${n}_${r}`,t)}async getFromUrl(t){return this.#R(t,t)}async getFromBlob(t,e){const i=await e;return this.#R(t,i)}async getFromId(t){this.#L||=new Map;const 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){const{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;const n=new OffscreenCanvas(e.width,e.height);return n.getContext("2d").drawImage(e,0,0),i={bitmap:n.transferToImageBitmap(),id:`image_${this.#k}_${this.#I++}`,refCounter:1,isSvg:!1},this.#L.set(t,i),this.#L.set(i.id,i),i}getSvgUrl(t){const e=this.#L.get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){this.#L||=new Map;const e=this.#L.get(t);if(!e)return;if(e.refCounter-=1,0!==e.refCounter)return;const{bitmap:i}=e;if(!e.url&&!e.file){const 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.#k}_`)}}class ae{#B=[];#N=!1;#O;#j=-1;constructor(t=128){this.#O=t}add({cmd:t,undo:e,post:i,mustExec:n,type:r=NaN,overwriteIfSameType:s=!1,keepUndo:a=!1}){if(n&&t(),this.#N)return;const o={cmd:t,undo:e,post:i,type:r};if(-1===this.#j)return this.#B.length>0&&(this.#B.length=0),this.#j=0,void this.#B.push(o);if(s&&this.#B[this.#j].type===r)return a&&(o.undo=this.#B[this.#j].undo),void(this.#B[this.#j]=o);const l=this.#j+1;l===this.#O?this.#B.splice(0,1):(this.#j=l,l<this.#B.length&&this.#B.splice(l)),this.#B.push(o)}undo(){if(-1===this.#j)return;this.#N=!0;const{undo:t,post:e}=this.#B[this.#j];t(),e?.(),this.#N=!1,this.#j-=1}redo(){if(this.#j<this.#B.length-1){this.#j+=1,this.#N=!0;const{cmd:t,post:e}=this.#B[this.#j];t(),e?.(),this.#N=!1}}hasSomethingToUndo(){return-1!==this.#j}hasSomethingToRedo(){return this.#j<this.#B.length-1}cleanType(t){if(-1!==this.#j){for(let e=this.#j;e>=0;e--)if(this.#B[e].type!==t)return this.#B.splice(e+1,this.#j-e),void(this.#j=e);this.#B.length=0,this.#j=-1}}destroy(){this.#B=null}}class oe{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=ct.platform;for(const[i,n,r={}]of t)for(const t of i){const i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:n,options:r}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:n,options:r}),this.allKeys.add(t.split("+").at(-1)))}}#U(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);const e=this.buffer.join("+");return this.buffer.length=0,e}exec(t,e){if(!this.allKeys.has(e.key))return;const i=this.callbacks.get(this.#U(e));if(!i)return;const{callback:n,options:{bubbles:r=!1,args:s=[],checker:a=null}}=i;a&&!a(t,e)||(n.bind(t,...s,e)(),r||kt(e))}}class le{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return function(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const i of t.keys()){e.style.color=i;const n=window.getComputedStyle(e).color;t.set(i,Bt(n))}e.remove()}(t),et(this,"_colors",t)}convert(t){const e=Bt(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[t,i]of this._colors)if(i.every((t,i)=>t===e[i]))return le._colorsMapping.get(t);return e}getHexCode(t){const e=this._colors.get(t);return e?ut.makeHexColor(...e):t}}class he{#z=new AbortController;#H=null;#V=null;#$=new Map;#W=new Map;#G=null;#X=null;#q=null;#Y=new ae;#K=null;#J=null;#Q=null;#Z=0;#tt=new Set;#et=null;#it=null;#nt=new Set;_editorUndoBar=null;#rt=!1;#st=!1;#at=!1;#ot=null;#lt=null;#ht=null;#ct=null;#dt=!1;#ut=null;#pt=new re;#gt=!1;#ft=!1;#mt=!1;#bt=null;#vt=null;#yt=null;#wt=null;#At=null;#xt=w.NONE;#Et=new Set;#Ct=null;#St=null;#_t=null;#Tt=null;#Pt=null;#Dt={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#Mt=[0,0];#Ft=null;#It=null;#kt=null;#Lt=null;#Rt=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const t=he.prototype,e=t=>t.#It.contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,{target:e})=>{if(e instanceof HTMLInputElement){const{type:t}=e;return"text"!==t&&"number"!==t}return!0},n=this.TRANSLATE_SMALL,r=this.TRANSLATE_BIG;return et(this,"_keyboardManager",new oe([[["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.#It.contains(e)&&!t.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,{target:e})=>!(e instanceof HTMLButtonElement)&&t.#It.contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-r,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[r,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-r],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,r],checker:e}]]))}constructor(t,e,i,n,r,s,a,o,l,h,c,d,u,p,g,f){const m=this._signal=this.#z.signal;this.#It=t,this.#kt=e,this.#Lt=i,this.#G=n,this.#K=r,this.#St=s,this.#Pt=o,this._eventBus=a,a._on("editingaction",this.onEditingAction.bind(this),{signal:m}),a._on("pagechanging",this.onPageChanging.bind(this),{signal:m}),a._on("scalechanging",this.onScaleChanging.bind(this),{signal:m}),a._on("rotationchanging",this.onRotationChanging.bind(this),{signal:m}),a._on("setpreference",this.onSetPreference.bind(this),{signal:m}),a._on("switchannotationeditorparams",t=>this.updateParams(t.type,t.value),{signal:m}),a._on("pagesedited",this.onPagesEdited.bind(this),{signal:m}),window.addEventListener("pointerdown",()=>{this.#ft=!0},{capture:!0,signal:m}),window.addEventListener("pointerup",()=>{this.#ft=!1},{capture:!0,signal:m}),this.#Bt(),this.#Nt(),this.#Ot(),this.#X=o.annotationStorage,this.#ot=o.filterFactory,this.#_t=l,this.#ct=h||null,this.#rt=c,this.#st=d,this.#at=u,this.#At=p||null,this.viewParameters={realScale:xt.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=g||null,this._supportsPinchToZoom=!1!==f,r?.setSidebarUiManager(this)}destroy(){this.#Rt?.resolve(),this.#Rt=null,this.#z?.abort(),this.#z=null,this._signal=null;for(const t of this.#W.values())t.destroy();this.#W.clear(),this.#$.clear(),this.#nt.clear(),this.#wt?.clear(),this.#H=null,this.#Et.clear(),this.#Y.destroy(),this.#G?.destroy(),this.#K?.destroy(),this.#St?.destroy(),this.#ut?.hide(),this.#ut=null,this.#yt?.destroy(),this.#yt=null,this.#V=null,this.#lt&&(clearTimeout(this.#lt),this.#lt=null),this.#Ft&&(clearTimeout(this.#Ft),this.#Ft=null),this._editorUndoBar?.destroy(),this.#Pt=null}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return this.#At}get useNewAltTextFlow(){return this.#st}get useNewAltTextWhenAddingImage(){return this.#at}get hcmFilter(){return et(this,"hcmFilter",this.#_t?this.#ot.addHCMFilter(this.#_t.foreground,this.#_t.background):"none")}get direction(){return et(this,"direction",getComputedStyle(this.#It).direction)}get _highlightColors(){return et(this,"_highlightColors",this.#ct?new Map(this.#ct.split(",").map(t=>((t=t.split("=").map(t=>t.trim()))[1]=t[1].toUpperCase(),t))):null)}get highlightColors(){const{_highlightColors:t}=this;if(!t)return et(this,"highlightColors",null);const e=new Map,i=!!this.#_t;for(const[n,r]of t){const t=n.endsWith("_HCM");i&&t?e.set(n.replace("_HCM",""),r):i||t||e.set(n,r)}return et(this,"highlightColors",e)}get highlightColorNames(){return et(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;const 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.#Q=t}setMainHighlightColorPicker(t){this.#yt=t}editAltText(t,e=!1){this.#G?.editAltText(this,t,e)}hasCommentManager(){return!!this.#K}editComment(t,e,i,n){this.#K?.showDialog(this,t,e,i,n)}selectComment(t,e){const i=this.#W.get(t),n=i?.getEditorByUID(e);n?.toggleComment(!0,!0)}updateComment(t){this.#K?.updateComment(t.getData())}updatePopupColor(t){this.#K?.updatePopupColor(t)}removeComment(t){this.#K?.removeComments([t.uid])}deleteComment(t,e){const i=()=>{t.comment=e};this.addCommands({cmd:()=>{this._editorUndoBar?.show(i,"comment"),this.toggleComment(null),t.comment=null},undo:i,mustExec:!0})}toggleComment(t,e,i=void 0){this.#K?.toggleCommentPopup(t,e,i)}makeCommentColor(t,e){return t&&this.#K?.makeCommentColor(t,e)||null}getCommentDialogElement(){return this.#K?.dialogElement||null}async waitForEditorsRendered(t){if(this.#W.has(t-1))return;const{resolve:e,promise:i}=Promise.withResolvers(),n=i=>{i.pageNumber===t&&(this._eventBus._off("editorsrendered",n),e())};this._eventBus.on("editorsrendered",n),await i}getSignature(t){this.#St?.getSignature({uiManager:this,editor:t})}get signatureManager(){return this.#St}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}){if("enableNewAltTextWhenAddingImage"===t)this.#at=e}onPagesEdited({pagesMapper:t}){for(const e of this.#$.values())e.updatePageIndex(t.getPrevPageNumber(e.pageIndex+1)-1);const e=this.#W,i=this.#W=new Map;for(const[n,r]of e){const e=t.getPrevPageNumber(n+1)-1;-1!==e?(i.set(e,r),r.updatePageIndex(e)):r.destroy()}}onPageChanging({pageNumber:t}){this.#Z=t-1}focusMainContainer(){this.#It.focus()}findParent(t,e){for(const i of this.#W.values()){const{x:n,y:r,width:s,height:a}=i.div.getBoundingClientRect();if(t>=n&&t<=n+s&&e>=r&&e<=r+a)return i}return null}disableUserSelect(t=!1){this.#kt.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#nt.add(t)}removeShouldRescale(t){this.#nt.delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*xt.PDF_TO_CSS_UNITS;for(const t of this.#nt)t.onScaleChanging();this.#Q?.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#jt({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t}#Ut(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const e of this.#W.values())if(e.hasTextLayer(t))return e;return null}highlightSelection(t="",e=!1){const i=document.getSelection();if(!i||i.isCollapsed)return;const{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:a}=i,o=i.toString(),l=this.#jt(i).closest(".textLayer"),h=this.getSelectionBoxes(l);if(!h)return;i.empty();const c=this.#Ut(l),d=this.#xt===w.NONE,u=()=>{const i=c?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:a,text:o});d&&this.showAllEditors("highlight",!0,!0),e&&i?.editComment()};d?this.switchToMode(w.HIGHLIGHT,u):u()}commentSelection(t=""){this.highlightSelection(t,!0)}#zt(){const t=document.getSelection();if(!t||t.isCollapsed)return;const e=this.#jt(t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&(this.#ut||=new ee(this),this.#ut.show(e,i,"ltr"===this.direction))}getAndRemoveDataFromAnnotationStorage(t){if(!this.#X)return null;const e=`${y}${t}`,i=this.#X.getRawValue(e);return i&&this.#X.remove(e),i}addToAnnotationStorage(t){t.isEmpty()||!this.#X||this.#X.has(t.id)||this.#X.setValue(t.id,t)}a11yAlert(t,e=null){const i=this.#Lt;i&&(i.setAttribute("data-l10n-id",t),e?i.setAttribute("data-l10n-args",JSON.stringify(e)):i.removeAttribute("data-l10n-args"))}#Ht(){const t=document.getSelection();if(!t||t.isCollapsed)return void(this.#Ct&&(this.#ut?.hide(),this.#Ct=null,this.#Vt({hasSelectedText:!1})));const{anchorNode:e}=t;if(e===this.#Ct)return;const i=this.#jt(t).closest(".textLayer");if(i){if(this.#ut?.hide(),this.#Ct=e,this.#Vt({hasSelectedText:!0}),(this.#xt===w.HIGHLIGHT||this.#xt===w.NONE)&&(this.#xt===w.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#dt=this.isShiftKeyDown,!this.isShiftKeyDown)){const t=this.#xt===w.HIGHLIGHT?this.#Ut(i):null;if(t?.toggleDrawing(),this.#ft){const e=new AbortController,i=this.combinedSignal(e),n=i=>{"pointerup"===i.type&&0!==i.button||(e.abort(),t?.toggleDrawing(!0),"pointerup"===i.type&&this.#$t("main_toolbar"))};window.addEventListener("pointerup",n,{signal:i}),window.addEventListener("blur",n,{signal:i})}else t?.toggleDrawing(!0),this.#$t("main_toolbar")}}else this.#Ct&&(this.#ut?.hide(),this.#Ct=null,this.#Vt({hasSelectedText:!1}))}#$t(t=""){this.#xt===w.HIGHLIGHT?this.highlightSelection(t):this.#rt&&this.#zt()}#Bt(){document.addEventListener("selectionchange",this.#Ht.bind(this),{signal:this._signal})}#Wt(){if(this.#ht)return;this.#ht=new AbortController;const t=this.combinedSignal(this.#ht);window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}#Gt(){this.#ht?.abort(),this.#ht=null}blur(){if(this.isShiftKeyDown=!1,this.#dt&&(this.#dt=!1,this.#$t("main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of this.#Et)if(e.div.contains(t)){this.#vt=[e,t],e._focusEventsAllowed=!1;break}}focus(){if(!this.#vt)return;const[t,e]=this.#vt;this.#vt=null,e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}#Ot(){if(this.#bt)return;this.#bt=new AbortController;const t=this.combinedSignal(this.#bt);window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}#Xt(){this.#bt?.abort(),this.#bt=null}#qt(){if(this.#J)return;this.#J=new AbortController;const t=this.combinedSignal(this.#J);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})}#Yt(){this.#J?.abort(),this.#J=null}#Nt(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}addEditListeners(){this.#Ot(),this.setEditingState(!0)}removeEditListeners(){this.#Xt(),this.setEditingState(!1)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const i of this.#it)if(i.isHandlingMimeForPasting(e))return t.dataTransfer.dropEffect="copy",void t.preventDefault()}drop(t){for(const e of t.dataTransfer.items)for(const i of this.#it)if(i.isHandlingMimeForPasting(e.type))return i.paste(e,this.currentLayer),void t.preventDefault()}copy(t){if(t.preventDefault(),this.#H?.commitOrRemove(),!this.hasSelection)return;const e=[];for(const t of this.#Et){const 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();const{clipboardData:e}=t;for(const t of e.items)for(const e of this.#it)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){return void K(`paste: "${t.message}".`)}if(!Array.isArray(i))return;this.unselectAll();const n=this.currentLayer;try{const t=[];for(const e of i){const i=await n.deserialize(e);if(!i)return;t.push(i)}const e=()=>{for(const e of t)this.#Kt(e);this.#Jt(t)},r=()=>{for(const e of t)e.remove()};this.addCommands({cmd:e,undo:r,mustExec:!0})}catch(t){K(`paste: "${t.message}".`)}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),this.#xt===w.NONE||this.isEditorHandlingKeyboard||he._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,this.#dt&&(this.#dt=!1,this.#$t("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")}}#Vt(t){Object.entries(t).some(([t,e])=>this.#Dt[t]!==e)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#Dt,t)}),this.#xt===w.HIGHLIGHT&&!1===t.hasSelectedEditor&&this.#Qt([[A.HIGHLIGHT_FREE,!0]]))}#Qt(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#Wt(),this.#qt(),this.#Vt({isEditing:this.#xt!==w.NONE,isEmpty:this.#Zt(),hasSomethingToUndo:this.#Y.hasSomethingToUndo(),hasSomethingToRedo:this.#Y.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#Gt(),this.#Yt(),this.#Vt({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!this.#it){this.#it=t;for(const t of this.#it)this.#Qt(t.defaultPropertiesToUpdate)}}getId(){return this.#pt.id}get currentLayer(){return this.#W.get(this.#Z)}getLayer(t){return this.#W.get(t)}get currentPageIndex(){return this.#Z}addLayer(t){this.#W.set(t.pageIndex,t),this.#gt?t.enable():t.disable()}removeLayer(t){this.#W.delete(t.pageIndex)}async updateMode(t,e=null,i=!1,n=!1,r=!1,s=!1){if(this.#xt!==t&&(!this.#Rt||(await this.#Rt.promise,this.#Rt))){if(this.#Rt=Promise.withResolvers(),this.#Q?.commitOrRemove(),this.#xt===w.POPUP&&this.#K?.hideSidebar(),this.#K?.destroyPopup(),this.#xt=t,t===w.NONE){this.setEditingState(!1),this.#te();for(const t of this.#$.values())t.hideStandaloneCommentButton();return this._editorUndoBar?.hide(),this.toggleComment(null),void this.#Rt.resolve()}for(const t of this.#$.values())t.addStandaloneCommentButton();t===w.SIGNATURE&&await(this.#St?.loadSignatures()),i&&ne.clearPointerType(),this.setEditingState(!0),await this.#ee(),this.unselectAll();for(const e of this.#W.values())e.updateMode(t);if(t===w.POPUP){this.#V||=await this.#Pt.getAnnotationsByType(new Set(this.#it.map(t=>t._editorType)));const t=new Set,e=[];for(const i of this.#$.values()){const{annotationElementId:n,hasComment:r,deleted:s}=i;n&&t.add(n),r&&!s&&e.push(i.getData())}for(const i of this.#V){const{id:n,popupRef:r,contentsObj:s}=i;r&&s?.str&&!t.has(n)&&!this.#tt.has(n)&&e.push(i)}this.#K?.showSidebar(e)}if(!e)return n&&this.addNewEditorFromKeyboard(),void this.#Rt.resolve();for(const t of this.#$.values())t.uid===e?(this.setSelected(t),s?t.editComment():r?t.enterInEditMode():t.focus()):t.unselect();this.#Rt.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==this.#xt&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(this.#it){switch(t){case A.CREATE:return void this.currentLayer.addNewEditor(e);case A.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#Tt||=new Map).set(t,e),this.showAllEditors("highlight",e)}if(this.hasSelection)for(const i of this.#Et)i.updateParams(t,e);else for(const i of this.#it)i.updateDefaultParams(t,e)}}showAllEditors(t,e,i=!1){for(const i of this.#$.values())i.editorType===t&&i.show(e);(this.#Tt?.get(A.HIGHLIGHT_SHOW_ALL)??!0)!==e&&this.#Qt([[A.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(this.#mt!==t){this.#mt=t;for(const e of this.#W.values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}async#ee(){if(!this.#gt){this.#gt=!0;const t=[];for(const e of this.#W.values())t.push(e.enable());await Promise.all(t);for(const t of this.#$.values())t.enable()}}#te(){if(this.unselectAll(),this.#gt){this.#gt=!1;for(const t of this.#W.values())t.disable();for(const t of this.#$.values())t.disable()}}*getEditors(t){for(const e of this.#$.values())e.pageIndex===t&&(yield e)}getEditor(t){return this.#$.get(t)}addEditor(t){this.#$.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#lt&&clearTimeout(this.#lt),this.#lt=setTimeout(()=>{this.focusMainContainer(),this.#lt=null},0)),this.#$.delete(t.id),t.annotationElementId&&this.#wt?.delete(t.annotationElementId),this.unselect(t),t.annotationElementId&&this.#tt.has(t.annotationElementId)||this.#X?.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}#Kt(t){const e=this.#W.get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#H!==t&&(this.#H=t,t&&this.#Qt(t.propertiesToUpdate))}get#ie(){let t=null;for(t of this.#Et);return t}updateUI(t){this.#ie===t&&this.#Qt(t.propertiesToUpdate)}updateUIForDefaultProperties(t){this.#Qt(t.defaultPropertiesToUpdate)}toggleSelected(t){if(this.#Et.has(t))return this.#Et.delete(t),t.unselect(),void this.#Vt({hasSelectedEditor:this.hasSelection});this.#Et.add(t),t.select(),this.#Qt(t.propertiesToUpdate),this.#Vt({hasSelectedEditor:!0})}setSelected(t){this.updateToolbar({mode:t.mode,editId:t.uid}),this.#Q?.commitOrRemove();for(const e of this.#Et)e!==t&&e.unselect();this.#Et.clear(),this.#Et.add(t),t.select(),this.#Qt(t.propertiesToUpdate),this.#Vt({hasSelectedEditor:!0})}isSelected(t){return this.#Et.has(t)}get firstSelectedEditor(){return this.#Et.values().next().value}unselect(t){t.unselect(),this.#Et.delete(t),this.#Vt({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#Et.size}get isEnterHandled(){return 1===this.#Et.size&&this.firstSelectedEditor.isEnterHandled}undo(){this.#Y.undo(),this.#Vt({hasSomethingToUndo:this.#Y.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#Zt()}),this._editorUndoBar?.hide()}redo(){this.#Y.redo(),this.#Vt({hasSomethingToUndo:!0,hasSomethingToRedo:this.#Y.hasSomethingToRedo(),isEmpty:this.#Zt()})}addCommands(t){this.#Y.add(t),this.#Vt({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#Zt()})}cleanUndoStack(t){this.#Y.cleanType(t)}#Zt(){if(0===this.#$.size)return!0;if(1===this.#$.size)for(const t of this.#$.values())return t.isEmpty();return!1}delete(){this.commitOrRemove();const t=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!t)return;const e=t?[t]:[...this.#Et],i=()=>{for(const t of e)this.#Kt(t)};this.addCommands({cmd:()=>{this._editorUndoBar?.show(i,1===e.length?e[0].editorType:e.length);for(const t of e)t.remove()},undo:i,mustExec:!0})}commitOrRemove(){this.#H?.commitOrRemove()}hasSomethingToControl(){return this.#H||this.hasSelection}#Jt(t){for(const t of this.#Et)t.unselect();this.#Et.clear();for(const e of t)e.isEmpty()||(this.#Et.add(e),e.select());this.#Vt({hasSelectedEditor:this.hasSelection})}selectAll(){for(const t of this.#Et)t.commit();this.#Jt(this.#$.values())}unselectAll(){if((!this.#H||(this.#H.commitOrRemove(),this.#xt===w.NONE))&&!this.#Q?.commitOrRemove()&&this.hasSelection){for(const t of this.#Et)t.unselect();this.#Et.clear(),this.#Vt({hasSelectedEditor:!1})}}translateSelectedEditors(t,e,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;this.#Mt[0]+=t,this.#Mt[1]+=e;const[n,r]=this.#Mt,s=[...this.#Et];this.#Ft&&clearTimeout(this.#Ft),this.#Ft=setTimeout(()=>{this.#Ft=null,this.#Mt[0]=this.#Mt[1]=0,this.addCommands({cmd:()=>{for(const t of s)this.#$.has(t.id)&&(t.translateInPage(n,r),t.translationDone())},undo:()=>{for(const t of s)this.#$.has(t.id)&&(t.translateInPage(-n,-r),t.translationDone())},mustExec:!1})},1e3);for(const i of s)i.translateInPage(t,e),i.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#et=new Map;for(const t of this.#Et)this.#et.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#et)return!1;this.disableUserSelect(!1);const t=this.#et;this.#et=null;let e=!1;for(const[{x:i,y:n,pageIndex:r},s]of t)s.newX=i,s.newY=n,s.newPageIndex=r,e||=i!==s.savedX||n!==s.savedY||r!==s.savedPageIndex;if(!e)return!1;const i=(t,e,i,n)=>{if(this.#$.has(t.id)){const r=this.#W.get(n);r?t._setParentAndPosition(r,e,i):(t.pageIndex=n,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(const[e,{newX:n,newY:r,newPageIndex:s}]of t)i(e,n,r,s)},undo:()=>{for(const[e,{savedX:n,savedY:r,savedPageIndex:s}]of t)i(e,n,r,s)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(this.#et)for(const i of this.#et.keys())i.drag(t,e)}rebuild(t){if(null===t.parent){const 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.#Et.size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#H===t}getActive(){return this.#H}getMode(){return this.#xt}isEditingMode(){return this.#xt!==w.NONE}get imageManager(){return et(this,"imageManager",new se)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let i=0,n=e.rangeCount;i<n;i++)if(!t.contains(e.getRangeAt(i).commonAncestorContainer))return null;const{x:i,y:n,width:r,height:s}=t.getBoundingClientRect();let a;switch(t.getAttribute("data-main-rotation")){case"90":a=(t,e,a,o)=>({x:(e-n)/s,y:1-(t+a-i)/r,width:o/s,height:a/r});break;case"180":a=(t,e,a,o)=>({x:1-(t+a-i)/r,y:1-(e+o-n)/s,width:a/r,height:o/s});break;case"270":a=(t,e,a,o)=>({x:1-(e+o-n)/s,y:(t-i)/r,width:o/s,height:a/r});break;default:a=(t,e,a,o)=>({x:(t-i)/r,y:(e-n)/s,width:a/r,height:o/s})}const o=[];for(let t=0,i=e.rangeCount;t<i;t++){const i=e.getRangeAt(t);if(!i.collapsed)for(const{x:t,y:e,width:n,height:r}of i.getClientRects())0!==n&&0!==r&&o.push(a(t,e,n,r))}return 0===o.length?null:o}addChangedExistingAnnotation({annotationElementId:t,id:e}){(this.#q||=new Map).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){this.#q?.delete(t)}renderAnnotationElement(t){const e=this.#q?.get(t.data.id);if(!e)return;const i=this.#X.getRawValue(e);i&&(this.#xt!==w.NONE||i.hasBeenModified)&&i.renderAnnotationElement(t)}setMissingCanvas(t,e,i){const n=this.#wt?.get(t);n&&(n.setCanvas(e,i),this.#wt.delete(t))}addMissingCanvas(t,e){(this.#wt||=new Map).set(t,e)}}class ce{#g=null;#ne=!1;#re=null;#se=null;#ae=null;#oe=null;#le=!1;#he=null;#u=null;#ce=null;#de=null;#ue=!1;static#pe=null;static _l10n=null;constructor(t){this.#u=t,this.#ue=t._uiManager.useNewAltTextFlow,ce.#pe||=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){ce._l10n??=t}async render(){const t=this.#re=document.createElement("button");t.className="altText",t.tabIndex="0";const e=this.#se=document.createElement("span");t.append(e),this.#ue?(t.classList.add("new"),t.setAttribute("data-l10n-id",ce.#pe.missing),e.setAttribute("data-l10n-id",ce.#pe["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const i=this.#u._uiManager._signal;t.addEventListener("contextmenu",It,{signal:i}),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});const n=t=>{t.preventDefault(),this.#u._uiManager.editAltText(this.#u),this.#ue&&this.#u._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#ge}})};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&(this.#le=!0,n(e))},{signal:i}),await this.#fe(),t}get#ge(){return(this.#g?"added":null===this.#g&&this.guessedText&&"review")||"missing"}finish(){this.#re&&(this.#re.focus({focusVisible:this.#le}),this.#le=!1)}isEmpty(){return this.#ue?null===this.#g:!this.#g&&!this.#ne}hasData(){return this.#ue?null!==this.#g||!!this.#ce:this.isEmpty()}get guessedText(){return this.#ce}async setGuessedText(t){null===this.#g&&(this.#ce=t,this.#de=await ce._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t}),this.#fe())}toggleAltTextBadge(t=!1){if(!this.#ue||this.#g)return this.#he?.remove(),void(this.#he=null);if(!this.#he){const t=this.#he=document.createElement("div");t.className="noAltTextBadge",this.#u.div.append(t)}this.#he.classList.toggle("hidden",!t)}serialize(t){let e=this.#g;return t||this.#ce!==e||(e=this.#de),{altText:e,decorative:this.#ne,guessedText:this.#ce,textWithDisclaimer:this.#de}}get data(){return{altText:this.#g,decorative:this.#ne}}set data({altText:t,decorative:e,guessedText:i,textWithDisclaimer:n,cancel:r=!1}){i&&(this.#ce=i,this.#de=n),this.#g===t&&this.#ne===e||(r||(this.#g=t,this.#ne=e),this.#fe())}toggle(t=!1){this.#re&&(!t&&this.#oe&&(clearTimeout(this.#oe),this.#oe=null),this.#re.disabled=!t)}shown(){this.#u._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#ge}})}destroy(){this.#re?.remove(),this.#re=null,this.#se=null,this.#ae=null,this.#he?.remove(),this.#he=null}async#fe(){const t=this.#re;if(!t)return;if(this.#ue){if(t.classList.toggle("done",!!this.#g),t.setAttribute("data-l10n-id",ce.#pe[this.#ge]),this.#se?.setAttribute("data-l10n-id",ce.#pe[`${this.#ge}-label`]),!this.#g)return void this.#ae?.remove()}else{if(!this.#g&&!this.#ne)return t.classList.remove("done"),void this.#ae?.remove();t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=this.#ae;if(!e){this.#ae=e=document.createElement("span"),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${this.#u.id}`;const i=100,n=this.#u._uiManager._signal;n.addEventListener("abort",()=>{clearTimeout(this.#oe),this.#oe=null},{once:!0}),t.addEventListener("mouseenter",()=>{this.#oe=setTimeout(()=>{this.#oe=null,this.#ae.classList.add("show"),this.#u._reportTelemetry({action:"alt_text_tooltip"})},i)},{signal:n}),t.addEventListener("mouseleave",()=>{this.#oe&&(clearTimeout(this.#oe),this.#oe=null),this.#ae?.classList.remove("show")},{signal:n})}this.#ne?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);const i=this.#u.getElementForAltText();i?.setAttribute("aria-describedby",e.id)}}class de{#me=null;#be=null;#ve=!1;#u=null;#ye=null;#we=null;#Ae=null;#xe=null;#Ee=!1;#Ce=null;constructor(t){this.#u=t}renderForToolbar(){const t=this.#be=document.createElement("button");return t.className="comment",this.#S(t,!1)}renderForStandalone(){const t=this.#me=document.createElement("button");t.className="annotationCommentButton";const e=this.#u.commentButtonPosition;if(e){const{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))`;const n=this.#u.commentButtonColor;n&&(i.backgroundColor=n)}return this.#S(t,!0)}focusButton(){setTimeout(()=>{(this.#me??this.#be)?.focus()},0)}onUpdatedColor(){if(!this.#me)return;const t=this.#u.commentButtonColor;t&&(this.#me.style.backgroundColor=t),this.#u._uiManager.updatePopupColor(this.#u)}get commentButtonWidth(){return(this.#me?.getBoundingClientRect().width??0)/this.#u.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#Ce)return this.#Ce;if(!this.#me)return null;const{x:t,y:e,height:i}=this.#me.getBoundingClientRect(),{x:n,y:r,width:s,height:a}=this.#u.parent.boundingClientRect;return[(t-n)/s,(e+i-r)/a]}set commentPopupPositionInLayer(t){this.#Ce=t}hasDefaultPopupPosition(){return null===this.#Ce}removeStandaloneCommentButton(){this.#me?.remove(),this.#me=null}removeToolbarCommentButton(){this.#be?.remove(),this.#be=null}setCommentButtonStates({selected:t,hasPopup:e}){this.#me&&(this.#me.classList.toggle("selected",t),this.#me.ariaExpanded=e)}#S(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"));const i=this.#u._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return t;t.addEventListener("contextmenu",It,{signal:i}),e&&(t.addEventListener("focusin",t=>{this.#u._focusEventsAllowed=!1,kt(t)},{capture:!0,signal:i}),t.addEventListener("focusout",t=>{this.#u._focusEventsAllowed=!0,kt(t)},{capture:!0,signal:i})),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});const n=e=>{e.preventDefault(),t===this.#be?this.edit():this.#u.toggleComment(!0)};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&(this.#ve=!0,n(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){const e=this.commentPopupPositionInLayer;let i,n;if(e)[i,n]=e;else{[i,n]=this.#u.commentButtonPosition;const{width:t,height:e,x:r,y:s}=this.#u;i=r+i*t,n=s+n*e}const r=this.#u.parent.boundingClientRect,{x:s,y:a,width:o,height:l}=r;this.#u._uiManager.editComment(this.#u,s+i*o,a+n*l,{...t,parentDimensions:r})}finish(){this.#be&&(this.#be.focus({focusVisible:this.#ve}),this.#ve=!1)}isDeleted(){return this.#Ee||""===this.#Ae}isEmpty(){return null===this.#Ae}hasBeenEdited(){return this.isDeleted()||this.#Ae!==this.#ye}serialize(){return this.data}get data(){return{text:this.#Ae,richText:this.#we,date:this.#xe,deleted:this.isDeleted()}}set data(t){if(t!==this.#Ae&&(this.#we=null),null===t)return this.#Ae="",void(this.#Ee=!0);this.#Ae=t,this.#xe=new Date,this.#Ee=!1}restoreData({text:t,richText:e,date:i}){this.#Ae=t,this.#we=e,this.#xe=i,this.#Ee=!1}setInitialText(t,e=null){this.#ye=t,this.data=t,this.#xe=null,this.#we=e}shown(){}destroy(){this.#be?.remove(),this.#be=null,this.#me?.remove(),this.#me=null,this.#Ae="",this.#we=null,this.#xe=null,this.#u=null,this.#ve=!1,this.#Ee=!1}}class ue{#It;#Se=!1;#_e=null;#Te;#Pe;#De;#Me;#Fe=null;#Ie;#ke=null;#Le;#Re=null;constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:i=null,onPinchStart:n=null,onPinching:r=null,onPinchEnd:s=null,signal:a}){this.#It=t,this.#_e=i,this.#Te=e,this.#Pe=n,this.#De=r,this.#Me=s,this.#Le=new AbortController,this.#Ie=AbortSignal.any([a,this.#Le.signal]),t.addEventListener("touchstart",this.#Be.bind(this),{passive:!1,signal:this.#Ie})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Ut.pixelRatio}#Be(t){if(this.#Te?.())return;if(1===t.touches.length){if(this.#Fe)return;const t=this.#Fe=new AbortController,e=AbortSignal.any([this.#Ie,t.signal]),i=this.#It,n={capture:!0,signal:e,passive:!1},r=t=>{"touch"===t.pointerType&&(this.#Fe?.abort(),this.#Fe=null)};return i.addEventListener("pointerdown",t=>{"touch"===t.pointerType&&(kt(t),r(t))},n),i.addEventListener("pointerup",r,n),void i.addEventListener("pointercancel",r,n)}if(!this.#Re){this.#Re=new AbortController;const t=AbortSignal.any([this.#Ie,this.#Re.signal]),e=this.#It,i={signal:t,capture:!1,passive:!1};e.addEventListener("touchmove",this.#Ne.bind(this),i);const n=this.#Oe.bind(this);e.addEventListener("touchend",n,i),e.addEventListener("touchcancel",n,i),i.capture=!0,e.addEventListener("pointerdown",kt,i),e.addEventListener("pointermove",kt,i),e.addEventListener("pointercancel",kt,i),e.addEventListener("pointerup",kt,i),this.#Pe?.()}if(kt(t),2!==t.touches.length||this.#_e?.())return void(this.#ke=null);let[e,i]=t.touches;e.identifier>i.identifier&&([e,i]=[i,e]),this.#ke={touch0X:e.screenX,touch0Y:e.screenY,touch1X:i.screenX,touch1Y:i.screenY}}#Ne(t){if(!this.#ke||2!==t.touches.length)return;kt(t);let[e,i]=t.touches;e.identifier>i.identifier&&([e,i]=[i,e]);const{screenX:n,screenY:r}=e,{screenX:s,screenY:a}=i,o=this.#ke,{touch0X:l,touch0Y:h,touch1X:c,touch1Y:d}=o,u=c-l,p=d-h,g=s-n,f=a-r,m=Math.hypot(g,f)||1,b=Math.hypot(u,p)||1;if(!this.#Se&&Math.abs(b-m)<=ue.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(o.touch0X=n,o.touch0Y=r,o.touch1X=s,o.touch1Y=a,!this.#Se)return void(this.#Se=!0);const v=[(n+s)/2,(r+a)/2];this.#De?.(v,b,m)}#Oe(t){t.touches.length>=2||(this.#Re&&(this.#Re.abort(),this.#Re=null,this.#Me?.()),this.#ke&&(kt(t),this.#ke=null,this.#Se=!1))}destroy(){this.#Le?.abort(),this.#Le=null,this.#Fe?.abort(),this.#Fe=null}}class pe{#je=null;#Ue=null;#g=null;#f=null;#me=null;#ze=!1;#He=null;#Ve="";#$e=null;#We=null;#Ge=null;#Xe=null;#qe=null;#Ye="";#Ke=!1;#Je=null;#Qe=!1;#Ze=!1;#ti=!1;#ei=null;#ii=0;#ni=0;#ri=null;#si=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;#ai=!1;#oi=pe._zIndex++;static _borderLineWidth=-1;static _colorManager=new le;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const t=pe.prototype._resizeWithKeyboard,e=he.TRANSLATE_SMALL,i=he.TRANSLATE_BIG;return et(this,"_resizerKeyboardManager",new oe([[["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"],pe.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;const{rotation:e,rawDims:{pageWidth:i,pageHeight:n,pageX:r,pageY:s}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,n],this.pageTranslation=[r,s];const[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 et(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new ge({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(pe._l10n??=t,pe._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!==pe._borderLineWidth)return;const i=getComputedStyle(document.documentElement);pe._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){J("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#ai}set _isDraggable(t){this.#ai=t,this.div?.classList.toggle("draggable",t)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){const[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}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#oi}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(this.#li(),this.#Xe?.remove(),this.#Xe=null),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#Ke?this.#Ke=!1:this.parent.setSelected(this))}focusout(t){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const 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,n){const[r,s]=this.parentDimensions;[i,n]=this.screenToPageTranslation(i,n),this.x=(t+i)/r,this.y=(e+n)/s,this.fixAndSetPosition()}_moveAfterPaste(t,e){const[i,n]=this.parentDimensions;this.setAt(t*i,e*n,this.width*i,this.height*n),this._onTranslated()}#hi([t,e],i,n){[i,n]=this.screenToPageTranslation(i,n),this.x+=i/t,this.y+=n/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(t,e){this.#hi(this.parentDimensions,t,e)}translateInPage(t,e){this.#Je||=[this.x,this.y,this.width,this.height],this.#hi(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){this.#Je||=[this.x,this.y,this.width,this.height];const{div:i,parentDimensions:[n,r]}=this;if(this.x+=t/n,this.y+=e/r,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{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:s,y:a}=this;const[o,l]=this.getBaseTranslation();s+=o,a+=l;const{style:h}=i;h.left=`${(100*s).toFixed(2)}%`,h.top=`${(100*a).toFixed(2)}%`,this._onTranslating(s,a),i.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!this.#Je&&(this.#Je[0]!==this.x||this.#Je[1]!==this.y)}get _hasBeenResized(){return!!this.#Je&&(this.#Je[2]!==this.width||this.#Je[3]!==this.height)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:i}=pe,n=i/t,r=i/e;switch(this.rotation){case 90:return[-n,r];case 180:return[n,r];case 270:return[n,-r];default:return[-n,-r]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const{div:{style:e},pageDimensions:[i,n]}=this;let{x:r,y:s,width:a,height:o}=this;if(a*=i,o*=n,r*=i,s*=n,this._mustFixPosition)switch(t){case 0:r=vt(r,0,i-a),s=vt(s,0,n-o);break;case 90:r=vt(r,0,i-o),s=vt(s,a,n);break;case 180:r=vt(r,a,i),s=vt(s,o,n);break;case 270:r=vt(r,o,i),s=vt(s,0,n-a)}this.x=r/=i,this.y=s/=n;const[l,h]=this.getBaseTranslation();r+=l,s+=h,e.left=`${(100*r).toFixed(2)}%`,e.top=`${(100*s).toFixed(2)}%`,this.moveInDOM()}static#ci(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 pe.#ci(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return pe.#ci(t,e,360-this.parentRotation)}#di(t){switch(t){case 90:{const[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{const[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(){const{parentScale:t,pageDimensions:[e,i]}=this;return[e*t,i*t]}setDims(){const{div:{style:t},width:e,height:i}=this;t.width=`${(100*e).toFixed(2)}%`,t.height=`${(100*i).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#ui(){if(this.#$e)return;this.#$e=document.createElement("div"),this.#$e.classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const i of t){const t=document.createElement("div");this.#$e.append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",this.#pi.bind(this,i),{signal:e}),t.addEventListener("contextmenu",It,{signal:e}),t.tabIndex=-1}this.div.prepend(this.#$e)}#pi(t,e){e.preventDefault();const{isMac:i}=ct.platform;if(0!==e.button||e.ctrlKey&&i)return;this.#g?.toggle(!1);const n=this._isDraggable;this._isDraggable=!1,this.#We=[e.screenX,e.screenY];const r=new AbortController,s=this._uiManager.combinedSignal(r);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#gi.bind(this,t),{passive:!0,capture:!0,signal:s}),window.addEventListener("touchmove",kt,{passive:!1,signal:s}),window.addEventListener("contextmenu",It,{signal:s}),this.#Ge={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const 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;const l=()=>{r.abort(),this.parent.togglePointerEvents(!0),this.#g?.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=a,this.div.style.cursor=o,this.#fi()};window.addEventListener("pointerup",l,{signal:s}),window.addEventListener("blur",l,{signal:s})}#mi(t,e,i,n){this.width=i,this.height=n,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#fi(){if(!this.#Ge)return;const{savedX:t,savedY:e,savedWidth:i,savedHeight:n}=this.#Ge;this.#Ge=null;const r=this.x,s=this.y,a=this.width,o=this.height;r===t&&s===e&&a===i&&o===n||this.addCommands({cmd:this.#mi.bind(this,r,s,a,o),undo:this.#mi.bind(this,t,e,i,n),mustExec:!0})}static _round(t){return Math.round(1e4*t)/1e4}#gi(t,e){const[i,n]=this.parentDimensions,r=this.x,s=this.y,a=this.width,o=this.height,l=pe.MIN_SIZE/i,h=pe.MIN_SIZE/n,c=this.#di(this.rotation),d=(t,e)=>[c[0]*t+c[2]*e,c[1]*t+c[3]*e],u=this.#di(360-this.rotation);let p,g,f=!1,m=!1;switch(t){case"topLeft":f=!0,p=(t,e)=>[0,0],g=(t,e)=>[t,e];break;case"topMiddle":p=(t,e)=>[t/2,0],g=(t,e)=>[t/2,e];break;case"topRight":f=!0,p=(t,e)=>[t,0],g=(t,e)=>[0,e];break;case"middleRight":m=!0,p=(t,e)=>[t,e/2],g=(t,e)=>[0,e/2];break;case"bottomRight":f=!0,p=(t,e)=>[t,e],g=(t,e)=>[0,0];break;case"bottomMiddle":p=(t,e)=>[t/2,e],g=(t,e)=>[t/2,0];break;case"bottomLeft":f=!0,p=(t,e)=>[0,e],g=(t,e)=>[t,0];break;case"middleLeft":m=!0,p=(t,e)=>[0,e/2],g=(t,e)=>[t,e/2]}const b=p(a,o),v=g(a,o);let y=d(...v);const w=pe._round(r+y[0]),A=pe._round(s+y[1]);let x,E,C=1,S=1;if(e.fromKeyboard)({deltaX:x,deltaY:E}=e);else{const{screenX:t,screenY:i}=e,[n,r]=this.#We;[x,E]=this.screenToPageTranslation(t-n,i-r),this.#We[0]=t,this.#We[1]=i}var _,T;if([x,E]=(_=x/i,T=E/n,[u[0]*_+u[2]*T,u[1]*_+u[3]*T]),f){const t=Math.hypot(a,o);C=S=Math.max(Math.min(Math.hypot(v[0]-b[0]-x,v[1]-b[1]-E)/t,1/a,1/o),l/a,h/o)}else m?C=vt(Math.abs(v[0]-b[0]-x),l,1)/a:S=vt(Math.abs(v[1]-b[1]-E),h,1)/o;const P=pe._round(a*C),D=pe._round(o*S);y=d(...g(P,D));const M=w-y[0],F=A-y[1];this.#Je||=[this.x,this.y,this.width,this.height],this.width=P,this.height=D,this.x=M,this.y=F,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#g?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#Ze)return this._editToolbar;this._editToolbar=new te(this),this.div.append(this._editToolbar.render());const{toolbarButtons:t}=this;if(t)for(const[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){const e=this._editToolbar?.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return this.#g||(ce.initialize(pe._l10n),this.#g=new ce(this),this.#je&&(this.#g.data=this.#je,this.#je=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.#f?.focusButton()}addCommentButton(){return this.canAddComment?this.#f||=new de(this):null}addStandaloneCommentButton(){this._uiManager.hasCommentManager()&&(this.#me?this._uiManager.isEditingMode()&&this.#me.classList.remove("hidden"):this.hasComment&&(this.#me=this.#f.renderForStandalone(),this.div.append(this.#me)))}removeStandaloneCommentButton(){this.#f.removeStandaloneCommentButton(),this.#me=null}hideStandaloneCommentButton(){this.#me?.classList.add("hidden")}get comment(){if(!this.#f)return null;const{data:{richText:t,text:e,date:i,deleted:n}}=this.#f;return{text:e,richText:t,date:i,deleted:n,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){this.#f||=new de(this),"object"==typeof t&&null!==t?this.#f.restoreData(t):this.#f.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)return;if(this.#f||=new de(this),this.#f.setInitialText(t,i),!this.annotationElementId)return;const n=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);n&&this.updateFromAnnotationLayer(n)}get hasEditedComment(){return this.#f?.hasBeenEdited()}get hasDeletedComment(){return this.#f?.isDeleted()}get hasComment(){return!!this.#f&&!this.#f.isEmpty()&&!this.#f.isDeleted()}async editComment(t){this.#f||=new de(this),this.#f.edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){this.#f.setSelectedButton(t)}addComment(t){if(this.hasEditedComment){const e=180,i=100,[,,,n]=t.rect,[r]=this.pageDimensions,[s]=this.pageTranslation,a=s+r+1,o=n-i,l=a+e;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[a,o,l,n]}}}updateFromAnnotationLayer({popup:{contents:t,deleted:e}}){this.#f.data=e?null:t}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){const 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.#ze?-1:0,t.setAttribute("role","application"),this.defaultL10nId&&t.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||t.classList.add("hidden"),this.setInForeground(),this.#bi();const[e,i]=this.parentDimensions;this.parentRotation%180!=0&&(t.style.maxWidth=`${(100*i/e).toFixed(2)}%`,t.style.maxHeight=`${(100*e/i).toFixed(2)}%`);const[n,r]=this.getInitialTranslation();return this.translate(n,r),ie(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(this.#si||=new ue({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#vi.bind(this),onPinching:this.#yi.bind(this),onPinchEnd:this.#wi.bind(this),signal:this._uiManager._signal})),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),t}#vi(){this.#Ge={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#g?.toggle(!1),this.parent.togglePointerEvents(!1)}#yi(t,e,i){let n=i/e*.7+1-.7;if(1===n)return;const r=this.#di(this.rotation),s=(t,e)=>[r[0]*t+r[2]*e,r[1]*t+r[3]*e],[a,o]=this.parentDimensions,l=this.x,h=this.y,c=this.width,d=this.height,u=pe.MIN_SIZE/a,p=pe.MIN_SIZE/o;n=Math.max(Math.min(n,1/c,1/d),u/c,p/d);const g=pe._round(c*n),f=pe._round(d*n);if(g===c&&f===d)return;this.#Je||=[l,h,c,d];const m=s(c/2,d/2),b=pe._round(l+m[0]),v=pe._round(h+m[1]),y=s(g/2,f/2);this.x=b-y[0],this.y=v-y[1],this.width=g,this.height=f,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#wi(){this.#g?.toggle(!0),this.parent.togglePointerEvents(!0),this.#fi()}pointerdown(t){const{isMac:e}=ct.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():(this.#Ke=!0,this._isDraggable?this.#Ai(t):this.#xi(t))}#xi(t){const{isMac:e}=ct.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#Ai(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();let i=!1;const n=new AbortController,r=this._uiManager.combinedSignal(n),s={capture:!0,passive:!1,signal:r},a=t=>{n.abort(),this.#He=null,this.#Ke=!1,this._uiManager.endDragSession()||this.#xi(t),i&&this._onStopDragging()};e&&(this.#ii=t.clientX,this.#ni=t.clientY,this.#He=t.pointerId,this.#Ve=t.pointerType,window.addEventListener("pointermove",t=>{i||(i=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:e,clientY:n,pointerId:r}=t;if(r!==this.#He)return void kt(t);const[s,a]=this.screenToPageTranslation(e-this.#ii,n-this.#ni);this.#ii=e,this.#ni=n,this._uiManager.dragSelectedEditors(s,a)},s),window.addEventListener("touchmove",kt,s),window.addEventListener("pointerdown",t=>{t.pointerType===this.#Ve&&(this.#si||t.isPrimary)&&a(t),kt(t)},s));const o=t=>{this.#He&&this.#He!==t.pointerId?kt(t):a(t)};window.addEventListener("pointerup",o,{signal:r}),window.addEventListener("blur",o,{signal:r})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#ei&&clearTimeout(this.#ei),this.#ei=setTimeout(()=>{this.#ei=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){const n=this.parentScale,[r,s]=this.pageDimensions,[a,o]=this.pageTranslation,l=t/n,h=e/n,c=this.x*r,d=this.y*s,u=this.width*r,p=this.height*s;switch(i){case 0:return[c+l+a,s-d-h-p+o,c+l+u+a,s-d-h+o];case 90:return[c+h+a,s-d+l+o,c+h+p+a,s-d+l+u+o];case 180:return[c-l-u+a,s-d+h+o,c-l+a,s-d+h+p+o];case 270:return[c-h-p+a,s-d-l-u+o,c-h+a,s-d-l+o];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[i,n,r,s]=t,a=r-i,o=s-n;switch(this.rotation){case 0:return[i,e-s,a,o];case 90:return[i,e-n,o,a];case 180:return[r,e-n,a,o];case 270:return[r,e-s,o,a];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&pe._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#f?.onUpdatedColor()}getData(){const{comment:{text:t,color:e,date:i,opacity:n,deleted:r,richText:s},uid:a,pageIndex:o,creationDate:l,modificationDate:h}=this;return{id:a,pageIndex:o,rect:this.getPDFRect(),richText:s,contentsObj:{str:t},creationDate:l,modificationDate:i||h,popupRef:!r,color:e,opacity:n}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return!this.isInEditMode()&&(this.parent.setEditingState(!1),this.#Ze=!0,!0)}disableEditMode(){return!!this.isInEditMode()&&(this.parent.setEditingState(!0),this.#Ze=!1,!0)}isInEditMode(){return this.#Ze}shouldGetKeyboardEvents(){return this.#ti}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:t,left:e,bottom:i,right:n}=this.getClientDimensions(),{innerHeight:r,innerWidth:s}=window;return e<s&&n>0&&t<r&&i>0}#bi(){if(this.#qe||!this.div)return;this.#qe=new AbortController;const t=this._uiManager.combinedSignal(this.#qe);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}rebuild(){this.#bi()}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){const n=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});n.rotation=t.rotation,n.#je=t.accessibilityData,n._isCopy=t.isCopy||!1;const[r,s]=n.pageDimensions,[a,o,l,h]=n.getRectInCurrentCoords(t.rect,s);return n.x=a/r,n.y=o/s,n.width=l/r,n.height=h/s,n}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){if(this.#qe?.abort(),this.#qe=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),this.#ei&&(clearTimeout(this.#ei),this.#ei=null),this.#li(),this.removeEditToolbar(),this.#ri){for(const t of this.#ri.values())clearTimeout(t);this.#ri=null}this.parent=null,this.#si?.destroy(),this.#si=null,this.#Xe?.remove(),this.#Xe=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#ui(),this.#$e.classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return"ltr"===this._uiManager.direction?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[t,e]}=this,[i,n,r,s]=this.getPDFRect();return[pe._round(i+(r-i)*t),pe._round(n+(s-n)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#f.commentPopupPositionInLayer}set commentPopupPosition(t){this.#f.commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return this.#f.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#f.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){this.#f?.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),this.#Ge={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const e=this.#$e.children;if(!this.#Ue){this.#Ue=Array.from(e);const t=this.#Ei.bind(this),i=this.#Ci.bind(this),n=this._uiManager._signal;for(const e of this.#Ue){const r=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t,{signal:n}),e.addEventListener("blur",i,{signal:n}),e.addEventListener("focus",this.#Si.bind(this,r),{signal:n}),e.setAttribute("data-l10n-id",pe._l10nResizer[r])}}const i=this.#Ue[0];let n=0;for(const t of e){if(t===i)break;n++}const r=(360-this.rotation+this.parentRotation)%360/90*(this.#Ue.length/4);if(r!==n){if(r<n)for(let t=0;t<n-r;t++)this.#$e.append(this.#$e.firstElementChild);else if(r>n)for(let t=0;t<r-n;t++)this.#$e.firstElementChild.before(this.#$e.lastElementChild);let t=0;for(const i of e){const e=this.#Ue[t++].getAttribute("data-resizer-name");i.setAttribute("data-l10n-id",pe._l10nResizer[e])}}this.#_i(0),this.#ti=!0,this.#$e.firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#Ei(t){pe._resizerKeyboardManager.exec(this,t)}#Ci(t){this.#ti&&t.relatedTarget?.parentNode!==this.#$e&&this.#li()}#Si(t){this.#Ye=this.#ti?t:""}#_i(t){if(this.#Ue)for(const e of this.#Ue)e.tabIndex=t}_resizeWithKeyboard(t,e){this.#ti&&this.#gi(this.#Ye,{deltaX:t,deltaY:e,fromKeyboard:!0})}#li(){this.#ti=!1,this.#_i(-1),this.#fi()}_stopResizingWithKeyboard(){this.#li(),this.div.focus()}select(){this.isSelected&&this._editToolbar?this._editToolbar.show():(this.isSelected=!0,this.makeResizable(),this.div?.classList.add("selectedEditor"),this._editToolbar?(this._editToolbar?.show(),this.#g?.toggleAltTextBadge(!1)):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.#$e?.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.#Qe}set isEditing(t){this.#Qe=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.#ri||=new Map;const{action:e}=t;let i=this.#ri.get(e);return i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),this.#ri.delete(e),0===this.#ri.size&&(this.#ri=null)},pe._telemetryTimeout),void this.#ri.set(e,i)}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#ze=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#ze=!0}updateFakeAnnotationElement(t){if(this.#Xe||this.deleted)return this.deleted?(this.#Xe.remove(),void(this.#Xe=null)):void((this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&this.#Xe.updateEdited({rect:this.getPDFRect(),popup:this.comment}));this.#Xe=t.addFakeAnnotation(this)}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){const t=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.before(e)}}else e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){const{firstElementChild:e}=t.container;"DIV"===e?.nodeName&&e.classList.contains("annotationContent")&&e.remove()}}class ge extends pe{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const fe=3285377520,me=4294901760,be=65535;class ve{constructor(t){this.h1=t?4294967295&t:fe,this.h2=t?4294967295&t:fe}update(t){let e,i;if("string"==typeof t){e=new Uint8Array(2*t.length),i=0;for(let n=0,r=t.length;n<r;n++){const r=t.charCodeAt(n);r<=255?e[i++]=r:(e[i++]=r>>>8,e[i++]=255&r)}}else{if(!ArrayBuffer.isView(t))throw new Error("Invalid data format, must be a string or TypedArray.");e=t.slice(),i=e.byteLength}const n=i>>2,r=i-4*n,s=new Uint32Array(e.buffer,0,n);let a=0,o=0,l=this.h1,h=this.h2;const c=3432918353,d=461845907,u=11601,p=13715;for(let t=0;t<n;t++)1&t?(a=s[t],a=a*c&me|a*u&be,a=a<<15|a>>>17,a=a*d&me|a*p&be,l^=a,l=l<<13|l>>>19,l=5*l+3864292196):(o=s[t],o=o*c&me|o*u&be,o=o<<15|o>>>17,o=o*d&me|o*p&be,h^=o,h=h<<13|h>>>19,h=5*h+3864292196);switch(a=0,r){case 3:a^=e[4*n+2]<<16;case 2:a^=e[4*n+1]<<8;case 1:a^=e[4*n],a=a*c&me|a*u&be,a=a<<15|a>>>17,a=a*d&me|a*p&be,1&n?l^=a:h^=a}this.h1=l,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=3981806797*t&me|36045*t&be,e=4283543511*e&me|(2950163797*(e<<16|t>>>16)&me)>>>16,t^=e>>>1,t=444984403*t&me|60499*t&be,e=3301882366*e&me|(3120437893*(e<<16|t>>>16)&me)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const ye=Object.freeze({map:null,hash:"",transfer:void 0});class we{#Ti=!1;#Pi=null;#Di=null;#Mi=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const i=this.#Mi.get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return this.#Mi.get(t)}remove(t){const e=this.#Mi.get(t);if(void 0!==e&&(e instanceof pe&&this.#Di.delete(e.annotationElementId),this.#Mi.delete(t),0===this.#Mi.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor)){for(const t of this.#Mi.values())if(t instanceof pe)return;this.onAnnotationEditor(null)}}setValue(t,e){const i=this.#Mi.get(t);let n=!1;if(void 0!==i)for(const[t,r]of Object.entries(e))i[t]!==r&&(n=!0,i[t]=r);else n=!0,this.#Mi.set(t,e);n&&this.#Fi(),e instanceof pe&&((this.#Di||=new Map).set(e.annotationElementId,e),"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type))}has(t){return this.#Mi.has(t)}get size(){return this.#Mi.size}#Fi(){this.#Ti||(this.#Ti=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#Ti&&(this.#Ti=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new Ae(this)}get serializable(){if(0===this.#Mi.size)return ye;const t=new Map,e=new ve,i=[],n=Object.create(null);let r=!1;for(const[i,s]of this.#Mi){const a=s instanceof pe?s.serialize(!1,n):s;s.page&&(s.pageIndex=s.page._pageIndex,delete s.page),a&&(t.set(i,a),e.update(`${i}:${JSON.stringify(a)}`),r||=!!a.bitmap)}if(r)for(const e of t.values())e.bitmap&&i.push(e.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:ye}get editorStats(){let t=null;const e=new Map;let i=0,n=0;for(const r of this.#Mi.values()){if(!(r instanceof pe)){r.popup&&(r.popup.deleted?n+=1:i+=1);continue}r.isCommentDeleted?n+=1:r.hasEditedComment&&(i+=1);const s=r.telemetryFinalData;if(!s)continue;const{type:a}=s;e.has(a)||e.set(a,Object.getPrototypeOf(r).constructor),t||=Object.create(null);const o=t[a]||=new Map;for(const[t,e]of Object.entries(s)){if("type"===t)continue;let i=o.get(t);i||(i=new Map,o.set(t,i));const n=i.get(e)??0;i.set(e,n+1)}}if((n>0||i>0)&&(t||=Object.create(null),t.comments={deleted:n,edited:i}),!t)return null;for(const[i,n]of e)t[i]=n.computeTelemetryFinalData(t[i]);return t}resetModifiedIds(){this.#Pi=null}updateEditor(t,e){const i=this.#Di?.get(t);return!!i&&(i.updateFromAnnotationLayer(e),!0)}getEditor(t){return this.#Di?.get(t)||null}get modifiedIds(){if(this.#Pi)return this.#Pi;const t=[];if(this.#Di)for(const e of this.#Di.values())e.serialize()&&t.push(e.annotationElementId);return this.#Pi={ids:new Set(t),hash:t.join(",")}}[Symbol.iterator](){return this.#Mi.entries()}}class Ae extends we{#Ii;constructor(t){super();const{map:e,hash:i,transfer:n}=t.serializable,r=structuredClone(e,n?{transfer:n}:null);this.#Ii={map:r,hash:i,transfer:n}}get print(){J("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#Ii}get modifiedIds(){return et(this,"modifiedIds",{ids:new Set,hash:""})}}class xe{#ki=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));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),this.#ki.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:i}){if(t&&!this.#ki.has(t.loadedName)){if(Q(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:e,src:n,style:r}=t,s=new FontFace(e,n,r);this.addNativeFontFace(s);try{await s.load(),this.#ki.add(e),i?.(t)}catch{K(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(s)}return}J("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){const e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(i){throw K(`Failed to load font '${e.family}': '${i}'.`),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(e=>{const i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){return et(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){return et(this,"isSyncFontLoadingSupported",o||ct.platform.isFirefox)}_queueLoadingCallback(t){const{loadingRequests:e}=this,i={done:!1,complete:function(){for(Q(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;){const t=e.shift();setTimeout(t.callback,0)}},callback:t};return e.push(i),i}get _loadTestFont(){return et(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){function i(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function n(t,e,i,n){return t.substring(0,e)+n+t.substring(e+i)}let r,s;const a=this._document.createElement("canvas");a.width=1,a.height=1;const o=a.getContext("2d");let l=0;const h=`lt${Date.now()}${this.loadTestFontId++}`;let c=this._loadTestFont;c=n(c,976,h.length,h);const d=1482184792;let u=i(c,16);for(r=0,s=h.length-3;r<s;r+=4)u=u-d+i(h,r)|0;var p;r<h.length&&(u=u-d+i(h+"XXX",r)|0),c=n(c,16,4,(p=u,String.fromCharCode(p>>24&255,p>>16&255,p>>8&255,255&p)));const g=`@font-face {font-family:"${h}";src:${`url(data:font/opentype;base64,${btoa(c)});`}}`;this.insertRule(g);const f=this._document.createElement("div");f.style.visibility="hidden",f.style.width=f.style.height="10px",f.style.position="absolute",f.style.top=f.style.left="0px";for(const e of[t.loadedName,h]){const t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=e,f.append(t)}this._document.body.append(f),function t(e,i){if(++l>30)return K("Load test font never loaded."),void i();o.font="30px "+e,o.fillText(".",0,20),o.getImageData(0,0,1,1).data[3]>0?i():setTimeout(t.bind(null,e,i))}(h,()=>{f.remove(),e.complete()})}}class Ee{#Li;constructor(t,e=null,i,n){this.compiledGlyphs=Object.create(null),this.#Li=t,this._inspectFont=e,i&&Object.assign(this,i),n&&(this.charProcOperatorList=n)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(this.cssFontInfo){const 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(){if(!this.data||this.disableFontFace)return null;const t=`url(data:${this.mimetype};base64,${this.data.toBase64()});`;let e;if(this.cssFontInfo){let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${t}}`}else e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;return this._inspectFont?.(this,t),e}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];const i=this.loadedName+"_path_"+e;let n;try{n=t.get(i)}catch(t){K(`getPathGenerator - ignoring character: "${t}".`)}const r=Qt(n?.path);return this.fontExtraProperties||t.delete(i),this.compiledGlyphs[e]=r}get black(){return this.#Li.black}get bold(){return this.#Li.bold}get disableFontFace(){return this.#Li.disableFontFace??!1}set disableFontFace(t){et(this,"disableFontFace",!!t)}get fontExtraProperties(){return this.#Li.fontExtraProperties??!1}get isInvalidPDFjsFont(){return this.#Li.isInvalidPDFjsFont}get isType3Font(){return this.#Li.isType3Font}get italic(){return this.#Li.italic}get missingFile(){return this.#Li.missingFile}get remeasure(){return this.#Li.remeasure}get vertical(){return this.#Li.vertical}get ascent(){return this.#Li.ascent}get defaultWidth(){return this.#Li.defaultWidth}get descent(){return this.#Li.descent}get bbox(){return this.#Li.bbox}set bbox(t){et(this,"bbox",t)}get fontMatrix(){return this.#Li.fontMatrix}get fallbackName(){return this.#Li.fallbackName}get loadedName(){return this.#Li.loadedName}get mimetype(){return this.#Li.mimetype}get name(){return this.#Li.name}get data(){return this.#Li.data}clearData(){this.#Li.clearData()}get cssFontInfo(){return this.#Li.cssFontInfo}get systemFontInfo(){return this.#Li.systemFontInfo}get defaultVMetrics(){return this.#Li.defaultVMetrics}}class Ce{#Ri;#Bi;#Ni;static strings=["fontFamily","fontWeight","italicAngle"];static write(t){const e=new TextEncoder,i={};let n=0;for(const r of Ce.strings){const s=e.encode(t[r]);i[r]=s,n+=4+s.length}const r=new ArrayBuffer(n),s=new Uint8Array(r),a=new DataView(r);let o=0;for(const t of Ce.strings){const e=i[t],n=e.length;a.setUint32(o,n),s.set(e,o+4),o+=4+n}return Q(o===r.byteLength,"CssFontInfo.write: Buffer overflow"),r}constructor(t){this.#Ri=t,this.#Bi=new DataView(this.#Ri),this.#Ni=new TextDecoder}#Oi(t){Q(t<Ce.strings.length,"Invalid string index");let e=0;for(let i=0;i<t;i++)e+=this.#Bi.getUint32(e)+4;const i=this.#Bi.getUint32(e);return this.#Ni.decode(new Uint8Array(this.#Ri,e+4,i))}get fontFamily(){return this.#Oi(0)}get fontWeight(){return this.#Oi(1)}get italicAngle(){return this.#Oi(2)}}class Se{#Ri;#Bi;#Ni;static strings=["css","loadedName","baseFontName","src"];static write(t){const e=new TextEncoder,i={};let n=0;for(const r of Se.strings){const s=e.encode(t[r]);i[r]=s,n+=4+s.length}n+=4;let r,s,a=1+n;t.style&&(r=e.encode(t.style.style),s=e.encode(t.style.weight),a+=4+r.length+4+s.length);const o=new ArrayBuffer(a),l=new Uint8Array(o),h=new DataView(o);let c=0;h.setUint8(c++,t.guessFallback?1:0),h.setUint32(c,0),c+=4,n=0;for(const t of Se.strings){const e=i[t],r=e.length;n+=4+r,h.setUint32(c,r),l.set(e,c+4),c+=4+r}return h.setUint32(c-n-4,n),t.style&&(h.setUint32(c,r.length),l.set(r,c+4),c+=4+r.length,h.setUint32(c,s.length),l.set(s,c+4),c+=4+s.length),Q(c<=o.byteLength,"SubstitionInfo.write: Buffer overflow"),o.transferToFixedLength(c)}constructor(t){this.#Ri=t,this.#Bi=new DataView(this.#Ri),this.#Ni=new TextDecoder}get guessFallback(){return 0!==this.#Bi.getUint8(0)}#Oi(t){Q(t<Se.strings.length,"Invalid string index");let e=5;for(let i=0;i<t;i++)e+=this.#Bi.getUint32(e)+4;const i=this.#Bi.getUint32(e);return this.#Ni.decode(new Uint8Array(this.#Ri,e+4,i))}get css(){return this.#Oi(0)}get loadedName(){return this.#Oi(1)}get baseFontName(){return this.#Oi(2)}get src(){return this.#Oi(3)}get style(){let t=1;t+=4+this.#Bi.getUint32(t);const e=this.#Bi.getUint32(t),i=this.#Ni.decode(new Uint8Array(this.#Ri,t+4,e));t+=4+e;const n=this.#Bi.getUint32(t);return{style:i,weight:this.#Ni.decode(new Uint8Array(this.#Ri,t+4,n))}}}class _e{static bools=["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"];static numbers=["ascent","defaultWidth","descent"];static strings=["fallbackName","loadedName","mimetype","name"];static#ji=Math.ceil(2*this.bools.length/8);static#Ui=this.#ji+8*this.numbers.length;static#zi=this.#Ui+1+8;static#Hi=this.#zi+1+48;static#Vi=this.#Hi+1+6;#Ri;#Ni;#Bi;constructor({data:t,extra:e}){this.#Ri=t,this.#Ni=new TextDecoder,this.#Bi=new DataView(this.#Ri),e&&Object.assign(this,e)}#$i(t){Q(t<_e.bools.length,"Invalid boolean index");const e=Math.floor(t/4),i=2*t%8,n=this.#Bi.getUint8(e)>>i&3;return 0===n?void 0:2===n}get black(){return this.#$i(0)}get bold(){return this.#$i(1)}get disableFontFace(){return this.#$i(2)}get fontExtraProperties(){return this.#$i(3)}get isInvalidPDFjsFont(){return this.#$i(4)}get isType3Font(){return this.#$i(5)}get italic(){return this.#$i(6)}get missingFile(){return this.#$i(7)}get remeasure(){return this.#$i(8)}get vertical(){return this.#$i(9)}#Wi(t){return Q(t<_e.numbers.length,"Invalid number index"),this.#Bi.getFloat64(_e.#ji+8*t)}get ascent(){return this.#Wi(0)}get defaultWidth(){return this.#Wi(1)}get descent(){return this.#Wi(2)}get bbox(){let t=_e.#Ui;if(0===this.#Bi.getUint8(t))return;t+=1;const e=[];for(let i=0;i<4;i++)e.push(this.#Bi.getInt16(t,!0)),t+=2;return e}get fontMatrix(){let t=_e.#zi;if(0===this.#Bi.getUint8(t))return;t+=1;const e=[];for(let i=0;i<6;i++)e.push(this.#Bi.getFloat64(t,!0)),t+=8;return e}get defaultVMetrics(){let t=_e.#Hi;if(0===this.#Bi.getUint8(t))return;t+=1;const e=[];for(let i=0;i<3;i++)e.push(this.#Bi.getInt16(t,!0)),t+=2;return e}#Oi(t){Q(t<_e.strings.length,"Invalid string index");let e=_e.#Vi+4;for(let i=0;i<t;i++)e+=this.#Bi.getUint32(e)+4;const i=this.#Bi.getUint32(e),n=new Uint8Array(i);return n.set(new Uint8Array(this.#Ri,e+4,i)),this.#Ni.decode(n)}get fallbackName(){return this.#Oi(0)}get loadedName(){return this.#Oi(1)}get mimetype(){return this.#Oi(2)}get name(){return this.#Oi(3)}get data(){let t=_e.#Vi;t+=4+this.#Bi.getUint32(t);t+=4+this.#Bi.getUint32(t);t+=4+this.#Bi.getUint32(t);const e=this.#Bi.getUint32(t);if(0!==e)return new Uint8Array(this.#Ri,t+4,e)}clearData(){let t=_e.#Vi;t+=4+this.#Bi.getUint32(t);t+=4+this.#Bi.getUint32(t);t+=4+this.#Bi.getUint32(t);const e=this.#Bi.getUint32(t);new Uint8Array(this.#Ri,t+4,e).fill(0),this.#Bi.setUint32(t,0)}get cssFontInfo(){let t=_e.#Vi;t+=4+this.#Bi.getUint32(t);t+=4+this.#Bi.getUint32(t);const e=this.#Bi.getUint32(t);if(0===e)return null;const i=new Uint8Array(e);return i.set(new Uint8Array(this.#Ri,t+4,e)),new Ce(i.buffer)}get systemFontInfo(){let t=_e.#Vi;t+=4+this.#Bi.getUint32(t);const e=this.#Bi.getUint32(t);if(0===e)return null;const i=new Uint8Array(e);return i.set(new Uint8Array(this.#Ri,t+4,e)),new Se(i.buffer)}static write(t){const e=t.systemFontInfo?Se.write(t.systemFontInfo):null,i=t.cssFontInfo?Ce.write(t.cssFontInfo):null,n=new TextEncoder,r={};let s=0;for(const e of _e.strings)r[e]=n.encode(t[e]),s+=4+r[e].length;const a=_e.#Vi+4+s+4+(e?e.byteLength:0)+4+(i?i.byteLength:0)+4+(t.data?t.data.length:0),o=new ArrayBuffer(a),l=new Uint8Array(o),h=new DataView(o);let c=0;const d=_e.bools.length;let u=0,p=0;for(let e=0;e<d;e++){const i=t[_e.bools[e]];u|=(void 0===i?0:i?2:1)<<p,p+=2,8!==p&&e!==d-1||(h.setUint8(c++,u),u=0,p=0)}Q(c===_e.#ji,"FontInfo.write: Boolean properties offset mismatch");for(const e of _e.numbers)h.setFloat64(c,t[e]),c+=8;if(Q(c===_e.#Ui,"FontInfo.write: Number properties offset mismatch"),t.bbox){h.setUint8(c++,4);for(const e of t.bbox)h.setInt16(c,e,!0),c+=2}else h.setUint8(c++,0),c+=8;if(Q(c===_e.#zi,"FontInfo.write: BBox properties offset mismatch"),t.fontMatrix){h.setUint8(c++,6);for(const e of t.fontMatrix)h.setFloat64(c,e,!0),c+=8}else h.setUint8(c++,0),c+=48;if(Q(c===_e.#Hi,"FontInfo.write: FontMatrix properties offset mismatch"),t.defaultVMetrics){h.setUint8(c++,1);for(const e of t.defaultVMetrics)h.setInt16(c,e,!0),c+=2}else h.setUint8(c++,0),c+=6;Q(c===_e.#Vi,"FontInfo.write: DefaultVMetrics properties offset mismatch"),h.setUint32(_e.#Vi,0),c+=4;for(const t of _e.strings){const e=r[t],i=e.length;h.setUint32(c,i),l.set(e,c+4),c+=4+i}if(h.setUint32(_e.#Vi,c-_e.#Vi-4),e){const t=e.byteLength;h.setUint32(c,t),Q(c+4+t<=o.byteLength,"FontInfo.write: Buffer overflow at systemFontInfo"),l.set(new Uint8Array(e),c+4),c+=4+t}else h.setUint32(c,0),c+=4;if(i){const t=i.byteLength;h.setUint32(c,t),Q(c+4+t<=o.byteLength,"FontInfo.write: Buffer overflow at cssFontInfo"),l.set(new Uint8Array(i),c+4),c+=4+t}else h.setUint32(c,0),c+=4;return void 0===t.data?(h.setUint32(c,0),c+=4):(h.setUint32(c,t.data.length),l.set(t.data,c+4),c+=4+t.data.length),Q(c<=o.byteLength,"FontInfo.write: Buffer overflow"),o.transferTo
2FixedLength(c)}}class Te{static#Gi=0;static#Xi=1;static#qi=2;static#Yi=3;static#Ki=4;static#Ji=8;static#Qi=12;static#Zi=16;constructor(t){this.buffer=t,this.view=new DataView(t),this.data=new Uint8Array(t)}static write(t){let e,i=null,n=[],r=[],s=[],a=[],o=null,l=null;switch(t[0]){case"RadialAxial":e="axial"===t[1]?1:2,i=t[2],s=t[3],1===e?n.push(...t[4],...t[5]):n.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],n=t[2],r=t[3],a=t[4]||[],i=t[6],l=t[7];break;default:throw new Error(`Unsupported pattern type: ${t[0]}`)}const h=Math.floor(n.length/2),c=Math.floor(r.length/3),d=s.length,u=a.length;let p=0;for(const t of a)p+=1,p=4*Math.ceil(p/4),p+=4+4*t.coords.length,p+=4+4*t.colors.length,void 0!==t.verticesPerRow&&(p+=4);const g=new ArrayBuffer(20+8*h+3*c+8*d+(i?16:0)+(l?3:0)+p),f=new DataView(g),m=new Uint8Array(g);f.setUint8(Te.#Gi,e),f.setUint8(Te.#Xi,i?1:0),f.setUint8(Te.#qi,l?1:0),f.setUint8(Te.#Yi,o),f.setUint32(Te.#Ki,h,!0),f.setUint32(Te.#Ji,c,!0),f.setUint32(Te.#Qi,d,!0),f.setUint32(Te.#Zi,u,!0);let b=20;new Float32Array(g,b,2*h).set(n),b+=8*h,m.set(r,b),b+=3*c;for(const[t,e]of s)f.setFloat32(b,t,!0),b+=4,f.setUint32(b,parseInt(e.slice(1),16),!0),b+=4;if(i)for(const t of i)f.setFloat32(b,t,!0),b+=4;l&&(m.set(l,b),b+=3);for(let t=0;t<a.length;t++){const e=a[t];f.setUint8(b,e.type),b+=1,b=4*Math.ceil(b/4),f.setUint32(b,e.coords.length,!0),b+=4;new Int32Array(g,b,e.coords.length).set(e.coords),b+=4*e.coords.length,f.setUint32(b,e.colors.length,!0),b+=4;new Int32Array(g,b,e.colors.length).set(e.colors),b+=4*e.colors.length,void 0!==e.verticesPerRow&&(f.setUint32(b,e.verticesPerRow,!0),b+=4)}return g}getIR(){const t=this.view,e=this.data[Te.#Gi],i=!!this.data[Te.#Xi],n=!!this.data[Te.#qi],r=t.getUint32(Te.#Ki,!0),s=t.getUint32(Te.#Ji,!0),a=t.getUint32(Te.#Qi,!0),o=t.getUint32(Te.#Zi,!0);let l=20;const h=new Float32Array(this.buffer,l,2*r);l+=8*r;const c=new Uint8Array(this.buffer,l,3*s);l+=3*s;const d=[];for(let e=0;e<a;++e){const e=t.getFloat32(l,!0);l+=4;const i=t.getUint32(l,!0);l+=4,d.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;n&&(p=new Uint8Array(this.buffer,l,3),l+=3);const g=[];for(let e=0;e<o;++e){const e=t.getUint8(l);l+=1,l=4*Math.ceil(l/4);const i=t.getUint32(l,!0);l+=4;const n=new Int32Array(this.buffer,l,i);l+=4*i;const r=t.getUint32(l,!0);l+=4;const s=new Int32Array(this.buffer,l,r);l+=4*r;const a={type:e,coords:n,colors:s};e===C&&(a.verticesPerRow=t.getUint32(l,!0),l+=4),g.push(a)}if(1===e)return["RadialAxial","axial",u,d,Array.from(h.slice(0,2)),Array.from(h.slice(2,4)),null,null];if(2===e)return["RadialAxial","radial",u,d,[h[0],h[1]],[h[3],h[4]],h[2],h[5]];if(3===e){const t=this.data[Te.#Yi];let e=null;if(h.length>0){let t=h[0],i=h[0],n=h[1],r=h[1];for(let e=0;e<h.length;e+=2){const s=h[e],a=h[e+1];t=t>s?s:t,n=n>a?a:n,i=i<s?s:i,r=r<a?a:r}e=[t,n,i,r]}return["Mesh",t,h,c,g,e,u,p]}throw new Error(`Unsupported pattern kind: ${e}`)}}class Pe{static write(t){let e,i;return ct.isFloat16ArraySupported?(i=new ArrayBuffer(2*t.length),e=new Float16Array(i)):(i=new ArrayBuffer(4*t.length),e=new Float32Array(i)),e.set(t),i}#Ri;constructor(t){this.#Ri=t}get path(){return ct.isFloat16ArraySupported?new Float16Array(this.#Ri):new Float32Array(this.#Ri)}}function De(t){if("string"!=typeof t)return null;if(t.endsWith("/"))return t;throw new Error(`Invalid factory url: "${t}" must include trailing slash.`)}const Me=t=>"object"==typeof t&&Number.isInteger(t?.num)&&t.num>=0&&Number.isInteger(t?.gen)&&t.gen>=0,Fe=function(t,e,i){if(!Array.isArray(i)||i.length<2)return!1;const[n,r,...s]=i;if(!t(n)&&!Number.isInteger(n))return!1;if(!e(r))return!1;const a=s.length;let o=!0;switch(r.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(const t of s)if(!("number"==typeof t||o&&null===t))return!1;return!0}.bind(null,Me,t=>"object"==typeof t&&"string"==typeof t?.name);class Ie{#o=new Map;#tn=Promise.resolve();postMessage(t,e){const i={data:structuredClone(t,e?{transfer:e}:null)};this.#tn.then(()=>{for(const[t]of this.#o)t.call(this,i)})}addEventListener(t,e,i=null){let n=null;if(i?.signal instanceof AbortSignal){const{signal:r}=i;if(r.aborted)return void K("LoopbackPort - cannot use an `aborted` signal.");const s=()=>this.removeEventListener(t,e);n=()=>r.removeEventListener("abort",s),r.addEventListener("abort",s)}this.#o.set(e,n)}removeEventListener(t,e){const i=this.#o.get(e);i?.(),this.#o.delete(e)}terminate(){for(const[,t]of this.#o)t?.();this.#o.clear()}}a(1689);const ke=1,Le=2,Re=1,Be=2,Ne=3,Oe=4,je=5,Ue=6,ze=7,He=8;function Ve(){}function $e(t){if(t instanceof lt||t instanceof st||t instanceof nt||t instanceof at||t instanceof rt)return t;switch(t instanceof Error||"object"==typeof t&&null!==t||J('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new lt(t.message);case"InvalidPDFException":return new st(t.message);case"PasswordException":return new nt(t.message,t.code);case"ResponseException":return new at(t.message,t.status,t.missing);case"UnknownErrorException":return new rt(t.message,t.details)}return new rt(t.message,t.toString())}class We{#en=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.#en.signal})}#in({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream)return void this.#nn(t);if(t.callback){const e=t.callbackId,i=this.callbackCapabilities[e];if(!i)throw new Error(`Cannot resolve callback ${e}`);if(delete this.callbackCapabilities[e],t.callback===ke)i.resolve(t.data);else{if(t.callback!==Le)throw new Error("Unexpected callback case");i.reject($e(t.reason))}return}const e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const i=this.sourceName,n=t.sourceName,r=this.comObj;return void Promise.try(e,t.data).then(function(e){r.postMessage({sourceName:i,targetName:n,callback:ke,callbackId:t.callbackId,data:e})},function(e){r.postMessage({sourceName:i,targetName:n,callback:Le,callbackId:t.callbackId,reason:$e(e)}
vendor: 20,530 bytes, line 2
2)})}t.streamId?this.#rn(t):e(t.data)}on(t,e){const i=this.actionHandler;if(i[t])throw new 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)}sendWithPromise(t,e,i){const n=this.callbackId++,r=Promise.withResolvers();this.callbackCapabilities[n]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:n,data:e},i)}catch(t){r.reject(t)}return r.promise}sendWithStream(t,e,i,n){const r=this.streamId++,s=this.sourceName,a=this.targetName,o=this.comObj;return new ReadableStream({start:i=>{const l=Promise.withResolvers();return this.streamControllers[r]={controller:i,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},o.postMessage({sourceName:s,targetName:a,action:t,streamId:r,data:e,desiredSize:i.desiredSize},n),l.promise},pull:t=>{const e=Promise.withResolvers();return this.streamControllers[r].pullCall=e,o.postMessage({sourceName:s,targetName:a,stream:Ue,streamId:r,desiredSize:t.desiredSize}),e.promise},cancel:t=>{Q(t instanceof Error,"cancel must have a valid reason");const e=Promise.withResolvers();return this.streamControllers[r].cancelCall=e,this.streamControllers[r].isClosed=!0,o.postMessage({sourceName:s,targetName:a,stream:Re,streamId:r,reason:$e(t)}),e.promise}},i)}#rn(t){const e=t.streamId,i=this.sourceName,n=t.sourceName,r=this.comObj,s=this,a=this.actionHandler[t.action],o={enqueue(t,s=1,a){if(this.isCancelled)return;const o=this.desiredSize;this.desiredSize-=s,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),r.postMessage({sourceName:i,targetName:n,stream:Oe,streamId:e,chunk:t},a)},close(){this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:i,targetName:n,stream:Ne,streamId:e}),delete s.streamSinks[e])},error(t){Q(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:i,targetName:n,stream:je,streamId:e,reason:$e(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(){r.postMessage({sourceName:i,targetName:n,stream:He,streamId:e,success:!0})},function(t){r.postMessage({sourceName:i,targetName:n,stream:He,streamId:e,reason:$e(t)})})}#nn(t){const e=t.streamId,i=this.sourceName,n=t.sourceName,r=this.comObj,s=this.streamControllers[e],a=this.streamSinks[e];switch(t.stream){case He:t.success?s.startCall.resolve():s.startCall.reject($e(t.reason));break;case ze:t.success?s.pullCall.resolve():s.pullCall.reject($e(t.reason));break;case Ue:if(!a){r.postMessage({sourceName:i,targetName:n,stream:ze,streamId:e,success:!0});break}a.desiredSize<=0&&t.desiredSize>0&&a.sinkCapability.resolve(),a.desiredSize=t.desiredSize,Promise.try(a.onPull||Ve).then(function(){r.postMessage({sourceName:i,targetName:n,stream:ze,streamId:e,success:!0})},function(t){r.postMessage({sourceName:i,targetName:n,stream:ze,streamId:e,reason:$e(t)})});break;case Oe:if(Q(s,"enqueue should have stream controller"),s.isClosed)break;s.controller.enqueue(t.chunk);break;case Ne:if(Q(s,"close should have stream controller"),s.isClosed)break;s.isClosed=!0,s.controller.close(),this.#sn(s,e);break;case je:Q(s,"error should have stream controller"),s.controller.error($e(t.reason)),this.#sn(s,e);break;case Be:t.success?s.cancelCall.resolve():s.cancelCall.reject($e(t.reason)),this.#sn(s,e);break;case Re:if(!a)break;const o=$e(t.reason);Promise.try(a.onCancel||Ve,o).then(function(){r.postMessage({sourceName:i,targetName:n,stream:Be,streamId:e,success:!0})},function(t){r.postMessage({sourceName:i,targetName:n,stream:Be,streamId:e,reason:$e(t)})}),a.sinkCapability.reject(o),a.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async#sn(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.#en?.abort(),this.#en=null}}class Ge{#an=!1;constructor({enableHWA:t=!1}){this.#an=t}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!this.#an})}}reset(t,e,i){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){J("Abstract method `_createCanvas` called.")}}class Xe extends Ge{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}}class qe{constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!t)throw new Error("CMap name must be specified.");const e=this.baseUrl+t+(this.isCompressed?".bcmap":"");return this._fetch(e).then(t=>({cMapData:t,isCompressed:this.isCompressed})).catch(t=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}async _fetch(t){J("Abstract method `_fetch` called.")}}class Ye extends qe{async _fetch(t){const e=await Et(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):ht(e)}}a(2489);class Ke{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,n,r){return"none"}destroy(t=!1){}}class Je extends Ke{#on;#ln;#hn;#cn;#dn;#un;#I=0;constructor({docId:t,ownerDocument:e=globalThis.document}){super(),this.#cn=t,this.#dn=e}get#L(){return this.#ln||=new Map}get#pn(){return this.#un||=new Map}get#gn(){if(!this.#hn){const t=this.#dn.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;const i=this.#dn.createElementNS(At,"svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#hn=this.#dn.createElementNS(At,"defs"),t.append(i),i.append(this.#hn),this.#dn.body.append(t)}return this.#hn}#fn(t){if(1===t.length){const e=t[0],i=new Array(256);for(let t=0;t<256;t++)i[t]=e[t]/255;const n=i.join(",");return[n,n,n]}const[e,i,n]=t,r=new Array(256),s=new Array(256),a=new Array(256);for(let t=0;t<256;t++)r[t]=e[t]/255,s[t]=i[t]/255,a[t]=n[t]/255;return[r.join(","),s.join(","),a.join(",")]}#mn(t){if(void 0===this.#on){this.#on="";const t=this.#dn.URL;t!==this.#dn.baseURI&&(_t(t)?K('#createUrl: ignore "data:"-URL for performance reasons.'):this.#on=tt(t,""))}return`url(${this.#on}#${t})`}addFilter(t){if(!t)return"none";let e=this.#L.get(t);if(e)return e;const[i,n,r]=this.#fn(t),s=1===t.length?i:`${i}${n}${r}`;if(e=this.#L.get(s),e)return this.#L.set(t,e),e;const a=`g_${this.#cn}_transfer_map_${this.#I++}`,o=this.#mn(a);this.#L.set(t,o),this.#L.set(s,o);const l=this.#bn(a);return this.#vn(i,n,r,l),o}addHCMFilter(t,e){const i=`${t}-${e}`,n="base";let r=this.#pn.get(n);if(r?.key===i)return r.url;if(r?(r.filter?.remove(),r.key=i,r.url="none",r.filter=null):(r={key:i,url:"none",filter:null},this.#pn.set(n,r)),!t||!e)return r.url;const s=this.#yn(t);t=ut.makeHexColor(...s);const a=this.#yn(e);if(e=ut.makeHexColor(...a),this.#gn.style.color="","#000000"===t&&"#ffffff"===e||t===e)return r.url;const o=new Array(256);for(let t=0;t<=255;t++){const e=t/255;o[t]=e<=.03928?e/12.92:((e+.055)/1.055)**2.4}const l=o.join(","),h=`g_${this.#cn}_hcm_filter`,c=r.filter=this.#bn(h);this.#vn(l,l,l,c),this.#wn(c);const d=(t,e)=>{const i=s[t]/255,n=a[t]/255,r=new Array(e+1);for(let t=0;t<=e;t++)r[t]=i+t/e*(n-i);return r.join(",")};return this.#vn(d(0,5),d(1,5),d(2,5),c),r.url=this.#mn(h),r.url}addAlphaFilter(t){let e=this.#L.get(t);if(e)return e;const[i]=this.#fn([t]),n=`alpha_${i}`;if(e=this.#L.get(n),e)return this.#L.set(t,e),e;const r=`g_${this.#cn}_alpha_map_${this.#I++}`,s=this.#mn(r);this.#L.set(t,s),this.#L.set(n,s);const a=this.#bn(r);return this.#An(i,a),s}addLuminosityFilter(t){let e,i,n=this.#L.get(t||"luminosity");if(n)return n;if(t?([e]=this.#fn([t]),i=`luminosity_${e}`):i="luminosity",n=this.#L.get(i),n)return this.#L.set(t,n),n;const r=`g_${this.#cn}_luminosity_map_${this.#I++}`,s=this.#mn(r);this.#L.set(t,s),this.#L.set(i,s);const a=this.#bn(r);return this.#xn(a),t&&this.#An(e,a),s}addHighlightHCMFilter(t,e,i,n,r){const s=`${e}-${i}-${n}-${r}`;let a=this.#pn.get(t);if(a?.key===s)return a.url;if(a?(a.filter?.remove(),a.key=s,a.url="none",a.filter=null):(a={key:s,url:"none",filter:null},this.#pn.set(t,a)),!e||!i)return a.url;const[o,l]=[e,i].map(this.#yn.bind(this));let h=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),c=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[d,u]=[n,r].map(this.#yn.bind(this));c<h&&([h,c,d,u]=[c,h,u,d]),this.#gn.style.color="";const p=(t,e,i)=>{const n=new Array(256),r=(c-h)/i,s=t/255,a=(e-t)/(255*i);let o=0;for(let t=0;t<=i;t++){const e=Math.round(h+t*r),i=s+t*a;for(let t=o;t<=e;t++)n[t]=i;o=e+1}for(let t=o;t<256;t++)n[t]=n[o-1];return n.join(",")},g=`g_${this.#cn}_hcm_${t}_filter`,f=a.filter=this.#bn(g);return this.#wn(f),this.#vn(p(d[0],u[0],5),p(d[1],u[1],5),p(d[2],u[2],5),f),a.url=this.#mn(g),a.url}destroy(t=!1){t&&this.#un?.size||(this.#hn?.parentNode.parentNode.remove(),this.#hn=null,this.#ln?.clear(),this.#ln=null,this.#un?.clear(),this.#un=null,this.#I=0)}#xn(t){const e=this.#dn.createElementNS(At,"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)}#wn(t){const e=this.#dn.createElementNS(At,"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)}#bn(t){const e=this.#dn.createElementNS(At,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),this.#gn.append(e),e}#En(t,e,i){const n=this.#dn.createElementNS(At,e);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),t.append(n)}#vn(t,e,i,n){const r=this.#dn.createElementNS(At,"feComponentTransfer");n.append(r),this.#En(r,"feFuncR",t),this.#En(r,"feFuncG",e),this.#En(r,"feFuncB",i)}#An(t,e){const i=this.#dn.createElementNS(At,"feComponentTransfer");e.append(i),this.#En(i,"feFuncA",t)}#yn(t){return this.#gn.style.color=t,Bt(getComputedStyle(this.#gn).getPropertyValue("color"))}}class Qe{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!t)throw new Error("Font filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetch(e).catch(t=>{throw new Error(`Unable to load font data at: ${e}`)})}async _fetch(t){J("Abstract method `_fetch` called.")}}class Ze extends Qe{async _fetch(t){const e=await Et(t,"arraybuffer");return new Uint8Array(e)}}class ti{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!t)throw new Error("Wasm filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetch(e).catch(t=>{throw new Error(`Unable to load wasm data at: ${e}`)})}async _fetch(t){J("Abstract method `_fetch` called.")}}class ei extends ti{async _fetch(t){const e=await Et(t,"arraybuffer");return new Uint8Array(e)}}if(o){let t;try{const e=process.getBuiltinModule("module").createRequire("file:///home/runner/work/uwazi/uwazi/node_modules/pdfjs-dist/legacy/build/pdf.mjs");try{t=e("@napi-rs/canvas")}catch(t){K(`Cannot load "@napi-rs/canvas" package: "${t}".`)}}catch(t){K(`Cannot access the \`require\` function: "${t}".`)}globalThis.DOMMatrix||(t?.DOMMatrix?globalThis.DOMMatrix=t.DOMMatrix:K("Cannot polyfill `DOMMatrix`, rendering may be broken.")),globalThis.ImageData||(t?.ImageData?globalThis.ImageData=t.ImageData:K("Cannot polyfill `ImageData`, rendering may be broken.")),globalThis.Path2D||(t?.Path2D?globalThis.Path2D=t.Path2D:K("Cannot polyfill `Path2D`, rendering may be broken.")),globalThis.navigator?.language||(globalThis.navigator={language:"en-US",platform:"",userAgent:""})}async function ii(t){const e=process.getBuiltinModule("fs"),i=await e.promises.readFile(t);return new Uint8Array(i)}class ni extends Ke{}class ri extends Ge{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire("file:///home/runner/work/uwazi/uwazi/node_modules/pdfjs-dist/legacy/build/pdf.mjs")("@napi-rs/canvas").createCanvas(t,e)}}class si extends qe{async _fetch(t){return ii(t)}}class ai extends Qe{async _fetch(t){return ii(t)}}class oi extends ti{async _fetch(t){return ii(t)}}a(7588);const li="__forcedDependency",{floor:hi,ceil:ci}=Math;function di(t,e,i,n,r,s){t[4*e+0]=Math.min(t[4*e+0],i),t[4*e+1]=Math.min(t[4*e+1],n),t[4*e+2]=Math.max(t[4*e+2],r),t[4*e+3]=Math.max(t[4*e+3],s)}const ui=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];class pi{#Cn;#Sn;constructor(t,e){this.#Cn=t,this.#Sn=e}get length(){return this.#Cn.length}isEmpty(t){return this.#Cn[t]===ui}minX(t){return this.#Sn[4*t+0]/256}minY(t){return this.#Sn[4*t+1]/256}maxX(t){return(this.#Sn[4*t+2]+1)/256}maxY(t){return(this.#Sn[4*t+3]+1)/256}}const gi=(t,e)=>{if(!t)return;let i=t.get(e);return i||(i={dependencies:new Set,isRenderingOperation:!1},t.set(e,i)),i};class fi{#_n={__proto__:null};#Tn={__proto__:null,transform:[],moveText:[],sameLineText:[],[li]:[]};#Pn=new Map;#Dn=[];#Mn=[];#Fn=[[1,0,0,1,0,0]];#In=[-1/0,-1/0,1/0,1/0];#kn=new Float64Array([1/0,1/0,-1/0,-1/0]);#Ln=-1;#Rn=new Set;#Bn=new Map;#Nn=new Map;#On;#jn;#Un;#Cn;#zn;constructor(t,e,i=!1){this.#On=t.width,this.#jn=t.height,this.#Hn(e),i&&(this.#zn=new Map)}growOperationsCount(t){t>=this.#Cn.length&&this.#Hn(t,this.#Cn)}#Hn(t,e){const i=new ArrayBuffer(4*t);this.#Un=new Uint8ClampedArray(i),this.#Cn=new Uint32Array(i),e&&e.length>0?(this.#Cn.set(e),this.#Cn.fill(ui,e.length)):this.#Cn.fill(ui)}save(t){return this.#_n={__proto__:this.#_n},this.#Tn={__proto__:this.#Tn,transform:{__proto__:this.#Tn.transform},moveText:{__proto__:this.#Tn.moveText},sameLineText:{__proto__:this.#Tn.sameLineText},[li]:{__proto__:this.#Tn[li]}},this.#In={__proto__:this.#In},this.#Dn.push(t),this}restore(t){const e=Object.getPrototypeOf(this.#_n);if(null===e)return this;this.#_n=e,this.#Tn=Object.getPrototypeOf(this.#Tn),this.#In=Object.getPrototypeOf(this.#In);const i=this.#Dn.pop();return void 0!==i&&(gi(this.#zn,t)?.dependencies.add(i),this.#Cn[t]=this.#Cn[i]),this}recordOpenMarker(t){return this.#Dn.push(t),this}getOpenMarker(){return 0===this.#Dn.length?null:this.#Dn.at(-1)}recordCloseMarker(t){const e=this.#Dn.pop();return void 0!==e&&(gi(this.#zn,t)?.dependencies.add(e),this.#Cn[t]=this.#Cn[e]),this}beginMarkedContent(t){return this.#Mn.push(t),this}endMarkedContent(t){const e=this.#Mn.pop();return void 0!==e&&(gi(this.#zn,t)?.dependencies.add(e),this.#Cn[t]=this.#Cn[e]),this}pushBaseTransform(t){return this.#Fn.push(ut.multiplyByDOMMatrix(this.#Fn.at(-1),t.getTransform())),this}popBaseTransform(){return this.#Fn.length>1&&this.#Fn.pop(),this}recordSimpleData(t,e){return this.#_n[t]=e,this}recordIncrementalData(t,e){return this.#Tn[t].push(e),this}resetIncrementalData(t,e){return this.#Tn[t].length=0,this}recordNamedData(t,e){return this.#Pn.set(t,e),this}recordSimpleDataFromNamed(t,e,i){this.#_n[t]=this.#Pn.get(e)??i}recordFutureForcedDependency(t,e){return this.recordIncrementalData(li,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(const e of t)e in this.#_n&&this.recordFutureForcedDependency(e,this.#_n[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const t of this.#Rn)this.recordFutureForcedDependency(li,t);return this}resetBBox(t){return this.#Ln!==t&&(this.#Ln=t,this.#kn[0]=1/0,this.#kn[1]=1/0,this.#kn[2]=-1/0,this.#kn[3]=-1/0),this}recordClipBox(t,e,i,n,r,s){const a=ut.multiplyByDOMMatrix(this.#Fn.at(-1),e.getTransform()),o=[1/0,1/0,-1/0,-1/0];ut.axialAlignedBoundingBox([i,r,n,s],a,o);const l=ut.intersect(this.#In,o);return l?(this.#In[0]=l[0],this.#In[1]=l[1],this.#In[2]=l[2],this.#In[3]=l[3]):(this.#In[0]=this.#In[1]=1/0,this.#In[2]=this.#In[3]=-1/0),this}recordBBox(t,e,i,n,r,s){const a=this.#In;if(a[0]===1/0)return this;const o=ut.multiplyByDOMMatrix(this.#Fn.at(-1),e.getTransform());if(a[0]===-1/0)return ut.axialAlignedBoundingBox([i,r,n,s],o,this.#kn),this;const l=[1/0,1/0,-1/0,-1/0];return ut.axialAlignedBoundingBox([i,r,n,s],o,l),this.#kn[0]=Math.min(this.#kn[0],Math.max(l[0],a[0])),this.#kn[1]=Math.min(this.#kn[1],Math.max(l[1],a[1])),this.#kn[2]=Math.max(this.#kn[2],Math.min(l[2],a[2])),this.#kn[3]=Math.max(this.#kn[3],Math.min(l[3],a[3])),this}recordCharacterBBox(t,e,i,n=1,r=0,s=0,a){const o=i.bbox;let l,h;if(o&&(l=o[2]!==o[0]&&o[3]!==o[1]&&this.#Nn.get(i),!1!==l&&(h=[0,0,0,0],ut.axialAlignedBoundingBox(o,i.fontMatrix,h),1===n&&0===r&&0===s||ut.scaleMinMax([n,0,0,-n,r,s],h),l)))return this.recordBBox(t,e,h[0],h[2],h[1],h[3]);if(!a)return this.recordFullPageBBox(t);const c=a();return o&&h&&void 0===l&&(l=h[0]<=r-c.actualBoundingBoxLeft&&h[2]>=r+c.actualBoundingBoxRight&&h[1]<=s-c.actualBoundingBoxAscent&&h[3]>=s+c.actualBoundingBoxDescent,this.#Nn.set(i,l),l)?this.recordBBox(t,e,h[0],h[2],h[1],h[3]):this.recordBBox(t,e,r-c.actualBoundingBoxLeft,r+c.actualBoundingBoxRight,s-c.actualBoundingBoxAscent,s+c.actualBoundingBoxDescent)}recordFullPageBBox(t){return this.#kn[0]=Math.max(0,this.#In[0]),this.#kn[1]=Math.max(0,this.#In[1]),this.#kn[2]=Math.min(this.#On,this.#In[2]),this.#kn[3]=Math.min(this.#jn,this.#In[3]),this}getSimpleIndex(t){return this.#_n[t]}recordDependencies(t,e){const i=this.#Rn,n=this.#_n,r=this.#Tn;for(const t of e)t in this.#_n?i.add(n[t]):t in r&&r[t].forEach(i.add,i);return this}recordNamedDependency(t,e){return this.#Pn.has(e)&&this.#Rn.add(this.#Pn.get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[li]),this.#zn){const e=gi(this.#zn,t),{dependencies:i}=e;this.#Rn.forEach(i.add,i),this.#Dn.forEach(i.add,i),this.#Mn.forEach(i.add,i),i.delete(t),e.isRenderingOperation=!0}if(this.#Ln===t){const i=hi(256*this.#kn[0]/this.#On),n=hi(256*this.#kn[1]/this.#jn),r=ci(256*this.#kn[2]/this.#On),s=ci(256*this.#kn[3]/this.#jn);di(this.#Un,t,i,n,r,s);for(const e of this.#Rn)e!==t&&di(this.#Un,e,i,n,r,s);for(const e of this.#Dn)e!==t&&di(this.#Un,e,i,n,r,s);for(const e of this.#Mn)e!==t&&di(this.#Un,e,i,n,r,s);e||(this.#Rn.clear(),this.#Ln=-1)}return this}recordShowTextOperation(t,e=!1){const i=Array.from(this.#Rn);this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(const t of i)this.recordIncrementalData("sameLineText",t);return this}bboxToClipBoxDropOperation(t,e=!1){return this.#Ln===t&&(this.#Ln=-1,this.#In[0]=Math.max(this.#In[0],this.#kn[0]),this.#In[1]=Math.max(this.#In[1],this.#kn[1]),this.#In[2]=Math.min(this.#In[2],this.#kn[2]),this.#In[3]=Math.min(this.#In[3],this.#kn[3]),e||this.#Rn.clear()),this}_takePendingDependencies(){const t=this.#Rn;return this.#Rn=new Set,t}_extractOperation(t){const e=this.#Bn.get(t);return this.#Bn.delete(t),e}_pushPendingDependencies(t){for(const e of t)this.#Rn.add(e)}take(){return this.#Nn.clear(),new pi(this.#Cn,this.#Un)}takeDebugMetadata(){return this.#zn}}class mi{#Vn;#$n;#Wn;#Gn=0;#Xn=0;constructor(t,e,i){if(t instanceof mi&&t.#Wn===!!i)return t;this.#Vn=t,this.#$n=e,this.#Wn=!!i}growOperationsCount(){throw new Error("Unreachable")}save(t){return this.#Xn++,this.#Vn.save(this.#$n),this}restore(t){return this.#Xn>0&&(this.#Vn.restore(this.#$n),this.#Xn--),this}recordOpenMarker(t){return this.#Gn++,this}getOpenMarker(){return this.#Gn>0?this.#$n:this.#Vn.getOpenMarker()}recordCloseMarker(t){return this.#Gn--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return this.#Vn.pushBaseTransform(t),this}popBaseTransform(){return this.#Vn.popBaseTransform(),this}recordSimpleData(t,e){return this.#Vn.recordSimpleData(t,this.#$n),this}recordIncrementalData(t,e){return this.#Vn.recordIncrementalData(t,this.#$n),this}resetIncrementalData(t,e){return this.#Vn.resetIncrementalData(t,this.#$n),this}recordNamedData(t,e){return this}
2recordSimpleDataFromNamed(t,e,i){return this.#Vn.recordSimpleDataFromNamed(t,e,this.#$n),this}recordFutureForcedDependency(t,e){return this.#Vn.recordFutureForcedDependency(t,this.#$n),this}inheritSimpleDataAsFutureForcedDependencies(t){return this.#Vn.inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#Vn.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return this.#Wn||this.#Vn.resetBBox(this.#$n),this}recordClipBox(t,e,i,n,r,s){return this.#Wn||this.#Vn.recordClipBox(this.#$n,e,i,n,r,s),this}recordBBox(t,e,i,n,r,s){return this.#Wn||this.#Vn.recordBBox(this.#$n,e,i,n,r,s),this}recordCharacterBBox(t,e,i,n,r,s,a){return this.#Wn||this.#Vn.recordCharacterBBox(this.#$n,e,i,n,r,s,a),this}recordFullPageBBox(t){return this.#Wn||this.#Vn.recordFullPageBBox(this.#$n),this}getSimpleIndex(t){return this.#Vn.getSimpleIndex(t)}recordDependencies(t,e){return this.#Vn.recordDependencies(this.#$n,e),this}recordNamedDependency(t,e){return this.#Vn.recordNamedDependency(this.#$n,e),this}recordOperation(t){return this.#Vn.recordOperation(this.#$n,!0),this}recordShowTextOperation(t){return this.#Vn.recordShowTextOperation(this.#$n,!0),this}bboxToClipBoxDropOperation(t){return this.#Wn||this.#Vn.bboxToClipBoxDropOperation(this.#$n,!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}}const bi=["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],vi=["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],yi=["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],wi=["filter","fillColor","fillAlpha"],Ai=["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],xi=["transform"],Ei=["transform","fillColor"],Ci="Fill",Si="Stroke",_i="Shading";function Ti(t,e){if(!e)return;const i=e[2]-e[0],n=e[3]-e[1],r=new Path2D;r.rect(e[0],e[1],i,n),t.clip(r)}class Pi{isModifyingCurrentTransform(){return!1}getPattern(){J("Abstract method `getPattern` called.")}}class Di extends Pi{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,n=this._p0,r=this._p1;if(e&&(n=n.slice(),r=r.slice(),ut.applyTransform(n,e),ut.applyTransform(r,e)),"axial"===this._type)i=t.createLinearGradient(n[0],n[1],r[0],r[1]);else if("radial"===this._type){let s=this._r0,a=this._r1;if(e){const t=new Float32Array(2);ut.singularValueDecompose2dScale(e,t),s*=t[0],a*=t[0]}i=t.createRadialGradient(n[0],n[1],s,r[0],r[1],a)}for(const t of this._colorStops)i.addColorStop(t[0],t[1]);return i}getPattern(t,e,i,n){let r;if(n===Si||n===Ci){if(this.isOriginBased()){let n=ut.transform(i,e.baseTransform);this.matrix&&(n=ut.transform(n,this.matrix));const r=.001,s=Math.hypot(n[0],n[1]),a=Math.hypot(n[2],n[3]),o=(n[0]*n[2]+n[1]*n[3])/(s*a);if(Math.abs(o)<r){if(!this.isRadial())return this._createGradient(t,n);if(Math.abs(s-a)<r)return this._createGradient(t,n)}}const s=e.current.getClippedPathBoundingBox(n,Nt(t))||[0,0,0,0],a=Math.ceil(s[2]-s[0])||1,o=Math.ceil(s[3]-s[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(-s[0],-s[1]),i=ut.transform(i,[1,0,0,1,s[0],s[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),Ti(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),r=t.createPattern(l.canvas,"no-repeat");const c=new DOMMatrix(i);r.setTransform(c)}else Ti(t,this._bbox),r=this._createGradient(t);return r}}function Mi(t,e,i,n,r,s,a,o){const l=e.coords,h=e.colors,c=t.data,d=4*t.width;let u;l[i+1]>l[n+1]&&(u=i,i=n,n=u,u=s,s=a,a=u),l[n+1]>l[r+1]&&(u=n,n=r,r=u,u=a,a=o,o=u),l[i+1]>l[n+1]&&(u=i,i=n,n=u,u=s,s=a,a=u);const p=(l[i]+e.offsetX)*e.scaleX,g=(l[i+1]+e.offsetY)*e.scaleY,f=(l[n]+e.offsetX)*e.scaleX,m=(l[n+1]+e.offsetY)*e.scaleY,b=(l[r]+e.offsetX)*e.scaleX,v=(l[r+1]+e.offsetY)*e.scaleY;if(g>=v)return;const y=h[s],w=h[s+1],A=h[s+2],x=h[a],E=h[a+1],C=h[a+2],S=h[o],_=h[o+1],T=h[o+2],P=Math.round(g),D=Math.round(v);let M,F,I,k,L,R,B,N;for(let t=P;t<=D;t++){if(t<m){const e=t<g?0:(g-t)/(g-m);M=p-(p-f)*e,F=y-(y-x)*e,I=w-(w-E)*e,k=A-(A-C)*e}else{let e;e=t>v?1:m===v?0:(m-t)/(m-v),M=f-(f-b)*e,F=x-(x-S)*e,I=E-(E-_)*e,k=C-(C-T)*e}let e;e=t<g?0:t>v?1:(g-t)/(g-v),L=p-(p-b)*e,R=y-(y-S)*e,B=w-(w-_)*e,N=A-(A-T)*e;const i=Math.round(Math.min(M,L)),n=Math.round(Math.max(M,L));let r=d*t+4*i;for(let t=i;t<=n;t++)e=(M-t)/(M-L),e<0?e=0:e>1&&(e=1),c[r++]=F-(F-R)*e|0,c[r++]=I-(I-B)*e|0,c[r++]=k-(k-N)*e|0,c[r++]=255}}function Fi(t,e,i){const n=e.coords,r=e.colors;let s,a;switch(e.type){case C:const o=e.verticesPerRow,l=Math.floor(n.length/o)-1,h=o-1;for(s=0;s<l;s++){let e=s*o;for(let s=0;s<h;s++,e++)Mi(t,i,n[e],n[e+1],n[e+o],r[e],r[e+1],r[e+o]),Mi(t,i,n[e+o+1],n[e+1],n[e+o],r[e+o+1],r[e+1],r[e+o])}break;case E:for(s=0,a=n.length;s<a;s+=3)Mi(t,i,n[s],n[s+1],n[s+2],r[s],r[s+1],r[s+2]);break;default:throw new Error("illegal figure")}}class Ii extends Pi{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){const n=Math.floor(this._bounds[0]),r=Math.floor(this._bounds[1]),s=Math.ceil(this._bounds[2])-n,a=Math.ceil(this._bounds[3])-r,o=Math.min(Math.ceil(Math.abs(s*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(a*t[1]*1.1)),3e3),h=s/o,c=a/l,d={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-r,scaleX:1/h,scaleY:1/c},u=o+4,p=l+4,g=i.getCanvas("mesh",u,p),f=g.context,m=f.createImageData(o,l);if(e){const t=m.data;for(let i=0,n=t.length;i<n;i+=4)t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=255}for(const t of this._figures)Fi(m,t,d);f.putImageData(m,2,2);return{canvas:g.canvas,offsetX:n-2*h,offsetY:r-2*c,scaleX:h,scaleY:c}}isModifyingCurrentTransform(){return!0}getPattern(t,e,i,n){Ti(t,this._bbox);const r=new Float32Array(2);if(n===_i)ut.singularValueDecompose2dScale(Nt(t),r);
vendor: 45,222 bytes, line 2
2else if(this.matrix){ut.singularValueDecompose2dScale(this.matrix,r);const[t,i]=r;ut.singularValueDecompose2dScale(e.baseTransform,r),r[0]*=t,r[1]*=i}else ut.singularValueDecompose2dScale(e.baseTransform,r);const s=this._createMeshCanvas(r,n===_i?null:this._background,e.cachedCanvases);return n!==_i&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(s.offsetX,s.offsetY),t.scale(s.scaleX,s.scaleY),t.createPattern(s.canvas,"no-repeat")}}class ki extends Pi{getPattern(){return"hotpink"}}const Li=1,Ri=2;class Bi{static MAX_PATTERN_SIZE=3e3;constructor(t,e,i,n){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=n}createPatternCanvas(t,e){const{bbox:i,operatorList:n,paintType:r,tilingType:s,color:a,canvasGraphicsFactory:o}=this;let{xstep:l,ystep:h}=this;l=Math.abs(l),h=Math.abs(h),Y("TilingType: "+s);const c=i[0],d=i[1],u=i[2],p=i[3],g=u-c,f=p-d,m=new Float32Array(2);ut.singularValueDecompose2dScale(this.matrix,m);const[b,v]=m;ut.singularValueDecompose2dScale(this.baseTransform,m);const y=b*m[0],w=v*m[1];let A=g,x=f,E=!1,C=!1;const S=Math.ceil(l*y),_=Math.ceil(h*w);S>=Math.ceil(g*y)?A=l:E=!0,_>=Math.ceil(f*w)?x=h:C=!0;const T=this.getSizeAndScale(A,this.ctx.canvas.width,y),P=this.getSizeAndScale(x,this.ctx.canvas.height,w),D=t.cachedCanvases.getCanvas("pattern",T.size,P.size),M=D.context,F=o.createCanvasGraphics(M,e);if(F.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(F,r,a),M.translate(-T.scale*c,-P.scale*d),F.transform(0,T.scale,0,0,P.scale,0,0),M.save(),F.dependencyTracker?.save(),this.clipBbox(F,c,d,u,p),F.baseTransform=Nt(F.ctx),F.executeOperatorList(n),F.endDrawing(),F.dependencyTracker?.restore(),M.restore(),E||C){const e=D.canvas;E&&(A=l),C&&(x=h);const i=this.getSizeAndScale(A,this.ctx.canvas.width,y),n=this.getSizeAndScale(x,this.ctx.canvas.height,w),r=i.size,s=n.size,a=t.cachedCanvases.getCanvas("pattern-workaround",r,s),o=a.context,u=E?Math.floor(g/l):0,p=C?Math.floor(f/h):0;for(let t=0;t<=u;t++)for(let i=0;i<=p;i++)o.drawImage(e,r*t,s*i,r,s,0,0,r,s);return{canvas:a.canvas,scaleX:i.scale,scaleY:n.scale,offsetX:c,offsetY:d}}return{canvas:D.canvas,scaleX:T.scale,scaleY:P.scale,offsetX:c,offsetY:d}}getSizeAndScale(t,e,i){const n=Math.max(Bi.MAX_PATTERN_SIZE,e);let r=Math.ceil(t*i);return r>=n?r=n:i=r/t,{scale:i,size:r}}clipBbox(t,e,i,n,r){const s=n-e,a=r-i;t.ctx.rect(e,i,s,a),ut.axialAlignedBoundingBox([e,i,n,r],Nt(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){const n=t.ctx,r=t.current;switch(e){case Li:const{fillStyle:t,strokeStyle:s}=this.ctx;n.fillStyle=r.fillColor=t,n.strokeStyle=r.strokeColor=s;break;case Ri:n.fillStyle=n.strokeStyle=i,r.fillColor=r.strokeColor=i;break;default:throw new ot(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,i,n,r){let s=i;n!==_i&&(s=ut.transform(s,e.baseTransform),this.matrix&&(s=ut.transform(s,this.matrix)));const a=this.createPatternCanvas(e,r);let o=new DOMMatrix(s);o=o.translate(a.offsetX,a.offsetY),o=o.scale(1/a.scaleX,1/a.scaleY);const l=t.createPattern(a.canvas,"repeat");return l.setTransform(o),l}}function Ni({src:t,srcPos:e=0,dest:i,width:n,height:r,nonBlackColor:s=4294967295,inverseDecode:a=!1}){const o=ct.isLittleEndian?4278190080:255,[l,h]=a?[s,o]:[o,s],c=n>>3,d=7&n,u=t.length;i=new Uint32Array(i.buffer);let p=0;for(let n=0;n<r;n++){for(const n=e+c;e<n;e++){const n=e<u?t[e]:255;i[p++]=128&n?h:l,i[p++]=64&n?h:l,i[p++]=32&n?h:l,i[p++]=16&n?h:l,i[p++]=8&n?h:l,i[p++]=4&n?h:l,i[p++]=2&n?h:l,i[p++]=1&n?h:l}if(0===d)continue;const n=e<u?t[e++]:255;for(let t=0;t<d;t++)i[p++]=n&1<<7-t?h:l}return{srcPos:e,destPos:p}}const Oi=16,ji=new DOMMatrix,Ui=new Float32Array(2),zi=new Float32Array([1/0,1/0,-1/0,-1/0]);class Hi{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let n;return void 0!==this.cache[t]?(n=this.cache[t],this.canvasFactory.reset(n,e,i)):(n=this.canvasFactory.create(e,i),this.cache[t]=n),n}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function Vi(t,e,i,n,r,s,a,o,l,h){const[c,d,u,p,g,f]=Nt(t);if(0===d&&0===u){const m=a*c+g,b=Math.round(m),v=o*p+f,y=Math.round(v),w=(a+l)*c+g,A=Math.abs(Math.round(w)-b)||1,x=(o+h)*p+f,E=Math.abs(Math.round(x)-y)||1;return t.setTransform(Math.sign(c),0,0,Math.sign(p),b,y),t.drawImage(e,i,n,r,s,0,0,A,E),t.setTransform(c,d,u,p,g,f),[A,E]}if(0===c&&0===p){const m=o*u+g,b=Math.round(m),v=a*d+f,y=Math.round(v),w=(o+h)*u+g,A=Math.abs(Math.round(w)-b)||1,x=(a+l)*d+f,E=Math.abs(Math.round(x)-y)||1;return t.setTransform(0,Math.sign(d),Math.sign(u),0,b,y),t.drawImage(e,i,n,r,s,0,0,E,A),t.setTransform(c,d,u,p,g,f),[E,A]}t.drawImage(e,i,n,r,s,a,o,l,h);return[Math.hypot(c,d)*l,Math.hypot(u,p)*h]}class $i{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=l;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=S;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=zi.slice()}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t}getPathBoundingBox(t=Ci,e=null){const i=this.minMax.slice();if(t===Si){e||J("Stroke bounding box must include transform."),ut.singularValueDecompose2dScale(e,Ui);const t=Ui[0]*this.lineWidth/2,n=Ui[1]*this.lineWidth/2;i[0]-=t,i[1]-=n,i[2]+=t,i[3]+=n}return i}updateClipFromPath(){const t=ut.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(zi,0)}getClippedPathBoundingBox(t=Ci,e=null){return ut.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function Wi(t,e){if(e instanceof ImageData)return void t.putImageData(e,0,0);const i=e.height,n=e.width,r=i%Oi,s=(i-r)/Oi,a=0===r?s:s+1,o=t.createImageData(n,Oi);let l,h=0;const c=e.data,d=o.data;let u,p,g,f;if(e.kind===F.GRAYSCALE_1BPP){const e=c.byteLength,i=new Uint32Array(d.buffer,0,d.byteLength>>2),f=i.length,m=n+7>>3,b=4294967295,v=ct.isLittleEndian?4278190080:255;for(u=0;u<a;u++){for(g=u<s?Oi:r,l=0,p=0;p<g;p++){const t=e-h;let r=0;const s=t>m?n:8*t-7,a=-8&s;let o=0,d=0;for(;r<a;r+=8)d=c[h++],i[l++]=128&d?b:v,i[l++]=64&d?b:v,i[l++]=32&d?b:v,i[l++]=16&d?b:v,i[l++]=8&d?b:v,i[l++]=4&d?b:v,i[l++]=2&d?b:v,i[l++]=1&d?b:v;for(;r<s;r++)0===o&&(d=c[h++],o=128),i[l++]=d&o?b:v,o>>=1}for(;l<f;)i[l++]=0;t.putImageData(o,0,u*Oi)}}else if(e.kind===F.RGBA_32BPP){for(p=0,f=n*Oi*4,u=0;u<s;u++)d.set(c.subarray(h,h+f)),h+=f,t.putImageData(o,0,p),p+=Oi;u<a&&(f=n*r*4,d.set(c.subarray(h,h+f)),t.putImageData(o,0,p))}else{if(e.kind!==F.RGB_24BPP)throw new Error(`bad image kind: ${e.kind}`);for(g=Oi,f=n*g,u=0;u<a;u++){for(u>=s&&(g=r,f=n*g),l=0,p=f;p--;)d[l++]=c[h++],d[l++]=c[h++],d[l++]=c[h++],d[l++]=255;t.putImageData(o,0,u*Oi)}}}function Gi(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);const i=e.height,n=e.width,r=i%Oi,s=(i-r)/Oi,a=0===r?s:s+1,o=t.createImageData(n,Oi);let l=0;const h=e.data,c=o.data;for(let e=0;e<a;e++){const i=e<s?Oi:r;({srcPos:l}=Ni({src:h,srcPos:l,dest:c,width:n,height:i,nonBlackColor:0})),t.putImageData(o,0,e*Oi)}}function Xi(t,e){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of i)void 0!==t[n]&&(e[n]=t[n]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function qi(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);const{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}function Yi(t,e){if(e)return!0;ut.singularValueDecompose2dScale(t,Ui);const i=Math.fround(Ut.pixelRatio*xt.PDF_TO_CSS_UNITS);return Ui[0]<=i&&Ui[1]<=i}const Ki=["butt","round","square"],Ji=["miter","round","bevel"],Qi={},Zi={};class tn{constructor(t,e,i,n,r,{optionalContentConfig:s,markedContentStack:a=null},o,l,h){this.ctx=t,this.current=new $i(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=n,this.filterFactory=r,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=s,this.cachedCanvases=new Hi(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:n=null}){const r=this.ctx.canvas.width,s=this.ctx.canvas.height,a=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,r,s),this.ctx.fillStyle=a,i){const t=this.cachedCanvases.getCanvas("transparent",r,s);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...Nt(this.compositeCtx))}this.ctx.save(),qi(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=Nt(this.ctx)}executeOperatorList(t,e,i,n,r){const s=t.argsArray,a=t.fnArray;let o=e||0;const l=s.length;if(l===o)return o;const h=l-o>10&&"function"==typeof i,c=h?Date.now()+15:0;let d=0;const u=this.commonObjs,p=this.objs;let g,f;for(;;){if(void 0!==n&&o===n.nextBreakPoint)return n.breakIt(o,i),o;if(!r||r(o))if(g=a[o],f=s[o]??null,g!==j.dependency)null===f?this[g](o):this[g](o,...f);else for(const t of f){this.dependencyTracker?.recordNamedData(t,o);const e=t.startsWith("g_")?u:p;if(!e.has(t))return e.get(t,i),o}if(o++,o===l)return o;if(h&&++d>10){if(Date.now()>c)return i(),o;d=0}}}#qn(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#qn(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#Yn()}#Yn(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}_scaleImage(t,e){const i=t.width??t.displayWidth,n=t.height??t.displayHeight;let r,s,a=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),l=i,h=n,c="prescale1";for(;a>2&&l>1||o>2&&h>1;){let e=l,i=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&&(i=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h)/2,o/=h/i),r=this.cachedCanvases.getCanvas(c,e,i),s=r.context,s.clearRect(0,0,e,i),s.drawImage(t,0,0,l,h,0,0,e,i),t=r.canvas,l=e,h=i,c="prescale1"===c?"prescale2":"prescale1"}return{img:t,paintWidth:l,paintHeight:h}}_createMaskCanvas(t,e){const i=this.ctx,{width:n,height:r}=e,s=this.current.fillColor,a=this.current.patternFill,o=Nt(i);let l,h,c,d;if((e.bitmap||e.data)&&e.count>1){const i=e.bitmap||e.data.buffer;h=JSON.stringify(a?o:[o.slice(0,4),s]),l=this._cachedBitmapsMap.get(i),l||(l=new Map,this._cachedBitmapsMap.set(i,l));const n=l.get(h);if(n&&!a){const e=Math.round(Math.min(o[0],o[2])+o[4]),i=Math.round(Math.min(o[1],o[3])+o[5]);return this.dependencyTracker?.recordDependencies(t,Ei),{canvas:n,offsetX:e,offsetY:i}}c=n}c||(d=this.cachedCanvases.getCanvas("maskCanvas",n,r),Gi(d.context,e));let u=ut.transform(o,[1/n,0,0,-1/r,0,0]);u=ut.transform(u,[1,0,0,1,0,-r]);const p=zi.slice();ut.axialAlignedBoundingBox([0,0,n,r],u,p);const[g,f,m,b]=p,v=Math.round(m-g)||1,y=Math.round(b-f)||1,w=this.cachedCanvases.getCanvas("fillCanvas",v,y),A=w.context,x=g,E=f;A.translate(-x,-E),A.transform(...u),c||(c=this._scaleImage(d.canvas,Ot(A)),c=c.img,l&&a&&l.set(h,c)),A.imageSmoothingEnabled=Yi(Nt(A),e.interpolate),Vi(A,c,0,0,c.width,c.height,0,0,n,r),A.globalCompositeOperation="source-in";const C=ut.transform(Ot(A),[1,0,0,1,-x,-E]);return A.fillStyle=a?s.getPattern(i,this,C,Ci,t):s,A.fillRect(0,0,n,r),l&&!a&&(this.cachedCanvases.delete("fillCanvas"),l.set(h,w.canvas)),this.dependencyTracker?.recordDependencies(t,Ei),{canvas:w.canvas,offsetX:Math.round(x),offsetY:Math.round(E)}}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=Ki[e]}setLineJoin(t,e){this.dependencyTracker?.recordSimpleData("lineJoin",t),this.ctx.lineJoin=Ji[e]}setMiterLimit(t,e){this.dependencyTracker?.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,i){this.dependencyTracker?.recordSimpleData("dash",t);const n=this.ctx;void 0!==n.setLineDash&&(n.setLineDash(e),n.lineDashOffset=i)}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){for(const[i,n]of e)switch(i){case"LW":this.setLineWidth(t,n);break;case"LC":this.setLineCap(t,n);break;case"LJ":this.setLineJoin(t,n);break;case"ML":this.setMiterLimit(t,n);break;case"D":this.setDash(t,n[0],n[1]);break;case"RI":this.setRenderingIntent(t,n);break;case"FL":this.setFlatness(t,n);break;case"Font":this.setFont(t,n[0],n[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=n;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=n;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=n;break;case"SMask":this.dependencyTracker?.recordSimpleData("SMask",t),this.current.activeSMask=n?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(n)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(t){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,i=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,r=this.cachedCanvases.getCanvas(n,e,i);this.suspendedCtx=this.ctx;const s=this.ctx=r.context;s.setTransform(this.suspendedCtx.getTransform()),Xi(this.suspendedCtx,s),function(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()},t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(t,i){e.translate(t,i),this.__originalTranslate(t,i)},t.scale=function(t,i){e.scale(t,i),this.__originalScale(t,i)},t.transform=function(t,i,n,r,s,a){e.transform(t,i,n,r,s,a),this.__originalTransform(t,i,n,r,s,a)},t.setTransform=function(t,i,n,r,s,a){e.setTransform(t,i,n,r,s,a),this.__originalSetTransform(t,i,n,r,s,a)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(t){e.rotate(t),this.__originalRotate(t)},t.clip=function(t){e.clip(t),this.__originalClip(t)},t.moveTo=function(t,i){e.moveTo(t,i),this.__originalMoveTo(t,i)},t.lineTo=function(t,i){e.lineTo(t,i),this.__originalLineTo(t,i)},t.bezierCurveTo=function(t,i,n,r,s,a){e.bezierCurveTo(t,i,n,r,s,a),this.__originalBezierCurveTo(t,i,n,r,s,a)},t.rect=function(t,i,n,r){e.rect(t,i,n,r),this.__originalRect(t,i,n,r)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}(s,this.suspendedCtx),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Xi(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];const 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,n){const r=n[0],s=n[1],a=n[2]-r,o=n[3]-s;0!==a&&0!==o&&(this.genericComposeSMask(e.context,i,a,o,e.subtype,e.backdrop,e.transferMap,r,s,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,n,r,s,a,o,l,h,c){let d=t.canvas,u=o-h,p=l-c;if(s)if(u<0||p<0||u+i>d.width||p+n>d.height){const t=this.cachedCanvases.getCanvas("maskExtension",i,n),e=t.context;e.drawImage(d,-u,-p),e.globalCompositeOperation="destination-atop",e.fillStyle=s,e.fillRect(0,0,i,n),e.globalCompositeOperation="source-over",d=t.canvas,u=p=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const e=new Path2D;e.rect(u,p,i,n),t.clip(e),t.globalCompositeOperation="destination-atop",t.fillStyle=s,t.fillRect(u,p,i,n),t.restore()}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===r&&a?e.filter=this.filterFactory.addAlphaFilter(a):"Luminosity"===r&&(e.filter=this.filterFactory.addLuminosityFilter(a));const g=new Path2D;g.rect(o,l,i,n),e.clip(g),e.globalCompositeOperation="destination-in",e.drawImage(d,u,p,i,n,o,l,i,n),e.restore()}save(t){this.inSMaskMode&&Xi(this.ctx,this.suspendedCtx),this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone(),this.dependencyTracker?.save(t)}restore(t){this.dependencyTracker?.restore(t),0!==this.stateStack.length?(this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&Xi(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null):this.inSMaskMode&&this.endSMaskMode()}transform(t,e,i,n,r,s,a){this.dependencyTracker?.recordIncrementalData("transform",t),this.ctx.transform(e,i,n,r,s,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i,n){let[r]=i;if(!n)return r||=i[0]=new Path2D,void this[e](t,r);if(null!==this.dependencyTracker){const i=e===j.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,n[0]-i,n[2]+i,n[1]-i,n[3]+i).recordDependencies(t,["transform"])}r instanceof Path2D||(r=i[0]=Qt(r)),ut.axialAlignedBoundingBox(n,Nt(this.ctx),this.current.minMax),this[e](t,r),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e,i=!0){const n=this.ctx,r=this.current.strokeColor;if(n.globalAlpha=this.current.strokeAlpha,this.contentVisible)if("object"==typeof r&&r?.getPattern){const i=r.isModifyingCurrentTransform()?n.getTransform():null;if(n.save(),n.strokeStyle=r.getPattern(n,this,Ot(n),Si,t),i){const t=new Path2D;t.addPath(e,n.getTransform().invertSelf().multiplySelf(i)),e=t}this.rescaleAndStroke(e,!1),n.restore()}else this.rescaleAndStroke(e,!0);this.dependencyTracker?.recordDependencies(t,bi),i&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(Si,Nt(this.ctx))),n.globalAlpha=this.current.fillAlpha}closeStroke(t,e){this.stroke(t,e)}fill(t,e,i=!0){const n=this.ctx,r=this.current.fillColor;let s=!1;if(this.current.patternFill){const i=r.isModifyingCurrentTransform()?n.getTransform():null;if(this.dependencyTracker?.save(t),n.save(),n.fillStyle=r.getPattern(n,this,Ot(n),Ci,t),i){const t=new Path2D;t.addPath(e,n.getTransform().invertSelf().multiplySelf(i)),e=t}s=!0}const a=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==a&&(this.pendingEOFill?(n.fill(e,"evenodd"),this.pendingEOFill=!1):n.fill(e)),this.dependencyTracker?.recordDependencies(t,vi),s&&(n.restore(),this.dependencyTracker?.restore(t)),i&&this.consumePath(t,e,a)}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,wi).recordOperation(t)}clip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=Qi}eoClip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=Zi}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){const e=this.pendingTextPaths,i=this.ctx;if(this.dependencyTracker){const{dependencyTracker:i}=this;void 0!==e&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",t),i.recordCloseMarker(t)}if(void 0!==e){const t=new Path2D,n=i.getTransform().invertSelf();for(const{transform:i,x:r,y:s,fontSize:a,path:o}of e)o&&t.addPath(o,new DOMMatrix(i).preMultiplySelf(n).translate(r,s).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);const n=this.commonObjs.get(e),r=this.current;if(!n)throw new Error(`Can't find font for ${e}`);if(r.fontMatrix=n.fontMatrix||l,0!==r.fontMatrix[0]&&0!==r.fontMatrix[3]||K("Invalid font matrix for font "+e),i<0?(i=-i,r.fontDirection=-1):r.fontDirection=1,this.current.font=n,this.current.fontSize=i,n.isType3Font)return;const s=n.loadedName||"sans-serif",a=n.systemFontInfo?.css||`"${s}", ${n.fallbackName}`;let o="normal";n.black?o="900":n.bold&&(o="bold");const h=n.italic?"italic":"normal";let c=i;i<16?c=16:i>100&&(c=100),this.current.fontSizeScale=i/c,this.ctx.font=`${h} ${o} ${c}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);const{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)}#Kn(t,e,i){const n=new Path2D;return n.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),n}paintChar(t,e,i,n,r,s){const a=this.ctx,o=this.current,l=o.font,h=o.textRenderingMode,c=o.fontSize/o.fontSizeScale,d=h&D,u=!!(h&M),p=o.patternFill&&!l.missingFile,g=o.patternStroke&&!l.missingFile;let f;if((l.disableFontFace||u||p||g)&&!l.missingFile&&(f=l.getPathGenerator(this.commonObjs,e)),f&&(l.disableFontFace||p||g)){let e;if(a.save(),a.translate(i,n),a.scale(c,-c),this.dependencyTracker?.recordCharacterBBox(t,a,l),d===S||d===T)if(r){e=a.getTransform(),a.setTransform(...r);const t=this.#Kn(f,e,r);a.fill(t)}else a.fill(f);if(d===_||d===T)if(s){e||=a.getTransform(),a.setTransform(...s);const{a:t,b:i,c:n,d:r}=e,o=ut.inverseTransform(s),l=ut.transform([t,i,n,r,0,0],o);ut.singularValueDecompose2dScale(l,Ui),a.lineWidth*=Math.max(Ui[0],Ui[1])/c,a.stroke(this.#Kn(f,e,s))}else a.lineWidth/=c,a.stroke(f);a.restore()}else d!==S&&d!==T||(a.fillText(e,i,n),this.dependencyTracker?.recordCharacterBBox(t,a,l,c,i,n,()=>a.measureText(e))),d!==_&&d!==T||(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(t,a,l,c,i,n,()=>a.measureText(e)).recordDependencies(t,bi),a.strokeText(e,i,n));if(u){(this.pendingTextPaths||=[]).push({transform:Nt(a),x:i,y:n,fontSize:c,path:f}),this.dependencyTracker?.recordCharacterBBox(t,a,l,c,i,n)}}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let i=!1;for(let t=3;t<e.length;t+=4)if(e[t]>0&&e[t]<255){i=!0;break}return et(this,"isFontSubpixelAAEnabled",i)}showText(t,e){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,Ai).resetBBox(t),this.current.textRenderingMode&M&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());const i=this.current,n=i.font;if(n.isType3Font)return this.showType3Text(t,e),void this.dependencyTracker?.recordShowTextOperation(t);const r=i.fontSize;if(0===r)return void this.dependencyTracker?.recordOperation(t);const s=this.ctx,a=i.fontSizeScale,o=i.charSpacing,l=i.wordSpacing,h=i.fontDirection,c=i.textHScale*h,d=e.length,u=n.vertical,p=u?1:-1,g=n.defaultVMetrics,f=r*i.fontMatrix[0],m=i.textRenderingMode===S&&!n.disableFontFace&&!i.patternFill;let b,v;s.save(),i.textMatrix&&s.transform(...i.textMatrix),s.translate(i.x,i.y+i.textRise),h>0?s.scale(c,-1):s.scale(c,1);const y=i.textRenderingMode&D,w=y===_||y===T;if((y===S||y===T)&&i.patternFill){s.save();const e=i.fillColor.getPattern(s,this,Ot(s),Ci,t);b=Nt(s),s.restore(),s.fillStyle=e}if(w&&i.patternStroke){s.save();const e=i.strokeColor.getPattern(s,this,Ot(s),Si,t);v=Nt(s),s.restore(),s.strokeStyle=e}let A=i.lineWidth;const x=i.textMatrixScale;if(0===x||0===A?w&&(A=this.getSinglePixelWidth()):A/=x,1!==a&&(s.scale(a,a),A/=a),s.lineWidth=A,n.isInvalidPDFjsFont){const n=[];let r=0;for(const t of e)n.push(t.unicode),r+=t.width;const a=n.join("");if(s.fillText(a,0,0),null!==this.dependencyTracker){const e=s.measureText(a);this.dependencyTracker.recordBBox(t,this.ctx,-e.actualBoundingBoxLeft,e.actualBoundingBoxRight,-e.actualBoundingBoxAscent,e.actualBoundingBoxDescent).recordShowTextOperation(t)}return i.x+=r*f*c,s.restore(),void this.compose()}let E,C=0;for(E=0;E<d;++E){const i=e[E];if("number"==typeof i){C+=p*i*r/1e3;continue}let c=!1;const d=(i.isSpace?l:0)+o,y=i.fontChar,w=i.accent;let A,x,S,_=i.width;if(u){const t=i.vmetric||g,e=-(i.vmetric?t[1]:.5*_)*f,n=t[2]*f;_=t?-t[0]:_,A=e/a,x=(C+n)/a}else A=C/a,x=0;if(n.remeasure&&_>0){S=s.measureText(y);const t=1e3*S.width/r*a;if(_<t&&this.isFontSubpixelAAEnabled){const e=_/t;c=!0,s.save(),s.scale(e,1),A/=e}else _!==t&&(A+=(_-t)/2e3*r/a)}if(this.contentVisible&&(i.isInFont||n.missingFile))if(m&&!w)s.fillText(y,A,x),this.dependencyTracker?.recordCharacterBBox(t,s,S?{bbox:null}:n,r/a,A,x,()=>S??s.measureText(y));else if(this.paintChar(t,y,A,x,b,v),w){const e=A+r*w.offset.x/a,i=x-r*w.offset.y/a;this.paintChar(t,w.fontChar,e,i,b,v)}C+=u?_*f-d*h:_*f+d*h,c&&s.restore()}u?i.y-=C:i.x+=C*c,s.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(t)}showType3Text(t,e){const i=this.ctx,n=this.current,r=n.font,s=n.fontSize,a=n.fontDirection,o=r.vertical?1:-1,h=n.charSpacing,c=n.wordSpacing,d=n.textHScale*a,u=n.fontMatrix||l,p=e.length;let g,f,m,b;if(n.textRenderingMode===P||0===s)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,i.save(),n.textMatrix&&i.transform(...n.textMatrix),i.translate(n.x,n.y+n.textRise),i.scale(d,a);const v=this.dependencyTracker;for(this.dependencyTracker=v?new mi(v,t):null,g=0;g<p;++g){if(f=e[g],"number"==typeof f){b=o*f*s/1e3,this.ctx.translate(b,0),n.x+=b*d;continue}const t=(f.isSpace?c:0)+h,a=r.charProcOperatorList[f.operatorListId];a?this.contentVisible&&(this.save(),i.scale(s,s),i.transform(...u),this.executeOperatorList(a),this.restore()):K(`Type3 character "${f.operatorListId}" is not available.`);const l=[f.width,0];ut.applyTransform(l,u),m=l[0]*s+t,i.translate(m,0),n.x+=m*d}i.restore(),v&&(this.dependencyTracker=v)}setCharWidth(t,e,i){}setCharWidthAndBounds(t,e,i,n,r,s,a){const o=new Path2D;o.rect(n,r,s-n,a-r),this.ctx.clip(o),this.dependencyTracker?.recordBBox(t,this.ctx,n,s,r,a).recordClipBox(t,this.ctx,n,s,r,a),this.endPath(t)}getColorN_Pattern(t,e){let i;if("TilingPattern"===e[0]){const t=this.baseTransform||Nt(this.ctx),n={createCanvasGraphics:(t,e)=>new tn(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new mi(this.dependencyTracker,e,!0):null)};i=new Bi(e,this.ctx,n,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}setStrokeTransparent(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 n;return this.cachedPatterns.has(e)?n=this.cachedPatterns.get(e):(n=function(t){switch(t[0]){case"RadialAxial":return new Di(t);case"Mesh":return new Ii(t);case"Dummy":return new ki}throw new Error(`Unknown IR type: ${t[0]}`)}(this.getObject(t,e)),this.cachedPatterns.set(e,n)),i&&(n.matrix=i),n}shadingFill(t,e){if(!this.contentVisible)return;const i=this.ctx;this.save(t);const n=this._getPattern(t,e);i.fillStyle=n.getPattern(i,this,Ot(i),_i,t);const r=Ot(i);if(r){const{width:t,height:e}=i.canvas,n=zi.slice();ut.axialAlignedBoundingBox([0,0,t,e],r,n);const[s,a,o,l]=n;this.ctx.fillRect(s,a,o-s,l-a)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,xi).recordDependencies(t,vi).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){J("Should not call beginInlineImage")}beginImageData(){J("Should not call beginImageData")}paintFormXObjectBegin(t,e,i){if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=Nt(this.ctx),i)){ut.axialAlignedBoundingBox(i,this.baseTransform,this.current.minMax);const[e,n,r,s]=i,a=new Path2D;a.rect(e,n,r-e,s-n),this.ctx.clip(a),this.dependencyTracker?.recordClipBox(t,this.ctx,e,r,n,s),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);const i=this.ctx;e.isolated||Y("TODO: Support non-isolated groups."),e.knockout&&K("Knockout groups not supported.");const n=Nt(i);if(e.matrix&&i.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let r=zi.slice();ut.axialAlignedBoundingBox(e.bbox,Nt(i),r);const s=[0,0,i.canvas.width,i.canvas.height];r=ut.intersect(r,s)||[0,0,0,0];const a=Math.floor(r[0]),o=Math.floor(r[1]),l=Math.max(Math.ceil(r[2])-a,1),h=Math.max(Math.ceil(r[3])-o,1);this.current.startNewPathAndClipBox([0,0,l,h]);let c="groupAt"+this.groupLevel;e.smask&&(c+="_smask_"+this.smaskCounter++%2);const d=this.cachedCanvases.getCanvas(c,l,h),u=d.context;u.translate(-a,-o),u.transform(...n);let p=new Path2D;const[g,f,m,b]=e.bbox;if(p.rect(g,f,m-g,b-f),e.matrix){const t=new Path2D;t.addPath(p,new DOMMatrix(e.matrix)),p=t}u.clip(p),e.smask&&this.smaskStack.push({canvas:d.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()),Xi(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--;const i=this.ctx,n=this.groupStack.pop();if(this.ctx=n,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();const e=Nt(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...e);const n=zi.slice();ut.axialAlignedBoundingBox([0,0,i.canvas.width,i.canvas.height],e,n),this.ctx.drawImage(i.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(t,e,i,n,r,s){if(this.#qn(),qi(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),i){const r=i[2]-i[0],a=i[3]-i[1];if(s&&this.annotationCanvasMap){(n=n.slice())[4]-=i[0],n[5]-=i[1],(i=i.slice())[0]=i[1]=0,i[2]=r,i[3]=a,ut.singularValueDecompose2dScale(Nt(this.ctx),Ui);const{viewportScale:t}=this,s=Math.ceil(r*this.outputScaleX*t),o=Math.ceil(a*this.outputScaleY*t);this.annotationCanvas=this.canvasFactory.create(s,o);const{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(Ui[0],0,0,-Ui[1],0,a*Ui[1]),qi(this.ctx)}else{qi(this.ctx),this.endPath(t);const e=new Path2D;e.rect(i[0],i[1],r,a),this.ctx.clip(e)}}this.current=new $i(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(t,...n),this.transform(t,...r)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),this.#Yn(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t,e){if(!this.contentVisible)return;const i=e.count;(e=this.getObject(t,e.data,e)).count=i;const n=this.ctx,r=this._createMaskCanvas(t,e),s=r.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(s,r.offsetX,r.offsetY),this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,r.offsetX,r.offsetX+s.width,r.offsetY,r.offsetY+s.height).recordOperation(t),n.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,i,n=0,r=0,s,a){if(!this.contentVisible)return;e=this.getObject(t,e.data,e);const o=this.ctx;o.save();const l=Nt(o);o.transform(i,n,r,s,0,0);const 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,c=a.length;e<c;e+=2){const c=ut.transform(l,[i,n,r,s,a[e],a[e+1]]);o.drawImage(h.canvas,c[4],c[5]),this.dependencyTracker?.recordBBox(t,this.ctx,c[4],c[4]+h.canvas.width,c[5],c[5]+h.canvas.height)}o.restore(),this.compose(),this.dependencyTracker?.recordOperation(t)}paintImageMaskXObjectGroup(t,e){if(!this.contentVisible)return;const i=this.ctx,n=this.current.fillColor,r=this.current.patternFill;this.dependencyTracker?.resetBBox(t).recordDependencies(t,Ei);for(const s of e){const{data:e,width:a,height:o,transform:l}=s,h=this.cachedCanvases.getCanvas("maskCanvas",a,o),c=h.context;c.save();Gi(c,this.getObject(t,e,s)),c.globalCompositeOperation="source-in",c.fillStyle=r?n.getPattern(c,this,Ot(i),Ci,t):n,c.fillRect(0,0,a,o),c.restore(),i.save(),i.transform(...l),i.scale(1,-1),Vi(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;const i=this.getObject(t,e);i?this.paintInlineImageXObject(t,i):K("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,i,n,r){if(!this.contentVisible)return;const s=this.getObject(t,e);if(!s)return void K("Dependent image isn't ready yet");const a=s.width,o=s.height,l=[];for(let t=0,e=r.length;t<e;t+=2)l.push({transform:[i,0,0,n,r[t],r[t+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(t,s,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;const{bitmap:e,width:i,height:n}=t,r=this.cachedCanvases.getCanvas("inlineImage",i,n),s=r.context;return s.filter=this.current.transferMaps,s.drawImage(e,0,0),s.filter="none",r.canvas}paintInlineImageXObject(t,e){if(!this.contentVisible)return;const i=e.width,n=e.height,r=this.ctx;this.save(t);const{filter:s}=r;let a;if("none"!==s&&""!==s&&(r.filter="none"),r.scale(1/i,-1/n),e.bitmap)a=this.applyTransferMapsToBitmap(e);else if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)a=e;else{const t=this.cachedCanvases.getCanvas("inlineImage",i,n).context;Wi(t,e),a=this.applyTransferMapsToCanvas(t)}const o=this._scaleImage(a,Ot(r));r.imageSmoothingEnabled=Yi(Nt(r),e.interpolate),this.dependencyTracker?.resetBBox(t).recordBBox(t,r,0,i,-n,0).recordDependencies(t,yi).recordOperation(t),Vi(r,o.img,0,0,o.paintWidth,o.paintHeight,0,-n,i,n),this.compose(),this.restore(t)}paintInlineImageXObjectGroup(t,e,i){if(!this.contentVisible)return;const n=this.ctx;let r;if(e.bitmap)r=e.bitmap;else{const t=e.width,i=e.height,n=this.cachedCanvases.getCanvas("inlineImage",t,i).context;Wi(n,e),r=this.applyTransferMapsToCanvas(n)}this.dependencyTracker?.resetBBox(t);for(const e of i)n.save(),n.transform(...e.transform),n.scale(1,-1),Vi(n,r,e.x,e.y,e.w,e.h,0,-1,1,1),this.dependencyTracker?.recordBBox(t,n,0,1,-1,0),n.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,vi).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t,e){}markPointProps(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){const n=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(i);const r=this.ctx;this.pendingClip?(n||(this.pendingClip===Zi?r.clip(e,"evenodd"):r.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){const t=Nt(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),n=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,n)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:t}=this.current,{a:e,b:i,c:n,d:r}=this.ctx.getTransform();let s,a;if(0===i&&0===n){const i=Math.abs(e),n=Math.abs(r);if(i===n)if(0===t)s=a=1/i;else{const e=i*t;s=a=e<1?1/e:1}else if(0===t)s=1/i,a=1/n;else{const e=i*t,r=n*t;s=e<1?1/e:1,a=r<1?1/r:1}}else{const o=Math.abs(e*r-i*n),l=Math.hypot(e,i),h=Math.hypot(n,r);if(0===t)s=h/o,a=l/o;else{const e=t*o;s=h>e?h/e:1,a=l>e?l/e:1}}this._cachedScaleForStroking[0]=s,this._cachedScaleForStroking[1]=a}return this._cachedScaleForStroking}rescaleAndStroke(t,e){const{ctx:i,current:{lineWidth:n}}=this,[r,s]=this.getScaleForStroking();if(r===s)return i.lineWidth=(n||1)*r,void i.stroke(t);const a=i.getLineDash();e&&i.save(),i.scale(r,s),ji.a=1/r,ji.d=1/s;const o=new Path2D;if(o.addPath(t,ji),a.length>0){const t=Math.max(r,s);i.setLineDash(a.map(e=>e/t)),i.lineDashOffset/=t}i.lineWidth=n||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(const t in j)void 0!==tn.prototype[t]&&(tn.prototype[j[t]]=tn.prototype[t]);class en{static#Jn=null;static#Qn="";static get workerPort(){return this.#Jn}static set workerPort(t){if(!("undefined"!=typeof Worker&&t instanceof Worker)&&null!==t)throw new Error("Invalid `workerPort` type.");this.#Jn=t}static get workerSrc(){return this.#Qn}static set workerSrc(t){if("string"!=typeof t)throw new Error("Invalid `workerSrc` type.");this.#Qn=t}}class nn{#Zn;#tr;constructor({parsedData:t,rawData:e}){this.#Zn=t,this.#tr=e}getRaw(){return this.#tr}get(t){return this.#Zn.get(t)??null}[Symbol.iterator](){return this.#Zn.entries()}}const rn=Symbol("INTERNAL");class sn{#er=!1;#ir=!1;#nr=!1;#rr=!0;constructor(t,{name:e,intent:i,usage:n,rbGroups:r}){this.#er=!!(t&d),this.#ir=!!(t&u),this.name=e,this.intent=i,this.usage=n,this.rbGroups=r}get visible(){if(this.#nr)return this.#rr;if(!this.#rr)return!1;const{print:t,view:e}=this.usage;return this.#er?"OFF"!==e?.viewState:!this.#ir||"OFF"!==t?.printState}_setVisible(t,e,i=!1){t!==rn&&J("Internal method `_setVisible` called."),this.#nr=i,this.#rr=e}}class an{#sr=null;#ar=new Map;#or=null;#lr=null;constructor(t,e=d){if(this.renderingIntent=e,this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,this.#lr=t.order;for(const i of t.groups)this.#ar.set(i.id,new sn(e,i));if("OFF"===t.baseState)for(const t of this.#ar.values())t._setVisible(rn,!1);for(const e of t.on)this.#ar.get(e)._setVisible(rn,!0);for(const e of t.off)this.#ar.get(e)._setVisible(rn,!1);this.#or=this.getHash()}}#hr(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let n=1;n<e;n++){const e=t[n];let r;if(Array.isArray(e))r=this.#hr(e);else{if(!this.#ar.has(e))return K(`Optional content group not found: ${e}`),!0;r=this.#ar.get(e).visible}switch(i){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return"And"===i}isVisible(t){if(0===this.#ar.size)return!0;
2if(!t)return Y("Optional content group not defined."),!0;if("OCG"===t.type)return this.#ar.has(t.id)?this.#ar.get(t.id).visible:(K(`Optional content group not found: ${t.id}`),!0);if("OCMD"===t.type){if(t.expression)return this.#hr(t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!this.#ar.has(e))return K(`Optional content group not found: ${e}`),!0;if(this.#ar.get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!this.#ar.has(e))return K(`Optional content group not found: ${e}`),!0;if(!this.#ar.get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!this.#ar.has(e))return K(`Optional content group not found: ${e}`),!0;if(!this.#ar.get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!this.#ar.has(e))return K(`Optional content group not found: ${e}`),!0;if(this.#ar.get(e).visible)return!1}return!0}return K(`Unknown optional content policy ${t.policy}.`),!0}return K(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,i=!0){const n=this.#ar.get(t);if(n){if(i&&e&&n.rbGroups.length)for(const e of n.rbGroups)for(const i of e)i!==t&&this.#ar.get(i)?._setVisible(rn,!1,!0);n._setVisible(rn,!!e,!0),this.#sr=null}else K(`Optional content group not found: ${t}`)}setOCGState({state:t,preserveRB:e}){let i;for(const n of t){switch(n){case"ON":case"OFF":case"Toggle":i=n;continue}const t=this.#ar.get(n);if(t)switch(i){case"ON":this.setVisibility(n,!0,e);break;case"OFF":this.setVisibility(n,!1,e);break;case"Toggle":this.setVisibility(n,!t.visible,e)}}this.#sr=null}get hasInitialVisibility(){return null===this.#or||this.getHash()===this.#or}getOrder(){return this.#ar.size?this.#lr?this.#lr.slice():[...this.#ar.keys()]:null}getGroup(t){return this.#ar.get(t)||null}getHash(){if(null!==this.#sr)return this.#sr;const t=new ve;for(const[e,i]of this.#ar)t.update(`${e}:${i.visible}`);return this.#sr=t.hexdigest()}[Symbol.iterator](){return this.#ar.entries()}}a(116);class on{#cr=null;#dr=null;_fullReader=null;_rangeReaders=new Set;_source=null;constructor(t,e,i){this._source=t,this.#cr=e,this.#dr=i}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return Q(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new this.#cr(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new this.#dr(this,t,e);return this._rangeReaders.add(i),i}cancelAllRequests(t){this._fullReader?.cancel(t);for(const e of new Set(this._rangeReaders))e.cancel(t)}}class ln{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(){J("Abstract method `read` called")}cancel(t){J("Abstract method `cancel` called")}}class hn{_stream=null;constructor(t,e,i){this._stream=t}async read(){J("Abstract method `read` called")}cancel(t){J("Abstract method `cancel` called")}}function cn(t){return t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer}class dn extends on{_progressiveDone=!1;_queuedChunks=[];constructor(t){super(t,un,pn);const{pdfDataRangeTransport:e}=t,{initialData:i,progressiveDone:n}=e;if(i?.length>0){const t=cn(i);this._queuedChunks.push(t)}this._progressiveDone=n,e.addRangeListener((t,e)=>{this.#ur(t,e)}),e.addProgressListener((t,e)=>{void 0!==e&&this._fullReader?.onProgress?.({loaded:t,total:e})}),e.addProgressiveReadListener(t=>{this.#ur(void 0,t)}),e.addProgressiveDoneListener(()=>{this._fullReader?.progressiveDone(),this._progressiveDone=!0}),e.transportReady()}#ur(t,e){const i=cn(e);if(void 0===t)this._fullReader?this._fullReader._enqueue(i):this._queuedChunks.push(i);else{const e=this._rangeReaders.keys().find(e=>e._begin===t);Q(e,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),e._enqueue(i)}}getFullReader(){const t=super.getFullReader();return this._queuedChunks=null,t}getRangeReader(t,e){const 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 un extends ln{_done=!1;_queuedChunks=null;_requests=[];constructor(t){super(t);const{pdfDataRangeTransport:e,disableRange:i,disableStream:n}=t._source,{length:r,contentDispositionFilename:s}=e;this._queuedChunks=t._queuedChunks||[];for(const t of this._queuedChunks)this._loaded+=t.byteLength;this._done=t._progressiveDone,this._contentLength=r,this._isStreamingSupported=!n,this._isRangeSupported=!i,Tt(s)&&(this._filename=s),this._headersCapability.resolve()}_enqueue(t){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else 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};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||=!0}}class pn extends hn{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{this._requests.shift().resolve({value:t,done:!1});for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this.onDone?.()}}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this.onDone?.()}}function gn(t,e){const i=new Headers;if(!t||!e||"object"!=typeof e)return i;for(const t in e){const n=e[t];void 0!==n&&i.append(t,n)}return i}function fn(t){return URL.parse(t)?.origin??null}function mn({responseHeaders:t,isHttp:e,rangeChunkSize:i,disableRange:n}){const r={allowRangeRequests:!1,suggestedLength:void 0},s=parseInt(t.get("Content-Length"),10);if(!Number.isInteger(s))return r;if(r.suggestedLength=s,s<=2*i)return r;if(n||!e)return r;if("bytes"!==t.get("Accept-Ranges"))return r;return"identity"!==(t.get("Content-Encoding")||"identity")||(r.allowRangeRequests=!0),r}function bn(t){const e=t.get("Content-Disposition");if(e){let t=function(t){let e=!0,i=n("filename\\*","i").exec(t);if(i){i=i[1];let t=a(i);return t=unescape(t),t=o(t),t=l(t),s(t)}if(i=function(t){const e=[];let i;const r=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=r.exec(t));){let[,t,n,r]=i;if(t=parseInt(t,10),t in e){if(0===t)break}else e[t]=[n,r]}const s=[];for(let t=0;t<e.length&&t in e;++t){let[i,n]=e[t];n=a(n),i&&(n=unescape(n),0===t&&(n=o(n))),s.push(n)}return s.join("")}(t),i)return s(l(i));
2if(i=n("filename","i").exec(t),i){i=i[1];let t=a(i);return t=l(t),s(t)}function n(t,e){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function r(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const n=new TextDecoder(t,{fatal:!0}),r=ht(i);i=n.decode(r),e=!1}catch{}}return i}function s(t){return e&&/[\x80-\xff]/.test(t)&&(t=r("utf-8",t),e&&(t=r("iso-8859-1",t))),t}function a(t){if(t.startsWith('"')){const e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){const 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){const e=t.indexOf("'");return-1===e?t:r(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,n){if("q"===i||"Q"===i)return r(e,n=(n=n.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(t,e){return String.fromCharCode(parseInt(e,16))}));try{n=atob(n)}catch{}return r(e,n)})}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(Tt(t))return t}return null}function vn(t,e){return new at(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t,404===t||0===t&&e.startsWith("file:"))}function yn(t,e){if(t!==e)throw new Error(`Expected range response-origin "${t}" to match "${e}".`)}function wn(t,e,i,n){return fetch(t,{method:"GET",headers:e,signal:n.signal,mode:"cors",credentials:i?"include":"same-origin",redirect:"follow"})}function An(t,e){if(200!==t&&206!==t)throw vn(t,e)}function xn(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(K(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class En extends on{_responseOrigin=null;constructor(t){super(t,Cn,Sn),this.isHttp=/^https?:/i.test(t.url),this.headers=gn(this.isHttp,t.httpHeaders)}}class Cn extends ln{_abortController=new AbortController;_reader=null;constructor(t){super(t);const{disableRange:e,disableStream:i,length:n,rangeChunkSize:r,url:s,withCredentials:a}=t._source;this._contentLength=n,this._isStreamingSupported=!i,this._isRangeSupported=!e;const o=new Headers(t.headers);wn(s,o,a,this._abortController).then(i=>{t._responseOrigin=fn(i.url),An(i.status,s),this._reader=i.body.getReader();const n=i.headers,{allowRangeRequests:a,suggestedLength:o}=mn({responseHeaders:n,isHttp:t.isHttp,rangeChunkSize:r,disableRange:e});this._isRangeSupported=a,this._contentLength=o||this._contentLength,this._filename=bn(n),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new lt("Streaming is disabled.")),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;const{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:xn(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class Sn extends hn{_abortController=new AbortController;_readCapability=Promise.withResolvers();_reader=null;constructor(t,e,i){super(t,e,i);const{url:n,withCredentials:r}=t._source,s=new Headers(t.headers);s.append("Range",`bytes=${e}-${i-1}`),wn(n,s,r,this._abortController).then(e=>{yn(fn(e.url),t._responseOrigin),An(e.status,n),this._reader=e.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:{value:xn(t),done:!1}}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class _n extends on{#pr=new WeakMap;_responseOrigin=null;constructor(t){super(t,Tn,Pn),this.url=t.url,this.isHttp=/^https?:/i.test(this.url),this.headers=gn(this.isHttp,t.httpHeaders)}_request(t){const e=new XMLHttpRequest,i={validateStatus:null,onHeadersReceived:t.onHeadersReceived,onDone:t.onDone,onError:t.onError,onProgress:t.onProgress};this.#pr.set(e,i),e.open("GET",this.url),e.withCredentials=this._source.withCredentials;for(const[t,i]of this.headers)e.setRequestHeader(t,i);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",Q(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>t.onError(e.status),e.onreadystatechange=this.#gr.bind(this,e),e.onprogress=this.#fr.bind(this,e),e.send(null),e}#fr(t,e){const i=this.#pr.get(t);i?.onProgress?.(e)}#gr(t,e){const i=this.#pr.get(t);if(!i)return;if(t.readyState>
2=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==t.readyState)return;if(!this.#pr.has(t))return;if(this.#pr.delete(t),0===t.status&&this.isHttp)return void i.onError(t.status);const n=t.status||200;if(!i.validateStatus(n))return void i.onError(t.status);const r="string"!=typeof(s=t.response)?s:ht(s).buffer;var s;if(206===n){const e=t.getResponseHeader("Content-Range");/bytes (\d+)-(\d+)\/(\d+)/.test(e)?i.onDone(r):(K('Missing or invalid "Content-Range" header.'),i.onError(0))}else r?i.onDone(r):i.onError(t.status)}_abortRequest(t){this.#pr.has(t)&&(this.#pr.delete(t),t.abort())}getRangeReader(t,e){const i=super.getRangeReader(t,e);return i&&(i.onClosed=()=>this._rangeReaders.delete(i)),i}}class Tn extends ln{_cachedChunks=[];_done=!1;_requests=[];_storedError=null;constructor(t){super(t);const{length:e}=t._source;this._contentLength=e,this._fullRequestXhr=t._request({onHeadersReceived:this.#mr.bind(this),onDone:this.#br.bind(this),onError:this.#vr.bind(this),onProgress:this.#fr.bind(this)})}#mr(){const t=this._stream,{disableRange:e,rangeChunkSize:i}=t._source,n=this._fullRequestXhr;t._responseOrigin=fn(n.responseURL);const r=n.getAllResponseHeaders(),s=new Headers(r?r.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(t=>{const[e,...i]=t.split(": ");return[e,i.join(": ")]}):[]),{allowRangeRequests:a,suggestedLength:o}=mn({responseHeaders:s,isHttp:t.isHttp,rangeChunkSize:i,disableRange:e});a&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=bn(s),this._isRangeSupported&&t._abortRequest(n),this._headersCapability.resolve()}#br(t){if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._cachedChunks.push(t);if(this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}#vr(t){this._storedError=vn(t,this._stream.url),this._headersCapability.reject(this._storedError);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}#fr(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};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t);for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}}class Pn extends hn{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.#mr.bind(this),onDone:this.#br.bind(this),onError:this.#vr.bind(this),onProgress:null})}#mr(){const t=fn(this._requestXhr?.responseURL);try{yn(t,this._stream._responseOrigin)}catch(t){this._storedError=t,this.#vr(0)}}#br(t){if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunk=t;this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this.onClosed?.()}#vr(t){this._storedError??=vn(t,this._stream.url);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._abortRequest(this._requestXhr),this.onClosed?.()}}const Dn=/^[a-z][a-z0-9\-+.]+:/i;function Mn(t){const{Readable:e}=process.getBuiltinModule("stream");if("function"==typeof e.toWeb)return e.toWeb(t);return process.getBuiltinModule("module").createRequire("file:///home/runner/work/uw
2azi/uwazi/node_modules/pdfjs-dist/legacy/build/pdf.mjs")("node-readable-to-web-readable-stream").makeDefaultReadableStreamFromNodeReadable(t)}function Fn(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(K(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class In extends on{constructor(t){super(t,kn,Ln),this.url=function(t){if(Dn.test(t))return new URL(t);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(t))}(t.url),Q("file:"===this.url.protocol,"PDFNodeStream only supports file:// URLs.")}}class kn extends ln{_reader=null;constructor(t){super(t);const{disableRange:e,disableStream:i,length:n,rangeChunkSize:r}=t._source;this._contentLength=n,this._isStreamingSupported=!i,this._isRangeSupported=!e;const s=t.url,a=process.getBuiltinModule("fs");a.promises.lstat(s).then(t=>{const e=Mn(a.createReadStream(s));this._reader=e.getReader();const{size:i}=t;i<=2*r&&(this._isRangeSupported=!1),this._contentLength=i,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new lt("Streaming is disabled.")),this._headersCapability.resolve()}).catch(t=>{"ENOENT"===t.code&&(t=vn(0,s.href)),this._headersCapability.reject(t)})}async read(){await this._headersCapability.promise;const{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:Fn(t),done:!1})}cancel(t){this._reader?.cancel(t)}}class Ln extends hn{_readCapability=Promise.withResolvers();_reader=null;constructor(t,e,i){super(t,e,i);const n=t.url,r=process.getBuiltinModule("fs");try{const t=Mn(r.createReadStream(n,{start:e,end:i-1}));this._reader=t.getReader(),this._readCapability.resolve()}catch(t){this._readCapability.reject(t)}}async read(){await this._readCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:{value:Fn(t),done:!1}}cancel(t){this._reader?.cancel(t)}}const Rn=Symbol("INITIAL_DATA");class Bn{#yr=Object.create(null);#wr(t){return this.#yr[t]||={...Promise.withResolvers(),data:Rn}}get(t,e=null){if(e){const i=this.#wr(t);return i.promise.then(()=>e(i.data)),null}const i=this.#yr[t];if(!i||i.data===Rn)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){const e=this.#yr[t];return!!e&&e.data!==Rn}delete(t){const e=this.#yr[t];return!(!e||e.data===Rn)&&(delete this.#yr[t],!0)}resolve(t,e=null){const i=this.#wr(t);i.data=e,i.resolve()}clear(){for(const t in this.#yr){const{data:e}=this.#yr[t];e?.bitmap?.close()}this.#yr=Object.create(null)}*[Symbol.iterator](){for(const t in this.#yr){const{data:e}=this.#yr[t];e!==Rn&&(yield[t,e])}}}class Nn{#Ar=Promise.withResolvers();#It=null;#xr=!1;#Er=!!globalThis.FontInspector?.enabled;#Cr=null;#Sr=null;#_r=0;#Tr=0;#Pr=null;#Dr=null;#Mr=0;#Fr=0;#Ir=Object.create(null);#kr=[];#Lr=null;#Rr=[];#Br=new WeakMap;#Nr=null;static#Or=new Map;static#jr=new Map;static#Ur=new WeakMap;static#zr=null;static#Hr=new Set;constructor({textContentSource:t,container:e,viewport:i}){if(t instanceof ReadableStream)this.#Lr=t;else{if("object"!=typeof t)throw new Error('No "textContentSource" parameter specified.');this.#Lr=new ReadableStream({start(e){e.enqueue(t),e.close()}})}this.#It=this.#Dr=e,this.#Fr=i.scale*Ut.pixelRatio,this.#Mr=i.rotation,this.#Sr={div:null,properties:null,ctx:null};const{pageWidth:n,pageHeight:r,pageX:s,pageY:a}=i.rawDims;this.#Nr=[1,0,0,-1,-s,a+r],this.#Tr=n,this.#_r=r,Nn.#Vr(),e.style.setProperty("--min-font-size",Nn.#zr),jt(e,i),this.#Ar.promise.finally(()=>{Nn.#Hr.delete(this),this.#Sr=null,this.#Ir=null}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=ct.platform;return et(this,"fontFamilyMap",new Map([["sans-serif",(t&&e?"Calibri, ":"")+"sans-serif"],["monospace",(t&&e?"Lucida Console, ":"")+"monospace"]]))}render(){const t=()=>{this.#Pr.read().then(({value:e,done:i})=>{i?this.#Ar.resolve():(this.#Cr??=e.lang,Object.assign(this.#Ir,e.styles),this.#$r(e.items),t())},this.#Ar.reject)};return this.#Pr=this.#Lr.getReader(),Nn.#Hr.add(this),t(),this.#Ar.promise}update({viewport:t,onBefore:e=null}){const i=t.scale*Ut.pixelRatio,n=t.rotation;if(n!==this.#Mr&&(e?.(),this.#Mr=n,jt(this.#Dr,{rotation:n})),i!==this.#Fr){e?.(),this.#Fr=i;const t={div:null,properties:null,ctx:Nn.#Wr(this.#Cr)};for(const e of this.#Rr)t.properties=this.#Br.get(e),t.div=e,this.#Gr(t)}}cancel(){const t=new lt("TextLayer task cancelled.");this.#Pr?.cancel(t).catch(()=>{}),this.#Pr=null,this.#Ar.reject(t)}get textDivs(){return this.#Rr}get textContentItemsStr(){return this.#kr}#$r(t){if(this.#xr)return;this.#Sr.ctx??=Nn.#Wr(this.#Cr);const e=this.#Rr,i=this.#kr;for(const n of t){if(e.length>1e5)return K("Ignoring additional textDivs for performance reasons."),void(this.#xr=!0);if(void 0!==n.str)i.push(n.str),this.#Xr(n);else if("beginMarkedContentProps"===n.type||"beginMarkedContent"===n.type){const t=this.#It;this.#It=document.createElement("span"),this.#It.classList.add("markedContent"),n.id&&this.#It.setAttribute("id",`${n.id}`),"Artifact"===n.tag&&(this.#It.ariaHidden=!0),t.append(this.#It)}else"endMarkedContent"===n.type&&(this.#It=this.#It.parentNode)}}#Xr(t){const e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};this.#Rr.push(e);const n=ut.transform(this.#Nr,t.transform);let r=Math.atan2(n[1],n[0]);const s=this.#Ir[t.fontName];s.vertical&&(r+=Math.PI/2);let a=this.#Er&&s.fontSubstitution||s.fontFamily;a=Nn.fontFamilyMap.get(a)||a;const o=Math.hypot(n[2],n[3]),l=o*Nn.#qr(a,s,this.#Cr);let h,c;0===r?(h=n[4],c=n[5]-l):(h=n[4]+l*Math.sin(r),c=n[5]-l*Math.cos(r));const d=e.style;d.left=`${(100*h/this.#Tr).toFixed(2)}%`,d.top=`${(100*c/this.#_r).toFixed(2)}%`,d.setProperty("--font-height",`${o.toFixed(2)}px`),d.fontFamily=a,i.fontSize=o,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,this.#
vendor: 8,649 bytes, line 2
2Er&&(e.dataset.fontName=s.fontSubstitutionLoadedName||t.fontName),0!==r&&(i.angle=r*(180/Math.PI));let u=!1;if(t.str.length>1)u=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const 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&&(i.canvasWidth=s.vertical?t.height:t.width),this.#Br.set(e,i),this.#Sr.div=e,this.#Sr.properties=i,this.#Gr(this.#Sr),i.hasText&&this.#It.append(e),i.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation"),this.#It.append(t)}}#Gr(t){const{div:e,properties:i,ctx:n}=t,{style:r}=e;if(0!==i.canvasWidth&&i.hasText){const{fontFamily:t}=r,{canvasWidth:s,fontSize:a}=i;Nn.#Yr(n,a*this.#Fr,t);const{width:o}=n.measureText(e.textContent);o>0&&r.setProperty("--scale-x",s*this.#Fr/o)}0!==i.angle&&r.setProperty("--rotate",`${i.angle}deg`)}static cleanup(){if(!(this.#Hr.size>0)){this.#Or.clear();for(const{canvas:t}of this.#jr.values())t.remove();this.#jr.clear()}}static#Wr(t=null){let e=this.#jr.get(t||="");if(!e){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#jr.set(t,e),this.#Ur.set(e,{size:0,family:""})}return e}static#Yr(t,e,i){const n=this.#Ur.get(t);e===n.size&&i===n.family||(t.font=`${e}px ${i}`,n.size=e,n.family=i)}static#Vr(){if(null!==this.#zr)return;const 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.#zr=t.getBoundingClientRect().height,t.remove()}static#qr(t,e,i){const n=this.#Or.get(t);if(n)return n;const r=this.#Wr(i);r.canvas.width=r.canvas.height=30,this.#Yr(r,30,t);const s=r.measureText(""),a=s.fontBoundingBoxAscent,o=Math.abs(s.fontBoundingBoxDescent);r.canvas.width=r.canvas.height=0;let l=.8;return a?l=a/(a+o):(ct.platform.isFirefox&&K("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?l=e.ascent:e.descent&&(l=1+e.descent)),this.#Or.set(t,l),l}}function On(t={}){"string"==typeof t||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});const e=new jn,{docId:i}=e,r=t.url?function(t){if(t instanceof URL)return t.href;if("string"==typeof t){if(o)return t;const e=URL.parse(t,window.location);if(e)return e.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(t.url):null,s=t.data?function(t){if(o&&void 0!==n&&t instanceof n)throw new 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 ht(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"==typeof t&&!isNaN(t?.length))return new Uint8Array(t);throw new 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,l=!0===t.withCredentials,h=t.password??null,c=t.range instanceof Un?t.range:null,d=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:65536;let u=t.worker instanceof Vn?t.worker:null;const p=t.verbosity,g="string"!=typeof t.docBaseUrl||_t(t.docBaseUrl)?null:t.docBaseUrl,f=De(t.cMapUrl),m=!1!==t.cMapPacked,b=t.CMapReaderFactory||(o?si:Ye),v=De(t.iccUrl),y=De(t.standardFontDataUrl),w=t.StandardFontDataFactory||(o?ai:Ze),A=De(t.wasmUrl),x=t.WasmFactory||(o?oi:ei),E=!0!==t.stopAtErrors,C=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,S=!1!==t.isEvalSupported,_="boolean"==typeof t.isOffscreenCanvasSupported?t.isOffscreenCanvasSupported:!o,T="boolean"==typeof t.isImageDecoderSupported?t.isImageDecoderSupported:!o&&(ct.platform.isFirefox||!globalThis.chrome),P=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,D="boolean"==typeof t.disableFontFace?t.disableFontFace:o,M=!0===t.fontExtraProperties,F=!0===t.enableXfa,I=t.ownerDocument||globalThis.document,k=!0===t.disableRange,L=!0===t.disableStream,R=!0===t.disableAutoFetch,B=!0===t.pdfBug,N=t.CanvasFactory||(o?ri:Xe),O=t.FilterFactory||(o?ni:Je),j=!0===t.enableHWA,U=!1!==t.useWasm,z=c?c.length:t.length??NaN,H="boolean"==typeof t.useSystemFonts?t.useSystemFonts:!o&&!D,V="boolean"==typeof t.useWorkerFetch?t.useWorkerFetch:!!(b===Ye&&w===Ze&&x===ei&&f&&y&&A&&Ft(f,document.baseURI)&&Ft(y,document.baseURI)&&Ft(A,document.baseURI));X(p);const $={canvasFactory:new N({ownerDocument:I,enableHWA:j}),filterFactory:new O({docId:i,ownerDocument:I}),cMapReaderFactory:V?null:new b({baseUrl:f,isCompressed:m}),standardFontDataFactory:V?null:new w({baseUrl:y}),wasmFactory:V?null:new x({baseUrl:A})};u||(u=Vn.create({verbosity:p,port:en.workerPort}),e._worker=u);const W={docId:i,apiVersion:"5.4.624",data:s,password:h,disableAutoFetch:R,rangeChunkSize:d,length:z,docBaseUrl:g,enableXfa:F,evaluatorOptions:{maxImageSize:C,disableFontFace:D,ignoreErrors:E,isEvalSupported:S,isOffscreenCanvasSupported:_,isImageDecoderSupported:T,canvasMaxAreaInBytes:P,fontExtraProperties:M,useSystemFonts:H,useWasm:U,useWorkerFetch:V,cMapUrl:f,iccUrl:v,standardFontDataUrl:y,wasmUrl:A}},G={ownerDocument:I,pdfBug:B,styleElement:null,enableHWA:j,loadingParams:{disableAutoFetch:R,enableXfa:F}};return u.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const t=u.messageHandler.sendWithPromise("GetDocRequest",W,s?[s.buffer]:null);let n;if(c)n=new dn({pdfDataRangeTransport:c,disableRange:k,disableStream:L});else if(!s){if(!r)throw new Error("getDocument - no `url` parameter provided.");const t=Ft(r)?En:o?In:_n;n=new t({url:r,length:z,httpHeaders:a,withCredentials:l,rangeChunkSize:d,disableRange:k,disableStream:L})}return t.then(t=>{if(e.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const r=new We(i,t,u.port),s=new $n(r,e,n,G,$);e._transport=s,r.send("Ready",null)})}).catch(e._capability.reject),e}class jn{static#cn=0;_capability=Promise.withResolvers();_transport=null;_worker=null;docId="d"+jn.#cn++;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 Un{#Ar=Promise.withResolvers();#Kr=[];#Jr=[];#Qr=[];#Zr=[];constructor(t,e,i=!1,n=null){this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=n}addRangeListener(t){this.#Zr.push(t)}addProgressListener(t){this.#Qr.push(t)}addProgressiveReadListener(t){this.#Jr.push(t)}addProgressiveDoneListener(t){this.#Kr.push(t)}onDataRange(t,e){for(const i of this.#Zr)i(t,e)}onDataProgress(t,e){this.#Ar.promise.then(()=>{for(const i of this.#Qr)i(t,e)})}onDataProgressiveRead(t){this.#Ar.promise.then(()=>{for(const e of this.#Jr)e(t)})}onDataProgressiveDone(){this.#Ar.promise.then(()=>{for(const t of this.#Kr)t()})}transportReady(){this.#Ar.resolve()}requestDataRange(t,e){J("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class zn{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 et(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"}={}){const{renderingIntent:e}
2=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 Hn{#ts=!1;#es=Zt.instance;constructor(t,e,i,n=!1){this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=n?new Mt:null,this._pdfBug=n,this.commonObjs=i.commonObjs,this.objs=new Bn,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:n=0,dontFlip:r=!1}={}){return new Ct({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:r})}getAnnotations({intent:t="display"}={}){const{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 et(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}
vendor: 2,206 bytes, line 2
2render({canvasContext:t,canvas:e=t.canvas,viewport:i,intent:n="display",annotationMode:r=v.ENABLE,transform:s=null,background:a=null,optionalContentConfigPromise:o=null,annotationCanvasMap:l=null,pageColors:h=null,printAnnotationStorage:c=null,isEditing:d=!1,recordOperations:p=!1,operationsFilter:g=null}){this._stats?.time("Overall");const f=this._transport.getRenderingIntent(n,r,c,d),{renderingIntent:m,cacheKey:b}=f;this.#ts=!1,o||=this._transport.getOptionalContentConfig(m);let y=this._intentStates.get(b);y||(y=Object.create(null),this._intentStates.set(b,y)),y.streamReaderCancelTimeout&&(clearTimeout(y.streamReaderCancelTimeout),y.streamReaderCancelTimeout=null);const w=!!(m&u);y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(f));const A=Boolean(this._pdfBug&&globalThis.StepperManager?.enabled),x=!this.recordedBBoxes&&(p||A),E=t=>{if(y.renderTasks.delete(C),x){const t=C.gfx?.dependencyTracker.take();t&&(C.stepper&&C.stepper.setOperatorBBoxes(t,C.gfx.dependencyTracker.takeDebugMetadata()),p&&(this.recordedBBoxes=t))}w&&(this.#ts=!0),this.#is(),t?(C.capability.reject(t),this._abortOperatorList({intentState:y,reason:t instanceof Error?t:new Error(t)})):C.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},C=new Gn({callback:E,params:{canvas:e,canvasContext:t,dependencyTracker:x?new fi(e,y.operatorList.length,A):null,viewport:i,transform:s,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:!w,pdfBug:this._pdfBug,pageColors:h,enableHWA:this._transport.enableHWA,operationsFilter:g});(y.renderTasks||=new Set).add(C);const S=C.task;return Promise.all([y.displayReadyCapability.promise,o]).then(([t,e])=>{if(this.destroyed)E();else{if(this._stats?.time("Rendering"),!(e.renderingIntent&m))throw new Error("Mu
2st use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");C.initializeGraphics({transparency:t,optionalContentConfig:e}),C.operatorListChanged()}}).catch(E),S}getOperatorList({intent:t="display",annotationMode:e=v.ENABLE,printAnnotationStorage:i=null,isEditing:n=!1}={}){const r=this._transport.getRenderingIntent(t,e,i,n,!0);let s,a=this._intentStates.get(r.cacheKey);return a||(a=Object.create(null),this._intentStates.set(r.cacheKey,a)),a.opListReadCapability||(s=Object.create(null),s.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(r)),a.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:this.#es.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=>yt.textContent(t));const e=this.streamTextContent(t);return new Promise(function(t,i){const n=e.getReader(),r={items:[],styles:Object.create(null),lang:null};!function e(){n.read().then(function({value:i,done:n}){n?t(r):(r.lang??=i.lang,Object.assign(r.styles,i.styles),r.items.push(...i.items),e())},i)}()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),this.#ts=!1,Promise.all(t)}cleanup(t=!1){this.#ts=!0;const e=this.#is();return t&&e&&(this._stats&&=new Mt),e}#is(){if(!this.#ts||this.destroyed)return!1;for(const{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#ts=!1,!0}_startRenderPage(t,e){const i=this._intentStates.get(e);i&&(this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(t))}_renderPageChunk(t,e){for(let i=0,n=t.length;i<n;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const t of e.renderTasks)t.operatorListChanged();t.lastChunk&&this.#is()}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:i,modifiedIds:n}){const{map:r,transfer:s}=i,a=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:this.#es.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:r,modifiedIds:n},s).getReader(),o=this._intentStates.get(e);o.streamReader=a;const l=()=>{a.read().then(({value:t,done:e})=>{e?o.streamReader=null:this._transport.destroyed||(this._renderPageChunk(t,o),l())},t=>{if(o.streamReader=null,!this._transport.destroyed){if(o.operatorList){o.operatorList.lastChunk=!0;for(const t of o.renderTasks)t.operatorListChanged();this.#is()}if(o.displayReadyCapability)o.displayReadyCapability.reject(t);else{if(!o.opListReadCapability)throw t;o.opListReadCapability.reject(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 St){let i=100;return e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),void(t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i))}}if(t.streamReader.cancel(new lt(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[e,i]of this._intentStates)if(i===t){this._intentStates.delete(e);break}this.cleanup()}}}get stats(){return this._stats}}class Vn{#Ar=Promise.withResolvers();#ns=null;#Jn=null;#rs=null;static#ss=0;static#as=!1;static#os=new WeakMap;static{o&&(this.#as=!0,en.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(t,e)=>{const i=URL.parse(t);if(!i?.origin||"null"===i.origin)return!1;const n=new URL(e,i);return i.origin===n.origin},this._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},this.fromPort=t=>{var e;if(e="`PDFWorker.fromPort` - please use `PDFWorker.create` instead.",console.log("Deprecated API usage: "+e),!t?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return this.create(t)}}constructor({name:t=null,port:e=null,verbosity:i=q()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=i,e){if(Vn.#os.has(e))throw new Error("Cannot use more than one PDFWorker per port.");Vn.#os.set(e,this),this.#ls(e)}else this.#hs()}get promise(){return this.#Ar.promise}#cs(){this.#Ar.resolve(),this.#ns.send("configure",{verbosity:this.verbosity})}get port(){return this.#Jn}get messageHandler(){return this.#ns}
2#ls(t){this.#Jn=t,this.#ns=new We("main","worker",t),this.#ns.on("ready",()=>{}),this.#cs()}#hs(){if(Vn.#as||Vn.#ds)return void this.#us();let{workerSrc:t}=Vn;try{Vn._isSameOrigin(window.location,t)||(t=Vn._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new We("main","worker",e),n=()=>{r.abort(),i.destroy(),e.terminate(),this.destroyed?this.#Ar.reject(new Error("Worker was destroyed")):this.#us()},r=new AbortController;e.addEventListener("error",()=>{this.#rs||n()},{signal:r.signal}),i.on("test",t=>{r.abort(),!this.destroyed&&t?(this.#ns=i,this.#Jn=e,this.#rs=e,this.#cs()):n()}),i.on("ready",t=>{if(r.abort(),this.destroyed)n();else try{s()}catch{this.#us()}});const s=()=>{const t=new Uint8Array;i.send("test",t,[t.buffer])};return void s()}catch{Y("The worker has been disabled.")}this.#us()}#us(){Vn.#as||(K("Setting up fake worker."),Vn.#as=!0),Vn._setupFakeWorkerGlobal.then(t=>{if(this.destroyed)return void this.#Ar.reject(new Error("Worker was destroyed"));const e=new Ie;this.#Jn=e;const i="fake"+Vn.#ss++,n=new We(i+"_worker",i,e);t.setup(n,e),this.#ns=new We(i,i+"_worker",e),this.#cs()}).catch(t=>{this.#Ar.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this.#rs?.terminate(),this.#rs=null,Vn.#os.delete(this.#Jn),this.#Jn=null,this.#ns?.destroy(),this.#ns=null}static create(t){const e=this.#os.get(t?.port);
2if(e){if(e._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new Vn(t)}static get workerSrc(){if(en.workerSrc)return en.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#ds(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return et(this,"_setupFakeWorkerGlobal",(async()=>{if(this.#ds)return this.#ds;return(await(import(this.workerSrc))).WorkerMessageHandler})())}}class $n{downloadInfoCapability=Promise.withResolvers();#ps=null;#gs=new Map;#fs=null;#ms=new Map;#bs=new Map;#vs=new Map;#ys=null;#es=Zt.instance;constructor(t,e,i,n,r){this.messageHandler=t,this.loadingTask=e,this.#fs=i,this.commonObjs=new Bn,this.fontLoader=new xe({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.enableHWA=n.enableHWA,this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=r.canvasFactory,this.filterFactory=r.filterFactory,this.cMapReaderFactory=r.cMapReaderFactory,this.standardFontDataFactory=r.standardFontDataFactory,this.wasmFactory=r.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler(),this.#es.addListener(this.#ws.bind(this))}#ws(){const t=new Map,e=new Map;for(let i=0,n=this.#es.pagesNumber;i<n;i++){const n=this.#es.getPrevPageNumber(i+1)-1,r=this.#ms.get(n);r&&t.set(i,r);const s=this.#bs.get(n);s&&e.set(i,s)}this.#ms=t,this.#bs=e}#As(t,e=null){const i=this.#gs.get(t);if(i)return i;const n=this.messageHandler.sendWithPromise(t,e);return this.#gs.set(t,n),n}#fr({loaded:t,total:e}){this.loadingTask.onProgress?.({loaded:t,total:e,percent:vt(Math.round(t/e*100),0,100)})}get annotationStorage(){return et(this,"annotationStorage",new we)}getRenderingIntent(t,e=v.ENABLE,i=null,n=!1,r=!1){let s=d,a=ye;switch(t){case"any":s=c;break;case"display":break;case"print":s=u;break;default:K(`getRenderingIntent - invalid intent: ${t}`)}const o=s&u&&i instanceof Ae?i:this.annotationStorage;switch(e){case v.DISABLE:s+=f;break;case v.ENABLE:break;case v.ENABLE_FORMS:s+=p;break;case v.ENABLE_STORAGE:s+=g,a=o.serializable;break;default:K(`getRenderingIntent - invalid annotationMode: ${e}`)}n&&(s+=m),r&&(s+=b);const{ids:l,hash:h}=o.modifiedIds;return{renderingIntent:s,cacheKey:[s,a.hash,h].join("_"),annotationStorageSerializable:a,modifiedIds:l}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#ys?.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const e of this.#ms.values())t.push(e._destroy());this.#ms.clear(),this.#bs.clear(),this.#vs.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#gs.clear(),this.filterFactory.destroy(),Nn.cleanup(),this.#fs?.cancelAllRequests(new lt("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(t,e)=>{Q(this.#fs,"GetReader - no `BasePDFStream` instance available."),this.#ps=this.#fs.getFullReader(),this.#ps.onProgress=t=>this.#fr(t),e.onPull=()=>{this.#ps.read().then(function({value:t,done:i}){i?e.close():(Q(t instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{this.#ps.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("ReaderHeadersReady",async t=>{await this.#ps.headersReady;const{isStreamingSupported:e,isRangeSupported:i,contentLength:n}=this.#ps;return e&&i&&(this.#ps.onProgress=null),{isStreamingSupported:e,isRangeSupported:i,contentLength:n}}),t.on("GetRangeReader",(t,e)=>{Q(this.#fs,"GetRangeReader - no `BasePDFStream` instance available.");const i=this.#fs.getRangeReader(t.begin,t.end);i?(e.onPull=()=>{i.read().then(function({value:t,done:i}){i?e.close():(Q(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})}):e.close()}),t.on("GetDoc",({pdfInfo:t})=>{this.#es.pagesNumber=t.numPages,this._numPages=t.numPages,this._htmlForXfa=t.htmlForXfa,delete t.htmlForXfa,e._capability.resolve(new zn(t,this))}),t.on("DocException",t=>{e._capability.reject($e(t))}
2),t.on("PasswordRequest",t=>{this.#ys=Promise.withResolvers();try{if(!e.onPassword)throw $e(t);const i=t=>{t instanceof Error?this.#ys.reject(t):this.#ys.resolve({password:t})};e.onPassword(i,t.code)}catch(t){this.#ys.reject(t)}return this.#ys.promise}),t.on("DataLoaded",t=>{this.#fr({loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)}),t.on("StartRenderPage",t=>{if(this.destroyed)return;this.#ms.get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)}),t.on("commonobj",([e,i,n])=>{if(this.destroyed)return null;if(this.commonObjs.has(e))return null;switch(i){case"Font":if("error"in n){const t=n.error;K(`Error during font loading: ${t}`),this.commonObjs.resolve(e,t);break}const r=new _e(n),s=this._params.pdfBug&&globalThis.FontInspector?.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,a=new Ee(r,s,n.extra,n.charProcOperatorList);this.fontLoader.bind(a).catch(()=>t.sendWithPromise("FontFallback",{id:e})).finally(()=>{!a.fontExtraProperties&&a.data&&a.clearData(),this.commonObjs.resolve(e,a)});break;case"CopyLocalImage":const{imageRef:o}=n;Q(o,"The imageRef must be defined.");for(const t of this.#ms.values())for(const[,i]of t.objs)if(i?.ref===o)return i.dataLen?(this.commonObjs.resolve(e,structuredClone(i)),i.dataLen):null;break;case"FontPath":this.commonObjs.resolve(e,new Pe(n));break;case"Image":this.commonObjs.resolve(e,n);break;case"Pattern":const l=new Te(n);this.commonObjs.resolve(e,l.getIR());break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([t,e,i,n])=>{if(this.destroyed)return;const r=this.#ms.get(e);if(!r.objs.has(t))if(0!==r._intentStates.size)switch(i){case"Image":case"Pattern":r.objs.resolve(t,n);break;default:throw new Error(`Got unknown object type ${i}`)}else n?.bitmap?.close()}),t.on("DocProgress",t=>{this.destroyed||this.#fr(t)}),t.on("FetchBinaryData",async t=>{if(this.destroyed)throw new Error("Worker was destroyed.");const e=this[t.type];if(!e)throw new 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&&K("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this.#ps?.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.#es.pagesNumber)return Promise.reject(new Error("Invalid page request."));const e=t-1,i=this.#es.getPageId(t)-1,n=this.#bs.get(e);if(n)return n;const r=this.messageHandler.sendWithPromise("GetPage",{pageIndex:i}).then(t=>{if(this.destroyed)throw new Error("Transport destroyed");t.refStr&&this.#vs.set(t.refStr,i);const n=new Hn(e,t,this,this._params.pdfBug);return this.#ms.set(e,n),n});return this.#bs.set(e,r),r}async getPageIndex(t){if(!Me(t))throw new Error("Invalid pageIndex request.");const e=await this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen});return this.#es.getPageNumber(e+1)-1}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.#es.getPageId(t+1)-1,intent:e})}getFieldObjects(){return this.#As("GetFieldObjects")}hasJSActions(){return this.#As("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!=typeof t?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}
2getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return this.#As("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.#es.getPageId(t+1)-1})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.#es.getPageId(t+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#As("GetOptionalContentConfig").then(e=>new an(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=this.#gs.get(t);if(e)return e;const i=this.messageHandler.sendWithPromise(t,null).then(t=>({info:t[0],metadata:t[1]?new nn(t[1]):null,contentDispositionFilename:this.#ps?.filename??null,contentLength:this.#ps?.contentLength??null,hasStructTree:t[2]}));return this.#gs.set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of this.#ms.values()){if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`)}this.commonObjs.clear(),t||this.fontLoader.clear(),this.#gs.clear(),this.filterFactory.destroy(!0),Nn.cleanup()}}cachedPageNumber(t){if(!Me(t))return null;const e=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`,i=this.#vs.get(e);return i>=0?this.#es.getPageNumber(i+1):null}}class Wn{_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(){const{separateAnnots:t}=this._internalRenderTask.operatorList;if(!t)return!1;const{annotationCanvasMap:e}=this._internalRenderTask;return t.form||t.canvas&&e?.size>0}}class Gn{#xs=null;static#Es=new WeakSet;constructor({callback:t,params:e,objs:i,commonObjs:n,annotationCanvasMap:r,operatorList:s,pageIndex:a,canvasFactory:o,filterFactory:l,useRequestAnimationFrame:h=!1,pdfBug:c=!1,pageColors:d=null,enableHWA:u=!1,operationsFilter:p=null}){this.callback=t,this.params=e,this.objs=i,this.commonObjs=n,this.annotationCanvasMap=r,this.operatorListIdx=null,this.operatorList=s,this._pageIndex=a,this.canvasFactory=o,this.filterFactory=l,this._pdfBug=c,this.pageColors=d,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 Wn(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(Gn.#Es.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");Gn.#Es.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());const{viewport:i,transform:n,background:r,dependencyTracker:s}=this.params,a=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new tn(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors,s),this.gfx.beginDrawing({transform:n,viewport:i,transparency:t,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,e=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#xs&&(window.cancelAnimationFrame(this.#xs),this.#xs=null),Gn.#Es.delete(this._canvas),t||=new St(`Rendering cancelled, page ${this._pageIndex+1}`,e),this.callback(t),this.task.onError?.(t)}operatorListChanged(){this.graphicsReady?(this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||=this._continueBound}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#xs=window.requestAnimationFrame(()=>{this.#xs=null,this._nextBound().catch(this._cancelBound)}
vendor: 52,377 bytes, line 2
2):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(),Gn.#Es.delete(this._canvas),this.callback())))}}const Xn="5.4.624",qn="384c6208b";class Yn{#Cs=null;#Ss=null;#_s;#Ts=null;#Ps=!1;#Ds=!1;#u=null;#Ms;#Fs=null;#C=null;static#Is=null;static get _keyboardManager(){return et(this,"_keyboardManager",new oe([[["Escape","mac+Escape"],Yn.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Yn.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Yn.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Yn.prototype._moveToPrevious],[["Home","mac+Home"],Yn.prototype._moveToBeginning],[["End","mac+End"],Yn.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:e=null}){t?(this.#Ds=!1,this.#u=t):this.#Ds=!0,this.#C=t?._uiManager||e,this.#Ms=this.#C._eventBus,this.#_s=t?.color?.toUpperCase()||this.#C?.highlightColors.values().next().value||"#FFFF98",Yn.#Is||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){const t=this.#Cs=document.createElement("button");t.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`);const e=this.#C._signal;t.addEventListener("click",this.#ks.bind(this),{signal:e}),t.addEventListener("keydown",this.#Ls.bind(this),{signal:e});const i=this.#Ss=document.createElement("span");return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=this.#_s,t.append(i),t}renderMainDropdown(){const t=this.#Ts=this.#Rs();return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}#Rs(){const t=document.createElement("div"),e=this.#C._signal;t.addEventListener("contextmenu",It,{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`);for(const[i,n]of this.#C.highlightColors){const r=document.createElement("button");r.tabIndex="0",r.role="option",r.setAttribute("data-color",n),r.title=i,r.setAttribute("data-l10n-id",Yn.#Is[i]);const s=document.createElement("span");r.append(s),s.className="swatch",s.style.backgroundColor=n,r.ariaSelected=n===this.#_s,r.addEventListener("click",this.#Bs.bind(this,n),{signal:e}),t.append(r)}return t.addEventListener("keydown",this.#Ls.bind(this),{signal:e}),t}#Bs(t,e){e.stopPropagation(),this.#Ms.dispatch("switchannotationeditorparams",{source:this,type:A.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)}_colorSelectFromKeyboard(t){if(t.target===this.#Cs)return void this.#ks(t);const e=t.target.getAttribute("data-color");e&&this.#Bs(e,t)}_moveToNext(t){this.#Ns?t.target!==this.#Cs?t.target.nextSibling?.focus():this.#Ts.firstElementChild?.focus():this.#ks(t)}_moveToPrevious(t){t.target!==this.#Ts?.firstElementChild&&t.target!==this.#Cs?(this.#Ns||this.#ks(t),t.target.previousSibling?.focus()):this.#Ns&&this._hideDropdownFromKeyboard()}_moveToBeginning(t){this.#Ns?this.#Ts.firstElementChild?.focus():this.#ks(t)}_moveToEnd(t){this.#Ns?this.#Ts.lastElementChild?.focus():this.#ks(t)}#Ls(t){Yn._keyboardManager.exec(this,t)}#ks(t){if(this.#Ns)return void this.hideDropdown();if(this.#Ps=0===t.detail,this.#Fs||(this.#Fs=new AbortController,window.addEventListener("pointerdown",this.#y.bind(this),{signal:this.#C.combinedSignal(this.#Fs)})),this.#Cs.ariaExpanded="true",this.#Ts)return void this.#Ts.classList.remove("hidden");const e=this.#Ts=this.#Rs();this.#Cs.append(e)}#y(t){this.#Ts?.contains(t.target)||this.hideDropdown()}hideDropdown(){this.#Ts?.classList.add("hidden"),this.#Cs.ariaExpanded="false",this.#Fs?.abort(),this.#Fs=null}get#Ns(){return this.#Ts&&!this.#Ts.classList.contains("hidden")}_hideDropdownFromKeyboard(){this.#Ds||(this.#Ns?(this.hideDropdown(),this.#Cs.focus({preventScroll:!0,focusVisible:this.#Ps})):this.#u?.unselect())}updateColor(t){if(this.#Ss&&(this.#Ss.style.backgroundColor=t),!this.#Ts)return;const e=this.#C.highlightColors.values();for(const i of this.#Ts.children)i.ariaSelected=e.next().value===t.toUpperCase()}destroy(){this.#Cs?.remove(),this.#Cs=null,this.#Ss=null,this.#Ts?.remove(),this.#Ts=null}}class Kn{#Os=null;#u=null;#C=null;static#Is=null;constructor(t){this.#u=t,this.#C=t._uiManager,Kn.#Is||=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"})}renderButton(){if(this.#Os)return this.#Os;const{editorType:t,colorType:e,color:i}=this.#u,n=this.#Os=document.createElement("input");return n.type="color",n.value=i||"#000000",n.className="basicColorPicker",n.tabIndex=0,n.setAttribute("data-l10n-id",Kn.#Is[t]),n.addEventListener("input",()=>{this.#C.updateParams(e,n.value)},{signal:this.#C._signal}),n}update(t){this.#Os&&(this.#Os.value=t)}destroy(){this.#Os?.remove(),this.#Os=null}hideDropdown(){}}a(531);function Jn(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function Qn(t){return Math.max(0,Math.min(255,255*t))}class Zn{static CMYK_G([t,e,i,n]){return["G",1-Math.min(1,.3*t+.59*i+.11*e+n)]}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=Qn(t),t,t]}static G_HTML([t]){const e=Jn(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(Qn)}static RGB_HTML(t){return`#${t.map(Jn).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,i,n]){return["RGB",1-Math.min(1,t+n),1-Math.min(1,i+n),1-Math.min(1,e+n)]}static CMYK_rgb([t,e,i,n]){return[Qn(1-Math.min(1,t+n)),Qn(1-Math.min(1,i+n)),Qn(1-Math.min(1,e+n))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,i]){const n=1-t,r=1-e,s=1-i;return["CMYK",n,r,s,Math.min(n,r,s)]}}class tr{create(t,e,i=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),i||(n.setAttribute("width",`${t}px`),n.setAttribute("height",`${e}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${t} ${e}`),n}createElement(t){if("string"!=typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){J("Abstract method `_createSVG` called.")}}class er extends tr{_createSVG(t){return document.createElementNS(At,t)}}const ir=new WeakSet,nr=60*(new Date).getTimezoneOffset()*1e3;class rr{static create(t){switch(t.data.annotationType){case I.LINK:return new or(t);case I.TEXT:return new lr(t);case I.WIDGET:switch(t.data.fieldType){case"Tx":return new cr(t);case"Btn":return t.data.radioButton?new pr(t):t.data.checkBox?new ur(t):new gr(t);case"Ch":return new fr(t);case"Sig":return new dr(t)}return new hr(t);case I.POPUP:return new mr(t);case I.FREETEXT:return new vr(t);case I.LINE:return new yr(t);case I.SQUARE:return new wr(t);case I.CIRCLE:return new Ar(t);case I.POLYLINE:return new xr(t);case I.CARET:return new Cr(t);case I.INK:return new Sr(t);case I.POLYGON:return new Er(t);case I.HIGHLIGHT:return new _r(t);case I.UNDERLINE:return new Tr(t);case I.SQUIGGLY:return new Pr(t);case I.STRIKEOUT:return new Dr(t);case I.STAMP:return new Mr(t);case I.FILEATTACHMENT:return new Fr(t);default:return new sr(t)}}}class sr{#js=null;#Us=!1;#zs=null;constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!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)),n&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!(!t?.str&&!e?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return sr._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){const{data:t}=this,e=this.annotationStorage?.getEditor(t.id);return e?e.getData():t}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){const t=this.annotationStorage?.getEditor(this.data.id);if(t)return t.commentButtonPositionInPage;const{quadPoints:e,inkLists:i,rect:n}=this.data;let r=-1/0,s=-1/0;if(e?.length>=8){for(let t=0;t<e.length;t+=8)e[t+1]>s?(s=e[t+1],r=e[t+2]):e[t+1]===s&&(r=Math.max(r,e[t+2]));return[r,s]}if(i?.length>=1){for(const t of i)for(let e=0,i=t.length;e<i;e+=2)t[e+1]>s?(s=t[e+1],r=t[e]):t[e+1]===s&&(r=Math.max(r,t[e]));if(r!==1/0)return[r,s]}return n?[n[2],n[3]]:null}_normalizePoint(t){const{page:{view:e},viewport:{rawDims:{pageWidth:i,pageHeight:n,pageX:r,pageY:s}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-r)/i,t[1]=100*(t[1]-s)/n,t}get commentText(){const{data:t}=this;return this.annotationStorage.getRawValue(`${y}${t.id}`)?.popup?.contents||t.contentsObj?.str||""}set commentText(t){const{data:e}=this,i={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:i})||this.annotationStorage.setValue(`${y}${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.#zs?.popup||this.popup)?.remove(),this.#zs=this.popup=null}updateEdited(t){if(!this.container)return;t.rect&&(this.#js||={rect:this.data.rect.slice(0)});const{rect:e,popup:i}=t;e&&this.#Hs(e);let n=this.#zs?.popup||this.popup;!n&&i?.text&&(this._createPopup(i),n=this.#zs.popup),n&&(n.updateEdited(t),i?.deleted&&(n.remove(),this.#zs=null,this.popup=null))}resetEdited(){this.#js&&(this.#Hs(this.#js.rect),this.#zs?.popup.resetEdited(),this.#js=null)}#Hs(t){const{container:{style:e},data:{rect:i,rotation:n},parent:{viewport:{rawDims:{pageWidth:r,pageHeight:s,pageX:a,pageY:o}}}}=this;i?.splice(0,4,...t),e.left=100*(t[0]-a)/r+"%",e.top=100*(s-t[3]+o)/s+"%",0===n?(e.width=100*(t[2]-t[0])/r+"%",e.height=100*(t[3]-t[1])/s+"%"):this.setRotation(n)}_createContainer(t){const{data:e,parent:{page:i,viewport:n}}=this,r=document.createElement("section");r.setAttribute("data-annotation-id",e.id),this instanceof hr||this instanceof or||(r.tabIndex=0);const{style:s}=r;if(s.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(r.title=e.alternativeText),e.noRotate&&r.classList.add("norotate"),!e.rect||this instanceof mr){const{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,r),r}const{width:a,height:o}=this;if(!t&&e.borderStyle.width>0){s.borderWidth=`${e.borderStyle.width}px`;const t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;if(t>0||i>0){const e=`calc(${t}px * var(--total-scale-factor)) / calc(${i}px * var(--total-scale-factor))`;s.borderRadius=e}else if(this instanceof pr){const t=`calc(${a}px * var(--total-scale-factor)) / calc(${o}px * var(--total-scale-factor))`;s.borderRadius=t}switch(e.borderStyle.style){case k:s.borderStyle="solid";break;case L:s.borderStyle="dashed";break;case R:K("Unimplemented border style: beveled");break;case B:K("Unimplemented border style: inset");break;case N:s.borderBottomStyle="solid"}const n=e.borderColor||null;n?(this.#Us=!0,s.borderColor=ut.makeHexColor(0|n[0],0|n[1],0|n[2])):s.borderWidth=0}const l=ut.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:c,pageX:d,pageY:u}=n.rawDims;s.left=100*(l[0]-d)/h+"%",s.top=100*(l[1]-u)/c+"%";const{rotation:p}=e;return e.hasOwnCanvas||0===p?(s.width=100*a/h+"%",s.height=100*o/c+"%"):this.setRotation(p,r),r}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:i,pageHeight:n}=this.parent.viewport.rawDims;let{width:r,height:s}=this;t%180!=0&&([r,s]=[s,r]),e.style.width=100*r/i+"%",e.style.height=100*s/n+"%",e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(t,e,i)=>{const n=i.detail[t],r=n[0],s=n.slice(1);i.target.style[e]=Zn[`${r}_HTML`](s),this.annotationStorage.setValue(this.data.id,{[e]:Zn[`${r}_rgb`](s)})};return et(this,"_commonActions",{display:t=>{const{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=>{const{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout(()=>t.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=>{const e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){const i=this._commonActions;for(const n of Object.keys(e.detail)){const r=t[n]||i[n];r?.(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const[n,r]of Object.entries(e)){const s=i[n];if(s){s({detail:{[n]:r},target:t}),delete e[n]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,i,n,r]=this.data.rect.map(t=>Math.fround(t));if(8===t.length){const[s,a,o,l]=t.subarray(2,6);if(n===s&&r===a&&e===o&&i===l)return}const{style:s}=this.container;let a;if(this.#Us){const{borderColor:t,borderWidth:e}=s;s.borderWidth=0,a=["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="${t}" stroke-width="${e}">`],this.container.classList.add("hasBorder")}const o=n-e,l=r-i,{svgFactory:h}=this,c=h.createElement("svg");c.classList.add("quadrilateralsContainer"),c.setAttribute("width",0),c.setAttribute("height",0),c.role="none";const d=h.createElement("defs");c.append(d);const u=h.createElement("clipPath"),p=`clippath_${this.data.id}`;u.setAttribute("id",p),u.setAttribute("clipPathUnits","objectBoundingBox"),d.append(u);for(let i=2,n=t.length;i<n;i+=8){const n=t[i],s=t[i+1],c=t[i+2],d=t[i+3],p=h.createElement("rect"),g=(c-e)/o,f=(r-s)/l,m=(n-c)/o,b=(s-d)/l;p.setAttribute("x",g),p.setAttribute("y",f),p.setAttribute("width",m),p.setAttribute("height",b),u.append(p),a?.push(`<rect vector-effect="non-scaling-stroke" x="${g}" y="${f}" width="${m}" height="${b}"/>`)}this.#Us&&(a.push("</g></svg>')"),s.backgroundImage=a.join("")),this.container.append(c),this.container.style.clipPath=`url(#${p})`}_createPopup(t=null){const{data:e}=this;let i,n;t?(i={str:t.text},n=t.date):(i=e.contentsObj,n=e.modificationDate),this.#zs=new mr({data:{color:e.color,titleObj:e.titleObj,modificationDate:n,contentsObj:i,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]})}get hasPopupElement(){return!!(this.#zs||this.popup||this.data.popupRef)}get extraPopupElement(){return this.#zs}render(){J("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const i=[];if(this._fieldObjects){const n=this._fieldObjects[t];if(n)for(const{page:t,id:r,exportValues:s}of n){if(-1===t)continue;if(r===e)continue;const n="string"==typeof s?s:null,a=document.querySelector(`[data-element-id="${r}"]`);!a||ir.has(a)?i.push({id:r,exportValue:n,domElement:a}):K(`_getElementsByName - element not allowed: ${r}`)}return i}for(const n of document.getElementsByName(t)){const{exportValue:t}=n,r=n.getAttribute("data-element-id");r!==e&&(ir.has(n)&&i.push({id:r,exportValue:t,domElement:n}))}return i}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{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 ar extends sr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.editor=t.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){const{editor:t}=this;t.hasComment&&this._createPopup(t.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get 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 or extends sr{constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!e?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let n=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),n=!0):t.action?(this._bindNamedAction(i,t.action,t.overlaidText),n=!0):t.attachment?(this.#Vs(i,t.attachment,t.overlaidText,t.attachmentDest),n=!0):t.setOCGState?(this.#$s(i,t.setOCGState,t.overlaidText),n=!0):t.dest?(this._bindLink(i,t.dest,t.overlaidText),n=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),n=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&(this.contentElement=i,this.container.append(i)),this.container}#Ws(){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.#Ws(),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.#Ws()}#Vs(t,e,i="",n=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,n),!1),this.#Ws()}#$s(t,e,i=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),i&&(t.title=i),this.#Ws()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(e.actions)){const r=i.get(n);r&&(t[r]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:n}}),!1))}e.overlaidText&&(t.title=e.overlaidText),t.onclick||(t.onclick=()=>!1),this.#Ws()}_bindResetFormAction(t,e){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),this.#Ws(),!this._fieldObjects)return K('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(i||(t.onclick=()=>!1));t.onclick=()=>{i?.();const{fields:t,refs:n,include:r}=e,s=[];if(0!==t.length||0!==n.length){const e=new Set(n);for(const i of t){const t=this._fieldObjects[i]||[];for(const{id:i}of t)e.add(i)}for(const t of Object.values(this._fieldObjects))for(const i of t)e.has(i.id)===r&&s.push(i)}else for(const t of Object.values(this._fieldObjects))s.push(...t);const a=this.annotationStorage,o=[];for(const t of s){const{id:e}=t;switch(o.push(e),t.type){case"text":{const i=t.defaultValue||"";a.setValue(e,{value:i});break}case"checkbox":case"radiobutton":{const i=t.defaultValue===t.exportValues;a.setValue(e,{value:i});break}case"combobox":case"listbox":{const i=t.defaultValue||"";a.setValue(e,{value:i});break}default:continue}const i=document.querySelector(`[data-element-id="${e}"]`);i&&(ir.has(i)?i.dispatchEvent(new Event("resetform")):K(`_bindResetFormAction - element not allowed: ${e}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}}),!1}}}class lr extends sr{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const 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}}class hr extends sr{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&("CANVAS"===t.previousSibling?.nodeName&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return ct.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,n,r){i.includes("mouse")?t.addEventListener(i,t=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:r(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}r&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:r(t)}})})}_setEventListeners(t,e,i,n){for(const[r,s]of i)("Action"===s||this.data.actions?.[s])&&("Focus"!==s&&"Blur"!==s||(e||={focused:!1}),this._setEventListener(t,e,r,s,n),"Focus"!==s||this.data.actions?.Blur?"Blur"!==s||this.data.actions?.Focus||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null))}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":ut.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||9,r=t.style;let s;const a=t=>Math.round(10*t)/10;if(this.data.multiLine){const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),e=t/(Math.round(t/(h*n))||1);s=Math.min(n,a(e/h))}else{const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2);s=Math.min(n,a(t/h))}r.fontSize=`calc(${s}px * var(--total-scale-factor))`,r.color=ut.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(r.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class cr extends hr{constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,i,n){const r=this.annotationStorage;for(const s of this._getElementsByName(t.name,t.id))s.domElement&&(s.domElement[e]=i),r.setValue(s.id,{[n]:i})}render(){const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){const n=t.getValue(e,{value:this.data.fieldValue});let r=n.value||"";const s=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;s&&r.length>s&&(r=r.slice(0,s));let a=n.formattedValue||this.data.textContent?.join("\n")||null;a&&this.data.comb&&(a=a.replaceAll(/\s+/g,""));const o={userValue:r,formattedValue:a,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=a??r,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type=this.data.password?"password":"text",i.setAttribute("value",a??r),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),ir.add(i),this.contentElement=i,i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=0;const{datetimeFormat:l,datetimeType:h,timeStep:c}=this.data,d=!!h&&this.enableScripting;l&&(i.title=l),this._setRequired(i,this.data.required),s&&(i.maxLength=s),i.addEventListener("input",n=>{t.setValue(e,{value:n.target.value}),this.setPropertyOnSiblings(i,"value",n.target.value,"value"),o.formattedValue=null}),i.addEventListener("resetform",t=>{const e=this.data.defaultFieldValue??"";i.value=o.userValue=e,o.formattedValue=null});let u=t=>{const{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;const{target:e}=t;if(d&&(e.type=h,c&&(e.step=c)),o.userValue){const t=o.userValue;if(d)if("time"===h){const i=new Date(t),n=[i.getHours(),i.getMinutes(),i.getSeconds()];e.value=n.map(t=>t.toString().padStart(2,"0")).join(":")}else e.value=new Date(t-nr).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);const n={value(i){o.userValue=i.detail.value??"",d||t.setValue(e,{value:o.userValue.toString()}),i.target.value=o.userValue},formattedValue(i){const{formattedValue:n}=i.detail;o.formattedValue=n,null!=n&&i.target!==document.activeElement&&(i.target.value=n);const r={formattedValue:n};d&&(r.value=n),t.setValue(e,r)},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{const{charLimit:n}=i.detail,{target:r}=i;if(0===n)return void r.removeAttribute("maxLength");r.setAttribute("maxLength",n);let s=o.userValue;!s||s.length<=n||(s=s.slice(0,n),r.value=o.userValue=s,t.setValue(e,{value:s}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,willCommit:!0,commitKey:1,selStart:r.selectionStart,selEnd:r.selectionEnd}}))}};this._dispatchEventFromSandbox(n,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;const{value:n}=t.target;o.lastCommittedValue!==n&&(o.lastCommittedValue=n,o.userValue=n,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,willCommit:!0,commitKey:i,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))});const n=u;u=null,i.addEventListener("blur",t=>{if(!o.focused||!t.relatedTarget)return;this.data.actions?.Blur||(o.focused=!1);const{target:i}=t;let{value:r}=i;if(d){if(r&&"time"===h){const t=r.split(":").map(t=>parseInt(t,10));r=new Date(2e3,0,1,t[0],t[1],t[2]||0).valueOf(),i.step=""}else r.includes("T")||(r=`${r}T00:00`),r=new Date(r).valueOf();i.type="text"}o.userValue=r,o.lastCommittedValue!==r&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:o.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}),n(t)}),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",t=>{o.lastCommittedValue=null;const{data:i,target:n}=t,{value:r,selectionStart:s,selectionEnd:a}=n;let l=s,h=a;switch(t.inputType){case"deleteWordBackward":{const t=r.substring(0,s).match(/\w*[^\w]*$/);t&&(l-=t[0].length);break}case"deleteWordForward":{const t=r.substring(s).match(/^[^\w]*\w*/);t&&(h+=t[0].length);break}case"deleteContentBackward":s===a&&(l-=1);break;case"deleteContentForward":s===a&&(h+=1)}t.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,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){const t=(this.data.rect[2]-this.data.rect[0])/s;i.classList.add("comb"),i.style.letterSpacing=`calc(${t}px * var(--total-scale-factor) - 1ch)`}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class dr extends hr{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class ur extends hr{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"==typeof n&&(n="Off"!==n,t.setValue(i,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const r=document.createElement("input");return ir.add(r),r.setAttribute("data-element-id",i),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="checkbox",r.name=e.fieldName,n&&r.setAttribute("checked",!0),r.setAttribute("exportValue",e.exportValue),r.tabIndex=0,r.addEventListener("change",n=>{const{name:r,checked:s}=n.target;for(const n of this._getElementsByName(r,i)){const i=s&&n.exportValue===e.exportValue;n.domElement&&(n.domElement.checked=i),t.setValue(n.id,{value:i})}t.setValue(i,{value:s})}),r.addEventListener("resetform",t=>{const i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue}),this.enableScripting&&this.hasJSActions&&(r.addEventListener("updatefromsandbox",e=>{const n={value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}};this._dispatchEventFromSandbox(n,e)}),this._setEventListeners(r,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(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class pr extends hr{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"==typeof n&&(n=n!==e.buttonValue,t.setValue(i,{value:n})),n)for(const n of this._getElementsByName(e.fieldName,i))t.setValue(n.id,{value:!1});const r=document.createElement("input");if(ir.add(r),r.setAttribute("data-element-id",i),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="radio",r.name=e.fieldName,n&&r.setAttribute("checked",!0),r.tabIndex=0,r.addEventListener("change",e=>{const{name:n,checked:r}=e.target;for(const e of this._getElementsByName(n,i))t.setValue(e.id,{value:!1});t.setValue(i,{value:r})}),r.addEventListener("resetform",t=>{const i=e.defaultFieldValue;t.target.checked=null!=i&&i===e.buttonValue}),this.enableScripting&&this.hasJSActions){const n=e.buttonValue;r.addEventListener("updatefromsandbox",e=>{const r={value:e=>{const r=n===e.detail.value;for(const n of this._getElementsByName(e.target.name)){const e=r&&n.id===i;n.domElement&&(n.domElement.checked=e),t.setValue(n.id,{value:e})}}};this._dispatchEventFromSandbox(r,e)}),this._setEventListeners(r,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)}return this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class gr extends or{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({},t)})),t}}class fr extends hr{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),n=document.createElement("select");ir.add(n),n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=0;let r=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",t=>{const e=this.data.defaultFieldValue;for(const t of n.options)t.selected=t.value===e});for(const t of this.data.options){const e=document.createElement("option");e.textContent=t.displayValue,e.value=t.exportValue,i.value.includes(t.exportValue)&&(e.setAttribute("selected",!0),r=!1),n.append(e)}let s=null;if(r){const t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),n.prepend(t),s=()=>{t.remove(),n.removeEventListener("input",s),s=null},n.addEventListener("input",s)}const a=t=>{const e=t?"value":"textContent",{options:i,multiple:r}=n;return r?Array.prototype.filter.call(i,t=>t.selected).map(t=>t[e]):-1===i.selectedIndex?null:i[i.selectedIndex][e]};let o=a(!1);const l=t=>{const e=t.target.options;return Array.prototype.map.call(e,t=>({displayValue:t.textContent,exportValue:t.value}))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",i=>{const r={value(i){s?.();const r=i.detail.value,l=new Set(Array.isArray(r)?r:[r]);for(const t of n.options)t.selected=l.has(t.value);t.setValue(e,{value:a(!0)}),o=a(!1)},multipleSelection(t){n.multiple=!0},remove(i){const r=n.options,s=i.detail.remove;if(r[s].selected=!1,n.remove(s),r.length>0){-1===Array.prototype.findIndex.call(r,t=>t.selected)&&(r[0].selected=!0)}t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},clear(i){for(;0!==n.length;)n.remove(0);t.setValue(e,{value:null,items:[]}),o=a(!1)},insert(i){const{index:r,displayValue:s,exportValue:h}=i.detail.insert,c=n.children[r],d=document.createElement("option");d.textContent=s,d.value=h,c?c.before(d):n.append(d),t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},items(i){const{items:r}=i.detail;for(;0!==n.length;)n.remove(0);for(const t of r){const{displayValue:e,exportValue:i}=t,r=document.createElement("option");r.textContent=e,r.value=i,n.append(r)}n.options.length>0&&(n.options[0].selected=!0),t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},indices(i){const n=new Set(i.detail.indices);for(const t of i.target.options)t.selected=n.has(t.index);t.setValue(e,{value:a(!0)}),o=a(!1)},editable(t){t.target.disabled=!t.detail.editable}};this._dispatchEventFromSandbox(r,i)}),n.addEventListener("input",i=>{const n=a(!0),r=a(!1);t.setValue(e,{value:n}),i.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:r,changeEx:n,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],t=>t.target.value)):n.addEventListener("input",function(i){t.setValue(e,{value:a(!0)})}),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class mr extends sr{constructor(t){const{data:e,elements:i,parent:n}=t,r=!!n._commentManager;if(super(t,{isRenderable:!r&&sr._hasPopupData(e)}),this.elements=i,r&&sr._hasPopupData(e)){const t=this.popup=this.#Gs();for(const e of i)e.popup=t}else this.popup=null}#Gs(){return new br({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})}render(){const{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";const e=this.popup=this.#Gs(),i=[];for(const 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=>`${bt}${t}`).join(",")),this.container}}class br{#K=null;#Xs=this.#Ls.bind(this);#qs=this.#Ys.bind(this);#Ks=this.#Js.bind(this);#Qs=this.#Zs.bind(this);#ta=null;#It=null;#ea=null;#ia=null;#na=null;#ra=null;#sa=null;#aa=!1;#oa=null;#la=null;#j=null;#ha=null;#ca=null;#Ce=null;#da=null;#we=null;#ua=null;#js=null;#pa=!1;#ga=null;#fa=null;constructor({container:t,color:e,elements:i,titleObj:n,modificationDate:r,contentsObj:s,richText:a,parent:o,rect:l,parentRect:h,open:c,commentManager:d=null}){this.#It=t,this.#ua=n,this.#ea=s,this.#we=a,this.#ra=o,this.#ta=e,this.#da=l,this.#sa=h,this.#na=i,this.#K=d,this.#ga=i[0],this.#ia=Lt.toDateObject(r),this.trigger=i.flatMap(t=>t.getElementsToTriggerPopup()),d||(this.#ma(),this.#It.hidden=!0,c&&this.#Zs())}#ma(){if(this.#la)return;this.#la=new AbortController;const{signal:t}=this.#la;for(const e of this.trigger)e.addEventListener("click",this.#Qs,{signal:t}),e.addEventListener("pointerenter",this.#Ks,{signal:t}),e.addEventListener("pointerleave",this.#qs,{signal:t}),e.classList.add("popupTriggerArea");for(const e of this.#na)e.container?.addEventListener("keydown",this.#Xs,{signal:t})}#ba(){const t=this.#na.find(t=>t.hasCommentButton);t&&(this.#ca=t._normalizePoint(t.commentButtonPosition))}renderCommentButton(){if(this.#ha)return void(this.#ha.parentNode||this.#ga.container.after(this.#ha));if(this.#ca||this.#ba(),!this.#ca)return;const{signal:t}=this.#la=new AbortController,e=this.#ga.hasOwnCommentButton,i=()=>{this.#K.toggleCommentPopup(this,!0,void 0,!e)},n=()=>{this.#K.toggleCommentPopup(this,!1,!0,!e)},r=()=>{this.#K.toggleCommentPopup(this,!1,!1)};if(e){this.#ha=this.#ga.container;for(const e of this.trigger)e.ariaHasPopup="dialog",e.ariaControls="commentPopup",e.addEventListener("keydown",this.#Xs,{signal:t}),e.addEventListener("click",i,{signal:t}),e.addEventListener("pointerenter",n,{signal:t}),e.addEventListener("pointerleave",r,{signal:t}),e.classList.add("popupTriggerArea")}else{const e=this.#ha=document.createElement("button");e.className="annotationCommentButton";const s=this.#ga.container;e.style.zIndex=s.style.zIndex+1,e.tabIndex=0,e.ariaHasPopup="dialog",e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button"),this.#va(),this.#ya(),e.addEventListener("keydown",this.#Xs,{signal:t}),e.addEventListener("click",i,{signal:t}),e.addEventListener("pointerenter",n,{signal:t}),e.addEventListener("pointerleave",r,{signal:t}),s.after(e)}}#ya(){if(this.#ga.extraPopupElement&&!this.#ga.editor)return;this.#ha||this.renderCommentButton();const[t,e]=this.#ca,{style:i}=this.#ha;i.left=`calc(${t}%)`,i.top=`calc(${e}% - var(--comment-button-dim))`}#va(){this.#ga.extraPopupElement||(this.#ha||this.renderCommentButton(),this.#ha.style.backgroundColor=this.commentButtonColor||"")}get commentButtonColor(){const{color:t,opacity:e}=this.#ga.commentData;return t?this.#ra._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{this.#ha?.focus()},0)}getData(){const{richText:t,color:e,opacity:i,creationDate:n,modificationDate:r}=this.#ga.commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:i,creationDate:n,modificationDate:r}}get elementBeforePopup(){return this.#ha}get comment(){return this.#fa||=this.#ga.commentText,this.#fa}set comment(t){t!==this.comment&&(this.#ga.commentText=this.#fa=t)}focus(){this.#ga.container?.focus()}get parentBoundingClientRect(){return this.#ga.layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){this.#ha&&(this.#ha.classList.toggle("selected",t),this.#ha.ariaExpanded=e)}setSelectedCommentButton(t){this.#ha.classList.toggle("selected",t)}get commentPopupPosition(){if(this.#Ce)return this.#Ce;const{x:t,y:e,height:i}=this.#ha.getBoundingClientRect(),{x:n,y:r,width:s,height:a}=this.#ga.layer.getBoundingClientRect();return[(t-n)/s,(e+i-r)/a]}set commentPopupPosition(t){this.#Ce=t}hasDefaultPopupPosition(){return null===this.#Ce}get commentButtonPosition(){return this.#ca}get commentButtonWidth(){return this.#ha.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){const[e,i]=this.#Ce||this.commentButtonPosition.map(t=>t/100),n=this.parentBoundingClientRect,{x:r,y:s,width:a,height:o}=n;this.#K.showDialog(null,this,r+e*a,s+i*o,{...t,parentDimensions:n})}render(){if(this.#oa)return;const t=this.#oa=document.createElement("div");if(t.className="popup",this.#ta){const e=t.style.outlineColor=ut.makeHexColor(...this.#ta);t.style.backgroundColor=`color-mix(in srgb, ${e} 30%, white)`}const e=document.createElement("span");if(e.className="header",this.#ua?.str){const t=document.createElement("span");t.className="title",e.append(t),({dir:t.dir,str:t.textContent}=this.#ua)}if(t.append(e),this.#ia){const 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.#ia.valueOf()})),t.dateTime=this.#ia.toISOString(),e.append(t)}Jt({html:this.#wa||this.#ea.str,dir:this.#ea?.dir,className:"popupContent"},t),this.#It.append(t)}get#wa(){const t=this.#we,e=this.#ea;return!t?.str||e?.str&&e.str!==t.str?null:this.#we.html||null}get#Aa(){return this.#wa?.attributes?.style?.fontSize||0}get#xa(){return this.#wa?.attributes?.style?.color||null}#Ea(t){const e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},n={style:{color:this.#xa,fontSize:this.#Aa?`calc(${this.#Aa}px * var(--total-scale-factor))`:""}};for(const i of t.split("\n"))e.push({name:"span",value:i,attributes:n});return i}#Ls(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&this.#aa)&&this.#Zs()}updateEdited({rect:t,popup:e,deleted:i}){if(this.#K)return i?(this.remove(),this.#fa=null):e&&(e.deleted?this.remove():(this.#va(),this.#fa=e.text)),void(t&&(this.#ca=null,this.#ba(),this.#ya()));i||e?.deleted?this.remove():(this.#ma(),this.#js||={contentsObj:this.#ea,richText:this.#we},t&&(this.#j=null),e&&e.text&&(this.#we=this.#Ea(e.text),this.#ia=Lt.toDateObject(e.date),this.#ea=null),this.#oa?.remove(),this.#oa=null)}resetEdited(){this.#js&&(({contentsObj:this.#ea,richText:this.#we}=this.#js),this.#js=null,this.#oa?.remove(),this.#oa=null,this.#j=null)}remove(){if(this.#la?.abort(),this.#la=null,this.#oa?.remove(),this.#oa=null,this.#pa=!1,this.#aa=!1,this.#ha?.remove(),this.#ha=null,this.trigger)for(const t of this.trigger)t.classList.remove("popupTriggerArea")}#Ca(){if(null!==this.#j)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:n,pageY:r}}}=this.#ra;let s=!!this.#sa,a=s?this.#sa:this.#da;for(const t of this.#na)if(!a||null!==ut.intersect(t.data.rect,a)){a=t.data.rect,s=!0;break}const o=ut.normalizeRect([a[0],t[3]-a[1]+t[1],a[2],t[3]-a[3]+t[1]]),l=s?a[2]-a[0]+5:0,h=o[0]+l,c=o[1];this.#j=[100*(h-n)/e,100*(c-r)/i];const{style:d}=this.#It;d.left=`${this.#j[0]}%`,d.top=`${this.#j[1]}%`}#Zs(){this.#K?this.#K.toggleCommentPopup(this,!1):(this.#aa=!this.#aa,this.#aa?(this.#Js(),this.#It.addEventListener("click",this.#Qs),this.#It.addEventListener("keydown",this.#Xs)):(this.#Ys(),this.#It.removeEventListener("click",this.#Qs),this.#It.removeEventListener("keydown",this.#Xs)))}#Js(){this.#oa||this.render(),this.isVisible?this.#aa&&this.#It.classList.add("focused"):(this.#Ca(),this.#It.hidden=!1,this.#It.style.zIndex=parseInt(this.#It.style.zIndex)+1e3)}#Ys(){this.#It.classList.remove("focused"),!this.#aa&&this.isVisible&&(this.#It.hidden=!0,this.#It.style.zIndex=parseInt(this.#It.style.zIndex)-1e3)}forceHide(){this.#pa=this.isVisible,this.#pa&&(this.#It.hidden=!0)}maybeShow(){this.#K||(this.#ma(),this.#pa&&(this.#oa||this.#Js(),this.#pa=!1,this.#It.hidden=!1))}get isVisible(){return!this.#K&&!1===this.#It.hidden}}class vr extends sr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=w.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=this.contentElement=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const 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}}class yr extends sr{#Sa=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const{data:t,width:e,height:i}=this,n=this.svgFactory.create(e,i,!0),r=this.#Sa=this.svgFactory.createElement("svg:line");return r.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),r.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),r.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),r.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),r.setAttribute("stroke-width",t.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#Sa}addHighlightArea(){this.container.classList.add("highlightArea")}}class wr extends sr{#_a=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const{data:t,width:e,height:i}=this,n=this.svgFactory.create(e,i,!0),r=t.borderStyle.width,s=this.#_a=this.svgFactory.createElement("svg:rect");return s.setAttribute("x",r/2),s.setAttribute("y",r/2),s.setAttribute("width",e-r),s.setAttribute("height",i-r),s.setAttribute("stroke-width",r||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#_a}addHighlightArea(){this.container.classList.add("highlightArea")}}class Ar extends sr{#Ta=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const{data:t,width:e,height:i}=this,n=this.svgFactory.create(e,i,!0),r=t.borderStyle.width,s=this.#Ta=this.svgFactory.createElement("svg:ellipse");return s.setAttribute("cx",e/2),s.setAttribute("cy",i/2),s.setAttribute("rx",e/2-r/2),s.setAttribute("ry",i/2-r/2),s.setAttribute("stroke-width",r||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#Ta}addHighlightArea(){this.container.classList.add("highlightArea")}}class xr extends sr{#Pa=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:e,borderStyle:i,popupRef:n},width:r,height:s}=this;if(!e)return this.container;const a=this.svgFactory.create(r,s,!0);let o=[];for(let i=0,n=e.length;i<n;i+=2){const n=e[i]-t[0],r=t[3]-e[i+1];o.push(`${n},${r}`)}o=o.join(" ");const l=this.#Pa=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),!n&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#Pa}addHighlightArea(){this.container.classList.add("highlightArea")}}class Er extends xr{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Cr extends sr{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 Sr extends sr{#Da=null;#Ma=[];constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?w.HIGHLIGHT:w.INK}#Fa(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);const{data:{rect:t,rotation:e,inkLists:i,borderStyle:n,popupRef:r}}=this,{transform:s,width:a,height:o}=this.#Fa(e,t),l=this.svgFactory.create(a,o,!0),h=this.#Da=this.svgFactory.createElement("svg:g");l.append(h),h.setAttribute("stroke-width",n.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",s);for(let t=0,e=i.length;t<e;t++){const e=this.svgFactory.createElement(this.svgElementName);this.#Ma.push(e),e.setAttribute("points",i[t].join(",")),h.append(e)}return!r&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(l),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);const{thickness:e,points:i,rect:n}=t,r=this.#Da;if(e>=0&&r.setAttribute("stroke-width",e||1),i)for(let t=0,e=this.#Ma.length;t<e;t++)this.#Ma[t].setAttribute("points",i[t].join(","));if(n){const{transform:t,width:e,height:i}=this.#Fa(this.data.rotation,n);r.parentElement.setAttribute("viewBox",`0 0 ${e} ${i}`),r.setAttribute("transform",t)}}getElementsToTriggerPopup(){return this.#Ma}addHighlightArea(){this.container.classList.add("highlightArea")}}class _r extends sr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=w.HIGHLIGHT}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){const e=document.createElement("mark");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}
2class Tr extends sr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("underlineAnnotation"),t){const e=document.createElement("u");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class Pr extends sr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("squigglyAnnotation"),t){const e=document.createElement("u");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class Dr extends sr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("strikeoutAnnotation"),t){const e=document.createElement("s");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class Mr extends sr{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=w.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 Fr extends sr{#Ia=null;constructor(t){super(t,{isRenderable:!0});const{file:e}=this.data;this.filename=e.filename,this.content=e.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...e})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:e}=this;let i;e.hasAppearance||0===e.fillAlpha?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(e.name)?"paperclip":"pushpin"}.svg`,e.fillAlpha&&e.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(100*e.fillAlpha)}%);`)),i.addEventListener("dblclick",this.#ka.bind(this)),this.#Ia=i;const{isMac:n}=ct.platform;return t.addEventListener("keydown",t=>{"Enter"===t.key&&(n?t.metaKey:t.ctrlKey)&&this.#ka()}),!e.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return this.#Ia}addHighlightArea(){this.container.classList.add("highlightArea")}#ka(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class Ir{#La=null;#Ra=null;#X=null;#Ba=new Map;#Na=null;#Oa=null;#na=[];#ja=!1;constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:n,page:r,viewport:s,structTreeLayer:a,commentManager:o,linkService:l,annotationStorage:h}){this.div=t,this.#La=e,this.#Ra=i,this.#Na=a||null,this.#Oa=l||null,this.#X=h||new we,this.page=r,this.viewport=s,this.zIndex=0,this._annotationEditorUIManager=n,this._commentManager=o||null}hasEditableAnnotations(){return this.#Ba.size>0}async render(t){const{annotations:e}=t,i=this.div;jt(i,this.viewport);const n=new Map,r=[],s={data:null,layer:i,linkService:this.#Oa,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new er,annotationStorage:this.#X,enableComment:!0===t.enableComment,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const t of e){if(t.noHTML)continue;const e=t.annotationType===I.POPUP;if(e){const e=n.get(t.id);if(!e)continue;if(!this._commentManager){r.push(t);continue}s.elements=e}else if(t.rect[2]===t.rect[0]||t.rect[3]===t.rect[1])continue;s.data=t;const i=rr.create(s);if(!i.isRenderable)continue;if(!e&&(this.#na.push(i),t.popupRef)){const e=n.get(t.popupRef);e?e.push(i):n.set(t.popupRef,[i])}const a=i.render();t.hidden&&(a.style.visibility="hidden"),i._isEditable&&(this.#Ba.set(i.data.id,i),this._annotationEditorUIManager?.renderAnnotationElement(i))}await this.#Ua();for(const t of r){const e=s.elements=n.get(t.id);s.data=t;const i=rr.create(s);if(!i.isRenderable)continue;const r=i.render();i.contentElement.id=`${bt}${t.id}`,t.hidden&&(r.style.visibility="hidden"),e.at(-1).container.after(r)}this.#za()}async#Ua(){if(0===this.#na.length)return;this.div.replaceChildren();const t=[];if(!this.#ja){this.#ja=!0;for(const{contentElement:e,data:{id:i}}of this.#na){const n=e.id=`${bt}${i}`;t.push(this.#Na?.getAriaAttributes(n).then(t=>{if(t)for(const[i,n]of t)e.setAttribute(i,n)}))}}this.#na.sort(({data:{rect:[t,e,i,n]}},{data:{rect:[r,s,a,o]}})=>{if(t===i&&e===n)return 1;if(r===a&&s===o)return-1;const l=(e+n)/2,h=(s+o)/2;if(l>=o&&h<=e)return-1;if(h>=n&&l<=s)return 1;return(t+i)/2-(r+a)/2});const e=document.createDocumentFragment();for(const t of this.#na)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.#La)for(const t of this.#na)this.#La.addPointerInTextLayer(t.contentElement,!1)}async addLinkAnnotations(t){const e={data:null,layer:this.div,linkService:this.#Oa,svgFactory:new er,parent:this};for(const i of t){i.borderStyle||=Ir._defaultBorderStyle,e.data=i;const t=rr.create(e);t.isRenderable&&(t.render(),t.contentElement.id=`${bt}${i.id}`,this.#na.push(t))}await this.#Ua()}update({viewport:t}){const e=this.div;this.viewport=t,jt(e,{rotation:t.rotation}),this.#za(),e.hidden=!1}#za(){if(!this.#Ra)return;const t=this.div;for(const[e,i]of this.#Ra){const n=t.querySelector(`[data-annotation-id="${e}"]`);if(!n)continue;i.className="annotationContent";const{firstChild:r}=n;r?"CANVAS"===r.nodeName?r.replaceWith(i):r.classList.contains("annotationContent")?r.after(i):r.before(i):n.append(i);const s=this.#Ba.get(e);s&&(s._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(e,n.id,i),s._hasNoCanvas=!1):s.canvas=i)}this.#Ra.clear()}getEditableAnnotations(){return Array.from(this.#Ba.values())}getEditableAnnotation(t){return this.#Ba.get(t)}addFakeAnnotation(t){const{div:e}=this,{id:i,rotation:n}=t,r=new ar({data:{id:i,rect:t.getPDFRect(),rotation:n},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:this.#Oa,annotationStorage:this.#X});return r.render(),r.contentElement.id=`${bt}${i}`,r.createOrUpdatePopup(),this.#na.push(r),r}removeAnnotation(t){const e=this.#na.findIndex(e=>e.data.id===t);if(e<0)return;const[i]=this.#na.splice(e,1);this.#La?.removePointerInTextLayer(i.contentElement)}updateFakeAnnotations(t){if(0!==t.length){for(const e of t)e.updateFakeAnnotationElement(this);this.#Ua()}}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}static get _defaultBorderStyle(){return et(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:k,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}}const kr=/\r\n?|\n/g;class Lr extends pe{#Ha="";#Va=`${this.id}-editor`;#$a=null;#Aa;_colorPicker=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const t=Lr.prototype,e=t=>t.isEmpty(),i=he.TRANSLATE_SMALL,n=he.TRANSLATE_BIG;return et(this,"_keyboardManager",new oe([[["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:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,n],checker:e}]]))}static _type="freetext";static _editorType=w.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.color=t.color||Lr._defaultColor||pe._defaultLineColor,this.#Aa=t.fontSize||Lr._defaultFontSize,this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert"),this.canAddComment=!1}static initialize(t,e){pe.initialize(t,e);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}
vendor: 94,021 bytes, line 2
2static updateDefaultParams(t,e){switch(t){case A.FREETEXT_SIZE:Lr._defaultFontSize=e;break;case A.FREETEXT_COLOR:Lr._defaultColor=e}}updateParams(t,e){switch(t){case A.FREETEXT_SIZE:this.#Wa(e);break;case A.FREETEXT_COLOR:this.#va(e)}}static get defaultPropertiesToUpdate(){return[[A.FREETEXT_SIZE,Lr._defaultFontSize],[A.FREETEXT_COLOR,Lr._defaultColor||pe._defaultLineColor]]}get propertiesToUpdate(){return[[A.FREETEXT_SIZE,this.#Aa],[A.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new Kn(this),[["colorPicker",this._colorPicker]]}get colorType(){return A.FREETEXT_COLOR}#Wa(t){const e=t=>{this.editorDiv.style.fontSize=`calc(${t}px * var(--total-scale-factor))`,this.translate(0,-(t-this.#Aa)*this.parentScale),this.#Aa=t,this.#Ga()},i=this.#Aa;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:A.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}#va(t){const 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:A.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){const t=this.parentScale;return[-Lr._internalPadding*t,-(Lr._internalPadding+this.#Aa)*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.#$a=new AbortController;const t=this._uiManager.combinedSignal(this.#$a);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.#Va),this._isDraggable=!0,this.#$a?.abort(),this.#$a=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()}#Xa(){const t=[];this.editorDiv.normalize();let e=null;for(const i of this.editorDiv.childNodes)e?.nodeType===Node.TEXT_NODE&&"BR"===i.nodeName||(t.push(Lr.#qa(i)),e=i);return t.join("\n")}#Ga(){const[t,e]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:t,div:e}=this,n=e.style.display,r=e.classList.contains("hidden");e.classList.remove("hidden"),e.style.display="hidden",t.div.append(this.div),i=e.getBoundingClientRect(),e.remove(),e.style.display=n,e.classList.toggle("hidden",r)}this.rotation%180==this.parentRotation%180?(this.width=i.width/t,this.height=i.height/e):(this.width=i.height/t,this.height=i.width/e),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=this.#Ha,e=this.#Ha=this.#Xa().trimEnd();if(t===e)return;const i=t=>{this.#Ha=t,t?(this.#Ya(),this._uiManager.rebuild(this),this.#Ga()):this.remove()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),this.#Ga()}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){Lr._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(){if(this.div)return this.div;let t,e;(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.#Va),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#Aa}px * var(--total-scale-factor))`,i.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[i,n]=this.parentDimensions;if(this.annotationElementId){const{position:r}=this._initialData;let[s,a]=this.getInitialTranslation();[s,a]=this.pageTranslationToScreen(s,a);const[o,l]=this.pageDimensions,[h,c]=this.pageTranslation;let d,u;switch(this.rotation){case 0:d=t+(r[0]-h)/o,u=e+this.height-(r[1]-c)/l;break;case 90:d=t+(r[0]-h)/o,u=e-(r[1]-c)/l,[s,a]=[a,-s];break;case 180:d=t-this.width+(r[0]-h)/o,u=e-(r[1]-c)/l,[s,a]=[-s,-a];break;case 270:d=t+(r[0]-h-this.height*l)/o,u=e+(r[1]-c-this.width*o)/l,[s,a]=[-a,s]}this.setAt(d*i,u*n,s,a)}else this._moveAfterPaste(t,e);this.#Ya(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#qa(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(kr,"")}editorDivPaste(t){const e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();const n=Lr.#Ka(e.getData("text")||"").replaceAll(kr,"\n");if(!n)return;const r=window.getSelection();if(!r.rangeCount)return;this.editorDiv.normalize(),r.deleteFromDocument();const s=r.getRangeAt(0);if(!n.includes("\n"))return s.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),void r.collapseToStart();const{startContainer:a,startOffset:o}=s,l=[],h=[];if(a.nodeType===Node.TEXT_NODE){const t=a.parentElement;if(h.push(a.nodeValue.slice(o).replaceAll(kr,"")),t!==this.editorDiv){let e=l;for(const i of this.editorDiv.childNodes)i!==t?e.push(Lr.#qa(i)):e=h}l.push(a.nodeValue.slice(0,o).replaceAll(kr,""))}else if(a===this.editorDiv){let t=l,e=0;for(const i of this.editorDiv.childNodes)e++===o&&(t=h),t.push(Lr.#qa(i))}this.#Ha=`${l.join("\n")}${n}${h.join("\n")}`,this.#Ya();const c=new Range;let d=Math.sumPrecise(l.map(t=>t.length));for(const{firstChild:t}of this.editorDiv.childNodes)if(t.nodeType===Node.TEXT_NODE){const e=t.nodeValue.length;if(d<=e){c.setStart(t,d),c.setEnd(t,d);break}d-=e}r.removeAllRanges(),r.addRange(c)}#Ya(){if(this.editorDiv.replaceChildren(),this.#Ha)for(const t of this.#Ha.split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#Ja(){return this.#Ha.replaceAll("Â "," ")}static#Ka(t){return t.replaceAll(" ","Â ")}get contentDiv(){return this.editorDiv}getPDFRect(){const t=Lr._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,e,i){let n=null;if(t instanceof vr){const{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:r,rotation:s,id:a,popupRef:o,richText:l,contentsObj:h,creationDate:c,modificationDate:d},textContent:u,textPosition:p,parent:{page:{pageNumber:g}}}=t;if(!u||0===u.length)return null;n=t={annotationType:w.FREETEXT,color:Array.from(i),fontSize:e,value:u.join("\n"),position:p,pageIndex:g-1,rect:r.slice(0),rotation:s,annotationElementId:a,id:a,deleted:!1,popupRef:o,comment:h?.str||null,richText:l,creationDate:c,modificationDate:d}}const r=await super.deserialize(t,e,i);return r.#Aa=t.fontSize,r.color=ut.makeHexColor(...t.color),r.#Ha=Lr.#Ka(t.value),r._initialData=n,t.comment&&r.setCommentData(t),r}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const e=pe._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(t),{color:e,fontSize:this.#Aa,value:this.#Ja()});return this.addComment(i),t?(i.isCopy=!0,i):this.annotationElementId&&!this.#Qa(i)?null:(i.id=this.annotationElementId,i)}#Qa(t){const{value:e,fontSize:i,color:n,pageIndex:r}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((t,e)=>t!==n[e])||t.pageIndex!==r}renderAnnotationElement(t){const e=super.renderAnnotationElement(t);if(!e)return null;const{style:i}=e;i.fontSize=`calc(${this.#Aa}px * var(--total-scale-factor))`,i.color=this.color,e.replaceChildren();for(const t of this.#Ha.split("\n")){const 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.#Ha}}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}class Rr{static PRECISION=1e-4;toSVGPath(){J("Abstract method `toSVGPath` must be implemented.")}get box(){J("Abstract getter `box` must be implemented.")}serialize(t,e){J("Abstract method `serialize` must be implemented.")}static _rescale(t,e,i,n,r,s){s||=new Float32Array(t.length);for(let a=0,o=t.length;a<o;a+=2)s[a]=e+t[a]*n,s[a+1]=i+t[a+1]*r;return s}static _rescaleAndSwap(t,e,i,n,r,s){s||=new Float32Array(t.length);for(let a=0,o=t.length;a<o;a+=2)s[a]=e+t[a+1]*n,s[a+1]=i+t[a]*r;return s}static _translate(t,e,i,n){n||=new Float32Array(t.length);for(let r=0,s=t.length;r<s;r+=2)n[r]=e+t[r],n[r+1]=i+t[r+1];return n}static svgRound(t){return Math.round(1e4*t)}static _normalizePoint(t,e,i,n,r){switch(r){case 90:return[1-e/i,t/n];case 180:return[1-t/i,1-e/n];case 270:return[e/i,1-t/n];default:return[t/i,e/n]}}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,n,r,s){return[(t+5*i)/6,(e+5*n)/6,(5*i+r)/6,(5*n+s)/6,(i+r)/2,(n+s)/2]}}class Br{#Za;#to=[];#eo;#io;#no=[];#ro=new Float32Array(18);#so;#ao;#oo;#lo;#ho;#co;#do=[];static#uo=8;static#po=2;static#go=Br.#uo+Br.#po;constructor({x:t,y:e},i,n,r,s,a=0){this.#Za=i,this.#co=r*n,this.#io=s,this.#ro.set([NaN,NaN,NaN,NaN,t,e],6),this.#eo=a,this.#lo=Br.#uo*n,this.#oo=Br.#go*n,this.#ho=n,this.#do.push(t,e)}isEmpty(){return isNaN(this.#ro[8])}#fo(){const t=this.#ro.subarray(4,6),e=this.#ro.subarray(16,18),[i,n,r,s]=this.#Za;return[(this.#so+(t[0]-e[0])/2-i)/r,(this.#ao+(t[1]-e[1])/2-n)/s,(this.#so+(e[0]-t[0])/2-i)/r,(this.#ao+(e[1]-t[1])/2-n)/s]}add({x:t,y:e}){this.#so=t,this.#ao=e;const[i,n,r,s]=this.#Za;let[a,o,l,h]=this.#ro.subarray(8,12);const c=t-l,d=e-h,u=Math.hypot(c,d);if(u<this.#oo)return!1;const p=u-this.#lo,g=p/u,f=g*c,m=g*d;let b=a,v=o;a=l,o=h,l+=f,h+=m,this.#do?.push(t,e);const y=f/p,w=-m/p*this.#co,A=y*this.#co;if(this.#ro.set(this.#ro.subarray(2,8),0),this.#ro.set([l+w,h+A],4),this.#ro.set(this.#ro.subarray(14,18),12),this.#ro.set([l-w,h-A],16),isNaN(this.#ro[6]))return 0===this.#no.length&&(this.#ro.set([a+w,o+A],2),this.#no.push(NaN,NaN,NaN,NaN,(a+w-i)/r,(o+A-n)/s),this.#ro.set([a-w,o-A],14),this.#to.push(NaN,NaN,NaN,NaN,(a-w-i)/r,(o-A-n)/s)),this.#ro.set([b,v,a,o,l,h],6),!this.isEmpty();this.#ro.set([b,v,a,o,l,h],6);return Math.abs(Math.atan2(v-o,b-a)-Math.atan2(m,f))<Math.PI/2?([a,o,l,h]=this.#ro.subarray(2,6),this.#no.push(NaN,NaN,NaN,NaN,((a+l)/2-i)/r,((o+h)/2-n)/s),[a,o,b,v]=this.#ro.subarray(14,18),this.#to.push(NaN,NaN,NaN,NaN,((b+a)/2-i)/r,((v+o)/2-n)/s),!0):([b,v,a,o,l,h]=this.#ro.subarray(0,6),this.#no.push(((b+5*a)/6-i)/r,((v+5*o)/6-n)/s,((5*a+l)/6-i)/r,((5*o+h)/6-n)/s,((a+l)/2-i)/r,((o+h)/2-n)/s),[l,h,a,o,b,v]=this.#ro.subarray(12,18),this.#to.push(((b+5*a)/6-i)/r,((v+5*o)/6-n)/s,((5*a+l)/6-i)/r,((5*o+h)/6-n)/s,((a+l)/2-i)/r,((o+h)/2-n)/s),!0)}toSVGPath(){if(this.isEmpty())return"";const t=this.#no,e=this.#to;if(isNaN(this.#ro[6])&&!this.isEmpty())return this.#mo();const 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.#bo(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.#vo(i),i.join(" ")}#mo(){const[t,e,i,n]=this.#Za,[r,s,a,o]=this.#fo();return`M${(this.#ro[2]-t)/i} ${(this.#ro[3]-e)/n} L${(this.#ro[4]-t)/i} ${(this.#ro[5]-e)/n} L${r} ${s} L${a} ${o} L${(this.#ro[16]-t)/i} ${(this.#ro[17]-e)/n} L${(this.#ro[14]-t)/i} ${(this.#ro[15]-e)/n} Z`}#vo(t){const e=this.#to;t.push(`L${e[4]} ${e[5]} Z`)}#bo(t){const[e,i,n,r]=this.#Za,s=this.#ro.subarray(4,6),a=this.#ro.subarray(16,18),[o,l,h,c]=this.#fo();t.push(`L${(s[0]-e)/n} ${(s[1]-i)/r} L${o} ${l} L${h} ${c} L${(a[0]-e)/n} ${(a[1]-i)/r}`)}newFreeDrawOutline(t,e,i,n,r,s){return new Nr(t,e,i,n,r,s)}getOutlines(){const t=this.#no,e=this.#to,i=this.#ro,[n,r,s,a]=this.#Za,o=new Float32Array((this.#do?.length??0)+2);for(let t=0,e=o.length-2;t<e;t+=2)o[t]=(this.#do[t]-n)/s,o[t+1]=(this.#do[t+1]-r)/a;if(o[o.length-2]=(this.#so-n)/s,o[o.length-1]=(this.#ao-r)/a,isNaN(i[6])&&!this.isEmpty())return this.#yo(o);const l=new Float32Array(this.#no.length+24+this.#to.length);let h=t.length;for(let e=0;e<h;e+=2)isNaN(t[e])?l[e]=l[e+1]=NaN:(l[e]=t[e],l[e+1]=t[e+1]);h=this.#wo(l,h);for(let t=e.length-6;t>=6;t-=6)for(let i=0;i<6;i+=2)isNaN(e[t+i])?(l[h]=l[h+1]=NaN,h+=2):(l[h]=e[t+i],l[h+1]=e[t+i+1],h+=2);return this.#Ao(l,h),this.newFreeDrawOutline(l,o,this.#Za,this.#ho,this.#eo,this.#io)}#yo(t){const e=this.#ro,[i,n,r,s]=this.#Za,[a,o,l,h]=this.#fo(),c=new Float32Array(36);return c.set([NaN,NaN,NaN,NaN,(e[2]-i)/r,(e[3]-n)/s,NaN,NaN,NaN,NaN,(e[4]-i)/r,(e[5]-n)/s,NaN,NaN,NaN,NaN,a,o,NaN,NaN,NaN,NaN,l,h,NaN,NaN,NaN,NaN,(e[16]-i)/r,(e[17]-n)/s,NaN,NaN,NaN,NaN,(e[14]-i)/r,(e[15]-n)/s],0),this.newFreeDrawOutline(c,t,this.#Za,this.#ho,this.#eo,this.#io)}#Ao(t,e){const i=this.#to;return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+6}#wo(t,e){const i=this.#ro.subarray(4,6),n=this.#ro.subarray(16,18),[r,s,a,o]=this.#Za,[l,h,c,d]=this.#fo();return t.set([NaN,NaN,NaN,NaN,(i[0]-r)/a,(i[1]-s)/o,NaN,NaN,NaN,NaN,l,h,NaN,NaN,NaN,NaN,c,d,NaN,NaN,NaN,NaN,(n[0]-r)/a,(n[1]-s)/o],e),e+24}}class Nr extends Rr{#Za;#xo=new Float32Array(4);#eo;#io;#do;#ho;#Eo;constructor(t,e,i,n,r,s){super(),this.#Eo=t,this.#do=e,this.#Za=i,this.#ho=n,this.#eo=r,this.#io=s,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#Co(s);const[a,o,l,h]=this.#xo;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(){const t=[`M${this.#Eo[4]} ${this.#Eo[5]}`];for(let e=6,i=this.#Eo.length;e<i;e+=6)isNaN(this.#Eo[e])?t.push(`L${this.#Eo[e+4]} ${this.#Eo[e+5]}`):t.push(`C${this.#Eo[e]} ${this.#Eo[e+1]} ${this.#Eo[e+2]} ${this.#Eo[e+3]} ${this.#Eo[e+4]} ${this.#Eo[e+5]}`);return t.push("Z"),t.join(" ")}serialize([t,e,i,n],r){const s=i-t,a=n-e;let o,l;switch(r){case 0:o=Rr._rescale(this.#Eo,t,n,s,-a),l=Rr._rescale(this.#do,t,n,s,-a);break;case 90:o=Rr._rescaleAndSwap(this.#Eo,t,e,s,a),l=Rr._rescaleAndSwap(this.#do,t,e,s,a);break;case 180:o=Rr._rescale(this.#Eo,i,e,-s,a),l=Rr._rescale(this.#do,i,e,-s,a);break;case 270:o=Rr._rescaleAndSwap(this.#Eo,i,n,-s,-a),l=Rr._rescaleAndSwap(this.#do,i,n,-s,-a)}return{outline:Array.from(o),points:[Array.from(l)]}}#Co(t){const e=this.#Eo;let i=e[4],n=e[5];const r=[i,n,i,n];let s=i,a=n,o=i,l=n;const h=t?Math.max:Math.min,c=new Float32Array(4);for(let t=6,d=e.length;t<d;t+=6){const d=e[t+4],u=e[t+5];isNaN(e[t])?(ut.pointBoundingBox(d,u,r),a>u?(s=d,a=u):a===u&&(s=h(s,d)),l<u?(o=d,l=u):l===u&&(o=h(o,d))):(c[0]=c[1]=1/0,c[2]=c[3]=-1/0,ut.bezierBoundingBox(i,n,...e.slice(t,t+6),c),ut.rectBoundingBox(c[0],c[1],c[2],c[3],r),a>c[1]?(s=c[0],a=c[1]):a===c[1]&&(s=h(s,c[0])),l<c[3]?(o=c[2],l=c[3]):l===c[3]&&(o=h(o,c[2]))),i=d,n=u}const d=this.#xo;d[0]=r[0]-this.#eo,d[1]=r[1]-this.#eo,d[2]=r[2]-r[0]+2*this.#eo,d[3]=r[3]-r[1]+2*this.#eo,this.firstPoint=[s,a],this.lastPoint=[o,l]}get box(){return this.#xo}newOutliner(t,e,i,n,r,s=0){return new Br(t,e,i,n,r,s)}getNewOutline(t,e){const[i,n,r,s]=this.#xo,[a,o,l,h]=this.#Za,c=r*l,d=s*h,u=i*l+a,p=n*h+o,g=this.newOutliner({x:this.#do[0]*c+u,y:this.#do[1]*d+p},this.#Za,this.#ho,t,this.#io,e??this.#eo);for(let t=2;t<this.#do.length;t+=2)g.add({x:this.#do[t]*c+u,y:this.#do[t+1]*d+p});return g.getOutlines()}}class Or{#Za;#So;#_o;#To=[];#Po=[];constructor(t,e=0,i=0,n=!0){const r=[1/0,1/0,-1/0,-1/0],s=10**-4;for(const{x:i,y:n,width:a,height:o}of t){const t=Math.floor((i-e)/s)*s,l=Math.ceil((i+a+e)/s)*s,h=Math.floor((n-e)/s)*s,c=Math.ceil((n+o+e)/s)*s,d=[t,h,c,!0],u=[l,h,c,!1];this.#To.push(d,u),ut.rectBoundingBox(t,h,l,c,r)}const a=r[2]-r[0]+2*i,o=r[3]-r[1]+2*i,l=r[0]-i,h=r[1]-i;let c=n?-1/0:1/0,d=1/0;const u=this.#To.at(n?-1:-2),p=[u[0],u[2]];for(const t of this.#To){const[e,i,r,s]=t;!s&&n?i<d?(d=i,c=e):i===d&&(c=Math.max(c,e)):s&&!n&&(i<d?(d=i,c=e):i===d&&(c=Math.min(c,e))),t[0]=(e-l)/a,t[1]=(i-h)/o,t[2]=(r-h)/o}this.#Za=new Float32Array([l,h,a,o]),this.#So=[c,d],this.#_o=p}getOutlines(){this.#To.sort((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]);const t=[];for(const e of this.#To)e[3]?(t.push(...this.#Do(e)),this.#Mo(e)):(this.#Fo(e),t.push(...this.#Do(e)));return this.#Io(t)}#Io(t){const e=[],i=new Set;for(const i of t){const[t,n,r]=i;e.push([t,n,i],[t,r,i])}e.sort((t,e)=>t[1]-e[1]||t[0]-e[0]);for(let t=0,n=e.length;t<n;t+=2){const n=e[t][2],r=e[t+1][2];n.push(r),r.push(n),i.add(n),i.add(r)}const n=[];let r;for(;i.size>0;){const t=i.values().next().value;let[e,s,a,o,l]=t;i.delete(t);let h=e,c=s;for(r=[e,a],n.push(r);;){let t;if(i.has(o))t=o;else{if(!i.has(l))break;t=l}i.delete(t),[e,s,a,o,l]=t,h!==e&&(r.push(h,c,e,c===s?s:a),h=e),c=c===s?a:s}r.push(h,c)}return new jr(n,this.#Za,this.#So,this.#_o)}#ko(t){const e=this.#Po;let i=0,n=e.length-1;for(;i<=n;){const r=i+n>>1,s=e[r][0];if(s===t)return r;s<t?i=r+1:n=r-1}return n+1}#Mo([,t,e]){const i=this.#ko(t);this.#Po.splice(i,0,[t,e])}#Fo([,t,e]){const i=this.#ko(t);for(let n=i;n<this.#Po.length;n++){const[i,r]=this.#Po[n];if(i!==t)break;if(i===t&&r===e)return void this.#Po.splice(n,1)}for(let n=i-1;n>=0;n--){const[i,r]=this.#Po[n];if(i!==t)break;if(i===t&&r===e)return void this.#Po.splice(n,1)}}#Do(t){const[e,i,n]=t,r=[[e,i,n]],s=this.#ko(n);for(let t=0;t<s;t++){const[i,n]=this.#Po[t];for(let t=0,s=r.length;t<s;t++){const[,a,o]=r[t];if(!(n<=a||o<=i))if(a>=i)if(o>n)r[t][1]=n;else{if(1===s)return[];r.splice(t,1),t--,s--}else r[t][2]=i,o>n&&r.push([e,n,o])}}return r}}class jr extends Rr{#Za;#Lo;constructor(t,e,i,n){super(),this.#Lo=t,this.#Za=e,this.firstPoint=i,this.lastPoint=n}toSVGPath(){const t=[];for(const e of this.#Lo){let[i,n]=e;t.push(`M${i} ${n}`);for(let r=2;r<e.length;r+=2){const s=e[r],a=e[r+1];s===i?(t.push(`V${a}`),n=a):a===n&&(t.push(`H${s}`),i=s)}t.push("Z")}return t.join(" ")}serialize([t,e,i,n],r){const s=[],a=i-t,o=n-e;for(const e of this.#Lo){const i=new Array(e.length);for(let r=0;r<e.length;r+=2)i[r]=t+e[r]*a,i[r+1]=n-e[r+1]*o;s.push(i)}return s}get box(){return this.#Za}get classNamesForOutlining(){return["highlightOutline"]}}class Ur extends Br{newFreeDrawOutline(t,e,i,n,r,s){return new zr(t,e,i,n,r,s)}}class zr extends Nr{newOutliner(t,e,i,n,r,s=0){return new Ur(t,e,i,n,r,s)}}class Hr extends pe{#Ro=null;#Bo=0;#No;#Oo=null;#d=null;#jo=null;#Uo=null;#zo=0;#Ho=null;#Vo=null;#I=null;#$o=!1;#So=null;#_o=null;#Wo=null;#Ae="";#co;#Go="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=w.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){const t=Hr.prototype;return et(this,"_keyboardManager",new oe([[["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||Hr._defaultColor,this.#co=t.thickness||Hr._defaultThickness,this.opacity=t.opacity||Hr._defaultOpacity,this.#No=t.boxes||null,this.#Go=t.methodOfCreation||"",this.#Ae=t.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?(this.#$o=!0,this.#Xo(t),this.#qo()):this.#No&&(this.#Ro=t.anchorNode,this.#Bo=t.anchorOffset,this.#Uo=t.focusNode,this.#zo=t.focusOffset,this.#Yo(),this.#qo(),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}get telemetryInitialData(){return{action:"added",type:this.#$o?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this.#co,methodOfCreation:this.#Go}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#Yo(){const t=new Or(this.#No,.001);this.#Vo=t.getOutlines(),[this.x,this.y,this.width,this.height]=this.#Vo.box;const e=new Or(this.#No,.0025,.001,"ltr"===this._uiManager.direction);this.#jo=e.getOutlines();const{firstPoint:i}=this.#Vo;this.#So=[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height];const{lastPoint:n}=this.#jo;this.#_o=[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height]}#Xo({highlightOutlines:t,highlightId:e,clipPathId:i}){this.#Vo=t;if(this.#jo=t.getNewOutline(this.#co/2+1.5,.0025),e>=0)this.#I=e,this.#Oo=i,this.parent.drawLayer.finalizeDraw(e,{bbox:t.box,path:{d:t.toSVGPath()}}),this.#Wo=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#jo.box,path:{d:this.#jo.toSVGPath()}},!0);else if(this.parent){const e=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#I,{bbox:Hr.#Ko(this.#Vo.box,(e-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#Wo,{bbox:Hr.#Ko(this.#jo.box,e),path:{d:this.#jo.toSVGPath()}})}const[n,r,s,a]=t.box;switch(this.rotation){case 0:this.x=n,this.y=r,this.width=s,this.height=a;break;case 90:{const[t,e]=this.parentDimensions;this.x=r,this.y=1-n,this.width=s*e/t,this.height=a*t/e;break}case 180:this.x=1-n,this.y=1-r,this.width=s,this.height=a;break;case 270:{const[t,e]=this.parentDimensions;this.x=1-r,this.y=n,this.width=s*e/t,this.height=a*t/e;break}}const{firstPoint:o}=t;this.#So=[(o[0]-n)/s,(o[1]-r)/a];const{lastPoint:l}=this.#jo;this.#_o=[(l[0]-n)/s,(l[1]-r)/a]}static initialize(t,e){pe.initialize(t,e),Hr._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case A.HIGHLIGHT_COLOR:Hr._defaultColor=e;break;case A.HIGHLIGHT_THICKNESS:Hr._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return this.#_o}get commentButtonPosition(){return this.#So}updateParams(t,e){switch(t){case A.HIGHLIGHT_COLOR:this.#va(e);break;case A.HIGHLIGHT_THICKNESS:this.#Jo(e)}}static get defaultPropertiesToUpdate(){return[[A.HIGHLIGHT_COLOR,Hr._defaultColor],[A.HIGHLIGHT_THICKNESS,Hr._defaultThickness]]}get propertiesToUpdate(){return[[A.HIGHLIGHT_COLOR,this.color||Hr._defaultColor],[A.HIGHLIGHT_THICKNESS,this.#co||Hr._defaultThickness],[A.HIGHLIGHT_FREE,this.#$o]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(this.#I,{root:{fill:this.color,"fill-opacity":this.opacity}}),this.#d?.updateColor(this.color),super.onUpdatedColor()}#va(t){const e=(t,e)=>{this.color=t,this.opacity=e,this.onUpdatedColor()},i=this.color,n=this.opacity;this.addCommands({cmd:e.bind(this,t,Hr._defaultOpacity),undo:e.bind(this,i,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:A.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(t)},!0)}#Jo(t){const e=this.#co,i=t=>{this.#co=t,this.#Qo(t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:A.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}get toolbarButtons(){if(this._uiManager.highlightColors){return[["colorPicker",this.#d=new Yn({editor:this})]]}return super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#Zo())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#Zo())}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){this.#tl(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.#qo(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?this.#tl():t&&(this.#qo(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#Qo(t){this.#$o&&(this.#Xo({highlightOutlines:this.#Vo.getNewOutline(t/2)}),this.fixAndSetPosition(),this.setDims())}#tl(){null!==this.#I&&this.parent&&(this.parent.drawLayer.remove(this.#I),this.#I=null,this.parent.drawLayer.remove(this.#Wo),this.#Wo=null)}#qo(t=this.parent){null===this.#I&&(({id:this.#I,clipPathId:this.#Oo}=t.drawLayer.draw({bbox:this.#Vo.box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:this.#$o},path:{d:this.#Vo.toSVGPath()}},!1,!0)),this.#Wo=t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#$o},bbox:this.#jo.box,path:{d:this.#jo.toSVGPath()}},this.#$o),this.#Ho&&(this.#Ho.style.clipPath=this.#Oo))}static#Ko([t,e,i,n],r){switch(r){case 90:return[1-e-n,t,n,i];case 180:return[1-t-i,1-e-n,i,n];case 270:return[e,1-t-i,n,i]}return[t,e,i,n]}rotate(t){const{drawLayer:e}=this.parent;let i;this.#$o?(t=(t-this.rotation+360)%360,i=Hr.#Ko(this.#Vo.box,t)):i=Hr.#Ko([this.x,this.y,this.width,this.height],t),e.updateProperties(this.#I,{bbox:i,root:{"data-main-rotation":t}}),e.updateProperties(this.#Wo,{bbox:Hr.#Ko(this.#jo.box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;const t=super.render();this.#Ae&&(t.setAttribute("aria-label",this.#Ae),t.setAttribute("role","mark")),this.#$o?t.classList.add("free"):this.div.addEventListener("keydown",this.#el.bind(this),{signal:this._uiManager._signal});const e=this.#Ho=document.createElement("div");return t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#Oo,this.setDims(),ie(this,this.#Ho,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#Wo,{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#Wo,{rootClass:{hovered:!1}})}#el(t){Hr._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#il(!0);break;case 1:case 3:this.#il(!1)}}#il(t){if(!this.#Ro)return;const e=window.getSelection();t?e.setPosition(this.#Ro,this.#Bo):e.setPosition(this.#Uo,this.#zo)}select(){super.select(),this.#Wo&&this.parent?.drawLayer.updateProperties(this.#Wo,{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),this.#Wo&&(this.parent?.drawLayer.updateProperties(this.#Wo,{rootClass:{selected:!1}}),this.#$o||this.#il(!1))}get _mustFixPosition(){return!this.#$o}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(this.#I,{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(this.#Wo,{rootClass:{hidden:!t}}))}#Zo(){return this.#$o?this.rotation:0}#nl(){if(this.#$o)return null;const[t,e]=this.pageDimensions,[i,n]=this.pageTranslation,r=this.#No,s=new Float32Array(8*r.length);let a=0;for(const{x:o,y:l,width:h,height:c}of r){const r=o*t+i,d=(1-l)*e+n;s[a]=s[a+4]=r,s[a+1]=s[a+3]=d,s[a+2]=s[a+6]=r+h*t,s[a+5]=s[a+7]=d-c*e,a+=8}return s}#rl(t){return this.#Vo.serialize(t,this.#Zo())}static startHighlighting(t,e,{target:i,x:n,y:r}){const{x:s,y:a,width:o,height:l}=i.getBoundingClientRect(),h=new AbortController,c=t.combinedSignal(h),d=e=>{h.abort(),this.#sl(t,e)};window.addEventListener("blur",d,{signal:c}),window.addEventListener("pointerup",d,{signal:c}),window.addEventListener("pointerdown",kt,{capture:!0,passive:!1,signal:c}),window.addEventListener("contextmenu",It,{signal:c}),i.addEventListener("pointermove",this.#al.bind(this,t),{signal:c}),this._freeHighlight=new Ur({x:n,y:r},[s,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#al(t,e){this._freeHighlight.add(e)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}static#sl(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 n=null;if(t instanceof _r){const{data:{quadPoints:e,rect:i,rotation:r,id:s,color:a,opacity:o,popupRef:l,richText:h,contentsObj:c,creationDate:d,modificationDate:u},parent:{page:{pageNumber:p}}}=t;n=t={annotationType:w.HIGHLIGHT,color:Array.from(a),opacity:o,quadPoints:e,boxes:null,pageIndex:p-1,rect:i.slice(0),rotation:r,annotationElementId:s,id:s,deleted:!1,popupRef:l,richText:h,comment:c?.str||null,creationDate:d,modificationDate:u}}else if(t instanceof Sr){const{data:{inkLists:e,rect:i,rotation:r,id:s,color:a,borderStyle:{rawWidth:o},popupRef:l,richText:h,contentsObj:c,creationDate:d,modificationDate:u},parent:{page:{pageNumber:p}}}=t;n=t={annotationType:w.HIGHLIGHT,color:Array.from(a),thickness:o,inkLists:e,boxes:null,pageIndex:p-1,rect:i.slice(0),rotation:r,annotationElementId:s,id:s,deleted:!1,popupRef:l,richText:h,comment:c?.str||null,creationDate:d,modificationDate:u}}const{color:r,quadPoints:s,inkLists:a,opacity:o}=t,l=await super.deserialize(t,e,i);l.color=ut.makeHexColor(...r),l.opacity=o||1,a&&(l.#co=t.thickness),l._initialData=n,t.comment&&l.setCommentData(t);const[h,c]=l.pageDimensions,[d,u]=l.pageTranslation;if(s){const t=l.#No=[];for(let e=0;e<s.length;e+=8)t.push({x:(s[e]-d)/h,y:1-(s[e+1]-u)/c,width:(s[e+2]-s[e])/h,height:(s[e+1]-s[e+5])/c});l.#Yo(),l.#qo(),l.rotate(l.rotation)}else if(a){l.#$o=!0;const t=a[0],i={x:t[0]-d,y:c-(t[1]-u)},n=new Ur(i,[0,0,h,c],1,l.#co/2,!0,.001);for(let e=0,r=t.length;e<r;e+=2)i.x=t[e]-d,i.y=c-(t[e+1]-u),n.add(i);const{id:r,clipPathId:s}=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:n.toSVGPath()}},!0,!0);l.#Xo({highlightOutlines:n.getOutlines(),highlightId:r,clipPathId:s}),l.#qo(),l.rotate(l.parentRotation)}return l}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const e=pe._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),i=super.serialize(t);return Object.assign(i,{color:e,opacity:this.opacity,thickness:this.#co,quadPoints:this.#nl(),outlines:this.#rl(i.rect)}),this.addComment(i),this.annotationElementId&&!this.#Qa(i)?null:(i.id=this.annotationElementId,i)}#Qa(t){const{color:e}=this._initialData;return this.hasEditedComment||t.color.some((t,i)=>t!==e[i])}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}}class Vr{#ol=Object.create(null);updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(const[e,i]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,i)}updateSVGProperty(t,e){this.#ol[t]=e}toSVGProperties(){const t=this.#ol;return this.#ol=Object.create(null),{root:t}}reset(){this.#ol=Object.create(null)}updateAll(t=this){this.updateProperties(t)}clone(){J("Not implemented")}}class $r extends pe{#ll=null;#hl;_colorPicker=null;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static#cl=null;static#dl=null;static#ul=null;static _INNER_MARGIN=3;constructor(t){super(t),this.#hl=t.mustBeCommitted||!1,this._addOutlines(t)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}_addOutlines(t){t.drawOutlines&&(this.#pl(t),this.#qo())}#pl({drawOutlines:t,drawId:e,drawingOptions:i}){this.#ll=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.#gl(t,this.parent),this.#fl(t.box)}#gl(t,e){const{id:i}=e.drawLayer.draw($r._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return i}static _mergeSVGProperties(t,e){const i=new Set(Object.keys(t));for(const[n,r]of Object.entries(e))i.has(n)?Object.assign(t[n],r):t[n]=r;return t}static getDefaultDrawingOptions(t){J("Not implemented")}static get typesMap(){J("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,e){const i=this.typesMap.get(t);i&&this._defaultDrawingOptions.updateProperty(i,e),this._currentParent&&($r.#cl.updateProperty(i,e),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,e){const i=this.constructor.typesMap.get(t);i&&this._updateProperty(t,i,e)}static get defaultPropertiesToUpdate(){const t=[],e=this._defaultDrawingOptions;for(const[i,n]of this.typesMap)t.push([i,e[n]]);return t}get propertiesToUpdate(){const t=[],{_drawingOptions:e}=this;for(const[i,n]of this.constructor.typesMap)t.push([i,e[n]]);return t}_updateProperty(t,e,i){const n=this._drawingOptions,r=n[e],s=i=>{n.updateProperty(e,i);const r=this.#ll.updateProperty(e,i);r&&this.#fl(r),this.parent?.drawLayer.updateProperties(this._drawId,n.toSVGProperties()),t===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:s.bind(this,i),undo:s.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,$r._mergeSVGProperties(this.#ll.getPathResizingSVGProperties(this.#ml()),{bbox:this.#bl()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,$r._mergeSVGProperties(this.#ll.getPathResizedSVGProperties(this.#ml()),{bbox:this.#bl()}))}_onTranslating(t,e){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#bl()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,$r._mergeSVGProperties(this.#ll.getPathTranslatedSVGProperties(this.#ml(),this.parentDimensions),{bbox:this.#bl()}))}_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.#hl&&(this.#hl=!1,this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){this.#tl(),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.#qo(),this.#fl(this.#ll.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),this.#tl()):t&&(this._uiManager.addShouldRescale(this),this.#qo(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),e&&this.select()}#tl(){null!==this._drawId&&this.parent&&(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}#qo(t=this.parent){null!==this._drawId&&this.parent===t||(null===this._drawId?(this._drawingOptions.updateAll(),this._drawId=this.#gl(this.#ll,t)):this.parent.drawLayer.updateParent(this._drawId,t.drawLayer))}#vl([t,e,i,n]){const{parentDimensions:[r,s],rotation:a}=this;switch(a){case 90:return[e,1-t,i*(s/r),n*(r/s)];case 180:return[1-t,1-e,i,n];case 270:return[1-e,t,i*(s/r),n*(r/s)];default:return[t,e,i,n]}}#ml(){const{x:t,y:e,width:i,height:n,parentDimensions:[r,s],rotation:a}=this;switch(a){case 90:return[1-e,t,i*(r/s),n*(s/r)];case 180:return[1-t,1-e,i,n];case 270:return[e,1-t,i*(r/s),n*(s/r)];default:return[t,e,i,n]}}#fl(t){[this.x,this.y,this.width,this.height]=this.#vl(t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#bl(){const{x:t,y:e,width:i,height:n,rotation:r,parentRotation:s,parentDimensions:[a,o]}=this;switch((4*r+s)/90){case 1:return[1-e-n,t,n,i];case 2:return[1-t-i,1-e-n,i,n];case 3:return[e,1-t-i,n,i];case 4:return[t,e-i*(a/o),n*(o/a),i*(a/o)];case 5:return[1-e,t,i*(a/o),n*(o/a)];case 6:return[1-t-n*(o/a),1-e,n*(o/a),i*(a/o)];case 7:return[e-i*(a/o),1-t-n*(o/a),i*(a/o),n*(o/a)];case 8:return[t-i,e-n,i,n];case 9:return[1-e,t-i,n,i];case 10:return[1-t,1-e,i,n];case 11:return[e-n,1-t,n,i];case 12:return[t-n*(o/a),e,n*(o/a),i*(a/o)];case 13:return[1-e-i*(a/o),t-n*(o/a),i*(a/o),n*(o/a)];case 14:return[1-t,1-e-i*(a/o),n*(o/a),i*(a/o)];case 15:return[e,1-t,i*(a/o),n*(o/a)];default:return[t,e,i,n]}}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,$r._mergeSVGProperties({bbox:this.#bl()},this.#ll.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&this.#fl(this.#ll.updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,e;this._isCopy&&(t=this.x,e=this.y);const i=super.render();i.classList.add("draw");const n=document.createElement("div");return i.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,e),i}static createDrawerInstance(t,e,i,n,r){J("Not implemented")}static startDrawing(t,e,i,n){const{target:r,offsetX:s,offsetY:a,pointerId:o,pointerType:l}=n;if(ne.isInitializedAndDifferentPointerType(l))return;const{viewport:{rotation:h}}=t,{width:c,height:d}=r.getBoundingClientRect(),u=$r.#dl=new AbortController,p=t.combinedSignal(u);ne.setPointer(l,o),window.addEventListener("pointerup",t=>{ne.isSamePointerIdOrRemove(t.pointerId)&&this._endDraw(t)},{signal:p}),window.addEventListener("pointercancel",t=>{ne.isSamePointerIdOrRemove(t.pointerId)&&this._currentParent.endDrawingSession()},{signal:p}),window.addEventListener("pointerdown",t=>{ne.isSamePointerType(t.pointerType)&&(ne.initializeAndAddPointerId(t.pointerId),$r.#cl.isCancellable()&&($r.#cl.removeLastElement(),$r.#cl.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:p}),window.addEventListener("contextmenu",It,{signal:p}),r.addEventListener("pointermove",this._drawMove.bind(this),{signal:p}),r.addEventListener("touchmove",t=>{ne.isSameTimeStamp(t.timeStamp)&&kt(t)},{signal:p}),t.toggleDrawing(),e._editorUndoBar?.hide(),$r.#cl?t.drawLayer.updateProperties(this._currentDrawId,$r.#cl.startNew(s,a,c,d,h)):(e.updateUIForDefaultProperties(this),$r.#cl=this.createDrawerInstance(s,a,c,d,h),$r.#ul=this.getDefaultDrawingOptions(),this._currentParent=t,({id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties($r.#ul.toSVGProperties(),$r.#cl.defaultSVGProperties),!0,!1)))}static _drawMove(t){if(ne.isSameTimeStamp(t.timeStamp),!$r.#cl)return;const{offsetX:e,offsetY:i,pointerId:n}=t;ne.isSamePointerId(n)&&(ne.isUsingMultiplePointers()?this._endDraw(t):(this._currentParent.drawLayer.updateProperties(this._currentDrawId,$r.#cl.add(e,i)),ne.setTimeStamp(t.timeStamp),kt(t)))}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,$r.#cl=null,$r.#ul=null,ne.clearTimeStamp()),$r.#dl&&($r.#dl.abort(),$r.#dl=null,ne.clearPointerIds())}static _endDraw(t){const e=this._currentParent;if(e){if(e.toggleDrawing(!0),this._cleanup(!1),t?.target===e.div&&e.drawLayer.updateProperties(this._currentDrawId,$r.#cl.end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){const t=$r.#cl,i=this._currentDrawId,n=t.getLastElement();return void e.addCommands({cmd:()=>{e.drawLayer.updateProperties(i,t.setLastElement(n))},undo:()=>{e.drawLayer.updateProperties(i,t.removeLastElement())},mustExec:!1,type:A.DRAW_STEP})}this.endDrawing(!1)}}static endDrawing(t){const e=this._currentParent;if(!e)return null;if(e.toggleDrawing(!0),e.cleanUndoStack(A.DRAW_STEP),!$r.#cl.isEmpty()){const{pageDimensions:[i,n],scale:r}=e,s=e.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:$r.#cl.getOutlines(i*r,n*r,r,this._INNER_MARGIN),drawingOptions:$r.#ul,mustBeCommitted:!t});return this._cleanup(!0),s}return e.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,e,i,n,r,s){J("Not implemented")}static async deserialize(t,e,i){const{rawDims:{pageWidth:n,pageHeight:r,pageX:s,pageY:a}}=e.viewport,o=this.deserializeDraw(s,a,n,r,this._INNER_MARGIN,t),l=await super.deserialize(t,e,i);return l.createDrawingOptions(t),l.#pl({drawOutlines:o}),l.#qo(),l.onScaleChanging(),l.rotate(),l}serializeDraw(t){const[e,i]=this.pageTranslation,[n,r]=this.pageDimensions;return this.#ll.serialize([e,i,n,r],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}}class Wr{#ro=new Float64Array(6);#Sa;#yl;#Mr;#co;#do;#wl="";#Al=0;#Lo=new Gr;#xl;#El;constructor(t,e,i,n,r,s){this.#xl=i,this.#El=n,this.#Mr=r,this.#co=s,[t,e]=this.#Cl(t,e);const a=this.#Sa=[NaN,NaN,NaN,NaN,t,e];this.#do=[t,e],this.#yl=[{line:a,points:this.#do}],this.#ro.set(a,0)}updateProperty(t,e){"stroke-width"===t&&(this.#co=e)}#Cl(t,e){return Rr._normalizePoint(t,e,this.#xl,this.#El,this.#Mr)}isEmpty(){return!this.#yl||0===this.#yl.length}isCancellable(){return this.#do.length<=10}add(t,e){[t,e]=this.#Cl(t,e);const[i,n,r,s]=this.#ro.subarray(2,6),a=t-r,o=e-s;return Math.hypot(this.#xl*a,this.#El*o)<=2?null:(this.#do.push(t,e),isNaN(i)?(this.#ro.set([r,s,t,e],2),this.#Sa.push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(this.#ro[0])&&this.#Sa.splice(6,6),this.#ro.set([i,n,r,s,t,e],0),this.#Sa.push(...Rr.createBezierPoints(i,n,r,s,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){const i=this.add(t,e);return i||(2===this.#do.length?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,i,n,r){this.#xl=i,this.#El=n,this.#Mr=r,[t,e]=this.#Cl(t,e);const s=this.#Sa=[NaN,NaN,NaN,NaN,t,e];this.#do=[t,e];const a=this.#yl.at(-1);return a&&(a.line=new Float32Array(a.line),a.points=new Float32Array(a.points)),this.#yl.push({line:s,points:this.#do}),this.#ro.set(s,0),this.#Al=0,this.toSVGPath(),null}getLastElement(){return this.#yl.at(-1)}setLastElement(t){return this.#yl?(this.#yl.push(t),this.#Sa=t.line,this.#do=t.points,this.#Al=0,{path:{d:this.toSVGPath()}}):this.#Lo.setLastElement(t)}removeLastElement(){if(!this.#yl)return this.#Lo.removeLastElement();this.#yl.pop(),this.#wl="";for(let t=0,e=this.#yl.length;t<e;t++){const{line:e,points:i}=this.#yl[t];this.#Sa=e,this.#do=i,this.#Al=0,this.toSVGPath()}return{path:{d:this.#wl}}}toSVGPath(){const t=Rr.svgRound(this.#Sa[4]),e=Rr.svgRound(this.#Sa[5]);if(2===this.#do.length)return this.#wl=`${this.#wl} M ${t} ${e} Z`,this.#wl;if(this.#do.length<=6){const i=this.#wl.lastIndexOf("M");this.#wl=`${this.#wl.slice(0,i)} M ${t} ${e}`,this.#Al=6}if(4===this.#do.length){const t=Rr.svgRound(this.#Sa[10]),e=Rr.svgRound(this.#Sa[11]);return this.#wl=`${this.#wl} L ${t} ${e}`,this.#Al=12,this.#wl}const i=[];0===this.#Al&&(i.push(`M ${t} ${e}`),this.#Al=6);for(let t=this.#Al,e=this.#Sa.length;t<e;t+=6){const[e,n,r,s,a,o]=this.#Sa.slice(t,t+6).map(Rr.svgRound);i.push(`C${e} ${n} ${r} ${s} ${a} ${o}`)}return this.#wl+=i.join(" "),this.#Al=this.#Sa.length,this.#wl}getOutlines(t,e,i,n){const r=this.#yl.at(-1);return r.line=new Float32Array(r.line),r.points=new Float32Array(r.points),this.#Lo.build(this.#yl,t,e,i,this.#Mr,this.#co,n),this.#ro=null,this.#Sa=null,this.#yl=null,this.#wl=null,this.#Lo}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}class Gr extends Rr{#xo;#Sl=0;#eo;#yl;#xl;#El;#_l;#Mr;#co;build(t,e,i,n,r,s,a){this.#xl=e,this.#El=i,this.#_l=n,this.#Mr=r,this.#co=s,this.#eo=a??0,this.#yl=t,this.#Tl()}get thickness(){return this.#co}setLastElement(t){return this.#yl.push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#yl.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const t=[];for(const{line:e}of this.#yl)if(t.push(`M${Rr.svgRound(e[4])} ${Rr.svgRound(e[5])}`),6!==e.length)if(12===e.length&&isNaN(e[6]))t.push(`L${Rr.svgRound(e[10])} ${Rr.svgRound(e[11])}`);else for(let i=6,n=e.length;i<n;i+=6){const[n,r,s,a,o,l]=e.subarray(i,i+6).map(Rr.svgRound);t.push(`C${n} ${r} ${s} ${a} ${o} ${l}`)}else t.push("Z");return t.join("")}serialize([t,e,i,n],r){const s=[],a=[],[o,l,h,c]=this.#Pl();let d,u,p,g,f,m,b,v,y;switch(this.#Mr){case 0:y=Rr._rescale,d=t,u=e+n,p=i,g=-n,f=t+o*i,m=e+(1-l-c)*n,b=t+(o+h)*i,v=e+(1-l)*n;break;case 90:y=Rr._rescaleAndSwap,d=t,u=e,p=i,g=n,f=t+l*i,m=e+o*n,b=t+(l+c)*i,v=e+(o+h)*n;break;case 180:y=Rr._rescale,d=t+i,u=e,p=-i,g=n,f=t+(1-o-h)*i,m=e+l*n,b=t+(1-o)*i,v=e+(l+c)*n;break;case 270:y=Rr._rescaleAndSwap,d=t+i,u=e+n,p=-i,g=-n,f=t+(1-l-c)*i,m=e+(1-o-h)*n,b=t+(1-l)*i,v=e+(1-o)*n}for(const{line:t,points:e}of this.#yl)s.push(y(t,d,u,p,g,r?new Array(t.length):null)),a.push(y(e,d,u,p,g,r?new Array(e.length):null));return{lines:s,points:a,rect:[f,m,b,v]}}static deserialize(t,e,i,n,r,{paths:{lines:s,points:a},rotation:o,thickness:l}){const h=[];let c,d,u,p,g;switch(o){case 0:g=Rr._rescale,c=-t/i,d=e/n+1,u=1/i,p=-1/n;break;case 90:g=Rr._rescaleAndSwap,c=-e/n,d=-t/i,u=1/n,p=1/i;break;case 180:g=Rr._rescale,c=t/i+1,d=-e/n,u=-1/i,p=1/n;break;case 270:g=Rr._rescaleAndSwap,c=e/n+1,d=t/i+1,u=-1/n,p=-1/i}if(!s){s=[];for(const t of a){const e=t.length;if(2===e){s.push(new Float32Array([NaN,NaN,NaN,NaN,t[0],t[1]]));continue}if(4===e){s.push(new Float32Array([NaN,NaN,NaN,NaN,t[0],t[1],NaN,NaN,NaN,NaN,t[2],t[3]]));continue}const i=new Float32Array(3*(e-2));s.push(i);let[n,r,a,o]=t.subarray(0,4);i.set([NaN,NaN,NaN,NaN,n,r],0);for(let s=4;s<e;s+=2){const e=t[s],l=t[s+1];i.set(Rr.createBezierPoints(n,r,a,o,e,l),3*(s-2)),[n,r,a,o]=[a,o,e,l]}}}for(let t=0,e=s.length;t<e;t++)h.push({line:g(s[t].map(t=>t??NaN),c,d,u,p),points:g(a[t].map(t=>t??NaN),c,d,u,p)});const f=new this.prototype.constructor;return f.build(h,i,n,1,o,l,r),f}#Dl(t=this.#co){const e=this.#eo+t/2*this.#_l;return this.#Mr%180==0?[e/this.#xl,e/this.#El]:[e/this.#El,e/this.#xl]}#Pl(){const[t,e,i,n]=this.#xo,[r,s]=this.#Dl(0);return[t+r,e+s,i-2*r,n-2*s]}#Tl(){const t=this.#xo=new Float32Array([1/0,1/0,-1/0,-1/0]);for(const{line:e}of this.#yl){if(e.length<=12){for(let i=4,n=e.length;i<n;i+=6)ut.pointBoundingBox(e[i],e[i+1],t);continue}let i=e[4],n=e[5];for(let r=6,s=e.length;r<s;r+=6){const[s,a,o,l,h,c]=e.subarray(r,r+6);ut.bezierBoundingBox(i,n,s,a,o,l,h,c,t),i=h,n=c}}const[e,i]=this.#Dl();t[0]=vt(t[0]-e,0,1),t[1]=vt(t[1]-i,0,1),t[2]=vt(t[2]+e,0,1),t[3]=vt(t[3]+i,0,1),t[2]-=t[0],t[3]-=t[1]}get box(){return this.#xo}updateProperty(t,e){return"stroke-width"===t?this.#Jo(e):null}#Jo(t){const[e,i]=this.#Dl();this.#co=t;const[n,r]=this.#Dl(),[s,a]=[n-e,r-i],o=this.#xo;return o[0]-=s,o[1]-=a,o[2]+=2*s,o[3]+=2*a,o}updateParentDimensions([t,e],i){const[n,r]=this.#Dl();this.#xl=t,this.#El=e,this.#_l=i;const[s,a]=this.#Dl(),o=s-n,l=a-r,h=this.#xo;return h[0]-=o,h[1]-=l,h[2]+=2*o,h[3]+=2*l,h}updateRotation(t){return this.#Sl=t,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#xo.map(Rr.svgRound).join(" ")}get defaultProperties(){const[t,e]=this.#xo;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Rr.svgRound(t)} ${Rr.svgRound(e)}`}}}get rotationTransform(){const[,,t,e]=this.#xo;let i=0,n=0,r=0,s=0,a=0,o=0;switch(this.#Sl){case 90:n=e/t,r=-t/e,a=t;break;case 180:i=-1,s=-1,a=t,o=e;break;case 270:n=-e/t,r=t/e,o=e;break;default:return""}return`matrix(${i} ${n} ${r} ${s} ${Rr.svgRound(a)} ${Rr.svgRound(o)})`}getPathResizingSVGProperties([t,e,i,n]){const[r,s]=this.#Dl(),[a,o,l,h]=this.#xo;if(Math.abs(l-r)<=Rr.PRECISION||Math.abs(h-s)<=Rr.PRECISION){const r=t+i/2-(a+l/2),s=e+n/2-(o+h/2);return{path:{"transform-origin":`${Rr.svgRound(t)} ${Rr.svgRound(e)}`,transform:`${this.rotationTransform} translate(${r} ${s})`}}}const c=(i-2*r)/(l-2*r),d=(n-2*s)/(h-2*s),u=l/i,p=h/n;return{path:{"transform-origin":`${Rr.svgRound(a)} ${Rr.svgRound(o)}`,transform:`${this.rotationTransform} scale(${u} ${p}) translate(${Rr.svgRound(r)} ${Rr.svgRound(s)}) scale(${c} ${d}) translate(${Rr.svgRound(-r)} ${Rr.svgRound(-s)})`}}}getPathResizedSVGProperties([t,e,i,n]){const[r,s]=this.#Dl(),a=this.#xo,[o,l,h,c]=a;if(a[0]=t,a[1]=e,a[2]=i,a[3]=n,Math.abs(h-r)<=Rr.PRECISION||Math.abs(c-s)<=Rr.PRECISION){const r=t+i/2-(o+h/2),s=e+n/2-(l+c/2);for(const{line:t,points:e}of this.#yl)Rr._translate(t,r,s,t),Rr._translate(e,r,s,e);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Rr.svgRound(t)} ${Rr.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const d=(i-2*r)/(h-2*r),u=(n-2*s)/(c-2*s),p=-d*(o+r)+t+r,g=-u*(l+s)+e+s;if(1!==d||1!==u||0!==p||0!==g)for(const{line:t,points:e}of this.#yl)Rr._rescale(t,p,g,d,u,t),Rr._rescale(e,p,g,d,u,e);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Rr.svgRound(t)} ${Rr.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,e],i){const[n,r]=i,s=this.#xo,a=t-s[0],o=e-s[1];if(this.#xl===n&&this.#El===r)for(const{line:t,points:e}of this.#yl)Rr._translate(t,a,o,t),Rr._translate(e,a,o,e);else{const t=this.#xl/n,e=this.#El/r;this.#xl=n,this.#El=r;for(const{line:i,points:n}of this.#yl)Rr._rescale(i,a,o,t,e,i),Rr._rescale(n,a,o,t,e,n);s[2]*=t,s[3]*=e}return s[0]=t,s[1]=e,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Rr.svgRound(t)} ${Rr.svgRound(e)}`}}}get defaultSVGProperties(){const t=this.#xo;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Rr.svgRound(t[0])} ${Rr.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}}class Xr extends Vr{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:pe._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(){const t=new Xr(this._viewParameters);return t.updateAll(this),t}}class qr extends $r{static _type="ink";static _editorType=w.INK;static _defaultDrawingOptions=null;constructor(t){super({...t,name:"inkEditor"}),this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,e){pe.initialize(t,e),this._defaultDrawingOptions=new Xr(e.viewParameters)}static getDefaultDrawingOptions(t){const e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!0}static get typesMap(){return et(this,"typesMap",new Map([[A.INK_THICKNESS,"stroke-width"],[A.INK_COLOR,"stroke"],[A.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,e,i,n,r){return new Wr(t,e,i,n,r,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,e,i,n,r,s){return Gr.deserialize(t,e,i,n,r,s)}static async deserialize(t,e,i){let n=null;if(t instanceof Sr){const{data:{inkLists:e,rect:i,rotation:r,id:s,color:a,opacity:o,borderStyle:{rawWidth:l},popupRef:h,richText:c,contentsObj:d,creationDate:u,modificationDate:p},parent:{page:{pageNumber:g}}}=t;n=t={annotationType:w.INK,color:Array.from(a),thickness:l,opacity:o,paths:{points:e},boxes:null,pageIndex:g-1,rect:i.slice(0),rotation:r,annotationElementId:s,id:s,deleted:!1,popupRef:h,richText:c,comment:d?.str||null,creationDate:u,modificationDate:p}}const r=await super.deserialize(t,e,i);return r._initialData=n,t.comment&&r.setCommentData(t),r}get toolbarButtons(){return this._colorPicker||=new Kn(this),[["colorPicker",this._colorPicker]]}get colorType(){return A.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:t,_drawingOptions:e,parent:i}=this;e.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(t,e.toSVGProperties())}static onScaleChangingWhenDrawing(){const t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:e,opacity:i}){this._drawingOptions=qr.getDefaultDrawingOptions({stroke:ut.makeHexColor(...t),"stroke-width":e,"stroke-opacity":i})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:e,points:i}=this.serializeDraw(t),{_drawingOptions:{stroke:n,"stroke-opacity":r,"stroke-width":s}}=this,a=Object.assign(super.serialize(t),{color:pe._colorManager.convert(n),opacity:r,thickness:s,paths:{lines:e,points:i}});return this.addComment(a),t?(a.isCopy=!0,a):this.annotationElementId&&!this.#Qa(a)?null:(a.id=this.annotationElementId,a)}#Qa(t){const{color:e,thickness:i,opacity:n,pageIndex:r}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((t,i)=>t!==e[i])||t.thickness!==i||t.opacity!==n||t.pageIndex!==r}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;const{points:e,rect:i}=this.serializeDraw(!1);return t.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:e,popup:this.comment}),null}}class Yr extends Gr{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}}a(9432);class Kr{static#Ml={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#Fl(t,e,i,n){return n-=e,0===(i-=t)?n>0?0:4:1===i?n+6:2-n}static#Il=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#kl(t,e,i,n,r,s,a){const o=this.#Fl(i,n,r,s);for(let r=0;r<8;r++){const s=(-r+o-a+16)%8;if(0!==t[(i+this.#Il[2*s])*e+(n+this.#Il[2*s+1])])return s}return-1}static#Ll(t,e,i,n,r,s,a){const o=this.#Fl(i,n,r,s);for(let r=0;r<8;r++){const s=(r+o+a+16)%8;if(0!==t[(i+this.#Il[2*s])*e+(n+this.#Il[2*s+1])])return s}return-1}static#Rl(t,e,i,n){const r=t.length,s=new Int32Array(r);for(let e=0;e<r;e++)s[e]=t[e]<=n?1:0;for(let t=1;t<i-1;t++)s[t*e]=s[t*e+e-1]=0;for(let t=0;t<e;t++)s[t]=s[e*i-1-t]=0;let a,o=1;const l=[];for(let t=1;t<i-1;t++){a=1;for(let i=1;i<e-1;i++){const n=t*e+i,r=s[n];if(0===r)continue;let h=t,c=i;if(1===r&&0===s[n-1])o+=1,c-=1;else{if(!(r>=1&&0===s[n+1])){1!==r&&(a=Math.abs(r));continue}o+=1,c+=1,r>1&&(a=r)}const d=[i,t],u=c===i+1,p={isHole:u,points:d,id:o,parent:0};let g;l.push(p);for(const t of l)if(t.id===a){g=t;break}g?g.isHole?p.parent=u?g.parent:a:p.parent=u?a:g.parent:p.parent=u?a:0;const f=this.#kl(s,e,t,i,h,c,0);if(-1===f){s[n]=-o,1!==s[n]&&(a=Math.abs(s[n]));continue}let m=this.#Il[2*f],b=this.#Il[2*f+1];const v=t+m,y=i+b;h=v,c=y;let w=t,A=i;for(;;){const r=this.#Ll(s,e,w,A,h,c,1);m=this.#Il[2*r],b=this.#Il[2*r+1];const l=w+m,u=A+b;d.push(u,l);const p=w*e+A;if(0===s[p+1]?s[p]=-o:1===s[p]&&(s[p]=o),l===t&&u===i&&w===v&&A===y){1!==s[n]&&(a=Math.abs(s[n]));break}h=w,c=A,w=l,A=u}}}return l}static#Bl(t,e,i,n){if(i-e<=4){for(let r=e;r<i-2;r+=2)n.push(t[r],t[r+1]);return}const r=t[e],s=t[e+1],a=t[i-4]-r,o=t[i-3]-s,l=Math.hypot(a,o),h=a/l,c=o/l,d=h*s-c*r,u=o/a,p=1/l,g=Math.atan(u),f=Math.cos(g),m=Math.sin(g),b=p*(Math.abs(f)+Math.abs(m)),v=p*(1-b+b**2),y=Math.max(Math.atan(Math.abs(m+f)*v),Math.atan(Math.abs(m-f)*v));let w=0,A=e;for(let n=e+2;n<i-2;n+=2){const e=Math.abs(d-h*t[n+1]+c*t[n]);e>w&&(A=n,w=e)}w>(l*y)**2?(this.#Bl(t,e,A+2,n),this.#Bl(t,A,i,n)):n.push(r,s)}static#Nl(t){const e=[],i=t.length;return this.#Bl(t,0,i,e),e.push(t[i-2],t[i-1]),e.length<=4?null:e}static#Ol(t,e,i,n,r,s){const a=new Float32Array(s**2),o=-2*n**2,l=s>>1;for(let t=0;t<s;t++){const e=(t-l)**2;for(let i=0;i<s;i++)a[t*s+i]=Math.exp((e+(i-l)**2)/o)}const h=new Float32Array(256),c=-2*r**2;for(let t=0;t<256;t++)h[t]=Math.exp(t**2/c);const d=t.length,u=new Uint8Array(d),p=new Uint32Array(256);for(let n=0;n<i;n++)for(let r=0;r<e;r++){const o=n*e+r,c=t[o];let d=0,g=0;for(let o=0;o<s;o++){const u=n+o-l;if(!(u<0||u>=i))for(let i=0;i<s;i++){const n=r+i-l;if(n<0||n>=e)continue;const p=t[u*e+n],f=a[o*s+i]*h[Math.abs(p-c)];d+=p*f,g+=f}}p[u[o]=Math.round(d/g)]++}return[u,p]}static#jl(t){const e=new Uint32Array(256);for(const i of t)e[i]++;return e}static#Ul(t){const e=t.length,i=new Uint8ClampedArray(e>>2);let n=-1/0,r=1/0;for(let e=0,s=i.length;e<s;e++){const s=i[e]=t[e<<2];n=Math.max(n,s),r=Math.min(r,s)}const s=255/(n-r);for(let t=0,e=i.length;t<e;t++)i[t]=(i[t]-r)*s;return i}static#zl(t){let e,i=-1/0,n=-1/0;const r=t.findIndex(t=>0!==t);let s=r,a=r;for(e=r;e<256;e++){const r=t[e];r>i&&(e-s>n&&(n=e-s,a=e-1),i=r,s=e)}for(e=a-1;e>=0&&!(t[e]>t[e+1]);e--);return e}static#Hl(t){const e=t,{width:i,height:n}=t,{maxDim:r}=this.#Ml;let s=i,a=n;if(i>r||n>r){let o=i,l=n,h=Math.log2(Math.max(i,n)/r);const c=Math.floor(h);h=h===c?c-1:c;for(let i=0;i<h;i++){s=Math.ceil(o/2),a=Math.ceil(l/2);const i=new OffscreenCanvas(s,a);i.getContext("2d").drawImage(t,0,0,o,l,0,0,s,a),o=s,l=a,t!==e&&t.close(),t=i.transferToImageBitmap()}const d=Math.min(r/s,r/a);s=Math.round(s*d),a=Math.round(a*d)}const o=new OffscreenCanvas(s,a).getContext("2d",{willReadFrequently:!0});o.fillStyle="white",o.fillRect(0,0,s,a),o.filter="grayscale(1)",o.drawImage(t,0,0,t.width,t.height,0,0,s,a);const l=o.getImageData(0,0,s,a).data;return[this.#Ul(l),s,a]}static extractContoursFromText(t,{fontFamily:e,fontStyle:i,fontWeight:n},r,s,a,o){let l=new OffscreenCanvas(1,1),h=l.getContext("2d",{alpha:!1});const c=h.font=`${i} ${n} 200px ${e}`,{actualBoundingBoxLeft:d,actualBoundingBoxRight:u,actualBoundingBoxAscent:p,actualBoundingBoxDescent:g,fontBoundingBoxAscent:f,fontBoundingBoxDescent:m,width:b}=h.measureText(t),v=1.5,y=Math.ceil(Math.max(Math.abs(d)+Math.abs(u)||0,b)*v),w=Math.ceil(Math.max(Math.abs(p)+Math.abs(g)||200,Math.abs(f)+Math.abs(m)||200)*v);l=new OffscreenCanvas(y,w),h=l.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=c,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,y,w),h.fillStyle="black",h.fillText(t,.5*y/2,1.5*w/2);const A=this.#Ul(h.getImageData(0,0,y,w).data),x=this.#jl(A),E=this.#zl(x),C=this.#Rl(A,y,w,E);return this.processDrawnLines({lines:{curves:C,width:y,height:w},pageWidth:r,pageHeight:s,rotation:a,innerMargin:o,mustSmooth:!0,areContours:!0})}static process(t,e,i,n,r){const[s,a,o]=this.#Hl(t),[l,h]=this.#Ol(s,a,o,Math.hypot(a,o)*this.#Ml.sigmaSFactor,this.#Ml.sigmaR,this.#Ml.kernelSize),c=this.#zl(h),d=this.#Rl(l,a,o,c);return this.processDrawnLines({lines:{curves:d,width:a,height:o},pageWidth:e,pageHeight:i,rotation:n,innerMargin:r,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:i,rotation:n,innerMargin:r,mustSmooth:s,areContours:a}){n%180!=0&&([e,i]=[i,e]);const{curves:o,width:l,height:h}=t,c=t.thickness??0,d=[],u=Math.min(e/l,i/h),p=u/e,g=u/i,f=[];for(const{points:t}of o){const e=s?this.#Nl(t):t;if(!e)continue;f.push(e);const i=e.length,n=new Float32Array(i),r=new Float32Array(3*(2===i?2:i-2));if(d.push({line:r,points:n}),2===i){n[0]=e[0]*p,n[1]=e[1]*g,r.set([NaN,NaN,NaN,NaN,n[0],n[1]],0);continue}let[a,o,l,h]=e;a*=p,o*=g,l*=p,h*=g,n.set([a,o,l,h],0),r.set([NaN,NaN,NaN,NaN,a,o],0);for(let t=4;t<i;t+=2){const i=n[t]=e[t]*p,s=n[t+1]=e[t+1]*g;r.set(Rr.createBezierPoints(a,o,l,h,i,s),3*(t-2)),[a,o,l,h]=[l,h,i,s]}}if(0===d.length)return null;const m=a?new Yr:new Gr;return m.build(d,e,i,1,n,a?0:c,r),{outline:m,newCurves:f,areContours:a,thickness:c,width:l,height:h}}static async compressSignature({outlines:t,areContours:e,thickness:i,width:n,height:r}){let s,a=1/0,o=-1/0,l=0;for(const e of t){l+=e.length;for(let t=2,i=e.length;t<i;t++){const i=e[t]-e[t-2];a=Math.min(a,i),o=Math.max(o,i)}}s=a>=-128&&o<=127?Int8Array:a>=-32768&&o<=32767?Int16Array:Int32Array;const h=t.length,c=8+3*h,d=new Uint32Array(c);let u=0;d[u++]=c*Uint32Array.BYTES_PER_ELEMENT+(l-2*h)*s.BYTES_PER_ELEMENT,d[u++]=0,d[u++]=n,d[u++]=r,d[u++]=e?0:1,d[u++]=Math.max(0,Math.floor(i??0)),d[u++]=h,d[u++]=s.BYTES_PER_ELEMENT;for(const e of t)d[u++]=e.length-2,d[u++]=e[0],d[u++]=e[1];const p=new CompressionStream("deflate-raw"),g=p.writable.getWriter();await g.ready,g.write(d);const f=s.prototype.constructor;for(const e of t){const t=new f(e.length-2);for(let i=2,n=e.length;i<n;i++)t[i-2]=e[i]-e[i-2];g.write(t)}g.close();const m=await new Response(p.readable).arrayBuffer();return new Uint8Array(m).toBase64()}static async decompressSignature(t){try{const e=Uint8Array.fromBase64(t),{readable:i,writable:n}=new DecompressionStream("deflate-raw"),r=n.getWriter();await r.ready,r.write(e).then(async()=>{await r.ready,await r.close()}).catch(()=>{});let s=null,a=0;for await(const t of i)s||=new Uint8Array(new Uint32Array(t.buffer,0,4)[0]),s.set(t,a),a+=t.length;const o=new Uint32Array(s.buffer,0,s.length>>2),l=o[1];if(0!==l)throw new Error(`Invalid version: ${l}`);const h=o[2],c=o[3],d=0===o[4],u=o[5],p=o[6],g=o[7],f=[],m=(8+3*p)*Uint32Array.BYTES_PER_ELEMENT;let b;switch(g){case Int8Array.BYTES_PER_ELEMENT:b=new Int8Array(s.buffer,m);break;case Int16Array.BYTES_PER_ELEMENT:b=new Int16Array(s.buffer,m);break;case Int32Array.BYTES_PER_ELEMENT:b=new Int32Array(s.buffer,m)}a=0;for(let t=0;t<p;t++){const e=o[3*t+8],i=new Float32Array(e+2);f.push(i);for(let e=0;e<2;e++)i[e]=o[3*t+8+e+1];for(let t=0;t<e;t++)i[t+2]=i[t]+b[a++]}return{areContours:d,thickness:u,outlines:f,width:h,height:c}}catch(t){return K(`decompressSignature: ${t}`),null}}}class Jr extends Vr{constructor(){super(),super.updateProperties({fill:pe._defaultLineColor,"stroke-width":0})}clone(){const t=new Jr;return t.updateAll(this),t}}class Qr extends Xr{constructor(t){super(t),super.updateProperties({stroke:pe._defaultLineColor,"stroke-width":1})}clone(){const t=new Qr(this._viewParameters);return t.updateAll(this),t}}class Zr extends $r{#Vl=!1;#$l=null;#Wl=null;#Gl=null;static _type="signature";static _editorType=w.SIGNATURE;static _defaultDrawingOptions=null;constructor(t){super({...t,mustBeCommitted:!0,name:"signatureEditor"}),this._willKeepAspectRatio=!0,this.#Wl=t.signatureData||null,this.#$l=null,this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,e){pe.initialize(t,e),this._defaultDrawingOptions=new Jr,this._defaultDrawnSignatureOptions=new Qr(e.viewParameters)}static getDefaultDrawingOptions(t){const e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!1}static get typesMap(){return et(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!this.#$l}}static computeTelemetryFinalData(t){const 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(){if(this.div)return this.div;let t,e;const{_isCopy:i}=this;if(i&&(this._isCopy=!1,t=this.x,e=this.y),super.render(),null===this._drawId)if(this.#Wl){const{lines:t,mustSmooth:e,areContours:i,description:n,uuid:r,heightInPage:s}=this.#Wl,{rawDims:{pageWidth:a,pageHeight:o},rotation:l}=this.parent.viewport,h=Kr.processDrawnLines({lines:t,pageWidth:a,pageHeight:o,rotation:l,innerMargin:Zr._INNER_MARGIN,mustSmooth:e,areContours:i});this.addSignature(h,s,n,r)}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.#$l||""}));return i&&(this._isCopy=!0,this._moveAfterPaste(t,e)),this.div}setUuid(t){this.#Gl=t,this.addEditToolbar()}getUuid(){return this.#Gl}get description(){return this.#$l}set description(t){this.#$l=t,this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:t})),super.addEditToolbar().then(e=>{e?.updateEditSignatureButton(t)}))}getSignaturePreview(){const{newCurves:t,areContours:e,thickness:i,width:n,height:r}=this.#Wl,s=Math.max(n,r);return{areContours:e,outline:Kr.processDrawnLines({lines:{curves:t.map(t=>({points:t})),thickness:i,width:n,height:r},pageWidth:s,pageHeight:s,rotation:0,innerMargin:0,mustSmooth:!1,areContours:e}).outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,e,i,n){const{x:r,y:s}=this,{outline:a}=this.#Wl=t;let o;this.#Vl=a instanceof Yr,this.description=i,this.#Vl?o=Zr.getDefaultDrawingOptions():(o=Zr._defaultDrawnSignatureOptions.clone(),o.updateProperties({"stroke-width":a.thickness})),this._addOutlines({drawOutlines:a,drawingOptions:o});const[,l]=this.pageDimensions;let 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=r,this.y=s,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(n),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!n,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(t){const{rawDims:{pageWidth:e,pageHeight:i},rotation:n}=this.parent.viewport;return Kr.process(t,e,i,n,Zr._INNER_MARGIN)}getFromText(t,e){const{rawDims:{pageWidth:i,pageHeight:n},rotation:r}=this.parent.viewport;return Kr.extractContoursFromText(t,e,i,n,r,Zr._INNER_MARGIN)}getDrawnSignature(t){const{rawDims:{pageWidth:e,pageHeight:i},rotation:n}=this.parent.viewport;return Kr.processDrawnLines({lines:t,pageWidth:e,pageHeight:i,rotation:n,innerMargin:Zr._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:e}){t?this._drawingOptions=Zr.getDefaultDrawingOptions():(this._drawingOptions=Zr._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":e}))}serialize(t=!1){if(this.isEmpty())return null;const{lines:e,points:i}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":n}}=this,r=Object.assign(super.serialize(t),{isSignature:!0,areContours:this.#Vl,color:[0,0,0],thickness:this.#Vl?0:n});return this.addComment(r),t?(r.paths={lines:e,points:i},r.uuid=this.#Gl,r.isCopy=!0):r.lines=e,this.#$l&&(r.accessibilityData={type:"Figure",alt:this.#$l}),r}static deserializeDraw(t,e,i,n,r,s){return s.areContours?Yr.deserialize(t,e,i,n,r,s):Gr.deserialize(t,e,i,n,r,s)}static async deserialize(t,e,i){const n=await super.deserialize(t,e,i);return n.#Vl=t.areContours,n.description=t.accessibilityData?.alt||"",n.#Gl=t.uuid,n}}class ts extends pe{#Xl=null;#ql=null;#Yl=null;#Kl=null;#Jl=null;#Ql="";#Zl=null;#th=!1;#eh=null;#ih=!1;#nh=!1;static _type="stamp";static _editorType=w.STAMP;constructor(t){super({...t,name:"stampEditor"}),this.#Kl=t.bitmapUrl,this.#Jl=t.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,e){pe.initialize(t,e)}static isHandlingMimeForPasting(t){return zt.includes(t)}static paste(t,e){e.pasteEditor({mode:w.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){const e=t.get("hasAltText");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}#rh(t,e=!1){t?(this.#Xl=t.bitmap,e||(this.#ql=t.id,this.#ih=t.isSvg),t.file&&(this.#Ql=t.file.name),this.#sh()):this.remove()}#ah(){if(this.#Yl=null,this._uiManager.enableWaiting(!1),this.#Zl)if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#Xl)this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#Xl){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;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:n,width:r,height:s}=t||this.copyCanvas(null,null,!0).imageData,a=await i.guess({name:"altText",request:{data:n,width:r,height:s,channels:n.length/(r*s)}});if(!a)throw new Error("No response from the AI service.");if(a.error)throw new Error("Error from the AI service.");if(a.cancel)return null;if(!a.output)throw new Error("No valid response from the AI service.");const o=a.output;return await this.setGuessedAltText(o),e&&!this.hasAltTextData()&&(this.altTextData={alt:o,decorative:!1}),o}#oh(){if(this.#ql)return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(this.#ql).then(t=>this.#rh(t,!0)).finally(()=>this.#ah());if(this.#Kl){const t=this.#Kl;return this.#Kl=null,this._uiManager.enableWaiting(!0),void(this.#Yl=this._uiManager.imageManager.getFromUrl(t).then(t=>this.#rh(t)).finally(()=>this.#ah()))}if(this.#Jl){const t=this.#Jl;return this.#Jl=null,this._uiManager.enableWaiting(!0),void(this.#Yl=this._uiManager.imageManager.getFromFile(t).then(t=>this.#rh(t)).finally(()=>this.#ah()))}const t=document.createElement("input");t.type="file",t.accept=zt.join(",");const e=this._uiManager._signal;this.#Yl=new Promise(i=>{t.addEventListener("change",async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);const e=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#rh(e)}else this.remove();i()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:e})}).finally(()=>this.#ah()),t.click()}remove(){this.#ql&&(this.#Xl=null,this._uiManager.imageManager.deleteId(this.#ql),this.#Zl?.remove(),this.#Zl=null,this.#eh&&(clearTimeout(this.#eh),this.#eh=null)),super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(this.#ql&&null===this.#Zl&&this.#oh(),this.isAttachedToDOM||this.parent.add(this))):this.#ql&&this.#oh()}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(this.#Yl||this.#Xl||this.#Kl||this.#Jl||this.#ql||this.#th)}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;return this._isCopy&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#th||(this.#Xl?this.#sh():this.#oh()),this._isCopy&&this._moveAfterPaste(t,e),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,e){const{id:i,bitmap:n}=this._uiManager.imageManager.getFromCanvas(t,e);e.remove(),i&&this._uiManager.imageManager.isValidId(i)&&(this.#ql=i,n&&(this.#Xl=n),this.#th=!1,this.#sh())}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;null!==this.#eh&&clearTimeout(this.#eh);this.#eh=setTimeout(()=>{this.#eh=null,this.#lh()},200)}#sh(){const{div:t}=this;let{width:e,height:i}=this.#Xl;const[n,r]=this.pageDimensions,s=.75;if(this.width)e=this.width*n,i=this.height*r;else if(e>s*n||i>s*r){const t=Math.min(s*n/e,s*r/i);e*=t,i*=t}this._uiManager.enableWaiting(!1);const a=this.#Zl=document.createElement("canvas");a.setAttribute("role","img"),this.addContainer(a),this.width=e/n,this.height=i/r,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(t.hidden=!1),this.#lh(),this.#nh||(this.parent.addUndoableEditor(this),this.#nh=!0),this._reportTelemetry({action:"inserted_image"}),this.#Ql&&this.div.setAttribute("aria-description",this.#Ql),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")}copyCanvas(t,e,i=!1){t||(t=224);const{width:n,height:r}=this.#Xl,s=new Ut;let a=this.#Xl,o=n,l=r,h=null;if(e){if(n>e||r>e){const t=Math.min(e/n,e/r);o=Math.floor(n*t),l=Math.floor(r*t)}h=document.createElement("canvas");const t=h.width=Math.ceil(o*s.sx),i=h.height=Math.ceil(l*s.sy);this.#ih||(a=this.#hh(t,i));const c=h.getContext("2d");c.filter=this._uiManager.hcmFilter;let d="white",u="#cfcfd8";"none"!==this._uiManager.hcmFilter?u="black":Ht.isDarkMode&&(d="#8f8f9d",u="#42414d");const p=15,g=p*s.sx,f=p*s.sy,m=new OffscreenCanvas(2*g,2*f),b=m.getContext("2d");b.fillStyle=d,b.fillRect(0,0,2*g,2*f),b.fillStyle=u,b.fillRect(0,0,g,f),b.fillRect(g,f,g,f),c.fillStyle=c.createPattern(m,"repeat"),c.fillRect(0,0,t,i),c.drawImage(a,0,0,a.width,a.height,0,0,t,i)}let c=null;if(i){let e,i;if(s.symmetric&&a.width<t&&a.height<t)e=a.width,i=a.height;else if(a=this.#Xl,n>t||r>t){const s=Math.min(t/n,t/r);e=Math.floor(n*s),i=Math.floor(r*s),this.#ih||(a=this.#hh(e,i))}const o=new OffscreenCanvas(e,i).getContext("2d",{willReadFrequently:!0});o.drawImage(a,0,0,a.width,a.height,0,0,e,i),c={width:e,height:i,data:o.getImageData(0,0,e,i).data}}return{canvas:h,width:o,height:l,imageData:c}}#hh(t,e){const{width:i,height:n}=this.#Xl;let r=i,s=n,a=this.#Xl;for(;r>2*t||s>2*e;){const i=r,n=s;r>2*t&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2)),s>2*e&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2));const o=new OffscreenCanvas(r,s);o.getContext("2d").drawImage(a,0,0,i,n,0,0,r,s),a=o.transferToImageBitmap()}return a}#lh(){const[t,e]=this.parentDimensions,{width:i,height:n}=this,r=new Ut,s=Math.ceil(i*t*r.sx),a=Math.ceil(n*e*r.sy),o=this.#Zl;if(!o||o.width===s&&o.height===a)return;o.width=s,o.height=a;const l=this.#ih?this.#Xl:this.#hh(s,a),h=o.getContext("2d");h.filter=this._uiManager.hcmFilter,h.drawImage(l,0,0,l.width,l.height,0,0,s,a)}#ch(t){if(t){if(this.#ih){const t=this._uiManager.imageManager.getSvgUrl(this.#ql);if(t)return t}const t=document.createElement("canvas");({width:t.width,height:t.height}=this.#Xl);return t.getContext("2d").drawImage(this.#Xl,0,0),t.toDataURL()}if(this.#ih){const[t,e]=this.pageDimensions,i=Math.round(this.width*t*xt.PDF_TO_CSS_UNITS),n=Math.round(this.height*e*xt.PDF_TO_CSS_UNITS),r=new OffscreenCanvas(i,n);return r.getContext("2d").drawImage(this.#Xl,0,0,this.#Xl.width,this.#Xl.height,0,0,i,n),r.transferToImageBitmap()}return structuredClone(this.#Xl)}static async deserialize(t,e,i){let n=null,r=!1;if(t instanceof Mr){const{data:{rect:s,rotation:a,id:o,structParent:l,popupRef:h,richText:c,contentsObj:d,creationDate:u,modificationDate:p},container:g,parent:{page:{pageNumber:f}},canvas:m}=t;let b,v;m?(delete t.canvas,({id:b,bitmap:v}=i.imageManager.getFromCanvas(g.id,m)),m.remove()):(r=!0,t._hasNoCanvas=!0);const y=(await e._structTree.getAriaAttributes(`${bt}${o}`))?.get("aria-label")||"";n=t={annotationType:w.STAMP,bitmapId:b,bitmap:v,pageIndex:f-1,rect:s.slice(0),rotation:a,annotationElementId:o,id:o,deleted:!1,accessibilityData:{decorative:!1,altText:y},isSvg:!1,structParent:l,popupRef:h,richText:c,comment:d?.str||null,creationDate:u,modificationDate:p}}const s=await super.deserialize(t,e,i),{rect:a,bitmap:o,bitmapUrl:l,bitmapId:h,isSvg:c,accessibilityData:d}=t;r?(i.addMissingCanvas(t.id,s),s.#th=!0):h&&i.imageManager.isValidId(h)?(s.#ql=h,o&&(s.#Xl=o)):s.#Kl=l,s.#ih=c;const[u,p]=s.pageDimensions;return s.width=(a[2]-a[0])/u,s.height=(a[3]-a[1])/p,d&&(s.altTextData=d),s._initialData=n,t.comment&&s.setCommentData(t),s.#nh=!!n,s}serialize(t=!1,e=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i=Object.assign(super.serialize(t),{bitmapId:this.#ql,isSvg:this.#ih});if(this.addComment(i),t)return i.bitmapUrl=this.#ch(!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;const{decorative:n,altText:r}=this.serializeAltText(!1);if(!n&&r&&(i.accessibilityData={type:"Figure",alt:r}),this.annotationElementId){const t=this.#Qa(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;const s=this.#ih?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has(this.#ql)){if(this.#ih){const t=e.stamps.get(this.#ql);s>t.area&&(t.area=s,t.serialized.bitmap.close(),t.serialized.bitmap=this.#ch(!1))}}else e.stamps.set(this.#ql,{area:s,serialized:i}),i.bitmap=this.#ch(!1);return i}#Qa(t){const{pageIndex:e,accessibilityData:{altText:i}}=this._initialData,n=t.pageIndex===e,r=(t.accessibilityData?.alt||"")===i;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&n&&r,isSameAltText:r}}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}class es{#La;#dh=!1;#uh=null;#ph=null;#gh=null;#fh=new Map;#mh=!1;#bh=!1;#vh=!1;#yh=null;#wh=null;#Ah=null;#xh=null;#Eh=null;#Ch=-1;#C;static _initialized=!1;static#it=new Map([Lr,qr,ts,Hr,Zr].map(t=>[t._editorType,t]));constructor({uiManager:t,pageIndex:e,div:i,structTreeLayer:n,accessibilityManager:r,annotationLayer:s,drawLayer:a,textLayer:o,viewport:l,l10n:h}){const c=[...es.#it.values()];if(!es._initialized){es._initialized=!0;for(const e of c)e.initialize(h,t)}t.registerEditorTypes(c),this.#C=t,this.pageIndex=e,this.div=i,this.#La=r,this.#uh=s,this.viewport=l,this.#Ah=o,this.drawLayer=a,this._structTree=n,this.#C.addLayer(this)}updatePageIndex(t){this.pageIndex=t}get isEmpty(){return 0===this.#fh.size}get isInvisible(){return this.isEmpty&&this.#C.getMode()===w.NONE}updateToolbar(t){this.#C.updateToolbar(t)}updateMode(t=this.#C.getMode()){switch(this.#Sh(),t){case w.NONE:return this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case w.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case w.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;if(e.toggle("nonEditing",!1),t===w.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(const i of es.#it.values())e.toggle(`${i._type}Editing`,t===i._editorType)}this.div.hidden=!1}hasTextLayer(t){return t===this.#Ah?.div}setEditingState(t){this.#C.setEditingState(t)}addCommands(t){this.#C.addCommands(t)}cleanUndoStack(t){this.#C.cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){this.#uh?.togglePointerEvents(t)}get#_h(){return 0!==this.#fh.size?this.#fh.values():this.#C.getEditors(this.pageIndex)}async enable(){this.#vh=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),this.#Eh?.abort(),this.#Eh=null;const t=new Set;for(const e of this.#_h)e.enableEditing(),e.show(!0),e.annotationElementId&&(this.#C.removeChangedExistingAnnotation(e),t.add(e.annotationElementId));const e=this.#uh;if(e)for(const i of e.getEditableAnnotations()){if(i.hide(),this.#C.isDeletedAnnotationElement(i.data.id))continue;if(t.has(i.data.id))continue;const e=await this.deserialize(i);e&&(this.addOrRebuild(e),e.enableEditing())}this.#vh=!1,this.#C._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#bh=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),this.#Ah&&!this.#Eh){this.#Eh=new AbortController;const t=this.#C.combinedSignal(this.#Eh);this.#Ah.div.addEventListener("pointerdown",t=>{const{clientX:e,clientY:i,timeStamp:n}=t;if(n-this.#Ch>500)return void(this.#Ch=n);this.#Ch=-1;const{classList:r}=this.div;r.toggle("getElements",!0);const s=document.elementsFromPoint(e,i);if(r.toggle("getElements",!1),!this.div.contains(s[0]))return;let a;const o=new RegExp(`^${y}[0-9]+$`);for(const t of s)if(o.test(t.id)){a=t.id;break}if(!a)return;const l=this.#fh.get(a);null===l?.annotationElementId&&(t.stopPropagation(),t.preventDefault(),l.dblclick(t))},{signal:t,capture:!0})}const t=this.#uh,e=[];if(t){const i=new Map,n=new Map;for(const t of this.#_h)t.disableEditing(),t.annotationElementId?null===t.serialize()?(n.set(t.annotationElementId,t),this.getEditableAnnotation(t.annotationElementId)?.show(),t.remove()):i.set(t.annotationElementId,t):e.push(t);const r=t.getEditableAnnotations();for(const t of r){const{id:e}=t.data;if(this.#C.isDeletedAnnotationElement(e)){t.updateEdited({deleted:!0});continue}let r=n.get(e);r?(r.resetAnnotationElement(t),r.show(!1),t.show()):(r=i.get(e),r&&(this.#C.addChangedExistingAnnotation(r),r.renderAnnotationElement(t)&&r.show(!1)),t.show())}}this.#Sh(),this.isEmpty&&(this.div.hidden=!0);const{classList:i}=this.div;for(const t of es.#it.values())i.remove(`${t._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(e),this.#bh=!1}getEditableAnnotation(t){return this.#uh?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#C.getActive()!==t&&this.#C.setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,this.#Ah?.div&&!this.#xh){this.#xh=new AbortController;const t=this.#C.combinedSignal(this.#xh);this.#Ah.div.addEventListener("pointerdown",this.#Th.bind(this),{signal:t}),this.#Ah.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#Ah?.div&&this.#xh&&(this.#xh.abort(),this.#xh=null,this.#Ah.div.classList.remove("highlighting"))}#Th(t){this.#C.unselectAll();const{target:e}=t;if(e===this.#Ah.div||("img"===e.getAttribute("role")||e.classList.contains("endOfContent"))&&this.#Ah.div.contains(e)){const{isMac:e}=ct.platform;if(0!==t.button||t.ctrlKey&&e)return;this.#C.showAllEditors("highlight",!0,!0),this.#Ah.div.classList.add("free"),this.toggleDrawing(),Hr.startHighlighting(this,"ltr"===this.#C.direction,{target:this.#Ah.div,x:t.x,y:t.y}),this.#Ah.div.addEventListener("pointerup",()=>{this.#Ah.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#C._signal}),t.preventDefault()}}enableClick(){if(this.#ph)return;this.#ph=new AbortController;const t=this.#C.combinedSignal(this.#ph);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});const e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){this.#ph?.abort(),this.#ph=null}attach(t){this.#fh.set(t.id,t);const{annotationElementId:e}=t;e&&this.#C.isDeletedAnnotationElement(e)&&this.#C.removeDeletedAnnotationElement(t)}detach(t){this.#fh.delete(t.id),this.#La?.removePointerInTextLayer(t.contentDiv),!this.#bh&&t.annotationElementId&&this.#C.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#C.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(this.#C.addDeletedAnnotationElement(t),pe.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.#C.addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!this.#vh),this.#C.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!this.#gh&&(t._focusEventsAllowed=!1,this.#gh=setTimeout(()=>{this.#gh=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this.#C._signal}),e.focus())},0)),t._structTreeParentId=this.#La?.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(const e of this.#fh.values())if(e.uid===t)return e;return null}getNextId(){return this.#C.getId()}get#Ph(){return es.#it.get(this.#C.getMode())}combinedSignal(t){return this.#C.combinedSignal(t)}#Dh(t){const e=this.#Ph;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#Ph?.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await this.#C.updateMode(t.mode);const{offsetX:i,offsetY:n}=this.#Mh(),r=this.getNextId(),s=this.#Dh({parent:this,id:r,x:i,y:n,uiManager:this.#C,isCentered:!0,...e});s&&this.add(s)}async deserialize(t){return await(es.#it.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#C))||null}createAndAddNewEditor(t,e,i={}){const n=this.getNextId(),r=this.#Dh({parent:this,id:n,x:t.offsetX,y:t.offsetY,uiManager:this.#C,isCentered:e,...i});return r&&this.add(r),r}get boundingClientRect(){return this.div.getBoundingClientRect()}#Mh(){const{x:t,y:e,width:i,height:n}=this.boundingClientRect,r=Math.max(0,t),s=Math.max(0,e),a=(r+Math.min(window.innerWidth,t+i))/2-t,o=(s+Math.min(window.innerHeight,e+n))/2-e,[l,h]=this.viewport.rotation%180==0?[a,o]:[o,a];return{offsetX:l,offsetY:h}}addNewEditor(t={}){this.createAndAddNewEditor(this.#Mh(),!0,t)}setSelected(t){this.#C.setSelected(t)}toggleSelected(t){this.#C.toggleSelected(t)}unselect(t){this.#C.unselect(t)}pointerup(t){const{isMac:e}=ct.platform;if(0!==t.button||t.ctrlKey&&e)return;if(t.target!==this.div)return;if(!this.#mh)return;if(this.#mh=!1,this.#Ph?.isDrawer&&this.#Ph.supportMultipleDrawings)return;if(!this.#dh)return void(this.#dh=!0);const i=this.#C.getMode();i!==w.STAMP&&i!==w.SIGNATURE?this.createAndAddNewEditor(t,!1):this.#C.unselectAll()}pointerdown(t){if(this.#C.getMode()===w.HIGHLIGHT&&this.enableTextSelection(),this.#mh)return void(this.#mh=!1);const{isMac:e}=ct.platform;if(0!==t.button||t.ctrlKey&&e)return;if(t.target!==this.div)return;if(this.#mh=!0,this.#Ph?.isDrawer)return void this.startDrawingSession(t);const i=this.#C.getActive();this.#dh=!i||i.isEmpty()}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),this.#yh)return void this.#Ph.startDrawing(this,this.#C,!1,t);this.#C.setCurrentDrawingSession(this),this.#yh=new AbortController;const e=this.#C.combinedSignal(this.#yh);this.div.addEventListener("blur",({relatedTarget:t})=>{t&&!this.div.contains(t)&&(this.#wh=null,this.commitOrRemove())},{signal:e}),this.#Ph.startDrawing(this,this.#C,!1,t)}pause(t){if(t){const{activeElement:t}=document;return void(this.div.contains(t)&&(this.#wh=t))}this.#wh&&setTimeout(()=>{this.#wh?.focus(),this.#wh=null},0)}endDrawingSession(t=!1){return this.#yh?(this.#C.setCurrentDrawingSession(null),this.#yh.abort(),this.#yh=null,this.#wh=null,this.#Ph.endDrawing(t)):null}findNewParent(t,e,i){const n=this.#C.findParent(e,i);return null!==n&&n!==this&&(n.changeParent(t),!0)}commitOrRemove(){return!!this.#yh&&(this.endDrawingSession(),!0)}onScaleChanging(){this.#yh&&this.#Ph.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#C.getActive()?.parent===this&&(this.#C.commitOrRemove(),this.#C.setActiveEditor(null)),this.#gh&&(clearTimeout(this.#gh),this.#gh=null);for(const t of this.#fh.values())this.#La?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#fh.clear(),this.#C.removeLayer(this)}#Sh(){for(const t of this.#fh.values())t.isEmpty()&&t.remove()}render({viewport:t}){this.viewport=t,jt(this.div,t);for(const t of this.#C.getEditors(this.pageIndex))this.add(t),t.rebuild();this.updateMode()}update({viewport:t}){this.#C.commitOrRemove(),this.#Sh();const e=this.viewport.rotation,i=t.rotation;if(this.viewport=t,jt(this.div,{rotation:i}),e!==i)for(const t of this.#fh.values())t.rotate(i)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return this.#C.viewParameters.realScale}}class is{#ra=null;#Fh=new Map;#Ih=new Map;static#I=0;setParent(t){if(this.#ra){if(this.#ra!==t){if(this.#Fh.size>0)for(const e of this.#Fh.values())e.remove(),t.append(e);this.#ra=t}}else this.#ra=t}static get _svgFactory(){return et(this,"_svgFactory",new er)}static#kh(t,[e,i,n,r]){const{style:s}=t;s.top=100*i+"%",s.left=100*e+"%",s.width=100*n+"%",s.height=100*r+"%"}#Lh(){const t=is._svgFactory.create(1,1,!0);return this.#ra.append(t),t.setAttribute("aria-hidden",!0),t}#Rh(t,e){const i=is._svgFactory.createElement("clipPath");t.append(i);const n=`clip_${e}`;i.setAttribute("id",n),i.setAttribute("clipPathUnits","objectBoundingBox");const r=is._svgFactory.createElement("use");return i.append(r),r.setAttribute("href",`#${e}`),r.classList.add("clip"),n}#Bh(t,e){for(const[i,n]of Object.entries(e))null===n?t.removeAttribute(i):t.setAttribute(i,n)}draw(t,e=!1,i=!1){const n=is.#I++,r=this.#Lh(),s=is._svgFactory.createElement("defs");r.append(s);const a=is._svgFactory.createElement("path");s.append(a);const o=`path_${n}`;a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke"),e&&this.#Ih.set(n,a);const l=i?this.#Rh(s,o):null,h=is._svgFactory.createElement("use");return r.append(h),h.setAttribute("href",`#${o}`),this.updateProperties(r,t),this.#Fh.set(n,r),{id:n,clipPathId:`url(#${l})`}}drawOutline(t,e){const i=is.#I++,n=this.#Lh(),r=is._svgFactory.createElement("defs");n.append(r);const s=is._svgFactory.createElement("path");r.append(s);const a=`path_${i}`;let o;if(s.setAttribute("id",a),s.setAttribute("vector-effect","non-scaling-stroke"),e){const t=is._svgFactory.createElement("mask");r.append(t),o=`mask_${i}`,t.setAttribute("id",o),t.setAttribute("maskUnits","objectBoundingBox");const e=is._svgFactory.createElement("rect");t.append(e),e.setAttribute("width","1"),e.setAttribute("height","1"),e.setAttribute("fill","white");const n=is._svgFactory.createElement("use");t.append(n),n.setAttribute("href",`#${a}`),n.setAttribute("stroke","none"),n.setAttribute("fill","black"),n.setAttribute("fill-rule","nonzero"),n.classList.add("mask")}const l=is._svgFactory.createElement("use");n.append(l),l.setAttribute("href",`#${a}`),o&&l.setAttribute("mask",`url(#${o})`);const h=l.cloneNode();return n.append(h),l.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.updateProperties(n,t),this.#Fh.set(i,n),i}finalizeDraw(t,e){this.#Ih.delete(t),this.updateProperties(t,e)}updateProperties(t,e){if(!e)return;const{root:i,bbox:n,rootClass:r,path:s}=e,a="number"==typeof t?this.#Fh.get(t):t;if(a){if(i&&this.#Bh(a,i),n&&is.#kh(a,n),r){const{classList:t}=a;for(const[e,i]of Object.entries(r))t.toggle(e,i)}if(s){const t=a.firstElementChild.firstElementChild;this.#Bh(t,s)}}}updateParent(t,e){if(e===this)return;const i=this.#Fh.get(t);i&&(e.#ra.append(i),this.#Fh.delete(t),e.#Fh.set(t,i))}remove(t){this.#Ih.delete(t),null!==this.#ra&&(this.#Fh.get(t).remove(),this.#Fh.delete(t))}destroy(){this.#ra=null;for(const t of this.#Fh.values())t.remove();this.#Fh.clear(),this.#Ih.clear()}}globalThis._pdfjsTestingUtils={HighlightOutliner:Or},globalThis.pdfjsLib={AbortException:lt,AnnotationEditorLayer:es,AnnotationEditorParamsType:A,AnnotationEditorType:w,AnnotationEditorUIManager:he,AnnotationLayer:Ir,AnnotationMode:v,AnnotationType:I,applyOpacity:$t,build:qn,ColorPicker:Yn,createValidAbsoluteUrl:Z,CSSConstants:Vt,DOMSVGFactory:er,DrawLayer:is,FeatureTest:ct,fetchData:Et,findContrastColor:Kt,getDocument:On,getFilenameFromUrl:Pt,getPdfFilenameFromUrl:Dt,getRGB:Bt,getUuid:mt,getXfaPageViewport:Rt,GlobalWorkerOptions:en,ImageKind:F,InvalidPDFException:st,isDataScheme:_t,isPdfFile:Tt,isValidExplicitDest:Fe,MathClamp:vt,noContextMenu:It,normalizeUnicode:ft,OPS:j,OutputScale:Ut,PagesMapper:Zt,PasswordResponses:W,PDFDataRangeTransport:Un,PDFDateString:Lt,PDFWorker:Vn,PermissionFlag:x,PixelsPerInch:xt,RenderingCancelledException:St,renderRichText:Jt,ResponseException:at,setLayerDimensions:jt,
2shadow:et,SignatureExtractor:Kr,stopEvent:kt,SupportedImageMimeTypes:zt,TextLayer:Nn,TouchManager:ue,updateUrlHash:tt,Util:ut,VerbosityLevel:O,version:Xn,XfaLayer:wt},i.d(e,["Do",0,j,"N5",0,A,"RY",0,Fe,"SS",0,W,"UJ",0,I,"_i",0,x,"j_",0,zt,"jq",0,qn,"mQ",0,O,"ng",0,v,"rE",0,Xn,"vP",0,w,"yI",0,F])},15493(t,e,i){i.r(e),i.d(e,{BR:()=>Pi,Gl:()=>re,I2:()=>en,ID:()=>bn,JO:()=>wt,P2:()=>_i,TO:()=>mn,UN:()=>Qi,Zl:()=>an,e2:()=>se,l7:()=>ce,md:()=>nn,qm:()=>oe,uU:()=>ne,xe:()=>hn,yL:()=>ee,z2:()=>Dt});var n={34(t,e,i){var n=i(4901);t.exports=function(t){return"object"==typeof t?null!==t:n(t)}},81(t,e,i){var n=i(9565),r=i(9306),s=i(8551),a=i(6823),o=i(851),l=TypeError;t.exports=function(t,e){var i=arguments.length<2?o(t):e;if(r(i))return s(n(i,t));throw new l(a(t)+" is not iterable")}},283(t,e,i){var n=i(9504),r=i(9039),s=i(4901),a=i(9297),o=i(3724),l=i(350).CONFIGURABLE,h=i(3706),c=i(1181),d=c.enforce,u=c.get,p=String,g=Object.defineProperty,f=n("".slice),m=n("".replace),b=n([].join),v=o&&!r(function(){return 8!==g(function(){},"length",{value:8}).length}),y=String(String).split("String"),w=t.exports=function(t,e,i){"Symbol("===f(p(e),0,7)&&(e="["+m(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 n=d(t);return a(n,"source")||(n.source=b(y,"string"==typeof e?e:"")),t};Function.prototype.toString=w(function(){return s(this)&&u(this).source||h(this)},"toString")},350(t,e,i){var n=i(3724),r=i(9297),s=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,o=r(s,"name"),l=o&&"something"===function(){}.name,h=o&&(!n||n&&a(s,"name").configurable);t.exports={EXISTS:o,PROPER:l,CONFIGURABLE:h}},397(t,e,i){var n=i(7751);t.exports=n("document","documentElement")},421(t){t.exports={}},507(t,e,i){var n=i(9565);t.exports=function(t,e,i){for(var r,s,a=i?t:t.iterator,o=t.next;!(r=n(o,a)).done;)if(void 0!==(s=e(r.value)))return s}},533(t,e,i){var n=i(9504),r=i(8014),s=i(655),a=i(2333),o=i(7750),l=n(a),h=n("".slice),c=Math.ceil,d=function(t){return function(e,i,n){var a,d,u=s(o(e)),p=r(i),g=u.length,f=void 0===n?" ":s(n);return p<=g||""===f?u:((d=l(f,c((a=p-g)/f.length))).length>a&&(d=h(d,0,a)),t?u+d:d+u)}};t.exports={start:d(!1),end:d(!0)}},616(t,e,i){var n=i(9039);t.exports=!n(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},655(t,e,i){var n=i(6955),r=String;t.exports=function(t){if("Symbol"===n(t))throw new TypeError("Cannot convert a Symbol value to a string");return r(t)}},679(t,e,i){var n=i(1625),r=TypeError;t.exports=function(t,e){if(n(e,t))return t;throw new r("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 n=+t;return(n>0?i:e)(n)}},757(t,e,i){var n=i(7751),r=i(4901),s=i(1625),a=i(7040),o=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=n("Symbol");return r(e)&&s(e.prototype,o(t))}},851(t,e,i){var n=i(6955),r=i(5966),s=i(4117),a=i(6269),o=i(8227)("iterator");t.exports=function(t){if(!s(t))return r(t,o)||r(t,"@@iterator")||a[n(t)]}},1072(t,e,i){var n=i(1828),r=i(8727);t.exports=Object.keys||function(t){return n(t,r)}},1108(t,e,i){var n=i(6955);t.exports=function(t){var e=n(t);return"BigInt64Array"===e||"BigUint64Array"===e}},1148(t,e,i){var n=i(6518),r=i(9565),s=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),c=i(4549)("every",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:c},{every:function(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(c)return r(c,this,t);var e=l(this),i=0;return!s(e,function(e,n){if(!t(e,i++))return n()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1181(t,e,i){var n,r,s,a=i(8622),o=i(4576),l=i(34),h=i(6699),c=i(9297),d=i(7629),u=i(6119),p=i(421),g="Object already initialized",f=o.TypeError,m=o.WeakMap;if(a||d.state){var b=d.state||(d.state=new m);b.get=b.get,b.has=b.has,b.set=b.set,n=function(t,e){if(b.has(t))throw new f(g);return e.facade=t,b.set(t,e),e},r=function(t){return b.get(t)||{}},s=function(t){return b.has(t)}}else{var v=u("state");p[v]=!0,n=function(t,e){if(c(t,v))throw new f(g);return e.facade=t,h(t,v,e),e},r=function(t){return c(t,v)?t[v]:{}},s=function(t){return c(t,v)}}t.exports={set:n,get:r,has:s,enforce:function(t){return s(t)?r(t):n(t,{})},getterFor:function(t){return function(e){var i;if(!l(e)||(i=r(e)).type!==t)throw new f("Incompatible receiver, "+t+" required");return i}}}},1291(t,e,i){var n=i(741);t.exports=function(t){var e=+t;return e!=e||0===e?0:n(e)}},1385(t,e,i){var n=i(9539);
vendor: 4,698 bytes, line 2
2t.exports=function(t,e,i){for(var r=t.length-1;r>=0;r--)if(void 0!==t[r])try{i=n(t[r].iterator,e,i)}catch(t){e="throw",i=t}if("throw"===e)throw i;return i}},1548(t,e,i){var n=i(4576),r=i(9039),s=i(9519),a=i(4215),o=n.structuredClone;t.exports=!!o&&!r(function(){if("DENO"===a&&s>92||"NODE"===a&&s>94||"BROWSER"===a&&s>97)return!1;var t=new ArrayBuffer(8),e=o(t,{transfer:[t]});return 0!==t.byteLength||8!==e.byteLength})},1625(t,e,i){var n=i(9504);t.exports=n({}.isPrototypeOf)},1698(t,e,i){var n=i(6518),r=i(4204),s=i(9835);n({target:"Set",proto:!0,real:!0,forced:!i(4916)("union")||!s("union")},{union:r})},1701(t,e,i){var n=i(6518),r=i(9565),s=i(9306),a=i(8551),o=i(1767),l=i(9462),h=i(6319),c=i(9539),d=i(684),u=i(4549),p=i(6395),g=!p&&!d("map",function(){}),f=!p&&!g&&u("map",TypeError),m=p||g||f,b=l(function(){var t=this.iterator,e=a(r(this.next,t));if(!(this.done=!!e.done))return h(t,this.mapper,[e.value,this.counter++],!0)});n({target:"Iterator",proto:!0,real:!0,forced:m},{map:function(t){a(this);try{s(t)}catch(t){c(this,"throw",t)}return f?r(f,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 n=i(9504),r=i(9297),s=i(5397),a=i(9617).indexOf,o=i(421),l=n([].push);t.exports=function(t,e){var i,n=s(t),h=0,c=[];for(i in n)!r(o,i)&&r(n,i)&&l(c,i);for(;e.length>h;)r(n,i=e[h++])&&(~a(c,i)||l(c,i));return c}},2106(t,e,i){var n=i(283),r=i(4913);t.exports=function(t,e,i){return i.get&&n(i.get,e,{getter:!0}),i.set&&n(i.set,e,{setter:!0}),r.f(t,e,i)}},2140(t,e,i){var n={};n[i(8227)("toStringTag")]="z",t.exports="[object z]"===String(n)},2195(t,e,i){var n=i(9504),r=n({}.toString),s=n("".slice);t.exports=function(t){return s(r(t),8,-1)}},2211(t,e,i){var n=i(9039);t.exports=!n(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})},2333(t,e,i){var n=i(1291),r=i(655),s=i(7750),a=RangeError;t.exports=function(t){var e=r(s(this)),i="",o=n(t);if(o<0||o===1/0)throw new a("Wrong number of repetitions");for(;o>0;(o>>>=1)&&(e+=e))1&o&&(i+=e);return i}},2360(t,e,i){var n,r=i(8551),s=i(6801),a=i(8727),o=i(421),l=i(397),h=i(4055),c=i(6119),d="prototype",u="script",p=c("IE_PROTO"),g=function(){},f=function(t){return"<"+u+">"+t+"</"+u+">"},m=function(t){t.write(f("")),t.close();var e=t.parentWindow.Object;return t=null,e},b=function(){try{n=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;b="undefined"!=typeof document?document.domain&&n?m(n):(e=h("iframe"),i="java"+u+":",e.style.display="none",l.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(f("document.F=Object")),t.close(),t.F):m(n);for(var r=a.length;r--;)delete b[d][a[r]];return b()};o[p]=!0,t.exports=Object.create||function(t,e){var i;return null!==t?(g[d]=r(t),i=new g,g[d]=null,i[p]=t):i=b(),void 0===e?i:s.f(i,e)}},2475(t,e,i){var n=i(6518),r=i(8527);n({target:"Set",proto:!0,real:!0,forced:!i(4916)("isSupersetOf",function(t){return!t})},{isSupersetOf:r})},2489(t,e,i){var n=i(6518),r=i(9565),s=i(9306),a=i(8551),o=i(1767),l=i(9462),h=i(6319),c=i(6395),d=i(9539),u=i(684),p=i(4549),g=!c&&!u("filter",function(){}),f=!c&&!g&&p("filter",TypeError),m=c||g||f,b=l(function(){for(var t,e,i=this.iterator,n=this.predicate,s=this.next;;){if(t=a(r(s,i)),this.done=!!t.done)return;if(e=t.value,h(i,n,[e,this.counter++],!0))return e}});n({target:"Iterator",proto:!0,real:!0,forced:m},{filter:function(t){a(this);try{s(t)}catch(t){d(this,"throw",t)}return f?r(f,this,t):new b(o(this),{predicate:t})}})},2529(t){t.exports=function(t,e){return{value:t,done:e}}},2652(t,e,i){var n=i(6080),r=i(9565),s=i(8551),a=i(6823),o=i(4209),l=i(6198),h=i(1625),c=i(81),d=i(851),u=i(9539),p=TypeError,g=function(t,e){this.stopped=t,this.result=e},f=g.prototype;t.exports=function(t,e,i){var m,b,v,y,w,A,x,E=i&&i.that,C=!(!i||!i.AS_ENTRIES),S=!(!i||!i.IS_RECORD),_=!(!i||!i.IS_ITERATOR),T=!(!i||!i.INTERRUPTED),P=n(e,E),D=function(t){return m&&u(m,"normal"),new g(!0,t)},M=function(t){return C?(s(t),T?P(t[0],t[1],D):P(t[0],t[1])):T?P(t,D):P(t)};if(S)m=t.iterator;else if(_)m=t;else{if(!(b=d(t)))throw new p(a(t)+" is not iterable");if(o(b)){for(v=0,y=l(t);y>v;v++)if((w=M(t[v]))&&h(f,w))return w;return new g(!1)}m=c(t,b)}for(A=S?t.next:m.next;!(x=r(A,m)).done;){try{w=M(x.value)}catch(t){u(m,"throw",t)}if("object"==typeof w&&w&&h(f,w))return w}return new g(!1)}},2777(t,e,i){var n=i(9565),r=i(34),s=i(757),a=i(5966),o=i(4270),l=i(8227),h=TypeError,c=l("toPrimitive");t.exports=function(t,e){if(!r(t)||s(t))return t;var i,l=a(t,c);if(l){if(void 0===e&&(e="default"),i=n(l,t,e),!r(i)||s(i))return i;throw new h("Can't convert object to primitive value")}return void 0===e&&(e="number"),o(t,e)}}
vendor: 8,658 bytes, line 2
2,2787(t,e,i){var n=i(9297),r=i(4901),s=i(8981),a=i(6119),o=i(2211),l=a("IE_PROTO"),h=Object,c=h.prototype;t.exports=o?h.getPrototypeOf:function(t){var e=s(t);if(n(e,l))return e[l];var i=e.constructor;return r(i)&&e instanceof i?i.prototype:e instanceof h?c:null}},2796(t,e,i){var n=i(9039),r=i(4901),s=/#|\.prototype\./,a=function(t,e){var i=l[o(t)];return i===c||i!==h&&(r(e)?n(e):!!e)},o=a.normalize=function(t){return String(t).replace(s,".").toLowerCase()},l=a.data={},h=a.NATIVE="N",c=a.POLYFILL="P";t.exports=a},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 n=i(4576).navigator,r=n&&n.userAgent;t.exports=r?String(r):""},2967(t,e,i){var n=i(6706),r=i(34),s=i(7750),a=i(3506);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=n(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return s(i),a(n),r(i)?(e?t(i,n):i.__proto__=n,i):i}}():void 0)},3238(t,e,i){var n=i(4576),r=i(7811),s=i(7394),a=n.DataView;t.exports=function(t){if(!r||0!==s(t))return!1;try{return new a(t),!1}catch(t){return!0}}},3392(t,e,i){var n=i(9504),r=0,s=Math.random(),a=n(1.1.toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++r+s,36)}},3440(t,e,i){var n=i(7080),r=i(4402),s=i(9286),a=i(5170),o=i(3789),l=i(8469),h=i(507),c=r.has,d=r.remove;t.exports=function(t){var e=n(this),i=o(t),r=s(e);return a(e)<=i.size?l(e,function(t){i.includes(t)&&d(r,t)}):h(i.getIterator(),function(t){c(r,t)&&d(r,t)}),r}},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 n=i(3925),r=String,s=TypeError;t.exports=function(t){if(n(t))return t;throw new s("Can't set "+r(t)+" as a prototype")}},3579(t,e,i){var n=i(6518),r=i(9565),s=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),c=i(4549)("some",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:c},{some:function(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(c)return r(c,this,t);var e=l(this),i=0;return s(e,function(e,n){if(t(e,i++))return n()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},3650(t,e,i){var n=i(7080),r=i(4402),s=i(9286),a=i(3789),o=i(507),l=r.add,h=r.has,c=r.remove;t.exports=function(t){var e=n(this),i=a(t).getIterator(),r=s(e);return o(i,function(t){h(e,t)?c(r,t):l(r,t)}),r}},3706(t,e,i){var n=i(9504),r=i(4901),s=i(7629),a=n(Function.toString);r(s.inspectSource)||(s.inspectSource=function(t){return a(t)}),t.exports=s.inspectSource},3717(t,e){e.f=Object.getOwnPropertySymbols},3724(t,e,i){var n=i(9039);t.exports=!n(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},3789(t,e,i){var n=i(9306),r=i(8551),s=i(9565),a=i(1291),o=i(1767),l="Invalid size",h=RangeError,c=TypeError,d=Math.max,u=function(t,e){this.set=t,this.size=d(e,0),this.has=n(t.has),this.keys=n(t.keys)};u.prototype={getIterator:function(){return o(r(s(this.keys,this.set)))},includes:function(t){return s(this.has,this.set,t)}},t.exports=function(t){r(t);var e=+t.size;if(e!=e)throw new c(l);var i=a(e);if(i<0)throw new h(l);return new u(t,i)}},3838(t,e,i){var n=i(7080),r=i(5170),s=i(8469),a=i(3789);t.exports=function(t){var e=n(this),i=a(t);return!(r(e)>i.size)&&!1!==s(e,function(t){if(!i.includes(t))return!1},!0)}},3853(t,e,i){var n=i(6518),r=i(4449);n({target:"Set",proto:!0,real:!0,forced:!i(4916)("isDisjointFrom",function(t){return!t})},{isDisjointFrom:r})},3925(t,e,i){var n=i(34);t.exports=function(t){return n(t)||null===t}},4055(t,e,i){var n=i(4576),r=i(34),s=n.document,a=r(s)&&r(s.createElement);t.exports=function(t){return a?s.createElement(t):{}}},4114(t,e,i){var n=i(6518),r=i(8981),s=i(6198),a=i(4527),o=i(6837);n({target:"Array",proto:!0,arity:1,forced:i(9039)(function(){return 4294967297!==[].push.call({length:4294967296},1)})||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}}()},{push:function(t){var e=r(this),i=s(e),n=arguments.length;o(i+n);for(var l=0;l<n;l++)e[i]=arguments[l],i++;return a(e,i),i}})},4117(t){t.exports=function(t){return null==t}},4204(t,e,i){var n=i(7080),r=i(4402).add,s=i(9286),a=i(3789),o=i(507);t.exports=function(t){var e=n(this),i=a(t).getIterator(),l=s(e);return o(i,function(t){r(l,t)}),l}},4209(t,e,i){var n=i(8227),r=i(6269),s=n("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||a[s]===t)}},4215(t,e,i){var n=i(4576),r=i(2839),s=i(2195),a=function(t){return r.slice(0,t.length)===t};t.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":n.Bun&&"string"==typeof Bun.version?"BUN":n.Deno&&"object"==typeof Deno.version?"DENO":"process"===s(n.process)?"NODE":n.window&&n.document?"BROWSER":"REST"},4270(t,e,i){var n=i(9565),r=i(4901),s=i(34),a=TypeError;t.exports=function(t,e){var i,o;if("string"===e&&r(i=t.toString)&&!s(o=n(i,t)))return o;if(r(i=t.valueOf)&&!s(o=n(i,t)))return o;if("string"!==e&&r(i=t.toString)&&!s(o=n(i,t)))return o;throw new a("Can't convert object to primitive value")}},4376(t,e,i){var n=i(2195);t.exports=Array.isArray||function(t){return"Array"===n(t)}},4402(t,e,i){var n=i(9504),r=Set.prototype;t.exports={Set,add:n(r.add),has:n(r.has),remove:n(r.delete),proto:r}},4449(t,e,i){var n=i(7080),r=i(4402).has,s=i(5170),a=i(3789),o=i(8469),l=i(507),h=i(9539);t.exports=function(t){var e=n(this),i=a(t);if(s(e)<=i.size)return!1!==o(e,function(t){if(i.includes(t))return!1},!0);var c=i.getIterator();return!1!==l(c,function(t){if(r(e,t))return h(c,"normal",!1)})}},4483(t,e,i){var n,r,s,a,o=i(4576),l=i(9429),h=i(1548),c=o.structuredClone,d=o.ArrayBuffer,u=o.MessageChannel,p=!1;if(h)p=function(t){c(t,{transfer:[t]})};else if(d)try{u||(n=l("worker_threads"))&&(u=n.MessageChannel),u&&(r=new u,s=new d(2),a=function(t){r.port1.postMessage(null,[t])},2===s.byteLength&&(a(s),0===s.byteLength&&(p=a)))}catch(t){}t.exports=p},4495(t,e,i){var n=i(9519),r=i(9039),s=i(4576).String;t.exports=!!Object.getOwnPropertySymbols&&!r(function(){var t=Symbol("symbol detection");return!s(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41})},4527(t,e,i){var n=i(3724),r=i(4376),s=TypeError,a=Object.getOwnPropertyDescriptor,o=n&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=o?function(t,e){if(r(t)&&!a(t,"length").writable)throw new s("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},4549(t,e,i){var n=i(4576);t.exports=function(t,e){var i=n.Iterator,r=i&&i.prototype,s=r&&r[t],a=!1;if(s)try{s.call({next:function(){return{done:!0}},return:function(){a=!0}},-1)}catch(t){t instanceof e||(a=!1)}if(!a)return s}},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 i.g&&i.g)||e("object"==typeof this&&this)||function(){return this}()||Function("return this")()},4603(t,e,i){var n=i(6840),r=i(9504),s=i(655),a=i(2812),o=URLSearchParams,l=o.prototype,h=r(l.append),c=r(l.delete),d=r(l.forEach),u=r([].push),p=new o("a=1&a=2&b=3");p.delete("a",1),p.delete("b",void 0),p+""!="a=2"&&n(l,"delete",function(t){var e=arguments.length,i=e<2?void 0:arguments[1];if(e&&void 0===i)return c(this,t);var n=[];d(this,function(t,e){u(n,{key:e,value:t})}),a(e,1);for(var r,o=s(t),l=s(i),p=0,g=0,f=!1,m=n.length;p<m;)r=n[p++],f||r.key===o?(f=!0,c(this,r.key)):g++;for(;g<m;)(r=n[g++]).key===o&&r.value===l||h(this,r.key,r.value)},{enumerable:!0,unsafe:!0})},4628(t,e,i){var n=i(6518),r=i(6043);n({target:"Promise",stat:!0},{withResolvers:function(){var t=r.f(this);return{promise:t.promise,resolve:t.resolve,reject:t.reject}}})},4644(t,e,i){var n,r,s,a=i(7811),o=i(3724),l=i(4576),h=i(4901),c=i(34),d=i(9297),u=i(6955),p=i(6823),g=i(6699),f=i(6840),m=i(2106),b=i(1625),v=i(2787),y=i(2967),w=i(8227),A=i(3392),x=i(1181),E=x.enforce,C=x.get,S=l.Int8Array,_=S&&S.prototype,T=l.Uint8ClampedArray,P=T&&T.prototype,D=S&&v(S),M=_&&v(_),F=Object.prototype,I=l.TypeError,k=w("toStringTag"),L=A("TYPED_ARRAY_TAG"),R="TypedArrayConstructor",B=a&&!!y&&"Opera"!==u(l.opera),N=!1,O={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},j={BigInt64Array:8,BigUint64Array:8},U=function(t){var e=v(t);if(c(e)){var i=C(e);return i&&d(i,R)?i[R]:U(e)}},z=function(t){if(!c(t))return!1;var e=u(t);return d(O,e)||d(j,e)};for(n in O)(s=(r=l[n])&&r.prototype)?E(s)[R]=r:B=!1;for(n in j)(s=(r=l[n])&&r.prototype)&&(E(s)[R]=r);
vendor: 4,364 bytes, line 2
2if((!B||!h(D)||D===Function.prototype)&&(D=function(){throw new I("Incorrect invocation")},B))for(n in O)l[n]&&y(l[n],D);if((!B||!M||M===F)&&(M=D.prototype,B))for(n in O)l[n]&&y(l[n].prototype,M);if(B&&v(P)!==M&&y(P,M),o&&!d(M,k))for(n in N=!0,m(M,k,{configurable:!0,get:function(){return c(this)?this[L]:void 0}}),O)l[n]&&g(l[n],L,n);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:B,TYPED_ARRAY_TAG:N&&L,aTypedArray:function(t){if(z(t))return t;throw new I("Target is not a typed array")},aTypedArrayConstructor:function(t){if(h(t)&&(!y||b(D,t)))return t;throw new I(p(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,e,i,n){if(o){if(i)for(var r in O){var s=l[r];if(s&&d(s.prototype,t))try{delete s.prototype[t]}catch(i){try{s.prototype[t]=e}catch(t){}}}M[t]&&!i||f(M,t,i?e:B&&_[t]||e,n)}},exportTypedArrayStaticMethod:function(t,e,i){var n,r;if(o){if(y){if(i)for(n in O)if((r=l[n])&&d(r,t))try{delete r[t]}catch(t){}if(D[t]&&!i)return;try{return f(D,t,i?e:B&&D[t]||e)}catch(t){}}for(n in O)!(r=l[n])||r[t]&&!i||f(r,t,e)}},getTypedArrayConstructor:U,isView:function(t){if(!c(t))return!1;var e=u(t);return"DataView"===e||d(O,e)||d(j,e)},isTypedArray:z,TypedArray:D,TypedArrayPrototype:M}},4659(t,e,i){var n=i(3724),r=i(4913),s=i(6980);t.exports=function(t,e,i){n?r.f(t,e,s(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 n=i(3724),r=i(5917),s=i(8686),a=i(8551),o=i(6969),l=TypeError,h=Object.defineProperty,c=Object.getOwnPropertyDescriptor,d="enumerable",u="configurable",p="writable";e.f=n?s?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 n=c(t,e);n&&n[p]&&(t[e]=i.value,i={configurable:u in i?i[u]:n[u],enumerable:d in i?i[d]:n[d],writable:!1})}return h(t,e,i)}:h:function(t,e,i){if(a(t),e=o(e),a(i),r)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 n=i(7751),r=function(t){return{size:t,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},s=function(t){return{size:t,has:function(){return!0},keys:function(){throw new Error("e")}}};t.exports=function(t,e){var i=n("Set");try{(new i)[t](r(0));try{return(new i)[t](r(-1)),!1}catch(n){if(!e)return!0;try{return(new i)[t](s(-1/0)),!1}catch(n){return e(new i([1,2])[t](s(1/0)))}}}catch(t){return!1}}},5024(t,e,i){var n=i(6518),r=i(3650),s=i(9835);n({target:"Set",proto:!0,real:!0,forced:!i(4916)("symmetricDifference")||!s("symmetricDifference")},{symmetricDifference:r})},5031(t,e,i){var n=i(7751),r=i(9504),s=i(8480),a=i(3717),o=i(8551),l=r([].concat);t.exports=n("Reflect","ownKeys")||function(t){var e=s.f(o(t)),i=a.f;return i?l(e,i(t)):e}},5169(t,e,i){var n=i(3238),r=TypeError;t.exports=function(t){if(n(t))throw new r("ArrayBuffer is detached");return t}},5170(t,e,i){var n=i(6706),r=i(4402);t.exports=n(r.proto,"size","get")||function(t){return t.size}},5397(t,e,i){var n=i(7055),r=i(7750);t.exports=function(t){return n(r(t))}},5610(t,e,i){var n=i(1291),r=Math.max,s=Math.min;t.exports=function(t,e){var i=n(t);return i<0?r(i+e,0):s(i,e)}},5636(t,e,i){var n=i(4576),r=i(9504),s=i(6706),a=i(7696),o=i(5169),l=i(7394),h=i(4483),c=i(1548),d=n.structuredClone,u=n.ArrayBuffer,p=n.DataView,g=Math.min,f=u.prototype,m=p.prototype,b=r(f.slice),v=s(f,"resizable","get"),y=s(f,"maxByteLength","get"),w=r(m.getInt8),A=r(m.setInt8);t.exports=(c||h)&&function(t,e,i){var n,r=l(t),s=void 0===e?r:a(e),f=!v||!v(t);if(o(t),c&&(t=d(t,{transfer:[t]}),r===s&&(i||f)))return t;if(r>=s&&(!i||f))n=b(t,0,s);else{var m=i&&!f&&y?{maxByteLength:y(t)}:void 0;n=new u(s,m);for(var x=new p(t),E=new p(n),C=g(s,r),S=0;S<C;S++)A(E,S,w(x,S))}return c||h(t),n}},5745(t,e,i){var n=i(7629);t.exports=function(t,e){return n[t]||(n[t]=e||{})}},5781(t,e,i){var n=i(6518),r=i(7751),s=i(2812),a=i(655),o=i(7416),l=r("URL");n({target:"URL",stat:!0,forced:!o},{parse:function(t){var e=s(arguments.length,1),i=a(t),n=e<2||void 0===arguments[1]?void 0:a(arguments[1]);try{return new l(i,n)}catch(t){return null}}})},5854(t,e,i){var n=i(2777),r=TypeError;t.exports=function(t){var e=n(t,"number");if("number"==typeof e)throw new r("Can't convert number to bigint");return BigInt(e)}}
2,5876(t,e,i){var n=i(6518),r=i(3838);n({target:"Set",proto:!0,real:!0,forced:!i(4916)("isSubsetOf",function(t){return t})},{isSubsetOf:r})},5917(t,e,i){var n=i(3724),r=i(9039),s=i(4055);t.exports=!n&&!r(function(){return 7!==Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a})},5966(t,e,i){var n=i(9306),r=i(4117);t.exports=function(t,e){var i=t[e];return r(i)?void 0:n(i)}},6043(t,e,i){var n=i(9306),r=TypeError,s=function(t){var e,i;this.promise=new t(function(t,n){if(void 0!==e||void 0!==i)throw new r("Bad Promise constructor");e=t,i=n}),this.resolve=n(e),this.reject=n(i)};t.exports.f=function(t){return new s(t)}},6069(t,e,i){var n=i(6518),r=i(9504),s=i(3463),a=i(9297),o=i(533).start,l=i(7452),h=Array,c=RegExp.escape,d=r("".charAt),u=r("".charCodeAt),p=r(1.1.toString),g=r([].join),f=/^[0-9a-z]/i,m=/^[$()*+./?[\\\]^{|}]/,b=RegExp("^[!\"#%&',\\-:;<=>@`~"+l+"]"),v=r(f.exec),y={"\t":"t","\n":"n","\v":"v","\f":"f","\r":"r"},w=function(t){var e=p(u(t,0),16);return e.length<3?"\\x"+o(e,2,"0"):"\\u"+o(e,4,"0")};n({target:"RegExp",stat:!0,forced:!c||"\\x61b"!==c("ab")},{escape:function(t){s(t);for(var e=t.length,i=h(e),n=0;n<e;n++){var r=d(t,n);if(0===n&&v(f,r))i[n]=w(r);else if(a(y,r))i[n]="\\"+y[r];else if(v(m,r))i[n]="\\"+r;else if(v(b,r))i[n]=w(r);else{var o=u(r,0);55296!=(63488&o)?i[n]=r:o>=56320||n+1>=e||56320!=(64512&u(t,n+1))?i[n]=w(r):(i[n]=r,i[++n]=d(t,n))}}return g(i,"")}})},6080(t,e,i){var n=i(7476),r=i(9306),s=i(616),a=n(n.bind);t.exports=function(t,e){return r(t),void 0===e?t:s?a(t,e):function(){return t.apply(e,arguments)}}},6119(t,e,i){var n=i(5745),r=i(3392),s=n("keys");t.exports=function(t){return s[t]||(s[t]=r(t))}},6193(t,e,i){var n=i(4215);t.exports="NODE"===n},6198(t,e,i){var n=i(8014);t.exports=function(t){return n(t.length)}},6269(t){t.exports={}},6279(t,e,i){var n=i(6840);t.exports=function(t,e,i){for(var r in e)n(t,r,e[r],i);return t}},6319(t,e,i){var n=i(8551),r=i(9539);t.exports=function(t,e,i,s){try{return s?e(n(i)[0],i[1]):e(i)}catch(e){r(t,"throw",e)}}},6395(t){t.exports=!1},6518(t,e,i){var n=i(4576),r=i(7347).f,s=i(6699),a=i(6840),o=i(9433),l=i(7740),h=i(2796);t.exports=function(t,e){var i,c,d,u,p,g=t.target,f=t.global,m=t.stat;if(i=f?n:m?n[g]||o(g,{}):n[g]&&n[g].prototype)for(c in e){if(u=e[c],d=t.dontCallGetSet?(p=r(i,c))&&p.value:i[c],!h(f?c:g+(m?".":"#")+c,t.forced)&&void 0!==d){if(typeof u==typeof d)continue;l(u,d)}(t.sham||d&&d.sham)&&s(u,"sham",!0),a(i,c,u,t)}}},6573(t,e,i){var n=i(3724),r=i(2106),s=i(3238),a=ArrayBuffer.prototype;n&&!("detached"in a)&&r(a,"detached",{configurable:!0,get:function(){return s(this)}})},6699(t,e,i){var n=i(3724),r=i(4913),s=i(6980);t.exports=n?function(t,e,i){return r.f(t,e,s(1,i))}:function(t,e,i){return t[e]=i,t}},6706(t,e,i){var n=i(9504),r=i(9306);t.exports=function(t,e,i){try{return n(r(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}}},6801(t,e,i){var n=i(3724),r=i(8686),s=i(4913),a=i(8551),o=i(5397),l=i(1072);e.f=n&&!r?Object.defineProperties:function(t,e){a(t);for(var i,n=o(e),r=l(e),h=r.length,c=0;h>c;)s.f(t,i=r[c++],n[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>9007199254740991)throw e("Maximum allowed index exceeded");return t}},6840(t,e,i){var n=i(4901),r=i(4913),s=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(n(i)&&s(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:r.f(t,e,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return t}},6955(t,e,i){var n=i(2140),r=i(4901),s=i(2195),a=i(8227)("toStringTag"),o=Object,l="Arguments"===s(function(){return arguments}());t.exports=n?s:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=o(t),a))?i:l?s(e):"Object"===(n=s(e))&&r(e.callee)?"Arguments":n}},6969(t,e,i){var n=i(2777),r=i(757);t.exports=function(t){var e=n(t,"string");return r(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){var n=i(4495);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},7055(t,e,i){var n=i(9504),r=i(9039),s=i(2195),a=Object,o=n("".split);t.exports=r(function(){return!a("z").propertyIsEnumerable(0)})?function(t){return"String"===s(t)?o(t,""):a(t)}:a},7080(t,e,i){var n=i(4402).has;t.exports=function(t){return n(t),t}},7347(t,e,i){var n=i(3724),r=i(9565),s=i(8773),a=i(6980),o=i(5397),l=i(6969),h=i(9297),c=i(5917),d=Object.getOwnPropertyDescriptor;e.f=n?d:function(t,e){if(t=o(t),e=l(e),c)try{return d(t,e)}catch(t){}if(h(t,e))return a(!r(s.f,t,e),t[e])}},7394(t,e,i){var n=i(4576),r=i(6706),s=i(2195),a=n.ArrayBuffer,o=n.TypeError;t.exports=a&&r(a.prototype,"byteLength","get")||function(t){if("ArrayBuffer"!==s(t))throw new o("ArrayBuffer expected");return t.byteLength}},7416(t,e,i){var n=i(9039),r=i(8227),s=i(3724),a=i(6395),o=r("iterator");t.exports=!n(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"),n="";return t.pathname="c%20d",e.forEach(function(t,i){e.delete("b"),n+=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||!s)||!e.sort||"https://a/c%20d?a=1&c=3"!==t.href||"3"!==e.get("
2c")||"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"!==n||"x"!==new URL("https://x",void 0).host})},7452(t){t.exports="\t\n\v\f\r  áââââââ
ââââââ¯âã\u2028\u2029\ufeff"},7476(t,e,i){var n=i(2195),r=i(9504);t.exports=function(t){if("Function"===n(t))return r(t)}},7566(t,e,i){var n=i(6840),r=i(9504),s=i(655),a=i(2812),o=URLSearchParams,l=o.prototype,h=r(l.getAll),c=r(l.has),d=new o("a=1");!d.has("a",2)&&d.has("a",void 0)||n(l,"has",function(t){var e=arguments.length,i=e<2?void 0:arguments[1];if(e&&void 0===i)return c(this,t);var n=h(this,t);a(e,1);for(var r=s(i),o=0;o<n.length;)if(n[o++]===r)return!0;return!1},{enumerable:!0,unsafe:!0})},7588(t,e,i){var n=i(6518),r=i(9565),s=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),c=i(4549)("forEach",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:c},{forEach:function(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(c)return r(c,this,t);var e=l(this),i=0;s(e,function(e){t(e,i++)},{IS_RECORD:!0})}})},7629(t,e,i){var n=i(6395),r=i(4576),s=i(9433),a="__core-js_shared__",o=t.exports=r[a]||s(a,{});(o.versions||(o.versions=[])).push({version:"3.47.0",mode:n?"pure":"global",copyright:"© 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 n=i(6518),r=i(3440),s=i(9039);n({target:"Set",proto:!0,real:!0,forced:!i(4916)("difference",function(t){return 0===t.size})||s(function(){var t={size:1,has:function(){return!0},keys:function(){var t=0;return{next:function(){var i=t++>1;return e.has(1)&&e.clear(),{done:i,value:2}}}}},e=new Set([1,2,3,4]);return 3!==e.difference(t).size})},{difference:r})},7657(t,e,i){var n,r,s,a=i(9039),o=i(4901),l=i(34),h=i(2360),c=i(2787),d=i(6840),u=i(8227),p=i(6395),g=u("iterator"),f=!1;[].keys&&("next"in(s=[].keys())?(r=c(c(s)))!==Object.prototype&&(n=r):f=!0),!l(n)||a(function(){var t={};return n[g].call(t)!==t})?n={}:p&&(n=h(n)),o(n[g])||d(n,g,function(){return this}),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:f}},7696(t,e,i){var n=i(1291),r=i(8014),s=RangeError;t.exports=function(t){if(void 0===t)return 0;var e=n(t),i=r(e);if(e!==i)throw new s("Wrong length or index");return i}},7740(t,e,i){var n=i(9297),r=i(5031),s=i(7347),a=i(4913);t.exports=function(t,e,i){for(var o=r(e),l=a.f,h=s.f,c=0;c<o.length;c++){var d=o[c];n(t,d)||i&&n(i,d)||l(t,d,h(e,d))}}},7750(t,e,i){var n=i(4117),r=TypeError;t.exports=function(t){if(n(t))throw new r("Can't call method on "+t);return t}},7751(t,e,i){var n=i(4576),r=i(4901);t.exports=function(t,e){return arguments.length<2?(i=n[t],r(i)?i:void 0):n[t]&&n[t][e];var i}},7811(t){t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},7936(t,e,i){var n=i(6518),r=i(5636);r&&n({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return r(this,arguments.length?arguments[0]:void 0,!1)}})},8004(t,e,i){var n=i(6518),r=i(9039),s=i(8750);n({target:"Set",proto:!0,real:!0,forced:!i(4916)("intersection",function(t){return 2===t.size&&t.has(1)&&t.has(2)})||r(function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))})},{intersection:s})},8014(t,e,i){var n=i(1291),r=Math.min;t.exports=function(t){var e=n(t);return e>0?r(e,9007199254740991):0}},8100(t,e,i){var n=i(6518),r=i(5636);r&&n({target:"ArrayBuffer",proto:!0},{transfer:function(){return r(this,arguments.length?arguments[0]:void 0,!0)}})},8111(t,e,i){var n=i(6518),r=i(4576),s=i(679),a=i(8551),o=i(4901),l=i(2787),h=i(2106),c=i(4659),d=i(9039),u=i(9297),p=i(8227),g=i(7657).IteratorPrototype,f=i(3724),m=i(6395),b="constructor",v="Iterator",y=p("toStringTag"),w=TypeError,A=r[v],x=m||!o(A)||A.prototype!==g||!d(function(){A({})}),E=function(){if(s(this,g),l(this)===g)throw new w("Abstract class Iterator not directly constructable")},C=function(t,e){f?h(g,t,{configurable:!0,get:function(){return e},set:function(e){if(a(this),this===g)throw new w("You can't redefine this property");u(this,t)?this[t]=e:c(this,t,e)}}):g[t]=e};u(g,y)||C(y,v),!x&&u(g,b)&&g[b]!==Object||C(b,E),E.prototype=g,n({global:!0,constructor:!0,forced:x},{Iterator:E})}
2,8227(t,e,i){var n=i(4576),r=i(5745),s=i(9297),a=i(3392),o=i(4495),l=i(7040),h=n.Symbol,c=r("wks"),d=l?h.for||h:h&&h.withoutSetter||a;t.exports=function(t){return s(c,t)||(c[t]=o&&s(h,t)?h[t]:d("Symbol."+t)),c[t]}},8235(t,e,i){var n=i(9504),r=i(9297),s=SyntaxError,a=parseInt,o=String.fromCharCode,l=n("".charAt),h=n("".slice),c=n(/./.exec),d={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},u=/^[\da-f]{4}$/i,p=/^[\u0000-\u001F]$/;t.exports=function(t,e){for(var i=!0,n="";e<t.length;){var g=l(t,e);if("\\"===g){var f=h(t,e,e+2);if(r(d,f))n+=d[f],e+=2;else{if("\\u"!==f)throw new s('Unknown escape sequence: "'+f+'"');var m=h(t,e+=2,e+4);if(!c(u,m))throw new s("Bad Unicode escape at: "+e);n+=o(a(m,16)),e+=4}}else{if('"'===g){i=!1,e++;break}if(c(p,g))throw new s("Bad control character in string literal at: "+e);n+=g,e++}}if(i)throw new s("Unterminated string at: "+e);return{value:n,end:e}}},8335(t,e,i){i(9112)},8469(t,e,i){var n=i(9504),r=i(507),s=i(4402),a=s.Set,o=s.proto,l=n(o.forEach),h=n(o.keys),c=h(new a).next;t.exports=function(t,e,i){return i?r({iterator:h(t),next:c},e):l(t,e)}},8480(t,e,i){var n=i(1828),r=i(8727).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,r)}},8527(t,e,i){var n=i(7080),r=i(4402).has,s=i(5170),a=i(3789),o=i(507),l=i(9539);t.exports=function(t){var e=n(this),i=a(t);if(s(e)<i.size)return!1;var h=i.getIterator();return!1!==o(h,function(t){if(!r(e,t))return l(h,"normal",!1)})}},8551(t,e,i){var n=i(34),r=String,s=TypeError;t.exports=function(t){if(n(t))return t;throw new s(r(t)+" is not an object")}},8622(t,e,i){var n=i(4576),r=i(4901),s=n.WeakMap;t.exports=r(s)&&/native code/.test(String(s))},8686(t,e,i){var n=i(3724),r=i(9039);t.exports=n&&r(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},8721(t,e,i){var n=i(3724),r=i(9504),s=i(2106),a=URLSearchParams.prototype,o=r(a.forEach);n&&!("size"in a)&&s(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"]},8750(t,e,i){var n=i(7080),r=i(4402),s=i(5170),a=i(3789),o=i(8469),l=i(507),h=r.Set,c=r.add,d=r.has;t.exports=function(t){var e=n(this),i=a(t),r=new h;return s(e)>i.size?l(i.getIterator(),function(t){d(e,t)&&c(r,t)}):o(e,function(t){i.includes(t)&&c(r,t)}),r}},8773(t,e){var i={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!i.call({1:2},1);e.f=r?function(t){var e=n(this,t);return!!e&&e.enumerable}:i},8981(t,e,i){var n=i(7750),r=Object;t.exports=function(t){return r(n(t))}},9039(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},9112(t,e,i){var n=i(6518),r=i(3724),s=i(4576),a=i(7751),o=i(9504),l=i(9565),h=i(4901),c=i(34),d=i(4376),u=i(9297),p=i(655),g=i(6198),f=i(4659),m=i(9039),b=i(8235),v=i(4495),y=s.JSON,w=s.Number,A=s.SyntaxError,x=y&&y.parse,E=a("Object","keys"),C=Object.getOwnPropertyDescriptor,S=o("".charAt),_=o("".slice),T=o(/./.exec),P=o([].push),D=/^\d$/,M=/^[1-9]$/,F=/^[\d-]$/,I=/^[\t\n\r ]$/,k=function(t,e,i,n){var r,s,a,o,h,p=t[e],f=n&&p===n.value,m=f&&"string"==typeof n.source?{source:n.source}:{};if(c(p)){var b=d(p),v=f?n.nodes:b?[]:{};if(b)for(r=v.length,a=g(p),o=0;o<a;o++)L(p,o,k(p,""+o,i,o<r?v[o]:void 0));else for(s=E(p),a=g(s),o=0;o<a;o++)h=s[o],L(p,h,k(p,h,i,u(v,h)?v[h]:void 0))}return l(i,t,e,p,m)},L=function(t,e,i){if(r){var n=C(t,e);if(n&&!n.configurable)return}void 0===i?delete t[e]:f(t,e,i)},R=function(t,e,i,n){this.value=t,this.end=e,this.source=i,this.nodes=n},B=function(t,e){this.source=t,this.index=e};B.prototype={fork:function(t){return new B(this.source,t)},parse:function(){var t=this.source,e=this.skip(I,this.index),i=this.fork(e),n=S(t,e);if(T(F,n))return i.number();switch(n){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 A('Unexpected character: "'+n+'" at: '+e)}
vendor: 4,149 bytes, line 2
2,node:function(t,e,i,n,r){return new R(e,n,t?null:_(this.source,i,n),r)},object:function(){for(var t=this.source,e=this.index+1,i=!1,n={},r={};e<t.length;){if(e=this.until(['"',"}"],e),"}"===S(t,e)&&!i){e++;break}var s=this.fork(e).string(),a=s.value;e=s.end,e=this.until([":"],e)+1,e=this.skip(I,e),s=this.fork(e).parse(),f(r,a,s),f(n,a,s.value),e=this.until([",","}"],s.end);var o=S(t,e);if(","===o)i=!0,e++;else if("}"===o){e++;break}}return this.node(1,n,this.index,e,r)},array:function(){for(var t=this.source,e=this.index+1,i=!1,n=[],r=[];e<t.length;){if(e=this.skip(I,e),"]"===S(t,e)&&!i){e++;break}var s=this.fork(e).parse();if(P(r,s),P(n,s.value),e=this.until([",","]"],s.end),","===S(t,e))i=!0,e++;else if("]"===S(t,e)){e++;break}}return this.node(1,n,this.index,e,r)},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("-"===S(t,i)&&i++,"0"===S(t,i))i++;else{if(!T(M,S(t,i)))throw new A("Failed to parse number at: "+i);i=this.skip(D,i+1)}if(("."===S(t,i)&&(i=this.skip(D,i+1)),"e"===S(t,i)||"E"===S(t,i))&&(i++,"+"!==S(t,i)&&"-"!==S(t,i)||i++,i===(i=this.skip(D,i))))throw new A("Failed to parse number's exponent value at: "+i);return this.node(0,w(_(t,e,i)),e,i)},keyword:function(t){var e=""+t,i=this.index,n=i+e.length;if(_(this.source,i,n)!==e)throw new A("Failed to parse value at: "+i);return this.node(0,t,i,n)},skip:function(t,e){for(var i=this.source;e<i.length&&T(t,S(i,e));e++);return e},until:function(t,e){e=this.skip(I,e);for(var i=S(this.source,e),n=0;n<t.length;n++)if(t[n]===i)return e;throw new A('Unexpected character: "'+i+'" at: '+e)}};var N=m(function(){var t,e="9007199254740993";return x(e,function(e,i,n){t=n.source}),t!==e}),O=v&&!m(function(){return 1/x("-0 \t")!=-1/0});n({target:"JSON",stat:!0,forced:N},{parse:function(t,e){return O&&!h(e)?x(t):function(t,e){t=p(t);var i=new B(t,0,""),n=i.parse(),r=n.value,s=i.skip(I,n.end);if(s<t.length)throw new A('Unexpected extra character: "'+S(t,s)+'" after the parsed data at: '+s);return h(e)?k({"":r},"",e,n):r}(t,e)}})},9286(t,e,i){var n=i(4402),r=i(8469),s=n.Set,a=n.add;t.exports=function(t){var e=new s;return r(t,function(t){a(e,t)}),e}},9297(t,e,i){var n=i(9504),r=i(8981),s=n({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return s(r(t),e)}},9306(t,e,i){var n=i(4901),r=i(6823),s=TypeError;t.exports=function(t){if(n(t))return t;throw new s(r(t)+" is not a function")}},9429(t,e,i){var n=i(4576),r=i(6193);t.exports=function(t){if(r){try{return n.process.getBuiltinModule(t)}catch(t){}try{return Function('return require("'+t+'")')()}catch(t){}}}},9433(t,e,i){var n=i(4576),r=Object.defineProperty;t.exports=function(t,e){try{r(n,t,{value:e,configurable:!0,writable:!0})}catch(i){n[t]=e}return e}},9462(t,e,i){var n=i(9565),r=i(2360),s=i(6699),a=i(6279),o=i(8227),l=i(1181),h=i(5966),c=i(7657).IteratorPrototype,d=i(2529),u=i(9539),p=i(1385),g=o("toStringTag"),f="IteratorHelper",m="WrapForValidIterator",b="normal",v="throw",y=l.set,w=function(t){var e=l.getterFor(t?m:f);return a(r(c),{next:function(){var i=e(this);if(t)return i.nextHandler();if(i.done)return d(void 0,!0);try{var n=i.nextHandler();return i.returnHandlerResult?n:d(n,i.done)}catch(t){throw i.done=!0,t}},return:function(){var i=e(this),r=i.iterator;if(i.done=!0,t){var s=h(r,"return");return s?n(s,r):d(void 0,!0)}if(i.inner)try{u(i.inner.iterator,b)}catch(t){return u(r,v,t)}if(i.openIters)try{p(i.openIters,b)}catch(t){return u(r,v,t)}return r&&u(r,b),d(void 0,!0)}})},A=w(!0),x=w(!1);s(x,g,"Iterator Helper"),t.exports=function(t,e,i){var n=function(n,r){r?(r.iterator=n.iterator,r.next=n.next):r=n,r.type=e?m:f,r.returnHandlerResult=!!i,r.nextHandler=t,r.counter=0,r.done=!1,y(this,r)};return n.prototype=e?A:x,n}},9504(t,e,i){var n=i(616),r=Function.prototype,s=r.call,a=n&&r.bind.bind(s,s);t.exports=n?a:function(t){return function(){return s.apply(t,arguments)}}},9519(t,e,i){var n,r,s=i(4576),a=i(2839),o=s.process,l=s.Deno,h=o&&o.versions||l&&l.version,c=h&&h.v8;c&&(r=(n=c.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!r&&a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>
2=74)&&(n=a.match(/Chrome\/(\d+)/))&&(r=+n[1]),t.exports=r},9539(t,e,i){var n=i(9565),r=i(8551),s=i(5966);t.exports=function(t,e,i){var a,o;r(t);try{if(!(a=s(t,"return"))){if("throw"===e)throw i;return i}a=n(a,t)}catch(t){o=!0,a=t}if("throw"===e)throw i;if(o)throw a;return r(a),i}},9565(t,e,i){var n=i(616),r=Function.prototype.call;t.exports=n?r.bind(r):function(){return r.apply(r,arguments)}},9577(t,e,i){var n=i(9928),r=i(4644),s=i(1108),a=i(1291),o=i(5854),l=r.aTypedArray,h=r.getTypedArrayConstructor,c=r.exportTypedArrayMethod,d=function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(t){return 8===t}}(),u=d&&function(){try{new Int8Array(1).with(-.5,1)}catch(t){return!0}}();c("with",{with:function(t,e){var i=l(this),r=a(t),c=s(i)?o(e):+e;return n(i,h(i),r,c)}}.with,!d||u)},9617(t,e,i){var n=i(5397),r=i(5610),s=i(6198),a=function(t){return function(e,i,a){var o=n(e),l=s(o);if(0===l)return!t&&-1;var h,c=r(a,l);if(t&&i!=i){for(;l>c;)if((h=o[c++])!=h)return!0}else for(;l>c;c++)if((t||c in o)&&o[c]===i)return t||c||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},9835(t){t.exports=function(t){try{var e=new Set,i={size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return e.clear(),e.add(4),function(){return{done:!0}}}})}},n=e[t](i);return 1===n.size&&4===n.values().next().value}catch(t){return!1}}},9928(t,e,i){var n=i(6198),r=i(1291),s=RangeError;t.exports=function(t,e,i,a){var o=n(t),l=r(i),h=l<0?o+l:l;if(h>=o||h<0)throw new s("Incorrect index");for(var c=new e(o),d=0;d<o;d++)c[d]=d===h?a:t[d];return c}}},r={};function s(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={exports:{}};return n[t].call(i.exports,i,i.exports,s),i.exports}s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);s(4114),s(6573),s(8100),s(7936),s(8111),s(2489),s(7588),s(1701),s(4628),s(6069),s(7642),s(8004),s(3853),s(5876),s(2475),s(5024),s(1698),s(9577),s(4603),s(7566),s(8721);const{AbortException:a,AnnotationEditorLayer:o,AnnotationEditorParamsType:l,AnnotationEditorType:h,AnnotationEditorUIManager:c,AnnotationLayer:d,AnnotationMode:u,AnnotationType:p,applyOpacity:g,build:f,ColorPicker:m,createValidAbsoluteUrl:b,CSSConstants:v,DOMSVGFactory:y,DrawLayer:w,FeatureTest:A,fetchData:x,findContrastColor:E,getDocument:C,getFilenameFromUrl:S,getPdfFilenameFromUrl:_,getRGB:T,getUuid:P,getXfaPageViewport:D,GlobalWorkerOptions:M,ImageKind:F,InvalidPDFException:I,isDataScheme:k,isPdfFile:L,isValidExplicitDest:R,MathClamp:B,noContextMenu:N,normalizeUnicode:O,OPS:j,OutputScale:U,PagesMapper:z,PasswordResponses:H,PDFDataRangeTransport:V,PDFDateString:$,PDFWorker:W,PermissionFlag:G,PixelsPerInch:X,RenderingCancelledException:q,renderRichText:Y,ResponseException:K,setLayerDimensions:J,shadow:Q,SignatureExtractor:Z,stopEvent:tt,SupportedImageMimeTypes:et,TextLayer:it,TouchManager:nt,updateUrlHash:rt,Util:st,VerbosityLevel:at,version:ot,XfaLayer:lt}=globalThis.pdfjsLib,ht={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},ct=0,dt=1,ut=2,pt=3,gt=0,ft=1,mt=2,bt={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},vt={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};function yt(t,e,i=!1){let n=t.offsetParent;if(!n)return void console.error("offsetParent is not set -- cannot scroll");let r=t.offsetTop+t.clientTop,s=t.offsetLeft+t.clientLeft;for(;n.clientHeight===n.scrollHeight&&n.clientWidth===n.scrollWidth||i&&(n.classList.contains("markedContent")||"hidden"===getComputedStyle(n).overflow);)if(r+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent,!n)return;if(e&&(void 0!==e.top&&(r+=e.top),void 0!==e.left)){if(i){const i=t.getBoundingClientRect().width,r=B((n.clientWidth-i)/2,20,400);s+=e.left-r}else s+=e.left;n.scrollLeft=s}n.scrollTop=r}function wt(t){const e=new Map;for(const[i,n]of new URLSearchParams(t))e.set(i.toLowerCase(),n);return e}const At=/[\x00-\x1F]/g;function xt(t,e=!1){return At.test(t)?e?t.replaceAll(At,t=>"\0"===t?"":" "):t.replaceAll("\0",""):t}function Et(t,e,i=0){let n=i,r=t.length-1;if(r<0||!e(t[r]))return t.length;if(e(t[n]))return n;for(;n<r;){const i=n+r>>1;e(t[i])?r=i:n=i+1}return n}function Ct(t){if(Math.floor(t)===t)return[t,1];const e=1/t;if(e>8)return[1,8];if(Math.floor(e)===e)return[1,e];const i=t>1?e:t;let n,r=0,s=1,a=1,o=1;for(;;){const t=r+a,e=s+o;if(e>8)break;i<=t/e?(a=t,o=e):(r=t,s=e)}return n=i-r/s<a/o-i?i===t?[r,s]:[s,r]:i===t?[a,o]:[o,a],n}function St(t,e){return t-t%e}function _t(t){return Number.isInteger(t)&&t%90==0}function Tt(t){return t.width<=t.height}new Promise(function(t){window.requestAnimationFrame(t)});const Pt=document.documentElement.style;class Dt{#Nh=null;#Oh=null;#jh=0;#Uh=null;#rr=!0;constructor(t){this.#Nh=t.classList,this.#Uh=t.style}get percent(){return this.#jh}set percent(t){this.#jh=t,isNaN(t)?this.#Nh.add("indeterminate"):(this.#Nh.remove("indeterminate"),this.#Uh.setProperty("--progressBar-percent",`${this.#jh}%`))}setWidth(t){if(!t)return;const e=t.parentNode.offsetWidth-t.offsetWidth;e>0&&this.#Uh.setProperty("--progressBar-end-offset",`${e}px`)}setDisableAutoFetch(t=5e3){100===this.#jh||isNaN(this.#jh)||(this.#Oh&&clearTimeout(this.#Oh),this.show(),this.#Oh=setTimeout(()=>{this.#Oh=null,this.hide()},t))}hide(){this.#rr&&(this.#rr=!1,this.#Nh.add("hidden"))}show(){this.#rr||(this.#rr=!0,this.#Nh.remove("hidden"))}}const Mt=function(){const t=document.createElement("div");return t.style.width="round(down, calc(1.6666666666666665 * 792px), 1px)","calc(1320px)"===t.style.width?Math.fround:t=>t}(),Ft=0,It=1,kt=2,Lt=3,Rt=4,Bt=5,Nt=6,Ot=7;function jt(t){return function(t){return t<11904}(t)?function(t){return!(65408&t)}(t)?function(t){return 32===t||9===t||13===t||10===t}(t)?Ft:function(t){return t>=97&&t<=122||t>=65&&t<=90}(t)||function(t){return t>=48&&t<=57}(t)||95===t?It:kt:function(t){return 3584==(65408&t)}
2(t)?Ot:160===t?Ft:It:function(t){return t>=13312&&t<=40959||t>=63744&&t<=64255}(t)?Lt:function(t){return t>=12448&&t<=12543}(t)?Rt:function(t){return t>=12352&&t<=12447}(t)?Bt:function(t){return t>=65376&&t<=65439}(t)?Nt:It}const Ut={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3},zt={"â":"-","â":"'","â":"'","â":"'","â":"'","â":'"',"â":'"',"â":'"',"â":'"',"¼":"1/4","½":"1/2","¾":"3/4"},Ht=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]);let Vt;const $t=/\p{M}+/gu,Wt=/([+^$|])|(\p{P}+)|(\s+)|(\p{M})|(\p{L})/gu,Gt=/([^\p{M}])\p{M}*$/u,Xt=/^\p{M}*([^\p{M}])/u,qt=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,Yt=new Map,Kt=new Map;let Jt=null,Qt=null;function Zt(t,e={}){const i=[];let n;for(;null!==(n=qt.exec(t));){let{index:t}=n;for(const e of n[0]){let n=Yt.get(e);n||(n=e.normalize("NFD").length,Yt.set(e,n)),i.push([n,t++])}}const r=i.length>0,s=e.ignoreDashEOL??!1;let a;if(!r&&Jt)a=Jt;else if(r&&Qt)a=Qt;else{const t=Object.keys(zt).join("");a=new RegExp([`[${t}]`,`[${void 0}]`,`${"(?:ã|ã)"}\\n`,"\\p{M}+(?:-\\n)?",`${"\\p{Ll}-\\n(?=\\p{Ll})|\\p{Lu}-\\n(?=\\p{L})"}`,"\\S-\\n",`${"(?:\\p{Ideographic}|[ã-ã¿])"}\\n`,"\\n",r?"[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]":"\\u0000"].map(t=>`(${t})`).join("|"),"gum"),r?Qt=a:Jt=a}const o=[];for(;null!==(n=$t.exec(t));)o.push([n[0].length,n.index]);let l=t.normalize("NFD");const h=[0,0];let c=0,d=0,u=0,p=0,g=0,f=!1;l=l.replace(a,(t,e,n,r,a,l,m,b,v,y,w)=>{if(w-=p,e){const t=zt[e],i=t.length;for(let t=1;t<i;t++)h.push(w-u+t,u-t);return u-=i-1,t}if(n){let t=Kt.get(n);t||(t=n.normalize("NFKC"),Kt.set(n,t));const e=t.length;for(let t=1;t<e;t++)h.push(w-u+t,u-t);return u-=e-1,t}if(r)return f=!0,w+g===o[c]?.[1]?++c:(h.push(w-1-u+1,u-1),u-=1,p+=1),h.push(w-u+1,u),p+=1,g+=1,r.charAt(0);if(a){const t=a.endsWith("\n"),e=t?a.length-2:a.length;f=!0;let i=e;w+g===o[c]?.[1]&&(i-=o[c][0],++c);for(let t=1;t<=i;t++)h.push(w-1-u+t,u-t);return u-=i,p+=i,t?(w+=e-1,h.push(w-u+1,1+u),u+=1,p+=1,g+=1,a.slice(0,e)):a}if(l){if(s)return p+=1,g+=1,l.slice(0,-1);const t=l.length-2;return h.push(w-u+t,1+u),u+=1,p+=1,g+=1,l.slice(0,-2)}if(m)return p+=1,g+=1,m.slice(0,-1);if(b){const t=b.length-1;return h.push(w-u+t,u),p+=1,g+=1,b.slice(0,-1)}if(v)return h.push(w-u+1,u-1),u-=1,p+=1,g+=1," ";if(w+g===i[d]?.[1]){const t=i[d][0]-1;++d;for(let e=1;e<=t;e++)h.push(w-(u-e),u-e);u-=t,p+=t}return y}),h.push(l.length,u);const m=new Uint32Array(h.length>>1),b=new Int32Array(h.length>>1);for(let t=0,e=h.length;t<e;t+=2)m[t>>1]=h[t],b[t>>1]=h[t+1];return[l,[m,b],f]}function te(t,e,i){if(!t)return[e,i];const[n,r]=t,s=e,a=e+i-1;let o=Et(n,t=>t>=s);n[o]>s&&--o;let l=Et(n,t=>t>=a,o);n[l]>a&&--l;const h=s+r[o];return[h,a+r[l]+1-h]}class ee{#zh=null;#Hh=!0;#Vh=0;constructor({linkService:t,eventBus:e,updateMatchesCountOnProgress:i=!0}){this._linkService=t,this._eventBus=e,this.#Hh=i,this.onIsPageVisible=null,this.#$h(),e._on("find",this.#Wh.bind(this)),e._on("findbarclose",this.#Gh.bind(this)),e._on("pagesedited",this.#Xh.bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this.#zh}setDocument(t){this._pdfDocument&&this.#$h(),t&&(this._pdfDocument=t,this._firstPageCapability.resolve())}#Wh(t){if(!t)return;const e=this._pdfDocument,{type:i}=t;(null===this.#zh||this.#qh(t))&&(this._dirtyMatch=!0),this.#zh=t,"highlightallchange"!==i&&this.#Yh(Ut.PENDING),this._firstPageCapability.promise.then(()=>{if(!this._pdfDocument||e&&this._pdfDocument!==e)return;this.#Xa();const t=!this._highlightMatches,n=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),i?this._dirtyMatch?this.#Kh():"again"===i?(this.#Kh(),t&&this.#zh.highlightAll&&this.#Jh()):"highlightallchange"===i?(n?this.#Kh():this._highlightMatches=!0,this.#Jh()):this.#Kh():this._findTimeout=setTimeout(()=>{this.#Kh(),this._findTimeout=null},250)})}scrollMatchIntoView({element:t=null,selectedLeft:e=0,pageIndex:i=-1,matchIndex:n=-1}){if(!this._scrollMatches||!t)return;if(-1===n||n!==this._selected.matchIdx)return;if(-1===i||i!==this._selected.pageIdx)return;this._scrollMatches=!1;yt(t,{top:-50,left:e},!0)}#$h(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],this.#Vh=0,this.#zh=null,this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this._firstPageCapability=Promise.withResolvers()}get#Qh(){const{query:t}=this.#zh;return"string"==typeof t?(t!==this._rawQuery&&(this._rawQuery=t,[this._normalizedQuery]=Zt(t)),this._normalizedQuery):(t||[]).filter(t=>!!t).map(t=>Zt(t)[0])}#qh(t){const e=t.query,i=this.#zh.query,n=typeof e;if(n!==typeof i)return!0;
2if("string"===n){if(e!==i)return!0}else if(JSON.stringify(e)!==JSON.stringify(i))return!0;switch(t.type){case"again":const t=this._selected.pageIdx+1,e=this._linkService;return t>=1&&t<=e.pagesCount&&t!==e.page&&!(this.onIsPageVisible?.(t)??!0);case"highlightallchange":return!1}return!0}#Zh(t,e,i){let n=t.slice(0,e).match(Gt);if(n){const i=t.charCodeAt(e),r=n[1].charCodeAt(0);if(jt(i)===jt(r))return!1}if(n=t.slice(e+i).match(Xt),n){const r=t.charCodeAt(e+i-1),s=n[1].charCodeAt(0);if(jt(r)===jt(s))return!1}return!0}#tc(t,e){const{matchDiacritics:i}=this.#zh;let n=!1;const r=(e,i)=>e===t?i:t.startsWith(e)?`${i}[ ]*`:t.endsWith(e)?`[ ]*${i}`:`[ ]*${i}[ ]*`,s="[ ]*";return(t=t.replaceAll(Wt,(t,s,a,o,l,h)=>s?r(s,RegExp.escape(s)):a?r(a,RegExp.escape(a)):o?"[ ]+":i?l||h:l?Ht.has(l.charCodeAt(0))?l:"":e?(n=!0,`${h}\\p{M}*`):h)).endsWith(s)&&(t=t.slice(0,t.length-4)),i&&e&&(Vt||=String.fromCharCode(...Ht),n=!0,t=`${t}(?=[${Vt}]|[^\\p{M}]|$)`),[n,t]}#ec(t){if(!this.#zh)return;const e=this.#Qh;if(0===e.length)return;const i=this._pageContents[t],n=this.match(e,i,t),r=this._pageMatches[t]=[],s=this._pageMatchesLength[t]=[],a=this._pageDiffs[t];n?.forEach(({index:t,length:e})=>{const[i,n]=te(a,t,e);n&&(r.push(i),s.push(n))}),this.#zh.highlightAll&&this.#ic(t),this._resumePageIdx===t&&(this._resumePageIdx=null,this.#nc());const o=r.length;this._matchesCountTotal+=o,this.#Hh?o>0&&this.#rc():++this.#Vh===this._linkService.pagesCount&&this.#rc()}match(t,e,i){const n=this._hasDiacritics[i];let r=!1;if("string"==typeof t?[r,t]=this.#tc(t,n):t=t.sort().reverse().map(t=>{const[e,i]=this.#tc(t,n);return r||=e,`(${i})`}).join("|"),!t)return;const{caseSensitive:s,entireWord:a}=this.#zh;t=new RegExp(t,`g${r?"u":""}${s?"":"i"}`);const o=[];let l;for(;null!==(l=t.exec(e));)a&&!this.#Zh(e,l.index,l[0].length)||o.push({index:l.index,length:l[0].length});return o}#Xa(){if(this._extractTextPromises.length>0)return;let t=Promise.resolve();const e={disableNormalization:!0},i=this._pdfDocument;for(let n=0,r=this._linkService.pagesCount;n<r;n++){const{promise:r,resolve:s}=Promise.withResolvers();this._extractTextPromises[n]=r,t=t.then(async()=>{i===this._pdfDocument?await i.getPage(n+1).then(t=>t.getTextContent(e)).then(t=>{const e=[];for(const i of t.items)e.push(i.str),i.hasEOL&&e.push("\n");[this._pageContents[n],this._pageDiffs[n],this._hasDiacritics[n]]=Zt(e.join("")),s()},t=>{console.error(`Unable to get text content for page ${n+1}`,t),this._pageContents[n]="",this._pageDiffs[n]=null,this._hasDiacritics[n]=!1,s()}):s()})}}#ic(t){this._scrollMatches&&this._selected.pageIdx===t&&(this._linkService.page=t+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:t})}#Jh(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}#Kh(){const t=this.#zh.findPrevious,e=this._linkService.page-1,i=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=e,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,this.#Vh=0,this._matchesCountTotal=0,this.#Jh();for(let t=0;t<i;t++)this._pendingFindMatches.has(t)||(this._pendingFindMatches.add(t),this._extractTextPromises[t].then(()=>{this._pendingFindMatches.delete(t),this.#ec(t)}))}if(0===this.#Qh.length)return void this.#Yh(Ut.FOUND);if(this._resumePageIdx)return;const n=this._offset;if(this._pagesToSearch=i,null!==n.matchIdx){const e=this._pageMatches[n.pageIdx].length;if(!t&&n.matchIdx+1<e||t&&n.matchIdx>0)return n.matchIdx=t?n.matchIdx-1:n.matchIdx+1,void this.#sc(!0);this.#ac(t)}this.#nc()}#oc(t){const e=this._offset,i=t.length,n=this.#zh.findPrevious;return i?(e.matchIdx=n?i-1:0,this.#sc(!0),!0):(this.#ac(n),!!(e.wrapped&&(e.matchI
2dx=null,this._pagesToSearch<0))&&(this.#sc(!1),!0))}#nc(){null!==this._resumePageIdx&&console.error("There can only be one pending page.");let t=null;do{const e=this._offset.pageIdx;if(t=this._pageMatches[e],!t){this._resumePageIdx=e;break}}while(!this.#oc(t))}#ac(t){const e=this._offset,i=this._linkService.pagesCount;e.pageIdx=t?e.pageIdx-1:e.pageIdx+1,e.matchIdx=null,this._pagesToSearch--,(e.pageIdx>=i||e.pageIdx<0)&&(e.pageIdx=t?i-1:0,e.wrapped=!0)}#sc(t=!1){let e=Ut.NOT_FOUND;const i=this._offset.wrapped;if(this._offset.wrapped=!1,t){const t=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,e=i?Ut.WRAPPED:Ut.FOUND,-1!==t&&t!==this._selected.pageIdx&&this.#ic(t)}this.#Yh(e,this.#zh.findPrevious),-1!==this._selected.pageIdx&&(this._scrollMatches=!0,this.#ic(this._selected.pageIdx))}#Xh({pagesMapper:t}){if(0===this._extractTextPromises.length)return;this.#Gh(),this._dirtyMatch=!0;const e=this._extractTextPromises,i=this._extractTextPromises.length=[];for(let n=0,r=t.length;n<r;n++){const r=t.getPrevPageNumber(n+1)-1;-1!==r&&i.push(e[r]||Promise.resolve())}}#Gh(t){const e=this._pdfDocument;this._firstPageCapability.promise.then(()=>{!this._pdfDocument||e&&this._pdfDocument!==e||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),this.#Yh(Ut.FOUND),this._highlightMatches=!1,this.#Jh())})}#lc(){const{pageIdx:t,matchIdx:e}=this._selected;let i=0,n=this._matchesCountTotal;if(-1!==e){for(let e=0;e<t;e++)i+=this._pageMatches[e]?.length||0;i+=e+1}return(i<1||i>n)&&(i=n=0),{current:i,total:n}}#rc(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this.#lc()})}#Yh(t,e=!1){(this.#Hh||this.#Vh===this._linkService.pagesCount&&t!==Ut.PENDING)&&this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:t,previous:e,entireWord:this.#zh?.entireWord??null,matchesCount:this.#lc(),rawQuery:this.#zh?.query??null})}}s(8335);const ie={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};class ne{externalLinkEnabled=!0;constructor({eventBus:t,externalLinkTarget:e=null,externalLinkRel:i=null,ignoreDestinationZoom:n=!1}={}){this.eventBus=t,this.externalLinkTarget=e,this.externalLinkRel=i,this._ignoreDestinationZoom=n,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(t,e=null){this.baseUrl=e,this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setHistory(t){this.pdfHistory=t}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return this.pdfDocument?this.pdfViewer.currentPageNumber:1}set page(t){this.pdfDocument&&(this.pdfViewer.currentPageNumber=t)}get rotation(){return this.pdfDocument?this.pdfViewer.pagesRotation:0}set rotation(t){this.pdfDocument&&(this.pdfViewer.pagesRotation=t)}get isInPresentationMode(){return!!this.pdfDocument&&this.pdfViewer.isInPresentationMode}async goToDestination(t){if(!this.pdfDocument)return;let e,i,n;if("string"==typeof t?(e=t,i=await this.pdfDocument.getDestination(t)):(e=null,i=await t),!Array.isArray(i))return void console.error(`goToDestination: "${i}" is not a valid destination array, for dest="${t}".`);const[r]=i;if(r&&"object"==typeof r){if(n=this.pdfDocument.cachedPageNumber(r),!n)try{n=await this.pdfDocument.getPageIndex(r)+1}catch{return void console.error(`goToDestination: "${r}" is not a valid page reference, for dest="${t}".`)}}else Number.isInteger(r)&&(n=r+1);if(!n||n<1||n>this.pagesCount)return void console.error(`goToDestination: "${n}" is not a valid page number, for dest="${t}".`);this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:e,explicitDest:i,pageNumber:n})),this.pdfViewer.scrollPageIntoView({pageNumber:n,destArray:i,ignoreDestinationZoom:this._ignoreDestinationZoom});const s=new AbortController;this.eventBus._on("textlayerrendered",t=>{t.pageNumber===n&&(t.source.textLayer.div.focus(),s.abort())},{signal:s.signal})}goToPage(t){if(!this.pdfDocument)return;const e="string"==typeof t&&this.pdfViewer.pageLabelToPageNumber(t)||0|t;Number.isInteger(e)&&e>0&&e<=this.pagesCount?(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(e)),this.pdfViewer.scrollPageIntoView({pageNumber:e})):console.error(`PDFLinkService.goToPage: "${t}" is not a valid page.`)}goToXY(t,e,i,n={}){this.pdfViewer.scrollPageIntoView({pageNumber:t,destArray:[null,{name:"XYZ"},e,i],ignoreDestinationZoom:!0,...n})}addLinkAttributes(t,e,i=!1){if(!e||"string"!=typeof e)throw new Error('A valid "url" parameter must provided.');const n=i?ie.BLANK:this.externalLinkTarget,r=this.externalLinkRel;this.externalLinkEnabled?t.href=t.title=e:(t.href="",t.title=`Disabled: ${e}`,t.onclick=()=>!1);let s="";switch(n){case ie.NONE:break;case ie.SELF:s="_self";break;case ie.BLANK:s="_blank";break;case ie.PARENT:s="_parent";break;case ie.TOP:s="_top"}t.target=s,t.rel="string"==typeof r?r:"noopener noreferrer nofollow"}getDestinationHash(t){if("string"==typeof t){if(t.length>0)return this.getAnchorUrl("#"+escape(t))}else if(Array.isArray(t)){const e=JSON.stringify(t);if(e.length>0)return this.getAnchorUrl("#"+escape(e))}return this.getAnchorUrl("")}getAnchorUrl(t){return this.baseUrl?this.baseUrl+t:t}setHash(t){if(!this.pdfDocument)return;let e,i;if(t.includes("=")){const n=wt(t);if(n.has("search")){const t=n.get("search").replaceAll('"',""),e="true"===n.get("phrase");this.eventBus.dispatch("findfromurlhash",{source:this,query:e?t:t.match(/\S+/g)})}if(n.has("page")&&(e=0|n.get("page")||1),n.has("zoom")){const t=n.get("zoom").split(","),e=t[0],r=parseFloat(e);e.includes("Fit")?"Fit"===e||"FitB"===e?i=[null,{name:e}]:"FitH"===e||"FitBH"===e||"FitV"===e||"FitBV"===e?i=[null,{name:e},t.length>1?0|t[1]:null]:"FitR"===e?5!==t.length?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:e},0|t[1],0|t[2],0|t[3],0|t[4]]:console.error(`PDFLinkService.setHash: "${e}" is not a valid zoom value.`):i=[null,{name:"XYZ"},t.length>1?0|t[1]:null,t.length>2?0|t[2]:null,r?r/100:e]}return i?this.pdfViewer.scrollPageIntoView({pageNumber:e||this.page,destArray:i,allowNegativeOffset:!0}):e&&(this.page=e),n.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:n.get("pagemode")}),void(n.has("nameddest")&&this.goToDestination(n.get("nameddest")))}i=unescape(t);try{i=JSON.parse(i),Array.isArray(i)||(i=i.toString())}catch{}"string"==typeof i||R(i)?this.goToDestination(i):console.error(`PDFLinkService.setHash: "${unescape(t)}" is not a valid destination.`)}executeNamedAction(t){if(this.pdfDocument){switch(t){case"GoBack":this.pdfHistory?.back();break;case"GoForward":this.pdfHistory?.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}this.eventBus.dispatch("namedaction",{source:this,action:t})}}async executeSetOCGState(t){if(!this.pdfDocument)return;const e=this.pdfDocument,i=await this.pdfViewer.optionalContentConfigPromise;e===this.pdfDocument&&(i.setOCGState(t),this.pdfViewer.optionalContentConfigPromise=Promise.resolve(i))}}class re extends ne{setDocument(t,e=null){}}class se{#hc=null;#K=null;#cc=!1;#dc=null;#uc=null;#pc=!1;constructor({pdfPage:t,linkService:e,downloadManager:i,annotationStorage:n=null,imageResourcesPath:r="",renderForms:s=!0,enableComment:a=!1,commentManager:o=null,enableScripting:l=!1,hasJSActionsProm
2ise:h=null,fieldObjectsPromise:c=null,annotationCanvasMap:d=null,accessibilityManager:u=null,annotationEditorUIManager:p=null,onAppend:g=null}){this.pdfPage=t,this.linkService=e,this.downloadManager=i,this.imageResourcesPath=r,this.renderForms=s,this.annotationStorage=n,this.enableComment=a,this.#K=o,this.enableScripting=l,this._hasJSActionsPromise=h||Promise.resolve(!1),this._fieldObjectsPromise=c||Promise.resolve(null),this._annotationCanvasMap=d,this._accessibilityManager=u,this._annotationEditorUIManager=p,this.#dc=g,this.annotationLayer=null,this.div=null,this._cancelled=!1,this._eventBus=e.eventBus}async render({viewport:t,intent:e="display",structTreeLayer:i=null}){if(this.div){if(this._cancelled||!this.annotationLayer)return;return void this.annotationLayer.update({viewport:t.clone({dontFlip:!0})})}const[n,r,s]=await Promise.all([this.pdfPage.getAnnotations({intent:e}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled)return;const a=this.div=document.createElement("div");if(a.className="annotationLayer",this.#dc?.(a),this.#gc(t,i),0===n.length)return this.#hc=n,void J(this.div,t);await this.annotationLayer.render({annotations:n,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,downloadManager:this.downloadManager,enableComment:this.enableComment,enableScripting:this.enableScripting,hasJSActions:r,fieldObjects:s}),this.#hc=n,this.linkService.isInPresentationMode&&this.#fc(pt),this.#uc||(this.#uc=new AbortController,this._eventBus?._on("presentationmodechanged",t=>{this.#fc(t.state)},{signal:this.#uc.signal}))}#gc(t,e){this.annotationLayer=new d({div:this.div,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,annotationEditorUIManager:this._annotationEditorUIManager,annotationStorage:this.annotationStorage,page:this.pdfPage,viewport:t.clone({dontFlip:!0}),structTreeLayer:e,commentManager:this.#K,linkService:this.linkService})}cancel(){this._cancelled=!0,this.#uc?.abort(),this.#uc=null}hide(t=!1){this.#cc=!t,this.div&&(this.div.hidden=!0)}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}async injectLinkAnnotations(t){if(null===this.#hc)throw new Error("`render` method must be called before `injectLinkAnnotations`.");if(this._cancelled||this.#pc)return;this.#pc=!0;const e=this.#hc.length?this.#mc(t):t;e.length&&(await this.annotationLayer.addLinkAnnotations(e),this.#cc||(this.div.hidden=!1))}#fc(t){if(!this.div)return;let e=!1;switch(t){case pt:e=!0;break;case dt:break;default:return}for(const t of this.div.childNodes)t.hasAttribute("data-internal-link")||(t.inert=e)}#mc(t){function e(t){if(!t.quadPoints)return[t.rect];const e=[];for(let i=2,n=t.quadPoints.length;i<n;i+=8){const n=t.quadPoints[i],r=t.quadPoints[i+1],s=t.quadPoints[i+2],a=t.quadPoints[i+3];e.push([s,a,n,r])}return e}function i(t,i){const n=[],r=e(t),s=e(i);for(const t of r)for(const e of s){const i=st.intersect(t,e);i&&n.push(i)}return n}function n(t){let e=0;for(const i of t)e+=Math.abs((i[2]-i[0])*(i[3]-i[1]));return e}return t.filter(t=>{let r;for(const s of this.#hc){if(s.annotationType!==p.LINK||!s.url)continue;const a=i(s,t);if(0!==a.length&&(r??=n(e(t)),n(a)/r>.5))return!1}return!0})}}function ae(t,e){const i=document.createElement("a");if(!i.click)throw new Error('DownloadManager: "a.click()" is not supported.');i.href=t,i.target="_parent","download"in i&&(i.download=e),(document.body||document.documentElement).append(i),i.click(),i.remove()}class oe{#bc=new WeakMap;downloadData(t,e,i){ae(URL.createObjectURL(new Blob([t],{type:i})),e)}openOrDownloadData(t,e,i=null){const n=L(e)?"application/pdf":"";return this.downloadData(t,e,n),!1}download(t,e,i){let n;if(t)n=URL.createObjectURL(new Blob([t],{type:"application/pdf"}));else{if(!b(e,"http://example.com"))return void console.error(`download - not a valid URL: ${e}`);n=e+"#pdfjs.action=download"}ae(n,i)}}const le="event",he="timeout";class ce{#o=Object.create(null);on(t,e,i=null){this._on(t,e,{external:!0,once:i?.once,signal:i?.signal})}off(t,e,i=null){this._off(t,e)}dispatch(t,e){const i=this.#o[t];if(!i||0===i.length)return;let n;for(const{listener:r,external:s,once:a}of i.slice(0))a&&this._off(t,r),s?(n||=[]).push(r):r(e);
2if(n){for(const t of n)t(e);n=null}}_on(t,e,i=null){let n=null;if(i?.signal instanceof AbortSignal){const{signal:r}=i;if(r.aborted)return void console.error("Cannot use an `aborted` signal.");const s=()=>this._off(t,e);n=()=>r.removeEventListener("abort",s),r.addEventListener("abort",s)}(this.#o[t]||=[]).push({listener:e,external:!0===i?.external,once:!0===i?.once,rmAbort:n})}_off(t,e,i=null){const n=this.#o[t];if(n)for(let t=0,i=n.length;t<i;t++){const i=n[t];if(i.listener===e)return i.rmAbort?.(),void n.splice(t,1)}}}class de{constructor(t){this.value=t}valueOf(){return this.value}}class ue extends de{constructor(t="???"){super(t)}toString(t){return`{${this.value}}`}}class pe extends de{constructor(t,e={}){super(t),this.opts=e}toString(t){if(t)try{return t.memoizeIntlObject(Intl.NumberFormat,this.opts).format(this.value)}catch(e){t.reportError(e)}return this.value.toString(10)}}class ge extends de{static supportsValue(t){if("number"==typeof t)return!0;if(t instanceof Date)return!0;if(t instanceof de)return ge.supportsValue(t.valueOf());if("Temporal"in globalThis){const e=globalThis.Temporal;if(t instanceof e.Instant||t instanceof e.PlainDateTime||t instanceof e.PlainDate||t instanceof e.PlainMonthDay||t instanceof e.PlainTime||t instanceof e.PlainYearMonth)return!0}return!1}constructor(t,e={}){t instanceof ge?(e={...t.opts,...e},t=t.value):t instanceof de&&(t=t.valueOf()),"object"==typeof t&&"calendarId"in t&&void 0===e.calendar&&(e={...e,calendar:t.calendarId}),super(t),this.opts=e}[Symbol.toPrimitive](t){return"string"===t?this.toString():this.toNumber()}toNumber(){const t=this.value;if("number"==typeof t)return t;if(t instanceof Date)return t.getTime();if("epochMilliseconds"in t)return t.epochMilliseconds;if("toZonedDateTime"in t)return t.toZonedDateTime("UTC").epochMilliseconds;throw new TypeError("Unwrapping a non-number value as a number")}toString(t){if(t)try{return t.memoizeIntlObject(Intl.DateTimeFormat,this.opts).format(this.value)}catch(e){t.reportError(e)}return"number"==typeof this.value||this.value instanceof Date?new Date(this.value).toISOString():this.value.toString()}}function fe(t,e,i){if(i===e)return!0;if(i instanceof pe&&e instanceof pe&&i.value===e.value)return!0;if(e instanceof pe&&"string"==typeof i){if(i===t.memoizeIntlObject(Intl.PluralRules,e.opts).select(e.value))return!0}return!1}function me(t,e,i){return e[i]?we(t,e[i].value):(t.reportError(new RangeError("No default")),new ue)}function be(t,e){const i=[],n=Object.create(null);for(const r of e)"narg"===r.type?n[r.name]=ve(t,r.value):i.push(ve(t,r));return{positional:i,named:n}}function ve(t,e){switch(e.type){case"str":return e.value;case"num":return new pe(e.value,{minimumFractionDigits:e.precision});case"var":return function(t,{name:e}){let i;if(t.params){if(!Object.prototype.hasOwnProperty.call(t.params,e))return new ue(`$${e}`);i=t.params[e]}else{if(!t.args||!Object.prototype.hasOwnProperty.call(t.args,e))return t.reportError(new ReferenceError(`Unknown variable: $${e}`)),new ue(`$${e}`);i=t.args[e]}if(i instanceof de)return i;switch(typeof i){case"string":return i;case"number":return new pe(i);case"object":if(ge.supportsValue(i))return new ge(i);default:return t.reportError(new TypeError(`Variable type not supported: $${e}, ${typeof i}`)),new ue(`$${e}`)}}(t,e);case"mesg":return function(t,{name:e,attr:i}){const n=t.bundle._messages.get(e);if(!n)return t.reportError(new ReferenceError(`Unknown message: ${e}`)),new ue(e);if(i){const r=n.attributes[i];return r?we(t,r):(t.reportError(new ReferenceError(`Unknown attribute: ${i}`)),new ue(`${e}.${i}`))}if(n.value)return we(t,n.value);return t.reportError(new ReferenceError(`No value: ${e}`)),new ue(e)}(t,e);case"term":return function(t,{name:e,attr:i,args:n}){const r=`-${e}`,s=t.bundle._terms.get(r);if(!s)return t.reportError(new ReferenceError(`Unknown term: ${r}`)),new ue(r);if(i){const e=s.attributes[i];if(e){t.params=be(t,n).named;const i=we(t,e);return t.params=null,i}return t.reportError(new ReferenceError(`Unknown attribute: ${i}`)),new ue(`${r}.${i}`)}t.params=be(t,n).named;const a=we(t,s.value);return t.params=null,a}(t,e);case"func":return function(t,{name:e,args:i}){let n=t.bundle._functions[e];if(!n)return t.reportError(new ReferenceError(`Unknown function: ${e}()`)),new ue(`${e}()`);if("function"!=typeof n)return t.reportError(new TypeError(`Function ${e}() is not callable`)),new ue(`${e}()`);try{let e=be(t,i);return n(e.positional,e.named)}catch(i){return t.reportError(i),new ue(`${e}()`)}}(t,e);case"select":return function(t,{selector:e,variants:i,star:n}){let r=ve(t,e);if(r instanceof ue)return me(t,i,n);for(const e of i){if(fe(t,r,ve(t,e.key)))return we(t,e.value)}return me(t,i,n)}(t,e);default:return new ue}}function ye(t,e){if(t.dirty.has(e))return t.reportError(new RangeError("Cyclic reference")),new ue;t.dirty.add(e);const i=[],n=t.bundle._useIsolating&&e.length>1;for(const r of e)if("string"!=typeof r){if(t.placeables++,t.placeables>100)throw t.dirty.delete(e),new RangeError(`Too many placeables expanded: ${t.placeables}, max allowed is 100`);n&&i.push("â¨"),i.push(ve(t,r).toString(t)),n&&i.push("â©")}else i.push(t.bundle._transform(r));return t.dirty.delete(e),i.join("")}function we(t,e){return"string"==typeof e?t.bundle._transform(e):ye(t,e)}class Ae{constructor(t,e,i){this.dirty=new WeakSet,this.params=null,this.placeables=0,this.bundle=t,this.errors=e,this.args=i}reportError(t){if(!(this.errors&&t instanceof Error))throw t;this.errors.push(t)}
vendor: 3,685 bytes, line 2
2memoizeIntlObject(t,e){let i=this.bundle._intls.get(t);i||(i={},this.bundle._intls.set(t,i));let n=JSON.stringify(e);return i[n]||(i[n]=new t(this.bundle.locales,e)),i[n]}}function xe(t,e){const i=Object.create(null);for(const[n,r]of Object.entries(t))e.includes(n)&&(i[n]=r.valueOf());return i}const Ee=["unitDisplay","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits"];function Ce(t,e){let i=t[0];if(i instanceof ue)return new ue(`NUMBER(${i.valueOf()})`);if(i instanceof pe)return new pe(i.valueOf(),{...i.opts,...xe(e,Ee)});if(i instanceof ge)return new pe(i.toNumber(),{...xe(e,Ee)});throw new TypeError("Invalid argument to NUMBER")}const Se=["dateStyle","timeStyle","fractionalSecondDigits","dayPeriod","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function _e(t,e){let i=t[0];if(i instanceof ue)return new ue(`DATETIME(${i.valueOf()})`);if(i instanceof ge||i instanceof pe)return new ge(i,xe(e,Se));throw new TypeError("Invalid argument to DATETIME")}const Te=new Map;class Pe{constructor(t,{functions:e,useIsolating:i=!0,transform:n=t=>t}={}){this._terms=new Map,this._messages=new Map,this.locales=Array.isArray(t)?t:[t],this._functions={NUMBER:Ce,DATETIME:_e,...e},this._useIsolating=i,this._transform=n,this._intls=function(t){const e=Array.isArray(t)?t.join(" "):t;let i=Te.get(e);return void 0===i&&(i=new Map,Te.set(e,i)),i}(t)}hasMessage(t){return this._messages.has(t)}getMessage(t){return this._messages.get(t)}addResource(t,{allowOverrides:e=!1}={}){const i=[];for(let n=0;n<t.body.length;n++){let r=t.body[n];if(r.id.startsWith("-")){if(!1===e&&this._terms.has(r.id)){i.push(new Error(`Attempt to override an existing term: "${r.id}"`));continue}this._terms.set(r.id,r)}else{if(!1===e&&this._messages.has(r.id)){i.push(new Error(`Attempt to override an existing message: "${r.id}"`));continue}this._messages.set(r.id,r)}}return i}formatPattern(t,e=null,i=null){if("string"==typeof t)return this._transform(t);let n=new Ae(this,i,e);try{return ye(n,t).toString(n)}catch(t){if(n.errors&&t instanceof Error)return n.errors.push(t),(new ue).toString(n);throw t}}}const De=/^(-?[a-zA-Z][\w-]*) *= */gm,Me=/\.([a-zA-Z][\w-]*) *= */y,Fe=/\*?\[/y,Ie=/(-?[0-9]+(?:\.([0-9]+))?)/y,ke=/([a-zA-Z][\w-]*)/y,Le=/([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y,Re=/^[A-Z][A-Z0-9_-]*$/,Be=/([^{}\n\r]+)/y,Ne=/([^\\"\n\r]*)/y,Oe=/\\([\\"])/y,je=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y,Ue=/^\n+/,ze=/ +$/,He=/ *\r?\n/g,Ve=/( *)$/,$e=/{\s*/y,We=/\s*}/y,Ge=/\[\s*/y,Xe=/\s*] */y,qe=/\s*\(\s*/y,Ye=/\s*->\s*/y,Ke=/\s*:\s*/y,Je=/\s*,?\s*/y,Qe=/\s+/y;class Ze{constructor(t){this.body=[],De.lastIndex=0;let e=0;for(;;){let i=De.exec(t);if(null===i)break;e=De.lastIndex;try{this.body.push(o(i[1]))}catch(t){if(t instanceof SyntaxError)continue;throw t}}function i(i){return i.lastIndex=e,i.test(t)}function n(i,n){if(t[e]===i)return e++,!0;if(n)throw new n(`Expected ${i}`);return!1}function r(t,n){if(i(t))return e=t.lastIndex,!0;if(n)throw new n(`Expected ${t.toString()}`);return!1}function s(i){i.lastIndex=e;let n=i.exec(t);if(null===n)throw new SyntaxError(`Expected ${i.toString()}`);return e=i.lastIndex,n}function a(t){return s(t)[1]}function o(t){let e=l(),n=function(){let t=Object.create(null);for(;i(Me);){let e=a(Me),i=l();if(null===i)throw new SyntaxError("Expected attribute value");t[e]=i}return t}();if(null===e&&0===Object.keys(n).length)throw new SyntaxError("Expected message value or attributes");return{id:t,value:e,attributes:n}}function l(){let n;if(i(Be)&&(n=a(Be)),"{"===t[e]||"}"===t[e])return h(n?[n]:[],1/0);
2let r=b();return r?n?h([n,r],r.length):(r.value=v(r.value,Ue),h([r],r.length)):n?v(n,ze):null}function h(n=[],r){for(;;){if(i(Be)){n.push(a(Be));continue}if("{"===t[e]){n.push(c());continue}if("}"===t[e])throw new SyntaxError("Unbalanced closing brace");let s=b();if(!s)break;n.push(s),r=Math.min(r,s.length)}let s=n.length-1,o=n[s];"string"==typeof o&&(n[s]=v(o,ze));let l=[];for(let t of n)t instanceof ti&&(t=t.value.slice(0,t.value.length-r)),t&&l.push(t);return l}function c(){r($e,SyntaxError);let t=d();if(r(We))return t;if(r(Ye)){let e=function(){let t,e=[],r=0;for(;i(Fe);){n("*")&&(t=r);let i=p(),s=l();if(null===s)throw new SyntaxError("Expected variant value");e[r++]={key:i,value:s}}if(0===r)return null;if(void 0===t)throw new SyntaxError("Expected default variant");return{variants:e,star:t}}();return r(We,SyntaxError),{type:"select",selector:t,...e}}throw new SyntaxError("Unclosed placeable")}function d(){if("{"===t[e])return c();if(i(Le)){let[,i,n,a=null]=s(Le);if("$"===i)return{type:"var",name:n};if(r(qe)){let s=function(){let i=[];for(;;){switch(t[e]){case")":return e++,i;case void 0:throw new SyntaxError("Unclosed argument list")}i.push(u()),r(Je)}}();if("-"===i)return{type:"term",name:n,attr:a,args:s};if(Re.test(n))return{type:"func",name:n,args:s};throw new SyntaxError("Function names must be all upper-case")}return"-"===i?{type:"term",name:n,attr:a,args:[]}:{type:"mesg",name:n,attr:a}}return g()}function u(){let t=d();return"mesg"!==t.type?t:r(Ke)?{type:"narg",name:t.name,value:g()}:t}function p(){let t;return r(Ge,SyntaxError),t=i(Ie)?f():{type:"str",value:a(ke)},r(Xe,SyntaxError),t}function g(){if(i(Ie))return f();if('"'===t[e])return function(){n('"',SyntaxError);let i="";for(;;){if(i+=a(Ne),"\\"!==t[e]){if(n('"'))return{type:"str",value:i};throw new SyntaxError("Unclosed string literal")}i+=m()}}();throw new SyntaxError("Invalid expression")}function f(){let[,t,e=""]=s(Ie),i=e.length;return{type:"num",value:parseFloat(t),precision:i}}function m(){if(i(Oe))return a(Oe);if(i(je)){let[,t,e]=s(je),i=parseInt(t||e,16);return i<=55295||57344<=i?String.fromCodePoint(i):"�"}throw new SyntaxError("Unknown escape sequence")}function b(){let i=e;switch(r(Qe),t[e]){case".":case"[":case"*":case"}":case void 0:return!1;case"{":return y(t.slice(i,e))}return" "===t[e-1]&&y(t.slice(i,e))}function v(t,e){return t.replace(e,"")}function y(t){let e=t.replace(He,"\n"),i=Ve.exec(t)[1].length;return new ti(e,i)}}}class ti{constructor(t,e){this.value=t,this.length=e}}const ei=/<|&#?\w+;/,ii={"http://www.w3.org/1999/xhtml":["em","strong","small","s","cite","q","dfn","abbr","data","time","code","var","samp","kbd","sub","sup","i","b","u","mark","bdi","bdo","span","br","wbr"]},ni={"http://www.w3.org/1999/xhtml":{global:["title","aria-description","aria-label","aria-valuetext"],a:["download"],area:["download","alt"],input:["alt","placeholder"],menuitem:["label"],menu:["label"],optgroup:["label"],option:["label"],track:["label"],img:["alt"],textarea:["placeholder"],th:["abbr"]},"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul":{global:["accesskey","aria-label","aria-valuetext","label","title","tooltiptext"],description:["value"],key:["key","keycode"],label:["value"],textbox:["placeholder","value"]}};function ri(t,e){const{value:i}=e;if("string"==typeof i)if("title"===t.localName&&"http://www.w3.org/1999/xhtml"===t.namespaceURI)t.textContent=i;else if(ei.test(i)){const e=t.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","template");e.innerHTML=i,function(t,e){for(const i of t.childNodes)if(i.nodeType!==i.TEXT_NODE){if(i.hasAttribute("data-l10n-name")){const n=oi(e,i);t.replaceChild(n,i);continue}if(ci(i)){const e=li(i);t.replaceChild(e,i);continue}console.warn(`An element of forbidden type "${i.localName}" was found in the translation. Only safe text-level elements and elements with data-l10n-name are allowed.`),t.replaceChild(hi(i),i)}e.textContent="",e.appendChild(t)}(e.content,t)}else t.textContent=i;ai(e,t)}function si(t,e){if(!t)return!1;for(let i of t)if(i.name===e)return!0;return!1}function ai(t,e){const i=e.hasAttribute("data-l10n-attrs")?e.getAttribute("data-l10n-attrs").split(",").map(t=>t.trim()):null;for(const n of Array.from(e.attributes))di(n.name,e,i)&&!si(t.attributes,n.name)&&e.removeAttribute(n.name);if(t.attributes)for(const n of Array.from(t.attributes))di(n.name,e,i)&&e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}function oi(t,e){const i=e.getAttribute("data-l10n-name"),n=t.querySelector(`[data-l10n-name="${i}"]`);if(!n)return console.warn(`An element named "${i}" wasn't found in the source.`),hi(e);if(n.localName!==e.localName)return console.warn(`An element named "${i}" was found in the translation but its type ${e.localName} didn't match the element found in the source (${n.localName}).`),hi(e);t.removeChild(n);return ui(e,n.cloneNode(!1))}function li(t){const e=t.ownerDocument.createElement(t.localName);return ui(t,e)}function hi(t){return t.ownerDocument.createTextNode(t.textContent)}function ci(t){const e=ii[t.namespaceURI];return e&&e.includes(t.localName)}function di(t,e,i=null){if(i&&i.includes(t))return!0;const n=ni[e.namespaceURI];if(!n)return!1;const r=t.toLowerCase(),s=e.localName;if(n.global.includes(r))return!0;
2if(!n[s])return!1;if(n[s].includes(r))return!0;if("http://www.w3.org/1999/xhtml"===e.namespaceURI&&"input"===s&&"value"===r){const t=e.type.toLowerCase();if("submit"===t||"button"===t||"reset"===t)return!0}return!1}function ui(t,e){return e.textContent=t.textContent,ai(t,e),e}class pi extends Array{static from(t){return t instanceof this?t:new this(t)}}Symbol.iterator;class gi extends pi{constructor(t){if(super(),Symbol.asyncIterator in Object(t))this.iterator=t[Symbol.asyncIterator]();else{if(!(Symbol.iterator in Object(t)))throw new TypeError("Argument must implement the iteration protocol.");this.iterator=t[Symbol.iterator]()}}[Symbol.asyncIterator](){const t=this;let e=0;return{next:async()=>(t.length<=e&&t.push(t.iterator.next()),t[e++])}}async touchNext(t=1){let e=0;for(;e++<t;){const t=this[this.length-1];if(t&&(await t).done)break;this.push(this.iterator.next())}return this[this.length-1]}}class fi{constructor(t=[],e){this.resourceIds=t,this.generateBundles=e,this.onChange(!0)}addResourceIds(t,e=!1){return this.resourceIds.push(...t),this.onChange(e),this.resourceIds.length}removeResourceIds(t){return this.resourceIds=this.resourceIds.filter(e=>!t.includes(e)),this.onChange(),this.resourceIds.length}async formatWithFallback(t,e){const i=[];let n=!1;for await(const r of this.bundles){n=!0;const s=vi(e,r,t,i);if(0===s.size)break;if("undefined"!=typeof console){const t=r.locales[0],e=Array.from(s).join(", ");console.warn(`[fluent] Missing translations in ${t}: ${e}`)}}return n||"undefined"==typeof console||console.warn(`[fluent] Request for keys failed because no resource bundles got generated.\n keys: ${JSON.stringify(t)}.\n resourceIds: ${JSON.stringify(this.resourceIds)}.`),i}formatMessages(t){return this.formatWithFallback(t,bi)}formatValues(t){return this.formatWithFallback(t,mi)}async formatValue(t,e){const[i]=await this.formatValues([{id:t,args:e}]);return i}handleEvent(){this.onChange()}onChange(t=!1){this.bundles=gi.from(this.generateBundles(this.resourceIds)),t&&this.bundles.touchNext(2)}}function mi(t,e,i,n){return i.value?t.formatPattern(i.value,n,e):null}function bi(t,e,i,n){const r={value:null,attributes:null};i.value&&(r.value=t.formatPattern(i.value,n,e));let s=Object.keys(i.attributes);if(s.length>0){r.attributes=new Array(s.length);for(let[a,o]of s.entries()){let s=t.formatPattern(i.attributes[o],n,e);r.attributes[a]={name:o,value:s}}}return r}function vi(t,e,i,n){const r=[],s=new Set;return i.forEach(({id:i,args:a},o)=>{if(void 0!==n[o])return;let l=e.getMessage(i);if(l){if(r.length=0,n[o]=t(e,r,l,a),r.length>0&&"undefined"!=typeof console){const t=e.locales[0],n=r.join(", ");console.warn(`[fluent][resolver] errors in ${t}/${i}: ${n}.`)}}else s.add(i)}),s}const yi="data-l10n-id",wi="data-l10n-args",Ai=`[${yi}]`;class xi extends fi{constructor(t,e){super(t,e),this.roots=new Set,this.pendingrAF=null,this.pendingElements=new Set,this.windowElement=null,this.mutationObserver=null,this.observerConfig={attributes:!0,characterData:!1,childList:!0,subtree:!0,attributeFilter:[yi,wi]}}onChange(t=!1){super.onChange(t),this.roots&&this.translateRoots()}setAttributes(t,e,i){return t.setAttribute(yi,e),i?t.setAttribute(wi,JSON.stringify(i)):t.removeAttribute(wi),t}getAttributes(t){return{id:t.getAttribute(yi),args:JSON.parse(t.getAttribute(wi)||null)}}connectRoot(t){for(const e of this.roots)if(e===t||e.contains(t)||t.contains(e))throw new Error("Cannot add a root that overlaps with existing root.");if(this.windowElement){if(this.windowElement!==t.ownerDocument.defaultView)throw new Error("Cannot connect a root:\n DOMLocalization already has a root from a different window.")}else this.windowElement=t.ownerDocument.defaultView,this.mutationObserver=new this.windowElement.MutationObserver(t=>this.translateMutations(t));this.roots.add(t),this.mutationObserver.observe(t,this.observerConfig)}disconnectRoot(t){return this.roots.delete(t),this.pauseObserving(),0===this.roots.size?(this.mutationObserver=null,this.windowElement&&this.pendingrAF&&this.windowElement.cancelAnimationFrame(this.pendingrAF),this.windowElement=null,this.pendingrAF=null,this.pendingElements.clear(),!0):(this.resumeObserving(),!1)}translateRoots(){const t=Array.from(this.roots);return Promise.all(t.map(t=>this.translateFragment(t)))}pauseObserving(){this.mutationObserver&&(this.translateMutations(this.mutationObserver.takeRecords()),this.mutationObserver.disconnect())}resumeObserving(){if(this.mutationObserver)for(const t of this.roots)this.mutationObserver.observe(t,this.observerConfig)}translateMutations(t){for(const e of t)switch(e.type){case"attributes":e.target.hasAttribute("data-l10n-id")&&this.pendingElements.add(e.target);break;case"childList":for(const t of e.addedNodes)if(t.nodeType===t.ELEMENT_NODE)if(t.childElementCount)for(const e of this.getTranslatables(t))this.pendingElements.add(e);else t.hasAttribute(yi)&&this.pendingElements.add(t)}this.pendingElements.size>0&&null===this.pendingrAF&&(this.pendingrAF=this.windowElement.requestAnimationFrame(()=>{this.translateElements(Array.from(this.pendingElements)),this.pendingElements.clear(),this.pendingrAF=null}))}translateFragment(t){return this.translateElements(this.getTranslatables(t))}async translateElements(t){if(!t.length)return;
2const e=t.map(this.getKeysForElement),i=await this.formatMessages(e);return this.applyTranslations(t,i)}applyTranslations(t,e){this.pauseObserving();for(let i=0;i<t.length;i++)void 0!==e[i]&&ri(t[i],e[i]);this.resumeObserving()}getTranslatables(t){const e=Array.from(t.querySelectorAll(Ai));return"function"==typeof t.hasAttribute&&t.hasAttribute(yi)&&e.push(t),e}getKeysForElement(t){return{id:t.getAttribute(yi),args:JSON.parse(t.getAttribute(wi)||null)}}}class Ei{#vc;#na;#Cr;#yc;constructor({lang:t,isRTL:e},i=null){this.#Cr=Ei.#wc(t),this.#yc=i,this.#vc=e??Ei.#Ac(this.#Cr)?"rtl":"ltr"}_setL10n(t){this.#yc=t}getLanguage(){return this.#Cr}getDirection(){return this.#vc}async get(t,e=null,i){if(Array.isArray(t)){t=t.map(t=>({id:t}));return(await this.#yc.formatMessages(t)).map(t=>t.value)}const n=await this.#yc.formatMessages([{id:t,args:e}]);return n[0]?.value||i}async translate(t){(this.#na||=new Set).add(t);try{this.#yc.connectRoot(t),await this.#yc.translateRoots()}catch{}}async translateOnce(t){try{await this.#yc.translateElements([t])}catch(t){console.error("translateOnce:",t)}}async destroy(){if(this.#na){for(const t of this.#na)this.#yc.disconnectRoot(t);this.#na.clear(),this.#na=null}this.#yc.pauseObserving()}pause(){this.#yc.pauseObserving()}resume(){this.#yc.resumeObserving()}static#wc(t){return{en:"en-us",es:"es-es",fy:"fy-nl",ga:"ga-ie",gu:"gu-in",hi:"hi-in",hy:"hy-am",nb:"nb-no",ne:"ne-np",nn:"nn-no",pa:"pa-in",pt:"pt-pt",sv:"sv-se",zh:"zh-cn"}[t=t?.toLowerCase()||"en-us"]||t}static#Ac(t){const e=t.split("-",1)[0];return["ar","he","fa","ps","ur"].includes(e)}}function Ci(){const{isAndroid:t,isLinux:e,isMac:i,isWindows:n}=A.platform;return e?"linux":n?"windows":i?"macos":t?"android":"other"}function Si(t,e){const i=new Ze(e),n=new Pe(t,{functions:{PLATFORM:Ci}}),r=n.addResource(i);return r.length&&console.error("L10n errors",r),n}class _i extends Ei{constructor(t){super({lang:t});const e=t?_i.#xc.bind(_i,"en-us",this.getLanguage()):_i.#Ec.bind(_i,this.getLanguage());this._setL10n(new xi([],e))}static async*#xc(t,e){const{baseURL:i,paths:n}=await this.#Cc(),r=[e];if(t!==e){const i=e.split("-",1)[0];i!==e&&r.push(i),r.push(t)}const s=r.map(t=>[t,this.#Sc(t,i,n)]);for(const[t,e]of s){const i=await e;i?yield i:"en-us"===t&&(yield this.#_c(t))}}static async#Sc(t,e,i){const n=i[t];if(!n)return null;const r=new URL(n,e);return Si(t,await x(r,"text"))}static async#Cc(){try{const{href:t}=document.querySelector('link[type="application/l10n"]'),e=await x(t,"json");return{baseURL:t.substring(0,t.lastIndexOf("/")+1)||"./",paths:e}}catch{}return{baseURL:"./",paths:Object.create(null)}}static async*#Ec(t){yield this.#_c(t)}static async#_c(t){return Si(t,'pdfjs-previous-button =\n .title = Previous Page\npdfjs-previous-button-label = Previous\npdfjs-next-button =\n .title = Next Page\npdfjs-next-button-label = Next\npdfjs-page-input =\n .title = Page\npdfjs-of-pages = of { $pagesCount }\npdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })\npdfjs-zoom-out-button =\n .title = Zoom Out\npdfjs-zoom-out-button-label = Zoom Out\npdfjs-zoom-in-button =\n .title = Zoom In\npdfjs-zoom-in-button-label = Zoom In\npdfjs-zoom-select =\n .title = Zoom\npdfjs-presentation-mode-button =\n .title = Switch to Presentation Mode\npdfjs-presentation-mode-button-label = Presentation Mode\npdfjs-open-file-button =\n .title = Open File\npdfjs-open-file-button-label = Open\npdfjs-print-button =\n .title = Print\npdfjs-print-button-label = Print\npdfjs-save-button =\n .title = Save\npdfjs-save-button-label = Save\npdfjs-download-button =\n .title = Download\npdfjs-download-button-label = Download\npdfjs-bookmark-button =\n .title = Current Page (View URL from Current Page)\npdfjs-bookmark-button-label = Current Page\npdfjs-tools-button =\n .title = Tools\npdfjs-tools-button-label = Tools\npdfjs-first-page-button =\n .title = Go to First Page\npdfjs-first-page-button-label = Go to First Page\npdfjs-last-page-button =\n .title = Go to Last Page\npdfjs-last-page-button-label = Go to Last Page\npdfjs-page-rotate-cw-button =\n .title = Rotate Clockwise\npdfjs-page-rotate-cw-button-label = Rotate Clockwise\npdfjs-page-rotate-ccw-button =\n .title = Rotate Counterclockwise\npdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise\npdfjs-cursor-text-select-tool-button =\n .title = Enable Text Selection Tool\npdfjs-cursor-text-select-tool-button-label = Text Selection Tool\npdfjs-cursor-hand-tool-button =\n .title = Enable Hand Tool\npdfjs-cursor-hand-tool-button-label = Hand Tool\npdfjs-scroll-page-button =\n .title = Use Page Scrolling\npdfjs-scroll-page-button-label = Page Scrolling\npdfjs-scroll-vertical-button =\n .title = Use Vertical Scrolling\npdfjs-scroll-vertical-button-label = Vertical Scrolling\npdfjs-scroll-horizontal-button =\n .title = Use Horizontal Scrolling\npdfjs-scroll-horizontal-button-label = Horizontal Scrolling\npdfjs-scroll-wrapped-button =\n .title = Use Wrapped Scrolling\npdfjs-scroll-wrapped-button-label = Wrapped Scrolling\npdfjs-spread-none-button =\n .title = Do not join page spreads\npdfjs-spread-none-button-label = No Spreads\npdfjs-spread-odd-button =\n .title = Join page spreads starting with odd-numbered pages\npdfjs-spread-odd-button-label = Odd Spreads\npdfjs-spread-even-button =\n .title = Join page spreads starting with even-numbered pages\npdfjs-spread-even-button-label = Even Spreads\npdfjs-document-properties-button =\n .title = Document Propertiesâ¦\npdfjs-document-properties-button-label = Document Propertiesâ¦\npdfjs-document-properties-file-name = File name:\npdfjs-document-properties-file-size = File size:\npdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes)\npdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes)\npdfjs-document-properties-title = Title:\npdfjs-document-properties-author = Author:\npdfjs-document-properties-subject = Subject:\npdfjs-document-properties-keywords = Keywords:\npdfjs-document-properties-creation-date = Creation Date:\npdfjs-document-properties-modification-date = Modification Date:\npdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }\npdfjs-document-properties-creator = Creator:\npdfjs-document-properties-producer = PDF Producer:\npdfjs-document-properties-version = PDF Version:\npdfjs-document-properties-page-count = Page Count:\npdfjs-document-properties-page-size = Page Size:\npdfjs-document-properties-page-size-unit-inches = in\npdfjs-document-properties-page-size-unit-millimeters = mm\npdfjs-document-properties-page-size-orientation-portrait = portrait\npdfjs-document-properties-page-size-orientation-landscape = landscape\npdfjs-document-properties-page-size-name-a-three = A3\npdfjs-document-properties-page-size-name-a-four = A4\npdfjs-document-properties-page-size-name-letter = Letter\npdfjs-document-properties-page-size-name-legal = Legal\npdfjs-document-properties-page-size-dimension-string = { $width } à { $height } { $unit } ({ $orientation })\npdfjs-document-properties-page-size-dimension-name-string = { $width } à { $height } { $unit } ({ $name }, { $orientation })\npdfjs-document-properties-linearized = Fast Web View:\npdfjs-document-properties-linearized-yes = Yes\npdfjs-document-properties-linearized-no = No\npdfjs-document-properties-close-button = Close\npdfjs-print-progress-message = Preparing document for printingâ¦\npdfjs-print-progress-percent = { $progress }%\npdfjs-print-progress-close-button = Cancel\npdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.\npdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.\npdfjs-current-outline-item-button =\n .title = Find Current Outline Item\npdfjs-current-outline-item-button-label = Current Outline Item\npdfjs-findbar-button =\n .title = Find in Document\npdfjs-findbar-button-label = Find\npdfjs-additional-layers = Additional Layers\npdfjs-thumb-page-title =\n .title = Page { $page }\npdfjs-thumb-page-canvas =\n .aria-label = Thumbnail of Page { $page }\npdfjs-find-input =\n .title = Find\n .placeholder = Find in documentâ¦\npdfjs-find-previous-button =\n .title = Find the previous occurrence of the phrase\npdfjs-find-previous-button-label = Previous\npdfjs-find-next-button =\n .title = Find the next occurrence of the phrase\npdfjs-find-next-button-label = Next\npdfjs-find-highlight-checkbox = Highlight All\npdfjs-find-match-case-checkbox-label = Match Case\npdfjs-find-match-diacritics-checkbox-label = Match Diacritics\npdfjs-find-entire-word-checkbox-label = Whole Words\npdfjs-find-reached-top = Reached top of document, continued from bottom\npdfjs-find-reached-bottom = Reached end of document, continued from top\npdfjs-find-match-count =\n { $total ->\n [one] { $current } of { $total } match\n *[other] { $current } of { $total } matches\n }\npdfjs-find-match-count-limit =\n { $limit ->\n [one] More than { $limit } match\n *[other] More than { $limit } matches\n }\npdfjs-find-not-found = Phrase not found\npdfjs-page-scale-width = Page Width\npdfjs-page-scale-fit = Page Fit\npdfjs-page-scale-auto = Automatic Zoom\npdfjs-page-scale-actual = Actual Size\npdfjs-page-scale-percent = { $scale }%\npdfjs-page-landmark =\n .aria-label = Page { $page }\npdfjs-loading-error = An error occurred while loading the PDF.\npdfjs-invalid-file-error = Invalid or corrupted PDF file.\npdfjs-missing-file-error = Missing PDF file.\npdfjs-unexpected-response-error = Unexpected server response.\npdfjs-rendering-error = An error occurred while rendering the page.\npdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }\npdfjs-text-annotation-type =\n .alt = [{ $type } Annotation]\npdfjs-password-label = Enter the password to open this PDF file.\npdfjs-password-invalid = Invalid password. Please try again.\npdfjs-password-ok-button = OK\npdfjs-password-cancel-button = Cancel\npdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.\npdfjs-editor-free-text-button =\n .title = Text\npdfjs-editor-color-picker-free-text-input =\n .title = Change text color\npdfjs-editor-free-text-button-label = Text\npdfjs-editor-ink-button =\n .title = Draw\npdfjs-editor-color-picker-ink-input =\n .title = Change drawing color\npdfjs-editor-ink-button-label = Draw\npdfjs-editor-stamp-button =\n .title = Add or edit images\npdfjs-editor-stamp-button-label = Add or edit images\npdfjs-editor-highlight-button =\n .title = Highlight\npdfjs-editor-highlight-button-label = Highlight\npdfjs-highlight-floating-button1 =\n .title = Highlight\n .aria-label = Highlight\npdfjs-highlight-floating-button-label = Highlight\npdfjs-comment-floating-button =\n .title = Comment\n .aria-label = Comment\npdfjs-comment-floating-button-label = Comment\npdfjs-editor-comment-button =\n .title = Comment\n .aria-label = Comment\npdfjs-editor-comment-button-label = Comment\npdfjs-editor-signature-button =\n .title = Add signature\npdfjs-editor-signature-button-label = Add signature\npdfjs-editor-highlight-editor =\n .aria-label = Highlight editor\npdfjs-editor-ink-editor =\n .aria-label = Drawing editor\npdfjs-editor-signature-editor1 =\n .aria-description = Signature editor: { $description }\npdfjs-editor-stamp-editor =\n .aria-label = Image editor\npdfjs-editor-remove-ink-button =\n .title = Remove drawing\npdfjs-editor-remove-freetext-button =\n .title = Remove text\npdfjs-editor-remove-stamp-button =\n .title = Remove image\npdfjs-editor-remove-highlight-button =\n .title = Remove highlight\npdfjs-editor-remove-signature-button =\n .title = Remove signature\npdfjs-editor-free-text-color-input = Color\npdfjs-editor-free-text-size-input = Size\npdfjs-editor-ink-color-input = Color\npdfjs-editor-ink-thickness-input = Thickness\npdfjs-editor-ink-opacity-input = Opacity\npdfjs-editor-stamp-add-image-button =\n .title = Add image\npdfjs-editor-stamp-add-image-button-label = Add image\npdfjs-editor-free-highlight-thickness-input = Thickness\npdfjs-editor-free-highlight-thickness-title =\n .title = Change thickness when highlighting items other than text\npdfjs-editor-add-signature-container =\n .aria-label = Signature controls and saved signatures\npdfjs-editor-signature-add-signature-button =\n .title = Add new signature\npdfjs-editor-signature-add-signature-button-label = Add new signature\npdfjs-editor-add-saved-signature-button =\n .title = Saved signature: { $description }\npdfjs-free-text2 =\n .aria-label = Text Editor\n .default-content = Start t
2ypingâ¦\npdfjs-editor-comments-sidebar-title =\n { $count ->\n [one] Comment\n *[other] Comments\n }\npdfjs-editor-comments-sidebar-close-button =\n .title = Close the sidebar\n .aria-label = Close the sidebar\npdfjs-editor-comments-sidebar-close-button-label = Close the sidebar\npdfjs-editor-comments-sidebar-no-comments1 = See something noteworthy? Highlight it and leave a comment.\npdfjs-editor-comments-sidebar-no-comments-link = Learn more\npdfjs-editor-alt-text-button =\n .aria-label = Alt text\npdfjs-editor-alt-text-button-label = Alt text\npdfjs-editor-alt-text-edit-button =\n .aria-label = Edit alt text\npdfjs-editor-alt-text-dialog-label = Choose an option\npdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people canât see the image or when it doesnât load.\npdfjs-editor-alt-text-add-description-label = Add a description\npdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.\npdfjs-editor-alt-text-mark-decorative-label = Mark as decorative\npdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.\npdfjs-editor-alt-text-cancel-button = Cancel\npdfjs-editor-alt-text-save-button = Save\npdfjs-editor-alt-text-decorative-tooltip = Marked as decorative\npdfjs-editor-alt-text-textarea =\n .placeholder = For example, âA young man sits down at a table to eat a mealâ\npdfjs-editor-resizer-top-left =\n .aria-label = Top left corner â resize\npdfjs-editor-resizer-top-middle =\n .aria-label = Top middle â resize\npdfjs-editor-resizer-top-right =\n .aria-label = Top right corner â resize\npdfjs-editor-resizer-middle-right =\n .aria-label = Middle right â resize\npdfjs-editor-resizer-bottom-right =\n .aria-label = Bottom right corner â resize\npdfjs-editor-resizer-bottom-middle =\n .aria-label = Bottom middle â resize\npdfjs-editor-resizer-bottom-left =\n .aria-label = Bottom left corner â resize\npdfjs-editor-resizer-middle-left =\n .aria-label = Middle left â resize\npdfjs-editor-highlight-colorpicker-label = Highlight color\npdfjs-editor-colorpicker-button =\n .title = Change color\npdfjs-editor-colorpicker-dropdown =\n .aria-label = Color choices\npdfjs-editor-colorpicker-yellow =\n .title = Yellow\npdfjs-editor-colorpicker-green =\n .title = Green\npdfjs-editor-colorpicker-blue =\n .title = Blue\npdfjs-editor-colorpicker-pink =\n .title = Pink\npdfjs-editor-colorpicker-red =\n .title = Red\npdfjs-editor-highlight-show-all-button-label = Show all\npdfjs-editor-highlight-show-all-button =\n .title = Show all\npdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description)\npdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description)\npdfjs-editor-new-alt-text-textarea =\n .placeholder = Write your description hereâ¦\npdfjs-editor-new-alt-text-description = Short description for people who canât see the image or when the image doesnât load.\npdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate.\npdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more\npdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically\npdfjs-editor-new-alt-text-not-now-button = Not now\npdfjs-editor-new-alt-text-error-title = Couldnât create alt text automatically\npdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later.\npdfjs-editor-new-alt-text-error-close-button = Close\npdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\n .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\npdfjs-editor-new-alt-text-added-button =\n .aria-label = Alt text added\npdfjs-editor-new-alt-text-added-button-label = Alt text added\npdfjs-editor-new-alt-text-missing-button =\n .aria-label = Missing alt text\npdfjs-editor-new-alt-text-missing-button-label = Missing alt text\npdfjs-editor-new-alt-text-to-review-button =\n .aria-label = Review alt text\npdfjs-editor-new-alt-text-to-review-button-label = Review alt text\npdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText }\npdfjs-image-alt-text-settings-button =\n .title = Image alt text settings\npdfjs-image-alt-text-settings-button-label = Image alt text settings\npdfjs-editor-alt-text-settings-dialog-label = Image alt text settings\npdfjs-editor-alt-text-settings-automatic-title = Automatic alt text\npdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically\npdfjs-editor-alt-text-settings-create-model-description = Suggests descriptions to help people who canât see the image or when the image doesnât load.\npdfjs-editor-alt-text-settings-download-model-label = Alt text AI model ({ $totalSize } MB)\npdfjs-editor-alt-text-settings-ai-model-description = Runs locally on your device so your data stays private. Required for automatic alt text.\npdfjs-editor-alt-text-settings-delete-model-button = Delete\npdfjs-editor-alt-text-settings-download-model-button = Download\npdfjs-editor-alt-text-settings-downloading-model-button = Downloadingâ¦\npdfjs-editor-alt-text-settings-editor-title = Alt text editor\npdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image\npdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text.\npdfjs-editor-alt-text-settings-close-button = Close\npdfjs-editor-highlight-added-alert = Highlight added\npdfjs-editor-freetext-added-alert = Text added\npdfjs-editor-ink-added-alert = Drawing added\npdfjs-editor-stamp-added-alert = Image added\npdfjs-editor-signature-added-alert = Signature added\npdfjs-editor-undo-bar-message-highlight = Highlight removed\npdfjs-editor-undo-bar-message-freetext = Text removed\npdfjs-editor-undo-bar-message-ink = Drawing removed\npdfjs-editor-undo-bar-message-stamp = Image removed\npdfjs-editor-undo-bar-message-signature = Signature removed\npdfjs-editor-undo-bar-message-comment = Comment removed\npdfjs-editor-undo-bar-message-multiple =\n { $count ->\n [one] { $count } annotation removed\n *[other] { $count } annotations removed\n }\npdfjs-editor-undo-bar-undo-button =\n .title = Undo\npdfjs-editor-undo-bar-undo-button-label = Undo\npdfjs-editor-undo-bar-close-button =\n .title = Close\npdfjs-editor-undo-bar-close-button-label = Close\npdfjs-editor-add-signature-dialog-label = This modal allows the user to create a signature to add to a PDF document. The user can edit the name (which also serves as the alt text), and optionally save the signature for repeated use.\npdfjs-editor-add-signature-dialog-title = Add a signature\npdfjs-editor-add-signature-type-button = Type\n .title = Type\npdfjs-editor-add-signature-draw-button = Draw\n .title = Draw\npdfjs-editor-add-signature-image-button = Image\n .title = Image\npdfjs-editor-add-signature-type-input =\n .aria-label = Type your signature\n .placeholder = Type your signature\npdfjs-editor-add-signature-draw-placeholder = Draw your signature\npdfjs-editor-add-signature-draw-thickness-range-label = Thickness\npdfjs-editor-add-signature-draw-thickness-range =\n .title = Drawing thickness: { $thickness }\npdfjs-editor-add-signature-image-placeholder = Drag a file here to upload\npdfjs-editor-add-signature-image-browse-link =\n { PLATFORM() ->\n [macos] Or choose image files\n *[other] Or browse image files\n }\npdfjs-editor-add-signature-description-label = Description (alt text)\npdfjs-editor-add-signature-description-input =\n .title = Description (alt text)\npdfjs-editor-add-signature-description-default-when-drawing = Signature\npdfjs-editor-add-signature-clear-button-label = Clear signature\npdfjs-editor-add-signature-clear-button =\n .title = Clear signature\npdfjs-editor-add-signature-save-checkbox = Save signature\npdfjs-editor-add-signature-save-warning-message = Youâve reached the limit of 5 saved signatures. Remove one to save more.\npdfjs-editor-add-signature-image-upload-error-title = Couldnât upload image\npdfjs-editor-add-signature-image-upload-error-description = Check your network connection or try another image.\npdfjs-editor-add-signature-image-no-data-error-title = Canât convert this image into a signature\npdfjs-editor-add-signature-image-no-data-error-description = Please try uploading a different image.\npdfjs-editor-add-signature-error-close-button = Close\npdfjs-editor-add-signature-cancel-button = Cancel\npdfjs-editor-add-signature-add-button = Add\npdfjs-editor-delete-signature-button1 =\n .title = Remove saved signature\npdfjs-editor-delete-signature-button-label1 = Remove saved signature\npdfjs-editor-add-signature-edit-button-label = Edit description\npdfjs-editor-edit-signature-dialog-title = Edit description\npdfjs-editor-edit-signature-update-button = Update\npdfjs-show-comment-button =\n .title = Show comment\npdfjs-editor-edit-comment-popup-button-label = Edit comment\npdfjs-editor-edit-comment-popup-button =\n .title = Edit comment\npdfjs-editor-delete-comment-popup-button-label = Remove c
2omment\npdfjs-editor-delete-comment-popup-button =\n .title = Remove comment\npdfjs-editor-edit-comment-dialog-title-when-editing = Edit comment\npdfjs-editor-edit-comment-dialog-save-button-when-editing = Update\npdfjs-editor-edit-comment-dialog-title-when-adding = Add comment\npdfjs-editor-edit-comment-dialog-save-button-when-adding = Add\npdfjs-editor-edit-comment-dialog-text-input =\n .placeholder = Start typingâ¦\npdfjs-editor-edit-comment-dialog-cancel-button = Cancel\npdfjs-editor-add-comment-button =\n .title = Add comment\npdfjs-toggle-views-manager-button =\n .title = Toggle Sidebar\npdfjs-toggle-views-manager-notification-button =\n .title = Toggle Sidebar (document contains thumbnails/outline/attachments/layers)\npdfjs-toggle-views-manager-button-label = Toggle Sidebar\npdfjs-views-manager-sidebar =\n .aria-label = Sidebar\npdfjs-views-manager-view-selector-button =\n .title = Views\npdfjs-views-manager-view-selector-button-label = Views\npdfjs-views-manager-pages-title = Pages\npdfjs-views-manager-outlines-title = Document outline\npdfjs-views-manager-attachments-title = Attachments\npdfjs-views-manager-layers-title = Layers\npdfjs-views-manager-pages-option-label = Pages\npdfjs-views-manager-outlines-option-label = Document outline\npdfjs-views-manager-attachments-option-label = Attachments\npdfjs-views-manager-layers-option-label = Layers\npdfjs-views-manager-add-file-button =\n .title = Add f
2ile\npdfjs-views-manager-add-file-button-label = Add file\npdfjs-views-manager-pages-status-action-label =\n { $count ->\n [one] { $count } selected\n *[other] { $count } selected\n }\npdfjs-views-manager-pages-status-none-action-label = Select pages\npdfjs-views-manager-pages-status-action-button-label = Manage\npdfjs-views-manager-pages-status-copy-button-label = Copy\npdfjs-views-manager-pages-status-cut-button-label = Cut\npdfjs-views-manager-pages-status-delete-button-label = Delete\npdfjs-views-manager-pages-status-save-as-button-label = Save asâ¦\npdfjs-views-manager-status-undo-cut-label =\n { $count ->\n [one] 1 page cut\n *[other] { $count } pages cut\n }\npdfjs-views-manager-pages-status-undo-copy-label =\n { $count ->\n [one] 1 page copied\n *[other] { $count } pages copied\n }\npdfjs-views-manager-pages-status-undo-delete-label =\n { $count ->\n [one] 1 page deleted\n *[other] { $count } pages deleted\n }\npdfjs-views-manager-pages-status-waiting-ready-label = Getting your file readyâ¦\npdfjs-views-manager-pages-status-waiting-uploading-label = Uploading fileâ¦\npdfjs-views-manager-status-warning-cut-label = Couldnât cut. Refresh page and try again.\npdfjs-views-manager-status-warning-copy-label = Couldnât copy. Refresh page and try again.\npdfjs-views-manager-status-warning-delete-label = Couldnât delete. Refresh page and try again.\npdfjs-views-manager-status-warning-save-label = Couldnât save. Refresh page and try again.\npdfjs-views-manager-status-undo-button-label = Undo\npdfjs-views-manager-status-close-button =\n .title = Close\npdfjs-views-manager-status-close-button-label = Close')}}function Ti(){return document.location.hash}class Pi{#uc=null;constructor({linkService:t,eventBus:e}){this.linkService=t,this.eventBus=e,this._initialized=!1,this._fingerprint="",this.reset(),this.eventBus._on("pagesinit",()=>{this._isPagesLoaded=!1,this.eventBus._on("pagesloaded",t=>{this._isPagesLoaded=!!t.pagesCount},{once:!0})})}initialize({fingerprint:t,resetHistory:e=!1,updateUrl:i=!1}){if(!t||"string"!=typeof t)return void console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');this._initialized&&this.reset();const n=""!==this._fingerprint&&this._fingerprint!==t;this._fingerprint=t,this._updateUrl=!0===i,this._initialized=!0,this.#Tc();const r=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=Ti(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!this.#Pc(r,!0)||e){const{hash:t,page:i,rotation:r}=this.#Dc(!0);return!t||n||e?void this.#Mc(null,!0):void this.#Mc({hash:t,page:i,rotation:r},!0)}const s=r.destination;this.#Fc(s,r.uid,!0),void 0!==s.rotation&&(this._initialRotation=s.rotation),s.dest?(this._initialBookmark=JSON.stringify(s.dest),this._destination.page=null):s.hash?this._initialBookmark=s.hash:s.page&&(this._initialBookmark=`page=${s.page}`)}reset(){this._initialized&&(this.#Ic(),this._initialized=!1,this.#kc()),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:t=null,explicitDest:e,pageNumber:i}){if(!this._initialized)return;if(t&&"string"!=typeof t)return void console.error(`PDFHistory.push: "${t}" is not a valid namedDest parameter.`);if(!Array.isArray(e))return void console.error(`PDFHistory.push: "${e}" is not a valid explicitDest parameter.`);if(!this.#Lc(i)&&(null!==i||this._destination))return void console.error(`PDFHistory.push: "${i}" is not a valid pageNumber parameter.`);const n=t||JSON.stringify(e);if(!n)return;let r=!1;if(this._destination&&(function(t,e){if("string"!=typeof t||"string"!=typeof e)return!1;if(t===e)return!0;if(wt(t).get("nameddest")===e)return!0;return!1}(this._destination.hash,n)||function(t,e){function i(t,e){if(typeof t!=typeof e)return!1;if(Array.isArray(t)||Array.isArray(e))return!1;if(null!==t&&"object"==typeof t&&null!==e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(!i(t[n],e[n]))return!1;return!0}return t===e||Number.isNaN(t)&&Number.isNaN(e)}if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(!i(t[n],e[n]))return!1;return!0}
2(this._destination.dest,e))){if(this._destination.page)return;r=!0}this._popStateInProgress&&!r||(this.#Mc({dest:e,hash:n,page:i,rotation:this.linkService.rotation},r),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))}pushPage(t){this._initialized&&(this.#Lc(t)?this._destination?.page!==t&&(this._popStateInProgress||(this.#Mc({dest:null,hash:`page=${t}`,page:t,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))):console.error(`PDFHistory.pushPage: "${t}" is not a valid page number.`))}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&this.#Rc()}back(){if(!this._initialized||this._popStateInProgress)return;const t=window.history.state;this.#Pc(t)&&t.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const t=window.history.state;this.#Pc(t)&&t.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}#Mc(t,e=!1){const i=e||!this._destination,n={fingerprint:this._fingerprint,uid:i?this._uid:this._uid+1,destination:t};let r;if(this.#Fc(t,n.uid),this._updateUrl&&t?.hash){const{href:e,protocol:i}=document.location;"file:"!==i&&(r=rt(e,t.hash))}i?window.history.replaceState(n,"",r):window.history.pushState(n,"",r)}#Rc(t=!1){if(!this._position)return;let e=this._position;if(t&&(e=Object.assign(Object.create(null),this._position),e.temporary=!0),!this._destination)return void this.#Mc(e);if(this._destination.temporary)return void this.#Mc(e,!0);if(this._destination.hash===e.hash)return;if(!this._destination.page&&this._numPositionUpdates<=50)return;let i=!1;if(this._destination.page>=e.first&&this._destination.page<=e.page){if(void 0!==this._destination.dest||!this._destination.first)return;i=!0}this.#Mc(e,i)}#Lc(t){return Number.isInteger(t)&&t>0&&t<=this.linkService.pagesCount}#Pc(t,e=!1){if(!t)return!1;if(t.fingerprint!==this._fingerprint){if(!e)return!1;{if("string"!=typeof t.fingerprint||t.fingerprint.length!==this._fingerprint.length)return!1;const[e]=performance.getEntriesByType("navigation");if("reload"!==e?.type)return!1}}return!(!Number.isInteger(t.uid)||t.uid<0)&&(null!==t.destination&&"object"==typeof t.destination)}#Fc(t,e,i=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),i&&t?.temporary&&delete t.temporary,this._destination=t,this._uid=e,this._maxUid=Math.max(this._maxUid,e),this._numPositionUpdates=0}#Dc(t=!1){const e=unescape(Ti()).substring(1),i=wt(e),n=i.get("nameddest")||"";let r=0|i.get("page");return(!this.#Lc(r)||t&&n.length>0)&&(r=null),{hash:e,page:r,rotation:this.linkService.rotation}}#Bc({location:t}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:t.pdfOpenParams.substring(1),page:this.linkService.page,first:t.pageNumber,rotation:t.rotation},this._popStateInProgress||(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout(()=>{this._popStateInProgress||this.#Rc(!0),this._updateViewareaTimeout=null},1e3))}#Nc({state:t}){const e=Ti(),i=this._currentHash!==e;if(this._currentHash=e,!t){this._uid++;const{hash:t,page:e,rotation:i}=this.#Dc();return void this.#Mc({hash:t,page:e,rotation:i},!0)}if(!this.#Pc(t))return;this._popStateInProgress=!0,i&&(this._blockHashChange++,async function({target:t,name:e,delay:i=0}){if("object"!=typeof t||!e||"string"!=typeof e||!(Number.isInteger(i)&&i>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");const{promise:n,resolve:r}=Promise.withResolvers(),s=new AbortController;function a(t){s.abort(),clearTimeout(o),r(t)}t[t instanceof ce?"_on":"addEventListener"](e,a.bind(null,le),{signal:s.signal});const o=setTimeout(a.bind(null,he),i);return n}({target:window,name:"hashchange",delay:1e3}).then(()=>{this._blockHashChange--}));const n=t.destination;this.#Fc(n,t.uid,!0),_t(n.rotation)&&(this.linkService.rotation=n.rotation),n.dest?this.linkService.goToDestination(n.dest):n.hash?this.linkService.setHash(n.hash):n.page&&(this.linkService.page=n.page),Promise.resolve().then(()=>{this._popStateInProgress=!1})}#Ic(){this._destination&&!this._destination.temporary||this.#Rc()}#Tc(){if(this.#uc)return;this.#uc=new AbortController;const{signal:t}=this.#uc;this.eventBus._on("updateviewarea",this.#Bc.bind(this),{signal:t}),window.addEventListener("popstate",this.#Nc.bind(this),{signal:t}),window.addEventListener("pagehide",this.#Ic.bind(this),{signal:t})}#kc(){this.#uc?.abort(),this.#uc=null}}class Di{#uh=null;#Oc=null;#dc=null;#Na=null;#Ah=null;#C;constructor(t){this.pdfPage=t.pdfPage,this.accessibilityManager=t.accessibilityManager,this.l10n=t.l10n,this.l10n||=new _i,this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,this.#C=t.uiManager,this.#uh=t.annotationLayer||null,this.#Ah=t.textLayer||null,this.#Oc=t.drawLayer||null,this.#dc=t.onAppend||null,this.#Na=t.structTreeLayer||null}async render({viewport:t,intent:e="display"}){if("display"!==e)return;if(this._cancelled)return;const i=t.clone({dontFlip:!0});if(this.div)return this.annotationEditorLayer.update({viewport:i}),void this.show();const n=this.div=document.createElement("div");n.className="annotationEditorLayer",n.hidden=!0,n.dir=this.#C.direction,this.#dc?.(n),this.annotationEditorLayer=new o({uiManager:this.#C,div:n,structTreeLayer:this.#Na,accessibilityManager:this.accessibilityManager,pageIndex:this.pdfPage.pageNumber-1,l10n:this.l10n,viewport:i,annotationLayer:this.#uh,textLayer:this.#Ah,drawLayer:this.#Oc});const r={viewport:i,div:n,annotations:null,intent:e};this.annotationEditorLayer.render(r),this.show()}cancel(){this._cancelled=!0,this.div&&this.annotationEditorLayer.destroy()}hide(){this.div&&(this.annotationEditorLayer.pause(!0),this.div.hidden=!0)}show(){this.div&&!this.annotationEditorLayer.isInvisible&&(this.div.hidden=!1,this.annotationEditorLayer.pause(!1))}}{var Mi=new Map;const{maxTouchPoints:t,platform:e,userAgent:i}=navigator,n=/Android/.test(i);(/\b(iPad|iPhone|iPod)(?=;)/.test(i)||"MacIntel"===e&&t>1||n)&&Mi.set("maxCanvasPixels",5242880),n&&Mi.set("useSystemFonts",!1)}const Fi=1,Ii=2,ki=4,Li=8,Ri=16,Bi=128,Ni={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},Oi={allowedGlobalEvents:{value:null,kind:Fi},canvasMaxAreaInBytes:{value:-1,kind:Fi+ki},isInAutomation:{value:!1,kind:Fi},localeProperties:{value:{lang:navigator.language||"en-US"},kind:Fi},maxCanvasDim:{value:32767,kind:Fi+Ii},nimbusDataStr:{value:"",kind:Fi},supportsCaretBrowsingMode:{value:!1,kind:Fi},supportsDocumentFonts:{value:!0,kind:Fi},supportsIntegratedFind:{value:!1,kind:Fi}
2,supportsMouseWheelZoomCtrlKey:{value:!0,kind:Fi},supportsMouseWheelZoomMetaKey:{value:!0,kind:Fi},supportsPinchToZoom:{value:!0,kind:Fi},supportsPrinting:{value:!0,kind:Fi},toolbarDensity:{value:0,kind:Fi+Ri},altTextLearnMoreUrl:{value:"",kind:Ii+Bi},annotationEditorMode:{value:0,kind:Ii+Bi},annotationMode:{value:2,kind:Ii+Bi},capCanvasAreaFactor:{value:200,kind:Ii+Bi},commentLearnMoreUrl:{value:"",kind:Ii+Bi},cursorToolOnLoad:{value:0,kind:Ii+Bi},debuggerSrc:{value:"./debugger.mjs",kind:Ii},defaultZoomDelay:{value:400,kind:Ii+Bi},defaultZoomValue:{value:"",kind:Ii+Bi},disableHistory:{value:!1,kind:Ii},disablePageLabels:{value:!1,kind:Ii+Bi},enableAltText:{value:!1,kind:Ii+Bi},enableAltTextModelDownload:{value:!0,kind:Ii+Bi+Ri},enableAutoLinking:{value:!0,kind:Ii+Bi},enableComment:{value:!1,kind:Ii+Bi},enableDetailCanvas:{value:!0,kind:Ii},enableGuessAltText:{value:!0,kind:Ii+Bi+Ri},enableHighlightFloatingButton:{value:!1,kind:Ii+Bi},enableNewAltTextWhenAddingImage:{value:!0,kind:Ii+Bi},enableOptimizedPartialRendering:{value:!1,kind:Ii+Bi},enablePermissions:{value:!1,kind:Ii+Bi},enablePrintAutoRotate:{value:!0,kind:Ii+Bi},enableScripting:{value:!0,kind:Ii+Bi},enableSignatureEditor:{value:!1,kind:Ii+Bi},enableSplitMerge:{value:!1,kind:Ii+Bi},enableUpdatedAddImage:{value:!1,kind:Ii+Bi},externalLinkRel:{value:"noopener noreferrer nofollow",kind:Ii},externalLinkTarget:{value:0,kind:Ii+Bi},highlightEditorColors:{value:"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F,yellow_HCM=#FFFFCC,green_HCM=#53FFBC,blue_HCM=#80EBFF,pink_HCM=#F6B8FF,red_HCM=#C50043",kind:Ii+Bi},historyUpdateUrl:{value:!1,kind:Ii+Bi},ignoreDestinationZoom:{value:!1,kind:Ii+Bi},imageResourcesPath:{value:"./images/",kind:Ii},maxCanvasPixels:{value:2**25,kind:Ii},minDurationToUpdateCanvas:{value:500,kind:Ii},forcePageColors:{value:!1,kind:Ii+Bi},pageColorsBackground:{value:"Canvas",kind:Ii+Bi},pageColorsForeground:{value:"CanvasText",kind:Ii+Bi},pdfBugEnabled:{value:!1,kind:Ii+Bi},printResolution:{value:150,kind:Ii},sidebarViewOnLoad:{value:-1,kind:Ii+Bi},scrollModeOnLoad:{value:-1,kind:Ii+Bi},spreadModeOnLoad:{value:-1,kind:Ii+Bi},textLayerMode:{value:1,kind:Ii+Bi},viewerCssTheme:{value:0,kind:Ii+Bi},viewOnLoad:{value:0,kind:Ii+Bi},cMapPacked:{value:!0,kind:ki},cMapUrl:{value:"../web/cmaps/",kind:ki},disableAutoFetch:{value:!1,kind:ki+Bi},disableFontFace:{value:!1,kind:ki+Bi},disableRange:{value:!1,kind:ki+Bi},disableStream:{value:!1,kind:ki+Bi},docBaseUrl:{value:"",kind:ki},enableHWA:{value:!0,kind:ki+Ii+Bi},enableXfa:{value:!0,kind:ki+Bi},fontExtraProperties:{value:!1,kind:ki},iccUrl:{value:"../web/iccs/",kind:ki},isEvalSupported:{value:!0,kind:ki},isOffscreenCanvasSupported:{value:!0,kind:ki},maxImageSize:{value:-1,kind:ki},pdfBug:{value:!1,kind:ki},standardFontDataUrl:{value:"../web/standard_fonts/",kind:ki},useSystemFonts:{value:void 0,kind:ki,type:Ni.BOOLEAN+Ni.UNDEFINED},verbosity:{value:1,kind:ki},wasmUrl:{value:"../web/wasm/",kind:ki},workerPort:{value:null,kind:Li},workerSrc:{value:"../build/pdf.worker.mjs",kind:Li}};Oi.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:Ii},Oi.sandboxBundleSrc={value:"../build/pdf.sandbox.mjs",kind:Ii},Oi.enableFakeMLManager={value:!0,kind:Ii},Oi.disablePreferences={value:!1,kind:Ii};class ji{static eventBus;static#jc=new Map;static{for(const t in Oi)this.#jc.set(t,Oi[t].value);for(const[t,e]of Mi)this.#jc.set(t,e);this._hasInvokedSet=!1,this._checkDisablePreferences=()=>!!this.get("disablePreferences")||(this._hasInvokedSet&&console.warn('The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.'),!1)}static get(t){return this.#jc.get(t)}static getAll(t=null,e=!1){const i=Object.create(null);for(const n in Oi){const r=Oi[n];(!t||t&r.kind)&&(i[n]=e?r.value:this.#jc.get(n))}return i}static set(t,e){this.setAll({[t]:e})}static setAll(t,e=!1){let i;this._hasInvokedSet||=!0;for(const n in t){const r=Oi[n],s=t[n];if(!r||!(typeof s==typeof r.value||Ni[(typeof s).toUpperCase()]&r.type))continue;const{kind:a}=r;(!e||a&Fi||a&Bi)&&(this.eventBus&&a&Ri&&(i||=new Map).set(n,s),this.#jc.set(n,s))}if(i)for(const[t,e]of i)this.eventBus.dispatch(t.toLowerCase(),{source:this,value:e})}}s(5781);function Ui({width:t,height:e,left:i,top:n},r){if(0===t||0===e)return null;const s=r.textLayer.div.getBoundingClientRect(),a=r.getPagePoint(i-s.left,n-s.top),o=r.getPagePoint(i-s.left+t,n-s.top+e);return st.normalizeRect([a[0],a[1],o[0],o[1]])}function zi(t,e){const i=t.getClientRects();if(1===i.length)return{rect:Ui(i[0],e)};const n=[1/0,1/0,-1/0,-1/0],r=[];let s=0;for(const t of i){const i=Ui(t,e);null!==i&&(r[s]=r[s+4]=i[0],r[s+1]=r[s+3]=i[3],r[s+2]=r[s+6]=i[2],r[s+5]=r[s+7]=i[1],st.rectBoundingBox(...i,n),s+=8)}return{quadPoints:r,rect:n}}function Hi(t,e){let i=t;do{if(i.nodeType===Node.TEXT_NODE){const t=i.textContent.length;if(e<=t)return[i,e];e-=t}else if(i.firstChild){i=i.firstChild;continue}for(;!i.nextSibling&&i!==t;)i=i.parentNode;i!==t&&(i=i.nextSibling)}while(i!==t);throw new Error("Offset is bigger than container's contents length.")}class Vi{static#Uc=0;static#i;static#zc;static findLinks(t){this.#i??=/\b(?:https?:\/\/|mailto:|www\.)(?:[\0-\x08\x0E-\x1F\$\+0-9=A-Z\^`-z\|~-\x9F\xA2-\xA6\xA8-\xAA\xAC-\xB5\xB8-\xBA\xBC-\xBE\xC0-\u037D\u037F-\u0386\u0388-\u0559\u0560-\u0588\u058B-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7-\u05F2\u05F5-\u0608\u060B\u060E-\u061A\u061C\u0620-\u0669\u066E-\u06D3\u06D5-\u06FF\u070E-\u07F6\u07FA-\u082F\u083F-\u085D\u085F-\u0963\u0966-\u096F\u0971-\u09FC\u09FE-\u0A75\u0A77-\u0AEF\u0AF1-\u0C76\u0C78-\u0C83\u0C85-\u0DF3\u0DF5-\u0E4E\u0E50-\u0E59\u0E5C-\u0F03\u0F13\u0F15-\u0F39\u0F3E-\u0F84\u0F86-\u0FCF\u0FD5-\u0FD8\u0FDB-\u1049\u1050-\u10FA\u10FC-\u135F\u1369-\u13FF\u1401-\u166D\u166F-\u167F\u1681-\u169A\u169D-\u16EA\u16EE-\u1734\u1737-\u17D3\u17D7\u17DB-\u17FF\u180B-\u1943\u1946-\u1A1D\u1A20-\u1A9F\u1AA7\u1AAE-\u1B4D\u1B50-\u1B59\u1B61-\u1B7C\u1B80-\u1BFB\u1C00-\u1C3A\u1C40-\u1C7D\u1C80-\u1CBF\u1CC8-\u1CD2\u1CD4-\u1FFF\u200B-\u200F\u202A-\u202E\u2044\u2052\u2060-\u207C\u207F-\u208C\u208F-\u2307\u230C-\u2328\u232B-\u2767\u2776-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2CF8\u2CFD\u2D00-\u2D6F\u2D71-\u2DFF\u2E2F\u2E50\u2E51\u2E5E-\u2F
2FF\u3004-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303C\u303E-\u309F\u30A1-\u30FA\u30FC-\uA4FD\uA500-\uA60C\uA610-\uA672\uA674-\uA67D\uA67F-\uA6F1\uA6F8-\uA873\uA878-\uA8CD\uA8D0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA95E\uA960-\uA9C0\uA9CE-\uA9DD\uA9E0-\uAA5B\uAA60-\uAADD\uAAE0-\uAAEF\uAAF2-\uABEA\uABEC-\uFD3D\uFD40-\uFE0F\uFE1A-\uFE2F\uFE53\uFE62\uFE64-\uFE67\uFE69\uFE6C-\uFEFE\uFF00\uFF04\uFF0B\uFF10-\uFF19\uFF1C-\uFF1E\uFF21-\uFF3A\uFF3E\uFF40-\uFF5A\uFF5C\uFF5E\uFF66-\u{100FF}\u{10103}-\u{1039E}\u{103A0}-\u{103CF}\u{103D1}-\u{1056E}\u{10570}-\u{10856}\u{10858}-\u{1091E}\u{10920}-\u{1093E}\u{10940}-\u{10A4F}\u{10A59}-\u{10A7E}\u{10A80}-\u{10AEF}\u{10AF7}-\u{10B38}\u{10B40}-\u{10B98}\u{10B9D}-\u{10D6D}\u{10D6F}-\u{10EAC}\u{10EAE}-\u{10ECF}\u{10ED1}-\u{10F54}\u{10F5A}-\u{10F85}\u{10F8A}-\u{11046}\u{1104E}-\u{110BA}\u{110BD}\u{110C2}-\u{1113F}\u{11144}-\u{11173}\u{11176}-\u{111C4}\u{111C9}-\u{111CC}\u{111CE}-\u{111DA}\u{111DC}\u{111E0}-\u{11237}\u{1123E}-\u{112A8}\u{112AA}-\u{113D3}\u{113D6}\u{113D9}-\u{1144A}\u{11450}-\u{11459}\u{1145C}\u{1145E}-\u{114C5}\u{114C7}-\u{115C0}\u{115D8}-\u{11640}\u{11644}-\u{1165F}\u{1166D}-\u{116B8}\u{116BA}-\u{1173B}\u{1173F}-\u{1183A}\u{1183C}-\u{11943}\u{11947}-\u{119E1}\u{119E3}-\u{11A3E}\u{11A47}-\u{11A99}\u{11A9D}\u{11AA3}-\u{11AFF}\u{11B0A}-\u{11BE0}\u{11BE2}-\u{11C40}\u{11C46}-\u{11C6F}\u{11C72}-\u{11EF6}\u{11EF9}-\u{11F42}\u{11F50}-\u{11FFE}\u{12000}-\u{1246F}\u{12475}-\u{12FF0}\u{12FF3}-\u{16A6D}\u{16A70}-\u{16AF4}\u{16AF6}-\u{16B36}\u{16B3C}-\u{16B43}\u{16B45}-\u{16D6C}\u{16D70}-\u{16E96}\u{16E9B}-\u{16FE1}\u{16FE3}-\u{1BC9E}\u{1BCA0}-\u{1DA86}\u{1DA8C}-\u{1E5FE}\u{1E600}-\u{1E95D}\u{1E960}-\u{10FFFF}]|\/|[\0-\x08\x0E-\x1F!-Z\\\^-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uFEFE\uFF00-\u{10FFFF}]+[\0-\x08\x0E-\x1F\$\+0-9=A-Z\^`-z\|~-\x9F\xA2-\xA6\xA8-\xAA\xAC-\xB5\xB8-\xBA\xBC-\xBE\xC0-\u037D\u037F-\u0386\u0388-\u0559\u0560-\u0588\u058B-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7-\u05F2\u05F5-\u0608\u060B\u060E-\u061A\u061C\u0620-\u0669\u066E-\u06D3\u06D5-\u06FF\u070E-\u07F6\u07FA-\u082F\u083F-\u085D\u085F-\u0963\u0966-\u096F\u0971-\u09FC\u09FE-\u0A75\u0A77-\u0AEF\u0AF1-\u0C76\u0C78-\u0C83\u0C85-\u0DF3\u0DF5-\u0E4E\u0E50-\u0E59\u0E5C-\u0F03\u0F13\u0F15-\u0F39\u0F3E-\u0F84\u0F86-\u0FCF\u0FD5-\u0FD8\u0FDB-\u1049\u1050-\u10FA\u10FC-\u135F\u1369-\u13FF\u1401-\u166D\u166F-\u167F\u1681-\u169A\u169D-\u16EA\u16EE-\u1734\u1737-\u17D3\u17D7\u17DB-\u17FF\u180B-\u1943\u1946-\u1A1D\u1A20-\u1A9F\u1AA7\u1AAE-\u1B4D\u1B50-\u1B59\u1B61-\u1B7C\u1B80-\u1BFB\u1C00-\u1C3A\u1C40-\u1C7D\u1C80-\u1CBF\u1CC8-\u1CD2\u1CD4-\u1FFF\u200B-\u200F\u202A-\u202E\u2044\u2052\u2060-\u207C\u207F-\u208C\u208F-\u2307\u230C-\u2328\u232B-\u2767\u2776-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2CF8\u2CFD\u2D00-\u2D6F\u2D71-\u2DFF\u2E2F\u2E50\u2E51\u2E5E-\u2FFF\u3004-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303C\u303E-\u309F\u30A1-\u30FA\u30FC-\uA4FD\uA500-\uA60C\uA610-\uA672\uA674-\uA67D\uA67F-\uA6F1\uA6F8-\uA873\uA878-\uA8CD\uA8D0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA95E\uA960-\uA9C0\uA9CE-\uA9DD\uA9E0-\uAA5B\uAA60-\uAADD\uAAE0-\uAAEF\uAAF2-\uABEA\uABEC-\uFD3D\uFD40-\uFE0F\uFE1A-\uFE2F\uFE53\uFE62\uFE64-\uFE67\uFE69\uFE6C-\uFEFE\uFF00\uFF04\uFF0B\uFF10-\uFF19\uFF1C-\uFF1E\uFF21-\uFF3A\uFF3E\uFF40-\uFF5A\uFF5C\uFF5E\uFF66-\u{100FF}\u{10103}-\u{1039E}\u{103A0}-\u{103CF}\u{103D1}-\u{1056E}\u{10570}-\u{10856}\u{10858}-\u{1091E}\u{10920}-\u{1093E}\u{10940}-\u{10A4F}\u{10A59}-\u{10A7E}\u{10A80}-\u{10AEF}\u{10AF7}-\u{10B38}\u{10B40}-\u{10B98}\u{10B9D}-\u{10D6D}\u{10D6F}-\u{10EAC}\u{10EAE}-\u{10ECF}\u{10ED1}-\u{10F54}\u{10F5A}-\u{10F85}\u{10F8A}-\u{11046}\u{1104E}-\u{110BA}\u{110BD}\u{110C2}-\u{1113F}\u{11144}-\u{11173}\u{11176}-\u{111C4}\u{111C9}-\u{111CC}\u{111CE}-\u{111DA}\u{111DC}\u{111E0}-\u{11237}\u{1123E}-\u{112A8}\u{112AA}-\u{113D3}\u{113D6}\u{113D9}-\u{1144A}\u{11450}-\u{11459}\u{1145C}\u{1145E}-\u{114C5}\u{114C7}-\u{115C0}\u{115D8}-\u{11640}\u{11644}-\u{1165F}\u{1166D}-\u{116B8}\u{116BA}-\u{1173B}\u{1173F}-\u{1183A}\u{1183C}-\u{11943}\u{11947}-\u{119E1}\u{119E3}-\u{11A3E}\u{11A47}-\u{11A99}\u{11A9D}
2\u{11AA3}-\u{11AFF}\u{11B0A}-\u{11BE0}\u{11BE2}-\u{11C40}\u{11C46}-\u{11C6F}\u{11C72}-\u{11EF6}\u{11EF9}-\u{11F42}\u{11F50}-\u{11FFE}\u{12000}-\u{1246F}\u{12475}-\u{12FF0}\u{12FF3}-\u{16A6D}\u{16A70}-\u{16AF4}\u{16AF6}-\u{16B36}\u{16B3C}-\u{16B43}\u{16B45}-\u{16D6C}\u{16D70}-\u{16E96}\u{16E9B}-\u{16FE1}\u{16FE3}-\u{1BC9E}\u{1BCA0}-\u{1DA86}\u{1DA8C}-\u{1E5FE}\u{1E600}-\u{1E95D}\u{1E960}-\u{10FFFF}])+|(?=\p{L})[\0-\x08\x0E-\x1F!-'\*-;=\?A-Z\\\^-z\|~-\x9F\xA1-\u0F39\u0F3E-\u167F\u1681-\u169A\u169D-\u1FFF\u200B-\u2019\u201B-\u201D\u201F-\u2027\u202A-\u202E\u2030-\u2044\u2047-\u205E\u2060-\u207C\u207F-\u208C\u208F-\u2307\u230C-\u2328\u232B-\u2767\u2776-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2E21\u2E2A-\u2E41\u2E43-\u2E54\u2E5D-\u2FFF\u3001-\u3007\u3012\u3013\u301C\u3020-\uFD3D\uFD40-\uFE16\uFE19-\uFE34\uFE45\uFE46\uFE49-\uFE58\uFE5F-\uFEFE\uFF00-\uFF07\uFF0A-\uFF3A\uFF3C\uFF3E-\uFF5A\uFF5C\uFF5E\uFF61\uFF64-\u{10FFFF}]+@([\0-\x08\x0E-\x1F\$\+\x2D0-9=A-Z\^`-z\|~-\x9F\xA2-\xA6\xA8-\xAA\xAC-\xB5\xB8-\xBA\xBC-\xBE\xC0-\u037D\u037F-\u0386\u0388-\u0559\u0560-\u0588\u058B-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7-\u05F2\u05F5-\u0608\u060B\u060E-\u061A\u061C\u0620-\u0669\u066E-\u06D3\u06D5-\u06FF\u070E-\u07F6\u07FA-\u082F\u083F-\u085D\u085F-\u0963\u0966-\u096F\u0971-\u09FC\u09FE-\u0A75\u0A77-\u0AEF\u0AF1-\u0C76\u0C78-\u0C83\u0C85-\u0DF3\u0DF5-\u0E4E\u0E50-\u0E59\u0E5C-\u0F03\u0F13\u0F15-\u0F39\u0F3E-\u0F84\u0F86-\u0FCF\u0FD5-\u0FD8\u0FDB-\u1049\u1050-\u10FA\u10FC-\u135F\u1369-\u13FF\u1401-\u166D\u166F-\u167F\u1681-\u169A\u169D-\u16EA\u16EE-\u1734\u1737-\u17D3\u17D7\u17DB-\u17FF\u180B-\u1943\u1946-\u1A1D\u1A20-\u1A9F\u1AA7\u1AAE-\u1B4D\u1B50-\u1B59\u1B61-\u1B7C\u1B80-\u1BFB\u1C00-\u1C3A\u1C40-\u1C7D\u1C80-\u1CBF\u1CC8-\u1CD2\u1CD4-\u1FFF\u200B-\u200F\u202A-\u202E\u2044\u2052\u2060-\u207C\u207F-\u208C\u208F-\u2307\u230C-\u2328\u232B-\u2767\u2776-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2CF8\u2CFD\u2D00-\u2D6F\u2D71-\u2DFF\u2E2F\u2E50\u2E51\u2E5E-\u2FFF\u3004-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303C\u303E-\u309F\u30A1-\u30FA\u30FC-\uA4FD\uA500-\uA60C\uA610-\uA672\uA674-\uA67D\uA67F-\uA6F1\uA6F8-\uA873\uA878-\uA8CD\uA8D0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA95E\uA960-\uA9C0\uA9CE-\uA9DD\uA9E0-\uAA5B\uAA60-\uAADD\uAAE0-\uAAEF\uAAF2-\uABEA\uABEC-\uFD3D\uFD40-\uFE0F\uFE1A-\uFE2F\uFE53\uFE62\uFE64-\uFE67\uFE69\uFE6C-\uFEFE\uFF00\uFF04\uFF0B\uFF10-\uFF19\uFF1C-\uFF1E\uFF21-\uFF3A\uFF3E\uFF40-\uFF5A\uFF5C\uFF5E\uFF66-\u{100FF}\u{10103}-\u{1039E}\u{103A0}-\u{103CF}\u{103D1}-\u{1056E}\u{10570}-\u{10856}\u{10858}-\u{1091E}\u{10920}-\u{1093E}\u{10940}-\u{10A4F}\u{10A59}-\u{10A7E}\u{10A80}-\u{10AEF}\u{10AF7}-\u{10B38}\u{10B40}-\u{10B98}\u{10B9D}-\u{10D6D}\u{10D6F}-\u{10EAC}\u{10EAE}-\u{10ECF}\u{10ED1}-\u{10F54}\u{10F5A}-\u{10F85}\u{10F8A}-\u{11046}\u{1104E}-\u{110BA}\u{110BD}\u{110C2}-\u{1113F}\u{11144}-\u{11173}\u{11176}-\u{111C4}\u{111C9}-\u{111CC}\u{111CE}-\u{111DA}\u{111DC}\u{111E0}-\u{11237}\u{1123E}-\u{112A8}\u{112AA}-\u{113D3}\u{113D6}\u{113D9}-\u{1144A}\u{11450}-\u{11459}\u{1145C}\u{1145E}-\u{114C5}\u{114C7}-\u{115C0}\u{115D8}-\u{11640}\u{11644}-\u{1165F}\u{1166D}-\u{116B8}\u{116BA}-\u{1173B}\u{1173F}-\u{1183A}\u{1183C}-\u{11943}\u{11947}-\u{119E1}\u{119E3}-\u{11A3E}\u{11A47}-\u{11A99}\u{11A9D}\u{11AA3}-\u{11AFF}\u{11B0A}-\u{11BE0}\u{11BE2}-\u{11C40}\u{11C46}-\u{11C6F}\u{11C72}-\u{11EF6}\u{11EF9}-\u{11F42}\u{11F50}-\u{11FFE}\u{12000}-\u{1246F}\u{12475}-\u{12FF0}\u{12FF3}-\u{16A6D}\u{16A70}-\u{16AF4}\u{16AF6}-\u{16B36}\u{16B3C}-\u{16B43}\u{16B45}-\u{16D6C}\u{16D70}-\u{16E96}\u{16E9B}-\u{16FE1}\u{16FE3}-\u{1BC9E}\u{1BCA0}-\u{1DA86}\u{1DA8C}-\u{1E5FE}\u{1E600}-\u{1E95D}\u{1E960}-\u{10FFFF}]+(?:\.[\0-\x08\x0E-\x1F\$\+\x2D0-9=A-Z\^`-z\|~-\x9F\xA2-\xA6\xA8-\xAA\xAC-\xB5\xB8-\xBA\xBC-\xBE\xC0-\u037D\u037F-\u0386\u0388-\u0559\u0560-\u0588\u058B-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7-\u05F2\u05F5-\u0608\u060B\u060E-\u061A\u061C\u0620-\u0669\u066E-\u06D3\u06D5-\u06FF\u070E-\u07F6\u07FA-\u082F\u083F-\u085D\u085F-\u0963\u0966-\u096F\u0971-\u09FC\u09FE-\u0A75\u0A77-\u0AEF\u0AF1-\u0C76\u0C78-\u0C83\u0C85-\u0DF3\u0DF5-\u0E4E\u0E50-\u0E59\u0E5C-\u0F03\u0F13\u0F15-\u0F39\u0F3E-\u0F84\u0F86-\u0FCF\u0FD5-\u0FD8\u0FDB-\u1049\u1050-\u10FA\u10FC-\u135F\u1369-\u13FF\u1401-\u166D\u166F-\u167F\u1681-\u169A\u169D-\u16EA\u16EE-\u1734\u1737-\u17D3\u17D7\u17DB-\u17FF\u180B-\u1943\u1946-\u1A1D\u1A20-\u1A9F\u1AA7\u1AAE-\u1B4D\u1B50-\u1B59\u1B61-\u1B7C\u1B80-\u1BFB\u1C00-\u1C3A\u1C40-\u1C7D\u1C80-\u1CBF\u1CC8-\u1CD2\u1CD4-\u1FFF\u200B-\u200F\u202A-\u202E\u2044\u2052\u2060-\u207C\u207F-\u208C\u208F-\u2307\u230C-\u2328\u232B-\u2767\u2776-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2CF8\u2CFD\u2D00-\u2D6F\u2D71-\u2DFF\u2E2F\u2E50\u2E51\u2E5E-\u2F
2FF\u3004-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303C\u303E-\u309F\u30A1-\u30FA\u30FC-\uA4FD\uA500-\uA60C\uA610-\uA672\uA674-\uA67D\uA67F-\uA6F1\uA6F8-\uA873\uA878-\uA8CD\uA8D0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA95E\uA960-\uA9C0\uA9CE-\uA9DD\uA9E0-\uAA5B\uAA60-\uAADD\uAAE0-\uAAEF\uAAF2-\uABEA\uABEC-\uFD3D\uFD40-\uFE0F\uFE1A-\uFE2F\uFE53\uFE62\uFE64-\uFE67\uFE69\uFE6C-\uFEFE\uFF00\uFF04\uFF0B\uFF10-\uFF19\uFF1C-\uFF1E\uFF21-\uFF3A\uFF3E\uFF40-\uFF5A\uFF5C\uFF5E\uFF66-\u{100FF}\u{10103}-\u{1039E}\u{103A0}-\u{103CF}\u{103D1}-\u{1056E}\u{10570}-\u{10856}\u{10858}-\u{1091E}\u{10920}-\u{1093E}\u{10940}-\u{10A4F}\u{10A59}-\u{10A7E}\u{10A80}-\u{10AEF}\u{10AF7}-\u{10B38}\u{10B40}-\u{10B98}\u{10B9D}-\u{10D6D}\u{10D6F}-\u{10EAC}\u{10EAE}-\u{10ECF}\u{10ED1}-\u{10F54}\u{10F5A}-\u{10F85}\u{10F8A}-\u{11046}\u{1104E}-\u{110BA}\u{110BD}\u{110C2}-\u{1113F}\u{11144}-\u{11173}\u{11176}-\u{111C4}\u{111C9}-\u{111CC}\u{111CE}-\u{111DA}\u{111DC}\u{111E0}-\u{11237}\u{1123E}-\u{112A8}\u{112AA}-\u{113D3}\u{113D6}\u{113D9}-\u{1144A}\u{11450}-\u{11459}\u{1145C}\u{1145E}-\u{114C5}\u{114C7}-\u{115C0}\u{115D8}-\u{11640}\u{11644}-\u{1165F}\u{1166D}-\u{116B8}\u{116BA}-\u{1173B}\u{1173F}-\u{1183A}\u{1183C}-\u{11943}\u{11947}-\u{119E1}\u{119E3}-\u{11A3E}\u{11A47}-\u{11A99}\u{11A9D}\u{11AA3}-\u{11AFF}\u{11B0A}-\u{11BE0}\u{11BE2}-\u{11C40}\u{11C46}-\u{11C6F}\u{11C72}-\u{11EF6}\u{11EF9}-\u{11F42}\u{11F50}-\u{11FFE}\u{12000}-\u{1246F}\u{12475}-\u{12FF0}\u{12FF3}-\u{16A6D}\u{16A70}-\u{16AF4}\u{16AF6}-\u{16B36}\u{16B3C}-\u{16B43}\u{16B45}-\u{16D6C}\u{16D70}-\u{16E96}\u{16E9B}-\u{16FE1}\u{16FE3}-\u{1BC9E}\u{1BCA0}-\u{1DA86}\u{1DA8C}-\u{1E5FE}\u{1E600}-\u{1E95D}\u{1E960}-\u{10FFFF}]+)+)/gmu;const[e,i]=Zt(t,{ignoreDashEOL:!0}),n=e.matchAll(this.#i),r=[];for(const t of n){const[e,n]=t;let s;if(e.startsWith("www.")||e.startsWith("http://")||e.startsWith("https://"))s=e;else if(n){const t=URL.parse(`http://${n}`)?.hostname;if(!t)continue;if(this.#zc??=/\.\d+$/,this.#zc.test(t))continue}s??=e.startsWith("mailto:")?e:`mailto:${e}`;const a=b(s,null,{addDefaultProtocol:!0});if(a){const[n,s]=te(i,t.index,e.length);r.push({url:a.href,index:n,length:s})}}return r}static processLinks(t){return this.findLinks(t._textHighlighter.textContentItemsStr.join("\n")).map(e=>function({url:t,index:e,length:i},n,r){const s=n._textHighlighter,[{begin:a,end:o}]=s._convertMatches([e],[i]),l=new Range;return l.setStart(...Hi(s.textDivs[a.divIdx],a.offset)),l.setEnd(...Hi(s.textDivs[o.divIdx],o.offset)),{id:`inferred_link_${r}`,unsafeUrl:t,url:t,annotationType:p.LINK,rotation:0,...zi(l,n),borderStyle:null}}(e,t,this.#Uc++))}}class $i{#Hc=null;#Vc=0;#$c=null;#Wc=ht.INITIAL;#Gc=null;#Xc=0;#qc=null;canvas=null;div=null;enableOptimizedPartialRendering=!1;eventBus=null;id=null;pageColors=null;recordedBBoxes=null;renderingQueue=null;renderTask=null;resume=null;constructor(t){this.eventBus=t.eventBus,this.id=t.id,this.pageColors=t.pageColors||null,this.renderingQueue=t.renderingQueue,this.enableOptimizedPartialRendering=t.enableOptimizedPartialRendering??!1,this.#Vc=t.minDurationToUpdateCanvas??500}get renderingState(){return this.#Wc}set renderingState(t){if(t!==this.#Wc)switch(this.#Wc=t,this.#Hc&&(clearTimeout(this.#Hc),this.#Hc=null),t){case ht.PAUSED:this.div.classList.remove("loading"),this.#Xc=0,this.#Gc?.(!1);break;case ht.RUNNING:this.div.classList.add("loadingIcon"),this.#Hc=setTimeout(()=>{this.div.classList.add("loading"),this.#Hc=null},0),this.#Xc=Date.now();break;case ht.INITIAL:case ht.FINISHED:this.div.classList.remove("loadingIcon","loading"),this.#Xc=0}}_createCanvas(t,e=!1){const{pageColors:i}=this,n=!(!i?.background||!i?.foreground),r=this.canvas,s=!r&&!n&&!e;let a=this.canvas=document.createElement("canvas");return this.#Gc=e=>{if(s){let i=this.#qc;if(!e&&this.#Vc>0){if(Date.now()-this.#Xc<this.#Vc)return;i||(i=this.#qc=a,a=this.canvas=a.cloneNode(!1),t(a))}if(i){return a.getContext("2d",{alpha:!1}).drawImage(i,0,0),void(e?this.#Yc():this.#Xc=Date.now())}return t(a),void(this.#Gc=null)}e&&(r?(r.replaceWith(a),r.width=r.height=0):t(a))},{canvas:a,prevCanvas:r}}#Kc=t=>{if(this.#Gc?.(!1),this.renderingQueue&&!this.renderingQueue.isHighestPriority(this))return this.renderingState=ht.PAUSED,void(this.resume=()=>{this.renderingState=ht.RUNNING,t()});t()};_resetCanvas(){const{canvas:t}=this;t&&(t.remove(),t.width=t.height=0,this.canvas=null,this.#Yc())}#Yc(){this.#qc&&(this.#qc.width=this.#qc.height=0,this.#qc=null)}async _drawCanvas(t,e,i){const n=this.renderTask=this.pdfPage.render(t);n.onContinue=this.#Kc,n.onError=t=>{t instanceof q&&(e(),this.#$c=null)};let r=null;try{await n.promise,this.#Gc?.(!0)}catch(t){if(t instanceof q)return;r=t,this.#Gc?.(!0)}finally{this.#$c=r,n===this.renderTask&&(this.renderTask=null,this.enableOptimizedPartialRendering&&(this.recordedBBoxes??=n.recordedBBoxes))}if(this.renderingState=ht.FINISHED,i(n),r)throw r}cancelRendering({cancelExtraDelay:t=0}={}){this.renderTask&&(this.renderTask.cancel(t),this.renderTask=null),this.resume=null}dispatchPageRender(){this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id})}dispatchPageRendered(t,e){this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:t,isDetailVie
2w:e,timestamp:performance.now(),error:this.#$c})}}class Wi{#Oc=null;async render({intent:t="display"}){"display"!==t||this.#Oc||this._cancelled||(this.#Oc=new w)}cancel(){this._cancelled=!0,this.#Oc&&(this.#Oc.destroy(),this.#Oc=null)}setParent(t){this.#Oc?.setParent(t)}getDrawLayer(){return this.#Oc}}class Gi extends $i{#Jc=null;renderingCancelled=!1;constructor({pageView:t}){super(t),this.pageView=t,this.renderingId="detail"+this.id,this.div=t.div}setPdfPage(t){this.pageView.setPdfPage(t)}get pdfPage(){return this.pageView.pdfPage}get renderingState(){return super.renderingState}set renderingState(t){this.renderingCancelled=!1,super.renderingState=t}reset({keepCanvas:t=!1}={}){const e=this.renderingCancelled||this.renderingState===ht.RUNNING||this.renderingState===ht.PAUSED;this.cancelRendering(),this.renderingState=ht.INITIAL,this.renderingCancelled=e,t||this._resetCanvas()}#Qc(t){if(!this.#Jc)return!0;const e=this.#Jc.minX,i=this.#Jc.minY,n=this.#Jc.width+e,r=this.#Jc.height+i;if(t.minX<e||t.minY<i||t.maxX>n||t.maxY>r)return!0;const{width:s,height:a,scale:o}=this.pageView.viewport;if(this.#Jc.scale!==o)return!0;const l=t.minX-e,h=n-t.maxX,c=t.minY-i,d=r-t.maxY;return e>0&&h/l>3||n<s&&l/h>3||i>0&&d/c>3||r<a&&c/d>3}update({visibleArea:t=null,underlyingViewUpdated:e=!1}={}){if(e)return this.cancelRendering(),void(this.renderingState=ht.INITIAL);if(!this.#Qc(t))return;const{viewport:i,maxCanvasPixels:n,capCanvasAreaFactor:r}=this.pageView,s=t.maxX-t.minX,a=t.maxY-t.minY,o=s*a*U.pixelRatio**2,l=(Math.sqrt(U.capPixels(n,r)/o)-1)/2;let h=Math.min(1,l);h<0&&(h=0);const c=s*h,d=a*h,u=Math.max(0,t.minX-c),p=Math.min(i.width,t.maxX+c),g=Math.max(0,t.minY-d),f=p-u,m=Math.min(i.height,t.maxY+d)-g;this.#Jc={minX:u,minY:g,width:f,height:m,scale:i.scale},this.reset({keepCanvas:!0})}_getRenderingContext(t,e){const i=this.pageView._getRenderingContext(t,e,!1),n=this.pdfPage.recordedBBoxes;if(!n||!this.enableOptimizedPartialRendering)return i;const{viewport:{width:r,height:s}}=this.pageView,{width:a,height:o,minX:l,minY:h}=this.#Jc,c=l/r,d=h/s,u=(l+a)/r,p=(h+o)/s;return{...i,operationsFilter:t=>!n.isEmpty(t)&&(n.minX(t)<=u&&n.maxX(t)>=c&&n.minY(t)<=p&&n.maxY(t)>=d)}}async draw(){if(this.pageView.detailView!==this)return;const t=this.pageView.renderingState===ht.FINISHED||this.renderingState===ht.FINISHED;this.renderingState!==ht.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:e,pdfPage:i,viewport:n}=this.pageView;if(!i)throw this.renderingState=ht.FINISHED,new Error("pdfPage is not loaded");this.renderingState=ht.RUNNING;const r=this.pageView._ensureCanvasWrapper(),{canvas:s,prevCanvas:a}=this._createCanvas(t=>{"CANVAS"===r.firstElementChild?.tagName?r.firstElementChild.after(t):r.prepend(t)},t);s.ariaHidden=!0,this.enableOptimizedPartialRendering&&(s.className="detailView");const{width:o,height:l}=n,h=this.#Jc,{pixelRatio:c}=U,d=[c,0,0,c,-h.minX*c,-h.minY*c];s.width=h.width*c,s.height=h.height*c;const{style:u}=s;u.width=100*h.width/o+"%",u.height=100*h.height/l+"%",u.top=100*h.minY/l+"%",u.left=100*h.minX/o+"%";const p=this._drawCanvas(this._getRenderingContext(s,d),()=>{this.canvas?.remove(),this.canvas=a},()=>{this.dispatchPageRendered(!1,!0)});return e.setAttribute("data-loaded",!0),this.dispatchPageRender(),p}}const Xi={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},qi=new Set(["math","merror","mfrac","mi","mmultiscripts","mn","mo","mover","mpadded","mprescripts","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msubsup","msup","mtable","mtd","mtext","mtr","munder","munderover","semantics"]),Yi="http://www.w3.org/1998/Math/MathML";class Ki{static get sanitizer(){return Q(this,"sanitizer",A.isSanitizerSupported?new Sanitizer({elements:[...qi].map(t=>
2({name:t,namespace:Yi})),replaceWithChildrenElements:[{name:"maction",namespace:Yi}],attributes:["dir","displaystyle","mathbackground","mathcolor","mathsize","scriptlevel","encoding","display","linethickness","intent","arg","form","fence","separator","lspace","rspace","stretchy","symmetric","maxsize","minsize","largeop","movablelimits","width","height","depth","voffset","accent","accentunder","columnspan","rowspan"],comments:!1}):null)}}const Ji=/^H(\d+)$/;class Qi{#Zc;#td=null;#ed;#id=new Map;#nd;#rd=null;#sd=null;#ad=null;constructor(t,e){this.#Zc=t.getStructTree(),this.#nd=e}async render(){if(this.#ed)return this.#ed;const{promise:t,resolve:e,reject:i}=Promise.withResolvers();this.#ed=t;try{this.#td=this.#od(await this.#Zc)}catch(t){i(t)}return this.#Zc=null,this.#td?.classList.add("structTree"),e(this.#td),t}async getAriaAttributes(t){try{return await this.render(),this.#id.get(t)}catch{}return null}hide(){this.#td&&!this.#td.hidden&&(this.#td.hidden=!0)}show(){this.#td?.hidden&&(this.#td.hidden=!1)}#ld(t,e){const{alt:i,id:n,lang:r}=t;if(void 0!==i){let n=!1;const r=xt(i);for(const e of t.children)if("annotation"===e.type){let t=this.#id.get(e.id);t||(t=new Map,this.#id.set(e.id,t)),t.set("aria-label",r),n=!0}n||e.setAttribute("aria-label",r)}void 0!==n&&e.setAttribute("aria-owns",n),void 0!==r&&e.setAttribute("lang",xt(r,!0))}#hd(t,e){const{alt:i,bbox:n,children:r}=t,s=r?.[0];if(!this.#nd||!i||!n||"content"!==s?.type)return!1;const{id:a}=s;if(!a)return!1;e.setAttribute("aria-owns",a);const o=document.createElement("span");(this.#rd||=new Map).set(a,o),o.setAttribute("role","img"),o.setAttribute("aria-label",xt(i));const{pageHeight:l,pageX:h,pageY:c}=this.#nd,d="calc(var(--total-scale-factor) *",{style:u}=o;return u.width=`${d}${n[2]-n[0]}px)`,u.height=`${d}${n[3]-n[1]}px)`,u.left=`${d}${n[0]-h}px)`,u.top=`${d}${l-n[3]+c}px)`,!0}updateTextLayer(){if(this.#rd){for(const[t,e]of this.#rd)document.getElementById(t)?.append(e);this.#rd.clear(),this.#rd=null}if(this.#sd){for(const t of this.#sd){const e=document.getElementById(t);e&&(e.ariaHidden=!0)}this.#sd.length=0,this.#sd=null}if(this.#ad){for(let t=0,e=this.#ad.length;t<e;t+=2){const e=this.#ad[t],i=this.#ad[t+1];let n="";for(const t of i){const e=document.getElementById(t);e&&(n+=e.textContent.trim()||"",e.ariaHidden="true")}n&&(e.textContent=n)}this.#ad.length=0,this.#ad=null}}#od(t){if(!t)return null;let e;if("role"in t){const{role:i}=t;if(qi.has(i)){e=document.createElementNS(Yi,i);const n=[];(this.#ad||=[]).push(e,n);for(const{type:e,id:i}of t.children||[])"content"===e&&i&&n.push(i)}else e=document.createElement("span");const n=i.match(Ji);if(n?(e.setAttribute("role","heading"),e.setAttribute("aria-level",n[1])):Xi[i]&&e.setAttribute("role",Xi[i]),"Figure"===i&&this.#hd(t,e))return e;if("Formula"===i){if(t.mathML&&Ki.sanitizer){e.setHTML(t.mathML,{sanitizer:Ki.sanitizer});for(const{id:e}of t.children||[])e&&(this.#sd||=[]).push(e);delete t.alt}t.mathML||1!==t.children.length||"math"===t.children[0].role||(e=document.createElementNS(Yi,"math"),delete t.alt)}}if(e||=document.createElement("span"),this.#ld(t,e),t.children)if(1===t.children.length&&"id"in t.children[0])this.#ld(t.children[0],e);else for(const i of t.children)e.append(this.#od(i));return e}}class Zi{#cd=!1;#dd=null;#ud=new Map;#pd=new Map;setTextMapping(t){this.#dd=t}static#gd(t,e){const i=t.getBoundingClientRect(),n=e.getBoundingClientRect();if(0===i.width&&0===i.height)return 1;if(0===n.width&&0===n.height)return-1;const r=i.y,s=i.y+i.height,a=i.y+i.height/2,o=n.y,l=n.y+n.height,h=n.y+n.height/2;if(a<=o&&h>=s)return-1;if(h<=r&&a>=l)return 1;return i.x+i.width/2-(n.x+n.width/2)}enable(){if(this.#cd)throw new Error("TextAccessibilityManager is already enabled.");if(!this.#dd)throw new Error("Text divs and strings have not been set.");if(this.#cd=!0,this.#dd=this.#dd.slice(),this.#dd.sort(Zi.#gd),this.#ud.size>0){const t=this.#dd;for(const[e,i]of this.#ud){document.getElementById(e)?this.#fd(e,t[i]):this.#ud.delete(e)}}for(const[t,e]of this.#pd)this.addPointerInTextLayer(t,e);this.#pd.clear()}disable(){this.#cd&&(this.#pd.clear(),this.#dd=null,this.#cd=!1)}removePointerInTextLayer(t){if(!this.#cd)return void this.#pd.delete(t);const e=this.#dd;if(!e||0===e.length)return;const{id:i}=t,n=this.#ud.get(i);if(void 0===n)return;const r=e[n];this.#ud.delete(i);let s=r.getAttribute("aria-owns");s?.includes(i)&&(s=s.split(" ").filter(t=>t!==i).join(" "),s?r.setAttribute("aria-owns",s):(r.removeAttribute("aria-owns"),r.setAttribute("role","presentation")))}#fd(t,e){const i=e.getAttribute("aria-owns");i?.includes(t)||e.setAttribute("aria-owns",i?`${i} ${t}`:t),e.removeAttribute("role")}addPointerInTextLayer(t,e){const{id:i}=t;if(!i)return null;if(!this.#cd)return this.#pd.set(t,e),null;e&&this.removePointerInTextLayer(t);const n=this.#dd;
2if(!n||0===n.length)return null;const r=Et(n,e=>Zi.#gd(t,e)<0),s=Math.max(0,r-1),a=n[s];this.#fd(i,a),this.#ud.set(i,s);const o=a.parentNode;return o?.classList.contains("markedContent")?o.id:null}moveElementInDOM(t,e,i,n){const r=this.addPointerInTextLayer(i,n);if(!t.hasChildNodes())return t.append(e),r;const s=Array.from(t.childNodes).filter(t=>t!==e);if(0===s.length)return r;const a=Et(s,t=>Zi.#gd(e,t)<0);return 0===a?s[0].before(e):s[a-1].after(e),r}}class tn{#uc=null;constructor({findController:t,eventBus:e,pageIndex:i}){this.findController=t,this.matches=[],this.eventBus=e,this.pageIdx=i,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(t,e){this.textDivs=t,this.textContentItemsStr=e}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0,this.#uc||(this.#uc=new AbortController,this.eventBus._on("updatetextlayermatches",t=>{t.pageIndex!==this.pageIdx&&-1!==t.pageIndex||this._updateMatches()},{signal:this.#uc.signal})),this._updateMatches()}disable(){this.enabled&&(this.enabled=!1,this.#uc?.abort(),this.#uc=null,this._updateMatches(!0))}_convertMatches(t,e){if(!t)return[];const{textContentItemsStr:i}=this;let n=0,r=0;const s=i.length-1,a=[];for(let o=0,l=t.length;o<l;o++){let l=t[o];for(;n!==s&&l>=r+i[n].length;)r+=i[n].length,n++;n===i.length&&console.error("Could not find a matching mapping");const h={begin:{divIdx:n,offset:l-r}};for(l+=e[o];n!==s&&l>r+i[n].length;)r+=i[n].length,n++;h.end={divIdx:n,offset:l-r},a.push(h)}return a}_renderMatches(t){if(0===t.length)return;const{findController:e,pageIdx:i}=this,{textContentItemsStr:n,textDivs:r}=this,s=i===e.selected.pageIdx,a=e.selected.matchIdx;let o=null;const l={divIdx:-1,offset:void 0};function h(t,e){const i=t.divIdx;return r[i].textContent="",c(i,0,t.offset,e)}function c(t,e,i,s){let a=r[t];if(a.nodeType===Node.TEXT_NODE){const e=document.createElement("span");a.before(e),e.append(a),r[t]=e,a=e}const o=n[t].substring(e,i),l=document.createTextNode(o);if(s){const t=document.createElement("span");if(t.className=`${s} appended`,t.append(l),a.append(t),s.includes("selected")){const{left:e}=t.getClientRects()[0];return e-a.getBoundingClientRect().left}return 0}return a.append(l),0}let d=a,u=d+1;if(e.state.highlightAll)d=0,u=t.length;else if(!s)return;let p=-1,g=-1;for(let n=d;n<u;n++){const d=t[n],u=d.begin;if(u.divIdx===p&&u.offset===g)continue;p=u.divIdx,g=u.offset;const f=d.end,m=s&&n===a,b=m?" selected":"";let v=0;if(o&&u.divIdx===o.divIdx?c(o.divIdx,o.offset,u.offset):(null!==o&&c(o.divIdx,o.offset,l.offset),h(u)),u.divIdx===f.divIdx)v=c(u.divIdx,u.offset,f.offset,"highlight"+b);else{v=c(u.divIdx,u.offset,l.offset,"highlight begin"+b);for(let t=u.divIdx+1,e=f.divIdx;t<e;t++)r[t].className="highlight middle"+b;h(f,"highlight end"+b)}o=f,m&&e.scrollMatchIntoView({element:r[u.divIdx],selectedLeft:v,pageIndex:i,matchIndex:a})}o&&c(o.divIdx,o.offset,l.offset)}_updateMatches(t=!1){if(!this.enabled&&!t)return;const{findController:e,matches:i,pageIdx:n}=this,{textContentItemsStr:r,textDivs:s}=this;let a=-1;for(const t of i){for(let e=Math.max(a,t.begin.divIdx),i=t.end.divIdx;e<=i;e++){const t=s[e];t.textContent=r[e],t.className=""}a=t.end.divIdx+1}if(!e?.highlightMatches||t)return;const o=e.pageMatches[n]||null,l=e.pageMatchesLength[n]||null;this.matches=this._convertMatches(o,l),this._renderMatches(this.matches)}}class en{#md=!1;#dc=null;#bd=!1;#Ah=null;static#vd=new Map;static#yd=null;constructor({pdfPage:t,highlighter:e=null,accessibilityManager:i=null,enablePermissions:n=!1,onAppend:r=null}){this.pdfPage=t,this.highlighter=e,this.accessibilityManager=i,this.#md=!0===n,this.#dc=r,this.div=document.createElement("div"),this.div.tabIndex=0,this.div.className="textLayer"}async render({viewport:t,textContentParams:e=null}){if(this.#bd&&this.#Ah)return this.#Ah.update({viewport:t,onBefore:this.hide.bind(this)}),void this.show();this.cancel(),this.#Ah=new it({textContentSource:this.pdfPage.streamTextContent(e||{includeMarkedContent:!0,disableNormalization:!0}),container:this.div,viewport:t});const{textDivs:i,textContentItemsStr:n}=this.#Ah;this.highlighter?.setTextMapping(i,n),this.accessibilityManager?.setTextMapping(i),await this.#Ah.render(),this.#bd=!0;const r=document.createElement("div");r.className="endOfContent",this.div.append(r),this.#wd(r),this.#dc?.(this.div),this.highlighter?.enable(),this.accessibilityManager?.enable()}hide(){!this.div.hidden&&this.#bd&&(this.highlighter?.disable(),this.div.hidden=!0)}show(){this.div.hidden&&this.#bd&&(this.div.hidden=!1,this.highlighter?.enable())}cancel(){this.#Ah?.cancel(),this.#Ah=null,this.highlighter?.disable(),this.accessibilityManager?.disable(),en.#Ad(this.div)}#wd(t){const{div:e}=this;e.addEventListener("mousedown",()=>{e.classList.add("selecting")}),e.addEventListener("copy",t=>{if(!this.#md){const e=document.getSelection();t.clipboardData.setData("text/plain",xt(O(e.toString())))}tt(t)}),en.#vd.set(e,t),en.#xd()}static#Ad(t){this.#vd.delete(t),0===this.#vd.size&&(this.#yd?.abort(),this.#yd=null)}static#xd(){if(this.#yd)return;this.#yd=new AbortController;const{signal:t}=this.#yd,e=(t,e)=>{e.append(t),t.style.width="",t.style.height="",e.classList.remove("selecting")};let i=!1;var n,r;document.addEventListener("pointerdown",()=>{i=!0},{signal:t}),document.addEventListener("pointerup",()=>{i=!1,this.#vd.forEach(e)},{signal:t}),window.addEventListener("blur",()=>{i=!1,this.#vd.forEach(e)},{signal:t}),document.addEventListener("keyup",()=>{i||this.#vd.forEach(e)},{signal:t}),document.addEventListener("selectionchange",()=>{const t=document.getSelection();if(0===t.rangeCount)return void this.#vd.forEach(e);const i=new Set;for(let e=0;e<t.rangeCount;e++){const n=t.getRangeAt(e);for(const t of this.#vd.keys())!i.has(t)&&n.intersectsNode(t)&&i.add(t)}for(const[t,n]of this.#vd)i.has(t)?t.classList.add("selecting"):e(n,t);if(n??="none"===getComputedStyle(this.#vd.values().next().value).getPropertyValue("-moz-user-select"),n)return;const s=t.getRangeAt(0),a=r&&(0===s.compareBoundaryPoints(Range.END_TO_END,r)||0===s.compareBoundaryPoints(Range.START_TO_END,r));let o=a?s.startContainer:s.endContainer;if(o.nodeType===Node.TEXT_NODE&&(o=o.parentNode),!a&&0===s.endOffset)do{for(;!o.previousSibling;)o=o.parentNode;o=o.previousSibling}while(!o.childNodes.length);const l=o.parentElement?.closest(".textLayer"),h=this.#vd.get(l);h&&(h.style.width=l.style.width,h.style.height=l.style.height,h.style.userSelect="text",o.parentElement.insertBefore(h,a?o:o.nextSibling)),r=s.cloneRange()},{signal:t})}}class nn{constructor({pdfPage:t,annotationStorage:e=null,linkService:i,xfaHtml:n=null}){this.pdfPage=t,this.annotationStorage=e,this.linkService=i,this.xfaHtml=n,this.div=null,this._cancelled=!1}async render({viewport:t,intent:e="display"}){if("print"===e){const i={viewport:t.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:e};return this.div=document.createElement("div"),i.div=this.div,lt.render(i)}const i=await this.pdfPage.getXfa();if(this._cancelled||!i)return{textDivs:[]};const n={viewport:t.clone({dontFlip:!0}),div:this.div,xfaHtml:i,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:e};return this.div?lt.update(n):(this.div=document.createElement("div"),n.div=this.div,lt.render(n))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}const rn={annotationEditorUIManager:null,annotationStorage:null,downloadManager:null,enableScripting:!1,fieldObjectsPromise:null,findController:null,hasJSActionsProm
2ise:null,get linkService(){return new re}},sn=new Map([["canvasWrapper",0],["textLayer",1],["annotationLayer",2],["annotationEditorLayer",3],["xfaLayer",3]]);class an extends $i{#Ed=u.ENABLE_FORMS;#Cd=null;#K=null;#Sd=!0;#_d=!1;#Qe=!1;#Td=null;#Pd=!1;#Dd=null;#Md=null;#Fd=1;#Id=1;#kd=ft;#Ld=1;#Rd={directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0};#Bd=[null,null,null,null];constructor(t){super(t);const e=t.container,i=t.defaultViewport;this.renderingId="page"+this.id,this.#Td=t.layerProperties||rn,this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=t.scale||1,this.viewport=i,this.pdfPageRotate=i.rotation,this._optionalContentConfigPromise=t.optionalContentConfigPromise||null,this.#kd=t.textLayerMode??ft,this.#Ed=t.annotationMode??u.ENABLE_FORMS,this.imageResourcesPath=t.imageResourcesPath||"",this.enableDetailCanvas=t.enableDetailCanvas??!0,this.maxCanvasPixels=t.maxCanvasPixels??ji.get("maxCanvasPixels"),this.maxCanvasDim=t.maxCanvasDim||ji.get("maxCanvasDim"),this.capCanvasAreaFactor=t.capCanvasAreaFactor??ji.get("capCanvasAreaFactor"),this.#Sd=!1!==t.enableAutoLinking,this.#K=t.commentManager||null,this.l10n=t.l10n,this.l10n||=new _i,this._isStandalone=!this.renderingQueue?.hasViewer(),this._container=e,this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.xfaLayer=null,this.structTreeLayer=null,this.drawLayer=null,this.detailView=null;const n=document.createElement("div");if(n.className="page",n.setAttribute("data-page-number",this.id),n.setAttribute("role","region"),n.setAttribute("data-l10n-id","pdfjs-page-landmark"),n.setAttribute("data-l10n-args",JSON.stringify({page:this.id})),this.div=n,this.#Nd(),e?.append(n),this._isStandalone){e?.style.setProperty("--scale-factor",this.scale*X.PDF_TO_CSS_UNITS),this.pageColors?.background&&e?.style.setProperty("--page-bg-color",this.pageColors.background);const{optionalContentConfigPromise:i}=t;i&&i.then(t=>{i===this._optionalContentConfigPromise&&(this.#Rd.initialOptionalContent=t.hasInitialVisibility)}),t.l10n||this.l10n.translate(this.div)}}#Od(t,e){const i=sn.get(e),n=this.#Bd[i];if(this.#Bd[i]=t,n)n.replaceWith(t);else{for(let e=i-1;e>=0;e--){const i=this.#Bd[e];if(i)return void i.after(t)}this.div.prepend(t)}}#Nd(){const{div:t,viewport:e}=this;if(e.userUnit!==this.#Ld&&(1!==e.userUnit?t.style.setProperty("--user-unit",e.userUnit):t.style.removeProperty("--user-unit"),this.#Ld=e.userUnit),this.pdfPage){if(this.#Md===e.rotation)return;this.#Md=e.rotation}J(t,e,!0,!1)}updatePageNumber(t){if(this.id===t)return;this.id=t,this.renderingId=`page${t}`,this.pdfPage&&(this.pdfPage.pageNumber=t),this.setPageLabel(this.pageLabel);const{div:e}=this;e.setAttribute("data-page-number",t),e.setAttribute("data-l10n-args",JSON.stringify({page:t})),this._textHighlighter.pageIdx=t-1}setPdfPage(t){!this._isStandalone||"CanvasText"!==this.pageColors?.foreground&&"Canvas"!==this.pageColors?.background||(this._container?.style.setProperty("--hcm-highlight-filter",t.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),this._container?.style.setProperty("--hcm-highlight-selected-filter",t.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","Highlight"))),this.pdfPage=t,this.pdfPageRotate=t.rotate;const e=(this.rotation+this.pdfPageRotate)%360;this.viewport=t.getViewport({scale:this.scale*X.PDF_TO_CSS_UNITS,rotation:e}),this.#Nd(),this.reset()}destroy(){this.reset(),this.pdfPage?.cleanup()}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}get _textHighlighter(){return Q(this,"_textHighlighter",new tn({pageIndex:this.id-1,eventBus:this.eventBus,findController:this.#Td.findController}))}#jd(t,e){this.eventBus.dispatch(t,{source:this,pageNumber:this.id,error:e})}async#Ud(){let t=null;try{await this.annotationLayer.render({viewport:this.viewport,intent:"display",structTreeLayer:this.structTreeLayer})}catch(e){console.error("#renderAnnotationLayer:",e),t=e}finally{this.#jd("annotationlayerrendered",t)}}async#zd(){let t=null;try{await this.annotationEditorLayer.render({viewport:this.viewport,intent:"display"})}catch(e){console.error("#renderAnnotationEditorLayer:",e),t=e}finally{this.#jd("annotationeditorlayerrendered",t)}}async#Hd(){try{await this.drawLayer.render({intent:"display"})}catch(t){console.error("#renderDrawLayer:",t)}}async#Vd(){let t=null;try{const t=await this.xfaLayer.render({viewport:this.viewport,intent:"display"});t?.textDivs&&this._textHighlighter&&this.#$d(t.textDivs)}catch(e){console.error("#renderXfaLayer:",e),t=e}finally{this.xfaLayer?.div&&(this.l10n.pause(),this.#Od(this.xfaLayer.div,"xfaLayer"),this.l10n.resume()),this.#jd("xfalayerrendered",t)}}async#Wd(){if(!this.textLayer)return;let t=null;try{await this.textLayer.render({viewport:this.viewport})}catch(e){if(e instanceof a)return;console.error("#renderTextLayer:",e),t=e}this.#jd("textlayerrendered",t),this.#Gd()}async#Gd(){if(!this.textLayer)return;const t=await(this.structTreeLayer?.render());t&&(this.l10n.pause(),this.structTreeLayer?.updateTextLayer(),this.canvas&&t.parentNode!==this.canvas&&this.canvas.append(t),this.l10n.resume()),this.structTreeLayer?.show()}async#$d(t){const e=await this.pdfPage.getTextContent(),i=[];for(const t of e.items)i.push(t.str);this._textHighlighter.setTextMapping(t,i),this._textHighlighter.enable()}async#Xd(t){let e=null;try{if(await t,!this.annotationLayer)return;await this.annotationLayer.injectLinkAnnotations(Vi.processLinks(this))}catch(t){console.error("#injectLinkAnnotations:",t),e=t}}_resetCanvas(){super._resetCanvas(),this.#Dd=null}reset({keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:e=!1,keepXfaLayer:i=!1,keepTextLayer:n=!1,keepCanvasWrapper:r=!1,preserveDetailVie
2wState:s=!1}={}){const a=this.pdfPage?._pdfBug??!1;this.cancelRendering({keepAnnotationLayer:t,keepAnnotationEditorLayer:e,keepXfaLayer:i,keepTextLayer:n}),this.renderingState=ht.INITIAL;const o=this.div,l=o.childNodes,h=t&&this.annotationLayer?.div||null,c=e&&this.annotationEditorLayer?.div||null,d=i&&this.xfaLayer?.div||null,u=n&&this.textLayer?.div||null,p=r&&this.#Cd||null;for(let t=l.length-1;t>=0;t--){const e=l[t];switch(e){case h:case c:case d:case u:case p:continue}if(a&&e.classList.contains("pdfBugGroupsLayer"))continue;e.remove();const i=this.#Bd.indexOf(e);i>=0&&(this.#Bd[i]=null)}o.removeAttribute("data-loaded"),h&&this.annotationLayer.hide(),c&&this.annotationEditorLayer.hide(),d&&this.xfaLayer.hide(),u&&this.textLayer.hide(),this.structTreeLayer?.hide(),!r&&this.#Cd&&(this.#Cd=null,this._resetCanvas()),s||(this.detailView?.reset({keepCanvas:r}),r||(this.detailView=null))}toggleEditingMode(t){this.#Qe=t,this.hasEditableAnnotations()&&this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0})}updateVisibleArea(t){this.enableDetailCanvas&&(this.#Pd&&this.maxCanvasPixels>0&&t?(this.detailView??=new Gi({pageView:this,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering}),this.detailView.update({visibleArea:t})):this.detailView&&(this.detailView.reset(),this.detailView=null))}update({scale:t=0,rotation:e=null,optionalContentConfigPromise:i=null,drawingDelay:n=-1}){this.scale=t||this.scale,"number"==typeof e&&(this.rotation=e),i instanceof Promise&&(this._optionalContentConfigPromise=i,i.then(t=>{i===this._optionalContentConfigPromise&&(this.#Rd.initialOptionalContent=t.hasInitialVisibility)})),this.#Rd.directDrawing=!0;const r=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*X.PDF_TO_CSS_UNITS,rotation:r}),this.#Nd(),this._isStandalone&&this._container?.style.setProperty("--scale-factor",this.viewport.scale),this.#qd(),this.canvas){const t=this.#_d&&this.#Pd,e=n>=0&&n<1e3;if(e||t)return e&&!t&&this.renderingState!==ht.FINISHED&&(this.cancelRendering({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:n}),this.renderingState=ht.FINISHED,this.#Rd.directDrawing=!1),this.cssTransform({redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!e,hideTextLayer:e}),void(e||(this.detailView?.update({underlyingViewUpdated:!0}),this.dispatchPageRendered(!0,!1)))}this.cssTransform({}),this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0,preserveDetailViewState:!0}),this.detailView?.update({underlyingViewUpdated:!0})}#qd(){const{width:t,height:e}=this.viewport,i=this.outputScale=new U;if(0===this.maxCanvasPixels){const t=1/this.scale;i.sx*=t,i.sy*=t,this.#Pd=!0}else if(this.#Pd=i.limitCanvas(t,e,this.maxCanvasPixels,this.maxCanvasDim,this.capCanvasAreaFactor),this.#Pd&&this.enableDetailCanvas){const t=this.enableOptimizedPartialRendering?4:2;i.sx/=t,i.sy/=t}}cancelRendering({keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:e=!1,keepXfaLayer:i=!1,keepTextLayer:n=!1,cancelExtraDelay:r=0}={}){super.cancelRendering({cancelExtraDelay:r}),!this.textLayer||n&&this.textLayer.div||(this.textLayer.cancel(),this.textLayer=null),!this.annotationLayer||t&&this.annotationLayer.div||(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),!this.annotationEditorLayer||e&&this.annotationEditorLayer.div||(this.drawLayer&&(this.drawLayer.cancel(),this.drawLayer=null),this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),!this.xfaLayer||i&&this.xfaLayer.div||(this.xfaLayer.cancel(),this.xfaLayer=null,this._textHighlighter?.disable())}cssTransform({redrawAnnotationLayer:t=!1,redrawAnnotationEditorLayer:e=!1,redrawXfaLayer:i=!1,redrawTextLayer:n=!1,hideTextLayer:r=!1}){const{canvas:s}=this;if(!s)return;const a=this.#Dd;if(this.viewport!==a){const t=(360+this.viewport.rotation-a.rotation)%360;if(90===t||270===t){const{width:e,height:i}=this.viewport,n=i/e,r=e/i;s.style.transform=`rotate(${t}deg) scale(${n},${r})`}else s.style.transform=0===t?"":`rotate(${t}deg)`}t&&this.annotationLayer&&this.#Ud(),e&&this.annotationEditorLayer&&(this.drawLayer&&this.#Hd(),this.#zd()),i&&this.xfaLayer&&this.#Vd(),this.textLayer&&(r?(this.textLayer.hide(),this.structTreeLayer?.hide()):n&&this.#Wd())}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(t,e){return this.viewport.convertToPdfPoint(t,e)}_ensureCanvasWrapper(){let t=this.#Cd;return t||(t=this.#Cd=document.createElement("div"),t.classList.add("canvasWrapper"),this.#Od(t,"canvasWrapper")),t}_getRenderingContext(t,e,i){return{canvas:t,transform:e,viewport:this.viewport,annotationMode:this.#Ed,optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors,isEditing:this.#Qe,recordOperations:i}}async draw(){this.renderingState!==ht.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:t,l10n:e,pdfPage:i,viewport:n}=this;if(!i)throw this.renderingState=ht.FINISHED,new Error("pdfPage is not loaded");this.renderingState=ht.RUNNING;const r=this._ensureCanvasWrapper();if(this.textLayer||this.#kd===gt||i.isPureXfa||(this._accessibilityManager||=new Zi,this.textLayer=new en({pdfPage:i,highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,enablePermissions:this.#kd===mt,onAppend:t=>{this.l10n.pause(),this.#Od(t,"textLayer"),this.l10n.resume()}})),!this.annotationLayer&&this.#Ed!==u.DISABLE){const{annotationStorage:t,annotationEditorUIManager:e,downloadManager:n,enableComment:r,enableScripting:s,fieldObjectsPromise:a,hasJSActionsProm
2ise:o,linkService:l}=this.#Td;this._annotationCanvasMap||=new Map,this.annotationLayer=new se({pdfPage:i,annotationStorage:t,imageResourcesPath:this.imageResourcesPath,renderForms:this.#Ed===u.ENABLE_FORMS,linkService:l,downloadManager:n,enableComment:r,enableScripting:s,hasJSActionsPromise:o,fieldObjectsPromise:a,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager,annotationEditorUIManager:e,commentManager:this.#K,onAppend:t=>{this.#Od(t,"annotationLayer")}})}const{width:s,height:a}=n;this.#Dd=n;const{canvas:o,prevCanvas:l}=this._createCanvas(t=>{r.prepend(t)});o.setAttribute("role","presentation"),this.outputScale||this.#qd();const{outputScale:h}=this;this.#_d=this.#Pd;const c=Ct(h.sx),d=Ct(h.sy),p=o.width=St(Mt(s*h.sx),c[0]),g=o.height=St(Mt(a*h.sy),d[0]),f=St(Mt(s),c[1]),m=St(Mt(a),d[1]);h.sx=p/f,h.sy=g/m,this.#Fd!==c[1]&&(t.style.setProperty("--scale-round-x",`${c[1]}px`),this.#Fd=c[1]),this.#Id!==d[1]&&(t.style.setProperty("--scale-round-y",`${d[1]}px`),this.#Id=d[1]);const b=this.enableOptimizedPartialRendering&&this.#_d&&!this.recordedBBoxes,v=h.scaled?[h.sx,0,0,h.sy,0,0]:null,y=this._drawCanvas(this._getRenderingContext(o,v,b),()=>{l?.remove(),this._resetCanvas()},t=>{this.#Rd.regularAnnotations=!t.separateAnnots,this.dispatchPageRendered(!1,!1)}).then(async()=>{if(this.renderingState!==ht.FINISHED)return;this.structTreeLayer||=new Qi(i,n.rawDims);const t=this.#Wd();this.annotationLayer&&(await this.#Ud(),this.#Sd&&this.annotationLayer&&this.textLayer&&await this.#Xd(t));const{annotationEditorUIManager:s}=this.#Td;s&&(this.drawLayer||=new Wi,await this.#Hd(),this.drawLayer.setParent(r),(this.annotationLayer||this.#Ed===u.DISABLE)&&(this.annotationEditorLayer||=new Di({uiManager:s,pdfPage:i,l10n:e,structTreeLayer:this.structTreeLayer,accessibilityManager:this._accessibilityManager,annotationLayer:this.annotationLayer?.annotationLayer,textLayer:this.textLayer,drawLayer:this.drawLayer.getDrawLayer(),onAppend:t=>{this.#Od(t,"annotationEditorLayer")}}),this.#zd()))});if(i.isPureXfa){if(!this.xfaLayer){const{annotationStorage:t,linkService:e}=this.#Td;this.xfaLayer=new nn({pdfPage:i,annotationStorage:t,linkService:e})}this.#Vd()}return t.setAttribute("data-loaded",!0),this.dispatchPageRender(),y}setPageLabel(t){this.pageLabel="string"==typeof t?t:null,this.div.setAttribute("data-l10n-args",JSON.stringify({page:this.pageLabel??this.id})),null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{directDrawing:t,initialOptionalContent:e,regularAnnotations:i}=this.#Rd;return t&&e&&i?this.canvas:null}}class on{constructor(t){this._ready=new Promise((e,i)=>{import(t).then(t=>{e(t.QuickJSSandbox())}).catch(i)})}async createSandbox(t){(await this._ready).create(t)}async dispatchEventInSandbox(t){const e=await this._ready;setTimeout(()=>e.dispatchEvent(t),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}class ln{#Yd=null;#Kd=null;#Jd=null;#uc=null;#Ms=null;#Qd=null;#Pt=null;#Zd=null;#tu=!1;#eu=null;#iu=null;constructor({eventBus:t,externalServices:e=null,docProperties:i=null}){this.#Ms=t,this.#Qd=e,this.#Jd=i}setViewer(t){this.#Zd=t}async setDocument(t){if(this.#Pt&&await this.#nu(),this.#Pt=t,!t)return;const[e,i,n]=await Promise.all([t.getFieldObjects(),t.getCalculationOrderIds(),t.getJSActions()]);if(!e&&!n)return void await this.#nu();if(t!==this.#Pt)return;try{this.#eu=this.#ru()}catch(t){return console.error("setDocument:",t),void await this.#nu()}const r=this.#Ms;this.#uc=new AbortController;const{signal:s}=this.#uc;r._on("updatefromsandbox",t=>{t?.source===window&&this.#su(t.detail)},{signal:s}),r._on("dispatcheventinsandbox",t=>{this.#eu?.dispatchEventInSandbox(t.detail)},{signal:s}),r._on("pagechanging",({pageNumber:t,previous:e})=>{t!==e&&(this.#au(e),this.#ou(t))},{signal:s}),r._on("pagerendered",({pageNumber:t})=>{this._pageOpenPending.has(t)&&t===this.#Zd.currentPageNumber&&this.#ou(t)},{signal:s}),r._on("pagesdestroy",async()=>{await this.#au(this.#Zd.currentPageNumber),await(this.#eu?.dispatchEventInSandbox({id:"doc",name:"WillClose"})),this.#Yd?.resolve()},{signal:s});try{const s=await this.#Jd(t);
2if(t!==this.#Pt)return;await this.#eu.createSandbox({objects:e,calculationOrder:i,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...s,actions:n}}),r.dispatch("sandboxcreated",{source:this})}catch(t){return console.error("setDocument:",t),void await this.#nu()}await(this.#eu?.dispatchEventInSandbox({id:"doc",name:"Open"})),await this.#ou(this.#Zd.currentPageNumber,!0),Promise.resolve().then(()=>{t===this.#Pt&&(this.#tu=!0)})}async dispatchWillSave(){return this.#eu?.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(){return this.#eu?.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(){if(this.#eu){await(this.#iu?.promise),this.#iu=Promise.withResolvers();try{await this.#eu.dispatchEventInSandbox({id:"doc",name:"WillPrint"})}catch(t){throw this.#iu.resolve(),this.#iu=null,t}await this.#iu.promise}}async dispatchDidPrint(){return this.#eu?.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){return this.#Kd?.promise||null}get ready(){return this.#tu}get _pageOpenPending(){return Q(this,"_pageOpenPending",new Set)}get _visitedPages(){return Q(this,"_visitedPages",new Map)}async#su(t){const e=this.#Zd,i=e.isInPresentationMode||e.isChangingPresentationMode,{id:n,siblings:r,command:s,value:a}=t;if(!n){switch(s){case"clear":console.clear();break;case"error":console.error(a);break;case"layout":if(!i){const t=function(t){let e=bt.VERTICAL,i=vt.NONE;switch(t){case"SinglePage":e=bt.PAGE;break;case"OneColumn":break;case"TwoPageLeft":e=bt.PAGE;case"TwoColumnLeft":i=vt.ODD;break;case"TwoPageRight":e=bt.PAGE;case"TwoColumnRight":i=vt.EVEN}return{scrollMode:e,spreadMode:i}}(a);e.spreadMode=t.spreadMode}break;case"page-num":e.currentPageNumber=a+1;break;case"print":await e.pagesPromise,this.#Ms.dispatch("print",{source:this});break;case"println":console.log(a);break;case"zoom":i||(e.currentScaleValue=a);break;case"SaveAs":this.#Ms.dispatch("download",{source:this});break;case"FirstPage":e.currentPageNumber=1;break;case"LastPage":e.currentPageNumber=e.pagesCount;break;case"NextPage":e.nextPage();break;case"PrevPage":e.previousPage();break;case"ZoomViewIn":i||e.increaseScale();break;case"ZoomViewOut":i||e.decreaseScale();break;case"WillPrintFinished":this.#iu?.resolve(),this.#iu=null}return}if(i&&t.focus)return;delete t.id,delete t.siblings;const o=r?[n,...r]:[n];for(const e of o){const i=document.querySelector(`[data-element-id="${e}"]`);i?i.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:t})):this.#Pt?.annotationStorage.setValue(e,t)}}async#ou(t,e=!1){const i=this.#Pt,n=this._visitedPages;if(e&&(this.#Yd=Promise.withResolvers()),!this.#Yd)return;const r=this.#Zd.getPageView(t-1);if(r?.renderingState!==ht.FINISHED)return void this._pageOpenPending.add(t);this._pageOpenPending.delete(t);const s=(async()=>{const e=await(n.has(t)?null:r.pdfPage?.getJSActions());i===this.#Pt&&await(this.#eu?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:t,actions:e}))})();n.set(t,s)}async#au(t){const e=this.#Pt,i=this._visitedPages;if(!this.#Yd)return;if(this._pageOpenPending.has(t))return;const n=i.get(t);n&&(i.set(t,null),await n,e===this.#Pt&&await(this.#eu?.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:t})))}#ru(){if(this.#Kd=Promise.withResolvers(),this.#eu)throw new Error("#initScripting: Scripting already exists.");return this.#Qd.createScripting()}async#nu(){if(!this.#eu)return this.#Pt=null,void this.#Kd?.resolve();this.#Yd&&(await Promise.race([this.#Yd.promise,new Promise(t=>{setTimeout(t,1e3)})]).catch(()=>{}),this.#Yd=null),this.#Pt=null;try{await this.#eu.destroySandbox()}catch{}this.#iu?.reject(new Error("Scripting destroyed.")),this.#iu=null,this.#uc?.abort(),this.#uc=null,this._pageOpenPending.clear(),this._visitedPages.clear(),this.#eu=null,this.#tu=!1,this.#Kd?.resolve()}}class hn extends ln{constructor(t){t.externalServices||window.addEventListener("updatefromsandbox",e=>{t.eventBus.dispatch("updatefromsandbox",{source:window,detail:e.detail})}),t.externalServices||={createScripting:()=>new on(t.sandboxBundleSrc)},t.docProperties||=t=>async function(t){const{info:e,metadata:i,contentDispositionFilename:n,contentLength:r}=await t.getMetadata();return{...e,baseURL:"",filesize:r||(await t.getDownloadInfo()).length,filename:n||_(""),metadata:i?.getRaw(),authors:i?.get("dc:creator"),numPages:t.numPages,URL:""}}(t),super(t)}}s(1148),s(3579);
2class cn{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1,Object.defineProperty(this,"hasViewer",{value:()=>!!this.pdfViewer})}setViewer(t){this.pdfViewer=t}setThumbnailViewer(t){this.pdfThumbnailViewer=t}isHighestPriority(t){return this.highestPriorityPage===t.renderingId}renderHighestPriority(t){this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),this.pdfViewer.forceRendering(t)||this.isThumbnailViewEnabled&&this.pdfThumbnailViewer?.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}getHighestPriority(t,e,i,n=!1,r=!1){const s=t.views,a=s.length;if(0===a)return null;for(let t=0;t<a;t++){const e=s[t].view;if(!this.isViewFinished(e))return e}if(!r)for(let t=0;t<a;t++){const{detailView:e}=s[t].view;if(e&&!this.isViewFinished(e))return e}const o=t.first.id,l=t.last.id;if(l-o+1>a){const n=t.ids;for(let t=1,r=l-o;t<r;t++){const r=i?o+t:l-t;if(n.has(r))continue;const s=e[r-1];if(!this.isViewFinished(s))return s}}let h=i?l:o-2,c=e[h];return c&&!this.isViewFinished(c)||n&&(h+=i?1:-1,c=e[h],c&&!this.isViewFinished(c))?c:null}isViewFinished(t){return t.renderingState===ht.FINISHED}renderView(t){switch(t.renderingState){case ht.FINISHED:return!1;case ht.PAUSED:this.highestPriorityPage=t.renderingId,t.resume();break;case ht.RUNNING:this.highestPriorityPage=t.renderingId;break;case ht.INITIAL:this.highestPriorityPage=t.renderingId,t.draw().finally(()=>{this.renderHighestPriority()}).catch(t=>{t instanceof q||console.error("renderView:",t)})}return!0}}const dn=1e4,un=5e3,pn=250;function gn(t){return Object.values(h).includes(t)&&t!==h.DISABLE}class fn{#lu=new Set;#hu=0;constructor(t){this.#hu=t}push(t){const e=this.#lu;e.has(t)&&e.delete(t),e.add(t),e.size>this.#hu&&this.#cu()}resize(t,e=null){this.#hu=t;const i=this.#lu;if(e){const t=i.size;let n=1;for(const r of i)if(e.has(r.id)&&(i.delete(r),i.add(r)),++n>t)break}for(;i.size>this.#hu;)this.#cu()}has(t){return this.#lu.has(t)}[Symbol.iterator](){return this.#lu.keys()}#cu(){const t=this.#lu.keys().next().value;t?.destroy(),this.#lu.delete(t)}}class mn{#Ri=null;#G=null;#du=null;#uu=h.NONE;#pu=null;#Ed=u.ENABLE_FORMS;#K=null;#gu=null;#fu=null;#an=!1;#rt=!1;#md=!1;#st=!1;#at=!1;#Sd=!0;#uc=null;#Vc=0;#At=null;#mu=!0;#bu=null;#vu=null;#yu=null;#wu=!1;#Au=null;#xu=!1;#Eu=0;#Cu=new ResizeObserver(this.#Su.bind(this));#_u=null;#Tu=null;#St=null;#Pu=!0;#kd=ft;#Lt=null;#es=z.instance;constructor(t){const e="5.4.624";if(ot!==e)throw new Error(`The API version "${ot}" does not match the Viewer version "${e}".`);if(this.container=t.container,this.viewer=t.viewer||t.container.firstElementChild,this.#Lt=t.viewerAlert||null,"DIV"!==this.container?.tagName||"DIV"!==this.viewer?.tagName)throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&"absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");this.#Cu.observe(this.container),this.eventBus=t.eventBus,this.linkService=t.linkService||new re,this.downloadManager=t.downloadManager||null,this.findController=t.findController||null,this.#G=t.altTextManager||null,this.#K=t.commentManager||null,this.#St=t.signatureManager||null,this.#fu=t.editorUndoBar||null,this.findController&&(this.findController.onIsPageVisible=t=>this._getVisiblePages().ids.has(t)),this._scriptingManager=t.scriptingManager||null,this.#kd=t.textLayerMode??ft,this.#Ed=t.annotationMode??u.ENABLE_FORMS,this.#uu=t.annotationEditorMode??h.NONE,this.#du=t.annotationEditorHighlightColors||null,this.#rt=!0===t.enableHighlightFloatingButton,this.#st=!0===t.enableUpdatedAddImage,this.#at=!0===t.enableNewAltTextWhenAddingImage,this.imageResourcesPath=t.imageResourcesPath||"",this.enablePrintAutoRotate=t.enablePrintAutoRotate||!1,this.removePageBorders=t.removePageBorders||!1,this.maxCanvasPixels=t.maxCanvasPixels,this.maxCanvasDim=t.maxCanvasDim,this.capCanvasAreaFactor=t.capCanvasAreaFactor,this.enableDetailCanvas=t.enableDetailCanvas??!0,this.enableOptimizedPartialRendering=t.enableOptimizedPartialRendering??!1,this.l10n=t.l10n,this.l10n||=new _i,this.#md=t.enablePermissions||!1,this.pageColors=t.pageColors||null,this.#At=t.mlManager||null,this.#an=t.enableHWA||!1,this.#Pu=!1!==t.supportsPinchToZoom,this.#Sd=!1!==t.enableAutoLinking,this.#Vc=t.minDurationToUpdateCanvas??500,this.defaultRenderingQueue=!t.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new cn,this.renderingQueue.setViewer(this)):this.renderingQueue=t.renderingQueue;
2const{abortSignal:i}=t;i?.addEventListener("abort",()=>{this.#Cu.disconnect(),this.#Cu=null},{once:!0}),this.scroll=function(t,e,i){const n=function(i){s||(s=window.requestAnimationFrame(function(){s=null;const i=t.scrollLeft,n=r.lastX;i!==n&&(r.right=i>n),r.lastX=i;const a=t.scrollTop,o=r.lastY;a!==o&&(r.down=a>o),r.lastY=a,e(r)}))},r={right:!0,down:!0,lastX:t.scrollLeft,lastY:t.scrollTop,_eventHandler:n};let s=null;return t.addEventListener("scroll",n,{useCapture:!0,signal:i}),i?.addEventListener("abort",()=>window.cancelAnimationFrame(s),{once:!0}),r}(this.container,this._scrollUpdate.bind(this),i),this.presentationModeState=ct,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),this.#Du(),this.eventBus._on("thumbnailrendered",({pageNumber:t,pdfPage:e})=>{const i=this._pages[t-1];this.#Ri.has(i)||e?.cleanup()}),t.l10n||this.l10n.translate(this.container)}get printingAllowed(){return this.#mu}get pagesCount(){return this._pages.length}getPageView(t){return this._pages[t]}getCachedPageViews(){return new Set(this.#Ri)}get pageViewsReady(){return this._pages.every(t=>t?.pdfPage)}get renderForms(){return this.#Ed===u.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(t){if(!Number.isInteger(t))throw new Error("Invalid page number.");this.pdfDocument&&(this._setCurrentPageNumber(t,!0)||console.error(`currentPageNumber: "${t}" is not a valid page.`))}_setCurrentPageNumber(t,e=!1){if(this._currentPageNumber===t)return e&&this.#Mu(),!0;if(!(0<t&&t<=this.pagesCount))return!1;const i=this._currentPageNumber;return this._currentPageNumber=t,this.eventBus.dispatch("pagechanging",{source:this,pageNumber:t,pageLabel:this._pageLabels?.[t-1]??null,previous:i}),e&&this.#Mu(),!0}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(t){if(!this.pdfDocument)return;let e=0|t;if(this._pageLabels){const i=this._pageLabels.indexOf(t);i>=0&&(e=i+1)}this._setCurrentPageNumber(e,!0)||console.error(`currentPageLabel: "${t}" is not a valid page.`)}get currentScale(){return 0!==this._currentScale?this._currentScale:1}set currentScale(t){if(isNaN(t))throw new Error("Invalid numeric scale.");this.pdfDocument&&this.#Fu(t,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(t){this.pdfDocument&&this.#Fu(t,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(t){if(!_t(t))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument)return;if((t%=360)<0&&(t+=360),this._pagesRotation===t)return;this._pagesRotation=t;const e=this._currentPageNumber;this.refresh(!0,{rotation:t}),this._currentScaleValue&&this.#Fu(this._currentScaleValue,{noScroll:!0}),this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:t,pageNumber:e}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _layerProperties(){const t=this;return Q(this,"_layerProperties",{get annotationEditorUIManager(){return t.#pu},get annotationStorage(){return t.pdfDocument?.annotationStorage},get downloadManager(){return t.downloadManager},get enableComment(){return!!t.#K},get enableScripting(){return!!t._scriptingManager},get fieldObjectsPromise(){return t.pdfDocument?.getFieldObjects()},get findController(){return t.findController},get hasJSActionsPromise(){return t.pdfDocument?.hasJSActions()},get linkService(){return t.linkService}})}#Iu(t){const e={annotationEditorMode:this.#uu,annotationMode:this.#Ed,textLayerMode:this.#kd};return t?(this.#mu=t.includes(G.PRINT_HIGH_QUALITY)||t.includes(G.PRINT),this.eventBus.dispatch("printingallowed",{source:this,isAllowed:this.#mu}),t.includes(G.COPY)||this.#kd!==ft||(e.textLayerMode=mt),t.includes(G.MODIFY_CONTENTS)||(e.annotationEditorMode=h.DISABLE),t.includes(G.MODIFY_ANNOTATIONS)||t.includes(G.FILL_INTERACTIVE_FORMS)||this.#Ed!==u.ENABLE_FORMS||(e.annotationMode=u.ENABLE),e):(this.#mu=!0,this.eventBus.dispatch("printingallowed",{source:this,isAllowed:this.#mu}),e)}async#ku(t){if("hidden"===document.visibilityState||!this.container.offsetParent||0===this._getVisiblePages().views.length)return;const e=Promise.withResolvers(),i=new AbortController;document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&e.resolve()},{signal:AbortSignal.any([t,i.signal])}),await Promise.race([this._onePageRenderedCapability.promise,e.promise]),i.abort()}async getAllText(){const t=[],e=[];for(let i=1,n=this.pdfDocument.numPages;i<=n;++i){if(this.#xu)return null;e.length=0;const n=await this.pdfDocument.getPage(i),{items:r}=await n.getTextContent();for(const t of r)t.str&&e.push(t.str),t.hasEOL&&e.push("\n");t.push(xt(e.join("")))}return t.join("\n")}#Lu(t,e){const i=document.getSelection(),{focusNode:n,anchorNode:r}=i;if(r&&n&&i.containsNode(this.#Au)){if(this.#wu||t===mt)return void tt(e);this.#wu=!0;const{classList:i}=this.viewer;i.add("copyAll");const n=new AbortController;window.addEventListener("keydown",t=>this.#xu="Escape"===t.key,{signal:n.signal}),this.getAllText().then(async t=>{null!==t&&await navigator.clipboard.writeText(t)}
2).catch(t=>{console.warn(`Something goes wrong when extracting the text: ${t.message}`)}).finally(()=>{this.#wu=!1,this.#xu=!1,n.abort(),i.remove("copyAll")}),tt(e)}}setDocument(t){if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),this.findController?.setDocument(null),this._scriptingManager?.setDocument(null),this.#pu?.destroy(),this.#pu=null,this.#uu=h.NONE,this.#mu=!0,this.#es.pagesNumber=0),this.pdfDocument=t,!t)return;const e=t.numPages,i=t.getPage(1),n=t.getOptionalContentConfig({intent:"display"}),r=this.#md?t.getPermissions():Promise.resolve(),{eventBus:s,pageColors:a,viewer:o}=this;this.#uc=new AbortController;const{signal:l}=this.#uc;if(e>dn){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const t=this._scrollMode=bt.PAGE;s.dispatch("scrollmodechanged",{source:this,mode:t})}this._pagesCapability.promise.then(()=>{s.dispatch("pagesloaded",{source:this,pagesCount:e})},()=>{});s._on("pagerender",t=>{const e=this._pages[t.pageNumber-1];e&&this.#Ri.push(e)},{signal:l});const d=t=>{t.cssTransform||t.isDetailView||(this._onePageRenderedCapability.resolve({timestamp:t.timestamp}),s._off("pagerendered",d))};s._on("pagerendered",d,{signal:l}),Promise.all([i,r]).then(([i,r])=>{if(t!==this.pdfDocument)return;this._firstPageCapability.resolve(i),this._optionalContentConfigPromise=n;const{annotationEditorMode:d,annotationMode:u,textLayerMode:p}=this.#Iu(r);if(p!==gt){const t=this.#Au=document.createElement("div");t.id="hiddenCopyElement",o.before(t)}if(d!==h.DISABLE){const e=d;t.isPureXfa?console.warn("Warning: XFA-editing is not implemented."):gn(e)?(this.#pu=new c(this.container,o,this.#Lt,this.#G,this.#K,this.#St,s,t,a,this.#du,this.#rt,this.#st,this.#at,this.#At,this.#fu,this.#Pu),s.dispatch("annotationeditoruimanager",{source:this,uiManager:this.#pu}),e!==h.NONE&&(this.#Ru(e),this.#pu.updateMode(e))):console.error(`Invalid AnnotationEditor mode: ${e}`)}const g=this._scrollMode===bt.PAGE?null:o,f=this.currentScale,m=i.getViewport({scale:f*X.PDF_TO_CSS_UNITS});o.style.setProperty("--scale-factor",m.scale),a?.background&&o.style.setProperty("--page-bg-color",a.background),"CanvasText"!==a?.foreground&&"Canvas"!==a?.background||(o.style.setProperty("--hcm-highlight-filter",t.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),o.style.setProperty("--hcm-highlight-selected-filter",t.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","ButtonText")));for(let t=1;t<=e;++t){const e=new an({container:g,eventBus:s,id:t,scale:f,defaultViewport:m.clone(),optionalContentConfigPromise:n,renderingQueue:this.renderingQueue,textLayerMode:p,annotationMode:u,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableDetailCanvas:this.enableDetailCanvas,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,pageColors:a,l10n:this.l10n,layerProperties:this._layerProperties,enableHWA:this.#an,enableAutoLinking:this.#Sd,minDurationToUpdateCanvas:this.#Vc,commentManager:this.#K});this._pages.push(e)}this._pages[0]?.setPdfPage(i),this._scrollMode===bt.PAGE?this.#Bu():this._spreadMode!==vt.NONE&&this._updateSpreadMode(),s._on("annotationeditorlayerrendered",t=>{this.#pu&&s.dispatch("annotationeditormodechanged",{source:this,mode:this.#uu})},{once:!0,signal:l}),this.#ku(l).then(async()=>{if(t!==this.pdfDocument)return;if(this.findController?.setDocument(t),this._scriptingManager?.setDocument(t),this.#Au&&document.addEventListener("copy",this.#Lu.bind(this,p),{signal:l}),t.loadingParams.disableAutoFetch||e>un)return void this._pagesCapability.resolve();let i=e-1;if(i<=0)this._pagesCapability.resolve();else for(let n=2;n<=e;++n){const e=t.getPage(n).then(t=>{const e=this._pages[n-1];e.pdfPage||e.setPdfPage(t),0===--i&&this._pagesCapability.resolve()},t=>{console.error(`Unable to get page ${n} to initialize viewer`,t),0===--i&&this._pagesCapability.resolve()});n%pn===0&&await e}}),s.dispatch("pagesinit",{source:this}),t.getMetadata().then(({info:e})=>{t===this.pdfDocument&&e.Language&&(o.lang=e.Language)}),this.defaultRenderingQueue&&this.update()}).catch(t=>{console.error("Unable to initialize viewer",t),this._pagesCapability.reject(t)})}async onBeforePagesEdited({pagesMapper:t}){await this._pagesCapability.promise,this._currentPageId=t.getPageId(this._currentPageNumber)}onPagesEdited({pagesMapper:t}){this._currentPageNumber=t.getPageNumber(this._currentPageId);const e=this._pages,i=this._pages=[];for(let n=0,r=t.pagesNumber;n<r;n++){const r=t.getPrevPageNumber(n+1)-1;if(-1===r)continue;const s=e[r];i[n]=s,s.updatePageNumber(n+1)}const n=this._scrollMode===bt.PAGE?null:this.viewer;if(n){n.replaceChildren();const e=document.createDocumentFragment();for(let n=0,r=t.pagesNumber;n<r;n++){const{div:t}=i[n];t.setAttribute("data-page-number",n+1),e.append(t)}n.append(e)}setTimeout(()=>{this.forceRendering()})}setPageLabels(t){if(this.pdfDocument){t?Array.isArray(t)&&this.pdfDocument.numPages===t.length?this._pageLabels=t:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let t=0,e=this._pages.length;t<e;t++)this._pages[t].setPageLabel(this._pageLabels?.[t]??null)}}_resetView(){this._pages=[],this._currentPageNumber=1,this._currentScale=0,this._currentScaleValue=null,this._pageLabels=null,this.#Ri=new fn(10),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=Promise.withResolvers(),this._onePageRenderedCapability=Promise.withResolvers(),this._pagesCapability=Promise.withResolvers(),this._scrollMode=bt.VERTICAL,this._previousScrollMode=bt.UNKNOWN,this._spreadMode=vt.NONE,this.#_u={previousPageNumber:1,scrollDown:!0,pages:[]},this.#uc?.abort(),this.#uc=null,this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),this.#Au?.remove(),this.#Au=null,this.#Nu(),this.#Ou()}#Bu(){if(this._scrollMode!==bt.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const t=this._currentPageNumber,e=this.#_u,i=this.viewer;if(i.textContent="",e.pages.length=0,this._spreadMode!==vt.NONE||this.isInPresentationMode){const n=new Set,r=this._spreadMode-1;-1===r?n.add(t-1):t%2!==r?(n.add(t-1),n.add(t)):(n.add(t-2),n.add(t-1));const s=document.createElement("div");if(s.className="spread",this.isInPresentationMode){const t=document.createElement("div");t.className="dummyPage",s.append(t)}for(const t of n){const i=this._pages[t];i&&(s.append(i.div),e.pages.push(i))}i.append(s)}else{const n=this._pages[t-1];i.append(n.div),e.pages.push(n)}e.scrollDown=t>=e.previousPageNumber,e.previousPageNumber=t}_scrollUpdate(){0!==this.pagesCount&&(this.#bu&&clearTimeout(this.#bu),this.#bu=setTimeout(()=>{this.#bu=null,this.update()},100),this.update())}#ju(t,e=null){const{div:i,id:n}=t;if(this._currentPageNumber!==n&&this._setCurrentPageNumber(n),this._scrollMode===bt.PAGE&&(this.#Bu(),this.update()),!e&&!this.isInPresentationMode){const t=i.offsetLeft+i.clientLeft,n=t+i.clientWidth,{scrollLeft:r,clientWidth:s}=this.container;(this._scrollMode===bt.HORIZONTAL||t<r||n>r+s)&&(e={left:0,top:0})}yt(i,e),!this._currentScaleValue&&this._location&&(this._location=null)}#Uu(t){return t===this._currentScale||Math.abs(t-this._currentScale)<1e-15}
2#zu(t,e,{noScroll:i=!1,preset:n=!1,drawingDelay:r=-1,origin:s=null}){if(this._currentScaleValue=e.toString(),this.#Uu(t))return void(n&&this.eventBus.dispatch("scalechanging",{source:this,scale:t,presetValue:e}));this.viewer.style.setProperty("--scale-factor",t*X.PDF_TO_CSS_UNITS);const a=r>=0&&r<1e3;this.refresh(!0,{scale:t,drawingDelay:a?r:-1}),a&&(this.#Tu=setTimeout(()=>{this.#Tu=null,this.refresh()},r));const o=this._currentScale;if(this._currentScale=t,!i){let e,i=this._currentPageNumber;if(!this._location||this.isInPresentationMode||this.isChangingPresentationMode||(i=this._location.pageNumber,e=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:i,destArray:e,allowNegativeOffset:!0}),Array.isArray(s)){const e=t/o-1,[i,n]=this.containerTopLeft;this.container.scrollLeft+=(s[0]-n)*e,this.container.scrollTop+=(s[1]-i)*e}}this.eventBus.dispatch("scalechanging",{source:this,scale:t,presetValue:n?e:void 0}),this.defaultRenderingQueue&&this.update()}get#Hu(){return this._spreadMode!==vt.NONE&&this._scrollMode!==bt.HORIZONTAL?2:1}#Fu(t,e){let i=parseFloat(t);if(i>0)e.preset=!1,this.#zu(i,t,e);else{const n=this._pages[this._currentPageNumber-1];if(!n)return;let r=40,s=5;this.isInPresentationMode?(r=s=4,this._spreadMode!==vt.NONE&&(r*=2)):this.removePageBorders?r=s=0:this._scrollMode===bt.HORIZONTAL&&([r,s]=[s,r]);const a=(this.container.clientWidth-r)/n.width*n.scale/this.#Hu,o=(this.container.clientHeight-s)/n.height*n.scale;switch(t){case"page-actual":i=1;break;case"page-width":i=a;break;case"page-height":i=o;break;case"page-fit":i=Math.min(a,o);break;case"auto":const e=Tt(n)?a:Math.min(o,a);i=Math.min(1.25,e);break;default:return void console.error(`#setScale: "${t}" is an unknown zoom value.`)}e.preset=!0,this.#zu(i,t,e)}}#Mu(){const t=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this.#Fu(this._currentScaleValue,{noScroll:!0}),this.#ju(t)}pageLabelToPageNumber(t){if(!this._pageLabels)return null;const e=this._pageLabels.indexOf(t);return e<0?null:e+1}scrollPageIntoView({pageNumber:t,destArray:e=null,allowNegativeOffset:i=!1,ignoreDestinationZoom:n=!1,center:r=null}){if(!this.pdfDocument)return;const s=Number.isInteger(t)&&this._pages[t-1];if(!s)return void console.error(`scrollPageIntoView: "${t}" is not a valid pageNumber parameter.`);if(this.isInPresentationMode||!e)return void this._setCurrentPageNumber(t,!0);let a,o,l=0,h=0,c=0,d=0;const u=s.rotation%180!=0,p=(u?s.height:s.width)/s.scale/X.PDF_TO_CSS_UNITS,g=(u?s.width:s.height)/s.scale/X.PDF_TO_CSS_UNITS;let f=0;switch(e[1].name){case"XYZ":l=e[2],h=e[3],f=e[4],l=null!==l?l:0,h=null!==h?h:g;break;case"Fit":case"FitB":f="page-fit";break;case"FitH":case"FitBH":h=e[2],f="page-width",null===h&&this._location?(l=this._location.left,h=this._location.top):("number"!=typeof h||h<0)&&(h=g);break;case"FitV":case"FitBV":l=e[2],c=p,d=g,f="page-height";break;case"FitR":l=e[2],h=e[3],c=e[4]-l,d=e[5]-h;let t=40,i=5;this.removePageBorders&&(t=i=0),a=(this.container.clientWidth-t)/c/X.PDF_TO_CSS_UNITS,o=(this.container.clientHeight-i)/d/X.PDF_TO_CSS_UNITS,f=Math.min(Math.abs(a),Math.abs(o));break;default:return void console.error(`scrollPageIntoView: "${e[1].name}" is not a valid destination type.`)}if(n||(f&&f!==this._currentScale?this.currentScaleValue=f:0===this._currentScale&&(this.currentScaleValue="auto")),"page-fit"===f&&!e[4])return void this.#ju(s);const m=[s.viewport.convertToViewportPoint(l,h),s.viewport.convertToViewportPoint(l+c,h+d)];let b=Math.min(m[0][0],m[1][0]),v=Math.min(m[0][1],m[1][1]);r?("both"!==r&&"vertical"!==r||(v-=(this.container.clientHeight-Math.abs(m[1][1]-m[0][1]))/2),"both"!==r&&"horizontal"!==r||(b-=(this.container.clientWidth-Math.abs(m[1][0]-m[0][0]))/2)):i||(b=Math.max(b,0),v=Math.max(v,0)),this.#ju(s,{left:b,top:v})}_updateLocation(t){const e=this._currentScale,i=this._currentScaleValue,n=parseFloat(i)===e?Math.round(1e4*e)/100:i,r=t.id,s=this._pages[r-1],a=this.container,o=s.getPagePoint(a.scrollLeft-t.x,a.scrollTop-t.y),l=Math.round(o[0]),h=Math.round(o[1]);let c=`#page=${r}`;this.isInPresentationMode||(c+=`&zoom=${n},${l},${h}`),this._location={pageNumber:r,scale:n,top:h,left:l,rotation:this._pagesRotation,pdfOpenParams:c}}update(){const t=this._getVisiblePages(),e=t.views,i=e.length;if(0===i)return;const n=Math.max(10,2*i+1);this.#Ri.resize(n,t.ids);for(const{view:t,visibleArea:i}of e)t.updateVisibleArea(i);for(const e of this.#Ri)t.ids.has(e.id)||e.updateVisibleArea(null);this.renderingQueue.renderHighestPriority(t);const r=this._spreadMode===vt.NONE&&(this._scrollMode===bt.PAGE||this._scrollMode===bt.VERTICAL),s=this._currentPageNumber;let a=!1;for(const t of e){if(t.percent<100)break;if(t.id===s&&r){a=!0;break}}this._setCurrentPageNumber(a?this._currentPageNumber:e[0].id),this._updateLocation(t.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}#Vu(){const t=this._getVisiblePages(),e=[],{ids:i,views:n}=t;
2for(const t of n){const{view:n}=t;n.hasEditableAnnotations()?e.push(t):i.delete(n.id)}return 0===e.length?null:(this.renderingQueue.renderHighestPriority({first:e[0],last:e.at(-1),views:e,ids:i}),i)}containsElement(t){return this.container.contains(t)}focus(){this.container.focus()}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return this.presentationModeState===pt}get isChangingPresentationMode(){return this.presentationModeState===ut}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const t=this._scrollMode===bt.PAGE?this.#_u.pages:this._pages,e=this._scrollMode===bt.HORIZONTAL,i=e&&this._isContainerRtl;return function({scrollEl:t,views:e,sortByVisibility:i=!1,horizontal:n=!1,rtl:r=!1}){const s=t.scrollTop,a=s+t.clientHeight,o=t.scrollLeft,l=o+t.clientWidth,h=[],c=new Set,d=e.length;let u=Et(e,n?function(t){const e=t.div,i=e.offsetLeft+e.clientLeft,n=i+e.clientWidth;return r?i<l:n>o}:function(t){const e=t.div;return e.offsetTop+e.clientTop+e.clientHeight>s});u>0&&u<d&&!n&&(u=function(t,e,i){if(t<2)return t;let n=e[t].div,r=n.offsetTop+n.clientTop;r>=i&&(n=e[t-1].div,r=n.offsetTop+n.clientTop);for(let i=t-2;i>=0&&(n=e[i].div,!(n.offsetTop+n.clientTop+n.clientHeight<=r));--i)t=i;return t}(u,e,s));let p=n?l:-1;for(let t=u;t<d;t++){const i=e[t],r=i.div,d=r.offsetLeft+r.clientLeft,u=r.offsetTop+r.clientTop,g=r.clientWidth,f=r.clientHeight,m=d+g,b=u+f;if(-1===p)b>=a&&(p=b);else if((n?d:u)>p)break;if(b<=s||u>=a||m<=o||d>=l)continue;const v=Math.max(0,s-u),y=Math.max(0,o-d),w=v+Math.max(0,b-a),A=(g-(y+Math.max(0,m-l)))/g,x=(f-w)/f*A*100|0;h.push({id:i.id,x:d,y:u,visibleArea:100===x?null:{minX:y,minY:v,maxX:Math.min(m,l)-d,maxY:Math.min(b,a)-u},view:i,percent:x,widthPercent:100*A|0}),c.add(i.id)}const g=h[0],f=h.at(-1);return i&&h.sort(function(t,e){const i=t.percent-e.percent;return Math.abs(i)>.001?-i:t.id-e.id}),{first:g,last:f,views:h,ids:c}}({scrollEl:this.container,views:t,sortByVisibility:!0,horizontal:e,rtl:i})}cleanup(){for(const t of this._pages)t.renderingState!==ht.FINISHED&&t.reset()}_cancelRendering(){for(const t of this._pages)t.cancelRendering()}async#$u(t){if(t.pdfPage)return t.pdfPage;try{const e=await this.pdfDocument.getPage(t.id);return t.pdfPage||t.setPdfPage(e),e}catch(t){return console.error("Unable to get page for page view",t),null}}#Wu(t){if(1===t.first?.id)return!0;if(t.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case bt.PAGE:return this.#_u.scrollDown;case bt.HORIZONTAL:return this.scroll.right}return this.scroll.down}forceRendering(t){const e=t||this._getVisiblePages(),i=this.#Wu(e),n=this._spreadMode!==vt.NONE&&this._scrollMode!==bt.HORIZONTAL,r=null!==this.#Tu||null!==this.#bu&&e.views.some(t=>t.detailView?.renderingCancelled),s=this.renderingQueue.getHighestPriority(e,this._pages,i,n,r);return!!s&&(this.#$u(s).then(()=>{this.renderingQueue.renderView(s)}),!0)}get hasEqualPageSizes(){const t=this._pages[0];for(let e=1,i=this._pages.length;e<i;++e){const i=this._pages[e];if(i.width!==t.width||i.height!==t.height)return!1}return!0}getPagesOverview(){let t;return this._pages.map(e=>{const i=e.pdfPage.getViewport({scale:1}),n=Tt(i);if(void 0===t)t=n;else if(this.enablePrintAutoRotate&&n!==t)return{width:i.height,height:i.width,rotation:(i.rotation-90)%360};return{width:i.width,height:i.height,rotation:i.rotation}})}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error("optionalContentConfigPromise: Not initialized yet."),this.pdfDocument.getOptionalContentConfig({intent:"display"})):Promise.resolve(null)}set optionalContentConfigPromise(t){if(!(t instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${t}`);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=t,this.refresh(!1,{optionalContentConfigPromise:t}),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:t}))}get scrollMode(){return this._scrollMode}set scrollMode(t){if(this._scrollMode!==t){if(!function(t){return Number.isInteger(t)&&Object.values(bt).includes(t)&&t!==bt.UNKNOWN}(t))throw new Error(`Invalid scroll mode: ${t}`);this.pagesCount>dn||(this._previousScrollMode=this._scrollMode,this._scrollMode=t,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:t}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(t=null){const e=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",e===bt.HORIZONTAL),i.classList.toggle("scrollWrapped",e===bt.WRAPPED),this.pdfDocument&&t&&(e===bt.PAGE?this.#Bu():this._previousScrollMode===bt.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#Fu(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(t,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(t){if(this._spreadMode!==t){if(!function(t){return Number.isInteger(t)&&Object.values(vt).includes(t)&&t!==vt.UNKNOWN}(t))throw new Error(`Invalid spread mode: ${t}`);this._spreadMode=t,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:t}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(t=null){if(!this.pdfDocument)return;const e=this.viewer,i=this._pages;if(this._scrollMode===bt.PAGE)this.#Bu();else if(e.textContent="",this._spreadMode===vt.NONE)for(const t of this._pages)e.append(t.div);else{const t=this._spreadMode-1;let n=null;for(let r=0,s=i.length;r<s;++r)null===n?(n=document.createElement("div"),n.className="spread",e.append(n)):r%2===t&&(n=n.cloneNode(!1),e.append(n)),n.append(i[r].div)}t&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#Fu(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(t,!0),this.update())}_getPageAdvance(t,e=!1){switch(this._scrollMode){case bt.WRAPPED:{const{views:i}=this._getVisiblePages(),n=new Map;for(const{id:t,y:e,percent:r,widthPercent:s}of i){if(0===r||s<100)continue;let i=n.get(e);i||n.set(e,i||=[]),i.push(t)}for(const i of n.values()){const n=i.indexOf(t);if(-1===n)continue;const r=i.length;if(1===r)break;
2if(e)for(let e=n-1,r=0;e>=r;e--){const n=i[e],r=i[e+1]-1;if(n<r)return t-r}else for(let e=n+1,s=r;e<s;e++){const n=i[e],r=i[e-1]+1;if(n>r)return r-t}if(e){const e=i[0];if(e<t)return t-e+1}else{const e=i[r-1];if(e>t)return e-t+1}break}break}case bt.HORIZONTAL:break;case bt.PAGE:case bt.VERTICAL:{if(this._spreadMode===vt.NONE)break;const i=this._spreadMode-1;if(e&&t%2!==i)break;if(!e&&t%2===i)break;const{views:n}=this._getVisiblePages(),r=e?t-1:t+1;for(const{id:t,percent:e,widthPercent:i}of n)if(t===r){if(e>0&&100===i)return 2;break}break}}return 1}nextPage(){const t=this._currentPageNumber,e=this.pagesCount;if(t>=e)return!1;const i=this._getPageAdvance(t,!1)||1;return this.currentPageNumber=Math.min(t+i,e),!0}previousPage(){const t=this._currentPageNumber;if(t<=1)return!1;const e=this._getPageAdvance(t,!0)||1;return this.currentPageNumber=Math.max(t-e,1),!0}updateScale({drawingDelay:t,scaleFactor:e=null,steps:i=null,origin:n}){if(null===i&&null===e)throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let r=this._currentScale;if(e>0&&1!==e)r=Math.round(r*e*100)/100;else if(i){const t=i>0?1.1:1/1.1,e=i>0?Math.ceil:Math.floor;i=Math.abs(i);do{r=e(10*(r*t).toFixed(2))/10}while(--i>0)}r=B(r,.1,10),this.#Fu(r,{noScroll:!1,drawingDelay:t,origin:n})}increaseScale(t={}){this.updateScale({...t,steps:t.steps??1})}decreaseScale(t={}){this.updateScale({...t,steps:-(t.steps??1)})}#Du(t=this.container.clientHeight){t!==this.#Eu&&(this.#Eu=t,Pt.setProperty("--viewer-container-height",`${t}px`))}#Su(t){for(const e of t)if(e.target===this.container){this.#Du(Math.floor(e.borderBoxSize[0].blockSize)),this.#gu=null;break}}get containerTopLeft(){return this.#gu||=[this.container.offsetTop,this.container.offsetLeft]}#Nu(){null!==this.#Tu&&(clearTimeout(this.#Tu),this.#Tu=null),null!==this.#bu&&(clearTimeout(this.#bu),this.#bu=null)}#Ou(){this.#vu?.abort(),this.#vu=null,null!==this.#yu&&(clearTimeout(this.#yu),this.#yu=null)}#Ru(t){switch(t){case h.STAMP:this.#At?.loadModel("altText");break;case h.SIGNATURE:this.#St?.loadSignatures()}}get annotationEditorMode(){return this.#pu?this.#uu:h.DISABLE}set annotationEditorMode({mode:t,editId:e=null,isFromKeyboard:i=!1,mustEnterInEditMode:n=!1,editComment:r=!1}){if(!this.#pu)throw new Error("The AnnotationEditor is not enabled.");if(this.#uu===t)return;if(!gn(t))throw new Error(`Invalid AnnotationEditor mode: ${t}`);if(!this.pdfDocument)return;this.#Ru(t);const{eventBus:s,pdfDocument:a}=this,o=async()=>{this.#Ou(),this.#uu=t,await this.#pu.updateMode(t,e,!0,i,n,r),t===this.#uu&&a===this.pdfDocument&&s.dispatch("annotationeditormodechanged",{source:this,mode:t})};if(t===h.NONE||this.#uu===h.NONE){const e=t!==h.NONE;e||this.pdfDocument.annotationStorage.resetModifiedIds(),this.cleanup();for(const t of this._pages)t.toggleEditingMode(e);const i=this.#Vu();if(e&&i){this.#Ou(),this.#vu=new AbortController;const t=AbortSignal.any([this.#uc.signal,this.#vu.signal]);return void s._on("pagerendered",({pageNumber:t})=>{i.delete(t),0===i.size&&(this.#yu=setTimeout(o,0))},{signal:t})}}o()}refresh(t=!1,e=Object.create(null)){if(this.pdfDocument){for(const t of this._pages)t.update(e);this.#Nu(),t||this.update()}}}class bn extends mn{_resetView(){super._resetView(),this._scrollMode=bt.PAGE,this._spreadMode=vt.NONE}set scrollMode(t){}_updateScrollMode(){}set spreadMode(t){}_updateSpreadMode(){}}globalThis.pdfjsViewer={AnnotationLayerBuilder:se,DownloadManager:oe,EventBus:ce,FindState:Ut,GenericL10n:_i,LinkTarget:ie,parseQueryString:wt,PDFFindController:ee,PDFHistory:Pi,PDFLinkService:ne,PDFPageView:an,PDFScriptingManager:hn,PDFSinglePageViewer:bn,PDFViewer:mn,ProgressBar:Dt,Re
2nderingStates:ht,ScrollMode:bt,SimpleLinkService:re,SpreadMode:vt,StructTreeLayerBuilder:Qi,TextLayerBuilder:en,XfaLayerBuilder:nn},i.d(e,["M9",0,ie,"VT",0,bt,"Xf",0,vt,"Xv",0,ht,"tx",0,Ut])}}]);
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.