@iamjariwala/react-doc-viewer 0.2.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,797 +0,0 @@
1
- "use strict";var lA=Object.defineProperty;var cA=(i,t,e)=>t in i?lA(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var ft=(i,t,e)=>(cA(i,typeof t!="symbol"?t+"":t,e),e),Pp=(i,t,e)=>{if(!t.has(i))throw TypeError("Cannot "+e)};var l=(i,t,e)=>(Pp(i,t,"read from private field"),e?e.call(i):t.get(i)),m=(i,t,e)=>{if(t.has(i))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(i):t.set(i,e)},w=(i,t,e,n)=>(Pp(i,t,"write to private field"),n?n.call(i,e):t.set(i,e),e);var Ve=(i,t,e,n)=>({set _(s){w(i,t,s,e)},get _(){return l(i,t,n)}}),A=(i,t,e)=>(Pp(i,t,"access private method"),e);const T=require("react/jsx-runtime"),I=require("react");var vo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Gm(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function hA(i){if(i.__esModule)return i;var t=i.default;if(typeof t=="function"){var e=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(i).forEach(function(n){var s=Object.getOwnPropertyDescriptor(i,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:function(){return i[n]}})}),e}var Ya=function(i){return i&&i.Math===Math&&i},ti=Ya(typeof globalThis=="object"&&globalThis)||Ya(typeof window=="object"&&window)||Ya(typeof self=="object"&&self)||Ya(typeof vo=="object"&&vo)||Ya(typeof vo=="object"&&vo)||function(){return this}()||Function("return this")(),Vm={},_s=function(i){try{return!!i()}catch{return!0}},dA=_s,eo=!dA(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),uA=_s,tb=!uA(function(){var i=(function(){}).bind();return typeof i!="function"||i.hasOwnProperty("prototype")}),fA=tb,id=Function.prototype.call,Wm=fA?id.bind(id):function(){return id.apply(id,arguments)},eb={},nb={}.propertyIsEnumerable,ib=Object.getOwnPropertyDescriptor,pA=ib&&!nb.call({1:2},1);eb.f=pA?function(t){var e=ib(this,t);return!!e&&e.enumerable}:nb;var sb=function(i,t){return{enumerable:!(i&1),configurable:!(i&2),writable:!(i&4),value:t}},rb=tb,ob=Function.prototype,rg=ob.call,gA=rb&&ob.bind.bind(rg,rg),zi=rb?gA:function(i){return function(){return rg.apply(i,arguments)}},ab=zi,mA=ab({}.toString),vA=ab("".slice),bA=function(i){return vA(mA(i),8,-1)},yA=zi,wA=_s,AA=bA,Rp=Object,xA=yA("".split),EA=wA(function(){return!Rp("z").propertyIsEnumerable(0)})?function(i){return AA(i)==="String"?xA(i,""):Rp(i)}:Rp,lb=function(i){return i==null},_A=lb,SA=TypeError,cb=function(i){if(_A(i))throw new SA("Can't call method on "+i);return i},CA=EA,TA=cb,qm=function(i){return CA(TA(i))},kp=typeof document=="object"&&document.all,ei=typeof kp>"u"&&kp!==void 0?function(i){return typeof i=="function"||i===kp}:function(i){return typeof i=="function"},PA=ei,zh=function(i){return typeof i=="object"?i!==null:PA(i)},Lp=ti,RA=ei,kA=function(i){return RA(i)?i:void 0},hb=function(i,t){return arguments.length<2?kA(Lp[i]):Lp[i]&&Lp[i][t]},LA=zi,IA=LA({}.isPrototypeOf),DA=typeof navigator<"u"&&String(navigator.userAgent)||"",db=ti,Ip=DA,k0=db.process,L0=db.Deno,I0=k0&&k0.versions||L0&&L0.version,D0=I0&&I0.v8,Cn,Yd;D0&&(Cn=D0.split("."),Yd=Cn[0]>0&&Cn[0]<4?1:+(Cn[0]+Cn[1]));!Yd&&Ip&&(Cn=Ip.match(/Edge\/(\d+)/),(!Cn||Cn[1]>=74)&&(Cn=Ip.match(/Chrome\/(\d+)/),Cn&&(Yd=+Cn[1])));var FA=Yd,F0=FA,MA=_s,OA=ti,NA=OA.String,ub=!!Object.getOwnPropertySymbols&&!MA(function(){var i=Symbol("symbol detection");return!NA(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&F0&&F0<41}),$A=ub,fb=$A&&!Symbol.sham&&typeof Symbol.iterator=="symbol",BA=hb,jA=ei,UA=IA,HA=fb,zA=Object,pb=HA?function(i){return typeof i=="symbol"}:function(i){var t=BA("Symbol");return jA(t)&&UA(t.prototype,zA(i))},GA=String,VA=function(i){try{return GA(i)}catch{return"Object"}},WA=ei,qA=VA,XA=TypeError,gb=function(i){if(WA(i))return i;throw new XA(qA(i)+" is not a function")},YA=gb,KA=lb,ZA=function(i,t){var e=i[t];return KA(e)?void 0:YA(e)},Dp=Wm,Fp=ei,Mp=zh,JA=TypeError,QA=function(i,t){var e,n;if(t==="string"&&Fp(e=i.toString)&&!Mp(n=Dp(e,i))||Fp(e=i.valueOf)&&!Mp(n=Dp(e,i))||t!=="string"&&Fp(e=i.toString)&&!Mp(n=Dp(e,i)))return n;throw new JA("Can't convert object to primitive value")},mb={exports:{}},M0=ti,tx=Object.defineProperty,Xm=function(i,t){try{tx(M0,i,{value:t,configurable:!0,writable:!0})}catch{M0[i]=t}return t},ex=ti,nx=Xm,O0="__core-js_shared__",N0=mb.exports=ex[O0]||nx(O0,{});(N0.versions||(N0.versions=[])).push({version:"3.37.1",mode:"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Ym=mb.exports,$0=Ym,vb=function(i,t){return $0[i]||($0[i]=t||{})},ix=cb,sx=Object,rx=function(i){return sx(ix(i))},ox=zi,ax=rx,lx=ox({}.hasOwnProperty),no=Object.hasOwn||function(t,e){return lx(ax(t),e)},cx=zi,hx=0,dx=Math.random(),ux=cx(1 .toString),bb=function(i){return"Symbol("+(i===void 0?"":i)+")_"+ux(++hx+dx,36)},fx=ti,px=vb,B0=no,gx=bb,mx=ub,vx=fb,bo=fx.Symbol,Op=px("wks"),bx=vx?bo.for||bo:bo&&bo.withoutSetter||gx,yx=function(i){return B0(Op,i)||(Op[i]=mx&&B0(bo,i)?bo[i]:bx("Symbol."+i)),Op[i]},wx=Wm,j0=zh,U0=pb,Ax=ZA,xx=QA,Ex=yx,_x=TypeError,Sx=Ex("toPrimitive"),Cx=function(i,t){if(!j0(i)||U0(i))return i;var e=Ax(i,Sx),n;if(e){if(t===void 0&&(t="default"),n=wx(e,i,t),!j0(n)||U0(n))return n;throw new _x("Can't convert object to primitive value")}return t===void 0&&(t="number"),xx(i,t)},Tx=Cx,Px=pb,yb=function(i){var t=Tx(i,"string");return Px(t)?t:t+""},Rx=ti,H0=zh,og=Rx.document,kx=H0(og)&&H0(og.createElement),Lx=function(i){return kx?og.createElement(i):{}},Ix=eo,Dx=_s,Fx=Lx,wb=!Ix&&!Dx(function(){return Object.defineProperty(Fx("div"),"a",{get:function(){return 7}}).a!==7}),Mx=eo,Ox=Wm,Nx=eb,$x=sb,Bx=qm,jx=yb,Ux=no,Hx=wb,z0=Object.getOwnPropertyDescriptor;Vm.f=Mx?z0:function(t,e){if(t=Bx(t),e=jx(e),Hx)try{return z0(t,e)}catch{}if(Ux(t,e))return $x(!Ox(Nx.f,t,e),t[e])};var Yf={},zx=eo,Gx=_s,Vx=zx&&Gx(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),Wx=zh,qx=String,Xx=TypeError,Ab=function(i){if(Wx(i))return i;throw new Xx(qx(i)+" is not an object")},Yx=eo,Kx=wb,Zx=Vx,sd=Ab,G0=yb,Jx=TypeError,Np=Object.defineProperty,Qx=Object.getOwnPropertyDescriptor,$p="enumerable",Bp="configurable",jp="writable";Yf.f=Yx?Zx?function(t,e,n){if(sd(t),e=G0(e),sd(n),typeof t=="function"&&e==="prototype"&&"value"in n&&jp in n&&!n[jp]){var s=Qx(t,e);s&&s[jp]&&(t[e]=n.value,n={configurable:Bp in n?n[Bp]:s[Bp],enumerable:$p in n?n[$p]:s[$p],writable:!1})}return Np(t,e,n)}:Np:function(t,e,n){if(sd(t),e=G0(e),sd(n),Kx)try{return Np(t,e,n)}catch{}if("get"in n||"set"in n)throw new Jx("Accessors not supported");return"value"in n&&(t[e]=n.value),t};var tE=eo,eE=Yf,nE=sb,xb=tE?function(i,t,e){return eE.f(i,t,nE(1,e))}:function(i,t,e){return i[t]=e,i},Eb={exports:{}},ag=eo,iE=no,_b=Function.prototype,sE=ag&&Object.getOwnPropertyDescriptor,Km=iE(_b,"name"),rE=Km&&(function(){}).name==="something",oE=Km&&(!ag||ag&&sE(_b,"name").configurable),aE={EXISTS:Km,PROPER:rE,CONFIGURABLE:oE},lE=zi,cE=ei,lg=Ym,hE=lE(Function.toString);cE(lg.inspectSource)||(lg.inspectSource=function(i){return hE(i)});var dE=lg.inspectSource,uE=ti,fE=ei,V0=uE.WeakMap,pE=fE(V0)&&/native code/.test(String(V0)),gE=vb,mE=bb,W0=gE("keys"),vE=function(i){return W0[i]||(W0[i]=mE(i))},Sb={},bE=pE,Cb=ti,yE=zh,wE=xb,Up=no,Hp=Ym,AE=vE,xE=Sb,q0="Object already initialized",cg=Cb.TypeError,EE=Cb.WeakMap,Kd,yl,Zd,_E=function(i){return Zd(i)?yl(i):Kd(i,{})},SE=function(i){return function(t){var e;if(!yE(t)||(e=yl(t)).type!==i)throw new cg("Incompatible receiver, "+i+" required");return e}};if(bE||Hp.state){var Pn=Hp.state||(Hp.state=new EE);Pn.get=Pn.get,Pn.has=Pn.has,Pn.set=Pn.set,Kd=function(i,t){if(Pn.has(i))throw new cg(q0);return t.facade=i,Pn.set(i,t),t},yl=function(i){return Pn.get(i)||{}},Zd=function(i){return Pn.has(i)}}else{var ao=AE("state");xE[ao]=!0,Kd=function(i,t){if(Up(i,ao))throw new cg(q0);return t.facade=i,wE(i,ao,t),t},yl=function(i){return Up(i,ao)?i[ao]:{}},Zd=function(i){return Up(i,ao)}}var CE={set:Kd,get:yl,has:Zd,enforce:_E,getterFor:SE},Zm=zi,TE=_s,PE=ei,rd=no,hg=eo,RE=aE.CONFIGURABLE,kE=dE,Tb=CE,LE=Tb.enforce,IE=Tb.get,X0=String,vd=Object.defineProperty,DE=Zm("".slice),FE=Zm("".replace),ME=Zm([].join),OE=hg&&!TE(function(){return vd(function(){},"length",{value:8}).length!==8}),NE=String(String).split("String"),$E=Eb.exports=function(i,t,e){DE(X0(t),0,7)==="Symbol("&&(t="["+FE(X0(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!rd(i,"name")||RE&&i.name!==t)&&(hg?vd(i,"name",{value:t,configurable:!0}):i.name=t),OE&&e&&rd(e,"arity")&&i.length!==e.arity&&vd(i,"length",{value:e.arity});try{e&&rd(e,"constructor")&&e.constructor?hg&&vd(i,"prototype",{writable:!1}):i.prototype&&(i.prototype=void 0)}catch{}var n=LE(i);return rd(n,"source")||(n.source=ME(NE,typeof t=="string"?t:"")),i};Function.prototype.toString=$E(function(){return PE(this)&&IE(this).source||kE(this)},"toString");var BE=Eb.exports,jE=ei,UE=Yf,HE=BE,zE=Xm,GE=function(i,t,e,n){n||(n={});var s=n.enumerable,r=n.name!==void 0?n.name:t;if(jE(e)&&HE(e,r,n),n.global)s?i[t]=e:zE(t,e);else{try{n.unsafe?i[t]&&(s=!0):delete i[t]}catch{}s?i[t]=e:UE.f(i,t,{value:e,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return i},Pb={},VE=Math.ceil,WE=Math.floor,qE=Math.trunc||function(t){var e=+t;return(e>0?WE:VE)(e)},XE=qE,Rb=function(i){var t=+i;return t!==t||t===0?0:XE(t)},YE=Rb,KE=Math.max,ZE=Math.min,JE=function(i,t){var e=YE(i);return e<0?KE(e+t,0):ZE(e,t)},QE=Rb,t_=Math.min,e_=function(i){var t=QE(i);return t>0?t_(t,9007199254740991):0},n_=e_,i_=function(i){return n_(i.length)},s_=qm,r_=JE,o_=i_,Y0=function(i){return function(t,e,n){var s=s_(t),r=o_(s);if(r===0)return!i&&-1;var o=r_(n,r),a;if(i&&e!==e){for(;r>o;)if(a=s[o++],a!==a)return!0}else for(;r>o;o++)if((i||o in s)&&s[o]===e)return i||o||0;return!i&&-1}},a_={includes:Y0(!0),indexOf:Y0(!1)},l_=zi,zp=no,c_=qm,h_=a_.indexOf,d_=Sb,K0=l_([].push),u_=function(i,t){var e=c_(i),n=0,s=[],r;for(r in e)!zp(d_,r)&&zp(e,r)&&K0(s,r);for(;t.length>n;)zp(e,r=t[n++])&&(~h_(s,r)||K0(s,r));return s},f_=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],p_=u_,g_=f_,m_=g_.concat("length","prototype");Pb.f=Object.getOwnPropertyNames||function(t){return p_(t,m_)};var kb={};kb.f=Object.getOwnPropertySymbols;var v_=hb,b_=zi,y_=Pb,w_=kb,A_=Ab,x_=b_([].concat),E_=v_("Reflect","ownKeys")||function(t){var e=y_.f(A_(t)),n=w_.f;return n?x_(e,n(t)):e},Z0=no,__=E_,S_=Vm,C_=Yf,T_=function(i,t,e){for(var n=__(t),s=C_.f,r=S_.f,o=0;o<n.length;o++){var a=n[o];!Z0(i,a)&&!(e&&Z0(e,a))&&s(i,a,r(t,a))}},P_=_s,R_=ei,k_=/#|\.prototype\./,Gh=function(i,t){var e=I_[L_(i)];return e===F_?!0:e===D_?!1:R_(t)?P_(t):!!t},L_=Gh.normalize=function(i){return String(i).replace(k_,".").toLowerCase()},I_=Gh.data={},D_=Gh.NATIVE="N",F_=Gh.POLYFILL="P",M_=Gh,od=ti,O_=Vm.f,N_=xb,$_=GE,B_=Xm,j_=T_,U_=M_,H_=function(i,t){var e=i.target,n=i.global,s=i.stat,r,o,a,c,d,h;if(n?o=od:s?o=od[e]||B_(e,{}):o=od[e]&&od[e].prototype,o)for(a in t){if(d=t[a],i.dontCallGetSet?(h=O_(o,a),c=h&&h.value):c=o[a],r=U_(n?a:e+(s?".":"#")+a,i.forced),!r&&c!==void 0){if(typeof d==typeof c)continue;j_(d,c)}(i.sham||c&&c.sham)&&N_(d,"sham",!0),$_(o,a,d,i)}},Lb={},J0=gb,z_=TypeError,G_=function(i){var t,e;this.promise=new i(function(n,s){if(t!==void 0||e!==void 0)throw new z_("Bad Promise constructor");t=n,e=s}),this.resolve=J0(t),this.reject=J0(e)};Lb.f=function(i){return new G_(i)};var V_=H_,W_=Lb;V_({target:"Promise",stat:!0},{withResolvers:function(){var t=W_.f(this);return{promise:t.promise,resolve:t.resolve,reject:t.reject}}});function q_(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ib={exports:{}},Qt=Ib.exports={},kn,Ln;function dg(){throw new Error("setTimeout has not been defined")}function ug(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?kn=setTimeout:kn=dg}catch{kn=dg}try{typeof clearTimeout=="function"?Ln=clearTimeout:Ln=ug}catch{Ln=ug}})();function Db(i){if(kn===setTimeout)return setTimeout(i,0);if((kn===dg||!kn)&&setTimeout)return kn=setTimeout,setTimeout(i,0);try{return kn(i,0)}catch{try{return kn.call(null,i,0)}catch{return kn.call(this,i,0)}}}function X_(i){if(Ln===clearTimeout)return clearTimeout(i);if((Ln===ug||!Ln)&&clearTimeout)return Ln=clearTimeout,clearTimeout(i);try{return Ln(i)}catch{try{return Ln.call(null,i)}catch{return Ln.call(this,i)}}}var Ni=[],wo=!1,Ns,bd=-1;function Y_(){!wo||!Ns||(wo=!1,Ns.length?Ni=Ns.concat(Ni):bd=-1,Ni.length&&Fb())}function Fb(){if(!wo){var i=Db(Y_);wo=!0;for(var t=Ni.length;t;){for(Ns=Ni,Ni=[];++bd<t;)Ns&&Ns[bd].run();bd=-1,t=Ni.length}Ns=null,wo=!1,X_(i)}}Qt.nextTick=function(i){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];Ni.push(new Mb(i,t)),Ni.length===1&&!wo&&Db(Fb)};function Mb(i,t){this.fun=i,this.array=t}Mb.prototype.run=function(){this.fun.apply(null,this.array)};Qt.title="browser";Qt.browser=!0;Qt.env={};Qt.argv=[];Qt.version="";Qt.versions={};function Gi(){}Qt.on=Gi;Qt.addListener=Gi;Qt.once=Gi;Qt.off=Gi;Qt.removeListener=Gi;Qt.removeAllListeners=Gi;Qt.emit=Gi;Qt.prependListener=Gi;Qt.prependOnceListener=Gi;Qt.listeners=function(i){return[]};Qt.binding=function(i){throw new Error("process.binding is not supported")};Qt.cwd=function(){return"/"};Qt.chdir=function(i){throw new Error("process.chdir is not supported")};Qt.umask=function(){return 0};var K_=Ib.exports;const ht=q_(K_);var Te=function(){return Te=Object.assign||function(t){for(var e,n=1,s=arguments.length;n<s;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},Te.apply(this,arguments)};function Xr(i,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,r;n<s;n++)(r||!(n in t))&&(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return i.concat(r||Array.prototype.slice.call(t))}function Z_(i){var t=Object.create(null);return function(e){return t[e]===void 0&&(t[e]=i(e)),t[e]}}var J_=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Q_=Z_(function(i){return J_.test(i)||i.charCodeAt(0)===111&&i.charCodeAt(1)===110&&i.charCodeAt(2)<91}),Ut="-ms-",gl="-moz-",Rt="-webkit-",Ob="comm",Kf="rule",Jm="decl",tS="@import",Nb="@keyframes",eS="@layer",$b=Math.abs,Qm=String.fromCharCode,fg=Object.assign;function nS(i,t){return pe(i,0)^45?(((t<<2^pe(i,0))<<2^pe(i,1))<<2^pe(i,2))<<2^pe(i,3):0}function Bb(i){return i.trim()}function oi(i,t){return(i=t.exec(i))?i[0]:i}function mt(i,t,e){return i.replace(t,e)}function yd(i,t,e){return i.indexOf(t,e)}function pe(i,t){return i.charCodeAt(t)|0}function Ua(i,t,e){return i.slice(t,e)}function Zn(i){return i.length}function jb(i){return i.length}function Qa(i,t){return t.push(i),i}function iS(i,t){return i.map(t).join("")}function Q0(i,t){return i.filter(function(e){return!oi(e,t)})}var Zf=1,Ha=1,Ub=0,dn=0,ee=0,qa="";function Jf(i,t,e,n,s,r,o,a){return{value:i,root:t,parent:e,type:n,props:s,children:r,line:Zf,column:Ha,length:o,return:"",siblings:a}}function Vi(i,t){return fg(Jf("",null,null,"",null,null,0,i.siblings),i,{length:-i.length},t)}function lo(i){for(;i.root;)i=Vi(i.root,{children:[i]});Qa(i,i.siblings)}function sS(){return ee}function rS(){return ee=dn>0?pe(qa,--dn):0,Ha--,ee===10&&(Ha=1,Zf--),ee}function Tn(){return ee=dn<Ub?pe(qa,dn++):0,Ha++,ee===10&&(Ha=1,Zf++),ee}function Wr(){return pe(qa,dn)}function wd(){return dn}function Qf(i,t){return Ua(qa,i,t)}function pg(i){switch(i){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function oS(i){return Zf=Ha=1,Ub=Zn(qa=i),dn=0,[]}function aS(i){return qa="",i}function Gp(i){return Bb(Qf(dn-1,gg(i===91?i+2:i===40?i+1:i)))}function lS(i){for(;(ee=Wr())&&ee<33;)Tn();return pg(i)>2||pg(ee)>3?"":" "}function cS(i,t){for(;--t&&Tn()&&!(ee<48||ee>102||ee>57&&ee<65||ee>70&&ee<97););return Qf(i,wd()+(t<6&&Wr()==32&&Tn()==32))}function gg(i){for(;Tn();)switch(ee){case i:return dn;case 34:case 39:i!==34&&i!==39&&gg(ee);break;case 40:i===41&&gg(i);break;case 92:Tn();break}return dn}function hS(i,t){for(;Tn()&&i+ee!==57;)if(i+ee===84&&Wr()===47)break;return"/*"+Qf(t,dn-1)+"*"+Qm(i===47?i:Tn())}function dS(i){for(;!pg(Wr());)Tn();return Qf(i,dn)}function uS(i){return aS(Ad("",null,null,null,[""],i=oS(i),0,[0],i))}function Ad(i,t,e,n,s,r,o,a,c){for(var d=0,h=0,u=o,p=0,v=0,b=0,x=1,_=1,E=1,R=0,k="",D=s,F=r,M=n,O=k;_;)switch(b=R,R=Tn()){case 40:if(b!=108&&pe(O,u-1)==58){yd(O+=mt(Gp(R),"&","&\f"),"&\f",$b(d?a[d-1]:0))!=-1&&(E=-1);break}case 34:case 39:case 91:O+=Gp(R);break;case 9:case 10:case 13:case 32:O+=lS(b);break;case 92:O+=cS(wd()-1,7);continue;case 47:switch(Wr()){case 42:case 47:Qa(fS(hS(Tn(),wd()),t,e,c),c);break;default:O+="/"}break;case 123*x:a[d++]=Zn(O)*E;case 125*x:case 59:case 0:switch(R){case 0:case 125:_=0;case 59+h:E==-1&&(O=mt(O,/\f/g,"")),v>0&&Zn(O)-u&&Qa(v>32?ev(O+";",n,e,u-1,c):ev(mt(O," ","")+";",n,e,u-2,c),c);break;case 59:O+=";";default:if(Qa(M=tv(O,t,e,d,h,s,a,k,D=[],F=[],u,r),r),R===123)if(h===0)Ad(O,t,M,M,D,r,u,a,F);else switch(p===99&&pe(O,3)===110?100:p){case 100:case 108:case 109:case 115:Ad(i,M,M,n&&Qa(tv(i,M,M,0,0,s,a,k,s,D=[],u,F),F),s,F,u,a,n?D:F);break;default:Ad(O,M,M,M,[""],F,0,a,F)}}d=h=v=0,x=E=1,k=O="",u=o;break;case 58:u=1+Zn(O),v=b;default:if(x<1){if(R==123)--x;else if(R==125&&x++==0&&rS()==125)continue}switch(O+=Qm(R),R*x){case 38:E=h>0?1:(O+="\f",-1);break;case 44:a[d++]=(Zn(O)-1)*E,E=1;break;case 64:Wr()===45&&(O+=Gp(Tn())),p=Wr(),h=u=Zn(k=O+=dS(wd())),R++;break;case 45:b===45&&Zn(O)==2&&(x=0)}}return r}function tv(i,t,e,n,s,r,o,a,c,d,h,u){for(var p=s-1,v=s===0?r:[""],b=jb(v),x=0,_=0,E=0;x<n;++x)for(var R=0,k=Ua(i,p+1,p=$b(_=o[x])),D=i;R<b;++R)(D=Bb(_>0?v[R]+" "+k:mt(k,/&\f/g,v[R])))&&(c[E++]=D);return Jf(i,t,e,s===0?Kf:a,c,d,h,u)}function fS(i,t,e,n){return Jf(i,t,e,Ob,Qm(sS()),Ua(i,2,-2),0,n)}function ev(i,t,e,n,s){return Jf(i,t,e,Jm,Ua(i,0,n),Ua(i,n+1,-1),n,s)}function Hb(i,t,e){switch(nS(i,t)){case 5103:return Rt+"print-"+i+i;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Rt+i+i;case 4789:return gl+i+i;case 5349:case 4246:case 4810:case 6968:case 2756:return Rt+i+gl+i+Ut+i+i;case 5936:switch(pe(i,t+11)){case 114:return Rt+i+Ut+mt(i,/[svh]\w+-[tblr]{2}/,"tb")+i;case 108:return Rt+i+Ut+mt(i,/[svh]\w+-[tblr]{2}/,"tb-rl")+i;case 45:return Rt+i+Ut+mt(i,/[svh]\w+-[tblr]{2}/,"lr")+i}case 6828:case 4268:case 2903:return Rt+i+Ut+i+i;case 6165:return Rt+i+Ut+"flex-"+i+i;case 5187:return Rt+i+mt(i,/(\w+).+(:[^]+)/,Rt+"box-$1$2"+Ut+"flex-$1$2")+i;case 5443:return Rt+i+Ut+"flex-item-"+mt(i,/flex-|-self/g,"")+(oi(i,/flex-|baseline/)?"":Ut+"grid-row-"+mt(i,/flex-|-self/g,""))+i;case 4675:return Rt+i+Ut+"flex-line-pack"+mt(i,/align-content|flex-|-self/g,"")+i;case 5548:return Rt+i+Ut+mt(i,"shrink","negative")+i;case 5292:return Rt+i+Ut+mt(i,"basis","preferred-size")+i;case 6060:return Rt+"box-"+mt(i,"-grow","")+Rt+i+Ut+mt(i,"grow","positive")+i;case 4554:return Rt+mt(i,/([^-])(transform)/g,"$1"+Rt+"$2")+i;case 6187:return mt(mt(mt(i,/(zoom-|grab)/,Rt+"$1"),/(image-set)/,Rt+"$1"),i,"")+i;case 5495:case 3959:return mt(i,/(image-set\([^]*)/,Rt+"$1$`$1");case 4968:return mt(mt(i,/(.+:)(flex-)?(.*)/,Rt+"box-pack:$3"+Ut+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Rt+i+i;case 4200:if(!oi(i,/flex-|baseline/))return Ut+"grid-column-align"+Ua(i,t)+i;break;case 2592:case 3360:return Ut+mt(i,"template-","")+i;case 4384:case 3616:return e&&e.some(function(n,s){return t=s,oi(n.props,/grid-\w+-end/)})?~yd(i+(e=e[t].value),"span",0)?i:Ut+mt(i,"-start","")+i+Ut+"grid-row-span:"+(~yd(e,"span",0)?oi(e,/\d+/):+oi(e,/\d+/)-+oi(i,/\d+/))+";":Ut+mt(i,"-start","")+i;case 4896:case 4128:return e&&e.some(function(n){return oi(n.props,/grid-\w+-start/)})?i:Ut+mt(mt(i,"-end","-span"),"span ","")+i;case 4095:case 3583:case 4068:case 2532:return mt(i,/(.+)-inline(.+)/,Rt+"$1$2")+i;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Zn(i)-1-t>6)switch(pe(i,t+1)){case 109:if(pe(i,t+4)!==45)break;case 102:return mt(i,/(.+:)(.+)-([^]+)/,"$1"+Rt+"$2-$3$1"+gl+(pe(i,t+3)==108?"$3":"$2-$3"))+i;case 115:return~yd(i,"stretch",0)?Hb(mt(i,"stretch","fill-available"),t,e)+i:i}break;case 5152:case 5920:return mt(i,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(n,s,r,o,a,c,d){return Ut+s+":"+r+d+(o?Ut+s+"-span:"+(a?c:+c-+r)+d:"")+i});case 4949:if(pe(i,t+6)===121)return mt(i,":",":"+Rt)+i;break;case 6444:switch(pe(i,pe(i,14)===45?18:11)){case 120:return mt(i,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Rt+(pe(i,14)===45?"inline-":"")+"box$3$1"+Rt+"$2$3$1"+Ut+"$2box$3")+i;case 100:return mt(i,":",":"+Ut)+i}break;case 5719:case 2647:case 2135:case 3927:case 2391:return mt(i,"scroll-","scroll-snap-")+i}return i}function Jd(i,t){for(var e="",n=0;n<i.length;n++)e+=t(i[n],n,i,t)||"";return e}function pS(i,t,e,n){switch(i.type){case eS:if(i.children.length)break;case tS:case Jm:return i.return=i.return||i.value;case Ob:return"";case Nb:return i.return=i.value+"{"+Jd(i.children,n)+"}";case Kf:if(!Zn(i.value=i.props.join(",")))return""}return Zn(e=Jd(i.children,n))?i.return=i.value+"{"+e+"}":""}function gS(i){var t=jb(i);return function(e,n,s,r){for(var o="",a=0;a<t;a++)o+=i[a](e,n,s,r)||"";return o}}function mS(i){return function(t){t.root||(t=t.return)&&i(t)}}function vS(i,t,e,n){if(i.length>-1&&!i.return)switch(i.type){case Jm:i.return=Hb(i.value,i.length,e);return;case Nb:return Jd([Vi(i,{value:mt(i.value,"@","@"+Rt)})],n);case Kf:if(i.length)return iS(e=i.props,function(s){switch(oi(s,n=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":lo(Vi(i,{props:[mt(s,/:(read-\w+)/,":"+gl+"$1")]})),lo(Vi(i,{props:[s]})),fg(i,{props:Q0(e,n)});break;case"::placeholder":lo(Vi(i,{props:[mt(s,/:(plac\w+)/,":"+Rt+"input-$1")]})),lo(Vi(i,{props:[mt(s,/:(plac\w+)/,":"+gl+"$1")]})),lo(Vi(i,{props:[mt(s,/:(plac\w+)/,Ut+"input-$1")]})),lo(Vi(i,{props:[s]})),fg(i,{props:Q0(e,n)});break}return""})}}var bS={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Yr=typeof ht<"u"&&ht.env!==void 0&&(ht.env.REACT_APP_SC_ATTR||ht.env.SC_ATTR)||"data-styled",zb="active",Gb="data-styled-version",tp="6.1.11",t0=`/*!sc*/
2
- `,e0=typeof window<"u"&&"HTMLElement"in window,yS=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof ht<"u"&&ht.env!==void 0&&ht.env.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&ht.env.REACT_APP_SC_DISABLE_SPEEDY!==""?ht.env.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&ht.env.REACT_APP_SC_DISABLE_SPEEDY:typeof ht<"u"&&ht.env!==void 0&&ht.env.SC_DISABLE_SPEEDY!==void 0&&ht.env.SC_DISABLE_SPEEDY!==""?ht.env.SC_DISABLE_SPEEDY!=="false"&&ht.env.SC_DISABLE_SPEEDY:ht.env.NODE_ENV!=="production"),nv=/invalid hook call/i,ad=new Set,wS=function(i,t){if(ht.env.NODE_ENV!=="production"){var e=t?' with the id of "'.concat(t,'"'):"",n="The component ".concat(i).concat(e,` has been created dynamically.
3
- `)+`You may see this warning because you've called styled inside another component.
4
- To resolve this only create new StyledComponents outside of any render method and function component.`,s=console.error;try{var r=!0;console.error=function(o){for(var a=[],c=1;c<arguments.length;c++)a[c-1]=arguments[c];nv.test(o)?(r=!1,ad.delete(n)):s.apply(void 0,Xr([o],a,!1))},I.useRef(),r&&!ad.has(n)&&(console.warn(n),ad.add(n))}catch(o){nv.test(o.message)&&ad.delete(n)}finally{console.error=s}}},ep=Object.freeze([]),za=Object.freeze({});function AS(i,t,e){return e===void 0&&(e=za),i.theme!==e.theme&&i.theme||t||e.theme}var mg=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),xS=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,ES=/(^-|-$)/g;function iv(i){return i.replace(xS,"-").replace(ES,"")}var _S=/(a)(d)/gi,ld=52,sv=function(i){return String.fromCharCode(i+(i>25?39:97))};function vg(i){var t,e="";for(t=Math.abs(i);t>ld;t=t/ld|0)e=sv(t%ld)+e;return(sv(t%ld)+e).replace(_S,"$1-$2")}var Vp,Vb=5381,Fs=function(i,t){for(var e=t.length;e;)i=33*i^t.charCodeAt(--e);return i},Wb=function(i){return Fs(Vb,i)};function qb(i){return vg(Wb(i)>>>0)}function Xb(i){return ht.env.NODE_ENV!=="production"&&typeof i=="string"&&i||i.displayName||i.name||"Component"}function Wp(i){return typeof i=="string"&&(ht.env.NODE_ENV==="production"||i.charAt(0)===i.charAt(0).toLowerCase())}var Yb=typeof Symbol=="function"&&Symbol.for,Kb=Yb?Symbol.for("react.memo"):60115,SS=Yb?Symbol.for("react.forward_ref"):60112,CS={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},TS={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Zb={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},PS=((Vp={})[SS]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Vp[Kb]=Zb,Vp);function rv(i){return("type"in(t=i)&&t.type.$$typeof)===Kb?Zb:"$$typeof"in i?PS[i.$$typeof]:CS;var t}var RS=Object.defineProperty,kS=Object.getOwnPropertyNames,ov=Object.getOwnPropertySymbols,LS=Object.getOwnPropertyDescriptor,IS=Object.getPrototypeOf,av=Object.prototype;function Jb(i,t,e){if(typeof t!="string"){if(av){var n=IS(t);n&&n!==av&&Jb(i,n,e)}var s=kS(t);ov&&(s=s.concat(ov(t)));for(var r=rv(i),o=rv(t),a=0;a<s.length;++a){var c=s[a];if(!(c in TS||e&&e[c]||o&&c in o||r&&c in r)){var d=LS(t,c);try{RS(i,c,d)}catch{}}}}return i}function Kr(i){return typeof i=="function"}function n0(i){return typeof i=="object"&&"styledComponentId"in i}function $s(i,t){return i&&t?"".concat(i," ").concat(t):i||t||""}function bg(i,t){if(i.length===0)return"";for(var e=i[0],n=1;n<i.length;n++)e+=i[n];return e}function Ga(i){return i!==null&&typeof i=="object"&&i.constructor.name===Object.name&&!("props"in i&&i.$$typeof)}function yg(i,t,e){if(e===void 0&&(e=!1),!e&&!Ga(i)&&!Array.isArray(i))return t;if(Array.isArray(t))for(var n=0;n<t.length;n++)i[n]=yg(i[n],t[n]);else if(Ga(t))for(var n in t)i[n]=yg(i[n],t[n]);return i}function i0(i,t){Object.defineProperty(i,"toString",{value:t})}var DS=ht.env.NODE_ENV!=="production"?{1:`Cannot create styled-component for component: %s.
5
-
6
- `,2:`Can't collect styles once you've consumed a \`ServerStyleSheet\`'s styles! \`ServerStyleSheet\` is a one off instance for each server-side render cycle.
7
-
8
- - Are you trying to reuse it across renders?
9
- - Are you accidentally calling collectStyles twice?
10
-
11
- `,3:`Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.
12
-
13
- `,4:`The \`StyleSheetManager\` expects a valid target or sheet prop!
14
-
15
- - Does this error occur on the client and is your target falsy?
16
- - Does this error occur on the server and is the sheet falsy?
17
-
18
- `,5:`The clone method cannot be used on the client!
19
-
20
- - Are you running in a client-like environment on the server?
21
- - Are you trying to run SSR on the client?
22
-
23
- `,6:`Trying to insert a new style tag, but the given Node is unmounted!
24
-
25
- - Are you using a custom target that isn't mounted?
26
- - Does your document not have a valid head element?
27
- - Have you accidentally removed a style tag manually?
28
-
29
- `,7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:`ThemeProvider: Please make your "theme" prop an object.
30
-
31
- `,9:"Missing document `<head>`\n\n",10:`Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021
32
-
33
- `,11:`_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.
34
-
35
- `,12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:`%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.
36
-
37
- `,14:`ThemeProvider: "theme" prop is required.
38
-
39
- `,15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:`Reached the limit of how many styled components may be created at group %s.
40
- You may only create up to 1,073,741,824 components. If you're creating components dynamically,
41
- as for instance in your render method then you may be running into this limitation.
42
-
43
- `,17:`CSSStyleSheet could not be found on HTMLStyleElement.
44
- Has styled-components' style tag been unmounted or altered by another script?
45
- `,18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function FS(){for(var i=[],t=0;t<arguments.length;t++)i[t]=arguments[t];for(var e=i[0],n=[],s=1,r=i.length;s<r;s+=1)n.push(i[s]);return n.forEach(function(o){e=e.replace(/%[a-z]/,o)}),e}function Bi(i){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return ht.env.NODE_ENV==="production"?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(i," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):"")):new Error(FS.apply(void 0,Xr([DS[i]],t,!1)).trim())}var MS=function(){function i(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return i.prototype.indexOfGroup=function(t){for(var e=0,n=0;n<t;n++)e+=this.groupSizes[n];return e},i.prototype.insertRules=function(t,e){if(t>=this.groupSizes.length){for(var n=this.groupSizes,s=n.length,r=s;t>=r;)if((r<<=1)<0)throw Bi(16,"".concat(t));this.groupSizes=new Uint32Array(r),this.groupSizes.set(n),this.length=r;for(var o=s;o<r;o++)this.groupSizes[o]=0}for(var a=this.indexOfGroup(t+1),c=(o=0,e.length);o<c;o++)this.tag.insertRule(a,e[o])&&(this.groupSizes[t]++,a++)},i.prototype.clearGroup=function(t){if(t<this.length){var e=this.groupSizes[t],n=this.indexOfGroup(t),s=n+e;this.groupSizes[t]=0;for(var r=n;r<s;r++)this.tag.deleteRule(n)}},i.prototype.getGroup=function(t){var e="";if(t>=this.length||this.groupSizes[t]===0)return e;for(var n=this.groupSizes[t],s=this.indexOfGroup(t),r=s+n,o=s;o<r;o++)e+="".concat(this.tag.getRule(o)).concat(t0);return e},i}(),OS=1<<30,xd=new Map,Qd=new Map,Ed=1,cd=function(i){if(xd.has(i))return xd.get(i);for(;Qd.has(Ed);)Ed++;var t=Ed++;if(ht.env.NODE_ENV!=="production"&&((0|t)<0||t>OS))throw Bi(16,"".concat(t));return xd.set(i,t),Qd.set(t,i),t},NS=function(i,t){Ed=t+1,xd.set(i,t),Qd.set(t,i)},$S="style[".concat(Yr,"][").concat(Gb,'="').concat(tp,'"]'),BS=new RegExp("^".concat(Yr,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),jS=function(i,t,e){for(var n,s=e.split(","),r=0,o=s.length;r<o;r++)(n=s[r])&&i.registerName(t,n)},US=function(i,t){for(var e,n=((e=t.textContent)!==null&&e!==void 0?e:"").split(t0),s=[],r=0,o=n.length;r<o;r++){var a=n[r].trim();if(a){var c=a.match(BS);if(c){var d=0|parseInt(c[1],10),h=c[2];d!==0&&(NS(h,d),jS(i,h,c[3]),i.getTag().insertRules(d,s)),s.length=0}else s.push(a)}}};function HS(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var Qb=function(i){var t=document.head,e=i||t,n=document.createElement("style"),s=function(a){var c=Array.from(a.querySelectorAll("style[".concat(Yr,"]")));return c[c.length-1]}(e),r=s!==void 0?s.nextSibling:null;n.setAttribute(Yr,zb),n.setAttribute(Gb,tp);var o=HS();return o&&n.setAttribute("nonce",o),e.insertBefore(n,r),n},zS=function(){function i(t){this.element=Qb(t),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var n=document.styleSheets,s=0,r=n.length;s<r;s++){var o=n[s];if(o.ownerNode===e)return o}throw Bi(17)}(this.element),this.length=0}return i.prototype.insertRule=function(t,e){try{return this.sheet.insertRule(e,t),this.length++,!0}catch{return!1}},i.prototype.deleteRule=function(t){this.sheet.deleteRule(t),this.length--},i.prototype.getRule=function(t){var e=this.sheet.cssRules[t];return e&&e.cssText?e.cssText:""},i}(),GS=function(){function i(t){this.element=Qb(t),this.nodes=this.element.childNodes,this.length=0}return i.prototype.insertRule=function(t,e){if(t<=this.length&&t>=0){var n=document.createTextNode(e);return this.element.insertBefore(n,this.nodes[t]||null),this.length++,!0}return!1},i.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},i.prototype.getRule=function(t){return t<this.length?this.nodes[t].textContent:""},i}(),VS=function(){function i(t){this.rules=[],this.length=0}return i.prototype.insertRule=function(t,e){return t<=this.length&&(this.rules.splice(t,0,e),this.length++,!0)},i.prototype.deleteRule=function(t){this.rules.splice(t,1),this.length--},i.prototype.getRule=function(t){return t<this.length?this.rules[t]:""},i}(),lv=e0,WS={isServer:!e0,useCSSOMInjection:!yS},ty=function(){function i(t,e,n){t===void 0&&(t=za),e===void 0&&(e={});var s=this;this.options=Te(Te({},WS),t),this.gs=e,this.names=new Map(n),this.server=!!t.isServer,!this.server&&e0&&lv&&(lv=!1,function(r){for(var o=document.querySelectorAll($S),a=0,c=o.length;a<c;a++){var d=o[a];d&&d.getAttribute(Yr)!==zb&&(US(r,d),d.parentNode&&d.parentNode.removeChild(d))}}(this)),i0(this,function(){return function(r){for(var o=r.getTag(),a=o.length,c="",d=function(u){var p=function(E){return Qd.get(E)}(u);if(p===void 0)return"continue";var v=r.names.get(p),b=o.getGroup(u);if(v===void 0||b.length===0)return"continue";var x="".concat(Yr,".g").concat(u,'[id="').concat(p,'"]'),_="";v!==void 0&&v.forEach(function(E){E.length>0&&(_+="".concat(E,","))}),c+="".concat(b).concat(x,'{content:"').concat(_,'"}').concat(t0)},h=0;h<a;h++)d(h);return c}(s)})}return i.registerId=function(t){return cd(t)},i.prototype.reconstructWithOptions=function(t,e){return e===void 0&&(e=!0),new i(Te(Te({},this.options),t),this.gs,e&&this.names||void 0)},i.prototype.allocateGSInstance=function(t){return this.gs[t]=(this.gs[t]||0)+1},i.prototype.getTag=function(){return this.tag||(this.tag=(t=function(e){var n=e.useCSSOMInjection,s=e.target;return e.isServer?new VS(s):n?new zS(s):new GS(s)}(this.options),new MS(t)));var t},i.prototype.hasNameForId=function(t,e){return this.names.has(t)&&this.names.get(t).has(e)},i.prototype.registerName=function(t,e){if(cd(t),this.names.has(t))this.names.get(t).add(e);else{var n=new Set;n.add(e),this.names.set(t,n)}},i.prototype.insertRules=function(t,e,n){this.registerName(t,e),this.getTag().insertRules(cd(t),n)},i.prototype.clearNames=function(t){this.names.has(t)&&this.names.get(t).clear()},i.prototype.clearRules=function(t){this.getTag().clearGroup(cd(t)),this.clearNames(t)},i.prototype.clearTag=function(){this.tag=void 0},i}(),qS=/&/g,XS=/^\s*\/\/.*$/gm;function ey(i,t){return i.map(function(e){return e.type==="rule"&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map(function(n){return"".concat(t," ").concat(n)})),Array.isArray(e.children)&&e.type!=="@keyframes"&&(e.children=ey(e.children,t)),e})}function YS(i){var t,e,n,s=za,r=s.options,o=r===void 0?za:r,a=s.plugins,c=a===void 0?ep:a,d=function(p,v,b){return b.startsWith(e)&&b.endsWith(e)&&b.replaceAll(e,"").length>0?".".concat(t):p},h=c.slice();h.push(function(p){p.type===Kf&&p.value.includes("&")&&(p.props[0]=p.props[0].replace(qS,e).replace(n,d))}),o.prefix&&h.push(vS),h.push(pS);var u=function(p,v,b,x){v===void 0&&(v=""),b===void 0&&(b=""),x===void 0&&(x="&"),t=x,e=v,n=new RegExp("\\".concat(e,"\\b"),"g");var _=p.replace(XS,""),E=uS(b||v?"".concat(b," ").concat(v," { ").concat(_," }"):_);o.namespace&&(E=ey(E,o.namespace));var R=[];return Jd(E,gS(h.concat(mS(function(k){return R.push(k)})))),R};return u.hash=c.length?c.reduce(function(p,v){return v.name||Bi(15),Fs(p,v.name)},Vb).toString():"",u}var KS=new ty,wg=YS(),ny=I.createContext({shouldForwardProp:void 0,styleSheet:KS,stylis:wg});ny.Consumer;I.createContext(void 0);function cv(){return I.useContext(ny)}var Ag=function(){function i(t,e){var n=this;this.inject=function(s,r){r===void 0&&(r=wg);var o=n.name+r.hash;s.hasNameForId(n.id,o)||s.insertRules(n.id,o,r(n.rules,o,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=e,i0(this,function(){throw Bi(12,String(n.name))})}return i.prototype.getName=function(t){return t===void 0&&(t=wg),this.name+t.hash},i}(),ZS=function(i){return i>="A"&&i<="Z"};function hv(i){for(var t="",e=0;e<i.length;e++){var n=i[e];if(e===1&&n==="-"&&i[0]==="-")return i;ZS(n)?t+="-"+n.toLowerCase():t+=n}return t.startsWith("ms-")?"-"+t:t}var iy=function(i){return i==null||i===!1||i===""},sy=function(i){var t,e,n=[];for(var s in i){var r=i[s];i.hasOwnProperty(s)&&!iy(r)&&(Array.isArray(r)&&r.isCss||Kr(r)?n.push("".concat(hv(s),":"),r,";"):Ga(r)?n.push.apply(n,Xr(Xr(["".concat(s," {")],sy(r),!1),["}"],!1)):n.push("".concat(hv(s),": ").concat((t=s,(e=r)==null||typeof e=="boolean"||e===""?"":typeof e!="number"||e===0||t in bS||t.startsWith("--")?String(e).trim():"".concat(e,"px")),";")))}return n};function qr(i,t,e,n){if(iy(i))return[];if(n0(i))return[".".concat(i.styledComponentId)];if(Kr(i)){if(!Kr(r=i)||r.prototype&&r.prototype.isReactComponent||!t)return[i];var s=i(t);return ht.env.NODE_ENV==="production"||typeof s!="object"||Array.isArray(s)||s instanceof Ag||Ga(s)||s===null||console.error("".concat(Xb(i)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),qr(s,t,e,n)}var r;return i instanceof Ag?e?(i.inject(e,n),[i.getName(n)]):[i]:Ga(i)?sy(i):Array.isArray(i)?Array.prototype.concat.apply(ep,i.map(function(o){return qr(o,t,e,n)})):[i.toString()]}function JS(i){for(var t=0;t<i.length;t+=1){var e=i[t];if(Kr(e)&&!n0(e))return!1}return!0}var QS=Wb(tp),tC=function(){function i(t,e,n){this.rules=t,this.staticRulesId="",this.isStatic=ht.env.NODE_ENV==="production"&&(n===void 0||n.isStatic)&&JS(t),this.componentId=e,this.baseHash=Fs(QS,e),this.baseStyle=n,ty.registerId(e)}return i.prototype.generateAndInjectStyles=function(t,e,n){var s=this.baseStyle?this.baseStyle.generateAndInjectStyles(t,e,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&e.hasNameForId(this.componentId,this.staticRulesId))s=$s(s,this.staticRulesId);else{var r=bg(qr(this.rules,t,e,n)),o=vg(Fs(this.baseHash,r)>>>0);if(!e.hasNameForId(this.componentId,o)){var a=n(r,".".concat(o),void 0,this.componentId);e.insertRules(this.componentId,o,a)}s=$s(s,o),this.staticRulesId=o}else{for(var c=Fs(this.baseHash,n.hash),d="",h=0;h<this.rules.length;h++){var u=this.rules[h];if(typeof u=="string")d+=u,ht.env.NODE_ENV!=="production"&&(c=Fs(c,u));else if(u){var p=bg(qr(u,t,e,n));c=Fs(c,p+h),d+=p}}if(d){var v=vg(c>>>0);e.hasNameForId(this.componentId,v)||e.insertRules(this.componentId,v,n(d,".".concat(v),void 0,this.componentId)),s=$s(s,v)}}return s},i}(),tu=I.createContext(void 0);tu.Consumer;function eC(i){var t=I.useContext(tu),e=I.useMemo(function(){return function(n,s){if(!n)throw Bi(14);if(Kr(n)){var r=n(s);if(ht.env.NODE_ENV!=="production"&&(r===null||Array.isArray(r)||typeof r!="object"))throw Bi(7);return r}if(Array.isArray(n)||typeof n!="object")throw Bi(8);return s?Te(Te({},s),n):n}(i.theme,t)},[i.theme,t]);return i.children?I.createElement(tu.Provider,{value:e},i.children):null}var qp={},dv=new Set;function nC(i,t,e){var n=n0(i),s=i,r=!Wp(i),o=t.attrs,a=o===void 0?ep:o,c=t.componentId,d=c===void 0?function(D,F){var M=typeof D!="string"?"sc":iv(D);qp[M]=(qp[M]||0)+1;var O="".concat(M,"-").concat(qb(tp+M+qp[M]));return F?"".concat(F,"-").concat(O):O}(t.displayName,t.parentComponentId):c,h=t.displayName,u=h===void 0?function(D){return Wp(D)?"styled.".concat(D):"Styled(".concat(Xb(D),")")}(i):h,p=t.displayName&&t.componentId?"".concat(iv(t.displayName),"-").concat(t.componentId):t.componentId||d,v=n&&s.attrs?s.attrs.concat(a).filter(Boolean):a,b=t.shouldForwardProp;if(n&&s.shouldForwardProp){var x=s.shouldForwardProp;if(t.shouldForwardProp){var _=t.shouldForwardProp;b=function(D,F){return x(D,F)&&_(D,F)}}else b=x}var E=new tC(e,p,n?s.componentStyle:void 0);function R(D,F){return function(M,O,C){var P=M.attrs,$=M.componentStyle,N=M.defaultProps,H=M.foldedComponentIds,z=M.styledComponentId,V=M.target,Z=I.useContext(tu),Q=cv(),j=M.shouldForwardProp||Q.shouldForwardProp;ht.env.NODE_ENV!=="production"&&I.useDebugValue(z);var W=AS(O,Z,N)||za,q=function(it,dt,J){for(var vt,Y=Te(Te({},dt),{className:void 0,theme:J}),tt=0;tt<it.length;tt+=1){var ut=Kr(vt=it[tt])?vt(Y):vt;for(var gt in ut)Y[gt]=gt==="className"?$s(Y[gt],ut[gt]):gt==="style"?Te(Te({},Y[gt]),ut[gt]):ut[gt]}return dt.className&&(Y.className=$s(Y.className,dt.className)),Y}(P,O,W),wt=q.as||V,pt={};for(var G in q)q[G]===void 0||G[0]==="$"||G==="as"||G==="theme"&&q.theme===W||(G==="forwardedAs"?pt.as=q.forwardedAs:j&&!j(G,wt)||(pt[G]=q[G],j||ht.env.NODE_ENV!=="development"||Q_(G)||dv.has(G)||!mg.has(wt)||(dv.add(G),console.warn('styled-components: it looks like an unknown prop "'.concat(G,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var st=function(it,dt){var J=cv(),vt=it.generateAndInjectStyles(dt,J.styleSheet,J.stylis);return ht.env.NODE_ENV!=="production"&&I.useDebugValue(vt),vt}($,q);ht.env.NODE_ENV!=="production"&&M.warnTooManyClasses&&M.warnTooManyClasses(st);var nt=$s(H,z);return st&&(nt+=" "+st),q.className&&(nt+=" "+q.className),pt[Wp(wt)&&!mg.has(wt)?"class":"className"]=nt,pt.ref=C,I.createElement(wt,pt)}(k,D,F)}R.displayName=u;var k=I.forwardRef(R);return k.attrs=v,k.componentStyle=E,k.displayName=u,k.shouldForwardProp=b,k.foldedComponentIds=n?$s(s.foldedComponentIds,s.styledComponentId):"",k.styledComponentId=p,k.target=n?s.target:i,Object.defineProperty(k,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(D){this._foldedDefaultProps=n?function(F){for(var M=[],O=1;O<arguments.length;O++)M[O-1]=arguments[O];for(var C=0,P=M;C<P.length;C++)yg(F,P[C],!0);return F}({},s.defaultProps,D):D}}),ht.env.NODE_ENV!=="production"&&(wS(u,p),k.warnTooManyClasses=function(D,F){var M={},O=!1;return function(C){if(!O&&(M[C]=!0,Object.keys(M).length>=200)){var P=F?' with the id of "'.concat(F,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(D).concat(P,`.
46
- `)+`Consider using the attrs method, together with a style object for frequently changed styles.
47
- Example:
48
- const Component = styled.div.attrs(props => ({
49
- style: {
50
- background: props.background,
51
- },
52
- }))\`width: 100%;\`
53
-
54
- <Component />`),O=!0,M={}}}}(u,p)),i0(k,function(){return".".concat(k.styledComponentId)}),r&&Jb(k,i,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),k}function uv(i,t){for(var e=[i[0]],n=0,s=t.length;n<s;n+=1)e.push(t[n],i[n+1]);return e}var fv=function(i){return Object.assign(i,{isCss:!0})};function np(i){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];if(Kr(i)||Ga(i))return fv(qr(uv(ep,Xr([i],t,!0))));var n=i;return t.length===0&&n.length===1&&typeof n[0]=="string"?qr(n):fv(qr(uv(n,t)))}function xg(i,t,e){if(e===void 0&&(e=za),!t)throw Bi(1,t);var n=function(s){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];return i(t,e,np.apply(void 0,Xr([s],r,!1)))};return n.attrs=function(s){return xg(i,t,Te(Te({},e),{attrs:Array.prototype.concat(e.attrs,s).filter(Boolean)}))},n.withConfig=function(s){return xg(i,t,Te(Te({},e),s))},n}var ry=function(i){return xg(nC,i)},X=ry;mg.forEach(function(i){X[i]=ry(i)});function oy(i){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];ht.env.NODE_ENV!=="production"&&typeof navigator<"u"&&navigator.product==="ReactNative"&&console.warn("`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated.");var n=bg(np.apply(void 0,Xr([i],t,!1))),s=qb(n);return new Ag(s,n)}ht.env.NODE_ENV!=="production"&&typeof navigator<"u"&&navigator.product==="ReactNative"&&console.warn(`It looks like you've imported 'styled-components' on React Native.
55
- Perhaps you're looking to import 'styled-components/native'?
56
- Read more about this at https://www.styled-components.com/docs/basics#react-native`);var hd="__sc-".concat(Yr,"__");ht.env.NODE_ENV!=="production"&&ht.env.NODE_ENV!=="test"&&typeof window<"u"&&(window[hd]||(window[hd]=0),window[hd]===1&&console.warn(`It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.
57
-
58
- See https://s-c.sh/2BAXzed for more info.`),window[hd]+=1);const iC="Document {{ currentFileNo }} of {{ allFilesCount }}",sC="No renderer for file type: {{{ fileType }}}",rC="Download file",oC="Your file is broken. Please check it on your machine.",aC="Recipients",lC="Sender",cC="Loading...",hC="Page {{ currentPage }}/{{ allPagesCount }}",dC="Drop files here",uC="Thumbnail sidebar",fC="Show thumbnails",pC="Hide thumbnails",gC="Annotation toolbar",mC="Select",vC="Highlight",bC="Pen",yC="Comment",wC="Eraser",AC="Add comment",xC="Delete annotation",EC="Save annotations",_C={documentNavInfo:iC,noRendererMessage:sC,downloadButtonLabel:rC,brokenFile:oC,msgPluginRecipients:aC,msgPluginSender:lC,pdfPluginLoading:cC,pdfPluginPageNumber:hC,dropFilesHere:dC,thumbnailSidebar:uC,showThumbnails:fC,hideThumbnails:pC,annotationToolbar:gC,selectTool:mC,highlightTool:vC,penTool:bC,commentTool:yC,eraserTool:wC,addComment:AC,deleteAnnotation:xC,saveAnnotations:EC},SC="Dokument {{ currentFileNo }} z {{ allFilesCount }}",CC="Brak funckji renderującej dla: {{{ fileType }}}",TC="Pobierz plik",PC="Twój plik jest uszkodzony. Sprawdź go na swoim komputerze.",RC="Odbiorcy",kC="Nadawca",LC="Wczytywanie...",IC="Strona {{ currentPage }}/{{ allPagesCount }}",DC={documentNavInfo:SC,noRendererMessage:CC,downloadButtonLabel:TC,brokenFile:PC,msgPluginRecipients:RC,msgPluginSender:kC,pdfPluginLoading:LC,pdfPluginPageNumber:IC},FC="Documento {{ currentFileNo }} de {{ allFilesCount }}",MC="No hay procesador para el tipo de archivo: {{{ fileType }}}",OC="Descargar archivo",NC="Tu archivo está roto. Compruébalo en tu máquina.",$C="Destinatarios",BC="Remitente",jC="Cargando...",UC="Página {{ currentPage }}/{{ allPagesCount }}",HC={documentNavInfo:FC,noRendererMessage:MC,downloadButtonLabel:OC,brokenFile:NC,msgPluginRecipients:$C,msgPluginSender:BC,pdfPluginLoading:jC,pdfPluginPageNumber:UC},zC="Dokument {{ currentFileNo }} von {{ allFilesCount }}",GC="Kein Renderer für Dateityp: {{{ fileType }}}",VC="Datei herunterladen",WC="Ihre Datei ist defekt. Bitte überprüfen Sie sie auf Ihrem Rechner.",qC="Empfänger",XC="Absender",YC="Wird geladen...",KC="Seite {{ currentPage }}/{{ allPagesCount }}",ZC={documentNavInfo:zC,noRendererMessage:GC,downloadButtonLabel:VC,brokenFile:WC,msgPluginRecipients:qC,msgPluginSender:XC,pdfPluginLoading:YC,pdfPluginPageNumber:KC},JC="Documento {{ currentFileNo }} di {{ allFilesCount }}",QC="Nessun renderer per il tipo di file: {{{ fileType }}}",tT="Scarica file",eT="Il tuo file è danneggiato. Controllalo sul tuo computer.",nT="Destinatari",iT="Mittente",sT="Caricamento in corso...",rT="Pagina {{ currentPage }}/{{ allPagesCount }}",oT={documentNavInfo:JC,noRendererMessage:QC,downloadButtonLabel:tT,brokenFile:eT,msgPluginRecipients:nT,msgPluginSender:iT,pdfPluginLoading:sT,pdfPluginPageNumber:rT},aT="Documento {{ currentFileNo }} de {{ allFilesCount }}",lT="Nenhum renderizador para o tipo de arquivo: {{{ fileType }}}",cT="Baixar arquivo",hT="Seu arquivo está quebrado. Por favor, verifique-o em sua máquina.",dT="Destinatários",uT="Remetente",fT="Carregando...",pT="Página {{ currentPage }}/{{ allPagesCount }}",gT={documentNavInfo:aT,noRendererMessage:lT,downloadButtonLabel:cT,brokenFile:hT,msgPluginRecipients:dT,msgPluginSender:uT,pdfPluginLoading:fT,pdfPluginPageNumber:pT},mT="Document {{ currentFileNo }} de {{ allFilesCount }}",vT="Aucun moteur de rendu pour le type de fichier : {{{ fileType }}}",bT="Télécharger le fichier",yT="Votre fichier est cassé. Veuillez le vérifier sur votre machine.",wT="Destinataires",AT="Expéditeur",xT="Chargement...",ET="Page {{ currentPage }}/{{ allPagesCount }}",_T={documentNavInfo:mT,noRendererMessage:vT,downloadButtonLabel:bT,brokenFile:yT,msgPluginRecipients:wT,msgPluginSender:AT,pdfPluginLoading:xT,pdfPluginPageNumber:ET},ST="مستند {{ currentFileNo }} من {{ allFilesCount }}",CT="{{{ fileType }}} : لا يمكننا عرض هذا النوع من الملفات",TT="تحميل الملف",PT="الملف تالف، يرجى التحقق منه على جهازك الخاص.",RT="المستلمين",kT="المرسل",LT="تحميل ...",IT=" {{ allPagesCount }} \\ {{ currentPage }} صفحة ",DT={documentNavInfo:ST,noRendererMessage:CT,downloadButtonLabel:TT,brokenFile:PT,msgPluginRecipients:RT,msgPluginSender:kT,pdfPluginLoading:LT,pdfPluginPageNumber:IT},FT="Dokument {{ currentFileNo }} od {{ allFilesCount }}",MT="Ne postoji pregledač za tip fajla: {{ fileType }}",OT="Preuzimanje fajla",NT="Vaš fajl nije dobar. Molimo Vas da probate da ga otvorite na vašem računaru.",$T="Primaoci",BT="Pošiljalac",jT="Učitavanje...",UT="Strana {{ currentPage }}/{{ allPagesCount }}",HT={documentNavInfo:FT,noRendererMessage:MT,downloadButtonLabel:OT,brokenFile:NT,msgPluginRecipients:$T,msgPluginSender:BT,pdfPluginLoading:jT,pdfPluginPageNumber:UT},zT="Документ {{ currentFileNo }} od {{ allFilesCount }}",GT="Не постоји прегледач за тип фајла: {{ fileType }}",VT="Преузимање фајла",WT="Ваш фајл није добар. Молимо Вас да пробате да га отворите на вашем рачунару.",qT="Примаоци",XT="Пошиљалац",YT="Учитавање...",KT="Страна {{ currentPage }}/{{ allPagesCount }}",ZT={documentNavInfo:zT,noRendererMessage:GT,downloadButtonLabel:VT,brokenFile:WT,msgPluginRecipients:qT,msgPluginSender:XT,pdfPluginLoading:YT,pdfPluginPageNumber:KT},JT="ファイル {{ currentFileNo }} / {{ allFilesCount }}",QT="ファイルタイプに対応したレンダラーはありません: {{ fileType }}",tP="ダウンロード",eP="ファイルが壊れています。あなたのマシンでファイルを確認してください。",nP="受信者",iP="送信者",sP="ローティング中...",rP="ページ {{ currentPage }}/{{ allPagesCount }}",oP={documentNavInfo:JT,noRendererMessage:QT,downloadButtonLabel:tP,brokenFile:eP,msgPluginRecipients:nP,msgPluginSender:iP,pdfPluginLoading:sP,pdfPluginPageNumber:rP},aP="Документ {{ currentFileNo }} из {{ allFilesCount }}",lP="Данный тип файла не поддерживается рендером: {{{ fileType }}}",cP="Скачать файл",hP="Ваш файл сломан. Пожалуйста, проверьте его на своём комьютере.",dP="Получатели",uP="Отправитель",fP="Загрузка...",pP="Страница {{ currentPage }}/{{ allPagesCount }}",gP={documentNavInfo:aP,noRendererMessage:lP,downloadButtonLabel:cP,brokenFile:hP,msgPluginRecipients:dP,msgPluginSender:uP,pdfPluginLoading:fP,pdfPluginPageNumber:pP},mP="Dokument {{ currentFileNo }} av {{ allFilesCount }}",vP="Ingen renderare för filtypen: {{{ fileType }}}",bP="Ladda ner",yP="Filen är trasig. Var vänlig kontrollera den på din maskin.",wP="Mottagare",AP="Avsändare",xP="Laddar...",EP="Sida {{ currentPage }}/{{ allPagesCount }}",_P={documentNavInfo:mP,noRendererMessage:vP,downloadButtonLabel:bP,brokenFile:yP,msgPluginRecipients:wP,msgPluginSender:AP,pdfPluginLoading:xP,pdfPluginPageNumber:EP},SP="Belge {{ currentFileNo }} / {{ allFilesCount }}",CP="Dosya türü için görüntüleyici bulunamadı: {{{ fileType }}}",TP="Dosyayı indir",PP="Dosyanız bozuk. Lütfen kendi cihazınızda kontrol edin.",RP="Alıcılar",kP="Gönderen",LP="Yükleniyor...",IP="Sayfa {{ currentPage }}/{{ allPagesCount }}",DP={documentNavInfo:SP,noRendererMessage:CP,downloadButtonLabel:TP,brokenFile:PP,msgPluginRecipients:RP,msgPluginSender:kP,pdfPluginLoading:LP,pdfPluginPageNumber:IP},eu={en:_C,pl:DC,es:HC,de:ZC,it:oT,pt:gT,fr:_T,ar:DT,sr:HT,sr_cyr:ZT,ja:oP,ru:gP,se:_P,tr:DP},FP=Object.keys(eu),s0="en",ay="SET_ALL_DOCUMENTS",ly="SET_DOCUMENT_LOADING",cy="NEXT_DOCUMENT",hy="PREVIOUS_DOCUMENT",dy="UPDATE_CURRENT_DOCUMENT",uy="SET_RENDERER_RECT",fy="SET_MAIN_CONFIG",py="ADD_DOCUMENTS_FROM_DROP",MP="SET_DRAG_STATE",gy="GO_TO_PAGE",OP=(i,t)=>({type:ay,documents:i,initialActiveDocument:t}),Xp=i=>({type:ly,value:i}),r0=()=>({type:cy}),o0=()=>({type:hy}),Eg=i=>({type:dy,document:i}),NP=i=>({type:uy,rect:i}),$P=i=>({type:fy,config:i}),BP=(i,t="append")=>({type:py,documents:i,behavior:t}),pv=i=>({type:gy,pageNumber:i}),nu={currentFileNo:0,documents:[],documentLoading:!0,currentDocument:void 0,rendererRect:void 0,config:{},pluginRenderers:[],language:s0,isDragging:!1,targetPage:void 0},jP=(i=nu,t)=>{switch(t.type){case ay:{const{documents:e,initialActiveDocument:n}=t;return{...i,documents:e,currentDocument:n||e[0]||null,currentFileNo:n&&e.includes(n)?e.indexOf(n):nu.currentFileNo}}case ly:{const{value:e}=t;return{...i,documentLoading:e}}case cy:{if(i.currentFileNo>=i.documents.length-1)return i;const e=i.currentFileNo+1;return i.onDocumentChange&&i.onDocumentChange(i.documents[e]),{...i,currentFileNo:e,currentDocument:i.documents[e],documentLoading:!0}}case hy:{if(i.currentFileNo<=0)return i;const e=i.currentFileNo-1;return i.onDocumentChange&&i.onDocumentChange(i.documents[e]),{...i,currentFileNo:i.currentFileNo-1,currentDocument:i.documents[e],documentLoading:!0}}case dy:{const{document:e}=t;return{...i,currentDocument:e,currentFileNo:i.documents.findIndex(n=>n.uri===e.uri)}}case uy:{const{rect:e}=t;return{...i,rendererRect:e}}case fy:{const{config:e}=t;return{...i,config:e}}case py:{const{documents:e,behavior:n}=t;if(e.length===0)return i;const s=n==="replace"?e:[...i.documents,...e],r=n==="replace"?0:i.documents.length;return{...i,documents:s,currentDocument:s[r],currentFileNo:r,documentLoading:!0}}case MP:{const{isDragging:e}=t;return{...i,isDragging:e}}case gy:{const{pageNumber:e}=t;return{...i,targetPage:e}}default:return i}},UP=({dragState:i,dropMessage:t="Drop files here"})=>i.isOverDropZone?T.jsx(GP,{children:T.jsxs(VP,{children:[T.jsx(HP,{}),T.jsx(WP,{children:t})]})}):null,HP=()=>T.jsxs("svg",{width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),T.jsx("polyline",{points:"17 8 12 3 7 8"}),T.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),zP=oy`
59
- 0% {
60
- transform: scale(1);
61
- opacity: 1;
62
- }
63
- 50% {
64
- transform: scale(1.05);
65
- opacity: 0.8;
66
- }
67
- 100% {
68
- transform: scale(1);
69
- opacity: 1;
70
- }
71
- `,GP=X.div`
72
- position: absolute;
73
- top: 0;
74
- left: 0;
75
- right: 0;
76
- bottom: 0;
77
- background-color: rgba(0, 100, 200, 0.85);
78
- display: flex;
79
- align-items: center;
80
- justify-content: center;
81
- z-index: 1000;
82
- animation: ${zP} 1.5s ease-in-out infinite;
83
- `,VP=X.div`
84
- display: flex;
85
- flex-direction: column;
86
- align-items: center;
87
- gap: 16px;
88
- padding: 40px;
89
- border: 3px dashed rgba(255, 255, 255, 0.7);
90
- border-radius: 16px;
91
- color: white;
92
- `,WP=X.span`
93
- font-size: 20px;
94
- font-weight: 600;
95
- color: white;
96
- text-align: center;
97
-
98
- @media (max-width: 768px) {
99
- font-size: 16px;
100
- }
101
- `,qP=()=>{const[i,t]=I.useState({isDragging:!1,isOverDropZone:!1}),e=I.useRef(0),n=I.useCallback(c=>{c.preventDefault(),c.stopPropagation(),e.current++,c.dataTransfer.items&&c.dataTransfer.items.length>0&&t({isDragging:!0,isOverDropZone:!0})},[]),s=I.useCallback(c=>{c.preventDefault(),c.stopPropagation(),e.current--,e.current===0&&t({isDragging:!1,isOverDropZone:!1})},[]),r=I.useCallback(c=>{c.preventDefault(),c.stopPropagation()},[]),o=I.useCallback((c,d)=>{c.preventDefault(),c.stopPropagation(),e.current=0,t({isDragging:!1,isOverDropZone:!1});const h=Array.from(c.dataTransfer.files);h.length>0&&d(h)},[]),a=I.useCallback(()=>{e.current=0,t({isDragging:!1,isOverDropZone:!1})},[]);return{dragState:i,handleDragEnter:n,handleDragLeave:s,handleDragOver:r,handleDrop:o,resetDragState:a}},XP=["application/pdf","image/png","image/jpeg","image/gif","image/bmp","image/webp","image/tiff","text/plain","text/html","text/csv","video/mp4","video/webm"],YP=50*1024*1024,KP=i=>{const t=(i==null?void 0:i.acceptedFileTypes)||XP,e=(i==null?void 0:i.maxFileSize)||YP,n=I.useCallback(c=>{var u;const d=c.type.toLowerCase(),h=((u=c.name.split(".").pop())==null?void 0:u.toLowerCase())||"";return t.some(p=>{if(p.includes("*")){const[v]=p.split("/");return d.startsWith(v)}return p.startsWith(".")?`.${h}`===p.toLowerCase():d===p.toLowerCase()||h===p.toLowerCase()})},[t]),s=I.useCallback(c=>c.size<=e,[e]),r=I.useCallback(c=>new Promise((d,h)=>{const u=new FileReader;u.onload=()=>{const p=u.result;d({uri:URL.createObjectURL(c),fileType:c.type||ZP(c.name),fileName:c.name,fileData:p})},u.onerror=()=>{h(new Error(`Failed to read file: ${c.name}`))},u.readAsDataURL(c)}),[]),o=I.useCallback(async c=>{const d=c.filter(u=>n(u)&&s(u));return(await Promise.all(d.map(r))).map(u=>({uri:u.uri,fileType:u.fileType,fileName:u.fileName,fileData:u.fileData}))},[n,s,r]),a=I.useCallback(c=>{const d=[],h=[],u=[];return c.forEach(p=>{n(p)?s(p)?d.push(p):u.push(p):h.push(p)}),{valid:d,invalidType:h,invalidSize:u}},[n,s]);return{processFiles:o,validateFiles:a,isFileTypeAccepted:n,isFileSizeValid:s}};function ZP(i){var n;const t=((n=i.split(".").pop())==null?void 0:n.toLowerCase())||"";return{pdf:"application/pdf",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",webp:"image/webp",tiff:"image/tiff",tif:"image/tiff",txt:"text/plain",html:"text/html",htm:"text/html",csv:"text/csv",mp4:"video/mp4",webm:"video/webm"}[t]||"application/octet-stream"}const Ss=I.createContext({state:nu,dispatch:()=>null}),JP=I.forwardRef((i,t)=>{const{children:e,documents:n,config:s,pluginRenderers:r,prefetchMethod:o,requestHeaders:a,initialActiveDocument:c,language:d,activeDocument:h,onDocumentChange:u,dragDropConfig:p,providerRef:v,jumpToPage:b}=i,{processFiles:x,validateFiles:_}=KP(p),[E,R]=I.useReducer(jP,{...nu,documents:n||[],currentDocument:n&&n.length?c||n[0]:void 0,config:s,pluginRenderers:r,prefetchMethod:o,requestHeaders:a,currentFileNo:c?n.findIndex(F=>F===c)??0:0,language:d&&eu[d]?d:s0,activeDocument:h,onDocumentChange:u});I.useEffect(()=>{R(OP(n,c)),s&&R($P(s))},[n,s,c]),I.useEffect(()=>{h&&R(Eg(h))},[h]),I.useEffect(()=>{b!==void 0&&b>0&&R(pv(b))},[b]);const k=I.useCallback(F=>{const M=(p==null?void 0:p.dropBehavior)||"append";R(BP(F,M))},[R,p]),D=I.useCallback(async F=>{const{valid:M,invalidType:O,invalidSize:C}=_(F);if(O.length>0&&(p!=null&&p.onDropRejected)&&p.onDropRejected(O,"file-type"),C.length>0&&(p!=null&&p.onDropRejected)&&p.onDropRejected(C,"file-size"),M.length>0){p!=null&&p.onDrop&&p.onDrop(M);const P=await x(M);P.length>0&&k(P)}},[_,x,k,p]);return I.useImperativeHandle(t,()=>({prev(){R(o0())},next(){R(r0())},goToPage(F){R(pv(F))}}),[R]),I.useEffect(()=>{v&&(v.current={handleFilesDropped:D})},[v,D]),T.jsx(Ss.Provider,{value:{state:E,dispatch:R,addDroppedDocuments:k},children:e})}),QP=np`
102
- background-color: ${i=>i.theme.primary};
103
- color: ${i=>i.theme.textPrimary};
104
- `,tR=np`
105
- background-color: ${i=>i.theme.secondary};
106
- color: ${i=>i.theme.textSecondary};
107
- `,ip=X.button`
108
- ${QP}
109
- display: flex;
110
- justify-content: center;
111
- align-items: center;
112
- width: 35px;
113
- height: 35px;
114
- padding: 0;
115
- margin: 0 0 0 5px;
116
- text-align: center;
117
- font-size: 18px;
118
- border: 0;
119
- outline: none;
120
- cursor: pointer;
121
- text-decoration: none;
122
- border-radius: 35px;
123
- opacity: ${i=>i.disabled?.4:1};
124
- pointer-events: ${i=>i.disabled?"none":"all"};
125
- box-shadow: 2px 2px 3px #00000033;
126
-
127
- @media (max-width: 768px) {
128
- width: 30px;
129
- height: 30px;
130
- font-size: 15px;
131
- }
132
- `,my=X.a`
133
- display: flex;
134
- justify-content: center;
135
- align-items: center;
136
- border: 0;
137
- outline: none;
138
- cursor: pointer;
139
- text-decoration: none;
140
- border-radius: 35px;
141
- background-color: ${i=>i.theme.primary};
142
- color: ${i=>i.theme.textPrimary};
143
- box-shadow: 2px 2px 3px #00000033;
144
-
145
- width: 35px;
146
- height: 35px;
147
- font-size: 18px;
148
- @media (max-width: 768px) {
149
- width: 30px;
150
- height: 30px;
151
- font-size: 15px;
152
- }
153
- `;X(ip)``;const eR=X(ip)`
154
- ${tR}
155
- `,nR=i=>T.jsx(vy,{...i}),iR=i=>T.jsx(vy,{...i,reverse:!0}),vy=({color:i,size:t,reverse:e})=>T.jsx("svg",{width:t||"100%",height:t||"100%",style:{transform:`${e?"rotate(180deg)":""}`},id:"arrow_left",version:"1.1",viewBox:"0 0 32 32",xmlSpace:"preserve",children:T.jsx("path",{clipRule:"evenodd",d:"M31.106,15H3.278l8.325-8.293 c0.391-0.391,0.391-1.024,0-1.414c-0.391-0.391-1.024-0.391-1.414,0l-9.9,9.899c-0.385,0.385-0.385,1.029,0,1.414l9.9,9.9 c0.391,0.391,1.024,0.391,1.414,0c0.391-0.391,0.391-1.024,0-1.414L3.278,17h27.828c0.552,0,1-0.448,1-1 C32.106,15.448,31.658,15,31.106,15z",fill:i||"#aaa",fillRule:"evenodd",id:"Arrow_Back"})}),sR=i=>{const{color:t,size:e}=i;return T.jsx("svg",{width:e||"100%",height:e||"100%",version:"1.1",id:"Icons",viewBox:"0 0 32 32",xmlSpace:"preserve",style:{alignSelf:"center",justifySelf:"center"},children:T.jsxs("g",{children:[T.jsx("path",{fill:t||"#aaa",d:"M16,2c-0.6,0-1,0.4-1,1v5c0,0.6,0.4,1,1,1s1-0.4,1-1V3C17,2.4,16.6,2,16,2z"}),T.jsx("path",{fill:t||"#aaa",d:`M7.5,6.1c-0.4-0.4-1-0.4-1.4,0s-0.4,1,0,1.4l3.5,3.5c0.2,0.2,0.5,0.3,0.7,0.3s0.5-0.1,0.7-0.3c0.4-0.4,0.4-1,0-1.4L7.5,6.1
156
- z`}),T.jsx("path",{fill:t||"#aaa",d:"M9,16c0-0.6-0.4-1-1-1H3c-0.6,0-1,0.4-1,1s0.4,1,1,1h5C8.6,17,9,16.6,9,16z"}),T.jsx("path",{fill:t||"#aaa",d:`M9.6,20.9l-3.5,3.5c-0.4,0.4-0.4,1,0,1.4c0.2,0.2,0.5,0.3,0.7,0.3s0.5-0.1,0.7-0.3l3.5-3.5c0.4-0.4,0.4-1,0-1.4
157
- S10,20.6,9.6,20.9z`}),T.jsx("path",{fill:t||"#aaa",d:"M16,23c-0.6,0-1,0.4-1,1v5c0,0.6,0.4,1,1,1s1-0.4,1-1v-5C17,23.4,16.6,23,16,23z"}),T.jsx("path",{fill:t||"#aaa",d:`M22.4,20.9c-0.4-0.4-1-0.4-1.4,0s-0.4,1,0,1.4l3.5,3.5c0.2,0.2,0.5,0.3,0.7,0.3s0.5-0.1,0.7-0.3c0.4-0.4,0.4-1,0-1.4
158
- L22.4,20.9z`}),T.jsx("path",{fill:t||"#aaa",d:"M29,15h-5c-0.6,0-1,0.4-1,1s0.4,1,1,1h5c0.6,0,1-0.4,1-1S29.6,15,29,15z"}),T.jsx("path",{fill:t||"#aaa",d:`M21.7,11.3c0.3,0,0.5-0.1,0.7-0.3l3.5-3.5c0.4-0.4,0.4-1,0-1.4s-1-0.4-1.4,0l-3.5,3.5c-0.4,0.4-0.4,1,0,1.4
159
- C21.1,11.2,21.4,11.3,21.7,11.3z`})]})})};/*!
160
- * mustache.js - Logic-less {{mustache}} templates with JavaScript
161
- * http://github.com/janl/mustache.js
162
- */var rR=Object.prototype.toString,Xa=Array.isArray||function(t){return rR.call(t)==="[object Array]"};function a0(i){return typeof i=="function"}function oR(i){return Xa(i)?"array":typeof i}function Yp(i){return i.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function gv(i,t){return i!=null&&typeof i=="object"&&t in i}function aR(i,t){return i!=null&&typeof i!="object"&&i.hasOwnProperty&&i.hasOwnProperty(t)}var lR=RegExp.prototype.test;function cR(i,t){return lR.call(i,t)}var hR=/\S/;function dR(i){return!cR(hR,i)}var uR={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function fR(i){return String(i).replace(/[&<>"'`=\/]/g,function(e){return uR[e]})}var pR=/\s*/,gR=/\s+/,mv=/\s*=/,mR=/\s*\}/,vR=/#|\^|\/|>|\{|&|=|!/;function bR(i,t){if(!i)return[];var e=!1,n=[],s=[],r=[],o=!1,a=!1,c="",d=0;function h(){if(o&&!a)for(;r.length;)delete s[r.pop()];else r=[];o=!1,a=!1}var u,p,v;function b(C){if(typeof C=="string"&&(C=C.split(gR,2)),!Xa(C)||C.length!==2)throw new Error("Invalid tags: "+C);u=new RegExp(Yp(C[0])+"\\s*"),p=new RegExp("\\s*"+Yp(C[1])),v=new RegExp("\\s*"+Yp("}"+C[1]))}b(t||en.tags);for(var x=new Vh(i),_,E,R,k,D,F;!x.eos();){if(_=x.pos,R=x.scanUntil(u),R)for(var M=0,O=R.length;M<O;++M)k=R.charAt(M),dR(k)?(r.push(s.length),c+=k):(a=!0,e=!0,c+=" "),s.push(["text",k,_,_+1]),_+=1,k===`
163
- `&&(h(),c="",d=0,e=!1);if(!x.scan(u))break;if(o=!0,E=x.scan(vR)||"name",x.scan(pR),E==="="?(R=x.scanUntil(mv),x.scan(mv),x.scanUntil(p)):E==="{"?(R=x.scanUntil(v),x.scan(mR),x.scanUntil(p),E="&"):R=x.scanUntil(p),!x.scan(p))throw new Error("Unclosed tag at "+x.pos);if(E==">"?D=[E,R,_,x.pos,c,d,e]:D=[E,R,_,x.pos],d++,s.push(D),E==="#"||E==="^")n.push(D);else if(E==="/"){if(F=n.pop(),!F)throw new Error('Unopened section "'+R+'" at '+_);if(F[1]!==R)throw new Error('Unclosed section "'+F[1]+'" at '+_)}else E==="name"||E==="{"||E==="&"?a=!0:E==="="&&b(R)}if(h(),F=n.pop(),F)throw new Error('Unclosed section "'+F[1]+'" at '+x.pos);return wR(yR(s))}function yR(i){for(var t=[],e,n,s=0,r=i.length;s<r;++s)e=i[s],e&&(e[0]==="text"&&n&&n[0]==="text"?(n[1]+=e[1],n[3]=e[3]):(t.push(e),n=e));return t}function wR(i){for(var t=[],e=t,n=[],s,r,o=0,a=i.length;o<a;++o)switch(s=i[o],s[0]){case"#":case"^":e.push(s),n.push(s),e=s[4]=[];break;case"/":r=n.pop(),r[5]=s[2],e=n.length>0?n[n.length-1][4]:t;break;default:e.push(s)}return t}function Vh(i){this.string=i,this.tail=i,this.pos=0}Vh.prototype.eos=function(){return this.tail===""};Vh.prototype.scan=function(t){var e=this.tail.match(t);if(!e||e.index!==0)return"";var n=e[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};Vh.prototype.scanUntil=function(t){var e=this.tail.search(t),n;switch(e){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,e),this.tail=this.tail.substring(e)}return this.pos+=n.length,n};function Va(i,t){this.view=i,this.cache={".":this.view},this.parent=t}Va.prototype.push=function(t){return new Va(t,this)};Va.prototype.lookup=function(t){var e=this.cache,n;if(e.hasOwnProperty(t))n=e[t];else{for(var s=this,r,o,a,c=!1;s;){if(t.indexOf(".")>0)for(r=s.view,o=t.split("."),a=0;r!=null&&a<o.length;)a===o.length-1&&(c=gv(r,o[a])||aR(r,o[a])),r=r[o[a++]];else r=s.view[t],c=gv(s.view,t);if(c){n=r;break}s=s.parent}e[t]=n}return a0(n)&&(n=n.call(this.view)),n};function Oe(){this.templateCache={_cache:{},set:function(t,e){this._cache[t]=e},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}Oe.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Oe.prototype.parse=function(t,e){var n=this.templateCache,s=t+":"+(e||en.tags).join(":"),r=typeof n<"u",o=r?n.get(s):void 0;return o==null&&(o=bR(t,e),r&&n.set(s,o)),o};Oe.prototype.render=function(t,e,n,s){var r=this.getConfigTags(s),o=this.parse(t,r),a=e instanceof Va?e:new Va(e,void 0);return this.renderTokens(o,a,n,t,s)};Oe.prototype.renderTokens=function(t,e,n,s,r){for(var o="",a,c,d,h=0,u=t.length;h<u;++h)d=void 0,a=t[h],c=a[0],c==="#"?d=this.renderSection(a,e,n,s,r):c==="^"?d=this.renderInverted(a,e,n,s,r):c===">"?d=this.renderPartial(a,e,n,r):c==="&"?d=this.unescapedValue(a,e):c==="name"?d=this.escapedValue(a,e,r):c==="text"&&(d=this.rawValue(a)),d!==void 0&&(o+=d);return o};Oe.prototype.renderSection=function(t,e,n,s,r){var o=this,a="",c=e.lookup(t[1]);function d(p){return o.render(p,e,n,r)}if(c){if(Xa(c))for(var h=0,u=c.length;h<u;++h)a+=this.renderTokens(t[4],e.push(c[h]),n,s,r);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")a+=this.renderTokens(t[4],e.push(c),n,s,r);else if(a0(c)){if(typeof s!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(e.view,s.slice(t[3],t[5]),d),c!=null&&(a+=c)}else a+=this.renderTokens(t[4],e,n,s,r);return a}};Oe.prototype.renderInverted=function(t,e,n,s,r){var o=e.lookup(t[1]);if(!o||Xa(o)&&o.length===0)return this.renderTokens(t[4],e,n,s,r)};Oe.prototype.indentPartial=function(t,e,n){for(var s=e.replace(/[^ \t]/g,""),r=t.split(`
164
- `),o=0;o<r.length;o++)r[o].length&&(o>0||!n)&&(r[o]=s+r[o]);return r.join(`
165
- `)};Oe.prototype.renderPartial=function(t,e,n,s){if(n){var r=this.getConfigTags(s),o=a0(n)?n(t[1]):n[t[1]];if(o!=null){var a=t[6],c=t[5],d=t[4],h=o;c==0&&d&&(h=this.indentPartial(o,d,a));var u=this.parse(h,r);return this.renderTokens(u,e,n,h,s)}}};Oe.prototype.unescapedValue=function(t,e){var n=e.lookup(t[1]);if(n!=null)return n};Oe.prototype.escapedValue=function(t,e,n){var s=this.getConfigEscape(n)||en.escape,r=e.lookup(t[1]);if(r!=null)return typeof r=="number"&&s===en.escape?String(r):s(r)};Oe.prototype.rawValue=function(t){return t[1]};Oe.prototype.getConfigTags=function(t){return Xa(t)?t:t&&typeof t=="object"?t.tags:void 0};Oe.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!Xa(t))return t.escape};var en={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(i){wl.templateCache=i},get templateCache(){return wl.templateCache}},wl=new Oe;en.clearCache=function(){return wl.clearCache()};en.parse=function(t,e){return wl.parse(t,e)};en.render=function(t,e,n,s){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+oR(t)+'" was given as the first argument for mustache#render(template, view, partials)');return wl.render(t,e,n,s)};en.escape=fR;en.Scanner=Vh;en.Context=Va;en.Writer=Oe;const io=()=>{const{state:{language:i}}=I.useContext(Ss),t=eu[s0];return{t:I.useCallback((n,s)=>{const r=eu[i];return r[n]?en.render(r[n],s):t[n]?en.render(t[n],s):n},[i,t])}},AR=()=>{const{state:{currentDocument:i,currentFileNo:t,documents:e},dispatch:n}=I.useContext(Ss),{t:s}=io();if(e.length<=1||!i)return null;let r=i.uri||"";const o=r==null?void 0:r.split("/");return o.length&&(r=o[o.length-1]),T.jsxs(xR,{id:"doc-nav",children:[T.jsx("p",{id:"doc-nav-info",children:s("documentNavInfo",{currentFileNo:t+1,allFilesCount:e.length})}),T.jsx(by,{id:"doc-nav-prev",onClick:()=>n(o0()),disabled:t===0,children:T.jsx(nR,{color:"#fff",size:"60%"})}),T.jsx(ER,{id:"doc-nav-next",onClick:()=>n(r0()),disabled:t>=e.length-1,children:T.jsx(iR,{color:"#fff",size:"60%"})})]})},xR=X.div`
166
- min-width: 150px;
167
- display: flex;
168
- flex-direction: row;
169
- align-items: center;
170
- justify-content: flex-end;
171
- margin: 0 10px;
172
- color: ${i=>i.theme.textPrimary};
173
- `,by=X(eR)`
174
- width: 30px;
175
- height: 30px;
176
- margin: 0 5px 0 10px;
177
-
178
- @media (max-width: 768px) {
179
- width: 25px;
180
- height: 25px;
181
- }
182
- `,ER=X(by)`
183
- margin: 0 5px;
184
- `,yy=(i,t)=>{var n;if(!i)return"";let e="";if(i.fileName)e=i.fileName;else{e=i.uri||"",e=decodeURI(e),t||(e=(n=e==null?void 0:e.split("?"))==null?void 0:n[0]);const s=e==null?void 0:e.split("/");s.length&&(e=s[s.length-1])}return e},_R=()=>{var n,s;const{state:{config:i,currentDocument:t}}=I.useContext(Ss);if(!t||(n=i==null?void 0:i.header)!=null&&n.disableFileName)return null;const e=yy(t,((s=i==null?void 0:i.header)==null?void 0:s.retainURLParams)||!1);return T.jsx(SR,{id:"file-name","data-testid":"file-name",children:e})},SR=X.div`
185
- flex: 1;
186
- text-align: left;
187
- color: ${i=>i.theme.textPrimary};
188
- font-weight: bold;
189
- margin: 0 10px;
190
- overflow: hidden;
191
- `,CR=()=>{var s,r,o;const{state:i,dispatch:t}=I.useContext(Ss),{config:e}=i;if((s=e==null?void 0:e.header)!=null&&s.disableHeader)return null;const n=(o=(r=e==null?void 0:e.header)==null?void 0:r.overrideComponent)==null?void 0:o.call(r,i,()=>t(o0()),()=>t(r0()));return n||T.jsxs(TR,{id:"header-bar","data-testid":"header-bar",children:[T.jsx(_R,{}),T.jsx(AR,{})]})},TR=X.div`
192
- display: flex;
193
- justify-content: flex-end;
194
- align-items: center;
195
- z-index: 1;
196
- padding: 0 10px;
197
- background-color: ${i=>i.theme.primary};
198
- font-size: 16px;
199
- min-height: 50px;
200
-
201
- @media (max-width: 768px) {
202
- min-height: 30px;
203
- padding: 5px;
204
- font-size: 10px;
205
- }
206
- `,sp=({documentURI:i,signal:t,fileLoaderComplete:e,readerTypeFunction:n,headers:s})=>fetch(i,{signal:t,headers:s}).then(async r=>{const o=await r.blob(),a=new FileReader;switch(a.addEventListener("loadend",()=>e(a)),n){case"arrayBuffer":a.readAsArrayBuffer(o);break;case"binaryString":a.readAsBinaryString(o);break;case"dataURL":a.readAsDataURL(o);break;case"text":a.readAsText(o);break}}).catch(r=>r),wy=i=>sp({...i,readerTypeFunction:"arrayBuffer"}),l0=i=>sp({...i,readerTypeFunction:"dataURL"}),c0=i=>sp({...i,readerTypeFunction:"text"}),PR=i=>sp({...i,readerTypeFunction:"binaryString"}),Ay=l0,RR=()=>{const{state:{currentDocument:i,pluginRenderers:t}}=I.useContext(Ss),[e,n]=I.useState();return I.useEffect(()=>{if(!i)return;if(!i.fileType){n(void 0);return}const s=[];t==null||t.forEach(o=>{i.fileType!==void 0&&o.fileTypes.indexOf(i.fileType)>=0&&s.push(o)});const[r]=s.sort((o,a)=>a.weight-o.weight);n(r&&r!==void 0?()=>r:null)},[i,t]),{CurrentRenderer:e}},kR=()=>{const{state:i,dispatch:t}=I.useContext(Ss),{currentFileNo:e,currentDocument:n,prefetchMethod:s}=i,{CurrentRenderer:r}=RR(),o=(n==null?void 0:n.uri)||"";return I.useEffect(()=>{if(!n||n.fileType!==void 0)return;const a=new AbortController,{signal:c}=a;return fetch(o,{method:s||o.startsWith("blob:")?"GET":"HEAD",signal:c,headers:i==null?void 0:i.requestHeaders}).then(d=>{const h=d.headers.get("content-type"),u=(h==null?void 0:h.split(";"))||[],p=u.length?u[0]:void 0;t(Eg({...n,fileType:p||void 0}))}).catch(d=>{if((d==null?void 0:d.name)!=="AbortError")throw d}),()=>{a.abort()}},[e,o,n]),I.useEffect(()=>{var u;if(!n||r===void 0)return;const a=new AbortController,{signal:c}=a,h={documentURI:o,signal:c,fileLoaderComplete:p=>{if(!n||!p){t(Xp(!1));return}const v={...n};p.result!==null&&(v.fileData=p.result),t(Eg(v)),t(Xp(!1))},headers:i==null?void 0:i.requestHeaders};return r===null?t(Xp(!1)):r.fileLoader!==void 0?(u=r.fileLoader)==null||u.call(r,h):Ay(h),()=>{a.abort()}},[r,e]),{state:i,dispatch:t,CurrentRenderer:r}},LR=()=>{const[i,t]=I.useState({width:void 0,height:void 0});return I.useEffect(()=>{function e(){t({width:window.innerWidth,height:window.innerHeight})}return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]),i},vv=({children:i})=>{var r,o;const{state:t}=I.useContext(Ss),{config:e}=t,[n,s]=I.useState(((r=e==null?void 0:e.loadingRenderer)==null?void 0:r.showLoadingTimeout)===!1);return I.useEffect(()=>{var a;setTimeout(()=>{s(!0)},typeof((a=e==null?void 0:e.loadingRenderer)==null?void 0:a.showLoadingTimeout)=="number"?e.loadingRenderer.showLoadingTimeout:500)},[(o=e==null?void 0:e.loadingRenderer)==null?void 0:o.showLoadingTimeout]),n?T.jsx(T.Fragment,{children:i}):null},IR=({documents:i,documentLoading:t,config:e,currentDocument:n,fileName:s,CurrentRenderer:r,state:o,t:a})=>{var c,d;if(i.length)if(t){if(e&&((c=e==null?void 0:e.loadingRenderer)!=null&&c.overrideComponent)){const h=e.loadingRenderer.overrideComponent;return T.jsx(vv,{children:T.jsx(h,{document:n,fileName:s})})}return T.jsx(vv,{children:T.jsx(FR,{id:"loading-renderer","data-testid":"loading-renderer",children:T.jsx(OR,{children:T.jsx(sR,{color:"#444",size:40})})})})}else{if(r)return T.jsx(r,{mainState:o});if(r===void 0)return null;if(e&&((d=e==null?void 0:e.noRenderer)!=null&&d.overrideComponent)){const h=e.noRenderer.overrideComponent;return T.jsx(h,{document:n,fileName:s})}return T.jsxs("div",{id:"no-renderer","data-testid":"no-renderer",children:[a("noRendererMessage",{fileType:(n==null?void 0:n.fileType)??""}),T.jsx(NR,{id:"no-renderer-download",href:n==null?void 0:n.uri,download:n==null?void 0:n.uri,children:a("downloadButtonLabel")})]})}else return T.jsx("div",{id:"no-documents"})},DR=()=>{var u;const{state:i,dispatch:t,CurrentRenderer:e}=kR(),{documents:n,documentLoading:s,currentDocument:r,config:o}=i,a=LR(),{t:c}=io(),d=I.useCallback(p=>{p&&t(NP(p==null?void 0:p.getBoundingClientRect()))},[a,t]),h=yy(r,((u=o==null?void 0:o.header)==null?void 0:u.retainURLParams)||!1);return T.jsx("div",{id:"proxy-renderer","data-testid":"proxy-renderer",ref:d,children:T.jsx(IR,{state:i,documents:n,documentLoading:s,config:o,currentDocument:r,fileName:h,CurrentRenderer:e,t:c})})},FR=X.div`
207
- display: flex;
208
- flex: 1;
209
- height: 75px;
210
- align-items: center;
211
- justify-content: center;
212
- `,MR=oy`
213
- from {
214
- transform: rotate(0deg);
215
- }
216
- to {
217
- transform: rotate(360deg);
218
- }
219
- `,OR=X.div`
220
- animation-name: ${MR};
221
- animation-duration: 4s;
222
- animation-timing-function: linear;
223
- animation-iteration-count: infinite;
224
- `,NR=X(my)`
225
- width: 130px;
226
- height: 30px;
227
- background-color: ${i=>i.theme.primary};
228
- @media (max-width: 768px) {
229
- width: 125px;
230
- height: 25px;
231
- }
232
- `,bv={primary:"#fff",secondary:"#000",tertiary:"#ffffff99",textPrimary:"#000",textSecondary:"#fff",textTertiary:"#00000044",disableThemeScrollbar:!1},Hi=({mainState:{currentDocument:i},children:t,...e})=>i?T.jsx($R,{id:"image-renderer",...e,children:t||T.jsx(BR,{id:"image-img",src:i.fileData})}):null;Hi.fileTypes=[];Hi.weight=0;const $R=X.div`
233
- display: flex;
234
- flex: 1;
235
- align-items: center;
236
- justify-content: center;
237
- width: 100%;
238
- height: 100%;
239
- background-color: #fff;
240
- `,BR=X.img`
241
- max-width: 95%;
242
- max-height: 95%;
243
- `,rp=i=>T.jsx(Hi,{...i});rp.fileTypes=["bmp","image/bmp"];rp.weight=0;const Wh=({mainState:{currentDocument:i}})=>(I.useEffect(()=>{const t=i==null?void 0:i.fileData;let e="";const n=t==null?void 0:t.replace(/^data:text\/html;(?:charset=([^;]*);)?base64,/,(d,h)=>(e=h||"utf-8",""));let s=window.atob(n);const r=Uint8Array.from(s,d=>d.charCodeAt(0));s=new TextDecoder(e).decode(r);const o=document.getElementById("html-body"),a=(o==null?void 0:o.contentWindow)&&o.contentWindow;if(!a)return;const c=a.document;c.open(),c.write(`${s}`),c.close()},[i]),T.jsx(jR,{id:"html-renderer",children:T.jsx(UR,{id:"html-body",sandbox:"allow-same-origin"})}));Wh.fileTypes=["htm","html","text/htm","text/html"];Wh.weight=0;Wh.fileLoader=l0;const jR=X.div`
244
- display: flex;
245
- flex-direction: column;
246
- width: 100%;
247
- padding: 0 30px;
248
- `,UR=X.iframe`
249
- height: 100%;
250
- padding: 15px;
251
- margin: 20px 0 20px 0;
252
- border: 1px solid ${i=>i.theme.secondary};
253
- `,op=i=>T.jsx(Hi,{...i});op.fileTypes=["jpg","jpeg","image/jpg","image/jpeg"];op.weight=0;const qh=({mainState:{currentDocument:i}})=>i?T.jsx(HR,{id:"msdoc-renderer",children:T.jsx(zR,{id:"msdoc-iframe",title:"msdoc-iframe",src:`https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(i.uri)}`,frameBorder:"0"})}):null,Ps={odt:["odt","application/vnd.oasis.opendocument.text"],doc:["doc","application/msword"],docx:["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/octet-stream"],xls:["xls","application/vnd.ms-excel"],xlsx:["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],ppt:["ppt","application/vnd.ms-powerpoint"],pptx:["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"]};qh.fileTypes=[...Ps.odt,...Ps.doc,...Ps.docx,...Ps.xls,...Ps.xlsx,...Ps.ppt,...Ps.pptx];qh.weight=0;qh.fileLoader=({fileLoaderComplete:i})=>i();const HR=X.div`
254
- width: 100%;
255
- `,zR=X.iframe`
256
- width: 100%;
257
- height: 100%;
258
- border: 0;
259
- `;var le={},ap={};ap.byteLength=WR;ap.toByteArray=XR;ap.fromByteArray=ZR;var Jn=[],rn=[],GR=typeof Uint8Array<"u"?Uint8Array:Array,Kp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var co=0,VR=Kp.length;co<VR;++co)Jn[co]=Kp[co],rn[Kp.charCodeAt(co)]=co;rn[45]=62;rn[95]=63;function xy(i){var t=i.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=i.indexOf("=");e===-1&&(e=t);var n=e===t?0:4-e%4;return[e,n]}function WR(i){var t=xy(i),e=t[0],n=t[1];return(e+n)*3/4-n}function qR(i,t,e){return(t+e)*3/4-e}function XR(i){var t,e=xy(i),n=e[0],s=e[1],r=new GR(qR(i,n,s)),o=0,a=s>0?n-4:n,c;for(c=0;c<a;c+=4)t=rn[i.charCodeAt(c)]<<18|rn[i.charCodeAt(c+1)]<<12|rn[i.charCodeAt(c+2)]<<6|rn[i.charCodeAt(c+3)],r[o++]=t>>16&255,r[o++]=t>>8&255,r[o++]=t&255;return s===2&&(t=rn[i.charCodeAt(c)]<<2|rn[i.charCodeAt(c+1)]>>4,r[o++]=t&255),s===1&&(t=rn[i.charCodeAt(c)]<<10|rn[i.charCodeAt(c+1)]<<4|rn[i.charCodeAt(c+2)]>>2,r[o++]=t>>8&255,r[o++]=t&255),r}function YR(i){return Jn[i>>18&63]+Jn[i>>12&63]+Jn[i>>6&63]+Jn[i&63]}function KR(i,t,e){for(var n,s=[],r=t;r<e;r+=3)n=(i[r]<<16&16711680)+(i[r+1]<<8&65280)+(i[r+2]&255),s.push(YR(n));return s.join("")}function ZR(i){for(var t,e=i.length,n=e%3,s=[],r=16383,o=0,a=e-n;o<a;o+=r)s.push(KR(i,o,o+r>a?a:o+r));return n===1?(t=i[e-1],s.push(Jn[t>>2]+Jn[t<<4&63]+"==")):n===2&&(t=(i[e-2]<<8)+i[e-1],s.push(Jn[t>>10]+Jn[t>>4&63]+Jn[t<<2&63]+"=")),s.join("")}var h0={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */h0.read=function(i,t,e,n,s){var r,o,a=s*8-n-1,c=(1<<a)-1,d=c>>1,h=-7,u=e?s-1:0,p=e?-1:1,v=i[t+u];for(u+=p,r=v&(1<<-h)-1,v>>=-h,h+=a;h>0;r=r*256+i[t+u],u+=p,h-=8);for(o=r&(1<<-h)-1,r>>=-h,h+=n;h>0;o=o*256+i[t+u],u+=p,h-=8);if(r===0)r=1-d;else{if(r===c)return o?NaN:(v?-1:1)*(1/0);o=o+Math.pow(2,n),r=r-d}return(v?-1:1)*o*Math.pow(2,r-n)};h0.write=function(i,t,e,n,s,r){var o,a,c,d=r*8-s-1,h=(1<<d)-1,u=h>>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=n?0:r-1,b=n?1:-1,x=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+u>=1?t+=p/c:t+=p*Math.pow(2,1-u),t*c>=2&&(o++,c/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(t*c-1)*Math.pow(2,s),o=o+u):(a=t*Math.pow(2,u-1)*Math.pow(2,s),o=0));s>=8;i[e+v]=a&255,v+=b,a/=256,s-=8);for(o=o<<s|a,d+=s;d>0;i[e+v]=o&255,v+=b,o/=256,d-=8);i[e+v-b]|=x*128};/*!
260
- * The buffer module from node.js, for the browser.
261
- *
262
- * @author Feross Aboukhadijeh <https://feross.org>
263
- * @license MIT
264
- */(function(i){const t=ap,e=h0,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;i.Buffer=h,i.SlowBuffer=F,i.INSPECT_MAX_BYTES=50;const s=2147483647;i.kMaxLength=s;const{Uint8Array:r,ArrayBuffer:o,SharedArrayBuffer:a}=globalThis;h.TYPED_ARRAY_SUPPORT=c(),!h.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function c(){try{const y=new r(1),f={foo:function(){return 42}};return Object.setPrototypeOf(f,r.prototype),Object.setPrototypeOf(y,f),y.foo()===42}catch{return!1}}Object.defineProperty(h.prototype,"parent",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.buffer}}),Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.byteOffset}});function d(y){if(y>s)throw new RangeError('The value "'+y+'" is invalid for option "size"');const f=new r(y);return Object.setPrototypeOf(f,h.prototype),f}function h(y,f,g){if(typeof y=="number"){if(typeof f=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return b(y)}return u(y,f,g)}h.poolSize=8192;function u(y,f,g){if(typeof y=="string")return x(y,f);if(o.isView(y))return E(y);if(y==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof y);if(lt(y,o)||y&&lt(y.buffer,o)||typeof a<"u"&&(lt(y,a)||y&&lt(y.buffer,a)))return R(y,f,g);if(typeof y=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const S=y.valueOf&&y.valueOf();if(S!=null&&S!==y)return h.from(S,f,g);const L=k(y);if(L)return L;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof y[Symbol.toPrimitive]=="function")return h.from(y[Symbol.toPrimitive]("string"),f,g);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof y)}h.from=function(y,f,g){return u(y,f,g)},Object.setPrototypeOf(h.prototype,r.prototype),Object.setPrototypeOf(h,r);function p(y){if(typeof y!="number")throw new TypeError('"size" argument must be of type number');if(y<0)throw new RangeError('The value "'+y+'" is invalid for option "size"')}function v(y,f,g){return p(y),y<=0?d(y):f!==void 0?typeof g=="string"?d(y).fill(f,g):d(y).fill(f):d(y)}h.alloc=function(y,f,g){return v(y,f,g)};function b(y){return p(y),d(y<0?0:D(y)|0)}h.allocUnsafe=function(y){return b(y)},h.allocUnsafeSlow=function(y){return b(y)};function x(y,f){if((typeof f!="string"||f==="")&&(f="utf8"),!h.isEncoding(f))throw new TypeError("Unknown encoding: "+f);const g=M(y,f)|0;let S=d(g);const L=S.write(y,f);return L!==g&&(S=S.slice(0,L)),S}function _(y){const f=y.length<0?0:D(y.length)|0,g=d(f);for(let S=0;S<f;S+=1)g[S]=y[S]&255;return g}function E(y){if(lt(y,r)){const f=new r(y);return R(f.buffer,f.byteOffset,f.byteLength)}return _(y)}function R(y,f,g){if(f<0||y.byteLength<f)throw new RangeError('"offset" is outside of buffer bounds');if(y.byteLength<f+(g||0))throw new RangeError('"length" is outside of buffer bounds');let S;return f===void 0&&g===void 0?S=new r(y):g===void 0?S=new r(y,f):S=new r(y,f,g),Object.setPrototypeOf(S,h.prototype),S}function k(y){if(h.isBuffer(y)){const f=D(y.length)|0,g=d(f);return g.length===0||y.copy(g,0,0,f),g}if(y.length!==void 0)return typeof y.length!="number"||Re(y.length)?d(0):_(y);if(y.type==="Buffer"&&Array.isArray(y.data))return _(y.data)}function D(y){if(y>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return y|0}function F(y){return+y!=y&&(y=0),h.alloc(+y)}h.isBuffer=function(f){return f!=null&&f._isBuffer===!0&&f!==h.prototype},h.compare=function(f,g){if(lt(f,r)&&(f=h.from(f,f.offset,f.byteLength)),lt(g,r)&&(g=h.from(g,g.offset,g.byteLength)),!h.isBuffer(f)||!h.isBuffer(g))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(f===g)return 0;let S=f.length,L=g.length;for(let B=0,U=Math.min(S,L);B<U;++B)if(f[B]!==g[B]){S=f[B],L=g[B];break}return S<L?-1:L<S?1:0},h.isEncoding=function(f){switch(String(f).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(f,g){if(!Array.isArray(f))throw new TypeError('"list" argument must be an Array of Buffers');if(f.length===0)return h.alloc(0);let S;if(g===void 0)for(g=0,S=0;S<f.length;++S)g+=f[S].length;const L=h.allocUnsafe(g);let B=0;for(S=0;S<f.length;++S){let U=f[S];if(lt(U,r))B+U.length>L.length?(h.isBuffer(U)||(U=h.from(U)),U.copy(L,B)):r.prototype.set.call(L,U,B);else if(h.isBuffer(U))U.copy(L,B);else throw new TypeError('"list" argument must be an Array of Buffers');B+=U.length}return L};function M(y,f){if(h.isBuffer(y))return y.length;if(o.isView(y)||lt(y,o))return y.byteLength;if(typeof y!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof y);const g=y.length,S=arguments.length>2&&arguments[2]===!0;if(!S&&g===0)return 0;let L=!1;for(;;)switch(f){case"ascii":case"latin1":case"binary":return g;case"utf8":case"utf-8":return Kt(y).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g*2;case"hex":return g>>>1;case"base64":return Lt(y).length;default:if(L)return S?-1:Kt(y).length;f=(""+f).toLowerCase(),L=!0}}h.byteLength=M;function O(y,f,g){let S=!1;if((f===void 0||f<0)&&(f=0),f>this.length||((g===void 0||g>this.length)&&(g=this.length),g<=0)||(g>>>=0,f>>>=0,g<=f))return"";for(y||(y="utf8");;)switch(y){case"hex":return G(this,f,g);case"utf8":case"utf-8":return j(this,f,g);case"ascii":return wt(this,f,g);case"latin1":case"binary":return pt(this,f,g);case"base64":return Q(this,f,g);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return st(this,f,g);default:if(S)throw new TypeError("Unknown encoding: "+y);y=(y+"").toLowerCase(),S=!0}}h.prototype._isBuffer=!0;function C(y,f,g){const S=y[f];y[f]=y[g],y[g]=S}h.prototype.swap16=function(){const f=this.length;if(f%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let g=0;g<f;g+=2)C(this,g,g+1);return this},h.prototype.swap32=function(){const f=this.length;if(f%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let g=0;g<f;g+=4)C(this,g,g+3),C(this,g+1,g+2);return this},h.prototype.swap64=function(){const f=this.length;if(f%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let g=0;g<f;g+=8)C(this,g,g+7),C(this,g+1,g+6),C(this,g+2,g+5),C(this,g+3,g+4);return this},h.prototype.toString=function(){const f=this.length;return f===0?"":arguments.length===0?j(this,0,f):O.apply(this,arguments)},h.prototype.toLocaleString=h.prototype.toString,h.prototype.equals=function(f){if(!h.isBuffer(f))throw new TypeError("Argument must be a Buffer");return this===f?!0:h.compare(this,f)===0},h.prototype.inspect=function(){let f="";const g=i.INSPECT_MAX_BYTES;return f=this.toString("hex",0,g).replace(/(.{2})/g,"$1 ").trim(),this.length>g&&(f+=" ... "),"<Buffer "+f+">"},n&&(h.prototype[n]=h.prototype.inspect),h.prototype.compare=function(f,g,S,L,B){if(lt(f,r)&&(f=h.from(f,f.offset,f.byteLength)),!h.isBuffer(f))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof f);if(g===void 0&&(g=0),S===void 0&&(S=f?f.length:0),L===void 0&&(L=0),B===void 0&&(B=this.length),g<0||S>f.length||L<0||B>this.length)throw new RangeError("out of range index");if(L>=B&&g>=S)return 0;if(L>=B)return-1;if(g>=S)return 1;if(g>>>=0,S>>>=0,L>>>=0,B>>>=0,this===f)return 0;let U=B-L,xt=S-g;const qt=Math.min(U,xt),zt=this.slice(L,B),Xt=f.slice(g,S);for(let Ot=0;Ot<qt;++Ot)if(zt[Ot]!==Xt[Ot]){U=zt[Ot],xt=Xt[Ot];break}return U<xt?-1:xt<U?1:0};function P(y,f,g,S,L){if(y.length===0)return-1;if(typeof g=="string"?(S=g,g=0):g>2147483647?g=2147483647:g<-2147483648&&(g=-2147483648),g=+g,Re(g)&&(g=L?0:y.length-1),g<0&&(g=y.length+g),g>=y.length){if(L)return-1;g=y.length-1}else if(g<0)if(L)g=0;else return-1;if(typeof f=="string"&&(f=h.from(f,S)),h.isBuffer(f))return f.length===0?-1:$(y,f,g,S,L);if(typeof f=="number")return f=f&255,typeof r.prototype.indexOf=="function"?L?r.prototype.indexOf.call(y,f,g):r.prototype.lastIndexOf.call(y,f,g):$(y,[f],g,S,L);throw new TypeError("val must be string, number or Buffer")}function $(y,f,g,S,L){let B=1,U=y.length,xt=f.length;if(S!==void 0&&(S=String(S).toLowerCase(),S==="ucs2"||S==="ucs-2"||S==="utf16le"||S==="utf-16le")){if(y.length<2||f.length<2)return-1;B=2,U/=2,xt/=2,g/=2}function qt(Xt,Ot){return B===1?Xt[Ot]:Xt.readUInt16BE(Ot*B)}let zt;if(L){let Xt=-1;for(zt=g;zt<U;zt++)if(qt(y,zt)===qt(f,Xt===-1?0:zt-Xt)){if(Xt===-1&&(Xt=zt),zt-Xt+1===xt)return Xt*B}else Xt!==-1&&(zt-=zt-Xt),Xt=-1}else for(g+xt>U&&(g=U-xt),zt=g;zt>=0;zt--){let Xt=!0;for(let Ot=0;Ot<xt;Ot++)if(qt(y,zt+Ot)!==qt(f,Ot)){Xt=!1;break}if(Xt)return zt}return-1}h.prototype.includes=function(f,g,S){return this.indexOf(f,g,S)!==-1},h.prototype.indexOf=function(f,g,S){return P(this,f,g,S,!0)},h.prototype.lastIndexOf=function(f,g,S){return P(this,f,g,S,!1)};function N(y,f,g,S){g=Number(g)||0;const L=y.length-g;S?(S=Number(S),S>L&&(S=L)):S=L;const B=f.length;S>B/2&&(S=B/2);let U;for(U=0;U<S;++U){const xt=parseInt(f.substr(U*2,2),16);if(Re(xt))return U;y[g+U]=xt}return U}function H(y,f,g,S){return Wt(Kt(f,y.length-g),y,g,S)}function z(y,f,g,S){return Wt(Vt(f),y,g,S)}function V(y,f,g,S){return Wt(Lt(f),y,g,S)}function Z(y,f,g,S){return Wt(kt(f,y.length-g),y,g,S)}h.prototype.write=function(f,g,S,L){if(g===void 0)L="utf8",S=this.length,g=0;else if(S===void 0&&typeof g=="string")L=g,S=this.length,g=0;else if(isFinite(g))g=g>>>0,isFinite(S)?(S=S>>>0,L===void 0&&(L="utf8")):(L=S,S=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const B=this.length-g;if((S===void 0||S>B)&&(S=B),f.length>0&&(S<0||g<0)||g>this.length)throw new RangeError("Attempt to write outside buffer bounds");L||(L="utf8");let U=!1;for(;;)switch(L){case"hex":return N(this,f,g,S);case"utf8":case"utf-8":return H(this,f,g,S);case"ascii":case"latin1":case"binary":return z(this,f,g,S);case"base64":return V(this,f,g,S);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Z(this,f,g,S);default:if(U)throw new TypeError("Unknown encoding: "+L);L=(""+L).toLowerCase(),U=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Q(y,f,g){return f===0&&g===y.length?t.fromByteArray(y):t.fromByteArray(y.slice(f,g))}function j(y,f,g){g=Math.min(y.length,g);const S=[];let L=f;for(;L<g;){const B=y[L];let U=null,xt=B>239?4:B>223?3:B>191?2:1;if(L+xt<=g){let qt,zt,Xt,Ot;switch(xt){case 1:B<128&&(U=B);break;case 2:qt=y[L+1],(qt&192)===128&&(Ot=(B&31)<<6|qt&63,Ot>127&&(U=Ot));break;case 3:qt=y[L+1],zt=y[L+2],(qt&192)===128&&(zt&192)===128&&(Ot=(B&15)<<12|(qt&63)<<6|zt&63,Ot>2047&&(Ot<55296||Ot>57343)&&(U=Ot));break;case 4:qt=y[L+1],zt=y[L+2],Xt=y[L+3],(qt&192)===128&&(zt&192)===128&&(Xt&192)===128&&(Ot=(B&15)<<18|(qt&63)<<12|(zt&63)<<6|Xt&63,Ot>65535&&Ot<1114112&&(U=Ot))}}U===null?(U=65533,xt=1):U>65535&&(U-=65536,S.push(U>>>10&1023|55296),U=56320|U&1023),S.push(U),L+=xt}return q(S)}const W=4096;function q(y){const f=y.length;if(f<=W)return String.fromCharCode.apply(String,y);let g="",S=0;for(;S<f;)g+=String.fromCharCode.apply(String,y.slice(S,S+=W));return g}function wt(y,f,g){let S="";g=Math.min(y.length,g);for(let L=f;L<g;++L)S+=String.fromCharCode(y[L]&127);return S}function pt(y,f,g){let S="";g=Math.min(y.length,g);for(let L=f;L<g;++L)S+=String.fromCharCode(y[L]);return S}function G(y,f,g){const S=y.length;(!f||f<0)&&(f=0),(!g||g<0||g>S)&&(g=S);let L="";for(let B=f;B<g;++B)L+=ke[y[B]];return L}function st(y,f,g){const S=y.slice(f,g);let L="";for(let B=0;B<S.length-1;B+=2)L+=String.fromCharCode(S[B]+S[B+1]*256);return L}h.prototype.slice=function(f,g){const S=this.length;f=~~f,g=g===void 0?S:~~g,f<0?(f+=S,f<0&&(f=0)):f>S&&(f=S),g<0?(g+=S,g<0&&(g=0)):g>S&&(g=S),g<f&&(g=f);const L=this.subarray(f,g);return Object.setPrototypeOf(L,h.prototype),L};function nt(y,f,g){if(y%1!==0||y<0)throw new RangeError("offset is not uint");if(y+f>g)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUintLE=h.prototype.readUIntLE=function(f,g,S){f=f>>>0,g=g>>>0,S||nt(f,g,this.length);let L=this[f],B=1,U=0;for(;++U<g&&(B*=256);)L+=this[f+U]*B;return L},h.prototype.readUintBE=h.prototype.readUIntBE=function(f,g,S){f=f>>>0,g=g>>>0,S||nt(f,g,this.length);let L=this[f+--g],B=1;for(;g>0&&(B*=256);)L+=this[f+--g]*B;return L},h.prototype.readUint8=h.prototype.readUInt8=function(f,g){return f=f>>>0,g||nt(f,1,this.length),this[f]},h.prototype.readUint16LE=h.prototype.readUInt16LE=function(f,g){return f=f>>>0,g||nt(f,2,this.length),this[f]|this[f+1]<<8},h.prototype.readUint16BE=h.prototype.readUInt16BE=function(f,g){return f=f>>>0,g||nt(f,2,this.length),this[f]<<8|this[f+1]},h.prototype.readUint32LE=h.prototype.readUInt32LE=function(f,g){return f=f>>>0,g||nt(f,4,this.length),(this[f]|this[f+1]<<8|this[f+2]<<16)+this[f+3]*16777216},h.prototype.readUint32BE=h.prototype.readUInt32BE=function(f,g){return f=f>>>0,g||nt(f,4,this.length),this[f]*16777216+(this[f+1]<<16|this[f+2]<<8|this[f+3])},h.prototype.readBigUInt64LE=ce(function(f){f=f>>>0,K(f,"offset");const g=this[f],S=this[f+7];(g===void 0||S===void 0)&&bt(f,this.length-8);const L=g+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24,B=this[++f]+this[++f]*2**8+this[++f]*2**16+S*2**24;return BigInt(L)+(BigInt(B)<<BigInt(32))}),h.prototype.readBigUInt64BE=ce(function(f){f=f>>>0,K(f,"offset");const g=this[f],S=this[f+7];(g===void 0||S===void 0)&&bt(f,this.length-8);const L=g*2**24+this[++f]*2**16+this[++f]*2**8+this[++f],B=this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+S;return(BigInt(L)<<BigInt(32))+BigInt(B)}),h.prototype.readIntLE=function(f,g,S){f=f>>>0,g=g>>>0,S||nt(f,g,this.length);let L=this[f],B=1,U=0;for(;++U<g&&(B*=256);)L+=this[f+U]*B;return B*=128,L>=B&&(L-=Math.pow(2,8*g)),L},h.prototype.readIntBE=function(f,g,S){f=f>>>0,g=g>>>0,S||nt(f,g,this.length);let L=g,B=1,U=this[f+--L];for(;L>0&&(B*=256);)U+=this[f+--L]*B;return B*=128,U>=B&&(U-=Math.pow(2,8*g)),U},h.prototype.readInt8=function(f,g){return f=f>>>0,g||nt(f,1,this.length),this[f]&128?(255-this[f]+1)*-1:this[f]},h.prototype.readInt16LE=function(f,g){f=f>>>0,g||nt(f,2,this.length);const S=this[f]|this[f+1]<<8;return S&32768?S|4294901760:S},h.prototype.readInt16BE=function(f,g){f=f>>>0,g||nt(f,2,this.length);const S=this[f+1]|this[f]<<8;return S&32768?S|4294901760:S},h.prototype.readInt32LE=function(f,g){return f=f>>>0,g||nt(f,4,this.length),this[f]|this[f+1]<<8|this[f+2]<<16|this[f+3]<<24},h.prototype.readInt32BE=function(f,g){return f=f>>>0,g||nt(f,4,this.length),this[f]<<24|this[f+1]<<16|this[f+2]<<8|this[f+3]},h.prototype.readBigInt64LE=ce(function(f){f=f>>>0,K(f,"offset");const g=this[f],S=this[f+7];(g===void 0||S===void 0)&&bt(f,this.length-8);const L=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+(S<<24);return(BigInt(L)<<BigInt(32))+BigInt(g+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24)}),h.prototype.readBigInt64BE=ce(function(f){f=f>>>0,K(f,"offset");const g=this[f],S=this[f+7];(g===void 0||S===void 0)&&bt(f,this.length-8);const L=(g<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(L)<<BigInt(32))+BigInt(this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+S)}),h.prototype.readFloatLE=function(f,g){return f=f>>>0,g||nt(f,4,this.length),e.read(this,f,!0,23,4)},h.prototype.readFloatBE=function(f,g){return f=f>>>0,g||nt(f,4,this.length),e.read(this,f,!1,23,4)},h.prototype.readDoubleLE=function(f,g){return f=f>>>0,g||nt(f,8,this.length),e.read(this,f,!0,52,8)},h.prototype.readDoubleBE=function(f,g){return f=f>>>0,g||nt(f,8,this.length),e.read(this,f,!1,52,8)};function it(y,f,g,S,L,B){if(!h.isBuffer(y))throw new TypeError('"buffer" argument must be a Buffer instance');if(f>L||f<B)throw new RangeError('"value" argument is out of bounds');if(g+S>y.length)throw new RangeError("Index out of range")}h.prototype.writeUintLE=h.prototype.writeUIntLE=function(f,g,S,L){if(f=+f,g=g>>>0,S=S>>>0,!L){const xt=Math.pow(2,8*S)-1;it(this,f,g,S,xt,0)}let B=1,U=0;for(this[g]=f&255;++U<S&&(B*=256);)this[g+U]=f/B&255;return g+S},h.prototype.writeUintBE=h.prototype.writeUIntBE=function(f,g,S,L){if(f=+f,g=g>>>0,S=S>>>0,!L){const xt=Math.pow(2,8*S)-1;it(this,f,g,S,xt,0)}let B=S-1,U=1;for(this[g+B]=f&255;--B>=0&&(U*=256);)this[g+B]=f/U&255;return g+S},h.prototype.writeUint8=h.prototype.writeUInt8=function(f,g,S){return f=+f,g=g>>>0,S||it(this,f,g,1,255,0),this[g]=f&255,g+1},h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(f,g,S){return f=+f,g=g>>>0,S||it(this,f,g,2,65535,0),this[g]=f&255,this[g+1]=f>>>8,g+2},h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(f,g,S){return f=+f,g=g>>>0,S||it(this,f,g,2,65535,0),this[g]=f>>>8,this[g+1]=f&255,g+2},h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(f,g,S){return f=+f,g=g>>>0,S||it(this,f,g,4,4294967295,0),this[g+3]=f>>>24,this[g+2]=f>>>16,this[g+1]=f>>>8,this[g]=f&255,g+4},h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(f,g,S){return f=+f,g=g>>>0,S||it(this,f,g,4,4294967295,0),this[g]=f>>>24,this[g+1]=f>>>16,this[g+2]=f>>>8,this[g+3]=f&255,g+4};function dt(y,f,g,S,L){At(f,S,L,y,g,7);let B=Number(f&BigInt(4294967295));y[g++]=B,B=B>>8,y[g++]=B,B=B>>8,y[g++]=B,B=B>>8,y[g++]=B;let U=Number(f>>BigInt(32)&BigInt(4294967295));return y[g++]=U,U=U>>8,y[g++]=U,U=U>>8,y[g++]=U,U=U>>8,y[g++]=U,g}function J(y,f,g,S,L){At(f,S,L,y,g,7);let B=Number(f&BigInt(4294967295));y[g+7]=B,B=B>>8,y[g+6]=B,B=B>>8,y[g+5]=B,B=B>>8,y[g+4]=B;let U=Number(f>>BigInt(32)&BigInt(4294967295));return y[g+3]=U,U=U>>8,y[g+2]=U,U=U>>8,y[g+1]=U,U=U>>8,y[g]=U,g+8}h.prototype.writeBigUInt64LE=ce(function(f,g=0){return dt(this,f,g,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeBigUInt64BE=ce(function(f,g=0){return J(this,f,g,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeIntLE=function(f,g,S,L){if(f=+f,g=g>>>0,!L){const qt=Math.pow(2,8*S-1);it(this,f,g,S,qt-1,-qt)}let B=0,U=1,xt=0;for(this[g]=f&255;++B<S&&(U*=256);)f<0&&xt===0&&this[g+B-1]!==0&&(xt=1),this[g+B]=(f/U>>0)-xt&255;return g+S},h.prototype.writeIntBE=function(f,g,S,L){if(f=+f,g=g>>>0,!L){const qt=Math.pow(2,8*S-1);it(this,f,g,S,qt-1,-qt)}let B=S-1,U=1,xt=0;for(this[g+B]=f&255;--B>=0&&(U*=256);)f<0&&xt===0&&this[g+B+1]!==0&&(xt=1),this[g+B]=(f/U>>0)-xt&255;return g+S},h.prototype.writeInt8=function(f,g,S){return f=+f,g=g>>>0,S||it(this,f,g,1,127,-128),f<0&&(f=255+f+1),this[g]=f&255,g+1},h.prototype.writeInt16LE=function(f,g,S){return f=+f,g=g>>>0,S||it(this,f,g,2,32767,-32768),this[g]=f&255,this[g+1]=f>>>8,g+2},h.prototype.writeInt16BE=function(f,g,S){return f=+f,g=g>>>0,S||it(this,f,g,2,32767,-32768),this[g]=f>>>8,this[g+1]=f&255,g+2},h.prototype.writeInt32LE=function(f,g,S){return f=+f,g=g>>>0,S||it(this,f,g,4,2147483647,-2147483648),this[g]=f&255,this[g+1]=f>>>8,this[g+2]=f>>>16,this[g+3]=f>>>24,g+4},h.prototype.writeInt32BE=function(f,g,S){return f=+f,g=g>>>0,S||it(this,f,g,4,2147483647,-2147483648),f<0&&(f=4294967295+f+1),this[g]=f>>>24,this[g+1]=f>>>16,this[g+2]=f>>>8,this[g+3]=f&255,g+4},h.prototype.writeBigInt64LE=ce(function(f,g=0){return dt(this,f,g,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),h.prototype.writeBigInt64BE=ce(function(f,g=0){return J(this,f,g,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function vt(y,f,g,S,L,B){if(g+S>y.length)throw new RangeError("Index out of range");if(g<0)throw new RangeError("Index out of range")}function Y(y,f,g,S,L){return f=+f,g=g>>>0,L||vt(y,f,g,4),e.write(y,f,g,S,23,4),g+4}h.prototype.writeFloatLE=function(f,g,S){return Y(this,f,g,!0,S)},h.prototype.writeFloatBE=function(f,g,S){return Y(this,f,g,!1,S)};function tt(y,f,g,S,L){return f=+f,g=g>>>0,L||vt(y,f,g,8),e.write(y,f,g,S,52,8),g+8}h.prototype.writeDoubleLE=function(f,g,S){return tt(this,f,g,!0,S)},h.prototype.writeDoubleBE=function(f,g,S){return tt(this,f,g,!1,S)},h.prototype.copy=function(f,g,S,L){if(!h.isBuffer(f))throw new TypeError("argument should be a Buffer");if(S||(S=0),!L&&L!==0&&(L=this.length),g>=f.length&&(g=f.length),g||(g=0),L>0&&L<S&&(L=S),L===S||f.length===0||this.length===0)return 0;if(g<0)throw new RangeError("targetStart out of bounds");if(S<0||S>=this.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("sourceEnd out of bounds");L>this.length&&(L=this.length),f.length-g<L-S&&(L=f.length-g+S);const B=L-S;return this===f&&typeof r.prototype.copyWithin=="function"?this.copyWithin(g,S,L):r.prototype.set.call(f,this.subarray(S,L),g),B},h.prototype.fill=function(f,g,S,L){if(typeof f=="string"){if(typeof g=="string"?(L=g,g=0,S=this.length):typeof S=="string"&&(L=S,S=this.length),L!==void 0&&typeof L!="string")throw new TypeError("encoding must be a string");if(typeof L=="string"&&!h.isEncoding(L))throw new TypeError("Unknown encoding: "+L);if(f.length===1){const U=f.charCodeAt(0);(L==="utf8"&&U<128||L==="latin1")&&(f=U)}}else typeof f=="number"?f=f&255:typeof f=="boolean"&&(f=Number(f));if(g<0||this.length<g||this.length<S)throw new RangeError("Out of range index");if(S<=g)return this;g=g>>>0,S=S===void 0?this.length:S>>>0,f||(f=0);let B;if(typeof f=="number")for(B=g;B<S;++B)this[B]=f;else{const U=h.isBuffer(f)?f:h.from(f,L),xt=U.length;if(xt===0)throw new TypeError('The value "'+f+'" is invalid for argument "value"');for(B=0;B<S-g;++B)this[B+g]=U[B%xt]}return this};const ut={};function gt(y,f,g){ut[y]=class extends g{constructor(){super(),Object.defineProperty(this,"message",{value:f.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${y}]`,this.stack,delete this.name}get code(){return y}set code(L){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:L,writable:!0})}toString(){return`${this.name} [${y}]: ${this.message}`}}}gt("ERR_BUFFER_OUT_OF_BOUNDS",function(y){return y?`${y} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),gt("ERR_INVALID_ARG_TYPE",function(y,f){return`The "${y}" argument must be of type number. Received type ${typeof f}`},TypeError),gt("ERR_OUT_OF_RANGE",function(y,f,g){let S=`The value of "${y}" is out of range.`,L=g;return Number.isInteger(g)&&Math.abs(g)>2**32?L=at(String(g)):typeof g=="bigint"&&(L=String(g),(g>BigInt(2)**BigInt(32)||g<-(BigInt(2)**BigInt(32)))&&(L=at(L)),L+="n"),S+=` It must be ${f}. Received ${L}`,S},RangeError);function at(y){let f="",g=y.length;const S=y[0]==="-"?1:0;for(;g>=S+4;g-=3)f=`_${y.slice(g-3,g)}${f}`;return`${y.slice(0,g)}${f}`}function St(y,f,g){K(f,"offset"),(y[f]===void 0||y[f+g]===void 0)&&bt(f,y.length-(g+1))}function At(y,f,g,S,L,B){if(y>g||y<f){const U=typeof f=="bigint"?"n":"";let xt;throw f===0||f===BigInt(0)?xt=`>= 0${U} and < 2${U} ** ${(B+1)*8}${U}`:xt=`>= -(2${U} ** ${(B+1)*8-1}${U}) and < 2 ** ${(B+1)*8-1}${U}`,new ut.ERR_OUT_OF_RANGE("value",xt,y)}St(S,L,B)}function K(y,f){if(typeof y!="number")throw new ut.ERR_INVALID_ARG_TYPE(f,"number",y)}function bt(y,f,g){throw Math.floor(y)!==y?(K(y,g),new ut.ERR_OUT_OF_RANGE("offset","an integer",y)):f<0?new ut.ERR_BUFFER_OUT_OF_BOUNDS:new ut.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${f}`,y)}const Pt=/[^+/0-9A-Za-z-_]/g;function jt(y){if(y=y.split("=")[0],y=y.trim().replace(Pt,""),y.length<2)return"";for(;y.length%4!==0;)y=y+"=";return y}function Kt(y,f){f=f||1/0;let g;const S=y.length;let L=null;const B=[];for(let U=0;U<S;++U){if(g=y.charCodeAt(U),g>55295&&g<57344){if(!L){if(g>56319){(f-=3)>-1&&B.push(239,191,189);continue}else if(U+1===S){(f-=3)>-1&&B.push(239,191,189);continue}L=g;continue}if(g<56320){(f-=3)>-1&&B.push(239,191,189),L=g;continue}g=(L-55296<<10|g-56320)+65536}else L&&(f-=3)>-1&&B.push(239,191,189);if(L=null,g<128){if((f-=1)<0)break;B.push(g)}else if(g<2048){if((f-=2)<0)break;B.push(g>>6|192,g&63|128)}else if(g<65536){if((f-=3)<0)break;B.push(g>>12|224,g>>6&63|128,g&63|128)}else if(g<1114112){if((f-=4)<0)break;B.push(g>>18|240,g>>12&63|128,g>>6&63|128,g&63|128)}else throw new Error("Invalid code point")}return B}function Vt(y){const f=[];for(let g=0;g<y.length;++g)f.push(y.charCodeAt(g)&255);return f}function kt(y,f){let g,S,L;const B=[];for(let U=0;U<y.length&&!((f-=2)<0);++U)g=y.charCodeAt(U),S=g>>8,L=g%256,B.push(L),B.push(S);return B}function Lt(y){return t.toByteArray(jt(y))}function Wt(y,f,g,S){let L;for(L=0;L<S&&!(L+g>=f.length||L>=y.length);++L)f[L+g]=y[L];return L}function lt(y,f){return y instanceof f||y!=null&&y.constructor!=null&&y.constructor.name!=null&&y.constructor.name===f.name}function Re(y){return y!==y}const ke=function(){const y="0123456789abcdef",f=new Array(256);for(let g=0;g<16;++g){const S=g*16;for(let L=0;L<16;++L)f[S+L]=y[g]+y[L]}return f}();function ce(y){return typeof BigInt>"u"?nn:y}function nn(){throw new Error("BigInt not supported")}})(le);const iu=le.Buffer,JR=le.Blob,QR=le.BlobOptions,tk=le.Buffer,ek=le.File,nk=le.FileOptions,ik=le.INSPECT_MAX_BYTES,sk=le.SlowBuffer,rk=le.TranscodeEncoding,ok=le.atob,ak=le.btoa,lk=le.constants,ck=le.isAscii,hk=le.isUtf8,dk=le.kMaxLength,uk=le.kStringMaxLength,fk=le.resolveObjectURL,pk=le.transcode,gk=Object.freeze(Object.defineProperty({__proto__:null,Blob:JR,BlobOptions:QR,Buffer:tk,File:ek,FileOptions:nk,INSPECT_MAX_BYTES:ik,SlowBuffer:sk,TranscodeEncoding:rk,atob:ok,btoa:ak,constants:lk,default:iu,isAscii:ck,isUtf8:hk,kMaxLength:dk,kStringMaxLength:uk,resolveObjectURL:fk,transcode:pk},Symbol.toStringTag,{value:"Module"}));var ml={};ml.d=(i,t)=>{for(var e in t)ml.o(t,e)&&!ml.o(i,e)&&Object.defineProperty(i,e,{enumerable:!0,get:t[e]})};ml.o=(i,t)=>Object.prototype.hasOwnProperty.call(i,t);var ot=globalThis.pdfjsLib={};ml.d(ot,{AbortException:()=>ro,AnnotationEditorLayer:()=>Mm,AnnotationEditorParamsType:()=>ct,AnnotationEditorType:()=>_t,AnnotationEditorUIManager:()=>Jr,AnnotationLayer:()=>f2,AnnotationMode:()=>Yi,CMapCompressionType:()=>Sg,ColorPicker:()=>Hw,DOMSVGFactory:()=>f0,DrawLayer:()=>Bm,FeatureTest:()=>ze,GlobalWorkerOptions:()=>ji,ImageKind:()=>_d,InvalidPDFException:()=>_y,MissingPDFException:()=>so,OPS:()=>fn,Outliner:()=>mm,PDFDataRangeTransport:()=>mw,PDFDateString:()=>Ly,PDFWorker:()=>xo,PasswordResponses:()=>yk,PermissionFlag:()=>bk,PixelsPerInch:()=>Es,RenderingCancelledException:()=>p0,TextLayer:()=>au,UnexpectedResponseException:()=>dp,Util:()=>et,VerbosityLevel:()=>lp,XfaLayer:()=>bw,build:()=>qL,createValidAbsoluteUrl:()=>Ek,fetchData:()=>vp,getDocument:()=>$L,getFilenameFromUrl:()=>Dk,getPdfFilenameFromUrl:()=>Fk,getXfaPageViewport:()=>Mk,isDataScheme:()=>g0,isPdfFile:()=>m0,noContextMenu:()=>Ge,normalizeUnicode:()=>Rk,renderTextLayer:()=>RL,setLayerDimensions:()=>Zr,shadow:()=>Tt,updateTextLayer:()=>kL,version:()=>WL});const Pe=typeof ht=="object"&&ht+""=="[object process]"&&!ht.versions.nw&&!(ht.versions.electron&&ht.type&&ht.type!=="browser"),Ey=[1,0,0,1,0,0],_g=[.001,0,0,.001,0,0],mk=1e7,Zp=1.35,hn={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},Yi={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},vk="pdfjs_internal_editor_",_t={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},ct={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_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},bk={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Ee={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},_d={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},ne={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},Ka={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},lp={ERRORS:0,WARNINGS:1,INFOS:5},Sg={NONE:0,BINARY:1},fn={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},yk={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let cp=lp.WARNINGS;function wk(i){Number.isInteger(i)&&(cp=i)}function Ak(){return cp}function hp(i){cp>=lp.INFOS&&console.log(`Info: ${i}`)}function yt(i){cp>=lp.WARNINGS&&console.log(`Warning: ${i}`)}function Mt(i){throw new Error(i)}function ae(i,t){i||Mt(t)}function xk(i){switch(i==null?void 0:i.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Ek(i,t=null,e=null){if(!i)return null;try{if(e&&typeof i=="string"){if(e.addDefaultProtocol&&i.startsWith("www.")){const s=i.match(/\./g);(s==null?void 0:s.length)>=2&&(i=`http://${i}`)}if(e.tryConvertEncoding)try{i=Pk(i)}catch{}}const n=t?new URL(i,t):new URL(i);if(xk(n))return n}catch{}return null}function Tt(i,t,e,n=!1){return Object.defineProperty(i,t,{value:e,enumerable:!n,configurable:!0,writable:!1}),e}const Cs=function(){function t(e,n){this.constructor===t&&Mt("Cannot initialize BaseException."),this.message=e,this.name=n}return t.prototype=new Error,t.constructor=t,t}();class Cg extends Cs{constructor(t,e){super(t,"PasswordException"),this.code=e}}class Tg extends Cs{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class _y extends Cs{constructor(t){super(t,"InvalidPDFException")}}class so extends Cs{constructor(t){super(t,"MissingPDFException")}}class dp extends Cs{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class _k extends Cs{constructor(t){super(t,"FormatError")}}class ro extends Cs{constructor(t){super(t,"AbortException")}}function Sy(i){(typeof i!="object"||(i==null?void 0:i.length)===void 0)&&Mt("Invalid argument for bytesToString");const t=i.length,e=8192;if(t<e)return String.fromCharCode.apply(null,i);const n=[];for(let s=0;s<t;s+=e){const r=Math.min(s+e,t),o=i.subarray(s,r);n.push(String.fromCharCode.apply(null,o))}return n.join("")}function up(i){typeof i!="string"&&Mt("Invalid argument for stringToBytes");const t=i.length,e=new Uint8Array(t);for(let n=0;n<t;++n)e[n]=i.charCodeAt(n)&255;return e}function Sk(i){return String.fromCharCode(i>>24&255,i>>16&255,i>>8&255,i&255)}function d0(i){const t=Object.create(null);for(const[e,n]of i)t[e]=n;return t}function Ck(){const i=new Uint8Array(4);return i[0]=1,new Uint32Array(i.buffer,0,1)[0]===1}function Tk(){try{return new Function(""),!0}catch{return!1}}class ze{static get isLittleEndian(){return Tt(this,"isLittleEndian",Ck())}static get isEvalSupported(){return Tt(this,"isEvalSupported",Tk())}static get isOffscreenCanvasSupported(){return Tt(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?Tt(this,"platform",{isMac:navigator.platform.includes("Mac")}):Tt(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){var t,e;return Tt(this,"isCSSRoundSupported",(e=(t=globalThis.CSS)==null?void 0:t.supports)==null?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const Jp=Array.from(Array(256).keys(),i=>i.toString(16).padStart(2,"0"));var So,Sd,xl,Pg;class et{static makeHexColor(t,e,n){return`#${Jp[t]}${Jp[e]}${Jp[n]}`}static scaleMinMax(t,e){let n;t[0]?(t[0]<0&&(n=e[0],e[0]=e[2],e[2]=n),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(n=e[1],e[1]=e[3],e[3]=n),e[1]*=t[3],e[3]*=t[3]):(n=e[0],e[0]=e[1],e[1]=n,n=e[2],e[2]=e[3],e[3]=n,t[1]<0&&(n=e[1],e[1]=e[3],e[3]=n),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(n=e[0],e[0]=e[2],e[2]=n),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 applyTransform(t,e){const n=t[0]*e[0]+t[1]*e[2]+e[4],s=t[0]*e[1]+t[1]*e[3]+e[5];return[n,s]}static applyInverseTransform(t,e){const n=e[0]*e[3]-e[1]*e[2],s=(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/n,r=(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/n;return[s,r]}static getAxialAlignedBoundingBox(t,e){const n=this.applyTransform(t,e),s=this.applyTransform(t.slice(2,4),e),r=this.applyTransform([t[0],t[3]],e),o=this.applyTransform([t[2],t[1]],e);return[Math.min(n[0],s[0],r[0],o[0]),Math.min(n[1],s[1],r[1],o[1]),Math.max(n[0],s[0],r[0],o[0]),Math.max(n[1],s[1],r[1],o[1])]}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){const e=[t[0],t[2],t[1],t[3]],n=t[0]*e[0]+t[1]*e[2],s=t[0]*e[1]+t[1]*e[3],r=t[2]*e[0]+t[3]*e[2],o=t[2]*e[1]+t[3]*e[3],a=(n+o)/2,c=Math.sqrt((n+o)**2-4*(n*o-r*s))/2,d=a+c||1,h=a-c||1;return[Math.sqrt(d),Math.sqrt(h)]}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 n=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),s=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(n>s)return null;const r=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),o=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return r>o?null:[n,r,s,o]}static bezierBoundingBox(t,e,n,s,r,o,a,c,d){return d?(d[0]=Math.min(d[0],t,a),d[1]=Math.min(d[1],e,c),d[2]=Math.max(d[2],t,a),d[3]=Math.max(d[3],e,c)):d=[Math.min(t,a),Math.min(e,c),Math.max(t,a),Math.max(e,c)],A(this,xl,Pg).call(this,t,n,r,a,e,s,o,c,3*(-t+3*(n-r)+a),6*(t-2*n+r),3*(n-t),d),A(this,xl,Pg).call(this,t,n,r,a,e,s,o,c,3*(-e+3*(s-o)+c),6*(e-2*s+o),3*(s-e),d),d}}So=new WeakSet,Sd=function(t,e,n,s,r,o,a,c,d,h){if(d<=0||d>=1)return;const u=1-d,p=d*d,v=p*d,b=u*(u*(u*t+3*d*e)+3*p*n)+v*s,x=u*(u*(u*r+3*d*o)+3*p*a)+v*c;h[0]=Math.min(h[0],b),h[1]=Math.min(h[1],x),h[2]=Math.max(h[2],b),h[3]=Math.max(h[3],x)},xl=new WeakSet,Pg=function(t,e,n,s,r,o,a,c,d,h,u,p){if(Math.abs(d)<1e-12){Math.abs(h)>=1e-12&&A(this,So,Sd).call(this,t,e,n,s,r,o,a,c,-u/h,p);return}const v=h**2-4*u*d;if(v<0)return;const b=Math.sqrt(v),x=2*d;A(this,So,Sd).call(this,t,e,n,s,r,o,a,c,(-h+b)/x,p),A(this,So,Sd).call(this,t,e,n,s,r,o,a,c,(-h-b)/x,p)},m(et,So),m(et,xl);function Pk(i){return decodeURIComponent(escape(i))}let Qp=null,yv=null;function Rk(i){return Qp||(Qp=/([\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,yv=new Map([["ſt","ſt"]])),i.replaceAll(Qp,(t,e,n)=>e?e.normalize("NFKC"):yv.get(n))}function kk(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const i=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(i);else for(let t=0;t<32;t++)i[t]=Math.floor(Math.random()*255);return Sy(i)}const Cy="pdfjs_internal_id_",ii={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8};class fp{constructor(){this.constructor===fp&&Mt("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,n,s,r){return"none"}destroy(t=!1){}}class pp{constructor(){this.constructor===pp&&Mt("Cannot initialize BaseCanvasFactory.")}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const n=this._createCanvas(t,e);return{canvas:n,context:n.getContext("2d")}}reset(t,e,n){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||n<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=n}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){Mt("Abstract method `_createCanvas` called.")}}class gp{constructor({baseUrl:t=null,isCompressed:e=!0}){this.constructor===gp&&Mt("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, 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":""),n=this.isCompressed?Sg.BINARY:Sg.NONE;return this._fetchData(e,n).catch(s=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}_fetchData(t,e){Mt("Abstract method `_fetchData` called.")}}class mp{constructor({baseUrl:t=null}){this.constructor===mp&&Mt("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, 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._fetchData(e).catch(n=>{throw new Error(`Unable to load font data at: ${e}`)})}_fetchData(t){Mt("Abstract method `_fetchData` called.")}}class u0{constructor(){this.constructor===u0&&Mt("Cannot initialize BaseSVGFactory.")}create(t,e,n=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),n||(s.setAttribute("width",`${t}px`),s.setAttribute("height",`${e}px`)),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${t} ${e}`),s}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){Mt("Abstract method `_createSVG` called.")}}const ri="http://www.w3.org/2000/svg",Ms=class Ms{};ft(Ms,"CSS",96),ft(Ms,"PDF",72),ft(Ms,"PDF_TO_CSS_UNITS",Ms.CSS/Ms.PDF);let Es=Ms;var Bs,In,hi,$e,fu,js,de,_e,Zi,ho,Ji,uo,Co,Cd,pu,Ty,El,Rg,Qi,fo,Us,tl,Hs,el,_l,kg,zs,nl;class Lk extends fp{constructor({docId:e,ownerDocument:n=globalThis.document}={}){super();m(this,de);m(this,Zi);m(this,Ji);m(this,Co);m(this,pu);m(this,El);m(this,Qi);m(this,Us);m(this,Hs);m(this,_l);m(this,zs);m(this,Bs,void 0);m(this,In,void 0);m(this,hi,void 0);m(this,$e,void 0);m(this,fu,void 0);m(this,js,0);w(this,hi,e),w(this,$e,n)}addFilter(e){if(!e)return"none";let n=l(this,de,_e).get(e);if(n)return n;const[s,r,o]=A(this,Co,Cd).call(this,e),a=e.length===1?s:`${s}${r}${o}`;if(n=l(this,de,_e).get(a),n)return l(this,de,_e).set(e,n),n;const c=`g_${l(this,hi)}_transfer_map_${Ve(this,js)._++}`,d=`url(#${c})`;l(this,de,_e).set(e,d),l(this,de,_e).set(a,d);const h=A(this,Qi,fo).call(this,c);return A(this,Hs,el).call(this,s,r,o,h),d}addHCMFilter(e,n){var b;const s=`${e}-${n}`,r="base";let o=l(this,Zi,ho).get(r);if((o==null?void 0:o.key)===s||(o?((b=o.filter)==null||b.remove(),o.key=s,o.url="none",o.filter=null):(o={key:s,url:"none",filter:null},l(this,Zi,ho).set(r,o)),!e||!n))return o.url;const a=A(this,zs,nl).call(this,e);e=et.makeHexColor(...a);const c=A(this,zs,nl).call(this,n);if(n=et.makeHexColor(...c),l(this,Ji,uo).style.color="",e==="#000000"&&n==="#ffffff"||e===n)return o.url;const d=new Array(256);for(let x=0;x<=255;x++){const _=x/255;d[x]=_<=.03928?_/12.92:((_+.055)/1.055)**2.4}const h=d.join(","),u=`g_${l(this,hi)}_hcm_filter`,p=o.filter=A(this,Qi,fo).call(this,u);A(this,Hs,el).call(this,h,h,h,p),A(this,El,Rg).call(this,p);const v=(x,_)=>{const E=a[x]/255,R=c[x]/255,k=new Array(_+1);for(let D=0;D<=_;D++)k[D]=E+D/_*(R-E);return k.join(",")};return A(this,Hs,el).call(this,v(0,5),v(1,5),v(2,5),p),o.url=`url(#${u})`,o.url}addAlphaFilter(e){let n=l(this,de,_e).get(e);if(n)return n;const[s]=A(this,Co,Cd).call(this,[e]),r=`alpha_${s}`;if(n=l(this,de,_e).get(r),n)return l(this,de,_e).set(e,n),n;const o=`g_${l(this,hi)}_alpha_map_${Ve(this,js)._++}`,a=`url(#${o})`;l(this,de,_e).set(e,a),l(this,de,_e).set(r,a);const c=A(this,Qi,fo).call(this,o);return A(this,_l,kg).call(this,s,c),a}addLuminosityFilter(e){let n=l(this,de,_e).get(e||"luminosity");if(n)return n;let s,r;if(e?([s]=A(this,Co,Cd).call(this,[e]),r=`luminosity_${s}`):r="luminosity",n=l(this,de,_e).get(r),n)return l(this,de,_e).set(e,n),n;const o=`g_${l(this,hi)}_luminosity_map_${Ve(this,js)._++}`,a=`url(#${o})`;l(this,de,_e).set(e,a),l(this,de,_e).set(r,a);const c=A(this,Qi,fo).call(this,o);return A(this,pu,Ty).call(this,c),e&&A(this,_l,kg).call(this,s,c),a}addHighlightHCMFilter(e,n,s,r,o){var R;const a=`${n}-${s}-${r}-${o}`;let c=l(this,Zi,ho).get(e);if((c==null?void 0:c.key)===a||(c?((R=c.filter)==null||R.remove(),c.key=a,c.url="none",c.filter=null):(c={key:a,url:"none",filter:null},l(this,Zi,ho).set(e,c)),!n||!s))return c.url;const[d,h]=[n,s].map(A(this,zs,nl).bind(this));let u=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),p=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[v,b]=[r,o].map(A(this,zs,nl).bind(this));p<u&&([u,p,v,b]=[p,u,b,v]),l(this,Ji,uo).style.color="";const x=(k,D,F)=>{const M=new Array(256),O=(p-u)/F,C=k/255,P=(D-k)/(255*F);let $=0;for(let N=0;N<=F;N++){const H=Math.round(u+N*O),z=C+N*P;for(let V=$;V<=H;V++)M[V]=z;$=H+1}for(let N=$;N<256;N++)M[N]=M[$-1];return M.join(",")},_=`g_${l(this,hi)}_hcm_${e}_filter`,E=c.filter=A(this,Qi,fo).call(this,_);return A(this,El,Rg).call(this,E),A(this,Hs,el).call(this,x(v[0],b[0],5),x(v[1],b[1],5),x(v[2],b[2],5),E),c.url=`url(#${_})`,c.url}destroy(e=!1){e&&l(this,Zi,ho).size!==0||(l(this,In)&&(l(this,In).parentNode.parentNode.remove(),w(this,In,null)),l(this,Bs)&&(l(this,Bs).clear(),w(this,Bs,null)),w(this,js,0))}}Bs=new WeakMap,In=new WeakMap,hi=new WeakMap,$e=new WeakMap,fu=new WeakMap,js=new WeakMap,de=new WeakSet,_e=function(){return l(this,Bs)||w(this,Bs,new Map)},Zi=new WeakSet,ho=function(){return l(this,fu)||w(this,fu,new Map)},Ji=new WeakSet,uo=function(){if(!l(this,In)){const e=l(this,$e).createElement("div"),{style:n}=e;n.visibility="hidden",n.contain="strict",n.width=n.height=0,n.position="absolute",n.top=n.left=0,n.zIndex=-1;const s=l(this,$e).createElementNS(ri,"svg");s.setAttribute("width",0),s.setAttribute("height",0),w(this,In,l(this,$e).createElementNS(ri,"defs")),e.append(s),s.append(l(this,In)),l(this,$e).body.append(e)}return l(this,In)},Co=new WeakSet,Cd=function(e){if(e.length===1){const d=e[0],h=new Array(256);for(let p=0;p<256;p++)h[p]=d[p]/255;const u=h.join(",");return[u,u,u]}const[n,s,r]=e,o=new Array(256),a=new Array(256),c=new Array(256);for(let d=0;d<256;d++)o[d]=n[d]/255,a[d]=s[d]/255,c[d]=r[d]/255;return[o.join(","),a.join(","),c.join(",")]},pu=new WeakSet,Ty=function(e){const n=l(this,$e).createElementNS(ri,"feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(n)},El=new WeakSet,Rg=function(e){const n=l(this,$e).createElementNS(ri,"feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(n)},Qi=new WeakSet,fo=function(e){const n=l(this,$e).createElementNS(ri,"filter");return n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("id",e),l(this,Ji,uo).append(n),n},Us=new WeakSet,tl=function(e,n,s){const r=l(this,$e).createElementNS(ri,n);r.setAttribute("type","discrete"),r.setAttribute("tableValues",s),e.append(r)},Hs=new WeakSet,el=function(e,n,s,r){const o=l(this,$e).createElementNS(ri,"feComponentTransfer");r.append(o),A(this,Us,tl).call(this,o,"feFuncR",e),A(this,Us,tl).call(this,o,"feFuncG",n),A(this,Us,tl).call(this,o,"feFuncB",s)},_l=new WeakSet,kg=function(e,n){const s=l(this,$e).createElementNS(ri,"feComponentTransfer");n.append(s),A(this,Us,tl).call(this,s,"feFuncA",e)},zs=new WeakSet,nl=function(e){return l(this,Ji,uo).style.color=e,v0(getComputedStyle(l(this,Ji,uo)).getPropertyValue("color"))};class Ik extends pp{constructor({ownerDocument:t=globalThis.document}={}){super(),this._document=t}_createCanvas(t,e){const n=this._document.createElement("canvas");return n.width=t,n.height=e,n}}async function vp(i,t="text"){if(il(i,document.baseURI)){const e=await fetch(i);if(!e.ok)throw new Error(e.statusText);switch(t){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json()}return e.text()}return new Promise((e,n)=>{const s=new XMLHttpRequest;s.open("GET",i,!0),s.responseType=t,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(s.status===200||s.status===0){switch(t){case"arraybuffer":case"blob":case"json":e(s.response);return}e(s.responseText);return}n(new Error(s.statusText))}},s.send(null)})}class Py extends gp{_fetchData(t,e){return vp(t,this.isCompressed?"arraybuffer":"text").then(n=>({cMapData:n instanceof ArrayBuffer?new Uint8Array(n):up(n),compressionType:e}))}}class Ry extends mp{_fetchData(t){return vp(t,"arraybuffer").then(e=>new Uint8Array(e))}}class f0 extends u0{_createSVG(t){return document.createElementNS(ri,t)}}class Xh{constructor({viewBox:t,scale:e,rotation:n,offsetX:s=0,offsetY:r=0,dontFlip:o=!1}){this.viewBox=t,this.scale=e,this.rotation=n,this.offsetX=s,this.offsetY=r;const a=(t[2]+t[0])/2,c=(t[3]+t[1])/2;let d,h,u,p;switch(n%=360,n<0&&(n+=360),n){case 180:d=-1,h=0,u=0,p=1;break;case 90:d=0,h=1,u=1,p=0;break;case 270:d=0,h=-1,u=-1,p=0;break;case 0:d=1,h=0,u=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(u=-u,p=-p);let v,b,x,_;d===0?(v=Math.abs(c-t[1])*e+s,b=Math.abs(a-t[0])*e+r,x=(t[3]-t[1])*e,_=(t[2]-t[0])*e):(v=Math.abs(a-t[0])*e+s,b=Math.abs(c-t[1])*e+r,x=(t[2]-t[0])*e,_=(t[3]-t[1])*e),this.transform=[d*e,h*e,u*e,p*e,v-d*e*a-u*e*c,b-h*e*a-p*e*c],this.width=x,this.height=_}get rawDims(){const{viewBox:t}=this;return Tt(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:n=this.offsetX,offsetY:s=this.offsetY,dontFlip:r=!1}={}){return new Xh({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:n,offsetY:s,dontFlip:r})}convertToViewportPoint(t,e){return et.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=et.applyTransform([t[0],t[1]],this.transform),n=et.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],n[0],n[1]]}convertToPdfPoint(t,e){return et.applyInverseTransform([t,e],this.transform)}}class p0 extends Cs{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function g0(i){const t=i.length;let e=0;for(;e<t&&i[e].trim()==="";)e++;return i.substring(e,e+5).toLowerCase()==="data:"}function m0(i){return typeof i=="string"&&/\.pdf$/i.test(i)}function Dk(i){return[i]=i.split(/[#?]/,1),i.substring(i.lastIndexOf("/")+1)}function Fk(i,t="document.pdf"){if(typeof i!="string")return t;if(g0(i))return yt('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const e=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,n=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,s=e.exec(i);let r=n.exec(s[1])||n.exec(s[2])||n.exec(s[3]);if(r&&(r=r[0],r.includes("%")))try{r=n.exec(decodeURIComponent(r))[0]}catch{}return r||t}class wv{constructor(){ft(this,"started",Object.create(null));ft(this,"times",[])}time(t){t in this.started&&yt(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||yt(`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:n}of this.times)e=Math.max(n.length,e);for(const{name:n,start:s,end:r}of this.times)t.push(`${n.padEnd(e)} ${r-s}ms
265
- `);return t.join("")}}function il(i,t){try{const{protocol:e}=t?new URL(i,t):new URL(i);return e==="http:"||e==="https:"}catch{return!1}}function Ge(i){i.preventDefault()}function ky(i){console.log("Deprecated API usage: "+i)}let Av;class Ly{static toDateObject(t){if(!t||typeof t!="string")return null;Av||(Av=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=Av.exec(t);if(!e)return null;const n=parseInt(e[1],10);let s=parseInt(e[2],10);s=s>=1&&s<=12?s-1:0;let r=parseInt(e[3],10);r=r>=1&&r<=31?r:1;let o=parseInt(e[4],10);o=o>=0&&o<=23?o:0;let a=parseInt(e[5],10);a=a>=0&&a<=59?a:0;let c=parseInt(e[6],10);c=c>=0&&c<=59?c:0;const d=e[7]||"Z";let h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let u=parseInt(e[9],10)||0;return u=u>=0&&u<=59?u:0,d==="-"?(o+=h,a+=u):d==="+"&&(o-=h,a-=u),new Date(Date.UTC(n,s,r,o,a,c))}}function Mk(i,{scale:t=1,rotation:e=0}){const{width:n,height:s}=i.attributes.style,r=[0,0,parseInt(n),parseInt(s)];return new Xh({viewBox:r,scale:t,rotation:e})}function v0(i){if(i.startsWith("#")){const t=parseInt(i.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return i.startsWith("rgb(")?i.slice(4,-1).split(",").map(t=>parseInt(t)):i.startsWith("rgba(")?i.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(yt(`Not a valid color format: "${i}"`),[0,0,0])}function Ok(i){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const e of i.keys()){t.style.color=e;const n=window.getComputedStyle(t).color;i.set(e,v0(n))}t.remove()}function Gt(i){const{a:t,b:e,c:n,d:s,e:r,f:o}=i.getTransform();return[t,e,n,s,r,o]}function si(i){const{a:t,b:e,c:n,d:s,e:r,f:o}=i.getTransform().invertSelf();return[t,e,n,s,r,o]}function Zr(i,t,e=!1,n=!0){if(t instanceof Xh){const{pageWidth:s,pageHeight:r}=t.rawDims,{style:o}=i,a=ze.isCSSRoundSupported,c=`var(--scale-factor) * ${s}px`,d=`var(--scale-factor) * ${r}px`,h=a?`round(${c}, 1px)`:`calc(${c})`,u=a?`round(${d}, 1px)`:`calc(${d})`;!e||t.rotation%180===0?(o.width=h,o.height=u):(o.width=u,o.height=h)}n&&i.setAttribute("data-main-rotation",t.rotation)}var Gs,Vs,Dn,Ws,gu,Iy,mu,Dy,vu,Fy,To,Td,bu,My,Sl,Ig;const yu=class yu{constructor(t){m(this,mu);m(this,vu);m(this,To);m(this,bu);m(this,Sl);m(this,Gs,null);m(this,Vs,null);m(this,Dn,void 0);m(this,Ws,null);w(this,Dn,t)}render(){const t=w(this,Gs,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",Ge),t.addEventListener("pointerdown",A(yu,gu,Iy));const e=w(this,Ws,document.createElement("div"));e.className="buttons",t.append(e);const n=l(this,Dn).toolbarPosition;if(n){const{style:s}=t,r=l(this,Dn)._uiManager.direction==="ltr"?1-n[0]:n[0];s.insetInlineEnd=`${100*r}%`,s.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return A(this,bu,My).call(this),t}hide(){var t;l(this,Gs).classList.add("hidden"),(t=l(this,Vs))==null||t.hideDropdown()}show(){l(this,Gs).classList.remove("hidden")}addAltTextButton(t){A(this,To,Td).call(this,t),l(this,Ws).prepend(t,l(this,Sl,Ig))}addColorPicker(t){w(this,Vs,t);const e=t.renderButton();A(this,To,Td).call(this,e),l(this,Ws).prepend(e,l(this,Sl,Ig))}remove(){var t;l(this,Gs).remove(),(t=l(this,Vs))==null||t.destroy(),w(this,Vs,null)}};Gs=new WeakMap,Vs=new WeakMap,Dn=new WeakMap,Ws=new WeakMap,gu=new WeakSet,Iy=function(t){t.stopPropagation()},mu=new WeakSet,Dy=function(t){l(this,Dn)._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()},vu=new WeakSet,Fy=function(t){l(this,Dn)._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()},To=new WeakSet,Td=function(t){t.addEventListener("focusin",A(this,mu,Dy).bind(this),{capture:!0}),t.addEventListener("focusout",A(this,vu,Fy).bind(this),{capture:!0}),t.addEventListener("contextmenu",Ge)},bu=new WeakSet,My=function(){const t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",`pdfjs-editor-remove-${l(this,Dn).editorType}-button`),A(this,To,Td).call(this,t),t.addEventListener("click",e=>{l(this,Dn)._uiManager.delete()}),l(this,Ws).append(t)},Sl=new WeakSet,Ig=function(){const t=document.createElement("div");return t.className="divider",t},m(yu,gu);let Lg=yu;var Cl,qs,Tl,wu,Oy,Au,Ny,xu,$y;class Nk{constructor(t){m(this,wu);m(this,Au);m(this,xu);m(this,Cl,null);m(this,qs,null);m(this,Tl,void 0);w(this,Tl,t)}show(t,e,n){const[s,r]=A(this,Au,Ny).call(this,e,n),{style:o}=l(this,qs)||w(this,qs,A(this,wu,Oy).call(this));t.append(l(this,qs)),o.insetInlineEnd=`${100*s}%`,o.top=`calc(${100*r}% + var(--editor-toolbar-vert-offset))`}hide(){l(this,qs).remove()}}Cl=new WeakMap,qs=new WeakMap,Tl=new WeakMap,wu=new WeakSet,Oy=function(){const t=w(this,qs,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",Ge);const e=w(this,Cl,document.createElement("div"));return e.className="buttons",t.append(e),A(this,xu,$y).call(this),t},Au=new WeakSet,Ny=function(t,e){let n=0,s=0;for(const r of t){const o=r.y+r.height;if(o<n)continue;const a=r.x+(e?r.width:0);if(o>n){s=a,n=o;continue}e?a>s&&(s=a):a<s&&(s=a)}return[e?1-s:s,n]},xu=new WeakSet,$y=function(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label"),t.addEventListener("contextmenu",Ge),t.addEventListener("click",()=>{l(this,Tl).highlightSelection("floating_button")}),l(this,Cl).append(t)};function su(i,t,e){for(const n of e)t.addEventListener(n,i[n].bind(i))}function $k(i){return Math.round(Math.min(255,Math.max(1,255*i))).toString(16).padStart(2,"0")}var Eu;class Bk{constructor(){m(this,Eu,0)}get id(){return`${vk}${Ve(this,Eu)._++}`}}Eu=new WeakMap;var Pl,_u,on,Rl,Fg;const T0=class T0{constructor(){m(this,Rl);m(this,Pl,kk());m(this,_u,0);m(this,on,null)}static get _isSVGFittingCanvas(){const t='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>',n=new OffscreenCanvas(1,3).getContext("2d"),s=new Image;s.src=t;const r=s.decode().then(()=>(n.drawImage(s,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return Tt(this,"_isSVGFittingCanvas",r)}async getFromFile(t){const{lastModified:e,name:n,size:s,type:r}=t;return A(this,Rl,Fg).call(this,`${e}_${n}_${s}_${r}`,t)}async getFromUrl(t){return A(this,Rl,Fg).call(this,t,t)}async getFromId(t){l(this,on)||w(this,on,new Map);const e=l(this,on).get(t);return e?e.bitmap?(e.refCounter+=1,e):e.file?this.getFromFile(e.file):this.getFromUrl(e.url):null}getSvgUrl(t){const e=l(this,on).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){l(this,on)||w(this,on,new Map);const e=l(this,on).get(t);e&&(e.refCounter-=1,e.refCounter===0&&(e.bitmap=null))}isValidId(t){return t.startsWith(`image_${l(this,Pl)}_`)}};Pl=new WeakMap,_u=new WeakMap,on=new WeakMap,Rl=new WeakSet,Fg=async function(t,e){l(this,on)||w(this,on,new Map);let n=l(this,on).get(t);if(n===null)return null;if(n!=null&&n.bitmap)return n.refCounter+=1,n;try{n||(n={bitmap:null,id:`image_${l(this,Pl)}_${Ve(this,_u)._++}`,refCounter:0,isSvg:!1});let s;if(typeof e=="string"?(n.url=e,s=await vp(e,"blob")):s=n.file=e,s.type==="image/svg+xml"){const r=T0._isSVGFittingCanvas,o=new FileReader,a=new Image,c=new Promise((d,h)=>{a.onload=()=>{n.bitmap=a,n.isSvg=!0,d()},o.onload=async()=>{const u=n.svgUrl=o.result;a.src=await r?`${u}#svgView(preserveAspectRatio(none))`:u},a.onerror=o.onerror=h});o.readAsDataURL(s),await c}else n.bitmap=await createImageBitmap(s);n.refCounter=1}catch(s){console.error(s),n=null}return l(this,on).set(t,n),n&&l(this,on).set(n.id,n),n};let Dg=T0;var ue,ts,kl,fe;class jk{constructor(t=128){m(this,ue,[]);m(this,ts,!1);m(this,kl,void 0);m(this,fe,-1);w(this,kl,t)}add({cmd:t,undo:e,post:n,mustExec:s,type:r=NaN,overwriteIfSameType:o=!1,keepUndo:a=!1}){if(s&&t(),l(this,ts))return;const c={cmd:t,undo:e,post:n,type:r};if(l(this,fe)===-1){l(this,ue).length>0&&(l(this,ue).length=0),w(this,fe,0),l(this,ue).push(c);return}if(o&&l(this,ue)[l(this,fe)].type===r){a&&(c.undo=l(this,ue)[l(this,fe)].undo),l(this,ue)[l(this,fe)]=c;return}const d=l(this,fe)+1;d===l(this,kl)?l(this,ue).splice(0,1):(w(this,fe,d),d<l(this,ue).length&&l(this,ue).splice(d)),l(this,ue).push(c)}undo(){if(l(this,fe)===-1)return;w(this,ts,!0);const{undo:t,post:e}=l(this,ue)[l(this,fe)];t(),e==null||e(),w(this,ts,!1),w(this,fe,l(this,fe)-1)}redo(){if(l(this,fe)<l(this,ue).length-1){w(this,fe,l(this,fe)+1),w(this,ts,!0);const{cmd:t,post:e}=l(this,ue)[l(this,fe)];t(),e==null||e(),w(this,ts,!1)}}hasSomethingToUndo(){return l(this,fe)!==-1}hasSomethingToRedo(){return l(this,fe)<l(this,ue).length-1}destroy(){w(this,ue,null)}}ue=new WeakMap,ts=new WeakMap,kl=new WeakMap,fe=new WeakMap;var Su,By;class Yh{constructor(t){m(this,Su);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=ze.platform;for(const[n,s,r={}]of t)for(const o of n){const a=o.startsWith("mac+");e&&a?(this.callbacks.set(o.slice(4),{callback:s,options:r}),this.allKeys.add(o.split("+").at(-1))):!e&&!a&&(this.callbacks.set(o,{callback:s,options:r}),this.allKeys.add(o.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const n=this.callbacks.get(A(this,Su,By).call(this,e));if(!n)return;const{callback:s,options:{bubbles:r=!1,args:o=[],checker:a=null}}=n;a&&!a(t,e)||(s.bind(t,...o,e)(),r||(e.stopPropagation(),e.preventDefault()))}}Su=new WeakSet,By=function(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};const Cu=class Cu{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return Ok(t),Tt(this,"_colors",t)}convert(t){const e=v0(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[n,s]of this._colors)if(s.every((r,o)=>r===e[o]))return Cu._colorsMapping.get(n);return e}getHexCode(t){const e=this._colors.get(t);return e?et.makeHexColor(...e):t}};ft(Cu,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let Mg=Cu;var Xe,ie,me,Po,di,Ro,pn,ko,Xs,Fn,ui,Ys,Ll,Il,Mn,Lo,es,On,Tu,ns,Dl,Ks,Fl,Io,ve,It,fi,Zs,Ml,Ol,Nl,$l,Bl,jl,Ul,Hl,zl,Gl,Vl,Wl,ql,Xl,is,Nn,pi,Yl,Do,Pd,Pu,jy,Ru,Uy,Fo,Rd,ku,Hy,Lu,zy,Iu,Gy,Kl,Og,Zl,Ng,Jl,$g,Ql,Bg,tc,jg,be,Le,$n,Wi,Du,Vy,Fu,Wy,ec,Ug,Mu,qy,Js,sl,nc,Hg;const yo=class yo{constructor(t,e,n,s,r,o,a,c,d){m(this,Do);m(this,Pu);m(this,Ru);m(this,Fo);m(this,ku);m(this,Lu);m(this,Iu);m(this,Kl);m(this,Zl);m(this,Jl);m(this,Ql);m(this,tc);m(this,be);m(this,$n);m(this,Du);m(this,Fu);m(this,ec);m(this,Mu);m(this,Js);m(this,nc);m(this,Xe,null);m(this,ie,new Map);m(this,me,new Map);m(this,Po,null);m(this,di,null);m(this,Ro,null);m(this,pn,new jk);m(this,ko,0);m(this,Xs,new Set);m(this,Fn,null);m(this,ui,null);m(this,Ys,new Set);m(this,Ll,!1);m(this,Il,null);m(this,Mn,null);m(this,Lo,null);m(this,es,!1);m(this,On,null);m(this,Tu,new Bk);m(this,ns,!1);m(this,Dl,!1);m(this,Ks,null);m(this,Fl,null);m(this,Io,null);m(this,ve,_t.NONE);m(this,It,new Set);m(this,fi,null);m(this,Zs,null);m(this,Ml,null);m(this,Ol,this.blur.bind(this));m(this,Nl,this.focus.bind(this));m(this,$l,this.copy.bind(this));m(this,Bl,this.cut.bind(this));m(this,jl,this.paste.bind(this));m(this,Ul,this.keydown.bind(this));m(this,Hl,this.keyup.bind(this));m(this,zl,this.onEditingAction.bind(this));m(this,Gl,this.onPageChanging.bind(this));m(this,Vl,this.onScaleChanging.bind(this));m(this,Wl,A(this,Ru,Uy).bind(this));m(this,ql,this.onRotationChanging.bind(this));m(this,Xl,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});m(this,is,[0,0]);m(this,Nn,null);m(this,pi,null);m(this,Yl,null);w(this,pi,t),w(this,Yl,e),w(this,Po,n),this._eventBus=s,this._eventBus._on("editingaction",l(this,zl)),this._eventBus._on("pagechanging",l(this,Gl)),this._eventBus._on("scalechanging",l(this,Vl)),this._eventBus._on("rotationchanging",l(this,ql)),A(this,ku,Hy).call(this),A(this,Zl,Ng).call(this),w(this,di,r.annotationStorage),w(this,Il,r.filterFactory),w(this,Zs,o),w(this,Lo,a||null),w(this,Ll,c),w(this,Io,d||null),this.viewParameters={realScale:Es.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const t=yo.prototype,e=o=>l(o,pi).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&o.hasSomethingToControl(),n=(o,{target:a})=>{if(a instanceof HTMLInputElement){const{type:c}=a;return c!=="text"&&c!=="number"}return!0},s=this.TRANSLATE_SMALL,r=this.TRANSLATE_BIG;return Tt(this,"_keyboardManager",new Yh([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],t.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:n}],[["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:n}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(o,{target:a})=>!(a instanceof HTMLButtonElement)&&l(o,pi).contains(a)&&!o.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(o,{target:a})=>!(a instanceof HTMLButtonElement)&&l(o,pi).contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-r,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[r,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-r],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,r],checker:e}]]))}destroy(){var t,e;A(this,Jl,$g).call(this),A(this,Kl,Og).call(this),this._eventBus._off("editingaction",l(this,zl)),this._eventBus._off("pagechanging",l(this,Gl)),this._eventBus._off("scalechanging",l(this,Vl)),this._eventBus._off("rotationchanging",l(this,ql));for(const n of l(this,me).values())n.destroy();l(this,me).clear(),l(this,ie).clear(),l(this,Ys).clear(),w(this,Xe,null),l(this,It).clear(),l(this,pn).destroy(),(t=l(this,Po))==null||t.destroy(),(e=l(this,On))==null||e.hide(),w(this,On,null),l(this,Mn)&&(clearTimeout(l(this,Mn)),w(this,Mn,null)),l(this,Nn)&&(clearTimeout(l(this,Nn)),w(this,Nn,null)),A(this,Lu,zy).call(this)}async mlGuess(t){var e;return((e=l(this,Io))==null?void 0:e.guess(t))||null}get hasMLManager(){return!!l(this,Io)}get hcmFilter(){return Tt(this,"hcmFilter",l(this,Zs)?l(this,Il).addHCMFilter(l(this,Zs).foreground,l(this,Zs).background):"none")}get direction(){return Tt(this,"direction",getComputedStyle(l(this,pi)).direction)}get highlightColors(){return Tt(this,"highlightColors",l(this,Lo)?new Map(l(this,Lo).split(",").map(t=>t.split("=").map(e=>e.trim()))):null)}get highlightColorNames(){return Tt(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){w(this,Fl,t)}editAltText(t){var e;(e=l(this,Po))==null||e.editAltText(this,t)}onPageChanging({pageNumber:t}){w(this,ko,t-1)}focusMainContainer(){l(this,pi).focus()}findParent(t,e){for(const n of l(this,me).values()){const{x:s,y:r,width:o,height:a}=n.div.getBoundingClientRect();if(t>=s&&t<=s+o&&e>=r&&e<=r+a)return n}return null}disableUserSelect(t=!1){l(this,Yl).classList.toggle("noUserSelect",t)}addShouldRescale(t){l(this,Ys).add(t)}removeShouldRescale(t){l(this,Ys).delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*Es.PDF_TO_CSS_UNITS;for(const e of l(this,Ys))e.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t=""){const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}=e,a=e.toString(),d=A(this,Do,Pd).call(this,e).closest(".textLayer"),h=this.getSelectionBoxes(d);if(h){e.empty(),l(this,ve)===_t.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:_t.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const u of l(this,me).values())if(u.hasTextLayer(d)){u.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o,text:a});break}}}addToAnnotationStorage(t){!t.isEmpty()&&l(this,di)&&!l(this,di).has(t.id)&&l(this,di).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,l(this,es)&&(w(this,es,!1),A(this,Fo,Rd).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of l(this,It))if(e.div.contains(t)){w(this,Ks,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!l(this,Ks))return;const[t,e]=l(this,Ks);w(this,Ks,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0}),e.focus()}addEditListeners(){A(this,Zl,Ng).call(this),A(this,Ql,Bg).call(this)}removeEditListeners(){A(this,Jl,$g).call(this),A(this,tc,jg).call(this)}copy(t){var n;if(t.preventDefault(),(n=l(this,Xe))==null||n.commitOrRemove(),!this.hasSelection)return;const e=[];for(const s of l(this,It)){const r=s.serialize(!0);r&&e.push(r)}e.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}paste(t){t.preventDefault();const{clipboardData:e}=t;for(const r of e.items)for(const o of l(this,ui))if(o.isHandlingMimeForPasting(r.type)){o.paste(r,this.currentLayer);return}let n=e.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(r){yt(`paste: "${r.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();const s=this.currentLayer;try{const r=[];for(const c of n){const d=s.deserialize(c);if(!d)return;r.push(d)}const o=()=>{for(const c of r)A(this,ec,Ug).call(this,c);A(this,nc,Hg).call(this,r)},a=()=>{for(const c of r)c.remove()};this.addCommands({cmd:o,undo:a,mustExec:!0})}catch(r){yt(`paste: "${r.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),l(this,ve)!==_t.NONE&&!this.isEditorHandlingKeyboard&&yo._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,l(this,es)&&(w(this,es,!1),A(this,Fo,Rd).call(this,"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}}setEditingState(t){t?(A(this,Iu,Gy).call(this),A(this,Ql,Bg).call(this),A(this,be,Le).call(this,{isEditing:l(this,ve)!==_t.NONE,isEmpty:A(this,Js,sl).call(this),hasSomethingToUndo:l(this,pn).hasSomethingToUndo(),hasSomethingToRedo:l(this,pn).hasSomethingToRedo(),hasSelectedEditor:!1})):(A(this,Kl,Og).call(this),A(this,tc,jg).call(this),A(this,be,Le).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!l(this,ui)){w(this,ui,t);for(const e of l(this,ui))A(this,$n,Wi).call(this,e.defaultPropertiesToUpdate)}}getId(){return l(this,Tu).id}get currentLayer(){return l(this,me).get(l(this,ko))}getLayer(t){return l(this,me).get(t)}get currentPageIndex(){return l(this,ko)}addLayer(t){l(this,me).set(t.pageIndex,t),l(this,ns)?t.enable():t.disable()}removeLayer(t){l(this,me).delete(t.pageIndex)}updateMode(t,e=null,n=!1){if(l(this,ve)!==t){if(w(this,ve,t),t===_t.NONE){this.setEditingState(!1),A(this,Fu,Wy).call(this);return}this.setEditingState(!0),A(this,Du,Vy).call(this),this.unselectAll();for(const s of l(this,me).values())s.updateMode(t);if(!e&&n){this.addNewEditorFromKeyboard();return}if(e){for(const s of l(this,ie).values())if(s.annotationElementId===e){this.setSelected(s),s.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==l(this,ve)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){var n;if(l(this,ui)){switch(t){case ct.CREATE:this.currentLayer.addNewEditor();return;case ct.HIGHLIGHT_DEFAULT_COLOR:(n=l(this,Fl))==null||n.updateColor(e);break;case ct.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(l(this,Ml)||w(this,Ml,new Map)).set(t,e),this.showAllEditors("highlight",e);break}for(const s of l(this,It))s.updateParams(t,e);for(const s of l(this,ui))s.updateDefaultParams(t,e)}}showAllEditors(t,e,n=!1){var r;for(const o of l(this,ie).values())o.editorType===t&&o.show(e);(((r=l(this,Ml))==null?void 0:r.get(ct.HIGHLIGHT_SHOW_ALL))??!0)!==e&&A(this,$n,Wi).call(this,[[ct.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(l(this,Dl)!==t){w(this,Dl,t);for(const e of l(this,me).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const n of l(this,ie).values())n.pageIndex===t&&e.push(n);return e}getEditor(t){return l(this,ie).get(t)}addEditor(t){l(this,ie).set(t.id,t)}removeEditor(t){var e;t.div.contains(document.activeElement)&&(l(this,Mn)&&clearTimeout(l(this,Mn)),w(this,Mn,setTimeout(()=>{this.focusMainContainer(),w(this,Mn,null)},0))),l(this,ie).delete(t.id),this.unselect(t),(!t.annotationElementId||!l(this,Xs).has(t.annotationElementId))&&((e=l(this,di))==null||e.remove(t.id))}addDeletedAnnotationElement(t){l(this,Xs).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return l(this,Xs).has(t)}removeDeletedAnnotationElement(t){l(this,Xs).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){l(this,Xe)!==t&&(w(this,Xe,t),t&&A(this,$n,Wi).call(this,t.propertiesToUpdate))}updateUI(t){l(this,Mu,qy)===t&&A(this,$n,Wi).call(this,t.propertiesToUpdate)}toggleSelected(t){if(l(this,It).has(t)){l(this,It).delete(t),t.unselect(),A(this,be,Le).call(this,{hasSelectedEditor:this.hasSelection});return}l(this,It).add(t),t.select(),A(this,$n,Wi).call(this,t.propertiesToUpdate),A(this,be,Le).call(this,{hasSelectedEditor:!0})}setSelected(t){for(const e of l(this,It))e!==t&&e.unselect();l(this,It).clear(),l(this,It).add(t),t.select(),A(this,$n,Wi).call(this,t.propertiesToUpdate),A(this,be,Le).call(this,{hasSelectedEditor:!0})}isSelected(t){return l(this,It).has(t)}get firstSelectedEditor(){return l(this,It).values().next().value}unselect(t){t.unselect(),l(this,It).delete(t),A(this,be,Le).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return l(this,It).size!==0}get isEnterHandled(){return l(this,It).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){l(this,pn).undo(),A(this,be,Le).call(this,{hasSomethingToUndo:l(this,pn).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:A(this,Js,sl).call(this)})}redo(){l(this,pn).redo(),A(this,be,Le).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:l(this,pn).hasSomethingToRedo(),isEmpty:A(this,Js,sl).call(this)})}addCommands(t){l(this,pn).add(t),A(this,be,Le).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:A(this,Js,sl).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...l(this,It)],e=()=>{for(const s of t)s.remove()},n=()=>{for(const s of t)A(this,ec,Ug).call(this,s)};this.addCommands({cmd:e,undo:n,mustExec:!0})}commitOrRemove(){var t;(t=l(this,Xe))==null||t.commitOrRemove()}hasSomethingToControl(){return l(this,Xe)||this.hasSelection}selectAll(){for(const t of l(this,It))t.commit();A(this,nc,Hg).call(this,l(this,ie).values())}unselectAll(){if(!(l(this,Xe)&&(l(this,Xe).commitOrRemove(),l(this,ve)!==_t.NONE))&&this.hasSelection){for(const t of l(this,It))t.unselect();l(this,It).clear(),A(this,be,Le).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;l(this,is)[0]+=t,l(this,is)[1]+=e;const[s,r]=l(this,is),o=[...l(this,It)],a=1e3;l(this,Nn)&&clearTimeout(l(this,Nn)),w(this,Nn,setTimeout(()=>{w(this,Nn,null),l(this,is)[0]=l(this,is)[1]=0,this.addCommands({cmd:()=>{for(const c of o)l(this,ie).has(c.id)&&c.translateInPage(s,r)},undo:()=>{for(const c of o)l(this,ie).has(c.id)&&c.translateInPage(-s,-r)},mustExec:!1})},a));for(const c of o)c.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),w(this,Fn,new Map);for(const t of l(this,It))l(this,Fn).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!l(this,Fn))return!1;this.disableUserSelect(!1);const t=l(this,Fn);w(this,Fn,null);let e=!1;for(const[{x:s,y:r,pageIndex:o},a]of t)a.newX=s,a.newY=r,a.newPageIndex=o,e||(e=s!==a.savedX||r!==a.savedY||o!==a.savedPageIndex);if(!e)return!1;const n=(s,r,o,a)=>{if(l(this,ie).has(s.id)){const c=l(this,me).get(a);c?s._setParentAndPosition(c,r,o):(s.pageIndex=a,s.x=r,s.y=o)}};return this.addCommands({cmd:()=>{for(const[s,{newX:r,newY:o,newPageIndex:a}]of t)n(s,r,o,a)},undo:()=>{for(const[s,{savedX:r,savedY:o,savedPageIndex:a}]of t)n(s,r,o,a)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(l(this,Fn))for(const n of l(this,Fn).keys())n.drag(t,e)}rebuild(t){if(t.parent===null){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(){var t;return((t=this.getActive())==null?void 0:t.shouldGetKeyboardEvents())||l(this,It).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return l(this,Xe)===t}getActive(){return l(this,Xe)}getMode(){return l(this,ve)}get imageManager(){return Tt(this,"imageManager",new Dg)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let d=0,h=e.rangeCount;d<h;d++)if(!t.contains(e.getRangeAt(d).commonAncestorContainer))return null;const{x:n,y:s,width:r,height:o}=t.getBoundingClientRect();let a;switch(t.getAttribute("data-main-rotation")){case"90":a=(d,h,u,p)=>({x:(h-s)/o,y:1-(d+u-n)/r,width:p/o,height:u/r});break;case"180":a=(d,h,u,p)=>({x:1-(d+u-n)/r,y:1-(h+p-s)/o,width:u/r,height:p/o});break;case"270":a=(d,h,u,p)=>({x:1-(h+p-s)/o,y:(d-n)/r,width:p/o,height:u/r});break;default:a=(d,h,u,p)=>({x:(d-n)/r,y:(h-s)/o,width:u/r,height:p/o});break}const c=[];for(let d=0,h=e.rangeCount;d<h;d++){const u=e.getRangeAt(d);if(!u.collapsed)for(const{x:p,y:v,width:b,height:x}of u.getClientRects())b===0||x===0||c.push(a(p,v,b,x))}return c.length===0?null:c}addChangedExistingAnnotation({annotationElementId:t,id:e}){(l(this,Ro)||w(this,Ro,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){var e;(e=l(this,Ro))==null||e.delete(t)}renderAnnotationElement(t){var s;const e=(s=l(this,Ro))==null?void 0:s.get(t.data.id);if(!e)return;const n=l(this,di).getRawValue(e);n&&(l(this,ve)===_t.NONE&&!n.hasBeenModified||n.renderAnnotationElement(t))}};Xe=new WeakMap,ie=new WeakMap,me=new WeakMap,Po=new WeakMap,di=new WeakMap,Ro=new WeakMap,pn=new WeakMap,ko=new WeakMap,Xs=new WeakMap,Fn=new WeakMap,ui=new WeakMap,Ys=new WeakMap,Ll=new WeakMap,Il=new WeakMap,Mn=new WeakMap,Lo=new WeakMap,es=new WeakMap,On=new WeakMap,Tu=new WeakMap,ns=new WeakMap,Dl=new WeakMap,Ks=new WeakMap,Fl=new WeakMap,Io=new WeakMap,ve=new WeakMap,It=new WeakMap,fi=new WeakMap,Zs=new WeakMap,Ml=new WeakMap,Ol=new WeakMap,Nl=new WeakMap,$l=new WeakMap,Bl=new WeakMap,jl=new WeakMap,Ul=new WeakMap,Hl=new WeakMap,zl=new WeakMap,Gl=new WeakMap,Vl=new WeakMap,Wl=new WeakMap,ql=new WeakMap,Xl=new WeakMap,is=new WeakMap,Nn=new WeakMap,pi=new WeakMap,Yl=new WeakMap,Do=new WeakSet,Pd=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},Pu=new WeakSet,jy=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;const n=A(this,Do,Pd).call(this,t).closest(".textLayer"),s=this.getSelectionBoxes(n);s&&(l(this,On)||w(this,On,new Nk(this)),l(this,On).show(n,s,this.direction==="ltr"))},Ru=new WeakSet,Uy=function(){var r,o,a;const t=document.getSelection();if(!t||t.isCollapsed){l(this,fi)&&((r=l(this,On))==null||r.hide(),w(this,fi,null),A(this,be,Le).call(this,{hasSelectedText:!1}));return}const{anchorNode:e}=t;if(e===l(this,fi))return;if(!A(this,Do,Pd).call(this,t).closest(".textLayer")){l(this,fi)&&((o=l(this,On))==null||o.hide(),w(this,fi,null),A(this,be,Le).call(this,{hasSelectedText:!1}));return}if((a=l(this,On))==null||a.hide(),w(this,fi,e),A(this,be,Le).call(this,{hasSelectedText:!0}),!(l(this,ve)!==_t.HIGHLIGHT&&l(this,ve)!==_t.NONE)&&(l(this,ve)===_t.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),w(this,es,this.isShiftKeyDown),!this.isShiftKeyDown)){const c=d=>{d.type==="pointerup"&&d.button!==0||(window.removeEventListener("pointerup",c),window.removeEventListener("blur",c),d.type==="pointerup"&&A(this,Fo,Rd).call(this,"main_toolbar"))};window.addEventListener("pointerup",c),window.addEventListener("blur",c)}},Fo=new WeakSet,Rd=function(t=""){l(this,ve)===_t.HIGHLIGHT?this.highlightSelection(t):l(this,Ll)&&A(this,Pu,jy).call(this)},ku=new WeakSet,Hy=function(){document.addEventListener("selectionchange",l(this,Wl))},Lu=new WeakSet,zy=function(){document.removeEventListener("selectionchange",l(this,Wl))},Iu=new WeakSet,Gy=function(){window.addEventListener("focus",l(this,Nl)),window.addEventListener("blur",l(this,Ol))},Kl=new WeakSet,Og=function(){window.removeEventListener("focus",l(this,Nl)),window.removeEventListener("blur",l(this,Ol))},Zl=new WeakSet,Ng=function(){window.addEventListener("keydown",l(this,Ul)),window.addEventListener("keyup",l(this,Hl))},Jl=new WeakSet,$g=function(){window.removeEventListener("keydown",l(this,Ul)),window.removeEventListener("keyup",l(this,Hl))},Ql=new WeakSet,Bg=function(){document.addEventListener("copy",l(this,$l)),document.addEventListener("cut",l(this,Bl)),document.addEventListener("paste",l(this,jl))},tc=new WeakSet,jg=function(){document.removeEventListener("copy",l(this,$l)),document.removeEventListener("cut",l(this,Bl)),document.removeEventListener("paste",l(this,jl))},be=new WeakSet,Le=function(t){Object.entries(t).some(([n,s])=>l(this,Xl)[n]!==s)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(l(this,Xl),t)}),l(this,ve)===_t.HIGHLIGHT&&t.hasSelectedEditor===!1&&A(this,$n,Wi).call(this,[[ct.HIGHLIGHT_FREE,!0]]))},$n=new WeakSet,Wi=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},Du=new WeakSet,Vy=function(){if(!l(this,ns)){w(this,ns,!0);for(const t of l(this,me).values())t.enable();for(const t of l(this,ie).values())t.enable()}},Fu=new WeakSet,Wy=function(){if(this.unselectAll(),l(this,ns)){w(this,ns,!1);for(const t of l(this,me).values())t.disable();for(const t of l(this,ie).values())t.disable()}},ec=new WeakSet,Ug=function(t){const e=l(this,me).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},Mu=new WeakSet,qy=function(){let t=null;for(t of l(this,It));return t},Js=new WeakSet,sl=function(){if(l(this,ie).size===0)return!0;if(l(this,ie).size===1)for(const t of l(this,ie).values())return t.isEmpty();return!1},nc=new WeakSet,Hg=function(t){for(const e of l(this,It))e.unselect();l(this,It).clear();for(const e of t)e.isEmpty()||(l(this,It).add(e),e.select());A(this,be,Le).call(this,{hasSelectedEditor:this.hasSelection})},ft(yo,"TRANSLATE_SMALL",1),ft(yo,"TRANSLATE_BIG",10);let Jr=yo;var gi,mi,gn,vi,mn,Mo,bi,ic,zg;const ai=class ai{constructor(t){m(this,ic);m(this,gi,"");m(this,mi,!1);m(this,gn,null);m(this,vi,null);m(this,mn,null);m(this,Mo,!1);m(this,bi,null);w(this,bi,t)}static initialize(t){ai._l10nPromise||(ai._l10nPromise=t)}async render(){const t=w(this,gn,document.createElement("button"));t.className="altText";const e=await ai._l10nPromise.get("pdfjs-editor-alt-text-button-label");t.textContent=e,t.setAttribute("aria-label",e),t.tabIndex="0",t.addEventListener("contextmenu",Ge),t.addEventListener("pointerdown",s=>s.stopPropagation());const n=s=>{s.preventDefault(),l(this,bi)._uiManager.editAltText(l(this,bi))};return t.addEventListener("click",n,{capture:!0}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(w(this,Mo,!0),n(s))}),await A(this,ic,zg).call(this),t}finish(){l(this,gn)&&(l(this,gn).focus({focusVisible:l(this,Mo)}),w(this,Mo,!1))}isEmpty(){return!l(this,gi)&&!l(this,mi)}get data(){return{altText:l(this,gi),decorative:l(this,mi)}}set data({altText:t,decorative:e}){l(this,gi)===t&&l(this,mi)===e||(w(this,gi,t),w(this,mi,e),A(this,ic,zg).call(this))}toggle(t=!1){l(this,gn)&&(!t&&l(this,mn)&&(clearTimeout(l(this,mn)),w(this,mn,null)),l(this,gn).disabled=!t)}destroy(){var t;(t=l(this,gn))==null||t.remove(),w(this,gn,null),w(this,vi,null)}};gi=new WeakMap,mi=new WeakMap,gn=new WeakMap,vi=new WeakMap,mn=new WeakMap,Mo=new WeakMap,bi=new WeakMap,ic=new WeakSet,zg=async function(){var s;const t=l(this,gn);if(!t)return;if(!l(this,gi)&&!l(this,mi)){t.classList.remove("done"),(s=l(this,vi))==null||s.remove();return}t.classList.add("done"),ai._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(r=>{t.setAttribute("aria-label",r)});let e=l(this,vi);if(!e){w(this,vi,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip");const r=e.id=`alt-text-tooltip-${l(this,bi).id}`;t.setAttribute("aria-describedby",r);const o=100;t.addEventListener("mouseenter",()=>{w(this,mn,setTimeout(()=>{w(this,mn,null),l(this,vi).classList.add("show"),l(this,bi)._reportTelemetry({action:"alt_text_tooltip"})},o))}),t.addEventListener("mouseleave",()=>{var a;l(this,mn)&&(clearTimeout(l(this,mn)),w(this,mn,null)),(a=l(this,vi))==null||a.classList.remove("show")})}e.innerText=l(this,mi)?await ai._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):l(this,gi),e.parentNode||t.append(e);const n=l(this,bi).getImageForAltText();n==null||n.setAttribute("aria-describedby",e.id)},ft(ai,"_l10nPromise",null);let ru=ai;var vn,Ie,Oo,Qs,ye,tr,No,$o,Se,sc,er,ss,rc,nr,yi,Bn,Bo,jo,an,oc,Ou,ac,Gg,lc,Vg,cc,Wg,Nu,Xy,$u,Yy,hc,qg,dc,Xg,uc,Yg,Bu,Ky,ju,Zy,Uu,Jy,Hu,Qy,fc,Kg,ir,rl;const Nt=class Nt{constructor(t){m(this,ac);m(this,cc);m(this,Nu);m(this,$u);m(this,hc);m(this,dc);m(this,uc);m(this,Bu);m(this,ju);m(this,Uu);m(this,Hu);m(this,fc);m(this,ir);m(this,vn,null);m(this,Ie,null);m(this,Oo,!1);m(this,Qs,!1);m(this,ye,null);m(this,tr,null);m(this,No,this.focusin.bind(this));m(this,$o,this.focusout.bind(this));m(this,Se,null);m(this,sc,"");m(this,er,!1);m(this,ss,null);m(this,rc,!1);m(this,nr,!1);m(this,yi,!1);m(this,Bn,null);m(this,Bo,0);m(this,jo,0);m(this,an,null);ft(this,"_initialOptions",Object.create(null));ft(this,"_isVisible",!0);ft(this,"_uiManager",null);ft(this,"_focusEventsAllowed",!0);ft(this,"_l10nPromise",null);m(this,oc,!1);m(this,Ou,Nt._zIndex++);this.constructor===Nt&&Mt("Cannot initialize AnnotationEditor."),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;const{rotation:e,rawDims:{pageWidth:n,pageHeight:s,pageX:r,pageY:o}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,s],this.pageTranslation=[r,o];const[a,c]=this.parentDimensions;this.x=t.x/a,this.y=t.y/c,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const t=Nt.prototype._resizeWithKeyboard,e=Jr.TRANSLATE_SMALL,n=Jr.TRANSLATE_BIG;return Tt(this,"_resizerKeyboardManager",new Yh([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,n]}],[["Escape","mac+Escape"],Nt.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return Tt(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new Uk({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,n){if(Nt._l10nPromise||(Nt._l10nPromise=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map(r=>[r,t.get(r.replaceAll(/([A-Z])/g,o=>`-${o.toLowerCase()}`))]))),n!=null&&n.strings)for(const r of n.strings)Nt._l10nPromise.set(r,t.get(r));if(Nt._borderLineWidth!==-1)return;const s=getComputedStyle(document.documentElement);Nt._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){Mt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return l(this,oc)}set _isDraggable(t){var e;w(this,oc,t),(e=this.div)==null||e.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(t*2),this.y+=this.width*t/(e*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(t*2),this.y-=this.width*t/(e*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}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=l(this,Ou)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):A(this,ir,rl).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&(l(this,er)?w(this,er,!1):this.parent.setSelected(this))}focusout(t){var n;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const e=t.relatedTarget;e!=null&&e.closest(`#${this.id}`)||(t.preventDefault(),(n=this.parent)!=null&&n.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,n,s){const[r,o]=this.parentDimensions;[n,s]=this.screenToPageTranslation(n,s),this.x=(t+n)/r,this.y=(e+s)/o,this.fixAndSetPosition()}translate(t,e){A(this,ac,Gg).call(this,this.parentDimensions,t,e)}translateInPage(t,e){l(this,ss)||w(this,ss,[this.x,this.y]),A(this,ac,Gg).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){l(this,ss)||w(this,ss,[this.x,this.y]);const[n,s]=this.parentDimensions;if(this.x+=t/n,this.y+=e/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:d,y:h}=this.div.getBoundingClientRect();this.parent.findNewParent(this,d,h)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:r,y:o}=this;const[a,c]=this.getBaseTranslation();r+=a,o+=c,this.div.style.left=`${(100*r).toFixed(2)}%`,this.div.style.top=`${(100*o).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!l(this,ss)&&(l(this,ss)[0]!==this.x||l(this,ss)[1]!==this.y)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:n}=Nt,s=n/t,r=n/e;switch(this.rotation){case 90:return[-s,r];case 180:return[s,r];case 270:return[s,-r];default:return[-s,-r]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const[e,n]=this.pageDimensions;let{x:s,y:r,width:o,height:a}=this;if(o*=e,a*=n,s*=e,r*=n,this._mustFixPosition)switch(t){case 0:s=Math.max(0,Math.min(e-o,s)),r=Math.max(0,Math.min(n-a,r));break;case 90:s=Math.max(0,Math.min(e-a,s)),r=Math.min(n,Math.max(o,r));break;case 180:s=Math.min(e,Math.max(o,s)),r=Math.min(n,Math.max(a,r));break;case 270:s=Math.min(e,Math.max(a,s)),r=Math.max(0,Math.min(n-o,r));break}this.x=s/=e,this.y=r/=n;const[c,d]=this.getBaseTranslation();s+=c,r+=d;const{style:h}=this.div;h.left=`${(100*s).toFixed(2)}%`,h.top=`${(100*r).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var n;return A(n=Nt,lc,Vg).call(n,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var n;return A(n=Nt,lc,Vg).call(n,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,n]}=this,s=e*t,r=n*t;return ze.isCSSRoundSupported?[Math.round(s),Math.round(r)]:[s,r]}setDims(t,e){const[n,s]=this.parentDimensions;this.div.style.width=`${(100*t/n).toFixed(2)}%`,l(this,Qs)||(this.div.style.height=`${(100*e/s).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:n}=t,s=n.endsWith("%"),r=!l(this,Qs)&&e.endsWith("%");if(s&&r)return;const[o,a]=this.parentDimensions;s||(t.width=`${(100*parseFloat(n)/o).toFixed(2)}%`),!l(this,Qs)&&!r&&(t.height=`${(100*parseFloat(e)/a).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}altTextFinish(){var t;(t=l(this,Ie))==null||t.finish()}async addEditToolbar(){return l(this,Se)||l(this,nr)?l(this,Se):(w(this,Se,new Lg(this)),this.div.append(l(this,Se).render()),l(this,Ie)&&l(this,Se).addAltTextButton(await l(this,Ie).render()),l(this,Se))}removeEditToolbar(){var t;l(this,Se)&&(l(this,Se).remove(),w(this,Se,null),(t=l(this,Ie))==null||t.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){l(this,Ie)||(ru.initialize(Nt._l10nPromise),w(this,Ie,new ru(this)),await this.addEditToolbar())}get altTextData(){var t;return(t=l(this,Ie))==null?void 0:t.data}set altTextData(t){l(this,Ie)&&(l(this,Ie).data=t)}hasAltText(){var t;return!((t=l(this,Ie))!=null&&t.isEmpty())}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=l(this,Oo)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),this.div.addEventListener("focusin",l(this,No)),this.div.addEventListener("focusout",l(this,$o));const[t,e]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*e/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/e).toFixed(2)}%`);const[n,s]=this.getInitialTranslation();return this.translate(n,s),su(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=ze.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(w(this,er,!0),this._isDraggable){A(this,Bu,Ky).call(this,t);return}A(this,uc,Yg).call(this,t)}moveInDOM(){l(this,Bn)&&clearTimeout(l(this,Bn)),w(this,Bn,setTimeout(()=>{var t;w(this,Bn,null),(t=this.parent)==null||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,n){t.changeParent(this),this.x=e,this.y=n,this.fixAndSetPosition()}getRect(t,e,n=this.rotation){const s=this.parentScale,[r,o]=this.pageDimensions,[a,c]=this.pageTranslation,d=t/s,h=e/s,u=this.x*r,p=this.y*o,v=this.width*r,b=this.height*o;switch(n){case 0:return[u+d+a,o-p-h-b+c,u+d+v+a,o-p-h+c];case 90:return[u+h+a,o-p+d+c,u+h+b+a,o-p+d+v+c];case 180:return[u-d-v+a,o-p+h+c,u-d+a,o-p+h+b+c];case 270:return[u-h-b+a,o-p-d-v+c,u-h+a,o-p-d+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[n,s,r,o]=t,a=r-n,c=o-s;switch(this.rotation){case 0:return[n,e-o,a,c];case 90:return[n,e-s,c,a];case 180:return[r,e-s,a,c];case 270:return[r,e-o,c,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){w(this,nr,!0)}disableEditMode(){w(this,nr,!1)}isInEditMode(){return l(this,nr)}shouldGetKeyboardEvents(){return l(this,yi)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var t,e;(t=this.div)==null||t.addEventListener("focusin",l(this,No)),(e=this.div)==null||e.addEventListener("focusout",l(this,$o))}rotate(t){}serialize(t=!1,e=null){Mt("An editor must be serializable")}static deserialize(t,e,n){const s=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:n});s.rotation=t.rotation;const[r,o]=s.pageDimensions,[a,c,d,h]=s.getRectInCurrentCoords(t.rect,o);return s.x=a/r,s.y=c/o,s.width=d/r,s.height=h/o,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.div.removeEventListener("focusin",l(this,No)),this.div.removeEventListener("focusout",l(this,$o)),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),l(this,Bn)&&(clearTimeout(l(this,Bn)),w(this,Bn,null)),A(this,ir,rl).call(this),this.removeEditToolbar(),l(this,an)){for(const t of l(this,an).values())clearTimeout(t);w(this,an,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(A(this,Nu,Xy).call(this),l(this,ye).classList.remove("hidden"),su(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),w(this,tr,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=l(this,ye).children;if(!l(this,vn)){w(this,vn,Array.from(e));const o=A(this,ju,Zy).bind(this),a=A(this,Uu,Jy).bind(this);for(const c of l(this,vn)){const d=c.getAttribute("data-resizer-name");c.setAttribute("role","spinbutton"),c.addEventListener("keydown",o),c.addEventListener("blur",a),c.addEventListener("focus",A(this,Hu,Qy).bind(this,d)),Nt._l10nPromise.get(`pdfjs-editor-resizer-label-${d}`).then(h=>c.setAttribute("aria-label",h))}}const n=l(this,vn)[0];let s=0;for(const o of e){if(o===n)break;s++}const r=(360-this.rotation+this.parentRotation)%360/90*(l(this,vn).length/4);if(r!==s){if(r<s)for(let a=0;a<s-r;a++)l(this,ye).append(l(this,ye).firstChild);else if(r>s)for(let a=0;a<r-s;a++)l(this,ye).firstChild.before(l(this,ye).lastChild);let o=0;for(const a of e){const d=l(this,vn)[o++].getAttribute("data-resizer-name");Nt._l10nPromise.get(`pdfjs-editor-resizer-label-${d}`).then(h=>a.setAttribute("aria-label",h))}}A(this,fc,Kg).call(this,0),w(this,yi,!0),l(this,ye).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){l(this,yi)&&A(this,dc,Xg).call(this,l(this,sc),{movementX:t,movementY:e})}_stopResizingWithKeyboard(){A(this,ir,rl).call(this),this.div.focus()}select(){var t,e;if(this.makeResizable(),(t=this.div)==null||t.classList.add("selectedEditor"),!l(this,Se)){this.addEditToolbar().then(()=>{var n,s;(n=this.div)!=null&&n.classList.contains("selectedEditor")&&((s=l(this,Se))==null||s.show())});return}(e=l(this,Se))==null||e.show()}unselect(){var t,e,n,s;(t=l(this,ye))==null||t.classList.add("hidden"),(e=this.div)==null||e.classList.remove("selectedEditor"),(n=this.div)!=null&&n.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(s=l(this,Se))==null||s.hide()}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return l(this,rc)}set isEditing(t){w(this,rc,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){w(this,Qs,!0);const n=t/e,{style:s}=this.div;s.aspectRatio=n,s.height="auto"}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){l(this,an)||w(this,an,new Map);const{action:n}=t;let s=l(this,an).get(n);s&&clearTimeout(s),s=setTimeout(()=>{this._reportTelemetry(t),l(this,an).delete(n),l(this,an).size===0&&w(this,an,null)},Nt._telemetryTimeout),l(this,an).set(n,s);return}t.type||(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),w(this,Oo,!1)}disable(){this.div&&(this.div.tabIndex=-1),w(this,Oo,!0)}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){const n=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),n.before(e)}return e}resetAnnotationElement(t){const{firstChild:e}=t.container;e.nodeName==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};vn=new WeakMap,Ie=new WeakMap,Oo=new WeakMap,Qs=new WeakMap,ye=new WeakMap,tr=new WeakMap,No=new WeakMap,$o=new WeakMap,Se=new WeakMap,sc=new WeakMap,er=new WeakMap,ss=new WeakMap,rc=new WeakMap,nr=new WeakMap,yi=new WeakMap,Bn=new WeakMap,Bo=new WeakMap,jo=new WeakMap,an=new WeakMap,oc=new WeakMap,Ou=new WeakMap,ac=new WeakSet,Gg=function([t,e],n,s){[n,s]=this.screenToPageTranslation(n,s),this.x+=n/t,this.y+=s/e,this.fixAndSetPosition()},lc=new WeakSet,Vg=function(t,e,n){switch(n){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},cc=new WeakSet,Wg=function(t){switch(t){case 90:{const[e,n]=this.pageDimensions;return[0,-e/n,n/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,n]=this.pageDimensions;return[0,e/n,-n/e,0]}default:return[1,0,0,1]}},Nu=new WeakSet,Xy=function(){if(l(this,ye))return;w(this,ye,document.createElement("div")),l(this,ye).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"];for(const e of t){const n=document.createElement("div");l(this,ye).append(n),n.classList.add("resizer",e),n.setAttribute("data-resizer-name",e),n.addEventListener("pointerdown",A(this,$u,Yy).bind(this,e)),n.addEventListener("contextmenu",Ge),n.tabIndex=-1}this.div.prepend(l(this,ye))},$u=new WeakSet,Yy=function(t,e){var b;e.preventDefault();const{isMac:n}=ze.platform;if(e.button!==0||e.ctrlKey&&n)return;(b=l(this,Ie))==null||b.toggle(!1);const s=A(this,dc,Xg).bind(this,t),r=this._isDraggable;this._isDraggable=!1;const o={passive:!0,capture:!0};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",s,o),window.addEventListener("contextmenu",Ge);const a=this.x,c=this.y,d=this.width,h=this.height,u=this.parent.div.style.cursor,p=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const v=()=>{var x;this.parent.togglePointerEvents(!0),(x=l(this,Ie))==null||x.toggle(!0),this._isDraggable=r,window.removeEventListener("pointerup",v),window.removeEventListener("blur",v),window.removeEventListener("pointermove",s,o),window.removeEventListener("contextmenu",Ge),this.parent.div.style.cursor=u,this.div.style.cursor=p,A(this,hc,qg).call(this,a,c,d,h)};window.addEventListener("pointerup",v),window.addEventListener("blur",v)},hc=new WeakSet,qg=function(t,e,n,s){const r=this.x,o=this.y,a=this.width,c=this.height;r===t&&o===e&&a===n&&c===s||this.addCommands({cmd:()=>{this.width=a,this.height=c,this.x=r,this.y=o;const[d,h]=this.parentDimensions;this.setDims(d*a,h*c),this.fixAndSetPosition()},undo:()=>{this.width=n,this.height=s,this.x=t,this.y=e;const[d,h]=this.parentDimensions;this.setDims(d*n,h*s),this.fixAndSetPosition()},mustExec:!0})},dc=new WeakSet,Xg=function(t,e){const[n,s]=this.parentDimensions,r=this.x,o=this.y,a=this.width,c=this.height,d=Nt.MIN_SIZE/n,h=Nt.MIN_SIZE/s,u=j=>Math.round(j*1e4)/1e4,p=A(this,cc,Wg).call(this,this.rotation),v=(j,W)=>[p[0]*j+p[2]*W,p[1]*j+p[3]*W],b=A(this,cc,Wg).call(this,360-this.rotation),x=(j,W)=>[b[0]*j+b[2]*W,b[1]*j+b[3]*W];let _,E,R=!1,k=!1;switch(t){case"topLeft":R=!0,_=(j,W)=>[0,0],E=(j,W)=>[j,W];break;case"topMiddle":_=(j,W)=>[j/2,0],E=(j,W)=>[j/2,W];break;case"topRight":R=!0,_=(j,W)=>[j,0],E=(j,W)=>[0,W];break;case"middleRight":k=!0,_=(j,W)=>[j,W/2],E=(j,W)=>[0,W/2];break;case"bottomRight":R=!0,_=(j,W)=>[j,W],E=(j,W)=>[0,0];break;case"bottomMiddle":_=(j,W)=>[j/2,W],E=(j,W)=>[j/2,0];break;case"bottomLeft":R=!0,_=(j,W)=>[0,W],E=(j,W)=>[j,0];break;case"middleLeft":k=!0,_=(j,W)=>[0,W/2],E=(j,W)=>[j,W/2];break}const D=_(a,c),F=E(a,c);let M=v(...F);const O=u(r+M[0]),C=u(o+M[1]);let P=1,$=1,[N,H]=this.screenToPageTranslation(e.movementX,e.movementY);if([N,H]=x(N/n,H/s),R){const j=Math.hypot(a,c);P=$=Math.max(Math.min(Math.hypot(F[0]-D[0]-N,F[1]-D[1]-H)/j,1/a,1/c),d/a,h/c)}else k?P=Math.max(d,Math.min(1,Math.abs(F[0]-D[0]-N)))/a:$=Math.max(h,Math.min(1,Math.abs(F[1]-D[1]-H)))/c;const z=u(a*P),V=u(c*$);M=v(...E(z,V));const Z=O-M[0],Q=C-M[1];this.width=z,this.height=V,this.x=Z,this.y=Q,this.setDims(n*z,s*V),this.fixAndSetPosition()},uc=new WeakSet,Yg=function(t){const{isMac:e}=ze.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},Bu=new WeakSet,Ky=function(t){const e=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let n,s;e&&(this.div.classList.add("moving"),n={passive:!0,capture:!0},w(this,Bo,t.clientX),w(this,jo,t.clientY),s=o=>{const{clientX:a,clientY:c}=o,[d,h]=this.screenToPageTranslation(a-l(this,Bo),c-l(this,jo));w(this,Bo,a),w(this,jo,c),this._uiManager.dragSelectedEditors(d,h)},window.addEventListener("pointermove",s,n));const r=()=>{window.removeEventListener("pointerup",r),window.removeEventListener("blur",r),e&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",s,n)),w(this,er,!1),this._uiManager.endDragSession()||A(this,uc,Yg).call(this,t)};window.addEventListener("pointerup",r),window.addEventListener("blur",r)},ju=new WeakSet,Zy=function(t){Nt._resizerKeyboardManager.exec(this,t)},Uu=new WeakSet,Jy=function(t){var e;l(this,yi)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==l(this,ye)&&A(this,ir,rl).call(this)},Hu=new WeakSet,Qy=function(t){w(this,sc,l(this,yi)?t:"")},fc=new WeakSet,Kg=function(t){if(l(this,vn))for(const e of l(this,vn))e.tabIndex=t},ir=new WeakSet,rl=function(){if(w(this,yi,!1),A(this,fc,Kg).call(this,-1),l(this,tr)){const{savedX:t,savedY:e,savedWidth:n,savedHeight:s}=l(this,tr);A(this,hc,qg).call(this,t,e,n,s),w(this,tr,null)}},m(Nt,lc),ft(Nt,"_borderLineWidth",-1),ft(Nt,"_colorManager",new Mg),ft(Nt,"_zIndex",1),ft(Nt,"_telemetryTimeout",1e3);let Dt=Nt;class Uk extends Dt{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}const xv=3285377520,sn=4294901760,Rn=65535;class tw{constructor(t){this.h1=t?t&4294967295:xv,this.h2=t?t&4294967295:xv}update(t){let e,n;if(typeof t=="string"){e=new Uint8Array(t.length*2),n=0;for(let x=0,_=t.length;x<_;x++){const E=t.charCodeAt(x);E<=255?e[n++]=E:(e[n++]=E>>>8,e[n++]=E&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),n=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const s=n>>2,r=n-s*4,o=new Uint32Array(e.buffer,0,s);let a=0,c=0,d=this.h1,h=this.h2;const u=3432918353,p=461845907,v=u&Rn,b=p&Rn;for(let x=0;x<s;x++)x&1?(a=o[x],a=a*u&sn|a*v&Rn,a=a<<15|a>>>17,a=a*p&sn|a*b&Rn,d^=a,d=d<<13|d>>>19,d=d*5+3864292196):(c=o[x],c=c*u&sn|c*v&Rn,c=c<<15|c>>>17,c=c*p&sn|c*b&Rn,h^=c,h=h<<13|h>>>19,h=h*5+3864292196);switch(a=0,r){case 3:a^=e[s*4+2]<<16;case 2:a^=e[s*4+1]<<8;case 1:a^=e[s*4],a=a*u&sn|a*v&Rn,a=a<<15|a>>>17,a=a*p&sn|a*b&Rn,s&1?d^=a:h^=a}this.h1=d,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&sn|t*36045&Rn,e=e*4283543511&sn|((e<<16|t>>>16)*2950163797&sn)>>>16,t^=e>>>1,t=t*444984403&sn|t*60499&Rn,e=e*3301882366&sn|((e<<16|t>>>16)*3120437893&sn)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Zg=Object.freeze({map:null,hash:"",transfer:void 0});var sr,we,zu,ew;class b0{constructor(){m(this,zu);m(this,sr,!1);m(this,we,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const n=l(this,we).get(t);return n===void 0?e:Object.assign(e,n)}getRawValue(t){return l(this,we).get(t)}remove(t){if(l(this,we).delete(t),l(this,we).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const e of l(this,we).values())if(e instanceof Dt)return;this.onAnnotationEditor(null)}}setValue(t,e){const n=l(this,we).get(t);let s=!1;if(n!==void 0)for(const[r,o]of Object.entries(e))n[r]!==o&&(s=!0,n[r]=o);else s=!0,l(this,we).set(t,e);s&&A(this,zu,ew).call(this),e instanceof Dt&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(e.constructor._type)}has(t){return l(this,we).has(t)}getAll(){return l(this,we).size>0?d0(l(this,we)):null}setAll(t){for(const[e,n]of Object.entries(t))this.setValue(e,n)}get size(){return l(this,we).size}resetModified(){l(this,sr)&&(w(this,sr,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new nw(this)}get serializable(){if(l(this,we).size===0)return Zg;const t=new Map,e=new tw,n=[],s=Object.create(null);let r=!1;for(const[o,a]of l(this,we)){const c=a instanceof Dt?a.serialize(!1,s):a;c&&(t.set(o,c),e.update(`${o}:${JSON.stringify(c)}`),r||(r=!!c.bitmap))}if(r)for(const o of t.values())o.bitmap&&n.push(o.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:n}:Zg}get editorStats(){let t=null;const e=new Map;for(const n of l(this,we).values()){if(!(n instanceof Dt))continue;const s=n.telemetryFinalData;if(!s)continue;const{type:r}=s;e.has(r)||e.set(r,Object.getPrototypeOf(n).constructor),t||(t=Object.create(null));const o=t[r]||(t[r]=new Map);for(const[a,c]of Object.entries(s)){if(a==="type")continue;let d=o.get(a);d||(d=new Map,o.set(a,d));const h=d.get(c)??0;d.set(c,h+1)}}for(const[n,s]of e)t[n]=s.computeTelemetryFinalData(t[n]);return t}}sr=new WeakMap,we=new WeakMap,zu=new WeakSet,ew=function(){l(this,sr)||(w(this,sr,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var pc;class nw extends b0{constructor(e){super();m(this,pc,void 0);const{map:n,hash:s,transfer:r}=e.serializable,o=structuredClone(n,r?{transfer:r}:null);w(this,pc,{map:o,hash:s,transfer:r})}get print(){Mt("Should not call PrintAnnotationStorage.print")}get serializable(){return l(this,pc)}}pc=new WeakMap;var Uo;class Hk{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){m(this,Uo,new Set);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(),l(this,Uo).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:e}){if(!(!t||l(this,Uo).has(t.loadedName))){if(ae(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:n,src:s,style:r}=t,o=new FontFace(n,s,r);this.addNativeFontFace(o);try{await o.load(),l(this,Uo).add(n),e==null||e(t)}catch{yt(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}Mt("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){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){const n=t.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(s){throw yt(`Failed to load font '${n.family}': '${s}'.`),t.disableFontFace=!0,s}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(n=>{const s=this._queueLoadingCallback(n);this._prepareFontLoadEvent(t,s)})}}get isFontLoadingAPISupported(){var e;const t=!!((e=this._document)!=null&&e.fonts);return Tt(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let t=!1;return(Pe||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),Tt(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){function e(){for(ae(!s.done,"completeRequest() cannot be called twice."),s.done=!0;n.length>0&&n[0].done;){const r=n.shift();setTimeout(r.callback,0)}}const{loadingRequests:n}=this,s={done:!1,complete:e,callback:t};return n.push(s),s}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Tt(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function n(D,F){return D.charCodeAt(F)<<24|D.charCodeAt(F+1)<<16|D.charCodeAt(F+2)<<8|D.charCodeAt(F+3)&255}function s(D,F,M,O){const C=D.substring(0,F),P=D.substring(F+M);return C+O+P}let r,o;const a=this._document.createElement("canvas");a.width=1,a.height=1;const c=a.getContext("2d");let d=0;function h(D,F){if(++d>30){yt("Load test font never loaded."),F();return}if(c.font="30px "+D,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){F();return}setTimeout(h.bind(null,D,F))}const u=`lt${Date.now()}${this.loadTestFontId++}`;let p=this._loadTestFont;p=s(p,976,u.length,u);const b=16,x=1482184792;let _=n(p,b);for(r=0,o=u.length-3;r<o;r+=4)_=_-x+n(u,r)|0;r<u.length&&(_=_-x+n(u+"XXX",r)|0),p=s(p,b,4,Sk(_));const E=`url(data:font/opentype;base64,${btoa(p)});`,R=`@font-face {font-family:"${u}";src:${E}}`;this.insertRule(R);const k=this._document.createElement("div");k.style.visibility="hidden",k.style.width=k.style.height="10px",k.style.position="absolute",k.style.top=k.style.left="0px";for(const D of[t.loadedName,u]){const F=this._document.createElement("span");F.textContent="Hi",F.style.fontFamily=D,k.append(F)}this._document.body.append(k),h(u,()=>{k.remove(),e.complete()})}}Uo=new WeakMap;class zk{constructor(t,{disableFontFace:e=!1,inspectFont:n=null}){this.compiledGlyphs=Object.create(null);for(const s in t)this[s]=t[s];this.disableFontFace=e===!0,this._inspectFont=n}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const n={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(n.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,n)}return(e=this._inspectFont)==null||e.call(this,this),t}createFontFaceRule(){var s;if(!this.data||this.disableFontFace)return null;const t=Sy(this.data),e=`url(data:${this.mimetype};base64,${btoa(t)});`;let n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let r=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(r+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${r}src:${e}}`}return(s=this._inspectFont)==null||s.call(this,this,e),n}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];let n;try{n=t.get(this.loadedName+"_path_"+e)}catch(r){yt(`getPathGenerator - ignoring character: "${r}".`)}if(!Array.isArray(n)||n.length===0)return this.compiledGlyphs[e]=function(r,o){};const s=[];for(let r=0,o=n.length;r<o;)switch(n[r++]){case ii.BEZIER_CURVE_TO:{const[a,c,d,h,u,p]=n.slice(r,r+6);s.push(v=>v.bezierCurveTo(a,c,d,h,u,p)),r+=6}break;case ii.MOVE_TO:{const[a,c]=n.slice(r,r+2);s.push(d=>d.moveTo(a,c)),r+=2}break;case ii.LINE_TO:{const[a,c]=n.slice(r,r+2);s.push(d=>d.lineTo(a,c)),r+=2}break;case ii.QUADRATIC_CURVE_TO:{const[a,c,d,h]=n.slice(r,r+4);s.push(u=>u.quadraticCurveTo(a,c,d,h)),r+=4}break;case ii.RESTORE:s.push(a=>a.restore());break;case ii.SAVE:s.push(a=>a.save());break;case ii.SCALE:ae(s.length===2,"Scale command is only valid at the third position.");break;case ii.TRANSFORM:{const[a,c,d,h,u,p]=n.slice(r,r+6);s.push(v=>v.transform(a,c,d,h,u,p)),r+=6}break;case ii.TRANSLATE:{const[a,c]=n.slice(r,r+2);s.push(d=>d.translate(a,c)),r+=2}break}return this.compiledGlyphs[e]=function(o,a){s[0](o),s[1](o),o.scale(a,-a);for(let c=2,d=s.length;c<d;c++)s[c](o)}}}if(Pe){var Jg=Promise.withResolvers(),vl=null;(async()=>{const t=await Promise.resolve().then(()=>require("./empty-DBAFSQIv.cjs")),e=await Promise.resolve().then(()=>require("./index-CYjVmFQ0.cjs")).then(a=>a.index),n=await Promise.resolve().then(()=>require("./index-DHMTXjv6.cjs")).then(a=>a.index),s=await Promise.resolve().then(()=>require("./url-BH2U_nez.cjs")).then(a=>a.url);let r,o;return new Map(Object.entries({fs:t,http:e,https:n,url:s,canvas:r,path2d:o}))})().then(t=>{vl=t,Jg.resolve()},t=>{yt(`loadPackages: ${t}`),vl=new Map,Jg.resolve()})}class Qn{static get promise(){return Jg.promise}static get(t){return vl==null?void 0:vl.get(t)}}const iw=function(i){return Qn.get("fs").promises.readFile(i).then(e=>new Uint8Array(e))};class Gk extends fp{}class Vk extends pp{_createCanvas(t,e){return Qn.get("canvas").createCanvas(t,e)}}class Wk extends gp{_fetchData(t,e){return iw(t).then(n=>({cMapData:n,compressionType:e}))}}class qk extends mp{_fetchData(t){return iw(t)}}const Me={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function Qg(i,t){if(!t)return;const e=t[2]-t[0],n=t[3]-t[1],s=new Path2D;s.rect(t[0],t[1],e,n),i.clip(s)}class Kh{constructor(){this.constructor===Kh&&Mt("Cannot initialize BaseShadingPattern.")}getPattern(){Mt("Abstract method `getPattern` called.")}}class Xk extends Kh{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}_createGradient(t){let e;this._type==="axial"?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const n of this._colorStops)e.addColorStop(n[0],n[1]);return e}getPattern(t,e,n,s){let r;if(s===Me.STROKE||s===Me.FILL){const o=e.current.getClippedPathBoundingBox(s,Gt(t))||[0,0,0,0],a=Math.ceil(o[2]-o[0])||1,c=Math.ceil(o[3]-o[1])||1,d=e.cachedCanvases.getCanvas("pattern",a,c,!0),h=d.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(-o[0],-o[1]),n=et.transform(n,[1,0,0,1,o[0],o[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),Qg(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),r=t.createPattern(d.canvas,"no-repeat");const u=new DOMMatrix(n);r.setTransform(u)}else Qg(t,this._bbox),r=this._createGradient(t);return r}}function tg(i,t,e,n,s,r,o,a){const c=t.coords,d=t.colors,h=i.data,u=i.width*4;let p;c[e+1]>c[n+1]&&(p=e,e=n,n=p,p=r,r=o,o=p),c[n+1]>c[s+1]&&(p=n,n=s,s=p,p=o,o=a,a=p),c[e+1]>c[n+1]&&(p=e,e=n,n=p,p=r,r=o,o=p);const v=(c[e]+t.offsetX)*t.scaleX,b=(c[e+1]+t.offsetY)*t.scaleY,x=(c[n]+t.offsetX)*t.scaleX,_=(c[n+1]+t.offsetY)*t.scaleY,E=(c[s]+t.offsetX)*t.scaleX,R=(c[s+1]+t.offsetY)*t.scaleY;if(b>=R)return;const k=d[r],D=d[r+1],F=d[r+2],M=d[o],O=d[o+1],C=d[o+2],P=d[a],$=d[a+1],N=d[a+2],H=Math.round(b),z=Math.round(R);let V,Z,Q,j,W,q,wt,pt;for(let G=H;G<=z;G++){if(G<_){const J=G<b?0:(b-G)/(b-_);V=v-(v-x)*J,Z=k-(k-M)*J,Q=D-(D-O)*J,j=F-(F-C)*J}else{let J;G>R?J=1:_===R?J=0:J=(_-G)/(_-R),V=x-(x-E)*J,Z=M-(M-P)*J,Q=O-(O-$)*J,j=C-(C-N)*J}let st;G<b?st=0:G>R?st=1:st=(b-G)/(b-R),W=v-(v-E)*st,q=k-(k-P)*st,wt=D-(D-$)*st,pt=F-(F-N)*st;const nt=Math.round(Math.min(V,W)),it=Math.round(Math.max(V,W));let dt=u*G+nt*4;for(let J=nt;J<=it;J++)st=(V-J)/(V-W),st<0?st=0:st>1&&(st=1),h[dt++]=Z-(Z-q)*st|0,h[dt++]=Q-(Q-wt)*st|0,h[dt++]=j-(j-pt)*st|0,h[dt++]=255}}function Yk(i,t,e){const n=t.coords,s=t.colors;let r,o;switch(t.type){case"lattice":const a=t.verticesPerRow,c=Math.floor(n.length/a)-1,d=a-1;for(r=0;r<c;r++){let h=r*a;for(let u=0;u<d;u++,h++)tg(i,e,n[h],n[h+1],n[h+a],s[h],s[h+1],s[h+a]),tg(i,e,n[h+a+1],n[h+1],n[h+a],s[h+a+1],s[h+1],s[h+a])}break;case"triangles":for(r=0,o=n.length;r<o;r+=3)tg(i,e,n[r],n[r+1],n[r+2],s[r],s[r+1],s[r+2]);break;default:throw new Error("illegal figure")}}class Kk extends Kh{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,e,n){const a=Math.floor(this._bounds[0]),c=Math.floor(this._bounds[1]),d=Math.ceil(this._bounds[2])-a,h=Math.ceil(this._bounds[3])-c,u=Math.min(Math.ceil(Math.abs(d*t[0]*1.1)),3e3),p=Math.min(Math.ceil(Math.abs(h*t[1]*1.1)),3e3),v=d/u,b=h/p,x={coords:this._coords,colors:this._colors,offsetX:-a,offsetY:-c,scaleX:1/v,scaleY:1/b},_=u+2*2,E=p+2*2,R=n.getCanvas("mesh",_,E,!1),k=R.context,D=k.createImageData(u,p);if(e){const M=D.data;for(let O=0,C=M.length;O<C;O+=4)M[O]=e[0],M[O+1]=e[1],M[O+2]=e[2],M[O+3]=255}for(const M of this._figures)Yk(D,M,x);return k.putImageData(D,2,2),{canvas:R.canvas,offsetX:a-2*v,offsetY:c-2*b,scaleX:v,scaleY:b}}getPattern(t,e,n,s){Qg(t,this._bbox);let r;if(s===Me.SHADING)r=et.singularValueDecompose2dScale(Gt(t));else if(r=et.singularValueDecompose2dScale(e.baseTransform),this.matrix){const a=et.singularValueDecompose2dScale(this.matrix);r=[r[0]*a[0],r[1]*a[1]]}const o=this._createMeshCanvas(r,s===Me.SHADING?null:this._background,e.cachedCanvases);return s!==Me.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(o.offsetX,o.offsetY),t.scale(o.scaleX,o.scaleY),t.createPattern(o.canvas,"no-repeat")}}class Zk extends Kh{getPattern(){return"hotpink"}}function Jk(i){switch(i[0]){case"RadialAxial":return new Xk(i);case"Mesh":return new Kk(i);case"Dummy":return new Zk}throw new Error(`Unknown IR type: ${i[0]}`)}const Ev={COLORED:1,UNCOLORED:2},Gu=class Gu{constructor(t,e,n,s,r){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.color=e,this.ctx=n,this.canvasGraphicsFactory=s,this.baseTransform=r}createPatternCanvas(t){const e=this.operatorList,n=this.bbox,s=this.xstep,r=this.ystep,o=this.paintType,a=this.tilingType,c=this.color,d=this.canvasGraphicsFactory;hp("TilingType: "+a);const h=n[0],u=n[1],p=n[2],v=n[3],b=et.singularValueDecompose2dScale(this.matrix),x=et.singularValueDecompose2dScale(this.baseTransform),_=[b[0]*x[0],b[1]*x[1]],E=this.getSizeAndScale(s,this.ctx.canvas.width,_[0]),R=this.getSizeAndScale(r,this.ctx.canvas.height,_[1]),k=t.cachedCanvases.getCanvas("pattern",E.size,R.size,!0),D=k.context,F=d.createCanvasGraphics(D);F.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(F,o,c);let M=h,O=u,C=p,P=v;return h<0&&(M=0,C+=Math.abs(h)),u<0&&(O=0,P+=Math.abs(u)),D.translate(-(E.scale*M),-(R.scale*O)),F.transform(E.scale,0,0,R.scale,0,0),D.save(),this.clipBbox(F,M,O,C,P),F.baseTransform=Gt(F.ctx),F.executeOperatorList(e),F.endDrawing(),{canvas:k.canvas,scaleX:E.scale,scaleY:R.scale,offsetX:M,offsetY:O}}getSizeAndScale(t,e,n){t=Math.abs(t);const s=Math.max(Gu.MAX_PATTERN_SIZE,e);let r=Math.ceil(t*n);return r>=s?r=s:n=r/t,{scale:n,size:r}}clipBbox(t,e,n,s,r){const o=s-e,a=r-n;t.ctx.rect(e,n,o,a),t.current.updateRectMinMax(Gt(t.ctx),[e,n,s,r]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,n){const s=t.ctx,r=t.current;switch(e){case Ev.COLORED:const o=this.ctx;s.fillStyle=o.fillStyle,s.strokeStyle=o.strokeStyle,r.fillColor=o.fillStyle,r.strokeColor=o.strokeStyle;break;case Ev.UNCOLORED:const a=et.makeHexColor(n[0],n[1],n[2]);s.fillStyle=a,s.strokeStyle=a,r.fillColor=a,r.strokeColor=a;break;default:throw new _k(`Unsupported paint type: ${e}`)}}getPattern(t,e,n,s){let r=n;s!==Me.SHADING&&(r=et.transform(r,e.baseTransform),this.matrix&&(r=et.transform(r,this.matrix)));const o=this.createPatternCanvas(e);let a=new DOMMatrix(r);a=a.translate(o.offsetX,o.offsetY),a=a.scale(1/o.scaleX,1/o.scaleY);const c=t.createPattern(o.canvas,"repeat");return c.setTransform(a),c}};ft(Gu,"MAX_PATTERN_SIZE",3e3);let tm=Gu;function Qk({src:i,srcPos:t=0,dest:e,width:n,height:s,nonBlackColor:r=4294967295,inverseDecode:o=!1}){const a=ze.isLittleEndian?4278190080:255,[c,d]=o?[r,a]:[a,r],h=n>>3,u=n&7,p=i.length;e=new Uint32Array(e.buffer);let v=0;for(let b=0;b<s;b++){for(const _=t+h;t<_;t++){const E=t<p?i[t]:255;e[v++]=E&128?d:c,e[v++]=E&64?d:c,e[v++]=E&32?d:c,e[v++]=E&16?d:c,e[v++]=E&8?d:c,e[v++]=E&4?d:c,e[v++]=E&2?d:c,e[v++]=E&1?d:c}if(u===0)continue;const x=t<p?i[t++]:255;for(let _=0;_<u;_++)e[v++]=x&1<<7-_?d:c}return{srcPos:t,destPos:v}}const _v=16,Sv=100,tL=15,Cv=10,Tv=1e3,je=16;function eL(i,t){if(i._removeMirroring)throw new Error("Context is already forwarding operations.");i.__originalSave=i.save,i.__originalRestore=i.restore,i.__originalRotate=i.rotate,i.__originalScale=i.scale,i.__originalTranslate=i.translate,i.__originalTransform=i.transform,i.__originalSetTransform=i.setTransform,i.__originalResetTransform=i.resetTransform,i.__originalClip=i.clip,i.__originalMoveTo=i.moveTo,i.__originalLineTo=i.lineTo,i.__originalBezierCurveTo=i.bezierCurveTo,i.__originalRect=i.rect,i.__originalClosePath=i.closePath,i.__originalBeginPath=i.beginPath,i._removeMirroring=()=>{i.save=i.__originalSave,i.restore=i.__originalRestore,i.rotate=i.__originalRotate,i.scale=i.__originalScale,i.translate=i.__originalTranslate,i.transform=i.__originalTransform,i.setTransform=i.__originalSetTransform,i.resetTransform=i.__originalResetTransform,i.clip=i.__originalClip,i.moveTo=i.__originalMoveTo,i.lineTo=i.__originalLineTo,i.bezierCurveTo=i.__originalBezierCurveTo,i.rect=i.__originalRect,i.closePath=i.__originalClosePath,i.beginPath=i.__originalBeginPath,delete i._removeMirroring},i.save=function(){t.save(),this.__originalSave()},i.restore=function(){t.restore(),this.__originalRestore()},i.translate=function(n,s){t.translate(n,s),this.__originalTranslate(n,s)},i.scale=function(n,s){t.scale(n,s),this.__originalScale(n,s)},i.transform=function(n,s,r,o,a,c){t.transform(n,s,r,o,a,c),this.__originalTransform(n,s,r,o,a,c)},i.setTransform=function(n,s,r,o,a,c){t.setTransform(n,s,r,o,a,c),this.__originalSetTransform(n,s,r,o,a,c)},i.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},i.rotate=function(n){t.rotate(n),this.__originalRotate(n)},i.clip=function(n){t.clip(n),this.__originalClip(n)},i.moveTo=function(e,n){t.moveTo(e,n),this.__originalMoveTo(e,n)},i.lineTo=function(e,n){t.lineTo(e,n),this.__originalLineTo(e,n)},i.bezierCurveTo=function(e,n,s,r,o,a){t.bezierCurveTo(e,n,s,r,o,a),this.__originalBezierCurveTo(e,n,s,r,o,a)},i.rect=function(e,n,s,r){t.rect(e,n,s,r),this.__originalRect(e,n,s,r)},i.closePath=function(){t.closePath(),this.__originalClosePath()},i.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class nL{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,n){let s;return this.cache[t]!==void 0?(s=this.cache[t],this.canvasFactory.reset(s,e,n)):(s=this.canvasFactory.create(e,n),this.cache[t]=s),s}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 dd(i,t,e,n,s,r,o,a,c,d){const[h,u,p,v,b,x]=Gt(i);if(u===0&&p===0){const R=o*h+b,k=Math.round(R),D=a*v+x,F=Math.round(D),M=(o+c)*h+b,O=Math.abs(Math.round(M)-k)||1,C=(a+d)*v+x,P=Math.abs(Math.round(C)-F)||1;return i.setTransform(Math.sign(h),0,0,Math.sign(v),k,F),i.drawImage(t,e,n,s,r,0,0,O,P),i.setTransform(h,u,p,v,b,x),[O,P]}if(h===0&&v===0){const R=a*p+b,k=Math.round(R),D=o*u+x,F=Math.round(D),M=(a+d)*p+b,O=Math.abs(Math.round(M)-k)||1,C=(o+c)*u+x,P=Math.abs(Math.round(C)-F)||1;return i.setTransform(0,Math.sign(u),Math.sign(p),0,k,F),i.drawImage(t,e,n,s,r,0,0,P,O),i.setTransform(h,u,p,v,b,x),[P,O]}i.drawImage(t,e,n,s,r,o,a,c,d);const _=Math.hypot(h,u),E=Math.hypot(p,v);return[_*c,E*d]}function iL(i){const{width:t,height:e}=i;if(t>Tv||e>Tv)return null;const n=1e3,s=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),r=t+1;let o=new Uint8Array(r*(e+1)),a,c,d;const h=t+7&-8;let u=new Uint8Array(h*e),p=0;for(const E of i.data){let R=128;for(;R>0;)u[p++]=E&R?0:255,R>>=1}let v=0;for(p=0,u[p]!==0&&(o[0]=1,++v),c=1;c<t;c++)u[p]!==u[p+1]&&(o[c]=u[p]?2:1,++v),p++;for(u[p]!==0&&(o[c]=2,++v),a=1;a<e;a++){p=a*h,d=a*r,u[p-h]!==u[p]&&(o[d]=u[p]?1:8,++v);let E=(u[p]?4:0)+(u[p-h]?8:0);for(c=1;c<t;c++)E=(E>>2)+(u[p+1]?4:0)+(u[p-h+1]?8:0),s[E]&&(o[d+c]=s[E],++v),p++;if(u[p-h]!==u[p]&&(o[d+c]=u[p]?2:4,++v),v>n)return null}for(p=h*(e-1),d=a*r,u[p]!==0&&(o[d]=8,++v),c=1;c<t;c++)u[p]!==u[p+1]&&(o[d+c]=u[p]?4:8,++v),p++;if(u[p]!==0&&(o[d+c]=4,++v),v>n)return null;const b=new Int32Array([0,r,-1,0,-r,0,0,0,1]),x=new Path2D;for(a=0;v&&a<=e;a++){let E=a*r;const R=E+t;for(;E<R&&!o[E];)E++;if(E===R)continue;x.moveTo(E%r,a);const k=E;let D=o[E];do{const F=b[D];do E+=F;while(!o[E]);const M=o[E];M!==5&&M!==10?(D=M,o[E]=0):(D=M&51*D>>4,o[E]&=D>>2|D<<2),x.lineTo(E%r,E/r|0),o[E]||--v}while(k!==E);--a}return u=null,o=null,function(E){E.save(),E.scale(1/t,-1/e),E.translate(0,-e),E.fill(x),E.beginPath(),E.restore()}}class Pv{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=Ey,this.textMatrixScale=1,this.fontMatrix=_g,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=Ee.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,e])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,n){[e,n]=et.applyTransform([e,n],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,n),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,n)}updateRectMinMax(t,e){const n=et.applyTransform(e,t),s=et.applyTransform(e.slice(2),t),r=et.applyTransform([e[0],e[3]],t),o=et.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,n[0],s[0],r[0],o[0]),this.minY=Math.min(this.minY,n[1],s[1],r[1],o[1]),this.maxX=Math.max(this.maxX,n[0],s[0],r[0],o[0]),this.maxY=Math.max(this.maxY,n[1],s[1],r[1],o[1])}updateScalingPathMinMax(t,e){et.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.minY=Math.min(this.minY,e[1]),this.maxX=Math.max(this.maxX,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,n,s,r,o,a,c,d,h){const u=et.bezierBoundingBox(e,n,s,r,o,a,c,d,h);h||this.updateRectMinMax(t,u)}getPathBoundingBox(t=Me.FILL,e=null){const n=[this.minX,this.minY,this.maxX,this.maxY];if(t===Me.STROKE){e||Mt("Stroke bounding box must include transform.");const s=et.singularValueDecompose2dScale(e),r=s[0]*this.lineWidth/2,o=s[1]*this.lineWidth/2;n[0]-=r,n[1]-=o,n[2]+=r,n[3]+=o}return n}updateClipFromPath(){const t=et.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t=Me.FILL,e=null){return et.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function Rv(i,t){if(typeof ImageData<"u"&&t instanceof ImageData){i.putImageData(t,0,0);return}const e=t.height,n=t.width,s=e%je,r=(e-s)/je,o=s===0?r:r+1,a=i.createImageData(n,je);let c=0,d;const h=t.data,u=a.data;let p,v,b,x;if(t.kind===_d.GRAYSCALE_1BPP){const _=h.byteLength,E=new Uint32Array(u.buffer,0,u.byteLength>>2),R=E.length,k=n+7>>3,D=4294967295,F=ze.isLittleEndian?4278190080:255;for(p=0;p<o;p++){for(b=p<r?je:s,d=0,v=0;v<b;v++){const M=_-c;let O=0;const C=M>k?n:M*8-7,P=C&-8;let $=0,N=0;for(;O<P;O+=8)N=h[c++],E[d++]=N&128?D:F,E[d++]=N&64?D:F,E[d++]=N&32?D:F,E[d++]=N&16?D:F,E[d++]=N&8?D:F,E[d++]=N&4?D:F,E[d++]=N&2?D:F,E[d++]=N&1?D:F;for(;O<C;O++)$===0&&(N=h[c++],$=128),E[d++]=N&$?D:F,$>>=1}for(;d<R;)E[d++]=0;i.putImageData(a,0,p*je)}}else if(t.kind===_d.RGBA_32BPP){for(v=0,x=n*je*4,p=0;p<r;p++)u.set(h.subarray(c,c+x)),c+=x,i.putImageData(a,0,v),v+=je;p<o&&(x=n*s*4,u.set(h.subarray(c,c+x)),i.putImageData(a,0,v))}else if(t.kind===_d.RGB_24BPP)for(b=je,x=n*b,p=0;p<o;p++){for(p>=r&&(b=s,x=n*b),d=0,v=x;v--;)u[d++]=h[c++],u[d++]=h[c++],u[d++]=h[c++],u[d++]=255;i.putImageData(a,0,p*je)}else throw new Error(`bad image kind: ${t.kind}`)}function kv(i,t){if(t.bitmap){i.drawImage(t.bitmap,0,0);return}const e=t.height,n=t.width,s=e%je,r=(e-s)/je,o=s===0?r:r+1,a=i.createImageData(n,je);let c=0;const d=t.data,h=a.data;for(let u=0;u<o;u++){const p=u<r?je:s;({srcPos:c}=Qk({src:d,srcPos:c,dest:h,width:n,height:p,nonBlackColor:0})),i.putImageData(a,0,u*je)}}function Za(i,t){const e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of e)i[n]!==void 0&&(t[n]=i[n]);i.setLineDash!==void 0&&(t.setLineDash(i.getLineDash()),t.lineDashOffset=i.lineDashOffset)}function ud(i){if(i.strokeStyle=i.fillStyle="#000000",i.fillRule="nonzero",i.globalAlpha=1,i.lineWidth=1,i.lineCap="butt",i.lineJoin="miter",i.miterLimit=10,i.globalCompositeOperation="source-over",i.font="10px sans-serif",i.setLineDash!==void 0&&(i.setLineDash([]),i.lineDashOffset=0),!Pe){const{filter:t}=i;t!=="none"&&t!==""&&(i.filter="none")}}function Lv(i,t){if(t)return!0;const e=et.singularValueDecompose2dScale(i);e[0]=Math.fround(e[0]),e[1]=Math.fround(e[1]);const n=Math.fround((globalThis.devicePixelRatio||1)*Es.PDF_TO_CSS_UNITS);return e[0]<=n&&e[1]<=n}const sL=["butt","round","square"],rL=["miter","round","bevel"],oL={},Iv={};var gc,em,mc,nm;const P0=class P0{constructor(t,e,n,s,r,{optionalContentConfig:o,markedContentStack:a=null},c,d){m(this,gc);m(this,mc);this.ctx=t,this.current=new Pv(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=n,this.canvasFactory=s,this.filterFactory=r,this.groupStack=[],this.processingType3=null,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=o,this.cachedCanvases=new nL(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=c,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=d,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,e=null){return typeof t=="string"?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing({transform:t,viewport:e,transparency:n=!1,background:s=null}){const r=this.ctx.canvas.width,o=this.ctx.canvas.height,a=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,r,o),this.ctx.fillStyle=a,n){const c=this.cachedCanvases.getCanvas("transparent",r,o);this.compositeCtx=this.ctx,this.transparentCanvas=c.canvas,this.ctx=c.context,this.ctx.save(),this.ctx.transform(...Gt(this.compositeCtx))}this.ctx.save(),ud(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=Gt(this.ctx)}executeOperatorList(t,e,n,s){const r=t.argsArray,o=t.fnArray;let a=e||0;const c=r.length;if(c===a)return a;const d=c-a>Cv&&typeof n=="function",h=d?Date.now()+tL:0;let u=0;const p=this.commonObjs,v=this.objs;let b;for(;;){if(s!==void 0&&a===s.nextBreakPoint)return s.breakIt(a,n),a;if(b=o[a],b!==fn.dependency)this[b].apply(this,r[a]);else for(const x of r[a]){const _=x.startsWith("g_")?p:v;if(!_.has(x))return _.get(x,n),a}if(a++,a===c)return a;if(d&&++u>Cv){if(Date.now()>h)return n(),a;u=0}}}endDrawing(){A(this,gc,em).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),A(this,mc,nm).call(this)}_scaleImage(t,e){const n=t.width,s=t.height;let r=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),a=n,c=s,d="prescale1",h,u;for(;r>2&&a>1||o>2&&c>1;){let p=a,v=c;r>2&&a>1&&(p=a>=16384?Math.floor(a/2)-1||1:Math.ceil(a/2),r/=a/p),o>2&&c>1&&(v=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,o/=c/v),h=this.cachedCanvases.getCanvas(d,p,v),u=h.context,u.clearRect(0,0,p,v),u.drawImage(t,0,0,a,c,0,0,p,v),t=h.canvas,a=p,c=v,d=d==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:a,paintHeight:c}}_createMaskCanvas(t){const e=this.ctx,{width:n,height:s}=t,r=this.current.fillColor,o=this.current.patternFill,a=Gt(e);let c,d,h,u;if((t.bitmap||t.data)&&t.count>1){const C=t.bitmap||t.data.buffer;d=JSON.stringify(o?a:[a.slice(0,4),r]),c=this._cachedBitmapsMap.get(C),c||(c=new Map,this._cachedBitmapsMap.set(C,c));const P=c.get(d);if(P&&!o){const $=Math.round(Math.min(a[0],a[2])+a[4]),N=Math.round(Math.min(a[1],a[3])+a[5]);return{canvas:P,offsetX:$,offsetY:N}}h=P}h||(u=this.cachedCanvases.getCanvas("maskCanvas",n,s),kv(u.context,t));let p=et.transform(a,[1/n,0,0,-1/s,0,0]);p=et.transform(p,[1,0,0,1,0,-s]);const[v,b,x,_]=et.getAxialAlignedBoundingBox([0,0,n,s],p),E=Math.round(x-v)||1,R=Math.round(_-b)||1,k=this.cachedCanvases.getCanvas("fillCanvas",E,R),D=k.context,F=v,M=b;D.translate(-F,-M),D.transform(...p),h||(h=this._scaleImage(u.canvas,si(D)),h=h.img,c&&o&&c.set(d,h)),D.imageSmoothingEnabled=Lv(Gt(D),t.interpolate),dd(D,h,0,0,h.width,h.height,0,0,n,s),D.globalCompositeOperation="source-in";const O=et.transform(si(D),[1,0,0,1,-F,-M]);return D.fillStyle=o?r.getPattern(e,this,O,Me.FILL):r,D.fillRect(0,0,n,s),c&&!o&&(this.cachedCanvases.delete("fillCanvas"),c.set(d,k.canvas)),{canvas:k.canvas,offsetX:Math.round(F),offsetY:Math.round(M)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=sL[t]}setLineJoin(t){this.ctx.lineJoin=rL[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const n=this.ctx;n.setLineDash!==void 0&&(n.setLineDash(t),n.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,n]of t)switch(e){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n[0],n[1]);break;case"CA":this.current.strokeAlpha=n;break;case"ca":this.current.fillAlpha=n,this.ctx.globalAlpha=n;break;case"BM":this.ctx.globalCompositeOperation=n;break;case"SMask":this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,e=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(n,t,e);this.suspendedCtx=this.ctx,this.ctx=s.context;const r=this.ctx;r.setTransform(...Gt(this.suspendedCtx)),Za(this.suspendedCtx,r),eL(r,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Za(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,n=this.suspendedCtx;this.composeSMask(n,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,n,s){const r=s[0],o=s[1],a=s[2]-r,c=s[3]-o;a===0||c===0||(this.genericComposeSMask(e.context,n,a,c,e.subtype,e.backdrop,e.transferMap,r,o,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(n.canvas,0,0),t.restore())}genericComposeSMask(t,e,n,s,r,o,a,c,d,h,u){let p=t.canvas,v=c-h,b=d-u;if(o){if(v<0||b<0||v+n>p.width||b+s>p.height){const _=this.cachedCanvases.getCanvas("maskExtension",n,s),E=_.context;E.drawImage(p,-v,-b),o.some(R=>R!==0)&&(E.globalCompositeOperation="destination-atop",E.fillStyle=et.makeHexColor(...o),E.fillRect(0,0,n,s),E.globalCompositeOperation="source-over"),p=_.canvas,v=b=0}else if(o.some(_=>_!==0)){t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const _=new Path2D;_.rect(v,b,n,s),t.clip(_),t.globalCompositeOperation="destination-atop",t.fillStyle=et.makeHexColor(...o),t.fillRect(v,b,n,s),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),r==="Alpha"&&a?e.filter=this.filterFactory.addAlphaFilter(a):r==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(a));const x=new Path2D;x.rect(c,d,n,s),e.clip(x),e.globalCompositeOperation="destination-in",e.drawImage(p,v,b,n,s,c,d,n,s),e.restore()}save(){this.inSMaskMode?(Za(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),Za(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,n,s,r,o){this.ctx.transform(t,e,n,s,r,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,n){const s=this.ctx,r=this.current;let o=r.x,a=r.y,c,d;const h=Gt(s),u=h[0]===0&&h[3]===0||h[1]===0&&h[2]===0,p=u?n.slice(0):null;for(let v=0,b=0,x=t.length;v<x;v++)switch(t[v]|0){case fn.rectangle:o=e[b++],a=e[b++];const _=e[b++],E=e[b++],R=o+_,k=a+E;s.moveTo(o,a),_===0||E===0?s.lineTo(R,k):(s.lineTo(R,a),s.lineTo(R,k),s.lineTo(o,k)),u||r.updateRectMinMax(h,[o,a,R,k]),s.closePath();break;case fn.moveTo:o=e[b++],a=e[b++],s.moveTo(o,a),u||r.updatePathMinMax(h,o,a);break;case fn.lineTo:o=e[b++],a=e[b++],s.lineTo(o,a),u||r.updatePathMinMax(h,o,a);break;case fn.curveTo:c=o,d=a,o=e[b+4],a=e[b+5],s.bezierCurveTo(e[b],e[b+1],e[b+2],e[b+3],o,a),r.updateCurvePathMinMax(h,c,d,e[b],e[b+1],e[b+2],e[b+3],o,a,p),b+=6;break;case fn.curveTo2:c=o,d=a,s.bezierCurveTo(o,a,e[b],e[b+1],e[b+2],e[b+3]),r.updateCurvePathMinMax(h,c,d,o,a,e[b],e[b+1],e[b+2],e[b+3],p),o=e[b+2],a=e[b+3],b+=4;break;case fn.curveTo3:c=o,d=a,o=e[b+2],a=e[b+3],s.bezierCurveTo(e[b],e[b+1],o,a,o,a),r.updateCurvePathMinMax(h,c,d,e[b],e[b+1],o,a,o,a,p),b+=4;break;case fn.closePath:s.closePath();break}u&&r.updateScalingPathMinMax(h,p),r.setCurrentPoint(o,a)}closePath(){this.ctx.closePath()}stroke(t=!0){const e=this.ctx,n=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof n=="object"&&(n!=null&&n.getPattern)?(e.save(),e.strokeStyle=n.getPattern(e,this,si(e),Me.STROKE),this.rescaleAndStroke(!1),e.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){const e=this.ctx,n=this.current.fillColor,s=this.current.patternFill;let r=!1;s&&(e.save(),e.fillStyle=n.getPattern(e,this,si(e),Me.FILL),r=!0);const o=this.current.getClippedPathBoundingBox();this.contentVisible&&o!==null&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),r&&e.restore(),t&&this.consumePath(o)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=oL}eoClip(){this.pendingClip=Iv}beginText(){this.current.textMatrix=Ey,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,e=this.ctx;if(t===void 0){e.beginPath();return}e.save(),e.beginPath();for(const n of t)e.setTransform(...n.transform),e.translate(n.x,n.y),n.addToPath(e,n.fontSize);e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){var h;const n=this.commonObjs.get(t),s=this.current;if(!n)throw new Error(`Can't find font for ${t}`);if(s.fontMatrix=n.fontMatrix||_g,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&yt("Invalid font matrix for font "+t),e<0?(e=-e,s.fontDirection=-1):s.fontDirection=1,this.current.font=n,this.current.fontSize=e,n.isType3Font)return;const r=n.loadedName||"sans-serif",o=((h=n.systemFontInfo)==null?void 0:h.css)||`"${r}", ${n.fallbackName}`;let a="normal";n.black?a="900":n.bold&&(a="bold");const c=n.italic?"italic":"normal";let d=e;e<_v?d=_v:e>Sv&&(d=Sv),this.current.fontSizeScale=e/d,this.ctx.font=`${c} ${a} ${d}px ${o}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,n,s,r,o){this.current.textMatrix=[t,e,n,s,r,o],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,n,s){const r=this.ctx,o=this.current,a=o.font,c=o.textRenderingMode,d=o.fontSize/o.fontSizeScale,h=c&Ee.FILL_STROKE_MASK,u=!!(c&Ee.ADD_TO_PATH_FLAG),p=o.patternFill&&!a.missingFile;let v;(a.disableFontFace||u||p)&&(v=a.getPathGenerator(this.commonObjs,t)),a.disableFontFace||p?(r.save(),r.translate(e,n),r.beginPath(),v(r,d),s&&r.setTransform(...s),(h===Ee.FILL||h===Ee.FILL_STROKE)&&r.fill(),(h===Ee.STROKE||h===Ee.FILL_STROKE)&&r.stroke(),r.restore()):((h===Ee.FILL||h===Ee.FILL_STROKE)&&r.fillText(t,e,n),(h===Ee.STROKE||h===Ee.FILL_STROKE)&&r.strokeText(t,e,n)),u&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Gt(r),x:e,y:n,fontSize:d,addToPath:v})}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 n=!1;for(let s=3;s<e.length;s+=4)if(e[s]>0&&e[s]<255){n=!0;break}return Tt(this,"isFontSubpixelAAEnabled",n)}showText(t){const e=this.current,n=e.font;if(n.isType3Font)return this.showType3Text(t);const s=e.fontSize;if(s===0)return;const r=this.ctx,o=e.fontSizeScale,a=e.charSpacing,c=e.wordSpacing,d=e.fontDirection,h=e.textHScale*d,u=t.length,p=n.vertical,v=p?1:-1,b=n.defaultVMetrics,x=s*e.fontMatrix[0],_=e.textRenderingMode===Ee.FILL&&!n.disableFontFace&&!e.patternFill;r.save(),r.transform(...e.textMatrix),r.translate(e.x,e.y+e.textRise),d>0?r.scale(h,-1):r.scale(h,1);let E;if(e.patternFill){r.save();const M=e.fillColor.getPattern(r,this,si(r),Me.FILL);E=Gt(r),r.restore(),r.fillStyle=M}let R=e.lineWidth;const k=e.textMatrixScale;if(k===0||R===0){const M=e.textRenderingMode&Ee.FILL_STROKE_MASK;(M===Ee.STROKE||M===Ee.FILL_STROKE)&&(R=this.getSinglePixelWidth())}else R/=k;if(o!==1&&(r.scale(o,o),R/=o),r.lineWidth=R,n.isInvalidPDFjsFont){const M=[];let O=0;for(const C of t)M.push(C.unicode),O+=C.width;r.fillText(M.join(""),0,0),e.x+=O*x*h,r.restore(),this.compose();return}let D=0,F;for(F=0;F<u;++F){const M=t[F];if(typeof M=="number"){D+=v*M*s/1e3;continue}let O=!1;const C=(M.isSpace?c:0)+a,P=M.fontChar,$=M.accent;let N,H,z=M.width;if(p){const Z=M.vmetric||b,Q=-(M.vmetric?Z[1]:z*.5)*x,j=Z[2]*x;z=Z?-Z[0]:z,N=Q/o,H=(D+j)/o}else N=D/o,H=0;if(n.remeasure&&z>0){const Z=r.measureText(P).width*1e3/s*o;if(z<Z&&this.isFontSubpixelAAEnabled){const Q=z/Z;O=!0,r.save(),r.scale(Q,1),N/=Q}else z!==Z&&(N+=(z-Z)/2e3*s/o)}if(this.contentVisible&&(M.isInFont||n.missingFile)){if(_&&!$)r.fillText(P,N,H);else if(this.paintChar(P,N,H,E),$){const Z=N+s*$.offset.x/o,Q=H-s*$.offset.y/o;this.paintChar($.fontChar,Z,Q,E)}}const V=p?z*x-C*d:z*x+C*d;D+=V,O&&r.restore()}p?e.y-=D:e.x+=D*h,r.restore(),this.compose()}showType3Text(t){const e=this.ctx,n=this.current,s=n.font,r=n.fontSize,o=n.fontDirection,a=s.vertical?1:-1,c=n.charSpacing,d=n.wordSpacing,h=n.textHScale*o,u=n.fontMatrix||_g,p=t.length,v=n.textRenderingMode===Ee.INVISIBLE;let b,x,_,E;if(!(v||r===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...n.textMatrix),e.translate(n.x,n.y),e.scale(h,o),b=0;b<p;++b){if(x=t[b],typeof x=="number"){E=a*x*r/1e3,this.ctx.translate(E,0),n.x+=E*h;continue}const R=(x.isSpace?d:0)+c,k=s.charProcOperatorList[x.operatorListId];if(!k){yt(`Type3 character "${x.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=x,this.save(),e.scale(r,r),e.transform(...u),this.executeOperatorList(k),this.restore()),_=et.applyTransform([x.width,0],u)[0]*r+R,e.translate(_,0),n.x+=_*h}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,n,s,r,o){this.ctx.rect(n,s,r-n,o-s),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if(t[0]==="TilingPattern"){const n=t[1],s=this.baseTransform||Gt(this.ctx),r={createCanvasGraphics:o=>new P0(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new tm(t,n,this.ctx,r,s)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,n){const s=et.makeHexColor(t,e,n);this.ctx.strokeStyle=s,this.current.strokeColor=s}setFillRGBColor(t,e,n){const s=et.makeHexColor(t,e,n);this.ctx.fillStyle=s,this.current.fillColor=s,this.current.patternFill=!1}_getPattern(t,e=null){let n;return this.cachedPatterns.has(t)?n=this.cachedPatterns.get(t):(n=Jk(this.getObject(t)),this.cachedPatterns.set(t,n)),e&&(n.matrix=e),n}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const n=this._getPattern(t);e.fillStyle=n.getPattern(e,this,si(e),Me.SHADING);const s=si(e);if(s){const{width:r,height:o}=e.canvas,[a,c,d,h]=et.getAxialAlignedBoundingBox([0,0,r,o],s);this.ctx.fillRect(a,c,d-a,h-c)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Mt("Should not call beginInlineImage")}beginImageData(){Mt("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=Gt(this.ctx),e)){const n=e[2]-e[0],s=e[3]-e[1];this.ctx.rect(e[0],e[1],n,s),this.current.updateRectMinMax(Gt(this.ctx),e),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const e=this.ctx;t.isolated||hp("TODO: Support non-isolated groups."),t.knockout&&yt("Knockout groups not supported.");const n=Gt(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let s=et.getAxialAlignedBoundingBox(t.bbox,Gt(e));const r=[0,0,e.canvas.width,e.canvas.height];s=et.intersect(s,r)||[0,0,0,0];const o=Math.floor(s[0]),a=Math.floor(s[1]),c=Math.max(Math.ceil(s[2])-o,1),d=Math.max(Math.ceil(s[3])-a,1);this.current.startNewPathAndClipBox([0,0,c,d]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(h,c,d),p=u.context;p.translate(-o,-a),p.transform(...n),t.smask?this.smaskStack.push({canvas:u.canvas,context:p,offsetX:o,offsetY:a,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(o,a),e.save()),Za(e,p),this.ctx=p,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const e=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const s=Gt(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...s);const r=et.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],s);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(r)}}beginAnnotation(t,e,n,s,r){if(A(this,gc,em).call(this),ud(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const o=e[2]-e[0],a=e[3]-e[1];if(r&&this.annotationCanvasMap){n=n.slice(),n[4]-=e[0],n[5]-=e[1],e=e.slice(),e[0]=e[1]=0,e[2]=o,e[3]=a;const[c,d]=et.singularValueDecompose2dScale(Gt(this.ctx)),{viewportScale:h}=this,u=Math.ceil(o*this.outputScaleX*h),p=Math.ceil(a*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(u,p);const{canvas:v,context:b}=this.annotationCanvas;this.annotationCanvasMap.set(t,v),this.annotationCanvas.savedCtx=this.ctx,this.ctx=b,this.ctx.save(),this.ctx.setTransform(c,0,0,-d,0,a*d),ud(this.ctx)}else ud(this.ctx),this.ctx.rect(e[0],e[1],o,a),this.ctx.clip(),this.endPath()}this.current=new Pv(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),A(this,mc,nm).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const e=t.count;t=this.getObject(t.data,t),t.count=e;const n=this.ctx,s=this.processingType3;if(s&&(s.compiled===void 0&&(s.compiled=iL(t)),s.compiled)){s.compiled(n);return}const r=this._createMaskCanvas(t),o=r.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(o,r.offsetX,r.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,n=0,s=0,r,o){if(!this.contentVisible)return;t=this.getObject(t.data,t);const a=this.ctx;a.save();const c=Gt(a);a.transform(e,n,s,r,0,0);const d=this._createMaskCanvas(t);a.setTransform(1,0,0,1,d.offsetX-c[4],d.offsetY-c[5]);for(let h=0,u=o.length;h<u;h+=2){const p=et.transform(c,[e,n,s,r,o[h],o[h+1]]),[v,b]=et.applyTransform([0,0],p);a.drawImage(d.canvas,v,b)}a.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,n=this.current.fillColor,s=this.current.patternFill;for(const r of t){const{data:o,width:a,height:c,transform:d}=r,h=this.cachedCanvases.getCanvas("maskCanvas",a,c),u=h.context;u.save();const p=this.getObject(o,r);kv(u,p),u.globalCompositeOperation="source-in",u.fillStyle=s?n.getPattern(u,this,si(e),Me.FILL):n,u.fillRect(0,0,a,c),u.restore(),e.save(),e.transform(...d),e.scale(1,-1),dd(e,h.canvas,0,0,a,c,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);if(!e){yt("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e)}paintImageXObjectRepeat(t,e,n,s){if(!this.contentVisible)return;const r=this.getObject(t);if(!r){yt("Dependent image isn't ready yet");return}const o=r.width,a=r.height,c=[];for(let d=0,h=s.length;d<h;d+=2)c.push({transform:[e,0,0,n,s[d],s[d+1]],x:0,y:0,w:o,h:a});this.paintInlineImageXObjectGroup(r,c)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return t.bitmap;const{bitmap:e,width:n,height:s}=t,r=this.cachedCanvases.getCanvas("inlineImage",n,s),o=r.context;return o.filter=this.current.transferMaps,o.drawImage(e,0,0),o.filter="none",r.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,n=t.height,s=this.ctx;if(this.save(),!Pe){const{filter:a}=s;a!=="none"&&a!==""&&(s.filter="none")}s.scale(1/e,-1/n);let r;if(t.bitmap)r=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)r=t;else{const c=this.cachedCanvases.getCanvas("inlineImage",e,n).context;Rv(c,t),r=this.applyTransferMapsToCanvas(c)}const o=this._scaleImage(r,si(s));s.imageSmoothingEnabled=Lv(Gt(s),t.interpolate),dd(s,o.img,0,0,o.paintWidth,o.paintHeight,0,-n,e,n),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const n=this.ctx;let s;if(t.bitmap)s=t.bitmap;else{const r=t.width,o=t.height,c=this.cachedCanvases.getCanvas("inlineImage",r,o).context;Rv(c,t),s=this.applyTransferMapsToCanvas(c)}for(const r of e)n.save(),n.transform(...r.transform),n.scale(1,-1),dd(n,s,r.x,r.y,r.w,r.h,0,-1,1,1),n.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const n=this.ctx;this.pendingClip&&(e||(this.pendingClip===Iv?n.clip("evenodd"):n.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),n.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=Gt(this.ctx);if(t[1]===0&&t[2]===0)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]),n=Math.hypot(t[0],t[2]),s=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(n,s)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:e,b:n,c:s,d:r}=this.ctx.getTransform();let o,a;if(n===0&&s===0){const c=Math.abs(e),d=Math.abs(r);if(c===d)if(t===0)o=a=1/c;else{const h=c*t;o=a=h<1?1/h:1}else if(t===0)o=1/c,a=1/d;else{const h=c*t,u=d*t;o=h<1?1/h:1,a=u<1?1/u:1}}else{const c=Math.abs(e*r-n*s),d=Math.hypot(e,n),h=Math.hypot(s,r);if(t===0)o=h/c,a=d/c;else{const u=t*c;o=h>u?h/u:1,a=d>u?d/u:1}}this._cachedScaleForStroking[0]=o,this._cachedScaleForStroking[1]=a}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:n}=this.current,[s,r]=this.getScaleForStroking();if(e.lineWidth=n||1,s===1&&r===1){e.stroke();return}const o=e.getLineDash();if(t&&e.save(),e.scale(s,r),o.length>0){const a=Math.max(s,r);e.setLineDash(o.map(c=>c/a)),e.lineDashOffset/=a}e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};gc=new WeakSet,em=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();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)},mc=new WeakSet,nm=function(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}};let Ao=P0;for(const i in fn)Ao.prototype[i]!==void 0&&(Ao.prototype[fn[i]]=Ao.prototype[i]);var vc,bc;class ji{static get workerPort(){return l(this,vc)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");w(this,vc,t)}static get workerSrc(){return l(this,bc)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");w(this,bc,t)}}vc=new WeakMap,bc=new WeakMap,m(ji,vc,null),m(ji,bc,"");const fd={UNKNOWN:0,DATA:1,ERROR:2},te={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function We(i){switch(i instanceof Error||typeof i=="object"&&i!==null||Mt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),i.name){case"AbortException":return new ro(i.message);case"MissingPDFException":return new so(i.message);case"PasswordException":return new Cg(i.message,i.code);case"UnexpectedResponseException":return new dp(i.message,i.status);case"UnknownErrorException":return new Tg(i.message,i.details);default:return new Tg(i.message,i.toString())}}var Vu,sw,Wu,rw,Ho,kd;class ol{constructor(t,e,n){m(this,Vu);m(this,Wu);m(this,Ho);this.sourceName=t,this.targetName=e,this.comObj=n,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),this._onComObjOnMessage=s=>{const r=s.data;if(r.targetName!==this.sourceName)return;if(r.stream){A(this,Wu,rw).call(this,r);return}if(r.callback){const a=r.callbackId,c=this.callbackCapabilities[a];if(!c)throw new Error(`Cannot resolve callback ${a}`);if(delete this.callbackCapabilities[a],r.callback===fd.DATA)c.resolve(r.data);else if(r.callback===fd.ERROR)c.reject(We(r.reason));else throw new Error("Unexpected callback case");return}const o=this.actionHandler[r.action];if(!o)throw new Error(`Unknown action from worker: ${r.action}`);if(r.callbackId){const a=this.sourceName,c=r.sourceName;new Promise(function(d){d(o(r.data))}).then(function(d){n.postMessage({sourceName:a,targetName:c,callback:fd.DATA,callbackId:r.callbackId,data:d})},function(d){n.postMessage({sourceName:a,targetName:c,callback:fd.ERROR,callbackId:r.callbackId,reason:We(d)})});return}if(r.streamId){A(this,Vu,sw).call(this,r);return}o(r.data)},n.addEventListener("message",this._onComObjOnMessage)}on(t,e){const n=this.actionHandler;if(n[t])throw new Error(`There is already an actionName called "${t}"`);n[t]=e}send(t,e,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},n)}sendWithPromise(t,e,n){const s=this.callbackId++,r=Promise.withResolvers();this.callbackCapabilities[s]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},n)}catch(o){r.reject(o)}return r.promise}sendWithStream(t,e,n,s){const r=this.streamId++,o=this.sourceName,a=this.targetName,c=this.comObj;return new ReadableStream({start:d=>{const h=Promise.withResolvers();return this.streamControllers[r]={controller:d,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:o,targetName:a,action:t,streamId:r,data:e,desiredSize:d.desiredSize},s),h.promise},pull:d=>{const h=Promise.withResolvers();return this.streamControllers[r].pullCall=h,c.postMessage({sourceName:o,targetName:a,stream:te.PULL,streamId:r,desiredSize:d.desiredSize}),h.promise},cancel:d=>{ae(d instanceof Error,"cancel must have a valid reason");const h=Promise.withResolvers();return this.streamControllers[r].cancelCall=h,this.streamControllers[r].isClosed=!0,c.postMessage({sourceName:o,targetName:a,stream:te.CANCEL,streamId:r,reason:We(d)}),h.promise}},n)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}Vu=new WeakSet,sw=function(t){const e=t.streamId,n=this.sourceName,s=t.sourceName,r=this.comObj,o=this,a=this.actionHandler[t.action],c={enqueue(d,h=1,u){if(this.isCancelled)return;const p=this.desiredSize;this.desiredSize-=h,p>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),r.postMessage({sourceName:n,targetName:s,stream:te.ENQUEUE,streamId:e,chunk:d},u)},close(){this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:n,targetName:s,stream:te.CLOSE,streamId:e}),delete o.streamSinks[e])},error(d){ae(d instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,r.postMessage({sourceName:n,targetName:s,stream:te.ERROR,streamId:e,reason:We(d)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[e]=c,new Promise(function(d){d(a(t.data,c))}).then(function(){r.postMessage({sourceName:n,targetName:s,stream:te.START_COMPLETE,streamId:e,success:!0})},function(d){r.postMessage({sourceName:n,targetName:s,stream:te.START_COMPLETE,streamId:e,reason:We(d)})})},Wu=new WeakSet,rw=function(t){const e=t.streamId,n=this.sourceName,s=t.sourceName,r=this.comObj,o=this.streamControllers[e],a=this.streamSinks[e];switch(t.stream){case te.START_COMPLETE:t.success?o.startCall.resolve():o.startCall.reject(We(t.reason));break;case te.PULL_COMPLETE:t.success?o.pullCall.resolve():o.pullCall.reject(We(t.reason));break;case te.PULL:if(!a){r.postMessage({sourceName:n,targetName:s,stream:te.PULL_COMPLETE,streamId:e,success:!0});break}a.desiredSize<=0&&t.desiredSize>0&&a.sinkCapability.resolve(),a.desiredSize=t.desiredSize,new Promise(function(c){var d;c((d=a.onPull)==null?void 0:d.call(a))}).then(function(){r.postMessage({sourceName:n,targetName:s,stream:te.PULL_COMPLETE,streamId:e,success:!0})},function(c){r.postMessage({sourceName:n,targetName:s,stream:te.PULL_COMPLETE,streamId:e,reason:We(c)})});break;case te.ENQUEUE:if(ae(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(t.chunk);break;case te.CLOSE:if(ae(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),A(this,Ho,kd).call(this,o,e);break;case te.ERROR:ae(o,"error should have stream controller"),o.controller.error(We(t.reason)),A(this,Ho,kd).call(this,o,e);break;case te.CANCEL_COMPLETE:t.success?o.cancelCall.resolve():o.cancelCall.reject(We(t.reason)),A(this,Ho,kd).call(this,o,e);break;case te.CANCEL:if(!a)break;new Promise(function(c){var d;c((d=a.onCancel)==null?void 0:d.call(a,We(t.reason)))}).then(function(){r.postMessage({sourceName:n,targetName:s,stream:te.CANCEL_COMPLETE,streamId:e,success:!0})},function(c){r.postMessage({sourceName:n,targetName:s,stream:te.CANCEL_COMPLETE,streamId:e,reason:We(c)})}),a.sinkCapability.reject(We(t.reason)),a.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},Ho=new WeakSet,kd=async function(t,e){var n,s,r;await Promise.allSettled([(n=t.startCall)==null?void 0:n.promise,(s=t.pullCall)==null?void 0:s.promise,(r=t.cancelCall)==null?void 0:r.promise]),delete this.streamControllers[e]};var rr,yc;class aL{constructor({parsedData:t,rawData:e}){m(this,rr,void 0);m(this,yc,void 0);w(this,rr,t),w(this,yc,e)}getRaw(){return l(this,yc)}get(t){return l(this,rr).get(t)??null}getAll(){return d0(l(this,rr))}has(t){return l(this,rr).has(t)}}rr=new WeakMap,yc=new WeakMap;const qi=Symbol("INTERNAL");var wc,Ac,xc,zo;class lL{constructor(t,{name:e,intent:n,usage:s}){m(this,wc,!1);m(this,Ac,!1);m(this,xc,!1);m(this,zo,!0);w(this,wc,!!(t&hn.DISPLAY)),w(this,Ac,!!(t&hn.PRINT)),this.name=e,this.intent=n,this.usage=s}get visible(){if(l(this,xc))return l(this,zo);if(!l(this,zo))return!1;const{print:t,view:e}=this.usage;return l(this,wc)?(e==null?void 0:e.viewState)!=="OFF":l(this,Ac)?(t==null?void 0:t.printState)!=="OFF":!0}_setVisible(t,e,n=!1){t!==qi&&Mt("Internal method `_setVisible` called."),w(this,xc,n),w(this,zo,e)}}wc=new WeakMap,Ac=new WeakMap,xc=new WeakMap,zo=new WeakMap;var rs,Ft,Go,Vo,Ec,im;class cL{constructor(t,e=hn.DISPLAY){m(this,Ec);m(this,rs,null);m(this,Ft,new Map);m(this,Go,null);m(this,Vo,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,w(this,Vo,t.order);for(const n of t.groups)l(this,Ft).set(n.id,new lL(e,n));if(t.baseState==="OFF")for(const n of l(this,Ft).values())n._setVisible(qi,!1);for(const n of t.on)l(this,Ft).get(n)._setVisible(qi,!0);for(const n of t.off)l(this,Ft).get(n)._setVisible(qi,!1);w(this,Go,this.getHash())}}isVisible(t){if(l(this,Ft).size===0)return!0;if(!t)return hp("Optional content group not defined."),!0;if(t.type==="OCG")return l(this,Ft).has(t.id)?l(this,Ft).get(t.id).visible:(yt(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return A(this,Ec,im).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const e of t.ids){if(!l(this,Ft).has(e))return yt(`Optional content group not found: ${e}`),!0;if(l(this,Ft).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const e of t.ids){if(!l(this,Ft).has(e))return yt(`Optional content group not found: ${e}`),!0;if(!l(this,Ft).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const e of t.ids){if(!l(this,Ft).has(e))return yt(`Optional content group not found: ${e}`),!0;if(!l(this,Ft).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const e of t.ids){if(!l(this,Ft).has(e))return yt(`Optional content group not found: ${e}`),!0;if(l(this,Ft).get(e).visible)return!1}return!0}return yt(`Unknown optional content policy ${t.policy}.`),!0}return yt(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0){const n=l(this,Ft).get(t);if(!n){yt(`Optional content group not found: ${t}`);return}n._setVisible(qi,!!e,!0),w(this,rs,null)}setOCGState({state:t,preserveRB:e}){let n;for(const s of t){switch(s){case"ON":case"OFF":case"Toggle":n=s;continue}const r=l(this,Ft).get(s);if(r)switch(n){case"ON":r._setVisible(qi,!0);break;case"OFF":r._setVisible(qi,!1);break;case"Toggle":r._setVisible(qi,!r.visible);break}}w(this,rs,null)}get hasInitialVisibility(){return l(this,Go)===null||this.getHash()===l(this,Go)}getOrder(){return l(this,Ft).size?l(this,Vo)?l(this,Vo).slice():[...l(this,Ft).keys()]:null}getGroups(){return l(this,Ft).size>0?d0(l(this,Ft)):null}getGroup(t){return l(this,Ft).get(t)||null}getHash(){if(l(this,rs)!==null)return l(this,rs);const t=new tw;for(const[e,n]of l(this,Ft))t.update(`${e}:${n.visible}`);return w(this,rs,t.hexdigest())}}rs=new WeakMap,Ft=new WeakMap,Go=new WeakMap,Vo=new WeakMap,Ec=new WeakSet,im=function(t){const e=t.length;if(e<2)return!0;const n=t[0];for(let s=1;s<e;s++){const r=t[s];let o;if(Array.isArray(r))o=A(this,Ec,im).call(this,r);else if(l(this,Ft).has(r))o=l(this,Ft).get(r).visible;else return yt(`Optional content group not found: ${r}`),!0;switch(n){case"And":if(!o)return!1;break;case"Or":if(o)return!0;break;case"Not":return!o;default:return!0}}return n==="And"};class hL{constructor(t,{disableRange:e=!1,disableStream:n=!1}){ae(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:s,initialData:r,progressiveDone:o,contentDispositionFilename:a}=t;if(this._queuedChunks=[],this._progressiveDone=o,this._contentDispositionFilename=a,(r==null?void 0:r.length)>0){const c=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;this._queuedChunks.push(c)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!n,this._isRangeSupported=!e,this._contentLength=s,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((c,d)=>{this._onReceiveData({begin:c,chunk:d})}),t.addProgressListener((c,d)=>{this._onProgress({loaded:c,total:d})}),t.addProgressiveReadListener(c=>{this._onReceiveData({chunk:c})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:e}){const n=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{const s=this._rangeReaders.some(function(r){return r._begin!==t?!1:(r._enqueue(n),!0)});ae(s,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}_onProgress(t){var e,n,s,r;t.total===void 0?(n=(e=this._rangeReaders[0])==null?void 0:e.onProgress)==null||n.call(e,{loaded:t.loaded}):(r=(s=this._fullRequestReader)==null?void 0:s.onProgress)==null||r.call(s,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;(t=this._fullRequestReader)==null||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){ae(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new dL(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const n=new uL(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(n),n}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const n of this._rangeReaders.slice(0))n.cancel(t);this._pdfDataRangeTransport.abort()}}class dL{constructor(t,e,n=!1,s=null){this._stream=t,this._done=n||!1,this._filename=m0(s)?s:null,this._queuedChunks=e||[],this._loaded=0;for(const r of this._queuedChunks)this._loaded+=r.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}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 e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class uL{constructor(t,e,n){this._stream=t,this._begin=e,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length===0)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,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 e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function fL(i){let t=!0,e=n("filename\\*","i").exec(i);if(e){e=e[1];let h=a(e);return h=unescape(h),h=c(h),h=d(h),r(h)}if(e=o(i),e){const h=d(e);return r(h)}if(e=n("filename","i").exec(i),e){e=e[1];let h=a(e);return h=d(h),r(h)}function n(h,u){return new RegExp("(?:^|;)\\s*"+h+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',u)}function s(h,u){if(h){if(!/^[\x00-\xFF]+$/.test(u))return u;try{const p=new TextDecoder(h,{fatal:!0}),v=up(u);u=p.decode(v),t=!1}catch{}}return u}function r(h){return t&&/[\x80-\xff]/.test(h)&&(h=s("utf-8",h),t&&(h=s("iso-8859-1",h))),h}function o(h){const u=[];let p;const v=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(p=v.exec(h))!==null;){let[,x,_,E]=p;if(x=parseInt(x,10),x in u){if(x===0)break;continue}u[x]=[_,E]}const b=[];for(let x=0;x<u.length&&x in u;++x){let[_,E]=u[x];E=a(E),_&&(E=unescape(E),x===0&&(E=c(E))),b.push(E)}return b.join("")}function a(h){if(h.startsWith('"')){const u=h.slice(1).split('\\"');for(let p=0;p<u.length;++p){const v=u[p].indexOf('"');v!==-1&&(u[p]=u[p].slice(0,v),u.length=p+1),u[p]=u[p].replaceAll(/\\(.)/g,"$1")}h=u.join('"')}return h}function c(h){const u=h.indexOf("'");if(u===-1)return h;const p=h.slice(0,u),b=h.slice(u+1).replace(/^[^']*'/,"");return s(p,b)}function d(h){return!h.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(h)?h:h.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(u,p,v,b){if(v==="q"||v==="Q")return b=b.replaceAll("_"," "),b=b.replaceAll(/=([0-9a-fA-F]{2})/g,function(x,_){return String.fromCharCode(parseInt(_,16))}),s(p,b);try{b=atob(b)}catch{}return s(p,b)})}return""}function y0({getResponseHeader:i,isHttp:t,rangeChunkSize:e,disableRange:n}){const s={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(i("Content-Length"),10);return!Number.isInteger(r)||(s.suggestedLength=r,r<=2*e)||n||!t||i("Accept-Ranges")!=="bytes"||(i("Content-Encoding")||"identity")!=="identity"||(s.allowRangeRequests=!0),s}function w0(i){const t=i("Content-Disposition");if(t){let e=fL(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(m0(e))return e}return null}function bp(i,t){return i===404||i===0&&t.startsWith("file:")?new so('Missing PDF "'+t+'".'):new dp(`Unexpected server response (${i}) while retrieving PDF "${t}".`,i)}function ow(i){return i===200||i===206}function aw(i,t,e){return{method:"GET",headers:i,signal:e.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function lw(i){const t=new Headers;for(const e in i){const n=i[e];n!==void 0&&t.append(e,n)}return t}function cw(i){return i instanceof Uint8Array?i.buffer:i instanceof ArrayBuffer?i:(yt(`getArrayBuffer - unexpected data format: ${i}`),new Uint8Array(i).buffer)}class Dv{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}getFullReader(){return ae(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new pL(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const n=new gL(this,t,e);return this._rangeRequestReaders.push(n),n}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const n of this._rangeRequestReaders.slice(0))n.cancel(t)}}class pL{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._headers=lw(this._stream.httpHeaders);const n=e.url;fetch(n,aw(this._headers,this._withCredentials,this._abortController)).then(s=>{if(!ow(s.status))throw bp(s.status,n);this._reader=s.body.getReader(),this._headersCapability.resolve();const r=c=>s.headers.get(c),{allowRangeRequests:o,suggestedLength:a}=y0({getResponseHeader:r,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=a||this._contentLength,this._filename=w0(r),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new ro("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}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(){var n;await this._headersCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded,total:this._contentLength}),{value:cw(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}class gL{constructor(t,e,n){this._stream=t,this._reader=null,this._loaded=0;const s=t.source;this._withCredentials=s.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController,this._headers=lw(this._stream.httpHeaders),this._headers.append("Range",`bytes=${e}-${n-1}`);const r=s.url;fetch(r,aw(this._headers,this._withCredentials,this._abortController)).then(o=>{if(!ow(o.status))throw bp(o.status,r);this._readCapability.resolve(),this._reader=o.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var n;await this._readCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded}),{value:cw(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}const eg=200,ng=206;function mL(i){const t=i.response;return typeof t!="string"?t:up(t).buffer}class vL{constructor(t,e={}){this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&e.httpHeaders||Object.create(null),this.withCredentials=e.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,n){const s={begin:t,end:e};for(const r in n)s[r]=n[r];return this.request(s)}requestFull(t){return this.request(t)}request(t){const e=new XMLHttpRequest,n=this.currXhrId++,s=this.pendingRequests[n]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const r in this.httpHeaders){const o=this.httpHeaders[r];o!==void 0&&e.setRequestHeader(r,o)}return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),s.expectedStatus=ng):s.expectedStatus=eg,e.responseType="arraybuffer",t.onError&&(e.onerror=function(r){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,n),e.onprogress=this.onProgress.bind(this,n),s.onHeadersReceived=t.onHeadersReceived,s.onDone=t.onDone,s.onError=t.onError,s.onProgress=t.onProgress,e.send(null),n}onProgress(t,e){var s;const n=this.pendingRequests[t];n&&((s=n.onProgress)==null||s.call(n,e))}onStateChange(t,e){var c,d,h;const n=this.pendingRequests[t];if(!n)return;const s=n.xhr;if(s.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),s.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],s.status===0&&this.isHttp){(c=n.onError)==null||c.call(n,s.status);return}const r=s.status||eg;if(!(r===eg&&n.expectedStatus===ng)&&r!==n.expectedStatus){(d=n.onError)==null||d.call(n,s.status);return}const a=mL(s);if(r===ng){const u=s.getResponseHeader("Content-Range"),p=/bytes (\d+)-(\d+)\/(\d+)/.exec(u);n.onDone({begin:parseInt(p[1],10),chunk:a})}else a?n.onDone({begin:0,chunk:a}):(h=n.onError)==null||h.call(n,s.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class bL{constructor(t){this._source=t,this._manager=new vL(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return ae(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new yL(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const n=new wL(this._manager,t,e);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const n of this._rangeRequestReaders.slice(0))n.cancel(t)}}class yL{constructor(t,e){this._manager=t;const n={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(n),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t),n=o=>e.getResponseHeader(o),{allowRangeRequests:s,suggestedLength:r}=y0({getResponseHeader:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=r||this._contentLength,this._filename=w0(n),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=bp(t,this._url),this._headersReceivedCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;(e=this.onProgress)==null||e.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersReceivedCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class wL{constructor(t,e,n){this._manager=t;const s={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,n,s),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var t;(t=this.onClosed)==null||t.call(this,this)}_onDone(t){const e=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0;for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=bp(t,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||(e=this.onProgress)==null||e.call(this,{loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,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 e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const hw=/^file:\/\/\/[a-zA-Z]:\//;function AL(i){const t=Qn.get("url"),e=t.parse(i);return e.protocol==="file:"||e.host?e:/^[a-z]:[/\\]/i.test(i)?t.parse(`file:///${i}`):(e.host||(e.protocol="file:"),e)}class xL{constructor(t){this.source=t,this.url=AL(t.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}getFullReader(){return ae(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new SL(this):new EL(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const n=this.isFsUrl?new CL(this,t,e):new _L(this,t,e);return this._rangeRequestReaders.push(n),n}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const n of this._rangeRequestReaders.slice(0))n.cancel(t)}}class dw{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}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(){var n;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new ro("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class uw{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const e=t.source;this._isStreamingSupported=!e.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var n;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(n=this.onProgress)==null||n.call(this,{loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function ou(i,t){return{protocol:i.protocol,auth:i.auth,host:i.hostname,port:i.port,path:i.path,method:"GET",headers:t}}class EL extends dw{constructor(t){super(t);const e=n=>{if(n.statusCode===404){const a=new so(`Missing PDF "${this._url}".`);this._storedError=a,this._headersCapability.reject(a);return}this._headersCapability.resolve(),this._setReadableStream(n);const s=a=>this._readableStream.headers[a.toLowerCase()],{allowRangeRequests:r,suggestedLength:o}=y0({getResponseHeader:s,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=o||this._contentLength,this._filename=w0(s)};if(this._request=null,this._url.protocol==="http:"){const n=Qn.get("http");this._request=n.request(ou(this._url,t.httpHeaders),e)}else{const n=Qn.get("https");this._request=n.request(ou(this._url,t.httpHeaders),e)}this._request.on("error",n=>{this._storedError=n,this._headersCapability.reject(n)}),this._request.end()}}class _L extends uw{constructor(t,e,n){super(t),this._httpHeaders={};for(const r in t.httpHeaders){const o=t.httpHeaders[r];o!==void 0&&(this._httpHeaders[r]=o)}this._httpHeaders.Range=`bytes=${e}-${n-1}`;const s=r=>{if(r.statusCode===404){const o=new so(`Missing PDF "${this._url}".`);this._storedError=o;return}this._setReadableStream(r)};if(this._request=null,this._url.protocol==="http:"){const r=Qn.get("http");this._request=r.request(ou(this._url,this._httpHeaders),s)}else{const r=Qn.get("https");this._request=r.request(ou(this._url,this._httpHeaders),s)}this._request.on("error",r=>{this._storedError=r}),this._request.end()}}class SL extends dw{constructor(t){super(t);let e=decodeURIComponent(this._url.path);hw.test(this._url.href)&&(e=e.replace(/^\//,""));const n=Qn.get("fs");n.promises.lstat(e).then(s=>{this._contentLength=s.size,this._setReadableStream(n.createReadStream(e)),this._headersCapability.resolve()},s=>{s.code==="ENOENT"&&(s=new so(`Missing PDF "${e}".`)),this._storedError=s,this._headersCapability.reject(s)})}}class CL extends uw{constructor(t,e,n){super(t);let s=decodeURIComponent(this._url.path);hw.test(this._url.href)&&(s=s.replace(/^\//,""));const r=Qn.get("fs");this._setReadableStream(r.createReadStream(s,{start:e,end:n-1}))}}const TL=1e5,Ne=30,PL=.8;var Jv,os,Be,_c,Sc,or,wi,Cc,Tc,ar,Wo,qo,as,Xo,Pc,Yo,lr,Rc,kc,Ue,cr,hr,Ko,qu,fw,Xu,pw,Lc,sm,Zo,Ld,Yu,gw;let au=(Ue=class{constructor({textContentSource:t,container:e,viewport:n}){m(this,qu);m(this,Xu);m(this,Lc);m(this,os,Promise.withResolvers());m(this,Be,null);m(this,_c,!1);m(this,Sc,!!((Jv=globalThis.FontInspector)!=null&&Jv.enabled));m(this,or,null);m(this,wi,null);m(this,Cc,0);m(this,Tc,0);m(this,ar,null);m(this,Wo,null);m(this,qo,0);m(this,as,0);m(this,Xo,Object.create(null));m(this,Pc,[]);m(this,Yo,null);m(this,lr,[]);m(this,Rc,new WeakMap);m(this,kc,null);if(t instanceof ReadableStream)w(this,Yo,t);else if(typeof t=="object")w(this,Yo,new ReadableStream({start(c){c.enqueue(t),c.close()}}));else throw new Error('No "textContentSource" parameter specified.');w(this,Be,w(this,Wo,e)),w(this,as,n.scale*(globalThis.devicePixelRatio||1)),w(this,qo,n.rotation),w(this,wi,{prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:null});const{pageWidth:s,pageHeight:r,pageX:o,pageY:a}=n.rawDims;w(this,kc,[1,0,0,-1,-o,a+r]),w(this,Tc,s),w(this,Cc,r),Zr(e,n),l(this,os).promise.catch(()=>{}).then(()=>{l(Ue,Ko).delete(this),w(this,wi,null),w(this,Xo,null)})}render(){const t=()=>{l(this,ar).read().then(({value:e,done:n})=>{if(n){l(this,os).resolve();return}l(this,or)??w(this,or,e.lang),Object.assign(l(this,Xo),e.styles),A(this,qu,fw).call(this,e.items),t()},l(this,os).reject)};return w(this,ar,l(this,Yo).getReader()),l(Ue,Ko).add(this),t(),l(this,os).promise}update({viewport:t,onBefore:e=null}){var r;const n=t.scale*(globalThis.devicePixelRatio||1),s=t.rotation;if(s!==l(this,qo)&&(e==null||e(),w(this,qo,s),Zr(l(this,Wo),{rotation:s})),n!==l(this,as)){e==null||e(),w(this,as,n);const o={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:A(r=Ue,Zo,Ld).call(r,l(this,or))};for(const a of l(this,lr))o.properties=l(this,Rc).get(a),o.div=a,A(this,Lc,sm).call(this,o)}}cancel(){var e;const t=new ro("TextLayer task cancelled.");(e=l(this,ar))==null||e.cancel(t).catch(()=>{}),w(this,ar,null),l(this,os).reject(t)}get textDivs(){return l(this,lr)}get textContentItemsStr(){return l(this,Pc)}static cleanup(){if(!(l(this,Ko).size>0)){l(this,cr).clear();for(const{canvas:t}of l(this,hr).values())t.remove();l(this,hr).clear()}}},os=new WeakMap,Be=new WeakMap,_c=new WeakMap,Sc=new WeakMap,or=new WeakMap,wi=new WeakMap,Cc=new WeakMap,Tc=new WeakMap,ar=new WeakMap,Wo=new WeakMap,qo=new WeakMap,as=new WeakMap,Xo=new WeakMap,Pc=new WeakMap,Yo=new WeakMap,lr=new WeakMap,Rc=new WeakMap,kc=new WeakMap,cr=new WeakMap,hr=new WeakMap,Ko=new WeakMap,qu=new WeakSet,fw=function(t){var s,r;if(l(this,_c))return;(r=l(this,wi)).ctx||(r.ctx=A(s=Ue,Zo,Ld).call(s,l(this,or)));const e=l(this,lr),n=l(this,Pc);for(const o of t){if(e.length>TL){yt("Ignoring additional textDivs for performance reasons."),w(this,_c,!0);return}if(o.str===void 0){if(o.type==="beginMarkedContentProps"||o.type==="beginMarkedContent"){const a=l(this,Be);w(this,Be,document.createElement("span")),l(this,Be).classList.add("markedContent"),o.id!==null&&l(this,Be).setAttribute("id",`${o.id}`),a.append(l(this,Be))}else o.type==="endMarkedContent"&&w(this,Be,l(this,Be).parentNode);continue}n.push(o.str),A(this,Xu,pw).call(this,o)}},Xu=new WeakSet,pw=function(t){var x;const e=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};l(this,lr).push(e);const s=et.transform(l(this,kc),t.transform);let r=Math.atan2(s[1],s[0]);const o=l(this,Xo)[t.fontName];o.vertical&&(r+=Math.PI/2);const a=l(this,Sc)&&o.fontSubstitution||o.fontFamily,c=Math.hypot(s[2],s[3]),d=c*A(x=Ue,Yu,gw).call(x,a,l(this,or));let h,u;r===0?(h=s[4],u=s[5]-d):(h=s[4]+d*Math.sin(r),u=s[5]-d*Math.cos(r));const p="calc(var(--scale-factor)*",v=e.style;l(this,Be)===l(this,Wo)?(v.left=`${(100*h/l(this,Tc)).toFixed(2)}%`,v.top=`${(100*u/l(this,Cc)).toFixed(2)}%`):(v.left=`${p}${h.toFixed(2)}px)`,v.top=`${p}${u.toFixed(2)}px)`),v.fontSize=`${p}${c.toFixed(2)}px)`,v.fontFamily=a,n.fontSize=c,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,l(this,Sc)&&(e.dataset.fontName=o.fontSubstitutionLoadedName||t.fontName),r!==0&&(n.angle=r*(180/Math.PI));let b=!1;if(t.str.length>1)b=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const _=Math.abs(t.transform[0]),E=Math.abs(t.transform[3]);_!==E&&Math.max(_,E)/Math.min(_,E)>1.5&&(b=!0)}if(b&&(n.canvasWidth=o.vertical?t.height:t.width),l(this,Rc).set(e,n),l(this,wi).div=e,l(this,wi).properties=n,A(this,Lc,sm).call(this,l(this,wi)),n.hasText&&l(this,Be).append(e),n.hasEOL){const _=document.createElement("br");_.setAttribute("role","presentation"),l(this,Be).append(_)}},Lc=new WeakSet,sm=function(t){const{div:e,properties:n,ctx:s,prevFontSize:r,prevFontFamily:o}=t,{style:a}=e;let c="";if(n.canvasWidth!==0&&n.hasText){const{fontFamily:d}=a,{canvasWidth:h,fontSize:u}=n;(r!==u||o!==d)&&(s.font=`${u*l(this,as)}px ${d}`,t.prevFontSize=u,t.prevFontFamily=d);const{width:p}=s.measureText(e.textContent);p>0&&(c=`scaleX(${h*l(this,as)/p})`)}n.angle!==0&&(c=`rotate(${n.angle}deg) ${c}`),c.length>0&&(a.transform=c)},Zo=new WeakSet,Ld=function(t=null){let e=l(this,hr).get(t||(t=""));if(!e){const n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=t,document.body.append(n),e=n.getContext("2d",{alpha:!1}),l(this,hr).set(t,e)}return e},Yu=new WeakSet,gw=function(t,e){const n=l(this,cr).get(t);if(n)return n;const s=A(this,Zo,Ld).call(this,e),r=s.font;s.canvas.width=s.canvas.height=Ne,s.font=`${Ne}px ${t}`;const o=s.measureText("");let a=o.fontBoundingBoxAscent,c=Math.abs(o.fontBoundingBoxDescent);if(a){const u=a/(a+c);return l(this,cr).set(t,u),s.canvas.width=s.canvas.height=0,s.font=r,u}s.strokeStyle="red",s.clearRect(0,0,Ne,Ne),s.strokeText("g",0,0);let d=s.getImageData(0,0,Ne,Ne).data;c=0;for(let u=d.length-1-3;u>=0;u-=4)if(d[u]>0){c=Math.ceil(u/4/Ne);break}s.clearRect(0,0,Ne,Ne),s.strokeText("A",0,Ne),d=s.getImageData(0,0,Ne,Ne).data,a=0;for(let u=0,p=d.length;u<p;u+=4)if(d[u]>0){a=Ne-Math.floor(u/4/Ne);break}s.canvas.width=s.canvas.height=0,s.font=r;const h=a?a/(a+c):PL;return l(this,cr).set(t,h),h},m(Ue,Zo),m(Ue,Yu),m(Ue,cr,new Map),m(Ue,hr,new Map),m(Ue,Ko,new Set),Ue);function RL(){ky("`renderTextLayer`, please use `TextLayer` instead.");const{textContentSource:i,container:t,viewport:e,...n}=arguments[0],s=Object.keys(n);s.length>0&&yt("Ignoring `renderTextLayer` parameters: "+s.join(", "));const r=new au({textContentSource:i,container:t,viewport:e}),{textDivs:o,textContentItemsStr:a}=r;return{promise:r.render(),textDivs:o,textContentItemsStr:a}}function kL(){ky("`updateTextLayer`, please use `TextLayer` instead.")}class Al{static textContent(t){const e=[],n={items:e,styles:Object.create(null)};function s(r){var c;if(!r)return;let o=null;const a=r.name;if(a==="#text")o=r.value;else if(Al.shouldBuildText(a))(c=r==null?void 0:r.attributes)!=null&&c.textContent?o=r.attributes.textContent:r.value&&(o=r.value);else return;if(o!==null&&e.push({str:o}),!!r.children)for(const d of r.children)s(d)}return s(t),n}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const LL=65536,IL=100,DL=5e3,FL=Pe?Vk:Ik,ML=Pe?Wk:Py,OL=Pe?Gk:Lk,NL=Pe?qk:Ry;function $L(i){if(typeof i=="string"||i instanceof URL?i={url:i}:(i instanceof ArrayBuffer||ArrayBuffer.isView(i))&&(i={data:i}),typeof i!="object")throw new Error("Invalid parameter in getDocument, need parameter object.");if(!i.url&&!i.data&&!i.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const t=new rm,{docId:e}=t,n=i.url?BL(i.url):null,s=i.data?jL(i.data):null,r=i.httpHeaders||null,o=i.withCredentials===!0,a=i.password??null,c=i.range instanceof mw?i.range:null,d=Number.isInteger(i.rangeChunkSize)&&i.rangeChunkSize>0?i.rangeChunkSize:LL;let h=i.worker instanceof xo?i.worker:null;const u=i.verbosity,p=typeof i.docBaseUrl=="string"&&!g0(i.docBaseUrl)?i.docBaseUrl:null,v=typeof i.cMapUrl=="string"?i.cMapUrl:null,b=i.cMapPacked!==!1,x=i.CMapReaderFactory||ML,_=typeof i.standardFontDataUrl=="string"?i.standardFontDataUrl:null,E=i.StandardFontDataFactory||NL,R=i.stopAtErrors!==!0,k=Number.isInteger(i.maxImageSize)&&i.maxImageSize>-1?i.maxImageSize:-1,D=i.isEvalSupported!==!1,F=typeof i.isOffscreenCanvasSupported=="boolean"?i.isOffscreenCanvasSupported:!Pe,M=Number.isInteger(i.canvasMaxAreaInBytes)?i.canvasMaxAreaInBytes:-1,O=typeof i.disableFontFace=="boolean"?i.disableFontFace:Pe,C=i.fontExtraProperties===!0,P=i.enableXfa===!0,$=i.ownerDocument||globalThis.document,N=i.disableRange===!0,H=i.disableStream===!0,z=i.disableAutoFetch===!0,V=i.pdfBug===!0,Z=c?c.length:i.length??NaN,Q=typeof i.useSystemFonts=="boolean"?i.useSystemFonts:!Pe&&!O,j=typeof i.useWorkerFetch=="boolean"?i.useWorkerFetch:x===Py&&E===Ry&&v&&_&&il(v,document.baseURI)&&il(_,document.baseURI),W=i.canvasFactory||new FL({ownerDocument:$}),q=i.filterFactory||new OL({docId:e,ownerDocument:$}),wt=null;wk(u);const pt={canvasFactory:W,filterFactory:q};if(j||(pt.cMapReaderFactory=new x({baseUrl:v,isCompressed:b}),pt.standardFontDataFactory=new E({baseUrl:_})),!h){const nt={verbosity:u,port:ji.workerPort};h=nt.port?xo.fromPort(nt):new xo(nt),t._worker=h}const G={docId:e,apiVersion:"4.3.136",data:s,password:a,disableAutoFetch:z,rangeChunkSize:d,length:Z,docBaseUrl:p,enableXfa:P,evaluatorOptions:{maxImageSize:k,disableFontFace:O,ignoreErrors:R,isEvalSupported:D,isOffscreenCanvasSupported:F,canvasMaxAreaInBytes:M,fontExtraProperties:C,useSystemFonts:Q,cMapUrl:j?v:null,standardFontDataUrl:j?_:null}},st={disableFontFace:O,fontExtraProperties:C,ownerDocument:$,pdfBug:V,styleElement:wt,loadingParams:{disableAutoFetch:z,enableXfa:P}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const nt=h.messageHandler.sendWithPromise("GetDocRequest",G,s?[s.buffer]:null);let it;return c?it=new hL(c,{disableRange:N,disableStream:H}):s||(it=(J=>Pe?function(){return typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype}()&&il(J.url)?new Dv(J):new xL(J):il(J.url)?new Dv(J):new bL(J))({url:n,length:Z,httpHeaders:r,withCredentials:o,rangeChunkSize:d,disableRange:N,disableStream:H})),nt.then(dt=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const J=new ol(e,dt,h.port),vt=new GL(J,t,it,st,pt);t._transport=vt,J.send("Ready",null)})}).catch(t._capability.reject),t}function BL(i){if(i instanceof URL)return i.href;try{return new URL(i,window.location).href}catch{if(Pe&&typeof i=="string")return i}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function jL(i){if(Pe&&typeof iu<"u"&&i instanceof iu)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength)return i;if(typeof i=="string")return up(i);if(i instanceof ArrayBuffer||ArrayBuffer.isView(i)||typeof i=="object"&&!isNaN(i==null?void 0:i.length))return new Uint8Array(i);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function Fv(i){return typeof i=="object"&&Number.isInteger(i==null?void 0:i.num)&&i.num>=0&&Number.isInteger(i==null?void 0:i.gen)&&i.gen>=0}var Ku;const Zu=class Zu{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${Ve(Zu,Ku)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var t,e,n;this.destroyed=!0;try{(t=this._worker)!=null&&t.port&&(this._worker._pendingDestroy=!0),await((e=this._transport)==null?void 0:e.destroy())}catch(s){throw(n=this._worker)!=null&&n.port&&delete this._worker._pendingDestroy,s}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};Ku=new WeakMap,m(Zu,Ku,0);let rm=Zu,mw=class{constructor(t,e,n=!1,s=null){this.length=t,this.initialData=e,this.progressiveDone=n,this.contentDispositionFilename=s,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,e){for(const n of this._rangeListeners)n(t,e)}onDataProgress(t,e){this._readyCapability.promise.then(()=>{for(const n of this._progressListeners)n(t,e)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const e of this._progressiveReadListeners)e(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){Mt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class UL{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Tt(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()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}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()}}var ls,Ai,cs,po,Jo,Id;class HL{constructor(t,e,n,s=!1){m(this,cs);m(this,Jo);m(this,ls,null);m(this,Ai,!1);this._pageIndex=t,this._pageInfo=e,this._transport=n,this._stats=s?new wv:null,this._pdfBug=s,this.commonObjs=n.commonObjs,this.objs=new vw,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+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:n=0,offsetY:s=0,dontFlip:r=!1}={}){return new Xh({viewBox:this.view,scale:t,rotation:e,offsetX:n,offsetY:s,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 Tt(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return((t=this._transport._htmlForXfa)==null?void 0:t.children[this._pageIndex])||null}render({canvasContext:t,viewport:e,intent:n="display",annotationMode:s=Yi.ENABLE,transform:r=null,background:o=null,optionalContentConfigPromise:a=null,annotationCanvasMap:c=null,pageColors:d=null,printAnnotationStorage:h=null}){var k,D;(k=this._stats)==null||k.time("Overall");const u=this._transport.getRenderingIntent(n,s,h),{renderingIntent:p,cacheKey:v}=u;w(this,Ai,!1),A(this,Jo,Id).call(this),a||(a=this._transport.getOptionalContentConfig(p));let b=this._intentStates.get(v);b||(b=Object.create(null),this._intentStates.set(v,b)),b.streamReaderCancelTimeout&&(clearTimeout(b.streamReaderCancelTimeout),b.streamReaderCancelTimeout=null);const x=!!(p&hn.PRINT);b.displayReadyCapability||(b.displayReadyCapability=Promise.withResolvers(),b.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(D=this._stats)==null||D.time("Page Request"),this._pumpOperatorList(u));const _=F=>{var M;b.renderTasks.delete(E),(this._maybeCleanupAfterRender||x)&&w(this,Ai,!0),A(this,cs,po).call(this,!x),F?(E.capability.reject(F),this._abortOperatorList({intentState:b,reason:F instanceof Error?F:new Error(F)})):E.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(M=globalThis.Stats)!=null&&M.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},E=new am({callback:_,params:{canvasContext:t,viewport:e,transform:r,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:b.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!x,pdfBug:this._pdfBug,pageColors:d});(b.renderTasks||(b.renderTasks=new Set)).add(E);const R=E.task;return Promise.all([b.displayReadyCapability.promise,a]).then(([F,M])=>{var O;if(this.destroyed){_();return}if((O=this._stats)==null||O.time("Rendering"),!(M.renderingIntent&p))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");E.initializeGraphics({transparency:F,optionalContentConfig:M}),E.operatorListChanged()}).catch(_),R}getOperatorList({intent:t="display",annotationMode:e=Yi.ENABLE,printAnnotationStorage:n=null}={}){var c;function s(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(a))}const r=this._transport.getRenderingIntent(t,e,n,!0);let o=this._intentStates.get(r.cacheKey);o||(o=Object.create(null),this._intentStates.set(r.cacheKey,o));let a;return o.opListReadCapability||(a=Object.create(null),a.operatorListChanged=s,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(a),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(c=this._stats)==null||c.time("Page Request"),this._pumpOperatorList(r)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(s){return s.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(n=>Al.textContent(n));const e=this.streamTextContent(t);return new Promise(function(n,s){function r(){o.read().then(function({value:c,done:d}){if(d){n(a);return}a.lang??(a.lang=c.lang),Object.assign(a.styles,c.styles),a.items.push(...c.items),r()},s)}const o=e.getReader(),a={items:[],styles:Object.create(null),lang:null};r()})}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 n of e.renderTasks)t.push(n.completed),n.cancel();return this.objs.clear(),w(this,Ai,!1),A(this,Jo,Id).call(this),Promise.all(t)}cleanup(t=!1){w(this,Ai,!0);const e=A(this,cs,po).call(this,!1);return t&&e&&this._stats&&(this._stats=new wv),e}_startRenderPage(t,e){var s,r;const n=this._intentStates.get(e);n&&((s=this._stats)==null||s.timeEnd("Page Request"),(r=n.displayReadyCapability)==null||r.resolve(t))}_renderPageChunk(t,e){for(let n=0,s=t.length;n<s;n++)e.operatorList.fnArray.push(t.fnArray[n]),e.operatorList.argsArray.push(t.argsArray[n]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const n of e.renderTasks)n.operatorListChanged();t.lastChunk&&A(this,cs,po).call(this,!0)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:n}){const{map:s,transfer:r}=n,a=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:s},r).getReader(),c=this._intentStates.get(e);c.streamReader=a;const d=()=>{a.read().then(({value:h,done:u})=>{if(u){c.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,c),d())},h=>{if(c.streamReader=null,!this._transport.destroyed){if(c.operatorList){c.operatorList.lastChunk=!0;for(const u of c.renderTasks)u.operatorListChanged();A(this,cs,po).call(this,!0)}if(c.displayReadyCapability)c.displayReadyCapability.reject(h);else if(c.opListReadCapability)c.opListReadCapability.reject(h);else throw h}})};d()}_abortOperatorList({intentState:t,reason:e,force:n=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!n){if(t.renderTasks.size>0)return;if(e instanceof p0){let s=IL;e.extraDelay>0&&e.extraDelay<1e3&&(s+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},s);return}}if(t.streamReader.cancel(new ro(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[s,r]of this._intentStates)if(r===t){this._intentStates.delete(s);break}this.cleanup()}}}get stats(){return this._stats}}ls=new WeakMap,Ai=new WeakMap,cs=new WeakSet,po=function(t=!1){if(A(this,Jo,Id).call(this),!l(this,Ai)||this.destroyed)return!1;if(t)return w(this,ls,setTimeout(()=>{w(this,ls,null),A(this,cs,po).call(this,!1)},DL)),!1;for(const{renderTasks:e,operatorList:n}of this._intentStates.values())if(e.size>0||!n.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),w(this,Ai,!1),!0},Jo=new WeakSet,Id=function(){l(this,ls)&&(clearTimeout(l(this,ls)),w(this,ls,null))};var dr,Ju;class zL{constructor(){m(this,dr,new Set);m(this,Ju,Promise.resolve())}postMessage(t,e){const n={data:structuredClone(t,e?{transfer:e}:null)};l(this,Ju).then(()=>{for(const s of l(this,dr))s.call(this,n)})}addEventListener(t,e){l(this,dr).add(e)}removeEventListener(t,e){l(this,dr).delete(e)}terminate(){l(this,dr).clear()}}dr=new WeakMap,Ju=new WeakMap;const ci={isWorkerDisabled:!1,fakeWorkerId:0};Pe&&(ci.isWorkerDisabled=!0,ji.workerSrc||(ji.workerSrc="./pdf.worker.mjs")),ci.isSameOrigin=function(i,t){let e;try{if(e=new URL(i),!e.origin||e.origin==="null")return!1}catch{return!1}const n=new URL(t,e);return e.origin===n.origin},ci.createCDNWrapper=function(i){const t=`await import("${i}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};var ur,Qo,Dd;const qe=class qe{constructor({name:t=null,port:e=null,verbosity:n=Ak()}={}){var s;if(this.name=t,this.destroyed=!1,this.verbosity=n,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){if((s=l(qe,ur))!=null&&s.has(e))throw new Error("Cannot use more than one PDFWorker per port.");(l(qe,ur)||w(qe,ur,new WeakMap)).set(e,this),this._initializeFromPort(e);return}this._initialize()}get promise(){return Pe?Promise.all([Qn.promise,this._readyCapability.promise]):this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new ol("main","worker",t),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!ci.isWorkerDisabled&&!l(qe,Qo,Dd)){let{workerSrc:t}=qe;try{ci.isSameOrigin(window.location.href,t)||(t=ci.createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),n=new ol("main","worker",e),s=()=>{e.removeEventListener("error",r),n.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},r=()=>{this._webWorker||s()};e.addEventListener("error",r),n.on("test",a=>{if(e.removeEventListener("error",r),this.destroyed){s();return}a?(this._messageHandler=n,this._port=e,this._webWorker=e,this._readyCapability.resolve(),n.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),n.destroy(),e.terminate())}),n.on("ready",a=>{if(e.removeEventListener("error",r),this.destroyed){s();return}try{o()}catch{this._setupFakeWorker()}});const o=()=>{const a=new Uint8Array;n.send("test",a,[a.buffer])};o();return}catch{hp("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){ci.isWorkerDisabled||(yt("Setting up fake worker."),ci.isWorkerDisabled=!0),qe._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const e=new zL;this._port=e;const n=`fake${ci.fakeWorkerId++}`,s=new ol(n+"_worker",n,e);t.setup(s,e);const r=new ol(n,n+"_worker",e);this._messageHandler=r,this._readyCapability.resolve(),r.send("configure",{verbosity:this.verbosity})}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){var t;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),(t=l(qe,ur))==null||t.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){var n;if(!(t!=null&&t.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const e=(n=l(this,ur))==null?void 0:n.get(t.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new qe(t)}static get workerSrc(){if(ji.workerSrc)return ji.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Tt(this,"_setupFakeWorkerGlobal",(async()=>l(this,Qo,Dd)?l(this,Qo,Dd):(await import(this.workerSrc)).WorkerMessageHandler)())}};ur=new WeakMap,Qo=new WeakSet,Dd=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch{return null}},m(qe,Qo),m(qe,ur,void 0);let xo=qe;var xi,jn,ta,ea,Un,fr,al;class GL{constructor(t,e,n,s,r){m(this,fr);m(this,xi,new Map);m(this,jn,new Map);m(this,ta,new Map);m(this,ea,new Map);m(this,Un,null);this.messageHandler=t,this.loadingTask=e,this.commonObjs=new vw,this.fontLoader=new Hk({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=r.canvasFactory,this.filterFactory=r.filterFactory,this.cMapReaderFactory=r.cMapReaderFactory,this.standardFontDataFactory=r.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return Tt(this,"annotationStorage",new b0)}getRenderingIntent(t,e=Yi.ENABLE,n=null,s=!1){let r=hn.DISPLAY,o=Zg;switch(t){case"any":r=hn.ANY;break;case"display":break;case"print":r=hn.PRINT;break;default:yt(`getRenderingIntent - invalid intent: ${t}`)}switch(e){case Yi.DISABLE:r+=hn.ANNOTATIONS_DISABLE;break;case Yi.ENABLE:break;case Yi.ENABLE_FORMS:r+=hn.ANNOTATIONS_FORMS;break;case Yi.ENABLE_STORAGE:r+=hn.ANNOTATIONS_STORAGE,o=(r&hn.PRINT&&n instanceof nw?n:this.annotationStorage).serializable;break;default:yt(`getRenderingIntent - invalid annotationMode: ${e}`)}return s&&(r+=hn.OPLIST),{renderingIntent:r,cacheKey:`${r}_${o.hash}`,annotationStorageSerializable:o}}destroy(){var n;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(n=l(this,Un))==null||n.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const s of l(this,jn).values())t.push(s._destroy());l(this,jn).clear(),l(this,ta).clear(),l(this,ea).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{var s;this.commonObjs.clear(),this.fontLoader.clear(),l(this,xi).clear(),this.filterFactory.destroy(),au.cleanup(),(s=this._networkStream)==null||s.cancelAllRequests(new ro("Worker was terminated.")),this.messageHandler&&(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",(n,s)=>{ae(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=r=>{this._lastProgress={loaded:r.loaded,total:r.total}},s.onPull=()=>{this._fullReader.read().then(function({value:r,done:o}){if(o){s.close();return}ae(r instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(r),1,[r])}).catch(r=>{s.error(r)})},s.onCancel=r=>{this._fullReader.cancel(r),s.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("ReaderHeadersReady",n=>{const s=Promise.withResolvers(),r=this._fullReader;return r.headersReady.then(()=>{var o;(!r.isStreamingSupported||!r.isRangeSupported)&&(this._lastProgress&&((o=e.onProgress)==null||o.call(e,this._lastProgress)),r.onProgress=a=>{var c;(c=e.onProgress)==null||c.call(e,{loaded:a.loaded,total:a.total})}),s.resolve({isStreamingSupported:r.isStreamingSupported,isRangeSupported:r.isRangeSupported,contentLength:r.contentLength})},s.reject),s.promise}),t.on("GetRangeReader",(n,s)=>{ae(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const r=this._networkStream.getRangeReader(n.begin,n.end);if(!r){s.close();return}s.onPull=()=>{r.read().then(function({value:o,done:a}){if(a){s.close();return}ae(o instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{s.error(o)})},s.onCancel=o=>{r.cancel(o),s.ready.catch(a=>{if(!this.destroyed)throw a})}}),t.on("GetDoc",({pdfInfo:n})=>{this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,e._capability.resolve(new UL(n,this))}),t.on("DocException",function(n){let s;switch(n.name){case"PasswordException":s=new Cg(n.message,n.code);break;case"InvalidPDFException":s=new _y(n.message);break;case"MissingPDFException":s=new so(n.message);break;case"UnexpectedResponseException":s=new dp(n.message,n.status);break;case"UnknownErrorException":s=new Tg(n.message,n.details);break;default:Mt("DocException - expected a valid Error.")}e._capability.reject(s)}),t.on("PasswordRequest",n=>{if(w(this,Un,Promise.withResolvers()),e.onPassword){const s=r=>{r instanceof Error?l(this,Un).reject(r):l(this,Un).resolve({password:r})};try{e.onPassword(s,n.code)}catch(r){l(this,Un).reject(r)}}else l(this,Un).reject(new Cg(n.message,n.code));return l(this,Un).promise}),t.on("DataLoaded",n=>{var s;(s=e.onProgress)==null||s.call(e,{loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),t.on("StartRenderPage",n=>{if(this.destroyed)return;l(this,jn).get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),t.on("commonobj",([n,s,r])=>{var o;if(this.destroyed||this.commonObjs.has(n))return null;switch(s){case"Font":const{disableFontFace:a,fontExtraProperties:c,pdfBug:d}=this._params;if("error"in r){const v=r.error;yt(`Error during font loading: ${v}`),this.commonObjs.resolve(n,v);break}const h=d&&((o=globalThis.FontInspector)!=null&&o.enabled)?(v,b)=>globalThis.FontInspector.fontAdded(v,b):null,u=new zk(r,{disableFontFace:a,inspectFont:h});this.fontLoader.bind(u).catch(()=>t.sendWithPromise("FontFallback",{id:n})).finally(()=>{!c&&u.data&&(u.data=null),this.commonObjs.resolve(n,u)});break;case"CopyLocalImage":const{imageRef:p}=r;ae(p,"The imageRef must be defined.");for(const v of l(this,jn).values())for(const[,b]of v.objs)if((b==null?void 0:b.ref)===p)return b.dataLen?(this.commonObjs.resolve(n,structuredClone(b)),b.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,r);break;default:throw new Error(`Got unknown common object type ${s}`)}return null}),t.on("obj",([n,s,r,o])=>{var c;if(this.destroyed)return;const a=l(this,jn).get(s);if(!a.objs.has(n)){if(a._intentStates.size===0){(c=o==null?void 0:o.bitmap)==null||c.close();return}switch(r){case"Image":a.objs.resolve(n,o),(o==null?void 0:o.dataLen)>mk&&(a._maybeCleanupAfterRender=!0);break;case"Pattern":a.objs.resolve(n,o);break;default:throw new Error(`Got unknown object type ${r}`)}}}),t.on("DocProgress",n=>{var s;this.destroyed||(s=e.onProgress)==null||s.call(e,{loaded:n.loaded,total:n.total})}),t.on("FetchBuiltInCMap",n=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(n):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),t.on("FetchStandardFontData",n=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(n):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var n;this.annotationStorage.size<=0&&yt("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:((n=this._fullReader)==null?void 0:n.filename)??null},e).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,n=l(this,ta).get(e);if(n)return n;const s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(r=>{if(this.destroyed)throw new Error("Transport destroyed");r.refStr&&l(this,ea).set(r.refStr,t);const o=new HL(e,r,this,this._params.pdfBug);return l(this,jn).set(e,o),o});return l(this,ta).set(e,s),s}getPageIndex(t){return Fv(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return A(this,fr,al).call(this,"GetFieldObjects")}hasJSActions(){return A(this,fr,al).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?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)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return A(this,fr,al).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return A(this,fr,al).call(this,"GetOptionalContentConfig").then(e=>new cL(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=l(this,xi).get(t);if(e)return e;const n=this.messageHandler.sendWithPromise(t,null).then(s=>{var r,o;return{info:s[0],metadata:s[1]?new aL(s[1]):null,contentDispositionFilename:((r=this._fullReader)==null?void 0:r.filename)??null,contentLength:((o=this._fullReader)==null?void 0:o.contentLength)??null}});return l(this,xi).set(t,n),n}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of l(this,jn).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),l(this,xi).clear(),this.filterFactory.destroy(!0),au.cleanup()}}cachedPageNumber(t){if(!Fv(t))return null;const e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return l(this,ea).get(e)??null}}xi=new WeakMap,jn=new WeakMap,ta=new WeakMap,ea=new WeakMap,Un=new WeakMap,fr=new WeakSet,al=function(t,e=null){const n=l(this,xi).get(t);if(n)return n;const s=this.messageHandler.sendWithPromise(t,e);return l(this,xi).set(t,s),s};const pd=Symbol("INITIAL_DATA");var bn,Ic,om;class vw{constructor(){m(this,Ic);m(this,bn,Object.create(null))}get(t,e=null){if(e){const s=A(this,Ic,om).call(this,t);return s.promise.then(()=>e(s.data)),null}const n=l(this,bn)[t];if(!n||n.data===pd)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return n.data}has(t){const e=l(this,bn)[t];return!!e&&e.data!==pd}resolve(t,e=null){const n=A(this,Ic,om).call(this,t);n.data=e,n.resolve()}clear(){var t;for(const e in l(this,bn)){const{data:n}=l(this,bn)[e];(t=n==null?void 0:n.bitmap)==null||t.close()}w(this,bn,Object.create(null))}*[Symbol.iterator](){for(const t in l(this,bn)){const{data:e}=l(this,bn)[t];e!==pd&&(yield[t,e])}}}bn=new WeakMap,Ic=new WeakSet,om=function(t){var e;return(e=l(this,bn))[t]||(e[t]={...Promise.withResolvers(),data:pd})};var hs;class VL{constructor(t){m(this,hs,null);w(this,hs,t),this.onContinue=null}get promise(){return l(this,hs).capability.promise}cancel(t=0){l(this,hs).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=l(this,hs).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=l(this,hs);return t.form||t.canvas&&(e==null?void 0:e.size)>0}}hs=new WeakMap;var pr;const Os=class Os{constructor({callback:t,params:e,objs:n,commonObjs:s,annotationCanvasMap:r,operatorList:o,pageIndex:a,canvasFactory:c,filterFactory:d,useRequestAnimationFrame:h=!1,pdfBug:u=!1,pageColors:p=null}){this.callback=t,this.params=e,this.objs=n,this.commonObjs=s,this.annotationCanvasMap=r,this.operatorListIdx=null,this.operatorList=o,this._pageIndex=a,this.canvasFactory=c,this.filterFactory=d,this._pdfBug=u,this.pageColors=p,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=h===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new VL(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.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){var a,c;if(this.cancelled)return;if(this._canvas){if(l(Os,pr).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.");l(Os,pr).add(this._canvas)}this._pdfBug&&((a=globalThis.StepperManager)!=null&&a.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:n,viewport:s,transform:r,background:o}=this.params;this.gfx=new Ao(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:r,viewport:s,transparency:t,background:o}),this.operatorListIdx=0,this.graphicsReady=!0,(c=this.graphicsReadyCallback)==null||c.call(this)}cancel(t=null,e=0){var n;this.running=!1,this.cancelled=!0,(n=this.gfx)==null||n.endDrawing(),l(Os,pr).delete(this._canvas),this.callback(t||new p0(`Rendering cancelled, page ${this._pageIndex+1}`,e))}operatorListChanged(){var t;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(t=this.stepper)==null||t.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame(()=>{this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),l(Os,pr).delete(this._canvas),this.callback())))}};pr=new WeakMap,m(Os,pr,new WeakSet);let am=Os;const WL="4.3.136",qL="0cec64437";function Mv(i){return Math.floor(Math.max(0,Math.min(1,i))*255).toString(16).padStart(2,"0")}function Ja(i){return Math.max(0,Math.min(255,255*i))}class Ov{static CMYK_G([t,e,n,s]){return["G",1-Math.min(1,.3*t+.59*n+.11*e+s)]}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=Ja(t),[t,t,t]}static G_HTML([t]){const e=Mv(t);return`#${e}${e}${e}`}static RGB_G([t,e,n]){return["G",.3*t+.59*e+.11*n]}static RGB_rgb(t){return t.map(Ja)}static RGB_HTML(t){return`#${t.map(Mv).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,n,s]){return["RGB",1-Math.min(1,t+s),1-Math.min(1,n+s),1-Math.min(1,e+s)]}static CMYK_rgb([t,e,n,s]){return[Ja(1-Math.min(1,t+s)),Ja(1-Math.min(1,n+s)),Ja(1-Math.min(1,e+s))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,n]){const s=1-t,r=1-e,o=1-n,a=Math.min(s,r,o);return["CMYK",s,r,o,a]}}class bw{static setupStorage(t,e,n,s,r){const o=s.getValue(e,{value:null});switch(n.name){case"textarea":if(o.value!==null&&(t.textContent=o.value),r==="print")break;t.addEventListener("input",a=>{s.setValue(e,{value:a.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(o.value===n.attributes.xfaOn?t.setAttribute("checked",!0):o.value===n.attributes.xfaOff&&t.removeAttribute("checked"),r==="print")break;t.addEventListener("change",a=>{s.setValue(e,{value:a.target.checked?a.target.getAttribute("xfaOn"):a.target.getAttribute("xfaOff")})})}else{if(o.value!==null&&t.setAttribute("value",o.value),r==="print")break;t.addEventListener("input",a=>{s.setValue(e,{value:a.target.value})})}break;case"select":if(o.value!==null){t.setAttribute("value",o.value);for(const a of n.children)a.attributes.value===o.value?a.attributes.selected=!0:a.attributes.hasOwnProperty("selected")&&delete a.attributes.selected}t.addEventListener("input",a=>{const c=a.target.options,d=c.selectedIndex===-1?"":c[c.selectedIndex].value;s.setValue(e,{value:d})});break}}static setAttributes({html:t,element:e,storage:n=null,intent:s,linkService:r}){const{attributes:o}=e,a=t instanceof HTMLAnchorElement;o.type==="radio"&&(o.name=`${o.name}-${s}`);for(const[c,d]of Object.entries(o))if(d!=null)switch(c){case"class":d.length&&t.setAttribute(c,d.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",d);break;case"style":Object.assign(t.style,d);break;case"textContent":t.textContent=d;break;default:(!a||c!=="href"&&c!=="newWindow")&&t.setAttribute(c,d)}a&&r.addLinkAttributes(t,o.href,o.newWindow),n&&o.dataId&&this.setupStorage(t,o.dataId,e,n)}static render(t){var u,p;const e=t.annotationStorage,n=t.linkService,s=t.xfaHtml,r=t.intent||"display",o=document.createElement(s.name);s.attributes&&this.setAttributes({html:o,element:s,intent:r,linkService:n});const a=r!=="richText",c=t.div;if(c.append(o),t.viewport){const v=`matrix(${t.viewport.transform.join(",")})`;c.style.transform=v}a&&c.setAttribute("class","xfaLayer xfaFont");const d=[];if(s.children.length===0){if(s.value){const v=document.createTextNode(s.value);o.append(v),a&&Al.shouldBuildText(s.name)&&d.push(v)}return{textDivs:d}}const h=[[s,-1,o]];for(;h.length>0;){const[v,b,x]=h.at(-1);if(b+1===v.children.length){h.pop();continue}const _=v.children[++h.at(-1)[1]];if(_===null)continue;const{name:E}=_;if(E==="#text"){const k=document.createTextNode(_.value);d.push(k),x.append(k);continue}const R=(u=_==null?void 0:_.attributes)!=null&&u.xmlns?document.createElementNS(_.attributes.xmlns,E):document.createElement(E);if(x.append(R),_.attributes&&this.setAttributes({html:R,element:_,storage:e,intent:r,linkService:n}),((p=_.children)==null?void 0:p.length)>0)h.push([_,-1,R]);else if(_.value){const k=document.createTextNode(_.value);a&&Al.shouldBuildText(E)&&d.push(k),R.append(k)}}for(const v of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))v.setAttribute("readOnly",!0);return{textDivs:d}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}const Zh=1e3,XL=9,Qr=new WeakSet;function Ui(i){return{width:i[2]-i[0],height:i[3]-i[1]}}class YL{static create(t){switch(t.data.annotationType){case ne.LINK:return new yw(t);case ne.TEXT:return new KL(t);case ne.WIDGET:switch(t.data.fieldType){case"Tx":return new ZL(t);case"Btn":return t.data.radioButton?new xw(t):t.data.checkBox?new QL(t):new t2(t);case"Ch":return new e2(t);case"Sig":return new JL(t)}return new oo(t);case ne.POPUP:return new cm(t);case ne.FREETEXT:return new Tw(t);case ne.LINE:return new i2(t);case ne.SQUARE:return new s2(t);case ne.CIRCLE:return new r2(t);case ne.POLYLINE:return new Pw(t);case ne.CARET:return new a2(t);case ne.INK:return new Rw(t);case ne.POLYGON:return new o2(t);case ne.HIGHLIGHT:return new l2(t);case ne.UNDERLINE:return new c2(t);case ne.SQUIGGLY:return new h2(t);case ne.STRIKEOUT:return new d2(t);case ne.STAMP:return new kw(t);case ne.FILEATTACHMENT:return new u2(t);default:return new Jt(t)}}}var gr,na,ia,Dc,lm;const R0=class R0{constructor(t,{isRenderable:e=!1,ignoreBorder:n=!1,createQuadrilaterals:s=!1}={}){m(this,Dc);m(this,gr,null);m(this,na,!1);m(this,ia,null);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.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(n)),s&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:e,richText:n}){return!!(t!=null&&t.str||e!=null&&e.str||n!=null&&n.str)}get hasPopupData(){return R0._hasPopupData(this.data)}updateEdited(t){var n;if(!this.container)return;l(this,gr)||w(this,gr,{rect:this.data.rect.slice(0)});const{rect:e}=t;e&&A(this,Dc,lm).call(this,e),(n=l(this,ia))==null||n.popup.updateEdited(t)}resetEdited(){var t;l(this,gr)&&(A(this,Dc,lm).call(this,l(this,gr).rect),(t=l(this,ia))==null||t.popup.resetEdited(),w(this,gr,null))}_createContainer(t){const{data:e,parent:{page:n,viewport:s}}=this,r=document.createElement("section");r.setAttribute("data-annotation-id",e.id),this instanceof oo||(r.tabIndex=Zh);const{style:o}=r;if(o.zIndex=this.parent.zIndex++,e.popupRef&&r.setAttribute("aria-haspopup","dialog"),e.alternativeText&&(r.title=e.alternativeText),e.noRotate&&r.classList.add("norotate"),!e.rect||this instanceof cm){const{rotation:x}=e;return!e.hasOwnCanvas&&x!==0&&this.setRotation(x,r),r}const{width:a,height:c}=Ui(e.rect);if(!t&&e.borderStyle.width>0){o.borderWidth=`${e.borderStyle.width}px`;const x=e.borderStyle.horizontalCornerRadius,_=e.borderStyle.verticalCornerRadius;if(x>0||_>0){const R=`calc(${x}px * var(--scale-factor)) / calc(${_}px * var(--scale-factor))`;o.borderRadius=R}else if(this instanceof xw){const R=`calc(${a}px * var(--scale-factor)) / calc(${c}px * var(--scale-factor))`;o.borderRadius=R}switch(e.borderStyle.style){case Ka.SOLID:o.borderStyle="solid";break;case Ka.DASHED:o.borderStyle="dashed";break;case Ka.BEVELED:yt("Unimplemented border style: beveled");break;case Ka.INSET:yt("Unimplemented border style: inset");break;case Ka.UNDERLINE:o.borderBottomStyle="solid";break}const E=e.borderColor||null;E?(w(this,na,!0),o.borderColor=et.makeHexColor(E[0]|0,E[1]|0,E[2]|0)):o.borderWidth=0}const d=et.normalizeRect([e.rect[0],n.view[3]-e.rect[1]+n.view[1],e.rect[2],n.view[3]-e.rect[3]+n.view[1]]),{pageWidth:h,pageHeight:u,pageX:p,pageY:v}=s.rawDims;o.left=`${100*(d[0]-p)/h}%`,o.top=`${100*(d[1]-v)/u}%`;const{rotation:b}=e;return e.hasOwnCanvas||b===0?(o.width=`${100*a/h}%`,o.height=`${100*c/u}%`):this.setRotation(b,r),r}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:s}=this.parent.viewport.rawDims,{width:r,height:o}=Ui(this.data.rect);let a,c;t%180===0?(a=100*r/n,c=100*o/s):(a=100*o/n,c=100*r/s),e.style.width=`${a}%`,e.style.height=`${c}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,n,s)=>{const r=s.detail[e],o=r[0],a=r.slice(1);s.target.style[n]=Ov[`${o}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[n]:Ov[`${o}_rgb`](a)})};return Tt(this,"_commonActions",{display:e=>{const{display:n}=e.detail,s=n%2===1;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:s,noPrint:n===1||n===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:n}=e.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{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:e=>{const n=e.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(t,e){const n=this._commonActions;for(const s of Object.keys(e.detail)){const r=t[s]||n[s];r==null||r(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const n=this._commonActions;for(const[s,r]of Object.entries(e)){const o=n[s];if(o){const a={detail:{[s]:r},target:t};o(a),delete e[s]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,n,s,r]=this.data.rect;if(t.length===1){const[,{x,y:_},{x:E,y:R}]=t[0];if(s===x&&r===_&&e===E&&n===R)return}const{style:o}=this.container;let a;if(l(this,na)){const{borderColor:x,borderWidth:_}=o;o.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="${x}" stroke-width="${_}">`],this.container.classList.add("hasBorder")}const c=s-e,d=r-n,{svgFactory:h}=this,u=h.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0);const p=h.createElement("defs");u.append(p);const v=h.createElement("clipPath"),b=`clippath_${this.data.id}`;v.setAttribute("id",b),v.setAttribute("clipPathUnits","objectBoundingBox"),p.append(v);for(const[,{x,y:_},{x:E,y:R}]of t){const k=h.createElement("rect"),D=(E-e)/c,F=(r-_)/d,M=(x-E)/c,O=(_-R)/d;k.setAttribute("x",D),k.setAttribute("y",F),k.setAttribute("width",M),k.setAttribute("height",O),v.append(k),a==null||a.push(`<rect vector-effect="non-scaling-stroke" x="${D}" y="${F}" width="${M}" height="${O}"/>`)}l(this,na)&&(a.push("</g></svg>')"),o.backgroundImage=a.join("")),this.container.append(u),this.container.style.clipPath=`url(#${b})`}_createPopup(){const{container:t,data:e}=this;t.setAttribute("aria-haspopup","dialog");const n=w(this,ia,new cm({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(n.render())}render(){Mt("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const n=[];if(this._fieldObjects){const s=this._fieldObjects[t];if(s)for(const{page:r,id:o,exportValues:a}of s){if(r===-1||o===e)continue;const c=typeof a=="string"?a:null,d=document.querySelector(`[data-element-id="${o}"]`);if(d&&!Qr.has(d)){yt(`_getElementsByName - element not allowed: ${o}`);continue}n.push({id:o,exportValue:c,domElement:d})}return n}for(const s of document.getElementsByName(t)){const{exportValue:r}=s,o=s.getAttribute("data-element-id");o!==e&&Qr.has(s)&&n.push({id:o,exportValue:r,domElement:s})}return n}show(){var t;this.container&&(this.container.hidden=!1),(t=this.popup)==null||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),(t=this.popup)==null||t.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")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var n;(n=this.linkService.eventBus)==null||n.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})})}};gr=new WeakMap,na=new WeakMap,ia=new WeakMap,Dc=new WeakSet,lm=function(t){const{container:{style:e},data:{rect:n,rotation:s},parent:{viewport:{rawDims:{pageWidth:r,pageHeight:o,pageX:a,pageY:c}}}}=this;n==null||n.splice(0,4,...t);const{width:d,height:h}=Ui(t);e.left=`${100*(t[0]-a)/r}%`,e.top=`${100*(o-t[3]+c)/o}%`,s===0?(e.width=`${100*d/r}%`,e.height=`${100*h/o}%`):this.setRotation(s)};let Jt=R0;var Ei,Ls,Qu,ww,tf,Aw;class yw extends Jt{constructor(e,n=null){super(e,{isRenderable:!0,ignoreBorder:!!(n!=null&&n.ignoreBorder),createQuadrilaterals:!0});m(this,Ei);m(this,Qu);m(this,tf);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:n}=this,s=document.createElement("a");s.setAttribute("data-element-id",e.id);let r=!1;return e.url?(n.addLinkAttributes(s,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(s,e.action),r=!0):e.attachment?(A(this,Qu,ww).call(this,s,e.attachment,e.attachmentDest),r=!0):e.setOCGState?(A(this,tf,Aw).call(this,s,e.setOCGState),r=!0):e.dest?(this._bindLink(s,e.dest),r=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(s,e),r=!0),e.resetForm?(this._bindResetFormAction(s,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(s,""),r=!0)),this.container.classList.add("linkAnnotation"),r&&this.container.append(s),this.container}_bindLink(e,n){e.href=this.linkService.getDestinationHash(n),e.onclick=()=>(n&&this.linkService.goToDestination(n),!1),(n||n==="")&&A(this,Ei,Ls).call(this)}_bindNamedAction(e,n){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(n),!1),A(this,Ei,Ls).call(this)}_bindJSAction(e,n){e.href=this.linkService.getAnchorUrl("");const s=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const r of Object.keys(n.actions)){const o=s.get(r);o&&(e[o]=()=>{var a;return(a=this.linkService.eventBus)==null||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n.id,name:r}}),!1})}e.onclick||(e.onclick=()=>!1),A(this,Ei,Ls).call(this)}_bindResetFormAction(e,n){const s=e.onclick;if(s||(e.href=this.linkService.getAnchorUrl("")),A(this,Ei,Ls).call(this),!this._fieldObjects){yt('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),s||(e.onclick=()=>!1);return}e.onclick=()=>{var u;s==null||s();const{fields:r,refs:o,include:a}=n,c=[];if(r.length!==0||o.length!==0){const p=new Set(o);for(const v of r){const b=this._fieldObjects[v]||[];for(const{id:x}of b)p.add(x)}for(const v of Object.values(this._fieldObjects))for(const b of v)p.has(b.id)===a&&c.push(b)}else for(const p of Object.values(this._fieldObjects))c.push(...p);const d=this.annotationStorage,h=[];for(const p of c){const{id:v}=p;switch(h.push(v),p.type){case"text":{const x=p.defaultValue||"";d.setValue(v,{value:x});break}case"checkbox":case"radiobutton":{const x=p.defaultValue===p.exportValues;d.setValue(v,{value:x});break}case"combobox":case"listbox":{const x=p.defaultValue||"";d.setValue(v,{value:x});break}default:continue}const b=document.querySelector(`[data-element-id="${v}"]`);if(b){if(!Qr.has(b)){yt(`_bindResetFormAction - element not allowed: ${v}`);continue}}else continue;b.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((u=this.linkService.eventBus)==null||u.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}})),!1}}}Ei=new WeakSet,Ls=function(){this.container.setAttribute("data-internal-link","")},Qu=new WeakSet,ww=function(e,n,s=null){e.href=this.linkService.getAnchorUrl(""),n.description&&(e.title=n.description),e.onclick=()=>{var r;return(r=this.downloadManager)==null||r.openOrDownloadData(n.content,n.filename,s),!1},A(this,Ei,Ls).call(this)},tf=new WeakSet,Aw=function(e,n){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(n),!1),A(this,Ei,Ls).call(this)};class KL extends Jt{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._createPopup(),this.container.append(t),this.container}}class oo extends Jt{render(){return this.container}showElementAndHideCanvas(t){var e;this.data.hasOwnCanvas&&(((e=t.previousSibling)==null?void 0:e.nodeName)==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return ze.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,n,s,r){n.includes("mouse")?t.addEventListener(n,o=>{var a;(a=this.linkService.eventBus)==null||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:r(o),shift:o.shiftKey,modifier:this._getKeyModifier(o)}})}):t.addEventListener(n,o=>{var a;if(n==="blur"){if(!e.focused||!o.relatedTarget)return;e.focused=!1}else if(n==="focus"){if(e.focused)return;e.focused=!0}r&&((a=this.linkService.eventBus)==null||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:r(o)}}))})}_setEventListeners(t,e,n,s){var r,o,a;for(const[c,d]of n)(d==="Action"||(r=this.data.actions)!=null&&r[d])&&((d==="Focus"||d==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,c,d,s),d==="Focus"&&!((o=this.data.actions)!=null&&o.Blur)?this._setEventListener(t,e,"blur","Blur",null):d==="Blur"&&!((a=this.data.actions)!=null&&a.Focus)&&this._setEventListener(t,e,"focus","Focus",null))}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":et.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||XL,r=t.style;let o;const a=2,c=d=>Math.round(10*d)/10;if(this.data.multiLine){const d=Math.abs(this.data.rect[3]-this.data.rect[1]-a),h=Math.round(d/(Zp*s))||1,u=d/h;o=Math.min(s,c(u/Zp))}else{const d=Math.abs(this.data.rect[3]-this.data.rect[1]-a);o=Math.min(s,c(d/Zp))}r.fontSize=`calc(${o}px * var(--scale-factor))`,r.color=et.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(r.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class ZL extends oo{constructor(t){const e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,n,s){const r=this.annotationStorage;for(const o of this._getElementsByName(t.name,t.id))o.domElement&&(o.domElement[e]=n),r.setValue(o.id,{[s]:n})}render(){var s,r;const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const o=t.getValue(e,{value:this.data.fieldValue});let a=o.value||"";const c=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;c&&a.length>c&&(a=a.slice(0,c));let d=o.formattedValue||((s=this.data.textContent)==null?void 0:s.join(`
266
- `))||null;d&&this.data.comb&&(d=d.replaceAll(/\s+/g,""));const h={userValue:a,formattedValue:d,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=d??a,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type="text",n.setAttribute("value",d??a),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),Qr.add(n),n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=Zh,this._setRequired(n,this.data.required),c&&(n.maxLength=c),n.addEventListener("input",p=>{t.setValue(e,{value:p.target.value}),this.setPropertyOnSiblings(n,"value",p.target.value,"value"),h.formattedValue=null}),n.addEventListener("resetform",p=>{const v=this.data.defaultFieldValue??"";n.value=h.userValue=v,h.formattedValue=null});let u=p=>{const{formattedValue:v}=h;v!=null&&(p.target.value=v),p.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",v=>{var x;if(h.focused)return;const{target:b}=v;h.userValue&&(b.value=h.userValue),h.lastCommittedValue=b.value,h.commitKey=1,(x=this.data.actions)!=null&&x.Focus||(h.focused=!0)}),n.addEventListener("updatefromsandbox",v=>{this.showElementAndHideCanvas(v.target);const b={value(x){h.userValue=x.detail.value??"",t.setValue(e,{value:h.userValue.toString()}),x.target.value=h.userValue},formattedValue(x){const{formattedValue:_}=x.detail;h.formattedValue=_,_!=null&&x.target!==document.activeElement&&(x.target.value=_),t.setValue(e,{formattedValue:_})},selRange(x){x.target.setSelectionRange(...x.detail.selRange)},charLimit:x=>{var k;const{charLimit:_}=x.detail,{target:E}=x;if(_===0){E.removeAttribute("maxLength");return}E.setAttribute("maxLength",_);let R=h.userValue;!R||R.length<=_||(R=R.slice(0,_),E.value=h.userValue=R,t.setValue(e,{value:R}),(k=this.linkService.eventBus)==null||k.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:R,willCommit:!0,commitKey:1,selStart:E.selectionStart,selEnd:E.selectionEnd}}))}};this._dispatchEventFromSandbox(b,v)}),n.addEventListener("keydown",v=>{var _;h.commitKey=1;let b=-1;if(v.key==="Escape"?b=0:v.key==="Enter"&&!this.data.multiLine?b=2:v.key==="Tab"&&(h.commitKey=3),b===-1)return;const{value:x}=v.target;h.lastCommittedValue!==x&&(h.lastCommittedValue=x,h.userValue=x,(_=this.linkService.eventBus)==null||_.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:x,willCommit:!0,commitKey:b,selStart:v.target.selectionStart,selEnd:v.target.selectionEnd}}))});const p=u;u=null,n.addEventListener("blur",v=>{var x,_;if(!h.focused||!v.relatedTarget)return;(x=this.data.actions)!=null&&x.Blur||(h.focused=!1);const{value:b}=v.target;h.userValue=b,h.lastCommittedValue!==b&&((_=this.linkService.eventBus)==null||_.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:b,willCommit:!0,commitKey:h.commitKey,selStart:v.target.selectionStart,selEnd:v.target.selectionEnd}})),p(v)}),(r=this.data.actions)!=null&&r.Keystroke&&n.addEventListener("beforeinput",v=>{var F;h.lastCommittedValue=null;const{data:b,target:x}=v,{value:_,selectionStart:E,selectionEnd:R}=x;let k=E,D=R;switch(v.inputType){case"deleteWordBackward":{const M=_.substring(0,E).match(/\w*[^\w]*$/);M&&(k-=M[0].length);break}case"deleteWordForward":{const M=_.substring(E).match(/^[^\w]*\w*/);M&&(D+=M[0].length);break}case"deleteContentBackward":E===R&&(k-=1);break;case"deleteContentForward":E===R&&(D+=1);break}v.preventDefault(),(F=this.linkService.eventBus)==null||F.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:_,change:b||"",willCommit:!1,selStart:k,selEnd:D}})}),this._setEventListeners(n,h,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],v=>v.target.value)}if(u&&n.addEventListener("blur",u),this.data.comb){const v=(this.data.rect[2]-this.data.rect[0])/c;n.classList.add("comb"),n.style.letterSpacing=`calc(${v}px * var(--scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class JL extends oo{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class QL extends oo{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,n=e.id;let s=t.getValue(n,{value:e.exportValue===e.fieldValue}).value;typeof s=="string"&&(s=s!=="Off",t.setValue(n,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const r=document.createElement("input");return Qr.add(r),r.setAttribute("data-element-id",n),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="checkbox",r.name=e.fieldName,s&&r.setAttribute("checked",!0),r.setAttribute("exportValue",e.exportValue),r.tabIndex=Zh,r.addEventListener("change",o=>{const{name:a,checked:c}=o.target;for(const d of this._getElementsByName(a,n)){const h=c&&d.exportValue===e.exportValue;d.domElement&&(d.domElement.checked=h),t.setValue(d.id,{value:h})}t.setValue(n,{value:c})}),r.addEventListener("resetform",o=>{const a=e.defaultFieldValue||"Off";o.target.checked=a===e.exportValue}),this.enableScripting&&this.hasJSActions&&(r.addEventListener("updatefromsandbox",o=>{const a={value(c){c.target.checked=c.detail.value!=="Off",t.setValue(n,{value:c.target.checked})}};this._dispatchEventFromSandbox(a,o)}),this._setEventListeners(r,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class xw extends oo{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,n=e.id;let s=t.getValue(n,{value:e.fieldValue===e.buttonValue}).value;if(typeof s=="string"&&(s=s!==e.buttonValue,t.setValue(n,{value:s})),s)for(const o of this._getElementsByName(e.fieldName,n))t.setValue(o.id,{value:!1});const r=document.createElement("input");if(Qr.add(r),r.setAttribute("data-element-id",n),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="radio",r.name=e.fieldName,s&&r.setAttribute("checked",!0),r.tabIndex=Zh,r.addEventListener("change",o=>{const{name:a,checked:c}=o.target;for(const d of this._getElementsByName(a,n))t.setValue(d.id,{value:!1});t.setValue(n,{value:c})}),r.addEventListener("resetform",o=>{const a=e.defaultFieldValue;o.target.checked=a!=null&&a===e.buttonValue}),this.enableScripting&&this.hasJSActions){const o=e.buttonValue;r.addEventListener("updatefromsandbox",a=>{const c={value:d=>{const h=o===d.detail.value;for(const u of this._getElementsByName(d.target.name)){const p=h&&u.id===n;u.domElement&&(u.domElement.checked=p),t.setValue(u.id,{value:p})}}};this._dispatchEventFromSandbox(c,a)}),this._setEventListeners(r,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)}return this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class t2 extends yw{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",n=>{this._dispatchEventFromSandbox({},n)})),t}}class e2 extends oo{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,n=t.getValue(e,{value:this.data.fieldValue}),s=document.createElement("select");Qr.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=Zh;let r=this.data.combo&&this.data.options.length>0;this.data.combo||(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",h=>{const u=this.data.defaultFieldValue;for(const p of s.options)p.selected=p.value===u});for(const h of this.data.options){const u=document.createElement("option");u.textContent=h.displayValue,u.value=h.exportValue,n.value.includes(h.exportValue)&&(u.setAttribute("selected",!0),r=!1),s.append(u)}let o=null;if(r){const h=document.createElement("option");h.value=" ",h.setAttribute("hidden",!0),h.setAttribute("selected",!0),s.prepend(h),o=()=>{h.remove(),s.removeEventListener("input",o),o=null},s.addEventListener("input",o)}const a=h=>{const u=h?"value":"textContent",{options:p,multiple:v}=s;return v?Array.prototype.filter.call(p,b=>b.selected).map(b=>b[u]):p.selectedIndex===-1?null:p[p.selectedIndex][u]};let c=a(!1);const d=h=>{const u=h.target.options;return Array.prototype.map.call(u,p=>({displayValue:p.textContent,exportValue:p.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",h=>{const u={value(p){o==null||o();const v=p.detail.value,b=new Set(Array.isArray(v)?v:[v]);for(const x of s.options)x.selected=b.has(x.value);t.setValue(e,{value:a(!0)}),c=a(!1)},multipleSelection(p){s.multiple=!0},remove(p){const v=s.options,b=p.detail.remove;v[b].selected=!1,s.remove(b),v.length>0&&Array.prototype.findIndex.call(v,_=>_.selected)===-1&&(v[0].selected=!0),t.setValue(e,{value:a(!0),items:d(p)}),c=a(!1)},clear(p){for(;s.length!==0;)s.remove(0);t.setValue(e,{value:null,items:[]}),c=a(!1)},insert(p){const{index:v,displayValue:b,exportValue:x}=p.detail.insert,_=s.children[v],E=document.createElement("option");E.textContent=b,E.value=x,_?_.before(E):s.append(E),t.setValue(e,{value:a(!0),items:d(p)}),c=a(!1)},items(p){const{items:v}=p.detail;for(;s.length!==0;)s.remove(0);for(const b of v){const{displayValue:x,exportValue:_}=b,E=document.createElement("option");E.textContent=x,E.value=_,s.append(E)}s.options.length>0&&(s.options[0].selected=!0),t.setValue(e,{value:a(!0),items:d(p)}),c=a(!1)},indices(p){const v=new Set(p.detail.indices);for(const b of p.target.options)b.selected=v.has(b.index);t.setValue(e,{value:a(!0)}),c=a(!1)},editable(p){p.target.disabled=!p.detail.editable}};this._dispatchEventFromSandbox(u,h)}),s.addEventListener("input",h=>{var v;const u=a(!0),p=a(!1);t.setValue(e,{value:u}),h.preventDefault(),(v=this.linkService.eventBus)==null||v.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:c,change:p,changeEx:u,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],h=>h.target.value)):s.addEventListener("input",function(h){t.setValue(e,{value:a(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class cm extends Jt{constructor(t){const{data:e,elements:n}=t;super(t,{isRenderable:Jt._hasPopupData(e)}),this.elements=n,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new n2({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,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}),e=[];for(const n of this.elements)n.popup=t,e.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",e.map(n=>`${Cy}${n}`).join(",")),this.container}}var sa,ef,nf,ra,mr,Yt,_i,vr,Fc,Mc,oa,Si,yn,Ci,Oc,Ti,Nc,br,yr,aa,Fd,$c,hm,sf,Ew,rf,_w,of,Sw,af,Cw,la,Md,ca,Od,Bc,dm;class n2{constructor({container:t,color:e,elements:n,titleObj:s,modificationDate:r,contentsObj:o,richText:a,parent:c,rect:d,parentRect:h,open:u}){m(this,aa);m(this,$c);m(this,sf);m(this,rf);m(this,of);m(this,af);m(this,la);m(this,ca);m(this,Bc);m(this,sa,A(this,of,Sw).bind(this));m(this,ef,A(this,Bc,dm).bind(this));m(this,nf,A(this,ca,Od).bind(this));m(this,ra,A(this,la,Md).bind(this));m(this,mr,null);m(this,Yt,null);m(this,_i,null);m(this,vr,null);m(this,Fc,null);m(this,Mc,null);m(this,oa,null);m(this,Si,!1);m(this,yn,null);m(this,Ci,null);m(this,Oc,null);m(this,Ti,null);m(this,Nc,null);m(this,br,null);m(this,yr,!1);var p;w(this,Yt,t),w(this,Nc,s),w(this,_i,o),w(this,Ti,a),w(this,Mc,c),w(this,mr,e),w(this,Oc,d),w(this,oa,h),w(this,Fc,n),w(this,vr,Ly.toDateObject(r)),this.trigger=n.flatMap(v=>v.getElementsToTriggerPopup());for(const v of this.trigger)v.addEventListener("click",l(this,ra)),v.addEventListener("mouseenter",l(this,nf)),v.addEventListener("mouseleave",l(this,ef)),v.classList.add("popupTriggerArea");for(const v of n)(p=v.container)==null||p.addEventListener("keydown",l(this,sa));l(this,Yt).hidden=!0,u&&A(this,la,Md).call(this)}render(){if(l(this,yn))return;const t=w(this,yn,document.createElement("div"));if(t.className="popup",l(this,mr)){const r=t.style.outlineColor=et.makeHexColor(...l(this,mr));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor=`color-mix(in srgb, ${r} 30%, white)`:t.style.backgroundColor=et.makeHexColor(...l(this,mr).map(a=>Math.floor(.7*(255-a)+a)))}const e=document.createElement("span");e.className="header";const n=document.createElement("h1");if(e.append(n),{dir:n.dir,str:n.textContent}=l(this,Nc),t.append(e),l(this,vr)){const r=document.createElement("span");r.classList.add("popupDate"),r.setAttribute("data-l10n-id","pdfjs-annotation-date-string"),r.setAttribute("data-l10n-args",JSON.stringify({date:l(this,vr).toLocaleDateString(),time:l(this,vr).toLocaleTimeString()})),e.append(r)}const s=l(this,aa,Fd);if(s)bw.render({xfaHtml:s,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const r=this._formatContents(l(this,_i));t.append(r)}l(this,Yt).append(t)}_formatContents({str:t,dir:e}){const n=document.createElement("p");n.classList.add("popupContent"),n.dir=e;const s=t.split(/(?:\r\n?|\n)/);for(let r=0,o=s.length;r<o;++r){const a=s[r];n.append(document.createTextNode(a)),r<o-1&&n.append(document.createElement("br"))}return n}updateEdited({rect:t,popupContent:e}){var n;l(this,br)||w(this,br,{contentsObj:l(this,_i),richText:l(this,Ti)}),t&&w(this,Ci,null),e&&(w(this,Ti,A(this,rf,_w).call(this,e)),w(this,_i,null)),(n=l(this,yn))==null||n.remove(),w(this,yn,null)}resetEdited(){var t;l(this,br)&&({contentsObj:Ve(this,_i)._,richText:Ve(this,Ti)._}=l(this,br),w(this,br,null),(t=l(this,yn))==null||t.remove(),w(this,yn,null),w(this,Ci,null))}forceHide(){w(this,yr,this.isVisible),l(this,yr)&&(l(this,Yt).hidden=!0)}maybeShow(){l(this,yr)&&(l(this,yn)||A(this,ca,Od).call(this),w(this,yr,!1),l(this,Yt).hidden=!1)}get isVisible(){return l(this,Yt).hidden===!1}}sa=new WeakMap,ef=new WeakMap,nf=new WeakMap,ra=new WeakMap,mr=new WeakMap,Yt=new WeakMap,_i=new WeakMap,vr=new WeakMap,Fc=new WeakMap,Mc=new WeakMap,oa=new WeakMap,Si=new WeakMap,yn=new WeakMap,Ci=new WeakMap,Oc=new WeakMap,Ti=new WeakMap,Nc=new WeakMap,br=new WeakMap,yr=new WeakMap,aa=new WeakSet,Fd=function(){const t=l(this,Ti),e=l(this,_i);return t!=null&&t.str&&(!(e!=null&&e.str)||e.str===t.str)&&l(this,Ti).html||null},$c=new WeakSet,hm=function(){var t,e,n;return((n=(e=(t=l(this,aa,Fd))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:n.fontSize)||0},sf=new WeakSet,Ew=function(){var t,e,n;return((n=(e=(t=l(this,aa,Fd))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:n.color)||null},rf=new WeakSet,_w=function(t){const e=[],n={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},s={style:{color:l(this,sf,Ew),fontSize:l(this,$c,hm)?`calc(${l(this,$c,hm)}px * var(--scale-factor))`:""}};for(const r of t.split(`
267
- `))e.push({name:"span",value:r,attributes:s});return n},of=new WeakSet,Sw=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&l(this,Si))&&A(this,la,Md).call(this)},af=new WeakSet,Cw=function(){if(l(this,Ci)!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:n,pageX:s,pageY:r}}}=l(this,Mc);let o=!!l(this,oa),a=o?l(this,oa):l(this,Oc);for(const b of l(this,Fc))if(!a||et.intersect(b.data.rect,a)!==null){a=b.data.rect,o=!0;break}const c=et.normalizeRect([a[0],t[3]-a[1]+t[1],a[2],t[3]-a[3]+t[1]]),h=o?a[2]-a[0]+5:0,u=c[0]+h,p=c[1];w(this,Ci,[100*(u-s)/e,100*(p-r)/n]);const{style:v}=l(this,Yt);v.left=`${l(this,Ci)[0]}%`,v.top=`${l(this,Ci)[1]}%`},la=new WeakSet,Md=function(){w(this,Si,!l(this,Si)),l(this,Si)?(A(this,ca,Od).call(this),l(this,Yt).addEventListener("click",l(this,ra)),l(this,Yt).addEventListener("keydown",l(this,sa))):(A(this,Bc,dm).call(this),l(this,Yt).removeEventListener("click",l(this,ra)),l(this,Yt).removeEventListener("keydown",l(this,sa)))},ca=new WeakSet,Od=function(){l(this,yn)||this.render(),this.isVisible?l(this,Si)&&l(this,Yt).classList.add("focused"):(A(this,af,Cw).call(this),l(this,Yt).hidden=!1,l(this,Yt).style.zIndex=parseInt(l(this,Yt).style.zIndex)+1e3)},Bc=new WeakSet,dm=function(){l(this,Yt).classList.remove("focused"),!(l(this,Si)||!this.isVisible)&&(l(this,Yt).hidden=!0,l(this,Yt).style.zIndex=parseInt(l(this,Yt).style.zIndex)-1e3)};class Tw extends Jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=_t.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const n=document.createElement("span");n.textContent=e,t.append(n)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}get _isEditable(){return this.data.hasOwnCanvas}}var jc;class i2 extends Jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,jc,null)}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:n,height:s}=Ui(e.rect),r=this.svgFactory.create(n,s,!0),o=w(this,jc,this.svgFactory.createElement("svg:line"));return o.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),o.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),o.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),o.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),o.setAttribute("stroke-width",e.borderStyle.width||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),r.append(o),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return l(this,jc)}addHighlightArea(){this.container.classList.add("highlightArea")}}jc=new WeakMap;var Uc;class s2 extends Jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Uc,null)}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:n,height:s}=Ui(e.rect),r=this.svgFactory.create(n,s,!0),o=e.borderStyle.width,a=w(this,Uc,this.svgFactory.createElement("svg:rect"));return a.setAttribute("x",o/2),a.setAttribute("y",o/2),a.setAttribute("width",n-o),a.setAttribute("height",s-o),a.setAttribute("stroke-width",o||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return l(this,Uc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Uc=new WeakMap;var Hc;class r2 extends Jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Hc,null)}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:n,height:s}=Ui(e.rect),r=this.svgFactory.create(n,s,!0),o=e.borderStyle.width,a=w(this,Hc,this.svgFactory.createElement("svg:ellipse"));return a.setAttribute("cx",n/2),a.setAttribute("cy",s/2),a.setAttribute("rx",n/2-o/2),a.setAttribute("ry",s/2-o/2),a.setAttribute("stroke-width",o||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return l(this,Hc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Hc=new WeakMap;var zc;class Pw extends Jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,zc,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const e=this.data,{width:n,height:s}=Ui(e.rect),r=this.svgFactory.create(n,s,!0);let o=[];for(const c of e.vertices){const d=c.x-e.rect[0],h=e.rect[3]-c.y;o.push(d+","+h)}o=o.join(" ");const a=w(this,zc,this.svgFactory.createElement(this.svgElementName));return a.setAttribute("points",o),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return l(this,zc)}addHighlightArea(){this.container.classList.add("highlightArea")}}zc=new WeakMap;class o2 extends Pw{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class a2 extends Jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var Gc;class Rw extends Jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Gc,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=_t.INK}render(){this.container.classList.add(this.containerClassName);const e=this.data,{width:n,height:s}=Ui(e.rect),r=this.svgFactory.create(n,s,!0);for(const o of e.inkLists){let a=[];for(const d of o){const h=d.x-e.rect[0],u=e.rect[3]-d.y;a.push(`${h},${u}`)}a=a.join(" ");const c=this.svgFactory.createElement(this.svgElementName);l(this,Gc).push(c),c.setAttribute("points",a),c.setAttribute("stroke-width",e.borderStyle.width||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),!e.popupRef&&this.hasPopupData&&this._createPopup(),r.append(c)}return this.container.append(r),this.container}getElementsToTriggerPopup(){return l(this,Gc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Gc=new WeakMap;class l2 extends Jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class c2 extends Jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class h2 extends Jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class d2 extends Jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class kw extends Jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var Vc,Wc,um;class u2 extends Jt{constructor(e){var s;super(e,{isRenderable:!0});m(this,Wc);m(this,Vc,null);const{file:n}=this.data;this.filename=n.filename,this.content=n.content,(s=this.linkService.eventBus)==null||s.dispatch("fileattachmentannotation",{source:this,...n})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:n}=this;let s;n.hasAppearance||n.fillAlpha===0?s=document.createElement("div"):(s=document.createElement("img"),s.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(n.name)?"paperclip":"pushpin"}.svg`,n.fillAlpha&&n.fillAlpha<1&&(s.style=`filter: opacity(${Math.round(n.fillAlpha*100)}%);`)),s.addEventListener("dblclick",A(this,Wc,um).bind(this)),w(this,Vc,s);const{isMac:r}=ze.platform;return e.addEventListener("keydown",o=>{o.key==="Enter"&&(r?o.metaKey:o.ctrlKey)&&A(this,Wc,um).call(this)}),!n.popupRef&&this.hasPopupData?this._createPopup():s.classList.add("popupTriggerArea"),e.append(s),e}getElementsToTriggerPopup(){return l(this,Vc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Vc=new WeakMap,Wc=new WeakSet,um=function(){var e;(e=this.downloadManager)==null||e.openOrDownloadData(this.content,this.filename)};var qc,wr,ha,lf,Lw,Xc,fm,Qv;let f2=(Qv=class{constructor({div:t,accessibilityManager:e,annotationCanvasMap:n,annotationEditorUIManager:s,page:r,viewport:o}){m(this,lf);m(this,Xc);m(this,qc,null);m(this,wr,null);m(this,ha,new Map);this.div=t,w(this,qc,e),w(this,wr,n),this.page=r,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=s}async render(t){var o;const{annotations:e}=t,n=this.div;Zr(n,this.viewport);const s=new Map,r={data:null,layer:n,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new f0,annotationStorage:t.annotationStorage||new b0,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const a of e){if(a.noHTML)continue;const c=a.annotationType===ne.POPUP;if(c){const u=s.get(a.id);if(!u)continue;r.elements=u}else{const{width:u,height:p}=Ui(a.rect);if(u<=0||p<=0)continue}r.data=a;const d=YL.create(r);if(!d.isRenderable)continue;if(!c&&a.popupRef){const u=s.get(a.popupRef);u?u.push(d):s.set(a.popupRef,[d])}const h=d.render();a.hidden&&(h.style.visibility="hidden"),A(this,lf,Lw).call(this,h,a.id),d.annotationEditorType>0&&(l(this,ha).set(d.data.id,d),(o=this._annotationEditorUIManager)==null||o.renderAnnotationElement(d))}A(this,Xc,fm).call(this)}update({viewport:t}){const e=this.div;this.viewport=t,Zr(e,{rotation:t.rotation}),A(this,Xc,fm).call(this),e.hidden=!1}getEditableAnnotations(){return Array.from(l(this,ha).values())}getEditableAnnotation(t){return l(this,ha).get(t)}},qc=new WeakMap,wr=new WeakMap,ha=new WeakMap,lf=new WeakSet,Lw=function(t,e){var s;const n=t.firstChild||t;n.id=`${Cy}${e}`,this.div.append(t),(s=l(this,qc))==null||s.moveElementInDOM(this.div,t,n,!1)},Xc=new WeakSet,fm=function(){if(!l(this,wr))return;const t=this.div;for(const[e,n]of l(this,wr)){const s=t.querySelector(`[data-annotation-id="${e}"]`);if(!s)continue;n.className="annotationContent";const{firstChild:r}=s;r?r.nodeName==="CANVAS"?r.replaceWith(n):r.classList.contains("annotationContent")?r.after(n):r.before(n):s.append(n)}l(this,wr).clear()},Qv);const gd=/\r\n?|\n/g;var Yc,Kc,Zc,Jc,Qc,wn,Ye,th,Ke,da,cf,Iw,hf,Dw,df,Fw,ua,Nd,fa,$d,pa,Bd,uf,Mw,eh,gm,ff,Ow;const $t=class $t extends Dt{constructor(e){super({...e,name:"freeTextEditor"});m(this,cf);m(this,hf);m(this,df);m(this,ua);m(this,pa);m(this,uf);m(this,ff);m(this,Yc,this.editorDivBlur.bind(this));m(this,Kc,this.editorDivFocus.bind(this));m(this,Zc,this.editorDivInput.bind(this));m(this,Jc,this.editorDivKeydown.bind(this));m(this,Qc,this.editorDivPaste.bind(this));m(this,wn,void 0);m(this,Ye,"");m(this,th,`${this.id}-editor`);m(this,Ke,void 0);m(this,da,null);w(this,wn,e.color||$t._defaultColor||Dt._defaultLineColor),w(this,Ke,e.fontSize||$t._defaultFontSize)}static get _keyboardManager(){const e=$t.prototype,n=o=>o.isEmpty(),s=Jr.TRANSLATE_SMALL,r=Jr.TRANSLATE_BIG;return Tt(this,"_keyboardManager",new Yh([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-s,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-r,0],checker:n}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[s,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[r,0],checker:n}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-s],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-r],checker:n}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,s],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,r],checker:n}]]))}static initialize(e,n){Dt.initialize(e,n,{strings:["pdfjs-free-text-default-content"]});const s=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(s.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,n){switch(e){case ct.FREETEXT_SIZE:$t._defaultFontSize=n;break;case ct.FREETEXT_COLOR:$t._defaultColor=n;break}}updateParams(e,n){switch(e){case ct.FREETEXT_SIZE:A(this,cf,Iw).call(this,n);break;case ct.FREETEXT_COLOR:A(this,hf,Dw).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[ct.FREETEXT_SIZE,$t._defaultFontSize],[ct.FREETEXT_COLOR,$t._defaultColor||Dt._defaultLineColor]]}get propertiesToUpdate(){return[[ct.FREETEXT_SIZE,l(this,Ke)],[ct.FREETEXT_COLOR,l(this,wn)]]}_translateEmpty(e,n){this._uiManager.translateSelectedEditors(e,n,!0)}getInitialTranslation(){const e=this.parentScale;return[-$t._internalPadding*e,-($t._internalPadding+l(this,Ke))*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(_t.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",l(this,Jc)),this.editorDiv.addEventListener("focus",l(this,Kc)),this.editorDiv.addEventListener("blur",l(this,Yc)),this.editorDiv.addEventListener("input",l(this,Zc)),this.editorDiv.addEventListener("paste",l(this,Qc)))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",l(this,th)),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",l(this,Jc)),this.editorDiv.removeEventListener("focus",l(this,Kc)),this.editorDiv.removeEventListener("blur",l(this,Yc)),this.editorDiv.removeEventListener("input",l(this,Zc)),this.editorDiv.removeEventListener("paste",l(this,Qc)),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var e;this.width||(this.enableEditMode(),this.editorDiv.focus(),(e=this._initialOptions)!=null&&e.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=l(this,Ye),n=w(this,Ye,A(this,df,Fw).call(this).trimEnd());if(e===n)return;const s=r=>{if(w(this,Ye,r),!r){this.remove();return}A(this,pa,Bd).call(this),this._uiManager.rebuild(this),A(this,ua,Nd).call(this)};this.addCommands({cmd:()=>{s(n)},undo:()=>{s(e)},mustExec:!1}),A(this,ua,Nd).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){$t._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let e,n;this.width&&(e=this.x,n=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",l(this,th)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),Dt._l10nPromise.get("pdfjs-free-text-default-content").then(r=>{var o;return(o=this.editorDiv)==null?void 0:o.setAttribute("default-content",r)}),this.editorDiv.contentEditable=!0;const{style:s}=this.editorDiv;if(s.fontSize=`calc(${l(this,Ke)}px * var(--scale-factor))`,s.color=l(this,wn),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),su(this,this.div,["dblclick","keydown"]),this.width){const[r,o]=this.parentDimensions;if(this.annotationElementId){const{position:a}=l(this,da);let[c,d]=this.getInitialTranslation();[c,d]=this.pageTranslationToScreen(c,d);const[h,u]=this.pageDimensions,[p,v]=this.pageTranslation;let b,x;switch(this.rotation){case 0:b=e+(a[0]-p)/h,x=n+this.height-(a[1]-v)/u;break;case 90:b=e+(a[0]-p)/h,x=n-(a[1]-v)/u,[c,d]=[d,-c];break;case 180:b=e-this.width+(a[0]-p)/h,x=n-(a[1]-v)/u,[c,d]=[-c,-d];break;case 270:b=e+(a[0]-p-this.height*u)/h,x=n+(a[1]-v-this.width*h)/u,[c,d]=[-d,c];break}this.setAt(b*r,x*o,c,d)}else this.setAt(e*r,n*o,this.width*r,this.height*o);A(this,pa,Bd).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var b,x,_;const n=e.clipboardData||window.clipboardData,{types:s}=n;if(s.length===1&&s[0]==="text/plain")return;e.preventDefault();const r=A(b=$t,eh,gm).call(b,n.getData("text")||"").replaceAll(gd,`
268
- `);if(!r)return;const o=window.getSelection();if(!o.rangeCount)return;this.editorDiv.normalize(),o.deleteFromDocument();const a=o.getRangeAt(0);if(!r.includes(`
269
- `)){a.insertNode(document.createTextNode(r)),this.editorDiv.normalize(),o.collapseToStart();return}const{startContainer:c,startOffset:d}=a,h=[],u=[];if(c.nodeType===Node.TEXT_NODE){const E=c.parentElement;if(u.push(c.nodeValue.slice(d).replaceAll(gd,"")),E!==this.editorDiv){let R=h;for(const k of this.editorDiv.childNodes){if(k===E){R=u;continue}R.push(A(x=$t,fa,$d).call(x,k))}}h.push(c.nodeValue.slice(0,d).replaceAll(gd,""))}else if(c===this.editorDiv){let E=h,R=0;for(const k of this.editorDiv.childNodes)R++===d&&(E=u),E.push(A(_=$t,fa,$d).call(_,k))}w(this,Ye,`${h.join(`
270
- `)}${r}${u.join(`
271
- `)}`),A(this,pa,Bd).call(this);const p=new Range;let v=h.reduce((E,R)=>E+R.length,0);for(const{firstChild:E}of this.editorDiv.childNodes)if(E.nodeType===Node.TEXT_NODE){const R=E.nodeValue.length;if(v<=R){p.setStart(E,v),p.setEnd(E,v);break}v-=R}o.removeAllRanges(),o.addRange(p)}get contentDiv(){return this.editorDiv}static deserialize(e,n,s){var a;let r=null;if(e instanceof Tw){const{data:{defaultAppearanceData:{fontSize:c,fontColor:d},rect:h,rotation:u,id:p},textContent:v,textPosition:b,parent:{page:{pageNumber:x}}}=e;if(!v||v.length===0)return null;r=e={annotationType:_t.FREETEXT,color:Array.from(d),fontSize:c,value:v.join(`
272
- `),position:b,pageIndex:x-1,rect:h.slice(0),rotation:u,id:p,deleted:!1}}const o=super.deserialize(e,n,s);return w(o,Ke,e.fontSize),w(o,wn,et.makeHexColor(...e.color)),w(o,Ye,A(a=$t,eh,gm).call(a,e.value)),o.annotationElementId=e.id||null,w(o,da,r),o}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const n=$t._internalPadding*this.parentScale,s=this.getRect(n,n),r=Dt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:l(this,wn)),o={annotationType:_t.FREETEXT,color:r,fontSize:l(this,Ke),value:A(this,uf,Mw).call(this),pageIndex:this.pageIndex,rect:s,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?o:this.annotationElementId&&!A(this,ff,Ow).call(this,o)?null:(o.id=this.annotationElementId,o)}renderAnnotationElement(e){const n=super.renderAnnotationElement(e);if(this.deleted)return n;const{style:s}=n;s.fontSize=`calc(${l(this,Ke)}px * var(--scale-factor))`,s.color=l(this,wn),n.replaceChildren();for(const o of l(this,Ye).split(`
273
- `)){const a=document.createElement("div");a.append(o?document.createTextNode(o):document.createElement("br")),n.append(a)}const r=$t._internalPadding*this.parentScale;return e.updateEdited({rect:this.getRect(r,r),popupContent:l(this,Ye)}),n}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};Yc=new WeakMap,Kc=new WeakMap,Zc=new WeakMap,Jc=new WeakMap,Qc=new WeakMap,wn=new WeakMap,Ye=new WeakMap,th=new WeakMap,Ke=new WeakMap,da=new WeakMap,cf=new WeakSet,Iw=function(e){const n=r=>{this.editorDiv.style.fontSize=`calc(${r}px * var(--scale-factor))`,this.translate(0,-(r-l(this,Ke))*this.parentScale),w(this,Ke,r),A(this,ua,Nd).call(this)},s=l(this,Ke);this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ct.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},hf=new WeakSet,Dw=function(e){const n=r=>{w(this,wn,this.editorDiv.style.color=r)},s=l(this,wn);this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ct.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},df=new WeakSet,Fw=function(){var n;const e=[];this.editorDiv.normalize();for(const s of this.editorDiv.childNodes)e.push(A(n=$t,fa,$d).call(n,s));return e.join(`
274
- `)},ua=new WeakSet,Nd=function(){const[e,n]=this.parentDimensions;let s;if(this.isAttachedToDOM)s=this.div.getBoundingClientRect();else{const{currentLayer:r,div:o}=this,a=o.style.display,c=o.classList.contains("hidden");o.classList.remove("hidden"),o.style.display="hidden",r.div.append(this.div),s=o.getBoundingClientRect(),o.remove(),o.style.display=a,o.classList.toggle("hidden",c)}this.rotation%180===this.parentRotation%180?(this.width=s.width/e,this.height=s.height/n):(this.width=s.height/e,this.height=s.width/n),this.fixAndSetPosition()},fa=new WeakSet,$d=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(gd,"")},pa=new WeakSet,Bd=function(){if(this.editorDiv.replaceChildren(),!!l(this,Ye))for(const e of l(this,Ye).split(`
275
- `)){const n=document.createElement("div");n.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(n)}},uf=new WeakSet,Mw=function(){return l(this,Ye).replaceAll(" "," ")},eh=new WeakSet,gm=function(e){return e.replaceAll(" "," ")},ff=new WeakSet,Ow=function(e){const{value:n,fontSize:s,color:r,pageIndex:o}=l(this,da);return this._hasBeenMoved||e.value!==n||e.fontSize!==s||e.color.some((a,c)=>a!==r[c])||e.pageIndex!==o},m($t,fa),m($t,eh),ft($t,"_freeTextDefaultContent",""),ft($t,"_internalPadding",0),ft($t,"_defaultColor",null),ft($t,"_defaultFontSize",10),ft($t,"_type","freetext"),ft($t,"_editorType",_t.FREETEXT);let pm=$t;var nh,ds,An,pf,Nw,ga,jd,gf,$w,mf,Bw,ih,vm;class mm{constructor(t,e=0,n=0,s=!0){m(this,pf);m(this,ga);m(this,gf);m(this,mf);m(this,ih);m(this,nh,void 0);m(this,ds,[]);m(this,An,[]);let r=1/0,o=-1/0,a=1/0,c=-1/0;const h=10**-4;for(const{x:E,y:R,width:k,height:D}of t){const F=Math.floor((E-e)/h)*h,M=Math.ceil((E+k+e)/h)*h,O=Math.floor((R-e)/h)*h,C=Math.ceil((R+D+e)/h)*h,P=[F,O,C,!0],$=[M,O,C,!1];l(this,ds).push(P,$),r=Math.min(r,F),o=Math.max(o,M),a=Math.min(a,O),c=Math.max(c,C)}const u=o-r+2*n,p=c-a+2*n,v=r-n,b=a-n,x=l(this,ds).at(s?-1:-2),_=[x[0],x[2]];for(const E of l(this,ds)){const[R,k,D]=E;E[0]=(R-v)/u,E[1]=(k-b)/p,E[2]=(D-b)/p}w(this,nh,{x:v,y:b,width:u,height:p,lastPoint:_})}getOutlines(){l(this,ds).sort((e,n)=>e[0]-n[0]||e[1]-n[1]||e[2]-n[2]);const t=[];for(const e of l(this,ds))e[3]?(t.push(...A(this,ih,vm).call(this,e)),A(this,gf,$w).call(this,e)):(A(this,mf,Bw).call(this,e),t.push(...A(this,ih,vm).call(this,e)));return A(this,pf,Nw).call(this,t)}}nh=new WeakMap,ds=new WeakMap,An=new WeakMap,pf=new WeakSet,Nw=function(t){const e=[],n=new Set;for(const o of t){const[a,c,d]=o;e.push([a,c,o],[a,d,o])}e.sort((o,a)=>o[1]-a[1]||o[0]-a[0]);for(let o=0,a=e.length;o<a;o+=2){const c=e[o][2],d=e[o+1][2];c.push(d),d.push(c),n.add(c),n.add(d)}const s=[];let r;for(;n.size>0;){const o=n.values().next().value;let[a,c,d,h,u]=o;n.delete(o);let p=a,v=c;for(r=[a,d],s.push(r);;){let b;if(n.has(h))b=h;else if(n.has(u))b=u;else break;n.delete(b),[a,c,d,h,u]=b,p!==a&&(r.push(p,v,a,v===c?c:d),p=a),v=v===c?d:c}r.push(p,v)}return new p2(s,l(this,nh))},ga=new WeakSet,jd=function(t){const e=l(this,An);let n=0,s=e.length-1;for(;n<=s;){const r=n+s>>1,o=e[r][0];if(o===t)return r;o<t?n=r+1:s=r-1}return s+1},gf=new WeakSet,$w=function([,t,e]){const n=A(this,ga,jd).call(this,t);l(this,An).splice(n,0,[t,e])},mf=new WeakSet,Bw=function([,t,e]){const n=A(this,ga,jd).call(this,t);for(let s=n;s<l(this,An).length;s++){const[r,o]=l(this,An)[s];if(r!==t)break;if(r===t&&o===e){l(this,An).splice(s,1);return}}for(let s=n-1;s>=0;s--){const[r,o]=l(this,An)[s];if(r!==t)break;if(r===t&&o===e){l(this,An).splice(s,1);return}}},ih=new WeakSet,vm=function(t){const[e,n,s]=t,r=[[e,n,s]],o=A(this,ga,jd).call(this,s);for(let a=0;a<o;a++){const[c,d]=l(this,An)[a];for(let h=0,u=r.length;h<u;h++){const[,p,v]=r[h];if(!(d<=p||v<=c)){if(p>=c){if(v>d)r[h][1]=d;else{if(u===1)return[];r.splice(h,1),h--,u--}continue}r[h][2]=c,v>d&&r.push([e,d,v])}}}return r};class jw{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(t,e){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof ym}}var sh,ma;class p2 extends jw{constructor(e,n){super();m(this,sh,void 0);m(this,ma,void 0);w(this,ma,e),w(this,sh,n)}toSVGPath(){const e=[];for(const n of l(this,ma)){let[s,r]=n;e.push(`M${s} ${r}`);for(let o=2;o<n.length;o+=2){const a=n[o],c=n[o+1];a===s?(e.push(`V${c}`),r=c):c===r&&(e.push(`H${a}`),s=a)}e.push("Z")}return e.join(" ")}serialize([e,n,s,r],o){const a=[],c=s-e,d=r-n;for(const h of l(this,ma)){const u=new Array(h.length);for(let p=0;p<h.length;p+=2)u[p]=e+h[p]*c,u[p+1]=r-h[p+1]*d;a.push(u)}return a}get box(){return l(this,sh)}}sh=new WeakMap,ma=new WeakMap;var Hn,Pi,va,ba,zn,Et,Ar,xr,rh,oh,ya,wa,us,ah,vf,bf,lh,bm;const li=class li{constructor({x:t,y:e},n,s,r,o,a=0){m(this,lh);m(this,Hn,void 0);m(this,Pi,[]);m(this,va,void 0);m(this,ba,void 0);m(this,zn,[]);m(this,Et,new Float64Array(18));m(this,Ar,void 0);m(this,xr,void 0);m(this,rh,void 0);m(this,oh,void 0);m(this,ya,void 0);m(this,wa,void 0);m(this,us,[]);w(this,Hn,n),w(this,wa,r*s),w(this,ba,o),l(this,Et).set([NaN,NaN,NaN,NaN,t,e],6),w(this,va,a),w(this,oh,l(li,ah)*s),w(this,rh,l(li,bf)*s),w(this,ya,s),l(this,us).push(t,e)}get free(){return!0}isEmpty(){return isNaN(l(this,Et)[8])}add({x:t,y:e}){var P;w(this,Ar,t),w(this,xr,e);const[n,s,r,o]=l(this,Hn);let[a,c,d,h]=l(this,Et).subarray(8,12);const u=t-d,p=e-h,v=Math.hypot(u,p);if(v<l(this,rh))return!1;const b=v-l(this,oh),x=b/v,_=x*u,E=x*p;let R=a,k=c;a=d,c=h,d+=_,h+=E,(P=l(this,us))==null||P.push(t,e);const D=-E/b,F=_/b,M=D*l(this,wa),O=F*l(this,wa);return l(this,Et).set(l(this,Et).subarray(2,8),0),l(this,Et).set([d+M,h+O],4),l(this,Et).set(l(this,Et).subarray(14,18),12),l(this,Et).set([d-M,h-O],16),isNaN(l(this,Et)[6])?(l(this,zn).length===0&&(l(this,Et).set([a+M,c+O],2),l(this,zn).push(NaN,NaN,NaN,NaN,(a+M-n)/r,(c+O-s)/o),l(this,Et).set([a-M,c-O],14),l(this,Pi).push(NaN,NaN,NaN,NaN,(a-M-n)/r,(c-O-s)/o)),l(this,Et).set([R,k,a,c,d,h],6),!this.isEmpty()):(l(this,Et).set([R,k,a,c,d,h],6),Math.abs(Math.atan2(k-c,R-a)-Math.atan2(E,_))<Math.PI/2?([a,c,d,h]=l(this,Et).subarray(2,6),l(this,zn).push(NaN,NaN,NaN,NaN,((a+d)/2-n)/r,((c+h)/2-s)/o),[a,c,R,k]=l(this,Et).subarray(14,18),l(this,Pi).push(NaN,NaN,NaN,NaN,((R+a)/2-n)/r,((k+c)/2-s)/o),!0):([R,k,a,c,d,h]=l(this,Et).subarray(0,6),l(this,zn).push(((R+5*a)/6-n)/r,((k+5*c)/6-s)/o,((5*a+d)/6-n)/r,((5*c+h)/6-s)/o,((a+d)/2-n)/r,((c+h)/2-s)/o),[d,h,a,c,R,k]=l(this,Et).subarray(12,18),l(this,Pi).push(((R+5*a)/6-n)/r,((k+5*c)/6-s)/o,((5*a+d)/6-n)/r,((5*c+h)/6-s)/o,((a+d)/2-n)/r,((c+h)/2-s)/o),!0))}toSVGPath(){if(this.isEmpty())return"";const t=l(this,zn),e=l(this,Pi),n=l(this,Et).subarray(4,6),s=l(this,Et).subarray(16,18),[r,o,a,c]=l(this,Hn),[d,h,u,p]=A(this,lh,bm).call(this);if(isNaN(l(this,Et)[6])&&!this.isEmpty())return`M${(l(this,Et)[2]-r)/a} ${(l(this,Et)[3]-o)/c} L${(l(this,Et)[4]-r)/a} ${(l(this,Et)[5]-o)/c} L${d} ${h} L${u} ${p} L${(l(this,Et)[16]-r)/a} ${(l(this,Et)[17]-o)/c} L${(l(this,Et)[14]-r)/a} ${(l(this,Et)[15]-o)/c} Z`;const v=[];v.push(`M${t[4]} ${t[5]}`);for(let b=6;b<t.length;b+=6)isNaN(t[b])?v.push(`L${t[b+4]} ${t[b+5]}`):v.push(`C${t[b]} ${t[b+1]} ${t[b+2]} ${t[b+3]} ${t[b+4]} ${t[b+5]}`);v.push(`L${(n[0]-r)/a} ${(n[1]-o)/c} L${d} ${h} L${u} ${p} L${(s[0]-r)/a} ${(s[1]-o)/c}`);for(let b=e.length-6;b>=6;b-=6)isNaN(e[b])?v.push(`L${e[b+4]} ${e[b+5]}`):v.push(`C${e[b]} ${e[b+1]} ${e[b+2]} ${e[b+3]} ${e[b+4]} ${e[b+5]}`);return v.push(`L${e[4]} ${e[5]} Z`),v.join(" ")}getOutlines(){var E;const t=l(this,zn),e=l(this,Pi),n=l(this,Et),s=n.subarray(4,6),r=n.subarray(16,18),[o,a,c,d]=l(this,Hn),h=new Float64Array((((E=l(this,us))==null?void 0:E.length)??0)+2);for(let R=0,k=h.length-2;R<k;R+=2)h[R]=(l(this,us)[R]-o)/c,h[R+1]=(l(this,us)[R+1]-a)/d;h[h.length-2]=(l(this,Ar)-o)/c,h[h.length-1]=(l(this,xr)-a)/d;const[u,p,v,b]=A(this,lh,bm).call(this);if(isNaN(n[6])&&!this.isEmpty()){const R=new Float64Array(36);return R.set([NaN,NaN,NaN,NaN,(n[2]-o)/c,(n[3]-a)/d,NaN,NaN,NaN,NaN,(n[4]-o)/c,(n[5]-a)/d,NaN,NaN,NaN,NaN,u,p,NaN,NaN,NaN,NaN,v,b,NaN,NaN,NaN,NaN,(n[16]-o)/c,(n[17]-a)/d,NaN,NaN,NaN,NaN,(n[14]-o)/c,(n[15]-a)/d],0),new ym(R,h,l(this,Hn),l(this,ya),l(this,va),l(this,ba))}const x=new Float64Array(l(this,zn).length+24+l(this,Pi).length);let _=t.length;for(let R=0;R<_;R+=2){if(isNaN(t[R])){x[R]=x[R+1]=NaN;continue}x[R]=t[R],x[R+1]=t[R+1]}x.set([NaN,NaN,NaN,NaN,(s[0]-o)/c,(s[1]-a)/d,NaN,NaN,NaN,NaN,u,p,NaN,NaN,NaN,NaN,v,b,NaN,NaN,NaN,NaN,(r[0]-o)/c,(r[1]-a)/d],_),_+=24;for(let R=e.length-6;R>=6;R-=6)for(let k=0;k<6;k+=2){if(isNaN(e[R+k])){x[_]=x[_+1]=NaN,_+=2;continue}x[_]=e[R+k],x[_+1]=e[R+k+1],_+=2}return x.set([NaN,NaN,NaN,NaN,e[4],e[5]],_),new ym(x,h,l(this,Hn),l(this,ya),l(this,va),l(this,ba))}};Hn=new WeakMap,Pi=new WeakMap,va=new WeakMap,ba=new WeakMap,zn=new WeakMap,Et=new WeakMap,Ar=new WeakMap,xr=new WeakMap,rh=new WeakMap,oh=new WeakMap,ya=new WeakMap,wa=new WeakMap,us=new WeakMap,ah=new WeakMap,vf=new WeakMap,bf=new WeakMap,lh=new WeakSet,bm=function(){const t=l(this,Et).subarray(4,6),e=l(this,Et).subarray(16,18),[n,s,r,o]=l(this,Hn);return[(l(this,Ar)+(t[0]-e[0])/2-n)/r,(l(this,xr)+(t[1]-e[1])/2-s)/o,(l(this,Ar)+(e[0]-t[0])/2-n)/r,(l(this,xr)+(e[1]-t[1])/2-s)/o]},m(li,ah,8),m(li,vf,2),m(li,bf,l(li,ah)+l(li,vf));let lu=li;var Aa,Er,Ri,ch,Ze,hh,Zt,_r,ll,Sr,cl,yf,Uw;class ym extends jw{constructor(e,n,s,r,o,a){super();m(this,_r);m(this,Sr);m(this,yf);m(this,Aa,void 0);m(this,Er,null);m(this,Ri,void 0);m(this,ch,void 0);m(this,Ze,void 0);m(this,hh,void 0);m(this,Zt,void 0);w(this,Zt,e),w(this,Ze,n),w(this,Aa,s),w(this,hh,r),w(this,Ri,o),w(this,ch,a),A(this,yf,Uw).call(this,a);const{x:c,y:d,width:h,height:u}=l(this,Er);for(let p=0,v=e.length;p<v;p+=2)e[p]=(e[p]-c)/h,e[p+1]=(e[p+1]-d)/u;for(let p=0,v=n.length;p<v;p+=2)n[p]=(n[p]-c)/h,n[p+1]=(n[p+1]-d)/u}toSVGPath(){const e=[`M${l(this,Zt)[4]} ${l(this,Zt)[5]}`];for(let n=6,s=l(this,Zt).length;n<s;n+=6){if(isNaN(l(this,Zt)[n])){e.push(`L${l(this,Zt)[n+4]} ${l(this,Zt)[n+5]}`);continue}e.push(`C${l(this,Zt)[n]} ${l(this,Zt)[n+1]} ${l(this,Zt)[n+2]} ${l(this,Zt)[n+3]} ${l(this,Zt)[n+4]} ${l(this,Zt)[n+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,n,s,r],o){const a=s-e,c=r-n;let d,h;switch(o){case 0:d=A(this,_r,ll).call(this,l(this,Zt),e,r,a,-c),h=A(this,_r,ll).call(this,l(this,Ze),e,r,a,-c);break;case 90:d=A(this,Sr,cl).call(this,l(this,Zt),e,n,a,c),h=A(this,Sr,cl).call(this,l(this,Ze),e,n,a,c);break;case 180:d=A(this,_r,ll).call(this,l(this,Zt),s,n,-a,c),h=A(this,_r,ll).call(this,l(this,Ze),s,n,-a,c);break;case 270:d=A(this,Sr,cl).call(this,l(this,Zt),s,r,-a,-c),h=A(this,Sr,cl).call(this,l(this,Ze),s,r,-a,-c);break}return{outline:Array.from(d),points:[Array.from(h)]}}get box(){return l(this,Er)}getNewOutline(e,n){const{x:s,y:r,width:o,height:a}=l(this,Er),[c,d,h,u]=l(this,Aa),p=o*h,v=a*u,b=s*h+c,x=r*u+d,_=new lu({x:l(this,Ze)[0]*p+b,y:l(this,Ze)[1]*v+x},l(this,Aa),l(this,hh),e,l(this,ch),n??l(this,Ri));for(let E=2;E<l(this,Ze).length;E+=2)_.add({x:l(this,Ze)[E]*p+b,y:l(this,Ze)[E+1]*v+x});return _.getOutlines()}}Aa=new WeakMap,Er=new WeakMap,Ri=new WeakMap,ch=new WeakMap,Ze=new WeakMap,hh=new WeakMap,Zt=new WeakMap,_r=new WeakSet,ll=function(e,n,s,r,o){const a=new Float64Array(e.length);for(let c=0,d=e.length;c<d;c+=2)a[c]=n+e[c]*r,a[c+1]=s+e[c+1]*o;return a},Sr=new WeakSet,cl=function(e,n,s,r,o){const a=new Float64Array(e.length);for(let c=0,d=e.length;c<d;c+=2)a[c]=n+e[c+1]*r,a[c+1]=s+e[c]*o;return a},yf=new WeakSet,Uw=function(e){const n=l(this,Zt);let s=n[4],r=n[5],o=s,a=r,c=s,d=r,h=s,u=r;const p=e?Math.max:Math.min;for(let E=6,R=n.length;E<R;E+=6){if(isNaN(n[E]))o=Math.min(o,n[E+4]),a=Math.min(a,n[E+5]),c=Math.max(c,n[E+4]),d=Math.max(d,n[E+5]),u<n[E+5]?(h=n[E+4],u=n[E+5]):u===n[E+5]&&(h=p(h,n[E+4]));else{const k=et.bezierBoundingBox(s,r,...n.slice(E,E+6));o=Math.min(o,k[0]),a=Math.min(a,k[1]),c=Math.max(c,k[2]),d=Math.max(d,k[3]),u<k[3]?(h=k[2],u=k[3]):u===k[3]&&(h=p(h,k[2]))}s=n[E+4],r=n[E+5]}const v=o-l(this,Ri),b=a-l(this,Ri),x=c-o+2*l(this,Ri),_=d-a+2*l(this,Ri);w(this,Er,{x:v,y:b,width:x,height:_,lastPoint:[h,u]})};var dh,uh,xn,Cr,xa,se,fh,Ea,ph,gh,fs,_a,mh,wm,vh,Am,wf,zw,ki,Is,Af,Gw,Gn,Xi,Sn;let Hw=(Sn=class{constructor({editor:t=null,uiManager:e=null}){m(this,mh);m(this,vh);m(this,wf);m(this,ki);m(this,Af);m(this,Gn);m(this,dh,A(this,wf,zw).bind(this));m(this,uh,A(this,Af,Gw).bind(this));m(this,xn,null);m(this,Cr,null);m(this,xa,void 0);m(this,se,null);m(this,fh,!1);m(this,Ea,!1);m(this,ph,null);m(this,gh,void 0);m(this,fs,null);m(this,_a,void 0);var n;t?(w(this,Ea,!1),w(this,_a,ct.HIGHLIGHT_COLOR),w(this,ph,t)):(w(this,Ea,!0),w(this,_a,ct.HIGHLIGHT_DEFAULT_COLOR)),w(this,fs,(t==null?void 0:t._uiManager)||e),w(this,gh,l(this,fs)._eventBus),w(this,xa,(t==null?void 0:t.color)||((n=l(this,fs))==null?void 0:n.highlightColors.values().next().value)||"#FFFF98")}static get _keyboardManager(){return Tt(this,"_keyboardManager",new Yh([[["Escape","mac+Escape"],Sn.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Sn.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Sn.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Sn.prototype._moveToPrevious],[["Home","mac+Home"],Sn.prototype._moveToBeginning],[["End","mac+End"],Sn.prototype._moveToEnd]]))}renderButton(){const t=w(this,xn,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0),t.addEventListener("click",A(this,ki,Is).bind(this)),t.addEventListener("keydown",l(this,dh));const e=w(this,Cr,document.createElement("span"));return e.className="swatch",e.setAttribute("aria-hidden",!0),e.style.backgroundColor=l(this,xa),t.append(e),t}renderMainDropdown(){const t=w(this,se,A(this,mh,wm).call(this));return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}_colorSelectFromKeyboard(t){if(t.target===l(this,xn)){A(this,ki,Is).call(this,t);return}const e=t.target.getAttribute("data-color");e&&A(this,vh,Am).call(this,e,t)}_moveToNext(t){var e,n;if(!l(this,Gn,Xi)){A(this,ki,Is).call(this,t);return}if(t.target===l(this,xn)){(e=l(this,se).firstChild)==null||e.focus();return}(n=t.target.nextSibling)==null||n.focus()}_moveToPrevious(t){var e,n;if(t.target===((e=l(this,se))==null?void 0:e.firstChild)||t.target===l(this,xn)){l(this,Gn,Xi)&&this._hideDropdownFromKeyboard();return}l(this,Gn,Xi)||A(this,ki,Is).call(this,t),(n=t.target.previousSibling)==null||n.focus()}_moveToBeginning(t){var e;if(!l(this,Gn,Xi)){A(this,ki,Is).call(this,t);return}(e=l(this,se).firstChild)==null||e.focus()}_moveToEnd(t){var e;if(!l(this,Gn,Xi)){A(this,ki,Is).call(this,t);return}(e=l(this,se).lastChild)==null||e.focus()}hideDropdown(){var t;(t=l(this,se))==null||t.classList.add("hidden"),window.removeEventListener("pointerdown",l(this,uh))}_hideDropdownFromKeyboard(){var t;if(!l(this,Ea)){if(!l(this,Gn,Xi)){(t=l(this,ph))==null||t.unselect();return}this.hideDropdown(),l(this,xn).focus({preventScroll:!0,focusVisible:l(this,fh)})}}updateColor(t){if(l(this,Cr)&&(l(this,Cr).style.backgroundColor=t),!l(this,se))return;const e=l(this,fs).highlightColors.values();for(const n of l(this,se).children)n.setAttribute("aria-selected",e.next().value===t)}destroy(){var t,e;(t=l(this,xn))==null||t.remove(),w(this,xn,null),w(this,Cr,null),(e=l(this,se))==null||e.remove(),w(this,se,null)}},dh=new WeakMap,uh=new WeakMap,xn=new WeakMap,Cr=new WeakMap,xa=new WeakMap,se=new WeakMap,fh=new WeakMap,Ea=new WeakMap,ph=new WeakMap,gh=new WeakMap,fs=new WeakMap,_a=new WeakMap,mh=new WeakSet,wm=function(){const t=document.createElement("div");t.addEventListener("contextmenu",Ge),t.className="dropdown",t.role="listbox",t.setAttribute("aria-multiselectable",!1),t.setAttribute("aria-orientation","vertical"),t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[e,n]of l(this,fs).highlightColors){const s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",n),s.title=e,s.setAttribute("data-l10n-id",`pdfjs-editor-colorpicker-${e}`);const r=document.createElement("span");s.append(r),r.className="swatch",r.style.backgroundColor=n,s.setAttribute("aria-selected",n===l(this,xa)),s.addEventListener("click",A(this,vh,Am).bind(this,n)),t.append(s)}return t.addEventListener("keydown",l(this,dh)),t},vh=new WeakSet,Am=function(t,e){e.stopPropagation(),l(this,gh).dispatch("switchannotationeditorparams",{source:this,type:l(this,_a),value:t})},wf=new WeakSet,zw=function(t){Sn._keyboardManager.exec(this,t)},ki=new WeakSet,Is=function(t){if(l(this,Gn,Xi)){this.hideDropdown();return}if(w(this,fh,t.detail===0),window.addEventListener("pointerdown",l(this,uh)),l(this,se)){l(this,se).classList.remove("hidden");return}const e=w(this,se,A(this,mh,wm).call(this));l(this,xn).append(e)},Af=new WeakSet,Gw=function(t){var e;(e=l(this,se))!=null&&e.contains(t.target)||this.hideDropdown()},Gn=new WeakSet,Xi=function(){return l(this,se)&&!l(this,se).classList.contains("hidden")},Sn);var Sa,bh,ps,Tr,Ca,ln,yh,wh,Pr,En,De,Je,xf,Ta,Rr,re,Pa,Vn,Ah,xh,xm,Eh,Em,Ef,Vw,_f,Ww,Sf,qw,_h,_m,kr,hl,gs,go,Cf,Xw,Ra,Ud,Lr,dl,Tf,Yw,Pf,Kw,Rf,Zw,kf,Jw;const Ct=class Ct extends Dt{constructor(e){super({...e,name:"highlightEditor"});m(this,xh);m(this,Eh);m(this,Ef);m(this,_f);m(this,Sf);m(this,_h);m(this,kr);m(this,Cf);m(this,Ra);m(this,Lr);m(this,Tf);m(this,Pf);m(this,Sa,null);m(this,bh,0);m(this,ps,void 0);m(this,Tr,null);m(this,Ca,null);m(this,ln,null);m(this,yh,null);m(this,wh,0);m(this,Pr,null);m(this,En,null);m(this,De,null);m(this,Je,!1);m(this,xf,A(this,Cf,Xw).bind(this));m(this,Ta,null);m(this,Rr,void 0);m(this,re,null);m(this,Pa,"");m(this,Vn,void 0);m(this,Ah,"");this.color=e.color||Ct._defaultColor,w(this,Vn,e.thickness||Ct._defaultThickness),w(this,Rr,e.opacity||Ct._defaultOpacity),w(this,ps,e.boxes||null),w(this,Ah,e.methodOfCreation||""),w(this,Pa,e.text||""),this._isDraggable=!1,e.highlightId>-1?(w(this,Je,!0),A(this,Eh,Em).call(this,e),A(this,kr,hl).call(this)):(w(this,Sa,e.anchorNode),w(this,bh,e.anchorOffset),w(this,yh,e.focusNode),w(this,wh,e.focusOffset),A(this,xh,xm).call(this),A(this,kr,hl).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const e=Ct.prototype;return Tt(this,"_keyboardManager",new Yh([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:l(this,Je)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:l(this,Vn),methodOfCreation:l(this,Ah)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,n){var s;Dt.initialize(e,n),Ct._defaultColor||(Ct._defaultColor=((s=n.highlightColors)==null?void 0:s.values().next().value)||"#fff066")}static updateDefaultParams(e,n){switch(e){case ct.HIGHLIGHT_DEFAULT_COLOR:Ct._defaultColor=n;break;case ct.HIGHLIGHT_THICKNESS:Ct._defaultThickness=n;break}}translateInPage(e,n){}get toolbarPosition(){return l(this,Ta)}updateParams(e,n){switch(e){case ct.HIGHLIGHT_COLOR:A(this,Ef,Vw).call(this,n);break;case ct.HIGHLIGHT_THICKNESS:A(this,_f,Ww).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[ct.HIGHLIGHT_DEFAULT_COLOR,Ct._defaultColor],[ct.HIGHLIGHT_THICKNESS,Ct._defaultThickness]]}get propertiesToUpdate(){return[[ct.HIGHLIGHT_COLOR,this.color||Ct._defaultColor],[ct.HIGHLIGHT_THICKNESS,l(this,Vn)||Ct._defaultThickness],[ct.HIGHLIGHT_FREE,l(this,Je)]]}async addEditToolbar(){const e=await super.addEditToolbar();return e?(this._uiManager.highlightColors&&(w(this,Ca,new Hw({editor:this})),e.addColorPicker(l(this,Ca))),e):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(A(this,Lr,dl).call(this))}getBaseTranslation(){return[0,0]}getRect(e,n){return super.getRect(e,n,A(this,Lr,dl).call(this))}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){A(this,_h,_m).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(A(this,kr,hl).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var s;let n=!1;this.parent&&!e?A(this,_h,_m).call(this):e&&(A(this,kr,hl).call(this,e),n=!this.parent&&((s=this.div)==null?void 0:s.classList.contains("selectedEditor"))),super.setParent(e),this.show(this._isVisible),n&&this.select()}rotate(e){var r,o,a;const{drawLayer:n}=this.parent;let s;l(this,Je)?(e=(e-this.rotation+360)%360,s=A(r=Ct,gs,go).call(r,l(this,En).box,e)):s=A(o=Ct,gs,go).call(o,this,e),n.rotate(l(this,De),e),n.rotate(l(this,re),e),n.updateBox(l(this,De),s),n.updateBox(l(this,re),A(a=Ct,gs,go).call(a,l(this,ln).box,e))}render(){if(this.div)return this.div;const e=super.render();l(this,Pa)&&(e.setAttribute("aria-label",l(this,Pa)),e.setAttribute("role","mark")),l(this,Je)?e.classList.add("free"):this.div.addEventListener("keydown",l(this,xf));const n=w(this,Pr,document.createElement("div"));e.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",n.style.clipPath=l(this,Tr);const[s,r]=this.parentDimensions;return this.setDims(this.width*s,this.height*r),su(this,l(this,Pr),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.parent.drawLayer.addClass(l(this,re),"hovered")}pointerleave(){this.parent.drawLayer.removeClass(l(this,re),"hovered")}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:A(this,Ra,Ud).call(this,!0);break;case 1:case 3:A(this,Ra,Ud).call(this,!1);break}}select(){var e,n;super.select(),l(this,re)&&((e=this.parent)==null||e.drawLayer.removeClass(l(this,re),"hovered"),(n=this.parent)==null||n.drawLayer.addClass(l(this,re),"selected"))}unselect(){var e;super.unselect(),l(this,re)&&((e=this.parent)==null||e.drawLayer.removeClass(l(this,re),"selected"),l(this,Je)||A(this,Ra,Ud).call(this,!1))}get _mustFixPosition(){return!l(this,Je)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.show(l(this,De),e),this.parent.drawLayer.show(l(this,re),e))}static startHighlighting(e,n,{target:s,x:r,y:o}){const{x:a,y:c,width:d,height:h}=s.getBoundingClientRect(),u=x=>{A(this,Rf,Zw).call(this,e,x)},p={capture:!0,passive:!1},v=x=>{x.preventDefault(),x.stopPropagation()},b=x=>{s.removeEventListener("pointermove",u),window.removeEventListener("blur",b),window.removeEventListener("pointerup",b),window.removeEventListener("pointerdown",v,p),window.removeEventListener("contextmenu",Ge),A(this,kf,Jw).call(this,e,x)};window.addEventListener("blur",b),window.addEventListener("pointerup",b),window.addEventListener("pointerdown",v,p),window.addEventListener("contextmenu",Ge),s.addEventListener("pointermove",u),this._freeHighlight=new lu({x:r,y:o},[a,c,d,h],e.scale,this._defaultThickness/2,n,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static deserialize(e,n,s){var x;const r=super.deserialize(e,n,s),{rect:[o,a,c,d],color:h,quadPoints:u}=e;r.color=et.makeHexColor(...h),w(r,Rr,e.opacity);const[p,v]=r.pageDimensions;r.width=(c-o)/p,r.height=(d-a)/v;const b=w(r,ps,[]);for(let _=0;_<u.length;_+=8)b.push({x:(u[4]-c)/p,y:(d-(1-u[_+5]))/v,width:(u[_+2]-u[_])/p,height:(u[_+5]-u[_+1])/v});return A(x=r,xh,xm).call(x),r}serialize(e=!1){if(this.isEmpty()||e)return null;const n=this.getRect(0,0),s=Dt._colorManager.convert(this.color);return{annotationType:_t.HIGHLIGHT,color:s,opacity:l(this,Rr),thickness:l(this,Vn),quadPoints:A(this,Tf,Yw).call(this),outlines:A(this,Pf,Kw).call(this,n),pageIndex:this.pageIndex,rect:n,rotation:A(this,Lr,dl).call(this),structTreeParentId:this._structTreeParentId}}static canCreateNewEmptyEditor(){return!1}};Sa=new WeakMap,bh=new WeakMap,ps=new WeakMap,Tr=new WeakMap,Ca=new WeakMap,ln=new WeakMap,yh=new WeakMap,wh=new WeakMap,Pr=new WeakMap,En=new WeakMap,De=new WeakMap,Je=new WeakMap,xf=new WeakMap,Ta=new WeakMap,Rr=new WeakMap,re=new WeakMap,Pa=new WeakMap,Vn=new WeakMap,Ah=new WeakMap,xh=new WeakSet,xm=function(){const e=new mm(l(this,ps),.001);w(this,En,e.getOutlines()),{x:this.x,y:this.y,width:this.width,height:this.height}=l(this,En).box;const n=new mm(l(this,ps),.0025,.001,this._uiManager.direction==="ltr");w(this,ln,n.getOutlines());const{lastPoint:s}=l(this,ln).box;w(this,Ta,[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height])},Eh=new WeakSet,Em=function({highlightOutlines:e,highlightId:n,clipPathId:s}){var u,p;if(w(this,En,e),w(this,ln,e.getNewOutline(l(this,Vn)/2+1.5,.0025)),n>=0)w(this,De,n),w(this,Tr,s),this.parent.drawLayer.finalizeLine(n,e),w(this,re,this.parent.drawLayer.highlightOutline(l(this,ln)));else if(this.parent){const v=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(l(this,De),e),this.parent.drawLayer.updateBox(l(this,De),A(u=Ct,gs,go).call(u,l(this,En).box,(v-this.rotation+360)%360)),this.parent.drawLayer.updateLine(l(this,re),l(this,ln)),this.parent.drawLayer.updateBox(l(this,re),A(p=Ct,gs,go).call(p,l(this,ln).box,v))}const{x:o,y:a,width:c,height:d}=e.box;switch(this.rotation){case 0:this.x=o,this.y=a,this.width=c,this.height=d;break;case 90:{const[v,b]=this.parentDimensions;this.x=a,this.y=1-o,this.width=c*b/v,this.height=d*v/b;break}case 180:this.x=1-o,this.y=1-a,this.width=c,this.height=d;break;case 270:{const[v,b]=this.parentDimensions;this.x=1-a,this.y=o,this.width=c*b/v,this.height=d*v/b;break}}const{lastPoint:h}=l(this,ln).box;w(this,Ta,[(h[0]-o)/c,(h[1]-a)/d])},Ef=new WeakSet,Vw=function(e){const n=r=>{var o,a;this.color=r,(o=this.parent)==null||o.drawLayer.changeColor(l(this,De),r),(a=l(this,Ca))==null||a.updateColor(r)},s=this.color;this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ct.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(e)},!0)},_f=new WeakSet,Ww=function(e){const n=l(this,Vn),s=r=>{w(this,Vn,r),A(this,Sf,qw).call(this,r)};this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ct.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},Sf=new WeakSet,qw=function(e){if(!l(this,Je))return;A(this,Eh,Em).call(this,{highlightOutlines:l(this,En).getNewOutline(e/2)}),this.fixAndSetPosition();const[n,s]=this.parentDimensions;this.setDims(this.width*n,this.height*s)},_h=new WeakSet,_m=function(){l(this,De)===null||!this.parent||(this.parent.drawLayer.remove(l(this,De)),w(this,De,null),this.parent.drawLayer.remove(l(this,re)),w(this,re,null))},kr=new WeakSet,hl=function(e=this.parent){l(this,De)===null&&({id:Ve(this,De)._,clipPathId:Ve(this,Tr)._}=e.drawLayer.highlight(l(this,En),this.color,l(this,Rr)),w(this,re,e.drawLayer.highlightOutline(l(this,ln))),l(this,Pr)&&(l(this,Pr).style.clipPath=l(this,Tr)))},gs=new WeakSet,go=function({x:e,y:n,width:s,height:r},o){switch(o){case 90:return{x:1-n-r,y:e,width:r,height:s};case 180:return{x:1-e-s,y:1-n-r,width:s,height:r};case 270:return{x:n,y:1-e-s,width:r,height:s}}return{x:e,y:n,width:s,height:r}},Cf=new WeakSet,Xw=function(e){Ct._keyboardManager.exec(this,e)},Ra=new WeakSet,Ud=function(e){if(!l(this,Sa))return;const n=window.getSelection();e?n.setPosition(l(this,Sa),l(this,bh)):n.setPosition(l(this,yh),l(this,wh))},Lr=new WeakSet,dl=function(){return l(this,Je)?this.rotation:0},Tf=new WeakSet,Yw=function(){if(l(this,Je))return null;const[e,n]=this.pageDimensions,s=l(this,ps),r=new Array(s.length*8);let o=0;for(const{x:a,y:c,width:d,height:h}of s){const u=a*e,p=(1-c-h)*n;r[o]=r[o+4]=u,r[o+1]=r[o+3]=p,r[o+2]=r[o+6]=u+d*e,r[o+5]=r[o+7]=p+h*n,o+=8}return r},Pf=new WeakSet,Kw=function(e){return l(this,En).serialize(e,A(this,Lr,dl).call(this))},Rf=new WeakSet,Zw=function(e,n){this._freeHighlight.add(n)&&e.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},kf=new WeakSet,Jw=function(e,n){this._freeHighlight.isEmpty()?e.drawLayer.removeFreeHighlight(this._freeHighlightId):e.createAndAddNewEditor(n,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},m(Ct,gs),m(Ct,Rf),m(Ct,kf),ft(Ct,"_defaultColor",null),ft(Ct,"_defaultOpacity",1),ft(Ct,"_defaultThickness",12),ft(Ct,"_l10nPromise"),ft(Ct,"_type","highlight"),ft(Ct,"_editorType",_t.HIGHLIGHT),ft(Ct,"_freeHighlightId",-1),ft(Ct,"_freeHighlight",null),ft(Ct,"_freeHighlightClipId","");let cu=Ct;var Ir,Dr,Sh,Ch,Th,Fr,Wn,Li,cn,Mr,Or,Nr,$r,Br,ms,Lf,Qw,If,t1,Df,e1,Ff,n1,Ph,Cm,Mf,i1,Rh,Tm,Of,s1,Nf,r1,$f,o1,Bf,a1,jf,l1,Ii,Ds,kh,Pm,ka,Hd,La,zd,vs,mo,Lh,Rm,Ia,Gd,Uf,c1,Ih,km,Hf,h1,zf,d1,Dh,Lm,Da,Vd,jr,ul;const Ht=class Ht extends Dt{constructor(e){super({...e,name:"inkEditor"});m(this,Lf);m(this,If);m(this,Df);m(this,Ff);m(this,Ph);m(this,Mf);m(this,Rh);m(this,Of);m(this,Nf);m(this,$f);m(this,Bf);m(this,jf);m(this,Ii);m(this,kh);m(this,ka);m(this,La);m(this,vs);m(this,Lh);m(this,Ia);m(this,zf);m(this,Dh);m(this,Da);m(this,jr);m(this,Ir,0);m(this,Dr,0);m(this,Sh,this.canvasPointermove.bind(this));m(this,Ch,this.canvasPointerleave.bind(this));m(this,Th,this.canvasPointerup.bind(this));m(this,Fr,this.canvasPointerdown.bind(this));m(this,Wn,null);m(this,Li,new Path2D);m(this,cn,!1);m(this,Mr,!1);m(this,Or,!1);m(this,Nr,null);m(this,$r,0);m(this,Br,0);m(this,ms,null);this.color=e.color||null,this.thickness=e.thickness||null,this.opacity=e.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(e,n){Dt.initialize(e,n)}static updateDefaultParams(e,n){switch(e){case ct.INK_THICKNESS:Ht._defaultThickness=n;break;case ct.INK_COLOR:Ht._defaultColor=n;break;case ct.INK_OPACITY:Ht._defaultOpacity=n/100;break}}updateParams(e,n){switch(e){case ct.INK_THICKNESS:A(this,Lf,Qw).call(this,n);break;case ct.INK_COLOR:A(this,If,t1).call(this,n);break;case ct.INK_OPACITY:A(this,Df,e1).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[ct.INK_THICKNESS,Ht._defaultThickness],[ct.INK_COLOR,Ht._defaultColor||Dt._defaultLineColor],[ct.INK_OPACITY,Math.round(Ht._defaultOpacity*100)]]}get propertiesToUpdate(){return[[ct.INK_THICKNESS,this.thickness||Ht._defaultThickness],[ct.INK_COLOR,this.color||Ht._defaultColor||Dt._defaultLineColor],[ct.INK_OPACITY,Math.round(100*(this.opacity??Ht._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(A(this,ka,Hd).call(this),A(this,La,zd).call(this)),this.isAttachedToDOM||(this.parent.add(this),A(this,vs,mo).call(this)),A(this,jr,ul).call(this)))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,l(this,Wn)&&(clearTimeout(l(this,Wn)),w(this,Wn,null)),l(this,Nr).disconnect(),w(this,Nr,null),super.remove())}setParent(e){!this.parent&&e?this._uiManager.removeShouldRescale(this):this.parent&&e===null&&this._uiManager.addShouldRescale(this),super.setParent(e)}onScaleChanging(){const[e,n]=this.parentDimensions,s=this.width*e,r=this.height*n;this.setDimensions(s,r)}enableEditMode(){l(this,cn)||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",l(this,Fr)))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",l(this,Fr)))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){l(this,cn)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),w(this,cn,!0),this.div.classList.add("disabled"),A(this,jr,ul).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),this.enableEditMode())}canvasPointerdown(e){e.button!==0||!this.isInEditMode()||l(this,cn)||(this.setInForeground(),e.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),A(this,Mf,i1).call(this,e.offsetX,e.offsetY))}canvasPointermove(e){e.preventDefault(),A(this,Rh,Tm).call(this,e.offsetX,e.offsetY)}canvasPointerup(e){e.preventDefault(),A(this,kh,Pm).call(this,e)}canvasPointerleave(e){A(this,kh,Pm).call(this,e)}get isResizable(){return!this.isEmpty()&&l(this,cn)}render(){if(this.div)return this.div;let e,n;this.width&&(e=this.x,n=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[s,r,o,a]=A(this,Ff,n1).call(this);if(this.setAt(s,r,0,0),this.setDims(o,a),A(this,ka,Hd).call(this),this.width){const[c,d]=this.parentDimensions;this.setAspectRatio(this.width*c,this.height*d),this.setAt(e*c,n*d,this.width*c,this.height*d),w(this,Or,!0),A(this,vs,mo).call(this),this.setDims(this.width*c,this.height*d),A(this,Ii,Ds).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return A(this,La,zd).call(this),this.div}setDimensions(e,n){const s=Math.round(e),r=Math.round(n);if(l(this,$r)===s&&l(this,Br)===r)return;w(this,$r,s),w(this,Br,r),this.canvas.style.visibility="hidden";const[o,a]=this.parentDimensions;this.width=e/o,this.height=n/a,this.fixAndSetPosition(),l(this,cn)&&A(this,Lh,Rm).call(this,e,n),A(this,vs,mo).call(this),A(this,Ii,Ds).call(this),this.canvas.style.visibility="visible",this.fixDims()}static deserialize(e,n,s){var _,E,R;if(e instanceof Rw)return null;const r=super.deserialize(e,n,s);r.thickness=e.thickness,r.color=et.makeHexColor(...e.color),r.opacity=e.opacity;const[o,a]=r.pageDimensions,c=r.width*o,d=r.height*a,h=r.parentScale,u=e.thickness/2;w(r,cn,!0),w(r,$r,Math.round(c)),w(r,Br,Math.round(d));const{paths:p,rect:v,rotation:b}=e;for(let{bezier:k}of p){k=A(_=Ht,Hf,h1).call(_,k,v,b);const D=[];r.paths.push(D);let F=h*(k[0]-u),M=h*(k[1]-u);for(let C=2,P=k.length;C<P;C+=6){const $=h*(k[C]-u),N=h*(k[C+1]-u),H=h*(k[C+2]-u),z=h*(k[C+3]-u),V=h*(k[C+4]-u),Z=h*(k[C+5]-u);D.push([[F,M],[$,N],[H,z],[V,Z]]),F=V,M=Z}const O=A(this,Uf,c1).call(this,D);r.bezierPath2D.push(O)}const x=A(E=r,Dh,Lm).call(E);return w(r,Dr,Math.max(Dt.MIN_SIZE,x[2]-x[0])),w(r,Ir,Math.max(Dt.MIN_SIZE,x[3]-x[1])),A(R=r,Lh,Rm).call(R,c,d),r}serialize(){if(this.isEmpty())return null;const e=this.getRect(0,0),n=Dt._colorManager.convert(this.ctx.strokeStyle);return{annotationType:_t.INK,color:n,thickness:this.thickness,opacity:this.opacity,paths:A(this,zf,d1).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,e),pageIndex:this.pageIndex,rect:e,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}};Ir=new WeakMap,Dr=new WeakMap,Sh=new WeakMap,Ch=new WeakMap,Th=new WeakMap,Fr=new WeakMap,Wn=new WeakMap,Li=new WeakMap,cn=new WeakMap,Mr=new WeakMap,Or=new WeakMap,Nr=new WeakMap,$r=new WeakMap,Br=new WeakMap,ms=new WeakMap,Lf=new WeakSet,Qw=function(e){const n=r=>{this.thickness=r,A(this,jr,ul).call(this)},s=this.thickness;this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ct.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},If=new WeakSet,t1=function(e){const n=r=>{this.color=r,A(this,Ii,Ds).call(this)},s=this.color;this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ct.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Df=new WeakSet,e1=function(e){const n=r=>{this.opacity=r,A(this,Ii,Ds).call(this)};e/=100;const s=this.opacity;this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ct.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},Ff=new WeakSet,n1=function(){const{parentRotation:e,parentDimensions:[n,s]}=this;switch(e){case 90:return[0,s,s,n];case 180:return[n,s,n,s];case 270:return[n,0,s,n];default:return[0,0,n,s]}},Ph=new WeakSet,Cm=function(){const{ctx:e,color:n,opacity:s,thickness:r,parentScale:o,scaleFactor:a}=this;e.lineWidth=r*o/a,e.lineCap="round",e.lineJoin="round",e.miterLimit=10,e.strokeStyle=`${n}${$k(s)}`},Mf=new WeakSet,i1=function(e,n){this.canvas.addEventListener("contextmenu",Ge),this.canvas.addEventListener("pointerleave",l(this,Ch)),this.canvas.addEventListener("pointermove",l(this,Sh)),this.canvas.addEventListener("pointerup",l(this,Th)),this.canvas.removeEventListener("pointerdown",l(this,Fr)),this.isEditing=!0,l(this,Or)||(w(this,Or,!0),A(this,vs,mo).call(this),this.thickness||(this.thickness=Ht._defaultThickness),this.color||(this.color=Ht._defaultColor||Dt._defaultLineColor),this.opacity??(this.opacity=Ht._defaultOpacity)),this.currentPath.push([e,n]),w(this,Mr,!1),A(this,Ph,Cm).call(this),w(this,ms,()=>{A(this,$f,o1).call(this),l(this,ms)&&window.requestAnimationFrame(l(this,ms))}),window.requestAnimationFrame(l(this,ms))},Rh=new WeakSet,Tm=function(e,n){const[s,r]=this.currentPath.at(-1);if(this.currentPath.length>1&&e===s&&n===r)return;const o=this.currentPath;let a=l(this,Li);if(o.push([e,n]),w(this,Mr,!0),o.length<=2){a.moveTo(...o[0]),a.lineTo(e,n);return}o.length===3&&(w(this,Li,a=new Path2D),a.moveTo(...o[0])),A(this,Bf,a1).call(this,a,...o.at(-3),...o.at(-2),e,n)},Of=new WeakSet,s1=function(){if(this.currentPath.length===0)return;const e=this.currentPath.at(-1);l(this,Li).lineTo(...e)},Nf=new WeakSet,r1=function(e,n){w(this,ms,null),e=Math.min(Math.max(e,0),this.canvas.width),n=Math.min(Math.max(n,0),this.canvas.height),A(this,Rh,Tm).call(this,e,n),A(this,Of,s1).call(this);let s;if(this.currentPath.length!==1)s=A(this,jf,l1).call(this);else{const d=[e,n];s=[[d,d.slice(),d.slice(),d]]}const r=l(this,Li),o=this.currentPath;this.currentPath=[],w(this,Li,new Path2D);const a=()=>{this.allRawPaths.push(o),this.paths.push(s),this.bezierPath2D.push(r),this._uiManager.rebuild(this)},c=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(A(this,ka,Hd).call(this),A(this,La,zd).call(this)),A(this,jr,ul).call(this))};this.addCommands({cmd:a,undo:c,mustExec:!0})},$f=new WeakSet,o1=function(){if(!l(this,Mr))return;w(this,Mr,!1);const e=Math.ceil(this.thickness*this.parentScale),n=this.currentPath.slice(-3),s=n.map(a=>a[0]),r=n.map(a=>a[1]);Math.min(...s)-e,Math.max(...s)+e,Math.min(...r)-e,Math.max(...r)+e;const{ctx:o}=this;o.save(),o.clearRect(0,0,this.canvas.width,this.canvas.height);for(const a of this.bezierPath2D)o.stroke(a);o.stroke(l(this,Li)),o.restore()},Bf=new WeakSet,a1=function(e,n,s,r,o,a,c){const d=(n+r)/2,h=(s+o)/2,u=(r+a)/2,p=(o+c)/2;e.bezierCurveTo(d+2*(r-d)/3,h+2*(o-h)/3,u+2*(r-u)/3,p+2*(o-p)/3,u,p)},jf=new WeakSet,l1=function(){const e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];const n=[];let s,[r,o]=e[0];for(s=1;s<e.length-2;s++){const[v,b]=e[s],[x,_]=e[s+1],E=(v+x)/2,R=(b+_)/2,k=[r+2*(v-r)/3,o+2*(b-o)/3],D=[E+2*(v-E)/3,R+2*(b-R)/3];n.push([[r,o],k,D,[E,R]]),[r,o]=[E,R]}const[a,c]=e[s],[d,h]=e[s+1],u=[r+2*(a-r)/3,o+2*(c-o)/3],p=[d+2*(a-d)/3,h+2*(c-h)/3];return n.push([[r,o],u,p,[d,h]]),n},Ii=new WeakSet,Ds=function(){if(this.isEmpty()){A(this,Ia,Gd).call(this);return}A(this,Ph,Cm).call(this);const{canvas:e,ctx:n}=this;n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,e.width,e.height),A(this,Ia,Gd).call(this);for(const s of this.bezierPath2D)n.stroke(s)},kh=new WeakSet,Pm=function(e){this.canvas.removeEventListener("pointerleave",l(this,Ch)),this.canvas.removeEventListener("pointermove",l(this,Sh)),this.canvas.removeEventListener("pointerup",l(this,Th)),this.canvas.addEventListener("pointerdown",l(this,Fr)),l(this,Wn)&&clearTimeout(l(this,Wn)),w(this,Wn,setTimeout(()=>{w(this,Wn,null),this.canvas.removeEventListener("contextmenu",Ge)},10)),A(this,Nf,r1).call(this,e.offsetX,e.offsetY),this.addToAnnotationStorage(),this.setInBackground()},ka=new WeakSet,Hd=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},La=new WeakSet,zd=function(){w(this,Nr,new ResizeObserver(e=>{const n=e[0].contentRect;n.width&&n.height&&this.setDimensions(n.width,n.height)})),l(this,Nr).observe(this.div)},vs=new WeakSet,mo=function(){if(!l(this,Or))return;const[e,n]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*n),A(this,Ia,Gd).call(this)},Lh=new WeakSet,Rm=function(e,n){const s=A(this,Da,Vd).call(this),r=(e-s)/l(this,Dr),o=(n-s)/l(this,Ir);this.scaleFactor=Math.min(r,o)},Ia=new WeakSet,Gd=function(){const e=A(this,Da,Vd).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)},Uf=new WeakSet,c1=function(e){const n=new Path2D;for(let s=0,r=e.length;s<r;s++){const[o,a,c,d]=e[s];s===0&&n.moveTo(...o),n.bezierCurveTo(a[0],a[1],c[0],c[1],d[0],d[1])}return n},Ih=new WeakSet,km=function(e,n,s){const[r,o,a,c]=n;switch(s){case 0:for(let d=0,h=e.length;d<h;d+=2)e[d]+=r,e[d+1]=c-e[d+1];break;case 90:for(let d=0,h=e.length;d<h;d+=2){const u=e[d];e[d]=e[d+1]+r,e[d+1]=u+o}break;case 180:for(let d=0,h=e.length;d<h;d+=2)e[d]=a-e[d],e[d+1]+=o;break;case 270:for(let d=0,h=e.length;d<h;d+=2){const u=e[d];e[d]=a-e[d+1],e[d+1]=c-u}break;default:throw new Error("Invalid rotation")}return e},Hf=new WeakSet,h1=function(e,n,s){const[r,o,a,c]=n;switch(s){case 0:for(let d=0,h=e.length;d<h;d+=2)e[d]-=r,e[d+1]=c-e[d+1];break;case 90:for(let d=0,h=e.length;d<h;d+=2){const u=e[d];e[d]=e[d+1]-o,e[d+1]=u-r}break;case 180:for(let d=0,h=e.length;d<h;d+=2)e[d]=a-e[d],e[d+1]-=o;break;case 270:for(let d=0,h=e.length;d<h;d+=2){const u=e[d];e[d]=c-e[d+1],e[d+1]=a-u}break;default:throw new Error("Invalid rotation")}return e},zf=new WeakSet,d1=function(e,n,s,r){var h,u;const o=[],a=this.thickness/2,c=e*n+a,d=e*s+a;for(const p of this.paths){const v=[],b=[];for(let x=0,_=p.length;x<_;x++){const[E,R,k,D]=p[x];if(E[0]===D[0]&&E[1]===D[1]&&_===1){const z=e*E[0]+c,V=e*E[1]+d;v.push(z,V),b.push(z,V);break}const F=e*E[0]+c,M=e*E[1]+d,O=e*R[0]+c,C=e*R[1]+d,P=e*k[0]+c,$=e*k[1]+d,N=e*D[0]+c,H=e*D[1]+d;x===0&&(v.push(F,M),b.push(F,M)),v.push(O,C,P,$,N,H),b.push(O,C),x===_-1&&b.push(N,H)}o.push({bezier:A(h=Ht,Ih,km).call(h,v,r,this.rotation),points:A(u=Ht,Ih,km).call(u,b,r,this.rotation)})}return o},Dh=new WeakSet,Lm=function(){let e=1/0,n=-1/0,s=1/0,r=-1/0;for(const o of this.paths)for(const[a,c,d,h]of o){const u=et.bezierBoundingBox(...a,...c,...d,...h);e=Math.min(e,u[0]),s=Math.min(s,u[1]),n=Math.max(n,u[2]),r=Math.max(r,u[3])}return[e,s,n,r]},Da=new WeakSet,Vd=function(){return l(this,cn)?Math.ceil(this.thickness*this.parentScale):0},jr=new WeakSet,ul=function(e=!1){if(this.isEmpty())return;if(!l(this,cn)){A(this,Ii,Ds).call(this);return}const n=A(this,Dh,Lm).call(this),s=A(this,Da,Vd).call(this);w(this,Dr,Math.max(Dt.MIN_SIZE,n[2]-n[0])),w(this,Ir,Math.max(Dt.MIN_SIZE,n[3]-n[1]));const r=Math.ceil(s+l(this,Dr)*this.scaleFactor),o=Math.ceil(s+l(this,Ir)*this.scaleFactor),[a,c]=this.parentDimensions;this.width=r/a,this.height=o/c,this.setAspectRatio(r,o);const d=this.translationX,h=this.translationY;this.translationX=-n[0],this.translationY=-n[1],A(this,vs,mo).call(this),A(this,Ii,Ds).call(this),w(this,$r,r),w(this,Br,o),this.setDims(r,o);const u=e?s/this.scaleFactor/2:0;this.translate(d-this.translationX-u,h-this.translationY-u)},m(Ht,Uf),m(Ht,Ih),m(Ht,Hf),ft(Ht,"_defaultColor",null),ft(Ht,"_defaultOpacity",1),ft(Ht,"_defaultThickness",1),ft(Ht,"_type","ink"),ft(Ht,"_editorType",_t.INK);let Sm=Ht;var Ae,xe,bs,Di,ys,Fa,qn,Ur,Xn,_n,Fh,Hr,fl,zr,pl,Ma,Wd,Mh,Dm,Gf,u1,Vf,f1,Oh,Fm,Oa,qd,Wf,p1;const bl=class bl extends Dt{constructor(e){super({...e,name:"stampEditor"});m(this,Hr);m(this,zr);m(this,Ma);m(this,Mh);m(this,Gf);m(this,Vf);m(this,Oh);m(this,Oa);m(this,Wf);m(this,Ae,null);m(this,xe,null);m(this,bs,null);m(this,Di,null);m(this,ys,null);m(this,Fa,"");m(this,qn,null);m(this,Ur,null);m(this,Xn,null);m(this,_n,!1);m(this,Fh,!1);w(this,Di,e.bitmapUrl),w(this,ys,e.bitmapFile)}static initialize(e,n){Dt.initialize(e,n)}static get supportedTypes(){return Tt(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(n=>`image/${n}`))}static get supportedTypesStr(){return Tt(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,n){n.pasteEditor(_t.STAMP,{bitmapFile:e.getAsFile()})}remove(){var e,n;l(this,xe)&&(w(this,Ae,null),this._uiManager.imageManager.deleteId(l(this,xe)),(e=l(this,qn))==null||e.remove(),w(this,qn,null),(n=l(this,Ur))==null||n.disconnect(),w(this,Ur,null),l(this,Xn)&&(clearTimeout(l(this,Xn)),w(this,Xn,null))),super.remove()}rebuild(){if(!this.parent){l(this,xe)&&A(this,Ma,Wd).call(this);return}super.rebuild(),this.div!==null&&(l(this,xe)&&l(this,qn)===null&&A(this,Ma,Wd).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(l(this,bs)||l(this,Ae)||l(this,Di)||l(this,ys)||l(this,xe))}get isResizable(){return!0}render(){if(this.div)return this.div;let e,n;if(this.width&&(e=this.x,n=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),l(this,Ae)?A(this,Mh,Dm).call(this):A(this,Ma,Wd).call(this),this.width){const[s,r]=this.parentDimensions;this.setAt(e*s,n*r,this.width*s,this.height*r)}return this.div}getImageForAltText(){return l(this,qn)}static deserialize(e,n,s){if(e instanceof kw)return null;const r=super.deserialize(e,n,s),{rect:o,bitmapUrl:a,bitmapId:c,isSvg:d,accessibilityData:h}=e;c&&s.imageManager.isValidId(c)?w(r,xe,c):w(r,Di,a),w(r,_n,d);const[u,p]=r.pageDimensions;return r.width=(o[2]-o[0])/u,r.height=(o[3]-o[1])/p,h&&(r.altTextData=h),r}serialize(e=!1,n=null){if(this.isEmpty())return null;const s={annotationType:_t.STAMP,bitmapId:l(this,xe),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:l(this,_n),structTreeParentId:this._structTreeParentId};if(e)return s.bitmapUrl=A(this,Oa,qd).call(this,!0),s.accessibilityData=this.altTextData,s;const{decorative:r,altText:o}=this.altTextData;if(!r&&o&&(s.accessibilityData={type:"Figure",alt:o}),n===null)return s;n.stamps||(n.stamps=new Map);const a=l(this,_n)?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(!n.stamps.has(l(this,xe)))n.stamps.set(l(this,xe),{area:a,serialized:s}),s.bitmap=A(this,Oa,qd).call(this,!1);else if(l(this,_n)){const c=n.stamps.get(l(this,xe));a>c.area&&(c.area=a,c.serialized.bitmap.close(),c.serialized.bitmap=A(this,Oa,qd).call(this,!1))}return s}};Ae=new WeakMap,xe=new WeakMap,bs=new WeakMap,Di=new WeakMap,ys=new WeakMap,Fa=new WeakMap,qn=new WeakMap,Ur=new WeakMap,Xn=new WeakMap,_n=new WeakMap,Fh=new WeakMap,Hr=new WeakSet,fl=function(e,n=!1){if(!e){this.remove();return}w(this,Ae,e.bitmap),n||(w(this,xe,e.id),w(this,_n,e.isSvg)),e.file&&w(this,Fa,e.file.name),A(this,Mh,Dm).call(this)},zr=new WeakSet,pl=function(){w(this,bs,null),this._uiManager.enableWaiting(!1),l(this,qn)&&this.div.focus()},Ma=new WeakSet,Wd=function(){if(l(this,xe)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(l(this,xe)).then(n=>A(this,Hr,fl).call(this,n,!0)).finally(()=>A(this,zr,pl).call(this));return}if(l(this,Di)){const n=l(this,Di);w(this,Di,null),this._uiManager.enableWaiting(!0),w(this,bs,this._uiManager.imageManager.getFromUrl(n).then(s=>A(this,Hr,fl).call(this,s)).finally(()=>A(this,zr,pl).call(this)));return}if(l(this,ys)){const n=l(this,ys);w(this,ys,null),this._uiManager.enableWaiting(!0),w(this,bs,this._uiManager.imageManager.getFromFile(n).then(s=>A(this,Hr,fl).call(this,s)).finally(()=>A(this,zr,pl).call(this)));return}const e=document.createElement("input");e.type="file",e.accept=bl.supportedTypesStr,w(this,bs,new Promise(n=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const s=await this._uiManager.imageManager.getFromFile(e.files[0]);A(this,Hr,fl).call(this,s)}n()}),e.addEventListener("cancel",()=>{this.remove(),n()})}).finally(()=>A(this,zr,pl).call(this))),e.click()},Mh=new WeakSet,Dm=function(){const{div:e}=this;let{width:n,height:s}=l(this,Ae);const[r,o]=this.pageDimensions,a=.75;if(this.width)n=this.width*r,s=this.height*o;else if(n>a*r||s>a*o){const u=Math.min(a*r/n,a*o/s);n*=u,s*=u}const[c,d]=this.parentDimensions;this.setDims(n*c/r,s*d/o),this._uiManager.enableWaiting(!1);const h=w(this,qn,document.createElement("canvas"));e.append(h),e.hidden=!1,A(this,Oh,Fm).call(this,n,s),A(this,Wf,p1).call(this),l(this,Fh)||(this.parent.addUndoableEditor(this),w(this,Fh,!0)),this._reportTelemetry({action:"inserted_image"}),l(this,Fa)&&h.setAttribute("aria-label",l(this,Fa))},Gf=new WeakSet,u1=function(e,n){var a;const[s,r]=this.parentDimensions;this.width=e/s,this.height=n/r,this.setDims(e,n),(a=this._initialOptions)!=null&&a.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,l(this,Xn)!==null&&clearTimeout(l(this,Xn)),w(this,Xn,setTimeout(()=>{w(this,Xn,null),A(this,Oh,Fm).call(this,e,n)},200))},Vf=new WeakSet,f1=function(e,n){const{width:s,height:r}=l(this,Ae);let o=s,a=r,c=l(this,Ae);for(;o>2*e||a>2*n;){const d=o,h=a;o>2*e&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2)),a>2*n&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2));const u=new OffscreenCanvas(o,a);u.getContext("2d").drawImage(c,0,0,d,h,0,0,o,a),c=u.transferToImageBitmap()}return c},Oh=new WeakSet,Fm=function(e,n){e=Math.ceil(e),n=Math.ceil(n);const s=l(this,qn);if(!s||s.width===e&&s.height===n)return;s.width=e,s.height=n;const r=l(this,_n)?l(this,Ae):A(this,Vf,f1).call(this,e,n);if(this._uiManager.hasMLManager&&!this.hasAltText()){const c=new OffscreenCanvas(e,n).getContext("2d");c.drawImage(r,0,0,r.width,r.height,0,0,e,n),this._uiManager.mlGuess({service:"image-to-text",request:{data:c.getImageData(0,0,e,n).data,width:e,height:n,channels:4}}).then(d=>{const h=(d==null?void 0:d.output)||"";this.parent&&h&&!this.hasAltText()&&(this.altTextData={altText:h,decorative:!1})})}const o=s.getContext("2d");o.filter=this._uiManager.hcmFilter,o.drawImage(r,0,0,r.width,r.height,0,0,e,n)},Oa=new WeakSet,qd=function(e){if(e){if(l(this,_n)){const r=this._uiManager.imageManager.getSvgUrl(l(this,xe));if(r)return r}const n=document.createElement("canvas");return{width:n.width,height:n.height}=l(this,Ae),n.getContext("2d").drawImage(l(this,Ae),0,0),n.toDataURL()}if(l(this,_n)){const[n,s]=this.pageDimensions,r=Math.round(this.width*n*Es.PDF_TO_CSS_UNITS),o=Math.round(this.height*s*Es.PDF_TO_CSS_UNITS),a=new OffscreenCanvas(r,o);return a.getContext("2d").drawImage(l(this,Ae),0,0,l(this,Ae).width,l(this,Ae).height,0,0,r,o),a.transferToImageBitmap()}return structuredClone(l(this,Ae))},Wf=new WeakSet,p1=function(){w(this,Ur,new ResizeObserver(e=>{const n=e[0].contentRect;n.width&&n.height&&A(this,Gf,u1).call(this,n.width,n.height)})),l(this,Ur).observe(this.div)},ft(bl,"_type","stamp"),ft(bl,"_editorType",_t.STAMP);let Im=bl;var Gr,Na,Yn,Vr,Fi,Mi,Oi,Qe,ws,$a,Ba,Fe,rt,As,qf,g1,Nh,Om,$h,Nm,Bh,$m,ja,Xd;const un=class un{constructor({uiManager:t,pageIndex:e,div:n,accessibilityManager:s,annotationLayer:r,drawLayer:o,textLayer:a,viewport:c,l10n:d}){m(this,qf);m(this,Nh);m(this,$h);m(this,Bh);m(this,ja);m(this,Gr,void 0);m(this,Na,!1);m(this,Yn,null);m(this,Vr,null);m(this,Fi,null);m(this,Mi,null);m(this,Oi,null);m(this,Qe,new Map);m(this,ws,!1);m(this,$a,!1);m(this,Ba,!1);m(this,Fe,null);m(this,rt,void 0);const h=[...l(un,As).values()];if(!un._initialized){un._initialized=!0;for(const u of h)u.initialize(d,t)}t.registerEditorTypes(h),w(this,rt,t),this.pageIndex=e,this.div=n,w(this,Gr,s),w(this,Yn,r),this.viewport=c,w(this,Fe,a),this.drawLayer=o,l(this,rt).addLayer(this)}get isEmpty(){return l(this,Qe).size===0}get isInvisible(){return this.isEmpty&&l(this,rt).getMode()===_t.NONE}updateToolbar(t){l(this,rt).updateToolbar(t)}updateMode(t=l(this,rt).getMode()){switch(A(this,ja,Xd).call(this),t){case _t.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case _t.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case _t.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;for(const n of l(un,As).values())e.toggle(`${n._type}Editing`,t===n._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===((e=l(this,Fe))==null?void 0:e.div)}addInkEditorIfNeeded(t){if(l(this,rt).getMode()!==_t.INK)return;if(!t){for(const n of l(this,Qe).values())if(n.isEmpty()){n.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(t){l(this,rt).setEditingState(t)}addCommands(t){l(this,rt).addCommands(t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){var e;(e=l(this,Yn))==null||e.div.classList.toggle("disabled",!t)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const n of l(this,Qe).values())n.enableEditing(),n.show(!0),n.annotationElementId&&(l(this,rt).removeChangedExistingAnnotation(n),t.add(n.annotationElementId));if(!l(this,Yn))return;const e=l(this,Yn).getEditableAnnotations();for(const n of e){if(n.hide(),l(this,rt).isDeletedAnnotationElement(n.data.id)||t.has(n.data.id))continue;const s=this.deserialize(n);s&&(this.addOrRebuild(s),s.enableEditing())}}disable(){var s;w(this,Ba,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Map,e=new Map;for(const r of l(this,Qe).values())if(r.disableEditing(),!!r.annotationElementId){if(r.serialize()!==null){t.set(r.annotationElementId,r);continue}else e.set(r.annotationElementId,r);(s=this.getEditableAnnotation(r.annotationElementId))==null||s.show(),r.remove()}if(l(this,Yn)){const r=l(this,Yn).getEditableAnnotations();for(const o of r){const{id:a}=o.data;if(l(this,rt).isDeletedAnnotationElement(a))continue;let c=e.get(a);if(c){c.resetAnnotationElement(o),c.show(!1),o.show();continue}c=t.get(a),c&&(l(this,rt).addChangedExistingAnnotation(c),c.renderAnnotationElement(o),c.show(!1)),o.show()}}A(this,ja,Xd).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:n}=this.div;for(const r of l(un,As).values())n.remove(`${r._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),w(this,Ba,!1)}getEditableAnnotation(t){var e;return((e=l(this,Yn))==null?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){l(this,rt).getActive()!==t&&l(this,rt).setActiveEditor(t)}enableTextSelection(){var t;this.div.tabIndex=-1,(t=l(this,Fe))!=null&&t.div&&!l(this,Mi)&&(w(this,Mi,A(this,qf,g1).bind(this)),l(this,Fe).div.addEventListener("pointerdown",l(this,Mi)),l(this,Fe).div.classList.add("highlighting"))}disableTextSelection(){var t;this.div.tabIndex=0,(t=l(this,Fe))!=null&&t.div&&l(this,Mi)&&(l(this,Fe).div.removeEventListener("pointerdown",l(this,Mi)),w(this,Mi,null),l(this,Fe).div.classList.remove("highlighting"))}enableClick(){l(this,Fi)||(w(this,Fi,this.pointerdown.bind(this)),w(this,Vr,this.pointerup.bind(this)),this.div.addEventListener("pointerdown",l(this,Fi)),this.div.addEventListener("pointerup",l(this,Vr)))}disableClick(){l(this,Fi)&&(this.div.removeEventListener("pointerdown",l(this,Fi)),this.div.removeEventListener("pointerup",l(this,Vr)),w(this,Fi,null),w(this,Vr,null))}attach(t){l(this,Qe).set(t.id,t);const{annotationElementId:e}=t;e&&l(this,rt).isDeletedAnnotationElement(e)&&l(this,rt).removeDeletedAnnotationElement(t)}detach(t){var e;l(this,Qe).delete(t.id),(e=l(this,Gr))==null||e.removePointerInTextLayer(t.contentDiv),!l(this,Ba)&&t.annotationElementId&&l(this,rt).addDeletedAnnotationElement(t)}remove(t){this.detach(t),l(this,rt).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,l(this,$a)||this.addInkEditorIfNeeded(!1)}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(l(this,rt).addDeletedAnnotationElement(t.annotationElementId),Dt.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),(e=t.parent)==null||e.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),l(this,rt).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),l(this,rt).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var n;if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!l(this,Oi)&&(t._focusEventsAllowed=!1,w(this,Oi,setTimeout(()=>{w(this,Oi,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0}),e.focus())},0))),t._structTreeParentId=(n=l(this,Gr))==null?void 0:n.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){const e=()=>t._uiManager.rebuild(t),n=()=>{t.remove()};this.addCommands({cmd:e,undo:n,mustExec:!1})}getNextId(){return l(this,rt).getId()}canCreateNewEmptyEditor(){var t;return(t=l(this,Nh,Om))==null?void 0:t.canCreateNewEmptyEditor()}pasteEditor(t,e){l(this,rt).updateToolbar(t),l(this,rt).updateMode(t);const{offsetX:n,offsetY:s}=A(this,Bh,$m).call(this),r=this.getNextId(),o=A(this,$h,Nm).call(this,{parent:this,id:r,x:n,y:s,uiManager:l(this,rt),isCentered:!0,...e});o&&this.add(o)}deserialize(t){var e;return((e=l(un,As).get(t.annotationType??t.annotationEditorType))==null?void 0:e.deserialize(t,this,l(this,rt)))||null}createAndAddNewEditor(t,e,n={}){const s=this.getNextId(),r=A(this,$h,Nm).call(this,{parent:this,id:s,x:t.offsetX,y:t.offsetY,uiManager:l(this,rt),isCentered:e,...n});return r&&this.add(r),r}addNewEditor(){this.createAndAddNewEditor(A(this,Bh,$m).call(this),!0)}setSelected(t){l(this,rt).setSelected(t)}toggleSelected(t){l(this,rt).toggleSelected(t)}isSelected(t){return l(this,rt).isSelected(t)}unselect(t){l(this,rt).unselect(t)}pointerup(t){const{isMac:e}=ze.platform;if(!(t.button!==0||t.ctrlKey&&e)&&t.target===this.div&&l(this,ws)){if(w(this,ws,!1),!l(this,Na)){w(this,Na,!0);return}if(l(this,rt).getMode()===_t.STAMP){l(this,rt).unselectAll();return}this.createAndAddNewEditor(t,!1)}}pointerdown(t){if(l(this,rt).getMode()===_t.HIGHLIGHT&&this.enableTextSelection(),l(this,ws)){w(this,ws,!1);return}const{isMac:e}=ze.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;w(this,ws,!0);const n=l(this,rt).getActive();w(this,Na,!n||n.isEmpty())}findNewParent(t,e,n){const s=l(this,rt).findParent(e,n);return s===null||s===this?!1:(s.changeParent(t),!0)}destroy(){var t,e;((t=l(this,rt).getActive())==null?void 0:t.parent)===this&&(l(this,rt).commitOrRemove(),l(this,rt).setActiveEditor(null)),l(this,Oi)&&(clearTimeout(l(this,Oi)),w(this,Oi,null));for(const n of l(this,Qe).values())(e=l(this,Gr))==null||e.removePointerInTextLayer(n.contentDiv),n.setParent(null),n.isAttachedToDOM=!1,n.div.remove();this.div=null,l(this,Qe).clear(),l(this,rt).removeLayer(this)}render({viewport:t}){this.viewport=t,Zr(this.div,t);for(const e of l(this,rt).getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){l(this,rt).commitOrRemove(),A(this,ja,Xd).call(this);const e=this.viewport.rotation,n=t.rotation;if(this.viewport=t,Zr(this.div,{rotation:n}),e!==n)for(const s of l(this,Qe).values())s.rotate(n);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return l(this,rt).viewParameters.realScale}};Gr=new WeakMap,Na=new WeakMap,Yn=new WeakMap,Vr=new WeakMap,Fi=new WeakMap,Mi=new WeakMap,Oi=new WeakMap,Qe=new WeakMap,ws=new WeakMap,$a=new WeakMap,Ba=new WeakMap,Fe=new WeakMap,rt=new WeakMap,As=new WeakMap,qf=new WeakSet,g1=function(t){if(l(this,rt).unselectAll(),t.target===l(this,Fe).div){const{isMac:e}=ze.platform;if(t.button!==0||t.ctrlKey&&e)return;l(this,rt).showAllEditors("highlight",!0,!0),l(this,Fe).div.classList.add("free"),cu.startHighlighting(this,l(this,rt).direction==="ltr",t),l(this,Fe).div.addEventListener("pointerup",()=>{l(this,Fe).div.classList.remove("free")},{once:!0}),t.preventDefault()}},Nh=new WeakSet,Om=function(){return l(un,As).get(l(this,rt).getMode())},$h=new WeakSet,Nm=function(t){const e=l(this,Nh,Om);return e?new e.prototype.constructor(t):null},Bh=new WeakSet,$m=function(){const{x:t,y:e,width:n,height:s}=this.div.getBoundingClientRect(),r=Math.max(0,t),o=Math.max(0,e),a=Math.min(window.innerWidth,t+n),c=Math.min(window.innerHeight,e+s),d=(r+a)/2-t,h=(o+c)/2-e,[u,p]=this.viewport.rotation%180===0?[d,h]:[h,d];return{offsetX:u,offsetY:p}},ja=new WeakSet,Xd=function(){w(this,$a,!0);for(const t of l(this,Qe).values())t.isEmpty()&&t.remove();w(this,$a,!1)},ft(un,"_initialized",!1),m(un,As,new Map([pm,Sm,Im,cu].map(t=>[t._editorType,t])));let Mm=un;var Kn,jh,oe,xs,Uh,jm,Hh,Um,Xf,m1;const ge=class ge{constructor({pageIndex:t}){m(this,Hh);m(this,Xf);m(this,Kn,null);m(this,jh,0);m(this,oe,new Map);m(this,xs,new Map);this.pageIndex=t}setParent(t){if(!l(this,Kn)){w(this,Kn,t);return}if(l(this,Kn)!==t){if(l(this,oe).size>0)for(const e of l(this,oe).values())e.remove(),t.append(e);w(this,Kn,t)}}static get _svgFactory(){return Tt(this,"_svgFactory",new f0)}highlight(t,e,n,s=!1){const r=Ve(this,jh)._++,o=A(this,Hh,Um).call(this,t.box);o.classList.add("highlight"),t.free&&o.classList.add("free");const a=ge._svgFactory.createElement("defs");o.append(a);const c=ge._svgFactory.createElement("path");a.append(c);const d=`path_p${this.pageIndex}_${r}`;c.setAttribute("id",d),c.setAttribute("d",t.toSVGPath()),s&&l(this,xs).set(r,c);const h=A(this,Xf,m1).call(this,a,d),u=ge._svgFactory.createElement("use");return o.append(u),o.setAttribute("fill",e),o.setAttribute("fill-opacity",n),u.setAttribute("href",`#${d}`),l(this,oe).set(r,o),{id:r,clipPathId:`url(#${h})`}}highlightOutline(t){const e=Ve(this,jh)._++,n=A(this,Hh,Um).call(this,t.box);n.classList.add("highlightOutline");const s=ge._svgFactory.createElement("defs");n.append(s);const r=ge._svgFactory.createElement("path");s.append(r);const o=`path_p${this.pageIndex}_${e}`;r.setAttribute("id",o),r.setAttribute("d",t.toSVGPath()),r.setAttribute("vector-effect","non-scaling-stroke");let a;if(t.free){n.classList.add("free");const h=ge._svgFactory.createElement("mask");s.append(h),a=`mask_p${this.pageIndex}_${e}`,h.setAttribute("id",a),h.setAttribute("maskUnits","objectBoundingBox");const u=ge._svgFactory.createElement("rect");h.append(u),u.setAttribute("width","1"),u.setAttribute("height","1"),u.setAttribute("fill","white");const p=ge._svgFactory.createElement("use");h.append(p),p.setAttribute("href",`#${o}`),p.setAttribute("stroke","none"),p.setAttribute("fill","black"),p.setAttribute("fill-rule","nonzero"),p.classList.add("mask")}const c=ge._svgFactory.createElement("use");n.append(c),c.setAttribute("href",`#${o}`),a&&c.setAttribute("mask",`url(#${a})`);const d=c.cloneNode();return n.append(d),c.classList.add("mainOutline"),d.classList.add("secondaryOutline"),l(this,oe).set(e,n),e}finalizeLine(t,e){const n=l(this,xs).get(t);l(this,xs).delete(t),this.updateBox(t,e.box),n.setAttribute("d",e.toSVGPath())}updateLine(t,e){l(this,oe).get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}removeFreeHighlight(t){this.remove(t),l(this,xs).delete(t)}updatePath(t,e){l(this,xs).get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){var n;A(n=ge,Uh,jm).call(n,l(this,oe).get(t),e)}show(t,e){l(this,oe).get(t).classList.toggle("hidden",!e)}rotate(t,e){l(this,oe).get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){l(this,oe).get(t).setAttribute("fill",e)}changeOpacity(t,e){l(this,oe).get(t).setAttribute("fill-opacity",e)}addClass(t,e){l(this,oe).get(t).classList.add(e)}removeClass(t,e){l(this,oe).get(t).classList.remove(e)}remove(t){l(this,Kn)!==null&&(l(this,oe).get(t).remove(),l(this,oe).delete(t))}destroy(){w(this,Kn,null);for(const t of l(this,oe).values())t.remove();l(this,oe).clear()}};Kn=new WeakMap,jh=new WeakMap,oe=new WeakMap,xs=new WeakMap,Uh=new WeakSet,jm=function(t,{x:e=0,y:n=0,width:s=1,height:r=1}={}){const{style:o}=t;o.top=`${100*n}%`,o.left=`${100*e}%`,o.width=`${100*s}%`,o.height=`${100*r}%`},Hh=new WeakSet,Um=function(t){var n;const e=ge._svgFactory.create(1,1,!0);return l(this,Kn).append(e),e.setAttribute("aria-hidden",!0),A(n=ge,Uh,jm).call(n,e,t),e},Xf=new WeakSet,m1=function(t,e){const n=ge._svgFactory.createElement("clipPath");t.append(n);const s=`clip_${e}`;n.setAttribute("id",s),n.setAttribute("clipPathUnits","objectBoundingBox");const r=ge._svgFactory.createElement("use");return n.append(r),r.setAttribute("href",`#${e}`),r.classList.add("clip"),s},m(ge,Uh);let Bm=ge;var g2=ot.AbortException,m2=ot.AnnotationEditorLayer,v2=ot.AnnotationEditorParamsType,b2=ot.AnnotationEditorType,y2=ot.AnnotationEditorUIManager,v1=ot.AnnotationLayer,b1=ot.AnnotationMode,w2=ot.CMapCompressionType,A2=ot.ColorPicker,x2=ot.DOMSVGFactory,E2=ot.DrawLayer,_2=ot.FeatureTest,A0=ot.GlobalWorkerOptions,S2=ot.ImageKind,C2=ot.InvalidPDFException,T2=ot.MissingPDFException,P2=ot.OPS,R2=ot.Outliner,k2=ot.PDFDataRangeTransport,L2=ot.PDFDateString,I2=ot.PDFWorker,D2=ot.PasswordResponses,F2=ot.PermissionFlag,M2=ot.PixelsPerInch,O2=ot.RenderingCancelledException,y1=ot.TextLayer,N2=ot.UnexpectedResponseException,$2=ot.Util,B2=ot.VerbosityLevel,j2=ot.XfaLayer,U2=ot.build,H2=ot.createValidAbsoluteUrl,z2=ot.fetchData,w1=ot.getDocument,G2=ot.getFilenameFromUrl,V2=ot.getPdfFilenameFromUrl,W2=ot.getXfaPageViewport,q2=ot.isDataScheme,X2=ot.isPdfFile,Y2=ot.noContextMenu,K2=ot.normalizeUnicode,Z2=ot.renderTextLayer,J2=ot.setLayerDimensions,Q2=ot.shadow,tI=ot.updateTextLayer,A1=ot.version;const eI=Object.freeze(Object.defineProperty({__proto__:null,AbortException:g2,AnnotationEditorLayer:m2,AnnotationEditorParamsType:v2,AnnotationEditorType:b2,AnnotationEditorUIManager:y2,AnnotationLayer:v1,AnnotationMode:b1,CMapCompressionType:w2,ColorPicker:A2,DOMSVGFactory:x2,DrawLayer:E2,FeatureTest:_2,GlobalWorkerOptions:A0,ImageKind:S2,InvalidPDFException:C2,MissingPDFException:T2,OPS:P2,Outliner:R2,PDFDataRangeTransport:k2,PDFDateString:L2,PDFWorker:I2,PasswordResponses:D2,PermissionFlag:F2,PixelsPerInch:M2,RenderingCancelledException:O2,TextLayer:y1,UnexpectedResponseException:N2,Util:$2,VerbosityLevel:B2,XfaLayer:j2,build:U2,createValidAbsoluteUrl:H2,fetchData:z2,getDocument:w1,getFilenameFromUrl:G2,getPdfFilenameFromUrl:V2,getXfaPageViewport:W2,isDataScheme:q2,isPdfFile:X2,noContextMenu:Y2,normalizeUnicode:K2,renderTextLayer:Z2,setLayerDimensions:J2,shadow:Q2,updateTextLayer:tI,version:A1},Symbol.toStringTag,{value:"Module"}));var he=function(i,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,r;n<s;n++)(r||!(n in t))&&(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return i.concat(r||Array.prototype.slice.call(t))},nI=["onCopy","onCut","onPaste"],iI=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],sI=["onFocus","onBlur"],rI=["onInput","onInvalid","onReset","onSubmit"],oI=["onLoad","onError"],aI=["onKeyDown","onKeyPress","onKeyUp"],lI=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],cI=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],hI=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],dI=["onSelect"],uI=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],fI=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],pI=["onScroll"],gI=["onWheel"],mI=["onAnimationStart","onAnimationEnd","onAnimationIteration"],vI=["onTransitionEnd"],bI=["onToggle"],yI=["onChange"],wI=he(he(he(he(he(he(he(he(he(he(he(he(he(he(he(he(he(he([],nI,!0),iI,!0),sI,!0),rI,!0),oI,!0),aI,!0),lI,!0),cI,!0),hI,!0),dI,!0),uI,!0),fI,!0),pI,!0),gI,!0),mI,!0),vI,!0),yI,!0),bI,!0);function x1(i,t){var e={};return wI.forEach(function(n){var s=i[n];s&&(t?e[n]=function(r){return s(r,t(n))}:e[n]=s)}),e}function Jh(i){var t=!1,e=new Promise(function(n,s){i.then(function(r){return!t&&n(r)}).catch(function(r){return!t&&s(r)})});return{promise:e,cancel:function(){t=!0}}}function E1(i){var t,e,n="";if(typeof i=="string"||typeof i=="number")n+=i;else if(typeof i=="object")if(Array.isArray(i))for(t=0;t<i.length;t++)i[t]&&(e=E1(i[t]))&&(n&&(n+=" "),n+=e);else for(t in i)i[t]&&(n&&(n+=" "),n+=t);return n}function yp(){for(var i,t,e=0,n="";e<arguments.length;)(i=arguments[e++])&&(t=E1(i))&&(n&&(n+=" "),n+=t);return n}var AI=ht.env.NODE_ENV==="production",ig="Invariant failed";function Bt(i,t){if(!i){if(AI)throw new Error(ig);var e=typeof t=="function"?t():t,n=e?"".concat(ig,": ").concat(e):ig;throw new Error(n)}}var xI=ht.env.NODE_ENV!=="production",_1=function(){};if(xI){var EI=function(t,e){var n=arguments.length;e=new Array(n>1?n-1:0);for(var s=1;s<n;s++)e[s-1]=arguments[s];var r=0,o="Warning: "+t.replace(/%s/g,function(){return e[r++]});typeof console<"u"&&console.error(o);try{throw new Error(o)}catch{}};_1=function(i,t,e){var n=arguments.length;e=new Array(n>2?n-2:0);for(var s=2;s<n;s++)e[s-2]=arguments[s];if(t===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");i||EI.apply(null,[t].concat(e))}}var _I=_1;const Ce=Gm(_I);var Nv=Object.prototype.hasOwnProperty;function $v(i,t,e){for(e of i.keys())if(Eo(e,t))return e}function Eo(i,t){var e,n,s;if(i===t)return!0;if(i&&t&&(e=i.constructor)===t.constructor){if(e===Date)return i.getTime()===t.getTime();if(e===RegExp)return i.toString()===t.toString();if(e===Array){if((n=i.length)===t.length)for(;n--&&Eo(i[n],t[n]););return n===-1}if(e===Set){if(i.size!==t.size)return!1;for(n of i)if(s=n,s&&typeof s=="object"&&(s=$v(t,s),!s)||!t.has(s))return!1;return!0}if(e===Map){if(i.size!==t.size)return!1;for(n of i)if(s=n[0],s&&typeof s=="object"&&(s=$v(t,s),!s)||!Eo(n[1],t.get(s)))return!1;return!0}if(e===ArrayBuffer)i=new Uint8Array(i),t=new Uint8Array(t);else if(e===DataView){if((n=i.byteLength)===t.byteLength)for(;n--&&i.getInt8(n)===t.getInt8(n););return n===-1}if(ArrayBuffer.isView(i)){if((n=i.byteLength)===t.byteLength)for(;n--&&i[n]===t[n];);return n===-1}if(!e||typeof i=="object"){n=0;for(e in i)if(Nv.call(i,e)&&++n&&!Nv.call(t,e)||!(e in t)||!Eo(i[e],t[e]))return!1;return Object.keys(t).length===n}}return i!==i&&t!==t}const S1=I.createContext(null);function _o({children:i,type:t}){return T.jsx("div",{className:`react-pdf__message react-pdf__message--${t}`,children:i})}const SI="noopener noreferrer nofollow";class CI{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return Bt(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(t){Bt(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}goToDestination(t){return new Promise(e=>{Bt(this.pdfDocument,"PDF document not loaded."),Bt(t,"Destination is not specified."),typeof t=="string"?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(e=>{Bt(Array.isArray(e),`"${e}" is not a valid destination array.`);const n=e[0];new Promise(s=>{Bt(this.pdfDocument,"PDF document not loaded."),n instanceof Object?this.pdfDocument.getPageIndex(n).then(r=>{s(r)}).catch(()=>{Bt(!1,`"${n}" is not a valid page reference.`)}):typeof n=="number"?s(n):Bt(!1,`"${n}" is not a valid destination reference.`)}).then(s=>{const r=s+1;Bt(this.pdfViewer,"PDF viewer is not initialized."),Bt(r>=1&&r<=this.pagesCount,`"${r}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:e,pageIndex:s,pageNumber:r})})})}navigateTo(t){this.goToDestination(t)}goToPage(t){const e=t-1;Bt(this.pdfViewer,"PDF viewer is not initialized."),Bt(t>=1&&t<=this.pagesCount,`"${t}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}addLinkAttributes(t,e,n){t.href=e,t.rel=this.externalLinkRel||SI,t.target=n?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const Bv={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},wp=typeof document<"u",C1=wp&&window.location.protocol==="file:";function TI(i){return typeof i<"u"}function Rs(i){return TI(i)&&i!==null}function PI(i){return typeof i=="string"}function RI(i){return i instanceof ArrayBuffer}function kI(i){return Bt(wp,"isBlob can only be used in a browser environment"),i instanceof Blob}function Hm(i){return PI(i)&&/^data:/.test(i)}function jv(i){Bt(Hm(i),"Invalid data URI.");const[t="",e=""]=i.split(",");return t.split(";").indexOf("base64")!==-1?atob(e):unescape(e)}function LI(){return wp&&window.devicePixelRatio||1}const T1="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function Uv(){Ce(!C1,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${T1}`)}function II(){Ce(!C1,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${T1}`)}function to(i){i&&i.cancel&&i.cancel()}function zm(i,t){return Object.defineProperty(i,"width",{get(){return this.view[2]*t},configurable:!0}),Object.defineProperty(i,"height",{get(){return this.view[3]*t},configurable:!0}),Object.defineProperty(i,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(i,"originalHeight",{get(){return this.view[3]},configurable:!0}),i}function DI(i){return i.name==="RenderingCancelledException"}function FI(i){return new Promise((t,e)=>{const n=new FileReader;n.onload=()=>{if(!n.result)return e(new Error("Error while reading a file."));t(n.result)},n.onerror=s=>{if(!s.target)return e(new Error("Error while reading a file."));const{error:r}=s.target;if(!r)return e(new Error("Error while reading a file."));switch(r.code){case r.NOT_FOUND_ERR:return e(new Error("Error while reading a file: File not found."));case r.SECURITY_ERR:return e(new Error("Error while reading a file: Security error."));case r.ABORT_ERR:return e(new Error("Error while reading a file: Aborted."));default:return e(new Error("Error while reading a file."))}},n.readAsArrayBuffer(i)})}function MI(i,t){switch(t.type){case"RESOLVE":return{value:t.value,error:void 0};case"REJECT":return{value:!1,error:t.error};case"RESET":return{value:void 0,error:void 0};default:return i}}function Wa(){return I.useReducer(MI,{value:void 0,error:void 0})}var OI=function(i,t,e,n){function s(r){return r instanceof e?r:new e(function(o){o(r)})}return new(e||(e=Promise))(function(r,o){function a(h){try{d(n.next(h))}catch(u){o(u)}}function c(h){try{d(n.throw(h))}catch(u){o(u)}}function d(h){h.done?r(h.value):s(h.value).then(a,c)}d((n=n.apply(i,t||[])).next())})},Hv=function(i,t){var e={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&t.indexOf(n)<0&&(e[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(i);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(i,n[s])&&(e[n[s]]=i[n[s]]);return e};const{PDFDataRangeTransport:NI}=eI,$I=(i,t)=>{switch(t){case Bv.NEED_PASSWORD:{const e=prompt("Enter the password to open this PDF file.");i(e);break}case Bv.INCORRECT_PASSWORD:{const e=prompt("Invalid password. Please try again.");i(e);break}}};function zv(i){return typeof i=="object"&&i!==null&&("data"in i||"range"in i||"url"in i)}const BI=I.forwardRef(function(t,e){var{children:n,className:s,error:r="Failed to load PDF file.",externalLinkRel:o,externalLinkTarget:a,file:c,inputRef:d,imageResourcesPath:h,loading:u="Loading PDF…",noData:p="No PDF file specified.",onItemClick:v,onLoadError:b,onLoadProgress:x,onLoadSuccess:_,onPassword:E=$I,onSourceError:R,onSourceSuccess:k,options:D,renderMode:F,rotate:M}=t,O=Hv(t,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[C,P]=Wa(),{value:$,error:N}=C,[H,z]=Wa(),{value:V,error:Z}=H,Q=I.useRef(new CI),j=I.useRef([]),W=I.useRef(void 0),q=I.useRef(void 0);c&&c!==W.current&&zv(c)&&(Ce(!Eo(c,W.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),W.current=c),D&&D!==q.current&&(Ce(!Eo(D,q.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),q.current=D);const wt=I.useRef({scrollPageIntoView:K=>{const{dest:bt,pageNumber:Pt,pageIndex:jt=Pt-1}=K;if(v){v({dest:bt,pageIndex:jt,pageNumber:Pt});return}const Kt=j.current[jt];if(Kt){Kt.scrollIntoView();return}Ce(!1,`An internal link leading to page ${Pt} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});I.useImperativeHandle(e,()=>({linkService:Q,pages:j,viewer:wt}),[]);function pt(){k&&k()}function G(){N&&(Ce(!1,N.toString()),R&&R(N))}function st(){P({type:"RESET"})}I.useEffect(st,[c,P]);const nt=I.useCallback(()=>OI(this,void 0,void 0,function*(){if(!c)return null;if(typeof c=="string")return Hm(c)?{data:jv(c)}:(Uv(),{url:c});if(c instanceof NI)return{range:c};if(RI(c))return{data:c};if(wp&&kI(c))return{data:yield FI(c)};if(Bt(typeof c=="object","Invalid parameter in file, need either Uint8Array, string or a parameter object"),Bt(zv(c),"Invalid parameter object: need either .data, .range or .url"),"url"in c&&typeof c.url=="string"){if(Hm(c.url)){const{url:K}=c,bt=Hv(c,["url"]),Pt=jv(K);return Object.assign({data:Pt},bt)}Uv()}return c}),[c]);I.useEffect(()=>{const K=Jh(nt());return K.promise.then(bt=>{P({type:"RESOLVE",value:bt})}).catch(bt=>{P({type:"REJECT",error:bt})}),()=>{to(K)}},[nt,P]),I.useEffect(()=>{if(!(typeof $>"u")){if($===!1){G();return}pt()}},[$]);function it(){V&&(_&&_(V),j.current=new Array(V.numPages),Q.current.setDocument(V))}function dt(){Z&&(Ce(!1,Z.toString()),b&&b(Z))}function J(){z({type:"RESET"})}I.useEffect(J,[z,$]);function vt(){if(!$)return;const K=Object.assign(Object.assign({},$),D),bt=w1(K);x&&(bt.onProgress=x),E&&(bt.onPassword=E);const Pt=bt;return Pt.promise.then(jt=>{z({type:"RESOLVE",value:jt})}).catch(jt=>{Pt.destroyed||z({type:"REJECT",error:jt})}),()=>{Pt.destroy()}}I.useEffect(vt,[D,z,$]),I.useEffect(()=>{if(!(typeof V>"u")){if(V===!1){dt();return}it()}},[V]);function Y(){Q.current.setViewer(wt.current),Q.current.setExternalLinkRel(o),Q.current.setExternalLinkTarget(a)}I.useEffect(Y,[o,a]);function tt(K,bt){j.current[K]=bt}function ut(K){delete j.current[K]}const gt=I.useMemo(()=>({imageResourcesPath:h,linkService:Q.current,onItemClick:v,pdf:V,registerPage:tt,renderMode:F,rotate:M,unregisterPage:ut}),[h,v,V,F,M]),at=I.useMemo(()=>x1(O,()=>V),[O,V]);function St(){return T.jsx(S1.Provider,{value:gt,children:n})}function At(){return c?V==null?T.jsx(_o,{type:"loading",children:typeof u=="function"?u():u}):V===!1?T.jsx(_o,{type:"error",children:typeof r=="function"?r():r}):St():T.jsx(_o,{type:"no-data",children:typeof p=="function"?p():p})}return T.jsx("div",Object.assign({className:yp("react-pdf__Document",s),ref:d,style:{"--scale-factor":"1"}},at,{children:At()}))});function P1(){return I.useContext(S1)}function R1(){for(var i=[],t=0;t<arguments.length;t++)i[t]=arguments[t];var e=i.filter(Boolean);if(e.length<=1){var n=e[0];return n||null}return function(r){e.forEach(function(o){typeof o=="function"?o(r):o&&(o.current=r)})}}const k1=I.createContext(null),L1={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},jI=/^H(\d+)$/;function UI(i){return i in L1}function Ap(i){return"children"in i}function I1(i){return Ap(i)?i.children.length===1&&0 in i.children&&"id"in i.children[0]:!1}function HI(i){const t={};if(Ap(i)){const{role:e}=i,n=e.match(jI);if(n)t.role="heading",t["aria-level"]=Number(n[1]);else if(UI(e)){const s=L1[e];s&&(t.role=s)}}return t}function D1(i){const t={};if(Ap(i)){if(i.alt!==void 0&&(t["aria-label"]=i.alt),i.lang!==void 0&&(t.lang=i.lang),I1(i)){const[e]=i.children;if(e){const n=D1(e);return Object.assign(Object.assign({},t),n)}}}else"id"in i&&(t["aria-owns"]=i.id);return t}function zI(i){return i?Object.assign(Object.assign({},HI(i)),D1(i)):null}function F1({className:i,node:t}){const e=I.useMemo(()=>zI(t),[t]),n=I.useMemo(()=>!Ap(t)||I1(t)?null:t.children.map((s,r)=>T.jsx(F1,{node:s},r)),[t]);return T.jsx("span",Object.assign({className:i},e,{children:n}))}function xp(){return I.useContext(k1)}function GI(){const i=xp();Bt(i,"Unable to find Page context.");const{onGetStructTreeError:t,onGetStructTreeSuccess:e}=i,[n,s]=Wa(),{value:r,error:o}=n,{customTextRenderer:a,page:c}=i;function d(){r&&e&&e(r)}function h(){o&&(Ce(!1,o.toString()),t&&t(o))}function u(){s({type:"RESET"})}I.useEffect(u,[s,c]);function p(){if(a||!c)return;const v=Jh(c.getStructTree()),b=v;return v.promise.then(x=>{s({type:"RESOLVE",value:x})}).catch(x=>{s({type:"REJECT",error:x})}),()=>to(b)}return I.useEffect(p,[a,c,s]),I.useEffect(()=>{if(r!==void 0){if(r===!1){h();return}d()}},[r]),r?T.jsx(F1,{className:"react-pdf__Page__structTree structTree",node:r}):null}const Gv=b1;function VI(i){const t=xp();Bt(t,"Unable to find Page context.");const e=Object.assign(Object.assign({},t),i),{_className:n,canvasBackground:s,devicePixelRatio:r=LI(),onRenderError:o,onRenderSuccess:a,page:c,renderForms:d,renderTextLayer:h,rotate:u,scale:p}=e,{canvasRef:v}=i;Bt(c,"Attempted to render page canvas, but no page was specified.");const b=I.useRef(null);function x(){c&&a&&a(zm(c,p))}function _(F){DI(F)||(Ce(!1,F.toString()),o&&o(F))}const E=I.useMemo(()=>c.getViewport({scale:p*r,rotation:u}),[r,c,u,p]),R=I.useMemo(()=>c.getViewport({scale:p,rotation:u}),[c,u,p]);function k(){if(!c)return;c.cleanup();const{current:F}=b;if(!F)return;F.width=E.width,F.height=E.height,F.style.width=`${Math.floor(R.width)}px`,F.style.height=`${Math.floor(R.height)}px`,F.style.visibility="hidden";const M={annotationMode:d?Gv.ENABLE_FORMS:Gv.ENABLE,canvasContext:F.getContext("2d",{alpha:!1}),viewport:E};s&&(M.background=s);const O=c.render(M),C=O;return O.promise.then(()=>{F.style.visibility="",x()}).catch(_),()=>to(C)}I.useEffect(k,[s,b,r,c,d,E,R]);const D=I.useCallback(()=>{const{current:F}=b;F&&(F.width=0,F.height=0)},[b]);return I.useEffect(()=>D,[D]),T.jsx("canvas",{className:`${n}__canvas`,dir:"ltr",ref:R1(v,b),style:{display:"block",userSelect:"none"},children:h?T.jsx(GI,{}):null})}function WI(i){return"str"in i}function qI(){const i=xp();Bt(i,"Unable to find Page context.");const{customTextRenderer:t,onGetTextError:e,onGetTextSuccess:n,onRenderTextLayerError:s,onRenderTextLayerSuccess:r,page:o,pageIndex:a,pageNumber:c,rotate:d,scale:h}=i;Bt(o,"Attempted to load page text content, but no page was specified.");const[u,p]=Wa(),{value:v,error:b}=u,x=I.useRef(null),_=I.useRef(void 0);Ce(parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function E(){v&&n&&n(v)}function R(){b&&(Ce(!1,b.toString()),e&&e(b))}function k(){p({type:"RESET"})}I.useEffect(k,[o,p]);function D(){if(!o)return;const N=Jh(o.getTextContent()),H=N;return N.promise.then(z=>{p({type:"RESOLVE",value:z})}).catch(z=>{p({type:"REJECT",error:z})}),()=>to(H)}I.useEffect(D,[o,p]),I.useEffect(()=>{if(v!==void 0){if(v===!1){R();return}E()}},[v]);const F=I.useCallback(()=>{r&&r()},[r]),M=I.useCallback(N=>{Ce(!1,N.toString()),s&&s(N)},[s]);function O(){const N=_.current;N&&N.classList.add("active")}function C(){const N=_.current;N&&N.classList.remove("active")}const P=I.useMemo(()=>o.getViewport({scale:h,rotation:d}),[o,d,h]);function $(){if(!o||!v)return;const{current:N}=x;if(!N)return;N.innerHTML="";const H=o.streamTextContent({includeMarkedContent:!0}),z={container:N,textContentSource:H,viewport:P},V=new y1(z),Z=V;return V.render().then(()=>{const Q=document.createElement("div");Q.className="endOfContent",N.append(Q),_.current=Q;const j=N.querySelectorAll('[role="presentation"]');if(t){let W=0;v.items.forEach((q,wt)=>{if(!WI(q))return;const pt=j[W];if(!pt)return;const G=t(Object.assign({pageIndex:a,pageNumber:c,itemIndex:wt},q));pt.innerHTML=G,W+=q.str&&q.hasEOL?2:1})}F()}).catch(M),()=>to(Z)}return I.useLayoutEffect($,[t,M,F,o,a,c,v,P]),T.jsx("div",{className:yp("react-pdf__Page__textContent","textLayer"),onMouseUp:C,onMouseDown:O,ref:x})}function XI(){const i=P1(),t=xp();Bt(t,"Unable to find Page context.");const e=Object.assign(Object.assign({},i),t),{imageResourcesPath:n,linkService:s,onGetAnnotationsError:r,onGetAnnotationsSuccess:o,onRenderAnnotationLayerError:a,onRenderAnnotationLayerSuccess:c,page:d,pdf:h,renderForms:u,rotate:p,scale:v=1}=e;Bt(h,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),Bt(d,"Attempted to load page annotations, but no page was specified."),Bt(s,"Attempted to load page annotations, but no linkService was specified.");const[b,x]=Wa(),{value:_,error:E}=b,R=I.useRef(null);Ce(parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function k(){_&&o&&o(_)}function D(){E&&(Ce(!1,E.toString()),r&&r(E))}function F(){x({type:"RESET"})}I.useEffect(F,[x,d]);function M(){if(!d)return;const N=Jh(d.getAnnotations()),H=N;return N.promise.then(z=>{x({type:"RESOLVE",value:z})}).catch(z=>{x({type:"REJECT",error:z})}),()=>{to(H)}}I.useEffect(M,[x,d,u]),I.useEffect(()=>{if(_!==void 0){if(_===!1){D();return}k()}},[_]);function O(){c&&c()}function C(N){Ce(!1,`${N}`),a&&a(N)}const P=I.useMemo(()=>d.getViewport({scale:v,rotation:p}),[d,p,v]);function $(){if(!h||!d||!s||!_)return;const{current:N}=R;if(!N)return;const H=P.clone({dontFlip:!0}),z={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:N,l10n:null,page:d,viewport:H},V={annotations:_,annotationStorage:h.annotationStorage,div:N,imageResourcesPath:n,linkService:s,page:d,renderForms:u,viewport:H};N.innerHTML="";try{new v1(z).render(V),O()}catch(Z){C(Z)}return()=>{}}return I.useEffect($,[_,n,s,d,u,P]),T.jsx("div",{className:yp("react-pdf__Page__annotations","annotationLayer"),ref:R})}var YI=function(i,t){var e={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&t.indexOf(n)<0&&(e[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(i);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(i,n[s])&&(e[n[s]]=i[n[s]]);return e};const Vv=1;function M1(i){const t=P1(),e=Object.assign(Object.assign({},t),i),{_className:n="react-pdf__Page",_enableRegisterUnregisterPage:s=!0,canvasBackground:r,canvasRef:o,children:a,className:c,customRenderer:d,customTextRenderer:h,devicePixelRatio:u,error:p="Failed to load the page.",height:v,inputRef:b,loading:x="Loading page…",noData:_="No page specified.",onGetAnnotationsError:E,onGetAnnotationsSuccess:R,onGetStructTreeError:k,onGetStructTreeSuccess:D,onGetTextError:F,onGetTextSuccess:M,onLoadError:O,onLoadSuccess:C,onRenderAnnotationLayerError:P,onRenderAnnotationLayerSuccess:$,onRenderError:N,onRenderSuccess:H,onRenderTextLayerError:z,onRenderTextLayerSuccess:V,pageIndex:Z,pageNumber:Q,pdf:j,registerPage:W,renderAnnotationLayer:q=!0,renderForms:wt=!1,renderMode:pt="canvas",renderTextLayer:G=!0,rotate:st,scale:nt=Vv,unregisterPage:it,width:dt}=e,J=YI(e,["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"]),[vt,Y]=Wa(),{value:tt,error:ut}=vt,gt=I.useRef(null);Bt(j,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const at=Rs(Q)?Q-1:Z??null,St=Q??(Rs(Z)?Z+1:null),At=st??(tt?tt.rotate:null),K=I.useMemo(()=>{if(!tt)return null;let y=1;const f=nt??Vv;if(dt||v){const g=tt.getViewport({scale:1,rotation:At});dt?y=dt/g.width:v&&(y=v/g.height)}return f*y},[v,tt,At,nt,dt]);function bt(){return()=>{Rs(at)&&s&&it&&it(at)}}I.useEffect(bt,[s,j,at,it]);function Pt(){if(C){if(!tt||!K)return;C(zm(tt,K))}if(s&&W){if(!Rs(at)||!gt.current)return;W(at,gt.current)}}function jt(){ut&&(Ce(!1,ut.toString()),O&&O(ut))}function Kt(){Y({type:"RESET"})}I.useEffect(Kt,[Y,j,at]);function Vt(){if(!j||!St)return;const y=Jh(j.getPage(St)),f=y;return y.promise.then(g=>{Y({type:"RESOLVE",value:g})}).catch(g=>{Y({type:"REJECT",error:g})}),()=>to(f)}I.useEffect(Vt,[Y,j,at,St,W]),I.useEffect(()=>{if(tt!==void 0){if(tt===!1){jt();return}Pt()}},[tt,K]);const kt=I.useMemo(()=>tt&&Rs(at)&&St&&Rs(At)&&Rs(K)?{_className:n,canvasBackground:r,customTextRenderer:h,devicePixelRatio:u,onGetAnnotationsError:E,onGetAnnotationsSuccess:R,onGetStructTreeError:k,onGetStructTreeSuccess:D,onGetTextError:F,onGetTextSuccess:M,onRenderAnnotationLayerError:P,onRenderAnnotationLayerSuccess:$,onRenderError:N,onRenderSuccess:H,onRenderTextLayerError:z,onRenderTextLayerSuccess:V,page:tt,pageIndex:at,pageNumber:St,renderForms:wt,renderTextLayer:G,rotate:At,scale:K}:null,[n,r,h,u,E,R,k,D,F,M,P,$,N,H,z,V,tt,at,St,wt,G,At,K]),Lt=I.useMemo(()=>x1(J,()=>tt&&(K?zm(tt,K):void 0)),[J,tt,K]),Wt=`${at}@${K}/${At}`;function lt(){switch(pt){case"custom":return Bt(d,'renderMode was set to "custom", but no customRenderer was passed.'),T.jsx(d,{},`${Wt}_custom`);case"none":return null;case"canvas":default:return T.jsx(VI,{canvasRef:o},`${Wt}_canvas`)}}function Re(){return G?T.jsx(qI,{},`${Wt}_text`):null}function ke(){return q?T.jsx(XI,{},`${Wt}_annotations`):null}function ce(){return T.jsxs(k1.Provider,{value:kt,children:[lt(),Re(),ke(),a]})}function nn(){return St?j===null||tt===void 0||tt===null?T.jsx(_o,{type:"loading",children:typeof x=="function"?x():x}):j===!1||tt===!1?T.jsx(_o,{type:"error",children:typeof p=="function"?p():p}):ce():T.jsx(_o,{type:"no-data",children:typeof _=="function"?_():_})}return T.jsx("div",Object.assign({className:yp(n,c),"data-page-number":St,ref:R1(b,gt),style:{"--scale-factor":`${K}`,backgroundColor:r||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},Lt,{children:nn()}))}II();A0.workerSrc="pdf.worker.mjs";const O1="SET_ZOOM_LEVEL",sg=i=>({type:O1,value:i}),N1="SET_PDF_PAGINATED",x0=i=>({type:N1,value:i}),$1="SET_NUM_PAGES",Wv=i=>({type:$1,value:i}),B1="SET_CURRENT_PAGE",j1="SET_CURRENT_MAIN_STATE",hu=i=>({type:B1,value:i}),Ki={defaultZoomLevel:1,zoomLevel:1,zoomJump:.1,paginated:!0,numPages:0,currentPage:1},KI=(i=Ki,t)=>{switch(t.type){case O1:{const{value:e}=t;return{...i,zoomLevel:e}}case N1:{const{value:e}=t;return{...i,paginated:e}}case $1:{const{value:e}=t;return{...i,numPages:e}}case B1:{const{value:e}=t;return{...i,currentPage:e}}case j1:{const{value:e}=t;return{...i,mainState:e}}default:return i}},Ts=I.createContext({state:Ki,dispatch:()=>null}),ZI=({children:i,mainState:t})=>{var r,o,a,c,d,h,u;const[e,n]=I.useReducer(KI,{...Ki,defaultZoomLevel:((o=(r=t.config)==null?void 0:r.pdfZoom)==null?void 0:o.defaultZoom)??Ki.defaultZoomLevel,zoomLevel:((c=(a=t.config)==null?void 0:a.pdfZoom)==null?void 0:c.defaultZoom)??Ki.zoomLevel,zoomJump:((h=(d=t.config)==null?void 0:d.pdfZoom)==null?void 0:h.zoomJump)??Ki.zoomJump,paginated:(u=t.config)!=null&&u.pdfVerticalScrollByDefault?!1:Ki.paginated,mainState:t}),s=I.useRef(void 0);return I.useEffect(()=>{n({type:j1,value:t})},[t]),I.useEffect(()=>{t.targetPage!==void 0&&t.targetPage!==s.current&&t.targetPage>=1&&t.targetPage<=e.numPages&&(n(hu(t.targetPage)),e.paginated||n(x0(!0)),s.current=t.targetPage)},[t.targetPage,e.numPages,e.paginated]),T.jsx(Ts.Provider,{value:{state:e,dispatch:n},children:i})},U1="SET_ACTIVE_TOOL",H1="SET_CURRENT_COLOR",z1="ADD_ANNOTATION",G1="UPDATE_ANNOTATION",V1="DELETE_ANNOTATION",W1="SET_ANNOTATIONS",q1="SET_SELECTED_ANNOTATION",X1="SET_IS_DRAWING",JI=i=>({type:U1,tool:i}),QI=i=>({type:H1,color:i}),E0=i=>({type:z1,annotation:i}),tD=(i,t)=>({type:G1,id:i,updates:t}),_0=i=>({type:V1,id:i}),eD=i=>({type:W1,annotations:i}),S0=i=>({type:q1,id:i}),qv=i=>({type:X1,isDrawing:i}),Y1=["#FFFF00","#FF6B6B","#4ECDC4","#45B7D1","#96CEB4","#FFEAA7","#DDA0DD","#98D8C8"],K1=["select","highlight","pen","comment","eraser"],du={activeTool:"select",currentColor:"#FFFF00",annotations:[],selectedAnnotationId:null,isDrawing:!1,availableColors:Y1,availableTools:K1},nD=(i=du,t)=>{switch(t.type){case U1:{const{tool:e}=t;return{...i,activeTool:e}}case H1:{const{color:e}=t;return{...i,currentColor:e}}case z1:{const{annotation:e}=t;return{...i,annotations:[...i.annotations,e]}}case G1:{const{id:e,updates:n}=t;return{...i,annotations:i.annotations.map(s=>s.id===e?{...s,...n}:s)}}case V1:{const{id:e}=t;return{...i,annotations:i.annotations.filter(n=>n.id!==e),selectedAnnotationId:i.selectedAnnotationId===e?null:i.selectedAnnotationId}}case W1:{const{annotations:e}=t;return{...i,annotations:e}}case q1:{const{id:e}=t;return{...i,selectedAnnotationId:e}}case X1:{const{isDrawing:e}=t;return{...i,isDrawing:e}}default:return i}},ni=I.createContext({state:du,dispatch:()=>null}),iD=({children:i,config:t,documentUri:e})=>{var r;const[n,s]=I.useReducer(nD,{...du,currentColor:(t==null?void 0:t.defaultColor)||du.currentColor,availableColors:(t==null?void 0:t.colors)||Y1,availableTools:(t==null?void 0:t.tools)||K1,activeTool:((r=t==null?void 0:t.tools)==null?void 0:r[0])||"select",annotations:(t==null?void 0:t.initialAnnotations)||[]});return I.useEffect(()=>{t!=null&&t.initialAnnotations&&s(eD(t.initialAnnotations))},[t==null?void 0:t.initialAnnotations]),I.useEffect(()=>{t!=null&&t.onAnnotationChange&&t.onAnnotationChange(n.annotations)},[n.annotations,t==null?void 0:t.onAnnotationChange]),T.jsx(ni.Provider,{value:{state:n,dispatch:s,config:t},children:i})},sD=({canvasRef:i,pageNumber:t,documentUri:e})=>{const{state:n,dispatch:s}=I.useContext(ni),[r,o]=I.useState([]),a=I.useRef(!1),c=I.useCallback(v=>{const b=i.current;if(!b)return null;const x=b.getBoundingClientRect(),_=b.width/x.width,E=b.height/x.height;return{x:(v.clientX-x.left)*_,y:(v.clientY-x.top)*E}},[i]),d=I.useCallback(v=>{if(n.activeTool!=="pen")return;const b=c(v);if(!b)return;a.current=!0,s(qv(!0)),o([b]);const x=i.current,_=x==null?void 0:x.getContext("2d");_&&(_.beginPath(),_.moveTo(b.x,b.y),_.strokeStyle=n.currentColor,_.lineWidth=3,_.lineCap="round",_.lineJoin="round")},[n.activeTool,n.currentColor,c,s,i]),h=I.useCallback(v=>{if(!a.current||n.activeTool!=="pen")return;const b=c(v);if(!b)return;o(E=>[...E,b]);const x=i.current,_=x==null?void 0:x.getContext("2d");_&&(_.lineTo(b.x,b.y),_.stroke())},[n.activeTool,c,i]),u=I.useCallback(()=>{if(a.current){if(a.current=!1,s(qv(!1)),r.length>1){const v={paths:[r],strokeWidth:3},b={id:crypto.randomUUID(),type:"drawing",documentUri:e,pageNumber:t,color:n.currentColor,data:v};s(E0(b))}o([])}},[r,e,t,n.currentColor,s]),p=I.useCallback(v=>{const b=i.current,x=b==null?void 0:b.getContext("2d");!x||!b||(x.clearRect(0,0,b.width,b.height),v.filter(_=>_.type==="drawing"&&_.pageNumber===t&&_.documentUri===e).forEach(_=>{const E=_.data;E!=null&&E.paths&&(x.strokeStyle=_.color,x.lineWidth=E.strokeWidth||3,x.lineCap="round",x.lineJoin="round",E.paths.forEach(R=>{R.length<2||(x.beginPath(),x.moveTo(R[0].x,R[0].y),R.slice(1).forEach(k=>{x.lineTo(k.x,k.y)}),x.stroke())}))}))},[i,t,e]);return{startDrawing:d,draw:h,stopDrawing:u,redrawAnnotations:p,isDrawing:n.isDrawing}},rD=({pageNumber:i,documentUri:t,containerRef:e})=>{const{state:n,dispatch:s}=I.useContext(ni);return{handleTextSelection:I.useCallback(()=>{if(n.activeTool!=="highlight")return;const o=window.getSelection();if(!o||o.isCollapsed)return;const a=o.getRangeAt(0),c=e.current;if(!c)return;const d=c.getBoundingClientRect(),h=Array.from(a.getClientRects());if(h.length===0)return;const p={rects:h.map(b=>({x:b.left-d.left,y:b.top-d.top,width:b.width,height:b.height})),text:o.toString()},v={id:crypto.randomUUID(),type:"highlight",documentUri:t,pageNumber:i,color:n.currentColor,data:p};s(E0(v)),o.removeAllRanges()},[n.activeTool,n.currentColor,t,i,e,s])}},oD=({annotation:i})=>{const{state:t,dispatch:e}=I.useContext(ni),n=i.data,s=t.selectedAnnotationId===i.id;if(!(n!=null&&n.rects))return null;const r=o=>{o.stopPropagation(),t.activeTool==="select"?e(S0(i.id)):t.activeTool==="eraser"&&e(_0(i.id))};return T.jsx(T.Fragment,{children:n.rects.map((o,a)=>T.jsx(aD,{$x:o.x,$y:o.y,$width:o.width,$height:o.height,$color:i.color,$isSelected:s,onClick:r,title:n.text},`${i.id}-${a}`))})},aD=X.div`
276
- position: absolute;
277
- left: ${i=>i.$x}px;
278
- top: ${i=>i.$y}px;
279
- width: ${i=>i.$width}px;
280
- height: ${i=>i.$height}px;
281
- background-color: ${i=>i.$color};
282
- opacity: 0.4;
283
- pointer-events: auto;
284
- cursor: pointer;
285
- border: ${i=>i.$isSelected?"2px solid #0064c8":"none"};
286
- box-sizing: border-box;
287
- transition: opacity 0.15s ease;
288
-
289
- &:hover {
290
- opacity: 0.6;
291
- }
292
- `,lD=({color:i="#000",size:t="100%"})=>T.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z"}),T.jsx("path",{d:"M13 13l6 6"})]}),cD=({color:i="#000",size:t="100%"})=>T.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M12 20h9"}),T.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"}),T.jsx("rect",{x:"3",y:"17",width:"18",height:"4",rx:"1",fill:i,opacity:"0.3"})]}),hD=({color:i="#000",size:t="100%"})=>T.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M12 19l7-7 3 3-7 7-3-3z"}),T.jsx("path",{d:"M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"}),T.jsx("path",{d:"M2 2l7.586 7.586"}),T.jsx("circle",{cx:"11",cy:"11",r:"2"})]}),dD=({color:i="#000",size:t="100%"})=>T.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:T.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),uD=({color:i="#000",size:t="100%"})=>T.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M20 20H7L3 16c-.6-.6-.6-1.5 0-2.1L13.1 3.9c.6-.6 1.5-.6 2.1 0l5.7 5.7c.6.6.6 1.5 0 2.1L11 21"}),T.jsx("path",{d:"M6 11l7 7"})]}),fD=({color:i="#000",size:t="100%"})=>T.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("polyline",{points:"3 6 5 6 21 6"}),T.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),T.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),T.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]}),pD=({annotation:i,onClose:t})=>{const{dispatch:e}=I.useContext(ni),n=i.data,[s,r]=I.useState((n==null?void 0:n.text)||""),[o,a]=I.useState(!(n!=null&&n.text)),c=()=>{if(s.trim()){const u={...n,text:s.trim(),timestamp:Date.now()};e(tD(i.id,{data:u})),a(!1)}},d=()=>{e(_0(i.id)),t()},h=u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),c()),u.key==="Escape"&&t()};return T.jsxs(gD,{onClick:u=>u.stopPropagation(),children:[T.jsxs(mD,{children:[T.jsx(vD,{children:"Comment"}),T.jsx(bD,{onClick:d,title:"Delete comment",children:T.jsx(fD,{size:"14",color:"#666"})})]}),o?T.jsx(yD,{value:s,onChange:u=>r(u.target.value),onKeyDown:h,placeholder:"Enter your comment...",autoFocus:!0}):T.jsx(wD,{onClick:()=>a(!0),children:s}),T.jsxs(AD,{children:[(n==null?void 0:n.timestamp)&&T.jsx(xD,{children:new Date(n.timestamp).toLocaleString()}),o&&T.jsx(ED,{onClick:c,disabled:!s.trim(),children:"Save"})]})]})},gD=X.div`
293
- position: absolute;
294
- top: 32px;
295
- left: 0;
296
- width: 250px;
297
- background: white;
298
- border-radius: 8px;
299
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
300
- z-index: 100;
301
- overflow: hidden;
302
- `,mD=X.div`
303
- display: flex;
304
- justify-content: space-between;
305
- align-items: center;
306
- padding: 8px 12px;
307
- border-bottom: 1px solid #e0e0e0;
308
- background: #f8f8f8;
309
- `,vD=X.span`
310
- font-size: 12px;
311
- font-weight: 600;
312
- color: #333;
313
- `,bD=X.button`
314
- display: flex;
315
- align-items: center;
316
- justify-content: center;
317
- width: 24px;
318
- height: 24px;
319
- padding: 0;
320
- border: none;
321
- background: transparent;
322
- cursor: pointer;
323
- border-radius: 4px;
324
-
325
- &:hover {
326
- background: #e0e0e0;
327
- }
328
- `,yD=X.textarea`
329
- width: 100%;
330
- min-height: 80px;
331
- padding: 12px;
332
- border: none;
333
- resize: none;
334
- font-family: inherit;
335
- font-size: 14px;
336
- box-sizing: border-box;
337
-
338
- &:focus {
339
- outline: none;
340
- }
341
-
342
- &::placeholder {
343
- color: #999;
344
- }
345
- `,wD=X.div`
346
- padding: 12px;
347
- font-size: 14px;
348
- color: #333;
349
- cursor: text;
350
- min-height: 40px;
351
- `,AD=X.div`
352
- display: flex;
353
- justify-content: space-between;
354
- align-items: center;
355
- padding: 8px 12px;
356
- border-top: 1px solid #e0e0e0;
357
- `,xD=X.span`
358
- font-size: 11px;
359
- color: #999;
360
- `,ED=X.button`
361
- padding: 4px 12px;
362
- border: none;
363
- border-radius: 4px;
364
- background: #0064c8;
365
- color: white;
366
- font-size: 12px;
367
- cursor: pointer;
368
-
369
- &:disabled {
370
- background: #ccc;
371
- cursor: not-allowed;
372
- }
373
-
374
- &:hover:not(:disabled) {
375
- background: #0054a8;
376
- }
377
- `,_D=({annotation:i})=>{const{state:t,dispatch:e}=I.useContext(ni),[n,s]=I.useState(!1),r=i.data,o=t.selectedAnnotationId===i.id;if(!r)return null;const a=c=>{c.stopPropagation(),t.activeTool==="eraser"?e(_0(i.id)):(e(S0(i.id)),s(!n))};return T.jsxs(CD,{$x:r.x,$y:r.y,children:[T.jsx(TD,{$color:i.color,$isSelected:o,onClick:a,"aria-label":"Comment",children:T.jsx(SD,{})}),n&&T.jsx(pD,{annotation:i,onClose:()=>s(!1)})]})},SD=()=>T.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"white",stroke:"white",strokeWidth:"2",children:T.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),CD=X.div`
378
- position: absolute;
379
- left: ${i=>i.$x}px;
380
- top: ${i=>i.$y}px;
381
- z-index: 10;
382
- `,TD=X.button`
383
- display: flex;
384
- align-items: center;
385
- justify-content: center;
386
- width: 28px;
387
- height: 28px;
388
- border-radius: 50%;
389
- border: 2px solid ${i=>i.$isSelected?"#0064c8":"white"};
390
- background-color: ${i=>i.$color};
391
- cursor: pointer;
392
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
393
- transition: transform 0.15s ease;
394
- padding: 0;
395
-
396
- &:hover {
397
- transform: scale(1.1);
398
- }
399
-
400
- &:focus {
401
- outline: 2px solid #0064c8;
402
- outline-offset: 2px;
403
- }
404
- `,PD=({pageNumber:i,documentUri:t,width:e,height:n})=>{const{state:s,dispatch:r}=I.useContext(ni),o=I.useRef(null),a=I.useRef(null),{startDrawing:c,draw:d,stopDrawing:h,redrawAnnotations:u}=sD({canvasRef:a,pageNumber:i,documentUri:t}),{handleTextSelection:p}=rD({pageNumber:i,documentUri:t,containerRef:o}),v=s.annotations.filter(k=>k.pageNumber===i&&k.documentUri===t),b=v.filter(k=>k.type==="highlight"),x=v.filter(k=>k.type==="comment"),_=v.filter(k=>k.type==="drawing");I.useEffect(()=>{u(_)},[_,u]),I.useEffect(()=>{const k=a.current;k&&(k.width=e,k.height=n,u(_))},[e,n,u,_]);const E=k=>{var D;if(s.activeTool==="comment"){const F=(D=o.current)==null?void 0:D.getBoundingClientRect();if(!F)return;const M=k.clientX-F.left,O=k.clientY-F.top,C={x:M,y:O,text:"",timestamp:Date.now()},P={id:crypto.randomUUID(),type:"comment",documentUri:t,pageNumber:i,color:s.currentColor,data:C};r(E0(P))}else s.activeTool==="select"&&r(S0(null))},R=()=>{switch(s.activeTool){case"highlight":return"text";case"pen":return"crosshair";case"comment":return"pointer";case"eraser":return"not-allowed";default:return"default"}};return T.jsxs(RD,{ref:o,$width:e,$height:n,$cursor:R(),onClick:E,onMouseUp:p,children:[b.map(k=>T.jsx(oD,{annotation:k},k.id)),x.map(k=>T.jsx(_D,{annotation:k},k.id)),T.jsx(kD,{ref:a,width:e,height:n,onMouseDown:c,onMouseMove:d,onMouseUp:h,onMouseLeave:h,$isPenActive:s.activeTool==="pen"})]})},RD=X.div`
405
- position: absolute;
406
- top: 0;
407
- left: 0;
408
- width: ${i=>i.$width}px;
409
- height: ${i=>i.$height}px;
410
- pointer-events: none;
411
- cursor: ${i=>i.$cursor};
412
-
413
- & > * {
414
- pointer-events: auto;
415
- }
416
- `,kD=X.canvas`
417
- position: absolute;
418
- top: 0;
419
- left: 0;
420
- pointer-events: ${i=>i.$isPenActive?"auto":"none"};
421
- `,LD=()=>{const{state:i,dispatch:t}=I.useContext(ni);return T.jsx(ID,{children:i.availableColors.map(e=>T.jsx(DD,{$color:e,$isSelected:i.currentColor===e,onClick:()=>t(QI(e)),title:e,"aria-label":`Select color ${e}`,"aria-pressed":i.currentColor===e},e))})},ID=X.div`
422
- display: flex;
423
- gap: 4px;
424
- padding: 4px;
425
- background: white;
426
- border-radius: 4px;
427
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
428
- `,DD=X.button`
429
- width: 24px;
430
- height: 24px;
431
- border-radius: 50%;
432
- border: 2px solid ${i=>i.$isSelected?"#333":"transparent"};
433
- background-color: ${i=>i.$color};
434
- cursor: pointer;
435
- transition: transform 0.15s ease, border-color 0.15s ease;
436
- padding: 0;
437
-
438
- &:hover {
439
- transform: scale(1.15);
440
- }
441
-
442
- &:focus {
443
- outline: 2px solid #0064c8;
444
- outline-offset: 2px;
445
- }
446
-
447
- @media (max-width: 768px) {
448
- width: 20px;
449
- height: 20px;
450
- }
451
- `,FD={select:lD,highlight:cD,pen:hD,comment:dD,eraser:uD},Xv={select:"Select",highlight:"Highlight",pen:"Draw",comment:"Comment",eraser:"Eraser"},MD=()=>{const{state:i,dispatch:t}=I.useContext(ni);return T.jsxs(OD,{children:[T.jsx(ND,{children:i.availableTools.map(e=>{const n=FD[e],s=i.activeTool===e;return T.jsx($D,{$isActive:s,onClick:()=>t(JI(e)),title:Xv[e],"aria-label":Xv[e],"aria-pressed":s,children:T.jsx(n,{color:s?"#0064c8":"#333",size:"60%"})},e)})}),(i.activeTool==="highlight"||i.activeTool==="pen"||i.activeTool==="comment")&&T.jsx(BD,{}),(i.activeTool==="highlight"||i.activeTool==="pen"||i.activeTool==="comment")&&T.jsx(LD,{})]})},OD=X.div`
452
- display: flex;
453
- align-items: center;
454
- gap: 8px;
455
- padding: 8px;
456
- background-color: ${i=>i.theme.tertiary};
457
- border-bottom: 1px solid #e0e0e0;
458
-
459
- @media (max-width: 768px) {
460
- padding: 6px;
461
- gap: 4px;
462
- }
463
- `,ND=X.div`
464
- display: flex;
465
- gap: 4px;
466
- `,$D=X.button`
467
- display: flex;
468
- justify-content: center;
469
- align-items: center;
470
- width: 36px;
471
- height: 36px;
472
- padding: 0;
473
- border: none;
474
- border-radius: 6px;
475
- background-color: ${i=>i.$isActive?"rgba(0, 100, 200, 0.15)":"white"};
476
- cursor: pointer;
477
- transition: background-color 0.15s ease, transform 0.15s ease;
478
-
479
- &:hover {
480
- background-color: ${i=>i.$isActive?"rgba(0, 100, 200, 0.2)":"#f0f0f0"};
481
- }
482
-
483
- &:focus {
484
- outline: 2px solid #0064c8;
485
- outline-offset: 2px;
486
- }
487
-
488
- @media (max-width: 768px) {
489
- width: 30px;
490
- height: 30px;
491
- }
492
- `,BD=X.div`
493
- width: 1px;
494
- height: 24px;
495
- background-color: #ccc;
496
- `,Z1=({pageNum:i})=>{var x,_;const{state:{mainState:t,paginated:e,zoomLevel:n,numPages:s,currentPage:r}}=I.useContext(Ts);I.useContext(ni);const{t:o}=io(),a=I.useRef(null),[c,d]=I.useState({width:0,height:0}),h=(t==null?void 0:t.rendererRect)||null,u=(x=t==null?void 0:t.config)==null?void 0:x.annotations,p=(u==null?void 0:u.enableAnnotations)??!1,v=i??r;I.useEffect(()=>{if(a.current){const E=a.current.querySelector("canvas");E&&d({width:E.width,height:E.height})}},[n,v]);const b=()=>{if(a.current){const E=a.current.querySelector("canvas");E&&d({width:E.offsetWidth,height:E.offsetHeight})}};return T.jsxs(jD,{id:"pdf-page-wrapper",$lastPage:v>=s,children:[!e&&T.jsx(UD,{id:"pdf-page-info",children:o("pdfPluginPageNumber",{currentPage:v,allPagesCount:s})}),T.jsxs(HD,{ref:a,children:[T.jsx(M1,{pageNumber:v||r,scale:n,height:((h==null?void 0:h.height)??100)-100,width:((h==null?void 0:h.width)??100)-100,loading:o("pdfPluginLoading"),onRenderSuccess:b}),p&&c.width>0&&T.jsx(PD,{pageNumber:v,documentUri:((_=t==null?void 0:t.currentDocument)==null?void 0:_.uri)||"",width:c.width,height:c.height})]})]})},jD=X.div`
497
- margin: ${i=>i.$lastPage?"20px 0":void 0};
498
- `,UD=X.div`
499
- padding: 0 0 10px 10px;
500
- color: ${i=>i.theme.textTertiary};
501
- font-size: 14px;
502
- text-align: left;
503
-
504
- @media (max-width: 768px) {
505
- font-size: 10px;
506
- }
507
- `,HD=X.div`
508
- position: relative;
509
- display: inline-block;
510
- `,zD=()=>{const{state:{numPages:i}}=I.useContext(Ts),t=[];for(let e=0;e<i;e++)t.push(T.jsx(Z1,{pageNum:e+1},e+1));return T.jsx(T.Fragment,{children:t})},J1="SET_SIDEBAR_OPEN",Q1="SET_THUMBNAILS",tA="SET_SELECTED_PAGE",eA="UPDATE_SINGLE_THUMBNAIL",GD=i=>({type:J1,isOpen:i}),VD=i=>({type:Q1,thumbnails:i}),Yv=i=>({type:tA,pageNumber:i}),Kv=(i,t)=>({type:eA,pageNumber:i,dataUrl:t}),C0={isOpen:!1,thumbnails:[],selectedPage:1,thumbnailWidth:120},WD=(i=C0,t)=>{switch(t.type){case J1:{const{isOpen:e}=t;return{...i,isOpen:e}}case Q1:{const{thumbnails:e}=t;return{...i,thumbnails:e}}case tA:{const{pageNumber:e}=t;return{...i,selectedPage:e}}case eA:{const{pageNumber:e,dataUrl:n}=t;return{...i,thumbnails:i.thumbnails.map(s=>s.pageNumber===e?{...s,dataUrl:n,isLoading:!1}:s)}}default:return i}},Qh=I.createContext({state:C0,dispatch:()=>null}),qD=({children:i,config:t})=>{const[e,n]=I.useReducer(WD,{...C0,isOpen:(t==null?void 0:t.sidebarDefaultOpen)??!1,thumbnailWidth:(t==null?void 0:t.thumbnailWidth)??120});return T.jsx(Qh.Provider,{value:{state:e,dispatch:n},children:i})},XD=({thumbnail:i,isSelected:t,width:e,onClick:n})=>T.jsxs(YD,{onClick:n,$isSelected:t,$width:e,role:"button",tabIndex:0,"aria-label":`Page ${i.pageNumber}`,onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&n()},children:[T.jsx(KD,{children:i.isLoading?T.jsx(JD,{$width:e,children:T.jsx(eF,{})}):i.dataUrl?T.jsx(ZD,{src:i.dataUrl,alt:`Page ${i.pageNumber}`,$width:e}):T.jsx(QD,{$width:e,children:i.pageNumber})}),T.jsx(tF,{children:i.pageNumber})]}),YD=X.div`
511
- display: flex;
512
- flex-direction: column;
513
- align-items: center;
514
- padding: 8px;
515
- cursor: pointer;
516
- border-radius: 4px;
517
- transition: background-color 0.2s ease;
518
- background-color: ${i=>i.$isSelected?"rgba(0, 100, 200, 0.15)":"transparent"};
519
- border: 2px solid
520
- ${i=>i.$isSelected?"#0064c8":"transparent"};
521
-
522
- &:hover {
523
- background-color: ${i=>i.$isSelected?"rgba(0, 100, 200, 0.2)":"rgba(0, 0, 0, 0.05)"};
524
- }
525
-
526
- &:focus {
527
- outline: 2px solid #0064c8;
528
- outline-offset: 2px;
529
- }
530
- `,KD=X.div`
531
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
532
- border-radius: 2px;
533
- overflow: hidden;
534
- `,ZD=X.img`
535
- width: ${i=>i.$width}px;
536
- height: auto;
537
- display: block;
538
- `,JD=X.div`
539
- width: ${i=>i.$width}px;
540
- height: ${i=>i.$width*1.4}px;
541
- background-color: #f0f0f0;
542
- display: flex;
543
- align-items: center;
544
- justify-content: center;
545
- `,QD=X.div`
546
- width: ${i=>i.$width}px;
547
- height: ${i=>i.$width*1.4}px;
548
- background-color: #e0e0e0;
549
- display: flex;
550
- align-items: center;
551
- justify-content: center;
552
- font-size: 24px;
553
- color: #888;
554
- `,tF=X.span`
555
- margin-top: 4px;
556
- font-size: 12px;
557
- color: #666;
558
- `,eF=X.div`
559
- width: 20px;
560
- height: 20px;
561
- border: 2px solid #e0e0e0;
562
- border-top-color: #666;
563
- border-radius: 50%;
564
- animation: spin 1s linear infinite;
565
-
566
- @keyframes spin {
567
- to {
568
- transform: rotate(360deg);
569
- }
570
- }
571
- `,nF=({onPageSelect:i,currentPage:t})=>{const{state:e,dispatch:n}=I.useContext(Qh),s=I.useRef(null),r=I.useRef(null);if(I.useEffect(()=>{n(Yv(t))},[t,n]),I.useEffect(()=>{if(r.current&&s.current){const a=s.current,c=r.current,d=a.getBoundingClientRect(),h=c.getBoundingClientRect();(h.top<d.top||h.bottom>d.bottom)&&c.scrollIntoView({behavior:"smooth",block:"center"})}},[e.selectedPage]),!e.isOpen)return null;const o=a=>{n(Yv(a)),i(a)};return T.jsx(iF,{children:T.jsx(sF,{ref:s,children:e.thumbnails.map(a=>T.jsx("div",{ref:a.pageNumber===e.selectedPage?r:null,children:T.jsx(XD,{thumbnail:a,isSelected:a.pageNumber===e.selectedPage,width:e.thumbnailWidth,onClick:()=>o(a.pageNumber)})},a.pageNumber))})})},iF=X.div`
572
- display: flex;
573
- flex-direction: column;
574
- background-color: ${i=>i.theme.primary};
575
- border-right: 1px solid #e0e0e0;
576
- flex-shrink: 0;
577
- width: fit-content;
578
- height: 100%;
579
- overflow: hidden;
580
- `,sF=X.div`
581
- display: flex;
582
- flex-direction: column;
583
- gap: 8px;
584
- padding: 12px;
585
- overflow-y: auto;
586
- flex: 1;
587
- min-height: 0;
588
-
589
- &::-webkit-scrollbar {
590
- width: 6px;
591
- }
592
-
593
- &::-webkit-scrollbar-track {
594
- background: transparent;
595
- }
596
-
597
- &::-webkit-scrollbar-thumb {
598
- background-color: #ccc;
599
- border-radius: 3px;
600
-
601
- &:hover {
602
- background-color: #aaa;
603
- }
604
- }
605
-
606
- @media (max-width: 768px) {
607
- padding: 8px;
608
- }
609
- `,rF=({title:i="Toggle thumbnails"})=>{const{state:t,dispatch:e}=I.useContext(Qh),n=()=>{e(GD(!t.isOpen))};return T.jsx(aF,{onClick:n,title:i,"aria-label":i,"aria-pressed":t.isOpen,children:T.jsx(oF,{isOpen:t.isOpen})})},oF=({isOpen:i})=>T.jsxs("svg",{width:"70%",height:"70%",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{opacity:i?1:.7},children:[T.jsx("rect",{x:"3",y:"3",width:"7",height:"9",rx:"1"}),T.jsx("rect",{x:"14",y:"3",width:"7",height:"9",rx:"1"}),T.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),T.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]}),aF=X.button`
610
- display: flex;
611
- justify-content: center;
612
- align-items: center;
613
- width: 30px;
614
- height: 30px;
615
- padding: 0;
616
- margin: 0 0 0 5px;
617
- border: 0;
618
- outline: none;
619
- cursor: pointer;
620
- border-radius: 30px;
621
- background-color: ${i=>i.theme.primary};
622
- color: ${i=>i.theme.textPrimary};
623
- box-shadow: 2px 2px 3px #00000033;
624
- transition: transform 0.2s ease;
625
-
626
- &:hover {
627
- transform: scale(1.05);
628
- }
629
-
630
- @media (max-width: 768px) {
631
- width: 25px;
632
- height: 25px;
633
- }
634
- `,lF=({numPages:i,documentUri:t,scale:e=.15})=>{const{state:n,dispatch:s}=I.useContext(Qh),r=I.useCallback(()=>{if(i>0){const a=Array.from({length:i},(c,d)=>({pageNumber:d+1,isLoading:!0}));s(VD(a))}},[i,s]),o=I.useCallback((a,c)=>{try{const d=a.toDataURL("image/png",.8);s(Kv(c,d))}catch{s(Kv(c,""))}},[s]);return I.useEffect(()=>{r()},[i,t,r]),{thumbnails:n.thumbnails,generateThumbnailFromCanvas:o,scale:e}},cF=120,hF=()=>{var d,h,u;const{state:i}=I.useContext(Ts),{state:t}=I.useContext(Qh),{numPages:e,mainState:n}=i,s=(d=n==null?void 0:n.config)==null?void 0:d.thumbnail,r=(s==null?void 0:s.enableThumbnails)??!1,o=I.useRef(new Set),{generateThumbnailFromCanvas:a}=lF({numPages:e,documentUri:(h=n==null?void 0:n.currentDocument)==null?void 0:h.uri}),c=I.useCallback(p=>{setTimeout(()=>{const v=document.querySelector(`[data-thumbnail-page="${p}"]`);if(v){const b=v.querySelector("canvas");b&&!o.current.has(p)&&(a(b,p),o.current.add(p))}},100)},[a]);return I.useEffect(()=>{o.current.clear()},[(u=n==null?void 0:n.currentDocument)==null?void 0:u.uri]),!r||!t.isOpen||e===0?null:T.jsx(dF,{"aria-hidden":"true",children:Array.from({length:e},(p,v)=>v+1).map(p=>{const v=t.thumbnails.find(b=>b.pageNumber===p);return v!=null&&v.dataUrl?null:T.jsx(uF,{"data-thumbnail-page":p,children:T.jsx(M1,{pageNumber:p,width:cF,onRenderSuccess:()=>c(p),renderTextLayer:!1,renderAnnotationLayer:!1})},p)})})},dF=X.div`
635
- position: absolute;
636
- left: -9999px;
637
- top: -9999px;
638
- visibility: hidden;
639
- pointer-events: none;
640
- `,uF=X.div`
641
- display: inline-block;
642
- `,fF=()=>{const{state:{mainState:i,paginated:t},dispatch:e}=I.useContext(Ts),{t:n}=io(),s=(i==null?void 0:i.currentDocument)||null;return I.useEffect(()=>{e(Wv(Ki.numPages))},[s]),!s||s.fileData===void 0?null:T.jsxs(pF,{file:s.fileData,onLoadSuccess:({numPages:r})=>e(Wv(r)),loading:T.jsx("span",{children:n("pdfPluginLoading")}),children:[t?T.jsx(Z1,{}):T.jsx(zD,{}),T.jsx(hF,{})]})},pF=X(BI)`
643
- display: flex;
644
- flex-direction: column;
645
- margin: 0 auto;
646
- `,gF=i=>T.jsx(nA,{...i,reverse:!0}),mF=i=>T.jsx(nA,{...i}),nA=i=>{const{color:t,size:e,reverse:n}=i;return T.jsx("svg",{width:e||"100%",height:e||"100%",style:{transform:`${n?"rotate(180deg)":""}`},viewBox:"0 0 12 12",version:"1.1",children:T.jsx("g",{id:"Icons",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:T.jsx("g",{id:"Rounded",transform:"translate(-548.000000, -1000.000000)",children:T.jsx("g",{id:"AV",transform:"translate(100.000000, 852.000000)",children:T.jsx("g",{id:"-Round-/-AV-/-skip_next",transform:"translate(442.000000, 142.000000)",children:T.jsxs("g",{children:[T.jsx("rect",{id:"Rectangle-Copy-52",x:"0",y:"0",width:"24",height:"24"}),T.jsx("path",{d:"M7.58,16.89 L13.35,12.82 C13.91,12.42 13.91,11.58 13.35,11.19 L7.58,7.11 C6.91,6.65 6,7.12 6,7.93 L6,16.07 C6,16.88 6.91,17.35 7.58,16.89 Z M16,7 L16,17 C16,17.55 16.45,18 17,18 C17.55,18 18,17.55 18,17 L18,7 C18,6.45 17.55,6 17,6 C16.45,6 16,6.45 16,7 Z",id:"icon_color",fill:t||"#aaa"})]})})})})})})},vF=i=>{const{color:t,size:e,reverse:n}=i;return T.jsxs("svg",{width:e||"100%",height:e||"100%",style:{transform:`${n?"rotate(180deg)":""}`},id:"Layer_1",viewBox:"0 0 24 24",children:[T.jsx("path",{d:"M20.57,9.43A8,8,0,0,0,5.26,10,5,5,0,1,0,5,20h5V18H5a3,3,0,0,1,0-6,3.1,3.1,0,0,1,.79.12l1.12.31.14-1.15a6,6,0,0,1,11.74-.82l.15.54.54.16A3.46,3.46,0,0,1,22,14.5,3.5,3.5,0,0,1,18.5,18H16v2h2.5A5.48,5.48,0,0,0,20.57,9.43Z",fill:t||"#aaa"}),T.jsx("polygon",{points:"12 11 12 15.59 10.71 14.29 9.29 15.71 13 19.41 16.71 15.71 15.29 14.29 14 15.59 14 11 12 11",fill:t||"#aaa"})]})},bF=i=>T.jsx(iA,{...i}),yF=i=>T.jsx(iA,{...i,reverse:!0}),iA=i=>{const{color:t,size:e,reverse:n}=i;return T.jsx("svg",{width:e||"100%",height:e||"100%",viewBox:"0 0 32 32",version:"1.1",children:T.jsx("g",{id:"Page-1",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:T.jsx("g",{id:"search-plus-icon",fill:t||"#aaa",children:T.jsx("path",{id:"search-plus",d:n?"M 13 13 L 16 13 L 19 13 L 19 16 L 16 16 L 13 16 L 10 16 L 10 13 Z M 19.4271 21.4271 C 18.0372 22.4175 16.3367 23 14.5 23 C 9.8056 23 6 19.1944 6 14.5 C 6 9.8056 9.8056 6 14.5 6 C 19.1944 6 23 9.8056 23 14.5 C 23 16.3367 22.4175 18.0372 21.4271 19.4271 L 27.0119 25.0119 C 27.5621 25.5621 27.5575 26.4425 27.0117 26.9883 L 26.9883 27.0117 C 26.4439 27.5561 25.5576 27.5576 25.0119 27.0119 L 19.4271 21.4271 L 19.4271 21.4271 L 19.4271 21.4271 Z M 14.5 21 C 18.0899 21 21 18.0899 21 14.5 C 21 10.9101 18.0899 8 14.5 8 C 10.9101 8 8 10.9101 8 14.5 C 8 18.0899 10.9101 21 14.5 21 L 14.5 21 Z":"M 13 13 L 13 10 L 16 10 L 16 13 L 19 13 L 19 16 L 16 16 L 16 19 L 13 19 L 13 16 L 10 16 L 10 13 Z M 19.4271 21.4271 C 18.0372 22.4175 16.3367 23 14.5 23 C 9.8056 23 6 19.1944 6 14.5 C 6 9.8056 9.8056 6 14.5 6 C 19.1944 6 23 9.8056 23 14.5 C 23 16.3367 22.4175 18.0372 21.4271 19.4271 L 27.0119 25.0119 C 27.5621 25.5621 27.5575 26.4425 27.0117 26.9883 L 26.9883 27.0117 C 26.4439 27.5561 25.5576 27.5576 25.0119 27.0119 L 19.4271 21.4271 L 19.4271 21.4271 L 19.4271 21.4271 Z M 14.5 21 C 18.0899 21 21 18.0899 21 14.5 C 21 10.9101 18.0899 8 14.5 8 C 10.9101 8 8 10.9101 8 14.5 C 8 18.0899 10.9101 21 14.5 21 L 14.5 21 Z"})})})})},wF=i=>{const{color:t,size:e}=i;return T.jsx("svg",{width:e||"100%",height:e||"100%",viewBox:"0 0 24 24",children:T.jsx("path",{fill:t||"#aaa",d:"M9.29,13.29,4,18.59V17a1,1,0,0,0-2,0v4a1,1,0,0,0,.08.38,1,1,0,0,0,.54.54A1,1,0,0,0,3,22H7a1,1,0,0,0,0-2H5.41l5.3-5.29a1,1,0,0,0-1.42-1.42ZM5.41,4H7A1,1,0,0,0,7,2H3a1,1,0,0,0-.38.08,1,1,0,0,0-.54.54A1,1,0,0,0,2,3V7A1,1,0,0,0,4,7V5.41l5.29,5.3a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42ZM21,16a1,1,0,0,0-1,1v1.59l-5.29-5.3a1,1,0,0,0-1.42,1.42L18.59,20H17a1,1,0,0,0,0,2h4a1,1,0,0,0,.38-.08,1,1,0,0,0,.54-.54A1,1,0,0,0,22,21V17A1,1,0,0,0,21,16Zm.92-13.38a1,1,0,0,0-.54-.54A1,1,0,0,0,21,2H17a1,1,0,0,0,0,2h1.59l-5.3,5.29a1,1,0,0,0,0,1.42,1,1,0,0,0,1.42,0L20,5.41V7a1,1,0,0,0,2,0V3A1,1,0,0,0,21.92,2.62Z"})})},AF=i=>{const{color:t,size:e,reverse:n}=i;return T.jsx("svg",{width:e||"100%",height:e||"100%",style:{transform:`${n?"rotate(90deg)":""}`},version:"1.1",id:"Scroll_1",viewBox:"0 0 297 297",xmlSpace:"preserve",children:T.jsx("path",{fill:t||"#aaa",d:`M206.004,200.723h-31.231V96.277h31.231c0.005,0,0.014,0,0.019,0c5.289,0,9.575-4.287,9.575-9.574
647
- c0-2.342-0.841-4.488-2.236-6.151L156.168,3.851C154.36,1.428,151.515,0,148.492,0c-3.023,0-5.868,1.428-7.675,3.851L83.302,80.98
648
- c-2.166,2.902-2.507,6.779-0.883,10.017c1.624,3.236,4.936,5.28,8.559,5.28h31.231v104.445H90.978c-3.623,0-6.934,2.044-8.559,5.28
649
- c-1.624,3.237-1.283,7.114,0.883,10.017l57.513,77.129c1.808,2.424,4.652,3.852,7.675,3.852c3.023,0,5.868-1.428,7.676-3.852
650
- l57.514-77.129c2.164-2.902,2.507-6.779,0.883-10.017C212.938,202.767,209.627,200.723,206.004,200.723z`})})},xF=()=>{const{state:{currentPage:i,numPages:t},dispatch:e}=I.useContext(Ts),{t:n}=io();return T.jsxs(EF,{id:"pdf-pagination",children:[T.jsx(sA,{id:"pdf-pagination-prev",onClick:()=>e(hu(i-1)),disabled:i===1,children:T.jsx(gF,{color:"#000",size:"50%"})}),T.jsx(SF,{id:"pdf-pagination-info",children:n("pdfPluginPageNumber",{currentPage:i,allPagesCount:t})}),T.jsx(_F,{id:"pdf-pagination-next",onClick:()=>e(hu(i+1)),disabled:i>=t,children:T.jsx(mF,{color:"#000",size:"50%"})})]})},EF=X.div`
651
- display: flex;
652
- align-items: center;
653
- `,sA=X(ip)`
654
- width: 30px;
655
- height: 30px;
656
- margin: 0 5px;
657
-
658
- @media (max-width: 768px) {
659
- width: 25px;
660
- height: 25px;
661
- }
662
- `,_F=X(sA)`
663
- margin: 0 20px 0 5px;
664
- `,SF=X.div`
665
- color: ${i=>i.theme.textPrimary};
666
- font-size: 14px;
667
- text-align: left;
668
-
669
- @media (max-width: 768px) {
670
- font-size: 10px;
671
- }
672
- `,CF=()=>{var u;const{t:i}=io(),{state:{mainState:t,paginated:e,zoomLevel:n,numPages:s,zoomJump:r,defaultZoomLevel:o},dispatch:a}=I.useContext(Ts),c=(t==null?void 0:t.currentDocument)||null,d=(u=t==null?void 0:t.config)==null?void 0:u.thumbnail,h=(d==null?void 0:d.enableThumbnails)??!1;return T.jsxs(TF,{id:"pdf-controls",children:[h&&s>1&&T.jsx(rF,{title:"Toggle thumbnails"}),e&&s>1&&T.jsx(xF,{}),(c==null?void 0:c.fileData)&&T.jsx(PF,{id:"pdf-download",href:c==null?void 0:c.fileData,download:(c==null?void 0:c.fileName)||(c==null?void 0:c.uri),title:i("downloadButtonLabel"),children:T.jsx(vF,{color:"#000",size:"75%"})}),T.jsx(md,{id:"pdf-zoom-out",onMouseDown:()=>a(sg(n-r)),children:T.jsx(yF,{color:"#000",size:"80%"})}),T.jsx(md,{id:"pdf-zoom-in",onMouseDown:()=>a(sg(n+r)),children:T.jsx(bF,{color:"#000",size:"80%"})}),T.jsx(md,{id:"pdf-zoom-reset",onMouseDown:()=>a(sg(o)),disabled:n===o,children:T.jsx(wF,{color:"#000",size:"70%"})}),s>1&&T.jsx(md,{id:"pdf-toggle-pagination",onMouseDown:()=>a(x0(!e)),children:T.jsx(AF,{color:"#000",size:"70%",reverse:e})})]})},TF=X.div`
673
- display: flex;
674
- position: sticky;
675
- top: 0;
676
- left: 0;
677
- z-index: 1;
678
- justify-content: flex-end;
679
- padding: 8px;
680
- background-color: ${i=>i.theme.tertiary};
681
- box-shadow: 0px 2px 3px #00000033;
682
-
683
- @media (max-width: 768px) {
684
- padding: 6px;
685
- }
686
- `,md=X(ip)`
687
- width: 30px;
688
- height: 30px;
689
- @media (max-width: 768px) {
690
- width: 25px;
691
- height: 25px;
692
- }
693
- `,PF=X(my)`
694
- width: 30px;
695
- height: 30px;
696
- @media (max-width: 768px) {
697
- width: 25px;
698
- height: 25px;
699
- }
700
- `;A0.workerSrc=new URL(`https://unpkg.com/pdfjs-dist@${A1}/build/pdf.worker.min.mjs`).toString();const RF=()=>{var a,c,d,h;const{state:i,dispatch:t}=I.useContext(Ts),e=(c=(a=i.mainState)==null?void 0:a.config)==null?void 0:c.thumbnail,n=(h=(d=i.mainState)==null?void 0:d.config)==null?void 0:h.annotations,s=(e==null?void 0:e.enableThumbnails)??!1,r=(n==null?void 0:n.enableAnnotations)??!1,o=u=>{t(hu(u)),i.paginated||t(x0(!0))};return T.jsxs(LF,{children:[s&&T.jsx(nF,{onPageSelect:o,currentPage:i.currentPage}),T.jsxs(IF,{children:[r&&T.jsx(MD,{}),T.jsx(CF,{}),T.jsx(fF,{})]})]})},Ep=({mainState:i})=>{var n,s,r;const t=(n=i.config)==null?void 0:n.thumbnail,e=(s=i.config)==null?void 0:s.annotations;return T.jsx(ZI,{mainState:i,children:T.jsx(qD,{config:t,children:T.jsx(iD,{config:e,documentUri:(r=i.currentDocument)==null?void 0:r.uri,children:T.jsx(kF,{id:"pdf-renderer","data-testid":"pdf-renderer",children:T.jsx(RF,{})})})})})};Ep.fileTypes=["pdf","application/pdf"];Ep.weight=0;const kF=X.div`
701
- display: flex;
702
- flex-direction: column;
703
- flex: 1;
704
- overflow: hidden;
705
-
706
- /* width */
707
- &::-webkit-scrollbar {
708
- ${i=>i.theme.disableThemeScrollbar?"":"width: 10px"};
709
- }
710
- /* Track */
711
- &::-webkit-scrollbar-track {
712
- /* background: ${i=>i.theme.secondary}; */
713
- }
714
- /* Handle */
715
- &::-webkit-scrollbar-thumb {
716
- background: ${i=>i.theme.tertiary};
717
- }
718
- /* Handle on hover */
719
- &::-webkit-scrollbar-thumb:hover {
720
- background: ${i=>i.theme.primary};
721
- }
722
- `,LF=X.div`
723
- display: flex;
724
- flex: 1;
725
- overflow: hidden;
726
- `,IF=X.div`
727
- display: flex;
728
- flex-direction: column;
729
- flex: 1;
730
- overflow: auto;
731
- `,DF=X(Hi)`
732
- display: flex;
733
- flex: 1;
734
- align-items: center;
735
- justify-content: center;
736
- height: 100%;
737
- background-color: white;
738
- background-image: linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
739
- linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
740
- linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
741
- linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
742
- background-size: 20px 20px;
743
- background-position:
744
- 0 0,
745
- 0 10px,
746
- 10px -10px,
747
- -10px 0px;
748
- `,_p=i=>T.jsx(DF,{...i});_p.fileTypes=["png","image/png"];_p.weight=0;let $i,tn,uu=[];const FF=()=>{var i=He(2,0);if(i===18761)tn=!0;else if(i===19789)tn=!1;else throw TypeError("Invalid byte order value.");return tn},MF=()=>{if(He(2,2)!==42)throw RangeError("You forgot your towel!");return!0},OF=i=>{var t={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop"},e;return i in t?e=t[i]:e="Tag"+i,e},NF=i=>{var t={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE"},e;return i in t&&(e=t[i]),e},$F=i=>{var t;return["BYTE","ASCII","SBYTE","UNDEFINED"].indexOf(i)!==-1?t=1:["SHORT","SSHORT"].indexOf(i)!==-1?t=2:["LONG","SLONG","FLOAT"].indexOf(i)!==-1?t=4:["RATIONAL","SRATIONAL","DOUBLE"].indexOf(i)!==-1&&(t=8),t},BF=(i,t,e)=>{e=e||0;var n=Math.floor(e/8),s=t+n,r=e+i,o=32-i;if(r<=0)throw RangeError("No bits requested");if(r<=8)var a=24+e,c=$i.getUint8(s,tn);else if(r<=16)var a=16+e,c=$i.getUint16(s,tn);else if(r<=32)var a=e,c=$i.getUint32(s,tn);else throw RangeError("Too many bits requested");var d={bits:c<<a>>>o,byteOffset:s+Math.floor(r/8),bitOffset:r%8};return d},He=(i,t)=>{if(i<=0)throw RangeError("No bytes requested");if(i<=1)return $i.getUint8(t,tn);if(i<=2)return $i.getUint16(t,tn);if(i<=3)return $i.getUint32(t,tn)>>>8;if(i<=4)return $i.getUint32(t,tn);throw RangeError("Too many bytes requested")},jF=(i,t,e,n)=>{var s=[],r=$F(t),o=r*e;if(o<=4){if(tn===!1)var a=n>>>(4-r)*8;else var a=n;s.push(a)}else for(var c=0;c<e;c++){var d=r*c;if(r>=8)if(["RATIONAL","SRATIONAL"].indexOf(t)!==-1)s.push(He(4,n+d)),s.push(He(4,n+d+4));else throw TypeError("Can't handle this field type or size");else s.push(He(r,n+d))}return t==="ASCII"&&s.forEach(function(h,u,p){p[u]=String.fromCharCode(h)}),s},ks=(i,t)=>{var e=Math.pow(2,8-t);return Math.floor(i*e+(e-1))},Zv=(i,t,e,n)=>(typeof n>"u"&&(n=1),"rgba("+i+", "+t+", "+e+", "+n+")"),rA=i=>{for(var t=He(2,i),e=[],n=i+2,s=0;s<t;n+=12,s++){var r=He(2,n),o=He(2,n+2),a=He(4,n+4),c=He(4,n+8),d=OF(r),h=NF(o),u=jF(d,h,a,c);e[d]={type:h,values:u}}uu.push(e);var p=He(4,n);return p===0?uu:rA(p)},UF=(i,t)=>{let e=t||document.createElement("canvas");if(i&&($i=new DataView(i),tn=FF(),!!MF())){var n=He(4,4);uu=rA(n);var s=uu[0],r=s.ImageWidth.values[0],o=s.ImageLength.values[0];e.width=r,e.height=o;var a=[],c=s.Compression?s.Compression.values[0]:1,d=s.SamplesPerPixel.values[0],h=[],u=0,p=!1;if(s.BitsPerSample.values.forEach(function(Wt,lt,Re){h[lt]={bitsPerSample:Wt,hasBytesPerSample:!1,bytesPerSample:void 0},Wt%8===0&&(h[lt].hasBytesPerSample=!0,h[lt].bytesPerSample=Wt/8),u+=Wt},void 0),u%8===0){p=!0;var v=u/8}var b=s.StripOffsets.values,x=b.length;if(s.StripByteCounts)var _=s.StripByteCounts.values;else if(x===1)var _=[Math.ceil(r*o*u/8)];else throw Error("Cannot recover from missing StripByteCounts");for(var E=0;E<x;E++){var R=b[E];a[E]=[];for(var k=_[E],D=0,F=0,M=1,O=!0,C=[],P=0,$=0,N=0;D<k;D+=M)switch(c){case 1:for(var H=0,C=[];H<d;H++)if(h[H].hasBytesPerSample){var z=h[H].bytesPerSample*H;C.push(He(h[H].bytesPerSample,R+D+z))}else{var V=BF(h[H].bitsPerSample,R+D,F);throw C.push(V.bits),D=V.byteOffset-R,F=V.bitOffset,RangeError("Cannot handle sub-byte bits per sample")}if(a[E].push(C),p)M=v;else throw M=0,RangeError("Cannot handle sub-byte bits per pixel");break;case 2:break;case 3:break;case 4:break;case 5:break;case 6:break;case 7:break;case 32773:if(O){O=!1;var Z=1,Q=1,j=$i.getInt8(R+D,tn);j>=0&&j<=127?Z=j+1:j>=-127&&j<=-1?Q=-j+1:O=!0}else{for(var W=He(1,R+D),H=0;H<Q;H++){if(h[$].hasBytesPerSample)N=N<<8*P|W,P++,P===h[$].bytesPerSample&&(C.push(N),N=P=0,$++);else throw RangeError("Cannot handle sub-byte bits per sample");$===d&&(a[E].push(C),C=[],$=0)}Z--,Z===0&&(O=!0)}M=1;break}}if(e.getContext){var q=e.getContext("2d");if(q.fillStyle=Zv(255,255,255,0),s.RowsPerStrip)var wt=s.RowsPerStrip.values[0];else var wt=o;var pt=a.length,G=o%wt,st=G===0?wt:G,nt=wt,it=0,dt=s.PhotometricInterpretation.values[0],J=[],vt=0;if(s.ExtraSamples&&(J=s.ExtraSamples.values,vt=J.length),s.ColorMap)var Y=s.ColorMap.values,tt=Math.pow(2,h[0].bitsPerSample);for(var E=0;E<pt;E++){E+1===pt&&(nt=st);for(var ut=a[E].length,gt=it*E,at=0,St=0;St<ut;at++)for(var At=0;At<r;At++,St++){var K=a[E][St],bt=0,Pt=0,jt=0,Kt=1;if(vt>0){for(var Vt=0;Vt<vt;Vt++)if(J[Vt]===1||J[Vt]===2){Kt=K[3+Vt]/256;break}}switch(dt){case 0:if(h[0].hasBytesPerSample)var kt=Math.pow(16,h[0].bytesPerSample*2);K.forEach(function(lt,Re,ke){ke[Re]=kt-lt});case 1:bt=Pt=jt=ks(K[0],h[0].bitsPerSample);break;case 2:bt=ks(K[0],h[0].bitsPerSample),Pt=ks(K[1],h[1].bitsPerSample),jt=ks(K[2],h[2].bitsPerSample);break;case 3:if(Y===void 0)throw Error("Palette image missing color map");var Lt=K[0];bt=ks(Y[Lt],16),Pt=ks(Y[tt+Lt],16),jt=ks(Y[2*tt+Lt],16);break;case 4:throw RangeError("Not Yet Implemented: Transparency mask");case 5:throw RangeError("Not Yet Implemented: CMYK");case 6:throw RangeError("Not Yet Implemented: YCbCr");case 8:throw RangeError("Not Yet Implemented: CIELab");default:throw RangeError("Unknown Photometric Interpretation:",dt)}q.fillStyle=Zv(bt,Pt,jt,Kt),q.fillRect(At,gt+at,1,1)}it=nt}}return e}},td=i=>{const{mainState:{currentDocument:t}}=i,{t:e}=io(),[n,s]=I.useState(!1),[r,o]=I.useState(!1);return I.useEffect(()=>{if(!t||n)return;const a=document.getElementById("tiff-img");try{a&&UF(t.fileData,a),s(!0)}catch{o(!0)}},[t,n]),r?T.jsx(Hi,{...i,children:T.jsx("div",{children:e("brokenFile")})}):T.jsx(Hi,{...i,children:T.jsx(HF,{id:"tiff-img"})})};td.fileTypes=["tif","tiff","image/tif","image/tiff"];td.weight=0;td.fileLoader=wy;const HF=X.canvas`
749
- max-width: 95%;
750
- max-height: 95%;
751
- `,ed=({mainState:{currentDocument:i}})=>T.jsx(zF,{id:"txt-renderer",children:i==null?void 0:i.fileData});ed.fileTypes=["txt","text/plain"];ed.weight=0;ed.fileLoader=c0;const zF=X.div`
752
- display: flex;
753
- flex-direction: column;
754
- width: 100%;
755
- padding: 30px;
756
- `;var oA={exports:{}};/* @license
757
- Papa Parse
758
- v5.4.1
759
- https://github.com/mholt/PapaParse
760
- License: MIT
761
- */(function(i,t){(function(e,n){i.exports=n()})(vo,function e(){var n=typeof self<"u"?self:typeof window<"u"?window:n!==void 0?n:{},s=!n.document&&!!n.postMessage,r=n.IS_PAPA_WORKER||!1,o={},a=0,c={parse:function(C,P){var $=(P=P||{}).dynamicTyping||!1;if(O($)&&(P.dynamicTypingFunction=$,$={}),P.dynamicTyping=$,P.transform=!!O(P.transform)&&P.transform,P.worker&&c.WORKERS_SUPPORTED){var N=function(){if(!c.WORKERS_SUPPORTED)return!1;var z=(Z=n.URL||n.webkitURL||null,Q=e.toString(),c.BLOB_URL||(c.BLOB_URL=Z.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",Q,")();"],{type:"text/javascript"})))),V=new n.Worker(z),Z,Q;return V.onmessage=R,V.id=a++,o[V.id]=V}();return N.userStep=P.step,N.userChunk=P.chunk,N.userComplete=P.complete,N.userError=P.error,P.step=O(P.step),P.chunk=O(P.chunk),P.complete=O(P.complete),P.error=O(P.error),delete P.worker,void N.postMessage({input:C,config:P,workerId:N.id})}var H=null;return c.NODE_STREAM_INPUT,typeof C=="string"?(C=function(z){return z.charCodeAt(0)===65279?z.slice(1):z}(C),H=P.download?new u(P):new v(P)):C.readable===!0&&O(C.read)&&O(C.on)?H=new b(P):(n.File&&C instanceof File||C instanceof Object)&&(H=new p(P)),H.stream(C)},unparse:function(C,P){var $=!1,N=!0,H=",",z=`\r
762
- `,V='"',Z=V+V,Q=!1,j=null,W=!1;(function(){if(typeof P=="object"){if(typeof P.delimiter!="string"||c.BAD_DELIMITERS.filter(function(G){return P.delimiter.indexOf(G)!==-1}).length||(H=P.delimiter),(typeof P.quotes=="boolean"||typeof P.quotes=="function"||Array.isArray(P.quotes))&&($=P.quotes),typeof P.skipEmptyLines!="boolean"&&typeof P.skipEmptyLines!="string"||(Q=P.skipEmptyLines),typeof P.newline=="string"&&(z=P.newline),typeof P.quoteChar=="string"&&(V=P.quoteChar),typeof P.header=="boolean"&&(N=P.header),Array.isArray(P.columns)){if(P.columns.length===0)throw new Error("Option columns is empty");j=P.columns}P.escapeChar!==void 0&&(Z=P.escapeChar+V),(typeof P.escapeFormulae=="boolean"||P.escapeFormulae instanceof RegExp)&&(W=P.escapeFormulae instanceof RegExp?P.escapeFormulae:/^[=+\-@\t\r].*$/)}})();var q=new RegExp(_(V),"g");if(typeof C=="string"&&(C=JSON.parse(C)),Array.isArray(C)){if(!C.length||Array.isArray(C[0]))return wt(null,C,Q);if(typeof C[0]=="object")return wt(j||Object.keys(C[0]),C,Q)}else if(typeof C=="object")return typeof C.data=="string"&&(C.data=JSON.parse(C.data)),Array.isArray(C.data)&&(C.fields||(C.fields=C.meta&&C.meta.fields||j),C.fields||(C.fields=Array.isArray(C.data[0])?C.fields:typeof C.data[0]=="object"?Object.keys(C.data[0]):[]),Array.isArray(C.data[0])||typeof C.data[0]=="object"||(C.data=[C.data])),wt(C.fields||[],C.data||[],Q);throw new Error("Unable to serialize unrecognized input");function wt(G,st,nt){var it="";typeof G=="string"&&(G=JSON.parse(G)),typeof st=="string"&&(st=JSON.parse(st));var dt=Array.isArray(G)&&0<G.length,J=!Array.isArray(st[0]);if(dt&&N){for(var vt=0;vt<G.length;vt++)0<vt&&(it+=H),it+=pt(G[vt],vt);0<st.length&&(it+=z)}for(var Y=0;Y<st.length;Y++){var tt=dt?G.length:st[Y].length,ut=!1,gt=dt?Object.keys(st[Y]).length===0:st[Y].length===0;if(nt&&!dt&&(ut=nt==="greedy"?st[Y].join("").trim()==="":st[Y].length===1&&st[Y][0].length===0),nt==="greedy"&&dt){for(var at=[],St=0;St<tt;St++){var At=J?G[St]:St;at.push(st[Y][At])}ut=at.join("").trim()===""}if(!ut){for(var K=0;K<tt;K++){0<K&&!gt&&(it+=H);var bt=dt&&J?G[K]:K;it+=pt(st[Y][bt],K)}Y<st.length-1&&(!nt||0<tt&&!gt)&&(it+=z)}}return it}function pt(G,st){if(G==null)return"";if(G.constructor===Date)return JSON.stringify(G).slice(1,25);var nt=!1;W&&typeof G=="string"&&W.test(G)&&(G="'"+G,nt=!0);var it=G.toString().replace(q,Z);return(nt=nt||$===!0||typeof $=="function"&&$(G,st)||Array.isArray($)&&$[st]||function(dt,J){for(var vt=0;vt<J.length;vt++)if(-1<dt.indexOf(J[vt]))return!0;return!1}(it,c.BAD_DELIMITERS)||-1<it.indexOf(H)||it.charAt(0)===" "||it.charAt(it.length-1)===" ")?V+it+V:it}}};if(c.RECORD_SEP="",c.UNIT_SEP="",c.BYTE_ORDER_MARK="\uFEFF",c.BAD_DELIMITERS=["\r",`
763
- `,'"',c.BYTE_ORDER_MARK],c.WORKERS_SUPPORTED=!s&&!!n.Worker,c.NODE_STREAM_INPUT=1,c.LocalChunkSize=10485760,c.RemoteChunkSize=5242880,c.DefaultDelimiter=",",c.Parser=E,c.ParserHandle=x,c.NetworkStreamer=u,c.FileStreamer=p,c.StringStreamer=v,c.ReadableStreamStreamer=b,n.jQuery){var d=n.jQuery;d.fn.parse=function(C){var P=C.config||{},$=[];return this.each(function(z){if(!(d(this).prop("tagName").toUpperCase()==="INPUT"&&d(this).attr("type").toLowerCase()==="file"&&n.FileReader)||!this.files||this.files.length===0)return!0;for(var V=0;V<this.files.length;V++)$.push({file:this.files[V],inputElem:this,instanceConfig:d.extend({},P)})}),N(),this;function N(){if($.length!==0){var z,V,Z,Q,j=$[0];if(O(C.before)){var W=C.before(j.file,j.inputElem);if(typeof W=="object"){if(W.action==="abort")return z="AbortError",V=j.file,Z=j.inputElem,Q=W.reason,void(O(C.error)&&C.error({name:z},V,Z,Q));if(W.action==="skip")return void H();typeof W.config=="object"&&(j.instanceConfig=d.extend(j.instanceConfig,W.config))}else if(W==="skip")return void H()}var q=j.instanceConfig.complete;j.instanceConfig.complete=function(wt){O(q)&&q(wt,j.file,j.inputElem),H()},c.parse(j.file,j.instanceConfig)}else O(C.complete)&&C.complete()}function H(){$.splice(0,1),N()}}}function h(C){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(P){var $=F(P);$.chunkSize=parseInt($.chunkSize),P.step||P.chunk||($.chunkSize=null),this._handle=new x($),(this._handle.streamer=this)._config=$}).call(this,C),this.parseChunk=function(P,$){if(this.isFirstChunk&&O(this._config.beforeFirstChunk)){var N=this._config.beforeFirstChunk(P);N!==void 0&&(P=N)}this.isFirstChunk=!1,this._halted=!1;var H=this._partialLine+P;this._partialLine="";var z=this._handle.parse(H,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var V=z.meta.cursor;this._finished||(this._partialLine=H.substring(V-this._baseIndex),this._baseIndex=V),z&&z.data&&(this._rowCount+=z.data.length);var Z=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(r)n.postMessage({results:z,workerId:c.WORKER_ID,finished:Z});else if(O(this._config.chunk)&&!$){if(this._config.chunk(z,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);z=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(z.data),this._completeResults.errors=this._completeResults.errors.concat(z.errors),this._completeResults.meta=z.meta),this._completed||!Z||!O(this._config.complete)||z&&z.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),Z||z&&z.meta.paused||this._nextChunk(),z}this._halted=!0},this._sendError=function(P){O(this._config.error)?this._config.error(P):r&&this._config.error&&n.postMessage({workerId:c.WORKER_ID,error:P,finished:!1})}}function u(C){var P;(C=C||{}).chunkSize||(C.chunkSize=c.RemoteChunkSize),h.call(this,C),this._nextChunk=s?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function($){this._input=$,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(P=new XMLHttpRequest,this._config.withCredentials&&(P.withCredentials=this._config.withCredentials),s||(P.onload=M(this._chunkLoaded,this),P.onerror=M(this._chunkError,this)),P.open(this._config.downloadRequestBody?"POST":"GET",this._input,!s),this._config.downloadRequestHeaders){var $=this._config.downloadRequestHeaders;for(var N in $)P.setRequestHeader(N,$[N])}if(this._config.chunkSize){var H=this._start+this._config.chunkSize-1;P.setRequestHeader("Range","bytes="+this._start+"-"+H)}try{P.send(this._config.downloadRequestBody)}catch(z){this._chunkError(z.message)}s&&P.status===0&&this._chunkError()}},this._chunkLoaded=function(){P.readyState===4&&(P.status<200||400<=P.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:P.responseText.length,this._finished=!this._config.chunkSize||this._start>=function($){var N=$.getResponseHeader("Content-Range");return N===null?-1:parseInt(N.substring(N.lastIndexOf("/")+1))}(P),this.parseChunk(P.responseText)))},this._chunkError=function($){var N=P.statusText||$;this._sendError(new Error(N))}}function p(C){var P,$;(C=C||{}).chunkSize||(C.chunkSize=c.LocalChunkSize),h.call(this,C);var N=typeof FileReader<"u";this.stream=function(H){this._input=H,$=H.slice||H.webkitSlice||H.mozSlice,N?((P=new FileReader).onload=M(this._chunkLoaded,this),P.onerror=M(this._chunkError,this)):P=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var H=this._input;if(this._config.chunkSize){var z=Math.min(this._start+this._config.chunkSize,this._input.size);H=$.call(H,this._start,z)}var V=P.readAsText(H,this._config.encoding);N||this._chunkLoaded({target:{result:V}})},this._chunkLoaded=function(H){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(H.target.result)},this._chunkError=function(){this._sendError(P.error)}}function v(C){var P;h.call(this,C=C||{}),this.stream=function($){return P=$,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var $,N=this._config.chunkSize;return N?($=P.substring(0,N),P=P.substring(N)):($=P,P=""),this._finished=!P,this.parseChunk($)}}}function b(C){h.call(this,C=C||{});var P=[],$=!0,N=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(H){this._input=H,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){N&&P.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),P.length?this.parseChunk(P.shift()):$=!0},this._streamData=M(function(H){try{P.push(typeof H=="string"?H:H.toString(this._config.encoding)),$&&($=!1,this._checkIsFinished(),this.parseChunk(P.shift()))}catch(z){this._streamError(z)}},this),this._streamError=M(function(H){this._streamCleanUp(),this._sendError(H)},this),this._streamEnd=M(function(){this._streamCleanUp(),N=!0,this._streamData("")},this),this._streamCleanUp=M(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function x(C){var P,$,N,H=Math.pow(2,53),z=-H,V=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,Z=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,Q=this,j=0,W=0,q=!1,wt=!1,pt=[],G={data:[],errors:[],meta:{}};if(O(C.step)){var st=C.step;C.step=function(Y){if(G=Y,dt())it();else{if(it(),G.data.length===0)return;j+=Y.data.length,C.preview&&j>C.preview?$.abort():(G.data=G.data[0],st(G,Q))}}}function nt(Y){return C.skipEmptyLines==="greedy"?Y.join("").trim()==="":Y.length===1&&Y[0].length===0}function it(){return G&&N&&(vt("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+c.DefaultDelimiter+"'"),N=!1),C.skipEmptyLines&&(G.data=G.data.filter(function(Y){return!nt(Y)})),dt()&&function(){if(!G)return;function Y(ut,gt){O(C.transformHeader)&&(ut=C.transformHeader(ut,gt)),pt.push(ut)}if(Array.isArray(G.data[0])){for(var tt=0;dt()&&tt<G.data.length;tt++)G.data[tt].forEach(Y);G.data.splice(0,1)}else G.data.forEach(Y)}(),function(){if(!G||!C.header&&!C.dynamicTyping&&!C.transform)return G;function Y(ut,gt){var at,St=C.header?{}:[];for(at=0;at<ut.length;at++){var At=at,K=ut[at];C.header&&(At=at>=pt.length?"__parsed_extra":pt[at]),C.transform&&(K=C.transform(K,At)),K=J(At,K),At==="__parsed_extra"?(St[At]=St[At]||[],St[At].push(K)):St[At]=K}return C.header&&(at>pt.length?vt("FieldMismatch","TooManyFields","Too many fields: expected "+pt.length+" fields but parsed "+at,W+gt):at<pt.length&&vt("FieldMismatch","TooFewFields","Too few fields: expected "+pt.length+" fields but parsed "+at,W+gt)),St}var tt=1;return!G.data.length||Array.isArray(G.data[0])?(G.data=G.data.map(Y),tt=G.data.length):G.data=Y(G.data,0),C.header&&G.meta&&(G.meta.fields=pt),W+=tt,G}()}function dt(){return C.header&&pt.length===0}function J(Y,tt){return ut=Y,C.dynamicTypingFunction&&C.dynamicTyping[ut]===void 0&&(C.dynamicTyping[ut]=C.dynamicTypingFunction(ut)),(C.dynamicTyping[ut]||C.dynamicTyping)===!0?tt==="true"||tt==="TRUE"||tt!=="false"&&tt!=="FALSE"&&(function(gt){if(V.test(gt)){var at=parseFloat(gt);if(z<at&&at<H)return!0}return!1}(tt)?parseFloat(tt):Z.test(tt)?new Date(tt):tt===""?null:tt):tt;var ut}function vt(Y,tt,ut,gt){var at={type:Y,code:tt,message:ut};gt!==void 0&&(at.row=gt),G.errors.push(at)}this.parse=function(Y,tt,ut){var gt=C.quoteChar||'"';if(C.newline||(C.newline=function(At,K){At=At.substring(0,1048576);var bt=new RegExp(_(K)+"([^]*?)"+_(K),"gm"),Pt=(At=At.replace(bt,"")).split("\r"),jt=At.split(`
764
- `),Kt=1<jt.length&&jt[0].length<Pt[0].length;if(Pt.length===1||Kt)return`
765
- `;for(var Vt=0,kt=0;kt<Pt.length;kt++)Pt[kt][0]===`
766
- `&&Vt++;return Vt>=Pt.length/2?`\r
767
- `:"\r"}(Y,gt)),N=!1,C.delimiter)O(C.delimiter)&&(C.delimiter=C.delimiter(Y),G.meta.delimiter=C.delimiter);else{var at=function(At,K,bt,Pt,jt){var Kt,Vt,kt,Lt;jt=jt||[","," ","|",";",c.RECORD_SEP,c.UNIT_SEP];for(var Wt=0;Wt<jt.length;Wt++){var lt=jt[Wt],Re=0,ke=0,ce=0;kt=void 0;for(var nn=new E({comments:Pt,delimiter:lt,newline:K,preview:10}).parse(At),y=0;y<nn.data.length;y++)if(bt&&nt(nn.data[y]))ce++;else{var f=nn.data[y].length;ke+=f,kt!==void 0?0<f&&(Re+=Math.abs(f-kt),kt=f):kt=f}0<nn.data.length&&(ke/=nn.data.length-ce),(Vt===void 0||Re<=Vt)&&(Lt===void 0||Lt<ke)&&1.99<ke&&(Vt=Re,Kt=lt,Lt=ke)}return{successful:!!(C.delimiter=Kt),bestDelimiter:Kt}}(Y,C.newline,C.skipEmptyLines,C.comments,C.delimitersToGuess);at.successful?C.delimiter=at.bestDelimiter:(N=!0,C.delimiter=c.DefaultDelimiter),G.meta.delimiter=C.delimiter}var St=F(C);return C.preview&&C.header&&St.preview++,P=Y,$=new E(St),G=$.parse(P,tt,ut),it(),q?{meta:{paused:!0}}:G||{meta:{paused:!1}}},this.paused=function(){return q},this.pause=function(){q=!0,$.abort(),P=O(C.chunk)?"":P.substring($.getCharIndex())},this.resume=function(){Q.streamer._halted?(q=!1,Q.streamer.parseChunk(P,!0)):setTimeout(Q.resume,3)},this.aborted=function(){return wt},this.abort=function(){wt=!0,$.abort(),G.meta.aborted=!0,O(C.complete)&&C.complete(G),P=""}}function _(C){return C.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function E(C){var P,$=(C=C||{}).delimiter,N=C.newline,H=C.comments,z=C.step,V=C.preview,Z=C.fastMode,Q=P=C.quoteChar===void 0||C.quoteChar===null?'"':C.quoteChar;if(C.escapeChar!==void 0&&(Q=C.escapeChar),(typeof $!="string"||-1<c.BAD_DELIMITERS.indexOf($))&&($=","),H===$)throw new Error("Comment character same as delimiter");H===!0?H="#":(typeof H!="string"||-1<c.BAD_DELIMITERS.indexOf(H))&&(H=!1),N!==`
768
- `&&N!=="\r"&&N!==`\r
769
- `&&(N=`
770
- `);var j=0,W=!1;this.parse=function(q,wt,pt){if(typeof q!="string")throw new Error("Input must be a string");var G=q.length,st=$.length,nt=N.length,it=H.length,dt=O(z),J=[],vt=[],Y=[],tt=j=0;if(!q)return g();if(C.header&&!wt){var ut=q.split(N)[0].split($),gt=[],at={},St=!1;for(var At in ut){var K=ut[At];O(C.transformHeader)&&(K=C.transformHeader(K,At));var bt=K,Pt=at[K]||0;for(0<Pt&&(St=!0,bt=K+"_"+Pt),at[K]=Pt+1;gt.includes(bt);)bt=bt+"_"+Pt;gt.push(bt)}if(St){var jt=q.split(N);jt[0]=gt.join($),q=jt.join(N)}}if(Z||Z!==!1&&q.indexOf(P)===-1){for(var Kt=q.split(N),Vt=0;Vt<Kt.length;Vt++){if(Y=Kt[Vt],j+=Y.length,Vt!==Kt.length-1)j+=N.length;else if(pt)return g();if(!H||Y.substring(0,it)!==H){if(dt){if(J=[],ce(Y.split($)),S(),W)return g()}else ce(Y.split($));if(V&&V<=Vt)return J=J.slice(0,V),g(!0)}}return g()}for(var kt=q.indexOf($,j),Lt=q.indexOf(N,j),Wt=new RegExp(_(Q)+_(P),"g"),lt=q.indexOf(P,j);;)if(q[j]!==P)if(H&&Y.length===0&&q.substring(j,j+it)===H){if(Lt===-1)return g();j=Lt+nt,Lt=q.indexOf(N,j),kt=q.indexOf($,j)}else if(kt!==-1&&(kt<Lt||Lt===-1))Y.push(q.substring(j,kt)),j=kt+st,kt=q.indexOf($,j);else{if(Lt===-1)break;if(Y.push(q.substring(j,Lt)),f(Lt+nt),dt&&(S(),W))return g();if(V&&J.length>=V)return g(!0)}else for(lt=j,j++;;){if((lt=q.indexOf(P,lt+1))===-1)return pt||vt.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:J.length,index:j}),y();if(lt===G-1)return y(q.substring(j,lt).replace(Wt,P));if(P!==Q||q[lt+1]!==Q){if(P===Q||lt===0||q[lt-1]!==Q){kt!==-1&&kt<lt+1&&(kt=q.indexOf($,lt+1)),Lt!==-1&&Lt<lt+1&&(Lt=q.indexOf(N,lt+1));var Re=nn(Lt===-1?kt:Math.min(kt,Lt));if(q.substr(lt+1+Re,st)===$){Y.push(q.substring(j,lt).replace(Wt,P)),q[j=lt+1+Re+st]!==P&&(lt=q.indexOf(P,j)),kt=q.indexOf($,j),Lt=q.indexOf(N,j);break}var ke=nn(Lt);if(q.substring(lt+1+ke,lt+1+ke+nt)===N){if(Y.push(q.substring(j,lt).replace(Wt,P)),f(lt+1+ke+nt),kt=q.indexOf($,j),lt=q.indexOf(P,j),dt&&(S(),W))return g();if(V&&J.length>=V)return g(!0);break}vt.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:J.length,index:j}),lt++}}else lt++}return y();function ce(L){J.push(L),tt=j}function nn(L){var B=0;if(L!==-1){var U=q.substring(lt+1,L);U&&U.trim()===""&&(B=U.length)}return B}function y(L){return pt||(L===void 0&&(L=q.substring(j)),Y.push(L),j=G,ce(Y),dt&&S()),g()}function f(L){j=L,ce(Y),Y=[],Lt=q.indexOf(N,j)}function g(L){return{data:J,errors:vt,meta:{delimiter:$,linebreak:N,aborted:W,truncated:!!L,cursor:tt+(wt||0)}}}function S(){z(g()),J=[],vt=[]}},this.abort=function(){W=!0},this.getCharIndex=function(){return j}}function R(C){var P=C.data,$=o[P.workerId],N=!1;if(P.error)$.userError(P.error,P.file);else if(P.results&&P.results.data){var H={abort:function(){N=!0,k(P.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:D,resume:D};if(O($.userStep)){for(var z=0;z<P.results.data.length&&($.userStep({data:P.results.data[z],errors:P.results.errors,meta:P.results.meta},H),!N);z++);delete P.results}else O($.userChunk)&&($.userChunk(P.results,H,P.file),delete P.results)}P.finished&&!N&&k(P.workerId,P.results)}function k(C,P){var $=o[C];O($.userComplete)&&$.userComplete(P),$.terminate(),delete o[C]}function D(){throw new Error("Not implemented.")}function F(C){if(typeof C!="object"||C===null)return C;var P=Array.isArray(C)?[]:{};for(var $ in C)P[$]=F(C[$]);return P}function M(C,P){return function(){C.apply(P,arguments)}}function O(C){return typeof C=="function"}return r&&(n.onmessage=function(C){var P=C.data;if(c.WORKER_ID===void 0&&P&&(c.WORKER_ID=P.workerId),typeof P.input=="string")n.postMessage({workerId:c.WORKER_ID,results:c.parse(P.input,P.config),finished:!0});else if(n.File&&P.input instanceof File||P.input instanceof Object){var $=c.parse(P.input,P.config);$&&n.postMessage({workerId:c.WORKER_ID,results:$,finished:!0})}}),(u.prototype=Object.create(h.prototype)).constructor=u,(p.prototype=Object.create(h.prototype)).constructor=p,(v.prototype=Object.create(v.prototype)).constructor=v,(b.prototype=Object.create(h.prototype)).constructor=b,c})})(oA);var GF=oA.exports;const VF=Gm(GF),nd=({mainState:{currentDocument:i,config:t}})=>{const[e,n]=I.useState([]);return I.useEffect(()=>{var s;if(i!=null&&i.fileData){const r=VF.parse(i.fileData,{delimiter:(t==null?void 0:t.csvDelimiter)??","});!((s=r.errors)!=null&&s.length)&&r.data&&n(r.data)}},[i,t==null?void 0:t.csvDelimiter]),e.length?T.jsx(WF,{children:T.jsxs(qF,{children:[T.jsx("thead",{children:T.jsx("tr",{children:e[0].map(s=>T.jsx("th",{children:s},s))})}),T.jsx("tbody",{children:e.slice(1,e.length).map(s=>T.jsx("tr",{children:s.map(r=>T.jsx("td",{children:r},r))},s.join("")))})]})}):null};nd.fileTypes=["csv","text/csv"];nd.weight=0;nd.fileLoader=c0;const WF=X.div`
771
- width: 100%;
772
- `,qF=X.table`
773
- width: 100%;
774
- text-align: left;
775
-
776
- th,
777
- td {
778
- padding: 5px 10px;
779
-
780
- &:empty {
781
- display: none;
782
- }
783
- }
784
- `,Sp=i=>T.jsx(Hi,{...i});Sp.fileTypes=["gif","image/gif"];Sp.weight=0;const Cp=({mainState:{currentDocument:i}})=>i?T.jsx(XF,{id:"video-renderer",children:T.jsx(YF,{controls:!0,src:i.uri})}):null;Cp.fileTypes=["video/mp4","video/quicktime","video/x-msvideo"];Cp.weight=0;const XF=X.div`
785
- width: 100%;
786
- `,YF=X.video`
787
- width: 100%;
788
- height: 100%;
789
- border: 0;
790
- `,Tp=i=>T.jsx(Hi,{...i});Tp.fileTypes=["webp","image/webp"];Tp.weight=0;const aA=[rp,Wh,op,qh,Ep,_p,td,ed,nd,Sp,Cp,Tp],KF=I.forwardRef((i,t)=>{const{documents:e,theme:n,config:s}=i,r=s==null?void 0:s.dragDrop,o=(r==null?void 0:r.enableDragDrop)??!1,a=I.useRef(null),{dragState:c,handleDragEnter:d,handleDragLeave:h,handleDragOver:u,handleDrop:p}=qP(),v=I.useCallback(b=>{var x;(x=a.current)==null||x.handleFilesDropped(b)},[]);if(!e)throw new Error("Please provide an array of documents to DocViewer!");return T.jsx(JP,{ref:t,providerRef:a,pluginRenderers:aA,...i,dragDropConfig:o?r:void 0,children:T.jsx(eC,{theme:n?{...bv,...n}:bv,children:T.jsxs(JF,{id:"react-doc-viewer","data-testid":"react-doc-viewer",className:i.className,style:i.style,onDragEnter:o?d:void 0,onDragLeave:o?h:void 0,onDragOver:o?u:void 0,onDrop:o?b=>p(b,v):void 0,children:[T.jsx(CR,{}),T.jsx(DR,{}),o&&T.jsx(UP,{dragState:c})]})})})}),ZF=I.memo(KF),JF=X.div`
791
- display: flex;
792
- flex-direction: column;
793
- background: #ffffff;
794
- width: 100%;
795
- height: 100%;
796
- position: relative;
797
- `;exports.BMPRenderer=rp;exports.Buffer=iu;exports.CSVRenderer=nd;exports.DocViewer=ZF;exports.DocViewerRenderers=aA;exports.HTMLRenderer=Wh;exports.JPGRenderer=op;exports.JPGRenderer$1=Sp;exports.MSDocRenderer=qh;exports.PDFRenderer=Ep;exports.PNGRenderer=_p;exports.TIFFRenderer=td;exports.TXTRenderer=ed;exports.VideoRenderer=Cp;exports.WebPRenderer=Tp;exports.arrayBufferFileLoader=wy;exports.binaryStringFileLoader=PR;exports.commonjsGlobal=vo;exports.dataURLFileLoader=l0;exports.defaultFileLoader=Ay;exports.dist=gk;exports.getAugmentedNamespace=hA;exports.getDefaultExportFromCjs=Gm;exports.process$1=ht;exports.supportedLanguages=FP;exports.textFileLoader=c0;