UNPKG

react-doc-viewer-x

Version:
388 lines 513 kB
"use strict";var k1=Object.defineProperty;var I1=(s,t,e)=>t in s?k1(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var dt=(s,t,e)=>(I1(s,typeof t!="symbol"?t+"":t,e),e),Sp=(s,t,e)=>{if(!t.has(s))throw TypeError("Cannot "+e)};var a=(s,t,e)=>(Sp(s,t,"read from private field"),e?e.call(s):t.get(s)),m=(s,t,e)=>{if(t.has(s))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(s):t.set(s,e)},w=(s,t,e,n)=>(Sp(s,t,"write to private field"),n?n.call(s,e):t.set(s,e),e);var Ge=(s,t,e,n)=>({set _(i){w(s,t,i,e)},get _(){return a(s,t,n)}}),A=(s,t,e)=>(Sp(s,t,"access private method"),e);const O=require("react/jsx-runtime"),U=require("react");var go=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Um(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function F1(s){if(s.__esModule)return s;var t=s.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(s).forEach(function(n){var i=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return s[n]}})}),e}var Xa=function(s){return s&&s.Math===Math&&s},Qn=Xa(typeof globalThis=="object"&&globalThis)||Xa(typeof window=="object"&&window)||Xa(typeof self=="object"&&self)||Xa(typeof go=="object"&&go)||Xa(typeof go=="object"&&go)||function(){return this}()||Function("return this")(),Hm={},_s=function(s){try{return!!s()}catch{return!0}},M1=_s,Qr=!M1(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),D1=_s,Hv=!D1(function(){var s=(function(){}).bind();return typeof s!="function"||s.hasOwnProperty("prototype")}),O1=Hv,eu=Function.prototype.call,zm=O1?eu.bind(eu):function(){return eu.apply(eu,arguments)},zv={},Vv={}.propertyIsEnumerable,Gv=Object.getOwnPropertyDescriptor,N1=Gv&&!Vv.call({1:2},1);zv.f=N1?function(t){var e=Gv(this,t);return!!e&&e.enumerable}:Vv;var Wv=function(s,t){return{enumerable:!(s&1),configurable:!(s&2),writable:!(s&4),value:t}},qv=Hv,Xv=Function.prototype,ng=Xv.call,B1=qv&&Xv.bind.bind(ng,ng),Hi=qv?B1:function(s){return function(){return ng.apply(s,arguments)}},Yv=Hi,$1=Yv({}.toString),j1=Yv("".slice),U1=function(s){return j1($1(s),8,-1)},H1=Hi,z1=_s,V1=U1,Cp=Object,G1=H1("".split),W1=z1(function(){return!Cp("z").propertyIsEnumerable(0)})?function(s){return V1(s)==="String"?G1(s,""):Cp(s)}:Cp,Kv=function(s){return s==null},q1=Kv,X1=TypeError,Zv=function(s){if(q1(s))throw new X1("Can't call method on "+s);return s},Y1=W1,K1=Zv,Vm=function(s){return Y1(K1(s))},Tp=typeof document=="object"&&document.all,ti=typeof Tp>"u"&&Tp!==void 0?function(s){return typeof s=="function"||s===Tp}:function(s){return typeof s=="function"},Z1=ti,Hh=function(s){return typeof s=="object"?s!==null:Z1(s)},Pp=Qn,J1=ti,Q1=function(s){return J1(s)?s:void 0},Jv=function(s,t){return arguments.length<2?Q1(Pp[s]):Pp[s]&&Pp[s][t]},tA=Hi,eA=tA({}.isPrototypeOf),nA=typeof navigator<"u"&&String(navigator.userAgent)||"",Qv=Qn,Rp=nA,E0=Qv.process,_0=Qv.Deno,x0=E0&&E0.versions||_0&&_0.version,S0=x0&&x0.v8,Sn,qu;S0&&(Sn=S0.split("."),qu=Sn[0]>0&&Sn[0]<4?1:+(Sn[0]+Sn[1]));!qu&&Rp&&(Sn=Rp.match(/Edge\/(\d+)/),(!Sn||Sn[1]>=74)&&(Sn=Rp.match(/Chrome\/(\d+)/),Sn&&(qu=+Sn[1])));var iA=qu,C0=iA,sA=_s,rA=Qn,oA=rA.String,ty=!!Object.getOwnPropertySymbols&&!sA(function(){var s=Symbol("symbol detection");return!oA(s)||!(Object(s)instanceof Symbol)||!Symbol.sham&&C0&&C0<41}),aA=ty,ey=aA&&!Symbol.sham&&typeof Symbol.iterator=="symbol",lA=Jv,cA=ti,hA=eA,uA=ey,dA=Object,ny=uA?function(s){return typeof s=="symbol"}:function(s){var t=lA("Symbol");return cA(t)&&hA(t.prototype,dA(s))},fA=String,pA=function(s){try{return fA(s)}catch{return"Object"}},gA=ti,mA=pA,vA=TypeError,iy=function(s){if(gA(s))return s;throw new vA(mA(s)+" is not a function")},yA=iy,bA=Kv,wA=function(s,t){var e=s[t];return bA(e)?void 0:yA(e)},Lp=zm,kp=ti,Ip=Hh,AA=TypeError,EA=function(s,t){var e,n;if(t==="string"&&kp(e=s.toString)&&!Ip(n=Lp(e,s))||kp(e=s.valueOf)&&!Ip(n=Lp(e,s))||t!=="string"&&kp(e=s.toString)&&!Ip(n=Lp(e,s)))return n;throw new AA("Can't convert object to primitive value")},sy={exports:{}},T0=Qn,_A=Object.defineProperty,Gm=function(s,t){try{_A(T0,s,{value:t,configurable:!0,writable:!0})}catch{T0[s]=t}return t},xA=Qn,SA=Gm,P0="__core-js_shared__",R0=sy.exports=xA[P0]||SA(P0,{});(R0.versions||(R0.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 Wm=sy.exports,L0=Wm,ry=function(s,t){return L0[s]||(L0[s]=t||{})},CA=Zv,TA=Object,PA=function(s){return TA(CA(s))},RA=Hi,LA=PA,kA=RA({}.hasOwnProperty),to=Object.hasOwn||function(t,e){return kA(LA(t),e)},IA=Hi,FA=0,MA=Math.random(),DA=IA(1 .toString),oy=function(s){return"Symbol("+(s===void 0?"":s)+")_"+DA(++FA+MA,36)},OA=Qn,NA=ry,k0=to,BA=oy,$A=ty,jA=ey,mo=OA.Symbol,Fp=NA("wks"),UA=jA?mo.for||mo:mo&&mo.withoutSetter||BA,HA=function(s){return k0(Fp,s)||(Fp[s]=$A&&k0(mo,s)?mo[s]:UA("Symbol."+s)),Fp[s]},zA=zm,I0=Hh,F0=ny,VA=wA,GA=EA,WA=HA,qA=TypeError,XA=WA("toPrimitive"),YA=function(s,t){if(!I0(s)||F0(s))return s;var e=VA(s,XA),n;if(e){if(t===void 0&&(t="default"),n=zA(e,s,t),!I0(n)||F0(n))return n;throw new qA("Can't convert object to primitive value")}return t===void 0&&(t="number"),GA(s,t)},KA=YA,ZA=ny,ay=function(s){var t=KA(s,"string");return ZA(t)?t:t+""},JA=Qn,M0=Hh,ig=JA.document,QA=M0(ig)&&M0(ig.createElement),tE=function(s){return QA?ig.createElement(s):{}},eE=Qr,nE=_s,iE=tE,ly=!eE&&!nE(function(){return Object.defineProperty(iE("div"),"a",{get:function(){return 7}}).a!==7}),sE=Qr,rE=zm,oE=zv,aE=Wv,lE=Vm,cE=ay,hE=to,uE=ly,D0=Object.getOwnPropertyDescriptor;Hm.f=sE?D0:function(t,e){if(t=lE(t),e=cE(e),uE)try{return D0(t,e)}catch{}if(hE(t,e))return aE(!rE(oE.f,t,e),t[e])};var Wf={},dE=Qr,fE=_s,pE=dE&&fE(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),gE=Hh,mE=String,vE=TypeError,cy=function(s){if(gE(s))return s;throw new vE(mE(s)+" is not an object")},yE=Qr,bE=ly,wE=pE,nu=cy,O0=ay,AE=TypeError,Mp=Object.defineProperty,EE=Object.getOwnPropertyDescriptor,Dp="enumerable",Op="configurable",Np="writable";Wf.f=yE?wE?function(t,e,n){if(nu(t),e=O0(e),nu(n),typeof t=="function"&&e==="prototype"&&"value"in n&&Np in n&&!n[Np]){var i=EE(t,e);i&&i[Np]&&(t[e]=n.value,n={configurable:Op in n?n[Op]:i[Op],enumerable:Dp in n?n[Dp]:i[Dp],writable:!1})}return Mp(t,e,n)}:Mp:function(t,e,n){if(nu(t),e=O0(e),nu(n),bE)try{return Mp(t,e,n)}catch{}if("get"in n||"set"in n)throw new AE("Accessors not supported");return"value"in n&&(t[e]=n.value),t};var _E=Qr,xE=Wf,SE=Wv,hy=_E?function(s,t,e){return xE.f(s,t,SE(1,e))}:function(s,t,e){return s[t]=e,s},uy={exports:{}},sg=Qr,CE=to,dy=Function.prototype,TE=sg&&Object.getOwnPropertyDescriptor,qm=CE(dy,"name"),PE=qm&&(function(){}).name==="something",RE=qm&&(!sg||sg&&TE(dy,"name").configurable),LE={EXISTS:qm,PROPER:PE,CONFIGURABLE:RE},kE=Hi,IE=ti,rg=Wm,FE=kE(Function.toString);IE(rg.inspectSource)||(rg.inspectSource=function(s){return FE(s)});var ME=rg.inspectSource,DE=Qn,OE=ti,N0=DE.WeakMap,NE=OE(N0)&&/native code/.test(String(N0)),BE=ry,$E=oy,B0=BE("keys"),jE=function(s){return B0[s]||(B0[s]=$E(s))},fy={},UE=NE,py=Qn,HE=Hh,zE=hy,Bp=to,$p=Wm,VE=jE,GE=fy,$0="Object already initialized",og=py.TypeError,WE=py.WeakMap,Xu,yl,Yu,qE=function(s){return Yu(s)?yl(s):Xu(s,{})},XE=function(s){return function(t){var e;if(!HE(t)||(e=yl(t)).type!==s)throw new og("Incompatible receiver, "+s+" required");return e}};if(UE||$p.state){var Tn=$p.state||($p.state=new WE);Tn.get=Tn.get,Tn.has=Tn.has,Tn.set=Tn.set,Xu=function(s,t){if(Tn.has(s))throw new og($0);return t.facade=s,Tn.set(s,t),t},yl=function(s){return Tn.get(s)||{}},Yu=function(s){return Tn.has(s)}}else{var ro=VE("state");GE[ro]=!0,Xu=function(s,t){if(Bp(s,ro))throw new og($0);return t.facade=s,zE(s,ro,t),t},yl=function(s){return Bp(s,ro)?s[ro]:{}},Yu=function(s){return Bp(s,ro)}}var YE={set:Xu,get:yl,has:Yu,enforce:qE,getterFor:XE},Xm=Hi,KE=_s,ZE=ti,iu=to,ag=Qr,JE=LE.CONFIGURABLE,QE=ME,gy=YE,t_=gy.enforce,e_=gy.get,j0=String,gu=Object.defineProperty,n_=Xm("".slice),i_=Xm("".replace),s_=Xm([].join),r_=ag&&!KE(function(){return gu(function(){},"length",{value:8}).length!==8}),o_=String(String).split("String"),a_=uy.exports=function(s,t,e){n_(j0(t),0,7)==="Symbol("&&(t="["+i_(j0(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!iu(s,"name")||JE&&s.name!==t)&&(ag?gu(s,"name",{value:t,configurable:!0}):s.name=t),r_&&e&&iu(e,"arity")&&s.length!==e.arity&&gu(s,"length",{value:e.arity});try{e&&iu(e,"constructor")&&e.constructor?ag&&gu(s,"prototype",{writable:!1}):s.prototype&&(s.prototype=void 0)}catch{}var n=t_(s);return iu(n,"source")||(n.source=s_(o_,typeof t=="string"?t:"")),s};Function.prototype.toString=a_(function(){return ZE(this)&&e_(this).source||QE(this)},"toString");var l_=uy.exports,c_=ti,h_=Wf,u_=l_,d_=Gm,f_=function(s,t,e,n){n||(n={});var i=n.enumerable,r=n.name!==void 0?n.name:t;if(c_(e)&&u_(e,r,n),n.global)i?s[t]=e:d_(t,e);else{try{n.unsafe?s[t]&&(i=!0):delete s[t]}catch{}i?s[t]=e:h_.f(s,t,{value:e,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return s},my={},p_=Math.ceil,g_=Math.floor,m_=Math.trunc||function(t){var e=+t;return(e>0?g_:p_)(e)},v_=m_,vy=function(s){var t=+s;return t!==t||t===0?0:v_(t)},y_=vy,b_=Math.max,w_=Math.min,A_=function(s,t){var e=y_(s);return e<0?b_(e+t,0):w_(e,t)},E_=vy,__=Math.min,x_=function(s){var t=E_(s);return t>0?__(t,9007199254740991):0},S_=x_,C_=function(s){return S_(s.length)},T_=Vm,P_=A_,R_=C_,U0=function(s){return function(t,e,n){var i=T_(t),r=R_(i);if(r===0)return!s&&-1;var o=P_(n,r),l;if(s&&e!==e){for(;r>o;)if(l=i[o++],l!==l)return!0}else for(;r>o;o++)if((s||o in i)&&i[o]===e)return s||o||0;return!s&&-1}},L_={includes:U0(!0),indexOf:U0(!1)},k_=Hi,jp=to,I_=Vm,F_=L_.indexOf,M_=fy,H0=k_([].push),D_=function(s,t){var e=I_(s),n=0,i=[],r;for(r in e)!jp(M_,r)&&jp(e,r)&&H0(i,r);for(;t.length>n;)jp(e,r=t[n++])&&(~F_(i,r)||H0(i,r));return i},O_=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],N_=D_,B_=O_,$_=B_.concat("length","prototype");my.f=Object.getOwnPropertyNames||function(t){return N_(t,$_)};var yy={};yy.f=Object.getOwnPropertySymbols;var j_=Jv,U_=Hi,H_=my,z_=yy,V_=cy,G_=U_([].concat),W_=j_("Reflect","ownKeys")||function(t){var e=H_.f(V_(t)),n=z_.f;return n?G_(e,n(t)):e},z0=to,q_=W_,X_=Hm,Y_=Wf,K_=function(s,t,e){for(var n=q_(t),i=Y_.f,r=X_.f,o=0;o<n.length;o++){var l=n[o];!z0(s,l)&&!(e&&z0(e,l))&&i(s,l,r(t,l))}},Z_=_s,J_=ti,Q_=/#|\.prototype\./,zh=function(s,t){var e=ex[tx(s)];return e===ix?!0:e===nx?!1:J_(t)?Z_(t):!!t},tx=zh.normalize=function(s){return String(s).replace(Q_,".").toLowerCase()},ex=zh.data={},nx=zh.NATIVE="N",ix=zh.POLYFILL="P",sx=zh,su=Qn,rx=Hm.f,ox=hy,ax=f_,lx=Gm,cx=K_,hx=sx,ux=function(s,t){var e=s.target,n=s.global,i=s.stat,r,o,l,c,u,h;if(n?o=su:i?o=su[e]||lx(e,{}):o=su[e]&&su[e].prototype,o)for(l in t){if(u=t[l],s.dontCallGetSet?(h=rx(o,l),c=h&&h.value):c=o[l],r=hx(n?l:e+(i?".":"#")+l,s.forced),!r&&c!==void 0){if(typeof u==typeof c)continue;cx(u,c)}(s.sham||c&&c.sham)&&ox(u,"sham",!0),ax(o,l,u,s)}},by={},V0=iy,dx=TypeError,fx=function(s){var t,e;this.promise=new s(function(n,i){if(t!==void 0||e!==void 0)throw new dx("Bad Promise constructor");t=n,e=i}),this.resolve=V0(t),this.reject=V0(e)};by.f=function(s){return new fx(s)};var px=ux,gx=by;px({target:"Promise",stat:!0},{withResolvers:function(){var t=gx.f(this);return{promise:t.promise,resolve:t.resolve,reject:t.reject}}});function mx(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var wy={exports:{}},Qt=wy.exports={},Rn,Ln;function lg(){throw new Error("setTimeout has not been defined")}function cg(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Rn=setTimeout:Rn=lg}catch{Rn=lg}try{typeof clearTimeout=="function"?Ln=clearTimeout:Ln=cg}catch{Ln=cg}})();function Ay(s){if(Rn===setTimeout)return setTimeout(s,0);if((Rn===lg||!Rn)&&setTimeout)return Rn=setTimeout,setTimeout(s,0);try{return Rn(s,0)}catch{try{return Rn.call(null,s,0)}catch{return Rn.call(this,s,0)}}}function vx(s){if(Ln===clearTimeout)return clearTimeout(s);if((Ln===cg||!Ln)&&clearTimeout)return Ln=clearTimeout,clearTimeout(s);try{return Ln(s)}catch{try{return Ln.call(null,s)}catch{return Ln.call(this,s)}}}var Oi=[],yo=!1,Ds,mu=-1;function yx(){!yo||!Ds||(yo=!1,Ds.length?Oi=Ds.concat(Oi):mu=-1,Oi.length&&Ey())}function Ey(){if(!yo){var s=Ay(yx);yo=!0;for(var t=Oi.length;t;){for(Ds=Oi,Oi=[];++mu<t;)Ds&&Ds[mu].run();mu=-1,t=Oi.length}Ds=null,yo=!1,vx(s)}}Qt.nextTick=function(s){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];Oi.push(new _y(s,t)),Oi.length===1&&!yo&&Ay(Ey)};function _y(s,t){this.fun=s,this.array=t}_y.prototype.run=function(){this.fun.apply(null,this.array)};Qt.title="browser";Qt.browser=!0;Qt.env={};Qt.argv=[];Qt.version="";Qt.versions={};function zi(){}Qt.on=zi;Qt.addListener=zi;Qt.once=zi;Qt.off=zi;Qt.removeListener=zi;Qt.removeAllListeners=zi;Qt.emit=zi;Qt.prependListener=zi;Qt.prependOnceListener=zi;Qt.listeners=function(s){return[]};Qt.binding=function(s){throw new Error("process.binding is not supported")};Qt.cwd=function(){return"/"};Qt.chdir=function(s){throw new Error("process.chdir is not supported")};Qt.umask=function(){return 0};var bx=wy.exports;const ct=mx(bx);var Te=function(){return Te=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;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 Wr(s,t,e){if(e||arguments.length===2)for(var n=0,i=t.length,r;n<i;n++)(r||!(n in t))&&(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return s.concat(r||Array.prototype.slice.call(t))}function wx(s){var t=Object.create(null);return function(e){return t[e]===void 0&&(t[e]=s(e)),t[e]}}var Ax=/^((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)-.*))$/,Ex=wx(function(s){return Ax.test(s)||s.charCodeAt(0)===111&&s.charCodeAt(1)===110&&s.charCodeAt(2)<91}),Ut="-ms-",pl="-moz-",Rt="-webkit-",xy="comm",qf="rule",Ym="decl",_x="@import",Sy="@keyframes",xx="@layer",Cy=Math.abs,Km=String.fromCharCode,hg=Object.assign;function Sx(s,t){return pe(s,0)^45?(((t<<2^pe(s,0))<<2^pe(s,1))<<2^pe(s,2))<<2^pe(s,3):0}function Ty(s){return s.trim()}function si(s,t){return(s=t.exec(s))?s[0]:s}function gt(s,t,e){return s.replace(t,e)}function vu(s,t,e){return s.indexOf(t,e)}function pe(s,t){return s.charCodeAt(t)|0}function $a(s,t,e){return s.slice(t,e)}function Kn(s){return s.length}function Py(s){return s.length}function Ja(s,t){return t.push(s),s}function Cx(s,t){return s.map(t).join("")}function G0(s,t){return s.filter(function(e){return!si(e,t)})}var Xf=1,ja=1,Ry=0,un=0,ee=0,Ga="";function Yf(s,t,e,n,i,r,o,l){return{value:s,root:t,parent:e,type:n,props:i,children:r,line:Xf,column:ja,length:o,return:"",siblings:l}}function Vi(s,t){return hg(Yf("",null,null,"",null,null,0,s.siblings),s,{length:-s.length},t)}function oo(s){for(;s.root;)s=Vi(s.root,{children:[s]});Ja(s,s.siblings)}function Tx(){return ee}function Px(){return ee=un>0?pe(Ga,--un):0,ja--,ee===10&&(ja=1,Xf--),ee}function Cn(){return ee=un<Ry?pe(Ga,un++):0,ja++,ee===10&&(ja=1,Xf++),ee}function Vr(){return pe(Ga,un)}function yu(){return un}function Kf(s,t){return $a(Ga,s,t)}function ug(s){switch(s){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 Rx(s){return Xf=ja=1,Ry=Kn(Ga=s),un=0,[]}function Lx(s){return Ga="",s}function Up(s){return Ty(Kf(un-1,dg(s===91?s+2:s===40?s+1:s)))}function kx(s){for(;(ee=Vr())&&ee<33;)Cn();return ug(s)>2||ug(ee)>3?"":" "}function Ix(s,t){for(;--t&&Cn()&&!(ee<48||ee>102||ee>57&&ee<65||ee>70&&ee<97););return Kf(s,yu()+(t<6&&Vr()==32&&Cn()==32))}function dg(s){for(;Cn();)switch(ee){case s:return un;case 34:case 39:s!==34&&s!==39&&dg(ee);break;case 40:s===41&&dg(s);break;case 92:Cn();break}return un}function Fx(s,t){for(;Cn()&&s+ee!==57;)if(s+ee===84&&Vr()===47)break;return"/*"+Kf(t,un-1)+"*"+Km(s===47?s:Cn())}function Mx(s){for(;!ug(Vr());)Cn();return Kf(s,un)}function Dx(s){return Lx(bu("",null,null,null,[""],s=Rx(s),0,[0],s))}function bu(s,t,e,n,i,r,o,l,c){for(var u=0,h=0,f=o,g=0,v=0,y=0,E=1,S=1,_=1,P=0,L="",k=i,F=r,I=n,M=L;S;)switch(y=P,P=Cn()){case 40:if(y!=108&&pe(M,f-1)==58){vu(M+=gt(Up(P),"&","&\f"),"&\f",Cy(u?l[u-1]:0))!=-1&&(_=-1);break}case 34:case 39:case 91:M+=Up(P);break;case 9:case 10:case 13:case 32:M+=kx(y);break;case 92:M+=Ix(yu()-1,7);continue;case 47:switch(Vr()){case 42:case 47:Ja(Ox(Fx(Cn(),yu()),t,e,c),c);break;default:M+="/"}break;case 123*E:l[u++]=Kn(M)*_;case 125*E:case 59:case 0:switch(P){case 0:case 125:S=0;case 59+h:_==-1&&(M=gt(M,/\f/g,"")),v>0&&Kn(M)-f&&Ja(v>32?q0(M+";",n,e,f-1,c):q0(gt(M," ","")+";",n,e,f-2,c),c);break;case 59:M+=";";default:if(Ja(I=W0(M,t,e,u,h,i,l,L,k=[],F=[],f,r),r),P===123)if(h===0)bu(M,t,I,I,k,r,f,l,F);else switch(g===99&&pe(M,3)===110?100:g){case 100:case 108:case 109:case 115:bu(s,I,I,n&&Ja(W0(s,I,I,0,0,i,l,L,i,k=[],f,F),F),i,F,f,l,n?k:F);break;default:bu(M,I,I,I,[""],F,0,l,F)}}u=h=v=0,E=_=1,L=M="",f=o;break;case 58:f=1+Kn(M),v=y;default:if(E<1){if(P==123)--E;else if(P==125&&E++==0&&Px()==125)continue}switch(M+=Km(P),P*E){case 38:_=h>0?1:(M+="\f",-1);break;case 44:l[u++]=(Kn(M)-1)*_,_=1;break;case 64:Vr()===45&&(M+=Up(Cn())),g=Vr(),h=f=Kn(L=M+=Mx(yu())),P++;break;case 45:y===45&&Kn(M)==2&&(E=0)}}return r}function W0(s,t,e,n,i,r,o,l,c,u,h,f){for(var g=i-1,v=i===0?r:[""],y=Py(v),E=0,S=0,_=0;E<n;++E)for(var P=0,L=$a(s,g+1,g=Cy(S=o[E])),k=s;P<y;++P)(k=Ty(S>0?v[P]+" "+L:gt(L,/&\f/g,v[P])))&&(c[_++]=k);return Yf(s,t,e,i===0?qf:l,c,u,h,f)}function Ox(s,t,e,n){return Yf(s,t,e,xy,Km(Tx()),$a(s,2,-2),0,n)}function q0(s,t,e,n,i){return Yf(s,t,e,Ym,$a(s,0,n),$a(s,n+1,-1),n,i)}function Ly(s,t,e){switch(Sx(s,t)){case 5103:return Rt+"print-"+s+s;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+s+s;case 4789:return pl+s+s;case 5349:case 4246:case 4810:case 6968:case 2756:return Rt+s+pl+s+Ut+s+s;case 5936:switch(pe(s,t+11)){case 114:return Rt+s+Ut+gt(s,/[svh]\w+-[tblr]{2}/,"tb")+s;case 108:return Rt+s+Ut+gt(s,/[svh]\w+-[tblr]{2}/,"tb-rl")+s;case 45:return Rt+s+Ut+gt(s,/[svh]\w+-[tblr]{2}/,"lr")+s}case 6828:case 4268:case 2903:return Rt+s+Ut+s+s;case 6165:return Rt+s+Ut+"flex-"+s+s;case 5187:return Rt+s+gt(s,/(\w+).+(:[^]+)/,Rt+"box-$1$2"+Ut+"flex-$1$2")+s;case 5443:return Rt+s+Ut+"flex-item-"+gt(s,/flex-|-self/g,"")+(si(s,/flex-|baseline/)?"":Ut+"grid-row-"+gt(s,/flex-|-self/g,""))+s;case 4675:return Rt+s+Ut+"flex-line-pack"+gt(s,/align-content|flex-|-self/g,"")+s;case 5548:return Rt+s+Ut+gt(s,"shrink","negative")+s;case 5292:return Rt+s+Ut+gt(s,"basis","preferred-size")+s;case 6060:return Rt+"box-"+gt(s,"-grow","")+Rt+s+Ut+gt(s,"grow","positive")+s;case 4554:return Rt+gt(s,/([^-])(transform)/g,"$1"+Rt+"$2")+s;case 6187:return gt(gt(gt(s,/(zoom-|grab)/,Rt+"$1"),/(image-set)/,Rt+"$1"),s,"")+s;case 5495:case 3959:return gt(s,/(image-set\([^]*)/,Rt+"$1$`$1");case 4968:return gt(gt(s,/(.+:)(flex-)?(.*)/,Rt+"box-pack:$3"+Ut+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Rt+s+s;case 4200:if(!si(s,/flex-|baseline/))return Ut+"grid-column-align"+$a(s,t)+s;break;case 2592:case 3360:return Ut+gt(s,"template-","")+s;case 4384:case 3616:return e&&e.some(function(n,i){return t=i,si(n.props,/grid-\w+-end/)})?~vu(s+(e=e[t].value),"span",0)?s:Ut+gt(s,"-start","")+s+Ut+"grid-row-span:"+(~vu(e,"span",0)?si(e,/\d+/):+si(e,/\d+/)-+si(s,/\d+/))+";":Ut+gt(s,"-start","")+s;case 4896:case 4128:return e&&e.some(function(n){return si(n.props,/grid-\w+-start/)})?s:Ut+gt(gt(s,"-end","-span"),"span ","")+s;case 4095:case 3583:case 4068:case 2532:return gt(s,/(.+)-inline(.+)/,Rt+"$1$2")+s;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(Kn(s)-1-t>6)switch(pe(s,t+1)){case 109:if(pe(s,t+4)!==45)break;case 102:return gt(s,/(.+:)(.+)-([^]+)/,"$1"+Rt+"$2-$3$1"+pl+(pe(s,t+3)==108?"$3":"$2-$3"))+s;case 115:return~vu(s,"stretch",0)?Ly(gt(s,"stretch","fill-available"),t,e)+s:s}break;case 5152:case 5920:return gt(s,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(n,i,r,o,l,c,u){return Ut+i+":"+r+u+(o?Ut+i+"-span:"+(l?c:+c-+r)+u:"")+s});case 4949:if(pe(s,t+6)===121)return gt(s,":",":"+Rt)+s;break;case 6444:switch(pe(s,pe(s,14)===45?18:11)){case 120:return gt(s,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Rt+(pe(s,14)===45?"inline-":"")+"box$3$1"+Rt+"$2$3$1"+Ut+"$2box$3")+s;case 100:return gt(s,":",":"+Ut)+s}break;case 5719:case 2647:case 2135:case 3927:case 2391:return gt(s,"scroll-","scroll-snap-")+s}return s}function Ku(s,t){for(var e="",n=0;n<s.length;n++)e+=t(s[n],n,s,t)||"";return e}function Nx(s,t,e,n){switch(s.type){case xx:if(s.children.length)break;case _x:case Ym:return s.return=s.return||s.value;case xy:return"";case Sy:return s.return=s.value+"{"+Ku(s.children,n)+"}";case qf:if(!Kn(s.value=s.props.join(",")))return""}return Kn(e=Ku(s.children,n))?s.return=s.value+"{"+e+"}":""}function Bx(s){var t=Py(s);return function(e,n,i,r){for(var o="",l=0;l<t;l++)o+=s[l](e,n,i,r)||"";return o}}function $x(s){return function(t){t.root||(t=t.return)&&s(t)}}function jx(s,t,e,n){if(s.length>-1&&!s.return)switch(s.type){case Ym:s.return=Ly(s.value,s.length,e);return;case Sy:return Ku([Vi(s,{value:gt(s.value,"@","@"+Rt)})],n);case qf:if(s.length)return Cx(e=s.props,function(i){switch(si(i,n=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":oo(Vi(s,{props:[gt(i,/:(read-\w+)/,":"+pl+"$1")]})),oo(Vi(s,{props:[i]})),hg(s,{props:G0(e,n)});break;case"::placeholder":oo(Vi(s,{props:[gt(i,/:(plac\w+)/,":"+Rt+"input-$1")]})),oo(Vi(s,{props:[gt(i,/:(plac\w+)/,":"+pl+"$1")]})),oo(Vi(s,{props:[gt(i,/:(plac\w+)/,Ut+"input-$1")]})),oo(Vi(s,{props:[i]})),hg(s,{props:G0(e,n)});break}return""})}}var Ux={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},qr=typeof ct<"u"&&ct.env!==void 0&&(ct.env.REACT_APP_SC_ATTR||ct.env.SC_ATTR)||"data-styled",ky="active",Iy="data-styled-version",Zf="6.1.11",Zm=`/*!sc*/
`,Jm=typeof window<"u"&&"HTMLElement"in window,Hx=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof ct<"u"&&ct.env!==void 0&&ct.env.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&ct.env.REACT_APP_SC_DISABLE_SPEEDY!==""?ct.env.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&ct.env.REACT_APP_SC_DISABLE_SPEEDY:typeof ct<"u"&&ct.env!==void 0&&ct.env.SC_DISABLE_SPEEDY!==void 0&&ct.env.SC_DISABLE_SPEEDY!==""?ct.env.SC_DISABLE_SPEEDY!=="false"&&ct.env.SC_DISABLE_SPEEDY:ct.env.NODE_ENV!=="production"),X0=/invalid hook call/i,ru=new Set,zx=function(s,t){if(ct.env.NODE_ENV!=="production"){var e=t?' with the id of "'.concat(t,'"'):"",n="The component ".concat(s).concat(e,` has been created dynamically.
`)+`You may see this warning because you've called styled inside another component.
To resolve this only create new StyledComponents outside of any render method and function component.`,i=console.error;try{var r=!0;console.error=function(o){for(var l=[],c=1;c<arguments.length;c++)l[c-1]=arguments[c];X0.test(o)?(r=!1,ru.delete(n)):i.apply(void 0,Wr([o],l,!1))},U.useRef(),r&&!ru.has(n)&&(console.warn(n),ru.add(n))}catch(o){X0.test(o.message)&&ru.delete(n)}finally{console.error=i}}},Jf=Object.freeze([]),Ua=Object.freeze({});function Vx(s,t,e){return e===void 0&&(e=Ua),s.theme!==e.theme&&s.theme||t||e.theme}var fg=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"]),Gx=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,Wx=/(^-|-$)/g;function Y0(s){return s.replace(Gx,"-").replace(Wx,"")}var qx=/(a)(d)/gi,ou=52,K0=function(s){return String.fromCharCode(s+(s>25?39:97))};function pg(s){var t,e="";for(t=Math.abs(s);t>ou;t=t/ou|0)e=K0(t%ou)+e;return(K0(t%ou)+e).replace(qx,"$1-$2")}var Hp,Fy=5381,Is=function(s,t){for(var e=t.length;e;)s=33*s^t.charCodeAt(--e);return s},My=function(s){return Is(Fy,s)};function Dy(s){return pg(My(s)>>>0)}function Oy(s){return ct.env.NODE_ENV!=="production"&&typeof s=="string"&&s||s.displayName||s.name||"Component"}function zp(s){return typeof s=="string"&&(ct.env.NODE_ENV==="production"||s.charAt(0)===s.charAt(0).toLowerCase())}var Ny=typeof Symbol=="function"&&Symbol.for,By=Ny?Symbol.for("react.memo"):60115,Xx=Ny?Symbol.for("react.forward_ref"):60112,Yx={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Kx={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},$y={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Zx=((Hp={})[Xx]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Hp[By]=$y,Hp);function Z0(s){return("type"in(t=s)&&t.type.$$typeof)===By?$y:"$$typeof"in s?Zx[s.$$typeof]:Yx;var t}var Jx=Object.defineProperty,Qx=Object.getOwnPropertyNames,J0=Object.getOwnPropertySymbols,tS=Object.getOwnPropertyDescriptor,eS=Object.getPrototypeOf,Q0=Object.prototype;function jy(s,t,e){if(typeof t!="string"){if(Q0){var n=eS(t);n&&n!==Q0&&jy(s,n,e)}var i=Qx(t);J0&&(i=i.concat(J0(t)));for(var r=Z0(s),o=Z0(t),l=0;l<i.length;++l){var c=i[l];if(!(c in Kx||e&&e[c]||o&&c in o||r&&c in r)){var u=tS(t,c);try{Jx(s,c,u)}catch{}}}}return s}function Xr(s){return typeof s=="function"}function Qm(s){return typeof s=="object"&&"styledComponentId"in s}function Os(s,t){return s&&t?"".concat(s," ").concat(t):s||t||""}function gg(s,t){if(s.length===0)return"";for(var e=s[0],n=1;n<s.length;n++)e+=s[n];return e}function Ha(s){return s!==null&&typeof s=="object"&&s.constructor.name===Object.name&&!("props"in s&&s.$$typeof)}function mg(s,t,e){if(e===void 0&&(e=!1),!e&&!Ha(s)&&!Array.isArray(s))return t;if(Array.isArray(t))for(var n=0;n<t.length;n++)s[n]=mg(s[n],t[n]);else if(Ha(t))for(var n in t)s[n]=mg(s[n],t[n]);return s}function t0(s,t){Object.defineProperty(s,"toString",{value:t})}var nS=ct.env.NODE_ENV!=="production"?{1:`Cannot create styled-component for component: %s.

`,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.

- Are you trying to reuse it across renders?
- Are you accidentally calling collectStyles twice?

`,3:`Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.

`,4:`The \`StyleSheetManager\` expects a valid target or sheet prop!

- Does this error occur on the client and is your target falsy?
- Does this error occur on the server and is the sheet falsy?

`,5:`The clone method cannot be used on the client!

- Are you running in a client-like environment on the server?
- Are you trying to run SSR on the client?

`,6:`Trying to insert a new style tag, but the given Node is unmounted!

- Are you using a custom target that isn't mounted?
- Does your document not have a valid head element?
- Have you accidentally removed a style tag manually?

`,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.

`,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

`,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.

`,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.

`,14:`ThemeProvider: "theme" prop is required.

`,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.
You may only create up to 1,073,741,824 components. If you're creating components dynamically,
as for instance in your render method then you may be running into this limitation.

`,17:`CSSStyleSheet could not be found on HTMLStyleElement.
Has styled-components' style tag been unmounted or altered by another script?
`,18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function iS(){for(var s=[],t=0;t<arguments.length;t++)s[t]=arguments[t];for(var e=s[0],n=[],i=1,r=s.length;i<r;i+=1)n.push(s[i]);return n.forEach(function(o){e=e.replace(/%[a-z]/,o)}),e}function Bi(s){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return ct.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(s," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):"")):new Error(iS.apply(void 0,Wr([nS[s]],t,!1)).trim())}var sS=function(){function s(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return s.prototype.indexOfGroup=function(t){for(var e=0,n=0;n<t;n++)e+=this.groupSizes[n];return e},s.prototype.insertRules=function(t,e){if(t>=this.groupSizes.length){for(var n=this.groupSizes,i=n.length,r=i;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=i;o<r;o++)this.groupSizes[o]=0}for(var l=this.indexOfGroup(t+1),c=(o=0,e.length);o<c;o++)this.tag.insertRule(l,e[o])&&(this.groupSizes[t]++,l++)},s.prototype.clearGroup=function(t){if(t<this.length){var e=this.groupSizes[t],n=this.indexOfGroup(t),i=n+e;this.groupSizes[t]=0;for(var r=n;r<i;r++)this.tag.deleteRule(n)}},s.prototype.getGroup=function(t){var e="";if(t>=this.length||this.groupSizes[t]===0)return e;for(var n=this.groupSizes[t],i=this.indexOfGroup(t),r=i+n,o=i;o<r;o++)e+="".concat(this.tag.getRule(o)).concat(Zm);return e},s}(),rS=1<<30,wu=new Map,Zu=new Map,Au=1,au=function(s){if(wu.has(s))return wu.get(s);for(;Zu.has(Au);)Au++;var t=Au++;if(ct.env.NODE_ENV!=="production"&&((0|t)<0||t>rS))throw Bi(16,"".concat(t));return wu.set(s,t),Zu.set(t,s),t},oS=function(s,t){Au=t+1,wu.set(s,t),Zu.set(t,s)},aS="style[".concat(qr,"][").concat(Iy,'="').concat(Zf,'"]'),lS=new RegExp("^".concat(qr,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),cS=function(s,t,e){for(var n,i=e.split(","),r=0,o=i.length;r<o;r++)(n=i[r])&&s.registerName(t,n)},hS=function(s,t){for(var e,n=((e=t.textContent)!==null&&e!==void 0?e:"").split(Zm),i=[],r=0,o=n.length;r<o;r++){var l=n[r].trim();if(l){var c=l.match(lS);if(c){var u=0|parseInt(c[1],10),h=c[2];u!==0&&(oS(h,u),cS(s,h,c[3]),s.getTag().insertRules(u,i)),i.length=0}else i.push(l)}}};function uS(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var Uy=function(s){var t=document.head,e=s||t,n=document.createElement("style"),i=function(l){var c=Array.from(l.querySelectorAll("style[".concat(qr,"]")));return c[c.length-1]}(e),r=i!==void 0?i.nextSibling:null;n.setAttribute(qr,ky),n.setAttribute(Iy,Zf);var o=uS();return o&&n.setAttribute("nonce",o),e.insertBefore(n,r),n},dS=function(){function s(t){this.element=Uy(t),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var n=document.styleSheets,i=0,r=n.length;i<r;i++){var o=n[i];if(o.ownerNode===e)return o}throw Bi(17)}(this.element),this.length=0}return s.prototype.insertRule=function(t,e){try{return this.sheet.insertRule(e,t),this.length++,!0}catch{return!1}},s.prototype.deleteRule=function(t){this.sheet.deleteRule(t),this.length--},s.prototype.getRule=function(t){var e=this.sheet.cssRules[t];return e&&e.cssText?e.cssText:""},s}(),fS=function(){function s(t){this.element=Uy(t),this.nodes=this.element.childNodes,this.length=0}return s.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},s.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},s.prototype.getRule=function(t){return t<this.length?this.nodes[t].textContent:""},s}(),pS=function(){function s(t){this.rules=[],this.length=0}return s.prototype.insertRule=function(t,e){return t<=this.length&&(this.rules.splice(t,0,e),this.length++,!0)},s.prototype.deleteRule=function(t){this.rules.splice(t,1),this.length--},s.prototype.getRule=function(t){return t<this.length?this.rules[t]:""},s}(),tv=Jm,gS={isServer:!Jm,useCSSOMInjection:!Hx},Hy=function(){function s(t,e,n){t===void 0&&(t=Ua),e===void 0&&(e={});var i=this;this.options=Te(Te({},gS),t),this.gs=e,this.names=new Map(n),this.server=!!t.isServer,!this.server&&Jm&&tv&&(tv=!1,function(r){for(var o=document.querySelectorAll(aS),l=0,c=o.length;l<c;l++){var u=o[l];u&&u.getAttribute(qr)!==ky&&(hS(r,u),u.parentNode&&u.parentNode.removeChild(u))}}(this)),t0(this,function(){return function(r){for(var o=r.getTag(),l=o.length,c="",u=function(f){var g=function(_){return Zu.get(_)}(f);if(g===void 0)return"continue";var v=r.names.get(g),y=o.getGroup(f);if(v===void 0||y.length===0)return"continue";var E="".concat(qr,".g").concat(f,'[id="').concat(g,'"]'),S="";v!==void 0&&v.forEach(function(_){_.length>0&&(S+="".concat(_,","))}),c+="".concat(y).concat(E,'{content:"').concat(S,'"}').concat(Zm)},h=0;h<l;h++)u(h);return c}(i)})}return s.registerId=function(t){return au(t)},s.prototype.reconstructWithOptions=function(t,e){return e===void 0&&(e=!0),new s(Te(Te({},this.options),t),this.gs,e&&this.names||void 0)},s.prototype.allocateGSInstance=function(t){return this.gs[t]=(this.gs[t]||0)+1},s.prototype.getTag=function(){return this.tag||(this.tag=(t=function(e){var n=e.useCSSOMInjection,i=e.target;return e.isServer?new pS(i):n?new dS(i):new fS(i)}(this.options),new sS(t)));var t},s.prototype.hasNameForId=function(t,e){return this.names.has(t)&&this.names.get(t).has(e)},s.prototype.registerName=function(t,e){if(au(t),this.names.has(t))this.names.get(t).add(e);else{var n=new Set;n.add(e),this.names.set(t,n)}},s.prototype.insertRules=function(t,e,n){this.registerName(t,e),this.getTag().insertRules(au(t),n)},s.prototype.clearNames=function(t){this.names.has(t)&&this.names.get(t).clear()},s.prototype.clearRules=function(t){this.getTag().clearGroup(au(t)),this.clearNames(t)},s.prototype.clearTag=function(){this.tag=void 0},s}(),mS=/&/g,vS=/^\s*\/\/.*$/gm;function zy(s,t){return s.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=zy(e.children,t)),e})}function yS(s){var t,e,n,i=Ua,r=i.options,o=r===void 0?Ua:r,l=i.plugins,c=l===void 0?Jf:l,u=function(g,v,y){return y.startsWith(e)&&y.endsWith(e)&&y.replaceAll(e,"").length>0?".".concat(t):g},h=c.slice();h.push(function(g){g.type===qf&&g.value.includes("&")&&(g.props[0]=g.props[0].replace(mS,e).replace(n,u))}),o.prefix&&h.push(jx),h.push(Nx);var f=function(g,v,y,E){v===void 0&&(v=""),y===void 0&&(y=""),E===void 0&&(E="&"),t=E,e=v,n=new RegExp("\\".concat(e,"\\b"),"g");var S=g.replace(vS,""),_=Dx(y||v?"".concat(y," ").concat(v," { ").concat(S," }"):S);o.namespace&&(_=zy(_,o.namespace));var P=[];return Ku(_,Bx(h.concat($x(function(L){return P.push(L)})))),P};return f.hash=c.length?c.reduce(function(g,v){return v.name||Bi(15),Is(g,v.name)},Fy).toString():"",f}var bS=new Hy,vg=yS(),Vy=U.createContext({shouldForwardProp:void 0,styleSheet:bS,stylis:vg});Vy.Consumer;U.createContext(void 0);function ev(){return U.useContext(Vy)}var yg=function(){function s(t,e){var n=this;this.inject=function(i,r){r===void 0&&(r=vg);var o=n.name+r.hash;i.hasNameForId(n.id,o)||i.insertRules(n.id,o,r(n.rules,o,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=e,t0(this,function(){throw Bi(12,String(n.name))})}return s.prototype.getName=function(t){return t===void 0&&(t=vg),this.name+t.hash},s}(),wS=function(s){return s>="A"&&s<="Z"};function nv(s){for(var t="",e=0;e<s.length;e++){var n=s[e];if(e===1&&n==="-"&&s[0]==="-")return s;wS(n)?t+="-"+n.toLowerCase():t+=n}return t.startsWith("ms-")?"-"+t:t}var Gy=function(s){return s==null||s===!1||s===""},Wy=function(s){var t,e,n=[];for(var i in s){var r=s[i];s.hasOwnProperty(i)&&!Gy(r)&&(Array.isArray(r)&&r.isCss||Xr(r)?n.push("".concat(nv(i),":"),r,";"):Ha(r)?n.push.apply(n,Wr(Wr(["".concat(i," {")],Wy(r),!1),["}"],!1)):n.push("".concat(nv(i),": ").concat((t=i,(e=r)==null||typeof e=="boolean"||e===""?"":typeof e!="number"||e===0||t in Ux||t.startsWith("--")?String(e).trim():"".concat(e,"px")),";")))}return n};function Gr(s,t,e,n){if(Gy(s))return[];if(Qm(s))return[".".concat(s.styledComponentId)];if(Xr(s)){if(!Xr(r=s)||r.prototype&&r.prototype.isReactComponent||!t)return[s];var i=s(t);return ct.env.NODE_ENV==="production"||typeof i!="object"||Array.isArray(i)||i instanceof yg||Ha(i)||i===null||console.error("".concat(Oy(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.")),Gr(i,t,e,n)}var r;return s instanceof yg?e?(s.inject(e,n),[s.getName(n)]):[s]:Ha(s)?Wy(s):Array.isArray(s)?Array.prototype.concat.apply(Jf,s.map(function(o){return Gr(o,t,e,n)})):[s.toString()]}function AS(s){for(var t=0;t<s.length;t+=1){var e=s[t];if(Xr(e)&&!Qm(e))return!1}return!0}var ES=My(Zf),_S=function(){function s(t,e,n){this.rules=t,this.staticRulesId="",this.isStatic=ct.env.NODE_ENV==="production"&&(n===void 0||n.isStatic)&&AS(t),this.componentId=e,this.baseHash=Is(ES,e),this.baseStyle=n,Hy.registerId(e)}return s.prototype.generateAndInjectStyles=function(t,e,n){var i=this.baseStyle?this.baseStyle.generateAndInjectStyles(t,e,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&e.hasNameForId(this.componentId,this.staticRulesId))i=Os(i,this.staticRulesId);else{var r=gg(Gr(this.rules,t,e,n)),o=pg(Is(this.baseHash,r)>>>0);if(!e.hasNameForId(this.componentId,o)){var l=n(r,".".concat(o),void 0,this.componentId);e.insertRules(this.componentId,o,l)}i=Os(i,o),this.staticRulesId=o}else{for(var c=Is(this.baseHash,n.hash),u="",h=0;h<this.rules.length;h++){var f=this.rules[h];if(typeof f=="string")u+=f,ct.env.NODE_ENV!=="production"&&(c=Is(c,f));else if(f){var g=gg(Gr(f,t,e,n));c=Is(c,g+h),u+=g}}if(u){var v=pg(c>>>0);e.hasNameForId(this.componentId,v)||e.insertRules(this.componentId,v,n(u,".".concat(v),void 0,this.componentId)),i=Os(i,v)}}return i},s}(),Ju=U.createContext(void 0);Ju.Consumer;function xS(s){var t=U.useContext(Ju),e=U.useMemo(function(){return function(n,i){if(!n)throw Bi(14);if(Xr(n)){var r=n(i);if(ct.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 i?Te(Te({},i),n):n}(s.theme,t)},[s.theme,t]);return s.children?U.createElement(Ju.Provider,{value:e},s.children):null}var Vp={},iv=new Set;function SS(s,t,e){var n=Qm(s),i=s,r=!zp(s),o=t.attrs,l=o===void 0?Jf:o,c=t.componentId,u=c===void 0?function(k,F){var I=typeof k!="string"?"sc":Y0(k);Vp[I]=(Vp[I]||0)+1;var M="".concat(I,"-").concat(Dy(Zf+I+Vp[I]));return F?"".concat(F,"-").concat(M):M}(t.displayName,t.parentComponentId):c,h=t.displayName,f=h===void 0?function(k){return zp(k)?"styled.".concat(k):"Styled(".concat(Oy(k),")")}(s):h,g=t.displayName&&t.componentId?"".concat(Y0(t.displayName),"-").concat(t.componentId):t.componentId||u,v=n&&i.attrs?i.attrs.concat(l).filter(Boolean):l,y=t.shouldForwardProp;if(n&&i.shouldForwardProp){var E=i.shouldForwardProp;if(t.shouldForwardProp){var S=t.shouldForwardProp;y=function(k,F){return E(k,F)&&S(k,F)}}else y=E}var _=new _S(e,g,n?i.componentStyle:void 0);function P(k,F){return function(I,M,C){var T=I.attrs,N=I.componentStyle,D=I.defaultProps,H=I.foldedComponentIds,z=I.styledComponentId,G=I.target,K=U.useContext(Ju),J=ev(),$=I.shouldForwardProp||J.shouldForwardProp;ct.env.NODE_ENV!=="production"&&U.useDebugValue(z);var W=Vx(M,K,D)||Ua,q=function(nt,ht,Z){for(var mt,X=Te(Te({},ht),{className:void 0,theme:Z}),Q=0;Q<nt.length;Q+=1){var ut=Xr(mt=nt[Q])?mt(X):mt;for(var pt in ut)X[pt]=pt==="className"?Os(X[pt],ut[pt]):pt==="style"?Te(Te({},X[pt]),ut[pt]):ut[pt]}return ht.className&&(X.className=Os(X.className,ht.className)),X}(T,M,W),wt=q.as||G,ft={};for(var V in q)q[V]===void 0||V[0]==="$"||V==="as"||V==="theme"&&q.theme===W||(V==="forwardedAs"?ft.as=q.forwardedAs:$&&!$(V,wt)||(ft[V]=q[V],$||ct.env.NODE_ENV!=="development"||Ex(V)||iv.has(V)||!fg.has(wt)||(iv.add(V),console.warn('styled-components: it looks like an unknown prop "'.concat(V,'" 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 it=function(nt,ht){var Z=ev(),mt=nt.generateAndInjectStyles(ht,Z.styleSheet,Z.stylis);return ct.env.NODE_ENV!=="production"&&U.useDebugValue(mt),mt}(N,q);ct.env.NODE_ENV!=="production"&&I.warnTooManyClasses&&I.warnTooManyClasses(it);var et=Os(H,z);return it&&(et+=" "+it),q.className&&(et+=" "+q.className),ft[zp(wt)&&!fg.has(wt)?"class":"className"]=et,ft.ref=C,U.createElement(wt,ft)}(L,k,F)}P.displayName=f;var L=U.forwardRef(P);return L.attrs=v,L.componentStyle=_,L.displayName=f,L.shouldForwardProp=y,L.foldedComponentIds=n?Os(i.foldedComponentIds,i.styledComponentId):"",L.styledComponentId=g,L.target=n?i.target:s,Object.defineProperty(L,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(k){this._foldedDefaultProps=n?function(F){for(var I=[],M=1;M<arguments.length;M++)I[M-1]=arguments[M];for(var C=0,T=I;C<T.length;C++)mg(F,T[C],!0);return F}({},i.defaultProps,k):k}}),ct.env.NODE_ENV!=="production"&&(zx(f,g),L.warnTooManyClasses=function(k,F){var I={},M=!1;return function(C){if(!M&&(I[C]=!0,Object.keys(I).length>=200)){var T=F?' with the id of "'.concat(F,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(k).concat(T,`.
`)+`Consider using the attrs method, together with a style object for frequently changed styles.
Example:
  const Component = styled.div.attrs(props => ({
    style: {
      background: props.background,
    },
  }))\`width: 100%;\`

  <Component />`),M=!0,I={}}}}(f,g)),t0(L,function(){return".".concat(L.styledComponentId)}),r&&jy(L,s,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),L}function sv(s,t){for(var e=[s[0]],n=0,i=t.length;n<i;n+=1)e.push(t[n],s[n+1]);return e}var rv=function(s){return Object.assign(s,{isCss:!0})};function Qf(s){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];if(Xr(s)||Ha(s))return rv(Gr(sv(Jf,Wr([s],t,!0))));var n=s;return t.length===0&&n.length===1&&typeof n[0]=="string"?Gr(n):rv(Gr(sv(n,t)))}function bg(s,t,e){if(e===void 0&&(e=Ua),!t)throw Bi(1,t);var n=function(i){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];return s(t,e,Qf.apply(void 0,Wr([i],r,!1)))};return n.attrs=function(i){return bg(s,t,Te(Te({},e),{attrs:Array.prototype.concat(e.attrs,i).filter(Boolean)}))},n.withConfig=function(i){return bg(s,t,Te(Te({},e),i))},n}var qy=function(s){return bg(SS,s)},bt=qy;fg.forEach(function(s){bt[s]=qy(s)});function CS(s){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];ct.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=gg(Qf.apply(void 0,Wr([s],t,!1))),i=Dy(n);return new yg(i,n)}ct.env.NODE_ENV!=="production"&&typeof navigator<"u"&&navigator.product==="ReactNative"&&console.warn(`It looks like you've imported 'styled-components' on React Native.
Perhaps you're looking to import 'styled-components/native'?
Read more about this at https://www.styled-components.com/docs/basics#react-native`);var lu="__sc-".concat(qr,"__");ct.env.NODE_ENV!=="production"&&ct.env.NODE_ENV!=="test"&&typeof window<"u"&&(window[lu]||(window[lu]=0),window[lu]===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.

See https://s-c.sh/2BAXzed for more info.`),window[lu]+=1);const TS="Document {{ currentFileNo }} of {{ allFilesCount }}",PS="No renderer for file type: {{{ fileType }}}",RS="Download file",LS="Your file is broken. Please check it on your machine.",kS="Recipients",IS="Sender",FS="Loading...",MS="Page {{ currentPage }}/{{ allPagesCount }}",DS={documentNavInfo:TS,noRendererMessage:PS,downloadButtonLabel:RS,brokenFile:LS,msgPluginRecipients:kS,msgPluginSender:IS,pdfPluginLoading:FS,pdfPluginPageNumber:MS},OS="Dokument {{ currentFileNo }} z {{ allFilesCount }}",NS="Brak funckji renderującej dla: {{{ fileType }}}",BS="Pobierz plik",$S="Twój plik jest uszkodzony. Sprawdź go na swoim komputerze.",jS="Odbiorcy",US="Nadawca",HS="Wczytywanie...",zS="Strona {{ currentPage }}/{{ allPagesCount }}",VS={documentNavInfo:OS,noRendererMessage:NS,downloadButtonLabel:BS,brokenFile:$S,msgPluginRecipients:jS,msgPluginSender:US,pdfPluginLoading:HS,pdfPluginPageNumber:zS},GS="Documento {{ currentFileNo }} de {{ allFilesCount }}",WS="No hay procesador para el tipo de archivo: {{{ fileType }}}",qS="Descargar archivo",XS="Tu archivo está roto. Compruébalo en tu máquina.",YS="Destinatarios",KS="Remitente",ZS="Cargando...",JS="Página {{ currentPage }}/{{ allPagesCount }}",QS={documentNavInfo:GS,noRendererMessage:WS,downloadButtonLabel:qS,brokenFile:XS,msgPluginRecipients:YS,msgPluginSender:KS,pdfPluginLoading:ZS,pdfPluginPageNumber:JS},tC="Dokument {{ currentFileNo }} von {{ allFilesCount }}",eC="Kein Renderer für Dateityp: {{{ fileType }}}",nC="Datei herunterladen",iC="Ihre Datei ist defekt. Bitte überprüfen Sie sie auf Ihrem Rechner.",sC="Empfänger",rC="Absender",oC="Wird geladen...",aC="Seite {{ currentPage }}/{{ allPagesCount }}",lC={documentNavInfo:tC,noRendererMessage:eC,downloadButtonLabel:nC,brokenFile:iC,msgPluginRecipients:sC,msgPluginSender:rC,pdfPluginLoading:oC,pdfPluginPageNumber:aC},cC="Documento {{ currentFileNo }} di {{ allFilesCount }}",hC="Nessun renderer per il tipo di file: {{{ fileType }}}",uC="Scarica file",dC="Il tuo file è danneggiato. Controllalo sul tuo computer.",fC="Destinatari",pC="Mittente",gC="Caricamento in corso...",mC="Pagina {{ currentPage }}/{{ allPagesCount }}",vC={documentNavInfo:cC,noRendererMessage:hC,downloadButtonLabel:uC,brokenFile:dC,msgPluginRecipients:fC,msgPluginSender:pC,pdfPluginLoading:gC,pdfPluginPageNumber:mC},yC="Documento {{ currentFileNo }} de {{ allFilesCount }}",bC="Nenhum renderizador para o tipo de arquivo: {{{ fileType }}}",wC="Baixar arquivo",AC="Seu arquivo está quebrado. Por favor, verifique-o em sua máquina.",EC="Destinatários",_C="Remetente",xC="Carregando...",SC="Página {{ currentPage }}/{{ allPagesCount }}",CC={documentNavInfo:yC,noRendererMessage:bC,downloadButtonLabel:wC,brokenFile:AC,msgPluginRecipients:EC,msgPluginSender:_C,pdfPluginLoading:xC,pdfPluginPageNumber:SC},TC="Document {{ currentFileNo }} de {{ allFilesCount }}",PC="Aucun moteur de rendu pour le type de fichier : {{{ fileType }}}",RC="Télécharger le fichier",LC="Votre fichier est cassé. Veuillez le vérifier sur votre machine.",kC="Destinataires",IC="Expéditeur",FC="Chargement...",MC="Page {{ currentPage }}/{{ allPagesCount }}",DC={documentNavInfo:TC,noRendererMessage:PC,downloadButtonLabel:RC,brokenFile:LC,msgPluginRecipients:kC,msgPluginSender:IC,pdfPluginLoading:FC,pdfPluginPageNumber:MC},OC="مستند {{ currentFileNo }} من {{ allFilesCount }}",NC="{{{ fileType }}} : لا يمكننا عرض هذا النوع من الملفات",BC="تحميل الملف",$C="الملف تالف، يرجى التحقق منه على جهازك الخاص.",jC="المستلمين",UC="المرسل",HC="تحميل ...",zC=" {{ allPagesCount }} \\ {{ currentPage }} صفحة ",VC={documentNavInfo:OC,noRendererMessage:NC,downloadButtonLabel:BC,brokenFile:$C,msgPluginRecipients:jC,msgPluginSender:UC,pdfPluginLoading:HC,pdfPluginPageNumber:zC},GC="Dokument {{ currentFileNo }} od {{ allFilesCount }}",WC="Ne postoji pregledač za tip fajla: {{ fileType }}",qC="Preuzimanje fajla",XC="Vaš fajl nije dobar. Molimo Vas da probate da ga otvorite na vašem računaru.",YC="Primaoci",KC="Pošiljalac",ZC="Učitavanje...",JC="Strana {{ currentPage }}/{{ allPagesCount }}",QC={documentNavInfo:GC,noRendererMessage:WC,downloadButtonLabel:qC,brokenFile:XC,msgPluginRecipients:YC,msgPluginSender:KC,pdfPluginLoading:ZC,pdfPluginPageNumber:JC},tT="Документ {{ currentFileNo }} od {{ allFilesCount }}",eT="Не постоји прегледач за тип фајла: {{ fileType }}",nT="Преузимање фајла",iT="Ваш фајл није добар. Молимо Вас да пробате да га отворите на вашем рачунару.",sT="Примаоци",rT="Пошиљалац",oT="Учитавање...",aT="Страна {{ currentPage }}/{{ allPagesCount }}",lT={documentNavInfo:tT,noRendererMessage:eT,downloadButtonLabel:nT,brokenFile:iT,msgPluginRecipients:sT,msgPluginSender:rT,pdfPluginLoading:oT,pdfPluginPageNumber:aT},cT="ファイル {{ currentFileNo }} / {{ allFilesCount }}",hT="ファイルタイプに対応したレンダラーはありません: {{ fileType }}",uT="ダウンロード",dT="ファイルが壊れています。あなたのマシンでファイルを確認してください。",fT="受信者",pT="送信者",gT="ローティング中...",mT="ページ {{ currentPage }}/{{ allPagesCount }}",vT={documentNavInfo:cT,noRendererMessage:hT,downloadButtonLabel:uT,brokenFile:dT,msgPluginRecipients:fT,msgPluginSender:pT,pdfPluginLoading:gT,pdfPluginPageNumber:mT},yT="Документ {{ currentFileNo }} из {{ allFilesCount }}",bT="Данный тип файла не поддерживается рендером: {{{ fileType }}}",wT="Скачать файл",AT="Ваш файл сломан. Пожалуйста, проверьте его на своём комьютере.",ET="Получатели",_T="Отправитель",xT="Загрузка...",ST="Страница {{ currentPage }}/{{ allPagesCount }}",CT={documentNavInfo:yT,noRendererMessage:bT,downloadButtonLabel:wT,brokenFile:AT,msgPluginRecipients:ET,msgPluginSender:_T,pdfPluginLoading:xT,pdfPluginPageNumber:ST},TT="Dokument {{ currentFileNo }} av {{ allFilesCount }}",PT="Ingen renderare för filtypen: {{{ fileType }}}",RT="Ladda ner",LT="Filen är trasig. Var vänlig kontrollera den på din maskin.",kT="Mottagare",IT="Avsändare",FT="Laddar...",MT="Sida {{ currentPage }}/{{ allPagesCount }}",DT={documentNavInfo:TT,noRendererMessage:PT,downloadButtonLabel:RT,brokenFile:LT,msgPluginRecipients:kT,msgPluginSender:IT,pdfPluginLoading:FT,pdfPluginPageNumber:MT},Qu={en:DS,pl:VS,es:QS,de:lC,it:vC,pt:CC,fr:DC,ar:VC,sr:QC,sr_cyr:lT,ja:vT,ru:CT,se:DT},OT=Object.keys(Qu),e0="en",Xy="SET_ALL_DOCUMENTS",Yy="SET_DOCUMENT_LOADING",Ky="NEXT_DOCUMENT",Zy="PREVIOUS_DOCUMENT",Jy="UPDATE_CURRENT_DOCUMENT",Qy="SET_RENDERER_RECT",tb="SET_MAIN_CONFIG",NT=(s,t)=>({type:Xy,documents:s,initialActiveDocument:t}),Gp=s=>({type:Yy,value:s}),n0=()=>({type:Ky}),i0=()=>({type:Zy}),wg=s=>({type:Jy,document:s}),BT=s=>({type:Qy,rect:s}),$T=s=>({type:tb,config:s}),td={currentFileNo:0,documents:[],documentLoading:!0,currentDocument:void 0,rendererRect:void 0,config:{},pluginRenderers:[],language:e0},jT=(s=td,t)=>{switch(t.type){case Xy:{const{documents:e,initialActiveDocument:n}=t;return{...s,documents:e,currentDocument:n||e[0]||null,currentFileNo:n&&e.includes(n)?e.indexOf(n):td.currentFileNo}}case Yy:{const{value:e}=t;return{...s,documentLoading:e}}case Ky:{if(s.currentFileNo>=s.documents.length-1)return s;const e=s.currentFileNo+1;return s.onDocumentChange&&s.onDocumentChange(s.documents[e]),{...s,currentFileNo:e,currentDocument:s.documents[e],documentLoading:!0}}case Zy:{if(s.currentFileNo<=0)return s;const e=s.currentFileNo-1;return s.onDocumentChange&&s.onDocumentChange(s.documents[e]),{...s,currentFileNo:s.currentFileNo-1,currentDocument:s.documents[e],documentLoading:!0}}case Jy:{const{document:e}=t;return{...s,currentDocument:e,currentFileNo:s.documents.findIndex(n=>n.uri===e.uri)}}case Qy:{const{rect:e}=t;return{...s,rendererRect:e}}case tb:{const{config:e}=t;return{...s,config:e}}default:return s}},xs=U.createContext({state:td,dispatch:()=>null}),UT=U.forwardRef((s,t)=>{const{children:e,documents:n,config:i,pluginRenderers:r,prefetchMethod:o,requestHeaders:l,initialActiveDocument:c,language:u,activeDocument:h,onDocumentChange:f}=s,[g,v]=U.useReducer(jT,{...td,documents:n||[],currentDocument:n&&n.length?c||n[0]:void 0,config:i,pluginRenderers:r,prefetchMethod:o,requestHeaders:l,currentFileNo:c?n.findIndex(y=>y===c)??0:0,language:u&&Qu[u]?u:e0,activeDocument:h,onDocumentChange:f});return U.useEffect(()=>{v(NT(n,c)),i&&v($T(i))},[n,i,c]),U.useEffect(()=>{h&&v(wg(h))},[h]),U.useImperativeHandle(t,()=>({prev(){v(i0())},next(){v(n0())}}),[v]),O.jsx(xs.Provider,{value:{state:g,dispatch:v},children:e})}),HT=Qf`
  background-color: ${s=>s.theme.primary};
  color: ${s=>s.theme.textPrimary};
`,zT=Qf`
  background-color: ${s=>s.theme.secondary};
  color: ${s=>s.theme.textSecondary};
`,tp=bt.button`
  ${HT}
  display: flex;
  justify-content: center;
  align-items: center;
  width: 35px;
  height: 35px;
  padding: 0;
  margin: 0 0 0 5px;
  text-align: center;
  font-size: 18px;
  border: 0;
  outline: none;
  cursor: pointer;
  text-decoration: none;
  border-radius: 35px;
  opacity: ${s=>s.disabled?.4:1};
  pointer-events: ${s=>s.disabled?"none":"all"};
  box-shadow: 2px 2px 3px #00000033;

  @media (max-width: 768px) {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }
`,eb=bt.a`
  display: flex;
  justify-content: center;
  align-items: center;
  border: 0;
  outline: none;
  cursor: pointer;
  text-decoration: none;
  border-radius: 35px;
  background-color: ${s=>s.theme.primary};
  color: ${s=>s.theme.textPrimary};
  box-shadow: 2px 2px 3px #00000033;

  width: 35px;
  height: 35px;
  font-size: 18px;
  @media (max-width: 768px) {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }
`;bt(tp)``;const VT=bt(tp)`
  ${zT}
`,GT=s=>O.jsx(nb,{...s}),WT=s=>O.jsx(nb,{...s,reverse:!0}),nb=({color:s,size:t,reverse:e})=>O.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:O.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:s||"#aaa",fillRule:"evenodd",id:"Arrow_Back"})}),qT=s=>{const{color:t,size:e}=s;return O.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:O.jsxs("g",{children:[O.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"}),O.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\r
		z`}),O.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"}),O.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\r
		S10,20.6,9.6,20.9z`}),O.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"}),O.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\r
		L22.4,20.9z`}),O.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"}),O.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\r
		C21.1,11.2,21.4,11.3,21.7,11.3z`})]})})};/*!
 * mustache.js - Logic-less {{mustache}} templates with JavaScript
 * http://github.com/janl/mustache.js
 */var XT=Object.prototype.toString,Wa=Array.isArray||function(t){return XT.call(t)==="[object Array]"};function s0(s){return typeof s=="function"}function YT(s){return Wa(s)?"array":typeof s}function Wp(s){return s.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function ov(s,t){return s!=null&&typeof s=="object"&&t in s}function KT(s,t){return s!=null&&typeof s!="object"&&s.hasOwnProperty&&s.hasOwnProperty(t)}var ZT=RegExp.prototype.test;function JT(s,t){return ZT.call(s,t)}var QT=/\S/;function tP(s){return!JT(QT,s)}var eP={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function nP(s){return String(s).replace(/[&<>"'`=\/]/g,function(e){return eP[e]})}var iP=/\s*/,sP=/\s+/,av=/\s*=/,rP=/\s*\}/,oP=/#|\^|\/|>|\{|&|=|!/;function aP(s,t){if(!s)return[];var e=!1,n=[],i=[],r=[],o=!1,l=!1,c="",u=0;function h(){if(o&&!l)for(;r.length;)delete i[r.pop()];else r=[];o=!1,l=!1}var f,g,v;function y(C){if(typeof C=="string"&&(C=C.split(sP,2)),!Wa(C)||C.length!==2)throw new Error("Invalid tags: "+C);f=new RegExp(Wp(C[0])+"\\s*"),g=new RegExp("\\s*"+Wp(C[1])),v=new RegExp("\\s*"+Wp("}"+C[1]))}y(t||en.tags);for(var E=new Vh(s),S,_,P,L,k,F;!E.eos();){if(S=E.pos,P=E.scanUntil(f),P)for(var I=0,M=P.length;I<M;++I)L=P.charAt(I),tP(L)?(r.push(i.length),c+=L):(l=!0,e=!0,c+=" "),i.push(["text",L,S,S+1]),S+=1,L===`
`&&(h(),c="",u=0,e=!1);if(!E.scan(f))break;if(o=!0,_=E.scan(oP)||"name",E.scan(iP),_==="="?(P=E.scanUntil(av),E.scan(av),E.scanUntil(g)):_==="{"?(P=E.scanUntil(v),E.scan(rP),E.scanUntil(g),_="&"):P=E.scanUntil(g),!E.scan(g))throw new Error("Unclosed tag at "+E.pos);if(_==">"?k=[_,P,S,E.pos,c,u,e]:k=[_,P,S,E.pos],u++,i.push(k),_==="#"||_==="^")n.push(k);else if(_==="/"){if(F=n.pop(),!F)throw new Error('Unopened section "'+P+'" at '+S);if(F[1]!==P)throw new Error('Unclosed section "'+F[1]+'" at '+S)}else _==="name"||_==="{"||_==="&"?l=!0:_==="="&&y(P)}if(h(),F=n.pop(),F)throw new Error('Unclosed section "'+F[1]+'" at '+E.pos);return cP(lP(i))}function lP(s){for(var t=[],e,n,i=0,r=s.length;i<r;++i)e=s[i],e&&(e[0]==="text"&&n&&n[0]==="text"?(n[1]+=e[1],n[3]=e[3]):(t.push(e),n=e));return t}function cP(s){for(var t=[],e=t,n=[],i,r,o=0,l=s.length;o<l;++o)switch(i=s[o],i[0]){case"#":case"^":e.push(i),n.push(i),e=i[4]=[];break;case"/":r=n.pop(),r[5]=i[2],e=n.length>0?n[n.length-1][4]:t;break;default:e.push(i)}return t}function Vh(s){this.string=s,this.tail=s,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 za(s,t){this.view=s,this.cache={".":this.view},this.parent=t}za.prototype.push=function(t){return new za(t,this)};za.prototype.lookup=function(t){var e=this.cache,n;if(e.hasOwnProperty(t))n=e[t];else{for(var i=this,r,o,l,c=!1;i;){if(t.indexOf(".")>0)for(r=i.view,o=t.split("."),l=0;r!=null&&l<o.length;)l===o.length-1&&(c=ov(r,o[l])||KT(r,o[l])),r=r[o[l++]];else r=i.view[t],c=ov(i.view,t);if(c){n=r;break}i=i.parent}e[t]=n}return s0(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,i=t+":"+(e||en.tags).join(":"),r=typeof n<"u",o=r?n.get(i):void 0;return o==null&&(o=aP(t,e),r&&n.set(i,o)),o};Oe.prototype.render=function(t,e,n,i){var r=this.getConfigTags(i),o=this.parse(t,r),l=e instanceof za?e:new za(e,void 0);return this.renderTokens(o,l,n,t,i)};Oe.prototype.renderTokens=function(t,e,n,i,r){for(var o="",l,c,u,h=0,f=t.length;h<f;++h)u=void 0,l=t[h],c=l[0],c==="#"?u=this.renderSection(l,e,n,i,r):c==="^"?u=this.renderInverted(l,e,n,i,r):c===">"?u=this.renderPartial(l,e,n,r):c==="&"?u=this.unescapedValue(l,e):c==="name"?u=this.escapedValue(l,e,r):c==="text"&&(u=this.rawValue(l)),u!==void 0&&(o+=u);return o};Oe.prototype.renderSection=function(t,e,n,i,r){var o=this,l="",c=e.lookup(t[1]);function u(g){return o.render(g,e,n,r)}if(c){if(Wa(c))for(var h=0,f=c.length;h<f;++h)l+=this.renderTokens(t[4],e.push(c[h]),n,i,r);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")l+=this.renderTokens(t[4],e.push(c),n,i,r);else if(s0(c)){if(typeof i!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(e.view,i.slice(t[3],t[5]),u),c!=null&&(l+=c)}else l+=this.renderTokens(t[4],e,n,i,r);return l}};Oe.prototype.renderInverted=function(t,e,n,i,r){var o=e.lookup(t[1]);if(!o||Wa(o)&&o.length===0)return this.renderTokens(t[4],e,n,i,r)};Oe.prototype.indentPartial=function(t,e,n){for(var i=e.replace(/[^ \t]/g,""),r=t.split(`
`),o=0;o<r.length;o++)r[o].length&&(o>0||!n)&&(r[o]=i+r[o]);return r.join(`
`)};Oe.prototype.renderPartial=function(t,e,n,i){if(n){var r=this.getConfigTags(i),o=s0(n)?n(t[1]):n[t[1]];if(o!=null){var l=t[6],c=t[5],u=t[4],h=o;c==0&&u&&(h=this.indentPartial(o,u,l));var f=this.parse(h,r);return this.renderTokens(f,e,n,h,i)}}};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 i=this.getConfigEscape(n)||en.escape,r=e.lookup(t[1]);if(r!=null)return typeof r=="number"&&i===en.escape?String(r):i(r)};Oe.prototype.rawValue=function(t){return t[1]};Oe.prototype.getConfigTags=function(t){return Wa(t)?t:t&&typeof t=="object"?t.tags:void 0};Oe.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!Wa(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(s){bl.templateCache=s},get templateCache(){return bl.templateCache}},bl=new Oe;en.clearCache=function(){return bl.clearCache()};en.parse=function(t,e){return bl.parse(t,e)};en.render=function(t,e,n,i){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+YT(t)+'" was given as the first argument for mustache#render(template, view, partials)');return bl.render(t,e,n,i)};en.escape=nP;en.Scanner=Vh;en.Context=za;en.Writer=Oe;const eo=()=>{const{state:{language:s}}=U.useContext(xs),t=Qu[e0];return{t:U.useCallback((n,i)=>{const r=Qu[s];return r[n]?en.render(r[n],i):t[n]?en.render(t[n],i):n},[s,t])}},hP=()=>{const{state:{currentDocument:s,currentFileNo:t,documents:e},dispatch:n}=U.useContext(xs),{t:i}=eo();if(e.length<=1||!s)return null;let r=s.uri||"";const o=r==null?void 0:r.split("/");return o.length&&(r=o[o.length-1]),O.jsxs(uP,{id:"doc-nav",children:[O.jsx("p",{id:"doc-nav-info",children:i("documentNavInfo",{currentFileNo:t+1,allFilesCount:e.length})}),O.jsx(ib,{id:"doc-nav-prev",onClick:()=>n(i0()),disabled:t===0,children:O.jsx(GT,{color:"#fff",size:"60%"})}),O.jsx(dP,{id:"doc-nav-next",onClick:()=>n(n0()),disabled:t>=e.length-1,children:O.jsx(WT,{color:"#fff",size:"60%"})})]})},uP=bt.div`
  min-width: 150px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  margin: 0 10px;
  color: ${s=>s.theme.textPrimary};
`,ib=bt(VT)`
  width: 30px;
  height: 30px;
  margin: 0 5px 0 10px;

  @media (max-width: 768px) {
    width: 25px;
    height: 25px;
  }
`,dP=bt(ib)`
  margin: 0 5px;
`,sb=(s,t)=>{var n;if(!s)return"";let e="";if(s.fileName)e=s.fileName;else{e=s.uri||"",e=decodeURI(e),t||(e=(n=e==null?void 0:e.split("?"))==null?void 0:n[0]);const i=e==null?void 0:e.split("/");i.length&&(e=i[i.length-1])}return e},fP=()=>{var n,i;const{state:{config:s,currentDocument:t}}=U.useContext(xs);if(!t||(n=s==null?void 0:s.header)!=null&&n.disableFileName)return null;const e=sb(t,((i=s==null?void 0:s.header)==null?void 0:i.retainURLParams)||!1);return O.jsx(pP,{id:"file-name","data-testid":"file-name",children:e})},pP=bt.div`
  flex: 1;
  text-align: left;
  color: ${s=>s.theme.textPrimary};
  font-weight: bold;
  margin: 0 10px;
  overflow: hidden;
`,gP=()=>{var i,r,o;const{state:s,dispatch:t}=U.useContext(xs),{config:e}=s;if((i=e==null?void 0:e.header)!=null&&i.disableHeader)return null;const n=(o=(r=e==null?void 0:e.header)==null?void 0:r.overrideComponent)==null?void 0:o.call(r,s,()=>t(i0()),()=>t(n0()));return n||O.jsxs(mP,{id:"header-bar","data-testid":"header-bar",children:[O.jsx(fP,{}),O.jsx(hP,{})]})},mP=bt.div`
  display: flex;
  justify-content: flex-end;
  align-items: center;
  z-index: 1;
  padding: 0 10px;
  background-color: ${s=>s.theme.primary};
  font-size: 16px;
  min-height: 50px;

  @media (max-width: 768px) {
    min-height: 30px;
    padding: 5px;
    font-size: 10px;
  }
`,ep=({documentURI:s,signal:t,fileLoaderComplete:e,readerTypeFunction:n,headers:i})=>fetch(s,{signal:t,headers:i}).then(async r=>{const o=await r.blob(),l=new FileReader;switch(l.addEventListener("loadend",()=>e(l)),n){case"arrayBuffer":l.readAsArrayBuffer(o);break;case"binaryString":l.readAsBinaryString(o);break;case"dataURL":l.readAsDataURL(o);break;case"text":l.readAsText(o);break}}).catch(r=>r),rb=s=>ep({...s,readerTypeFunction:"arrayBuffer"}),r0=s=>ep({...s,readerTypeFunction:"dataURL"}),o0=s=>ep({...s,readerTypeFunction:"text"}),vP=s=>ep({...s,readerTypeFunction:"binaryString"}),ob=r0,yP=()=>{const{state:{currentDocument:s,pluginRenderers:t}}=U.useContext(xs),[e,n]=U.useState();return U.useEffect(()=>{if(!s)return;if(!s.fileType){n(void 0);return}const i=[];t==null||t.forEach(o=>{s.fileType!==void 0&&o.fileTypes.indexOf(s.fileType)>=0&&i.push(o)});const[r]=i.sort((o,l)=>l.weight-o.weight);n(r&&r!==void 0?()=>r:null)},[s,t]),{CurrentRenderer:e}},bP=()=>{const{state:s,dispatch:t}=U.useContext(xs),{currentFileNo:e,currentDocument:n,prefetchMethod:i}=s,[r,o]=U.useState(!1),{CurrentRenderer:l}=yP(),c=(n==null?void 0:n.uri)||"";return U.useEffect(()=>{if(r||!n||n.fileType!==void 0)return;const u=new AbortController,{signal:h}=u;return fetch(c,{method:i||c.startsWith("blob:")?"GET":"HEAD",signal:h,headers:s==null?void 0:s.requestHeaders}).then(f=>{const g=f.headers.get("content-type"),v=(g==null?void 0:g.split(";"))||[],y=v.length?v[0]:void 0;t(wg({...n,fileType:y||void 0}))}).catch(f=>{if((f==null?void 0:f.name)!=="AbortError")throw f}).finally(()=>{o(!0)}),()=>{u.abort()}},[e,c,n,r]),U.useEffect(()=>{o(!1)},[e]),U.useEffect(()=>{var v;if(!n||l===void 0)return;const u=new AbortController,{signal:h}=u,g={documentURI:c,signal:h,fileLoaderComplete:y=>{if(!n||!y){t(Gp(!1));return}const E={...n};y.result!==null&&(E.fileData=y.result),t(wg(E)),t(Gp(!1))},headers:s==null?void 0:s.requestHeaders};return l===null?t(Gp(!1)):l.fileLoader!==void 0?(v=l.fileLoader)==null||v.call(l,g):ob(g),()=>{u.abort()}},[l,e]),{state:s,dispatch:t,CurrentRenderer:l}},wP=()=>{const[s,t]=U.useState({width:void 0,height:void 0});return U.useEffect(()=>{function e(){t({width:window.innerWidth,height:window.innerHeight})}return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]),s},lv=({children:s})=>{var r,o;const{state:t}=U.useContext(xs),{config:e}=t,[n,i]=U.useState(((r=e==null?void 0:e.loadingRenderer)==null?void 0:r.showLoadingTimeout)===!1);return U.useEffect(()=>{var l;setTimeout(()=>{i(!0)},typeof((l=e==null?void 0:e.loadingRenderer)==null?void 0:l.showLoadingTimeout)=="number"?e.loadingRenderer.showLoadingTimeout:500)},[(o=e==null?void 0:e.loadingRenderer)==null?void 0:o.showLoadingTimeout]),n?O.jsx(O.Fragment,{children:s}):null},AP=({documents:s,documentLoading:t,config:e,currentDocument:n,fileName:i,CurrentRenderer:r,state:o,t:l})=>{var c,u;if(s.length)if(t){if(e&&((c=e==null?void 0:e.loadingRenderer)!=null&&c.overrideComponent)){const h=e.loadingRenderer.overrideComponent;return O.jsx(lv,{children:O.jsx(h,{document:n,fileName:i})})}return O.jsx(lv,{children:O.jsx(_P,{id:"loading-renderer","data-testid":"loading-renderer",children:O.jsx(SP,{children:O.jsx(qT,{color:"#444",size:40})})})})}else{if(r)return O.jsx(r,{mainState:o});if(r===void 0)return null;if(e&&((u=e==null?void 0:e.noRenderer)!=null&&u.overrideComponent)){const h=e.noRenderer.overrideComponent;return O.jsx(h,{document:n,fileName:i})}return O.jsxs("div",{id:"no-renderer","data-testid":"no-renderer",children:[l("noRendererMessage",{fileType:(n==null?void 0:n.fileType)??""}),O.jsx(CP,{id:"no-renderer-download",href:n==null?void 0:n.uri,download:n==null?void 0:n.uri,children:l("downloadButtonLabel")})]})}else return O.jsx("div",{id:"no-documents"})},EP=()=>{var f;const{state:s,dispatch:t,CurrentRenderer:e}=bP(),{documents:n,documentLoading:i,currentDocument:r,config:o}=s,l=wP(),{t:c}=eo(),u=U.useCallback(g=>{g&&t(BT(g==null?void 0:g.getBoundingClientRect()))},[l,t]),h=sb(r,((f=o==null?void 0:o.header)==null?void 0:f.retainURLParams)||!1);return O.jsx("div",{id:"proxy-renderer","data-testid":"proxy-renderer",ref:u,children:O.jsx(AP,{state:s,documents:n,documentLoading:i,config:o,currentDocument:r,fileName:h,CurrentRenderer:e,t:c})})},_P=bt.div`
  display: flex;
  flex: 1;
  height: 75px;
  align-items: center;
  justify-content: center;
`,xP=CS`
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
`,SP=bt.div`
  animation-name: ${xP};
  animation-duration: 4s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
`,CP=bt(eb)`
  width: 130px;
  height: 30px;
  background-color: ${s=>s.theme.primary};
  @media (max-width: 768px) {
    width: 125px;
    height: 25px;
  }
`,cv={primary:"#fff",secondary:"#000",tertiary:"#ffffff99",textPrimary:"#000",textSecondary:"#fff",textTertiary:"#00000044",disableThemeScrollbar:!1},Ui=({mainState:{currentDocument:s},children:t,...e})=>s?O.jsx(TP,{id:"image-renderer",...e,children:t||O.jsx(PP,{id:"image-img",src:s.fileData})}):null;Ui.fileTypes=[];Ui.weight=0;const TP=bt.div`
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: #fff;
`,PP=bt.img`
  max-width: 95%;
  max-height: 95%;
`,np=s=>O.jsx(Ui,{...s});np.fileTypes=["bmp","image/bmp"];np.weight=0;const Gh=({mainState:{currentDocument:s}})=>(U.useEffect(()=>{const t=s==null?void 0:s.fileData;let e="";const n=(t==null?void 0:t.replace(/^data:text\/html;(?:charset=([^;]*);)?base64,/,(c,u)=>(e=u,"")))||"";let i=window.atob(n);if(e){const c=new Uint8Array(i.length);for(let u=0;u<i.length;u++)c[u]=i.charCodeAt(u);i=new TextDecoder(e).decode(c)}const r=document.getElementById("html-body"),o=(r==null?void 0:r.contentWindow)&&r.contentWindow;if(!o)return;const l=o.document;l.open(),l.write(`${i}`),l.close()},[s]),O.jsx(RP,{id:"html-renderer",children:O.jsx(LP,{id:"html-body",sandbox:"allow-same-origin"})}));Gh.fileTypes=["htm","html","text/htm","text/html"];Gh.weight=0;Gh.fileLoader=r0;const RP=bt.div`
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0 30px;
`,LP=bt.iframe`
  height: 100%;
  padding: 15px;
  margin: 20px 0 20px 0;
  border: 1px solid ${s=>s.theme.secondary};
`,ip=s=>O.jsx(Ui,{...s});ip.fileTypes=["jpg","jpeg","image/jpg","image/jpeg"];ip.weight=0;const Wh=({mainState:{currentDocument:s}})=>s?O.jsx(kP,{id:"msdoc-renderer",children:O.jsx(IP,{id:"msdoc-iframe",title:"msdoc-iframe",src:`https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(s.uri)}`,frameBorder:"0"})}):null,Cs={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"]};Wh.fileTypes=[...Cs.odt,...Cs.doc,...Cs.docx,...Cs.xls,...Cs.xlsx,...Cs.ppt,...Cs.pptx];Wh.weight=0;Wh.fileLoader=({fileLoaderComplete:s})=>s();const kP=bt.div`
  width: 100%;
`,IP=bt.iframe`
  width: 100%;
  height: 100%;
  border: 0;
`;var le={},sp={};sp.byteLength=DP;sp.toByteArray=NP;sp.fromByteArray=jP;var Zn=[],rn=[],FP=typeof Uint8Array<"u"?Uint8Array:Array,qp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var ao=0,MP=qp.length;ao<MP;++ao)Zn[ao]=qp[ao],rn[qp.charCodeAt(ao)]=ao;rn[45]=62;rn[95]=63;function ab(s){var t=s.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=s.indexOf("=");e===-1&&(e=t);var n=e===t?0:4-e%4;return[e,n]}function DP(s){var t=ab(s),e=t[0],n=t[1];return(e+n)*3/4-n}function OP(s,t,e){return(t+e)*3/4-e}function NP(s){var t,e=ab(s),n=e[0],i=e[1],r=new FP(OP(s,n,i)),o=0,l=i>0?n-4:n,c;for(c=0;c<l;c+=4)t=rn[s.charCodeAt(c)]<<18|rn[s.charCodeAt(c+1)]<<12|rn[s.charCodeAt(c+2)]<<6|rn[s.charCodeAt(c+3)],r[o++]=t>>16&255,r[o++]=t>>8&255,r[o++]=t&255;return i===2&&(t=rn[s.charCodeAt(c)]<<2|rn[s.charCodeAt(c+1)]>>4,r[o++]=t&255),i===1&&(t=rn[s.charCodeAt(c)]<<10|rn[s.charCodeAt(c+1)]<<4|rn[s.charCodeAt(c+2)]>>2,r[o++]=t>>8&255,r[o++]=t&255),r}function BP(s){return Zn[s>>18&63]+Zn[s>>12&63]+Zn[s>>6&63]+Zn[s&63]}function $P(s,t,e){for(var n,i=[],r=t;r<e;r+=3)n=(s[r]<<16&16711680)+(s[r+1]<<8&65280)+(s[r+2]&255),i.push(BP(n));return i.join("")}function jP(s){for(var t,e=s.length,n=e%3,i=[],r=16383,o=0,l=e-n;o<l;o+=r)i.push($P(s,o,o+r>l?l:o+r));return n===1?(t=s[e-1],i.push(Zn[t>>2]+Zn[t<<4&63]+"==")):n===2&&(t=(s[e-2]<<8)+s[e-1],i.push(Zn[t>>10]+Zn[t>>4&63]+Zn[t<<2&63]+"=")),i.join("")}var a0={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */a0.read=function(s,t,e,n,i){var r,o,l=i*8-n-1,c=(1<<l)-1,u=c>>1,h=-7,f=e?i-1:0,g=e?-1:1,v=s[t+f];for(f+=g,r=v&(1<<-h)-1,v>>=-h,h+=l;h>0;r=r*256+s[t+f],f+=g,h-=8);for(o=r&(1<<-h)-1,r>>=-h,h+=n;h>0;o=o*256+s[t+f],f+=g,h-=8);if(r===0)r=1-u;else{if(r===c)return o?NaN:(v?-1:1)*(1/0);o=o+Math.pow(2,n),r=r-u}return(v?-1:1)*o*Math.pow(2,r-n)};a0.write=function(s,t,e,n,i,r){var o,l,c,u=r*8-i-1,h=(1<<u)-1,f=h>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=n?0:r-1,y=n?1:-1,E=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=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+f>=1?t+=g/c:t+=g*Math.pow(2,1-f),t*c>=2&&(o++,c/=2),o+f>=h?(l=0,o=h):o+f>=1?(l=(t*c-1)*Math.pow(2,i),o=o+f):(l=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;s[e+v]=l&255,v+=y,l/=256,i-=8);for(o=o<<i|l,u+=i;u>0;s[e+v]=o&255,v+=y,o/=256,u-=8);s[e+v-y]|=E*128};/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
 * @license  MIT
 */(function(s){const t=sp,e=a0,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;s.Buffer=h,s.SlowBuffer=F,s.INSPECT_MAX_BYTES=50;const i=2147483647;s.kMaxLength=i;const{Uint8Array:r,ArrayBuffer:o,SharedArrayBuffer:l}=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 b=new r(1),d={foo:function(){return 42}};return Object.setPrototypeOf(d,r.prototype),Object.setPrototypeOf(b,d),b.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 u(b){if(b>i)throw new RangeError('The value "'+b+'" is invalid for option "size"');const d=new r(b);return Object.setPrototypeOf(d,h.prototype),d}function h(b,d,p){if(typeof b=="number"){if(typeof d=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return y(b)}return f(b,d,p)}h.poolSize=8192;function f(b,d,p){if(typeof b=="string")return E(b,d);if(o.isView(b))return _(b);if(b==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof b);if(at(b,o)||b&&at(b.buffer,o)||typeof l<"u"&&(at(b,l)||b&&at(b.buffer,l)))return P(b,d,p);if(typeof b=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const x=b.valueOf&&b.valueOf();if(x!=null&&x!==b)return h.from(x,d,p);const R=L(b);if(R)return R;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof b[Symbol.toPrimitive]=="function")return h.from(b[Symbol.toPrimitive]("string"),d,p);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof b)}h.from=function(b,d,p){return f(b,d,p)},Object.setPrototypeOf(h.prototype,r.prototype),Object.setPrototypeOf(h,r);function g(b){if(typeof b!="number")throw new TypeError('"size" argument must be of type number');if(b<0)throw new RangeError('The value "'+b+'" is invalid for option "size"')}function v(b,d,p){return g(b),b<=0?u(b):d!==void 0?typeof p=="string"?u(b).fill(d,p):u(b).fill(d):u(b)}h.alloc=function(b,d,p){return v(b,d,p)};function y(b){return g(b),u(b<0?0:k(b)|0)}h.allocUnsafe=function(b){return y(b)},h.allocUnsafeSlow=function(b){return y(b)};function E(b,d){if((typeof d!="string"||d==="")&&(d="utf8"),!h.isEncoding(d))throw new TypeError("Unknown encoding: "+d);const p=I(b,d)|0;let x=u(p);const R=x.write(b,d);return R!==p&&(x=x.slice(0,R)),x}function S(b){const d=b.length<0?0:k(b.length)|0,p=u(d);for(let x=0;x<d;x+=1)p[x]=b[x]&255;return p}function _(b){if(at(b,r)){const d=new r(b);return P(d.buffer,d.byteOffset,d.byteLength)}return S(b)}function P(b,d,p){if(d<0||b.byteLength<d)throw new RangeError('"offset" is outside of buffer bounds');if(b.byteLength<d+(p||0))throw new RangeError('"length" is outside of buffer bounds');let x;return d===void 0&&p===void 0?x=new r(b):p===void 0?x=new r(b,d):x=new r(b,d,p),Object.setPrototypeOf(x,h.prototype),x}function L(b){if(h.isBuffer(b)){const d=k(b.length)|0,p=u(d);return p.length===0||b.copy(p,0,0,d),p}if(b.length!==void 0)return typeof b.length!="number"||Re(b.length)?u(0):S(b);if(b.type==="Buffer"&&Array.isArray(b.data))return S(b.data)}function k(b){if(b>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return b|0}function F(b){return+b!=b&&(b=0),h.alloc(+b)}h.isBuffer=function(d){return d!=null&&d._isBuffer===!0&&d!==h.prototype},h.compare=function(d,p){if(at(d,r)&&(d=h.from(d,d.offset,d.byteLength)),at(p,r)&&(p=h.from(p,p.offset,p.byteLength)),!h.isBuffer(d)||!h.isBuffer(p))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(d===p)return 0;let x=d.length,R=p.length;for(let B=0,j=Math.min(x,R);B<j;++B)if(d[B]!==p[B]){x=d[B],R=p[B];break}return x<R?-1:R<x?1:0},h.isEncoding=function(d){switch(String(d).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(d,p){if(!Array.isArray(d))throw new TypeError('"list" argument must be an Array of Buffers');if(d.length===0)return h.alloc(0);let x;if(p===void 0)for(p=0,x=0;x<d.length;++x)p+=d[x].length;const R=h.allocUnsafe(p);let B=0;for(x=0;x<d.length;++x){let j=d[x];if(at(j,r))B+j.length>R.length?(h.isBuffer(j)||(j=h.from(j)),j.copy(R,B)):r.prototype.set.call(R,j,B);else if(h.isBuffer(j))j.copy(R,B);else throw new TypeError('"list" argument must be an Array of Buffers');B+=j.length}return R};function I(b,d){if(h.isBuffer(b))return b.length;if(o.isView(b)||at(b,o))return b.byteLength;if(typeof b!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof b);const p=b.length,x=arguments.length>2&&arguments[2]===!0;if(!x&&p===0)return 0;let R=!1;for(;;)switch(d){case"ascii":case"latin1":case"binary":return p;case"utf8":case"utf-8":return Kt(b).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p*2;case"hex":return p>>>1;case"base64":return kt(b).length;default:if(R)return x?-1:Kt(b).length;d=(""+d).toLowerCase(),R=!0}}h.byteLength=I;function M(b,d,p){let x=!1;if((d===void 0||d<0)&&(d=0),d>this.length||((p===void 0||p>this.length)&&(p=this.length),p<=0)||(p>>>=0,d>>>=0,p<=d))return"";for(b||(b="utf8");;)switch(b){case"hex":return V(this,d,p);case"utf8":case"utf-8":return $(this,d,p);case"ascii":return wt(this,d,p);case"latin1":case"binary":return ft(this,d,p);case"base64":return J(this,d,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return it(this,d,p);default:if(x)throw new TypeError("Unknown encoding: "+b);b=(b+"").toLowerCase(),x=!0}}h.prototype._isBuffer=!0;function C(b,d,p){const x=b[d];b[d]=b[p],b[p]=x}h.prototype.swap16=function(){const d=this.length;if(d%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let p=0;p<d;p+=2)C(this,p,p+1);return this},h.prototype.swap32=function(){const d=this.length;if(d%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let p=0;p<d;p+=4)C(this,p,p+3),C(this,p+1,p+2);return this},h.prototype.swap64=function(){const d=this.length;if(d%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let p=0;p<d;p+=8)C(this,p,p+7),C(this,p+1,p+6),C(this,p+2,p+5),C(this,p+3,p+4);return this},h.prototype.toString=function(){const d=this.length;return d===0?"":arguments.length===0?$(this,0,d):M.apply(this,arguments)},h.prototype.toLocaleString=h.prototype.toString,h.prototype.equals=function(d){if(!h.isBuffer(d))throw new TypeError("Argument must be a Buffer");return this===d?!0:h.compare(this,d)===0},h.prototype.inspect=function(){let d="";const p=s.INSPECT_MAX_BYTES;return d=this.toString("hex",0,p).replace(/(.{2})/g,"$1 ").trim(),this.length>p&&(d+=" ... "),"<Buffer "+d+">"},n&&(h.prototype[n]=h.prototype.inspect),h.prototype.compare=function(d,p,x,R,B){if(at(d,r)&&(d=h.from(d,d.offset,d.byteLength)),!h.isBuffer(d))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof d);if(p===void 0&&(p=0),x===void 0&&(x=d?d.length:0),R===void 0&&(R=0),B===void 0&&(B=this.length),p<0||x>d.length||R<0||B>this.length)throw new RangeError("out of range index");if(R>=B&&p>=x)return 0;if(R>=B)return-1;if(p>=x)return 1;if(p>>>=0,x>>>=0,R>>>=0,B>>>=0,this===d)return 0;let j=B-R,Et=x-p;const qt=Math.min(j,Et),zt=this.slice(R,B),Xt=d.slice(p,x);for(let Ot=0;Ot<qt;++Ot)if(zt[Ot]!==Xt[Ot]){j=zt[Ot],Et=Xt[Ot];break}return j<Et?-1:Et<j?1:0};function T(b,d,p,x,R){if(b.length===0)return-1;if(typeof p=="string"?(x=p,p=0):p>2147483647?p=2147483647:p<-2147483648&&(p=-2147483648),p=+p,Re(p)&&(p=R?0:b.length-1),p<0&&(p=b.length+p),p>=b.length){if(R)return-1;p=b.length-1}else if(p<0)if(R)p=0;else return-1;if(typeof d=="string"&&(d=h.from(d,x)),h.isBuffer(d))return d.length===0?-1:N(b,d,p,x,R);if(typeof d=="number")return d=d&255,typeof r.prototype.indexOf=="function"?R?r.prototype.indexOf.call(b,d,p):r.prototype.lastIndexOf.call(b,d,p):N(b,[d],p,x,R);throw new TypeError("val must be string, number or Buffer")}function N(b,d,p,x,R){let B=1,j=b.length,Et=d.length;if(x!==void 0&&(x=String(x).toLowerCase(),x==="ucs2"||x==="ucs-2"||x==="utf16le"||x==="utf-16le")){if(b.length<2||d.length<2)return-1;B=2,j/=2,Et/=2,p/=2}function qt(Xt,Ot){return B===1?Xt[Ot]:Xt.readUInt16BE(Ot*B)}let zt;if(R){let Xt=-1;for(zt=p;zt<j;zt++)if(qt(b,zt)===qt(d,Xt===-1?0:zt-Xt)){if(Xt===-1&&(Xt=zt),zt-Xt+1===Et)return Xt*B}else Xt!==-1&&(zt-=zt-Xt),Xt=-1}else for(p+Et>j&&(p=j-Et),zt=p;zt>=0;zt--){let Xt=!0;for(let Ot=0;Ot<Et;Ot++)if(qt(b,zt+Ot)!==qt(d,Ot)){Xt=!1;break}if(Xt)return zt}return-1}h.prototype.includes=function(d,p,x){return this.indexOf(d,p,x)!==-1},h.prototype.indexOf=function(d,p,x){return T(this,d,p,x,!0)},h.prototype.lastIndexOf=function(d,p,x){return T(this,d,p,x,!1)};function D(b,d,p,x){p=Number(p)||0;const R=b.length-p;x?(x=Number(x),x>R&&(x=R)):x=R;const B=d.length;x>B/2&&(x=B/2);let j;for(j=0;j<x;++j){const Et=parseInt(d.substr(j*2,2),16);if(Re(Et))return j;b[p+j]=Et}return j}function H(b,d,p,x){return Wt(Kt(d,b.length-p),b,p,x)}function z(b,d,p,x){return Wt(Gt(d),b,p,x)}function G(b,d,p,x){return Wt(kt(d),b,p,x)}function K(b,d,p,x){return Wt(Lt(d,b.length-p),b,p,x)}h.prototype.write=function(d,p,x,R){if(p===void 0)R="utf8",x=this.length,p=0;else if(x===void 0&&typeof p=="string")R=p,x=this.length,p=0;else if(isFinite(p))p=p>>>0,isFinite(x)?(x=x>>>0,R===void 0&&(R="utf8")):(R=x,x=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const B=this.length-p;if((x===void 0||x>B)&&(x=B),d.length>0&&(x<0||p<0)||p>this.length)throw new RangeError("Attempt to write outside buffer bounds");R||(R="utf8");let j=!1;for(;;)switch(R){case"hex":return D(this,d,p,x);case"utf8":case"utf-8":return H(this,d,p,x);case"ascii":case"latin1":case"binary":return z(this,d,p,x);case"base64":return G(this,d,p,x);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,d,p,x);default:if(j)throw new TypeError("Unknown encoding: "+R);R=(""+R).toLowerCase(),j=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function J(b,d,p){return d===0&&p===b.length?t.fromByteArray(b):t.fromByteArray(b.slice(d,p))}function $(b,d,p){p=Math.min(b.length,p);const x=[];let R=d;for(;R<p;){const B=b[R];let j=null,Et=B>239?4:B>223?3:B>191?2:1;if(R+Et<=p){let qt,zt,Xt,Ot;switch(Et){case 1:B<128&&(j=B);break;case 2:qt=b[R+1],(qt&192)===128&&(Ot=(B&31)<<6|qt&63,Ot>127&&(j=Ot));break;case 3:qt=b[R+1],zt=b[R+2],(qt&192)===128&&(zt&192)===128&&(Ot=(B&15)<<12|(qt&63)<<6|zt&63,Ot>2047&&(Ot<55296||Ot>57343)&&(j=Ot));break;case 4:qt=b[R+1],zt=b[R+2],Xt=b[R+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&&(j=Ot))}}j===null?(j=65533,Et=1):j>65535&&(j-=65536,x.push(j>>>10&1023|55296),j=56320|j&1023),x.push(j),R+=Et}return q(x)}const W=4096;function q(b){const d=b.length;if(d<=W)return String.fromCharCode.apply(String,b);let p="",x=0;for(;x<d;)p+=String.fromCharCode.apply(String,b.slice(x,x+=W));return p}function wt(b,d,p){let x="";p=Math.min(b.length,p);for(let R=d;R<p;++R)x+=String.fromCharCode(b[R]&127);return x}function ft(b,d,p){let x="";p=Math.min(b.length,p);for(let R=d;R<p;++R)x+=String.fromCharCode(b[R]);return x}function V(b,d,p){const x=b.length;(!d||d<0)&&(d=0),(!p||p<0||p>x)&&(p=x);let R="";for(let B=d;B<p;++B)R+=Le[b[B]];return R}function it(b,d,p){const x=b.slice(d,p);let R="";for(let B=0;B<x.length-1;B+=2)R+=String.fromCharCode(x[B]+x[B+1]*256);return R}h.prototype.slice=function(d,p){const x=this.length;d=~~d,p=p===void 0?x:~~p,d<0?(d+=x,d<0&&(d=0)):d>x&&(d=x),p<0?(p+=x,p<0&&(p=0)):p>x&&(p=x),p<d&&(p=d);const R=this.subarray(d,p);return Object.setPrototypeOf(R,h.prototype),R};function et(b,d,p){if(b%1!==0||b<0)throw new RangeError("offset is not uint");if(b+d>p)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUintLE=h.prototype.readUIntLE=function(d,p,x){d=d>>>0,p=p>>>0,x||et(d,p,this.length);let R=this[d],B=1,j=0;for(;++j<p&&(B*=256);)R+=this[d+j]*B;return R},h.prototype.readUintBE=h.prototype.readUIntBE=function(d,p,x){d=d>>>0,p=p>>>0,x||et(d,p,this.length);let R=this[d+--p],B=1;for(;p>0&&(B*=256);)R+=this[d+--p]*B;return R},h.prototype.readUint8=h.prototype.readUInt8=function(d,p){return d=d>>>0,p||et(d,1,this.length),this[d]},h.prototype.readUint16LE=h.prototype.readUInt16LE=function(d,p){return d=d>>>0,p||et(d,2,this.length),this[d]|this[d+1]<<8},h.prototype.readUint16BE=h.prototype.readUInt16BE=function(d,p){return d=d>>>0,p||et(d,2,this.length),this[d]<<8|this[d+1]},h.prototype.readUint32LE=h.prototype.readUInt32LE=function(d,p){return d=d>>>0,p||et(d,4,this.length),(this[d]|this[d+1]<<8|this[d+2]<<16)+this[d+3]*16777216},h.prototype.readUint32BE=h.prototype.readUInt32BE=function(d,p){return d=d>>>0,p||et(d,4,this.length),this[d]*16777216+(this[d+1]<<16|this[d+2]<<8|this[d+3])},h.prototype.readBigUInt64LE=ce(function(d){d=d>>>0,Y(d,"offset");const p=this[d],x=this[d+7];(p===void 0||x===void 0)&&vt(d,this.length-8);const R=p+this[++d]*2**8+this[++d]*2**16+this[++d]*2**24,B=this[++d]+this[++d]*2**8+this[++d]*2**16+x*2**24;return BigInt(R)+(BigInt(B)<<BigInt(32))}),h.prototype.readBigUInt64BE=ce(function(d){d=d>>>0,Y(d,"offset");const p=this[d],x=this[d+7];(p===void 0||x===void 0)&&vt(d,this.length-8);const R=p*2**24+this[++d]*2**16+this[++d]*2**8+this[++d],B=this[++d]*2**24+this[++d]*2**16+this[++d]*2**8+x;return(BigInt(R)<<BigInt(32))+BigInt(B)}),h.prototype.readIntLE=function(d,p,x){d=d>>>0,p=p>>>0,x||et(d,p,this.length);let R=this[d],B=1,j=0;for(;++j<p&&(B*=256);)R+=this[d+j]*B;return B*=128,R>=B&&(R-=Math.pow(2,8*p)),R},h.prototype.readIntBE=function(d,p,x){d=d>>>0,p=p>>>0,x||et(d,p,this.length);let R=p,B=1,j=this[d+--R];for(;R>0&&(B*=256);)j+=this[d+--R]*B;return B*=128,j>=B&&(j-=Math.pow(2,8*p)),j},h.prototype.readInt8=function(d,p){return d=d>>>0,p||et(d,1,this.length),this[d]&128?(255-this[d]+1)*-1:this[d]},h.prototype.readInt16LE=function(d,p){d=d>>>0,p||et(d,2,this.length);const x=this[d]|this[d+1]<<8;return x&32768?x|4294901760:x},h.prototype.readInt16BE=function(d,p){d=d>>>0,p||et(d,2,this.length);const x=this[d+1]|this[d]<<8;return x&32768?x|4294901760:x},h.prototype.readInt32LE=function(d,p){return d=d>>>0,p||et(d,4,this.length),this[d]|this[d+1]<<8|this[d+2]<<16|this[d+3]<<24},h.prototype.readInt32BE=function(d,p){return d=d>>>0,p||et(d,4,this.length),this[d]<<24|this[d+1]<<16|this[d+2]<<8|this[d+3]},h.prototype.readBigInt64LE=ce(function(d){d=d>>>0,Y(d,"offset");const p=this[d],x=this[d+7];(p===void 0||x===void 0)&&vt(d,this.length-8);const R=this[d+4]+this[d+5]*2**8+this[d+6]*2**16+(x<<24);return(BigInt(R)<<BigInt(32))+BigInt(p+this[++d]*2**8+this[++d]*2**16+this[++d]*2**24)}),h.prototype.readBigInt64BE=ce(function(d){d=d>>>0,Y(d,"offset");const p=this[d],x=this[d+7];(p===void 0||x===void 0)&&vt(d,this.length-8);const R=(p<<24)+this[++d]*2**16+this[++d]*2**8+this[++d];return(BigInt(R)<<BigInt(32))+BigInt(this[++d]*2**24+this[++d]*2**16+this[++d]*2**8+x)}),h.prototype.readFloatLE=function(d,p){return d=d>>>0,p||et(d,4,this.length),e.read(this,d,!0,23,4)},h.prototype.readFloatBE=function(d,p){return d=d>>>0,p||et(d,4,this.length),e.read(this,d,!1,23,4)},h.prototype.readDoubleLE=function(d,p){return d=d>>>0,p||et(d,8,this.length),e.read(this,d,!0,52,8)},h.prototype.readDoubleBE=function(d,p){return d=d>>>0,p||et(d,8,this.length),e.read(this,d,!1,52,8)};function nt(b,d,p,x,R,B){if(!h.isBuffer(b))throw new TypeError('"buffer" argument must be a Buffer instance');if(d>R||d<B)throw new RangeError('"value" argument is out of bounds');if(p+x>b.length)throw new RangeError("Index out of range")}h.prototype.writeUintLE=h.prototype.writeUIntLE=function(d,p,x,R){if(d=+d,p=p>>>0,x=x>>>0,!R){const Et=Math.pow(2,8*x)-1;nt(this,d,p,x,Et,0)}let B=1,j=0;for(this[p]=d&255;++j<x&&(B*=256);)this[p+j]=d/B&255;return p+x},h.prototype.writeUintBE=h.prototype.writeUIntBE=function(d,p,x,R){if(d=+d,p=p>>>0,x=x>>>0,!R){const Et=Math.pow(2,8*x)-1;nt(this,d,p,x,Et,0)}let B=x-1,j=1;for(this[p+B]=d&255;--B>=0&&(j*=256);)this[p+B]=d/j&255;return p+x},h.prototype.writeUint8=h.prototype.writeUInt8=function(d,p,x){return d=+d,p=p>>>0,x||nt(this,d,p,1,255,0),this[p]=d&255,p+1},h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(d,p,x){return d=+d,p=p>>>0,x||nt(this,d,p,2,65535,0),this[p]=d&255,this[p+1]=d>>>8,p+2},h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(d,p,x){return d=+d,p=p>>>0,x||nt(this,d,p,2,65535,0),this[p]=d>>>8,this[p+1]=d&255,p+2},h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(d,p,x){return d=+d,p=p>>>0,x||nt(this,d,p,4,4294967295,0),this[p+3]=d>>>24,this[p+2]=d>>>16,this[p+1]=d>>>8,this[p]=d&255,p+4},h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(d,p,x){return d=+d,p=p>>>0,x||nt(this,d,p,4,4294967295,0),this[p]=d>>>24,this[p+1]=d>>>16,this[p+2]=d>>>8,this[p+3]=d&255,p+4};function ht(b,d,p,x,R){At(d,x,R,b,p,7);let B=Number(d&BigInt(4294967295));b[p++]=B,B=B>>8,b[p++]=B,B=B>>8,b[p++]=B,B=B>>8,b[p++]=B;let j=Number(d>>BigInt(32)&BigInt(4294967295));return b[p++]=j,j=j>>8,b[p++]=j,j=j>>8,b[p++]=j,j=j>>8,b[p++]=j,p}function Z(b,d,p,x,R){At(d,x,R,b,p,7);let B=Number(d&BigInt(4294967295));b[p+7]=B,B=B>>8,b[p+6]=B,B=B>>8,b[p+5]=B,B=B>>8,b[p+4]=B;let j=Number(d>>BigInt(32)&BigInt(4294967295));return b[p+3]=j,j=j>>8,b[p+2]=j,j=j>>8,b[p+1]=j,j=j>>8,b[p]=j,p+8}h.prototype.writeBigUInt64LE=ce(function(d,p=0){return ht(this,d,p,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeBigUInt64BE=ce(function(d,p=0){return Z(this,d,p,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeIntLE=function(d,p,x,R){if(d=+d,p=p>>>0,!R){const qt=Math.pow(2,8*x-1);nt(this,d,p,x,qt-1,-qt)}let B=0,j=1,Et=0;for(this[p]=d&255;++B<x&&(j*=256);)d<0&&Et===0&&this[p+B-1]!==0&&(Et=1),this[p+B]=(d/j>>0)-Et&255;return p+x},h.prototype.writeIntBE=function(d,p,x,R){if(d=+d,p=p>>>0,!R){const qt=Math.pow(2,8*x-1);nt(this,d,p,x,qt-1,-qt)}let B=x-1,j=1,Et=0;for(this[p+B]=d&255;--B>=0&&(j*=256);)d<0&&Et===0&&this[p+B+1]!==0&&(Et=1),this[p+B]=(d/j>>0)-Et&255;return p+x},h.prototype.writeInt8=function(d,p,x){return d=+d,p=p>>>0,x||nt(this,d,p,1,127,-128),d<0&&(d=255+d+1),this[p]=d&255,p+1},h.prototype.writeInt16LE=function(d,p,x){return d=+d,p=p>>>0,x||nt(this,d,p,2,32767,-32768),this[p]=d&255,this[p+1]=d>>>8,p+2},h.prototype.writeInt16BE=function(d,p,x){return d=+d,p=p>>>0,x||nt(this,d,p,2,32767,-32768),this[p]=d>>>8,this[p+1]=d&255,p+2},h.prototype.writeInt32LE=function(d,p,x){return d=+d,p=p>>>0,x||nt(this,d,p,4,2147483647,-2147483648),this[p]=d&255,this[p+1]=d>>>8,this[p+2]=d>>>16,this[p+3]=d>>>24,p+4},h.prototype.writeInt32BE=function(d,p,x){return d=+d,p=p>>>0,x||nt(this,d,p,4,2147483647,-2147483648),d<0&&(d=4294967295+d+1),this[p]=d>>>24,this[p+1]=d>>>16,this[p+2]=d>>>8,this[p+3]=d&255,p+4},h.prototype.writeBigInt64LE=ce(function(d,p=0){return ht(this,d,p,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),h.prototype.writeBigInt64BE=ce(function(d,p=0){return Z(this,d,p,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function mt(b,d,p,x,R,B){if(p+x>b.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("Index out of range")}function X(b,d,p,x,R){return d=+d,p=p>>>0,R||mt(b,d,p,4),e.write(b,d,p,x,23,4),p+4}h.prototype.writeFloatLE=function(d,p,x){return X(this,d,p,!0,x)},h.prototype.writeFloatBE=function(d,p,x){return X(this,d,p,!1,x)};function Q(b,d,p,x,R){return d=+d,p=p>>>0,R||mt(b,d,p,8),e.write(b,d,p,x,52,8),p+8}h.prototype.writeDoubleLE=function(d,p,x){return Q(this,d,p,!0,x)},h.prototype.writeDoubleBE=function(d,p,x){return Q(this,d,p,!1,x)},h.prototype.copy=function(d,p,x,R){if(!h.isBuffer(d))throw new TypeError("argument should be a Buffer");if(x||(x=0),!R&&R!==0&&(R=this.length),p>=d.length&&(p=d.length),p||(p=0),R>0&&R<x&&(R=x),R===x||d.length===0||this.length===0)return 0;if(p<0)throw new RangeError("targetStart out of bounds");if(x<0||x>=this.length)throw new RangeError("Index out of range");if(R<0)throw new RangeError("sourceEnd out of bounds");R>this.length&&(R=this.length),d.length-p<R-x&&(R=d.length-p+x);const B=R-x;return this===d&&typeof r.prototype.copyWithin=="function"?this.copyWithin(p,x,R):r.prototype.set.call(d,this.subarray(x,R),p),B},h.prototype.fill=function(d,p,x,R){if(typeof d=="string"){if(typeof p=="string"?(R=p,p=0,x=this.length):typeof x=="string"&&(R=x,x=this.length),R!==void 0&&typeof R!="string")throw new TypeError("encoding must be a string");if(typeof R=="string"&&!h.isEncoding(R))throw new TypeError("Unknown encoding: "+R);if(d.length===1){const j=d.charCodeAt(0);(R==="utf8"&&j<128||R==="latin1")&&(d=j)}}else typeof d=="number"?d=d&255:typeof d=="boolean"&&(d=Number(d));if(p<0||this.length<p||this.length<x)throw new RangeError("Out of range index");if(x<=p)return this;p=p>>>0,x=x===void 0?this.length:x>>>0,d||(d=0);let B;if(typeof d=="number")for(B=p;B<x;++B)this[B]=d;else{const j=h.isBuffer(d)?d:h.from(d,R),Et=j.length;if(Et===0)throw new TypeError('The value "'+d+'" is invalid for argument "value"');for(B=0;B<x-p;++B)this[B+p]=j[B%Et]}return this};const ut={};function pt(b,d,p){ut[b]=class extends p{constructor(){super(),Object.defineProperty(this,"message",{value:d.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${b}]`,this.stack,delete this.name}get code(){return b}set code(R){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:R,writable:!0})}toString(){return`${this.name} [${b}]: ${this.message}`}}}pt("ERR_BUFFER_OUT_OF_BOUNDS",function(b){return b?`${b} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),pt("ERR_INVALID_ARG_TYPE",function(b,d){return`The "${b}" argument must be of type number. Received type ${typeof d}`},TypeError),pt("ERR_OUT_OF_RANGE",function(b,d,p){let x=`The value of "${b}" is out of range.`,R=p;return Number.isInteger(p)&&Math.abs(p)>2**32?R=ot(String(p)):typeof p=="bigint"&&(R=String(p),(p>BigInt(2)**BigInt(32)||p<-(BigInt(2)**BigInt(32)))&&(R=ot(R)),R+="n"),x+=` It must be ${d}. Received ${R}`,x},RangeError);function ot(b){let d="",p=b.length;const x=b[0]==="-"?1:0;for(;p>=x+4;p-=3)d=`_${b.slice(p-3,p)}${d}`;return`${b.slice(0,p)}${d}`}function St(b,d,p){Y(d,"offset"),(b[d]===void 0||b[d+p]===void 0)&&vt(d,b.length-(p+1))}function At(b,d,p,x,R,B){if(b>p||b<d){const j=typeof d=="bigint"?"n":"";let Et;throw d===0||d===BigInt(0)?Et=`>= 0${j} and < 2${j} ** ${(B+1)*8}${j}`:Et=`>= -(2${j} ** ${(B+1)*8-1}${j}) and < 2 ** ${(B+1)*8-1}${j}`,new ut.ERR_OUT_OF_RANGE("value",Et,b)}St(x,R,B)}function Y(b,d){if(typeof b!="number")throw new ut.ERR_INVALID_ARG_TYPE(d,"number",b)}function vt(b,d,p){throw Math.floor(b)!==b?(Y(b,p),new ut.ERR_OUT_OF_RANGE("offset","an integer",b)):d<0?new ut.ERR_BUFFER_OUT_OF_BOUNDS:new ut.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${d}`,b)}const Pt=/[^+/0-9A-Za-z-_]/g;function jt(b){if(b=b.split("=")[0],b=b.trim().replace(Pt,""),b.length<2)return"";for(;b.length%4!==0;)b=b+"=";return b}function Kt(b,d){d=d||1/0;let p;const x=b.length;let R=null;const B=[];for(let j=0;j<x;++j){if(p=b.charCodeAt(j),p>55295&&p<57344){if(!R){if(p>56319){(d-=3)>-1&&B.push(239,191,189);continue}else if(j+1===x){(d-=3)>-1&&B.push(239,191,189);continue}R=p;continue}if(p<56320){(d-=3)>-1&&B.push(239,191,189),R=p;continue}p=(R-55296<<10|p-56320)+65536}else R&&(d-=3)>-1&&B.push(239,191,189);if(R=null,p<128){if((d-=1)<0)break;B.push(p)}else if(p<2048){if((d-=2)<0)break;B.push(p>>6|192,p&63|128)}else if(p<65536){if((d-=3)<0)break;B.push(p>>12|224,p>>6&63|128,p&63|128)}else if(p<1114112){if((d-=4)<0)break;B.push(p>>18|240,p>>12&63|128,p>>6&63|128,p&63|128)}else throw new Error("Invalid code point")}return B}function Gt(b){const d=[];for(let p=0;p<b.length;++p)d.push(b.charCodeAt(p)&255);return d}function Lt(b,d){let p,x,R;const B=[];for(let j=0;j<b.length&&!((d-=2)<0);++j)p=b.charCodeAt(j),x=p>>8,R=p%256,B.push(R),B.push(x);return B}function kt(b){return t.toByteArray(jt(b))}function Wt(b,d,p,x){let R;for(R=0;R<x&&!(R+p>=d.length||R>=b.length);++R)d[R+p]=b[R];return R}function at(b,d){return b instanceof d||b!=null&&b.constructor!=null&&b.constructor.name!=null&&b.constructor.name===d.name}function Re(b){return b!==b}const Le=function(){const b="0123456789abcdef",d=new Array(256);for(let p=0;p<16;++p){const x=p*16;for(let R=0;R<16;++R)d[x+R]=b[p]+b[R]}return d}();function ce(b){return typeof BigInt>"u"?nn:b}function nn(){throw new Error("BigInt not supported")}})(le);const ed=le.Buffer,UP=le.Blob,HP=le.BlobOptions,zP=le.Buffer,VP=le.File,GP=le.FileOptions,WP=le.INSPECT_MAX_BYTES,qP=le.SlowBuffer,XP=le.TranscodeEncoding,YP=le.atob,KP=le.btoa,ZP=le.constants,JP=le.isAscii,QP=le.isUtf8,tR=le.kMaxLength,eR=le.kStringMaxLength,nR=le.resolveObjectURL,iR=le.transcode,sR=Object.freeze(Object.defineProperty({__proto__:null,Blob:UP,BlobOptions:HP,Buffer:zP,File:VP,FileOptions:GP,INSPECT_MAX_BYTES:WP,SlowBuffer:qP,TranscodeEncoding:XP,atob:YP,btoa:KP,constants:ZP,default:ed,isAscii:JP,isUtf8:QP,kMaxLength:tR,kStringMaxLength:eR,resolveObjectURL:nR,transcode:iR},Symbol.toStringTag,{value:"Module"}));var gl={};gl.d=(s,t)=>{for(var e in t)gl.o(t,e)&&!gl.o(s,e)&&Object.defineProperty(s,e,{enumerable:!0,get:t[e]})};gl.o=(s,t)=>Object.prototype.hasOwnProperty.call(s,t);var rt=globalThis.pdfjsLib={};gl.d(rt,{AbortException:()=>io,AnnotationEditorLayer:()=>Im,AnnotationEditorParamsType:()=>lt,AnnotationEditorType:()=>xt,AnnotationEditorUIManager:()=>Kr,AnnotationLayer:()=>nk,AnnotationMode:()=>Xi,CMapCompressionType:()=>Eg,ColorPicker:()=>ad,DOMSVGFactory:()=>h0,DrawLayer:()=>Om,FeatureTest:()=>ze,GlobalWorkerOptions:()=>$i,ImageKind:()=>Eu,InvalidPDFException:()=>cb,MissingPDFException:()=>no,OPS:()=>fn,Outliner:()=>fm,PDFDataRangeTransport:()=>ew,PDFDateString:()=>mb,PDFWorker:()=>wo,PasswordResponses:()=>lR,PermissionFlag:()=>aR,PixelsPerInch:()=>Es,RenderingCancelledException:()=>u0,TextLayer:()=>rd,UnexpectedResponseException:()=>lp,Util:()=>tt,VerbosityLevel:()=>rp,XfaLayer:()=>iw,build:()=>OL,createValidAbsoluteUrl:()=>dR,fetchData:()=>pp,getDocument:()=>TL,getFilenameFromUrl:()=>ER,getPdfFilenameFromUrl:()=>_R,getXfaPageViewport:()=>xR,isDataScheme:()=>d0,isPdfFile:()=>f0,noContextMenu:()=>Ve,normalizeUnicode:()=>yR,renderTextLayer:()=>yL,setLayerDimensions:()=>Yr,shadow:()=>Tt,updateTextLayer:()=>bL,version:()=>DL});const Pe=typeof ct=="object"&&ct+""=="[object process]"&&!ct.versions.nw&&!(ct.versions.electron&&ct.type&&ct.type!=="browser"),lb=[1,0,0,1,0,0],Ag=[.001,0,0,.001,0,0],rR=1e7,Xp=1.35,hn={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},Xi={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},oR="pdfjs_internal_editor_",xt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},lt={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},aR={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},_e={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},Eu={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},Ya={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},rp={ERRORS:0,WARNINGS:1,INFOS:5},Eg={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},lR={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let op=rp.WARNINGS;function cR(s){Number.isInteger(s)&&(op=s)}function hR(){return op}function ap(s){op>=rp.INFOS&&console.log(`Info: ${s}`)}function yt(s){op>=rp.WARNINGS&&console.log(`Warning: ${s}`)}function Dt(s){throw new Error(s)}function ae(s,t){s||Dt(t)}function uR(s){switch(s==null?void 0:s.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function dR(s,t=null,e=null){if(!s)return null;try{if(e&&typeof s=="string"){if(e.addDefaultProtocol&&s.startsWith("www.")){const i=s.match(/\./g);(i==null?void 0:i.length)>=2&&(s=`http://${s}`)}if(e.tryConvertEncoding)try{s=vR(s)}catch{}}const n=t?new URL(s,t):new URL(s);if(uR(n))return n}catch{}return null}function Tt(s,t,e,n=!1){return Object.defineProperty(s,t,{value:e,enumerable:!n,configurable:!0,writable:!1}),e}const Ss=function(){function t(e,n){this.constructor===t&&Dt("Cannot initialize BaseException."),this.message=e,this.name=n}return t.prototype=new Error,t.constructor=t,t}();class _g extends Ss{constructor(t,e){super(t,"PasswordException"),this.code=e}}class xg extends Ss{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class cb extends Ss{constructor(t){super(t,"InvalidPDFException")}}class no extends Ss{constructor(t){super(t,"MissingPDFException")}}class lp extends Ss{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class fR extends Ss{constructor(t){super(t,"FormatError")}}class io extends Ss{constructor(t){super(t,"AbortException")}}function hb(s){(typeof s!="object"||(s==null?void 0:s.length)===void 0)&&Dt("Invalid argument for bytesToString");const t=s.length,e=8192;if(t<e)return String.fromCharCode.apply(null,s);const n=[];for(let i=0;i<t;i+=e){const r=Math.min(i+e,t),o=s.subarray(i,r);n.push(String.fromCharCode.apply(null,o))}return n.join("")}function cp(s){typeof s!="string"&&Dt("Invalid argument for stringToBytes");const t=s.length,e=new Uint8Array(t);for(let n=0;n<t;++n)e[n]=s.charCodeAt(n)&255;return e}function pR(s){return String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,s&255)}function l0(s){const t=Object.create(null);for(const[e,n]of s)t[e]=n;return t}function gR(){const s=new Uint8Array(4);return s[0]=1,new Uint32Array(s.buffer,0,1)[0]===1}function mR(){try{return new Function(""),!0}catch{return!1}}class ze{static get isLittleEndian(){return Tt(this,"isLittleEndian",gR())}static get isEvalSupported(){return Tt(this,"isEvalSupported",mR())}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 Yp=Array.from(Array(256).keys(),s=>s.toString(16).padStart(2,"0"));var _o,_u,Al,Sg;class tt{static makeHexColor(t,e,n){return`#${Yp[t]}${Yp[e]}${Yp[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],i=t[0]*e[1]+t[1]*e[3]+e[5];return[n,i]}static applyInverseTransform(t,e){const n=e[0]*e[3]-e[1]*e[2],i=(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[i,r]}static getAxialAlignedBoundingBox(t,e){const n=this.applyTransform(t,e),i=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],i[0],r[0],o[0]),Math.min(n[1],i[1],r[1],o[1]),Math.max(n[0],i[0],r[0],o[0]),Math.max(n[1],i[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],i=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],l=(n+o)/2,c=Math.sqrt((n+o)**2-4*(n*o-r*i))/2,u=l+c||1,h=l-c||1;return[Math.sqrt(u),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])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(n>i)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,i,o]}static bezierBoundingBox(t,e,n,i,r,o,l,c,u){return u?(u[0]=Math.min(u[0],t,l),u[1]=Math.min(u[1],e,c),u[2]=Math.max(u[2],t,l),u[3]=Math.max(u[3],e,c)):u=[Math.min(t,l),Math.min(e,c),Math.max(t,l),Math.max(e,c)],A(this,Al,Sg).call(this,t,n,r,l,e,i,o,c,3*(-t+3*(n-r)+l),6*(t-2*n+r),3*(n-t),u),A(this,Al,Sg).call(this,t,n,r,l,e,i,o,c,3*(-e+3*(i-o)+c),6*(e-2*i+o),3*(i-e),u),u}}_o=new WeakSet,_u=function(t,e,n,i,r,o,l,c,u,h){if(u<=0||u>=1)return;const f=1-u,g=u*u,v=g*u,y=f*(f*(f*t+3*u*e)+3*g*n)+v*i,E=f*(f*(f*r+3*u*o)+3*g*l)+v*c;h[0]=Math.min(h[0],y),h[1]=Math.min(h[1],E),h[2]=Math.max(h[2],y),h[3]=Math.max(h[3],E)},Al=new WeakSet,Sg=function(t,e,n,i,r,o,l,c,u,h,f,g){if(Math.abs(u)<1e-12){Math.abs(h)>=1e-12&&A(this,_o,_u).call(this,t,e,n,i,r,o,l,c,-f/h,g);return}const v=h**2-4*f*u;if(v<0)return;const y=Math.sqrt(v),E=2*u;A(this,_o,_u).call(this,t,e,n,i,r,o,l,c,(-h+y)/E,g),A(this,_o,_u).call(this,t,e,n,i,r,o,l,c,(-h-y)/E,g)},m(tt,_o),m(tt,Al);function vR(s){return decodeURIComponent(escape(s))}let Kp=null,hv=null;function yR(s){return Kp||(Kp=/([\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,hv=new Map([["ſt","ſt"]])),s.replaceAll(Kp,(t,e,n)=>e?e.normalize("NFKC"):hv.get(n))}function bR(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const s=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(s);else for(let t=0;t<32;t++)s[t]=Math.floor(Math.random()*255);return hb(s)}const ub="pdfjs_internal_id_",ei={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 hp{constructor(){this.constructor===hp&&Dt("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,n,i,r){return"none"}destroy(t=!1){}}class up{constructor(){this.constructor===up&&Dt("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){Dt("Abstract method `_createCanvas` called.")}}class dp{constructor({baseUrl:t=null,isCompressed:e=!0}){this.constructor===dp&&Dt("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?Eg.BINARY:Eg.NONE;return this._fetchData(e,n).catch(i=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}_fetchData(t,e){Dt("Abstract method `_fetchData` called.")}}class fp{constructor({baseUrl:t=null}){this.constructor===fp&&Dt("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){Dt("Abstract method `_fetchData` called.")}}class c0{constructor(){this.constructor===c0&&Dt("Cannot initialize BaseSVGFactory.")}create(t,e,n=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),n||(i.setAttribute("width",`${t}px`),i.setAttribute("height",`${e}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${t} ${e}`),i}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){Dt("Abstract method `_createSVG` called.")}}const ii="http://www.w3.org/2000/svg",Fs=class Fs{};dt(Fs,"CSS",96),dt(Fs,"PDF",72),dt(Fs,"PDF_TO_CSS_UNITS",Fs.CSS/Fs.PDF);let Es=Fs;var Ns,kn,ci,Be,hd,Bs,ue,xe,Ki,lo,Zi,co,xo,xu,ud,db,El,Cg,Ji,ho,$s,Qa,js,tl,_l,Tg,Us,el;class wR extends hp{constructor({docId:e,ownerDocument:n=globalThis.document}={}){super();m(this,ue);m(this,Ki);m(this,Zi);m(this,xo);m(this,ud);m(this,El);m(this,Ji);m(this,$s);m(this,js);m(this,_l);m(this,Us);m(this,Ns,void 0);m(this,kn,void 0);m(this,ci,void 0);m(this,Be,void 0);m(this,hd,void 0);m(this,Bs,0);w(this,ci,e),w(this,Be,n)}addFilter(e){if(!e)return"none";let n=a(this,ue,xe).get(e);if(n)return n;const[i,r,o]=A(this,xo,xu).call(this,e),l=e.length===1?i:`${i}${r}${o}`;if(n=a(this,ue,xe).get(l),n)return a(this,ue,xe).set(e,n),n;const c=`g_${a(this,ci)}_transfer_map_${Ge(this,Bs)._++}`,u=`url(#${c})`;a(this,ue,xe).set(e,u),a(this,ue,xe).set(l,u);const h=A(this,Ji,ho).call(this,c);return A(this,js,tl).call(this,i,r,o,h),u}addHCMFilter(e,n){var y;const i=`${e}-${n}`,r="base";let o=a(this,Ki,lo).get(r);if((o==null?void 0:o.key)===i||(o?((y=o.filter)==null||y.remove(),o.key=i,o.url="none",o.filter=null):(o={key:i,url:"none",filter:null},a(this,Ki,lo).set(r,o)),!e||!n))return o.url;const l=A(this,Us,el).call(this,e);e=tt.makeHexColor(...l);const c=A(this,Us,el).call(this,n);if(n=tt.makeHexColor(...c),a(this,Zi,co).style.color="",e==="#000000"&&n==="#ffffff"||e===n)return o.url;const u=new Array(256);for(let E=0;E<=255;E++){const S=E/255;u[E]=S<=.03928?S/12.92:((S+.055)/1.055)**2.4}const h=u.join(","),f=`g_${a(this,ci)}_hcm_filter`,g=o.filter=A(this,Ji,ho).call(this,f);A(this,js,tl).call(this,h,h,h,g),A(this,El,Cg).call(this,g);const v=(E,S)=>{const _=l[E]/255,P=c[E]/255,L=new Array(S+1);for(let k=0;k<=S;k++)L[k]=_+k/S*(P-_);return L.join(",")};return A(this,js,tl).call(this,v(0,5),v(1,5),v(2,5),g),o.url=`url(#${f})`,o.url}addAlphaFilter(e){let n=a(this,ue,xe).get(e);if(n)return n;const[i]=A(this,xo,xu).call(this,[e]),r=`alpha_${i}`;if(n=a(this,ue,xe).get(r),n)return a(this,ue,xe).set(e,n),n;const o=`g_${a(this,ci)}_alpha_map_${Ge(this,Bs)._++}`,l=`url(#${o})`;a(this,ue,xe).set(e,l),a(this,ue,xe).set(r,l);const c=A(this,Ji,ho).call(this,o);return A(this,_l,Tg).call(this,i,c),l}addLuminosityFilter(e){let n=a(this,ue,xe).get(e||"luminosity");if(n)return n;let i,r;if(e?([i]=A(this,xo,xu).call(this,[e]),r=`luminosity_${i}`):r="luminosity",n=a(this,ue,xe).get(r),n)return a(this,ue,xe).set(e,n),n;const o=`g_${a(this,ci)}_luminosity_map_${Ge(this,Bs)._++}`,l=`url(#${o})`;a(this,ue,xe).set(e,l),a(this,ue,xe).set(r,l);const c=A(this,Ji,ho).call(this,o);return A(this,ud,db).call(this,c),e&&A(this,_l,Tg).call(this,i,c),l}addHighlightHCMFilter(e,n,i,r,o){var P;const l=`${n}-${i}-${r}-${o}`;let c=a(this,Ki,lo).get(e);if((c==null?void 0:c.key)===l||(c?((P=c.filter)==null||P.remove(),c.key=l,c.url="none",c.filter=null):(c={key:l,url:"none",filter:null},a(this,Ki,lo).set(e,c)),!n||!i))return c.url;const[u,h]=[n,i].map(A(this,Us,el).bind(this));let f=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),g=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[v,y]=[r,o].map(A(this,Us,el).bind(this));g<f&&([f,g,v,y]=[g,f,y,v]),a(this,Zi,co).style.color="";const E=(L,k,F)=>{const I=new Array(256),M=(g-f)/F,C=L/255,T=(k-L)/(255*F);let N=0;for(let D=0;D<=F;D++){const H=Math.round(f+D*M),z=C+D*T;for(let G=N;G<=H;G++)I[G]=z;N=H+1}for(let D=N;D<256;D++)I[D]=I[N-1];return I.join(",")},S=`g_${a(this,ci)}_hcm_${e}_filter`,_=c.filter=A(this,Ji,ho).call(this,S);return A(this,El,Cg).call(this,_),A(this,js,tl).call(this,E(v[0],y[0],5),E(v[1],y[1],5),E(v[2],y[2],5),_),c.url=`url(#${S})`,c.url}destroy(e=!1){e&&a(this,Ki,lo).size!==0||(a(this,kn)&&(a(this,kn).parentNode.parentNode.remove(),w(this,kn,null)),a(this,Ns)&&(a(this,Ns).clear(),w(this,Ns,null)),w(this,Bs,0))}}Ns=new WeakMap,kn=new WeakMap,ci=new WeakMap,Be=new WeakMap,hd=new WeakMap,Bs=new WeakMap,ue=new WeakSet,xe=function(){return a(this,Ns)||w(this,Ns,new Map)},Ki=new WeakSet,lo=function(){return a(this,hd)||w(this,hd,new Map)},Zi=new WeakSet,co=function(){if(!a(this,kn)){const e=a(this,Be).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 i=a(this,Be).createElementNS(ii,"svg");i.setAttribute("width",0),i.setAttribute("height",0),w(this,kn,a(this,Be).createElementNS(ii,"defs")),e.append(i),i.append(a(this,kn)),a(this,Be).body.append(e)}return a(this,kn)},xo=new WeakSet,xu=function(e){if(e.length===1){const u=e[0],h=new Array(256);for(let g=0;g<256;g++)h[g]=u[g]/255;const f=h.join(",");return[f,f,f]}const[n,i,r]=e,o=new Array(256),l=new Array(256),c=new Array(256);for(let u=0;u<256;u++)o[u]=n[u]/255,l[u]=i[u]/255,c[u]=r[u]/255;return[o.join(","),l.join(","),c.join(",")]},ud=new WeakSet,db=function(e){const n=a(this,Be).createElementNS(ii,"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,Cg=function(e){const n=a(this,Be).createElementNS(ii,"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)},Ji=new WeakSet,ho=function(e){const n=a(this,Be).createElementNS(ii,"filter");return n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("id",e),a(this,Zi,co).append(n),n},$s=new WeakSet,Qa=function(e,n,i){const r=a(this,Be).createElementNS(ii,n);r.setAttribute("type","discrete"),r.setAttribute("tableValues",i),e.append(r)},js=new WeakSet,tl=function(e,n,i,r){const o=a(this,Be).createElementNS(ii,"feComponentTransfer");r.append(o),A(this,$s,Qa).call(this,o,"feFuncR",e),A(this,$s,Qa).call(this,o,"feFuncG",n),A(this,$s,Qa).call(this,o,"feFuncB",i)},_l=new WeakSet,Tg=function(e,n){const i=a(this,Be).createElementNS(ii,"feComponentTransfer");n.append(i),A(this,$s,Qa).call(this,i,"feFuncA",e)},Us=new WeakSet,el=function(e){return a(this,Zi,co).style.color=e,p0(getComputedStyle(a(this,Zi,co)).getPropertyValue("color"))};class AR extends up{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 pp(s,t="text"){if(nl(s,document.baseURI)){const e=await fetch(s);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 i=new XMLHttpRequest;i.open("GET",s,!0),i.responseType=t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case"arraybuffer":case"blob":case"json":e(i.response);return}e(i.responseText);return}n(new Error(i.statusText))}},i.send(null)})}class fb extends dp{_fetchData(t,e){return pp(t,this.isCompressed?"arraybuffer":"text").then(n=>({cMapData:n instanceof ArrayBuffer?new Uint8Array(n):cp(n),compressionType:e}))}}class pb extends fp{_fetchData(t){return pp(t,"arraybuffer").then(e=>new Uint8Array(e))}}class h0 extends c0{_createSVG(t){return document.createElementNS(ii,t)}}class qh{constructor({viewBox:t,scale:e,rotation:n,offsetX:i=0,offsetY:r=0,dontFlip:o=!1}){this.viewBox=t,this.scale=e,this.rotation=n,this.offsetX=i,this.offsetY=r;const l=(t[2]+t[0])/2,c=(t[3]+t[1])/2;let u,h,f,g;switch(n%=360,n<0&&(n+=360),n){case 180:u=-1,h=0,f=0,g=1;break;case 90:u=0,h=1,f=1,g=0;break;case 270:u=0,h=-1,f=-1,g=0;break;case 0:u=1,h=0,f=0,g=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(f=-f,g=-g);let v,y,E,S;u===0?(v=Math.abs(c-t[1])*e+i,y=Math.abs(l-t[0])*e+r,E=(t[3]-t[1])*e,S=(t[2]-t[0])*e):(v=Math.abs(l-t[0])*e+i,y=Math.abs(c-t[1])*e+r,E=(t[2]-t[0])*e,S=(t[3]-t[1])*e),this.transform=[u*e,h*e,f*e,g*e,v-u*e*l-f*e*c,y-h*e*l-g*e*c],this.width=E,this.height=S}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:i=this.offsetY,dontFlip:r=!1}={}){return new qh({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:n,offsetY:i,dontFlip:r})}convertToViewportPoint(t,e){return tt.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=tt.applyTransform([t[0],t[1]],this.transform),n=tt.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],n[0],n[1]]}convertToPdfPoint(t,e){return tt.applyInverseTransform([t,e],this.transform)}}class u0 extends Ss{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function d0(s){const t=s.length;let e=0;for(;e<t&&s[e].trim()==="";)e++;return s.substring(e,e+5).toLowerCase()==="data:"}function f0(s){return typeof s=="string"&&/\.pdf$/i.test(s)}function ER(s){return[s]=s.split(/[#?]/,1),s.substring(s.lastIndexOf("/")+1)}function _R(s,t="document.pdf"){if(typeof s!="string")return t;if(d0(s))return yt('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const e=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,n=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,i=e.exec(s);let r=n.exec(i[1])||n.exec(i[2])||n.exec(i[3]);if(r&&(r=r[0],r.includes("%")))try{r=n.exec(decodeURIComponent(r))[0]}catch{}return r||t}class uv{constructor(){dt(this,"started",Object.create(null));dt(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:i,end:r}of this.times)t.push(`${n.padEnd(e)} ${r-i}ms
`);return t.join("")}}function nl(s,t){try{const{protocol:e}=t?new URL(s,t):new URL(s);return e==="http:"||e==="https:"}catch{return!1}}function Ve(s){s.preventDefault()}function gb(s){console.log("Deprecated API usage: "+s)}let dv;class mb{static toDateObject(t){if(!t||typeof t!="string")return null;dv||(dv=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=dv.exec(t);if(!e)return null;const n=parseInt(e[1],10);let i=parseInt(e[2],10);i=i>=1&&i<=12?i-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 l=parseInt(e[5],10);l=l>=0&&l<=59?l:0;let c=parseInt(e[6],10);c=c>=0&&c<=59?c:0;const u=e[7]||"Z";let h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let f=parseInt(e[9],10)||0;return f=f>=0&&f<=59?f:0,u==="-"?(o+=h,l+=f):u==="+"&&(o-=h,l-=f),new Date(Date.UTC(n,i,r,o,l,c))}}function xR(s,{scale:t=1,rotation:e=0}){const{width:n,height:i}=s.attributes.style,r=[0,0,parseInt(n),parseInt(i)];return new qh({viewBox:r,scale:t,rotation:e})}function p0(s){if(s.startsWith("#")){const t=parseInt(s.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return s.startsWith("rgb(")?s.slice(4,-1).split(",").map(t=>parseInt(t)):s.startsWith("rgba(")?s.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(yt(`Not a valid color format: "${s}"`),[0,0,0])}function SR(s){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const e of s.keys()){t.style.color=e;const n=window.getComputedStyle(t).color;s.set(e,p0(n))}t.remove()}function Vt(s){const{a:t,b:e,c:n,d:i,e:r,f:o}=s.getTransform();return[t,e,n,i,r,o]}function ni(s){const{a:t,b:e,c:n,d:i,e:r,f:o}=s.getTransform().invertSelf();return[t,e,n,i,r,o]}function Yr(s,t,e=!1,n=!0){if(t instanceof qh){const{pageWidth:i,pageHeight:r}=t.rawDims,{style:o}=s,l=ze.isCSSRoundSupported,c=`var(--scale-factor) * ${i}px`,u=`var(--scale-factor) * ${r}px`,h=l?`round(${c}, 1px)`:`calc(${c})`,f=l?`round(${u}, 1px)`:`calc(${u})`;!e||t.rotation%180===0?(o.width=h,o.height=f):(o.width=f,o.height=h)}n&&s.setAttribute("data-main-rotation",t.rotation)}var Hs,zs,In,Vs,dd,vb,fd,yb,pd,bb,So,Su,gd,wb,xl,Rg;const md=class md{constructor(t){m(this,fd);m(this,pd);m(this,So);m(this,gd);m(this,xl);m(this,Hs,null);m(this,zs,null);m(this,In,void 0);m(this,Vs,null);w(this,In,t)}render(){const t=w(this,Hs,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",Ve),t.addEventListener("pointerdown",A(md,dd,vb));const e=w(this,Vs,document.createElement("div"));e.className="buttons",t.append(e);const n=a(this,In).toolbarPosition;if(n){const{style:i}=t,r=a(this,In)._uiManager.direction==="ltr"?1-n[0]:n[0];i.insetInlineEnd=`${100*r}%`,i.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return A(this,gd,wb).call(this),t}hide(){var t;a(this,Hs).classList.add("hidden"),(t=a(this,zs))==null||t.hideDropdown()}show(){a(this,Hs).classList.remove("hidden")}addAltTextButton(t){A(this,So,Su).call(this,t),a(this,Vs).prepend(t,a(this,xl,Rg))}addColorPicker(t){w(this,zs,t);const e=t.renderButton();A(this,So,Su).call(this,e),a(this,Vs).prepend(e,a(this,xl,Rg))}remove(){var t;a(this,Hs).remove(),(t=a(this,zs))==null||t.destroy(),w(this,zs,null)}};Hs=new WeakMap,zs=new WeakMap,In=new WeakMap,Vs=new WeakMap,dd=new WeakSet,vb=function(t){t.stopPropagation()},fd=new WeakSet,yb=function(t){a(this,In)._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()},pd=new WeakSet,bb=function(t){a(this,In)._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()},So=new WeakSet,Su=function(t){t.addEventListener("focusin",A(this,fd,yb).bind(this),{capture:!0}),t.addEventListener("focusout",A(this,pd,bb).bind(this),{capture:!0}),t.addEventListener("contextmenu",Ve)},gd=new WeakSet,wb=function(){const t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",`pdfjs-editor-remove-${a(this,In).editorType}-button`),A(this,So,Su).call(this,t),t.addEventListener("click",e=>{a(this,In)._uiManager.delete()}),a(this,Vs).append(t)},xl=new WeakSet,Rg=function(){const t=document.createElement("div");return t.className="divider",t},m(md,dd);let Pg=md;var Sl,Gs,Cl,vd,Ab,yd,Eb,bd,_b;class CR{constructor(t){m(this,vd);m(this,yd);m(this,bd);m(this,Sl,null);m(this,Gs,null);m(this,Cl,void 0);w(this,Cl,t)}show(t,e,n){const[i,r]=A(this,yd,Eb).call(this,e,n),{style:o}=a(this,Gs)||w(this,Gs,A(this,vd,Ab).call(this));t.append(a(this,Gs)),o.insetInlineEnd=`${100*i}%`,o.top=`calc(${100*r}% + var(--editor-toolbar-vert-offset))`}hide(){a(this,Gs).remove()}}Sl=new WeakMap,Gs=new WeakMap,Cl=new WeakMap,vd=new WeakSet,Ab=function(){const t=w(this,Gs,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",Ve);const e=w(this,Sl,document.createElement("div"));return e.className="buttons",t.append(e),A(this,bd,_b).call(this),t},yd=new WeakSet,Eb=function(t,e){let n=0,i=0;for(const r of t){const o=r.y+r.height;if(o<n)continue;const l=r.x+(e?r.width:0);if(o>n){i=l,n=o;continue}e?l>i&&(i=l):l<i&&(i=l)}return[e?1-i:i,n]},bd=new WeakSet,_b=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",Ve),t.addEventListener("click",()=>{a(this,Cl).highlightSelection("floating_button")}),a(this,Sl).append(t)};function nd(s,t,e){for(const n of e)t.addEventListener(n,s[n].bind(s))}function TR(s){return Math.round(Math.min(255,Math.max(1,255*s))).toString(16).padStart(2,"0")}var wd;class PR{constructor(){m(this,wd,0)}get id(){return`${oR}${Ge(this,wd)._++}`}}wd=new WeakMap;var Tl,Ad,on,Pl,kg;const b0=class b0{constructor(){m(this,Pl);m(this,Tl,bR());m(this,Ad,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"),i=new Image;i.src=t;const r=i.decode().then(()=>(n.drawImage(i,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:i,type:r}=t;return A(this,Pl,kg).call(this,`${e}_${n}_${i}_${r}`,t)}async getFromUrl(t){return A(this,Pl,kg).call(this,t,t)}async getFromId(t){a(this,on)||w(this,on,new Map);const e=a(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=a(this,on).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){a(this,on)||w(this,on,new Map);const e=a(this,on).get(t);e&&(e.refCounter-=1,e.refCounter===0&&(e.bitmap=null))}isValidId(t){return t.startsWith(`image_${a(this,Tl)}_`)}};Tl=new WeakMap,Ad=new WeakMap,on=new WeakMap,Pl=new WeakSet,kg=async function(t,e){a(this,on)||w(this,on,new Map);let n=a(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_${a(this,Tl)}_${Ge(this,Ad)._++}`,refCounter:0,isSvg:!1});let i;if(typeof e=="string"?(n.url=e,i=await pp(e,"blob")):i=n.file=e,i.type==="image/svg+xml"){const r=b0._isSVGFittingCanvas,o=new FileReader,l=new Image,c=new Promise((u,h)=>{l.onload=()=>{n.bitmap=l,n.isSvg=!0,u()},o.onload=async()=>{const f=n.svgUrl=o.result;l.src=await r?`${f}#svgView(preserveAspectRatio(none))`:f},l.onerror=o.onerror=h});o.readAsDataURL(i),await c}else n.bitmap=await createImageBitmap(i);n.refCounter=1}catch(i){console.error(i),n=null}return a(this,on).set(t,n),n&&a(this,on).set(n.id,n),n};let Lg=b0;var de,Qi,Rl,fe;class RR{constructor(t=128){m(this,de,[]);m(this,Qi,!1);m(this,Rl,void 0);m(this,fe,-1);w(this,Rl,t)}add({cmd:t,undo:e,post:n,mustExec:i,type:r=NaN,overwriteIfSameType:o=!1,keepUndo:l=!1}){if(i&&t(),a(this,Qi))return;const c={cmd:t,undo:e,post:n,type:r};if(a(this,fe)===-1){a(this,de).length>0&&(a(this,de).length=0),w(this,fe,0),a(this,de).push(c);return}if(o&&a(this,de)[a(this,fe)].type===r){l&&(c.undo=a(this,de)[a(this,fe)].undo),a(this,de)[a(this,fe)]=c;return}const u=a(this,fe)+1;u===a(this,Rl)?a(this,de).splice(0,1):(w(this,fe,u),u<a(this,de).length&&a(this,de).splice(u)),a(this,de).push(c)}undo(){if(a(this,fe)===-1)return;w(this,Qi,!0);const{undo:t,post:e}=a(this,de)[a(this,fe)];t(),e==null||e(),w(this,Qi,!1),w(this,fe,a(this,fe)-1)}redo(){if(a(this,fe)<a(this,de).length-1){w(this,fe,a(this,fe)+1),w(this,Qi,!0);const{cmd:t,post:e}=a(this,de)[a(this,fe)];t(),e==null||e(),w(this,Qi,!1)}}hasSomethingToUndo(){return a(this,fe)!==-1}hasSomethingToRedo(){return a(this,fe)<a(this,de).length-1}destroy(){w(this,de,null)}}de=new WeakMap,Qi=new WeakMap,Rl=new WeakMap,fe=new WeakMap;var Ed,xb;class Xh{constructor(t){m(this,Ed);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=ze.platform;for(const[n,i,r={}]of t)for(const o of n){const l=o.startsWith("mac+");e&&l?(this.callbacks.set(o.slice(4),{callback:i,options:r}),this.allKeys.add(o.split("+").at(-1))):!e&&!l&&(this.callbacks.set(o,{callback:i,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,Ed,xb).call(this,e));if(!n)return;const{callback:i,options:{bubbles:r=!1,args:o=[],checker:l=null}}=n;l&&!l(t,e)||(i.bind(t,...o,e)(),r||(e.stopPropagation(),e.preventDefault()))}}Ed=new WeakSet,xb=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 _d=class _d{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return SR(t),Tt(this,"_colors",t)}convert(t){const e=p0(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[n,i]of this._colors)if(i.every((r,o)=>r===e[o]))return _d._colorsMapping.get(n);return e}getHexCode(t){const e=this._colors.get(t);return e?tt.makeHexColor(...e):t}};dt(_d,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let Ig=_d;var Xe,ie,me,Co,hi,To,pn,Po,Ws,Fn,ui,qs,Ll,kl,Mn,Ro,ts,Dn,xd,es,Il,Xs,Fl,Lo,ve,It,di,Ys,Ml,Dl,Ol,Nl,Bl,$l,jl,Ul,Hl,zl,Vl,Gl,Wl,ql,ns,On,fi,Xl,ko,Cu,Sd,Sb,Cd,Cb,Io,Tu,Td,Tb,Pd,Pb,Rd,Rb,Yl,Fg,Kl,Mg,Zl,Dg,Jl,Og,Ql,Ng,ye,ke,Nn,Gi,Ld,Lb,kd,kb,tc,Bg,Id,Ib,Ks,il,ec,$g;const vo=class vo{constructor(t,e,n,i,r,o,l,c,u){m(this,ko);m(this,Sd);m(this,Cd);m(this,Io);m(this,Td);m(this,Pd);m(this,Rd);m(this,Yl);m(this,Kl);m(this,Zl);m(this,Jl);m(this,Ql);m(this,ye);m(this,Nn);m(this,Ld);m(this,kd);m(this,tc);m(this,Id);m(this,Ks);m(this,ec);m(this,Xe,null);m(this,ie,new Map);m(this,me,new Map);m(this,Co,null);m(this,hi,null);m(this,To,null);m(this,pn,new RR);m(this,Po,0);m(this,Ws,new Set);m(this,Fn,null);m(this,ui,null);m(this,qs,new Set);m(this,Ll,!1);m(this,kl,null);m(this,Mn,null);m(this,Ro,null);m(this,ts,!1);m(this,Dn,null);m(this,xd,new PR);m(this,es,!1);m(this,Il,!1);m(this,Xs,null);m(this,Fl,null);m(this,Lo,null);m(this,ve,xt.NONE);m(this,It,new Set);m(this,di,null);m(this,Ys,null);m(this,Ml,null);m(this,Dl,this.blur.bind(this));m(this,Ol,this.focus.bind(this));m(this,Nl,this.copy.bind(this));m(this,Bl,this.cut.bind(this));m(this,$l,this.paste.bind(this));m(this,jl,this.keydown.bind(this));m(this,Ul,this.keyup.bind(this));m(this,Hl,this.onEditingAction.bind(this));m(this,zl,this.onPageChanging.bind(this));m(this,Vl,this.onScaleChanging.bind(this));m(this,Gl,A(this,Cd,Cb).bind(this));m(this,Wl,this.onRotationChanging.bind(this));m(this,ql,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});m(this,ns,[0,0]);m(this,On,null);m(this,fi,null);m(this,Xl,null);w(this,fi,t),w(this,Xl,e),w(this,Co,n),this._eventBus=i,this._eventBus._on("editingaction",a(this,Hl)),this._eventBus._on("pagechanging",a(this,zl)),this._eventBus._on("scalechanging",a(this,Vl)),this._eventBus._on("rotationchanging",a(this,Wl)),A(this,Td,Tb).call(this),A(this,Kl,Mg).call(this),w(this,hi,r.annotationStorage),w(this,kl,r.filterFactory),w(this,Ys,o),w(this,Ro,l||null),w(this,Ll,c),w(this,Lo,u||null),this.viewParameters={realScale:Es.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const t=vo.prototype,e=o=>a(o,fi).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&o.hasSomethingToControl(),n=(o,{target:l})=>{if(l instanceof HTMLInputElement){const{type:c}=l;return c!=="text"&&c!=="number"}return!0},i=this.TRANSLATE_SMALL,r=this.TRANSLATE_BIG;return Tt(this,"_keyboardManager",new Xh([[["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:l})=>!(l instanceof HTMLButtonElement)&&a(o,fi).contains(l)&&!o.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&a(o,fi).contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-r,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[r,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-r],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,r],checker:e}]]))}destroy(){var t,e;A(this,Zl,Dg).call(this),A(this,Yl,Fg).call(this),this._eventBus._off("editingaction",a(this,Hl)),this._eventBus._off("pagechanging",a(this,zl)),this._eventBus._off("scalechanging",a(this,Vl)),this._eventBus._off("rotationchanging",a(this,Wl));for(const n of a(this,me).values())n.destroy();a(this,me).clear(),a(this,ie).clear(),a(this,qs).clear(),w(this,Xe,null),a(this,It).clear(),a(this,pn).destroy(),(t=a(this,Co))==null||t.destroy(),(e=a(this,Dn))==null||e.hide(),w(this,Dn,null),a(this,Mn)&&(clearTimeout(a(this,Mn)),w(this,Mn,null)),a(this,On)&&(clearTimeout(a(this,On)),w(this,On,null)),A(this,Pd,Pb).call(this)}async mlGuess(t){var e;return((e=a(this,Lo))==null?void 0:e.guess(t))||null}get hasMLManager(){return!!a(this,Lo)}get hcmFilter(){return Tt(this,"hcmFilter",a(this,Ys)?a(this,kl).addHCMFilter(a(this,Ys).foreground,a(this,Ys).background):"none")}get direction(){return Tt(this,"direction",getComputedStyle(a(this,fi)).direction)}get highlightColors(){return Tt(this,"highlightColors",a(this,Ro)?new Map(a(this,Ro).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=a(this,Co))==null||e.editAltText(this,t)}onPageChanging({pageNumber:t}){w(this,Po,t-1)}focusMainContainer(){a(this,fi).focus()}findParent(t,e){for(const n of a(this,me).values()){const{x:i,y:r,width:o,height:l}=n.div.getBoundingClientRect();if(t>=i&&t<=i+o&&e>=r&&e<=r+l)return n}return null}disableUserSelect(t=!1){a(this,Xl).classList.toggle("noUserSelect",t)}addShouldRescale(t){a(this,qs).add(t)}removeShouldRescale(t){a(this,qs).delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*Es.PDF_TO_CSS_UNITS;for(const e of a(this,qs))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:i,focusNode:r,focusOffset:o}=e,l=e.toString(),u=A(this,ko,Cu).call(this,e).closest(".textLayer"),h=this.getSelectionBoxes(u);if(h){e.empty(),a(this,ve)===xt.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:xt.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const f of a(this,me).values())if(f.hasTextLayer(u)){f.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:o,text:l});break}}}addToAnnotationStorage(t){!t.isEmpty()&&a(this,hi)&&!a(this,hi).has(t.id)&&a(this,hi).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,a(this,ts)&&(w(this,ts,!1),A(this,Io,Tu).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of a(this,It))if(e.div.contains(t)){w(this,Xs,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!a(this,Xs))return;const[t,e]=a(this,Xs);w(this,Xs,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0}),e.focus()}addEditListeners(){A(this,Kl,Mg).call(this),A(this,Jl,Og).call(this)}removeEditListeners(){A(this,Zl,Dg).call(this),A(this,Ql,Ng).call(this)}copy(t){var n;if(t.preventDefault(),(n=a(this,Xe))==null||n.commitOrRemove(),!this.hasSelection)return;const e=[];for(const i of a(this,It)){const r=i.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 a(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 i=this.currentLayer;try{const r=[];for(const c of n){const u=i.deserialize(c);if(!u)return;r.push(u)}const o=()=>{for(const c of r)A(this,tc,Bg).call(this,c);A(this,ec,$g).call(this,r)},l=()=>{for(const c of r)c.remove()};this.addCommands({cmd:o,undo:l,mustExec:!0})}catch(r){yt(`paste: "${r.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),a(this,ve)!==xt.NONE&&!this.isEditorHandlingKeyboard&&vo._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,a(this,ts)&&(w(this,ts,!1),A(this,Io,Tu).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,Rd,Rb).call(this),A(this,Jl,Og).call(this),A(this,ye,ke).call(this,{isEditing:a(this,ve)!==xt.NONE,isEmpty:A(this,Ks,il).call(this),hasSomethingToUndo:a(this,pn).hasSomethingToUndo(),hasSomethingToRedo:a(this,pn).hasSomethingToRedo(),hasSelectedEditor:!1})):(A(this,Yl,Fg).call(this),A(this,Ql,Ng).call(this),A(this,ye,ke).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!a(this,ui)){w(this,ui,t);for(const e of a(this,ui))A(this,Nn,Gi).call(this,e.defaultPropertiesToUpdate)}}getId(){return a(this,xd).id}get currentLayer(){return a(this,me).get(a(this,Po))}getLayer(t){return a(this,me).get(t)}get currentPageIndex(){return a(this,Po)}addLayer(t){a(this,me).set(t.pageIndex,t),a(this,es)?t.enable():t.disable()}removeLayer(t){a(this,me).delete(t.pageIndex)}updateMode(t,e=null,n=!1){if(a(this,ve)!==t){if(w(this,ve,t),t===xt.NONE){this.setEditingState(!1),A(this,kd,kb).call(this);return}this.setEditingState(!0),A(this,Ld,Lb).call(this),this.unselectAll();for(const i of a(this,me).values())i.updateMode(t);if(!e&&n){this.addNewEditorFromKeyboard();return}if(e){for(const i of a(this,ie).values())if(i.annotationElementId===e){this.setSelected(i),i.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==a(this,ve)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){var n;if(a(this,ui)){switch(t){case lt.CREATE:this.currentLayer.addNewEditor();return;case lt.HIGHLIGHT_DEFAULT_COLOR:(n=a(this,Fl))==null||n.updateColor(e);break;case lt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(a(this,Ml)||w(this,Ml,new Map)).set(t,e),this.showAllEditors("highlight",e);break}for(const i of a(this,It))i.updateParams(t,e);for(const i of a(this,ui))i.updateDefaultParams(t,e)}}showAllEditors(t,e,n=!1){var r;for(const o of a(this,ie).values())o.editorType===t&&o.show(e);(((r=a(this,Ml))==null?void 0:r.get(lt.HIGHLIGHT_SHOW_ALL))??!0)!==e&&A(this,Nn,Gi).call(this,[[lt.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(a(this,Il)!==t){w(this,Il,t);for(const e of a(this,me).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const n of a(this,ie).values())n.pageIndex===t&&e.push(n);return e}getEditor(t){return a(this,ie).get(t)}addEditor(t){a(this,ie).set(t.id,t)}removeEditor(t){var e;t.div.contains(document.activeElement)&&(a(this,Mn)&&clearTimeout(a(this,Mn)),w(this,Mn,setTimeout(()=>{this.focusMainContainer(),w(this,Mn,null)},0))),a(this,ie).delete(t.id),this.unselect(t),(!t.annotationElementId||!a(this,Ws).has(t.annotationElementId))&&((e=a(this,hi))==null||e.remove(t.id))}addDeletedAnnotationElement(t){a(this,Ws).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return a(this,Ws).has(t)}removeDeletedAnnotationElement(t){a(this,Ws).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){a(this,Xe)!==t&&(w(this,Xe,t),t&&A(this,Nn,Gi).call(this,t.propertiesToUpdate))}updateUI(t){a(this,Id,Ib)===t&&A(this,Nn,Gi).call(this,t.propertiesToUpdate)}toggleSelected(t){if(a(this,It).has(t)){a(this,It).delete(t),t.unselect(),A(this,ye,ke).call(this,{hasSelectedEditor:this.hasSelection});return}a(this,It).add(t),t.select(),A(this,Nn,Gi).call(this,t.propertiesToUpdate),A(this,ye,ke).call(this,{hasSelectedEditor:!0})}setSelected(t){for(const e of a(this,It))e!==t&&e.unselect();a(this,It).clear(),a(this,It).add(t),t.select(),A(this,Nn,Gi).call(this,t.propertiesToUpdate),A(this,ye,ke).call(this,{hasSelectedEditor:!0})}isSelected(t){return a(this,It).has(t)}get firstSelectedEditor(){return a(this,It).values().next().value}unselect(t){t.unselect(),a(this,It).delete(t),A(this,ye,ke).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return a(this,It).size!==0}get isEnterHandled(){return a(this,It).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){a(this,pn).undo(),A(this,ye,ke).call(this,{hasSomethingToUndo:a(this,pn).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:A(this,Ks,il).call(this)})}redo(){a(this,pn).redo(),A(this,ye,ke).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:a(this,pn).hasSomethingToRedo(),isEmpty:A(this,Ks,il).call(this)})}addCommands(t){a(this,pn).add(t),A(this,ye,ke).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:A(this,Ks,il).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...a(this,It)],e=()=>{for(const i of t)i.remove()},n=()=>{for(const i of t)A(this,tc,Bg).call(this,i)};this.addCommands({cmd:e,undo:n,mustExec:!0})}commitOrRemove(){var t;(t=a(this,Xe))==null||t.commitOrRemove()}hasSomethingToControl(){return a(this,Xe)||this.hasSelection}selectAll(){for(const t of a(this,It))t.commit();A(this,ec,$g).call(this,a(this,ie).values())}unselectAll(){if(!(a(this,Xe)&&(a(this,Xe).commitOrRemove(),a(this,ve)!==xt.NONE))&&this.hasSelection){for(const t of a(this,It))t.unselect();a(this,It).clear(),A(this,ye,ke).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;a(this,ns)[0]+=t,a(this,ns)[1]+=e;const[i,r]=a(this,ns),o=[...a(this,It)],l=1e3;a(this,On)&&clearTimeout(a(this,On)),w(this,On,setTimeout(()=>{w(this,On,null),a(this,ns)[0]=a(this,ns)[1]=0,this.addCommands({cmd:()=>{for(const c of o)a(this,ie).has(c.id)&&c.translateInPage(i,r)},undo:()=>{for(const c of o)a(this,ie).has(c.id)&&c.translateInPage(-i,-r)},mustExec:!1})},l));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 a(this,It))a(this,Fn).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!a(this,Fn))return!1;this.disableUserSelect(!1);const t=a(this,Fn);w(this,Fn,null);let e=!1;for(const[{x:i,y:r,pageIndex:o},l]of t)l.newX=i,l.newY=r,l.newPageIndex=o,e||(e=i!==l.savedX||r!==l.savedY||o!==l.savedPageIndex);if(!e)return!1;const n=(i,r,o,l)=>{if(a(this,ie).has(i.id)){const c=a(this,me).get(l);c?i._setParentAndPosition(c,r,o):(i.pageIndex=l,i.x=r,i.y=o)}};return this.addCommands({cmd:()=>{for(const[i,{newX:r,newY:o,newPageIndex:l}]of t)n(i,r,o,l)},undo:()=>{for(const[i,{savedX:r,savedY:o,savedPageIndex:l}]of t)n(i,r,o,l)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(a(this,Fn))for(const n of a(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())||a(this,It).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return a(this,Xe)===t}getActive(){return a(this,Xe)}getMode(){return a(this,ve)}get imageManager(){return Tt(this,"imageManager",new Lg)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let u=0,h=e.rangeCount;u<h;u++)if(!t.contains(e.getRangeAt(u).commonAncestorContainer))return null;const{x:n,y:i,width:r,height:o}=t.getBoundingClientRect();let l;switch(t.getAttribute("data-main-rotation")){case"90":l=(u,h,f,g)=>({x:(h-i)/o,y:1-(u+f-n)/r,width:g/o,height:f/r});break;case"180":l=(u,h,f,g)=>({x:1-(u+f-n)/r,y:1-(h+g-i)/o,width:f/r,height:g/o});break;case"270":l=(u,h,f,g)=>({x:1-(h+g-i)/o,y:(u-n)/r,width:g/o,height:f/r});break;default:l=(u,h,f,g)=>({x:(u-n)/r,y:(h-i)/o,width:f/r,height:g/o});break}const c=[];for(let u=0,h=e.rangeCount;u<h;u++){const f=e.getRangeAt(u);if(!f.collapsed)for(const{x:g,y:v,width:y,height:E}of f.getClientRects())y===0||E===0||c.push(l(g,v,y,E))}return c.length===0?null:c}addChangedExistingAnnotation({annotationElementId:t,id:e}){(a(this,To)||w(this,To,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){var e;(e=a(this,To))==null||e.delete(t)}renderAnnotationElement(t){var i;const e=(i=a(this,To))==null?void 0:i.get(t.data.id);if(!e)return;const n=a(this,hi).getRawValue(e);n&&(a(this,ve)===xt.NONE&&!n.hasBeenModified||n.renderAnnotationElement(t))}};Xe=new WeakMap,ie=new WeakMap,me=new WeakMap,Co=new WeakMap,hi=new WeakMap,To=new WeakMap,pn=new WeakMap,Po=new WeakMap,Ws=new WeakMap,Fn=new WeakMap,ui=new WeakMap,qs=new WeakMap,Ll=new WeakMap,kl=new WeakMap,Mn=new WeakMap,Ro=new WeakMap,ts=new WeakMap,Dn=new WeakMap,xd=new WeakMap,es=new WeakMap,Il=new WeakMap,Xs=new WeakMap,Fl=new WeakMap,Lo=new WeakMap,ve=new WeakMap,It=new WeakMap,di=new WeakMap,Ys=new WeakMap,Ml=new WeakMap,Dl=new WeakMap,Ol=new WeakMap,Nl=new WeakMap,Bl=new WeakMap,$l=new WeakMap,jl=new WeakMap,Ul=new WeakMap,Hl=new WeakMap,zl=new WeakMap,Vl=new WeakMap,Gl=new WeakMap,Wl=new WeakMap,ql=new WeakMap,ns=new WeakMap,On=new WeakMap,fi=new WeakMap,Xl=new WeakMap,ko=new WeakSet,Cu=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},Sd=new WeakSet,Sb=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;const n=A(this,ko,Cu).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(n);i&&(a(this,Dn)||w(this,Dn,new CR(this)),a(this,Dn).show(n,i,this.direction==="ltr"))},Cd=new WeakSet,Cb=function(){var r,o,l;const t=document.getSelection();if(!t||t.isCollapsed){a(this,di)&&((r=a(this,Dn))==null||r.hide(),w(this,di,null),A(this,ye,ke).call(this,{hasSelectedText:!1}));return}const{anchorNode:e}=t;if(e===a(this,di))return;if(!A(this,ko,Cu).call(this,t).closest(".textLayer")){a(this,di)&&((o=a(this,Dn))==null||o.hide(),w(this,di,null),A(this,ye,ke).call(this,{hasSelectedText:!1}));return}if((l=a(this,Dn))==null||l.hide(),w(this,di,e),A(this,ye,ke).call(this,{hasSelectedText:!0}),!(a(this,ve)!==xt.HIGHLIGHT&&a(this,ve)!==xt.NONE)&&(a(this,ve)===xt.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),w(this,ts,this.isShiftKeyDown),!this.isShiftKeyDown)){const c=u=>{u.type==="pointerup"&&u.button!==0||(window.removeEventListener("pointerup",c),window.removeEventListener("blur",c),u.type==="pointerup"&&A(this,Io,Tu).call(this,"main_toolbar"))};window.addEventListener("pointerup",c),window.addEventListener("blur",c)}},Io=new WeakSet,Tu=function(t=""){a(this,ve)===xt.HIGHLIGHT?this.highlightSelection(t):a(this,Ll)&&A(this,Sd,Sb).call(this)},Td=new WeakSet,Tb=function(){document.addEventListener("selectionchange",a(this,Gl))},Pd=new WeakSet,Pb=function(){document.removeEventListener("selectionchange",a(this,Gl))},Rd=new WeakSet,Rb=function(){window.addEventListener("focus",a(this,Ol)),window.addEventListener("blur",a(this,Dl))},Yl=new WeakSet,Fg=function(){window.removeEventListener("focus",a(this,Ol)),window.removeEventListener("blur",a(this,Dl))},Kl=new WeakSet,Mg=function(){window.addEventListener("keydown",a(this,jl)),window.addEventListener("keyup",a(this,Ul))},Zl=new WeakSet,Dg=function(){window.removeEventListener("keydown",a(this,jl)),window.removeEventListener("keyup",a(this,Ul))},Jl=new WeakSet,Og=function(){document.addEventListener("copy",a(this,Nl)),document.addEventListener("cut",a(this,Bl)),document.addEventListener("paste",a(this,$l))},Ql=new WeakSet,Ng=function(){document.removeEventListener("copy",a(this,Nl)),document.removeEventListener("cut",a(this,Bl)),document.removeEventListener("paste",a(this,$l))},ye=new WeakSet,ke=function(t){Object.entries(t).some(([n,i])=>a(this,ql)[n]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(a(this,ql),t)}),a(this,ve)===xt.HIGHLIGHT&&t.hasSelectedEditor===!1&&A(this,Nn,Gi).call(this,[[lt.HIGHLIGHT_FREE,!0]]))},Nn=new WeakSet,Gi=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},Ld=new WeakSet,Lb=function(){if(!a(this,es)){w(this,es,!0);for(const t of a(this,me).values())t.enable();for(const t of a(this,ie).values())t.enable()}},kd=new WeakSet,kb=function(){if(this.unselectAll(),a(this,es)){w(this,es,!1);for(const t of a(this,me).values())t.disable();for(const t of a(this,ie).values())t.disable()}},tc=new WeakSet,Bg=function(t){const e=a(this,me).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},Id=new WeakSet,Ib=function(){let t=null;for(t of a(this,It));return t},Ks=new WeakSet,il=function(){if(a(this,ie).size===0)return!0;if(a(this,ie).size===1)for(const t of a(this,ie).values())return t.isEmpty();return!1},ec=new WeakSet,$g=function(t){for(const e of a(this,It))e.unselect();a(this,It).clear();for(const e of t)e.isEmpty()||(a(this,It).add(e),e.select());A(this,ye,ke).call(this,{hasSelectedEditor:this.hasSelection})},dt(vo,"TRANSLATE_SMALL",1),dt(vo,"TRANSLATE_BIG",10);let Kr=vo;var pi,gi,gn,mi,mn,Fo,vi,nc,jg;const ri=class ri{constructor(t){m(this,nc);m(this,pi,"");m(this,gi,!1);m(this,gn,null);m(this,mi,null);m(this,mn,null);m(this,Fo,!1);m(this,vi,null);w(this,vi,t)}static initialize(t){ri._l10nPromise||(ri._l10nPromise=t)}async render(){const t=w(this,gn,document.createElement("button"));t.className="altText";const e=await ri._l10nPromise.get("pdfjs-editor-alt-text-button-label");t.textContent=e,t.setAttribute("aria-label",e),t.tabIndex="0",t.addEventListener("contextmenu",Ve),t.addEventListener("pointerdown",i=>i.stopPropagation());const n=i=>{i.preventDefault(),a(this,vi)._uiManager.editAltText(a(this,vi))};return t.addEventListener("click",n,{capture:!0}),t.addEventListener("keydown",i=>{i.target===t&&i.key==="Enter"&&(w(this,Fo,!0),n(i))}),await A(this,nc,jg).call(this),t}finish(){a(this,gn)&&(a(this,gn).focus({focusVisible:a(this,Fo)}),w(this,Fo,!1))}isEmpty(){return!a(this,pi)&&!a(this,gi)}get data(){return{altText:a(this,pi),decorative:a(this,gi)}}set data({altText:t,decorative:e}){a(this,pi)===t&&a(this,gi)===e||(w(this,pi,t),w(this,gi,e),A(this,nc,jg).call(this))}toggle(t=!1){a(this,gn)&&(!t&&a(this,mn)&&(clearTimeout(a(this,mn)),w(this,mn,null)),a(this,gn).disabled=!t)}destroy(){var t;(t=a(this,gn))==null||t.remove(),w(this,gn,null),w(this,mi,null)}};pi=new WeakMap,gi=new WeakMap,gn=new WeakMap,mi=new WeakMap,mn=new WeakMap,Fo=new WeakMap,vi=new WeakMap,nc=new WeakSet,jg=async function(){var i;const t=a(this,gn);if(!t)return;if(!a(this,pi)&&!a(this,gi)){t.classList.remove("done"),(i=a(this,mi))==null||i.remove();return}t.classList.add("done"),ri._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(r=>{t.setAttribute("aria-label",r)});let e=a(this,mi);if(!e){w(this,mi,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip");const r=e.id=`alt-text-tooltip-${a(this,vi).id}`;t.setAttribute("aria-describedby",r);const o=100;t.addEventListener("mouseenter",()=>{w(this,mn,setTimeout(()=>{w(this,mn,null),a(this,mi).classList.add("show"),a(this,vi)._reportTelemetry({action:"alt_text_tooltip"})},o))}),t.addEventListener("mouseleave",()=>{var l;a(this,mn)&&(clearTimeout(a(this,mn)),w(this,mn,null)),(l=a(this,mi))==null||l.classList.remove("show")})}e.innerText=a(this,gi)?await ri._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):a(this,pi),e.parentNode||t.append(e);const n=a(this,vi).getImageForAltText();n==null||n.setAttribute("aria-describedby",e.id)},dt(ri,"_l10nPromise",null);let id=ri;var vn,Ie,Mo,Zs,be,Js,Do,Oo,Se,ic,Qs,is,sc,tr,yi,Bn,No,Bo,an,rc,Fd,oc,Ug,ac,Hg,lc,zg,Md,Fb,Dd,Mb,cc,Vg,hc,Gg,uc,Wg,Od,Db,Nd,Ob,Bd,Nb,$d,Bb,dc,qg,er,sl;const Nt=class Nt{constructor(t){m(this,oc);m(this,lc);m(this,Md);m(this,Dd);m(this,cc);m(this,hc);m(this,uc);m(this,Od);m(this,Nd);m(this,Bd);m(this,$d);m(this,dc);m(this,er);m(this,vn,null);m(this,Ie,null);m(this,Mo,!1);m(this,Zs,!1);m(this,be,null);m(this,Js,null);m(this,Do,this.focusin.bind(this));m(this,Oo,this.focusout.bind(this));m(this,Se,null);m(this,ic,"");m(this,Qs,!1);m(this,is,null);m(this,sc,!1);m(this,tr,!1);m(this,yi,!1);m(this,Bn,null);m(this,No,0);m(this,Bo,0);m(this,an,null);dt(this,"_initialOptions",Object.create(null));dt(this,"_isVisible",!0);dt(this,"_uiManager",null);dt(this,"_focusEventsAllowed",!0);dt(this,"_l10nPromise",null);m(this,rc,!1);m(this,Fd,Nt._zIndex++);this.constructor===Nt&&Dt("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:i,pageX:r,pageY:o}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,i],this.pageTranslation=[r,o];const[l,c]=this.parentDimensions;this.x=t.x/l,this.y=t.y/c,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const t=Nt.prototype._resizeWithKeyboard,e=Kr.TRANSLATE_SMALL,n=Kr.TRANSLATE_BIG;return Tt(this,"_resizerKeyboardManager",new Xh([[["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 LR({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 i=getComputedStyle(document.documentElement);Nt._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){Dt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return a(this,rc)}set _isDraggable(t){var e;w(this,rc,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=a(this,Fd)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):A(this,er,sl).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&(a(this,Qs)?w(this,Qs,!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,i){const[r,o]=this.parentDimensions;[n,i]=this.screenToPageTranslation(n,i),this.x=(t+n)/r,this.y=(e+i)/o,this.fixAndSetPosition()}translate(t,e){A(this,oc,Ug).call(this,this.parentDimensions,t,e)}translateInPage(t,e){a(this,is)||w(this,is,[this.x,this.y]),A(this,oc,Ug).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){a(this,is)||w(this,is,[this.x,this.y]);const[n,i]=this.parentDimensions;if(this.x+=t/n,this.y+=e/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:h}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,h)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:r,y:o}=this;const[l,c]=this.getBaseTranslation();r+=l,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!!a(this,is)&&(a(this,is)[0]!==this.x||a(this,is)[1]!==this.y)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:n}=Nt,i=n/t,r=n/e;switch(this.rotation){case 90:return[-i,r];case 180:return[i,r];case 270:return[i,-r];default:return[-i,-r]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const[e,n]=this.pageDimensions;let{x:i,y:r,width:o,height:l}=this;if(o*=e,l*=n,i*=e,r*=n,this._mustFixPosition)switch(t){case 0:i=Math.max(0,Math.min(e-o,i)),r=Math.max(0,Math.min(n-l,r));break;case 90:i=Math.max(0,Math.min(e-l,i)),r=Math.min(n,Math.max(o,r));break;case 180:i=Math.min(e,Math.max(o,i)),r=Math.min(n,Math.max(l,r));break;case 270:i=Math.min(e,Math.max(l,i)),r=Math.max(0,Math.min(n-o,r));break}this.x=i/=e,this.y=r/=n;const[c,u]=this.getBaseTranslation();i+=c,r+=u;const{style:h}=this.div;h.left=`${(100*i).toFixed(2)}%`,h.top=`${(100*r).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var n;return A(n=Nt,ac,Hg).call(n,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var n;return A(n=Nt,ac,Hg).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,i=e*t,r=n*t;return ze.isCSSRoundSupported?[Math.round(i),Math.round(r)]:[i,r]}setDims(t,e){const[n,i]=this.parentDimensions;this.div.style.width=`${(100*t/n).toFixed(2)}%`,a(this,Zs)||(this.div.style.height=`${(100*e/i).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:n}=t,i=n.endsWith("%"),r=!a(this,Zs)&&e.endsWith("%");if(i&&r)return;const[o,l]=this.parentDimensions;i||(t.width=`${(100*parseFloat(n)/o).toFixed(2)}%`),!a(this,Zs)&&!r&&(t.height=`${(100*parseFloat(e)/l).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}altTextFinish(){var t;(t=a(this,Ie))==null||t.finish()}async addEditToolbar(){return a(this,Se)||a(this,tr)?a(this,Se):(w(this,Se,new Pg(this)),this.div.append(a(this,Se).render()),a(this,Ie)&&a(this,Se).addAltTextButton(await a(this,Ie).render()),a(this,Se))}removeEditToolbar(){var t;a(this,Se)&&(a(this,Se).remove(),w(this,Se,null),(t=a(this,Ie))==null||t.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){a(this,Ie)||(id.initialize(Nt._l10nPromise),w(this,Ie,new id(this)),await this.addEditToolbar())}get altTextData(){var t;return(t=a(this,Ie))==null?void 0:t.data}set altTextData(t){a(this,Ie)&&(a(this,Ie).data=t)}hasAltText(){var t;return!((t=a(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=a(this,Mo)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),this.div.addEventListener("focusin",a(this,Do)),this.div.addEventListener("focusout",a(this,Oo));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,i]=this.getInitialTranslation();return this.translate(n,i),nd(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,Qs,!0),this._isDraggable){A(this,Od,Db).call(this,t);return}A(this,uc,Wg).call(this,t)}moveInDOM(){a(this,Bn)&&clearTimeout(a(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 i=this.parentScale,[r,o]=this.pageDimensions,[l,c]=this.pageTranslation,u=t/i,h=e/i,f=this.x*r,g=this.y*o,v=this.width*r,y=this.height*o;switch(n){case 0:return[f+u+l,o-g-h-y+c,f+u+v+l,o-g-h+c];case 90:return[f+h+l,o-g+u+c,f+h+y+l,o-g+u+v+c];case 180:return[f-u-v+l,o-g+h+c,f-u+l,o-g+h+y+c];case 270:return[f-h-y+l,o-g-u-v+c,f-h+l,o-g-u+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[n,i,r,o]=t,l=r-n,c=o-i;switch(this.rotation){case 0:return[n,e-o,l,c];case 90:return[n,e-i,c,l];case 180:return[r,e-i,l,c];case 270:return[r,e-o,c,l];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){w(this,tr,!0)}disableEditMode(){w(this,tr,!1)}isInEditMode(){return a(this,tr)}shouldGetKeyboardEvents(){return a(this,yi)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var t,e;(t=this.div)==null||t.addEventListener("focusin",a(this,Do)),(e=this.div)==null||e.addEventListener("focusout",a(this,Oo))}rotate(t){}serialize(t=!1,e=null){Dt("An editor must be serializable")}static deserialize(t,e,n){const i=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:n});i.rotation=t.rotation;const[r,o]=i.pageDimensions,[l,c,u,h]=i.getRectInCurrentCoords(t.rect,o);return i.x=l/r,i.y=c/o,i.width=u/r,i.height=h/o,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.div.removeEventListener("focusin",a(this,Do)),this.div.removeEventListener("focusout",a(this,Oo)),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),a(this,Bn)&&(clearTimeout(a(this,Bn)),w(this,Bn,null)),A(this,er,sl).call(this),this.removeEditToolbar(),a(this,an)){for(const t of a(this,an).values())clearTimeout(t);w(this,an,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(A(this,Md,Fb).call(this),a(this,be).classList.remove("hidden"),nd(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,Js,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=a(this,be).children;if(!a(this,vn)){w(this,vn,Array.from(e));const o=A(this,Nd,Ob).bind(this),l=A(this,Bd,Nb).bind(this);for(const c of a(this,vn)){const u=c.getAttribute("data-resizer-name");c.setAttribute("role","spinbutton"),c.addEventListener("keydown",o),c.addEventListener("blur",l),c.addEventListener("focus",A(this,$d,Bb).bind(this,u)),Nt._l10nPromise.get(`pdfjs-editor-resizer-label-${u}`).then(h=>c.setAttribute("aria-label",h))}}const n=a(this,vn)[0];let i=0;for(const o of e){if(o===n)break;i++}const r=(360-this.rotation+this.parentRotation)%360/90*(a(this,vn).length/4);if(r!==i){if(r<i)for(let l=0;l<i-r;l++)a(this,be).append(a(this,be).firstChild);else if(r>i)for(let l=0;l<r-i;l++)a(this,be).firstChild.before(a(this,be).lastChild);let o=0;for(const l of e){const u=a(this,vn)[o++].getAttribute("data-resizer-name");Nt._l10nPromise.get(`pdfjs-editor-resizer-label-${u}`).then(h=>l.setAttribute("aria-label",h))}}A(this,dc,qg).call(this,0),w(this,yi,!0),a(this,be).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){a(this,yi)&&A(this,hc,Gg).call(this,a(this,ic),{movementX:t,movementY:e})}_stopResizingWithKeyboard(){A(this,er,sl).call(this),this.div.focus()}select(){var t,e;if(this.makeResizable(),(t=this.div)==null||t.classList.add("selectedEditor"),!a(this,Se)){this.addEditToolbar().then(()=>{var n,i;(n=this.div)!=null&&n.classList.contains("selectedEditor")&&((i=a(this,Se))==null||i.show())});return}(e=a(this,Se))==null||e.show()}unselect(){var t,e,n,i;(t=a(this,be))==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}),(i=a(this,Se))==null||i.hide()}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return a(this,sc)}set isEditing(t){w(this,sc,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){w(this,Zs,!0);const n=t/e,{style:i}=this.div;i.aspectRatio=n,i.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){a(this,an)||w(this,an,new Map);const{action:n}=t;let i=a(this,an).get(n);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),a(this,an).delete(n),a(this,an).size===0&&w(this,an,null)},Nt._telemetryTimeout),a(this,an).set(n,i);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,Mo,!1)}disable(){this.div&&(this.div.tabIndex=-1),w(this,Mo,!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,Mo=new WeakMap,Zs=new WeakMap,be=new WeakMap,Js=new WeakMap,Do=new WeakMap,Oo=new WeakMap,Se=new WeakMap,ic=new WeakMap,Qs=new WeakMap,is=new WeakMap,sc=new WeakMap,tr=new WeakMap,yi=new WeakMap,Bn=new WeakMap,No=new WeakMap,Bo=new WeakMap,an=new WeakMap,rc=new WeakMap,Fd=new WeakMap,oc=new WeakSet,Ug=function([t,e],n,i){[n,i]=this.screenToPageTranslation(n,i),this.x+=n/t,this.y+=i/e,this.fixAndSetPosition()},ac=new WeakSet,Hg=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]}},lc=new WeakSet,zg=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]}},Md=new WeakSet,Fb=function(){if(a(this,be))return;w(this,be,document.createElement("div")),a(this,be).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");a(this,be).append(n),n.classList.add("resizer",e),n.setAttribute("data-resizer-name",e),n.addEventListener("pointerdown",A(this,Dd,Mb).bind(this,e)),n.addEventListener("contextmenu",Ve),n.tabIndex=-1}this.div.prepend(a(this,be))},Dd=new WeakSet,Mb=function(t,e){var y;e.preventDefault();const{isMac:n}=ze.platform;if(e.button!==0||e.ctrlKey&&n)return;(y=a(this,Ie))==null||y.toggle(!1);const i=A(this,hc,Gg).bind(this,t),r=this._isDraggable;this._isDraggable=!1;const o={passive:!0,capture:!0};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",i,o),window.addEventListener("contextmenu",Ve);const l=this.x,c=this.y,u=this.width,h=this.height,f=this.parent.div.style.cursor,g=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const v=()=>{var E;this.parent.togglePointerEvents(!0),(E=a(this,Ie))==null||E.toggle(!0),this._isDraggable=r,window.removeEventListener("pointerup",v),window.removeEventListener("blur",v),window.removeEventListener("pointermove",i,o),window.removeEventListener("contextmenu",Ve),this.parent.div.style.cursor=f,this.div.style.cursor=g,A(this,cc,Vg).call(this,l,c,u,h)};window.addEventListener("pointerup",v),window.addEventListener("blur",v)},cc=new WeakSet,Vg=function(t,e,n,i){const r=this.x,o=this.y,l=this.width,c=this.height;r===t&&o===e&&l===n&&c===i||this.addCommands({cmd:()=>{this.width=l,this.height=c,this.x=r,this.y=o;const[u,h]=this.parentDimensions;this.setDims(u*l,h*c),this.fixAndSetPosition()},undo:()=>{this.width=n,this.height=i,this.x=t,this.y=e;const[u,h]=this.parentDimensions;this.setDims(u*n,h*i),this.fixAndSetPosition()},mustExec:!0})},hc=new WeakSet,Gg=function(t,e){const[n,i]=this.parentDimensions,r=this.x,o=this.y,l=this.width,c=this.height,u=Nt.MIN_SIZE/n,h=Nt.MIN_SIZE/i,f=$=>Math.round($*1e4)/1e4,g=A(this,lc,zg).call(this,this.rotation),v=($,W)=>[g[0]*$+g[2]*W,g[1]*$+g[3]*W],y=A(this,lc,zg).call(this,360-this.rotation),E=($,W)=>[y[0]*$+y[2]*W,y[1]*$+y[3]*W];let S,_,P=!1,L=!1;switch(t){case"topLeft":P=!0,S=($,W)=>[0,0],_=($,W)=>[$,W];break;case"topMiddle":S=($,W)=>[$/2,0],_=($,W)=>[$/2,W];break;case"topRight":P=!0,S=($,W)=>[$,0],_=($,W)=>[0,W];break;case"middleRight":L=!0,S=($,W)=>[$,W/2],_=($,W)=>[0,W/2];break;case"bottomRight":P=!0,S=($,W)=>[$,W],_=($,W)=>[0,0];break;case"bottomMiddle":S=($,W)=>[$/2,W],_=($,W)=>[$/2,0];break;case"bottomLeft":P=!0,S=($,W)=>[0,W],_=($,W)=>[$,0];break;case"middleLeft":L=!0,S=($,W)=>[0,W/2],_=($,W)=>[$,W/2];break}const k=S(l,c),F=_(l,c);let I=v(...F);const M=f(r+I[0]),C=f(o+I[1]);let T=1,N=1,[D,H]=this.screenToPageTranslation(e.movementX,e.movementY);if([D,H]=E(D/n,H/i),P){const $=Math.hypot(l,c);T=N=Math.max(Math.min(Math.hypot(F[0]-k[0]-D,F[1]-k[1]-H)/$,1/l,1/c),u/l,h/c)}else L?T=Math.max(u,Math.min(1,Math.abs(F[0]-k[0]-D)))/l:N=Math.max(h,Math.min(1,Math.abs(F[1]-k[1]-H)))/c;const z=f(l*T),G=f(c*N);I=v(..._(z,G));const K=M-I[0],J=C-I[1];this.width=z,this.height=G,this.x=K,this.y=J,this.setDims(n*z,i*G),this.fixAndSetPosition()},uc=new WeakSet,Wg=function(t){const{isMac:e}=ze.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},Od=new WeakSet,Db=function(t){const e=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let n,i;e&&(this.div.classList.add("moving"),n={passive:!0,capture:!0},w(this,No,t.clientX),w(this,Bo,t.clientY),i=o=>{const{clientX:l,clientY:c}=o,[u,h]=this.screenToPageTranslation(l-a(this,No),c-a(this,Bo));w(this,No,l),w(this,Bo,c),this._uiManager.dragSelectedEditors(u,h)},window.addEventListener("pointermove",i,n));const r=()=>{window.removeEventListener("pointerup",r),window.removeEventListener("blur",r),e&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",i,n)),w(this,Qs,!1),this._uiManager.endDragSession()||A(this,uc,Wg).call(this,t)};window.addEventListener("pointerup",r),window.addEventListener("blur",r)},Nd=new WeakSet,Ob=function(t){Nt._resizerKeyboardManager.exec(this,t)},Bd=new WeakSet,Nb=function(t){var e;a(this,yi)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==a(this,be)&&A(this,er,sl).call(this)},$d=new WeakSet,Bb=function(t){w(this,ic,a(this,yi)?t:"")},dc=new WeakSet,qg=function(t){if(a(this,vn))for(const e of a(this,vn))e.tabIndex=t},er=new WeakSet,sl=function(){if(w(this,yi,!1),A(this,dc,qg).call(this,-1),a(this,Js)){const{savedX:t,savedY:e,savedWidth:n,savedHeight:i}=a(this,Js);A(this,cc,Vg).call(this,t,e,n,i),w(this,Js,null)}},m(Nt,ac),dt(Nt,"_borderLineWidth",-1),dt(Nt,"_colorManager",new Ig),dt(Nt,"_zIndex",1),dt(Nt,"_telemetryTimeout",1e3);let Ft=Nt;class LR extends Ft{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}const fv=3285377520,sn=4294901760,Pn=65535;class $b{constructor(t){this.h1=t?t&4294967295:fv,this.h2=t?t&4294967295:fv}update(t){let e,n;if(typeof t=="string"){e=new Uint8Array(t.length*2),n=0;for(let E=0,S=t.length;E<S;E++){const _=t.charCodeAt(E);_<=255?e[n++]=_:(e[n++]=_>>>8,e[n++]=_&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 i=n>>2,r=n-i*4,o=new Uint32Array(e.buffer,0,i);let l=0,c=0,u=this.h1,h=this.h2;const f=3432918353,g=461845907,v=f&Pn,y=g&Pn;for(let E=0;E<i;E++)E&1?(l=o[E],l=l*f&sn|l*v&Pn,l=l<<15|l>>>17,l=l*g&sn|l*y&Pn,u^=l,u=u<<13|u>>>19,u=u*5+3864292196):(c=o[E],c=c*f&sn|c*v&Pn,c=c<<15|c>>>17,c=c*g&sn|c*y&Pn,h^=c,h=h<<13|h>>>19,h=h*5+3864292196);switch(l=0,r){case 3:l^=e[i*4+2]<<16;case 2:l^=e[i*4+1]<<8;case 1:l^=e[i*4],l=l*f&sn|l*v&Pn,l=l<<15|l>>>17,l=l*g&sn|l*y&Pn,i&1?u^=l:h^=l}this.h1=u,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&sn|t*36045&Pn,e=e*4283543511&sn|((e<<16|t>>>16)*2950163797&sn)>>>16,t^=e>>>1,t=t*444984403&sn|t*60499&Pn,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 Xg=Object.freeze({map:null,hash:"",transfer:void 0});var nr,we,jd,jb;class g0{constructor(){m(this,jd);m(this,nr,!1);m(this,we,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const n=a(this,we).get(t);return n===void 0?e:Object.assign(e,n)}getRawValue(t){return a(this,we).get(t)}remove(t){if(a(this,we).delete(t),a(this,we).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const e of a(this,we).values())if(e instanceof Ft)return;this.onAnnotationEditor(null)}}setValue(t,e){const n=a(this,we).get(t);let i=!1;if(n!==void 0)for(const[r,o]of Object.entries(e))n[r]!==o&&(i=!0,n[r]=o);else i=!0,a(this,we).set(t,e);i&&A(this,jd,jb).call(this),e instanceof Ft&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(e.constructor._type)}has(t){return a(this,we).has(t)}getAll(){return a(this,we).size>0?l0(a(this,we)):null}setAll(t){for(const[e,n]of Object.entries(t))this.setValue(e,n)}get size(){return a(this,we).size}resetModified(){a(this,nr)&&(w(this,nr,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Ub(this)}get serializable(){if(a(this,we).size===0)return Xg;const t=new Map,e=new $b,n=[],i=Object.create(null);let r=!1;for(const[o,l]of a(this,we)){const c=l instanceof Ft?l.serialize(!1,i):l;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}:Xg}get editorStats(){let t=null;const e=new Map;for(const n of a(this,we).values()){if(!(n instanceof Ft))continue;const i=n.telemetryFinalData;if(!i)continue;const{type:r}=i;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[l,c]of Object.entries(i)){if(l==="type")continue;let u=o.get(l);u||(u=new Map,o.set(l,u));const h=u.get(c)??0;u.set(c,h+1)}}for(const[n,i]of e)t[n]=i.computeTelemetryFinalData(t[n]);return t}}nr=new WeakMap,we=new WeakMap,jd=new WeakSet,jb=function(){a(this,nr)||(w(this,nr,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var fc;class Ub extends g0{constructor(e){super();m(this,fc,void 0);const{map:n,hash:i,transfer:r}=e.serializable,o=structuredClone(n,r?{transfer:r}:null);w(this,fc,{map:o,hash:i,transfer:r})}get print(){Dt("Should not call PrintAnnotationStorage.print")}get serializable(){return a(this,fc)}}fc=new WeakMap;var $o;class kR{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){m(this,$o,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(),a(this,$o).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:e}){if(!(!t||a(this,$o).has(t.loadedName))){if(ae(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:n,src:i,style:r}=t,o=new FontFace(n,i,r);this.addNativeFontFace(o);try{await o.load(),a(this,$o).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}Dt("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(i){throw yt(`Failed to load font '${n.family}': '${i}'.`),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(n=>{const i=this._queueLoadingCallback(n);this._prepareFontLoadEvent(t,i)})}}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(!i.done,"completeRequest() cannot be called twice."),i.done=!0;n.length>0&&n[0].done;){const r=n.shift();setTimeout(r.callback,0)}}const{loadingRequests:n}=this,i={done:!1,complete:e,callback:t};return n.push(i),i}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(k,F){return k.charCodeAt(F)<<24|k.charCodeAt(F+1)<<16|k.charCodeAt(F+2)<<8|k.charCodeAt(F+3)&255}function i(k,F,I,M){const C=k.substring(0,F),T=k.substring(F+I);return C+M+T}let r,o;const l=this._document.createElement("canvas");l.width=1,l.height=1;const c=l.getContext("2d");let u=0;function h(k,F){if(++u>30){yt("Load test font never loaded."),F();return}if(c.font="30px "+k,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){F();return}setTimeout(h.bind(null,k,F))}const f=`lt${Date.now()}${this.loadTestFontId++}`;let g=this._loadTestFont;g=i(g,976,f.length,f);const y=16,E=1482184792;let S=n(g,y);for(r=0,o=f.length-3;r<o;r+=4)S=S-E+n(f,r)|0;r<f.length&&(S=S-E+n(f+"XXX",r)|0),g=i(g,y,4,pR(S));const _=`url(data:font/opentype;base64,${btoa(g)});`,P=`@font-face {font-family:"${f}";src:${_}}`;this.insertRule(P);const L=this._document.createElement("div");L.style.visibility="hidden",L.style.width=L.style.height="10px",L.style.position="absolute",L.style.top=L.style.left="0px";for(const k of[t.loadedName,f]){const F=this._document.createElement("span");F.textContent="Hi",F.style.fontFamily=k,L.append(F)}this._document.body.append(L),h(f,()=>{L.remove(),e.complete()})}}$o=new WeakMap;class IR{constructor(t,{disableFontFace:e=!1,inspectFont:n=null}){this.compiledGlyphs=Object.create(null);for(const i in t)this[i]=t[i];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 i;if(!this.data||this.disableFontFace)return null;const t=hb(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(i=this._inspectFont)==null||i.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 i=[];for(let r=0,o=n.length;r<o;)switch(n[r++]){case ei.BEZIER_CURVE_TO:{const[l,c,u,h,f,g]=n.slice(r,r+6);i.push(v=>v.bezierCurveTo(l,c,u,h,f,g)),r+=6}break;case ei.MOVE_TO:{const[l,c]=n.slice(r,r+2);i.push(u=>u.moveTo(l,c)),r+=2}break;case ei.LINE_TO:{const[l,c]=n.slice(r,r+2);i.push(u=>u.lineTo(l,c)),r+=2}break;case ei.QUADRATIC_CURVE_TO:{const[l,c,u,h]=n.slice(r,r+4);i.push(f=>f.quadraticCurveTo(l,c,u,h)),r+=4}break;case ei.RESTORE:i.push(l=>l.restore());break;case ei.SAVE:i.push(l=>l.save());break;case ei.SCALE:ae(i.length===2,"Scale command is only valid at the third position.");break;case ei.TRANSFORM:{const[l,c,u,h,f,g]=n.slice(r,r+6);i.push(v=>v.transform(l,c,u,h,f,g)),r+=6}break;case ei.TRANSLATE:{const[l,c]=n.slice(r,r+2);i.push(u=>u.translate(l,c)),r+=2}break}return this.compiledGlyphs[e]=function(o,l){i[0](o),i[1](o),o.scale(l,-l);for(let c=2,u=i.length;c<u;c++)i[c](o)}}}if(Pe){var Yg=Promise.withResolvers(),ml=null;(async()=>{const t=await Promise.resolve().then(()=>require("./empty-DBAFSQIv.cjs")),e=await Promise.resolve().then(()=>require("./index-DXkoUiz7.cjs")).then(l=>l.index),n=await Promise.resolve().then(()=>require("./index-CrL_zfv8.cjs")).then(l=>l.index),i=await Promise.resolve().then(()=>require("./url-Bx0ZSydb.cjs")).then(l=>l.url);let r,o;return new Map(Object.entries({fs:t,http:e,https:n,url:i,canvas:r,path2d:o}))})().then(t=>{ml=t,Yg.resolve()},t=>{yt(`loadPackages: ${t}`),ml=new Map,Yg.resolve()})}class Jn{static get promise(){return Yg.promise}static get(t){return ml==null?void 0:ml.get(t)}}const Hb=function(s){return Jn.get("fs").promises.readFile(s).then(e=>new Uint8Array(e))};class FR extends hp{}class MR extends up{_createCanvas(t,e){return Jn.get("canvas").createCanvas(t,e)}}class DR extends dp{_fetchData(t,e){return Hb(t).then(n=>({cMapData:n,compressionType:e}))}}class OR extends fp{_fetchData(t){return Hb(t)}}const De={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function Kg(s,t){if(!t)return;const e=t[2]-t[0],n=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],e,n),s.clip(i)}class Yh{constructor(){this.constructor===Yh&&Dt("Cannot initialize BaseShadingPattern.")}getPattern(){Dt("Abstract method `getPattern` called.")}}class NR extends Yh{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,i){let r;if(i===De.STROKE||i===De.FILL){const o=e.current.getClippedPathBoundingBox(i,Vt(t))||[0,0,0,0],l=Math.ceil(o[2]-o[0])||1,c=Math.ceil(o[3]-o[1])||1,u=e.cachedCanvases.getCanvas("pattern",l,c,!0),h=u.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=tt.transform(n,[1,0,0,1,o[0],o[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),Kg(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),r=t.createPattern(u.canvas,"no-repeat");const f=new DOMMatrix(n);r.setTransform(f)}else Kg(t,this._bbox),r=this._createGradient(t);return r}}function Zp(s,t,e,n,i,r,o,l){const c=t.coords,u=t.colors,h=s.data,f=s.width*4;let g;c[e+1]>c[n+1]&&(g=e,e=n,n=g,g=r,r=o,o=g),c[n+1]>c[i+1]&&(g=n,n=i,i=g,g=o,o=l,l=g),c[e+1]>c[n+1]&&(g=e,e=n,n=g,g=r,r=o,o=g);const v=(c[e]+t.offsetX)*t.scaleX,y=(c[e+1]+t.offsetY)*t.scaleY,E=(c[n]+t.offsetX)*t.scaleX,S=(c[n+1]+t.offsetY)*t.scaleY,_=(c[i]+t.offsetX)*t.scaleX,P=(c[i+1]+t.offsetY)*t.scaleY;if(y>=P)return;const L=u[r],k=u[r+1],F=u[r+2],I=u[o],M=u[o+1],C=u[o+2],T=u[l],N=u[l+1],D=u[l+2],H=Math.round(y),z=Math.round(P);let G,K,J,$,W,q,wt,ft;for(let V=H;V<=z;V++){if(V<S){const Z=V<y?0:(y-V)/(y-S);G=v-(v-E)*Z,K=L-(L-I)*Z,J=k-(k-M)*Z,$=F-(F-C)*Z}else{let Z;V>P?Z=1:S===P?Z=0:Z=(S-V)/(S-P),G=E-(E-_)*Z,K=I-(I-T)*Z,J=M-(M-N)*Z,$=C-(C-D)*Z}let it;V<y?it=0:V>P?it=1:it=(y-V)/(y-P),W=v-(v-_)*it,q=L-(L-T)*it,wt=k-(k-N)*it,ft=F-(F-D)*it;const et=Math.round(Math.min(G,W)),nt=Math.round(Math.max(G,W));let ht=f*V+et*4;for(let Z=et;Z<=nt;Z++)it=(G-Z)/(G-W),it<0?it=0:it>1&&(it=1),h[ht++]=K-(K-q)*it|0,h[ht++]=J-(J-wt)*it|0,h[ht++]=$-($-ft)*it|0,h[ht++]=255}}function BR(s,t,e){const n=t.coords,i=t.colors;let r,o;switch(t.type){case"lattice":const l=t.verticesPerRow,c=Math.floor(n.length/l)-1,u=l-1;for(r=0;r<c;r++){let h=r*l;for(let f=0;f<u;f++,h++)Zp(s,e,n[h],n[h+1],n[h+l],i[h],i[h+1],i[h+l]),Zp(s,e,n[h+l+1],n[h+1],n[h+l],i[h+l+1],i[h+1],i[h+l])}break;case"triangles":for(r=0,o=n.length;r<o;r+=3)Zp(s,e,n[r],n[r+1],n[r+2],i[r],i[r+1],i[r+2]);break;default:throw new Error("illegal figure")}}class $R extends Yh{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 l=Math.floor(this._bounds[0]),c=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-l,h=Math.ceil(this._bounds[3])-c,f=Math.min(Math.ceil(Math.abs(u*t[0]*1.1)),3e3),g=Math.min(Math.ceil(Math.abs(h*t[1]*1.1)),3e3),v=u/f,y=h/g,E={coords:this._coords,colors:this._colors,offsetX:-l,offsetY:-c,scaleX:1/v,scaleY:1/y},S=f+2*2,_=g+2*2,P=n.getCanvas("mesh",S,_,!1),L=P.context,k=L.createImageData(f,g);if(e){const I=k.data;for(let M=0,C=I.length;M<C;M+=4)I[M]=e[0],I[M+1]=e[1],I[M+2]=e[2],I[M+3]=255}for(const I of this._figures)BR(k,I,E);return L.putImageData(k,2,2),{canvas:P.canvas,offsetX:l-2*v,offsetY:c-2*y,scaleX:v,scaleY:y}}getPattern(t,e,n,i){Kg(t,this._bbox);let r;if(i===De.SHADING)r=tt.singularValueDecompose2dScale(Vt(t));else if(r=tt.singularValueDecompose2dScale(e.baseTransform),this.matrix){const l=tt.singularValueDecompose2dScale(this.matrix);r=[r[0]*l[0],r[1]*l[1]]}const o=this._createMeshCanvas(r,i===De.SHADING?null:this._background,e.cachedCanvases);return i!==De.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 jR extends Yh{getPattern(){return"hotpink"}}function UR(s){switch(s[0]){case"RadialAxial":return new NR(s);case"Mesh":return new $R(s);case"Dummy":return new jR}throw new Error(`Unknown IR type: ${s[0]}`)}const pv={COLORED:1,UNCOLORED:2},Ud=class Ud{constructor(t,e,n,i,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=i,this.baseTransform=r}createPatternCanvas(t){const e=this.operatorList,n=this.bbox,i=this.xstep,r=this.ystep,o=this.paintType,l=this.tilingType,c=this.color,u=this.canvasGraphicsFactory;ap("TilingType: "+l);const h=n[0],f=n[1],g=n[2],v=n[3],y=tt.singularValueDecompose2dScale(this.matrix),E=tt.singularValueDecompose2dScale(this.baseTransform),S=[y[0]*E[0],y[1]*E[1]],_=this.getSizeAndScale(i,this.ctx.canvas.width,S[0]),P=this.getSizeAndScale(r,this.ctx.canvas.height,S[1]),L=t.cachedCanvases.getCanvas("pattern",_.size,P.size,!0),k=L.context,F=u.createCanvasGraphics(k);F.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(F,o,c);let I=h,M=f,C=g,T=v;return h<0&&(I=0,C+=Math.abs(h)),f<0&&(M=0,T+=Math.abs(f)),k.translate(-(_.scale*I),-(P.scale*M)),F.transform(_.scale,0,0,P.scale,0,0),k.save(),this.clipBbox(F,I,M,C,T),F.baseTransform=Vt(F.ctx),F.executeOperatorList(e),F.endDrawing(),{canvas:L.canvas,scaleX:_.scale,scaleY:P.scale,offsetX:I,offsetY:M}}getSizeAndScale(t,e,n){t=Math.abs(t);const i=Math.max(Ud.MAX_PATTERN_SIZE,e);let r=Math.ceil(t*n);return r>=i?r=i:n=r/t,{scale:n,size:r}}clipBbox(t,e,n,i,r){const o=i-e,l=r-n;t.ctx.rect(e,n,o,l),t.current.updateRectMinMax(Vt(t.ctx),[e,n,i,r]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,n){const i=t.ctx,r=t.current;switch(e){case pv.COLORED:const o=this.ctx;i.fillStyle=o.fillStyle,i.strokeStyle=o.strokeStyle,r.fillColor=o.fillStyle,r.strokeColor=o.strokeStyle;break;case pv.UNCOLORED:const l=tt.makeHexColor(n[0],n[1],n[2]);i.fillStyle=l,i.strokeStyle=l,r.fillColor=l,r.strokeColor=l;break;default:throw new fR(`Unsupported paint type: ${e}`)}}getPattern(t,e,n,i){let r=n;i!==De.SHADING&&(r=tt.transform(r,e.baseTransform),this.matrix&&(r=tt.transform(r,this.matrix)));const o=this.createPatternCanvas(e);let l=new DOMMatrix(r);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const c=t.createPattern(o.canvas,"repeat");return c.setTransform(l),c}};dt(Ud,"MAX_PATTERN_SIZE",3e3);let Zg=Ud;function HR({src:s,srcPos:t=0,dest:e,width:n,height:i,nonBlackColor:r=4294967295,inverseDecode:o=!1}){const l=ze.isLittleEndian?4278190080:255,[c,u]=o?[r,l]:[l,r],h=n>>3,f=n&7,g=s.length;e=new Uint32Array(e.buffer);let v=0;for(let y=0;y<i;y++){for(const S=t+h;t<S;t++){const _=t<g?s[t]:255;e[v++]=_&128?u:c,e[v++]=_&64?u:c,e[v++]=_&32?u:c,e[v++]=_&16?u:c,e[v++]=_&8?u:c,e[v++]=_&4?u:c,e[v++]=_&2?u:c,e[v++]=_&1?u:c}if(f===0)continue;const E=t<g?s[t++]:255;for(let S=0;S<f;S++)e[v++]=E&1<<7-S?u:c}return{srcPos:t,destPos:v}}const gv=16,mv=100,zR=15,vv=10,yv=1e3,je=16;function VR(s,t){if(s._removeMirroring)throw new Error("Context is already forwarding operations.");s.__originalSave=s.save,s.__originalRestore=s.restore,s.__originalRotate=s.rotate,s.__originalScale=s.scale,s.__originalTranslate=s.translate,s.__originalTransform=s.transform,s.__originalSetTransform=s.setTransform,s.__originalResetTransform=s.resetTransform,s.__originalClip=s.clip,s.__originalMoveTo=s.moveTo,s.__originalLineTo=s.lineTo,s.__originalBezierCurveTo=s.bezierCurveTo,s.__originalRect=s.rect,s.__originalClosePath=s.closePath,s.__originalBeginPath=s.beginPath,s._removeMirroring=()=>{s.save=s.__originalSave,s.restore=s.__originalRestore,s.rotate=s.__originalRotate,s.scale=s.__originalScale,s.translate=s.__originalTranslate,s.transform=s.__originalTransform,s.setTransform=s.__originalSetTransform,s.resetTransform=s.__originalResetTransform,s.clip=s.__originalClip,s.moveTo=s.__originalMoveTo,s.lineTo=s.__originalLineTo,s.bezierCurveTo=s.__originalBezierCurveTo,s.rect=s.__originalRect,s.closePath=s.__originalClosePath,s.beginPath=s.__originalBeginPath,delete s._removeMirroring},s.save=function(){t.save(),this.__originalSave()},s.restore=function(){t.restore(),this.__originalRestore()},s.translate=function(n,i){t.translate(n,i),this.__originalTranslate(n,i)},s.scale=function(n,i){t.scale(n,i),this.__originalScale(n,i)},s.transform=function(n,i,r,o,l,c){t.transform(n,i,r,o,l,c),this.__originalTransform(n,i,r,o,l,c)},s.setTransform=function(n,i,r,o,l,c){t.setTransform(n,i,r,o,l,c),this.__originalSetTransform(n,i,r,o,l,c)},s.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},s.rotate=function(n){t.rotate(n),this.__originalRotate(n)},s.clip=function(n){t.clip(n),this.__originalClip(n)},s.moveTo=function(e,n){t.moveTo(e,n),this.__originalMoveTo(e,n)},s.lineTo=function(e,n){t.lineTo(e,n),this.__originalLineTo(e,n)},s.bezierCurveTo=function(e,n,i,r,o,l){t.bezierCurveTo(e,n,i,r,o,l),this.__originalBezierCurveTo(e,n,i,r,o,l)},s.rect=function(e,n,i,r){t.rect(e,n,i,r),this.__originalRect(e,n,i,r)},s.closePath=function(){t.closePath(),this.__originalClosePath()},s.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class GR{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,n){let i;return this.cache[t]!==void 0?(i=this.cache[t],this.canvasFactory.reset(i,e,n)):(i=this.canvasFactory.create(e,n),this.cache[t]=i),i}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 cu(s,t,e,n,i,r,o,l,c,u){const[h,f,g,v,y,E]=Vt(s);if(f===0&&g===0){const P=o*h+y,L=Math.round(P),k=l*v+E,F=Math.round(k),I=(o+c)*h+y,M=Math.abs(Math.round(I)-L)||1,C=(l+u)*v+E,T=Math.abs(Math.round(C)-F)||1;return s.setTransform(Math.sign(h),0,0,Math.sign(v),L,F),s.drawImage(t,e,n,i,r,0,0,M,T),s.setTransform(h,f,g,v,y,E),[M,T]}if(h===0&&v===0){const P=l*g+y,L=Math.round(P),k=o*f+E,F=Math.round(k),I=(l+u)*g+y,M=Math.abs(Math.round(I)-L)||1,C=(o+c)*f+E,T=Math.abs(Math.round(C)-F)||1;return s.setTransform(0,Math.sign(f),Math.sign(g),0,L,F),s.drawImage(t,e,n,i,r,0,0,T,M),s.setTransform(h,f,g,v,y,E),[T,M]}s.drawImage(t,e,n,i,r,o,l,c,u);const S=Math.hypot(h,f),_=Math.hypot(g,v);return[S*c,_*u]}function WR(s){const{width:t,height:e}=s;if(t>yv||e>yv)return null;const n=1e3,i=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)),l,c,u;const h=t+7&-8;let f=new Uint8Array(h*e),g=0;for(const _ of s.data){let P=128;for(;P>0;)f[g++]=_&P?0:255,P>>=1}let v=0;for(g=0,f[g]!==0&&(o[0]=1,++v),c=1;c<t;c++)f[g]!==f[g+1]&&(o[c]=f[g]?2:1,++v),g++;for(f[g]!==0&&(o[c]=2,++v),l=1;l<e;l++){g=l*h,u=l*r,f[g-h]!==f[g]&&(o[u]=f[g]?1:8,++v);let _=(f[g]?4:0)+(f[g-h]?8:0);for(c=1;c<t;c++)_=(_>>2)+(f[g+1]?4:0)+(f[g-h+1]?8:0),i[_]&&(o[u+c]=i[_],++v),g++;if(f[g-h]!==f[g]&&(o[u+c]=f[g]?2:4,++v),v>n)return null}for(g=h*(e-1),u=l*r,f[g]!==0&&(o[u]=8,++v),c=1;c<t;c++)f[g]!==f[g+1]&&(o[u+c]=f[g]?4:8,++v),g++;if(f[g]!==0&&(o[u+c]=4,++v),v>n)return null;const y=new Int32Array([0,r,-1,0,-r,0,0,0,1]),E=new Path2D;for(l=0;v&&l<=e;l++){let _=l*r;const P=_+t;for(;_<P&&!o[_];)_++;if(_===P)continue;E.moveTo(_%r,l);const L=_;let k=o[_];do{const F=y[k];do _+=F;while(!o[_]);const I=o[_];I!==5&&I!==10?(k=I,o[_]=0):(k=I&51*k>>4,o[_]&=k>>2|k<<2),E.lineTo(_%r,_/r|0),o[_]||--v}while(L!==_);--l}return f=null,o=null,function(_){_.save(),_.scale(1/t,-1/e),_.translate(0,-e),_.fill(E),_.beginPath(),_.restore()}}class bv{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=lb,this.textMatrixScale=1,this.fontMatrix=Ag,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=_e.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]=tt.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=tt.applyTransform(e,t),i=tt.applyTransform(e.slice(2),t),r=tt.applyTransform([e[0],e[3]],t),o=tt.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,n[0],i[0],r[0],o[0]),this.minY=Math.min(this.minY,n[1],i[1],r[1],o[1]),this.maxX=Math.max(this.maxX,n[0],i[0],r[0],o[0]),this.maxY=Math.max(this.maxY,n[1],i[1],r[1],o[1])}updateScalingPathMinMax(t,e){tt.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,i,r,o,l,c,u,h){const f=tt.bezierBoundingBox(e,n,i,r,o,l,c,u,h);h||this.updateRectMinMax(t,f)}getPathBoundingBox(t=De.FILL,e=null){const n=[this.minX,this.minY,this.maxX,this.maxY];if(t===De.STROKE){e||Dt("Stroke bounding box must include transform.");const i=tt.singularValueDecompose2dScale(e),r=i[0]*this.lineWidth/2,o=i[1]*this.lineWidth/2;n[0]-=r,n[1]-=o,n[2]+=r,n[3]+=o}return n}updateClipFromPath(){const t=tt.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=De.FILL,e=null){return tt.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function wv(s,t){if(typeof ImageData<"u"&&t instanceof ImageData){s.putImageData(t,0,0);return}const e=t.height,n=t.width,i=e%je,r=(e-i)/je,o=i===0?r:r+1,l=s.createImageData(n,je);let c=0,u;const h=t.data,f=l.data;let g,v,y,E;if(t.kind===Eu.GRAYSCALE_1BPP){const S=h.byteLength,_=new Uint32Array(f.buffer,0,f.byteLength>>2),P=_.length,L=n+7>>3,k=4294967295,F=ze.isLittleEndian?4278190080:255;for(g=0;g<o;g++){for(y=g<r?je:i,u=0,v=0;v<y;v++){const I=S-c;let M=0;const C=I>L?n:I*8-7,T=C&-8;let N=0,D=0;for(;M<T;M+=8)D=h[c++],_[u++]=D&128?k:F,_[u++]=D&64?k:F,_[u++]=D&32?k:F,_[u++]=D&16?k:F,_[u++]=D&8?k:F,_[u++]=D&4?k:F,_[u++]=D&2?k:F,_[u++]=D&1?k:F;for(;M<C;M++)N===0&&(D=h[c++],N=128),_[u++]=D&N?k:F,N>>=1}for(;u<P;)_[u++]=0;s.putImageData(l,0,g*je)}}else if(t.kind===Eu.RGBA_32BPP){for(v=0,E=n*je*4,g=0;g<r;g++)f.set(h.subarray(c,c+E)),c+=E,s.putImageData(l,0,v),v+=je;g<o&&(E=n*i*4,f.set(h.subarray(c,c+E)),s.putImageData(l,0,v))}else if(t.kind===Eu.RGB_24BPP)for(y=je,E=n*y,g=0;g<o;g++){for(g>=r&&(y=i,E=n*y),u=0,v=E;v--;)f[u++]=h[c++],f[u++]=h[c++],f[u++]=h[c++],f[u++]=255;s.putImageData(l,0,g*je)}else throw new Error(`bad image kind: ${t.kind}`)}function Av(s,t){if(t.bitmap){s.drawImage(t.bitmap,0,0);return}const e=t.height,n=t.width,i=e%je,r=(e-i)/je,o=i===0?r:r+1,l=s.createImageData(n,je);let c=0;const u=t.data,h=l.data;for(let f=0;f<o;f++){const g=f<r?je:i;({srcPos:c}=HR({src:u,srcPos:c,dest:h,width:n,height:g,nonBlackColor:0})),s.putImageData(l,0,f*je)}}function Ka(s,t){const e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of e)s[n]!==void 0&&(t[n]=s[n]);s.setLineDash!==void 0&&(t.setLineDash(s.getLineDash()),t.lineDashOffset=s.lineDashOffset)}function hu(s){if(s.strokeStyle=s.fillStyle="#000000",s.fillRule="nonzero",s.globalAlpha=1,s.lineWidth=1,s.lineCap="butt",s.lineJoin="miter",s.miterLimit=10,s.globalCompositeOperation="source-over",s.font="10px sans-serif",s.setLineDash!==void 0&&(s.setLineDash([]),s.lineDashOffset=0),!Pe){const{filter:t}=s;t!=="none"&&t!==""&&(s.filter="none")}}function Ev(s,t){if(t)return!0;const e=tt.singularValueDecompose2dScale(s);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 qR=["butt","round","square"],XR=["miter","round","bevel"],YR={},_v={};var pc,Jg,gc,Qg;const w0=class w0{constructor(t,e,n,i,r,{optionalContentConfig:o,markedContentStack:l=null},c,u){m(this,pc);m(this,gc);this.ctx=t,this.current=new bv(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=i,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=l||[],this.optionalContentConfig=o,this.cachedCanvases=new GR(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=c,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=u,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:i=null}){const r=this.ctx.canvas.width,o=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,r,o),this.ctx.fillStyle=l,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(...Vt(this.compositeCtx))}this.ctx.save(),hu(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=Vt(this.ctx)}executeOperatorList(t,e,n,i){const r=t.argsArray,o=t.fnArray;let l=e||0;const c=r.length;if(c===l)return l;const u=c-l>vv&&typeof n=="function",h=u?Date.now()+zR:0;let f=0;const g=this.commonObjs,v=this.objs;let y;for(;;){if(i!==void 0&&l===i.nextBreakPoint)return i.breakIt(l,n),l;if(y=o[l],y!==fn.dependency)this[y].apply(this,r[l]);else for(const E of r[l]){const S=E.startsWith("g_")?g:v;if(!S.has(E))return S.get(E,n),l}if(l++,l===c)return l;if(u&&++f>vv){if(Date.now()>h)return n(),l;f=0}}}endDrawing(){A(this,pc,Jg).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,gc,Qg).call(this)}_scaleImage(t,e){const n=t.width,i=t.height;let r=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),l=n,c=i,u="prescale1",h,f;for(;r>2&&l>1||o>2&&c>1;){let g=l,v=c;r>2&&l>1&&(g=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),r/=l/g),o>2&&c>1&&(v=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,o/=c/v),h=this.cachedCanvases.getCanvas(u,g,v),f=h.context,f.clearRect(0,0,g,v),f.drawImage(t,0,0,l,c,0,0,g,v),t=h.canvas,l=g,c=v,u=u==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:l,paintHeight:c}}_createMaskCanvas(t){const e=this.ctx,{width:n,height:i}=t,r=this.current.fillColor,o=this.current.patternFill,l=Vt(e);let c,u,h,f;if((t.bitmap||t.data)&&t.count>1){const C=t.bitmap||t.data.buffer;u=JSON.stringify(o?l:[l.slice(0,4),r]),c=this._cachedBitmapsMap.get(C),c||(c=new Map,this._cachedBitmapsMap.set(C,c));const T=c.get(u);if(T&&!o){const N=Math.round(Math.min(l[0],l[2])+l[4]),D=Math.round(Math.min(l[1],l[3])+l[5]);return{canvas:T,offsetX:N,offsetY:D}}h=T}h||(f=this.cachedCanvases.getCanvas("maskCanvas",n,i),Av(f.context,t));let g=tt.transform(l,[1/n,0,0,-1/i,0,0]);g=tt.transform(g,[1,0,0,1,0,-i]);const[v,y,E,S]=tt.getAxialAlignedBoundingBox([0,0,n,i],g),_=Math.round(E-v)||1,P=Math.round(S-y)||1,L=this.cachedCanvases.getCanvas("fillCanvas",_,P),k=L.context,F=v,I=y;k.translate(-F,-I),k.transform(...g),h||(h=this._scaleImage(f.canvas,ni(k)),h=h.img,c&&o&&c.set(u,h)),k.imageSmoothingEnabled=Ev(Vt(k),t.interpolate),cu(k,h,0,0,h.width,h.height,0,0,n,i),k.globalCompositeOperation="source-in";const M=tt.transform(ni(k),[1,0,0,1,-F,-I]);return k.fillStyle=o?r.getPattern(e,this,M,De.FILL):r,k.fillRect(0,0,n,i),c&&!o&&(this.cachedCanvases.delete("fillCanvas"),c.set(u,L.canvas)),{canvas:L.canvas,offsetX:Math.round(F),offsetY:Math.round(I)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=qR[t]}setLineJoin(t){this.ctx.lineJoin=XR[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,i=this.cachedCanvases.getCanvas(n,t,e);this.suspendedCtx=this.ctx,this.ctx=i.context;const r=this.ctx;r.setTransform(...Vt(this.suspendedCtx)),Ka(this.suspendedCtx,r),VR(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(),Ka(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,i){const r=i[0],o=i[1],l=i[2]-r,c=i[3]-o;l===0||c===0||(this.genericComposeSMask(e.context,n,l,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,i,r,o,l,c,u,h,f){let g=t.canvas,v=c-h,y=u-f;if(o){if(v<0||y<0||v+n>g.width||y+i>g.height){const S=this.cachedCanvases.getCanvas("maskExtension",n,i),_=S.context;_.drawImage(g,-v,-y),o.some(P=>P!==0)&&(_.globalCompositeOperation="destination-atop",_.fillStyle=tt.makeHexColor(...o),_.fillRect(0,0,n,i),_.globalCompositeOperation="source-over"),g=S.canvas,v=y=0}else if(o.some(S=>S!==0)){t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const S=new Path2D;S.rect(v,y,n,i),t.clip(S),t.globalCompositeOperation="destination-atop",t.fillStyle=tt.makeHexColor(...o),t.fillRect(v,y,n,i),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),r==="Alpha"&&l?e.filter=this.filterFactory.addAlphaFilter(l):r==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(l));const E=new Path2D;E.rect(c,u,n,i),e.clip(E),e.globalCompositeOperation="destination-in",e.drawImage(g,v,y,n,i,c,u,n,i),e.restore()}save(){this.inSMaskMode?(Ka(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(),Ka(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,n,i,r,o){this.ctx.transform(t,e,n,i,r,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,n){const i=this.ctx,r=this.current;let o=r.x,l=r.y,c,u;const h=Vt(i),f=h[0]===0&&h[3]===0||h[1]===0&&h[2]===0,g=f?n.slice(0):null;for(let v=0,y=0,E=t.length;v<E;v++)switch(t[v]|0){case fn.rectangle:o=e[y++],l=e[y++];const S=e[y++],_=e[y++],P=o+S,L=l+_;i.moveTo(o,l),S===0||_===0?i.lineTo(P,L):(i.lineTo(P,l),i.lineTo(P,L),i.lineTo(o,L)),f||r.updateRectMinMax(h,[o,l,P,L]),i.closePath();break;case fn.moveTo:o=e[y++],l=e[y++],i.moveTo(o,l),f||r.updatePathMinMax(h,o,l);break;case fn.lineTo:o=e[y++],l=e[y++],i.lineTo(o,l),f||r.updatePathMinMax(h,o,l);break;case fn.curveTo:c=o,u=l,o=e[y+4],l=e[y+5],i.bezierCurveTo(e[y],e[y+1],e[y+2],e[y+3],o,l),r.updateCurvePathMinMax(h,c,u,e[y],e[y+1],e[y+2],e[y+3],o,l,g),y+=6;break;case fn.curveTo2:c=o,u=l,i.bezierCurveTo(o,l,e[y],e[y+1],e[y+2],e[y+3]),r.updateCurvePathMinMax(h,c,u,o,l,e[y],e[y+1],e[y+2],e[y+3],g),o=e[y+2],l=e[y+3],y+=4;break;case fn.curveTo3:c=o,u=l,o=e[y+2],l=e[y+3],i.bezierCurveTo(e[y],e[y+1],o,l,o,l),r.updateCurvePathMinMax(h,c,u,e[y],e[y+1],o,l,o,l,g),y+=4;break;case fn.closePath:i.closePath();break}f&&r.updateScalingPathMinMax(h,g),r.setCurrentPoint(o,l)}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,ni(e),De.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,i=this.current.patternFill;let r=!1;i&&(e.save(),e.fillStyle=n.getPattern(e,this,ni(e),De.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=YR}eoClip(){this.pendingClip=_v}beginText(){this.current.textMatrix=lb,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),i=this.current;if(!n)throw new Error(`Can't find font for ${t}`);if(i.fontMatrix=n.fontMatrix||Ag,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&yt("Invalid font matrix for font "+t),e<0?(e=-e,i.fontDirection=-1):i.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 l="normal";n.black?l="900":n.bold&&(l="bold");const c=n.italic?"italic":"normal";let u=e;e<gv?u=gv:e>mv&&(u=mv),this.current.fontSizeScale=e/u,this.ctx.font=`${c} ${l} ${u}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,i,r,o){this.current.textMatrix=[t,e,n,i,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,i){const r=this.ctx,o=this.current,l=o.font,c=o.textRenderingMode,u=o.fontSize/o.fontSizeScale,h=c&_e.FILL_STROKE_MASK,f=!!(c&_e.ADD_TO_PATH_FLAG),g=o.patternFill&&!l.missingFile;let v;(l.disableFontFace||f||g)&&(v=l.getPathGenerator(this.commonObjs,t)),l.disableFontFace||g?(r.save(),r.translate(e,n),r.beginPath(),v(r,u),i&&r.setTransform(...i),(h===_e.FILL||h===_e.FILL_STROKE)&&r.fill(),(h===_e.STROKE||h===_e.FILL_STROKE)&&r.stroke(),r.restore()):((h===_e.FILL||h===_e.FILL_STROKE)&&r.fillText(t,e,n),(h===_e.STROKE||h===_e.FILL_STROKE)&&r.strokeText(t,e,n)),f&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Vt(r),x:e,y:n,fontSize:u,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 i=3;i<e.length;i+=4)if(e[i]>0&&e[i]<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 i=e.fontSize;if(i===0)return;const r=this.ctx,o=e.fontSizeScale,l=e.charSpacing,c=e.wordSpacing,u=e.fontDirection,h=e.textHScale*u,f=t.length,g=n.vertical,v=g?1:-1,y=n.defaultVMetrics,E=i*e.fontMatrix[0],S=e.textRenderingMode===_e.FILL&&!n.disableFontFace&&!e.patternFill;r.save(),r.transform(...e.textMatrix),r.translate(e.x,e.y+e.textRise),u>0?r.scale(h,-1):r.scale(h,1);let _;if(e.patternFill){r.save();const I=e.fillColor.getPattern(r,this,ni(r),De.FILL);_=Vt(r),r.restore(),r.fillStyle=I}let P=e.lineWidth;const L=e.textMatrixScale;if(L===0||P===0){const I=e.textRenderingMode&_e.FILL_STROKE_MASK;(I===_e.STROKE||I===_e.FILL_STROKE)&&(P=this.getSinglePixelWidth())}else P/=L;if(o!==1&&(r.scale(o,o),P/=o),r.lineWidth=P,n.isInvalidPDFjsFont){const I=[];let M=0;for(const C of t)I.push(C.unicode),M+=C.width;r.fillText(I.join(""),0,0),e.x+=M*E*h,r.restore(),this.compose();return}let k=0,F;for(F=0;F<f;++F){const I=t[F];if(typeof I=="number"){k+=v*I*i/1e3;continue}let M=!1;const C=(I.isSpace?c:0)+l,T=I.fontChar,N=I.accent;let D,H,z=I.width;if(g){const K=I.vmetric||y,J=-(I.vmetric?K[1]:z*.5)*E,$=K[2]*E;z=K?-K[0]:z,D=J/o,H=(k+$)/o}else D=k/o,H=0;if(n.remeasure&&z>0){const K=r.measureText(T).width*1e3/i*o;if(z<K&&this.isFontSubpixelAAEnabled){const J=z/K;M=!0,r.save(),r.scale(J,1),D/=J}else z!==K&&(D+=(z-K)/2e3*i/o)}if(this.contentVisible&&(I.isInFont||n.missingFile)){if(S&&!N)r.fillText(T,D,H);else if(this.paintChar(T,D,H,_),N){const K=D+i*N.offset.x/o,J=H-i*N.offset.y/o;this.paintChar(N.fontChar,K,J,_)}}const G=g?z*E-C*u:z*E+C*u;k+=G,M&&r.restore()}g?e.y-=k:e.x+=k*h,r.restore(),this.compose()}showType3Text(t){const e=this.ctx,n=this.current,i=n.font,r=n.fontSize,o=n.fontDirection,l=i.vertical?1:-1,c=n.charSpacing,u=n.wordSpacing,h=n.textHScale*o,f=n.fontMatrix||Ag,g=t.length,v=n.textRenderingMode===_e.INVISIBLE;let y,E,S,_;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),y=0;y<g;++y){if(E=t[y],typeof E=="number"){_=l*E*r/1e3,this.ctx.translate(_,0),n.x+=_*h;continue}const P=(E.isSpace?u:0)+c,L=i.charProcOperatorList[E.operatorListId];if(!L){yt(`Type3 character "${E.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=E,this.save(),e.scale(r,r),e.transform(...f),this.executeOperatorList(L),this.restore()),S=tt.applyTransform([E.width,0],f)[0]*r+P,e.translate(S,0),n.x+=S*h}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,n,i,r,o){this.ctx.rect(n,i,r-n,o-i),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if(t[0]==="TilingPattern"){const n=t[1],i=this.baseTransform||Vt(this.ctx),r={createCanvasGraphics:o=>new w0(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new Zg(t,n,this.ctx,r,i)}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 i=tt.makeHexColor(t,e,n);this.ctx.strokeStyle=i,this.current.strokeColor=i}setFillRGBColor(t,e,n){const i=tt.makeHexColor(t,e,n);this.ctx.fillStyle=i,this.current.fillColor=i,this.current.patternFill=!1}_getPattern(t,e=null){let n;return this.cachedPatterns.has(t)?n=this.cachedPatterns.get(t):(n=UR(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,ni(e),De.SHADING);const i=ni(e);if(i){const{width:r,height:o}=e.canvas,[l,c,u,h]=tt.getAxialAlignedBoundingBox([0,0,r,o],i);this.ctx.fillRect(l,c,u-l,h-c)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Dt("Should not call beginInlineImage")}beginImageData(){Dt("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=Vt(this.ctx),e)){const n=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],n,i),this.current.updateRectMinMax(Vt(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||ap("TODO: Support non-isolated groups."),t.knockout&&yt("Knockout groups not supported.");const n=Vt(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let i=tt.getAxialAlignedBoundingBox(t.bbox,Vt(e));const r=[0,0,e.canvas.width,e.canvas.height];i=tt.intersect(i,r)||[0,0,0,0];const o=Math.floor(i[0]),l=Math.floor(i[1]),c=Math.max(Math.ceil(i[2])-o,1),u=Math.max(Math.ceil(i[3])-l,1);this.current.startNewPathAndClipBox([0,0,c,u]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);const f=this.cachedCanvases.getCanvas(h,c,u),g=f.context;g.translate(-o,-l),g.transform(...n),t.smask?this.smaskStack.push({canvas:f.canvas,context:g,offsetX:o,offsetY:l,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,l),e.save()),Ka(e,g),this.ctx=g,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 i=Vt(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...i);const r=tt.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],i);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(r)}}beginAnnotation(t,e,n,i,r){if(A(this,pc,Jg).call(this),hu(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const o=e[2]-e[0],l=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]=l;const[c,u]=tt.singularValueDecompose2dScale(Vt(this.ctx)),{viewportScale:h}=this,f=Math.ceil(o*this.outputScaleX*h),g=Math.ceil(l*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(f,g);const{canvas:v,context:y}=this.annotationCanvas;this.annotationCanvasMap.set(t,v),this.annotationCanvas.savedCtx=this.ctx,this.ctx=y,this.ctx.save(),this.ctx.setTransform(c,0,0,-u,0,l*u),hu(this.ctx)}else hu(this.ctx),this.ctx.rect(e[0],e[1],o,l),this.ctx.clip(),this.endPath()}this.current=new bv(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...i)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),A(this,gc,Qg).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,i=this.processingType3;if(i&&(i.compiled===void 0&&(i.compiled=WR(t)),i.compiled)){i.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,i=0,r,o){if(!this.contentVisible)return;t=this.getObject(t.data,t);const l=this.ctx;l.save();const c=Vt(l);l.transform(e,n,i,r,0,0);const u=this._createMaskCanvas(t);l.setTransform(1,0,0,1,u.offsetX-c[4],u.offsetY-c[5]);for(let h=0,f=o.length;h<f;h+=2){const g=tt.transform(c,[e,n,i,r,o[h],o[h+1]]),[v,y]=tt.applyTransform([0,0],g);l.drawImage(u.canvas,v,y)}l.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,n=this.current.fillColor,i=this.current.patternFill;for(const r of t){const{data:o,width:l,height:c,transform:u}=r,h=this.cachedCanvases.getCanvas("maskCanvas",l,c),f=h.context;f.save();const g=this.getObject(o,r);Av(f,g),f.globalCompositeOperation="source-in",f.fillStyle=i?n.getPattern(f,this,ni(e),De.FILL):n,f.fillRect(0,0,l,c),f.restore(),e.save(),e.transform(...u),e.scale(1,-1),cu(e,h.canvas,0,0,l,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,i){if(!this.contentVisible)return;const r=this.getObject(t);if(!r){yt("Dependent image isn't ready yet");return}const o=r.width,l=r.height,c=[];for(let u=0,h=i.length;u<h;u+=2)c.push({transform:[e,0,0,n,i[u],i[u+1]],x:0,y:0,w:o,h:l});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:i}=t,r=this.cachedCanvases.getCanvas("inlineImage",n,i),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,i=this.ctx;if(this.save(),!Pe){const{filter:l}=i;l!=="none"&&l!==""&&(i.filter="none")}i.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;wv(c,t),r=this.applyTransferMapsToCanvas(c)}const o=this._scaleImage(r,ni(i));i.imageSmoothingEnabled=Ev(Vt(i),t.interpolate),cu(i,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 i;if(t.bitmap)i=t.bitmap;else{const r=t.width,o=t.height,c=this.cachedCanvases.getCanvas("inlineImage",r,o).context;wv(c,t),i=this.applyTransferMapsToCanvas(c)}for(const r of e)n.save(),n.transform(...r.transform),n.scale(1,-1),cu(n,i,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===_v?n.clip("evenodd"):n.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),n.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=Vt(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]),i=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(n,i)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:e,b:n,c:i,d:r}=this.ctx.getTransform();let o,l;if(n===0&&i===0){const c=Math.abs(e),u=Math.abs(r);if(c===u)if(t===0)o=l=1/c;else{const h=c*t;o=l=h<1?1/h:1}else if(t===0)o=1/c,l=1/u;else{const h=c*t,f=u*t;o=h<1?1/h:1,l=f<1?1/f:1}}else{const c=Math.abs(e*r-n*i),u=Math.hypot(e,n),h=Math.hypot(i,r);if(t===0)o=h/c,l=u/c;else{const f=t*c;o=h>f?h/f:1,l=u>f?u/f:1}}this._cachedScaleForStroking[0]=o,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:n}=this.current,[i,r]=this.getScaleForStroking();if(e.lineWidth=n||1,i===1&&r===1){e.stroke();return}const o=e.getLineDash();if(t&&e.save(),e.scale(i,r),o.length>0){const l=Math.max(i,r);e.setLineDash(o.map(c=>c/l)),e.lineDashOffset/=l}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}};pc=new WeakSet,Jg=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)},gc=new WeakSet,Qg=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 bo=w0;for(const s in fn)bo.prototype[s]!==void 0&&(bo.prototype[fn[s]]=bo.prototype[s]);var mc,vc;class $i{static get workerPort(){return a(this,mc)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");w(this,mc,t)}static get workerSrc(){return a(this,vc)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");w(this,vc,t)}}mc=new WeakMap,vc=new WeakMap,m($i,mc,null),m($i,vc,"");const uu={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(s){switch(s instanceof Error||typeof s=="object"&&s!==null||Dt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),s.name){case"AbortException":return new io(s.message);case"MissingPDFException":return new no(s.message);case"PasswordException":return new _g(s.message,s.code);case"UnexpectedResponseException":return new lp(s.message,s.status);case"UnknownErrorException":return new xg(s.message,s.details);default:return new xg(s.message,s.toString())}}var Hd,zb,zd,Vb,jo,Pu;class rl{constructor(t,e,n){m(this,Hd);m(this,zd);m(this,jo);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=i=>{const r=i.data;if(r.targetName!==this.sourceName)return;if(r.stream){A(this,zd,Vb).call(this,r);return}if(r.callback){const l=r.callbackId,c=this.callbackCapabilities[l];if(!c)throw new Error(`Cannot resolve callback ${l}`);if(delete this.callbackCapabilities[l],r.callback===uu.DATA)c.resolve(r.data);else if(r.callback===uu.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 l=this.sourceName,c=r.sourceName;new Promise(function(u){u(o(r.data))}).then(function(u){n.postMessage({sourceName:l,targetName:c,callback:uu.DATA,callbackId:r.callbackId,data:u})},function(u){n.postMessage({sourceName:l,targetName:c,callback:uu.ERROR,callbackId:r.callbackId,reason:We(u)})});return}if(r.streamId){A(this,Hd,zb).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 i=this.callbackId++,r=Promise.withResolvers();this.callbackCapabilities[i]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:e},n)}catch(o){r.reject(o)}return r.promise}sendWithStream(t,e,n,i){const r=this.streamId++,o=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:u=>{const h=Promise.withResolvers();return this.streamControllers[r]={controller:u,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:o,targetName:l,action:t,streamId:r,data:e,desiredSize:u.desiredSize},i),h.promise},pull:u=>{const h=Promise.withResolvers();return this.streamControllers[r].pullCall=h,c.postMessage({sourceName:o,targetName:l,stream:te.PULL,streamId:r,desiredSize:u.desiredSize}),h.promise},cancel:u=>{ae(u 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:l,stream:te.CANCEL,streamId:r,reason:We(u)}),h.promise}},n)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}Hd=new WeakSet,zb=function(t){const e=t.streamId,n=this.sourceName,i=t.sourceName,r=this.comObj,o=this,l=this.actionHandler[t.action],c={enqueue(u,h=1,f){if(this.isCancelled)return;const g=this.desiredSize;this.desiredSize-=h,g>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),r.postMessage({sourceName:n,targetName:i,stream:te.ENQUEUE,streamId:e,chunk:u},f)},close(){this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:n,targetName:i,stream:te.CLOSE,streamId:e}),delete o.streamSinks[e])},error(u){ae(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,r.postMessage({sourceName:n,targetName:i,stream:te.ERROR,streamId:e,reason:We(u)}))},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(u){u(l(t.data,c))}).then(function(){r.postMessage({sourceName:n,targetName:i,stream:te.START_COMPLETE,streamId:e,success:!0})},function(u){r.postMessage({sourceName:n,targetName:i,stream:te.START_COMPLETE,streamId:e,reason:We(u)})})},zd=new WeakSet,Vb=function(t){const e=t.streamId,n=this.sourceName,i=t.sourceName,r=this.comObj,o=this.streamControllers[e],l=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(!l){r.postMessage({sourceName:n,targetName:i,stream:te.PULL_COMPLETE,streamId:e,success:!0});break}l.desiredSize<=0&&t.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=t.desiredSize,new Promise(function(c){var u;c((u=l.onPull)==null?void 0:u.call(l))}).then(function(){r.postMessage({sourceName:n,targetName:i,stream:te.PULL_COMPLETE,streamId:e,success:!0})},function(c){r.postMessage({sourceName:n,targetName:i,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,jo,Pu).call(this,o,e);break;case te.ERROR:ae(o,"error should have stream controller"),o.controller.error(We(t.reason)),A(this,jo,Pu).call(this,o,e);break;case te.CANCEL_COMPLETE:t.success?o.cancelCall.resolve():o.cancelCall.reject(We(t.reason)),A(this,jo,Pu).call(this,o,e);break;case te.CANCEL:if(!l)break;new Promise(function(c){var u;c((u=l.onCancel)==null?void 0:u.call(l,We(t.reason)))}).then(function(){r.postMessage({sourceName:n,targetName:i,stream:te.CANCEL_COMPLETE,streamId:e,success:!0})},function(c){r.postMessage({sourceName:n,targetName:i,stream:te.CANCEL_COMPLETE,streamId:e,reason:We(c)})}),l.sinkCapability.reject(We(t.reason)),l.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},jo=new WeakSet,Pu=async function(t,e){var n,i,r;await Promise.allSettled([(n=t.startCall)==null?void 0:n.promise,(i=t.pullCall)==null?void 0:i.promise,(r=t.cancelCall)==null?void 0:r.promise]),delete this.streamControllers[e]};var ir,yc;class KR{constructor({parsedData:t,rawData:e}){m(this,ir,void 0);m(this,yc,void 0);w(this,ir,t),w(this,yc,e)}getRaw(){return a(this,yc)}get(t){return a(this,ir).get(t)??null}getAll(){return l0(a(this,ir))}has(t){return a(this,ir).has(t)}}ir=new WeakMap,yc=new WeakMap;const Wi=Symbol("INTERNAL");var bc,wc,Ac,Uo;class ZR{constructor(t,{name:e,intent:n,usage:i}){m(this,bc,!1);m(this,wc,!1);m(this,Ac,!1);m(this,Uo,!0);w(this,bc,!!(t&hn.DISPLAY)),w(this,wc,!!(t&hn.PRINT)),this.name=e,this.intent=n,this.usage=i}get visible(){if(a(this,Ac))return a(this,Uo);if(!a(this,Uo))return!1;const{print:t,view:e}=this.usage;return a(this,bc)?(e==null?void 0:e.viewState)!=="OFF":a(this,wc)?(t==null?void 0:t.printState)!=="OFF":!0}_setVisible(t,e,n=!1){t!==Wi&&Dt("Internal method `_setVisible` called."),w(this,Ac,n),w(this,Uo,e)}}bc=new WeakMap,wc=new WeakMap,Ac=new WeakMap,Uo=new WeakMap;var ss,Mt,Ho,zo,Ec,tm;class JR{constructor(t,e=hn.DISPLAY){m(this,Ec);m(this,ss,null);m(this,Mt,new Map);m(this,Ho,null);m(this,zo,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,w(this,zo,t.order);for(const n of t.groups)a(this,Mt).set(n.id,new ZR(e,n));if(t.baseState==="OFF")for(const n of a(this,Mt).values())n._setVisible(Wi,!1);for(const n of t.on)a(this,Mt).get(n)._setVisible(Wi,!0);for(const n of t.off)a(this,Mt).get(n)._setVisible(Wi,!1);w(this,Ho,this.getHash())}}isVisible(t){if(a(this,Mt).size===0)return!0;if(!t)return ap("Optional content group not defined."),!0;if(t.type==="OCG")return a(this,Mt).has(t.id)?a(this,Mt).get(t.id).visible:(yt(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return A(this,Ec,tm).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const e of t.ids){if(!a(this,Mt).has(e))return yt(`Optional content group not found: ${e}`),!0;if(a(this,Mt).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const e of t.ids){if(!a(this,Mt).has(e))return yt(`Optional content group not found: ${e}`),!0;if(!a(this,Mt).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const e of t.ids){if(!a(this,Mt).has(e))return yt(`Optional content group not found: ${e}`),!0;if(!a(this,Mt).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const e of t.ids){if(!a(this,Mt).has(e))return yt(`Optional content group not found: ${e}`),!0;if(a(this,Mt).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=a(this,Mt).get(t);if(!n){yt(`Optional content group not found: ${t}`);return}n._setVisible(Wi,!!e,!0),w(this,ss,null)}setOCGState({state:t,preserveRB:e}){let n;for(const i of t){switch(i){case"ON":case"OFF":case"Toggle":n=i;continue}const r=a(this,Mt).get(i);if(r)switch(n){case"ON":r._setVisible(Wi,!0);break;case"OFF":r._setVisible(Wi,!1);break;case"Toggle":r._setVisible(Wi,!r.visible);break}}w(this,ss,null)}get hasInitialVisibility(){return a(this,Ho)===null||this.getHash()===a(this,Ho)}getOrder(){return a(this,Mt).size?a(this,zo)?a(this,zo).slice():[...a(this,Mt).keys()]:null}getGroups(){return a(this,Mt).size>0?l0(a(this,Mt)):null}getGroup(t){return a(this,Mt).get(t)||null}getHash(){if(a(this,ss)!==null)return a(this,ss);const t=new $b;for(const[e,n]of a(this,Mt))t.update(`${e}:${n.visible}`);return w(this,ss,t.hexdigest())}}ss=new WeakMap,Mt=new WeakMap,Ho=new WeakMap,zo=new WeakMap,Ec=new WeakSet,tm=function(t){const e=t.length;if(e<2)return!0;const n=t[0];for(let i=1;i<e;i++){const r=t[i];let o;if(Array.isArray(r))o=A(this,Ec,tm).call(this,r);else if(a(this,Mt).has(r))o=a(this,Mt).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 QR{constructor(t,{disableRange:e=!1,disableStream:n=!1}){ae(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:i,initialData:r,progressiveDone:o,contentDispositionFilename:l}=t;if(this._queuedChunks=[],this._progressiveDone=o,this._contentDispositionFilename=l,(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=i,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((c,u)=>{this._onReceiveData({begin:c,chunk:u})}),t.addProgressListener((c,u)=>{this._onProgress({loaded:c,total:u})}),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 i=this._rangeReaders.some(function(r){return r._begin!==t?!1:(r._enqueue(n),!0)});ae(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}_onProgress(t){var e,n,i,r;t.total===void 0?(n=(e=this._rangeReaders[0])==null?void 0:e.onProgress)==null||n.call(e,{loaded:t.loaded}):(r=(i=this._fullRequestReader)==null?void 0:i.onProgress)==null||r.call(i,{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 tL(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const n=new eL(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 tL{constructor(t,e,n=!1,i=null){this._stream=t,this._done=n||!1,this._filename=f0(i)?i: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 eL{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 nL(s){let t=!0,e=n("filename\\*","i").exec(s);if(e){e=e[1];let h=l(e);return h=unescape(h),h=c(h),h=u(h),r(h)}if(e=o(s),e){const h=u(e);return r(h)}if(e=n("filename","i").exec(s),e){e=e[1];let h=l(e);return h=u(h),r(h)}function n(h,f){return new RegExp("(?:^|;)\\s*"+h+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',f)}function i(h,f){if(h){if(!/^[\x00-\xFF]+$/.test(f))return f;try{const g=new TextDecoder(h,{fatal:!0}),v=cp(f);f=g.decode(v),t=!1}catch{}}return f}function r(h){return t&&/[\x80-\xff]/.test(h)&&(h=i("utf-8",h),t&&(h=i("iso-8859-1",h))),h}function o(h){const f=[];let g;const v=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(g=v.exec(h))!==null;){let[,E,S,_]=g;if(E=parseInt(E,10),E in f){if(E===0)break;continue}f[E]=[S,_]}const y=[];for(let E=0;E<f.length&&E in f;++E){let[S,_]=f[E];_=l(_),S&&(_=unescape(_),E===0&&(_=c(_))),y.push(_)}return y.join("")}function l(h){if(h.startsWith('"')){const f=h.slice(1).split('\\"');for(let g=0;g<f.length;++g){const v=f[g].indexOf('"');v!==-1&&(f[g]=f[g].slice(0,v),f.length=g+1),f[g]=f[g].replaceAll(/\\(.)/g,"$1")}h=f.join('"')}return h}function c(h){const f=h.indexOf("'");if(f===-1)return h;const g=h.slice(0,f),y=h.slice(f+1).replace(/^[^']*'/,"");return i(g,y)}function u(h){return!h.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(h)?h:h.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(f,g,v,y){if(v==="q"||v==="Q")return y=y.replaceAll("_"," "),y=y.replaceAll(/=([0-9a-fA-F]{2})/g,function(E,S){return String.fromCharCode(parseInt(S,16))}),i(g,y);try{y=atob(y)}catch{}return i(g,y)})}return""}function m0({getResponseHeader:s,isHttp:t,rangeChunkSize:e,disableRange:n}){const i={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(s("Content-Length"),10);return!Number.isInteger(r)||(i.suggestedLength=r,r<=2*e)||n||!t||s("Accept-Ranges")!=="bytes"||(s("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function v0(s){const t=s("Content-Disposition");if(t){let e=nL(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(f0(e))return e}return null}function gp(s,t){return s===404||s===0&&t.startsWith("file:")?new no('Missing PDF "'+t+'".'):new lp(`Unexpected server response (${s}) while retrieving PDF "${t}".`,s)}function Gb(s){return s===200||s===206}function Wb(s,t,e){return{method:"GET",headers:s,signal:e.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function qb(s){const t=new Headers;for(const e in s){const n=s[e];n!==void 0&&t.append(e,n)}return t}function Xb(s){return s instanceof Uint8Array?s.buffer:s instanceof ArrayBuffer?s:(yt(`getArrayBuffer - unexpected data format: ${s}`),new Uint8Array(s).buffer)}class xv{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 iL(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const n=new sL(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 iL{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=qb(this._stream.httpHeaders);const n=e.url;fetch(n,Wb(this._headers,this._withCredentials,this._abortController)).then(i=>{if(!Gb(i.status))throw gp(i.status,n);this._reader=i.body.getReader(),this._headersCapability.resolve();const r=c=>i.headers.get(c),{allowRangeRequests:o,suggestedLength:l}=m0({getResponseHeader:r,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=l||this._contentLength,this._filename=v0(r),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new io("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:Xb(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}class sL{constructor(t,e,n){this._stream=t,this._reader=null,this._loaded=0;const i=t.source;this._withCredentials=i.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!i.disableStream,this._abortController=new AbortController,this._headers=qb(this._stream.httpHeaders),this._headers.append("Range",`bytes=${e}-${n-1}`);const r=i.url;fetch(r,Wb(this._headers,this._withCredentials,this._abortController)).then(o=>{if(!Gb(o.status))throw gp(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:Xb(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}const Jp=200,Qp=206;function rL(s){const t=s.response;return typeof t!="string"?t:cp(t).buffer}class oL{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 i={begin:t,end:e};for(const r in n)i[r]=n[r];return this.request(i)}requestFull(t){return this.request(t)}request(t){const e=new XMLHttpRequest,n=this.currXhrId++,i=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}`),i.expectedStatus=Qp):i.expectedStatus=Jp,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),i.onHeadersReceived=t.onHeadersReceived,i.onDone=t.onDone,i.onError=t.onError,i.onProgress=t.onProgress,e.send(null),n}onProgress(t,e){var i;const n=this.pendingRequests[t];n&&((i=n.onProgress)==null||i.call(n,e))}onStateChange(t,e){var c,u,h;const n=this.pendingRequests[t];if(!n)return;const i=n.xhr;if(i.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),i.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],i.status===0&&this.isHttp){(c=n.onError)==null||c.call(n,i.status);return}const r=i.status||Jp;if(!(r===Jp&&n.expectedStatus===Qp)&&r!==n.expectedStatus){(u=n.onError)==null||u.call(n,i.status);return}const l=rL(i);if(r===Qp){const f=i.getResponseHeader("Content-Range"),g=/bytes (\d+)-(\d+)\/(\d+)/.exec(f);n.onDone({begin:parseInt(g[1],10),chunk:l})}else l?n.onDone({begin:0,chunk:l}):(h=n.onError)==null||h.call(n,i.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 aL{constructor(t){this._source=t,this._manager=new oL(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 lL(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const n=new cL(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 lL{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:i,suggestedLength:r}=m0({getResponseHeader:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=r||this._contentLength,this._filename=v0(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=gp(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 cL{constructor(t,e,n){this._manager=t;const i={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,i),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=gp(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 Yb=/^file:\/\/\/[a-zA-Z]:\//;function hL(s){const t=Jn.get("url"),e=t.parse(s);return e.protocol==="file:"||e.host?e:/^[a-z]:[/\\]/i.test(s)?t.parse(`file:///${s}`):(e.host||(e.protocol="file:"),e)}class uL{constructor(t){this.source=t,this.url=hL(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 pL(this):new dL(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const n=this.isFsUrl?new gL(this,t,e):new fL(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 Kb{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 io("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Zb{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 sd(s,t){return{protocol:s.protocol,auth:s.auth,host:s.hostname,port:s.port,path:s.path,method:"GET",headers:t}}class dL extends Kb{constructor(t){super(t);const e=n=>{if(n.statusCode===404){const l=new no(`Missing PDF "${this._url}".`);this._storedError=l,this._headersCapability.reject(l);return}this._headersCapability.resolve(),this._setReadableStream(n);const i=l=>this._readableStream.headers[l.toLowerCase()],{allowRangeRequests:r,suggestedLength:o}=m0({getResponseHeader:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=o||this._contentLength,this._filename=v0(i)};if(this._request=null,this._url.protocol==="http:"){const n=Jn.get("http");this._request=n.request(sd(this._url,t.httpHeaders),e)}else{const n=Jn.get("https");this._request=n.request(sd(this._url,t.httpHeaders),e)}this._request.on("error",n=>{this._storedError=n,this._headersCapability.reject(n)}),this._request.end()}}class fL extends Zb{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 i=r=>{if(r.statusCode===404){const o=new no(`Missing PDF "${this._url}".`);this._storedError=o;return}this._setReadableStream(r)};if(this._request=null,this._url.protocol==="http:"){const r=Jn.get("http");this._request=r.request(sd(this._url,this._httpHeaders),i)}else{const r=Jn.get("https");this._request=r.request(sd(this._url,this._httpHeaders),i)}this._request.on("error",r=>{this._storedError=r}),this._request.end()}}class pL extends Kb{constructor(t){super(t);let e=decodeURIComponent(this._url.path);Yb.test(this._url.href)&&(e=e.replace(/^\//,""));const n=Jn.get("fs");n.promises.lstat(e).then(i=>{this._contentLength=i.size,this._setReadableStream(n.createReadStream(e)),this._headersCapability.resolve()},i=>{i.code==="ENOENT"&&(i=new no(`Missing PDF "${e}".`)),this._storedError=i,this._headersCapability.reject(i)})}}class gL extends Zb{constructor(t,e,n){super(t);let i=decodeURIComponent(this._url.path);Yb.test(this._url.href)&&(i=i.replace(/^\//,""));const r=Jn.get("fs");this._setReadableStream(r.createReadStream(i,{start:e,end:n-1}))}}const mL=1e5,Ne=30,vL=.8;var jv,rs,$e,_c,xc,sr,bi,Sc,Cc,rr,Vo,Go,os,Wo,Tc,qo,or,Pc,Rc,Ue,ar,lr,Xo,Vd,Jb,Gd,Qb,Lc,em,Yo,Ru,Wd,tw;let rd=(Ue=class{constructor({textContentSource:t,container:e,viewport:n}){m(this,Vd);m(this,Gd);m(this,Lc);m(this,rs,Promise.withResolvers());m(this,$e,null);m(this,_c,!1);m(this,xc,!!((jv=globalThis.FontInspector)!=null&&jv.enabled));m(this,sr,null);m(this,bi,null);m(this,Sc,0);m(this,Cc,0);m(this,rr,null);m(this,Vo,null);m(this,Go,0);m(this,os,0);m(this,Wo,Object.create(null));m(this,Tc,[]);m(this,qo,null);m(this,or,[]);m(this,Pc,new WeakMap);m(this,Rc,null);if(t instanceof ReadableStream)w(this,qo,t);else if(typeof t=="object")w(this,qo,new ReadableStream({start(c){c.enqueue(t),c.close()}}));else throw new Error('No "textContentSource" parameter specified.');w(this,$e,w(this,Vo,e)),w(this,os,n.scale*(globalThis.devicePixelRatio||1)),w(this,Go,n.rotation),w(this,bi,{prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:null});const{pageWidth:i,pageHeight:r,pageX:o,pageY:l}=n.rawDims;w(this,Rc,[1,0,0,-1,-o,l+r]),w(this,Cc,i),w(this,Sc,r),Yr(e,n),a(this,rs).promise.catch(()=>{}).then(()=>{a(Ue,Xo).delete(this),w(this,bi,null),w(this,Wo,null)})}render(){const t=()=>{a(this,rr).read().then(({value:e,done:n})=>{if(n){a(this,rs).resolve();return}a(this,sr)??w(this,sr,e.lang),Object.assign(a(this,Wo),e.styles),A(this,Vd,Jb).call(this,e.items),t()},a(this,rs).reject)};return w(this,rr,a(this,qo).getReader()),a(Ue,Xo).add(this),t(),a(this,rs).promise}update({viewport:t,onBefore:e=null}){var r;const n=t.scale*(globalThis.devicePixelRatio||1),i=t.rotation;if(i!==a(this,Go)&&(e==null||e(),w(this,Go,i),Yr(a(this,Vo),{rotation:i})),n!==a(this,os)){e==null||e(),w(this,os,n);const o={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:A(r=Ue,Yo,Ru).call(r,a(this,sr))};for(const l of a(this,or))o.properties=a(this,Pc).get(l),o.div=l,A(this,Lc,em).call(this,o)}}cancel(){var e;const t=new io("TextLayer task cancelled.");(e=a(this,rr))==null||e.cancel(t).catch(()=>{}),w(this,rr,null),a(this,rs).reject(t)}get textDivs(){return a(this,or)}get textContentItemsStr(){return a(this,Tc)}static cleanup(){if(!(a(this,Xo).size>0)){a(this,ar).clear();for(const{canvas:t}of a(this,lr).values())t.remove();a(this,lr).clear()}}},rs=new WeakMap,$e=new WeakMap,_c=new WeakMap,xc=new WeakMap,sr=new WeakMap,bi=new WeakMap,Sc=new WeakMap,Cc=new WeakMap,rr=new WeakMap,Vo=new WeakMap,Go=new WeakMap,os=new WeakMap,Wo=new WeakMap,Tc=new WeakMap,qo=new WeakMap,or=new WeakMap,Pc=new WeakMap,Rc=new WeakMap,ar=new WeakMap,lr=new WeakMap,Xo=new WeakMap,Vd=new WeakSet,Jb=function(t){var i,r;if(a(this,_c))return;(r=a(this,bi)).ctx||(r.ctx=A(i=Ue,Yo,Ru).call(i,a(this,sr)));const e=a(this,or),n=a(this,Tc);for(const o of t){if(e.length>mL){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 l=a(this,$e);w(this,$e,document.createElement("span")),a(this,$e).classList.add("markedContent"),o.id!==null&&a(this,$e).setAttribute("id",`${o.id}`),l.append(a(this,$e))}else o.type==="endMarkedContent"&&w(this,$e,a(this,$e).parentNode);continue}n.push(o.str),A(this,Gd,Qb).call(this,o)}},Gd=new WeakSet,Qb=function(t){var E;const e=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};a(this,or).push(e);const i=tt.transform(a(this,Rc),t.transform);let r=Math.atan2(i[1],i[0]);const o=a(this,Wo)[t.fontName];o.vertical&&(r+=Math.PI/2);const l=a(this,xc)&&o.fontSubstitution||o.fontFamily,c=Math.hypot(i[2],i[3]),u=c*A(E=Ue,Wd,tw).call(E,l,a(this,sr));let h,f;r===0?(h=i[4],f=i[5]-u):(h=i[4]+u*Math.sin(r),f=i[5]-u*Math.cos(r));const g="calc(var(--scale-factor)*",v=e.style;a(this,$e)===a(this,Vo)?(v.left=`${(100*h/a(this,Cc)).toFixed(2)}%`,v.top=`${(100*f/a(this,Sc)).toFixed(2)}%`):(v.left=`${g}${h.toFixed(2)}px)`,v.top=`${g}${f.toFixed(2)}px)`),v.fontSize=`${g}${c.toFixed(2)}px)`,v.fontFamily=l,n.fontSize=c,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,a(this,xc)&&(e.dataset.fontName=o.fontSubstitutionLoadedName||t.fontName),r!==0&&(n.angle=r*(180/Math.PI));let y=!1;if(t.str.length>1)y=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const S=Math.abs(t.transform[0]),_=Math.abs(t.transform[3]);S!==_&&Math.max(S,_)/Math.min(S,_)>1.5&&(y=!0)}if(y&&(n.canvasWidth=o.vertical?t.height:t.width),a(this,Pc).set(e,n),a(this,bi).div=e,a(this,bi).properties=n,A(this,Lc,em).call(this,a(this,bi)),n.hasText&&a(this,$e).append(e),n.hasEOL){const S=document.createElement("br");S.setAttribute("role","presentation"),a(this,$e).append(S)}},Lc=new WeakSet,em=function(t){const{div:e,properties:n,ctx:i,prevFontSize:r,prevFontFamily:o}=t,{style:l}=e;let c="";if(n.canvasWidth!==0&&n.hasText){const{fontFamily:u}=l,{canvasWidth:h,fontSize:f}=n;(r!==f||o!==u)&&(i.font=`${f*a(this,os)}px ${u}`,t.prevFontSize=f,t.prevFontFamily=u);const{width:g}=i.measureText(e.textContent);g>0&&(c=`scaleX(${h*a(this,os)/g})`)}n.angle!==0&&(c=`rotate(${n.angle}deg) ${c}`),c.length>0&&(l.transform=c)},Yo=new WeakSet,Ru=function(t=null){let e=a(this,lr).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}),a(this,lr).set(t,e)}return e},Wd=new WeakSet,tw=function(t,e){const n=a(this,ar).get(t);if(n)return n;const i=A(this,Yo,Ru).call(this,e),r=i.font;i.canvas.width=i.canvas.height=Ne,i.font=`${Ne}px ${t}`;const o=i.measureText("");let l=o.fontBoundingBoxAscent,c=Math.abs(o.fontBoundingBoxDescent);if(l){const f=l/(l+c);return a(this,ar).set(t,f),i.canvas.width=i.canvas.height=0,i.font=r,f}i.strokeStyle="red",i.clearRect(0,0,Ne,Ne),i.strokeText("g",0,0);let u=i.getImageData(0,0,Ne,Ne).data;c=0;for(let f=u.length-1-3;f>=0;f-=4)if(u[f]>0){c=Math.ceil(f/4/Ne);break}i.clearRect(0,0,Ne,Ne),i.strokeText("A",0,Ne),u=i.getImageData(0,0,Ne,Ne).data,l=0;for(let f=0,g=u.length;f<g;f+=4)if(u[f]>0){l=Ne-Math.floor(f/4/Ne);break}i.canvas.width=i.canvas.height=0,i.font=r;const h=l?l/(l+c):vL;return a(this,ar).set(t,h),h},m(Ue,Yo),m(Ue,Wd),m(Ue,ar,new Map),m(Ue,lr,new Map),m(Ue,Xo,new Set),Ue);function yL(){gb("`renderTextLayer`, please use `TextLayer` instead.");const{textContentSource:s,container:t,viewport:e,...n}=arguments[0],i=Object.keys(n);i.length>0&&yt("Ignoring `renderTextLayer` parameters: "+i.join(", "));const r=new rd({textContentSource:s,container:t,viewport:e}),{textDivs:o,textContentItemsStr:l}=r;return{promise:r.render(),textDivs:o,textContentItemsStr:l}}function bL(){gb("`updateTextLayer`, please use `TextLayer` instead.")}class wl{static textContent(t){const e=[],n={items:e,styles:Object.create(null)};function i(r){var c;if(!r)return;let o=null;const l=r.name;if(l==="#text")o=r.value;else if(wl.shouldBuildText(l))(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 u of r.children)i(u)}return i(t),n}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const wL=65536,AL=100,EL=5e3,_L=Pe?MR:AR,xL=Pe?DR:fb,SL=Pe?FR:wR,CL=Pe?OR:pb;function TL(s){if(typeof s=="string"||s instanceof URL?s={url:s}:(s instanceof ArrayBuffer||ArrayBuffer.isView(s))&&(s={data:s}),typeof s!="object")throw new Error("Invalid parameter in getDocument, need parameter object.");if(!s.url&&!s.data&&!s.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const t=new nm,{docId:e}=t,n=s.url?PL(s.url):null,i=s.data?RL(s.data):null,r=s.httpHeaders||null,o=s.withCredentials===!0,l=s.password??null,c=s.range instanceof ew?s.range:null,u=Number.isInteger(s.rangeChunkSize)&&s.rangeChunkSize>0?s.rangeChunkSize:wL;let h=s.worker instanceof wo?s.worker:null;const f=s.verbosity,g=typeof s.docBaseUrl=="string"&&!d0(s.docBaseUrl)?s.docBaseUrl:null,v=typeof s.cMapUrl=="string"?s.cMapUrl:null,y=s.cMapPacked!==!1,E=s.CMapReaderFactory||xL,S=typeof s.standardFontDataUrl=="string"?s.standardFontDataUrl:null,_=s.StandardFontDataFactory||CL,P=s.stopAtErrors!==!0,L=Number.isInteger(s.maxImageSize)&&s.maxImageSize>-1?s.maxImageSize:-1,k=s.isEvalSupported!==!1,F=typeof s.isOffscreenCanvasSupported=="boolean"?s.isOffscreenCanvasSupported:!Pe,I=Number.isInteger(s.canvasMaxAreaInBytes)?s.canvasMaxAreaInBytes:-1,M=typeof s.disableFontFace=="boolean"?s.disableFontFace:Pe,C=s.fontExtraProperties===!0,T=s.enableXfa===!0,N=s.ownerDocument||globalThis.document,D=s.disableRange===!0,H=s.disableStream===!0,z=s.disableAutoFetch===!0,G=s.pdfBug===!0,K=c?c.length:s.length??NaN,J=typeof s.useSystemFonts=="boolean"?s.useSystemFonts:!Pe&&!M,$=typeof s.useWorkerFetch=="boolean"?s.useWorkerFetch:E===fb&&_===pb&&v&&S&&nl(v,document.baseURI)&&nl(S,document.baseURI),W=s.canvasFactory||new _L({ownerDocument:N}),q=s.filterFactory||new SL({docId:e,ownerDocument:N}),wt=null;cR(f);const ft={canvasFactory:W,filterFactory:q};if($||(ft.cMapReaderFactory=new E({baseUrl:v,isCompressed:y}),ft.standardFontDataFactory=new _({baseUrl:S})),!h){const et={verbosity:f,port:$i.workerPort};h=et.port?wo.fromPort(et):new wo(et),t._worker=h}const V={docId:e,apiVersion:"4.3.136",data:i,password:l,disableAutoFetch:z,rangeChunkSize:u,length:K,docBaseUrl:g,enableXfa:T,evaluatorOptions:{maxImageSize:L,disableFontFace:M,ignoreErrors:P,isEvalSupported:k,isOffscreenCanvasSupported:F,canvasMaxAreaInBytes:I,fontExtraProperties:C,useSystemFonts:J,cMapUrl:$?v:null,standardFontDataUrl:$?S:null}},it={disableFontFace:M,fontExtraProperties:C,ownerDocument:N,pdfBug:G,styleElement:wt,loadingParams:{disableAutoFetch:z,enableXfa:T}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const et=h.messageHandler.sendWithPromise("GetDocRequest",V,i?[i.buffer]:null);let nt;return c?nt=new QR(c,{disableRange:D,disableStream:H}):i||(nt=(Z=>Pe?function(){return typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype}()&&nl(Z.url)?new xv(Z):new uL(Z):nl(Z.url)?new xv(Z):new aL(Z))({url:n,length:K,httpHeaders:r,withCredentials:o,rangeChunkSize:u,disableRange:D,disableStream:H})),et.then(ht=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const Z=new rl(e,ht,h.port),mt=new FL(Z,t,nt,it,ft);t._transport=mt,Z.send("Ready",null)})}).catch(t._capability.reject),t}function PL(s){if(s instanceof URL)return s.href;try{return new URL(s,window.location).href}catch{if(Pe&&typeof s=="string")return s}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function RL(s){if(Pe&&typeof ed<"u"&&s instanceof ed)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(s instanceof Uint8Array&&s.byteLength===s.buffer.byteLength)return s;if(typeof s=="string")return cp(s);if(s instanceof ArrayBuffer||ArrayBuffer.isView(s)||typeof s=="object"&&!isNaN(s==null?void 0:s.length))return new Uint8Array(s);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function Sv(s){return typeof s=="object"&&Number.isInteger(s==null?void 0:s.num)&&s.num>=0&&Number.isInteger(s==null?void 0:s.gen)&&s.gen>=0}var qd;const Xd=class Xd{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${Ge(Xd,qd)._++}`,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(i){throw(n=this._worker)!=null&&n.port&&delete this._worker._pendingDestroy,i}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};qd=new WeakMap,m(Xd,qd,0);let nm=Xd,ew=class{constructor(t,e,n=!1,i=null){this.length=t,this.initialData=e,this.progressiveDone=n,this.contentDispositionFilename=i,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){Dt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class LL{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 as,wi,ls,uo,Ko,Lu;class kL{constructor(t,e,n,i=!1){m(this,ls);m(this,Ko);m(this,as,null);m(this,wi,!1);this._pageIndex=t,this._pageInfo=e,this._transport=n,this._stats=i?new uv:null,this._pdfBug=i,this.commonObjs=n.commonObjs,this.objs=new nw,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:i=0,dontFlip:r=!1}={}){return new qh({viewBox:this.view,scale:t,rotation:e,offsetX:n,offsetY:i,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:i=Xi.ENABLE,transform:r=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:c=null,pageColors:u=null,printAnnotationStorage:h=null}){var L,k;(L=this._stats)==null||L.time("Overall");const f=this._transport.getRenderingIntent(n,i,h),{renderingIntent:g,cacheKey:v}=f;w(this,wi,!1),A(this,Ko,Lu).call(this),l||(l=this._transport.getOptionalContentConfig(g));let y=this._intentStates.get(v);y||(y=Object.create(null),this._intentStates.set(v,y)),y.streamReaderCancelTimeout&&(clearTimeout(y.streamReaderCancelTimeout),y.streamReaderCancelTimeout=null);const E=!!(g&hn.PRINT);y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(k=this._stats)==null||k.time("Page Request"),this._pumpOperatorList(f));const S=F=>{var I;y.renderTasks.delete(_),(this._maybeCleanupAfterRender||E)&&w(this,wi,!0),A(this,ls,uo).call(this,!E),F?(_.capability.reject(F),this._abortOperatorList({intentState:y,reason:F instanceof Error?F:new Error(F)})):_.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(I=globalThis.Stats)!=null&&I.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},_=new sm({callback:S,params:{canvasContext:t,viewport:e,transform:r,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!E,pdfBug:this._pdfBug,pageColors:u});(y.renderTasks||(y.renderTasks=new Set)).add(_);const P=_.task;return Promise.all([y.displayReadyCapability.promise,l]).then(([F,I])=>{var M;if(this.destroyed){S();return}if((M=this._stats)==null||M.time("Rendering"),!(I.renderingIntent&g))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");_.initializeGraphics({transparency:F,optionalContentConfig:I}),_.operatorListChanged()}).catch(S),P}getOperatorList({intent:t="display",annotationMode:e=Xi.ENABLE,printAnnotationStorage:n=null}={}){var c;function i(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}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 l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=i,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(l),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(i){return i.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(n=>wl.textContent(n));const e=this.streamTextContent(t);return new Promise(function(n,i){function r(){o.read().then(function({value:c,done:u}){if(u){n(l);return}l.lang??(l.lang=c.lang),Object.assign(l.styles,c.styles),l.items.push(...c.items),r()},i)}const o=e.getReader(),l={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,wi,!1),A(this,Ko,Lu).call(this),Promise.all(t)}cleanup(t=!1){w(this,wi,!0);const e=A(this,ls,uo).call(this,!1);return t&&e&&this._stats&&(this._stats=new uv),e}_startRenderPage(t,e){var i,r;const n=this._intentStates.get(e);n&&((i=this._stats)==null||i.timeEnd("Page Request"),(r=n.displayReadyCapability)==null||r.resolve(t))}_renderPageChunk(t,e){for(let n=0,i=t.length;n<i;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,ls,uo).call(this,!0)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:n}){const{map:i,transfer:r}=n,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:i},r).getReader(),c=this._intentStates.get(e);c.streamReader=l;const u=()=>{l.read().then(({value:h,done:f})=>{if(f){c.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,c),u())},h=>{if(c.streamReader=null,!this._transport.destroyed){if(c.operatorList){c.operatorList.lastChunk=!0;for(const f of c.renderTasks)f.operatorListChanged();A(this,ls,uo).call(this,!0)}if(c.displayReadyCapability)c.displayReadyCapability.reject(h);else if(c.opListReadCapability)c.opListReadCapability.reject(h);else throw h}})};u()}_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 u0){let i=AL;e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new io(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[i,r]of this._intentStates)if(r===t){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}}as=new WeakMap,wi=new WeakMap,ls=new WeakSet,uo=function(t=!1){if(A(this,Ko,Lu).call(this),!a(this,wi)||this.destroyed)return!1;if(t)return w(this,as,setTimeout(()=>{w(this,as,null),A(this,ls,uo).call(this,!1)},EL)),!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,wi,!1),!0},Ko=new WeakSet,Lu=function(){a(this,as)&&(clearTimeout(a(this,as)),w(this,as,null))};var cr,Yd;class IL{constructor(){m(this,cr,new Set);m(this,Yd,Promise.resolve())}postMessage(t,e){const n={data:structuredClone(t,e?{transfer:e}:null)};a(this,Yd).then(()=>{for(const i of a(this,cr))i.call(this,n)})}addEventListener(t,e){a(this,cr).add(e)}removeEventListener(t,e){a(this,cr).delete(e)}terminate(){a(this,cr).clear()}}cr=new WeakMap,Yd=new WeakMap;const li={isWorkerDisabled:!1,fakeWorkerId:0};Pe&&(li.isWorkerDisabled=!0,$i.workerSrc||($i.workerSrc="./pdf.worker.mjs")),li.isSameOrigin=function(s,t){let e;try{if(e=new URL(s),!e.origin||e.origin==="null")return!1}catch{return!1}const n=new URL(t,e);return e.origin===n.origin},li.createCDNWrapper=function(s){const t=`await import("${s}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};var hr,Zo,ku;const qe=class qe{constructor({name:t=null,port:e=null,verbosity:n=hR()}={}){var i;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((i=a(qe,hr))!=null&&i.has(e))throw new Error("Cannot use more than one PDFWorker per port.");(a(qe,hr)||w(qe,hr,new WeakMap)).set(e,this),this._initializeFromPort(e);return}this._initialize()}get promise(){return Pe?Promise.all([Jn.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 rl("main","worker",t),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!li.isWorkerDisabled&&!a(qe,Zo,ku)){let{workerSrc:t}=qe;try{li.isSameOrigin(window.location.href,t)||(t=li.createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),n=new rl("main","worker",e),i=()=>{e.removeEventListener("error",r),n.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},r=()=>{this._webWorker||i()};e.addEventListener("error",r),n.on("test",l=>{if(e.removeEventListener("error",r),this.destroyed){i();return}l?(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",l=>{if(e.removeEventListener("error",r),this.destroyed){i();return}try{o()}catch{this._setupFakeWorker()}});const o=()=>{const l=new Uint8Array;n.send("test",l,[l.buffer])};o();return}catch{ap("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){li.isWorkerDisabled||(yt("Setting up fake worker."),li.isWorkerDisabled=!0),qe._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const e=new IL;this._port=e;const n=`fake${li.fakeWorkerId++}`,i=new rl(n+"_worker",n,e);t.setup(i,e);const r=new rl(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=a(qe,hr))==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=a(this,hr))==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($i.workerSrc)return $i.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Tt(this,"_setupFakeWorkerGlobal",(async()=>a(this,Zo,ku)?a(this,Zo,ku):(await import(this.workerSrc)).WorkerMessageHandler)())}};hr=new WeakMap,Zo=new WeakSet,ku=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch{return null}},m(qe,Zo),m(qe,hr,void 0);let wo=qe;var Ai,$n,Jo,Qo,jn,ur,ol;class FL{constructor(t,e,n,i,r){m(this,ur);m(this,Ai,new Map);m(this,$n,new Map);m(this,Jo,new Map);m(this,Qo,new Map);m(this,jn,null);this.messageHandler=t,this.loadingTask=e,this.commonObjs=new nw,this.fontLoader=new kR({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.loadingParams=i.loadingParams,this._params=i,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 g0)}getRenderingIntent(t,e=Xi.ENABLE,n=null,i=!1){let r=hn.DISPLAY,o=Xg;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 Xi.DISABLE:r+=hn.ANNOTATIONS_DISABLE;break;case Xi.ENABLE:break;case Xi.ENABLE_FORMS:r+=hn.ANNOTATIONS_FORMS;break;case Xi.ENABLE_STORAGE:r+=hn.ANNOTATIONS_STORAGE,o=(r&hn.PRINT&&n instanceof Ub?n:this.annotationStorage).serializable;break;default:yt(`getRenderingIntent - invalid annotationMode: ${e}`)}return i&&(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=a(this,jn))==null||n.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const i of a(this,$n).values())t.push(i._destroy());a(this,$n).clear(),a(this,Jo).clear(),a(this,Qo).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{var i;this.commonObjs.clear(),this.fontLoader.clear(),a(this,Ai).clear(),this.filterFactory.destroy(),rd.cleanup(),(i=this._networkStream)==null||i.cancelAllRequests(new io("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,i)=>{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}},i.onPull=()=>{this._fullReader.read().then(function({value:r,done:o}){if(o){i.close();return}ae(r instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(r),1,[r])}).catch(r=>{i.error(r)})},i.onCancel=r=>{this._fullReader.cancel(r),i.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("ReaderHeadersReady",n=>{const i=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=l=>{var c;(c=e.onProgress)==null||c.call(e,{loaded:l.loaded,total:l.total})}),i.resolve({isStreamingSupported:r.isStreamingSupported,isRangeSupported:r.isRangeSupported,contentLength:r.contentLength})},i.reject),i.promise}),t.on("GetRangeReader",(n,i)=>{ae(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const r=this._networkStream.getRangeReader(n.begin,n.end);if(!r){i.close();return}i.onPull=()=>{r.read().then(function({value:o,done:l}){if(l){i.close();return}ae(o instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{i.error(o)})},i.onCancel=o=>{r.cancel(o),i.ready.catch(l=>{if(!this.destroyed)throw l})}}),t.on("GetDoc",({pdfInfo:n})=>{this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,e._capability.resolve(new LL(n,this))}),t.on("DocException",function(n){let i;switch(n.name){case"PasswordException":i=new _g(n.message,n.code);break;case"InvalidPDFException":i=new cb(n.message);break;case"MissingPDFException":i=new no(n.message);break;case"UnexpectedResponseException":i=new lp(n.message,n.status);break;case"UnknownErrorException":i=new xg(n.message,n.details);break;default:Dt("DocException - expected a valid Error.")}e._capability.reject(i)}),t.on("PasswordRequest",n=>{if(w(this,jn,Promise.withResolvers()),e.onPassword){const i=r=>{r instanceof Error?a(this,jn).reject(r):a(this,jn).resolve({password:r})};try{e.onPassword(i,n.code)}catch(r){a(this,jn).reject(r)}}else a(this,jn).reject(new _g(n.message,n.code));return a(this,jn).promise}),t.on("DataLoaded",n=>{var i;(i=e.onProgress)==null||i.call(e,{loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),t.on("StartRenderPage",n=>{if(this.destroyed)return;a(this,$n).get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),t.on("commonobj",([n,i,r])=>{var o;if(this.destroyed||this.commonObjs.has(n))return null;switch(i){case"Font":const{disableFontFace:l,fontExtraProperties:c,pdfBug:u}=this._params;if("error"in r){const v=r.error;yt(`Error during font loading: ${v}`),this.commonObjs.resolve(n,v);break}const h=u&&((o=globalThis.FontInspector)!=null&&o.enabled)?(v,y)=>globalThis.FontInspector.fontAdded(v,y):null,f=new IR(r,{disableFontFace:l,inspectFont:h});this.fontLoader.bind(f).catch(()=>t.sendWithPromise("FontFallback",{id:n})).finally(()=>{!c&&f.data&&(f.data=null),this.commonObjs.resolve(n,f)});break;case"CopyLocalImage":const{imageRef:g}=r;ae(g,"The imageRef must be defined.");for(const v of a(this,$n).values())for(const[,y]of v.objs)if((y==null?void 0:y.ref)===g)return y.dataLen?(this.commonObjs.resolve(n,structuredClone(y)),y.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,r);break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([n,i,r,o])=>{var c;if(this.destroyed)return;const l=a(this,$n).get(i);if(!l.objs.has(n)){if(l._intentStates.size===0){(c=o==null?void 0:o.bitmap)==null||c.close();return}switch(r){case"Image":l.objs.resolve(n,o),(o==null?void 0:o.dataLen)>rR&&(l._maybeCleanupAfterRender=!0);break;case"Pattern":l.objs.resolve(n,o);break;default:throw new Error(`Got unknown object type ${r}`)}}}),t.on("DocProgress",n=>{var i;this.destroyed||(i=e.onProgress)==null||i.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=a(this,Jo).get(e);if(n)return n;const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(r=>{if(this.destroyed)throw new Error("Transport destroyed");r.refStr&&a(this,Qo).set(r.refStr,t);const o=new kL(e,r,this,this._params.pdfBug);return a(this,$n).set(e,o),o});return a(this,Jo).set(e,i),i}getPageIndex(t){return Sv(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,ur,ol).call(this,"GetFieldObjects")}hasJSActions(){return A(this,ur,ol).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,ur,ol).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,ur,ol).call(this,"GetOptionalContentConfig").then(e=>new JR(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=a(this,Ai).get(t);if(e)return e;const n=this.messageHandler.sendWithPromise(t,null).then(i=>{var r,o;return{info:i[0],metadata:i[1]?new KR(i[1]):null,contentDispositionFilename:((r=this._fullReader)==null?void 0:r.filename)??null,contentLength:((o=this._fullReader)==null?void 0:o.contentLength)??null}});return a(this,Ai).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 a(this,$n).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),a(this,Ai).clear(),this.filterFactory.destroy(!0),rd.cleanup()}}cachedPageNumber(t){if(!Sv(t))return null;const e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return a(this,Qo).get(e)??null}}Ai=new WeakMap,$n=new WeakMap,Jo=new WeakMap,Qo=new WeakMap,jn=new WeakMap,ur=new WeakSet,ol=function(t,e=null){const n=a(this,Ai).get(t);if(n)return n;const i=this.messageHandler.sendWithPromise(t,e);return a(this,Ai).set(t,i),i};const du=Symbol("INITIAL_DATA");var yn,kc,im;class nw{constructor(){m(this,kc);m(this,yn,Object.create(null))}get(t,e=null){if(e){const i=A(this,kc,im).call(this,t);return i.promise.then(()=>e(i.data)),null}const n=a(this,yn)[t];if(!n||n.data===du)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return n.data}has(t){const e=a(this,yn)[t];return!!e&&e.data!==du}resolve(t,e=null){const n=A(this,kc,im).call(this,t);n.data=e,n.resolve()}clear(){var t;for(const e in a(this,yn)){const{data:n}=a(this,yn)[e];(t=n==null?void 0:n.bitmap)==null||t.close()}w(this,yn,Object.create(null))}*[Symbol.iterator](){for(const t in a(this,yn)){const{data:e}=a(this,yn)[t];e!==du&&(yield[t,e])}}}yn=new WeakMap,kc=new WeakSet,im=function(t){var e;return(e=a(this,yn))[t]||(e[t]={...Promise.withResolvers(),data:du})};var cs;class ML{constructor(t){m(this,cs,null);w(this,cs,t),this.onContinue=null}get promise(){return a(this,cs).capability.promise}cancel(t=0){a(this,cs).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=a(this,cs).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=a(this,cs);return t.form||t.canvas&&(e==null?void 0:e.size)>0}}cs=new WeakMap;var dr;const Ms=class Ms{constructor({callback:t,params:e,objs:n,commonObjs:i,annotationCanvasMap:r,operatorList:o,pageIndex:l,canvasFactory:c,filterFactory:u,useRequestAnimationFrame:h=!1,pdfBug:f=!1,pageColors:g=null}){this.callback=t,this.params=e,this.objs=n,this.commonObjs=i,this.annotationCanvasMap=r,this.operatorListIdx=null,this.operatorList=o,this._pageIndex=l,this.canvasFactory=c,this.filterFactory=u,this._pdfBug=f,this.pageColors=g,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 ML(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 l,c;if(this.cancelled)return;if(this._canvas){if(a(Ms,dr).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.");a(Ms,dr).add(this._canvas)}this._pdfBug&&((l=globalThis.StepperManager)!=null&&l.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:n,viewport:i,transform:r,background:o}=this.params;this.gfx=new bo(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:r,viewport:i,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(),a(Ms,dr).delete(this._canvas),this.callback(t||new u0(`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(),a(Ms,dr).delete(this._canvas),this.callback())))}};dr=new WeakMap,m(Ms,dr,new WeakSet);let sm=Ms;const DL="4.3.136",OL="0cec64437";function Cv(s){return Math.floor(Math.max(0,Math.min(1,s))*255).toString(16).padStart(2,"0")}function Za(s){return Math.max(0,Math.min(255,255*s))}class Tv{static CMYK_G([t,e,n,i]){return["G",1-Math.min(1,.3*t+.59*n+.11*e+i)]}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=Za(t),[t,t,t]}static G_HTML([t]){const e=Cv(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(Za)}static RGB_HTML(t){return`#${t.map(Cv).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,n,i]){return["RGB",1-Math.min(1,t+i),1-Math.min(1,n+i),1-Math.min(1,e+i)]}static CMYK_rgb([t,e,n,i]){return[Za(1-Math.min(1,t+i)),Za(1-Math.min(1,n+i)),Za(1-Math.min(1,e+i))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,n]){const i=1-t,r=1-e,o=1-n,l=Math.min(i,r,o);return["CMYK",i,r,o,l]}}class iw{static setupStorage(t,e,n,i,r){const o=i.getValue(e,{value:null});switch(n.name){case"textarea":if(o.value!==null&&(t.textContent=o.value),r==="print")break;t.addEventListener("input",l=>{i.setValue(e,{value:l.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",l=>{i.setValue(e,{value:l.target.checked?l.target.getAttribute("xfaOn"):l.target.getAttribute("xfaOff")})})}else{if(o.value!==null&&t.setAttribute("value",o.value),r==="print")break;t.addEventListener("input",l=>{i.setValue(e,{value:l.target.value})})}break;case"select":if(o.value!==null){t.setAttribute("value",o.value);for(const l of n.children)l.attributes.value===o.value?l.attributes.selected=!0:l.attributes.hasOwnProperty("selected")&&delete l.attributes.selected}t.addEventListener("input",l=>{const c=l.target.options,u=c.selectedIndex===-1?"":c[c.selectedIndex].value;i.setValue(e,{value:u})});break}}static setAttributes({html:t,element:e,storage:n=null,intent:i,linkService:r}){const{attributes:o}=e,l=t instanceof HTMLAnchorElement;o.type==="radio"&&(o.name=`${o.name}-${i}`);for(const[c,u]of Object.entries(o))if(u!=null)switch(c){case"class":u.length&&t.setAttribute(c,u.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",u);break;case"style":Object.assign(t.style,u);break;case"textContent":t.textContent=u;break;default:(!l||c!=="href"&&c!=="newWindow")&&t.setAttribute(c,u)}l&&r.addLinkAttributes(t,o.href,o.newWindow),n&&o.dataId&&this.setupStorage(t,o.dataId,e,n)}static render(t){var f,g;const e=t.annotationStorage,n=t.linkService,i=t.xfaHtml,r=t.intent||"display",o=document.createElement(i.name);i.attributes&&this.setAttributes({html:o,element:i,intent:r,linkService:n});const l=r!=="richText",c=t.div;if(c.append(o),t.viewport){const v=`matrix(${t.viewport.transform.join(",")})`;c.style.transform=v}l&&c.setAttribute("class","xfaLayer xfaFont");const u=[];if(i.children.length===0){if(i.value){const v=document.createTextNode(i.value);o.append(v),l&&wl.shouldBuildText(i.name)&&u.push(v)}return{textDivs:u}}const h=[[i,-1,o]];for(;h.length>0;){const[v,y,E]=h.at(-1);if(y+1===v.children.length){h.pop();continue}const S=v.children[++h.at(-1)[1]];if(S===null)continue;const{name:_}=S;if(_==="#text"){const L=document.createTextNode(S.value);u.push(L),E.append(L);continue}const P=(f=S==null?void 0:S.attributes)!=null&&f.xmlns?document.createElementNS(S.attributes.xmlns,_):document.createElement(_);if(E.append(P),S.attributes&&this.setAttributes({html:P,element:S,storage:e,intent:r,linkService:n}),((g=S.children)==null?void 0:g.length)>0)h.push([S,-1,P]);else if(S.value){const L=document.createTextNode(S.value);l&&wl.shouldBuildText(_)&&u.push(L),P.append(L)}}for(const v of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))v.setAttribute("readOnly",!0);return{textDivs:u}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}const Kh=1e3,NL=9,Zr=new WeakSet;function ji(s){return{width:s[2]-s[0],height:s[3]-s[1]}}class BL{static create(t){switch(t.data.annotationType){case ne.LINK:return new sw(t);case ne.TEXT:return new $L(t);case ne.WIDGET:switch(t.data.fieldType){case"Tx":return new jL(t);case"Btn":return t.data.radioButton?new aw(t):t.data.checkBox?new HL(t):new zL(t);case"Ch":return new VL(t);case"Sig":return new UL(t)}return new so(t);case ne.POPUP:return new om(t);case ne.FREETEXT:return new dw(t);case ne.LINE:return new WL(t);case ne.SQUARE:return new qL(t);case ne.CIRCLE:return new XL(t);case ne.POLYLINE:return new fw(t);case ne.CARET:return new KL(t);case ne.INK:return new pw(t);case ne.POLYGON:return new YL(t);case ne.HIGHLIGHT:return new ZL(t);case ne.UNDERLINE:return new JL(t);case ne.SQUIGGLY:return new QL(t);case ne.STRIKEOUT:return new tk(t);case ne.STAMP:return new gw(t);case ne.FILEATTACHMENT:return new ek(t);default:return new Jt(t)}}}var fr,ta,ea,Ic,rm;const A0=class A0{constructor(t,{isRenderable:e=!1,ignoreBorder:n=!1,createQuadrilaterals:i=!1}={}){m(this,Ic);m(this,fr,null);m(this,ta,!1);m(this,ea,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)),i&&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 A0._hasPopupData(this.data)}updateEdited(t){var n;if(!this.container)return;a(this,fr)||w(this,fr,{rect:this.data.rect.slice(0)});const{rect:e}=t;e&&A(this,Ic,rm).call(this,e),(n=a(this,ea))==null||n.popup.updateEdited(t)}resetEdited(){var t;a(this,fr)&&(A(this,Ic,rm).call(this,a(this,fr).rect),(t=a(this,ea))==null||t.popup.resetEdited(),w(this,fr,null))}_createContainer(t){const{data:e,parent:{page:n,viewport:i}}=this,r=document.createElement("section");r.setAttribute("data-annotation-id",e.id),this instanceof so||(r.tabIndex=Kh);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 om){const{rotation:E}=e;return!e.hasOwnCanvas&&E!==0&&this.setRotation(E,r),r}const{width:l,height:c}=ji(e.rect);if(!t&&e.borderStyle.width>0){o.borderWidth=`${e.borderStyle.width}px`;const E=e.borderStyle.horizontalCornerRadius,S=e.borderStyle.verticalCornerRadius;if(E>0||S>0){const P=`calc(${E}px * var(--scale-factor)) / calc(${S}px * var(--scale-factor))`;o.borderRadius=P}else if(this instanceof aw){const P=`calc(${l}px * var(--scale-factor)) / calc(${c}px * var(--scale-factor))`;o.borderRadius=P}switch(e.borderStyle.style){case Ya.SOLID:o.borderStyle="solid";break;case Ya.DASHED:o.borderStyle="dashed";break;case Ya.BEVELED:yt("Unimplemented border style: beveled");break;case Ya.INSET:yt("Unimplemented border style: inset");break;case Ya.UNDERLINE:o.borderBottomStyle="solid";break}const _=e.borderColor||null;_?(w(this,ta,!0),o.borderColor=tt.makeHexColor(_[0]|0,_[1]|0,_[2]|0)):o.borderWidth=0}const u=tt.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:f,pageX:g,pageY:v}=i.rawDims;o.left=`${100*(u[0]-g)/h}%`,o.top=`${100*(u[1]-v)/f}%`;const{rotation:y}=e;return e.hasOwnCanvas||y===0?(o.width=`${100*l/h}%`,o.height=`${100*c/f}%`):this.setRotation(y,r),r}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:i}=this.parent.viewport.rawDims,{width:r,height:o}=ji(this.data.rect);let l,c;t%180===0?(l=100*r/n,c=100*o/i):(l=100*o/n,c=100*r/i),e.style.width=`${l}%`,e.style.height=`${c}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,n,i)=>{const r=i.detail[e],o=r[0],l=r.slice(1);i.target.style[n]=Tv[`${o}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[n]:Tv[`${o}_rgb`](l)})};return Tt(this,"_commonActions",{display:e=>{const{display:n}=e.detail,i=n%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,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 i of Object.keys(e.detail)){const r=t[i]||n[i];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[i,r]of Object.entries(e)){const o=n[i];if(o){const l={detail:{[i]:r},target:t};o(l),delete e[i]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,n,i,r]=this.data.rect;if(t.length===1){const[,{x:E,y:S},{x:_,y:P}]=t[0];if(i===E&&r===S&&e===_&&n===P)return}const{style:o}=this.container;let l;if(a(this,ta)){const{borderColor:E,borderWidth:S}=o;o.borderWidth=0,l=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${E}" stroke-width="${S}">`],this.container.classList.add("hasBorder")}const c=i-e,u=r-n,{svgFactory:h}=this,f=h.createElement("svg");f.classList.add("quadrilateralsContainer"),f.setAttribute("width",0),f.setAttribute("height",0);const g=h.createElement("defs");f.append(g);const v=h.createElement("clipPath"),y=`clippath_${this.data.id}`;v.setAttribute("id",y),v.setAttribute("clipPathUnits","objectBoundingBox"),g.append(v);for(const[,{x:E,y:S},{x:_,y:P}]of t){const L=h.createElement("rect"),k=(_-e)/c,F=(r-S)/u,I=(E-_)/c,M=(S-P)/u;L.setAttribute("x",k),L.setAttribute("y",F),L.setAttribute("width",I),L.setAttribute("height",M),v.append(L),l==null||l.push(`<rect vector-effect="non-scaling-stroke" x="${k}" y="${F}" width="${I}" height="${M}"/>`)}a(this,ta)&&(l.push("</g></svg>')"),o.backgroundImage=l.join("")),this.container.append(f),this.container.style.clipPath=`url(#${y})`}_createPopup(){const{container:t,data:e}=this;t.setAttribute("aria-haspopup","dialog");const n=w(this,ea,new om({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(){Dt("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const n=[];if(this._fieldObjects){const i=this._fieldObjects[t];if(i)for(const{page:r,id:o,exportValues:l}of i){if(r===-1||o===e)continue;const c=typeof l=="string"?l:null,u=document.querySelector(`[data-element-id="${o}"]`);if(u&&!Zr.has(u)){yt(`_getElementsByName - element not allowed: ${o}`);continue}n.push({id:o,exportValue:c,domElement:u})}return n}for(const i of document.getElementsByName(t)){const{exportValue:r}=i,o=i.getAttribute("data-element-id");o!==e&&Zr.has(i)&&n.push({id:o,exportValue:r,domElement:i})}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})})}};fr=new WeakMap,ta=new WeakMap,ea=new WeakMap,Ic=new WeakSet,rm=function(t){const{container:{style:e},data:{rect:n,rotation:i},parent:{viewport:{rawDims:{pageWidth:r,pageHeight:o,pageX:l,pageY:c}}}}=this;n==null||n.splice(0,4,...t);const{width:u,height:h}=ji(t);e.left=`${100*(t[0]-l)/r}%`,e.top=`${100*(o-t[3]+c)/o}%`,i===0?(e.width=`${100*u/r}%`,e.height=`${100*h/o}%`):this.setRotation(i)};let Jt=A0;var Ei,Rs,Kd,rw,Zd,ow;class sw extends Jt{constructor(e,n=null){super(e,{isRenderable:!0,ignoreBorder:!!(n!=null&&n.ignoreBorder),createQuadrilaterals:!0});m(this,Ei);m(this,Kd);m(this,Zd);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:n}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let r=!1;return e.url?(n.addLinkAttributes(i,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(i,e.action),r=!0):e.attachment?(A(this,Kd,rw).call(this,i,e.attachment,e.attachmentDest),r=!0):e.setOCGState?(A(this,Zd,ow).call(this,i,e.setOCGState),r=!0):e.dest?(this._bindLink(i,e.dest),r=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),r=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(i,""),r=!0)),this.container.classList.add("linkAnnotation"),r&&this.container.append(i),this.container}_bindLink(e,n){e.href=this.linkService.getDestinationHash(n),e.onclick=()=>(n&&this.linkService.goToDestination(n),!1),(n||n==="")&&A(this,Ei,Rs).call(this)}_bindNamedAction(e,n){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(n),!1),A(this,Ei,Rs).call(this)}_bindJSAction(e,n){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const r of Object.keys(n.actions)){const o=i.get(r);o&&(e[o]=()=>{var l;return(l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n.id,name:r}}),!1})}e.onclick||(e.onclick=()=>!1),A(this,Ei,Rs).call(this)}_bindResetFormAction(e,n){const i=e.onclick;if(i||(e.href=this.linkService.getAnchorUrl("")),A(this,Ei,Rs).call(this),!this._fieldObjects){yt('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(e.onclick=()=>!1);return}e.onclick=()=>{var f;i==null||i();const{fields:r,refs:o,include:l}=n,c=[];if(r.length!==0||o.length!==0){const g=new Set(o);for(const v of r){const y=this._fieldObjects[v]||[];for(const{id:E}of y)g.add(E)}for(const v of Object.values(this._fieldObjects))for(const y of v)g.has(y.id)===l&&c.push(y)}else for(const g of Object.values(this._fieldObjects))c.push(...g);const u=this.annotationStorage,h=[];for(const g of c){const{id:v}=g;switch(h.push(v),g.type){case"text":{const E=g.defaultValue||"";u.setValue(v,{value:E});break}case"checkbox":case"radiobutton":{const E=g.defaultValue===g.exportValues;u.setValue(v,{value:E});break}case"combobox":case"listbox":{const E=g.defaultValue||"";u.setValue(v,{value:E});break}default:continue}const y=document.querySelector(`[data-element-id="${v}"]`);if(y){if(!Zr.has(y)){yt(`_bindResetFormAction - element not allowed: ${v}`);continue}}else continue;y.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((f=this.linkService.eventBus)==null||f.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}})),!1}}}Ei=new WeakSet,Rs=function(){this.container.setAttribute("data-internal-link","")},Kd=new WeakSet,rw=function(e,n,i=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,i),!1},A(this,Ei,Rs).call(this)},Zd=new WeakSet,ow=function(e,n){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(n),!1),A(this,Ei,Rs).call(this)};class $L 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 so 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,i,r){n.includes("mouse")?t.addEventListener(n,o=>{var l;(l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:r(o),shift:o.shiftKey,modifier:this._getKeyModifier(o)}})}):t.addEventListener(n,o=>{var l;if(n==="blur"){if(!e.focused||!o.relatedTarget)return;e.focused=!1}else if(n==="focus"){if(e.focused)return;e.focused=!0}r&&((l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:r(o)}}))})}_setEventListeners(t,e,n,i){var r,o,l;for(const[c,u]of n)(u==="Action"||(r=this.data.actions)!=null&&r[u])&&((u==="Focus"||u==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,c,u,i),u==="Focus"&&!((o=this.data.actions)!=null&&o.Blur)?this._setEventListener(t,e,"blur","Blur",null):u==="Blur"&&!((l=this.data.actions)!=null&&l.Focus)&&this._setEventListener(t,e,"focus","Focus",null))}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":tt.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||NL,r=t.style;let o;const l=2,c=u=>Math.round(10*u)/10;if(this.data.multiLine){const u=Math.abs(this.data.rect[3]-this.data.rect[1]-l),h=Math.round(u/(Xp*i))||1,f=u/h;o=Math.min(i,c(f/Xp))}else{const u=Math.abs(this.data.rect[3]-this.data.rect[1]-l);o=Math.min(i,c(u/Xp))}r.fontSize=`calc(${o}px * var(--scale-factor))`,r.color=tt.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 jL extends so{constructor(t){const e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,n,i){const r=this.annotationStorage;for(const o of this._getElementsByName(t.name,t.id))o.domElement&&(o.domElement[e]=n),r.setValue(o.id,{[i]:n})}render(){var i,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 l=o.value||"";const c=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;c&&l.length>c&&(l=l.slice(0,c));let u=o.formattedValue||((i=this.data.textContent)==null?void 0:i.join(`
`))||null;u&&this.data.comb&&(u=u.replaceAll(/\s+/g,""));const h={userValue:l,formattedValue:u,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=u??l,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type="text",n.setAttribute("value",u??l),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),Zr.add(n),n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=Kh,this._setRequired(n,this.data.required),c&&(n.maxLength=c),n.addEventListener("input",g=>{t.setValue(e,{value:g.target.value}),this.setPropertyOnSiblings(n,"value",g.target.value,"value"),h.formattedValue=null}),n.addEventListener("resetform",g=>{const v=this.data.defaultFieldValue??"";n.value=h.userValue=v,h.formattedValue=null});let f=g=>{const{formattedValue:v}=h;v!=null&&(g.target.value=v),g.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",v=>{var E;if(h.focused)return;const{target:y}=v;h.userValue&&(y.value=h.userValue),h.lastCommittedValue=y.value,h.commitKey=1,(E=this.data.actions)!=null&&E.Focus||(h.focused=!0)}),n.addEventListener("updatefromsandbox",v=>{this.showElementAndHideCanvas(v.target);const y={value(E){h.userValue=E.detail.value??"",t.setValue(e,{value:h.userValue.toString()}),E.target.value=h.userValue},formattedValue(E){const{formattedValue:S}=E.detail;h.formattedValue=S,S!=null&&E.target!==document.activeElement&&(E.target.value=S),t.setValue(e,{formattedValue:S})},selRange(E){E.target.setSelectionRange(...E.detail.selRange)},charLimit:E=>{var L;const{charLimit:S}=E.detail,{target:_}=E;if(S===0){_.removeAttribute("maxLength");return}_.setAttribute("maxLength",S);let P=h.userValue;!P||P.length<=S||(P=P.slice(0,S),_.value=h.userValue=P,t.setValue(e,{value:P}),(L=this.linkService.eventBus)==null||L.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:P,willCommit:!0,commitKey:1,selStart:_.selectionStart,selEnd:_.selectionEnd}}))}};this._dispatchEventFromSandbox(y,v)}),n.addEventListener("keydown",v=>{var S;h.commitKey=1;let y=-1;if(v.key==="Escape"?y=0:v.key==="Enter"&&!this.data.multiLine?y=2:v.key==="Tab"&&(h.commitKey=3),y===-1)return;const{value:E}=v.target;h.lastCommittedValue!==E&&(h.lastCommittedValue=E,h.userValue=E,(S=this.linkService.eventBus)==null||S.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:E,willCommit:!0,commitKey:y,selStart:v.target.selectionStart,selEnd:v.target.selectionEnd}}))});const g=f;f=null,n.addEventListener("blur",v=>{var E,S;if(!h.focused||!v.relatedTarget)return;(E=this.data.actions)!=null&&E.Blur||(h.focused=!1);const{value:y}=v.target;h.userValue=y,h.lastCommittedValue!==y&&((S=this.linkService.eventBus)==null||S.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:y,willCommit:!0,commitKey:h.commitKey,selStart:v.target.selectionStart,selEnd:v.target.selectionEnd}})),g(v)}),(r=this.data.actions)!=null&&r.Keystroke&&n.addEventListener("beforeinput",v=>{var F;h.lastCommittedValue=null;const{data:y,target:E}=v,{value:S,selectionStart:_,selectionEnd:P}=E;let L=_,k=P;switch(v.inputType){case"deleteWordBackward":{const I=S.substring(0,_).match(/\w*[^\w]*$/);I&&(L-=I[0].length);break}case"deleteWordForward":{const I=S.substring(_).match(/^[^\w]*\w*/);I&&(k+=I[0].length);break}case"deleteContentBackward":_===P&&(L-=1);break;case"deleteContentForward":_===P&&(k+=1);break}v.preventDefault(),(F=this.linkService.eventBus)==null||F.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:S,change:y||"",willCommit:!1,selStart:L,selEnd:k}})}),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(f&&n.addEventListener("blur",f),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 UL extends so{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class HL extends so{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,n=e.id;let i=t.getValue(n,{value:e.exportValue===e.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",t.setValue(n,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const r=document.createElement("input");return Zr.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,i&&r.setAttribute("checked",!0),r.setAttribute("exportValue",e.exportValue),r.tabIndex=Kh,r.addEventListener("change",o=>{const{name:l,checked:c}=o.target;for(const u of this._getElementsByName(l,n)){const h=c&&u.exportValue===e.exportValue;u.domElement&&(u.domElement.checked=h),t.setValue(u.id,{value:h})}t.setValue(n,{value:c})}),r.addEventListener("resetform",o=>{const l=e.defaultFieldValue||"Off";o.target.checked=l===e.exportValue}),this.enableScripting&&this.hasJSActions&&(r.addEventListener("updatefromsandbox",o=>{const l={value(c){c.target.checked=c.detail.value!=="Off",t.setValue(n,{value:c.target.checked})}};this._dispatchEventFromSandbox(l,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 aw extends so{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 i=t.getValue(n,{value:e.fieldValue===e.buttonValue}).value;if(typeof i=="string"&&(i=i!==e.buttonValue,t.setValue(n,{value:i})),i)for(const o of this._getElementsByName(e.fieldName,n))t.setValue(o.id,{value:!1});const r=document.createElement("input");if(Zr.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,i&&r.setAttribute("checked",!0),r.tabIndex=Kh,r.addEventListener("change",o=>{const{name:l,checked:c}=o.target;for(const u of this._getElementsByName(l,n))t.setValue(u.id,{value:!1});t.setValue(n,{value:c})}),r.addEventListener("resetform",o=>{const l=e.defaultFieldValue;o.target.checked=l!=null&&l===e.buttonValue}),this.enableScripting&&this.hasJSActions){const o=e.buttonValue;r.addEventListener("updatefromsandbox",l=>{const c={value:u=>{const h=o===u.detail.value;for(const f of this._getElementsByName(u.target.name)){const g=h&&f.id===n;f.domElement&&(f.domElement.checked=g),t.setValue(f.id,{value:g})}}};this._dispatchEventFromSandbox(c,l)}),this._setEventListeners(r,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],l=>l.target.checked)}return this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class zL extends sw{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 VL extends so{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}),i=document.createElement("select");Zr.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=Kh;let r=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",h=>{const f=this.data.defaultFieldValue;for(const g of i.options)g.selected=g.value===f});for(const h of this.data.options){const f=document.createElement("option");f.textContent=h.displayValue,f.value=h.exportValue,n.value.includes(h.exportValue)&&(f.setAttribute("selected",!0),r=!1),i.append(f)}let o=null;if(r){const h=document.createElement("option");h.value=" ",h.setAttribute("hidden",!0),h.setAttribute("selected",!0),i.prepend(h),o=()=>{h.remove(),i.removeEventListener("input",o),o=null},i.addEventListener("input",o)}const l=h=>{const f=h?"value":"textContent",{options:g,multiple:v}=i;return v?Array.prototype.filter.call(g,y=>y.selected).map(y=>y[f]):g.selectedIndex===-1?null:g[g.selectedIndex][f]};let c=l(!1);const u=h=>{const f=h.target.options;return Array.prototype.map.call(f,g=>({displayValue:g.textContent,exportValue:g.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",h=>{const f={value(g){o==null||o();const v=g.detail.value,y=new Set(Array.isArray(v)?v:[v]);for(const E of i.options)E.selected=y.has(E.value);t.setValue(e,{value:l(!0)}),c=l(!1)},multipleSelection(g){i.multiple=!0},remove(g){const v=i.options,y=g.detail.remove;v[y].selected=!1,i.remove(y),v.length>0&&Array.prototype.findIndex.call(v,S=>S.selected)===-1&&(v[0].selected=!0),t.setValue(e,{value:l(!0),items:u(g)}),c=l(!1)},clear(g){for(;i.length!==0;)i.remove(0);t.setValue(e,{value:null,items:[]}),c=l(!1)},insert(g){const{index:v,displayValue:y,exportValue:E}=g.detail.insert,S=i.children[v],_=document.createElement("option");_.textContent=y,_.value=E,S?S.before(_):i.append(_),t.setValue(e,{value:l(!0),items:u(g)}),c=l(!1)},items(g){const{items:v}=g.detail;for(;i.length!==0;)i.remove(0);for(const y of v){const{displayValue:E,exportValue:S}=y,_=document.createElement("option");_.textContent=E,_.value=S,i.append(_)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:l(!0),items:u(g)}),c=l(!1)},indices(g){const v=new Set(g.detail.indices);for(const y of g.target.options)y.selected=v.has(y.index);t.setValue(e,{value:l(!0)}),c=l(!1)},editable(g){g.target.disabled=!g.detail.editable}};this._dispatchEventFromSandbox(f,h)}),i.addEventListener("input",h=>{var v;const f=l(!0),g=l(!1);t.setValue(e,{value:f}),h.preventDefault(),(v=this.linkService.eventBus)==null||v.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:c,change:g,changeEx:f,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],h=>h.target.value)):i.addEventListener("input",function(h){t.setValue(e,{value:l(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class om 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 GL({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=>`${ub}${n}`).join(",")),this.container}}var na,Jd,Qd,ia,pr,Yt,_i,gr,Fc,Mc,sa,xi,bn,Si,Dc,Ci,Oc,mr,vr,ra,Iu,Nc,am,tf,lw,ef,cw,nf,hw,sf,uw,oa,Fu,aa,Mu,Bc,lm;class GL{constructor({container:t,color:e,elements:n,titleObj:i,modificationDate:r,contentsObj:o,richText:l,parent:c,rect:u,parentRect:h,open:f}){m(this,ra);m(this,Nc);m(this,tf);m(this,ef);m(this,nf);m(this,sf);m(this,oa);m(this,aa);m(this,Bc);m(this,na,A(this,nf,hw).bind(this));m(this,Jd,A(this,Bc,lm).bind(this));m(this,Qd,A(this,aa,Mu).bind(this));m(this,ia,A(this,oa,Fu).bind(this));m(this,pr,null);m(this,Yt,null);m(this,_i,null);m(this,gr,null);m(this,Fc,null);m(this,Mc,null);m(this,sa,null);m(this,xi,!1);m(this,bn,null);m(this,Si,null);m(this,Dc,null);m(this,Ci,null);m(this,Oc,null);m(this,mr,null);m(this,vr,!1);var g;w(this,Yt,t),w(this,Oc,i),w(this,_i,o),w(this,Ci,l),w(this,Mc,c),w(this,pr,e),w(this,Dc,u),w(this,sa,h),w(this,Fc,n),w(this,gr,mb.toDateObject(r)),this.trigger=n.flatMap(v=>v.getElementsToTriggerPopup());for(const v of this.trigger)v.addEventListener("click",a(this,ia)),v.addEventListener("mouseenter",a(this,Qd)),v.addEventListener("mouseleave",a(this,Jd)),v.classList.add("popupTriggerArea");for(const v of n)(g=v.container)==null||g.addEventListener("keydown",a(this,na));a(this,Yt).hidden=!0,f&&A(this,oa,Fu).call(this)}render(){if(a(this,bn))return;const t=w(this,bn,document.createElement("div"));if(t.className="popup",a(this,pr)){const r=t.style.outlineColor=tt.makeHexColor(...a(this,pr));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor=`color-mix(in srgb, ${r} 30%, white)`:t.style.backgroundColor=tt.makeHexColor(...a(this,pr).map(l=>Math.floor(.7*(255-l)+l)))}const e=document.createElement("span");e.className="header";const n=document.createElement("h1");if(e.append(n),{dir:n.dir,str:n.textContent}=a(this,Oc),t.append(e),a(this,gr)){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:a(this,gr).toLocaleDateString(),time:a(this,gr).toLocaleTimeString()})),e.append(r)}const i=a(this,ra,Iu);if(i)iw.render({xfaHtml:i,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const r=this._formatContents(a(this,_i));t.append(r)}a(this,Yt).append(t)}_formatContents({str:t,dir:e}){const n=document.createElement("p");n.classList.add("popupContent"),n.dir=e;const i=t.split(/(?:\r\n?|\n)/);for(let r=0,o=i.length;r<o;++r){const l=i[r];n.append(document.createTextNode(l)),r<o-1&&n.append(document.createElement("br"))}return n}updateEdited({rect:t,popupContent:e}){var n;a(this,mr)||w(this,mr,{contentsObj:a(this,_i),richText:a(this,Ci)}),t&&w(this,Si,null),e&&(w(this,Ci,A(this,ef,cw).call(this,e)),w(this,_i,null)),(n=a(this,bn))==null||n.remove(),w(this,bn,null)}resetEdited(){var t;a(this,mr)&&({contentsObj:Ge(this,_i)._,richText:Ge(this,Ci)._}=a(this,mr),w(this,mr,null),(t=a(this,bn))==null||t.remove(),w(this,bn,null),w(this,Si,null))}forceHide(){w(this,vr,this.isVisible),a(this,vr)&&(a(this,Yt).hidden=!0)}maybeShow(){a(this,vr)&&(a(this,bn)||A(this,aa,Mu).call(this),w(this,vr,!1),a(this,Yt).hidden=!1)}get isVisible(){return a(this,Yt).hidden===!1}}na=new WeakMap,Jd=new WeakMap,Qd=new WeakMap,ia=new WeakMap,pr=new WeakMap,Yt=new WeakMap,_i=new WeakMap,gr=new WeakMap,Fc=new WeakMap,Mc=new WeakMap,sa=new WeakMap,xi=new WeakMap,bn=new WeakMap,Si=new WeakMap,Dc=new WeakMap,Ci=new WeakMap,Oc=new WeakMap,mr=new WeakMap,vr=new WeakMap,ra=new WeakSet,Iu=function(){const t=a(this,Ci),e=a(this,_i);return t!=null&&t.str&&(!(e!=null&&e.str)||e.str===t.str)&&a(this,Ci).html||null},Nc=new WeakSet,am=function(){var t,e,n;return((n=(e=(t=a(this,ra,Iu))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:n.fontSize)||0},tf=new WeakSet,lw=function(){var t,e,n;return((n=(e=(t=a(this,ra,Iu))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:n.color)||null},ef=new WeakSet,cw=function(t){const e=[],n={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},i={style:{color:a(this,tf,lw),fontSize:a(this,Nc,am)?`calc(${a(this,Nc,am)}px * var(--scale-factor))`:""}};for(const r of t.split(`
`))e.push({name:"span",value:r,attributes:i});return n},nf=new WeakSet,hw=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&a(this,xi))&&A(this,oa,Fu).call(this)},sf=new WeakSet,uw=function(){if(a(this,Si)!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:n,pageX:i,pageY:r}}}=a(this,Mc);let o=!!a(this,sa),l=o?a(this,sa):a(this,Dc);for(const y of a(this,Fc))if(!l||tt.intersect(y.data.rect,l)!==null){l=y.data.rect,o=!0;break}const c=tt.normalizeRect([l[0],t[3]-l[1]+t[1],l[2],t[3]-l[3]+t[1]]),h=o?l[2]-l[0]+5:0,f=c[0]+h,g=c[1];w(this,Si,[100*(f-i)/e,100*(g-r)/n]);const{style:v}=a(this,Yt);v.left=`${a(this,Si)[0]}%`,v.top=`${a(this,Si)[1]}%`},oa=new WeakSet,Fu=function(){w(this,xi,!a(this,xi)),a(this,xi)?(A(this,aa,Mu).call(this),a(this,Yt).addEventListener("click",a(this,ia)),a(this,Yt).addEventListener("keydown",a(this,na))):(A(this,Bc,lm).call(this),a(this,Yt).removeEventListener("click",a(this,ia)),a(this,Yt).removeEventListener("keydown",a(this,na)))},aa=new WeakSet,Mu=function(){a(this,bn)||this.render(),this.isVisible?a(this,xi)&&a(this,Yt).classList.add("focused"):(A(this,sf,uw).call(this),a(this,Yt).hidden=!1,a(this,Yt).style.zIndex=parseInt(a(this,Yt).style.zIndex)+1e3)},Bc=new WeakSet,lm=function(){a(this,Yt).classList.remove("focused"),!(a(this,xi)||!this.isVisible)&&(a(this,Yt).hidden=!0,a(this,Yt).style.zIndex=parseInt(a(this,Yt).style.zIndex)-1e3)};class dw extends Jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=xt.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 $c;class WL extends Jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,$c,null)}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:n,height:i}=ji(e.rect),r=this.svgFactory.create(n,i,!0),o=w(this,$c,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 a(this,$c)}addHighlightArea(){this.container.classList.add("highlightArea")}}$c=new WeakMap;var jc;class qL extends Jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,jc,null)}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:n,height:i}=ji(e.rect),r=this.svgFactory.create(n,i,!0),o=e.borderStyle.width,l=w(this,jc,this.svgFactory.createElement("svg:rect"));return l.setAttribute("x",o/2),l.setAttribute("y",o/2),l.setAttribute("width",n-o),l.setAttribute("height",i-o),l.setAttribute("stroke-width",o||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),r.append(l),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return a(this,jc)}addHighlightArea(){this.container.classList.add("highlightArea")}}jc=new WeakMap;var Uc;class XL extends Jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Uc,null)}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:n,height:i}=ji(e.rect),r=this.svgFactory.create(n,i,!0),o=e.borderStyle.width,l=w(this,Uc,this.svgFactory.createElement("svg:ellipse"));return l.setAttribute("cx",n/2),l.setAttribute("cy",i/2),l.setAttribute("rx",n/2-o/2),l.setAttribute("ry",i/2-o/2),l.setAttribute("stroke-width",o||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),r.append(l),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return a(this,Uc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Uc=new WeakMap;var Hc;class fw extends Jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,Hc,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const e=this.data,{width:n,height:i}=ji(e.rect),r=this.svgFactory.create(n,i,!0);let o=[];for(const c of e.vertices){const u=c.x-e.rect[0],h=e.rect[3]-c.y;o.push(u+","+h)}o=o.join(" ");const l=w(this,Hc,this.svgFactory.createElement(this.svgElementName));return l.setAttribute("points",o),l.setAttribute("stroke-width",e.borderStyle.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),r.append(l),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return a(this,Hc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Hc=new WeakMap;class YL extends fw{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class KL 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 zc;class pw extends Jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,zc,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=xt.INK}render(){this.container.classList.add(this.containerClassName);const e=this.data,{width:n,height:i}=ji(e.rect),r=this.svgFactory.create(n,i,!0);for(const o of e.inkLists){let l=[];for(const u of o){const h=u.x-e.rect[0],f=e.rect[3]-u.y;l.push(`${h},${f}`)}l=l.join(" ");const c=this.svgFactory.createElement(this.svgElementName);a(this,zc).push(c),c.setAttribute("points",l),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 a(this,zc)}addHighlightArea(){this.container.classList.add("highlightArea")}}zc=new WeakMap;class ZL 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 JL 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 QL 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 tk 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 gw 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,Gc,cm;class ek extends Jt{constructor(e){var i;super(e,{isRenderable:!0});m(this,Gc);m(this,Vc,null);const{file:n}=this.data;this.filename=n.filename,this.content=n.content,(i=this.linkService.eventBus)==null||i.dispatch("fileattachmentannotation",{source:this,...n})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:n}=this;let i;n.hasAppearance||n.fillAlpha===0?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(n.name)?"paperclip":"pushpin"}.svg`,n.fillAlpha&&n.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(n.fillAlpha*100)}%);`)),i.addEventListener("dblclick",A(this,Gc,cm).bind(this)),w(this,Vc,i);const{isMac:r}=ze.platform;return e.addEventListener("keydown",o=>{o.key==="Enter"&&(r?o.metaKey:o.ctrlKey)&&A(this,Gc,cm).call(this)}),!n.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return a(this,Vc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Vc=new WeakMap,Gc=new WeakSet,cm=function(){var e;(e=this.downloadManager)==null||e.openOrDownloadData(this.content,this.filename)};var Wc,yr,la,rf,mw,qc,hm,Uv;let nk=(Uv=class{constructor({div:t,accessibilityManager:e,annotationCanvasMap:n,annotationEditorUIManager:i,page:r,viewport:o}){m(this,rf);m(this,qc);m(this,Wc,null);m(this,yr,null);m(this,la,new Map);this.div=t,w(this,Wc,e),w(this,yr,n),this.page=r,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=i}async render(t){var o;const{annotations:e}=t,n=this.div;Yr(n,this.viewport);const i=new Map,r={data:null,layer:n,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new h0,annotationStorage:t.annotationStorage||new g0,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const l of e){if(l.noHTML)continue;const c=l.annotationType===ne.POPUP;if(c){const f=i.get(l.id);if(!f)continue;r.elements=f}else{const{width:f,height:g}=ji(l.rect);if(f<=0||g<=0)continue}r.data=l;const u=BL.create(r);if(!u.isRenderable)continue;if(!c&&l.popupRef){const f=i.get(l.popupRef);f?f.push(u):i.set(l.popupRef,[u])}const h=u.render();l.hidden&&(h.style.visibility="hidden"),A(this,rf,mw).call(this,h,l.id),u.annotationEditorType>0&&(a(this,la).set(u.data.id,u),(o=this._annotationEditorUIManager)==null||o.renderAnnotationElement(u))}A(this,qc,hm).call(this)}update({viewport:t}){const e=this.div;this.viewport=t,Yr(e,{rotation:t.rotation}),A(this,qc,hm).call(this),e.hidden=!1}getEditableAnnotations(){return Array.from(a(this,la).values())}getEditableAnnotation(t){return a(this,la).get(t)}},Wc=new WeakMap,yr=new WeakMap,la=new WeakMap,rf=new WeakSet,mw=function(t,e){var i;const n=t.firstChild||t;n.id=`${ub}${e}`,this.div.append(t),(i=a(this,Wc))==null||i.moveElementInDOM(this.div,t,n,!1)},qc=new WeakSet,hm=function(){if(!a(this,yr))return;const t=this.div;for(const[e,n]of a(this,yr)){const i=t.querySelector(`[data-annotation-id="${e}"]`);if(!i)continue;n.className="annotationContent";const{firstChild:r}=i;r?r.nodeName==="CANVAS"?r.replaceWith(n):r.classList.contains("annotationContent")?r.after(n):r.before(n):i.append(n)}a(this,yr).clear()},Uv);const fu=/\r\n?|\n/g;var Xc,Yc,Kc,Zc,Jc,wn,Ye,Qc,Ke,ca,of,vw,af,yw,lf,bw,ha,Du,ua,Ou,da,Nu,cf,ww,th,dm,hf,Aw;const Bt=class Bt extends Ft{constructor(e){super({...e,name:"freeTextEditor"});m(this,of);m(this,af);m(this,lf);m(this,ha);m(this,da);m(this,cf);m(this,hf);m(this,Xc,this.editorDivBlur.bind(this));m(this,Yc,this.editorDivFocus.bind(this));m(this,Kc,this.editorDivInput.bind(this));m(this,Zc,this.editorDivKeydown.bind(this));m(this,Jc,this.editorDivPaste.bind(this));m(this,wn,void 0);m(this,Ye,"");m(this,Qc,`${this.id}-editor`);m(this,Ke,void 0);m(this,ca,null);w(this,wn,e.color||Bt._defaultColor||Ft._defaultLineColor),w(this,Ke,e.fontSize||Bt._defaultFontSize)}static get _keyboardManager(){const e=Bt.prototype,n=o=>o.isEmpty(),i=Kr.TRANSLATE_SMALL,r=Kr.TRANSLATE_BIG;return Tt(this,"_keyboardManager",new Xh([[["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:[-i,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-r,0],checker:n}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[i,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[r,0],checker:n}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-r],checker:n}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,i],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,r],checker:n}]]))}static initialize(e,n){Ft.initialize(e,n,{strings:["pdfjs-free-text-default-content"]});const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,n){switch(e){case lt.FREETEXT_SIZE:Bt._defaultFontSize=n;break;case lt.FREETEXT_COLOR:Bt._defaultColor=n;break}}updateParams(e,n){switch(e){case lt.FREETEXT_SIZE:A(this,of,vw).call(this,n);break;case lt.FREETEXT_COLOR:A(this,af,yw).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[lt.FREETEXT_SIZE,Bt._defaultFontSize],[lt.FREETEXT_COLOR,Bt._defaultColor||Ft._defaultLineColor]]}get propertiesToUpdate(){return[[lt.FREETEXT_SIZE,a(this,Ke)],[lt.FREETEXT_COLOR,a(this,wn)]]}_translateEmpty(e,n){this._uiManager.translateSelectedEditors(e,n,!0)}getInitialTranslation(){const e=this.parentScale;return[-Bt._internalPadding*e,-(Bt._internalPadding+a(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(xt.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",a(this,Zc)),this.editorDiv.addEventListener("focus",a(this,Yc)),this.editorDiv.addEventListener("blur",a(this,Xc)),this.editorDiv.addEventListener("input",a(this,Kc)),this.editorDiv.addEventListener("paste",a(this,Jc)))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",a(this,Qc)),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",a(this,Zc)),this.editorDiv.removeEventListener("focus",a(this,Yc)),this.editorDiv.removeEventListener("blur",a(this,Xc)),this.editorDiv.removeEventListener("input",a(this,Kc)),this.editorDiv.removeEventListener("paste",a(this,Jc)),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=a(this,Ye),n=w(this,Ye,A(this,lf,bw).call(this).trimEnd());if(e===n)return;const i=r=>{if(w(this,Ye,r),!r){this.remove();return}A(this,da,Nu).call(this),this._uiManager.rebuild(this),A(this,ha,Du).call(this)};this.addCommands({cmd:()=>{i(n)},undo:()=>{i(e)},mustExec:!1}),A(this,ha,Du).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){Bt._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",a(this,Qc)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),Ft._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:i}=this.editorDiv;if(i.fontSize=`calc(${a(this,Ke)}px * var(--scale-factor))`,i.color=a(this,wn),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),nd(this,this.div,["dblclick","keydown"]),this.width){const[r,o]=this.parentDimensions;if(this.annotationElementId){const{position:l}=a(this,ca);let[c,u]=this.getInitialTranslation();[c,u]=this.pageTranslationToScreen(c,u);const[h,f]=this.pageDimensions,[g,v]=this.pageTranslation;let y,E;switch(this.rotation){case 0:y=e+(l[0]-g)/h,E=n+this.height-(l[1]-v)/f;break;case 90:y=e+(l[0]-g)/h,E=n-(l[1]-v)/f,[c,u]=[u,-c];break;case 180:y=e-this.width+(l[0]-g)/h,E=n-(l[1]-v)/f,[c,u]=[-c,-u];break;case 270:y=e+(l[0]-g-this.height*f)/h,E=n+(l[1]-v-this.width*h)/f,[c,u]=[-u,c];break}this.setAt(y*r,E*o,c,u)}else this.setAt(e*r,n*o,this.width*r,this.height*o);A(this,da,Nu).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var y,E,S;const n=e.clipboardData||window.clipboardData,{types:i}=n;if(i.length===1&&i[0]==="text/plain")return;e.preventDefault();const r=A(y=Bt,th,dm).call(y,n.getData("text")||"").replaceAll(fu,`
`);if(!r)return;const o=window.getSelection();if(!o.rangeCount)return;this.editorDiv.normalize(),o.deleteFromDocument();const l=o.getRangeAt(0);if(!r.includes(`
`)){l.insertNode(document.createTextNode(r)),this.editorDiv.normalize(),o.collapseToStart();return}const{startContainer:c,startOffset:u}=l,h=[],f=[];if(c.nodeType===Node.TEXT_NODE){const _=c.parentElement;if(f.push(c.nodeValue.slice(u).replaceAll(fu,"")),_!==this.editorDiv){let P=h;for(const L of this.editorDiv.childNodes){if(L===_){P=f;continue}P.push(A(E=Bt,ua,Ou).call(E,L))}}h.push(c.nodeValue.slice(0,u).replaceAll(fu,""))}else if(c===this.editorDiv){let _=h,P=0;for(const L of this.editorDiv.childNodes)P++===u&&(_=f),_.push(A(S=Bt,ua,Ou).call(S,L))}w(this,Ye,`${h.join(`
`)}${r}${f.join(`
`)}`),A(this,da,Nu).call(this);const g=new Range;let v=h.reduce((_,P)=>_+P.length,0);for(const{firstChild:_}of this.editorDiv.childNodes)if(_.nodeType===Node.TEXT_NODE){const P=_.nodeValue.length;if(v<=P){g.setStart(_,v),g.setEnd(_,v);break}v-=P}o.removeAllRanges(),o.addRange(g)}get contentDiv(){return this.editorDiv}static deserialize(e,n,i){var l;let r=null;if(e instanceof dw){const{data:{defaultAppearanceData:{fontSize:c,fontColor:u},rect:h,rotation:f,id:g},textContent:v,textPosition:y,parent:{page:{pageNumber:E}}}=e;if(!v||v.length===0)return null;r=e={annotationType:xt.FREETEXT,color:Array.from(u),fontSize:c,value:v.join(`
`),position:y,pageIndex:E-1,rect:h.slice(0),rotation:f,id:g,deleted:!1}}const o=super.deserialize(e,n,i);return w(o,Ke,e.fontSize),w(o,wn,tt.makeHexColor(...e.color)),w(o,Ye,A(l=Bt,th,dm).call(l,e.value)),o.annotationElementId=e.id||null,w(o,ca,r),o}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const n=Bt._internalPadding*this.parentScale,i=this.getRect(n,n),r=Ft._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:a(this,wn)),o={annotationType:xt.FREETEXT,color:r,fontSize:a(this,Ke),value:A(this,cf,ww).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?o:this.annotationElementId&&!A(this,hf,Aw).call(this,o)?null:(o.id=this.annotationElementId,o)}renderAnnotationElement(e){const n=super.renderAnnotationElement(e);if(this.deleted)return n;const{style:i}=n;i.fontSize=`calc(${a(this,Ke)}px * var(--scale-factor))`,i.color=a(this,wn),n.replaceChildren();for(const o of a(this,Ye).split(`
`)){const l=document.createElement("div");l.append(o?document.createTextNode(o):document.createElement("br")),n.append(l)}const r=Bt._internalPadding*this.parentScale;return e.updateEdited({rect:this.getRect(r,r),popupContent:a(this,Ye)}),n}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};Xc=new WeakMap,Yc=new WeakMap,Kc=new WeakMap,Zc=new WeakMap,Jc=new WeakMap,wn=new WeakMap,Ye=new WeakMap,Qc=new WeakMap,Ke=new WeakMap,ca=new WeakMap,of=new WeakSet,vw=function(e){const n=r=>{this.editorDiv.style.fontSize=`calc(${r}px * var(--scale-factor))`,this.translate(0,-(r-a(this,Ke))*this.parentScale),w(this,Ke,r),A(this,ha,Du).call(this)},i=a(this,Ke);this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:lt.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},af=new WeakSet,yw=function(e){const n=r=>{w(this,wn,this.editorDiv.style.color=r)},i=a(this,wn);this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:lt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},lf=new WeakSet,bw=function(){var n;const e=[];this.editorDiv.normalize();for(const i of this.editorDiv.childNodes)e.push(A(n=Bt,ua,Ou).call(n,i));return e.join(`
`)},ha=new WeakSet,Du=function(){const[e,n]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:r,div:o}=this,l=o.style.display,c=o.classList.contains("hidden");o.classList.remove("hidden"),o.style.display="hidden",r.div.append(this.div),i=o.getBoundingClientRect(),o.remove(),o.style.display=l,o.classList.toggle("hidden",c)}this.rotation%180===this.parentRotation%180?(this.width=i.width/e,this.height=i.height/n):(this.width=i.height/e,this.height=i.width/n),this.fixAndSetPosition()},ua=new WeakSet,Ou=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(fu,"")},da=new WeakSet,Nu=function(){if(this.editorDiv.replaceChildren(),!!a(this,Ye))for(const e of a(this,Ye).split(`
`)){const n=document.createElement("div");n.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(n)}},cf=new WeakSet,ww=function(){return a(this,Ye).replaceAll(" "," ")},th=new WeakSet,dm=function(e){return e.replaceAll(" "," ")},hf=new WeakSet,Aw=function(e){const{value:n,fontSize:i,color:r,pageIndex:o}=a(this,ca);return this._hasBeenMoved||e.value!==n||e.fontSize!==i||e.color.some((l,c)=>l!==r[c])||e.pageIndex!==o},m(Bt,ua),m(Bt,th),dt(Bt,"_freeTextDefaultContent",""),dt(Bt,"_internalPadding",0),dt(Bt,"_defaultColor",null),dt(Bt,"_defaultFontSize",10),dt(Bt,"_type","freetext"),dt(Bt,"_editorType",xt.FREETEXT);let um=Bt;var eh,hs,An,uf,Ew,fa,Bu,df,_w,ff,xw,nh,pm;class fm{constructor(t,e=0,n=0,i=!0){m(this,uf);m(this,fa);m(this,df);m(this,ff);m(this,nh);m(this,eh,void 0);m(this,hs,[]);m(this,An,[]);let r=1/0,o=-1/0,l=1/0,c=-1/0;const h=10**-4;for(const{x:_,y:P,width:L,height:k}of t){const F=Math.floor((_-e)/h)*h,I=Math.ceil((_+L+e)/h)*h,M=Math.floor((P-e)/h)*h,C=Math.ceil((P+k+e)/h)*h,T=[F,M,C,!0],N=[I,M,C,!1];a(this,hs).push(T,N),r=Math.min(r,F),o=Math.max(o,I),l=Math.min(l,M),c=Math.max(c,C)}const f=o-r+2*n,g=c-l+2*n,v=r-n,y=l-n,E=a(this,hs).at(i?-1:-2),S=[E[0],E[2]];for(const _ of a(this,hs)){const[P,L,k]=_;_[0]=(P-v)/f,_[1]=(L-y)/g,_[2]=(k-y)/g}w(this,eh,{x:v,y,width:f,height:g,lastPoint:S})}getOutlines(){a(this,hs).sort((e,n)=>e[0]-n[0]||e[1]-n[1]||e[2]-n[2]);const t=[];for(const e of a(this,hs))e[3]?(t.push(...A(this,nh,pm).call(this,e)),A(this,df,_w).call(this,e)):(A(this,ff,xw).call(this,e),t.push(...A(this,nh,pm).call(this,e)));return A(this,uf,Ew).call(this,t)}}eh=new WeakMap,hs=new WeakMap,An=new WeakMap,uf=new WeakSet,Ew=function(t){const e=[],n=new Set;for(const o of t){const[l,c,u]=o;e.push([l,c,o],[l,u,o])}e.sort((o,l)=>o[1]-l[1]||o[0]-l[0]);for(let o=0,l=e.length;o<l;o+=2){const c=e[o][2],u=e[o+1][2];c.push(u),u.push(c),n.add(c),n.add(u)}const i=[];let r;for(;n.size>0;){const o=n.values().next().value;let[l,c,u,h,f]=o;n.delete(o);let g=l,v=c;for(r=[l,u],i.push(r);;){let y;if(n.has(h))y=h;else if(n.has(f))y=f;else break;n.delete(y),[l,c,u,h,f]=y,g!==l&&(r.push(g,v,l,v===c?c:u),g=l),v=v===c?u:c}r.push(g,v)}return new ik(i,a(this,eh))},fa=new WeakSet,Bu=function(t){const e=a(this,An);let n=0,i=e.length-1;for(;n<=i;){const r=n+i>>1,o=e[r][0];if(o===t)return r;o<t?n=r+1:i=r-1}return i+1},df=new WeakSet,_w=function([,t,e]){const n=A(this,fa,Bu).call(this,t);a(this,An).splice(n,0,[t,e])},ff=new WeakSet,xw=function([,t,e]){const n=A(this,fa,Bu).call(this,t);for(let i=n;i<a(this,An).length;i++){const[r,o]=a(this,An)[i];if(r!==t)break;if(r===t&&o===e){a(this,An).splice(i,1);return}}for(let i=n-1;i>=0;i--){const[r,o]=a(this,An)[i];if(r!==t)break;if(r===t&&o===e){a(this,An).splice(i,1);return}}},nh=new WeakSet,pm=function(t){const[e,n,i]=t,r=[[e,n,i]],o=A(this,fa,Bu).call(this,i);for(let l=0;l<o;l++){const[c,u]=a(this,An)[l];for(let h=0,f=r.length;h<f;h++){const[,g,v]=r[h];if(!(u<=g||v<=c)){if(g>=c){if(v>u)r[h][1]=u;else{if(f===1)return[];r.splice(h,1),h--,f--}continue}r[h][2]=c,v>u&&r.push([e,u,v])}}}return r};class Sw{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 mm}}var ih,pa;class ik extends Sw{constructor(e,n){super();m(this,ih,void 0);m(this,pa,void 0);w(this,pa,e),w(this,ih,n)}toSVGPath(){const e=[];for(const n of a(this,pa)){let[i,r]=n;e.push(`M${i} ${r}`);for(let o=2;o<n.length;o+=2){const l=n[o],c=n[o+1];l===i?(e.push(`V${c}`),r=c):c===r&&(e.push(`H${l}`),i=l)}e.push("Z")}return e.join(" ")}serialize([e,n,i,r],o){const l=[],c=i-e,u=r-n;for(const h of a(this,pa)){const f=new Array(h.length);for(let g=0;g<h.length;g+=2)f[g]=e+h[g]*c,f[g+1]=r-h[g+1]*u;l.push(f)}return l}get box(){return a(this,ih)}}ih=new WeakMap,pa=new WeakMap;var Un,Ti,ga,ma,Hn,_t,br,wr,sh,rh,va,ya,us,oh,pf,gf,ah,gm;const oi=class oi{constructor({x:t,y:e},n,i,r,o,l=0){m(this,ah);m(this,Un,void 0);m(this,Ti,[]);m(this,ga,void 0);m(this,ma,void 0);m(this,Hn,[]);m(this,_t,new Float64Array(18));m(this,br,void 0);m(this,wr,void 0);m(this,sh,void 0);m(this,rh,void 0);m(this,va,void 0);m(this,ya,void 0);m(this,us,[]);w(this,Un,n),w(this,ya,r*i),w(this,ma,o),a(this,_t).set([NaN,NaN,NaN,NaN,t,e],6),w(this,ga,l),w(this,rh,a(oi,oh)*i),w(this,sh,a(oi,gf)*i),w(this,va,i),a(this,us).push(t,e)}get free(){return!0}isEmpty(){return isNaN(a(this,_t)[8])}add({x:t,y:e}){var T;w(this,br,t),w(this,wr,e);const[n,i,r,o]=a(this,Un);let[l,c,u,h]=a(this,_t).subarray(8,12);const f=t-u,g=e-h,v=Math.hypot(f,g);if(v<a(this,sh))return!1;const y=v-a(this,rh),E=y/v,S=E*f,_=E*g;let P=l,L=c;l=u,c=h,u+=S,h+=_,(T=a(this,us))==null||T.push(t,e);const k=-_/y,F=S/y,I=k*a(this,ya),M=F*a(this,ya);return a(this,_t).set(a(this,_t).subarray(2,8),0),a(this,_t).set([u+I,h+M],4),a(this,_t).set(a(this,_t).subarray(14,18),12),a(this,_t).set([u-I,h-M],16),isNaN(a(this,_t)[6])?(a(this,Hn).length===0&&(a(this,_t).set([l+I,c+M],2),a(this,Hn).push(NaN,NaN,NaN,NaN,(l+I-n)/r,(c+M-i)/o),a(this,_t).set([l-I,c-M],14),a(this,Ti).push(NaN,NaN,NaN,NaN,(l-I-n)/r,(c-M-i)/o)),a(this,_t).set([P,L,l,c,u,h],6),!this.isEmpty()):(a(this,_t).set([P,L,l,c,u,h],6),Math.abs(Math.atan2(L-c,P-l)-Math.atan2(_,S))<Math.PI/2?([l,c,u,h]=a(this,_t).subarray(2,6),a(this,Hn).push(NaN,NaN,NaN,NaN,((l+u)/2-n)/r,((c+h)/2-i)/o),[l,c,P,L]=a(this,_t).subarray(14,18),a(this,Ti).push(NaN,NaN,NaN,NaN,((P+l)/2-n)/r,((L+c)/2-i)/o),!0):([P,L,l,c,u,h]=a(this,_t).subarray(0,6),a(this,Hn).push(((P+5*l)/6-n)/r,((L+5*c)/6-i)/o,((5*l+u)/6-n)/r,((5*c+h)/6-i)/o,((l+u)/2-n)/r,((c+h)/2-i)/o),[u,h,l,c,P,L]=a(this,_t).subarray(12,18),a(this,Ti).push(((P+5*l)/6-n)/r,((L+5*c)/6-i)/o,((5*l+u)/6-n)/r,((5*c+h)/6-i)/o,((l+u)/2-n)/r,((c+h)/2-i)/o),!0))}toSVGPath(){if(this.isEmpty())return"";const t=a(this,Hn),e=a(this,Ti),n=a(this,_t).subarray(4,6),i=a(this,_t).subarray(16,18),[r,o,l,c]=a(this,Un),[u,h,f,g]=A(this,ah,gm).call(this);if(isNaN(a(this,_t)[6])&&!this.isEmpty())return`M${(a(this,_t)[2]-r)/l} ${(a(this,_t)[3]-o)/c} L${(a(this,_t)[4]-r)/l} ${(a(this,_t)[5]-o)/c} L${u} ${h} L${f} ${g} L${(a(this,_t)[16]-r)/l} ${(a(this,_t)[17]-o)/c} L${(a(this,_t)[14]-r)/l} ${(a(this,_t)[15]-o)/c} Z`;const v=[];v.push(`M${t[4]} ${t[5]}`);for(let y=6;y<t.length;y+=6)isNaN(t[y])?v.push(`L${t[y+4]} ${t[y+5]}`):v.push(`C${t[y]} ${t[y+1]} ${t[y+2]} ${t[y+3]} ${t[y+4]} ${t[y+5]}`);v.push(`L${(n[0]-r)/l} ${(n[1]-o)/c} L${u} ${h} L${f} ${g} L${(i[0]-r)/l} ${(i[1]-o)/c}`);for(let y=e.length-6;y>=6;y-=6)isNaN(e[y])?v.push(`L${e[y+4]} ${e[y+5]}`):v.push(`C${e[y]} ${e[y+1]} ${e[y+2]} ${e[y+3]} ${e[y+4]} ${e[y+5]}`);return v.push(`L${e[4]} ${e[5]} Z`),v.join(" ")}getOutlines(){var _;const t=a(this,Hn),e=a(this,Ti),n=a(this,_t),i=n.subarray(4,6),r=n.subarray(16,18),[o,l,c,u]=a(this,Un),h=new Float64Array((((_=a(this,us))==null?void 0:_.length)??0)+2);for(let P=0,L=h.length-2;P<L;P+=2)h[P]=(a(this,us)[P]-o)/c,h[P+1]=(a(this,us)[P+1]-l)/u;h[h.length-2]=(a(this,br)-o)/c,h[h.length-1]=(a(this,wr)-l)/u;const[f,g,v,y]=A(this,ah,gm).call(this);if(isNaN(n[6])&&!this.isEmpty()){const P=new Float64Array(36);return P.set([NaN,NaN,NaN,NaN,(n[2]-o)/c,(n[3]-l)/u,NaN,NaN,NaN,NaN,(n[4]-o)/c,(n[5]-l)/u,NaN,NaN,NaN,NaN,f,g,NaN,NaN,NaN,NaN,v,y,NaN,NaN,NaN,NaN,(n[16]-o)/c,(n[17]-l)/u,NaN,NaN,NaN,NaN,(n[14]-o)/c,(n[15]-l)/u],0),new mm(P,h,a(this,Un),a(this,va),a(this,ga),a(this,ma))}const E=new Float64Array(a(this,Hn).length+24+a(this,Ti).length);let S=t.length;for(let P=0;P<S;P+=2){if(isNaN(t[P])){E[P]=E[P+1]=NaN;continue}E[P]=t[P],E[P+1]=t[P+1]}E.set([NaN,NaN,NaN,NaN,(i[0]-o)/c,(i[1]-l)/u,NaN,NaN,NaN,NaN,f,g,NaN,NaN,NaN,NaN,v,y,NaN,NaN,NaN,NaN,(r[0]-o)/c,(r[1]-l)/u],S),S+=24;for(let P=e.length-6;P>=6;P-=6)for(let L=0;L<6;L+=2){if(isNaN(e[P+L])){E[S]=E[S+1]=NaN,S+=2;continue}E[S]=e[P+L],E[S+1]=e[P+L+1],S+=2}return E.set([NaN,NaN,NaN,NaN,e[4],e[5]],S),new mm(E,h,a(this,Un),a(this,va),a(this,ga),a(this,ma))}};Un=new WeakMap,Ti=new WeakMap,ga=new WeakMap,ma=new WeakMap,Hn=new WeakMap,_t=new WeakMap,br=new WeakMap,wr=new WeakMap,sh=new WeakMap,rh=new WeakMap,va=new WeakMap,ya=new WeakMap,us=new WeakMap,oh=new WeakMap,pf=new WeakMap,gf=new WeakMap,ah=new WeakSet,gm=function(){const t=a(this,_t).subarray(4,6),e=a(this,_t).subarray(16,18),[n,i,r,o]=a(this,Un);return[(a(this,br)+(t[0]-e[0])/2-n)/r,(a(this,wr)+(t[1]-e[1])/2-i)/o,(a(this,br)+(e[0]-t[0])/2-n)/r,(a(this,wr)+(e[1]-t[1])/2-i)/o]},m(oi,oh,8),m(oi,pf,2),m(oi,gf,a(oi,oh)+a(oi,pf));let od=oi;var ba,Ar,Pi,lh,Ze,ch,Zt,Er,al,_r,ll,mf,Cw;class mm extends Sw{constructor(e,n,i,r,o,l){super();m(this,Er);m(this,_r);m(this,mf);m(this,ba,void 0);m(this,Ar,null);m(this,Pi,void 0);m(this,lh,void 0);m(this,Ze,void 0);m(this,ch,void 0);m(this,Zt,void 0);w(this,Zt,e),w(this,Ze,n),w(this,ba,i),w(this,ch,r),w(this,Pi,o),w(this,lh,l),A(this,mf,Cw).call(this,l);const{x:c,y:u,width:h,height:f}=a(this,Ar);for(let g=0,v=e.length;g<v;g+=2)e[g]=(e[g]-c)/h,e[g+1]=(e[g+1]-u)/f;for(let g=0,v=n.length;g<v;g+=2)n[g]=(n[g]-c)/h,n[g+1]=(n[g+1]-u)/f}toSVGPath(){const e=[`M${a(this,Zt)[4]} ${a(this,Zt)[5]}`];for(let n=6,i=a(this,Zt).length;n<i;n+=6){if(isNaN(a(this,Zt)[n])){e.push(`L${a(this,Zt)[n+4]} ${a(this,Zt)[n+5]}`);continue}e.push(`C${a(this,Zt)[n]} ${a(this,Zt)[n+1]} ${a(this,Zt)[n+2]} ${a(this,Zt)[n+3]} ${a(this,Zt)[n+4]} ${a(this,Zt)[n+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,n,i,r],o){const l=i-e,c=r-n;let u,h;switch(o){case 0:u=A(this,Er,al).call(this,a(this,Zt),e,r,l,-c),h=A(this,Er,al).call(this,a(this,Ze),e,r,l,-c);break;case 90:u=A(this,_r,ll).call(this,a(this,Zt),e,n,l,c),h=A(this,_r,ll).call(this,a(this,Ze),e,n,l,c);break;case 180:u=A(this,Er,al).call(this,a(this,Zt),i,n,-l,c),h=A(this,Er,al).call(this,a(this,Ze),i,n,-l,c);break;case 270:u=A(this,_r,ll).call(this,a(this,Zt),i,r,-l,-c),h=A(this,_r,ll).call(this,a(this,Ze),i,r,-l,-c);break}return{outline:Array.from(u),points:[Array.from(h)]}}get box(){return a(this,Ar)}getNewOutline(e,n){const{x:i,y:r,width:o,height:l}=a(this,Ar),[c,u,h,f]=a(this,ba),g=o*h,v=l*f,y=i*h+c,E=r*f+u,S=new od({x:a(this,Ze)[0]*g+y,y:a(this,Ze)[1]*v+E},a(this,ba),a(this,ch),e,a(this,lh),n??a(this,Pi));for(let _=2;_<a(this,Ze).length;_+=2)S.add({x:a(this,Ze)[_]*g+y,y:a(this,Ze)[_+1]*v+E});return S.getOutlines()}}ba=new WeakMap,Ar=new WeakMap,Pi=new WeakMap,lh=new WeakMap,Ze=new WeakMap,ch=new WeakMap,Zt=new WeakMap,Er=new WeakSet,al=function(e,n,i,r,o){const l=new Float64Array(e.length);for(let c=0,u=e.length;c<u;c+=2)l[c]=n+e[c]*r,l[c+1]=i+e[c+1]*o;return l},_r=new WeakSet,ll=function(e,n,i,r,o){const l=new Float64Array(e.length);for(let c=0,u=e.length;c<u;c+=2)l[c]=n+e[c+1]*r,l[c+1]=i+e[c]*o;return l},mf=new WeakSet,Cw=function(e){const n=a(this,Zt);let i=n[4],r=n[5],o=i,l=r,c=i,u=r,h=i,f=r;const g=e?Math.max:Math.min;for(let _=6,P=n.length;_<P;_+=6){if(isNaN(n[_]))o=Math.min(o,n[_+4]),l=Math.min(l,n[_+5]),c=Math.max(c,n[_+4]),u=Math.max(u,n[_+5]),f<n[_+5]?(h=n[_+4],f=n[_+5]):f===n[_+5]&&(h=g(h,n[_+4]));else{const L=tt.bezierBoundingBox(i,r,...n.slice(_,_+6));o=Math.min(o,L[0]),l=Math.min(l,L[1]),c=Math.max(c,L[2]),u=Math.max(u,L[3]),f<L[3]?(h=L[2],f=L[3]):f===L[3]&&(h=g(h,L[2]))}i=n[_+4],r=n[_+5]}const v=o-a(this,Pi),y=l-a(this,Pi),E=c-o+2*a(this,Pi),S=u-l+2*a(this,Pi);w(this,Ar,{x:v,y,width:E,height:S,lastPoint:[h,f]})};var hh,uh,En,xr,wa,se,dh,Aa,fh,ph,ds,Ea,gh,vm,mh,ym,vf,Tw,Ri,Ls,yf,Pw,zn,qi;const ai=class ai{constructor({editor:t=null,uiManager:e=null}){m(this,gh);m(this,mh);m(this,vf);m(this,Ri);m(this,yf);m(this,zn);m(this,hh,A(this,vf,Tw).bind(this));m(this,uh,A(this,yf,Pw).bind(this));m(this,En,null);m(this,xr,null);m(this,wa,void 0);m(this,se,null);m(this,dh,!1);m(this,Aa,!1);m(this,fh,null);m(this,ph,void 0);m(this,ds,null);m(this,Ea,void 0);var n;t?(w(this,Aa,!1),w(this,Ea,lt.HIGHLIGHT_COLOR),w(this,fh,t)):(w(this,Aa,!0),w(this,Ea,lt.HIGHLIGHT_DEFAULT_COLOR)),w(this,ds,(t==null?void 0:t._uiManager)||e),w(this,ph,a(this,ds)._eventBus),w(this,wa,(t==null?void 0:t.color)||((n=a(this,ds))==null?void 0:n.highlightColors.values().next().value)||"#FFFF98")}static get _keyboardManager(){return Tt(this,"_keyboardManager",new Xh([[["Escape","mac+Escape"],ai.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],ai.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],ai.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],ai.prototype._moveToPrevious],[["Home","mac+Home"],ai.prototype._moveToBeginning],[["End","mac+End"],ai.prototype._moveToEnd]]))}renderButton(){const t=w(this,En,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,Ri,Ls).bind(this)),t.addEventListener("keydown",a(this,hh));const e=w(this,xr,document.createElement("span"));return e.className="swatch",e.setAttribute("aria-hidden",!0),e.style.backgroundColor=a(this,wa),t.append(e),t}renderMainDropdown(){const t=w(this,se,A(this,gh,vm).call(this));return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}_colorSelectFromKeyboard(t){if(t.target===a(this,En)){A(this,Ri,Ls).call(this,t);return}const e=t.target.getAttribute("data-color");e&&A(this,mh,ym).call(this,e,t)}_moveToNext(t){var e,n;if(!a(this,zn,qi)){A(this,Ri,Ls).call(this,t);return}if(t.target===a(this,En)){(e=a(this,se).firstChild)==null||e.focus();return}(n=t.target.nextSibling)==null||n.focus()}_moveToPrevious(t){var e,n;if(t.target===((e=a(this,se))==null?void 0:e.firstChild)||t.target===a(this,En)){a(this,zn,qi)&&this._hideDropdownFromKeyboard();return}a(this,zn,qi)||A(this,Ri,Ls).call(this,t),(n=t.target.previousSibling)==null||n.focus()}_moveToBeginning(t){var e;if(!a(this,zn,qi)){A(this,Ri,Ls).call(this,t);return}(e=a(this,se).firstChild)==null||e.focus()}_moveToEnd(t){var e;if(!a(this,zn,qi)){A(this,Ri,Ls).call(this,t);return}(e=a(this,se).lastChild)==null||e.focus()}hideDropdown(){var t;(t=a(this,se))==null||t.classList.add("hidden"),window.removeEventListener("pointerdown",a(this,uh))}_hideDropdownFromKeyboard(){var t;if(!a(this,Aa)){if(!a(this,zn,qi)){(t=a(this,fh))==null||t.unselect();return}this.hideDropdown(),a(this,En).focus({preventScroll:!0,focusVisible:a(this,dh)})}}updateColor(t){if(a(this,xr)&&(a(this,xr).style.backgroundColor=t),!a(this,se))return;const e=a(this,ds).highlightColors.values();for(const n of a(this,se).children)n.setAttribute("aria-selected",e.next().value===t)}destroy(){var t,e;(t=a(this,En))==null||t.remove(),w(this,En,null),w(this,xr,null),(e=a(this,se))==null||e.remove(),w(this,se,null)}};hh=new WeakMap,uh=new WeakMap,En=new WeakMap,xr=new WeakMap,wa=new WeakMap,se=new WeakMap,dh=new WeakMap,Aa=new WeakMap,fh=new WeakMap,ph=new WeakMap,ds=new WeakMap,Ea=new WeakMap,gh=new WeakSet,vm=function(){const t=document.createElement("div");t.addEventListener("contextmenu",Ve),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 a(this,ds).highlightColors){const i=document.createElement("button");i.tabIndex="0",i.role="option",i.setAttribute("data-color",n),i.title=e,i.setAttribute("data-l10n-id",`pdfjs-editor-colorpicker-${e}`);const r=document.createElement("span");i.append(r),r.className="swatch",r.style.backgroundColor=n,i.setAttribute("aria-selected",n===a(this,wa)),i.addEventListener("click",A(this,mh,ym).bind(this,n)),t.append(i)}return t.addEventListener("keydown",a(this,hh)),t},mh=new WeakSet,ym=function(t,e){e.stopPropagation(),a(this,ph).dispatch("switchannotationeditorparams",{source:this,type:a(this,Ea),value:t})},vf=new WeakSet,Tw=function(t){ai._keyboardManager.exec(this,t)},Ri=new WeakSet,Ls=function(t){if(a(this,zn,qi)){this.hideDropdown();return}if(w(this,dh,t.detail===0),window.addEventListener("pointerdown",a(this,uh)),a(this,se)){a(this,se).classList.remove("hidden");return}const e=w(this,se,A(this,gh,vm).call(this));a(this,En).append(e)},yf=new WeakSet,Pw=function(t){var e;(e=a(this,se))!=null&&e.contains(t.target)||this.hideDropdown()},zn=new WeakSet,qi=function(){return a(this,se)&&!a(this,se).classList.contains("hidden")};let ad=ai;var _a,vh,fs,Sr,xa,ln,yh,bh,Cr,_n,Fe,Je,bf,Sa,Tr,re,Ca,Vn,wh,Ah,bm,Eh,wm,wf,Rw,Af,Lw,Ef,kw,_h,Am,Pr,cl,ps,fo,_f,Iw,Ta,$u,Rr,hl,xf,Fw,Sf,Mw,Cf,Dw,Tf,Ow;const Ct=class Ct extends Ft{constructor(e){super({...e,name:"highlightEditor"});m(this,Ah);m(this,Eh);m(this,wf);m(this,Af);m(this,Ef);m(this,_h);m(this,Pr);m(this,_f);m(this,Ta);m(this,Rr);m(this,xf);m(this,Sf);m(this,_a,null);m(this,vh,0);m(this,fs,void 0);m(this,Sr,null);m(this,xa,null);m(this,ln,null);m(this,yh,null);m(this,bh,0);m(this,Cr,null);m(this,_n,null);m(this,Fe,null);m(this,Je,!1);m(this,bf,A(this,_f,Iw).bind(this));m(this,Sa,null);m(this,Tr,void 0);m(this,re,null);m(this,Ca,"");m(this,Vn,void 0);m(this,wh,"");this.color=e.color||Ct._defaultColor,w(this,Vn,e.thickness||Ct._defaultThickness),w(this,Tr,e.opacity||Ct._defaultOpacity),w(this,fs,e.boxes||null),w(this,wh,e.methodOfCreation||""),w(this,Ca,e.text||""),this._isDraggable=!1,e.highlightId>-1?(w(this,Je,!0),A(this,Eh,wm).call(this,e),A(this,Pr,cl).call(this)):(w(this,_a,e.anchorNode),w(this,vh,e.anchorOffset),w(this,yh,e.focusNode),w(this,bh,e.focusOffset),A(this,Ah,bm).call(this),A(this,Pr,cl).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const e=Ct.prototype;return Tt(this,"_keyboardManager",new Xh([[["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:a(this,Je)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:a(this,Vn),methodOfCreation:a(this,wh)}}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 i;Ft.initialize(e,n),Ct._defaultColor||(Ct._defaultColor=((i=n.highlightColors)==null?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(e,n){switch(e){case lt.HIGHLIGHT_DEFAULT_COLOR:Ct._defaultColor=n;break;case lt.HIGHLIGHT_THICKNESS:Ct._defaultThickness=n;break}}translateInPage(e,n){}get toolbarPosition(){return a(this,Sa)}updateParams(e,n){switch(e){case lt.HIGHLIGHT_COLOR:A(this,wf,Rw).call(this,n);break;case lt.HIGHLIGHT_THICKNESS:A(this,Af,Lw).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[lt.HIGHLIGHT_DEFAULT_COLOR,Ct._defaultColor],[lt.HIGHLIGHT_THICKNESS,Ct._defaultThickness]]}get propertiesToUpdate(){return[[lt.HIGHLIGHT_COLOR,this.color||Ct._defaultColor],[lt.HIGHLIGHT_THICKNESS,a(this,Vn)||Ct._defaultThickness],[lt.HIGHLIGHT_FREE,a(this,Je)]]}async addEditToolbar(){const e=await super.addEditToolbar();return e?(this._uiManager.highlightColors&&(w(this,xa,new ad({editor:this})),e.addColorPicker(a(this,xa))),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,Rr,hl).call(this))}getBaseTranslation(){return[0,0]}getRect(e,n){return super.getRect(e,n,A(this,Rr,hl).call(this))}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){A(this,_h,Am).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(A(this,Pr,cl).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var i;let n=!1;this.parent&&!e?A(this,_h,Am).call(this):e&&(A(this,Pr,cl).call(this,e),n=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(e),this.show(this._isVisible),n&&this.select()}rotate(e){var r,o,l;const{drawLayer:n}=this.parent;let i;a(this,Je)?(e=(e-this.rotation+360)%360,i=A(r=Ct,ps,fo).call(r,a(this,_n).box,e)):i=A(o=Ct,ps,fo).call(o,this,e),n.rotate(a(this,Fe),e),n.rotate(a(this,re),e),n.updateBox(a(this,Fe),i),n.updateBox(a(this,re),A(l=Ct,ps,fo).call(l,a(this,ln).box,e))}render(){if(this.div)return this.div;const e=super.render();a(this,Ca)&&(e.setAttribute("aria-label",a(this,Ca)),e.setAttribute("role","mark")),a(this,Je)?e.classList.add("free"):this.div.addEventListener("keydown",a(this,bf));const n=w(this,Cr,document.createElement("div"));e.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",n.style.clipPath=a(this,Sr);const[i,r]=this.parentDimensions;return this.setDims(this.width*i,this.height*r),nd(this,a(this,Cr),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.parent.drawLayer.addClass(a(this,re),"hovered")}pointerleave(){this.parent.drawLayer.removeClass(a(this,re),"hovered")}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:A(this,Ta,$u).call(this,!0);break;case 1:case 3:A(this,Ta,$u).call(this,!1);break}}select(){var e,n;super.select(),a(this,re)&&((e=this.parent)==null||e.drawLayer.removeClass(a(this,re),"hovered"),(n=this.parent)==null||n.drawLayer.addClass(a(this,re),"selected"))}unselect(){var e;super.unselect(),a(this,re)&&((e=this.parent)==null||e.drawLayer.removeClass(a(this,re),"selected"),a(this,Je)||A(this,Ta,$u).call(this,!1))}get _mustFixPosition(){return!a(this,Je)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.show(a(this,Fe),e),this.parent.drawLayer.show(a(this,re),e))}static startHighlighting(e,n,{target:i,x:r,y:o}){const{x:l,y:c,width:u,height:h}=i.getBoundingClientRect(),f=E=>{A(this,Cf,Dw).call(this,e,E)},g={capture:!0,passive:!1},v=E=>{E.preventDefault(),E.stopPropagation()},y=E=>{i.removeEventListener("pointermove",f),window.removeEventListener("blur",y),window.removeEventListener("pointerup",y),window.removeEventListener("pointerdown",v,g),window.removeEventListener("contextmenu",Ve),A(this,Tf,Ow).call(this,e,E)};window.addEventListener("blur",y),window.addEventListener("pointerup",y),window.addEventListener("pointerdown",v,g),window.addEventListener("contextmenu",Ve),i.addEventListener("pointermove",f),this._freeHighlight=new od({x:r,y:o},[l,c,u,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,i){var E;const r=super.deserialize(e,n,i),{rect:[o,l,c,u],color:h,quadPoints:f}=e;r.color=tt.makeHexColor(...h),w(r,Tr,e.opacity);const[g,v]=r.pageDimensions;r.width=(c-o)/g,r.height=(u-l)/v;const y=w(r,fs,[]);for(let S=0;S<f.length;S+=8)y.push({x:(f[4]-c)/g,y:(u-(1-f[S+5]))/v,width:(f[S+2]-f[S])/g,height:(f[S+5]-f[S+1])/v});return A(E=r,Ah,bm).call(E),r}serialize(e=!1){if(this.isEmpty()||e)return null;const n=this.getRect(0,0),i=Ft._colorManager.convert(this.color);return{annotationType:xt.HIGHLIGHT,color:i,opacity:a(this,Tr),thickness:a(this,Vn),quadPoints:A(this,xf,Fw).call(this),outlines:A(this,Sf,Mw).call(this,n),pageIndex:this.pageIndex,rect:n,rotation:A(this,Rr,hl).call(this),structTreeParentId:this._structTreeParentId}}static canCreateNewEmptyEditor(){return!1}};_a=new WeakMap,vh=new WeakMap,fs=new WeakMap,Sr=new WeakMap,xa=new WeakMap,ln=new WeakMap,yh=new WeakMap,bh=new WeakMap,Cr=new WeakMap,_n=new WeakMap,Fe=new WeakMap,Je=new WeakMap,bf=new WeakMap,Sa=new WeakMap,Tr=new WeakMap,re=new WeakMap,Ca=new WeakMap,Vn=new WeakMap,wh=new WeakMap,Ah=new WeakSet,bm=function(){const e=new fm(a(this,fs),.001);w(this,_n,e.getOutlines()),{x:this.x,y:this.y,width:this.width,height:this.height}=a(this,_n).box;const n=new fm(a(this,fs),.0025,.001,this._uiManager.direction==="ltr");w(this,ln,n.getOutlines());const{lastPoint:i}=a(this,ln).box;w(this,Sa,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])},Eh=new WeakSet,wm=function({highlightOutlines:e,highlightId:n,clipPathId:i}){var f,g;if(w(this,_n,e),w(this,ln,e.getNewOutline(a(this,Vn)/2+1.5,.0025)),n>=0)w(this,Fe,n),w(this,Sr,i),this.parent.drawLayer.finalizeLine(n,e),w(this,re,this.parent.drawLayer.highlightOutline(a(this,ln)));else if(this.parent){const v=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(a(this,Fe),e),this.parent.drawLayer.updateBox(a(this,Fe),A(f=Ct,ps,fo).call(f,a(this,_n).box,(v-this.rotation+360)%360)),this.parent.drawLayer.updateLine(a(this,re),a(this,ln)),this.parent.drawLayer.updateBox(a(this,re),A(g=Ct,ps,fo).call(g,a(this,ln).box,v))}const{x:o,y:l,width:c,height:u}=e.box;switch(this.rotation){case 0:this.x=o,this.y=l,this.width=c,this.height=u;break;case 90:{const[v,y]=this.parentDimensions;this.x=l,this.y=1-o,this.width=c*y/v,this.height=u*v/y;break}case 180:this.x=1-o,this.y=1-l,this.width=c,this.height=u;break;case 270:{const[v,y]=this.parentDimensions;this.x=1-l,this.y=o,this.width=c*y/v,this.height=u*v/y;break}}const{lastPoint:h}=a(this,ln).box;w(this,Sa,[(h[0]-o)/c,(h[1]-l)/u])},wf=new WeakSet,Rw=function(e){const n=r=>{var o,l;this.color=r,(o=this.parent)==null||o.drawLayer.changeColor(a(this,Fe),r),(l=a(this,xa))==null||l.updateColor(r)},i=this.color;this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:lt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(e)},!0)},Af=new WeakSet,Lw=function(e){const n=a(this,Vn),i=r=>{w(this,Vn,r),A(this,Ef,kw).call(this,r)};this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:lt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},Ef=new WeakSet,kw=function(e){if(!a(this,Je))return;A(this,Eh,wm).call(this,{highlightOutlines:a(this,_n).getNewOutline(e/2)}),this.fixAndSetPosition();const[n,i]=this.parentDimensions;this.setDims(this.width*n,this.height*i)},_h=new WeakSet,Am=function(){a(this,Fe)===null||!this.parent||(this.parent.drawLayer.remove(a(this,Fe)),w(this,Fe,null),this.parent.drawLayer.remove(a(this,re)),w(this,re,null))},Pr=new WeakSet,cl=function(e=this.parent){a(this,Fe)===null&&({id:Ge(this,Fe)._,clipPathId:Ge(this,Sr)._}=e.drawLayer.highlight(a(this,_n),this.color,a(this,Tr)),w(this,re,e.drawLayer.highlightOutline(a(this,ln))),a(this,Cr)&&(a(this,Cr).style.clipPath=a(this,Sr)))},ps=new WeakSet,fo=function({x:e,y:n,width:i,height:r},o){switch(o){case 90:return{x:1-n-r,y:e,width:r,height:i};case 180:return{x:1-e-i,y:1-n-r,width:i,height:r};case 270:return{x:n,y:1-e-i,width:r,height:i}}return{x:e,y:n,width:i,height:r}},_f=new WeakSet,Iw=function(e){Ct._keyboardManager.exec(this,e)},Ta=new WeakSet,$u=function(e){if(!a(this,_a))return;const n=window.getSelection();e?n.setPosition(a(this,_a),a(this,vh)):n.setPosition(a(this,yh),a(this,bh))},Rr=new WeakSet,hl=function(){return a(this,Je)?this.rotation:0},xf=new WeakSet,Fw=function(){if(a(this,Je))return null;const[e,n]=this.pageDimensions,i=a(this,fs),r=new Array(i.length*8);let o=0;for(const{x:l,y:c,width:u,height:h}of i){const f=l*e,g=(1-c-h)*n;r[o]=r[o+4]=f,r[o+1]=r[o+3]=g,r[o+2]=r[o+6]=f+u*e,r[o+5]=r[o+7]=g+h*n,o+=8}return r},Sf=new WeakSet,Mw=function(e){return a(this,_n).serialize(e,A(this,Rr,hl).call(this))},Cf=new WeakSet,Dw=function(e,n){this._freeHighlight.add(n)&&e.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},Tf=new WeakSet,Ow=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,ps),m(Ct,Cf),m(Ct,Tf),dt(Ct,"_defaultColor",null),dt(Ct,"_defaultOpacity",1),dt(Ct,"_defaultThickness",12),dt(Ct,"_l10nPromise"),dt(Ct,"_type","highlight"),dt(Ct,"_editorType",xt.HIGHLIGHT),dt(Ct,"_freeHighlightId",-1),dt(Ct,"_freeHighlight",null),dt(Ct,"_freeHighlightClipId","");let ld=Ct;var Lr,kr,xh,Sh,Ch,Ir,Gn,Li,cn,Fr,Mr,Dr,Or,Nr,gs,Pf,Nw,Rf,Bw,Lf,$w,kf,jw,Th,_m,If,Uw,Ph,xm,Ff,Hw,Mf,zw,Df,Vw,Of,Gw,Nf,Ww,ki,ks,Rh,Sm,Pa,ju,Ra,Uu,ms,po,Lh,Cm,La,Hu,Bf,qw,kh,Tm,$f,Xw,jf,Yw,Ih,Pm,ka,zu,Br,ul;const Ht=class Ht extends Ft{constructor(e){super({...e,name:"inkEditor"});m(this,Pf);m(this,Rf);m(this,Lf);m(this,kf);m(this,Th);m(this,If);m(this,Ph);m(this,Ff);m(this,Mf);m(this,Df);m(this,Of);m(this,Nf);m(this,ki);m(this,Rh);m(this,Pa);m(this,Ra);m(this,ms);m(this,Lh);m(this,La);m(this,jf);m(this,Ih);m(this,ka);m(this,Br);m(this,Lr,0);m(this,kr,0);m(this,xh,this.canvasPointermove.bind(this));m(this,Sh,this.canvasPointerleave.bind(this));m(this,Ch,this.canvasPointerup.bind(this));m(this,Ir,this.canvasPointerdown.bind(this));m(this,Gn,null);m(this,Li,new Path2D);m(this,cn,!1);m(this,Fr,!1);m(this,Mr,!1);m(this,Dr,null);m(this,Or,0);m(this,Nr,0);m(this,gs,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){Ft.initialize(e,n)}static updateDefaultParams(e,n){switch(e){case lt.INK_THICKNESS:Ht._defaultThickness=n;break;case lt.INK_COLOR:Ht._defaultColor=n;break;case lt.INK_OPACITY:Ht._defaultOpacity=n/100;break}}updateParams(e,n){switch(e){case lt.INK_THICKNESS:A(this,Pf,Nw).call(this,n);break;case lt.INK_COLOR:A(this,Rf,Bw).call(this,n);break;case lt.INK_OPACITY:A(this,Lf,$w).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[lt.INK_THICKNESS,Ht._defaultThickness],[lt.INK_COLOR,Ht._defaultColor||Ft._defaultLineColor],[lt.INK_OPACITY,Math.round(Ht._defaultOpacity*100)]]}get propertiesToUpdate(){return[[lt.INK_THICKNESS,this.thickness||Ht._defaultThickness],[lt.INK_COLOR,this.color||Ht._defaultColor||Ft._defaultLineColor],[lt.INK_OPACITY,Math.round(100*(this.opacity??Ht._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(A(this,Pa,ju).call(this),A(this,Ra,Uu).call(this)),this.isAttachedToDOM||(this.parent.add(this),A(this,ms,po).call(this)),A(this,Br,ul).call(this)))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,a(this,Gn)&&(clearTimeout(a(this,Gn)),w(this,Gn,null)),a(this,Dr).disconnect(),w(this,Dr,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,i=this.width*e,r=this.height*n;this.setDimensions(i,r)}enableEditMode(){a(this,cn)||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",a(this,Ir)))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",a(this,Ir)))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){a(this,cn)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),w(this,cn,!0),this.div.classList.add("disabled"),A(this,Br,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()||a(this,cn)||(this.setInForeground(),e.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),A(this,If,Uw).call(this,e.offsetX,e.offsetY))}canvasPointermove(e){e.preventDefault(),A(this,Ph,xm).call(this,e.offsetX,e.offsetY)}canvasPointerup(e){e.preventDefault(),A(this,Rh,Sm).call(this,e)}canvasPointerleave(e){A(this,Rh,Sm).call(this,e)}get isResizable(){return!this.isEmpty()&&a(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[i,r,o,l]=A(this,kf,jw).call(this);if(this.setAt(i,r,0,0),this.setDims(o,l),A(this,Pa,ju).call(this),this.width){const[c,u]=this.parentDimensions;this.setAspectRatio(this.width*c,this.height*u),this.setAt(e*c,n*u,this.width*c,this.height*u),w(this,Mr,!0),A(this,ms,po).call(this),this.setDims(this.width*c,this.height*u),A(this,ki,ks).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return A(this,Ra,Uu).call(this),this.div}setDimensions(e,n){const i=Math.round(e),r=Math.round(n);if(a(this,Or)===i&&a(this,Nr)===r)return;w(this,Or,i),w(this,Nr,r),this.canvas.style.visibility="hidden";const[o,l]=this.parentDimensions;this.width=e/o,this.height=n/l,this.fixAndSetPosition(),a(this,cn)&&A(this,Lh,Cm).call(this,e,n),A(this,ms,po).call(this),A(this,ki,ks).call(this),this.canvas.style.visibility="visible",this.fixDims()}static deserialize(e,n,i){var S,_,P;if(e instanceof pw)return null;const r=super.deserialize(e,n,i);r.thickness=e.thickness,r.color=tt.makeHexColor(...e.color),r.opacity=e.opacity;const[o,l]=r.pageDimensions,c=r.width*o,u=r.height*l,h=r.parentScale,f=e.thickness/2;w(r,cn,!0),w(r,Or,Math.round(c)),w(r,Nr,Math.round(u));const{paths:g,rect:v,rotation:y}=e;for(let{bezier:L}of g){L=A(S=Ht,$f,Xw).call(S,L,v,y);const k=[];r.paths.push(k);let F=h*(L[0]-f),I=h*(L[1]-f);for(let C=2,T=L.length;C<T;C+=6){const N=h*(L[C]-f),D=h*(L[C+1]-f),H=h*(L[C+2]-f),z=h*(L[C+3]-f),G=h*(L[C+4]-f),K=h*(L[C+5]-f);k.push([[F,I],[N,D],[H,z],[G,K]]),F=G,I=K}const M=A(this,Bf,qw).call(this,k);r.bezierPath2D.push(M)}const E=A(_=r,Ih,Pm).call(_);return w(r,kr,Math.max(Ft.MIN_SIZE,E[2]-E[0])),w(r,Lr,Math.max(Ft.MIN_SIZE,E[3]-E[1])),A(P=r,Lh,Cm).call(P,c,u),r}serialize(){if(this.isEmpty())return null;const e=this.getRect(0,0),n=Ft._colorManager.convert(this.ctx.strokeStyle);return{annotationType:xt.INK,color:n,thickness:this.thickness,opacity:this.opacity,paths:A(this,jf,Yw).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,e),pageIndex:this.pageIndex,rect:e,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}};Lr=new WeakMap,kr=new WeakMap,xh=new WeakMap,Sh=new WeakMap,Ch=new WeakMap,Ir=new WeakMap,Gn=new WeakMap,Li=new WeakMap,cn=new WeakMap,Fr=new WeakMap,Mr=new WeakMap,Dr=new WeakMap,Or=new WeakMap,Nr=new WeakMap,gs=new WeakMap,Pf=new WeakSet,Nw=function(e){const n=r=>{this.thickness=r,A(this,Br,ul).call(this)},i=this.thickness;this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:lt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},Rf=new WeakSet,Bw=function(e){const n=r=>{this.color=r,A(this,ki,ks).call(this)},i=this.color;this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:lt.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Lf=new WeakSet,$w=function(e){const n=r=>{this.opacity=r,A(this,ki,ks).call(this)};e/=100;const i=this.opacity;this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:lt.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},kf=new WeakSet,jw=function(){const{parentRotation:e,parentDimensions:[n,i]}=this;switch(e){case 90:return[0,i,i,n];case 180:return[n,i,n,i];case 270:return[n,0,i,n];default:return[0,0,n,i]}},Th=new WeakSet,_m=function(){const{ctx:e,color:n,opacity:i,thickness:r,parentScale:o,scaleFactor:l}=this;e.lineWidth=r*o/l,e.lineCap="round",e.lineJoin="round",e.miterLimit=10,e.strokeStyle=`${n}${TR(i)}`},If=new WeakSet,Uw=function(e,n){this.canvas.addEventListener("contextmenu",Ve),this.canvas.addEventListener("pointerleave",a(this,Sh)),this.canvas.addEventListener("pointermove",a(this,xh)),this.canvas.addEventListener("pointerup",a(this,Ch)),this.canvas.removeEventListener("pointerdown",a(this,Ir)),this.isEditing=!0,a(this,Mr)||(w(this,Mr,!0),A(this,ms,po).call(this),this.thickness||(this.thickness=Ht._defaultThickness),this.color||(this.color=Ht._defaultColor||Ft._defaultLineColor),this.opacity??(this.opacity=Ht._defaultOpacity)),this.currentPath.push([e,n]),w(this,Fr,!1),A(this,Th,_m).call(this),w(this,gs,()=>{A(this,Df,Vw).call(this),a(this,gs)&&window.requestAnimationFrame(a(this,gs))}),window.requestAnimationFrame(a(this,gs))},Ph=new WeakSet,xm=function(e,n){const[i,r]=this.currentPath.at(-1);if(this.currentPath.length>1&&e===i&&n===r)return;const o=this.currentPath;let l=a(this,Li);if(o.push([e,n]),w(this,Fr,!0),o.length<=2){l.moveTo(...o[0]),l.lineTo(e,n);return}o.length===3&&(w(this,Li,l=new Path2D),l.moveTo(...o[0])),A(this,Of,Gw).call(this,l,...o.at(-3),...o.at(-2),e,n)},Ff=new WeakSet,Hw=function(){if(this.currentPath.length===0)return;const e=this.currentPath.at(-1);a(this,Li).lineTo(...e)},Mf=new WeakSet,zw=function(e,n){w(this,gs,null),e=Math.min(Math.max(e,0),this.canvas.width),n=Math.min(Math.max(n,0),this.canvas.height),A(this,Ph,xm).call(this,e,n),A(this,Ff,Hw).call(this);let i;if(this.currentPath.length!==1)i=A(this,Nf,Ww).call(this);else{const u=[e,n];i=[[u,u.slice(),u.slice(),u]]}const r=a(this,Li),o=this.currentPath;this.currentPath=[],w(this,Li,new Path2D);const l=()=>{this.allRawPaths.push(o),this.paths.push(i),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,Pa,ju).call(this),A(this,Ra,Uu).call(this)),A(this,Br,ul).call(this))};this.addCommands({cmd:l,undo:c,mustExec:!0})},Df=new WeakSet,Vw=function(){if(!a(this,Fr))return;w(this,Fr,!1);const e=Math.ceil(this.thickness*this.parentScale),n=this.currentPath.slice(-3),i=n.map(l=>l[0]),r=n.map(l=>l[1]);Math.min(...i)-e,Math.max(...i)+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 l of this.bezierPath2D)o.stroke(l);o.stroke(a(this,Li)),o.restore()},Of=new WeakSet,Gw=function(e,n,i,r,o,l,c){const u=(n+r)/2,h=(i+o)/2,f=(r+l)/2,g=(o+c)/2;e.bezierCurveTo(u+2*(r-u)/3,h+2*(o-h)/3,f+2*(r-f)/3,g+2*(o-g)/3,f,g)},Nf=new WeakSet,Ww=function(){const e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];const n=[];let i,[r,o]=e[0];for(i=1;i<e.length-2;i++){const[v,y]=e[i],[E,S]=e[i+1],_=(v+E)/2,P=(y+S)/2,L=[r+2*(v-r)/3,o+2*(y-o)/3],k=[_+2*(v-_)/3,P+2*(y-P)/3];n.push([[r,o],L,k,[_,P]]),[r,o]=[_,P]}const[l,c]=e[i],[u,h]=e[i+1],f=[r+2*(l-r)/3,o+2*(c-o)/3],g=[u+2*(l-u)/3,h+2*(c-h)/3];return n.push([[r,o],f,g,[u,h]]),n},ki=new WeakSet,ks=function(){if(this.isEmpty()){A(this,La,Hu).call(this);return}A(this,Th,_m).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,La,Hu).call(this);for(const i of this.bezierPath2D)n.stroke(i)},Rh=new WeakSet,Sm=function(e){this.canvas.removeEventListener("pointerleave",a(this,Sh)),this.canvas.removeEventListener("pointermove",a(this,xh)),this.canvas.removeEventListener("pointerup",a(this,Ch)),this.canvas.addEventListener("pointerdown",a(this,Ir)),a(this,Gn)&&clearTimeout(a(this,Gn)),w(this,Gn,setTimeout(()=>{w(this,Gn,null),this.canvas.removeEventListener("contextmenu",Ve)},10)),A(this,Mf,zw).call(this,e.offsetX,e.offsetY),this.addToAnnotationStorage(),this.setInBackground()},Pa=new WeakSet,ju=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")},Ra=new WeakSet,Uu=function(){w(this,Dr,new ResizeObserver(e=>{const n=e[0].contentRect;n.width&&n.height&&this.setDimensions(n.width,n.height)})),a(this,Dr).observe(this.div)},ms=new WeakSet,po=function(){if(!a(this,Mr))return;const[e,n]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*n),A(this,La,Hu).call(this)},Lh=new WeakSet,Cm=function(e,n){const i=A(this,ka,zu).call(this),r=(e-i)/a(this,kr),o=(n-i)/a(this,Lr);this.scaleFactor=Math.min(r,o)},La=new WeakSet,Hu=function(){const e=A(this,ka,zu).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)},Bf=new WeakSet,qw=function(e){const n=new Path2D;for(let i=0,r=e.length;i<r;i++){const[o,l,c,u]=e[i];i===0&&n.moveTo(...o),n.bezierCurveTo(l[0],l[1],c[0],c[1],u[0],u[1])}return n},kh=new WeakSet,Tm=function(e,n,i){const[r,o,l,c]=n;switch(i){case 0:for(let u=0,h=e.length;u<h;u+=2)e[u]+=r,e[u+1]=c-e[u+1];break;case 90:for(let u=0,h=e.length;u<h;u+=2){const f=e[u];e[u]=e[u+1]+r,e[u+1]=f+o}break;case 180:for(let u=0,h=e.length;u<h;u+=2)e[u]=l-e[u],e[u+1]+=o;break;case 270:for(let u=0,h=e.length;u<h;u+=2){const f=e[u];e[u]=l-e[u+1],e[u+1]=c-f}break;default:throw new Error("Invalid rotation")}return e},$f=new WeakSet,Xw=function(e,n,i){const[r,o,l,c]=n;switch(i){case 0:for(let u=0,h=e.length;u<h;u+=2)e[u]-=r,e[u+1]=c-e[u+1];break;case 90:for(let u=0,h=e.length;u<h;u+=2){const f=e[u];e[u]=e[u+1]-o,e[u+1]=f-r}break;case 180:for(let u=0,h=e.length;u<h;u+=2)e[u]=l-e[u],e[u+1]-=o;break;case 270:for(let u=0,h=e.length;u<h;u+=2){const f=e[u];e[u]=c-e[u+1],e[u+1]=l-f}break;default:throw new Error("Invalid rotation")}return e},jf=new WeakSet,Yw=function(e,n,i,r){var h,f;const o=[],l=this.thickness/2,c=e*n+l,u=e*i+l;for(const g of this.paths){const v=[],y=[];for(let E=0,S=g.length;E<S;E++){const[_,P,L,k]=g[E];if(_[0]===k[0]&&_[1]===k[1]&&S===1){const z=e*_[0]+c,G=e*_[1]+u;v.push(z,G),y.push(z,G);break}const F=e*_[0]+c,I=e*_[1]+u,M=e*P[0]+c,C=e*P[1]+u,T=e*L[0]+c,N=e*L[1]+u,D=e*k[0]+c,H=e*k[1]+u;E===0&&(v.push(F,I),y.push(F,I)),v.push(M,C,T,N,D,H),y.push(M,C),E===S-1&&y.push(D,H)}o.push({bezier:A(h=Ht,kh,Tm).call(h,v,r,this.rotation),points:A(f=Ht,kh,Tm).call(f,y,r,this.rotation)})}return o},Ih=new WeakSet,Pm=function(){let e=1/0,n=-1/0,i=1/0,r=-1/0;for(const o of this.paths)for(const[l,c,u,h]of o){const f=tt.bezierBoundingBox(...l,...c,...u,...h);e=Math.min(e,f[0]),i=Math.min(i,f[1]),n=Math.max(n,f[2]),r=Math.max(r,f[3])}return[e,i,n,r]},ka=new WeakSet,zu=function(){return a(this,cn)?Math.ceil(this.thickness*this.parentScale):0},Br=new WeakSet,ul=function(e=!1){if(this.isEmpty())return;if(!a(this,cn)){A(this,ki,ks).call(this);return}const n=A(this,Ih,Pm).call(this),i=A(this,ka,zu).call(this);w(this,kr,Math.max(Ft.MIN_SIZE,n[2]-n[0])),w(this,Lr,Math.max(Ft.MIN_SIZE,n[3]-n[1]));const r=Math.ceil(i+a(this,kr)*this.scaleFactor),o=Math.ceil(i+a(this,Lr)*this.scaleFactor),[l,c]=this.parentDimensions;this.width=r/l,this.height=o/c,this.setAspectRatio(r,o);const u=this.translationX,h=this.translationY;this.translationX=-n[0],this.translationY=-n[1],A(this,ms,po).call(this),A(this,ki,ks).call(this),w(this,Or,r),w(this,Nr,o),this.setDims(r,o);const f=e?i/this.scaleFactor/2:0;this.translate(u-this.translationX-f,h-this.translationY-f)},m(Ht,Bf),m(Ht,kh),m(Ht,$f),dt(Ht,"_defaultColor",null),dt(Ht,"_defaultOpacity",1),dt(Ht,"_defaultThickness",1),dt(Ht,"_type","ink"),dt(Ht,"_editorType",xt.INK);let Em=Ht;var Ae,Ee,vs,Ii,ys,Ia,Wn,$r,qn,xn,Fh,jr,dl,Ur,fl,Fa,Vu,Mh,Lm,Uf,Kw,Hf,Zw,Dh,km,Ma,Gu,zf,Jw;const vl=class vl extends Ft{constructor(e){super({...e,name:"stampEditor"});m(this,jr);m(this,Ur);m(this,Fa);m(this,Mh);m(this,Uf);m(this,Hf);m(this,Dh);m(this,Ma);m(this,zf);m(this,Ae,null);m(this,Ee,null);m(this,vs,null);m(this,Ii,null);m(this,ys,null);m(this,Ia,"");m(this,Wn,null);m(this,$r,null);m(this,qn,null);m(this,xn,!1);m(this,Fh,!1);w(this,Ii,e.bitmapUrl),w(this,ys,e.bitmapFile)}static initialize(e,n){Ft.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(xt.STAMP,{bitmapFile:e.getAsFile()})}remove(){var e,n;a(this,Ee)&&(w(this,Ae,null),this._uiManager.imageManager.deleteId(a(this,Ee)),(e=a(this,Wn))==null||e.remove(),w(this,Wn,null),(n=a(this,$r))==null||n.disconnect(),w(this,$r,null),a(this,qn)&&(clearTimeout(a(this,qn)),w(this,qn,null))),super.remove()}rebuild(){if(!this.parent){a(this,Ee)&&A(this,Fa,Vu).call(this);return}super.rebuild(),this.div!==null&&(a(this,Ee)&&a(this,Wn)===null&&A(this,Fa,Vu).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(a(this,vs)||a(this,Ae)||a(this,Ii)||a(this,ys)||a(this,Ee))}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(),a(this,Ae)?A(this,Mh,Lm).call(this):A(this,Fa,Vu).call(this),this.width){const[i,r]=this.parentDimensions;this.setAt(e*i,n*r,this.width*i,this.height*r)}return this.div}getImageForAltText(){return a(this,Wn)}static deserialize(e,n,i){if(e instanceof gw)return null;const r=super.deserialize(e,n,i),{rect:o,bitmapUrl:l,bitmapId:c,isSvg:u,accessibilityData:h}=e;c&&i.imageManager.isValidId(c)?w(r,Ee,c):w(r,Ii,l),w(r,xn,u);const[f,g]=r.pageDimensions;return r.width=(o[2]-o[0])/f,r.height=(o[3]-o[1])/g,h&&(r.altTextData=h),r}serialize(e=!1,n=null){if(this.isEmpty())return null;const i={annotationType:xt.STAMP,bitmapId:a(this,Ee),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:a(this,xn),structTreeParentId:this._structTreeParentId};if(e)return i.bitmapUrl=A(this,Ma,Gu).call(this,!0),i.accessibilityData=this.altTextData,i;const{decorative:r,altText:o}=this.altTextData;if(!r&&o&&(i.accessibilityData={type:"Figure",alt:o}),n===null)return i;n.stamps||(n.stamps=new Map);const l=a(this,xn)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!n.stamps.has(a(this,Ee)))n.stamps.set(a(this,Ee),{area:l,serialized:i}),i.bitmap=A(this,Ma,Gu).call(this,!1);else if(a(this,xn)){const c=n.stamps.get(a(this,Ee));l>c.area&&(c.area=l,c.serialized.bitmap.close(),c.serialized.bitmap=A(this,Ma,Gu).call(this,!1))}return i}};Ae=new WeakMap,Ee=new WeakMap,vs=new WeakMap,Ii=new WeakMap,ys=new WeakMap,Ia=new WeakMap,Wn=new WeakMap,$r=new WeakMap,qn=new WeakMap,xn=new WeakMap,Fh=new WeakMap,jr=new WeakSet,dl=function(e,n=!1){if(!e){this.remove();return}w(this,Ae,e.bitmap),n||(w(this,Ee,e.id),w(this,xn,e.isSvg)),e.file&&w(this,Ia,e.file.name),A(this,Mh,Lm).call(this)},Ur=new WeakSet,fl=function(){w(this,vs,null),this._uiManager.enableWaiting(!1),a(this,Wn)&&this.div.focus()},Fa=new WeakSet,Vu=function(){if(a(this,Ee)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(a(this,Ee)).then(n=>A(this,jr,dl).call(this,n,!0)).finally(()=>A(this,Ur,fl).call(this));return}if(a(this,Ii)){const n=a(this,Ii);w(this,Ii,null),this._uiManager.enableWaiting(!0),w(this,vs,this._uiManager.imageManager.getFromUrl(n).then(i=>A(this,jr,dl).call(this,i)).finally(()=>A(this,Ur,fl).call(this)));return}if(a(this,ys)){const n=a(this,ys);w(this,ys,null),this._uiManager.enableWaiting(!0),w(this,vs,this._uiManager.imageManager.getFromFile(n).then(i=>A(this,jr,dl).call(this,i)).finally(()=>A(this,Ur,fl).call(this)));return}const e=document.createElement("input");e.type="file",e.accept=vl.supportedTypesStr,w(this,vs,new Promise(n=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const i=await this._uiManager.imageManager.getFromFile(e.files[0]);A(this,jr,dl).call(this,i)}n()}),e.addEventListener("cancel",()=>{this.remove(),n()})}).finally(()=>A(this,Ur,fl).call(this))),e.click()},Mh=new WeakSet,Lm=function(){const{div:e}=this;let{width:n,height:i}=a(this,Ae);const[r,o]=this.pageDimensions,l=.75;if(this.width)n=this.width*r,i=this.height*o;else if(n>l*r||i>l*o){const f=Math.min(l*r/n,l*o/i);n*=f,i*=f}const[c,u]=this.parentDimensions;this.setDims(n*c/r,i*u/o),this._uiManager.enableWaiting(!1);const h=w(this,Wn,document.createElement("canvas"));e.append(h),e.hidden=!1,A(this,Dh,km).call(this,n,i),A(this,zf,Jw).call(this),a(this,Fh)||(this.parent.addUndoableEditor(this),w(this,Fh,!0)),this._reportTelemetry({action:"inserted_image"}),a(this,Ia)&&h.setAttribute("aria-label",a(this,Ia))},Uf=new WeakSet,Kw=function(e,n){var l;const[i,r]=this.parentDimensions;this.width=e/i,this.height=n/r,this.setDims(e,n),(l=this._initialOptions)!=null&&l.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,a(this,qn)!==null&&clearTimeout(a(this,qn)),w(this,qn,setTimeout(()=>{w(this,qn,null),A(this,Dh,km).call(this,e,n)},200))},Hf=new WeakSet,Zw=function(e,n){const{width:i,height:r}=a(this,Ae);let o=i,l=r,c=a(this,Ae);for(;o>2*e||l>2*n;){const u=o,h=l;o>2*e&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2)),l>2*n&&(l=l>=16384?Math.floor(l/2)-1:Math.ceil(l/2));const f=new OffscreenCanvas(o,l);f.getContext("2d").drawImage(c,0,0,u,h,0,0,o,l),c=f.transferToImageBitmap()}return c},Dh=new WeakSet,km=function(e,n){e=Math.ceil(e),n=Math.ceil(n);const i=a(this,Wn);if(!i||i.width===e&&i.height===n)return;i.width=e,i.height=n;const r=a(this,xn)?a(this,Ae):A(this,Hf,Zw).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(u=>{const h=(u==null?void 0:u.output)||"";this.parent&&h&&!this.hasAltText()&&(this.altTextData={altText:h,decorative:!1})})}const o=i.getContext("2d");o.filter=this._uiManager.hcmFilter,o.drawImage(r,0,0,r.width,r.height,0,0,e,n)},Ma=new WeakSet,Gu=function(e){if(e){if(a(this,xn)){const r=this._uiManager.imageManager.getSvgUrl(a(this,Ee));if(r)return r}const n=document.createElement("canvas");return{width:n.width,height:n.height}=a(this,Ae),n.getContext("2d").drawImage(a(this,Ae),0,0),n.toDataURL()}if(a(this,xn)){const[n,i]=this.pageDimensions,r=Math.round(this.width*n*Es.PDF_TO_CSS_UNITS),o=Math.round(this.height*i*Es.PDF_TO_CSS_UNITS),l=new OffscreenCanvas(r,o);return l.getContext("2d").drawImage(a(this,Ae),0,0,a(this,Ae).width,a(this,Ae).height,0,0,r,o),l.transferToImageBitmap()}return structuredClone(a(this,Ae))},zf=new WeakSet,Jw=function(){w(this,$r,new ResizeObserver(e=>{const n=e[0].contentRect;n.width&&n.height&&A(this,Uf,Kw).call(this,n.width,n.height)})),a(this,$r).observe(this.div)},dt(vl,"_type","stamp"),dt(vl,"_editorType",xt.STAMP);let Rm=vl;var Hr,Da,Xn,zr,Fi,Mi,Di,Qe,bs,Oa,Na,Me,st,ws,Vf,Qw,Oh,Fm,Nh,Mm,Bh,Dm,Ba,Wu;const dn=class dn{constructor({uiManager:t,pageIndex:e,div:n,accessibilityManager:i,annotationLayer:r,drawLayer:o,textLayer:l,viewport:c,l10n:u}){m(this,Vf);m(this,Oh);m(this,Nh);m(this,Bh);m(this,Ba);m(this,Hr,void 0);m(this,Da,!1);m(this,Xn,null);m(this,zr,null);m(this,Fi,null);m(this,Mi,null);m(this,Di,null);m(this,Qe,new Map);m(this,bs,!1);m(this,Oa,!1);m(this,Na,!1);m(this,Me,null);m(this,st,void 0);const h=[...a(dn,ws).values()];if(!dn._initialized){dn._initialized=!0;for(const f of h)f.initialize(u,t)}t.registerEditorTypes(h),w(this,st,t),this.pageIndex=e,this.div=n,w(this,Hr,i),w(this,Xn,r),this.viewport=c,w(this,Me,l),this.drawLayer=o,a(this,st).addLayer(this)}get isEmpty(){return a(this,Qe).size===0}get isInvisible(){return this.isEmpty&&a(this,st).getMode()===xt.NONE}updateToolbar(t){a(this,st).updateToolbar(t)}updateMode(t=a(this,st).getMode()){switch(A(this,Ba,Wu).call(this),t){case xt.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case xt.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case xt.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 a(dn,ws).values())e.toggle(`${n._type}Editing`,t===n._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===((e=a(this,Me))==null?void 0:e.div)}addInkEditorIfNeeded(t){if(a(this,st).getMode()!==xt.INK)return;if(!t){for(const n of a(this,Qe).values())if(n.isEmpty()){n.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(t){a(this,st).setEditingState(t)}addCommands(t){a(this,st).addCommands(t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){var e;(e=a(this,Xn))==null||e.div.classList.toggle("disabled",!t)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const n of a(this,Qe).values())n.enableEditing(),n.show(!0),n.annotationElementId&&(a(this,st).removeChangedExistingAnnotation(n),t.add(n.annotationElementId));if(!a(this,Xn))return;const e=a(this,Xn).getEditableAnnotations();for(const n of e){if(n.hide(),a(this,st).isDeletedAnnotationElement(n.data.id)||t.has(n.data.id))continue;const i=this.deserialize(n);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){var i;w(this,Na,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Map,e=new Map;for(const r of a(this,Qe).values())if(r.disableEditing(),!!r.annotationElementId){if(r.serialize()!==null){t.set(r.annotationElementId,r);continue}else e.set(r.annotationElementId,r);(i=this.getEditableAnnotation(r.annotationElementId))==null||i.show(),r.remove()}if(a(this,Xn)){const r=a(this,Xn).getEditableAnnotations();for(const o of r){const{id:l}=o.data;if(a(this,st).isDeletedAnnotationElement(l))continue;let c=e.get(l);if(c){c.resetAnnotationElement(o),c.show(!1),o.show();continue}c=t.get(l),c&&(a(this,st).addChangedExistingAnnotation(c),c.renderAnnotationElement(o),c.show(!1)),o.show()}}A(this,Ba,Wu).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:n}=this.div;for(const r of a(dn,ws).values())n.remove(`${r._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),w(this,Na,!1)}getEditableAnnotation(t){var e;return((e=a(this,Xn))==null?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){a(this,st).getActive()!==t&&a(this,st).setActiveEditor(t)}enableTextSelection(){var t;this.div.tabIndex=-1,(t=a(this,Me))!=null&&t.div&&!a(this,Mi)&&(w(this,Mi,A(this,Vf,Qw).bind(this)),a(this,Me).div.addEventListener("pointerdown",a(this,Mi)),a(this,Me).div.classList.add("highlighting"))}disableTextSelection(){var t;this.div.tabIndex=0,(t=a(this,Me))!=null&&t.div&&a(this,Mi)&&(a(this,Me).div.removeEventListener("pointerdown",a(this,Mi)),w(this,Mi,null),a(this,Me).div.classList.remove("highlighting"))}enableClick(){a(this,Fi)||(w(this,Fi,this.pointerdown.bind(this)),w(this,zr,this.pointerup.bind(this)),this.div.addEventListener("pointerdown",a(this,Fi)),this.div.addEventListener("pointerup",a(this,zr)))}disableClick(){a(this,Fi)&&(this.div.removeEventListener("pointerdown",a(this,Fi)),this.div.removeEventListener("pointerup",a(this,zr)),w(this,Fi,null),w(this,zr,null))}attach(t){a(this,Qe).set(t.id,t);const{annotationElementId:e}=t;e&&a(this,st).isDeletedAnnotationElement(e)&&a(this,st).removeDeletedAnnotationElement(t)}detach(t){var e;a(this,Qe).delete(t.id),(e=a(this,Hr))==null||e.removePointerInTextLayer(t.contentDiv),!a(this,Na)&&t.annotationElementId&&a(this,st).addDeletedAnnotationElement(t)}remove(t){this.detach(t),a(this,st).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,a(this,Oa)||this.addInkEditorIfNeeded(!1)}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(a(this,st).addDeletedAnnotationElement(t.annotationElementId),Ft.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),a(this,st).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),a(this,st).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var n;if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!a(this,Di)&&(t._focusEventsAllowed=!1,w(this,Di,setTimeout(()=>{w(this,Di,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0}),e.focus())},0))),t._structTreeParentId=(n=a(this,Hr))==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 a(this,st).getId()}canCreateNewEmptyEditor(){var t;return(t=a(this,Oh,Fm))==null?void 0:t.canCreateNewEmptyEditor()}pasteEditor(t,e){a(this,st).updateToolbar(t),a(this,st).updateMode(t);const{offsetX:n,offsetY:i}=A(this,Bh,Dm).call(this),r=this.getNextId(),o=A(this,Nh,Mm).call(this,{parent:this,id:r,x:n,y:i,uiManager:a(this,st),isCentered:!0,...e});o&&this.add(o)}deserialize(t){var e;return((e=a(dn,ws).get(t.annotationType??t.annotationEditorType))==null?void 0:e.deserialize(t,this,a(this,st)))||null}createAndAddNewEditor(t,e,n={}){const i=this.getNextId(),r=A(this,Nh,Mm).call(this,{parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:a(this,st),isCentered:e,...n});return r&&this.add(r),r}addNewEditor(){this.createAndAddNewEditor(A(this,Bh,Dm).call(this),!0)}setSelected(t){a(this,st).setSelected(t)}toggleSelected(t){a(this,st).toggleSelected(t)}isSelected(t){return a(this,st).isSelected(t)}unselect(t){a(this,st).unselect(t)}pointerup(t){const{isMac:e}=ze.platform;if(!(t.button!==0||t.ctrlKey&&e)&&t.target===this.div&&a(this,bs)){if(w(this,bs,!1),!a(this,Da)){w(this,Da,!0);return}if(a(this,st).getMode()===xt.STAMP){a(this,st).unselectAll();return}this.createAndAddNewEditor(t,!1)}}pointerdown(t){if(a(this,st).getMode()===xt.HIGHLIGHT&&this.enableTextSelection(),a(this,bs)){w(this,bs,!1);return}const{isMac:e}=ze.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;w(this,bs,!0);const n=a(this,st).getActive();w(this,Da,!n||n.isEmpty())}findNewParent(t,e,n){const i=a(this,st).findParent(e,n);return i===null||i===this?!1:(i.changeParent(t),!0)}destroy(){var t,e;((t=a(this,st).getActive())==null?void 0:t.parent)===this&&(a(this,st).commitOrRemove(),a(this,st).setActiveEditor(null)),a(this,Di)&&(clearTimeout(a(this,Di)),w(this,Di,null));for(const n of a(this,Qe).values())(e=a(this,Hr))==null||e.removePointerInTextLayer(n.contentDiv),n.setParent(null),n.isAttachedToDOM=!1,n.div.remove();this.div=null,a(this,Qe).clear(),a(this,st).removeLayer(this)}render({viewport:t}){this.viewport=t,Yr(this.div,t);for(const e of a(this,st).getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){a(this,st).commitOrRemove(),A(this,Ba,Wu).call(this);const e=this.viewport.rotation,n=t.rotation;if(this.viewport=t,Yr(this.div,{rotation:n}),e!==n)for(const i of a(this,Qe).values())i.rotate(n);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return a(this,st).viewParameters.realScale}};Hr=new WeakMap,Da=new WeakMap,Xn=new WeakMap,zr=new WeakMap,Fi=new WeakMap,Mi=new WeakMap,Di=new WeakMap,Qe=new WeakMap,bs=new WeakMap,Oa=new WeakMap,Na=new WeakMap,Me=new WeakMap,st=new WeakMap,ws=new WeakMap,Vf=new WeakSet,Qw=function(t){if(a(this,st).unselectAll(),t.target===a(this,Me).div){const{isMac:e}=ze.platform;if(t.button!==0||t.ctrlKey&&e)return;a(this,st).showAllEditors("highlight",!0,!0),a(this,Me).div.classList.add("free"),ld.startHighlighting(this,a(this,st).direction==="ltr",t),a(this,Me).div.addEventListener("pointerup",()=>{a(this,Me).div.classList.remove("free")},{once:!0}),t.preventDefault()}},Oh=new WeakSet,Fm=function(){return a(dn,ws).get(a(this,st).getMode())},Nh=new WeakSet,Mm=function(t){const e=a(this,Oh,Fm);return e?new e.prototype.constructor(t):null},Bh=new WeakSet,Dm=function(){const{x:t,y:e,width:n,height:i}=this.div.getBoundingClientRect(),r=Math.max(0,t),o=Math.max(0,e),l=Math.min(window.innerWidth,t+n),c=Math.min(window.innerHeight,e+i),u=(r+l)/2-t,h=(o+c)/2-e,[f,g]=this.viewport.rotation%180===0?[u,h]:[h,u];return{offsetX:f,offsetY:g}},Ba=new WeakSet,Wu=function(){w(this,Oa,!0);for(const t of a(this,Qe).values())t.isEmpty()&&t.remove();w(this,Oa,!1)},dt(dn,"_initialized",!1),m(dn,ws,new Map([um,Em,Rm,ld].map(t=>[t._editorType,t])));let Im=dn;var Yn,$h,oe,As,jh,Nm,Uh,Bm,Gf,t1;const ge=class ge{constructor({pageIndex:t}){m(this,Uh);m(this,Gf);m(this,Yn,null);m(this,$h,0);m(this,oe,new Map);m(this,As,new Map);this.pageIndex=t}setParent(t){if(!a(this,Yn)){w(this,Yn,t);return}if(a(this,Yn)!==t){if(a(this,oe).size>0)for(const e of a(this,oe).values())e.remove(),t.append(e);w(this,Yn,t)}}static get _svgFactory(){return Tt(this,"_svgFactory",new h0)}highlight(t,e,n,i=!1){const r=Ge(this,$h)._++,o=A(this,Uh,Bm).call(this,t.box);o.classList.add("highlight"),t.free&&o.classList.add("free");const l=ge._svgFactory.createElement("defs");o.append(l);const c=ge._svgFactory.createElement("path");l.append(c);const u=`path_p${this.pageIndex}_${r}`;c.setAttribute("id",u),c.setAttribute("d",t.toSVGPath()),i&&a(this,As).set(r,c);const h=A(this,Gf,t1).call(this,l,u),f=ge._svgFactory.createElement("use");return o.append(f),o.setAttribute("fill",e),o.setAttribute("fill-opacity",n),f.setAttribute("href",`#${u}`),a(this,oe).set(r,o),{id:r,clipPathId:`url(#${h})`}}highlightOutline(t){const e=Ge(this,$h)._++,n=A(this,Uh,Bm).call(this,t.box);n.classList.add("highlightOutline");const i=ge._svgFactory.createElement("defs");n.append(i);const r=ge._svgFactory.createElement("path");i.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 l;if(t.free){n.classList.add("free");const h=ge._svgFactory.createElement("mask");i.append(h),l=`mask_p${this.pageIndex}_${e}`,h.setAttribute("id",l),h.setAttribute("maskUnits","objectBoundingBox");const f=ge._svgFactory.createElement("rect");h.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");const g=ge._svgFactory.createElement("use");h.append(g),g.setAttribute("href",`#${o}`),g.setAttribute("stroke","none"),g.setAttribute("fill","black"),g.setAttribute("fill-rule","nonzero"),g.classList.add("mask")}const c=ge._svgFactory.createElement("use");n.append(c),c.setAttribute("href",`#${o}`),l&&c.setAttribute("mask",`url(#${l})`);const u=c.cloneNode();return n.append(u),c.classList.add("mainOutline"),u.classList.add("secondaryOutline"),a(this,oe).set(e,n),e}finalizeLine(t,e){const n=a(this,As).get(t);a(this,As).delete(t),this.updateBox(t,e.box),n.setAttribute("d",e.toSVGPath())}updateLine(t,e){a(this,oe).get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}removeFreeHighlight(t){this.remove(t),a(this,As).delete(t)}updatePath(t,e){a(this,As).get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){var n;A(n=ge,jh,Nm).call(n,a(this,oe).get(t),e)}show(t,e){a(this,oe).get(t).classList.toggle("hidden",!e)}rotate(t,e){a(this,oe).get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){a(this,oe).get(t).setAttribute("fill",e)}changeOpacity(t,e){a(this,oe).get(t).setAttribute("fill-opacity",e)}addClass(t,e){a(this,oe).get(t).classList.add(e)}removeClass(t,e){a(this,oe).get(t).classList.remove(e)}remove(t){a(this,Yn)!==null&&(a(this,oe).get(t).remove(),a(this,oe).delete(t))}destroy(){w(this,Yn,null);for(const t of a(this,oe).values())t.remove();a(this,oe).clear()}};Yn=new WeakMap,$h=new WeakMap,oe=new WeakMap,As=new WeakMap,jh=new WeakSet,Nm=function(t,{x:e=0,y:n=0,width:i=1,height:r=1}={}){const{style:o}=t;o.top=`${100*n}%`,o.left=`${100*e}%`,o.width=`${100*i}%`,o.height=`${100*r}%`},Uh=new WeakSet,Bm=function(t){var n;const e=ge._svgFactory.create(1,1,!0);return a(this,Yn).append(e),e.setAttribute("aria-hidden",!0),A(n=ge,jh,Nm).call(n,e,t),e},Gf=new WeakSet,t1=function(t,e){const n=ge._svgFactory.createElement("clipPath");t.append(n);const i=`clip_${e}`;n.setAttribute("id",i),n.setAttribute("clipPathUnits","objectBoundingBox");const r=ge._svgFactory.createElement("use");return n.append(r),r.setAttribute("href",`#${e}`),r.classList.add("clip"),i},m(ge,jh);let Om=ge;var sk=rt.AbortException,rk=rt.AnnotationEditorLayer,ok=rt.AnnotationEditorParamsType,ak=rt.AnnotationEditorType,lk=rt.AnnotationEditorUIManager,e1=rt.AnnotationLayer,n1=rt.AnnotationMode,ck=rt.CMapCompressionType,hk=rt.ColorPicker,uk=rt.DOMSVGFactory,dk=rt.DrawLayer,fk=rt.FeatureTest,y0=rt.GlobalWorkerOptions,pk=rt.ImageKind,gk=rt.InvalidPDFException,mk=rt.MissingPDFException,vk=rt.OPS,yk=rt.Outliner,bk=rt.PDFDataRangeTransport,wk=rt.PDFDateString,Ak=rt.PDFWorker,Ek=rt.PasswordResponses,_k=rt.PermissionFlag,xk=rt.PixelsPerInch,Sk=rt.RenderingCancelledException,i1=rt.TextLayer,Ck=rt.UnexpectedResponseException,Tk=rt.Util,Pk=rt.VerbosityLevel,Rk=rt.XfaLayer,Lk=rt.build,kk=rt.createValidAbsoluteUrl,Ik=rt.fetchData,s1=rt.getDocument,Fk=rt.getFilenameFromUrl,Mk=rt.getPdfFilenameFromUrl,Dk=rt.getXfaPageViewport,Ok=rt.isDataScheme,Nk=rt.isPdfFile,Bk=rt.noContextMenu,$k=rt.normalizeUnicode,jk=rt.renderTextLayer,Uk=rt.setLayerDimensions,Hk=rt.shadow,zk=rt.updateTextLayer,r1=rt.version;const Vk=Object.freeze(Object.defineProperty({__proto__:null,AbortException:sk,AnnotationEditorLayer:rk,AnnotationEditorParamsType:ok,AnnotationEditorType:ak,AnnotationEditorUIManager:lk,AnnotationLayer:e1,AnnotationMode:n1,CMapCompressionType:ck,ColorPicker:hk,DOMSVGFactory:uk,DrawLayer:dk,FeatureTest:fk,GlobalWorkerOptions:y0,ImageKind:pk,InvalidPDFException:gk,MissingPDFException:mk,OPS:vk,Outliner:yk,PDFDataRangeTransport:bk,PDFDateString:wk,PDFWorker:Ak,PasswordResponses:Ek,PermissionFlag:_k,PixelsPerInch:xk,RenderingCancelledException:Sk,TextLayer:i1,UnexpectedResponseException:Ck,Util:Tk,VerbosityLevel:Pk,XfaLayer:Rk,build:Lk,createValidAbsoluteUrl:kk,fetchData:Ik,getDocument:s1,getFilenameFromUrl:Fk,getPdfFilenameFromUrl:Mk,getXfaPageViewport:Dk,isDataScheme:Ok,isPdfFile:Nk,noContextMenu:Bk,normalizeUnicode:$k,renderTextLayer:jk,setLayerDimensions:Uk,shadow:Hk,updateTextLayer:zk,version:r1},Symbol.toStringTag,{value:"Module"}));var he=function(s,t,e){if(e||arguments.length===2)for(var n=0,i=t.length,r;n<i;n++)(r||!(n in t))&&(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return s.concat(r||Array.prototype.slice.call(t))},Gk=["onCopy","onCut","onPaste"],Wk=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],qk=["onFocus","onBlur"],Xk=["onInput","onInvalid","onReset","onSubmit"],Yk=["onLoad","onError"],Kk=["onKeyDown","onKeyPress","onKeyUp"],Zk=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],Jk=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],Qk=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],tI=["onSelect"],eI=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],nI=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],iI=["onScroll"],sI=["onWheel"],rI=["onAnimationStart","onAnimationEnd","onAnimationIteration"],oI=["onTransitionEnd"],aI=["onToggle"],lI=["onChange"],cI=he(he(he(he(he(he(he(he(he(he(he(he(he(he(he(he(he(he([],Gk,!0),Wk,!0),qk,!0),Xk,!0),Yk,!0),Kk,!0),Zk,!0),Jk,!0),Qk,!0),tI,!0),eI,!0),nI,!0),iI,!0),sI,!0),rI,!0),oI,!0),lI,!0),aI,!0);function o1(s,t){var e={};return cI.forEach(function(n){var i=s[n];i&&(t?e[n]=function(r){return i(r,t(n))}:e[n]=i)}),e}function Zh(s){var t=!1,e=new Promise(function(n,i){s.then(function(r){return!t&&n(r)}).catch(function(r){return!t&&i(r)})});return{promise:e,cancel:function(){t=!0}}}function a1(s){var t,e,n="";if(typeof s=="string"||typeof s=="number")n+=s;else if(typeof s=="object")if(Array.isArray(s))for(t=0;t<s.length;t++)s[t]&&(e=a1(s[t]))&&(n&&(n+=" "),n+=e);else for(t in s)s[t]&&(n&&(n+=" "),n+=t);return n}function mp(){for(var s,t,e=0,n="";e<arguments.length;)(s=arguments[e++])&&(t=a1(s))&&(n&&(n+=" "),n+=t);return n}var hI=ct.env.NODE_ENV==="production",tg="Invariant failed";function $t(s,t){if(!s){if(hI)throw new Error(tg);var e=typeof t=="function"?t():t,n=e?"".concat(tg,": ").concat(e):tg;throw new Error(n)}}var uI=ct.env.NODE_ENV!=="production",l1=function(){};if(uI){var dI=function(t,e){var n=arguments.length;e=new Array(n>1?n-1:0);for(var i=1;i<n;i++)e[i-1]=arguments[i];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{}};l1=function(s,t,e){var n=arguments.length;e=new Array(n>2?n-2:0);for(var i=2;i<n;i++)e[i-2]=arguments[i];if(t===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");s||dI.apply(null,[t].concat(e))}}var fI=l1;const Ce=Um(fI);var Pv=Object.prototype.hasOwnProperty;function Rv(s,t,e){for(e of s.keys())if(Ao(e,t))return e}function Ao(s,t){var e,n,i;if(s===t)return!0;if(s&&t&&(e=s.constructor)===t.constructor){if(e===Date)return s.getTime()===t.getTime();if(e===RegExp)return s.toString()===t.toString();if(e===Array){if((n=s.length)===t.length)for(;n--&&Ao(s[n],t[n]););return n===-1}if(e===Set){if(s.size!==t.size)return!1;for(n of s)if(i=n,i&&typeof i=="object"&&(i=Rv(t,i),!i)||!t.has(i))return!1;return!0}if(e===Map){if(s.size!==t.size)return!1;for(n of s)if(i=n[0],i&&typeof i=="object"&&(i=Rv(t,i),!i)||!Ao(n[1],t.get(i)))return!1;return!0}if(e===ArrayBuffer)s=new Uint8Array(s),t=new Uint8Array(t);else if(e===DataView){if((n=s.byteLength)===t.byteLength)for(;n--&&s.getInt8(n)===t.getInt8(n););return n===-1}if(ArrayBuffer.isView(s)){if((n=s.byteLength)===t.byteLength)for(;n--&&s[n]===t[n];);return n===-1}if(!e||typeof s=="object"){n=0;for(e in s)if(Pv.call(s,e)&&++n&&!Pv.call(t,e)||!(e in t)||!Ao(s[e],t[e]))return!1;return Object.keys(t).length===n}}return s!==s&&t!==t}const c1=U.createContext(null);function Eo({children:s,type:t}){return O.jsx("div",{className:`react-pdf__message react-pdf__message--${t}`,children:s})}const pI="noopener noreferrer nofollow";class gI{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 $t(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(t){$t(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}goToDestination(t){return new Promise(e=>{$t(this.pdfDocument,"PDF document not loaded."),$t(t,"Destination is not specified."),typeof t=="string"?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(e=>{$t(Array.isArray(e),`"${e}" is not a valid destination array.`);const n=e[0];new Promise(i=>{$t(this.pdfDocument,"PDF document not loaded."),n instanceof Object?this.pdfDocument.getPageIndex(n).then(r=>{i(r)}).catch(()=>{$t(!1,`"${n}" is not a valid page reference.`)}):typeof n=="number"?i(n):$t(!1,`"${n}" is not a valid destination reference.`)}).then(i=>{const r=i+1;$t(this.pdfViewer,"PDF viewer is not initialized."),$t(r>=1&&r<=this.pagesCount,`"${r}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:e,pageIndex:i,pageNumber:r})})})}navigateTo(t){this.goToDestination(t)}goToPage(t){const e=t-1;$t(this.pdfViewer,"PDF viewer is not initialized."),$t(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||pI,t.target=n?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const Lv={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},vp=typeof document<"u",h1=vp&&window.location.protocol==="file:";function mI(s){return typeof s<"u"}function Ts(s){return mI(s)&&s!==null}function vI(s){return typeof s=="string"}function yI(s){return s instanceof ArrayBuffer}function bI(s){return $t(vp,"isBlob can only be used in a browser environment"),s instanceof Blob}function $m(s){return vI(s)&&/^data:/.test(s)}function kv(s){$t($m(s),"Invalid data URI.");const[t="",e=""]=s.split(",");return t.split(";").indexOf("base64")!==-1?atob(e):unescape(e)}function wI(){return vp&&window.devicePixelRatio||1}const u1="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function Iv(){Ce(!h1,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${u1}`)}function AI(){Ce(!h1,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${u1}`)}function Jr(s){s&&s.cancel&&s.cancel()}function jm(s,t){return Object.defineProperty(s,"width",{get(){return this.view[2]*t},configurable:!0}),Object.defineProperty(s,"height",{get(){return this.view[3]*t},configurable:!0}),Object.defineProperty(s,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(s,"originalHeight",{get(){return this.view[3]},configurable:!0}),s}function EI(s){return s.name==="RenderingCancelledException"}function _I(s){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=i=>{if(!i.target)return e(new Error("Error while reading a file."));const{error:r}=i.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(s)})}function xI(s,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 s}}function Va(){return U.useReducer(xI,{value:void 0,error:void 0})}var SI=function(s,t,e,n){function i(r){return r instanceof e?r:new e(function(o){o(r)})}return new(e||(e=Promise))(function(r,o){function l(h){try{u(n.next(h))}catch(f){o(f)}}function c(h){try{u(n.throw(h))}catch(f){o(f)}}function u(h){h.done?r(h.value):i(h.value).then(l,c)}u((n=n.apply(s,t||[])).next())})},Fv=function(s,t){var e={};for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&t.indexOf(n)<0&&(e[n]=s[n]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(s);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(s,n[i])&&(e[n[i]]=s[n[i]]);return e};const{PDFDataRangeTransport:CI}=Vk,TI=(s,t)=>{switch(t){case Lv.NEED_PASSWORD:{const e=prompt("Enter the password to open this PDF file.");s(e);break}case Lv.INCORRECT_PASSWORD:{const e=prompt("Invalid password. Please try again.");s(e);break}}};function Mv(s){return typeof s=="object"&&s!==null&&("data"in s||"range"in s||"url"in s)}const PI=U.forwardRef(function(t,e){var{children:n,className:i,error:r="Failed to load PDF file.",externalLinkRel:o,externalLinkTarget:l,file:c,inputRef:u,imageResourcesPath:h,loading:f="Loading PDF…",noData:g="No PDF file specified.",onItemClick:v,onLoadError:y,onLoadProgress:E,onLoadSuccess:S,onPassword:_=TI,onSourceError:P,onSourceSuccess:L,options:k,renderMode:F,rotate:I}=t,M=Fv(t,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[C,T]=Va(),{value:N,error:D}=C,[H,z]=Va(),{value:G,error:K}=H,J=U.useRef(new gI),$=U.useRef([]),W=U.useRef(void 0),q=U.useRef(void 0);c&&c!==W.current&&Mv(c)&&(Ce(!Ao(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),k&&k!==q.current&&(Ce(!Ao(k,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=k);const wt=U.useRef({scrollPageIntoView:Y=>{const{dest:vt,pageNumber:Pt,pageIndex:jt=Pt-1}=Y;if(v){v({dest:vt,pageIndex:jt,pageNumber:Pt});return}const Kt=$.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>.`)}});U.useImperativeHandle(e,()=>({linkService:J,pages:$,viewer:wt}),[]);function ft(){L&&L()}function V(){D&&(Ce(!1,D.toString()),P&&P(D))}function it(){T({type:"RESET"})}U.useEffect(it,[c,T]);const et=U.useCallback(()=>SI(this,void 0,void 0,function*(){if(!c)return null;if(typeof c=="string")return $m(c)?{data:kv(c)}:(Iv(),{url:c});if(c instanceof CI)return{range:c};if(yI(c))return{data:c};if(vp&&bI(c))return{data:yield _I(c)};if($t(typeof c=="object","Invalid parameter in file, need either Uint8Array, string or a parameter object"),$t(Mv(c),"Invalid parameter object: need either .data, .range or .url"),"url"in c&&typeof c.url=="string"){if($m(c.url)){const{url:Y}=c,vt=Fv(c,["url"]),Pt=kv(Y);return Object.assign({data:Pt},vt)}Iv()}return c}),[c]);U.useEffect(()=>{const Y=Zh(et());return Y.promise.then(vt=>{T({type:"RESOLVE",value:vt})}).catch(vt=>{T({type:"REJECT",error:vt})}),()=>{Jr(Y)}},[et,T]),U.useEffect(()=>{if(!(typeof N>"u")){if(N===!1){V();return}ft()}},[N]);function nt(){G&&(S&&S(G),$.current=new Array(G.numPages),J.current.setDocument(G))}function ht(){K&&(Ce(!1,K.toString()),y&&y(K))}function Z(){z({type:"RESET"})}U.useEffect(Z,[z,N]);function mt(){if(!N)return;const Y=Object.assign(Object.assign({},N),k),vt=s1(Y);E&&(vt.onProgress=E),_&&(vt.onPassword=_);const Pt=vt;return Pt.promise.then(jt=>{z({type:"RESOLVE",value:jt})}).catch(jt=>{Pt.destroyed||z({type:"REJECT",error:jt})}),()=>{Pt.destroy()}}U.useEffect(mt,[k,z,N]),U.useEffect(()=>{if(!(typeof G>"u")){if(G===!1){ht();return}nt()}},[G]);function X(){J.current.setViewer(wt.current),J.current.setExternalLinkRel(o),J.current.setExternalLinkTarget(l)}U.useEffect(X,[o,l]);function Q(Y,vt){$.current[Y]=vt}function ut(Y){delete $.current[Y]}const pt=U.useMemo(()=>({imageResourcesPath:h,linkService:J.current,onItemClick:v,pdf:G,registerPage:Q,renderMode:F,rotate:I,unregisterPage:ut}),[h,v,G,F,I]),ot=U.useMemo(()=>o1(M,()=>G),[M,G]);function St(){return O.jsx(c1.Provider,{value:pt,children:n})}function At(){return c?G==null?O.jsx(Eo,{type:"loading",children:typeof f=="function"?f():f}):G===!1?O.jsx(Eo,{type:"error",children:typeof r=="function"?r():r}):St():O.jsx(Eo,{type:"no-data",children:typeof g=="function"?g():g})}return O.jsx("div",Object.assign({className:mp("react-pdf__Document",i),ref:u,style:{"--scale-factor":"1"}},ot,{children:At()}))});function d1(){return U.useContext(c1)}function f1(){for(var s=[],t=0;t<arguments.length;t++)s[t]=arguments[t];var e=s.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 p1=U.createContext(null),g1={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},RI=/^H(\d+)$/;function LI(s){return s in g1}function yp(s){return"children"in s}function m1(s){return yp(s)?s.children.length===1&&0 in s.children&&"id"in s.children[0]:!1}function kI(s){const t={};if(yp(s)){const{role:e}=s,n=e.match(RI);if(n)t.role="heading",t["aria-level"]=Number(n[1]);else if(LI(e)){const i=g1[e];i&&(t.role=i)}}return t}function v1(s){const t={};if(yp(s)){if(s.alt!==void 0&&(t["aria-label"]=s.alt),s.lang!==void 0&&(t.lang=s.lang),m1(s)){const[e]=s.children;if(e){const n=v1(e);return Object.assign(Object.assign({},t),n)}}}else"id"in s&&(t["aria-owns"]=s.id);return t}function II(s){return s?Object.assign(Object.assign({},kI(s)),v1(s)):null}function y1({className:s,node:t}){const e=U.useMemo(()=>II(t),[t]),n=U.useMemo(()=>!yp(t)||m1(t)?null:t.children.map((i,r)=>O.jsx(y1,{node:i},r)),[t]);return O.jsx("span",Object.assign({className:s},e,{children:n}))}function bp(){return U.useContext(p1)}function FI(){const s=bp();$t(s,"Unable to find Page context.");const{onGetStructTreeError:t,onGetStructTreeSuccess:e}=s,[n,i]=Va(),{value:r,error:o}=n,{customTextRenderer:l,page:c}=s;function u(){r&&e&&e(r)}function h(){o&&(Ce(!1,o.toString()),t&&t(o))}function f(){i({type:"RESET"})}U.useEffect(f,[i,c]);function g(){if(l||!c)return;const v=Zh(c.getStructTree()),y=v;return v.promise.then(E=>{i({type:"RESOLVE",value:E})}).catch(E=>{i({type:"REJECT",error:E})}),()=>Jr(y)}return U.useEffect(g,[l,c,i]),U.useEffect(()=>{if(r!==void 0){if(r===!1){h();return}u()}},[r]),r?O.jsx(y1,{className:"react-pdf__Page__structTree structTree",node:r}):null}const Dv=n1;function MI(s){const t=bp();$t(t,"Unable to find Page context.");const e=Object.assign(Object.assign({},t),s),{_className:n,canvasBackground:i,devicePixelRatio:r=wI(),onRenderError:o,onRenderSuccess:l,page:c,renderForms:u,renderTextLayer:h,rotate:f,scale:g}=e,{canvasRef:v}=s;$t(c,"Attempted to render page canvas, but no page was specified.");const y=U.useRef(null);function E(){c&&l&&l(jm(c,g))}function S(F){EI(F)||(Ce(!1,F.toString()),o&&o(F))}const _=U.useMemo(()=>c.getViewport({scale:g*r,rotation:f}),[r,c,f,g]),P=U.useMemo(()=>c.getViewport({scale:g,rotation:f}),[c,f,g]);function L(){if(!c)return;c.cleanup();const{current:F}=y;if(!F)return;F.width=_.width,F.height=_.height,F.style.width=`${Math.floor(P.width)}px`,F.style.height=`${Math.floor(P.height)}px`,F.style.visibility="hidden";const I={annotationMode:u?Dv.ENABLE_FORMS:Dv.ENABLE,canvasContext:F.getContext("2d",{alpha:!1}),viewport:_};i&&(I.background=i);const M=c.render(I),C=M;return M.promise.then(()=>{F.style.visibility="",E()}).catch(S),()=>Jr(C)}U.useEffect(L,[i,y,r,c,u,_,P]);const k=U.useCallback(()=>{const{current:F}=y;F&&(F.width=0,F.height=0)},[y]);return U.useEffect(()=>k,[k]),O.jsx("canvas",{className:`${n}__canvas`,dir:"ltr",ref:f1(v,y),style:{display:"block",userSelect:"none"},children:h?O.jsx(FI,{}):null})}function DI(s){return"str"in s}function OI(){const s=bp();$t(s,"Unable to find Page context.");const{customTextRenderer:t,onGetTextError:e,onGetTextSuccess:n,onRenderTextLayerError:i,onRenderTextLayerSuccess:r,page:o,pageIndex:l,pageNumber:c,rotate:u,scale:h}=s;$t(o,"Attempted to load page text content, but no page was specified.");const[f,g]=Va(),{value:v,error:y}=f,E=U.useRef(null),S=U.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 _(){v&&n&&n(v)}function P(){y&&(Ce(!1,y.toString()),e&&e(y))}function L(){g({type:"RESET"})}U.useEffect(L,[o,g]);function k(){if(!o)return;const D=Zh(o.getTextContent()),H=D;return D.promise.then(z=>{g({type:"RESOLVE",value:z})}).catch(z=>{g({type:"REJECT",error:z})}),()=>Jr(H)}U.useEffect(k,[o,g]),U.useEffect(()=>{if(v!==void 0){if(v===!1){P();return}_()}},[v]);const F=U.useCallback(()=>{r&&r()},[r]),I=U.useCallback(D=>{Ce(!1,D.toString()),i&&i(D)},[i]);function M(){const D=S.current;D&&D.classList.add("active")}function C(){const D=S.current;D&&D.classList.remove("active")}const T=U.useMemo(()=>o.getViewport({scale:h,rotation:u}),[o,u,h]);function N(){if(!o||!v)return;const{current:D}=E;if(!D)return;D.innerHTML="";const H=o.streamTextContent({includeMarkedContent:!0}),z={container:D,textContentSource:H,viewport:T},G=new i1(z),K=G;return G.render().then(()=>{const J=document.createElement("div");J.className="endOfContent",D.append(J),S.current=J;const $=D.querySelectorAll('[role="presentation"]');if(t){let W=0;v.items.forEach((q,wt)=>{if(!DI(q))return;const ft=$[W];if(!ft)return;const V=t(Object.assign({pageIndex:l,pageNumber:c,itemIndex:wt},q));ft.innerHTML=V,W+=q.str&&q.hasEOL?2:1})}F()}).catch(I),()=>Jr(K)}return U.useLayoutEffect(N,[t,I,F,o,l,c,v,T]),O.jsx("div",{className:mp("react-pdf__Page__textContent","textLayer"),onMouseUp:C,onMouseDown:M,ref:E})}function NI(){const s=d1(),t=bp();$t(t,"Unable to find Page context.");const e=Object.assign(Object.assign({},s),t),{imageResourcesPath:n,linkService:i,onGetAnnotationsError:r,onGetAnnotationsSuccess:o,onRenderAnnotationLayerError:l,onRenderAnnotationLayerSuccess:c,page:u,pdf:h,renderForms:f,rotate:g,scale:v=1}=e;$t(h,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),$t(u,"Attempted to load page annotations, but no page was specified."),$t(i,"Attempted to load page annotations, but no linkService was specified.");const[y,E]=Va(),{value:S,error:_}=y,P=U.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 L(){S&&o&&o(S)}function k(){_&&(Ce(!1,_.toString()),r&&r(_))}function F(){E({type:"RESET"})}U.useEffect(F,[E,u]);function I(){if(!u)return;const D=Zh(u.getAnnotations()),H=D;return D.promise.then(z=>{E({type:"RESOLVE",value:z})}).catch(z=>{E({type:"REJECT",error:z})}),()=>{Jr(H)}}U.useEffect(I,[E,u,f]),U.useEffect(()=>{if(S!==void 0){if(S===!1){k();return}L()}},[S]);function M(){c&&c()}function C(D){Ce(!1,`${D}`),l&&l(D)}const T=U.useMemo(()=>u.getViewport({scale:v,rotation:g}),[u,g,v]);function N(){if(!h||!u||!i||!S)return;const{current:D}=P;if(!D)return;const H=T.clone({dontFlip:!0}),z={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:D,l10n:null,page:u,viewport:H},G={annotations:S,annotationStorage:h.annotationStorage,div:D,imageResourcesPath:n,linkService:i,page:u,renderForms:f,viewport:H};D.innerHTML="";try{new e1(z).render(G),M()}catch(K){C(K)}return()=>{}}return U.useEffect(N,[S,n,i,u,f,T]),O.jsx("div",{className:mp("react-pdf__Page__annotations","annotationLayer"),ref:P})}var BI=function(s,t){var e={};for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&t.indexOf(n)<0&&(e[n]=s[n]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(s);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(s,n[i])&&(e[n[i]]=s[n[i]]);return e};const Ov=1;function $I(s){const t=d1(),e=Object.assign(Object.assign({},t),s),{_className:n="react-pdf__Page",_enableRegisterUnregisterPage:i=!0,canvasBackground:r,canvasRef:o,children:l,className:c,customRenderer:u,customTextRenderer:h,devicePixelRatio:f,error:g="Failed to load the page.",height:v,inputRef:y,loading:E="Loading page…",noData:S="No page specified.",onGetAnnotationsError:_,onGetAnnotationsSuccess:P,onGetStructTreeError:L,onGetStructTreeSuccess:k,onGetTextError:F,onGetTextSuccess:I,onLoadError:M,onLoadSuccess:C,onRenderAnnotationLayerError:T,onRenderAnnotationLayerSuccess:N,onRenderError:D,onRenderSuccess:H,onRenderTextLayerError:z,onRenderTextLayerSuccess:G,pageIndex:K,pageNumber:J,pdf:$,registerPage:W,renderAnnotationLayer:q=!0,renderForms:wt=!1,renderMode:ft="canvas",renderTextLayer:V=!0,rotate:it,scale:et=Ov,unregisterPage:nt,width:ht}=e,Z=BI(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"]),[mt,X]=Va(),{value:Q,error:ut}=mt,pt=U.useRef(null);$t($,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const ot=Ts(J)?J-1:K??null,St=J??(Ts(K)?K+1:null),At=it??(Q?Q.rotate:null),Y=U.useMemo(()=>{if(!Q)return null;let b=1;const d=et??Ov;if(ht||v){const p=Q.getViewport({scale:1,rotation:At});ht?b=ht/p.width:v&&(b=v/p.height)}return d*b},[v,Q,At,et,ht]);function vt(){return()=>{Ts(ot)&&i&&nt&&nt(ot)}}U.useEffect(vt,[i,$,ot,nt]);function Pt(){if(C){if(!Q||!Y)return;C(jm(Q,Y))}if(i&&W){if(!Ts(ot)||!pt.current)return;W(ot,pt.current)}}function jt(){ut&&(Ce(!1,ut.toString()),M&&M(ut))}function Kt(){X({type:"RESET"})}U.useEffect(Kt,[X,$,ot]);function Gt(){if(!$||!St)return;const b=Zh($.getPage(St)),d=b;return b.promise.then(p=>{X({type:"RESOLVE",value:p})}).catch(p=>{X({type:"REJECT",error:p})}),()=>Jr(d)}U.useEffect(Gt,[X,$,ot,St,W]),U.useEffect(()=>{if(Q!==void 0){if(Q===!1){jt();return}Pt()}},[Q,Y]);const Lt=U.useMemo(()=>Q&&Ts(ot)&&St&&Ts(At)&&Ts(Y)?{_className:n,canvasBackground:r,customTextRenderer:h,devicePixelRatio:f,onGetAnnotationsError:_,onGetAnnotationsSuccess:P,onGetStructTreeError:L,onGetStructTreeSuccess:k,onGetTextError:F,onGetTextSuccess:I,onRenderAnnotationLayerError:T,onRenderAnnotationLayerSuccess:N,onRenderError:D,onRenderSuccess:H,onRenderTextLayerError:z,onRenderTextLayerSuccess:G,page:Q,pageIndex:ot,pageNumber:St,renderForms:wt,renderTextLayer:V,rotate:At,scale:Y}:null,[n,r,h,f,_,P,L,k,F,I,T,N,D,H,z,G,Q,ot,St,wt,V,At,Y]),kt=U.useMemo(()=>o1(Z,()=>Q&&(Y?jm(Q,Y):void 0)),[Z,Q,Y]),Wt=`${ot}@${Y}/${At}`;function at(){switch(ft){case"custom":return $t(u,'renderMode was set to "custom", but no customRenderer was passed.'),O.jsx(u,{},`${Wt}_custom`);case"none":return null;case"canvas":default:return O.jsx(MI,{canvasRef:o},`${Wt}_canvas`)}}function Re(){return V?O.jsx(OI,{},`${Wt}_text`):null}function Le(){return q?O.jsx(NI,{},`${Wt}_annotations`):null}function ce(){return O.jsxs(p1.Provider,{value:Lt,children:[at(),Re(),Le(),l]})}function nn(){return St?$===null||Q===void 0||Q===null?O.jsx(Eo,{type:"loading",children:typeof E=="function"?E():E}):$===!1||Q===!1?O.jsx(Eo,{type:"error",children:typeof g=="function"?g():g}):ce():O.jsx(Eo,{type:"no-data",children:typeof S=="function"?S():S})}return O.jsx("div",Object.assign({className:mp(n,c),"data-page-number":St,ref:f1(y,pt),style:{"--scale-factor":`${Y}`,backgroundColor:r||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},kt,{children:nn()}))}AI();y0.workerSrc="pdf.worker.mjs";const b1="SET_ZOOM_LEVEL",eg=s=>({type:b1,value:s}),w1="SET_PDF_PAGINATED",jI=s=>({type:w1,value:s}),A1="SET_NUM_PAGES",Nv=s=>({type:A1,value:s}),E1="SET_CURRENT_PAGE",_1="SET_CURRENT_MAIN_STATE",Bv=s=>({type:E1,value:s}),Yi={defaultZoomLevel:1,zoomLevel:1,zoomJump:.1,paginated:!0,numPages:0,currentPage:1},UI=(s=Yi,t)=>{switch(t.type){case b1:{const{value:e}=t;return{...s,zoomLevel:e}}case w1:{const{value:e}=t;return{...s,paginated:e}}case A1:{const{value:e}=t;return{...s,numPages:e}}case E1:{const{value:e}=t;return{...s,currentPage:e}}case _1:{const{value:e}=t;return{...s,mainState:e}}default:return s}},qa=U.createContext({state:Yi,dispatch:()=>null}),HI=({children:s,mainState:t})=>{var i,r,o,l,c,u,h;const[e,n]=U.useReducer(UI,{...Yi,defaultZoomLevel:((r=(i=t.config)==null?void 0:i.pdfZoom)==null?void 0:r.defaultZoom)??Yi.defaultZoomLevel,zoomLevel:((l=(o=t.config)==null?void 0:o.pdfZoom)==null?void 0:l.defaultZoom)??Yi.zoomLevel,zoomJump:((u=(c=t.config)==null?void 0:c.pdfZoom)==null?void 0:u.zoomJump)??Yi.zoomJump,paginated:(h=t.config)!=null&&h.pdfVerticalScrollByDefault?!1:Yi.paginated,mainState:t});return U.useEffect(()=>{n({type:_1,value:t})},[t]),O.jsx(qa.Provider,{value:{state:e,dispatch:n},children:s})},x1=({pageNum:s})=>{const{state:{mainState:t,paginated:e,zoomLevel:n,numPages:i,currentPage:r}}=U.useContext(qa),{t:o}=eo(),l=(t==null?void 0:t.rendererRect)||null,c=s??r;return O.jsxs(zI,{id:"pdf-page-wrapper",$lastPage:c>=i,children:[!e&&O.jsx(VI,{id:"pdf-page-info",children:o("pdfPluginPageNumber",{currentPage:c,allPagesCount:i})}),O.jsx($I,{pageNumber:c||r,scale:n,height:((l==null?void 0:l.height)??100)-100,width:((l==null?void 0:l.width)??100)-100,loading:o("pdfPluginLoading")})]})},zI=bt.div`
  margin: ${s=>s.$lastPage?"20px 0":void 0};
`,VI=bt.div`
  padding: 0 0 10px 10px;
  color: ${s=>s.theme.textTertiary};
  font-size: 14px;
  text-align: left;

  @media (max-width: 768px) {
    font-size: 10px;
  }
`,GI=()=>{const{state:{numPages:s}}=U.useContext(qa),t=[];for(let e=0;e<s;e++)t.push(O.jsx(x1,{pageNum:e+1},e+1));return O.jsx(O.Fragment,{children:t})},WI=()=>{const{state:{mainState:s,paginated:t},dispatch:e}=U.useContext(qa),{t:n}=eo(),i=(s==null?void 0:s.currentDocument)||null;return U.useEffect(()=>{e(Nv(Yi.numPages))},[i]),!i||i.fileData===void 0?null:O.jsx(qI,{file:i.fileData,onLoadSuccess:({numPages:r})=>e(Nv(r)),loading:O.jsx("span",{children:n("pdfPluginLoading")}),children:t?O.jsx(x1,{}):O.jsx(GI,{})})},qI=bt(PI)`
  display: flex;
  flex-direction: column;
  margin: 0 auto;
`,XI=s=>O.jsx(S1,{...s,reverse:!0}),YI=s=>O.jsx(S1,{...s}),S1=s=>{const{color:t,size:e,reverse:n}=s;return O.jsx("svg",{width:e||"100%",height:e||"100%",style:{transform:`${n?"rotate(180deg)":""}`},viewBox:"0 0 12 12",version:"1.1",children:O.jsx("g",{id:"Icons",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:O.jsx("g",{id:"Rounded",transform:"translate(-548.000000, -1000.000000)",children:O.jsx("g",{id:"AV",transform:"translate(100.000000, 852.000000)",children:O.jsx("g",{id:"-Round-/-AV-/-skip_next",transform:"translate(442.000000, 142.000000)",children:O.jsxs("g",{children:[O.jsx("rect",{id:"Rectangle-Copy-52",x:"0",y:"0",width:"24",height:"24"}),O.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"})]})})})})})})},KI=s=>{const{color:t,size:e,reverse:n}=s;return O.jsxs("svg",{width:e||"100%",height:e||"100%",style:{transform:`${n?"rotate(180deg)":""}`},id:"Layer_1",viewBox:"0 0 24 24",children:[O.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"}),O.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"})]})},ZI=s=>O.jsx(C1,{...s}),JI=s=>O.jsx(C1,{...s,reverse:!0}),C1=s=>{const{color:t,size:e,reverse:n}=s;return O.jsx("svg",{width:e||"100%",height:e||"100%",viewBox:"0 0 32 32",version:"1.1",children:O.jsx("g",{id:"Page-1",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:O.jsx("g",{id:"search-plus-icon",fill:t||"#aaa",children:O.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"})})})})},QI=s=>{const{color:t,size:e}=s;return O.jsx("svg",{width:e||"100%",height:e||"100%",viewBox:"0 0 24 24",children:O.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"})})},t2=s=>{const{color:t,size:e,reverse:n}=s;return O.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:O.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\r
  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\r
  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\r
  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\r
  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`})})},e2=()=>{const{state:{currentPage:s,numPages:t},dispatch:e}=U.useContext(qa),{t:n}=eo();return O.jsxs(n2,{id:"pdf-pagination",children:[O.jsx(T1,{id:"pdf-pagination-prev",onClick:()=>e(Bv(s-1)),disabled:s===1,children:O.jsx(XI,{color:"#000",size:"50%"})}),O.jsx(s2,{id:"pdf-pagination-info",children:n("pdfPluginPageNumber",{currentPage:s,allPagesCount:t})}),O.jsx(i2,{id:"pdf-pagination-next",onClick:()=>e(Bv(s+1)),disabled:s>=t,children:O.jsx(YI,{color:"#000",size:"50%"})})]})},n2=bt.div`
  display: flex;
  align-items: center;
`,T1=bt(tp)`
  width: 30px;
  height: 30px;
  margin: 0 5px;

  @media (max-width: 768px) {
    width: 25px;
    height: 25px;
  }
`,i2=bt(T1)`
  margin: 0 20px 0 5px;
`,s2=bt.div`
  color: ${s=>s.theme.textPrimary};
  font-size: 14px;
  text-align: left;

  @media (max-width: 768px) {
    font-size: 10px;
  }
`,r2=()=>{const{t:s}=eo(),{state:{mainState:t,paginated:e,zoomLevel:n,numPages:i,zoomJump:r,defaultZoomLevel:o},dispatch:l}=U.useContext(qa),c=(t==null?void 0:t.currentDocument)||null;return O.jsxs(o2,{id:"pdf-controls",children:[e&&i>1&&O.jsx(e2,{}),(c==null?void 0:c.fileData)&&O.jsx(a2,{id:"pdf-download",href:c==null?void 0:c.fileData,download:(c==null?void 0:c.fileName)||(c==null?void 0:c.uri),title:s("downloadButtonLabel"),children:O.jsx(KI,{color:"#000",size:"75%"})}),O.jsx(pu,{id:"pdf-zoom-out",onMouseDown:()=>l(eg(n-r)),children:O.jsx(JI,{color:"#000",size:"80%"})}),O.jsx(pu,{id:"pdf-zoom-in",onMouseDown:()=>l(eg(n+r)),children:O.jsx(ZI,{color:"#000",size:"80%"})}),O.jsx(pu,{id:"pdf-zoom-reset",onMouseDown:()=>l(eg(o)),disabled:n===o,children:O.jsx(QI,{color:"#000",size:"70%"})}),i>1&&O.jsx(pu,{id:"pdf-toggle-pagination",onMouseDown:()=>l(jI(!e)),children:O.jsx(t2,{color:"#000",size:"70%",reverse:e})})]})},o2=bt.div`
  display: flex;
  position: sticky;
  top: 0;
  left: 0;
  z-index: 1;
  justify-content: flex-end;
  padding: 8px;
  background-color: ${s=>s.theme.tertiary};
  box-shadow: 0px 2px 3px #00000033;

  @media (max-width: 768px) {
    padding: 6px;
  }
`,pu=bt(tp)`
  width: 30px;
  height: 30px;
  @media (max-width: 768px) {
    width: 25px;
    height: 25px;
  }
`,a2=bt(eb)`
  width: 30px;
  height: 30px;
  @media (max-width: 768px) {
    width: 25px;
    height: 25px;
  }
`;y0.workerSrc=new URL(`https://unpkg.com/pdfjs-dist@${r1}/build/pdf.worker.min.mjs`).toString();const wp=({mainState:s})=>O.jsx(HI,{mainState:s,children:O.jsxs(l2,{id:"pdf-renderer","data-testid":"pdf-renderer",children:[O.jsx(r2,{}),O.jsx(WI,{})]})});wp.fileTypes=["pdf","application/pdf"];wp.weight=0;const l2=bt.div`
  display: flex;
  flex-direction: column;
  flex: 1;

  /* width */
  &::-webkit-scrollbar {
    ${s=>s.theme.disableThemeScrollbar?"":"width: 10px"};
  }
  /* Track */
  &::-webkit-scrollbar-track {
    /* background: ${s=>s.theme.secondary}; */
  }
  /* Handle */
  &::-webkit-scrollbar-thumb {
    background: ${s=>s.theme.tertiary};
  }
  /* Handle on hover */
  &::-webkit-scrollbar-thumb:hover {
    background: ${s=>s.theme.primary};
  }
`,c2=bt(Ui)`
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  height: 100%;
  background-color: white;
  background-image: linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
    linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
  background-size: 20px 20px;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0px;
`,Ap=s=>O.jsx(c2,{...s});Ap.fileTypes=["png","image/png"];Ap.weight=0;let Ni,tn,cd=[];const h2=()=>{var s=He(2,0);if(s===18761)tn=!0;else if(s===19789)tn=!1;else throw TypeError("Invalid byte order value.");return tn},u2=()=>{if(He(2,2)!==42)throw RangeError("You forgot your towel!");return!0},d2=s=>{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 s in t?e=t[s]:e="Tag"+s,e},f2=s=>{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 s in t&&(e=t[s]),e},p2=s=>{var t;return["BYTE","ASCII","SBYTE","UNDEFINED"].indexOf(s)!==-1?t=1:["SHORT","SSHORT"].indexOf(s)!==-1?t=2:["LONG","SLONG","FLOAT"].indexOf(s)!==-1?t=4:["RATIONAL","SRATIONAL","DOUBLE"].indexOf(s)!==-1&&(t=8),t},g2=(s,t,e)=>{e=e||0;var n=Math.floor(e/8),i=t+n,r=e+s,o=32-s;if(r<=0)throw RangeError("No bits requested");if(r<=8)var l=24+e,c=Ni.getUint8(i,tn);else if(r<=16)var l=16+e,c=Ni.getUint16(i,tn);else if(r<=32)var l=e,c=Ni.getUint32(i,tn);else throw RangeError("Too many bits requested");var u={bits:c<<l>>>o,byteOffset:i+Math.floor(r/8),bitOffset:r%8};return u},He=(s,t)=>{if(s<=0)throw RangeError("No bytes requested");if(s<=1)return Ni.getUint8(t,tn);if(s<=2)return Ni.getUint16(t,tn);if(s<=3)return Ni.getUint32(t,tn)>>>8;if(s<=4)return Ni.getUint32(t,tn);throw RangeError("Too many bytes requested")},m2=(s,t,e,n)=>{var i=[],r=p2(t),o=r*e;if(o<=4){if(tn===!1)var l=n>>>(4-r)*8;else var l=n;i.push(l)}else for(var c=0;c<e;c++){var u=r*c;if(r>=8)if(["RATIONAL","SRATIONAL"].indexOf(t)!==-1)i.push(He(4,n+u)),i.push(He(4,n+u+4));else throw TypeError("Can't handle this field type or size");else i.push(He(r,n+u))}return t==="ASCII"&&i.forEach(function(h,f,g){g[f]=String.fromCharCode(h)}),i},Ps=(s,t)=>{var e=Math.pow(2,8-t);return Math.floor(s*e+(e-1))},$v=(s,t,e,n)=>(typeof n>"u"&&(n=1),"rgba("+s+", "+t+", "+e+", "+n+")"),P1=s=>{for(var t=He(2,s),e=[],n=s+2,i=0;i<t;n+=12,i++){var r=He(2,n),o=He(2,n+2),l=He(4,n+4),c=He(4,n+8),u=d2(r),h=f2(o),f=m2(u,h,l,c);e[u]={type:h,values:f}}cd.push(e);var g=He(4,n);return g===0?cd:P1(g)},v2=(s,t)=>{let e=t||document.createElement("canvas");if(s&&(Ni=new DataView(s),tn=h2(),!!u2())){var n=He(4,4);cd=P1(n);var i=cd[0],r=i.ImageWidth.values[0],o=i.ImageLength.values[0];e.width=r,e.height=o;var l=[],c=i.Compression?i.Compression.values[0]:1,u=i.SamplesPerPixel.values[0],h=[],f=0,g=!1;if(i.BitsPerSample.values.forEach(function(Wt,at,Re){h[at]={bitsPerSample:Wt,hasBytesPerSample:!1,bytesPerSample:void 0},Wt%8===0&&(h[at].hasBytesPerSample=!0,h[at].bytesPerSample=Wt/8),f+=Wt},void 0),f%8===0){g=!0;var v=f/8}var y=i.StripOffsets.values,E=y.length;if(i.StripByteCounts)var S=i.StripByteCounts.values;else if(E===1)var S=[Math.ceil(r*o*f/8)];else throw Error("Cannot recover from missing StripByteCounts");for(var _=0;_<E;_++){var P=y[_];l[_]=[];for(var L=S[_],k=0,F=0,I=1,M=!0,C=[],T=0,N=0,D=0;k<L;k+=I)switch(c){case 1:for(var H=0,C=[];H<u;H++)if(h[H].hasBytesPerSample){var z=h[H].bytesPerSample*H;C.push(He(h[H].bytesPerSample,P+k+z))}else{var G=g2(h[H].bitsPerSample,P+k,F);throw C.push(G.bits),k=G.byteOffset-P,F=G.bitOffset,RangeError("Cannot handle sub-byte bits per sample")}if(l[_].push(C),g)I=v;else throw I=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(M){M=!1;var K=1,J=1,$=Ni.getInt8(P+k,tn);$>=0&&$<=127?K=$+1:$>=-127&&$<=-1?J=-$+1:M=!0}else{for(var W=He(1,P+k),H=0;H<J;H++){if(h[N].hasBytesPerSample)D=D<<8*T|W,T++,T===h[N].bytesPerSample&&(C.push(D),D=T=0,N++);else throw RangeError("Cannot handle sub-byte bits per sample");N===u&&(l[_].push(C),C=[],N=0)}K--,K===0&&(M=!0)}I=1;break}}if(e.getContext){var q=e.getContext("2d");if(q.fillStyle=$v(255,255,255,0),i.RowsPerStrip)var wt=i.RowsPerStrip.values[0];else var wt=o;var ft=l.length,V=o%wt,it=V===0?wt:V,et=wt,nt=0,ht=i.PhotometricInterpretation.values[0],Z=[],mt=0;if(i.ExtraSamples&&(Z=i.ExtraSamples.values,mt=Z.length),i.ColorMap)var X=i.ColorMap.values,Q=Math.pow(2,h[0].bitsPerSample);for(var _=0;_<ft;_++){_+1===ft&&(et=it);for(var ut=l[_].length,pt=nt*_,ot=0,St=0;St<ut;ot++)for(var At=0;At<r;At++,St++){var Y=l[_][St],vt=0,Pt=0,jt=0,Kt=1;if(mt>0){for(var Gt=0;Gt<mt;Gt++)if(Z[Gt]===1||Z[Gt]===2){Kt=Y[3+Gt]/256;break}}switch(ht){case 0:if(h[0].hasBytesPerSample)var Lt=Math.pow(16,h[0].bytesPerSample*2);Y.forEach(function(at,Re,Le){Le[Re]=Lt-at});case 1:vt=Pt=jt=Ps(Y[0],h[0].bitsPerSample);break;case 2:vt=Ps(Y[0],h[0].bitsPerSample),Pt=Ps(Y[1],h[1].bitsPerSample),jt=Ps(Y[2],h[2].bitsPerSample);break;case 3:if(X===void 0)throw Error("Palette image missing color map");var kt=Y[0];vt=Ps(X[kt],16),Pt=Ps(X[Q+kt],16),jt=Ps(X[2*Q+kt],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:",ht)}q.fillStyle=$v(vt,Pt,jt,Kt),q.fillRect(At,pt+ot,1,1)}nt=et}}return e}},Jh=s=>{const{mainState:{currentDocument:t}}=s,{t:e}=eo(),[n,i]=U.useState(!1),[r,o]=U.useState(!1);return U.useEffect(()=>{if(!t||n)return;const l=document.getElementById("tiff-img");try{l&&v2(t.fileData,l),i(!0)}catch{o(!0)}},[t,n]),r?O.jsx(Ui,{...s,children:O.jsx("div",{children:e("brokenFile")})}):O.jsx(Ui,{...s,children:O.jsx(y2,{id:"tiff-img"})})};Jh.fileTypes=["tif","tiff","image/tif","image/tiff"];Jh.weight=0;Jh.fileLoader=rb;const y2=bt.canvas`
  max-width: 95%;
  max-height: 95%;
`,Qh=({mainState:{currentDocument:s}})=>O.jsx(b2,{id:"txt-renderer",children:s==null?void 0:s.fileData});Qh.fileTypes=["txt","text/plain"];Qh.weight=0;Qh.fileLoader=o0;const b2=bt.div`
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 30px;
`;var R1={exports:{}};/* @license
Papa Parse
v5.4.1
https://github.com/mholt/PapaParse
License: MIT
*/(function(s,t){(function(e,n){s.exports=n()})(go,function e(){var n=typeof self<"u"?self:typeof window<"u"?window:n!==void 0?n:{},i=!n.document&&!!n.postMessage,r=n.IS_PAPA_WORKER||!1,o={},l=0,c={parse:function(C,T){var N=(T=T||{}).dynamicTyping||!1;if(M(N)&&(T.dynamicTypingFunction=N,N={}),T.dynamicTyping=N,T.transform=!!M(T.transform)&&T.transform,T.worker&&c.WORKERS_SUPPORTED){var D=function(){if(!c.WORKERS_SUPPORTED)return!1;var z=(K=n.URL||n.webkitURL||null,J=e.toString(),c.BLOB_URL||(c.BLOB_URL=K.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; ","(",J,")();"],{type:"text/javascript"})))),G=new n.Worker(z),K,J;return G.onmessage=P,G.id=l++,o[G.id]=G}();return D.userStep=T.step,D.userChunk=T.chunk,D.userComplete=T.complete,D.userError=T.error,T.step=M(T.step),T.chunk=M(T.chunk),T.complete=M(T.complete),T.error=M(T.error),delete T.worker,void D.postMessage({input:C,config:T,workerId:D.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=T.download?new f(T):new v(T)):C.readable===!0&&M(C.read)&&M(C.on)?H=new y(T):(n.File&&C instanceof File||C instanceof Object)&&(H=new g(T)),H.stream(C)},unparse:function(C,T){var N=!1,D=!0,H=",",z=`\r
`,G='"',K=G+G,J=!1,$=null,W=!1;(function(){if(typeof T=="object"){if(typeof T.delimiter!="string"||c.BAD_DELIMITERS.filter(function(V){return T.delimiter.indexOf(V)!==-1}).length||(H=T.delimiter),(typeof T.quotes=="boolean"||typeof T.quotes=="function"||Array.isArray(T.quotes))&&(N=T.quotes),typeof T.skipEmptyLines!="boolean"&&typeof T.skipEmptyLines!="string"||(J=T.skipEmptyLines),typeof T.newline=="string"&&(z=T.newline),typeof T.quoteChar=="string"&&(G=T.quoteChar),typeof T.header=="boolean"&&(D=T.header),Array.isArray(T.columns)){if(T.columns.length===0)throw new Error("Option columns is empty");$=T.columns}T.escapeChar!==void 0&&(K=T.escapeChar+G),(typeof T.escapeFormulae=="boolean"||T.escapeFormulae instanceof RegExp)&&(W=T.escapeFormulae instanceof RegExp?T.escapeFormulae:/^[=+\-@\t\r].*$/)}})();var q=new RegExp(S(G),"g");if(typeof C=="string"&&(C=JSON.parse(C)),Array.isArray(C)){if(!C.length||Array.isArray(C[0]))return wt(null,C,J);if(typeof C[0]=="object")return wt($||Object.keys(C[0]),C,J)}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||$),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||[],J);throw new Error("Unable to serialize unrecognized input");function wt(V,it,et){var nt="";typeof V=="string"&&(V=JSON.parse(V)),typeof it=="string"&&(it=JSON.parse(it));var ht=Array.isArray(V)&&0<V.length,Z=!Array.isArray(it[0]);if(ht&&D){for(var mt=0;mt<V.length;mt++)0<mt&&(nt+=H),nt+=ft(V[mt],mt);0<it.length&&(nt+=z)}for(var X=0;X<it.length;X++){var Q=ht?V.length:it[X].length,ut=!1,pt=ht?Object.keys(it[X]).length===0:it[X].length===0;if(et&&!ht&&(ut=et==="greedy"?it[X].join("").trim()==="":it[X].length===1&&it[X][0].length===0),et==="greedy"&&ht){for(var ot=[],St=0;St<Q;St++){var At=Z?V[St]:St;ot.push(it[X][At])}ut=ot.join("").trim()===""}if(!ut){for(var Y=0;Y<Q;Y++){0<Y&&!pt&&(nt+=H);var vt=ht&&Z?V[Y]:Y;nt+=ft(it[X][vt],Y)}X<it.length-1&&(!et||0<Q&&!pt)&&(nt+=z)}}return nt}function ft(V,it){if(V==null)return"";if(V.constructor===Date)return JSON.stringify(V).slice(1,25);var et=!1;W&&typeof V=="string"&&W.test(V)&&(V="'"+V,et=!0);var nt=V.toString().replace(q,K);return(et=et||N===!0||typeof N=="function"&&N(V,it)||Array.isArray(N)&&N[it]||function(ht,Z){for(var mt=0;mt<Z.length;mt++)if(-1<ht.indexOf(Z[mt]))return!0;return!1}(nt,c.BAD_DELIMITERS)||-1<nt.indexOf(H)||nt.charAt(0)===" "||nt.charAt(nt.length-1)===" ")?G+nt+G:nt}}};if(c.RECORD_SEP="",c.UNIT_SEP="",c.BYTE_ORDER_MARK="\uFEFF",c.BAD_DELIMITERS=["\r",`
`,'"',c.BYTE_ORDER_MARK],c.WORKERS_SUPPORTED=!i&&!!n.Worker,c.NODE_STREAM_INPUT=1,c.LocalChunkSize=10485760,c.RemoteChunkSize=5242880,c.DefaultDelimiter=",",c.Parser=_,c.ParserHandle=E,c.NetworkStreamer=f,c.FileStreamer=g,c.StringStreamer=v,c.ReadableStreamStreamer=y,n.jQuery){var u=n.jQuery;u.fn.parse=function(C){var T=C.config||{},N=[];return this.each(function(z){if(!(u(this).prop("tagName").toUpperCase()==="INPUT"&&u(this).attr("type").toLowerCase()==="file"&&n.FileReader)||!this.files||this.files.length===0)return!0;for(var G=0;G<this.files.length;G++)N.push({file:this.files[G],inputElem:this,instanceConfig:u.extend({},T)})}),D(),this;function D(){if(N.length!==0){var z,G,K,J,$=N[0];if(M(C.before)){var W=C.before($.file,$.inputElem);if(typeof W=="object"){if(W.action==="abort")return z="AbortError",G=$.file,K=$.inputElem,J=W.reason,void(M(C.error)&&C.error({name:z},G,K,J));if(W.action==="skip")return void H();typeof W.config=="object"&&($.instanceConfig=u.extend($.instanceConfig,W.config))}else if(W==="skip")return void H()}var q=$.instanceConfig.complete;$.instanceConfig.complete=function(wt){M(q)&&q(wt,$.file,$.inputElem),H()},c.parse($.file,$.instanceConfig)}else M(C.complete)&&C.complete()}function H(){N.splice(0,1),D()}}}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(T){var N=F(T);N.chunkSize=parseInt(N.chunkSize),T.step||T.chunk||(N.chunkSize=null),this._handle=new E(N),(this._handle.streamer=this)._config=N}).call(this,C),this.parseChunk=function(T,N){if(this.isFirstChunk&&M(this._config.beforeFirstChunk)){var D=this._config.beforeFirstChunk(T);D!==void 0&&(T=D)}this.isFirstChunk=!1,this._halted=!1;var H=this._partialLine+T;this._partialLine="";var z=this._handle.parse(H,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var G=z.meta.cursor;this._finished||(this._partialLine=H.substring(G-this._baseIndex),this._baseIndex=G),z&&z.data&&(this._rowCount+=z.data.length);var K=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(r)n.postMessage({results:z,workerId:c.WORKER_ID,finished:K});else if(M(this._config.chunk)&&!N){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||!K||!M(this._config.complete)||z&&z.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),K||z&&z.meta.paused||this._nextChunk(),z}this._halted=!0},this._sendError=function(T){M(this._config.error)?this._config.error(T):r&&this._config.error&&n.postMessage({workerId:c.WORKER_ID,error:T,finished:!1})}}function f(C){var T;(C=C||{}).chunkSize||(C.chunkSize=c.RemoteChunkSize),h.call(this,C),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(N){this._input=N,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(T=new XMLHttpRequest,this._config.withCredentials&&(T.withCredentials=this._config.withCredentials),i||(T.onload=I(this._chunkLoaded,this),T.onerror=I(this._chunkError,this)),T.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var N=this._config.downloadRequestHeaders;for(var D in N)T.setRequestHeader(D,N[D])}if(this._config.chunkSize){var H=this._start+this._config.chunkSize-1;T.setRequestHeader("Range","bytes="+this._start+"-"+H)}try{T.send(this._config.downloadRequestBody)}catch(z){this._chunkError(z.message)}i&&T.status===0&&this._chunkError()}},this._chunkLoaded=function(){T.readyState===4&&(T.status<200||400<=T.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:T.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(N){var D=N.getResponseHeader("Content-Range");return D===null?-1:parseInt(D.substring(D.lastIndexOf("/")+1))}(T),this.parseChunk(T.responseText)))},this._chunkError=function(N){var D=T.statusText||N;this._sendError(new Error(D))}}function g(C){var T,N;(C=C||{}).chunkSize||(C.chunkSize=c.LocalChunkSize),h.call(this,C);var D=typeof FileReader<"u";this.stream=function(H){this._input=H,N=H.slice||H.webkitSlice||H.mozSlice,D?((T=new FileReader).onload=I(this._chunkLoaded,this),T.onerror=I(this._chunkError,this)):T=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=N.call(H,this._start,z)}var G=T.readAsText(H,this._config.encoding);D||this._chunkLoaded({target:{result:G}})},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(T.error)}}function v(C){var T;h.call(this,C=C||{}),this.stream=function(N){return T=N,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var N,D=this._config.chunkSize;return D?(N=T.substring(0,D),T=T.substring(D)):(N=T,T=""),this._finished=!T,this.parseChunk(N)}}}function y(C){h.call(this,C=C||{});var T=[],N=!0,D=!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(){D&&T.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),T.length?this.parseChunk(T.shift()):N=!0},this._streamData=I(function(H){try{T.push(typeof H=="string"?H:H.toString(this._config.encoding)),N&&(N=!1,this._checkIsFinished(),this.parseChunk(T.shift()))}catch(z){this._streamError(z)}},this),this._streamError=I(function(H){this._streamCleanUp(),this._sendError(H)},this),this._streamEnd=I(function(){this._streamCleanUp(),D=!0,this._streamData("")},this),this._streamCleanUp=I(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function E(C){var T,N,D,H=Math.pow(2,53),z=-H,G=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,K=/^((\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)))$/,J=this,$=0,W=0,q=!1,wt=!1,ft=[],V={data:[],errors:[],meta:{}};if(M(C.step)){var it=C.step;C.step=function(X){if(V=X,ht())nt();else{if(nt(),V.data.length===0)return;$+=X.data.length,C.preview&&$>C.preview?N.abort():(V.data=V.data[0],it(V,J))}}}function et(X){return C.skipEmptyLines==="greedy"?X.join("").trim()==="":X.length===1&&X[0].length===0}function nt(){return V&&D&&(mt("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+c.DefaultDelimiter+"'"),D=!1),C.skipEmptyLines&&(V.data=V.data.filter(function(X){return!et(X)})),ht()&&function(){if(!V)return;function X(ut,pt){M(C.transformHeader)&&(ut=C.transformHeader(ut,pt)),ft.push(ut)}if(Array.isArray(V.data[0])){for(var Q=0;ht()&&Q<V.data.length;Q++)V.data[Q].forEach(X);V.data.splice(0,1)}else V.data.forEach(X)}(),function(){if(!V||!C.header&&!C.dynamicTyping&&!C.transform)return V;function X(ut,pt){var ot,St=C.header?{}:[];for(ot=0;ot<ut.length;ot++){var At=ot,Y=ut[ot];C.header&&(At=ot>=ft.length?"__parsed_extra":ft[ot]),C.transform&&(Y=C.transform(Y,At)),Y=Z(At,Y),At==="__parsed_extra"?(St[At]=St[At]||[],St[At].push(Y)):St[At]=Y}return C.header&&(ot>ft.length?mt("FieldMismatch","TooManyFields","Too many fields: expected "+ft.length+" fields but parsed "+ot,W+pt):ot<ft.length&&mt("FieldMismatch","TooFewFields","Too few fields: expected "+ft.length+" fields but parsed "+ot,W+pt)),St}var Q=1;return!V.data.length||Array.isArray(V.data[0])?(V.data=V.data.map(X),Q=V.data.length):V.data=X(V.data,0),C.header&&V.meta&&(V.meta.fields=ft),W+=Q,V}()}function ht(){return C.header&&ft.length===0}function Z(X,Q){return ut=X,C.dynamicTypingFunction&&C.dynamicTyping[ut]===void 0&&(C.dynamicTyping[ut]=C.dynamicTypingFunction(ut)),(C.dynamicTyping[ut]||C.dynamicTyping)===!0?Q==="true"||Q==="TRUE"||Q!=="false"&&Q!=="FALSE"&&(function(pt){if(G.test(pt)){var ot=parseFloat(pt);if(z<ot&&ot<H)return!0}return!1}(Q)?parseFloat(Q):K.test(Q)?new Date(Q):Q===""?null:Q):Q;var ut}function mt(X,Q,ut,pt){var ot={type:X,code:Q,message:ut};pt!==void 0&&(ot.row=pt),V.errors.push(ot)}this.parse=function(X,Q,ut){var pt=C.quoteChar||'"';if(C.newline||(C.newline=function(At,Y){At=At.substring(0,1048576);var vt=new RegExp(S(Y)+"([^]*?)"+S(Y),"gm"),Pt=(At=At.replace(vt,"")).split("\r"),jt=At.split(`
`),Kt=1<jt.length&&jt[0].length<Pt[0].length;if(Pt.length===1||Kt)return`
`;for(var Gt=0,Lt=0;Lt<Pt.length;Lt++)Pt[Lt][0]===`
`&&Gt++;return Gt>=Pt.length/2?`\r
`:"\r"}(X,pt)),D=!1,C.delimiter)M(C.delimiter)&&(C.delimiter=C.delimiter(X),V.meta.delimiter=C.delimiter);else{var ot=function(At,Y,vt,Pt,jt){var Kt,Gt,Lt,kt;jt=jt||[",","	","|",";",c.RECORD_SEP,c.UNIT_SEP];for(var Wt=0;Wt<jt.length;Wt++){var at=jt[Wt],Re=0,Le=0,ce=0;Lt=void 0;for(var nn=new _({comments:Pt,delimiter:at,newline:Y,preview:10}).parse(At),b=0;b<nn.data.length;b++)if(vt&&et(nn.data[b]))ce++;else{var d=nn.data[b].length;Le+=d,Lt!==void 0?0<d&&(Re+=Math.abs(d-Lt),Lt=d):Lt=d}0<nn.data.length&&(Le/=nn.data.length-ce),(Gt===void 0||Re<=Gt)&&(kt===void 0||kt<Le)&&1.99<Le&&(Gt=Re,Kt=at,kt=Le)}return{successful:!!(C.delimiter=Kt),bestDelimiter:Kt}}(X,C.newline,C.skipEmptyLines,C.comments,C.delimitersToGuess);ot.successful?C.delimiter=ot.bestDelimiter:(D=!0,C.delimiter=c.DefaultDelimiter),V.meta.delimiter=C.delimiter}var St=F(C);return C.preview&&C.header&&St.preview++,T=X,N=new _(St),V=N.parse(T,Q,ut),nt(),q?{meta:{paused:!0}}:V||{meta:{paused:!1}}},this.paused=function(){return q},this.pause=function(){q=!0,N.abort(),T=M(C.chunk)?"":T.substring(N.getCharIndex())},this.resume=function(){J.streamer._halted?(q=!1,J.streamer.parseChunk(T,!0)):setTimeout(J.resume,3)},this.aborted=function(){return wt},this.abort=function(){wt=!0,N.abort(),V.meta.aborted=!0,M(C.complete)&&C.complete(V),T=""}}function S(C){return C.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _(C){var T,N=(C=C||{}).delimiter,D=C.newline,H=C.comments,z=C.step,G=C.preview,K=C.fastMode,J=T=C.quoteChar===void 0||C.quoteChar===null?'"':C.quoteChar;if(C.escapeChar!==void 0&&(J=C.escapeChar),(typeof N!="string"||-1<c.BAD_DELIMITERS.indexOf(N))&&(N=","),H===N)throw new Error("Comment character same as delimiter");H===!0?H="#":(typeof H!="string"||-1<c.BAD_DELIMITERS.indexOf(H))&&(H=!1),D!==`
`&&D!=="\r"&&D!==`\r
`&&(D=`
`);var $=0,W=!1;this.parse=function(q,wt,ft){if(typeof q!="string")throw new Error("Input must be a string");var V=q.length,it=N.length,et=D.length,nt=H.length,ht=M(z),Z=[],mt=[],X=[],Q=$=0;if(!q)return p();if(C.header&&!wt){var ut=q.split(D)[0].split(N),pt=[],ot={},St=!1;for(var At in ut){var Y=ut[At];M(C.transformHeader)&&(Y=C.transformHeader(Y,At));var vt=Y,Pt=ot[Y]||0;for(0<Pt&&(St=!0,vt=Y+"_"+Pt),ot[Y]=Pt+1;pt.includes(vt);)vt=vt+"_"+Pt;pt.push(vt)}if(St){var jt=q.split(D);jt[0]=pt.join(N),q=jt.join(D)}}if(K||K!==!1&&q.indexOf(T)===-1){for(var Kt=q.split(D),Gt=0;Gt<Kt.length;Gt++){if(X=Kt[Gt],$+=X.length,Gt!==Kt.length-1)$+=D.length;else if(ft)return p();if(!H||X.substring(0,nt)!==H){if(ht){if(Z=[],ce(X.split(N)),x(),W)return p()}else ce(X.split(N));if(G&&G<=Gt)return Z=Z.slice(0,G),p(!0)}}return p()}for(var Lt=q.indexOf(N,$),kt=q.indexOf(D,$),Wt=new RegExp(S(J)+S(T),"g"),at=q.indexOf(T,$);;)if(q[$]!==T)if(H&&X.length===0&&q.substring($,$+nt)===H){if(kt===-1)return p();$=kt+et,kt=q.indexOf(D,$),Lt=q.indexOf(N,$)}else if(Lt!==-1&&(Lt<kt||kt===-1))X.push(q.substring($,Lt)),$=Lt+it,Lt=q.indexOf(N,$);else{if(kt===-1)break;if(X.push(q.substring($,kt)),d(kt+et),ht&&(x(),W))return p();if(G&&Z.length>=G)return p(!0)}else for(at=$,$++;;){if((at=q.indexOf(T,at+1))===-1)return ft||mt.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Z.length,index:$}),b();if(at===V-1)return b(q.substring($,at).replace(Wt,T));if(T!==J||q[at+1]!==J){if(T===J||at===0||q[at-1]!==J){Lt!==-1&&Lt<at+1&&(Lt=q.indexOf(N,at+1)),kt!==-1&&kt<at+1&&(kt=q.indexOf(D,at+1));var Re=nn(kt===-1?Lt:Math.min(Lt,kt));if(q.substr(at+1+Re,it)===N){X.push(q.substring($,at).replace(Wt,T)),q[$=at+1+Re+it]!==T&&(at=q.indexOf(T,$)),Lt=q.indexOf(N,$),kt=q.indexOf(D,$);break}var Le=nn(kt);if(q.substring(at+1+Le,at+1+Le+et)===D){if(X.push(q.substring($,at).replace(Wt,T)),d(at+1+Le+et),Lt=q.indexOf(N,$),at=q.indexOf(T,$),ht&&(x(),W))return p();if(G&&Z.length>=G)return p(!0);break}mt.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Z.length,index:$}),at++}}else at++}return b();function ce(R){Z.push(R),Q=$}function nn(R){var B=0;if(R!==-1){var j=q.substring(at+1,R);j&&j.trim()===""&&(B=j.length)}return B}function b(R){return ft||(R===void 0&&(R=q.substring($)),X.push(R),$=V,ce(X),ht&&x()),p()}function d(R){$=R,ce(X),X=[],kt=q.indexOf(D,$)}function p(R){return{data:Z,errors:mt,meta:{delimiter:N,linebreak:D,aborted:W,truncated:!!R,cursor:Q+(wt||0)}}}function x(){z(p()),Z=[],mt=[]}},this.abort=function(){W=!0},this.getCharIndex=function(){return $}}function P(C){var T=C.data,N=o[T.workerId],D=!1;if(T.error)N.userError(T.error,T.file);else if(T.results&&T.results.data){var H={abort:function(){D=!0,L(T.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:k,resume:k};if(M(N.userStep)){for(var z=0;z<T.results.data.length&&(N.userStep({data:T.results.data[z],errors:T.results.errors,meta:T.results.meta},H),!D);z++);delete T.results}else M(N.userChunk)&&(N.userChunk(T.results,H,T.file),delete T.results)}T.finished&&!D&&L(T.workerId,T.results)}function L(C,T){var N=o[C];M(N.userComplete)&&N.userComplete(T),N.terminate(),delete o[C]}function k(){throw new Error("Not implemented.")}function F(C){if(typeof C!="object"||C===null)return C;var T=Array.isArray(C)?[]:{};for(var N in C)T[N]=F(C[N]);return T}function I(C,T){return function(){C.apply(T,arguments)}}function M(C){return typeof C=="function"}return r&&(n.onmessage=function(C){var T=C.data;if(c.WORKER_ID===void 0&&T&&(c.WORKER_ID=T.workerId),typeof T.input=="string")n.postMessage({workerId:c.WORKER_ID,results:c.parse(T.input,T.config),finished:!0});else if(n.File&&T.input instanceof File||T.input instanceof Object){var N=c.parse(T.input,T.config);N&&n.postMessage({workerId:c.WORKER_ID,results:N,finished:!0})}}),(f.prototype=Object.create(h.prototype)).constructor=f,(g.prototype=Object.create(h.prototype)).constructor=g,(v.prototype=Object.create(v.prototype)).constructor=v,(y.prototype=Object.create(h.prototype)).constructor=y,c})})(R1);var w2=R1.exports;const A2=Um(w2),tu=({mainState:{currentDocument:s,config:t}})=>{const[e,n]=U.useState([]);return U.useEffect(()=>{var i;if(s!=null&&s.fileData){const r=A2.parse(s.fileData,{delimiter:(t==null?void 0:t.csvDelimiter)??","});!((i=r.errors)!=null&&i.length)&&r.data&&n(r.data)}},[s,t==null?void 0:t.csvDelimiter]),e.length?O.jsx(E2,{children:O.jsxs(_2,{children:[O.jsx("thead",{children:O.jsx("tr",{children:e[0].map(i=>O.jsx("th",{children:i},i))})}),O.jsx("tbody",{children:e.slice(1,e.length).map(i=>O.jsx("tr",{children:i.map(r=>O.jsx("td",{children:r},r))},i.join("")))})]})}):null};tu.fileTypes=["csv","text/csv"];tu.weight=0;tu.fileLoader=o0;const E2=bt.div`
  width: 100%;
`,_2=bt.table`
  width: 100%;
  text-align: left;

  th,
  td {
    padding: 5px 10px;

    &:empty {
      display: none;
    }
  }
`,Ep=s=>O.jsx(Ui,{...s});Ep.fileTypes=["gif","image/gif"];Ep.weight=0;const _p=({mainState:{currentDocument:s}})=>s?O.jsx(x2,{id:"video-renderer",children:O.jsx(S2,{controls:!0,src:s.uri})}):null;_p.fileTypes=["video/mp4","video/quicktime","video/x-msvideo"];_p.weight=0;const x2=bt.div`
  width: 100%;
`,S2=bt.video`
  width: 100%;
  height: 100%;
  border: 0;
`,xp=s=>O.jsx(Ui,{...s});xp.fileTypes=["webp","image/webp"];xp.weight=0;const L1=[np,Gh,ip,Wh,wp,Ap,Jh,Qh,tu,Ep,_p,xp],C2=U.forwardRef((s,t)=>{const{documents:e,theme:n}=s;if(!e)throw new Error("Please provide an array of documents to DocViewer!");return O.jsx(UT,{ref:t,pluginRenderers:L1,...s,children:O.jsx(xS,{theme:n?{...cv,...n}:cv,children:O.jsxs(P2,{id:"react-doc-viewer","data-testid":"react-doc-viewer",className:s.className,style:s.style,children:[O.jsx(gP,{}),O.jsx(EP,{})]})})})}),T2=U.memo(C2),P2=bt.div`
  display: flex;
  flex-direction: column;
  background: #ffffff;
  width: 100%;
  height: 100%;
`;exports.BMPRenderer=np;exports.Buffer=ed;exports.CSVRenderer=tu;exports.DocViewer=T2;exports.DocViewerRenderers=L1;exports.HTMLRenderer=Gh;exports.JPGRenderer=ip;exports.JPGRenderer$1=Ep;exports.MSDocRenderer=Wh;exports.PDFRenderer=wp;exports.PNGRenderer=Ap;exports.TIFFRenderer=Jh;exports.TXTRenderer=Qh;exports.VideoRenderer=_p;exports.WebPRenderer=xp;exports.arrayBufferFileLoader=rb;exports.binaryStringFileLoader=vP;exports.commonjsGlobal=go;exports.dataURLFileLoader=r0;exports.defaultFileLoader=ob;exports.dist=sR;exports.getAugmentedNamespace=F1;exports.getDefaultExportFromCjs=Um;exports.process$1=ct;exports.supportedLanguages=OT;exports.textFileLoader=o0;