vendor: 2,500 bytes, line 1
1var t,e,i,s,n,a,r,o,l,h,c,d,u,p,g,f,m,v,w,b,y,A,_,x,k,S,M,E,C,T,P,D,R,I,L,F,N,W,B,O,j,U,H,$,z,V,G,q,X,Y,K,Q,J,Z,tt,et,it,st,nt,at,rt,ot,lt,ht,ct,dt,ut,pt,gt,ft,mt,vt,wt,bt,yt,At,_t,xt,kt,St,Mt,Et,Ct,Tt,Pt,Dt,Rt,It,Lt,Ft,Nt,Wt,Bt,Ot,jt,Ut,Ht,$t,zt,Vt,Gt,qt,Xt,Yt,Kt,Qt,Jt,Zt,te,ee,ie,se,ne,ae,re,oe,le,he,ce,de,ue,pe,ge,fe,me,ve,we,be,ye,Ae,_e,xe,ke,Se,Me,Ee,Ce,Te,Pe,De,Re,Ie,Le,Fe,Ne,We,Be,Oe,je,Ue,He,$e,ze,Ve,Ge,qe,Xe,Ye,Ke,Qe,Je,Ze,ti,ei,ii,si,ni,ai,ri,oi,li,hi,ci,di,ui,pi,gi,fi,mi,vi,wi,bi,yi,Ai,_i,xi,ki,Si,Mi,Ei,Ci,Ti,Pi,Di,Ri,Ii,Li,Fi,Ni,Wi,Bi,Oi,ji,Ui,Hi,$i,zi,Vi,Gi,qi,Xi,Yi,Ki,Qi,Ji,Zi,ts,es,is,ss,ns,as,rs,os,ls,hs,cs,ds,us,ps,gs,fs,ms,vs,ws,bs,ys,As,_s,xs,ks,Ss,Ms,Es,Cs,Ts,Ps,Ds,Rs,Is,Ls,Fs,Ns,Ws,Bs,Os,js,Us,Hs,$s,zs,Vs,Gs,qs,Xs,Ys,Ks,Qs,Js,Zs,tn,en,sn,nn,an,rn,on,ln,hn,cn,dn,un,pn,gn,fn,mn,vn,wn,bn,yn,An,_n,xn,kn,Sn,Mn,En,Cn,Tn,Pn,Dn,Rn,In,Ln,Fn,Nn,Wn,Bn,On,jn,Un,Hn,$n,zn,Vn,Gn,qn,Xn,Yn,Kn,Qn,Jn,Zn,ta,ea,ia,sa,na,aa,ra,oa,la,ha,ca,da,ua,pa,ga,fa,ma,va,wa,ba,ya,Aa,_a,xa,ka,Sa,Ma,Ea,Ca,Ta,Pa,Da,Ra,Ia,La,Fa,Na,Wa,Ba,Oa,ja,Ua,Ha,$a,za,Va,Ga,qa,Xa,Ya,Ka,Qa,Ja,Za,tr,er,ir,sr,nr,ar,rr,or,lr,hr,cr,dr,ur,pr,gr,fr,mr,vr,wr,br,yr,Ar,_r,xr,kr,Sr,Mr,Er,Cr,Tr,Pr,Dr,Rr,Ir,Lr,Fr,Nr,Wr,Br,Or,jr,Ur,Hr,$r,zr,Vr,Gr,qr,Xr,Yr,Kr,Qr,Jr,Zr,to,eo,io,so,no,ao,ro,oo,lo,ho,co,uo,po,go,fo,mo,vo,wo,bo,yo,Ao,_o,xo,ko,So,Mo,Eo,Co,To,Po,Do,Ro,Io,Lo,Fo,No,Wo,Bo,Oo,jo,Uo,Ho,$o,zo,Vo,Go,qo,Xo,Yo,Ko,Qo,Jo,Zo,tl,el,il,sl,nl,al,rl,ol,ll,hl,cl,dl,ul,pl,gl,fl,ml,vl,wl,bl,yl,Al,_l,xl,kl,Sl,Ml,El,Cl,Tl,Pl,Dl,Rl,Il,Ll,Fl,Nl,Wl,Bl,Ol,jl,Ul,Hl,$l,zl,Vl,Gl,ql,Xl,Yl,Kl,Ql,Jl,Zl,th,eh,ih,sh,nh,ah,rh,oh,lh,hh,ch,dh,uh,ph,gh,fh,mh,vh,wh,bh,yh,Ah,_h,xh,kh,Sh,Mh,Eh,Ch,Th,Ph,Dh,Rh,Ih,Lh,Fh,Nh,Wh,Bh,Oh,jh,Uh,Hh,$h,zh,Vh,Gh,qh,Xh,Yh,Kh,Qh,Jh,Zh,tc,ec,ic,sc,nc,ac,rc,oc,lc,hc,cc,dc,uc,pc,gc,fc,mc,vc,wc,bc,yc,Ac,_c,xc,kc,Sc,Mc,Ec,Cc,Tc,Pc,Dc,Rc,Ic,Lc,Fc,Nc,Wc,Bc,Oc,jc,Uc,Hc,$c,zc,Vc,Gc,qc,Xc,Yc,Kc,Qc,Jc,Zc,td,ed,id,sd,nd,ad,rd,od,ld,hd,cd,dd,ud,pd,gd,fd,md,vd,wd,bd,yd,Ad,_d,xd,kd,Sd,Md,Ed,Cd,Td,Pd,Dd,Rd,Id,Ld,Fd,Nd,Wd,Bd,Od,jd,Ud=Object.defineProperty,Hd=t=>{throw TypeError(t)},$d=(t,e,i)=>((t,e,i)=>e in t?Ud(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i),zd=(t,e,i)=>e.has(t)||Hd("Cannot "+i),Vd=(t,e,i)=>(zd(t,e,"read from private field"),i?i.call(t):e.get(t)),Gd=(t,e,i)=>e.has(t)?Hd("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),qd=(t,e,i,s)=>(zd(t,e,"write to private field"),s?s.call(t,i):e.set(t,i),i),Xd=(t,e,
1i)=>(zd(t,e,"access private method"),i),Yd=(t,e,i,s)=>({set _(s){qd(t,e,s,i)},get _(){return Vd(t,e,s)}});import{g as Kd,r as Qd,j as Jd}from"./react-vendor.B75MsAI9.js";import{iC as Zd,U as tu,S as eu,Q as iu,M as su,a4 as nu}from"./AuthModalContainer.D3JsQqnf.js";import{c as au}from"./clsx.BeLtu-UY.js";const ru=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),ou=[.001,0,0,.001,0,0],lu=1.35,hu={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},cu="pdfjs_internal_editor_",du={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},uu={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},pu={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},gu={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},fu={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},mu={ERRORS:0,WARNINGS:1,INFOS:5},vu={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},wu={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let bu=mu.WARNINGS;function yu(){return bu}function Au(t){}function _u(t){throw new Error(t)}function xu(t,e){t||_u(e)}function ku(t,e=null,i=null){if(!t)return null;if(i&&"string"==typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);(null==e?void 0:e.length)>=2&&(t=`http://${t}`)}if(i.tryConvertEncoding)try{t=decodeURIComponent(escape(t))}catch(n){}}const s=e?URL.parse(t,e):URL.parse(t);return function(t){switch(null==t?void 0:t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(s)?s:null}function Su(t,e,i=!1){const s=URL.parse(t);return s?(s.hash=e,s.href):i&&ku(t,"http://example.com")?t.split("#",1)[0]+""+(e?`#${e}`:""):""}function Mu(t,e,i,s=!1){return Object.defineProperty(t,e,{value:i,enumerable:!s,configurable:!0,writable:!1}),i}const Eu=function(){function t(t,e){this.message=t,this.name=e}return t.prototype=new Error,t.constructor=t,t}();class Cu extends Eu{constructor(t,e){super(t,"PasswordException"),this.code=e}}class Tu extends Eu{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}
vendor: 4,674 bytes, line 1
1class Pu extends Eu{constructor(t){super(t,"InvalidPDFException")}}class Du extends Eu{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}}class Ru extends Eu{constructor(t){super(t,"FormatError")}}class Iu extends Eu{constructor(t){super(t,"AbortException")}}function Lu(t){"object"==typeof t&&void 0!==(null==t?void 0:t.length)||_u("Invalid argument for bytesToString");const e=t.length,i=8192;if(e<i)return String.fromCharCode.apply(null,t);const s=[];for(let n=0;n<e;n+=i){const a=Math.min(n+i,e),r=t.subarray(n,a);s.push(String.fromCharCode.apply(null,r))}return s.join("")}function Fu(t){"string"!=typeof t&&_u("Invalid argument for stringToBytes");const e=t.length,i=new Uint8Array(e);for(let s=0;s<e;++s)i[s]=255&t.charCodeAt(s);return i}class Nu{static get isLittleEndian(){return Mu(this,"isLittleEndian",function(){const t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return Mu(this,"isEvalSupported",function(){try{return new Function(""),!0}catch(t){return!1}}())}static get isOffscreenCanvasSupported(){return Mu(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get isImageDecoderSupported(){return Mu(this,"isImageDecoderSupported","undefined"!=typeof ImageDecoder)}static get platform(){const{platform:t,userAgent:e}=navigator;return Mu(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCSSRoundSupported(){var t,e;return Mu(this,"isCSSRoundSupported",null==(e=null==(t=globalThis.CSS)?void 0:t.supports)?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const Wu=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));class Bu{static makeHexColor(t,e,i){return`#${Wu[t]}${Wu[e]}${Wu[i]}`}static domMatrixToTransform(t){return[t.a,t.b,t.c,t.d,t.e,t.f]}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e,i=0){const s=t[i],n=t[i+1];t[i]=s*e[0]+n*e[2]+e[4],t[i+1]=s*e[1]+n*e[3]+e[5]}static applyTransformToBezier(t,e,i=0){const s=e[0],n=e[1],a=e[2],r=e[3],o=e[4],l=e[5];for(let h=0;h<6;h+=2){const e=t[i+h],c=t[i+h+1];t[i+h]=e*s+c*a+o,t[i+h+1]=e*n+c*r+l}}static applyInverseTransform(t,e){const i=t[0],s=t[1],n=e[0]*e[3]-e[1]*e[2];t[0]=(i*e[3]-s*e[2]+e[2]*e[5]-e[4]*e[3])/n,t[1]=(-i*e[1]+s*e[0]+e[4]*e[1]-e[5]*e[0])/n}static axialAlignedBoundingBox(t,e,i){const s=e[0],n=e[1],a=e[2],r=e[3],o=e[4],l=e[5],h=t[0],c=t[1],d=t[2],u=t[3];let p=s*h+o,g=p,f=s*d+o,m=f,v=r*c+l,w=v,b=r*u+l,y=b;if(0!==n||0!==a){const t=n*h,e=n*d,i=a*c,s=a*u;p+=i,m+=i,f+=s,g+=s,v+=t,y+=t,b+=e,w+=e}i[0]=Math.min(i[0],p,f,g,m),i[1]=Math.min(i[1],v,b,w,y),i[2]=Math.max(i[2],p,f,g,m),i[3]=Math.max(i[3],v,b,w,y)}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){const i=t[0],s=t[1],n=t[2],a=t[3],r=i**2+s**2,o=i*n+s*a,l=n**2+a**2,h=(r+l)/2,c=Math.sqrt(h**2-(r*l-o**2));e[0]=Math.sqrt(h+c||1),e[1]=Math.sqrt(h-c||1)}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),s=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>s)return null;const n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>a?null:[i,n,s,a]}static pointBoundingBox(t,e,i){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}static rectBoundingBox(t,e,i,s,n){n[0]=Math.min(n[0],t,i),n[1]=Math.min(n[1],e,s),n[2]=Math.max(n[2],t,i),n[3]=Math.max(n[3],e,s)}static bezierBoundingBox(e,s,n,a,r,o,l,h,c){c[0]=Math.min(c[0],e,l),c[1]=Math.min(c[1],s,h),c[2]=Math.max(c[2],e,l),c[3]=Math.max(c[3],s,h),Xd(this,t,i).call(this,e,n,r,l,s,a,o,h,3*(3*(n-r)-e+l),6*(e-2*n+r),3*(n-e),c),Xd(this,t,i).call(this,e,n,r,l,s,a,o,h,3*(3*(a-o)-s+h),6*(s-2*a+o),3*(a-s),c)}}
1t=new WeakSet,e=function(t,e,i,s,n,a,r,o,l,h){if(l<=0||l>=1)return;const c=1-l,d=l*l,u=d*l,p=c*(c*(c*t+3*l*e)+3*d*i)+u*s,g=c*(c*(c*n+3*l*a)+3*d*r)+u*o;h[0]=Math.min(h[0],p),h[1]=Math.min(h[1],g),h[2]=Math.max(h[2],p),h[3]=Math.max(h[3],g)},i=function(i,s,n,a,r,o,l,h,c,d,u,p){if(Math.abs(c)<1e-12)return void(Math.abs(d)>=1e-12&&Xd(this,t,e).call(this,i,s,n,a,r,o,l,h,-u/d,p));const g=d**2-4*u*c;if(g<0)return;const f=Math.sqrt(g),m=2*c;Xd(this,t,e).call(this,i,s,n,a,r,o,l,h,(-d+f)/m,p),Xd(this,t,e).call(this,i,s,n,a,r,o,l,h,(-d-f)/m,p)},Gd(Bu,t);let Ou=null,ju=null;function Uu(t){return Ou||(Ou=/([\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,ju=new Map([["ï¬
","ſt"]])),t.replaceAll(Ou,(t,e,i)=>e?e.normalize("NFKC"):ju.get(i))}function Hu(){if("function"==typeof crypto.randomUUID)return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),Lu(t)}const $u="pdfjs_internal_id_";function zu(t,e,i){return Math.min(Math.max(t,e),i)}function Vu(t){return Uint8Array.prototype.toBase64?t.toBase64():btoa(Lu(t))}"function"!=typeof Promise.try&&(Promise.try=function(t,...e){return new Promise(i=>{i(t(...e))})}),"function"!=typeof Math.sumPrecise&&(Math.sumPrecise=function(t){return t.reduce((t,e)=>t+e,0)});class Gu{static textContent(t){const e=[],i={items:e,styles:Object.create(null)};return function t(i){var s;if(!i)return;let n=null;const a=i.name;if("#text"===a)n=i.value;else{if(!Gu.shouldBuildText(a))return;(null==(s=null==i?void 0:i.attributes)?void 0:s.textContent)?n=i.attributes.textContent:i.value&&(n=i.value)}if(null!==n&&e.push({str:n}),i.children)for(const e of i.children)t(e)}(t),i}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}class qu{static setupStorage(t,e,i,s,n){const a=s.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==a.value&&(t.textContent=a.value),"print"===n)break;t.addEventListener("input",t=>{s.setValue(e,{value:t.target.value})});break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(a.value===i.attributes.xfaOn?t.setAttribute("checked",!0):a.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===n)break;t.addEventListener("change",t=>{s.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(null!==a.value&&t.setAttribute("value",a.value),"print"===n)break;t.addEventListener("input",t=>{s.setValue(e,{value:t.target.value})})}break;case"select":if(null!==a.value){t.setAttribute("value",a.value);for(const t of i.children)t.attributes.value===a.value?t.attributes.selected=!0:t.attributes.hasOwnProperty("selected")&&delete t.attributes.selected}t.addEventListener("input",t=>{const i=t.target.options,n=-1===i.selectedIndex?"":i[i.selectedIndex].value;s.setValue(e,{value:n})})}}static setAttributes({html:t,element:e,storage:i=null,intent:s,linkService:n}){const{attributes:a}=e,r=t instanceof HTMLAnchorElement;"radio"===a.type&&(a.name=`${a.name}-${s}`);for(const[o,l]of Object.entries(a))if(null!=l)switch(o){case"class":l.length&&t.setAttribute(o,l.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",l);break;case"style":Object.assign(t.style,l);break;case"textContent":t.textContent=l;break;default:(!r||"href"!==o&&"newWindow"!==o)&&t.setAttribute(o,l)}r&&n.addLinkAttributes(t,a.href,a.newWindow),i&&a.dataId&&this.setupStorage(t,a.dataId,e,i)}static render(t){var e,i;const s=t.annotationStorage,n=t.linkService,a=t.xfaHtml,r=t.intent||"display",o=document.createElement(a.name);a.attributes&&this.setAttributes({html:o,element:a,intent:r,linkService:n});const l="richText"!==r,h=t.div;if(h.append(o),t.viewport){const e=`matrix(${t.viewport.transform.join(",")})`;h.style.transform=e}l&&h.setAttribute("class","xfaLayer xfaFont");const c=[];if(0===a.children.length){if(a.value){const t=document.createTextNode(a.value);o.append(t),l&&Gu.shouldBuildText(a.name)&&c.push(t)}return{textDivs:c}}const d=[[a,-1,o]];for(;d.length>0;){const[t,a,o]=d.at(-1);if(a+1===t.children.length){d.pop();continue}const h=t.children[++d.at(-1)[1]];if(null===h)continue;const{name:u}=h;if("#text"===u){const t=document.createTextNode(h.value);c.push(t),o.append(t);continue}const p=(null==(e=null==h?void 0:h.attributes)?void 0:e.xmlns)?document.createElementNS(h.attributes.xmlns,u):document.createElement(u);if(o.append(p),h.attributes&&this.setAttributes({html:p,element:h,storage:s,intent:r,linkService:n}),(null==(i=h.children)?void 0:i.length)>0)d.push([h,-1,p]);else if(h.value){const t=document.createTextNode(h.value);l&&Gu.shouldBuildText(u)&&c.push(t),p.append(t)}}for(const u of h.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))u.setAttribute("readOnly",!0);return{textDivs:c}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}const Xu="http://www.w3.org/2000/svg",Yu=class{};$d(Yu,"CSS",96),$d(Yu,"PDF",72),$d(Yu,"PDF_TO_CSS_UNITS",Yu.CSS/Yu.PDF);let Ku=Yu;async function Qu(t,e="text"){if(ap(t,document.baseURI)){const i=await fetch(t);if(!i.ok)throw new Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise((i,s)=>{const n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType=e,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE)if(200!==n.status&&0!==n.status)s(new Error(n.statusText));else{switch(e){case"arraybuffer":case"blob":case"json":return void i(n.response)}i(n.responseText)}},n.send(null)})}class Ju{constructor({viewBox:t,userUnit:e,scale:i,rotation:s,offsetX:n=0,offsetY:a=0,dontFlip:r=!1}){this.viewBox=t,this.userUnit=e,this.scale=i,this.rotation=s,this.offsetX=n,this.offsetY=a,i*=e;const o=(t[2]+t[0])/2,l=(t[3]+t[1])/2;let h,c,d,u,p,g,f,m;switch((s%=360)<0&&(s+=360),s){case 180:h=-1,c=0,d=0,u=1;break;case 90:h=0,c=1,d=1,u=0;break;case 270:h=0,c=-1,d=-1,u=0;break;case 0:h=1,c=0,d=0,u=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(d=-d,u=-u),0===h?(p=Math.abs(l-t[1])*i+n,g=Math.abs(o-t[0])*i+a,f=(t[3]-t[1])*i,m=(t[2]-t[0])*i):(p=Math.abs(o-t[0])*i+n,g=Math.abs(l-t[1])*i+a,f=(t[2]-t[0])*i,m=(t[3]-t[1])*i),this.transform=[h*i,c*i,d*i,u*i,p-h*i*o-d*i*l,g-c*i*o-u*i*l],this.width=f,this.height=m}get rawDims(){const t=this.viewBox;return Mu(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:s=this.offsetY,dontFlip:n=!1}={}){return new Ju({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:n})}convertToViewportPoint(t,e){const i=[t,e];return Bu.applyTransform(i,this.transform),i}convertToViewportRectangle(t){const e=[t[0],t[1]];Bu.applyTransform(e,this.transform);const i=[t[2],t[3]];return Bu.applyTransform(i,this.transform),[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){const i=[t,e];return Bu.applyInverseTransform(i,this.transform),i}}
1class Zu extends Eu{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function tp(t){const e=t.length;let i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function ep(t){return"string"==typeof t&&/\.pdf$/i.test(t)}function ip(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function sp(t,e="document.pdf"){if("string"!=typeof t)return e;if(tp(t))return e;const i=(t=>{try{return new URL(t)}catch(e){try{return new URL(decodeURIComponent(t))}catch(i){try{return new URL(t,"https://foo.bar")}catch(s){try{return new URL(decodeURIComponent(t),"https://foo.bar")}catch(n){return null}}}}})(t);if(!i)return e;const s=t=>{try{let e=decodeURIComponent(t);return e.includes("/")?(e=e.split("/").at(-1),e.test(/^\.pdf$/i)?e:t):e}catch(e){return t}},n=/\.pdf$/i,a=i.pathname.split("/").at(-1);if(n.test(a))return s(a);if(i.searchParams.size>0){const t=Array.from(i.searchParams.values()).reverse();for(const i of t)if(n.test(i))return s(i);const e=Array.from(i.searchParams.keys()).reverse();for(const i of e)if(n.test(i))return s(i)}if(i.hash){const t=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(i.hash);if(t)return s(t[0])}return e}class np{constructor(){$d(this,"started",Object.create(null)),$d(this,"times",[])}time(t){this.started,this.started[t]=Date.now()}timeEnd(t){this.started,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:i}of this.times)e=Math.max(i.length,e);for(const{name:i,start:s,end:n}of this.times)t.push(`${i.padEnd(e)} ${n-s}ms\n`);return t.join("")}}function ap(t,e){const i=e?URL.parse(t,e):URL.parse(t);return"http:"===(null==i?void 0:i.protocol)||"https:"===(null==i?void 0:i.protocol)}function rp(t){t.preventDefault()}function op(t){t.preventDefault(),t.stopPropagation()}class lp{static toDateObject(t){if(t instanceof Date)return t;if(!t||"string"!=typeof t)return null;Vd(this,s)||qd(this,s,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=Vd(this,s).exec(t);if(!e)return null;const i=parseInt(e[1],10);let n=parseInt(e[2],10);n=n>=1&&n<=12?n-1:0;let a=parseInt(e[3],10);a=a>=1&&a<=31?a:1;let r=parseInt(e[4],10);r=r>=0&&r<=23?r:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const h=e[7]||"Z";let c=parseInt(e[8],10);c=c>=0&&c<=23?c:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,"-"===h?(r+=c,o+=d):"+"===h&&(r-=c,o-=d),new Date(Date.UTC(i,n,a,r,o,l))}}function hp(t,{scale:e=1,rotation:i=0}){const{width:s,height:n}=t.attributes.style,a=[0,0,parseInt(s),parseInt(n)];return new Ju({viewBox:a,userUnit:1,scale:e,rotation:i})}function cp(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(16711680&e)>>16,(65280&e)>>8,255&e]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(t=>parseInt(t)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):[0,0,0]}function dp(t){const{a:e,b:i,c:s,d:n,e:a,f:r}=t.getTransform();return[e,i,s,n,a,r]}function up(t){const{a:e,b:i,c:s,d:n,e:a,f:r}=t.getTransform().invertSelf();return[e,i,s,n,a,r]}function pp(t,e,i=!1,s=!0){if(e instanceof Ju){const{pageWidth:s,pageHeight:n}=e.rawDims,{style:a}=t,r=Nu.isCSSRoundSupported,o=`var(--total-scale-factor) * ${s}px`,l=`var(--total-scale-factor) * ${n}px`,h=r?`round(down, ${o}, var(--scale-round-x))`:`calc(${o})`,c=r?`round(down, ${l}, var(--scale-round-y))`:`calc(${l})`;i&&e.rotation%180!=0?(a.width=c,a.height=h):(a.width=h,a.height=c)}s&&t.setAttribute("data-main-rotation",e.rotation)}s=new WeakMap,Gd(lp,s);class gp{constructor(){const{pixelRatio:t}=gp;this.sx=t,this.sy=t}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,i,s,n=-1){let a=1/0,r=1/0,o=1/0;(i=gp.capPixels(i,n))>0&&(a=Math.sqrt(i/(t*e))),-1!==s&&(r=s/t,o=s/e);const l=Math.min(a,r,o);return(this.sx>l||this.sy>l)&&(this.sx=l,this.sy=l,!0)}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>
1=0){const i=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,i):i}return t}}const fp=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class mp{static get isDarkMode(){var t;return Mu(this,"isDarkMode",!!(null==(t=null==window?void 0:window.matchMedia)?void 0:t.call(window,"(prefers-color-scheme: dark)").matches))}}class vp{static get commentForegroundColor(){const t=document.createElement("span");t.classList.add("comment","sidebar");const{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);const{color:i}=window.getComputedStyle(t);return t.remove(),Mu(this,"commentForegroundColor",cp(i))}}function wp(t,e,i,s){const n=255*(1-(s=Math.min(Math.max(null!=s?s:1,0),1)));return[t=Math.round(t*s+n),e=Math.round(e*s+n),i=Math.round(i*s+n)]}function bp(t,e){const i=t[0]/255,s=t[1]/255,n=t[2]/255,a=Math.max(i,s,n),r=Math.min(i,s,n),o=(a+r)/2;if(a===r)e[0]=e[1]=0;else{const t=a-r;switch(e[1]=o<.5?t/(a+r):t/(2-a-r),a){case i:e[0]=60*((s-n)/t+(s<n?6:0));break;case s:e[0]=60*((n-i)/t+2);break;case n:e[0]=60*((i-s)/t+4)}}e[2]=o}function yp(t,e){const i=t[0],s=t[1],n=t[2],a=(1-Math.abs(2*n-1))*s,r=a*(1-Math.abs(i/60%2-1)),o=n-a/2;switch(Math.floor(i/60)){case 0:e[0]=a+o,e[1]=r+o,e[2]=o;break;case 1:e[0]=r+o,e[1]=a+o,e[2]=o;break;case 2:e[0]=o,e[1]=a+o,e[2]=r+o;break;case 3:e[0]=o,e[1]=r+o,e[2]=a+o;break;case 4:e[0]=r+o,e[1]=o,e[2]=a+o;break;case 5:case 6:e[0]=a+o,e[1]=o,e[2]=r+o}}function Ap(t){return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function _p(t,e,i){yp(t,i),i.map(Ap);const s=.2126*i[0]+.7152*i[1]+.0722*i[2];yp(e,i),i.map(Ap);const n=.2126*i[0]+.7152*i[1]+.0722*i[2];return s>n?(s+.05)/(n+.05):(n+.05)/(s+.05)}const xp=new Map;function kp(t,e){const i=t[0]+256*t[1]+65536*t[2]+16777216*e[0]+4294967296*e[1]+1099511627776*e[2];let s=xp.get(i);if(s)return s;const n=new Float32Array(9),a=n.subarray(0,3),r=n.subarray(3,6);bp(t,r);const o=n.subarray(6,9);bp(e,o);const l=o[2]<.5,h=l?12:4.5;if(r[2]=l?Math.sqrt(r[2]):1-Math.sqrt(1-r[2]),_p(r,o,a)<h){let t,e;l?(t=r[2],e=1):(t=0,e=r[2]);const i=.005;for(;e-t>i;){const i=r[2]=(t+e)/2;l===_p(r,o,a)<h?t=i:e=i}r[2]=l?e:t}return yp(r,a),s=Bu.makeHexColor(Math.round(255*a[0]),Math.round(255*a[1]),Math.round(255*a[2])),xp.set(i,s),s}function Sp({html:t,dir:e,className:i},s){const n=document.createDocumentFragment();if("string"==typeof t){const i=document.createElement("p");i.dir=e||"auto";const s=t.split(/(?:\r\n?|\n)/);for(let t=0,e=s.length;t<e;++t){const n=s[t];i.append(document.createTextNode(n)),t<e-1&&i.append(document.createElement("br"))}n.append(i)}else qu.render({xfaHtml:t,div:n,intent:"richText"});n.firstChild.classList.add("richText",i),s.append(n)}const Mp=class t{constructor(e){Gd(this,f),Gd(this,n,null),Gd(this,a,null),Gd(this,r),Gd(this,o,null),Gd(this,l,null),Gd(this,h,null),Gd(this,c,null),Gd(this,d,null),qd(this,r,e),Vd(t,u)||qd(t,u,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){const e=qd(this,n,document.createElement("div"));e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const i=Vd(this,r)._uiManager._signal;i instanceof AbortSignal&&!i.aborted&&(e.addEventListener("contextmenu",rp,{signal:i}),e.addEventListener("pointerdown",Xd(t,p,g),{signal:i}));const s=qd(this,o,document.createElement("div"));s.className="buttons",e.append(s);const a=Vd(this,r).toolbarPosition;if(a){const{style:t}=e,i="ltr"===Vd(this,r)._uiManager.direction?1-a[0]:a[0];t.insetInlineEnd=100*i+"%",t.top=`calc(${100*a[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return Vd(this,n)}hide(){var t;Vd(this,n).classList.add("hidden"),null==(t=Vd(this,a))||t.hideDropdown()}show(){var t,e;Vd(this,n).classList.remove("hidden"),null==(t=Vd(this,l))||t.shown(),null==(e=Vd(this,h))||e.shown()}
1addDeleteButton(){const{editorType:e,_uiManager:i}=Vd(this,r),s=document.createElement("button");s.classList.add("basic","deleteButton"),s.tabIndex=0,s.setAttribute("data-l10n-id",Vd(t,u)[e]),Xd(this,f,w).call(this,s)&&s.addEventListener("click",t=>{i.delete()},{signal:i._signal}),Vd(this,o).append(s)}async addAltText(t){const e=await t.render();Xd(this,f,w).call(this,e),Vd(this,o).append(e,Vd(this,f,b)),qd(this,l,t)}addComment(t,e=null){if(Vd(this,h))return;const i=t.renderForToolbar();if(!i)return;Xd(this,f,w).call(this,i);const s=qd(this,c,Vd(this,f,b));e?(Vd(this,o).insertBefore(i,e),Vd(this,o).insertBefore(s,e)):Vd(this,o).append(i,s),qd(this,h,t),t.toolbar=this}addColorPicker(t){if(Vd(this,a))return;qd(this,a,t);const e=t.renderButton();Xd(this,f,w).call(this,e),Vd(this,o).append(e,Vd(this,f,b))}async addEditSignatureButton(t){const e=qd(this,d,await t.renderEditButton(Vd(this,r)));Xd(this,f,w).call(this,e),Vd(this,o).append(e,Vd(this,f,b))}removeButton(t){var e,i;"comment"===t&&(null==(e=Vd(this,h))||e.removeToolbarCommentButton(),qd(this,h,null),null==(i=Vd(this,c))||i.remove(),qd(this,c,null))}async addButton(t,e){switch(t){case"colorPicker":this.addColorPicker(e);break;case"altText":await this.addAltText(e);break;case"editSignature":await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":this.addComment(e)}}async addButtonBefore(t,e,i){const s=Vd(this,o).querySelector(i);s&&"comment"===t&&this.addComment(e,s)}updateEditSignatureButton(t){Vd(this,d)&&(Vd(this,d).title=t)}remove(){var t;Vd(this,n).remove(),null==(t=Vd(this,a))||t.destroy(),qd(this,a,null)}};n=new WeakMap,a=new WeakMap,r=new WeakMap,o=new WeakMap,l=new WeakMap,h=new WeakMap,c=new WeakMap,d=new WeakMap,u=new WeakMap,p=new WeakSet,g=function(t){t.stopPropagation()},f=new WeakSet,m=function(t){Vd(this,r)._focusEventsAllowed=!1,op(t)},v=function(t){Vd(this,r)._focusEventsAllowed=!0,op(t)},w=function(t){const e=Vd(this,r)._uiManager._signal;return e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("focusin",Xd(this,f,m).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",Xd(this,f,v).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",rp,{signal:e}),!0)},b=function(){const t=document.createElement("div");return t.className="divider",t},Gd(Mp,p),Gd(Mp,u,null);let Ep=Mp;class Cp{constructor(t){Gd(this,x),Gd(this,y,null),Gd(this,A,null),Gd(this,_),qd(this,_,t)}show(t,e,i){const[s,n]=Xd(this,x,S).call(this,e,i),{style:a}=Vd(this,A)||qd(this,A,Xd(this,x,k).call(this));t.append(Vd(this,A)),a.insetInlineEnd=100*s+"%",a.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){Vd(this,A).remove()}}function Tp(t,e,i){for(const s of i)e.addEventListener(s,t[s].bind(t))}y=new WeakMap,A=new WeakMap,_=new WeakMap,x=new WeakSet,k=function(){const t=qd(this,A,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar");const e=Vd(this,_)._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",rp,{signal:e});const i=qd(this,y,document.createElement("div"));return i.className="buttons",t.append(i),Vd(this,_).hasCommentManager()&&Xd(this,x,M).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{Vd(this,_).commentSelection("floating_button")}),Xd(this,x,M).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{Vd(this,_).highlightSelection("floating_button")}),t},S=function(t,e){let i=0,s=0;for(const n of t){const t=n.y+n.height;if(t<i)continue;const a=n.x+(e?n.width:0);t>i?(s=a,i=t):e?a>s&&(s=a):a<s&&(s=a)}return[e?1-s:s,i]},M=function(t,e,i,s){const n=document.createElement("button");n.classList.add("basic",t),n.tabIndex=0,n.setAttribute("data-l10n-id",e);const a=document.createElement("span");n.append(a),a.className="visuallyHidden",a.setAttribute("data-l10n-id",i);const r=Vd(this,_)._signal;r instanceof AbortSignal&&!r.aborted&&(n.addEventListener("contextmenu",rp,{signal:r}),n.addEventListener("click",s,{signal:r})),Vd(this,y).append(n)};class Pp{constructor(){Gd(this,E,0)}get id(){return`${cu}${Yd(this,E)._++}`}}E=new WeakMap;const Dp=class{constructor(){Gd(this,D),Gd(this,C,Hu()),Gd(this,T,0),Gd(this,P,null)}static get _isSVGFittingCanvas(){const t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;return e.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',Mu(this,"_isSVGFittingCanvas",e.decode().then(()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0])))}async getFromFile(t){const{lastModified:e,name:i,size:s,type:n}=t;return Xd(this,D,R).call(this,`${e}_${i}_${s}_${n}`,t)}async getFromUrl(t){return Xd(this,D,R).call(this,t,t)}async getFromBlob(t,e){const i=await e;return Xd(this,D,R).call(this,t,i)}async getFromId(t){Vd(this,P)||qd(this,P,new Map);const e=Vd(this,P).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){const{blobPromise:t}=e;return delete e.blobPromise,this.getFromBlob(e.id,t)}return this.getFromUrl(e.url)}getFromCanvas(t,e){Vd(this,P)||qd(this,P,new Map);let i=Vd(this,P).get(t);if(null==i?void 0:i.bitmap)return i.refCounter+=1,i;const s=new OffscreenCanvas(e.width,e.height);return s.getContext("2d").drawImage(e,0,0),i={bitmap:s.transferToImageBitmap(),id:`image_${Vd(this,C)}_${Yd(this,T)._++}`,refCounter:1,isSvg:!1},Vd(this,P).set(t,i),Vd(this,P).set(i.id,i),i}getSvgUrl(t){const e=Vd(this,P).get(t);return(null==e?void 0:e.isSvg)?e.svgUrl:null}deleteId(t){var e;Vd(this,P)||qd(this,P,new Map);const i=Vd(this,P).get(t);if(!i)return;if(i.refCounter-=1,0!==i.refCounter)return;const{bitmap:s}=i;
1if(!i.url&&!i.file){const t=new OffscreenCanvas(s.width,s.height);t.getContext("bitmaprenderer").transferFromImageBitmap(s),i.blobPromise=t.convertToBlob()}null==(e=s.close)||e.call(s),i.bitmap=null}isValidId(t){return t.startsWith(`image_${Vd(this,C)}_`)}};C=new WeakMap,T=new WeakMap,P=new WeakMap,D=new WeakSet,R=async function(t,e){Vd(this,P)||qd(this,P,new Map);let i=Vd(this,P).get(t);if(null===i)return null;if(null==i?void 0:i.bitmap)return i.refCounter+=1,i;try{let t;if(i||(i={bitmap:null,id:`image_${Vd(this,C)}_${Yd(this,T)._++}`,refCounter:0,isSvg:!1}),"string"==typeof e?(i.url=e,t=await Qu(e,"blob")):e instanceof File?t=i.file=e:e instanceof Blob&&(t=e),"image/svg+xml"===t.type){const e=Dp._isSVGFittingCanvas,s=new FileReader,n=new Image,a=new Promise((t,a)=>{n.onload=()=>{i.bitmap=n,i.isSvg=!0,t()},s.onload=async()=>{const t=i.svgUrl=s.result;n.src=await e?`${t}#svgView(preserveAspectRatio(none))`:t},n.onerror=s.onerror=a});s.readAsDataURL(t),await a}else i.bitmap=await createImageBitmap(t);i.refCounter=1}catch(s){i=null}return Vd(this,P).set(t,i),i&&Vd(this,P).set(i.id,i),i};let Rp=Dp;class Ip{constructor(t=128){Gd(this,I,[]),Gd(this,L,!1),Gd(this,F),Gd(this,N,-1),qd(this,F,t)}add({cmd:t,undo:e,post:i,mustExec:s,type:n=NaN,overwriteIfSameType:a=!1,keepUndo:r=!1}){if(s&&t(),Vd(this,L))return;const o={cmd:t,undo:e,post:i,type:n};if(-1===Vd(this,N))return Vd(this,I).length>0&&(Vd(this,I).length=0),qd(this,N,0),void Vd(this,I).push(o);if(a&&Vd(this,I)[Vd(this,N)].type===n)return r&&(o.undo=Vd(this,I)[Vd(this,N)].undo),void(Vd(this,I)[Vd(this,N)]=o);const l=Vd(this,N)+1;l===Vd(this,F)?Vd(this,I).splice(0,1):(qd(this,N,l),l<Vd(this,I).length&&Vd(this,I).splice(l)),Vd(this,I).push(o)}undo(){if(-1===Vd(this,N))return;qd(this,L,!0);const{undo:t,post:e}=Vd(this,I)[Vd(this,N)];t(),null==e||e(),qd(this,L,!1),qd(this,N,Vd(this,N)-1)}redo(){if(Vd(this,N)<Vd(this,I).length-1){qd(this,N,Vd(this,N)+1),qd(this,L,!0);const{cmd:t,post:e}=Vd(this,I)[Vd(this,N)];t(),null==e||e(),qd(this,L,!1)}}hasSomethingToUndo(){return-1!==Vd(this,N)}hasSomethingToRedo(){return Vd(this,N)<Vd(this,I).length-1}cleanType(t){if(-1!==Vd(this,N)){for(let e=Vd(this,N);e>=0;e--)if(Vd(this,I)[e].type!==t)return Vd(this,I).splice(e+1,Vd(this,N)-e),void qd(this,N,e);Vd(this,I).length=0,qd(this,N,-1)}}destroy(){qd(this,I,null)}}I=new WeakMap,L=new WeakMap,F=new WeakMap,N=new WeakMap;class Lp{constructor(t){Gd(this,W),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=Nu.platform;for(const[i,s,n={}]of t)for(const t of i){const i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:s,options:n}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:s,options:n}),this.allKeys.add(t.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const i=this.callbacks.get(Xd(this,W,B).call(this,e));if(!i)return;const{callback:s,options:{bubbles:n=!1,args:a=[],checker:r=null}}=i;r&&!r(t,e)||(s.bind(t,...a,e)(),n||op(e))}}W=new WeakSet,B=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 Fp=class t{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return function(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const i of t.keys()){e.style.color=i;const s=window.getComputedStyle(e).color;t.set(i,cp(s))}e.remove()}(t),Mu(this,"_colors",t)}convert(e){const i=cp(e);if(!window.matchMedia("(forced-colors: active)").matches)return i;for(const[s,n]of this._colors)if(n.every((t,e)=>t===i[e]))return t._colorsMapping.get(s);return i}getHexCode(t){const e=this._colors.get(t);return e?Bu.makeHexColor(...e):t}};$d(Fp,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let Np=Fp;const Wp=class t{constructor(t,e,i,s,n,a,r,o,l,h,c,d,u,p,g,f){Gd(this,Lt),Gd(this,O,new AbortController),Gd(this,j,null),Gd(this,U,null),Gd(this,H,new Map),Gd(this,$,new Map),Gd(this,z,null),Gd(this,V,null),Gd(this,G,null),Gd(this,q,new Ip),Gd(this,X,null),Gd(this,Y,null),Gd(this,K,null),Gd(this,Q,0),Gd(this,J,new Set),Gd(this,Z,null),Gd(this,tt,null),Gd(this,et,new Set),$d(this,"_editorUndoBar",null),Gd(this,it,!1),Gd(this,st,!1),Gd(this,nt,!1),Gd(this,at,null),Gd(this,rt,null),Gd(this,ot,null),Gd(this,lt,null),Gd(this,ht,!1),Gd(this,ct,null),Gd(this,dt,new Pp),Gd(this,ut,!1),Gd(this,pt,!1),Gd(this,gt,!1),Gd(this,ft,null),Gd(this,mt,null),Gd(this,vt,null),Gd(this,wt,null),Gd(this,bt,null),Gd(this,yt,du.NONE),Gd(this,At,new Set),Gd(this,_t,null),Gd(this,xt,null),Gd(this,kt,null),Gd(this,St,null),Gd(this,Mt,null),Gd(this,Et,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),Gd(this,Ct,[0,0]),Gd(this,Tt,null),Gd(this,Pt,null),Gd(this,Dt,null),Gd(this,Rt,null),Gd(this,It,null);const m=this._signal=Vd(this,O).signal;qd(this,Pt,t),qd(this,Dt,e),qd(this,Rt,i),qd(this,z,s),qd(this,X,n),qd(this,xt,a),qd(this,Mt,o),this._eventBus=r,r._on("editingaction",this.onEditingAction.bind(this),{signal:m}),r._on("pagechanging",this.onPageChanging.bind(this),{signal:m}),r._on("scalechanging",this.onScaleChanging.bind(this),{signal:m}),r._on("rotationchanging",this.onRotationChanging.bind(this),{signal:m}),r._on("setpreference",this.onSetPreference.bind(this),{signal:m}),r._on("switchannotationeditorparams",t=>this.updateParams(t.type,t.value),{signal:m}),window.addEventListener("pointerdown",()=>{qd(this,pt,!0)},{capture:!0,signal:m}),window.addEventListener("pointerup",()=>{qd(this,pt,!1)},{capture:!0,signal:m}),Xd(this,Lt,jt).call(this),Xd(this,Lt,qt).call(this),Xd(this,Lt,$t).call(this),qd(this,V,o.annotationStorage),qd(this,at,o.filterFactory),qd(this,kt,l),qd(this,lt,h||null),qd(this,it,c),qd(this,st,d),qd(this,nt,u),qd(this,bt,p||null),this.viewParameters={realScale:Ku.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=g||null,this._supportsPinchToZoom=!1!==f,null==n||n.setSidebarUiManager(this)}static get _keyboardManager(){const e=t.prototype,i=t=>Vd(t,Pt).contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),s=(t,{target:e})=>
1{if(e instanceof HTMLInputElement){const{type:t}=e;return"text"!==t&&"number"!==t}return!0},n=this.TRANSLATE_SMALL,a=this.TRANSLATE_BIG;return Mu(this,"_keyboardManager",new Lp([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:s}],[["ctrl+z","mac+meta+z"],e.undo,{checker:s}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:s}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:s}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(t,{target:e})=>!(e instanceof HTMLButtonElement)&&Vd(t,Pt).contains(e)&&!t.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(t,{target:e})=>!(e instanceof HTMLButtonElement)&&Vd(t,Pt).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-n,0],checker:i}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-a,0],checker:i}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[n,0],checker:i}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[a,0],checker:i}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-n],checker:i}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-a],checker:i}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,n],checker:i}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,a],checker:i}]]))}destroy(){var t,e,i,s,n,a,r,o,l;null==(t=Vd(this,It))||t.resolve(),qd(this,It,null),null==(e=Vd(this,O))||e.abort(),qd(this,O,null),this._signal=null;for(const h of Vd(this,$).values())h.destroy();Vd(this,$).clear(),Vd(this,H).clear(),Vd(this,et).clear(),null==(i=Vd(this,wt))||i.clear(),qd(this,j,null),Vd(this,At).clear(),Vd(this,q).destroy(),null==(s=Vd(this,z))||s.destroy(),null==(n=Vd(this,X))||n.destroy(),null==(a=Vd(this,xt))||a.destroy(),null==(r=Vd(this,ct))||r.hide(),qd(this,ct,null),null==(o=Vd(this,vt))||o.destroy(),qd(this,vt,null),qd(this,U,null),Vd(this,rt)&&(clearTimeout(Vd(this,rt)),qd(this,rt,null)),Vd(this,Tt)&&(clearTimeout(Vd(this,Tt)),qd(this,Tt,null)),null==(l=this._editorUndoBar)||l.destroy(),qd(this,Mt,null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return Vd(this,bt)}get useNewAltTextFlow(){return Vd(this,st)}get useNewAltTextWhenAddingImage(){return Vd(this,nt)}get hcmFilter(){return Mu(this,"hcmFilter",Vd(this,kt)?Vd(this,at).addHCMFilter(Vd(this,kt).foreground,Vd(this,kt).background):"none")}get direction(){return Mu(this,"direction",getComputedStyle(Vd(this,Pt)).direction)}get _highlightColors(){return Mu(this,"_highlightColors",Vd(this,lt)?new Map(Vd(this,lt).split(",").map(t=>((t=t.split("=").map(t=>t.trim()))[1]=t[1].toUpperCase(),t))):null)}get highlightColors(){const{_highlightColors:t}=this;if(!t)return Mu(this,"highlightColors",null);const e=new Map,i=!!Vd(this,kt);for(const[s,n]of t){const t=s.endsWith("_HCM");i&&t?e.set(s.replace("_HCM",""),n):i||t||e.set(s,n)}return Mu(this,"highlightColors",e)}get highlightColorNames(){return Mu(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;const e=this.highlightColorNames.get(t);return this._highlightColors.get(e)||t}getNonHCMColorName(t){return this.highlightColorNames.get(t)||t}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),qd(this,K,t)}setMainHighlightColorPicker(t){qd(this,vt,t)}editAltText(t,e=!1){var i;null==(i=Vd(this,z))||i.editAltText(this,t,e)}hasCommentManager(){return!!Vd(this,X)}editComment(t,e,i,s){var n;null==(n=Vd(this,X))||n.showDialog(this,t,e,i,s)}selectComment(t,e){const i=Vd(this,$).get(t),s=null==i?void 0:i.getEditorByUID(e);null==s||s.toggleComment(!0,!0)}updateComment(t){var e;null==(e=Vd(this,X))||e.updateComment(t.getData())}updatePopupColor(t){var e;null==(e=Vd(this,X))||e.updatePopupColor(t)}
1removeComment(t){var e;null==(e=Vd(this,X))||e.removeComments([t.uid])}toggleComment(t,e,i=void 0){var s;null==(s=Vd(this,X))||s.toggleCommentPopup(t,e,i)}makeCommentColor(t,e){var i;return t&&(null==(i=Vd(this,X))?void 0:i.makeCommentColor(t,e))||null}getCommentDialogElement(){var t;return(null==(t=Vd(this,X))?void 0:t.dialogElement)||null}async waitForEditorsRendered(t){if(Vd(this,$).has(t-1))return;const{resolve:e,promise:i}=Promise.withResolvers(),s=i=>{i.pageNumber===t&&(this._eventBus._off("editorsrendered",s),e())};this._eventBus.on("editorsrendered",s),await i}getSignature(t){var e;null==(e=Vd(this,xt))||e.getSignature({uiManager:this,editor:t})}get signatureManager(){return Vd(this,xt)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){"enableNewAltTextWhenAddingImage"===t&&qd(this,nt,e)}onPageChanging({pageNumber:t}){qd(this,Q,t-1)}focusMainContainer(){Vd(this,Pt).focus()}findParent(t,e){for(const i of Vd(this,$).values()){const{x:s,y:n,width:a,height:r}=i.div.getBoundingClientRect();if(t>=s&&t<=s+a&&e>=n&&e<=n+r)return i}return null}disableUserSelect(t=!1){Vd(this,Dt).classList.toggle("noUserSelect",t)}addShouldRescale(t){Vd(this,et).add(t)}removeShouldRescale(t){Vd(this,et).delete(t)}onScaleChanging({scale:t}){var e;this.commitOrRemove(),this.viewParameters.realScale=t*Ku.PDF_TO_CSS_UNITS;for(const i of Vd(this,et))i.onScaleChanging();null==(e=Vd(this,K))||e.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t="",e=!1){const i=document.getSelection();if(!i||i.isCollapsed)return;const{anchorNode:s,anchorOffset:n,focusNode:a,focusOffset:r}=i,o=i.toString(),l=Xd(this,Lt,Ft).call(this,i).closest(".textLayer"),h=this.getSelectionBoxes(l);if(!h)return;i.empty();const c=Xd(this,Lt,Nt).call(this,l),d=Vd(this,yt)===du.NONE,u=()=>{const i=null==c?void 0:c.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:s,anchorOffset:n,focusNode:a,focusOffset:r,text:o});d&&this.showAllEditors("highlight",!0,!0),e&&(null==i||i.editComment())};d?this.switchToMode(du.HIGHLIGHT,u):u()}commentSelection(t=""){this.highlightSelection(t,!0)}getAndRemoveDataFromAnnotationStorage(t){if(!Vd(this,V))return null;const e=`${cu}${t}`,i=Vd(this,V).getRawValue(e);return i&&Vd(this,V).remove(e),i}addToAnnotationStorage(t){t.isEmpty()||!Vd(this,V)||Vd(this,V).has(t.id)||Vd(this,V).setValue(t.id,t)}a11yAlert(t,e=null){const i=Vd(this,Rt);i&&(i.setAttribute("data-l10n-id",t),e?i.setAttribute("data-l10n-args",JSON.stringify(e)):i.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,Vd(this,ht)&&(qd(this,ht,!1),Xd(this,Lt,Ot).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of Vd(this,At))if(e.div.contains(t)){qd(this,mt,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!Vd(this,mt))return;const[t,e]=Vd(this,mt);qd(this,mt,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){Xd(this,Lt,$t).call(this),Xd(this,Lt,Vt).call(this)}removeEditListeners(){Xd(this,Lt,zt).call(this),Xd(this,Lt,Gt).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const i of Vd(this,tt))if(i.isHandlingMimeForPasting(e))return t.dataTransfer.dropEffect="copy",void t.preventDefault()}drop(t){for(const e of t.dataTransfer.items)for(const i of Vd(this,tt))if(i.isHandlingMimeForPasting(e.type))return i.paste(e,this.currentLayer),void t.preventDefault()}copy(t){var e;if(t.preventDefault(),null==(e=Vd(this,j))||e.commitOrRemove(),!this.hasSelection)return;const i=[];for(const s of Vd(this,At)){const t=s.serialize(!0);t&&i.push(t)}0!==i.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(i))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();const{clipboardData:e}=t;for(const a of e.items)for(const t of Vd(this,tt))if(t.isHandlingMimeForPasting(a.type))return void t.paste(a,this.currentLayer);let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(n){return void n.message}if(!Array.isArray(i))return;this.unselectAll();const s=this.currentLayer;try{const t=[];for(const a of i){const e=await s.deserialize(a);if(!e)return;t.push(e)}const e=()=>{for(const e of t)Xd(this,Lt,Jt).call(this,e);Xd(this,Lt,ee).call(this,t)},n=()=>{for(const e of t)e.remove()};this.addCommands({cmd:e,undo:n,mustExec:!0})}catch(n){n.message}}keydown(e){this.isShiftKeyDown||"Shift"!==e.key||(this.isShiftKeyDown=!0),Vd(this,yt)===du.NONE||this.isEditorHandlingKeyboard||t._keyboardManager.exec(this,e)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,Vd(this,ht)&&(qd(this,ht,!1),Xd(this,Lt,Ot).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;case"commentSelection":this.commentSelection("context_menu")}}setEditingState(t){t?(Xd(this,Lt,Ut).call(this),Xd(this,Lt,Vt).call(this),Xd(this,Lt,Xt).call(this,{isEditing:Vd(this,yt)!==du.NONE,isEmpty:Xd(this,Lt,te).call(this),hasSomethingToUndo:Vd(this,q).hasSomethingToUndo(),hasSomethingToRedo:Vd(this,q).hasSomethingToRedo(),hasSelectedEditor:!1})):(Xd(this,Lt,Ht).call(this),Xd(this,Lt,Gt).call(this),Xd(this,Lt,Xt).call(this,{isEditing:!1}),this.disableUserSelect(!1))}
1registerEditorTypes(t){if(!Vd(this,tt)){qd(this,tt,t);for(const t of Vd(this,tt))Xd(this,Lt,Yt).call(this,t.defaultPropertiesToUpdate)}}getId(){return Vd(this,dt).id}get currentLayer(){return Vd(this,$).get(Vd(this,Q))}getLayer(t){return Vd(this,$).get(t)}get currentPageIndex(){return Vd(this,Q)}addLayer(t){Vd(this,$).set(t.pageIndex,t),Vd(this,ut)?t.enable():t.disable()}removeLayer(t){Vd(this,$).delete(t.pageIndex)}async updateMode(t,e=null,i=!1,s=!1,n=!1){var a,r,o,l,h,c;if(Vd(this,yt)!==t&&(!Vd(this,It)||(await Vd(this,It).promise,Vd(this,It)))){if(qd(this,It,Promise.withResolvers()),null==(a=Vd(this,K))||a.commitOrRemove(),Vd(this,yt)===du.POPUP&&(null==(r=Vd(this,X))||r.hideSidebar()),null==(o=Vd(this,X))||o.destroyPopup(),qd(this,yt,t),t===du.NONE){this.setEditingState(!1),Xd(this,Lt,Qt).call(this);for(const t of Vd(this,H).values())t.hideStandaloneCommentButton();return null==(l=this._editorUndoBar)||l.hide(),this.toggleComment(null),void Vd(this,It).resolve()}for(const t of Vd(this,H).values())t.addStandaloneCommentButton();t===du.SIGNATURE&&await(null==(h=Vd(this,xt))?void 0:h.loadSignatures()),this.setEditingState(!0),await Xd(this,Lt,Kt).call(this),this.unselectAll();for(const e of Vd(this,$).values())e.updateMode(t);if(t===du.POPUP){Vd(this,U)||qd(this,U,await Vd(this,Mt).getAnnotationsByType(new Set(Vd(this,tt).map(t=>t._editorType))));const t=new Set,e=[];for(const i of Vd(this,H).values()){const{annotationElementId:s,hasComment:n,deleted:a}=i;s&&t.add(s),n&&!a&&e.push(i.getData())}for(const i of Vd(this,U)){const{id:s,popupRef:n,contentsObj:a}=i;n&&(null==a?void 0:a.str)&&!t.has(s)&&!Vd(this,J).has(s)&&e.push(i)}null==(c=Vd(this,X))||c.showSidebar(e)}if(!e)return i&&this.addNewEditorFromKeyboard(),void Vd(this,It).resolve();for(const t of Vd(this,H).values())t.uid===e?(this.setSelected(t),n?t.editComment():s?t.enterInEditMode():t.focus()):t.unselect();Vd(this,It).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==Vd(this,yt)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(Vd(this,tt)){switch(t){case uu.CREATE:return void this.currentLayer.addNewEditor(e);case uu.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(Vd(this,St)||qd(this,St,new Map)).set(t,e),this.showAllEditors("highlight",e)}if(this.hasSelection)for(const i of Vd(this,At))i.updateParams(t,e);else for(const i of Vd(this,tt))i.updateDefaultParams(t,e)}}showAllEditors(t,e,i=!1){var s,n;for(const a of Vd(this,H).values())a.editorType===t&&a.show(e);(null==(n=null==(s=Vd(this,St))?void 0:s.get(uu.HIGHLIGHT_SHOW_ALL))||n)!==e&&Xd(this,Lt,Yt).call(this,[[uu.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(Vd(this,gt)!==t){qd(this,gt,t);for(const e of Vd(this,$).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}*getEditors(t){for(const e of Vd(this,H).values())e.pageIndex===t&&(yield e)}getEditor(t){return Vd(this,H).get(t)}addEditor(t){Vd(this,H).set(t.id,t)}removeEditor(t){var e,i;t.div.contains(document.activeElement)&&(Vd(this,rt)&&clearTimeout(Vd(this,rt)),qd(this,rt,setTimeout(()=>{this.focusMainContainer(),qd(this,rt,null)},0))),Vd(this,H).delete(t.id),t.annotationElementId&&(null==(e=Vd(this,wt))||e.delete(t.annotationElementId)),this.unselect(t),t.annotationElementId&&Vd(this,J).has(t.annotationElementId)||null==(i=Vd(this,V))||i.remove(t.id)}addDeletedAnnotationElement(t){Vd(this,J).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return Vd(this,J).has(t)}removeDeletedAnnotationElement(t){Vd(this,J).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){Vd(this,j)!==t&&(qd(this,j,t),t&&Xd(this,Lt,Yt).call(this,t.propertiesToUpdate))}updateUI(t){Vd(this,Lt,Zt)===t&&Xd(this,Lt,Yt).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){Xd(this,Lt,Yt).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(Vd(this,At).has(t))return Vd(this,At).delete(t),t.unselect(),void Xd(this,Lt,Xt).call(this,{hasSelectedEditor:this.hasSelection});Vd(this,At).add(t),t.select(),Xd(this,Lt,Yt).call(this,t.propertiesToUpdate),Xd(this,Lt,Xt).call(this,{hasSelectedEditor:!0})}setSelected(t){var e;this.updateToolbar({mode:t.mode,editId:t.id}),null==(e=Vd(this,K))||e.commitOrRemove();for(const i of Vd(this,At))i!==t&&i.unselect();Vd(this,At).clear(),Vd(this,At).add(t),t.select(),Xd(this,Lt,Yt).call(this,t.propertiesToUpdate),Xd(this,Lt,Xt).call(this,{hasSelectedEditor:!0})}isSelected(t){return Vd(this,At).has(t)}get firstSelectedEditor(){return Vd(this,At).values().next().value}unselect(t){t.unselect(),Vd(this,At).delete(t),Xd(this,Lt,Xt).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==Vd(this,At).size}get isEnterHandled(){return 1===Vd(this,At).size&&this.firstSelectedEditor.isEnterHandled}undo(){var t;Vd(this,q).undo(),Xd(this,Lt,Xt).call(this,{hasSomethingToUndo:Vd(this,q).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:Xd(this,Lt,te).call(this)}),null==(t=this._editorUndoBar)||t.hide()}redo(){Vd(this,q).redo(),Xd(this,Lt,Xt).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:Vd(this,q).hasSomethingToRedo(),isEmpty:Xd(this,Lt,te).call(this)})}addCommands(t){Vd(this,q).add(t),Xd(this,Lt,Xt).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:Xd(this,Lt,te).call(this)})}cleanUndoStack(t){Vd(this,q).cleanType(t)}delete(){var t;this.commitOrRemove();const e=null==(t=this.currentLayer)?void 0:t.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const i=e?[e]:[...Vd(this,At)],s=()=>{for(const t of i)Xd(this,Lt,Jt).call(this,t)};this.addCommands({cmd:()=>{var t;null==(t=this._editorUndoBar)||t.show(s,1===i.length?i[0].editorType:i.length);for(const e of i)e.remove()},undo:s,mustExec:!0})}commitOrRemove(){var t;null==(t=Vd(this,j))||t.commitOrRemove()}hasSomethingToControl(){return Vd(this,j)||this.hasSelection}selectAll(){for(const t of Vd(this,At))t.commit();Xd(this,Lt,ee).call(this,Vd(this,H).values())}unselectAll(){var t;if((!Vd(this,j)||(Vd(this,j).commitOrRemove(),Vd(this,yt)===du.NONE))&&!(null==(t=Vd(this,K))?void 0:t.commitOrRemove())&&this.hasSelection){for(const t of Vd(this,At))t.unselect();Vd(this,At).clear(),Xd(this,Lt,Xt).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;Vd(this,Ct)[0]+=t,Vd(this,Ct)[1]+=e;const[s,n]=Vd(this,Ct),a=[...Vd(this,At)];Vd(this,Tt)&&clearTimeout(Vd(this,Tt)),qd(this,Tt,setTimeout(()=>{qd(this,Tt,null),Vd(this,Ct)[0]=Vd(this,Ct)[1]=0,this.addCommands({cmd:()=>{for(const t of a)Vd(this,H).has(t.id)&&(t.translateInPage(s,n),t.translationDone())},undo:()=>{for(const t of a)Vd(this,H).has(t.id)&&(t.translateInPage(-s,-n),t.translationDone())},mustExec:!1})},1e3));for(const r of a)r.translateInPage(t,e),r.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),qd(this,Z,new Map);for(const t of Vd(this,At))Vd(this,Z).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!Vd(this,Z))return!1;this.disableUserSelect(!1);const t=Vd(this,Z);qd(this,Z,null);let e=!1;for(const[{x:s,y:n,pageIndex:a},r]of t)r.newX=s,r.newY=n,r.newPageIndex=a,e||(e=s!==r.savedX||n!==r.savedY||a!==r.savedPageIndex);if(!e)return!1;const i=(t,e,i,s)=>{if(Vd(this,H).has(t.id)){const n=Vd(this,$).get(s);n?t._setParentAndPosition(n,e,i):(t.pageIndex=s,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(const[e,{newX:s,newY:n,newPageIndex:a}]of t)i(e,s,n,a)},undo:()=>{for(const[e,{savedX:s,savedY:n,savedPageIndex:a}]of t)i(e,s,n,a)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(Vd(this,Z))for(const i of Vd(this,Z).keys())i.drag(t,e)}rebuild(t){if(null===t.parent){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){var t;return(null==(t=this.getActive())?void 0:t.shouldGetKeyboardEvents())||1===Vd(this,At).size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return Vd(this,j)===t}getActive(){return Vd(this,j)}getMode(){return Vd(this,yt)}isEditingMode(){return Vd(this,yt)!==du.NONE}get imageManager(){return Mu(this,"imageManager",new Rp)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let l=0,h=e.rangeCount;l<h;
1l++)if(!t.contains(e.getRangeAt(l).commonAncestorContainer))return null;const{x:i,y:s,width:n,height:a}=t.getBoundingClientRect();let r;switch(t.getAttribute("data-main-rotation")){case"90":r=(t,e,r,o)=>({x:(e-s)/a,y:1-(t+r-i)/n,width:o/a,height:r/n});break;case"180":r=(t,e,r,o)=>({x:1-(t+r-i)/n,y:1-(e+o-s)/a,width:r/n,height:o/a});break;case"270":r=(t,e,r,o)=>({x:1-(e+o-s)/a,y:(t-i)/n,width:o/a,height:r/n});break;default:r=(t,e,r,o)=>({x:(t-i)/n,y:(e-s)/a,width:r/n,height:o/a})}const o=[];for(let l=0,h=e.rangeCount;l<h;l++){const t=e.getRangeAt(l);if(!t.collapsed)for(const{x:e,y:i,width:s,height:n}of t.getClientRects())0!==s&&0!==n&&o.push(r(e,i,s,n))}return 0===o.length?null:o}addChangedExistingAnnotation({annotationElementId:t,id:e}){(Vd(this,G)||qd(this,G,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){var e;null==(e=Vd(this,G))||e.delete(t)}renderAnnotationElement(t){var e;const i=null==(e=Vd(this,G))?void 0:e.get(t.data.id);if(!i)return;const s=Vd(this,V).getRawValue(i);s&&(Vd(this,yt)!==du.NONE||s.hasBeenModified)&&s.renderAnnotationElement(t)}setMissingCanvas(t,e,i){var s;const n=null==(s=Vd(this,wt))?void 0:s.get(t);n&&(n.setCanvas(e,i),Vd(this,wt).delete(t))}addMissingCanvas(t,e){(Vd(this,wt)||qd(this,wt,new Map)).set(t,e)}};O=new WeakMap,j=new WeakMap,U=new WeakMap,H=new WeakMap,$=new WeakMap,z=new WeakMap,V=new WeakMap,G=new WeakMap,q=new WeakMap,X=new WeakMap,Y=new WeakMap,K=new WeakMap,Q=new WeakMap,J=new WeakMap,Z=new WeakMap,tt=new WeakMap,et=new WeakMap,it=new WeakMap,st=new WeakMap,nt=new WeakMap,at=new WeakMap,rt=new WeakMap,ot=new WeakMap,lt=new WeakMap,ht=new WeakMap,ct=new WeakMap,dt=new WeakMap,ut=new WeakMap,pt=new WeakMap,gt=new WeakMap,ft=new WeakMap,mt=new WeakMap,vt=new WeakMap,wt=new WeakMap,bt=new WeakMap,yt=new WeakMap,At=new WeakMap,_t=new WeakMap,xt=new WeakMap,kt=new WeakMap,St=new WeakMap,Mt=new WeakMap,Et=new WeakMap,Ct=new WeakMap,Tt=new WeakMap,Pt=new WeakMap,Dt=new WeakMap,Rt=new WeakMap,It=new WeakMap,Lt=new WeakSet,Ft=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},Nt=function(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const i of Vd(this,$).values())if(i.hasTextLayer(t))return i;return null},Wt=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;const e=Xd(this,Lt,Ft).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&(Vd(this,ct)||qd(this,ct,new Cp(this)),Vd(this,ct).show(e,i,"ltr"===this.direction))},Bt=function(){var t,e,i;const s=document.getSelection();if(!s||s.isCollapsed)return void(Vd(this,_t)&&(null==(t=Vd(this,ct))||t.hide(),qd(this,_t,null),Xd(this,Lt,Xt).call(this,{hasSelectedText:!1})));const{anchorNode:n}=s;if(n===Vd(this,_t))return;const a=Xd(this,Lt,Ft).call(this,s).closest(".textLayer");if(a){if(null==(i=Vd(this,ct))||i.hide(),qd(this,_t,n),Xd(this,Lt,Xt).call(this,{hasSelectedText:!0}),(Vd(this,yt)===du.HIGHLIGHT||Vd(this,yt)===du.NONE)&&(Vd(this,yt)===du.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),qd(this,ht,this.isShiftKeyDown),!this.isShiftKeyDown)){const t=Vd(this,yt)===du.HIGHLIGHT?Xd(this,Lt,Nt).call(this,a):null;if(null==t||t.toggleDrawing(),Vd(this,pt)){const e=new AbortController,i=this.combinedSignal(e),s=i=>{"pointerup"===i.type&&0!==i.button||(e.abort(),null==t||t.toggleDrawing(!0),"pointerup"===i.type&&Xd(this,Lt,Ot).call(this,"main_toolbar"))};window.addEventListener("pointerup",s,{signal:i}),window.addEventListener("blur",s,{signal:i})}else null==t||t.toggleDrawing(!0),Xd(this,Lt,Ot).call(this,"main_toolbar")}}else Vd(this,_t)&&(null==(e=Vd(this,ct))||e.hide(),qd(this,_t,null),Xd(this,Lt,Xt).call(this,{hasSelectedText:!1}))},Ot=function(t=""){Vd(this,yt)===du.HIGHLIGHT?this.highlightSelection(t):Vd(this,it)&&Xd(this,Lt,Wt).call(this)},jt=function(){document.addEventListener("selectionchange",Xd(this,Lt,Bt).bind(this),{signal:this._signal})},Ut=function(){if(Vd(this,ot))return;qd(this,ot,new AbortController);const t=this.combinedSignal(Vd(this,ot));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},Ht=function(){var t;null==(t=Vd(this,ot))||t.abort(),qd(this,ot,null)},$t=function(){if(Vd(this,ft))return;qd(this,ft,new AbortController);const t=this.combinedSignal(Vd(this,ft));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},zt=function(){var t;null==(t=Vd(this,ft))||t.abort(),qd(this,ft,null)},Vt=function(){if(Vd(this,Y))return;qd(this,Y,new AbortController);const t=this.combinedSignal(Vd(this,Y));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})},Gt=function(){var t;null==(t=Vd(this,Y))||t.abort(),qd(this,Y,null)},qt=function(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},Xt=function(t){Object.entries(t).some(([t,e])=>Vd(this,Et)[t]!==e)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(Vd(this,Et),t)}),Vd(this,yt)===du.HIGHLIGHT&&!1===t.hasSelectedEditor&&Xd(this,Lt,Yt).call(this,[[uu.HIGHLIGHT_FREE,!0]]))},Yt=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},Kt=async function(){if(!Vd(this,ut)){qd(this,ut,!0);const t=[];for(const e of Vd(this,$).values())t.push(e.enable());await Promise.all(t);for(const e of Vd(this,H).values())e.enable()}},Qt=function(){if(this.unselectAll(),Vd(this,ut)){qd(this,ut,!1);for(const t of Vd(this,$).values())t.disable();for(const t of Vd(this,H).values())t.disable()}},Jt=function(t){const e=Vd(this,$).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},Zt=function(){let t=null;for(t of Vd(this,At));return t},te=function(){if(0===Vd(this,H).size)return!0;
1if(1===Vd(this,H).size)for(const t of Vd(this,H).values())return t.isEmpty();return!1},ee=function(t){for(const e of Vd(this,At))e.unselect();Vd(this,At).clear();for(const e of t)e.isEmpty()||(Vd(this,At).add(e),e.select());Xd(this,Lt,Xt).call(this,{hasSelectedEditor:this.hasSelection})},$d(Wp,"TRANSLATE_SMALL",1),$d(Wp,"TRANSLATE_BIG",10);let Bp=Wp;const Op=class t{constructor(e){Gd(this,fe),Gd(this,ie,null),Gd(this,se,!1),Gd(this,ne,null),Gd(this,ae,null),Gd(this,re,null),Gd(this,oe,null),Gd(this,le,!1),Gd(this,he,null),Gd(this,ce,null),Gd(this,de,null),Gd(this,ue,null),Gd(this,pe,!1),qd(this,ce,e),qd(this,pe,e._uiManager.useNewAltTextFlow),Vd(t,ge)||qd(t,ge,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(e){null!=t._l10n||(t._l10n=e)}async render(){const e=qd(this,ne,document.createElement("button"));e.className="altText",e.tabIndex="0";const i=qd(this,ae,document.createElement("span"));e.append(i),Vd(this,pe)?(e.classList.add("new"),e.setAttribute("data-l10n-id",Vd(t,ge).missing),i.setAttribute("data-l10n-id",Vd(t,ge)["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),i.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const s=Vd(this,ce)._uiManager._signal;e.addEventListener("contextmenu",rp,{signal:s}),e.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:s});const n=t=>{t.preventDefault(),Vd(this,ce)._uiManager.editAltText(Vd(this,ce)),Vd(this,pe)&&Vd(this,ce)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:Vd(this,fe,me)}})};return e.addEventListener("click",n,{capture:!0,signal:s}),e.addEventListener("keydown",t=>{t.target===e&&"Enter"===t.key&&(qd(this,le,!0),n(t))},{signal:s}),await Xd(this,fe,ve).call(this),e}finish(){Vd(this,ne)&&(Vd(this,ne).focus({focusVisible:Vd(this,le)}),qd(this,le,!1))}isEmpty(){return Vd(this,pe)?null===Vd(this,ie):!Vd(this,ie)&&!Vd(this,se)}hasData(){return Vd(this,pe)?null!==Vd(this,ie)||!!Vd(this,de):this.isEmpty()}get guessedText(){return Vd(this,de)}async setGuessedText(e){null===Vd(this,ie)&&(qd(this,de,e),qd(this,ue,await t._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e})),Xd(this,fe,ve).call(this))}toggleAltTextBadge(t=!1){var e;if(!Vd(this,pe)||Vd(this,ie))return null==(e=Vd(this,he))||e.remove(),void qd(this,he,null);if(!Vd(this,he)){const t=qd(this,he,document.createElement("div"));t.className="noAltTextBadge",Vd(this,ce).div.append(t)}Vd(this,he).classList.toggle("hidden",!t)}serialize(t){let e=Vd(this,ie);return t||Vd(this,de)!==e||(e=Vd(this,ue)),{altText:e,decorative:Vd(this,se),guessedText:Vd(this,de),textWithDisclaimer:Vd(this,ue)}}get data(){return{altText:Vd(this,ie),decorative:Vd(this,se)}}set data({altText:t,decorative:e,guessedText:i,textWithDisclaimer:s,cancel:n=!1}){i&&(qd(this,de,i),qd(this,ue,s)),Vd(this,ie)===t&&Vd(this,se)===e||(n||(qd(this,ie,t),qd(this,se,e)),Xd(this,fe,ve).call(this))}toggle(t=!1){Vd(this,ne)&&(!t&&Vd(this,oe)&&(clearTimeout(Vd(this,oe)),qd(this,oe,null)),Vd(this,ne).disabled=!t)}shown(){Vd(this,ce)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:Vd(this,fe,me)}})}destroy(){var t,e;null==(t=Vd(this,ne))||t.remove(),qd(this,ne,null),qd(this,ae,null),qd(this,re,null),null==(e=Vd(this,he))||e.remove(),qd(this,he,null)}};ie=new WeakMap,se=new WeakMap,ne=new WeakMap,ae=new WeakMap,re=new WeakMap,oe=new WeakMap,le=new WeakMap,he=new WeakMap,ce=new WeakMap,de=new WeakMap,ue=new WeakMap,pe=new WeakMap,ge=new WeakMap,fe=new WeakSet,me=function(){return(Vd(this,ie)?"added":null===Vd(this,ie)&&this.guessedText&&"review")||"missing"},ve=async function(){var t,e,i;const s=Vd(this,ne);if(!s)return;if(Vd(this,pe)){if(s.classList.toggle("done",!!Vd(this,ie)),s.setAttribute("data-l10n-id",Vd(Op,ge)[Vd(this,fe,me)]),null==(t=Vd(this,ae))||t.setAttribute("data-l10n-id",Vd(Op,ge)[`${Vd(this,fe,me)}-label`]),!Vd(this,ie))return void(null==(e=Vd(this,re))||e.remove())}else{if(!Vd(this,ie)&&!Vd(this,se))return s.classList.remove("done"),void(null==(i=Vd(this,re))||i.remove());s.classList.add("done"),s.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let n=Vd(this,re);if(!n){qd(this,re,n=document.createElement("span")),n.className="tooltip",n.setAttribute("role","tooltip"),n.id=`alt-text-tooltip-${Vd(this,ce).id}`;const t=100,e=Vd(this,ce)._uiManager._signal;e.addEventListener("abort",()=>{clearTimeout(Vd(this,oe)),qd(this,oe,null)},{once:!0}),s.addEventListener("mouseenter",()=>{qd(this,oe,setTimeout(()=>{qd(this,oe,null),Vd(this,re).classList.add("show"),Vd(this,ce)._reportTelemetry({action:"alt_text_tooltip"})},t))},{signal:e}),s.addEventListener("mouseleave",()=>{var t;Vd(this,oe)&&(clearTimeout(Vd(this,oe)),qd(this,oe,null)),null==(t=Vd(this,re))||t.classList.remove("show")},{signal:e})}Vd(this,se)?n.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(n.removeAttribute("data-l10n-id"),n.textContent=Vd(this,ie)),n.parentNode||s.append(n);const a=Vd(this,ce).getElementForAltText();null==a||a.setAttribute("aria-describedby",n.id)},Gd(Op,ge,null),$d(Op,"_l10n",null);let jp=Op;class Up{constructor(t){Gd(this,Ce),Gd(this,we,null),Gd(this,be,null),Gd(this,ye,!1),Gd(this,Ae,null),Gd(this,_e,null),Gd(this,xe,null),Gd(this,ke,null),Gd(this,Se,null),Gd(this,Me,!1),Gd(this,Ee,null),qd(this,Ae,t)}renderForToolbar(){const t=qd(this,be,document.createElement("button"));
1return t.className="comment",Xd(this,Ce,Te).call(this,t,!1)}renderForStandalone(){const t=qd(this,we,document.createElement("button"));t.className="annotationCommentButton";const e=Vd(this,Ae).commentButtonPosition;if(e){const{style:i}=t;i.insetInlineEnd=`calc(${100*("ltr"===Vd(this,Ae)._uiManager.direction?1-e[0]:e[0])}% - var(--comment-button-dim))`,i.top=`calc(${100*e[1]}% - var(--comment-button-dim))`;const s=Vd(this,Ae).commentButtonColor;s&&(i.backgroundColor=s)}return Xd(this,Ce,Te).call(this,t,!0)}focusButton(){setTimeout(()=>{var t,e;null==(e=null!=(t=Vd(this,we))?t:Vd(this,be))||e.focus()},0)}onUpdatedColor(){if(!Vd(this,we))return;const t=Vd(this,Ae).commentButtonColor;t&&(Vd(this,we).style.backgroundColor=t),Vd(this,Ae)._uiManager.updatePopupColor(Vd(this,Ae))}get commentButtonWidth(){var t,e;return(null!=(e=null==(t=Vd(this,we))?void 0:t.getBoundingClientRect().width)?e:0)/Vd(this,Ae).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(Vd(this,Ee))return Vd(this,Ee);if(!Vd(this,we))return null;const{x:t,y:e,height:i}=Vd(this,we).getBoundingClientRect(),{x:s,y:n,width:a,height:r}=Vd(this,Ae).parent.boundingClientRect;return[(t-s)/a,(e+i-n)/r]}set commentPopupPositionInLayer(t){qd(this,Ee,t)}hasDefaultPopupPosition(){return null===Vd(this,Ee)}removeStandaloneCommentButton(){var t;null==(t=Vd(this,we))||t.remove(),qd(this,we,null)}removeToolbarCommentButton(){var t;null==(t=Vd(this,be))||t.remove(),qd(this,be,null)}setCommentButtonStates({selected:t,hasPopup:e}){Vd(this,we)&&(Vd(this,we).classList.toggle("selected",t),Vd(this,we).ariaExpanded=e)}edit(t){const e=this.commentPopupPositionInLayer;let i,s;if(e)[i,s]=e;else{[i,s]=Vd(this,Ae).commentButtonPosition;const{width:t,height:e,x:n,y:a}=Vd(this,Ae);i=n+i*t,s=a+s*e}const n=Vd(this,Ae).parent.boundingClientRect,{x:a,y:r,width:o,height:l}=n;Vd(this,Ae)._uiManager.editComment(Vd(this,Ae),a+i*o,r+s*l,{...t,parentDimensions:n})}finish(){Vd(this,be)&&(Vd(this,be).focus({focusVisible:Vd(this,ye)}),qd(this,ye,!1))}isDeleted(){return Vd(this,Me)||""===Vd(this,ke)}isEmpty(){return null===Vd(this,ke)}hasBeenEdited(){return this.isDeleted()||Vd(this,ke)!==Vd(this,_e)}serialize(){return this.data}get data(){return{text:Vd(this,ke),richText:Vd(this,xe),date:Vd(this,Se),deleted:this.isDeleted()}}set data(t){if(t!==Vd(this,ke)&&qd(this,xe,null),null===t)return qd(this,ke,""),void qd(this,Me,!0);qd(this,ke,t),qd(this,Se,new Date),qd(this,Me,!1)}setInitialText(t,e=null){qd(this,_e,t),this.data=t,qd(this,Se,null),qd(this,xe,e)}shown(){}destroy(){var t,e;null==(t=Vd(this,be))||t.remove(),qd(this,be,null),null==(e=Vd(this,we))||e.remove(),qd(this,we,null),qd(this,ke,""),qd(this,xe,null),qd(this,Se,null),qd(this,Ae,null),qd(this,ye,!1),qd(this,Me,!1)}}we=new WeakMap,be=new WeakMap,ye=new WeakMap,Ae=new WeakMap,_e=new WeakMap,xe=new WeakMap,ke=new WeakMap,Se=new WeakMap,Me=new WeakMap,Ee=new WeakMap,Ce=new WeakSet,Te=function(t,e){if(!Vd(this,Ae)._uiManager.hasCommentManager())return null;t.tabIndex="0",t.ariaHasPopup="dialog",e?(t.ariaControls="commentPopup",t.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(t.ariaControlsElements=[Vd(this,Ae)._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-button"));const i=Vd(this,Ae)._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return t;t.addEventListener("contextmenu",rp,{signal:i}),e&&(t.addEventListener("focusin",t=>{Vd(this,Ae)._focusEventsAllowed=!1,op(t)},{capture:!0,signal:i}),t.addEventListener("focusout",t=>{Vd(this,Ae)._focusEventsAllowed=!0,op(t)},{capture:!0,signal:i})),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});const s=e=>{e.preventDefault(),t===Vd(this,be)?this.edit():Vd(this,Ae).toggleComment(!0)};return t.addEventListener("click",s,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&(qd(this,ye,!0),s(e))},{signal:i}),t.addEventListener("pointerenter",()=>{Vd(this,Ae).toggleComment(!1,!0)},{signal:i}),t.addEventListener("pointerleave",()=>{Vd(this,Ae).toggleComment(!1,!1)},{signal:i}),t};const Hp=class{constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:i=null,onPinchStart:s=null,onPinching:n=null,onPinchEnd:a=null,signal:r}){Gd(this,He),Gd(this,Pe),Gd(this,De,!1),Gd(this,Re,null),Gd(this,Ie),Gd(this,Le),Gd(this,Fe),Gd(this,Ne),Gd(this,We,null),Gd(this,Be),Gd(this,Oe,null),Gd(this,je),Gd(this,Ue,null),qd(this,Pe,t),qd(this,Re,i),qd(this,Ie,e),qd(this,Le,s),qd(this,Fe,n),qd(this,Ne,a),qd(this,je,new AbortController),qd(this,Be,AbortSignal.any([r,Vd(this,je).signal])),t.addEventListener("touchstart",Xd(this,He,$e).bind(this),{passive:!1,signal:Vd(this,Be)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/gp.pixelRatio}destroy(){var t,e;null==(t=Vd(this,je))||t.abort(),qd(this,je,null),null==(e=Vd(this,We))||e.abort(),qd(this,We,null)}};Pe=new WeakMap,De=new WeakMap,Re=new WeakMap,Ie=new WeakMap,Le=new WeakMap,Fe=new WeakMap,Ne=new WeakMap,We=new WeakMap,Be=new WeakMap,Oe=new WeakMap,je=new WeakMap,Ue=new WeakMap,He=new WeakSet,$e=function(t){var e,i,s;if(null==(e=Vd(this,Ie))?void 0:e.call(this))return;if(1===t.touches.length){if(Vd(this,We))return;const t=qd(this,We,new AbortController),e=AbortSignal.any([Vd(this,Be),t.signal]),i=Vd(this,Pe),s={capture:!0,signal:e,passive:!1},n=t=>{var e;"touch"===t.pointerType&&(null==(e=Vd(this,We))||e.abort(),qd(this,We,null))};return i.addEventListener("pointerdown",t=>{"touch"===t.pointerType&&(op(t),n(t))},s),i.addEventListener("pointerup",n,s),void i.addEventListener("pointercancel",n,s)}if(!Vd(this,Ue)){qd(this,Ue,new AbortController);const t=AbortSignal.any([Vd(this,Be),Vd(this,Ue).signal]),e=Vd(this,Pe),s={signal:t,capture:!1,passive:!1};e.addEventListener("touchmove",Xd(this,He,ze).bind(this),s);const n=Xd(this,He,Ve).bind(this);e.addEventListener("touchend",n,s),e.addEventListener("touchcancel",n,s),s.capture=!0,e.addEventListener("pointerdown",op,s),e.addEventListener("pointermove",op,s),e.addEventListener("pointercancel",op,s),e.addEventListener("pointerup",op,s),null==(i=Vd(this,Le))||i.call(this)}if(op(t),2!==t.touches.length||(null==(s=Vd(this,Re))?void 0:s.call(this)))return void qd(this,Oe,null);let[n,a]=t.touches;n.identifier>a.identifier&&([n,a]=[a,n]),qd(this,Oe,{touch0X:n.screenX,touch0Y:n.screenY,touch1X:a.screenX,touch1Y:a.screenY})},ze=function(t){var e;if(!Vd(this,Oe)||2!==t.touches.length)return;op(t);let[i,s]=t.touches;i.identifier>s.identifier&&([i,s]=[s,i]);const{screenX:n,screenY:a}=i,{screenX:r,screenY:o}=s,l=Vd(this,Oe),{touch0X:h,touch0Y:c,touch1X:d,touch1Y:u}=l,p=d-h,g=u-c,f=r-n,m=o-a,v=Math.hypot(f,m)||1,w=Math.hypot(p,g)||1;if(!Vd(this,De)&&Math.abs(w-v)<=Hp.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=n,l.touch0Y=a,l.touch1X=r,l.touch1Y=o,!Vd(this,De))return void qd(this,De,!0);const b=[(n+r)/2,(a+o)/2];null==(e=Vd(this,Fe))||e.call(this,b,w,v)},Ve=function(t){var e;t.touches.length>=2||(Vd(this,Ue)&&(Vd(this,Ue).abort(),qd(this,Ue,null),null==(e=Vd(this,Ne))||e.call(this)),Vd(this,Oe)&&(op(t),qd(this,Oe,null),qd(this,De,!1)))};let $p=Hp;const zp=class t{constructor(e){Gd(this,wi),Gd(this,Ge,null),Gd(this,qe,null),Gd(this,Xe,null),Gd(this,Ye,null),Gd(this,Ke,null),Gd(this,Qe,!1),Gd(this,Je,null),Gd(this,Ze,""),Gd(this,ti,null),Gd(this,ei,null),Gd(this,ii,null),Gd(this,si,null),Gd(this,ni,null),Gd(this,ai,""),Gd(this,ri,!1),Gd(this,oi,null),Gd(this,li,!1),Gd(this,hi,!1),Gd(this,ci,!1),Gd(this,di,null),Gd(this,ui,0
1),Gd(this,pi,0),Gd(this,gi,null),Gd(this,fi,null),$d(this,"isSelected",!1),$d(this,"_isCopy",!1),$d(this,"_editToolbar",null),$d(this,"_initialOptions",Object.create(null)),$d(this,"_initialData",null),$d(this,"_isVisible",!0),$d(this,"_uiManager",null),$d(this,"_focusEventsAllowed",!0),Gd(this,mi,!1),Gd(this,vi,t._zIndex++),this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null,this.creationDate=e.creationDate||new Date,this.modificationDate=e.modificationDate||null;const{rotation:i,rawDims:{pageWidth:s,pageHeight:n,pageX:a,pageY:r}}=this.parent.viewport;this.rotation=i,this.pageRotation=(360+i-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,n],this.pageTranslation=[a,r];const[o,l]=this.parentDimensions;this.x=e.x/o,this.y=e.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=t.prototype._resizeWithKeyboard,i=Bp.TRANSLATE_SMALL,s=Bp.TRANSLATE_BIG;return Mu(this,"_resizerKeyboardManager",new Lp([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-i,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-s,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[i,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[s,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-i]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-s]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,i]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,s]}],[["Escape","mac+Escape"],t.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return Mu(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new Gp({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(e,i){if(null!=t._l10n||(t._l10n=e),t._l10nResizer||(t._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),-1!==t._borderLineWidth)return;const s=getComputedStyle(document.documentElement);t._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){_u("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return Vd(this,mi)}set _isDraggable(t){var e;qd(this,mi,t),null==(e=this.div)||e.classList.toggle("draggable",t)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=Vd(this,vi)}setParent(t){var e;null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(Xd(this,wi,Bi).call(this),null==(e=Vd(this,si))||e.remove(),qd(this,si,null)),this.parent=t}focusin(t){this._focusEventsAllowed&&(Vd(this,ri)?qd(this,ri,!1):this.parent.setSelected(this))}focusout(t){var e;if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const i=t.relatedTarget;(null==i?void 0:i.closest(`#${this.id}`))||(t.preventDefault(),(null==(e=this.parent)?void 0:e.isMultipleSelection)||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,s){const[n,a]=this.parentDimensions;[i,s]=this.screenToPageTranslation(i,s),this.x=(t+i)/n,this.y=(e+s)/a,this.fixAndSetPosition()}_moveAfterPaste(t,e){const[i,s]=this.parentDimensions;this.setAt(t*i,e*s,this.width*i,this.height*s),this._onTranslated()}translate(t,e){Xd(this,wi,bi).call(this,this.parentDimensions,t,e)}translateInPage(t,e){Vd(this,oi)||qd(this,oi,[this.x,this.y,this.width,this.height]),Xd(this,wi,bi).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){Vd(this,oi)||qd(this,oi,[this.x,this.y,this.width,this.height]);const{div:i,parentDimensions:[s,n]}=this;if(this.x+=t/s,this.y+=e/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:r}=this;const[o,l]=this.getBaseTranslation();a+=o,r+=l;const{style:h}=i;
1h.left=`${(100*a).toFixed(2)}%`,h.top=`${(100*r).toFixed(2)}%`,this._onTranslating(a,r),i.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!Vd(this,oi)&&(Vd(this,oi)[0]!==this.x||Vd(this,oi)[1]!==this.y)}get _hasBeenResized(){return!!Vd(this,oi)&&(Vd(this,oi)[2]!==this.width||Vd(this,oi)[3]!==this.height)}getBaseTranslation(){const[e,i]=this.parentDimensions,{_borderLineWidth:s}=t,n=s/e,a=s/i;switch(this.rotation){case 90:return[-n,a];case 180:return[n,a];case 270:return[n,-a];default:return[-n,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const{div:{style:e},pageDimensions:[i,s]}=this;let{x:n,y:a,width:r,height:o}=this;if(r*=i,o*=s,n*=i,a*=s,this._mustFixPosition)switch(t){case 0:n=zu(n,0,i-r),a=zu(a,0,s-o);break;case 90:n=zu(n,0,i-o),a=zu(a,r,s);break;case 180:n=zu(n,r,i),a=zu(a,o,s);break;case 270:n=zu(n,o,i),a=zu(a,0,s-r)}this.x=n/=i,this.y=a/=s;const[l,h]=this.getBaseTranslation();n+=l,a+=h,e.left=`${(100*n).toFixed(2)}%`,e.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,i){var s;return Xd(s=t,yi,Ai).call(s,e,i,this.parentRotation)}pageTranslationToScreen(e,i){var s;return Xd(s=t,yi,Ai).call(s,e,i,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,i]}=this;return[e*t,i*t]}setDims(){const{div:{style:t},width:e,height:i}=this;t.width=`${(100*e).toFixed(2)}%`,t.height=`${(100*i).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(1e4*t)/1e4}_onResizing(){}altTextFinish(){var t;null==(t=Vd(this,Xe))||t.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||Vd(this,hi))return this._editToolbar;this._editToolbar=new Ep(this),this.div.append(this._editToolbar.render());const{toolbarButtons:t}=this;if(t)for(const[e,i]of t)await this._editToolbar.addButton(e,i);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){var t;null==(t=this._editToolbar)||t.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){var t;null==(t=this._editToolbar)||t.removeButton("comment")}removeEditToolbar(){var t,e;null==(t=this._editToolbar)||t.remove(),this._editToolbar=null,null==(e=Vd(this,Xe))||e.destroy()}addContainer(t){var e;const i=null==(e=this._editToolbar)?void 0:e.div;i?i.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return Vd(this,Xe)||(jp.initialize(t._l10n),qd(this,Xe,new jp(this)),Vd(this,Ge)&&(Vd(this,Xe).data=Vd(this,Ge),qd(this,Ge,null))),Vd(this,Xe)}get altTextData(){var t;return null==(t=Vd(this,Xe))?void 0:t.data}set altTextData(t){Vd(this,Xe)&&(Vd(this,Xe).data=t)}get guessedAltText(){var t;return null==(t=Vd(this,Xe))?void 0:t.guessedText}async setGuessedAltText(t){var e;await(null==(e=Vd(this,Xe))?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return null==(e=Vd(this,Xe))?void 0:e.serialize(t)}hasAltText(){return!!Vd(this,Xe)&&!Vd(this,Xe).isEmpty()}hasAltTextData(){var t,e;return null!=(e=null==(t=Vd(this,Xe))?void 0:t.hasData())&&e}focusCommentButton(){var t;null==(t=Vd(this,Ye))||t.focusButton()}addCommentButton(){return Vd(this,Ye)||qd(this,Ye,new Up(this))}addStandaloneCommentButton(){Vd(this,Ke)?this._uiManager.isEditingMode()&&Vd(this,Ke).classList.remove("hidden"):this.hasComment&&(qd(this,Ke,Vd(this,Ye).renderForStandalone()),this.div.append(Vd(this,Ke)))}removeStandaloneCommentButton(){Vd(this,Ye).removeStandaloneCommentButton(),qd(this,Ke,null)}hideStandaloneCommentButton(){var t;null==(t=Vd(this,Ke))||t.classList.add("hidden")}get comment(){var t;const{data:{richText:e,text:i,date:s,deleted:n}}=Vd(this,Ye);return{text:i,richText:e,date:s,deleted:n,color:this.getNonHCMColor(),opacity:null!=(t=this.opacity)?t:1}}set comment(t){Vd(this,Ye)||qd(this,Ye,new Up(this)),Vd(this,Ye).data=t,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:t,popupRef:e,richText:i}){if(!e)return;if(Vd(this,Ye)||qd(this,Ye,new Up(this)),Vd(this,Ye).setInitialText(t,i),!this.annotationElementId)return;const s=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);s&&this.updateFromAnnotationLayer(s)}get hasEditedComment(){var t;return null==(t=Vd(this,Ye))?void 0:t.hasBeenEdited()}get hasDeletedComment(){var t;return null==(t=Vd(this,Ye))?void 0:t.isDeleted()}get hasComment(){return!!Vd(this,Ye)&&!Vd(this,Ye).isEmpty()&&!Vd(this,Ye).isDeleted()}async editComment(t){Vd(this,Ye)||qd(this,Ye,new Up(this)),Vd(this,Ye).edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){Vd(this,Ye).setSelectedButton(t)}addComment(t){if(this.hasEditedComment){const e=180,i=100,[,,,s]=t.rect,[n]=this.pageDimensions,[a]=this.pageTranslation,r=a+n+1,o=s-i,l=r+e;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[r,o,l,s]}}}updateFromAnnotationLayer({popup:{contents:t,deleted:e}}){Vd(this,Ye).data=e?null:t}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var t;const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=Vd(this,Qe)?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),Xd(this,wi,Ii).call(this);const[i,s]=this.parentDimensions;this.parentRotation%180!=0&&(e.style.maxWidth=`${(100*s/i).toFixed(2)}%`,e.style.maxHeight=`${(100*i/s).toFixed(2)}%`);const[n,a]=this.getInitialTranslation();return this.translate(n,a),Tp(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(Vd(this,fi)||qd(this,fi,new $p({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:Xd(this,wi,Ci).bind(this),onPinching:Xd(this,wi,Ti).bind(this),onPinchEnd:Xd(this,wi,Pi).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),null==(t=this._uiManager._editorUndoBar)||t.hide(),e}pointerdown(t){const{isMac:e}=Nu.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():(qd(this,ri,!0),this._isDraggable?Xd(this,wi,Ri).call(this,t):Xd(this,wi,Di).call(this,t))}_onStartDragging(){}_onStopDragging(){}moveInDOM(){Vd(this,di)&&clearTimeout(Vd(this,di)),qd(this,di,setTimeout(()=>{var t;qd(this,di,null),null==(t=this.parent)||t.moveEditorInDOM(this)},0))}
1_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,i=this.rotation){const s=this.parentScale,[n,a]=this.pageDimensions,[r,o]=this.pageTranslation,l=t/s,h=e/s,c=this.x*n,d=this.y*a,u=this.width*n,p=this.height*a;switch(i){case 0:return[c+l+r,a-d-h-p+o,c+l+u+r,a-d-h+o];case 90:return[c+h+r,a-d+l+o,c+h+p+r,a-d+l+u+o];case 180:return[c-l-u+r,a-d+h+o,c-l+r,a-d+h+p+o];case 270:return[c-h-p+r,a-d-l-u+o,c-h+r,a-d-l+o];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[i,s,n,a]=t,r=n-i,o=a-s;switch(this.rotation){case 0:return[i,e-a,r,o];case 90:return[i,e-s,o,r];case 180:return[n,e-s,r,o];case 270:return[n,e-a,o,r];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&t._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var t;null==(t=Vd(this,Ye))||t.onUpdatedColor()}getData(){const{comment:{text:t,color:e,date:i,opacity:s,deleted:n,richText:a},uid:r,pageIndex:o,creationDate:l,modificationDate:h}=this;return{id:r,pageIndex:o,rect:this.getPDFRect(),richText:a,contentsObj:{str:t},creationDate:l,modificationDate:i||h,popupRef:!n,color:e,opacity:s}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return!this.isInEditMode()&&(this.parent.setEditingState(!1),qd(this,hi,!0),!0)}disableEditMode(){return!!this.isInEditMode()&&(this.parent.setEditingState(!0),qd(this,hi,!1),!0)}isInEditMode(){return Vd(this,hi)}shouldGetKeyboardEvents(){return Vd(this,ci)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:t,left:e,bottom:i,right:s}=this.getClientDimensions(),{innerHeight:n,innerWidth:a}=window;return e<a&&s>0&&t<n&&i>0}rebuild(){Xd(this,wi,Ii).call(this)}rotate(t){}resize(){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:(null==(t=this._initialData)?void 0:t.popupRef)||""}}serialize(t=!1,e=null){var i;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:(null==(i=this._initialData)?void 0:i.popupRef)||""}}static async deserialize(t,e,i){const s=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});s.rotation=t.rotation,qd(s,Ge,t.accessibilityData),s._isCopy=t.isCopy||!1;const[n,a]=s.pageDimensions,[r,o,l,h]=s.getRectInCurrentCoords(t.rect,a);return s.x=r/n,s.y=o/a,s.width=l/n,s.height=h/a,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){var t,e;if(null==(t=Vd(this,ni))||t.abort(),qd(this,ni,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),Vd(this,di)&&(clearTimeout(Vd(this,di)),qd(this,di,null)),Xd(this,wi,Bi).call(this),this.removeEditToolbar(),Vd(this,gi)){for(const t of Vd(this,gi).values())clearTimeout(t);qd(this,gi,null)}this.parent=null,null==(e=Vd(this,fi))||e.destroy(),qd(this,fi,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(Xd(this,wi,xi).call(this),Vd(this,ti).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return"ltr"===this._uiManager.direction?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[e,i]}=this,[s,n,a,r]=this.getPDFRect();return[t._round(s+(a-s)*e),t._round(n+(r-n)*(1-i))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return Vd(this,Ye).commentPopupPositionInLayer}set commentPopupPosition(t){Vd(this,Ye).commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return Vd(this,Ye).hasDefaultPopupPosition()}get commentButtonWidth(){return Vd(this,Ye).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){Vd(this,Ye).setCommentButtonStates(t)}keydown(e){if(!this.isResizable||e.target!==this.div||"Enter"!==e.key)return;this._uiManager.setSelected(this),qd(this,ii,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const i=Vd(this,ti).children;if(!Vd(this,qe)){qd(this,qe,Array.from(i));const e=Xd(this,wi,Li).bind(this),s=Xd(this,wi,Fi).bind(this),n=this._uiManager._signal;for(const i of Vd(this,qe)){const a=i.getAttribute("data-resizer-name");i.setAttribute("role","spinbutton"),i.addEventListener("keydown",e,{signal:n}),i.addEventListener("blur",s,{signal:n}),i.addEventListener("focus",Xd(this,wi,Ni).bind(this,a),{signal:n}),i.setAttribute("data-l10n-id",t._l10nResizer[a])}}const s=Vd(this,qe)[0];let n=0;for(const t of i){if(t===s)break;n++}const a=(360-this.rotation+this.parentRotation)%360/90*(Vd(this,qe).length/4);if(a!==n){if(a<n)for(let t=0;t<n-a;t++)Vd(this,ti).append(Vd(this,ti).firstChild);else if(a>n)for(let t=0;t<a-n;t++)Vd(this,ti).firstChild.before(Vd(this,ti).lastChild);let e=0;for(const s of i){const i=Vd(this,qe)[e++].getAttribute("data-resizer-name");s.setAttribute("data-l10n-id",t._l10nResizer[i])}}Xd(this,wi,Wi).call(this,0),qd(this,ci,!0),Vd(this,ti).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(t,e){Vd(this,ci)&&Xd(this,wi,Ei).call(this,Vd(this,ai),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){Xd(this,wi,Bi).call(this),this.div.focus()}select(){var t,e,i;this.isSelected&&this._editToolbar?this._editToolbar.show():(this.isSelected=!0,this.makeResizable(),null==(t=this.div)||t.classList.add("selectedEditor"),this._editToolbar?(null==(e=this._editToolbar)||e.show(),null==(i=Vd(this,Xe))||i.toggleAltTextBadge(!1)):this.addEditToolbar().then(()=>{var t,e;(null==(t=this.div)?void 0:t.classList.contains("selectedEditor"))&&(null==(e=this._editToolbar)||e.show())}))}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>{var t;return null==(t=this.div)?void 0:t.focus({preventScroll:!0})},0)}unselect(){var t,e,i,s,n;this.isSelected&&(this.isSelected=!1,null==(t=Vd(this,ti))||t.classList.add("hidden"),null==(e=this.div)||e.classList.remove("selectedEditor"),(null==(i=this.div)?void 0:i.contains(document.activeElement))&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),null==(s=this._editToolbar)||s.hide(),null==(n=Vd(this,Xe))||n.toggleAltTextBadge(!0),this.hasComment&&this._uiManager.toggleComment(this,!1,
1!1))}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){"BUTTON"!==t.target.nodeName&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return Vd(this,li)}set isEditing(t){qd(this,li,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,i=!1){if(i){Vd(this,gi)||qd(this,gi,new Map);const{action:i}=e;let s=Vd(this,gi).get(i);return s&&clearTimeout(s),s=setTimeout(()=>{this._reportTelemetry(e),Vd(this,gi).delete(i),0===Vd(this,gi).size&&qd(this,gi,null)},t._telemetryTimeout),void Vd(this,gi).set(i,s)}e.type||(e.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),qd(this,Qe,!1)}disable(){this.div&&(this.div.tabIndex=-1),qd(this,Qe,!0)}updateFakeAnnotationElement(t){if(Vd(this,si)||this.deleted)return this.deleted?(Vd(this,si).remove(),void qd(this,si,null)):void((this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&Vd(this,si).updateEdited({rect:this.getPDFRect(),popup:this.comment}));qd(this,si,t.addFakeAnnotation(this))}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){const t=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.before(e)}}else e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){const{firstChild:e}=t.container;"DIV"===(null==e?void 0:e.nodeName)&&e.classList.contains("annotationContent")&&e.remove()}};Ge=new WeakMap,qe=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,Ke=new WeakMap,Qe=new WeakMap,Je=new WeakMap,Ze=new WeakMap,ti=new WeakMap,ei=new WeakMap,ii=new WeakMap,si=new WeakMap,ni=new WeakMap,ai=new WeakMap,ri=new WeakMap,oi=new WeakMap,li=new WeakMap,hi=new WeakMap,ci=new WeakMap,di=new WeakMap,ui=new WeakMap,pi=new WeakMap,gi=new WeakMap,fi=new WeakMap,mi=new WeakMap,vi=new WeakMap,wi=new WeakSet,bi=function([t,e],i,s){[i,s]=this.screenToPageTranslation(i,s),this.x+=i/t,this.y+=s/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},yi=new WeakSet,Ai=function(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},_i=function(t){switch(t){case 90:{const[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}},xi=function(){if(Vd(this,ti))return;qd(this,ti,document.createElement("div")),Vd(this,ti).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const i of t){const t=document.createElement("div");Vd(this,ti).append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",Xd(this,wi,ki).bind(this,i),{signal:e}),t.addEventListener("contextmenu",rp,{signal:e}),t.tabIndex=-1}this.div.prepend(Vd(this,ti))},ki=function(t,e){var i;e.preventDefault();const{isMac:s}=Nu.platform;if(0!==e.button||e.ctrlKey&&s)return;null==(i=Vd(this,Xe))||i.toggle(!1);const n=this._isDraggable;this._isDraggable=!1,qd(this,ei,[e.screenX,e.screenY]);const a=new AbortController,r=this._uiManager.combinedSignal(a);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",Xd(this,wi,Ei).bind(this,t),{passive:!0,capture:!0,signal:r}),window.addEventListener("touchmove",op,{passive:!1,signal:r}),window.addEventListener("contextmenu",rp,{signal:r}),qd(this,ii,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const h=()=>{var t;a.abort(),this.parent.togglePointerEvents(!0),null==(t=Vd(this,Xe))||t.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=o,this.div.style.cursor=l,Xd(this,wi,Mi).call(this)};window.addEventListener("pointerup",h,{signal:r}),window.addEventListener("blur",h,{signal:r})}
1,Si=function(t,e,i,s){this.width=i,this.height=s,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()},Mi=function(){if(!Vd(this,ii))return;const{savedX:t,savedY:e,savedWidth:i,savedHeight:s}=Vd(this,ii);qd(this,ii,null);const n=this.x,a=this.y,r=this.width,o=this.height;n===t&&a===e&&r===i&&o===s||this.addCommands({cmd:Xd(this,wi,Si).bind(this,n,a,r,o),undo:Xd(this,wi,Si).bind(this,t,e,i,s),mustExec:!0})},Ei=function(t,e){const[i,s]=this.parentDimensions,n=this.x,a=this.y,r=this.width,o=this.height,l=zp.MIN_SIZE/i,h=zp.MIN_SIZE/s,c=Xd(this,wi,_i).call(this,this.rotation),d=(t,e)=>[c[0]*t+c[2]*e,c[1]*t+c[3]*e],u=Xd(this,wi,_i).call(this,360-this.rotation);let p,g,f=!1,m=!1;switch(t){case"topLeft":f=!0,p=(t,e)=>[0,0],g=(t,e)=>[t,e];break;case"topMiddle":p=(t,e)=>[t/2,0],g=(t,e)=>[t/2,e];break;case"topRight":f=!0,p=(t,e)=>[t,0],g=(t,e)=>[0,e];break;case"middleRight":m=!0,p=(t,e)=>[t,e/2],g=(t,e)=>[0,e/2];break;case"bottomRight":f=!0,p=(t,e)=>[t,e],g=(t,e)=>[0,0];break;case"bottomMiddle":p=(t,e)=>[t/2,e],g=(t,e)=>[t/2,0];break;case"bottomLeft":f=!0,p=(t,e)=>[0,e],g=(t,e)=>[t,0];break;case"middleLeft":m=!0,p=(t,e)=>[0,e/2],g=(t,e)=>[t,e/2]}const v=p(r,o),w=g(r,o);let b=d(...w);const y=zp._round(n+b[0]),A=zp._round(a+b[1]);let _,x,k=1,S=1;if(e.fromKeyboard)({deltaX:_,deltaY:x}=e);else{const{screenX:t,screenY:i}=e,[s,n]=Vd(this,ei);[_,x]=this.screenToPageTranslation(t-s,i-n),Vd(this,ei)[0]=t,Vd(this,ei)[1]=i}var M,E;if([_,x]=(M=_/i,E=x/s,[u[0]*M+u[2]*E,u[1]*M+u[3]*E]),f){const t=Math.hypot(r,o);k=S=Math.max(Math.min(Math.hypot(w[0]-v[0]-_,w[1]-v[1]-x)/t,1/r,1/o),l/r,h/o)}else m?k=zu(Math.abs(w[0]-v[0]-_),l,1)/r:S=zu(Math.abs(w[1]-v[1]-x),h,1)/o;const C=zp._round(r*k),T=zp._round(o*S);b=d(...g(C,T));const P=y-b[0],D=A-b[1];Vd(this,oi)||qd(this,oi,[this.x,this.y,this.width,this.height]),this.width=C,this.height=T,this.x=P,this.y=D,this.setDims(),this.fixAndSetPosition(),this._onResizing()},Ci=function(){var t;qd(this,ii,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),null==(t=Vd(this,Xe))||t.toggle(!1),this.parent.togglePointerEvents(!1)},Ti=function(t,e,i){let s=i/e*.7+1-.7;if(1===s)return;const n=Xd(this,wi,_i).call(this,this.rotation),a=(t,e)=>[n[0]*t+n[2]*e,n[1]*t+n[3]*e],[r,o]=this.parentDimensions,l=this.x,h=this.y,c=this.width,d=this.height,u=zp.MIN_SIZE/r,p=zp.MIN_SIZE/o;s=Math.max(Math.min(s,1/c,1/d),u/c,p/d);const g=zp._round(c*s),f=zp._round(d*s);if(g===c&&f===d)return;Vd(this,oi)||qd(this,oi,[l,h,c,d]);const m=a(c/2,d/2),v=zp._round(l+m[0]),w=zp._round(h+m[1]),b=a(g/2,f/2);this.x=v-b[0],this.y=w-b[1],this.width=g,this.height=f,this.setDims(),this.fixAndSetPosition(),this._onResizing()},Pi=function(){var t;null==(t=Vd(this,Xe))||t.toggle(!0),this.parent.togglePointerEvents(!0),Xd(this,wi,Mi).call(this)},Di=function(t){const{isMac:e}=Nu.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},Ri=function(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();let i=!1;const s=new AbortController,n=this._uiManager.combinedSignal(s),a={capture:!0,passive:!1,signal:n},r=t=>{s.abort(),qd(this,Je,null),qd(this,ri,!1),this._uiManager.endDragSession()||Xd(this,wi,Di).call(this,t),i&&this._onStopDragging()};e&&(qd(this,ui,t.clientX),qd(this,pi,t.clientY),qd(this,Je,t.pointerId),qd(this,Ze,t.pointerType),window.addEventListener("pointermove",t=>{i||(i=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:e,clientY:s,pointerId:n}=t;if(n!==Vd(this,Je))return void op(t);const[a,r]=this.screenToPageTranslation(e-Vd(this,ui),s-Vd(this,pi));qd(this,ui,e),qd(this,pi,s),this._uiManager.dragSelectedEditors(a,r)},a),window.addEventListener("touchmove",op,a),window.addEventListener("pointerdown",t=>{t.pointerType===Vd(this,Ze)&&(Vd(this,fi)||t.isPrimary)&&r(t),op(t)},a));const o=t=>{Vd(this,Je)&&Vd(this,Je)!==t.pointerId?op(t):r(t)};window.addEventListener("pointerup",o,{signal:n}),window.addEventListener("blur",o,{signal:n})},Ii=function(){if(Vd(this,ni)||!this.div)return;qd(this,ni,new AbortController);const t=this._uiManager.combinedSignal(Vd(this,ni));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},Li=function(t){zp._resizerKeyboardManager.exec(this,t)},Fi=function(t){var e;Vd(this,ci)&&(null==(e=t.relatedTarget)?void 0:e.parentNode)!==Vd(this,ti)&&X
1d(this,wi,Bi).call(this)},Ni=function(t){qd(this,ai,Vd(this,ci)?t:"")},Wi=function(t){if(Vd(this,qe))for(const e of Vd(this,qe))e.tabIndex=t},Bi=function(){qd(this,ci,!1),Xd(this,wi,Wi).call(this,-1),Xd(this,wi,Mi).call(this)},Gd(zp,yi),$d(zp,"_l10n",null),$d(zp,"_l10nResizer",null),$d(zp,"_borderLineWidth",-1),$d(zp,"_colorManager",new Np),$d(zp,"_zIndex",1),$d(zp,"_telemetryTimeout",1e3);let Vp=zp;class Gp extends Vp{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const qp=3285377520,Xp=4294901760,Yp=65535;class Kp{constructor(t){this.h1=t?4294967295&t:qp,this.h2=t?4294967295&t:qp}update(t){let e,i;if("string"==typeof t){e=new Uint8Array(2*t.length),i=0;for(let s=0,n=t.length;s<n;s++){const n=t.charCodeAt(s);n<=255?e[i++]=n:(e[i++]=n>>>8,e[i++]=255&n)}}else{if(!ArrayBuffer.isView(t))throw new Error("Invalid data format, must be a string or TypedArray.");e=t.slice(),i=e.byteLength}const s=i>>2,n=i-4*s,a=new Uint32Array(e.buffer,0,s);let r=0,o=0,l=this.h1,h=this.h2;const c=3432918353,d=461845907,u=11601,p=13715;for(let g=0;g<s;g++)1&g?(r=a[g],r=r*c&Xp|r*u&Yp,r=r<<15|r>>>17,r=r*d&Xp|r*p&Yp,l^=r,l=l<<13|l>>>19,l=5*l+3864292196):(o=a[g],o=o*c&Xp|o*u&Yp,o=o<<15|o>>>17,o=o*d&Xp|o*p&Yp,h^=o,h=h<<13|h>>>19,h=5*h+3864292196);switch(r=0,n){case 3:r^=e[4*s+2]<<16;case 2:r^=e[4*s+1]<<8;case 1:r^=e[4*s],r=r*c&Xp|r*u&Yp,r=r<<15|r>>>17,r=r*d&Xp|r*p&Yp,1&s?l^=r:h^=r}this.h1=l,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=3981806797*t&Xp|36045*t&Yp,e=4283543511*e&Xp|(2950163797*(e<<16|t>>>16)&Xp)>>>16,t^=e>>>1,t=444984403*t&Xp|60499*t&Yp,e=3301882366*e&Xp|(3120437893*(e<<16|t>>>16)&Xp)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Qp=Object.freeze({map:null,hash:"",transfer:void 0});class Jp{constructor(){Gd(this,$i),Gd(this,Oi,!1),Gd(this,ji,null),Gd(this,Ui,null),Gd(this,Hi,new Map),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const i=Vd(this,Hi).get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return Vd(this,Hi).get(t)}remove(t){const e=Vd(this,Hi).get(t);if(void 0!==e&&(e instanceof Vp&&Vd(this,Ui).delete(e.annotationElementId),Vd(this,Hi).delete(t),0===Vd(this,Hi).size&&this.resetModified(),"function"==typeof this.onAnnotationEditor)){for(const t of Vd(this,Hi).values())if(t instanceof Vp)return;this.onAnnotationEditor(null)}}setValue(t,e){const i=Vd(this,Hi).get(t);let s=!1;if(void 0!==i)for(const[n,a]of Object.entries(e))i[n]!==a&&(s=!0,i[n]=a);else s=!0,Vd(this,Hi).set(t,e);s&&Xd(this,$i,zi).call(this),e instanceof Vp&&((Vd(this,Ui)||qd(this,Ui,new Map)).set(e.annotationElementId,e),"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type))}has(t){return Vd(this,Hi).has(t)}get size(){return Vd(this,Hi).size}resetModified(){Vd(this,Oi)&&(qd(this,Oi,!1),"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new Zp(this)}get serializable(){if(0===Vd(this,Hi).size)return Qp;const t=new Map,e=new Kp,i=[],s=Object.create(null);let n=!1;for(const[a,r]of Vd(this,Hi)){const i=r instanceof Vp?r.serialize(!1,s):r;i&&(t.set(a,i),e.update(`${a}:${JSON.stringify(i)}`),n||(n=!!i.bitmap))}if(n)for(const a of t.values())a.bitmap&&i.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:Qp}get editorStats(){var t;let e=null;const i=new Map;let s=0,n=0;for(const a of Vd(this,Hi).values()){if(!(a instanceof Vp)){a.popup&&(a.popup.deleted?n+=1:s+=1);continue}a.isCommentDeleted?n+=1:a.hasEditedComment&&(s+=1);const r=a.telemetryFinalData;if(!r)continue;const{type:o}=r;i.has(o)||i.set(o,Object.getPrototypeOf(a).constructor),e||(e=Object.create(null));const l=e[o]||(e[o]=new Map);for(const[e,i]of Object.entries(r)){if("type"===e)continue;let s=l.get(e);s||(s=new Map,l.set(e,s));const n=null!=(t=s.get(i))?t:0;s.set(i,n+1)}}if((n>0||s>0)&&(e||(e=Object.create(null)),e.comments={deleted:n,edited:s}),!e)return null;for(const[a,r]of i)e[a]=r.computeTelemetryFinalData(e[a]);return e}resetModifiedIds(){qd(this,ji,null)}updateEditor(t,e){var i;const s=null==(i=Vd(this,Ui))?void 0:i.get(t);return!!s&&(s.updateFromAnnotationLayer(e),!0)}getEditor(t){var e;return(null==(e=Vd(this,Ui))?void 0:e.get(t))||null}get modifiedIds(){if(Vd(this,ji))return Vd(this,ji);const t=[];if(Vd(this,Ui))for(const e of Vd(this,Ui).values())e.serialize()&&t.pu
1sh(e.annotationElementId);return qd(this,ji,{ids:new Set(t),hash:t.join(",")})}[Symbol.iterator](){return Vd(this,Hi).entries()}}Oi=new WeakMap,ji=new WeakMap,Ui=new WeakMap,Hi=new WeakMap,$i=new WeakSet,zi=function(){Vd(this,Oi)||(qd(this,Oi,!0),"function"==typeof this.onSetModified&&this.onSetModified())};class Zp extends Jp{constructor(t){super(),Gd(this,Vi);const{map:e,hash:i,transfer:s}=t.serializable,n=structuredClone(e,s?{transfer:s}:null);qd(this,Vi,{map:n,hash:i,transfer:s})}get print(){_u("Should not call PrintAnnotationStorage.print")}get serializable(){return Vd(this,Vi)}get modifiedIds(){return Mu(this,"modifiedIds",{ids:new Set,hash:""})}}Vi=new WeakMap;class tg{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){Gd(this,Gi,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(),Vd(this,Gi).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:i}){if(t&&!Vd(this,Gi).has(t.loadedName)){if(xu(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:e,src:n,style:a}=t,r=new FontFace(e,n,a);this.addNativeFontFace(r);try{await r.load(),Vd(this,Gi).add(e),null==i||i(t)}catch(s){t.baseFontName,this.removeNativeFontFace(r)}return}_u("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo)return void(await this.loadSystemFont(t));if(this.isFontLoadingAPISupported){const e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(i){throw e.family,t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(e=>{const i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){var t;return Mu(this,"isFontLoadingAPISupported",!!(null==(t=this._document)?void 0:t.fonts))}get isSyncFontLoadingSupported(){return Mu(this,"isSyncFontLoadingSupported",ru||Nu.platform.isFirefox)}_queueLoadingCallback(t){const{loadingRequests:e}=this,i={done:!1,complete:function(){for(xu(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;){const t=e.shift();setTimeout(t.callback,0)}},callback:t};return e.push(i),i}get _loadTestFont(){return Mu(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){function i(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function s(t,e,i,s){return t.substring(0,e)+s+t.substring(e+i)}let n,a;const r=this._document.createElement("canvas");r.width=1,r.height=1;const o=r.getContext("2d");let l=0;const h=`lt${Date.now()}${this.loadTestFontId++}`;let c=this._loadTestFont;c=s(c,976,h.length,h);const d=1482184792;let u=i(c,16);for(n=0,a=h.length-3;n<a;n+=4)u=u-d+i(h,n)|0;var p;n<h.length&&(u=u-d+i(h+"XXX",n)|0),c=s(c,16,4,(p=u,String.fromCharCode(p>>24&255,p>>16&255,p>>8&255,255&p)));const g=`@font-face {font-family:"${h}";src:url(data:font/opentype;base64,${btoa(c)});}`;this.insertRule(g);const f=this._document.createElement("div");f.style.visibility="hidden",f.style.width=f.style.height="10px",f.style.position="absolute",f.style.top=f.style.left="0px";for(const m of[t.loadedName,h]){const t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=m,f.append(t)}this._document.body.append(f),function t(e,i){++l>30?i():(o.font="30px "+e,o.fillText(".",0,20),o.getImageData(0,0,1,1).data[3]>0?i():setTimeout(t.bind(null,e,i)))}(h,()=>{f.remove(),e.complete()})}}Gi=new WeakMap;class eg{constructor(t,e=null,i,s){Gd(this,qi),this.compiledGlyphs=Object.create(null),qd(this,qi,t),this._inspectFont=e,i&&Object.assign(this,i),s&&(this.charProcOperatorList=s)}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return null==(t=this._inspectFont)||t.call(this,this),e}createFontFaceRule(){var t;if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${Vu(this.data)});`;let i;if(this.cssFontInfo){let t=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(t+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),i=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${t}src:${e}}`}else i=`@font-face {font-family:"${this.loadedName}";src:${e}}`;return null==(t=this._inspectFont)||t.call(this,this,e),i}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];const i=this.loadedName+"_path_"+e;let s;try{s=t.get(i)}catch(a){}const n=new Path2D(s||"");return this.fontExtraProperties||t.delete(i),this.compiledGlyphs[e]=n}get black(){return Vd(this,qi).black}get bold(){return Vd(this,qi).bold}get disableFontFace(){var t;return null!=(t=Vd(this,qi).disableFontFace)&&t}get fontExtraProperties(){var t;return null!=(t=Vd(this,qi).fontExtraProperties)&&t}get isInvalidPDFjsFont(){return Vd(this,qi).isInvalidPDFjsFont}get isType3Font(){return Vd(this,qi).isType3Font}get italic(){return Vd(this,qi).italic}get missingFile(){return Vd(this,qi).missingFile}get remeasure(){return Vd(this,qi).remeasure}get vertical(){return Vd(this,qi).vertical}get ascent(){return Vd(this,qi).ascent}get defaultWidth(){return Vd(this,qi).defaultWidth}get descent(){return Vd(this,qi).descent}get bbox(){return Vd(this,qi).bbox}get fontMatrix(){return Vd(this,qi).fontMatrix}get fallbackName(){return Vd(this,qi).fallbackName}get loadedName(){return Vd(this,qi).loadedName}get mimetype(){return Vd(this,qi).mimetype}get name(){return Vd(this,qi).name}get data(){return Vd(this,qi).data}clearData(){Vd(this,qi).clearData()}get cssFontInfo(){return Vd(this,qi).cssFontInfo}get systemFontInfo(){return Vd(this,qi).systemFontInfo}get defaultVMetrics(){return Vd(this,qi).defaultVMetrics}}function ig(t){if("string"!=typeof t)return null;if(t.endsWith("/"))return t;throw new Error(`Invalid factory url: "${t}" must include trailing slash.`)}qi=new WeakMap;const sg=t=>"object"==typeof t&&Number.isInteger(null==t?void 0:t.num)&&t.num>=0&&Number.isInteger(null==t?void 0:t.gen)&&t.gen>
1=0,ng=function(t,e,i){if(!Array.isArray(i)||i.length<2)return!1;const[s,n,...a]=i;if(!t(s)&&!Number.isInteger(s))return!1;if(!e(n))return!1;const r=a.length;let o=!0;switch(n.name){case"XYZ":if(r<2||r>3)return!1;break;case"Fit":case"FitB":return 0===r;case"FitH":case"FitBH":case"FitV":case"FitBV":if(r>1)return!1;break;case"FitR":if(4!==r)return!1;o=!1;break;default:return!1}for(const l of a)if(!("number"==typeof l||o&&null===l))return!1;return!0}.bind(null,sg,t=>"object"==typeof t&&"string"==typeof(null==t?void 0:t.name));class ag{constructor(){Gd(this,Xi,new Map),Gd(this,Yi,Promise.resolve())}postMessage(t,e){const i={data:structuredClone(t,e?{transfer:e}:null)};Vd(this,Yi).then(()=>{for(const[t]of Vd(this,Xi))t.call(this,i)})}addEventListener(t,e,i=null){let s=null;if((null==i?void 0:i.signal)instanceof AbortSignal){const{signal:n}=i;if(n.aborted)return;const a=()=>this.removeEventListener(t,e);s=()=>n.removeEventListener("abort",a),n.addEventListener("abort",a)}Vd(this,Xi).set(e,s)}removeEventListener(t,e){const i=Vd(this,Xi).get(e);null==i||i(),Vd(this,Xi).delete(e)}terminate(){for(const[,t]of Vd(this,Xi))null==t||t();Vd(this,Xi).clear()}}function rg(){}function og(t){if(t instanceof Iu||t instanceof Pu||t instanceof Cu||t instanceof Du||t instanceof Tu)return t;switch(t instanceof Error||"object"==typeof t&&null!==t||_u('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new Iu(t.message);case"InvalidPDFException":return new Pu(t.message);case"PasswordException":return new Cu(t.message,t.code);case"ResponseException":return new Du(t.message,t.status,t.missing);case"UnknownErrorException":return new Tu(t.message,t.details)}return new Tu(t.message,t.toString())}Xi=new WeakMap,Yi=new WeakMap;class lg{constructor(t,e,i){Gd(this,Qi),Gd(this,Ki,new AbortController),this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",Xd(this,Qi,Ji).bind(this),{signal:Vd(this,Ki).signal})}on(t,e){const i=this.actionHandler;if(i[t])throw new Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const s=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[s]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},i)}catch(a){n.reject(a)}return n.promise}sendWithStream(t,e,i,s){const n=this.streamId++,a=this.sourceName,r=this.targetName,o=this.comObj;return new ReadableStream({start:i=>{const l=Promise.withResolvers();return this.streamControllers[n]={controller:i,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},o.postMessage({sourceName:a,targetName:r,action:t,streamId:n,data:e,desiredSize:i.desiredSize},s),l.promise},pull:t=>{const e=Promise.withResolvers();return this.streamControllers[n].pullCall=e,o.postMessage({sourceName:a,targetName:r,stream:6,streamId:n,desiredSize:t.desiredSize}),e.promise},cancel:t=>{xu(t instanceof Error,"cancel must have a valid reason");const e=Promise.withResolvers();return this.streamControllers[n].cancelCall=e,this.streamControllers[n].isClosed=!0,o.postMessage({sourceName:a,targetName:r,stream:1,streamId:n,reason:og(t)}),e.promise}},i)}destroy(){var t;null==(t=Vd(this,Ki))||t.abort(),qd(this,Ki,null)}}Ki=new WeakMap,Qi=new WeakSet,Ji=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream)return void Xd(this,Qi,ts).call(this,t);if(t.callback){const e=t.callbackId,i=this.callbackCapabilities[e];if(!i)throw new Error(`Cannot resolve callback ${e}`);if(delete this.callbackCapabilities[e],1===t.callback)i.resolve(t.data);else{if(2!==t.callback)throw new Error("Unexpected callback case");i.reject(og(t.reason))}return}const e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const i=this.sourceName,s=t.sourceName,n=this.comObj;return void Promise.try(e,t.data).then(function(e){n.postMessage({sourceName:i,targetName:s,callback:1,callbackId:t.callbackId,data:e})},function(e){n.postMessage({sourceName:i,targetName:s,callback:2,callbackId:t.callbackId,reason:og(e)})})}t.streamId?Xd(this,Qi,Zi).call(this,t):e(t.data)},Zi=function(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,n=this.comObj,a=this,r=this.actionHandler[t.action],o={enqueue(t,a=1,r){if(this.isCancelled)return;const o=this.desiredSize;this.desiredSize-=a,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:i,targetName:s,stream:4,streamId:e,chunk:t},r)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:s,stream:3,streamId:e}),delete a.streamSinks[e])},error(t){xu(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:s,stream:5,streamId:e,reason:og(t)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};o.sinkCapability.resolve(),o.ready=o.sinkCapability.promise,this.streamSinks[e]=o,Promise.try(r,t.data,o).then(function(){n.postMessage({sourceName:i,targetName:s,stream:8,streamId:e,success:!0})},function(t){n.postMessage({sourceName:i,targetName:s,stream:8,streamId:e,reason:og(t)})})},ts=function(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,n=this.comObj,a=this.streamControllers[e],r=this.streamSinks[e];switch(t.stream){case 8:t.success?a.startCall.resolve():a.startCall.reject(og(t.reason));break;case 7:t.success?a.pullCall.resolve():a.pullCall.reject(og(t.reason));break;case 6:if(!r){n.postMessage({sourceName:i,targetName:s,stream:7,streamId:e,success:!0});break}r.desiredSize<=0&&t.desiredSize>0&&r.sinkCapability.resolve(),r.desiredSize=t.desiredSize,Promise.try(r.onPull||rg).then(function(){n.postMessage({sourceName:i,targetName:s,stream:7,streamId:e,success:!0})},function(t){n.postMessage({sourceName:i,targetName:s,stream:7,streamId:e,reason:og(t)})});break;case 4:if(xu(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case 3:if(xu(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),Xd(this,Qi,es).call(this,a,e);break;case 5:xu(a,"error should have stream controller"),a.controller.error(og(t.reason)),Xd(this,Qi,es).call(this,a,e);break;case 2:t.success?a.cancelCall.resolve():a.cancelCall.reject(og(t.reason)),Xd(this,Qi,es).call(this,a,e);break;case 1:if(!r)break;const o=og(t.reason);Promise.try(r.onCancel||rg,o).then(function(){n.postMessage({sourceName:i,targetName:s,stream:2,streamId:e,success:!0})},function(t){n.postMessage({sourceName:i,targetName:s,stream:2,streamId:e,reason:og(t)})}),r.sinkCapability.reject(o),r.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},es=async function(t,e){var i,s,n;await Promise.allSettled([null==(i=t.startCall)?void 0:i.promise,null==(s=t.pullCall)?void 0:s.promise,null==(n=t.cancelCall)?void 0:n.promise]),delete this.streamControllers[e]};class hg{constructor({enableHWA:t=!1}){Gd(this,is,!1),qd(this,is,t)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!Vd(this,is)})}}reset(t,e,i){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){_u("Abstract method `_createCanvas` called.")}}is=new WeakMap;class cg extends hg{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}}class dg{constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!t)throw new Error("CMap name must be specified.");const e=this.baseUrl+t+(this.isCompressed?".bcmap":"");return this._fetch(e).then(t=>({cMapData:t,isCompressed:this.isCompressed})).catch(t=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}async _fetch(t){_u("Abstract method `_fetch` called.")}}class ug extends dg{async _fetch(t){const e=await Qu(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):Fu(e)}}class pg{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,s,n){return"none"}destroy(t=!1){}}class gg extends pg{constructor({docId:t,ownerDocument:e=globalThis.document}){super(),Gd(this,cs),Gd(this,ss),Gd(this,ns),Gd(this,as),Gd(this,rs),Gd(this,os),Gd(this,ls),Gd(this,hs,0),qd(this,rs,t),qd(this,os,e)}addFilter(t){if(!t)return"none";let e=Vd(this,cs,ds).get(t);if(e)return e;
1const[i,s,n]=Xd(this,cs,gs).call(this,t),a=1===t.length?i:`${i}${s}${n}`;if(e=Vd(this,cs,ds).get(a),e)return Vd(this,cs,ds).set(t,e),e;const r=`g_${Vd(this,rs)}_transfer_map_${Yd(this,hs)._++}`,o=Xd(this,cs,fs).call(this,r);Vd(this,cs,ds).set(t,o),Vd(this,cs,ds).set(a,o);const l=Xd(this,cs,ws).call(this,r);return Xd(this,cs,ys).call(this,i,s,n,l),o}addHCMFilter(t,e){var i;const s=`${t}-${e}`,n="base";let a=Vd(this,cs,us).get(n);if((null==a?void 0:a.key)===s)return a.url;if(a?(null==(i=a.filter)||i.remove(),a.key=s,a.url="none",a.filter=null):(a={key:s,url:"none",filter:null},Vd(this,cs,us).set(n,a)),!t||!e)return a.url;const r=Xd(this,cs,_s).call(this,t);t=Bu.makeHexColor(...r);const o=Xd(this,cs,_s).call(this,e);if(e=Bu.makeHexColor(...o),Vd(this,cs,ps).style.color="","#000000"===t&&"#ffffff"===e||t===e)return a.url;const l=new Array(256);for(let p=0;p<=255;p++){const t=p/255;l[p]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const h=l.join(","),c=`g_${Vd(this,rs)}_hcm_filter`,d=a.filter=Xd(this,cs,ws).call(this,c);Xd(this,cs,ys).call(this,h,h,h,d),Xd(this,cs,vs).call(this,d);const u=(t,e)=>{const i=r[t]/255,s=o[t]/255,n=new Array(e+1);for(let a=0;a<=e;a++)n[a]=i+a/e*(s-i);return n.join(",")};return Xd(this,cs,ys).call(this,u(0,5),u(1,5),u(2,5),d),a.url=Xd(this,cs,fs).call(this,c),a.url}addAlphaFilter(t){let e=Vd(this,cs,ds).get(t);if(e)return e;const[i]=Xd(this,cs,gs).call(this,[t]),s=`alpha_${i}`;if(e=Vd(this,cs,ds).get(s),e)return Vd(this,cs,ds).set(t,e),e;const n=`g_${Vd(this,rs)}_alpha_map_${Yd(this,hs)._++}`,a=Xd(this,cs,fs).call(this,n);Vd(this,cs,ds).set(t,a),Vd(this,cs,ds).set(s,a);const r=Xd(this,cs,ws).call(this,n);return Xd(this,cs,As).call(this,i,r),a}addLuminosityFilter(t){let e,i,s=Vd(this,cs,ds).get(t||"luminosity");if(s)return s;if(t?([e]=Xd(this,cs,gs).call(this,[t]),i=`luminosity_${e}`):i="luminosity",s=Vd(this,cs,ds).get(i),s)return Vd(this,cs,ds).set(t,s),s;const n=`g_${Vd(this,rs)}_luminosity_map_${Yd(this,hs)._++}`,a=Xd(this,cs,fs).call(this,n);Vd(this,cs,ds).set(t,a),Vd(this,cs,ds).set(i,a);const r=Xd(this,cs,ws).call(this,n);return Xd(this,cs,ms).call(this,r),t&&Xd(this,cs,As).call(this,e,r),a}addHighlightHCMFilter(t,e,i,s,n){var a;const r=`${e}-${i}-${s}-${n}`;let o=Vd(this,cs,us).get(t);if((null==o?void 0:o.key)===r)return o.url;if(o?(null==(a=o.filter)||a.remove(),o.key=r,o.url="none",o.filter=null):(o={key:r,url:"none",filter:null},Vd(this,cs,us).set(t,o)),!e||!i)return o.url;const[l,h]=[e,i].map(Xd(this,cs,_s).bind(this));let c=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),d=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[u,p]=[s,n].map(Xd(this,cs,_s).bind(this));
1d<c&&([c,d,u,p]=[d,c,p,u]),Vd(this,cs,ps).style.color="";const g=(t,e,i)=>{const s=new Array(256),n=(d-c)/i,a=t/255,r=(e-t)/(255*i);let o=0;for(let l=0;l<=i;l++){const t=Math.round(c+l*n),e=a+l*r;for(let i=o;i<=t;i++)s[i]=e;o=t+1}for(let l=o;l<256;l++)s[l]=s[o-1];return s.join(",")},f=`g_${Vd(this,rs)}_hcm_${t}_filter`,m=o.filter=Xd(this,cs,ws).call(this,f);return Xd(this,cs,vs).call(this,m),Xd(this,cs,ys).call(this,g(u[0],p[0],5),g(u[1],p[1],5),g(u[2],p[2],5),m),o.url=Xd(this,cs,fs).call(this,f),o.url}destroy(t=!1){var e,i,s,n;t&&(null==(e=Vd(this,ls))?void 0:e.size)||(null==(i=Vd(this,as))||i.parentNode.parentNode.remove(),qd(this,as,null),null==(s=Vd(this,ns))||s.clear(),qd(this,ns,null),null==(n=Vd(this,ls))||n.clear(),qd(this,ls,null),qd(this,hs,0))}}ss=new WeakMap,ns=new WeakMap,as=new WeakMap,rs=new WeakMap,os=new WeakMap,ls=new WeakMap,hs=new WeakMap,cs=new WeakSet,ds=function(){return Vd(this,ns)||qd(this,ns,new Map)},us=function(){return Vd(this,ls)||qd(this,ls,new Map)},ps=function(){if(!Vd(this,as)){const t=Vd(this,os).createElement("div"),{style:e}=t;e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;const i=Vd(this,os).createElementNS(Xu,"svg");i.setAttribute("width",0),i.setAttribute("height",0),qd(this,as,Vd(this,os).createElementNS(Xu,"defs")),t.append(i),i.append(Vd(this,as)),Vd(this,os).body.append(t)}return Vd(this,as)},gs=function(t){if(1===t.length){const e=t[0],i=new Array(256);for(let t=0;t<256;t++)i[t]=e[t]/255;const s=i.join(",");return[s,s,s]}const[e,i,s]=t,n=new Array(256),a=new Array(256),r=new Array(256);for(let o=0;o<256;o++)n[o]=e[o]/255,a[o]=i[o]/255,r[o]=s[o]/255;return[n.join(","),a.join(","),r.join(",")]},fs=function(t){if(void 0===Vd(this,ss)){qd(this,ss,"");const t=Vd(this,os).URL;t!==Vd(this,os).baseURI&&(tp(t)||qd(this,ss,Su(t,"")))}return`url(${Vd(this,ss)}#${t})`},ms=function(t){const e=Vd(this,os).createElementNS(Xu,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)},vs=function(t){const e=Vd(this,os).createElementNS(Xu,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(e)},ws=function(t){const e=Vd(this,os).createElementNS(Xu,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),Vd(this,cs,ps).append(e),e},bs=function(t,e,i){const s=Vd(this,os).createElementNS(Xu,e);s.setAttribute("type","discrete"),s.setAttribute("tableValues",i),t.append(s)},ys=function(t,e,i,s){const n=Vd(this,os).createElementNS(Xu,"feComponentTransfer");
1s.append(n),Xd(this,cs,bs).call(this,n,"feFuncR",t),Xd(this,cs,bs).call(this,n,"feFuncG",e),Xd(this,cs,bs).call(this,n,"feFuncB",i)},As=function(t,e){const i=Vd(this,os).createElementNS(Xu,"feComponentTransfer");e.append(i),Xd(this,cs,bs).call(this,i,"feFuncA",t)},_s=function(t){return Vd(this,cs,ps).style.color=t,cp(getComputedStyle(Vd(this,cs,ps)).getPropertyValue("color"))};class fg{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!t)throw new Error("Font filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetch(e).catch(t=>{throw new Error(`Unable to load font data at: ${e}`)})}async _fetch(t){_u("Abstract method `_fetch` called.")}}class mg extends fg{async _fetch(t){const e=await Qu(t,"arraybuffer");return new Uint8Array(e)}}class vg{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!t)throw new Error("Wasm filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetch(e).catch(t=>{throw new Error(`Unable to load wasm data at: ${e}`)})}async _fetch(t){_u("Abstract method `_fetch` called.")}}class wg extends vg{async _fetch(t){const e=await Qu(t,"arraybuffer");return new Uint8Array(e)}}async function bg(t){const e=process.getBuiltinModule("fs"),i=await e.promises.readFile(t);return new Uint8Array(i)}class yg extends pg{}class Ag extends hg{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(t,e)}}class _g extends dg{async _fetch(t){return bg(t)}}class xg extends fg{async _fetch(t){return bg(t)}}class kg extends vg{async _fetch(t){return bg(t)}}const Sg="__forcedDependency",{floor:Mg,ceil:Eg}=Math;function Cg(t,e,i,s,n,a){t[4*e+0]=Math.min(t[4*e+0],i),t[4*e+1]=Math.min(t[4*e+1],s),t[4*e+2]=Math.max(t[4*e+2],n),t[4*e+3]=Math.max(t[4*e+3],a)}const Tg=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];class Pg{constructor(t,e){Gd(this,xs),Gd(this,ks),qd(this,xs,t),qd(this,ks,e)}get length(){return Vd(this,xs).length}isEmpty(t){return Vd(this,xs)[t]===Tg}minX(t){return Vd(this,ks)[4*t+0]/256}minY(t){return Vd(this,ks)[4*t+1]/256}maxX(t){return(Vd(this,ks)[4*t+2]+1)/256}maxY(t){return(Vd(this,ks)[4*t+3]+1)/256}}xs=new WeakMap,ks=new WeakMap;const Dg=(t,e)=>{if(!t)return;let i=t.get(e);return i||(i={dependencies:new Set,isRenderingOperation:!1},t.set(e,i)),i};class Rg{constructor(t,e,i=!1){Gd(this,Hs),Gd(this,Ss,{__proto__:null}),Gd(this,Ms,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Sg]:[]}),Gd(this,Es,new Map),Gd(this,Cs,[]),Gd(this,Ts,[]),Gd(this,Ps,[[1,0,0,1,0,0]]),Gd(this,Ds,[-1/0,-1/0,1/0,1/0]),Gd(this,Rs,new Float64Array([1/0,1/0,-1/0,-1/0])),Gd(this,Is,-1),Gd(this,Ls,new Set),Gd(this,Fs,new Map),Gd(this,Ns,new Map),Gd(this,Ws),Gd(this,Bs),Gd(this,Os),Gd(this,js),Gd(this,Us),qd(this,Ws,t.width),qd(this,Bs,t.height),Xd(this,Hs,$s).call(this,e),i&&qd(this,Us,new Map)}growOperationsCount(t){t>=Vd(this,js).length&&Xd(this,Hs,$s).call(this,t,Vd(this,js))}save(t){return qd(this,Ss,{__proto__:Vd(this,Ss)}),qd(this,Ms,{__proto__:Vd(this,Ms),transform:{__proto__:Vd(this,Ms).transform},moveText:{__proto__:Vd(this,Ms).moveText},sameLineText:{__proto__:Vd(this,Ms).sameLineText},[Sg]:{__proto__:Vd(this,Ms)[Sg]}}),qd(this,Ds,{__proto__:Vd(this,Ds)}),Vd(this,Cs).push(t),this}restore(t){var e;const i=Object.getPrototypeOf(Vd(this,Ss));if(null===i)return this;qd(this,Ss,i),qd(this,Ms,Object.getPrototypeOf(Vd(this,Ms))),qd(this,Ds,Object.getPrototypeOf(Vd(this,Ds)));const s=Vd(this,Cs).pop();return void 0!==s&&(null==(e=Dg(Vd(this,Us),t))||e.dependencies.add(s),Vd(this,js)[t]=Vd(this,js)[s]),this}recordOpenMarker(t){return Vd(this,Cs).push(t),this}getOpenMarker(){return 0===Vd(this,Cs).length?null:Vd(this,Cs).at(-1)}recordCloseMarker(t){var e;const i=Vd(this,Cs).pop();return void 0!==i&&(null==(e=Dg(Vd(this,Us),t))||e.dependencies.add(i),Vd(this,js)[t]=Vd(this,js)[i]),this}beginMarkedContent(t){return Vd(this,Ts).push(t),this}endMarkedContent(t){var e;const i=Vd(this,Ts).pop();return void 0!==i&&(null==(e=Dg(Vd(this,Us),t))||e.dependencies.add(i),Vd(this,js)[t]=Vd(this,js)[i]),this}pushBaseTransform(t){return Vd(this,Ps).push(Bu.multiplyByDOMMatrix(Vd(this,Ps).at(-1),t.getTransform())),this}popBaseTransform(){return Vd(this,Ps).length>1&&Vd(this,Ps).pop(),this}recordSimpleData(t,e){return Vd(this,Ss)[t]=e,this}recordIncrementalData(t,e){return Vd(this,Ms)[t].push(e),this}resetIncrementalData(t,e){return Vd(this,Ms)[t].length=0,this}recordNamedData(t,e){return Vd(this,Es).set(t,e),this}
1recordSimpleDataFromNamed(t,e,i){var s;Vd(this,Ss)[t]=null!=(s=Vd(this,Es).get(e))?s:i}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Sg,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(const e of t)e in Vd(this,Ss)&&this.recordFutureForcedDependency(e,Vd(this,Ss)[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const t of Vd(this,Ls))this.recordFutureForcedDependency(Sg,t);return this}resetBBox(t){return Vd(this,Is)!==t&&(qd(this,Is,t),Vd(this,Rs)[0]=1/0,Vd(this,Rs)[1]=1/0,Vd(this,Rs)[2]=-1/0,Vd(this,Rs)[3]=-1/0),this}recordClipBox(t,e,i,s,n,a){const r=Bu.multiplyByDOMMatrix(Vd(this,Ps).at(-1),e.getTransform()),o=[1/0,1/0,-1/0,-1/0];Bu.axialAlignedBoundingBox([i,n,s,a],r,o);const l=Bu.intersect(Vd(this,Ds),o);return l?(Vd(this,Ds)[0]=l[0],Vd(this,Ds)[1]=l[1],Vd(this,Ds)[2]=l[2],Vd(this,Ds)[3]=l[3]):(Vd(this,Ds)[0]=Vd(this,Ds)[1]=1/0,Vd(this,Ds)[2]=Vd(this,Ds)[3]=-1/0),this}recordBBox(t,e,i,s,n,a){const r=Vd(this,Ds);if(r[0]===1/0)return this;const o=Bu.multiplyByDOMMatrix(Vd(this,Ps).at(-1),e.getTransform());if(r[0]===-1/0)return Bu.axialAlignedBoundingBox([i,n,s,a],o,Vd(this,Rs)),this;const l=[1/0,1/0,-1/0,-1/0];return Bu.axialAlignedBoundingBox([i,n,s,a],o,l),Vd(this,Rs)[0]=Math.min(Vd(this,Rs)[0],Math.max(l[0],r[0])),Vd(this,Rs)[1]=Math.min(Vd(this,Rs)[1],Math.max(l[1],r[1])),Vd(this,Rs)[2]=Math.max(Vd(this,Rs)[2],Math.min(l[2],r[2])),Vd(this,Rs)[3]=Math.max(Vd(this,Rs)[3],Math.min(l[3],r[3])),this}recordCharacterBBox(t,e,i,s=1,n=0,a=0,r){const o=i.bbox;let l,h;if(o&&(l=o[2]!==o[0]&&o[3]!==o[1]&&Vd(this,Ns).get(i),!1!==l&&(h=[0,0,0,0],Bu.axialAlignedBoundingBox(o,i.fontMatrix,h),1===s&&0===n&&0===a||Bu.scaleMinMax([s,0,0,-s,n,a],h),l)))return this.recordBBox(t,e,h[0],h[2],h[1],h[3]);if(!r)return this.recordFullPageBBox(t);const c=r();return o&&h&&void 0===l&&(l=h[0]<=n-c.actualBoundingBoxLeft&&h[2]>=n+c.actualBoundingBoxRight&&h[1]<=a-c.actualBoundingBoxAscent&&h[3]>=a+c.actualBoundingBoxDescent,Vd(this,Ns).set(i,l),l)?this.recordBBox(t,e,h[0],h[2],h[1],h[3]):this.recordBBox(t,e,n-c.actualBoundingBoxLeft,n+c.actualBoundingBoxRight,a-c.actualBoundingBoxAscent,a+c.actualBoundingBoxDescent)}recordFullPageBBox(t){return Vd(this,Rs)[0]=Math.max(0,Vd(this,Ds)[0]),Vd(this,Rs)[1]=Math.max(0,Vd(this,Ds)[1]),Vd(this,Rs)[2]=Math.min(Vd(this,Ws),Vd(this,Ds)[2]),Vd(this,Rs)[3]=Math.min(Vd(this,Bs),Vd(this,Ds)[3]),this}getSimpleIndex(t){return Vd(this,Ss)[t]}recordDependencies(t,e){const i=Vd(this,Ls),s=Vd(this,Ss),n=Vd(this,Ms);for(const a of e)a in Vd(this,Ss)?i.add(s[a]):a in n&&n[a].forEach(i.add,i);return this}recordNamedDependency(t,e){return Vd(this,Es).has(e)&&Vd(this,Ls).add(Vd(this,Es).get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[Sg]),Vd(this,Us)){const e=Dg(Vd(this,Us),t),{dependencies:i}=e;Vd(this,Ls).forEach(i.add,i),Vd(this,Cs).forEach(i.add,i),Vd(this,Ts).forEach(i.add,i),i.delete(t),e.isRenderingOperation=!0}if(Vd(this,Is)===t){const i=Mg(256*Vd(this,Rs)[0]/Vd(this,Ws)),s=Mg(256*Vd(this,Rs)[1]/Vd(this,Bs)),n=Eg(256*Vd(this,Rs)[2]/Vd(this,Ws)),a=Eg(256*Vd(this,Rs)[3]/Vd(this,Bs));Cg(Vd(this,Os),t,i,s,n,a);for(const e of Vd(this,Ls))e!==t&&Cg(Vd(this,Os),e,i,s,n,a);for(const e of Vd(this,Cs))e!==t&&Cg(Vd(this,Os),e,i,s,n,a);for(const e of Vd(this,Ts))e!==t&&Cg(Vd(this,Os),e,i,s,n,a);e||(Vd(this,Ls).clear(),qd(this,Is,-1))}return this}recordShowTextOperation(t,e=!1){const i=Array.from(Vd(this,Ls));this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(const s of i)this.recordIncrementalData("sameLineText",s);return this}bboxToClipBoxDropOperation(t,e=!1){return Vd(this,Is)===t&&(qd(this,Is,-1),Vd(this,Ds)[0]=Math.max(Vd(this,Ds)[0],Vd(this,Rs)[0]),Vd(this,Ds)[1]=Math.max(Vd(this,Ds)[1],Vd(this,Rs)[1]),Vd(this,Ds)[2]=Math.min(Vd(this,Ds)[2],Vd(this,Rs)[2]),Vd(this,Ds)[3]=Math.min(Vd(this,Ds)[3],Vd(this,Rs)[3]),e||Vd(this,Ls).clear()),this}_takePendingDependencies(){const t=Vd(this,Ls);return qd(this,Ls,new Set),t}_extractOperation(t){const e=Vd(this,Fs).get(t);return Vd(this,Fs).delete(t),e}_pushPendingDependencies(t){for(const e of t)Vd(this,Ls).add(e)}take(){return Vd(this,Ns).clear(),new Pg(Vd(this,js),Vd(this,Os))}takeDebugMetadata(){return Vd(this,Us)}}Ss=new WeakMap,Ms=new WeakMap,Es=new WeakMap,Cs=new WeakMap,Ts=new WeakMap,Ps=new WeakMap,Ds=new WeakMap,Rs=new WeakMap,Is=new WeakMap,Ls=new WeakMap,Fs=new WeakMap,Ns=new WeakMap,Ws=new WeakMap,Bs=new WeakMap,O
1s=new WeakMap,js=new WeakMap,Us=new WeakMap,Hs=new WeakSet,$s=function(t,e){const i=new ArrayBuffer(4*t);qd(this,Os,new Uint8ClampedArray(i)),qd(this,js,new Uint32Array(i)),e&&e.length>0?(Vd(this,js).set(e),Vd(this,js).fill(Tg,e.length)):Vd(this,js).fill(Tg)},zs=new WeakMap,Vs=new WeakMap,Gs=new WeakMap,qs=new WeakMap,Xs=new WeakMap;let Ig=class t{constructor(e,i,s){if(Gd(this,zs),Gd(this,Vs),Gd(this,Gs),Gd(this,qs,0),Gd(this,Xs,0),e instanceof t&&Vd(e,Gs)===!!s)return e;qd(this,zs,e),qd(this,Vs,i),qd(this,Gs,!!s)}growOperationsCount(){throw new Error("Unreachable")}save(t){return Yd(this,Xs)._++,Vd(this,zs).save(Vd(this,Vs)),this}restore(t){return Vd(this,Xs)>0&&(Vd(this,zs).restore(Vd(this,Vs)),Yd(this,Xs)._--),this}recordOpenMarker(t){return Yd(this,qs)._++,this}getOpenMarker(){return Vd(this,qs)>0?Vd(this,Vs):Vd(this,zs).getOpenMarker()}recordCloseMarker(t){return Yd(this,qs)._--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return Vd(this,zs).pushBaseTransform(t),this}popBaseTransform(){return Vd(this,zs).popBaseTransform(),this}recordSimpleData(t,e){return Vd(this,zs).recordSimpleData(t,Vd(this,Vs)),this}recordIncrementalData(t,e){return Vd(this,zs).recordIncrementalData(t,Vd(this,Vs)),this}resetIncrementalData(t,e){return Vd(this,zs).resetIncrementalData(t,Vd(this,Vs)),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,i){return Vd(this,zs).recordSimpleDataFromNamed(t,e,Vd(this,Vs)),this}recordFutureForcedDependency(t,e){return Vd(this,zs).recordFutureForcedDependency(t,Vd(this,Vs)),this}inheritSimpleDataAsFutureForcedDependencies(t){return Vd(this,zs).inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return Vd(this,zs).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return Vd(this,Gs)||Vd(this,zs).resetBBox(Vd(this,Vs)),this}recordClipBox(t,e,i,s,n,a){return Vd(this,Gs)||Vd(this,zs).recordClipBox(Vd(this,Vs),e,i,s,n,a),this}recordBBox(t,e,i,s,n,a){return Vd(this,Gs)||Vd(this,zs).recordBBox(Vd(this,Vs),e,i,s,n,a),this}recordCharacterBBox(t,e,i,s,n,a,r){return Vd(this,Gs)||Vd(this,zs).recordCharacterBBox(Vd(this,Vs),e,i,s,n,a,r),this}recordFullPageBBox(t){return Vd(this,Gs)||Vd(this,zs).recordFullPageBBox(Vd(this,Vs)),this}getSimpleIndex(t){return Vd(this,zs).getSimpleIndex(t)}recordDependencies(t,e){return Vd(this,zs).recordDependencies(Vd(this,Vs),e),this}recordNamedDependency(t,e){return Vd(this,zs).recordNamedDependency(Vd(this,Vs),e),this}recordOperation(t){return Vd(this,zs).recordOperation(Vd(this,Vs),!0),this}recordShowTextOperation(t){return Vd(this,zs).recordShowTextOperation(Vd(this,Vs),!0),this}bboxToClipBoxDropOperation(t){return Vd(this,Gs)||Vd(this,zs).bboxToClipBoxDropOperation(Vd(this,Vs),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};const Lg=["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],Fg=["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],Ng=["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],Wg=["filter","fillColor","fillAlpha"],Bg=["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],Og=["transform"],jg=["transform","fillColor"],Ug="Fill",Hg="Stroke",$g="Shading";function zg(t,e){if(!e)return;const i=e[2]-e[0],s=e[3]-e[1],n=new Path2D;n.rect(e[0],e[1],i,s),t.clip(n)}class Vg{isModifyingCurrentTransform(){return!1}getPattern(){_u("Abstract method `getPattern` called.")}}class Gg extends Vg{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;"axial"===this._type?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const i of this._colorStops)e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,s){let n;if(s===Hg||s===Ug){const a=e.current.getClippedPathBoundingBox(s,dp(t))||[0,0,0,0],r=M
vendor: 11,282 bytes, line 1
1ath.ceil(a[2]-a[0])||1,o=Math.ceil(a[3]-a[1])||1,l=e.cachedCanvases.getCanvas("pattern",r,o),h=l.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-a[0],-a[1]),i=Bu.transform(i,[1,0,0,1,a[0],a[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),zg(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),n=t.createPattern(l.canvas,"no-repeat");const c=new DOMMatrix(i);n.setTransform(c)}else zg(t,this._bbox),n=this._createGradient(t);return n}}function qg(t,e,i,s,n,a,r,o){const l=e.coords,h=e.colors,c=t.data,d=4*t.width;let u;l[i+1]>l[s+1]&&(u=i,i=s,s=u,u=a,a=r,r=u),l[s+1]>l[n+1]&&(u=s,s=n,n=u,u=r,r=o,o=u),l[i+1]>l[s+1]&&(u=i,i=s,s=u,u=a,a=r,r=u);const p=(l[i]+e.offsetX)*e.scaleX,g=(l[i+1]+e.offsetY)*e.scaleY,f=(l[s]+e.offsetX)*e.scaleX,m=(l[s+1]+e.offsetY)*e.scaleY,v=(l[n]+e.offsetX)*e.scaleX,w=(l[n+1]+e.offsetY)*e.scaleY;if(g>=w)return;const b=h[a],y=h[a+1],A=h[a+2],_=h[r],x=h[r+1],k=h[r+2],S=h[o],M=h[o+1],E=h[o+2],C=Math.round(g),T=Math.round(w);let P,D,R,I,L,F,N,W;for(let B=C;B<=T;B++){if(B<m){const t=B<g?0:(g-B)/(g-m);P=p-(p-f)*t,D=b-(b-_)*t,R=y-(y-x)*t,I=A-(A-k)*t}else{let t;t=B>w?1:m===w?0:(m-B)/(m-w),P=f-(f-v)*t,D=_-(_-S)*t,R=x-(x-M)*t,I=k-(k-E)*t}let t;t=B<g?0:B>w?1:(g-B)/(g-w),L=p-(p-v)*t,F=b-(b-S)*t,N=y-(y-M)*t,W=A-(A-E)*t;const e=Math.round(Math.min(P,L)),i=Math.round(Math.max(P,L));let s=d*B+4*e;for(let n=e;n<=i;n++)t=(P-n)/(P-L),t<0?t=0:t>1&&(t=1),c[s++]=D-(D-F)*t|0,c[s++]=R-(R-N)*t|0,c[s++]=I-(I-W)*t|0,c[s++]=255}}function Xg(t,e,i){const s=e.coords,n=e.colors;let a,r;switch(e.type){case"lattice":const o=e.verticesPerRow,l=Math.floor(s.length/o)-1,h=o-1;for(a=0;a<l;a++){let e=a*o;for(let a=0;a<h;a++,e++)qg(t,i,s[e],s[e+1],s[e+o],n[e],n[e+1],n[e+o]),qg(t,i,s[e+o+1],s[e+1],s[e+o],n[e+o+1],n[e+1],n[e+o])}break;case"triangles":for(a=0,r=s.length;a<r;a+=3)qg(t,i,s[a],s[a+1],s[a+2],n[a],n[a+1],n[a+2]);break;default:throw new Error("illegal figure")}}class Yg extends Vg{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],this.matrix=null}_createMeshCanvas(t,e,i){const s=Math.floor(this._bounds[0]),n=Math.floor(this._bounds[1]),a=Math.ceil(this._bounds[2])-s,r=Math.ceil(this._bounds[3])-n,o=Math.min(Math.ceil(Math.abs(a*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(r*t[1]*1.1)),3e3),h=a/o,c=r/l,d={coords:this._coords,colors:this._colors,offsetX:-s,offsetY:-n,scaleX:1/h,scaleY:1/c},u=o+4,p=l+4,g=i.getCanvas("mesh",u,p),f=g.context,m=f.createImageData(o,l);if(e){const t=m.data;for(let i=0,s=t.length;i<s;i+=4)t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=255}for(const v of this._figures)Xg(m,v,d);return f.putImageData(m,2,2),{canvas:g.canvas,offsetX:s-2*h,offsetY:n-2*c,scaleX:h,scaleY:c}}isModifyingCurrentTransform(){return!0}getPattern(t,e,i,s){zg(t,this._bbox);const n=new Float32Array(2);if(s===$g)Bu.singularValueDecompose2dScale(dp(t),n);else if(this.matrix){Bu.singularValueDecompose2dScale(this.matrix,n);const[t,i]=n;Bu.singularValueDecompose2dScale(e.baseTransform,n),n[0]*=t,n[1]*=i}else Bu.singularValueDecompose2dScale(e.baseTransform,n);const a=this._createMeshCanvas(n,s===$g?null:this._background,e.cachedCanvases);return s!==$g&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(a.offsetX,a.offsetY),t.scale(a.scaleX,a.scaleY),t.createPattern(a.canvas,"no-repeat")}}class Kg extends Vg{getPattern(){return"hotpink"}}const Qg=class t{constructor(t,e,i,s){this.color=t[1],this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.ctx=e,this.canvasGraphicsFactory=i,this.baseTransform=s}createPatternCanvas(t,e){var i,s;const{bbox:n,operatorList:a,paintType:r,tilingType:o,color:l,canvasGraphicsFactory:h}=this;let{xstep:c,ystep:d}=this;c=Math.abs(c),d=Math.abs(d);const u=n[0],p=n[1],g=n[2],f=n[3],m=g-u,v=f-p,w=new Float32Array(2);Bu.singularValueDecompose2dScale(this.matrix,w);const[b,y]=w;Bu.singularValueDecompose2dScale(this.baseTransform,w);const A=b*w[0],_=y*w[1];let x=m,k=v,S=!1,M=!1;const E=Math.ceil(c*A),C=Math.ceil(d*_);E>=Math.ceil(m*A)?x=c:S=!0,C>=Math.ceil(v*_)?k=d:M=!0;const T=this.getSizeAndScale(x,this.ctx.canvas.width,A),P=this.getSizeAndScale(k,this.ctx.canvas.height,_),D=t.cachedCanvases.getCanvas("pattern",T.size,P.size),R=D.context,I=h.createCanvasGraphics(R,e);if(I.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(I,r,l),R.translate(-T.scale*u,-P.scale*p),I.transform(0,T.scale,0,0,P.scale,0,0),R.save(),null==(i=I.dependencyTracker)||i.save(),this.clipBbox(I,u,p,g,f),I.baseTransform=dp(I.ctx),I.executeOperatorList(a),I.endDrawing(),null==(s=I.dependencyTracker)||s.restore(),R.restore(),S||M){const e=D.canvas;S&&(x=c),M&&(k=d);const i=this.getSizeAndScale(x,this.ctx.canvas.width,A),s=this.getSizeAndScale(k,this.ctx.canvas.height,_),n=i.size,a=s.size,r=t.cachedCanvases.getCanvas("pattern-workaround",n,a),o=r.context,l=S?Math.floor(m/c):0,h=M?Math.floor(v/d):0;for(let t=0;t<=l;t++)for(let i=0;i<=h;i++)o.drawImage(e,n*t,a*i,n,a,0,0,n,a);return{canvas:r.canvas,scaleX:i.scale,scaleY:s.scale,offsetX:u,offsetY:p}}return{canvas:D.canvas,scaleX:T.scale,scaleY:P.scale,offsetX:u,offsetY:p}}getSizeAndScale(e,i,s){const n=Math.max(t.MAX_PATTERN_SIZE,i);let a=Math.ceil(e*s);return a>=n?a=n:s=a/e,{scale:s,size:a}}clipBbox(t,e,i,s,n){const a=s-e,r=n-i;t.ctx.rect(e,i,a,r),Bu.axialAlignedBoundingBox([e,i,s,n],dp(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){const s=t.ctx,n=t.current;switch(e){case 1:const{fillStyle:t,strokeStyle:a}=this.ctx;s.fillStyle=n.fillColor=t,s.strokeStyle=n.strokeColor=a;break;case 2:s.fillStyle=s.strokeStyle=i,n.fillColor=n.strokeColor=i;break;default:throw new Ru(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,i,s,n){let a=i;s!==$g&&(a=Bu.transform(a,e.baseTransform),this.matrix&&(a=Bu.transform(a,this.matrix)));const r=this.createPatternCanvas(e,n);let o=new DOMMatrix(a);o=o.translate(r.offsetX,r.offsetY),o=o.scale(1/r.scaleX,1/r.scaleY);const l=t.createPattern(r.canvas,"repeat");return l.setTransform(o),l}};$d(Qg,"MAX_PATTERN_SIZE",3e3);let Jg=Qg;function Zg({src:t,srcPos:e=0,dest:i,width:s,height:n,nonBlackColor:a=4294967295,inverseDecode:r=!1}){const o=Nu.isLittleEndian?4278190080:255,[l,h]=r?[a,o]:[o,a],c=s>>3,d=7&s,u=t.length;i=new Uint32Array(i.buffer);let p=0;for(let g=0;g<n;g++){for(const n=e+c;e<n;e++){const s=e<u?t[e]:255;i[p++]=128&s?h:l,i[p++]=64&s?h:l,i[p++]=32&s?h:l,i[p++]=16&s?h:l,i[p++]=8&s?h:l,i[p++]=4&s?h:l,i[p++]=2&s?h:l,i[p++]=1&s?h:l}if(0===d)continue;const s=e<u?t[e++]:255;for(let t=0;t<d;t++)i[p++]=s&1<<7-t?h:l}return{srcPos:e,destPos:p}}const tf=16,ef=new DOMMatrix,sf=new Float32Array(2),nf=new Float32Array([1/0,1/0,-1/0,-1/0]);class af{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let s;return void 0!==this.cache[t]?(s=this.cache[t],this.canvasFactory.reset(s,e,i)):(s=this.canvasFactory.create(e,i),this.cache[t]=s),s}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function rf(t,e,i,s,n,a,r,o,l,h){const[c,d,u,p,g,f]=dp(t);if(0===d&&0===u){const m=r*c+g,v=Math.round(m),w=o*p+f,b=Math.round(w),y=(r+l)*c+g,A=Math.abs(Math.round(y)-v)||1,_=(o+h)*p+f,x=Math.abs(Math.round(_)-b)||1;return t.setTransform(Math.sign(c),0,0,Math.sign(p),v,b),t.drawImage(e,i,s,n,a,0,0,A,x),t.setTransform(c,d,u,p,g,f),[A,x]}if(0===c&&0===p){const m=o*u+g,v=Math.round(m),w=r*d+f,b=Math.round(w),y=(o+h)*u+g,A=Math.abs(Math.round(y)-v)||1,_=(r+l)*d+f,x=Math.abs(Math.round(_)-b)||1;return t.setTransform(0,Math.sign(d),Math.sign(u),0,v,b),t.drawImage(e,i,s,n,a,0,0,x,A),t.setTransform(c,d,u,p,g,f),[x,A]}return t.drawImage(e,i,s,n,a,r,o,l,h),[Math.hypot(c,d)*l,Math.hypot(u,p)*h]}class of{constructor(t,e,i){$d(this,"alphaIsShape",!1),$d(this,"fontSize",0),$d(this,"fontSizeScale",1),$d(this,"textMatrix",null),$d(this,"textMatrixScale",1),$d(this,"fontMatrix",ou),$d(this,"leading",0),$d(this,"x",0),$d(this,"y",0),$d(this,"lineX",0),$d(this,"lineY",0),$d(this,"charSpacing",0),$d(this,"wordSpacing",0),$d(this,"textHScale",1),$d(this,"textRenderingMode",0),$d(this,"textRise",0),$d(this,"fillColor","#000000"),$d(this,"strokeColor","#000000"),$d(this,"patternFill",!1),$d(this,"patternStroke",!1),$d(this,"fillAlpha",1),$d(this,"strokeAlpha",1),$d(this,"lineWidth",1),$d(this,"activeSMask",null),$d(this,"transferMaps","none"),null==i||i(this),this.clipBox=new Float32Array([0,0,t,e]),this.minMax=nf.slice()}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t}getPathBoundingBox(t=Ug,e=null){const i=this.minMax.slice();if(t===Hg){e||_u("Stroke bounding box must include transform."),Bu.singularValueDecompose2dScale(e,sf);const t=sf[0]*this.lineWidth/2,s=sf[1]*this.lineWidth/2;i[0]-=t,i[1]-=s,i[2]+=t,i[3]+=s}return i}updateClipFromPath(){const t=Bu.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(nf,0)}getClippedPathBoundingBox(t=Ug,e=null){return Bu.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function lf(t,e){if(e instanceof ImageData)return void t.putImageData(e,0,0);const i=e.height,s=e.width,n=i%tf,a=(i-n)/tf,r=0===n?a:a+1,o=t.createImageData(s,tf);let l,h=0;const c=e.data,d=o.data;let u,p,g,f;if(e.kind===gu.GRAYSCALE_1BPP){const e=c.byteLength,i=new Uint32Array(d.buffer,0,d.byteLength>>2),f=i.length,m=s+7>>3,v=4294967295,w=Nu.isLittleEndian?4278190080:255;for(u=0;u<r;u++){for(g=u<a?tf:n,l=0,p=0;p<g;p++){const t=e-h;let n=0;const a=t>m?s:8*t-7,r=-8&a;let o=0,d=0;for(;n<r;n+=8)d=c[h++],i[l++]=128&d?v:w,i[l++]=64&d?v:w,i[l++]=32&d?v:w,i[l++]=16&d?v:w,i[l++]=8&d?v:w,i[l++]=4&d?v:w,i[l++]=2&d?v:w,i[l++]=1&d?v:w;for(;n<a;n++)0===o&&(d=c[h++],o=128),i[l++]=d&o?v:w,o>>=1}for(;l<f;)i[l++]=0;t.putImageData(o,0,u*tf)}}else if(e.kind===gu.RGBA_32BPP){for(p=0,f=s*tf*4,u=0;u<a;u++)d.set(c.subarray(h,h+f)),h+=f,t.putImageData(o,0,p),p+=tf;u<r&&(f=s*n*4,d.set(c.subarray(h,h+f)),t.putImageData(o,0,p))}else{if(e.kind!==gu.RGB_24BPP)throw new Error(`bad image kind: ${e.kind}`);for(g=tf,f=s*g,u=0;u<r;u++){for(u>=a&&(g=n,f=s*g),l=0,p=f;p--;)d[l++]=c[h++],d[l++]=c[h++],d[l++]=c[h++],d[l++]=255;t.putImageData(o,0,u*tf)}}}function hf(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);const i=e.height,s=e.width,n=i%tf,a=(i-n)/tf,r=0===n?a:a+1,o=t.createImageData(s,tf);let l=0;const h=e.data,c=o.data;for(let d=0;d<r;d++){const e=d<a?tf:n;({srcPos:l}=Zg({src:h,srcPos:l,dest:c,width:s,height:e,nonBlackColor:0})),t.putImageData(o,0,d*tf)}}function cf(t,e){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of i)void 0!==t[s]&&(e[s]=t[s]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function df(t){t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miter
1Limit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0);const{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}function uf(t,e){if(e)return!0;Bu.singularValueDecompose2dScale(t,sf);const i=Math.fround(gp.pixelRatio*Ku.PDF_TO_CSS_UNITS);return sf[0]<=i&&sf[1]<=i}const pf=["butt","round","square"],gf=["miter","round","bevel"],ff={},mf={};Ys=new WeakSet,Ks=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)},Qs=function(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}},Js=function(t,e,i){const s=new Path2D;return s.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),s};let vf=class t{constructor(t,e,i,s,n,{optionalContentConfig:a,markedContentStack:r=null},o,l,h){Gd(this,Ys),this.ctx=t,this.current=new of(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=i,this.canvasFactory=s,this.filterFactory=n,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=r||[],this.optionalContentConfig=a,this.cachedCanvases=new af(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=o,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=null!=h?h:null}getObject(t,e,i=null){var s;return"string"==typeof e?(null==(s=this.dependencyTracker)||s.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):i}beginDrawing({transform:t,viewport:e,transparency:i=!1,background:s=null}){const n=this.ctx.canvas.width,a=this.ctx.canvas.height,r=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,n,a),this.ctx.fillStyle=r,i){const t=this.cachedCanvases.getCanvas("transparent",n,a);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...dp(this.compositeCtx))}this.ctx.save(),df(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=dp(this.ctx)}executeOperatorList(t,e,i,s,n){var a,r;const o=t.argsArray,l=t.fnArray;let h=e||0;const c=o.length;if(c===h)return h;const d=c-h>10&&"function"==typeof i,u=d?Date.now()+15:0;let p=0;const g=this.commonObjs,f=this.objs;let m,v;for(;;){if(void 0!==s&&h===s.nextBreakPoint)return s.breakIt(h,i),h;if(!n||n(h))if(m=l[h],v=null!=(a=o[h])?a:null,m!==vu.dependency)null===v?this[m](h):this[m](h,...v);else for(const t of v){null==(r=this.dependencyTracker)||r.recordNamedData(t,h);const e=t.startsWith("g_")?g:f;if(!e.has(t))return e.get(t,i),h}if(h++,h===c)return h;if(d&&++p>10){if(Date.now()>u)return i(),h;p=0}}}endDrawing(){Xd(this,Ys,Ks).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),Xd(this,Ys,Qs).call(this)}_scaleImage(t,e){var i,s;const n=null!=(i=t.width)?i:t.displayWidth,a=null!=(s=t.height)?s:t.displayHeight;let r,o,l=Math.max(Math.hypot(e[0],e[1]),1),h=Math.max(Math.hypot(e[2],e[3]),1),c=n,d=a,u="prescale1";for(;l>2&&c>1||h>2&&d>1;){let e=c,i=d;l>2&&c>1&&(e=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c/2),l/=c/e),h>2&&d>1&&(i=d>
vendor: 5,174 bytes, line 1
1=16384?Math.floor(d/2)-1||1:Math.ceil(d)/2,h/=d/i),r=this.cachedCanvases.getCanvas(u,e,i),o=r.context,o.clearRect(0,0,e,i),o.drawImage(t,0,0,c,d,0,0,e,i),t=r.canvas,c=e,d=i,u="prescale1"===u?"prescale2":"prescale1"}return{img:t,paintWidth:c,paintHeight:d}}_createMaskCanvas(t,e){var i,s;const n=this.ctx,{width:a,height:r}=e,o=this.current.fillColor,l=this.current.patternFill,h=dp(n);let c,d,u,p;if((e.bitmap||e.data)&&e.count>1){const s=e.bitmap||e.data.buffer;d=JSON.stringify(l?h:[h.slice(0,4),o]),c=this._cachedBitmapsMap.get(s),c||(c=new Map,this._cachedBitmapsMap.set(s,c));const n=c.get(d);if(n&&!l){const e=Math.round(Math.min(h[0],h[2])+h[4]),s=Math.round(Math.min(h[1],h[3])+h[5]);return null==(i=this.dependencyTracker)||i.recordDependencies(t,jg),{canvas:n,offsetX:e,offsetY:s}}u=n}u||(p=this.cachedCanvases.getCanvas("maskCanvas",a,r),hf(p.context,e));let g=Bu.transform(h,[1/a,0,0,-1/r,0,0]);g=Bu.transform(g,[1,0,0,1,0,-r]);const f=nf.slice();Bu.axialAlignedBoundingBox([0,0,a,r],g,f);const[m,v,w,b]=f,y=Math.round(w-m)||1,A=Math.round(b-v)||1,_=this.cachedCanvases.getCanvas("fillCanvas",y,A),x=_.context,k=m,S=v;x.translate(-k,-S),x.transform(...g),u||(u=this._scaleImage(p.canvas,up(x)),u=u.img,c&&l&&c.set(d,u)),x.imageSmoothingEnabled=uf(dp(x),e.interpolate),rf(x,u,0,0,u.width,u.height,0,0,a,r),x.globalCompositeOperation="source-in";const M=Bu.transform(up(x),[1,0,0,1,-k,-S]);return x.fillStyle=l?o.getPattern(n,this,M,Ug,t):o,x.fillRect(0,0,a,r),c&&!l&&(this.cachedCanvases.delete("fillCanvas"),c.set(d,_.canvas)),null==(s=this.dependencyTracker)||s.recordDependencies(t,jg),{canvas:_.canvas,offsetX:Math.round(k),offsetY:Math.round(S)}}setLineWidth(t,e){var i;null==(i=this.dependencyTracker)||i.recordSimpleData("lineWidth",t),e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(t,e){var i;null==(i=this.dependencyTracker)||i.recordSimpleData("lineCap",t),this.ctx.lineCap=pf[e]}setLineJoin(t,e){var i;null==(i=this.dependencyTracker)||i.recordSimpleData("lineJoin",t),this.ctx.lineJoin=gf[e]}setMiterLimit(t,e){var i;null==(i=this.dependencyTracker)||i.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,i){var s;null==(s=this.dependencyTracker)||s.recordSimpleData("dash",t);const n=this.ctx;void 0!==n.setLineDash&&(n.setLineDash(e),n.lineDashOffset=i)}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){var i,s,n,a,r;for(const[o,l]of e)switch(o){case"LW":this.setLineWidth(t,l);break;case"LC":this.setLineCap(t,l);break;case"LJ":this.setLineJoin(t,l);break;case"ML":this.setMiterLimit(t,l);break;case"D":this.setDash(t,l[0],l[1]);break;case"RI":this.setRenderingIntent(t,l);break;case"FL":this.setFlatness(t,l);break;case"Font":this.setFont(t,l[0],l[1]);break;case"CA":null==(i=this.dependencyTracker)||i.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=l;break;case"ca":null==(s=this.dependencyTracker)||s.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=l;break;case"BM":null==(n=this.dependencyTracker)||n.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=l;break;case"SMask":null==(a=this.dependencyTracker)||a.recordSimpleData("SMask",t),this.current.activeSMask=l?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":null==(r=this.dependencyTracker)||r.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(l)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(t){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,i=this.ctx.canvas.height,s="smaskGroupAt"+this.groupLevel,n=this.cachedCanvases.getCanvas(s,e,i);this.suspendedCtx=this.ctx;const a=this.ctx=n.context;a.setTransform(this.suspendedCtx.getTransform()),cf(this.suspendedCtx,a),function(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()}
1,t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(t,i){e.translate(t,i),this.__originalTranslate(t,i)},t.scale=function(t,i){e.scale(t,i),this.__originalScale(t,i)},t.transform=function(t,i,s,n,a,r){e.transform(t,i,s,n,a,r),this.__originalTransform(t,i,s,n,a,r)},t.setTransform=function(t,i,s,n,a,r){e.setTransform(t,i,s,n,a,r),this.__originalSetTransform(t,i,s,n,a,r)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(t){e.rotate(t),this.__originalRotate(t)},t.clip=function(t){e.clip(t),this.__originalClip(t)},t.moveTo=function(t,i){e.moveTo(t,i),this.__originalMoveTo(t,i)},t.lineTo=function(t,i){e.lineTo(t,i),this.__originalLineTo(t,i)},t.bezierCurveTo=function(t,i,s,n,a,r){e.bezierCurveTo(t,i,s,n,a,r),this.__originalBezierCurveTo(t,i,s,n,a,r)},t.rect=function(t,i,s,n){e.rect(t,i,s,n),this.__originalRect(t,i,s,n)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}(a,this.suspendedCtx),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),cf(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,i,s){const n=s[0],a=s[1],r=s[2]-n,o=s[3]-a;0!==r&&0!==o&&(this.genericComposeSMask(e.context,i,r,o,e.subtype,e.backdrop,e.transferMap,n,a,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,e,i,s,n,a,r,o,l,h,c){let d=t.canvas,u=o-h,p=l-c;if(a)if(u<0||p<0||u+i>d.width||p+s>d.height){const t=this.cachedCanvases.getCanvas("maskExtension",i,s),e=t.context;e.drawImage(d,-u,-p),e.globalCompositeOperation="destination-atop",e.fillStyle=a,e.fillRect(0,0,i,s),e.globalCompositeOperation="source-over",d=t.canvas,u=p=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const e=new Path2D;e.rect(u,p,i,s),t.clip(e),t.globalCompositeOperation="destination-atop",t.fillStyle=a,t.fillRect(u,p,i,s),t.restore()}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===n&&r?e.filter=this.filterFactory.addAlphaFilter(r):"Luminosity"===n&&(e.filter=this.filterFactory.addLuminosityFilter(r));const g=new Path2D;g.rect(o,l,i,s),e.clip(g),e.globalCompositeOperation="destination-in",e.drawImage(d,u,p,i,s,o,l,i,s),e.restore()}save(t){var e;this.inSMaskMode&&cf(this.ctx,this.suspendedCtx),this.ctx.save();const i=this.current;this.stateStack.push(i),this.current=i.clone(),null==(e=this.dependencyTracker)||e.save(t)}restore(t){var e;null==(e=this.dependencyTracker)||e.restore(t),0!==this.stateStack.length?(this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&cf(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null):this.inSMaskMode&&this.endSMaskMode()}transform(t,e,i,s,n,a,r){var o;null==(o=this.dependencyTracker)||o.recordIncrementalData("transform",t),this.ctx.transform(e,i,s,n,a,r),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i,s){let[n]=i;if(!s)return n||(n=i[0]=new Path2D),void this[e](t,n);if(null!==this.dependencyTracker){const i=e===vu.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,s[0]-i,s[2]+i,s[1]-i,s[3]+i).recordDependencies(t,["transform"])}if(!(n instanceof Path2D)){const t=i[0]=new Path2D;for(let e=0,i=n.length;e<i;)switch(n[e++]){case 0:t.moveTo(n[e++],n[e++]);break;case 1:t.lineTo(n[e++],n[e++]);break;case 2:t.bezierCurveTo(n[e++],n[e++],n[e++],n[e++],n[e++],n[e++]);break;case 3:t.closePath();break;default:Au(n[e-1])}n=t}Bu.axialAlignedBoundingBox(s,dp(this.ctx),this.current.minMax),this[e](t,n),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e,i=!0){var s;const n=this.ctx,a=this.current.strokeColor;if(n.globalAlpha=this.current.strokeAlpha,this.contentVisible)if("object"==typeof a&&(null==a?void 0:a.getPattern)){const i=a.isModifyingCurrentTransform()?n.getTransform():null;if(n.save(),n.strokeStyle=a.getPattern(n,this,up(n),Hg,t),i){const t=new Path2D;t.addPath(e,n.getTransform().invertSelf().multiplySelf(i)),e=t}
1this.rescaleAndStroke(e,!1),n.restore()}else this.rescaleAndStroke(e,!0);null==(s=this.dependencyTracker)||s.recordDependencies(t,Lg),i&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(Hg,dp(this.ctx))),n.globalAlpha=this.current.fillAlpha}closeStroke(t,e){this.stroke(t,e)}fill(t,e,i=!0){var s,n,a;const r=this.ctx,o=this.current.fillColor;let l=!1;if(this.current.patternFill){const i=o.isModifyingCurrentTransform()?r.getTransform():null;if(null==(s=this.dependencyTracker)||s.save(t),r.save(),r.fillStyle=o.getPattern(r,this,up(r),Ug,t),i){const t=new Path2D;t.addPath(e,r.getTransform().invertSelf().multiplySelf(i)),e=t}l=!0}const h=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==h&&(this.pendingEOFill?(r.fill(e,"evenodd"),this.pendingEOFill=!1):r.fill(e)),null==(n=this.dependencyTracker)||n.recordDependencies(t,Fg),l&&(r.restore(),null==(a=this.dependencyTracker)||a.restore(t)),i&&this.consumePath(t,e,h)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e)}eoFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}closeFillStroke(t,e){this.fillStroke(t,e)}closeEOFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}endPath(t,e){this.consumePath(t,e)}rawFillPath(t,e){var i;this.ctx.fill(e),null==(i=this.dependencyTracker)||i.recordDependencies(t,Wg).recordOperation(t)}clip(t){var e;null==(e=this.dependencyTracker)||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=ff}eoClip(t){var e;null==(e=this.dependencyTracker)||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=mf}beginText(t){var e;this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,null==(e=this.dependencyTracker)||e.recordOpenMarker(t).resetIncrementalData("sameLineText").resetIncrementalData("moveText",t)}endText(t){const e=this.pendingTextPaths,i=this.ctx;if(this.dependencyTracker){const{dependencyTracker:i}=this;void 0!==e&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",t),i.recordCloseMarker(t)}if(void 0!==e){const t=new Path2D,s=i.getTransform().invertSelf();for(const{transform:i,x:n,y:a,fontSize:r,path:o}of e)o&&t.addPath(o,new DOMMatrix(i).preMultiplySelf(s).translate(n,a).scale(r,-r));i.clip(t)}delete this.pendingTextPaths}setCharSpacing(t,e){var i;null==(i=this.dependencyTracker)||i.recordSimpleData("charSpacing",t),this.current.charSpacing=e}setWordSpacing(t,e){var i;null==(i=this.dependencyTracker)||i.recordSimpleData("wordSpacing",t),this.current.wordSpacing=e}setHScale(t,e){var i;null==(i=this.dependencyTracker)||i.recordSimpleData("hScale",t),this.current.textHScale=e/100}setLeading(t,e){var i;null==(i=this.dependencyTracker)||i.recordSimpleData("leading",t),this.current.leading=-e}setFont(t,e,i){var s,n;null==(s=this.dependencyTracker)||s.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);const a=this.commonObjs.get(e),r=this.current;if(!a)throw new Error(`Can't find font for ${e}`);if(r.fontMatrix=a.fontMatrix||ou,0===r.fontMatrix[0]||r.fontMatrix[3],i<0?(i=-i,r.fontDirection=-1):r.fontDirection=1,this.current.font=a,this.current.fontSize=i,a.isType3Font)return;const o=a.loadedName||"sans-serif",l=(null==(n=a.systemFontInfo)?void 0:n.css)||`"${o}", ${a.fallbackName}`;let h="normal";a.black?h="900":a.bold&&(h="bold");const c=a.italic?"italic":"normal";let d=i;i<16?d=16:i>100&&(d=100),this.current.fontSizeScale=i/d,this.ctx.font=`${c} ${h} ${d}px ${l}`}setTextRenderingMode(t,e){var i;null==(i=this.dependencyTracker)||i.recordSimpleData("textRenderingMode",t),this.current.textRenderingMode=e}setTextRise(t,e){var i;null==(i=this.dependencyTracker)||i.recordSimpleData("textRise",t),this.current.textRise=e}moveText(t,e,i){var s;null==(s=this.dependencyTracker)||s.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=i}setLeadingMoveText(t,e,i){this.setLeading(t,-i),this.moveText(t,e,i)}setTextMatrix(t,e){var i;null==(i=this.dependencyTracker)||i.recordSimpleData("textMatrix",t);const{current:s}=this;s.textMatrix=e,s.textMatrixScale=Math.hypot(e[0],e[1]),s.x=s.lineX=0,s.y=s.lineY=0}nextLine(t){var e,i;this.moveText(t,0,this.current.leading),null==(i=this.dependencyTracker)||i.recordIncrementalData("moveText",null!=(e=this.dependencyTracker.getSimpleIndex("leading"))?e:t)}paintChar(t,e,i,s,n,a){var r,o,l,h;const c=this.ctx,d=this.current,u=d.font,p=d.textRenderingMode,g=d.fontSize/d.fontSizeScale,f=3&p,m=!!(4&p),v=d.patternFill&&!u.missingFile,w=d.patternStroke&&!u.missingFile;let b;if((u.disableFontFace||m||v||w)&&!u.missingFile&&(b=u.getPathGenerator(this.commonObjs,e)),b&&(u.disableFontFace||v||w)){let e;if(c.save(),c.translate(i,s),c.scale(g,-g),null==(r=this.dependencyTracker)||r.recordCharacterBBox(t,c,u),0===f||2===f)if(n){e=c.getTransform(),c.setTransform(...n);const t=Xd(this,Ys,Js).call(this,b,e,n);c.fill(t)}else c.fill(b);if(1===f||2===f)if(a){e||(e=c.getTransform()),c.setTransform(...a);const{a:t,b:i,c:s,d:n}=e,r=Bu.inverseTransform(a),o=Bu.transform([t,i,s,n,0,0],r);Bu.singularValueDecompose2dScale(o,sf),c.lineWidth*=Math.max(sf[0],sf[1])/g,c.stroke(Xd(this,Ys,Js).call(this,b,e,a))}else c.lineWidth/=g,c.stroke(b);
1c.restore()}else 0!==f&&2!==f||(c.fillText(e,i,s),null==(o=this.dependencyTracker)||o.recordCharacterBBox(t,c,u,g,i,s,()=>c.measureText(e))),1!==f&&2!==f||(this.dependencyTracker&&(null==(l=this.dependencyTracker)||l.recordCharacterBBox(t,c,u,g,i,s,()=>c.measureText(e)).recordDependencies(t,Lg)),c.strokeText(e,i,s));m&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:dp(c),x:i,y:s,fontSize:g,path:b}),null==(h=this.dependencyTracker)||h.recordCharacterBBox(t,c,u,g,i,s))}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let i=!1;for(let s=3;s<e.length;s+=4)if(e[s]>0&&e[s]<255){i=!0;break}return Mu(this,"isFontSubpixelAAEnabled",i)}showText(t,e){var i,s,n,a;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,Bg).resetBBox(t),4&this.current.textRenderingMode&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());const r=this.current,o=r.font;if(o.isType3Font)return this.showType3Text(t,e),void(null==(i=this.dependencyTracker)||i.recordShowTextOperation(t));const l=r.fontSize;if(0===l)return void(null==(s=this.dependencyTracker)||s.recordOperation(t));const h=this.ctx,c=r.fontSizeScale,d=r.charSpacing,u=r.wordSpacing,p=r.fontDirection,g=r.textHScale*p,f=e.length,m=o.vertical,v=m?1:-1,w=o.defaultVMetrics,b=l*r.fontMatrix[0],y=0===r.textRenderingMode&&!o.disableFontFace&&!r.patternFill;let A,_;if(h.save(),r.textMatrix&&h.transform(...r.textMatrix),h.translate(r.x,r.y+r.textRise),p>0?h.scale(g,-1):h.scale(g,1),r.patternFill){h.save();const e=r.fillColor.getPattern(h,this,up(h),Ug,t);A=dp(h),h.restore(),h.fillStyle=e}if(r.patternStroke){h.save();const e=r.strokeColor.getPattern(h,this,up(h),Hg,t);_=dp(h),h.restore(),h.strokeStyle=e}let x=r.lineWidth;const k=r.textMatrixScale;if(0===k||0===x){const t=3&r.textRenderingMode;1!==t&&2!==t||(x=this.getSinglePixelWidth())}else x/=k;if(1!==c&&(h.scale(c,c),x/=c),h.lineWidth=x,o.isInvalidPDFjsFont){const i=[];let s=0;for(const t of e)i.push(t.unicode),s+=t.width;const n=i.join("");if(h.fillText(n,0,0),null!==this.dependencyTracker){const e=h.measureText(n);this.dependencyTracker.recordBBox(t,this.ctx,-e.actualBoundingBoxLeft,e.actualBoundingBoxRight,-e.actualBoundingBoxAscent,e.actualBoundingBoxDescent).recordShowTextOperation(t)}return r.x+=s*b*g,h.restore(),void this.compose()}let S,M=0;for(S=0;S<f;++S){const i=e[S];if("number"==typeof i){M+=v*i*l/1e3;continue}let s=!1;const a=(i.isSpace?u:0)+d,r=i.fontChar,g=i.accent;let f,x,k,E=i.width;if(m){const t=i.vmetric||w,e=-(i.vmetric?t[1]:.5*E)*b,s=t[2]*b;E=t?-t[0]:E,f=e/c,x=(M+s)/c}else f=M/c,x=0;if(o.remeasure&&E>0){k=h.measureText(r);const t=1e3*k.width/l*c;if(E<t&&this.isFontSubpixelAAEnabled){const e=E/t;s=!0,h.save(),h.scale(e,1),f/=e}else E!==t&&(f+=(E-t)/2e3*l/c)}if(this.contentVisible&&(i.isInFont||o.missingFile))if(y&&!g)h.fillText(r,f,x),null==(n=this.dependencyTracker)||n.recordCharacterBBox(t,h,k?{bbox:null}:o,l/c,f,x,()=>null!=k?k:h.measureText(r));else if(this.paintChar(t,r,f,x,A,_),g){const e=f+l*g.offset.x/c,i=x-l*g.offset.y/c;this.paintChar(t,g.fontChar,e,i,A,_)}
1M+=m?E*b-a*p:E*b+a*p,s&&h.restore()}m?r.y-=M:r.x+=M*g,h.restore(),this.compose(),null==(a=this.dependencyTracker)||a.recordShowTextOperation(t)}showType3Text(t,e){const i=this.ctx,s=this.current,n=s.font,a=s.fontSize,r=s.fontDirection,o=n.vertical?1:-1,l=s.charSpacing,h=s.wordSpacing,c=s.textHScale*r,d=s.fontMatrix||ou,u=e.length;let p,g,f,m;if(3===s.textRenderingMode||0===a)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,i.save(),s.textMatrix&&i.transform(...s.textMatrix),i.translate(s.x,s.y+s.textRise),i.scale(c,r);const v=this.dependencyTracker;for(this.dependencyTracker=v?new Ig(v,t):null,p=0;p<u;++p){if(g=e[p],"number"==typeof g){m=o*g*a/1e3,this.ctx.translate(m,0),s.x+=m*c;continue}const t=(g.isSpace?h:0)+l,r=n.charProcOperatorList[g.operatorListId];r?this.contentVisible&&(this.save(),i.scale(a,a),i.transform(...d),this.executeOperatorList(r),this.restore()):Au(g.operatorListId);const u=[g.width,0];Bu.applyTransform(u,d),f=u[0]*a+t,i.translate(f,0),s.x+=f*c}i.restore(),v&&(this.dependencyTracker=v)}setCharWidth(t,e,i){}
1setCharWidthAndBounds(t,e,i,s,n,a,r){var o;const l=new Path2D;l.rect(s,n,a-s,r-n),this.ctx.clip(l),null==(o=this.dependencyTracker)||o.recordBBox(t,this.ctx,s,a,n,r).recordClipBox(t,this.ctx,s,a,n,r),this.endPath(t)}getColorN_Pattern(e,i){let s;if("TilingPattern"===i[0]){const e=this.baseTransform||dp(this.ctx),n={createCanvasGraphics:(e,i)=>new t(e,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new Ig(this.dependencyTracker,i,!0):null)};s=new Jg(i,this.ctx,n,e)}else s=this._getPattern(e,i[1],i[2]);return s}setStrokeColorN(t,...e){var i;null==(i=this.dependencyTracker)||i.recordSimpleData("strokeColor",t),this.current.strokeColor=this.getColorN_Pattern(t,e),this.current.patternStroke=!0}setFillColorN(t,...e){var i;null==(i=this.dependencyTracker)||i.recordSimpleData("fillColor",t),this.current.fillColor=this.getColorN_Pattern(t,e),this.current.patternFill=!0}setStrokeRGBColor(t,e){var i;null==(i=this.dependencyTracker)||i.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}
1setStrokeTransparent(t){var e;null==(e=this.dependencyTracker)||e.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e){var i;null==(i=this.dependencyTracker)||i.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1}setFillTransparent(t){var e;null==(e=this.dependencyTracker)||e.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e,i=null){let s;return this.cachedPatterns.has(e)?s=this.cachedPatterns.get(e):(s=function(t){switch(t[0]){case"RadialAxial":return new Gg(t);case"Mesh":return new Yg(t);case"Dummy":return new Kg}throw new Error(`Unknown IR type: ${t[0]}`)}(this.getObject(t,e)),this.cachedPatterns.set(e,s)),i&&(s.matrix=i),s}shadingFill(t,e){var i;if(!this.contentVisible)return;const s=this.ctx;this.save(t);const n=this._getPattern(t,e);s.fillStyle=n.getPattern(s,this,up(s),$g,t);const a=up(s);if(a){const{width:t,height:e}=s.canvas,i=nf.slice();Bu.axialAlignedBoundingBox([0,0,t,e],a,i);const[n,r,o,l]=i;this.ctx.fillRect(n,r,o-n,l-r)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);null==(i=this.dependencyTracker)||i.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,Og).recordDependencies(t,Fg).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){_u("Should not call beginInlineImage")}beginImageData(){_u("Should not call beginImageData")}
1paintFormXObjectBegin(t,e,i){var s;if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=dp(this.ctx),i)){Bu.axialAlignedBoundingBox(i,this.baseTransform,this.current.minMax);const[e,n,a,r]=i,o=new Path2D;o.rect(e,n,a-e,r-n),this.ctx.clip(o),null==(s=this.dependencyTracker)||s.recordClipBox(t,this.ctx,e,a,n,r),this.endPath(t)}}paintFormXObjectEnd(t){this.contentVisible&&(this.restore(t),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t,e){var i;if(!this.contentVisible)return;this.save(t),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const s=this.ctx;e.isolated,e.knockout;const n=dp(s);if(e.matrix&&s.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let a=nf.slice();Bu.axialAlignedBoundingBox(e.bbox,dp(s),a);const r=[0,0,s.canvas.width,s.canvas.height];a=Bu.intersect(a,r)||[0,0,0,0];const o=Math.floor(a[0]),l=Math.floor(a[1]),h=Math.max(Math.ceil(a[2])-o,1),c=Math.max(Math.ceil(a[3])-l,1);this.current.startNewPathAndClipBox([0,0,h,c]);let d="groupAt"+this.groupLevel;e.smask&&(d+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(d,h,c),p=u.context;p.translate(-o,-l),p.transform(...n);let g=new Path2D;const[f,m,v,w]=e.bbox;if(g.rect(f,m,v-f,w-m),e.matrix){const t=new Path2D;t.addPath(g,new DOMMatrix(e.matrix)),g=t}p.clip(g),e.smask&&this.smaskStack.push({canvas:u.canvas,context:p,offsetX:o,offsetY:l,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}),e.smask&&!this.dependencyTracker||(s.setTransform(1,0,0,1,0,0),s.translate(o,l),s.save()),cf(s,p),this.ctx=p,null==(i=this.dependencyTracker)||i.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(s),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(s),this.groupLevel++}endGroup(t,e){var i;if(!this.contentVisible)return;this.groupLevel--;const s=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,null==(i=this.dependencyTracker)||i.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();const e=dp(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...e);const i=nf.slice();Bu.axialAlignedBoundingBox([0,0,s.canvas.width,s.canvas.height],e,i),this.ctx.drawImage(s.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(t,e,i,s,n,a){if(Xd(this,Ys,Ks).call(this),df(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),i){const n=i[2]-i[0],r=i[3]-i[1];if(a&&this.annotationCanvasMap){(s=s.slice())[4]-=i[0],s[5]-=i[1],(i=i.slice())[0]=i[1]=0,i[2]=n,i[3]=r,Bu.singularValueDecompose2dScale(dp(this.ctx),sf);const{viewportScale:t}=this,a=Math.ceil(n*this.outputScaleX*t),o=Math.ceil(r*this.outputScaleY*t);this.annotationCanvas=this.canvasFactory.create(a,o);const{canvas:l,context:h}=this.annotationCanvas;this.annotationCanvasMap.set(e,l),this.annotationCanvas.savedCtx=this.ctx,this.ctx=h,this.ctx.save(),this.ctx.setTransform(sf[0],0,0,-sf[1],0,r*sf[1]),df(this.ctx)}else{df(this.ctx),this.endPath(t);const e=new Path2D;e.rect(i[0],i[1],n,r),this.ctx.clip(e)}}this.current=new of(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(t,...s),this.transform(t,...n)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),Xd(this,Ys,Qs).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t,e){var i;if(!this.contentVisible)return;const s=e.count;(e=this.getObject(t,e.data,e)).count=s;const n=this.ctx,a=this._createMaskCanvas(t,e),r=a.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(r,a.offsetX,a.offsetY),null==(i=this.dependencyTracker)||i.resetBBox(t).recordBBox(t,this.ctx,a.offsetX,a.offsetX+r.width,a.offsetY,a.offsetY+r.height).recordOperation(t),n.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,i,s=0,n=0,a,r){var o,l,h;if(!this.contentVisible)return;e=this.getObject(t,e.data,e);const c=this.ctx;c.save();const d=dp(c);c.transform(i,s,n,a,0,0);const u=this._createMaskCanvas(t,e);c.setTransform(1,0,0,1,u.offsetX-d[4],u.offsetY-d[5]),null==(o=this.dependencyTracker)||o.resetBBox(t);for(let p=0,g=r.length;p<g;p+=2){const e=Bu.transform(d,[i,s,n,a,r[p],r[p+1]]);c.drawImage(u.canvas,e[4],e[5]),null==(l=this.dependencyTracker)||l.recordBBox(t,this.ctx,e[4],e[4]+u.canvas.width,e[5],e[5]+u.canvas.height)}
1c.restore(),this.compose(),null==(h=this.dependencyTracker)||h.recordOperation(t)}paintImageMaskXObjectGroup(t,e){var i,s,n;if(!this.contentVisible)return;const a=this.ctx,r=this.current.fillColor,o=this.current.patternFill;null==(i=this.dependencyTracker)||i.resetBBox(t).recordDependencies(t,jg);for(const l of e){const{data:e,width:i,height:n,transform:h}=l,c=this.cachedCanvases.getCanvas("maskCanvas",i,n),d=c.context;d.save(),hf(d,this.getObject(t,e,l)),d.globalCompositeOperation="source-in",d.fillStyle=o?r.getPattern(d,this,up(a),Ug,t):r,d.fillRect(0,0,i,n),d.restore(),a.save(),a.transform(...h),a.scale(1,-1),rf(a,c.canvas,0,0,i,n,0,-1,1,1),null==(s=this.dependencyTracker)||s.recordBBox(t,a,0,i,0,n),a.restore()}this.compose(),null==(n=this.dependencyTracker)||n.recordOperation(t)}paintImageXObject(t,e){if(!this.contentVisible)return;const i=this.getObject(t,e);i&&this.paintInlineImageXObject(t,i)}paintImageXObjectRepeat(t,e,i,s,n){if(!this.contentVisible)return;const a=this.getObject(t,e);if(!a)return;const r=a.width,o=a.height,l=[];for(let h=0,c=n.length;h<c;h+=2)l.push({transform:[i,0,0,s,n[h],n[h+1]],x:0,y:0,w:r,h:o});this.paintInlineImageXObjectGroup(t,a,l)}applyTransferMapsToCanvas(t){return"none"!==this.current.transferMaps&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if("none"===this.current.transferMaps)return t.bitmap;const{bitmap:e,width:i,height:s}=t,n=this.cachedCanvases.getCanvas("inlineImage",i,s),a=n.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",n.canvas}paintInlineImageXObject(t,e){var i;if(!this.contentVisible)return;const s=e.width,n=e.height,a=this.ctx;this.save(t);const{filter:r}=a;let o;if("none"!==r&&""!==r&&(a.filter="none"),a.scale(1/s,-1/n),e.bitmap)o=this.applyTransferMapsToBitmap(e);else if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)o=e;else{const t=this.cachedCanvases.getCanvas("inlineImage",s,n).context;lf(t,e),o=this.applyTransferMapsToCanvas(t)}const l=this._scaleImage(o,up(a));a.imageSmoothingEnabled=uf(dp(a),e.interpolate),null==(i=this.dependencyTracker)||i.resetBBox(t).recordBBox(t,a,0,s,-n,0).recordDependencies(t,Ng).recordOperation(t),rf(a,l.img,0,0,l.paintWidth,l.paintHeight,0,-n,s,n),this.compose(),this.restore(t)}paintInlineImageXObjectGroup(t,e,i){var s,n,a;if(!this.contentVisible)return;const r=this.ctx;let o;if(e.bitmap)o=e.bitmap;else{const t=e.width,i=e.height,s=this.cachedCanvases.getCanvas("inlineImage",t,i).context;lf(s,e),o=this.applyTransferMapsToCanvas(s)}null==(s=this.dependencyTracker)||s.resetBBox(t);for(const l of i)r.save(),r.transform(...l.transform),r.scale(1,-1),rf(r,o,l.x,l.y,l.w,l.h,0,-1,1,1),null==(n=this.dependencyTracker)||n.recordBBox(t,r,0,1,-1,0),r.restore();null==(a=this.dependencyTracker)||a.recordOperation(t),this.compose()}paintSolidColorImageMask(t){var e;this.contentVisible&&(null==(e=this.dependencyTracker)||e.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,Fg).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t,e){}
1markPointProps(t,e,i){}beginMarkedContent(t,e){var i;null==(i=this.dependencyTracker)||i.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,i){var s;null==(s=this.dependencyTracker)||s.beginMarkedContent(t),"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(i)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(t){var e;null==(e=this.dependencyTracker)||e.endMarkedContent(t),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(t){}endCompat(t){}consumePath(t,e,i){var s,n;const a=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(i);const r=this.ctx;this.pendingClip?(a||(this.pendingClip===mf?r.clip(e,"evenodd"):r.clip(e)),this.pendingClip=null,null==(s=this.dependencyTracker)||s.bboxToClipBoxDropOperation(t).recordFutureForcedDependency("clipPath",t)):null==(n=this.dependencyTracker)||n.recordOperation(t),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=dp(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),s=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,s)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:t}=this.current,{a:e,b:i,c:s,d:n}=this.ctx.getTransform();let a,r;if(0===i&&0===s){const i=Math.abs(e),s=Math.abs(n);if(i===s)if(0===t)a=r=1/i;else{const e=i*t;a=r=e<1?1/e:1}else if(0===t)a=1/i,r=1/s;else{const e=i*t,n=s*t;a=e<1?1/e:1,r=n<1?1/n:1}}else{const o=Math.abs(e*n-i*s),l=Math.hypot(e,i),h=Math.hypot(s,n);if(0===t)a=h/o,r=l/o;else{const e=t*o;a=h>e?h/e:1,r=l>e?l/e:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=r}return this._cachedScaleForStroking}rescaleAndStroke(t,e){const{ctx:i,current:{lineWidth:s}}=this,[n,a]=this.getScaleForStroking();if(n===a)return i.lineWidth=(s||1)*n,void i.stroke(t);const r=i.getLineDash();e&&i.save(),i.scale(n,a),ef.a=1/n,ef.d=1/a;const o=new Path2D;if(o.addPath(t,ef),r.length>0){const t=Math.max(n,a);i.setLineDash(r.map(e=>e/t)),i.lineDashOffset/=t}i.lineWidth=s||1,i.stroke(o),e&&i.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};for(const Sw in vu)void 0!==vf.prototype[Sw]&&(vf.prototype[vu[Sw]]=vf.prototype[Sw]);const wf=class t{constructor(t){Gd(this,sn),Gd(this,Zs),Gd(this,tn),Gd(this,en),qd(this,Zs,t),qd(this,tn,new DataView(Vd(this,Zs))),qd(this,en,new TextDecoder)}static write(e){const i=new TextEncoder,s={};let n=0;for(const h of t.strings){const t=i.encode(e[h]);s[h]=t,n+=4+t.length}
1const a=new ArrayBuffer(n),r=new Uint8Array(a),o=new DataView(a);let l=0;for(const h of t.strings){const t=s[h],e=t.length;o.setUint32(l,e),r.set(t,l+4),l+=4+e}return xu(l===a.byteLength,"CssFontInfo.write: Buffer overflow"),a}get fontFamily(){return Xd(this,sn,nn).call(this,0)}get fontWeight(){return Xd(this,sn,nn).call(this,1)}get italicAngle(){return Xd(this,sn,nn).call(this,2)}};Zs=new WeakMap,tn=new WeakMap,en=new WeakMap,sn=new WeakSet,nn=function(t){xu(t<wf.strings.length,"Invalid string index");let e=0;for(let s=0;s<t;s++)e+=Vd(this,tn).getUint32(e)+4;const i=Vd(this,tn).getUint32(e);return Vd(this,en).decode(new Uint8Array(Vd(this,Zs),e+4,i))},$d(wf,"strings",["fontFamily","fontWeight","italicAngle"]);let bf=wf;const yf=class t{constructor(t){Gd(this,ln),Gd(this,an),Gd(this,rn),Gd(this,on),qd(this,an,t),qd(this,rn,new DataView(Vd(this,an))),qd(this,on,new TextDecoder)}static write(e){const i=new TextEncoder,s={};let n=0;for(const u of t.strings){const t=i.encode(e[u]);s[u]=t,n+=4+t.length}n+=4;let a,r,o=1+n;e.style&&(a=i.encode(e.style.style),r=i.encode(e.style.weight),o+=4+a.length+4+r.length);const l=new ArrayBuffer(o),h=new Uint8Array(l),c=new DataView(l);let d=0;c.setUint8(d++,e.guessFallback?1:0),c.setUint32(d,0),d+=4,n=0;for(const u of t.strings){const t=s[u],e=t.length;n+=4+e,c.setUint32(d,e),h.set(t,d+4),d+=4+e}return c.setUint32(d-n-4,n),e.style&&(c.setUint32(d,a.length),h.set(a,d+4),d+=4+a.length,c.setUint32(d,r.length),h.set(r,d+4),d+=4+r.length),xu(d<=l.byteLength,"SubstitionInfo.write: Buffer overflow"),l.transferToFixedLength(d)}get guessFallback(){return 0!==Vd(this,rn).getUint8(0)}get css(){return Xd(this,ln,hn).call(this,0)}get loadedName(){return Xd(this,ln,hn).call(this,1)}get baseFontName(){return Xd(this,ln,hn).call(this,2)}get src(){return Xd(this,ln,hn).call(this,3)}get style(){let t=1;t+=4+Vd(this,rn).getUint32(t);const e=Vd(this,rn).getUint32(t),i=Vd(this,on).decode(new Uint8Array(Vd(this,an),t+4,e));t+=4+e;const s=Vd(this,rn).getUint32(t);return{style:i,weight:Vd(this,on).decode(new Uint8Array(Vd(this,an),t+4,s))}}};an=new WeakMap,rn=new WeakMap,on=new WeakMap,ln=new WeakSet,hn=function(t){xu(t<yf.strings.length,"Invalid string index");let e=5;for(let s=0;s<t;s++)e+=Vd(this,rn).getUint32(e)+4;const i=Vd(this,rn).getUint32(e);return Vd(this,on).decode(new Uint8Array(Vd(this,an),e+4,i))},$d(yf,"strings",["css","loadedName","baseFontName","src"]);let Af=yf;const _f=class t{constructor({data:t,extra:e}){Gd(this,wn),Gd(this,fn),Gd(this,mn),Gd(this,vn),qd(this,fn,t),qd(this,mn,new TextDecoder),qd(this,vn,new DataView(Vd(this,fn))),e&&Object.assign(this,e)}get black(){return Xd(this,wn,bn).call(this,0)}get bold(){return Xd(this,wn,bn).call(this,1)}get disableFontFace(){return Xd(this,wn,bn).call(this,2)}get fontExtraProperties(){return Xd(this,wn,bn).call(this,3)}get isInvalidPDFjsFont(){return Xd(this,wn,bn).call(this,4)}get isType3Font(){return Xd(this,wn,bn).call(this,5)}get italic(){return Xd(this,wn,bn).call(this,6)}get missingFile(){return Xd(this,wn,bn).call(this,7)}get remeasure(){return Xd(this,wn,bn).call(this,8)}get vertical(){return Xd(this,wn,bn).call(this,9)}get ascent(){return Xd(this,wn,yn).call(this,0)}get defaultWidth(){return Xd(this,wn,yn).call(this,1)}get descent(){return Xd(this,wn,yn).call(this,2)}get bbox(){let e=Vd(t,dn);if(0===Vd(this,vn).getUint8(e))return;e+=1;const i=[];for(let t=0;t<4;t++)i.push(Vd(this,vn).getInt16(e,!0)),e+=2;return i}get fontMatrix(){let e=Vd(t,un);if(0===Vd(this,vn).getUint8(e))return;e+=1;const i=[];for(let t=0;t<6;t++)i.push(Vd(this,vn).getFloat64(e,!0)),e+=8;return i}get defaultVMetrics(){let e=Vd(t,pn);if(0===Vd(this,vn).getUint8(e))return;e+=1;const i=[];for(let t=0;t<3;t++)i.push(Vd(this,vn).getInt16(e,!0)),e+=2;return i}get fallbackName(){return Xd(this,wn,An).call(this,0)}get loadedName(){return Xd(this,wn,An).call(this,1)}get mimetype(){return Xd(this,wn,An).call(this,2)}get name(){return Xd(this,wn,An).call(this,3)}get data(){let e=Vd(t,gn);e+=4+Vd(this,vn).getUint32(e),e+=4+Vd(this,vn).getUint32(e),e+=4+Vd(this,vn).getUint32(e);const i=Vd(this,vn).getUint32(e);if(0!==i)return new Uint8Array(Vd(this,fn),e+4,i)}clearData(){let e=Vd(t,gn);e+=4+Vd(this,vn).getUint32(e),e+=4+Vd(this,vn).getUint32(e),e+=4+Vd(this,vn).getUint32(e);const i=Vd(this,vn).getUint32(e);new Uint8Array(Vd(this,fn),e+4,i).fill(0),Vd(this,vn).setUint32(e,0)}get cssFontInfo(){let e=Vd(t,gn);e+=4+Vd(this,vn).getUint32(e),e+=4+Vd(this,vn).getUint32(e);const i=Vd(this,vn).getUint32(e);if(0===i)return null;const s=new Uint8Array(i);return s.set(new Uint8Array(Vd(this,fn),e+4,i)),new bf(s.buffer)}get systemFontInfo(){let e=Vd(t,gn);e+=4+Vd(this,vn).getUint32(e);const i=Vd(this,vn).getUint32(e);if(0===i)return null;const s=new Uint8Array(i);return s.set(new Uint8Array(Vd(this,fn),e+4,i)),new Af(s.buffer)}static write(e){const i=e.systemFontInfo?Af.write(e.systemFontInfo):null,s=e.cssFontInfo?bf.write(e.cssFontInfo):null,n=new TextEncoder,a={};let r=0;for(const f of t.strings)a[f]=n.encode(e[f]),r+=4+a[f].length;const o=Vd(t,gn)+4+r+4+(i?i.byteLength:0)+4+(s?s.byteLength:0)+4+(e.data?e.data.length:0),l=new ArrayBuffer(o),h=new Uint8Array(l),c=new DataView(l);let d=0;const u=t.bools.length;let p=0,g=0;for(let f=0;f<u;f++){const i=e[t.bools[f]];p|=(void 0===i?0:i?2:1)<<g,g+=2,8!==g&&f!==u-1||(c.setUint8(d++,p),p=0,g=0)}xu(d===Vd(t,cn),"FontInfo.write: Boolean properties offset mismatch");for(const f of t.numbers)c.setFloat64(d,e[f]),d+=8;if(xu(d===Vd(t,dn),"FontInfo.write: Number properties offset mismatch"),e.bbox){c.setUint8(d++,4);for(const t of e.bbox)c.setInt16(d,t,!0),d+=2}else c.setUint8(d++,0),d+=8;if(xu(d===Vd(t,un),"FontInfo.write: BBox properties offset mismatch"),e.fontMatrix){c.setUint8(d++,6);for(const t of e.fontMatrix)c.setFloat64(d,t,!0),d+=8}else c.setUint8(d++,0),d+=48;if(xu(d===Vd(t,pn),"FontInfo.write: FontMatrix properties offset mismatch"),e.defaultVMetrics){c.setUint8(d++,1);for(const t of e.defaultVMetrics)c.setInt16(d,t,!0),d+=2}else c.setUint8(d++,0),d+=6;xu(d===Vd(t,gn),"FontInfo.write: DefaultVMetrics properties offset mismatch"),c.setUint32(Vd(t,gn),0),d+=4;for(const f of t.strings){const t=a[f],e=t.length;c.setUint32(d,e),h.set(t,d+4),d+=4+e}if(c.setUint32(Vd(t,gn),d-Vd(t,gn)-4),i){const t=i.byteLength;c.setUint32(d,t),xu(d+4+t<=l.byteLength,"FontInfo.write: Buffer overflow at systemFontInfo"),h.set(new Uint8Array(i),d+4),d+=4+t}else c.setUint32(d,0),d+=4;if(s){const t=s.byteLength;c.setUint32(d,t),xu(d+4+t<=l.byteLength,"FontInfo.write: Buffer overflow at cssFontInfo"),h.set(new Uint8Array(s),d+4),d+=4+t}else c.setUint32(d,0),d+=4;return void 0===e.data?(c.setUint32(d,0),d+=4):(c.setUint32(d,e.data.length),h.set(e.data,d+4),d+=4+e.data.length),xu(d<=l.byteLength,"FontInfo.write: Buffer overflow"),l.transferTo
1FixedLength(d)}};cn=new WeakMap,dn=new WeakMap,un=new WeakMap,pn=new WeakMap,gn=new WeakMap,fn=new WeakMap,mn=new WeakMap,vn=new WeakMap,wn=new WeakSet,bn=function(t){xu(t<_f.bools.length,"Invalid boolean index");const e=Math.floor(t/4),i=2*t%8,s=Vd(this,vn).getUint8(e)>>i&3;return 0===s?void 0:2===s},yn=function(t){return xu(t<_f.numbers.length,"Invalid number index"),Vd(this,vn).getFloat64(Vd(_f,cn)+8*t)},An=function(t){xu(t<_f.strings.length,"Invalid string index");let e=Vd(_f,gn)+4;for(let n=0;n<t;n++)e+=Vd(this,vn).getUint32(e)+4;const i=Vd(this,vn).getUint32(e),s=new Uint8Array(i);return s.set(new Uint8Array(Vd(this,fn),e+4,i)),Vd(this,mn).decode(s)},$d(_f,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),$d(_f,"numbers",["ascent","defaultWidth","descent"]),$d(_f,"strings",["fallbackName","loadedName","mimetype","name"]),Gd(_f,cn,Math.ceil(2*_f.bools.length/8)),Gd(_f,dn,Vd(_f,cn)+8*_f.numbers.length),Gd(_f,un,Vd(_f,dn)+1+8),Gd(_f,pn,Vd(_f,un)+1+48),Gd(_f,gn,Vd(_f,pn)+1+6);let xf=_f;class kf{static get workerPort(){return Vd(this,_n)}static set workerPort(t){if(!("undefined"!=typeof Worker&&t instanceof Worker)&&null!==t)throw new Error("Invalid `workerPort` type.");qd(this,_n,t)}static get workerSrc(){return Vd(this,xn)}static set workerSrc(t){if("string"!=typeof t)throw new Error("Invalid `workerSrc` type.");qd(this,xn,t)}}_n=new WeakMap,xn=new WeakMap,Gd(kf,_n,null),Gd(kf,xn,"");class Sf{constructor({parsedData:t,rawData:e}){Gd(this,kn),Gd(this,Sn),qd(this,kn,t),qd(this,Sn,e)}getRaw(){return Vd(this,Sn)}get(t){var e;return null!=(e=Vd(this,kn).get(t))?e:null}[Symbol.iterator](){return Vd(this,kn).entries()}}kn=new WeakMap,Sn=new WeakMap;const Mf=Symbol("INTERNAL");class Ef{constructor(t,{name:e,intent:i,usage:s,rbGroups:n}){Gd(this,Mn,!1),Gd(this,En,!1),Gd(this,Cn,!1),Gd(this,Tn,!0),qd(this,Mn,!!(2&t)),qd(this,En,!!(4&t)),this.name=e,this.intent=i,this.usage=s,this.rbGroups=n}get visible(){if(Vd(this,Cn))return Vd(this,Tn);if(!Vd(this,Tn))return!1;const{print:t,view:e}=this.usage;return Vd(this,Mn)?"OFF"!==(null==e?void 0:e.viewState):!Vd(this,En)||"OFF"!==(null==t?void 0:t.printState)}_setVisible(t,e,i=!1){t!==Mf&&_u("Internal method `_setVisible` called."),qd(this,Cn,i),qd(this,Tn,e)}}Mn=new WeakMap,En=new WeakMap,Cn=new WeakMap,Tn=new WeakMap;class Cf{constructor(t,e=2){if(Gd(this,Ln),Gd(this,Pn,null),Gd(this,Dn,new Map),Gd(this,Rn,null),Gd(this,In,null),this.renderingIntent=e,this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,qd(this,In,t.order);for(const i of t.groups)Vd(this,Dn).set(i.id,new Ef(e,i));if("OFF"===t.baseState)for(const t of Vd(this,Dn).values())t._setVisible(Mf,!1);for(const e of t.on)Vd(this,Dn).get(e)._setVisible(Mf,!0);for(const e of t.off)Vd(this,Dn).get(e)._setVisible(Mf,!1);qd(this,Rn,this.getHash())}}isVisible(t){if(0===Vd(this,Dn).size)return!0;if(!t)return!0;if("OCG"===t.type)return Vd(this,Dn).has(t.id)?Vd(this,Dn).get(t.id).visible:(t.id,!0);if("OCMD"===t.type){if(t.expression)return Xd(this,Ln,Fn).call(this,t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!Vd(this,Dn).has(e))return Au(),!0;if(Vd(this,Dn).get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!Vd(this,Dn).has(e))return Au(),!0;if(!Vd(this,Dn).get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!Vd(this,Dn).has(e))return Au(),!0;if(!Vd(this,Dn).get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!Vd(this,Dn).has(e))return Au(),!0;if(Vd(this,Dn).get(e).visible)return!1}return!0}return t.policy,!0}return t.type,!0}setVisibility(t,e=!0,i=!0){var s;const n=Vd(this,Dn).get(t);if(n){if(i&&e&&n.rbGroups.length)for(const e of n.rbGroups)for(const i of e)i!==t&&(null==(s=Vd(this,Dn).get(i))||s._setVisible(Mf,!1,!0));n._setVisible(Mf,!!e,!0),qd(this,Pn,null)}}setOCGState({state:t,preserveRB:e}){let i;for(const s of t){switch(s){case"ON":case"OFF":case"Toggle":i=s;continue}const t=Vd(this,Dn).get(s);if(t)switch(i){case"ON":this.setVisibility(s,!0,e);break;case"OFF":this.setVisibility(s,!1,e);break;case"Toggle":this.setVisibility(s,!t.visible,e)}}qd(this,Pn,null)}get hasInitialVisibility(){return null===Vd(this,Rn)||this.getHash()===Vd(this,Rn)}getOrder(){return Vd(this,Dn).size?Vd(this,In)?Vd(this,In).slice():[...Vd(this,Dn).keys()]:null}getGroup(t){return Vd(this,Dn).get(t)||null}getHash(){if(null!==Vd(this,Pn))return Vd(this,Pn);const t=new Kp;for(const[e,i]of Vd(this,Dn))t.update(`${e}:${i.visible}`);return qd(this,Pn,t.hexdigest())}[Symbol.iterator](){return Vd(this,Dn).entries()}}Pn=new WeakMap,Dn=new WeakMap,Rn=new WeakMap,In=new WeakMap,Ln=new WeakSet,Fn=function(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let s=1;s<e;s++){const e=t[s];let n;if(Array.isArray(e))n=Xd(this,Ln,Fn).call(this,e);else{if(!Vd(this,Dn).has(e))return Au(),!0;n=Vd(this,Dn).get(e).visible}switch(i){case"And":if(!n)return!1;break;case"Or":if(n)return!0;break;case"Not":return!n;default:return!0}}return"And"===i};class Tf{constructor(t,{disableRange:e=!1,disableStream:i=!1}){xu(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:s,initialData:n,progressiveDone:a,contentDispositionFilename:r}=t;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=r,(null==n?void 0:n.length)>0){const t=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!i,this._isRangeSupported=!e,this._contentLength=s,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((t,e)=>{this._onReceiveData({begin:t,chunk:e})}),t.addProgressListener((t,e)=>{this._onProgress({loaded:t,total:e})}),t.addProgressiveReadListener(t=>{this._onReceiveData({chunk:t})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:e}){const i=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;void 0===t?this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i):xu(this._rangeReaders.some(function(e){return e._begin===t&&(e._enqueue(i),!0)}),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}get _progressiveDataLength(){var t,e;return null!=(e=null==(t=this._fullRequestReader)?void 0:t._loaded)?e:0}_onProgress(t){var e,i,s,n;void 0===t.total?null==(i=null==(e=this._rangeReaders[0])?void 0:e.onProgress)||i.call(e,{loaded:t.loaded}):null==(n=null==(s=this._fullRequestReader)?void 0:s.onProgress)||n.call(s,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;null==(t=this._fullRequestReader)||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){xu(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new Pf(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new Df(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){var e;null==(e=this._fullRequestReader)||e.cancel(t);for(const i of this._rangeReaders.slice(0))i.cancel(t);this._pdfDataRangeTransport.abort()}}class Pf{constructor(t,e,i=!1,s=null){this._stream=t,this._done=i||!1,this._filename=ep(s)?s:null,this._queuedChunks=e||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.byteLength;
1this._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 Df{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Rf(t,e){const i=new Headers;if(!t||!e||"object"!=typeof e)return i;for(const s in e){const t=e[s];void 0!==t&&i.append(s,t)}return i}function If(t){var e,i;return null!=(i=null==(e=URL.parse(t))?void 0:e.origin)?i:null}function Lf({responseHeaders:t,isHttp:e,rangeChunkSize:i,disableRange:s}){const n={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(t.get("Content-Length"),10);return Number.isInteger(a)?(n.suggestedLength=a,a<=2*i||s||!e||"bytes"!==t.get("Accept-Ranges")||"identity"!==(t.get("Content-Encoding")||"identity")||(n.allowRangeRequests=!0),n):n}function Ff(t){const e=t.get("Content-Disposition");if(e){let t=function(t){let e=!0,i=s("filename\\*","i").exec(t);if(i){i=i[1];let t=r(i);return t=unescape(t),t=o(t),t=l(t),a(t)}if(i=function(t){const e=[];let i;const n=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=n.exec(t));){let[,t,s,n]=i;if(t=parseInt(t,10),t in e){if(0===t)break}else e[t]=[s,n]}const a=[];for(let s=0;s<e.length&&s in e;++s){let[t,i]=e[s];i=r(i),t&&(i=unescape(i),0===s&&(i=o(i))),a.push(i)}return a.join("")}(t),i)return a(l(i));if(i=s("filename","i").exec(t),i){i=i[1];let t=r(i);return t=l(t),a(t)}function s(t,e){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function n(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const s=new TextDecoder(t,{fatal:!0}),n=Fu(i);i=s.decode(n),e=!1}catch(s){}}return i}function a(t){return e&&/[\x80-\xff]/.test(t)&&(t=n("utf-8",t),e&&(t=n("iso-8859-1",t))),t}function r(t){if(t.startsWith('"')){const e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){const i=e[t].indexOf('"');-1!==i&&(e[t]=e[t].slice(0,i),e.length=t+1),e[t]=e[t].replaceAll(/\\(.)/g,"$1")}t=e.join('"')}return t}function o(t){const e=t.indexOf("'");return-1===e?t:n(t.slice(0,e),t.slice(e+1).replace(/^[^']*'/,""))}function l(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(t,e,i,s){if("q"===i||"Q"===i)return n(e,s=(s=s.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(t,e){return String.fromCharCode(parseInt(e,16))}));try{s=atob(s)}catch(a){}return n(e,s)})}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch(i){}if(ep(t))return t}return null}function Nf(t,e){return new Du(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t,404===t||0===t&&e.startsWith("file:"))}function Wf(t){return 200===t||206===t}function Bf(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function Of(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:new Uint8Array(t).buffer}class jf{constructor(t){$d(this,"_responseOrigin",null),this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=Rf(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t,e;return null!=(e=null==(t=this._fullRequestReader)?void 0:t._loaded)?e:0}getFullReader(){return xu(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Uf(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new Hf(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null==(e=this._fullRequestReader)||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class Uf{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;const i=new Headers(t.headers),s=e.url;fetch(s,Bf(i,this._withCredentials,this._abortController)).then(e=>{if(t._responseOrigin=If(e.url),!Wf(e.status))throw Nf(e.status,s);this._reader=e.body.getReader(),this._headersCapability.resolve();const i=e.headers,{allowRangeRequests:n,suggestedLength:a}=Lf({responseHeaders:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=n,this._contentLength=a||this._contentLength,this._filename=Ff(i),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Iu("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 t;await this._headersCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null==(t=this.onProgress)||t.call(this,{loaded:this._loaded,total:this._contentLength}),{value:Of(e),done:!1})}cancel(t){var e;null==(e=this._reader)||e.cancel(t),this._abortController.abort()}}class Hf{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;const s=t.source;this._withCredentials=s.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController;const n=new Headers(t.headers);n.append("Range",`bytes=${e}-${i-1}`);const a=s.url;fetch(a,Bf(n,this._withCredentials,this._abortController)).then(e=>{const i=If(e.url);if(i!==t._responseOrigin)throw new Error(`Expected range response-origin "${i}" to match "${t._responseOrigin}".`);if(!Wf(e.status))throw Nf(e.status,a);this._readCapability.resolve(),this._reader=e.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._readCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null==(t=this.onProgress)||t.call(this,{loaded:this._loaded}),{value:Of(e),done:!1})}cancel(t){var e;null==(e=this._reader)||e.cancel(t),this._abortController.abort()}}class $f{constructor({url:t,httpHeaders:e,withCredentials:i}){$d(this,"_responseOrigin",null),this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=Rf(this.isHttp,e),this.withCredentials=i||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(t){const e=new XMLHttpRequest,i=this.currXhrId++,s=this.pendingRequests[i]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const[n,a]of this.headers)e.setRequestHeader(n,a);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),s.expectedStatus=206):s.expectedStatus=200,e.responseType="arraybuffer",xu(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>{t.onError(e.status)},e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),s.onHeadersReceived=t.onHeadersReceived,s.onDone=t.onDone,s.onError=t.onError,s.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){var i;const s=this.pendingRequests[t];s&&(null==(i=s.onProgress)||i.call(s,e))}onStateChange(t,e){const i=this.pendingRequests[t];if(!i)return;const s=i.xhr;if(s.readyState>
1=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==s.readyState)return;if(!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===s.status&&this.isHttp)return void i.onError(s.status);const n=s.status||200;if((200!==n||206!==i.expectedStatus)&&n!==i.expectedStatus)return void i.onError(s.status);const a=function(t){const e=t.response;return"string"!=typeof e?e:Fu(e).buffer}(s);if(206===n){const t=s.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);e?i.onDone({begin:parseInt(e[1],10),chunk:a}):i.onError(0)}else a?i.onDone({begin:0,chunk:a}):i.onError(s.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class zf{constructor(t){this._source=t,this._manager=new $f(t),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 xu(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Vf(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const i=new Gf(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null==(e=this._fullRequestReader)||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class Vf{constructor(t,e){this._manager=t,this._url=e.url,this._fullRequestId=t.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=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);this._manager._responseOrigin=If(e.responseURL);const i=e.getAllResponseHeaders(),s=new Headers(i?i.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(t=>{const[e,...i]=t.split(": ");return[e,i.join(": ")]}):[]),{allowRangeRequests:n,suggestedLength:a}=Lf({responseHeaders:s,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=Ff(s),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.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 t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=Nf(t,this._url),this._headersCapability.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;null==(e=this.onProgress)||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._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest
1(this._fullRequestId),this._fullRequestReader=null}}class Gf{constructor(t,e,i){this._manager=t,this._url=t.url,this._requestId=t.request({begin:e,end:i,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){var t;const e=If(null==(t=this._manager.getRequestXhr(this._requestId))?void 0:t.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){var t;null==(t=this.onClosed)||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 i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){null!=this._storedError||(this._storedError=Nf(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||null==(e=this.onProgress)||e.call(this,{loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const 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 qf=/^[a-z][a-z0-9\-+.]+:/i;class Xf{constructor(t){this.source=t,this.url=function(t){if(qf.test(t))return new URL(t);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(t))}(t.url),xu("file:"===this.url.protocol,"PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t,e;return null!=(e=null==(t=this._fullRequestReader)?void 0:t._loaded)?e:0}getFullReader(){return xu(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new Yf(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new Kf(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null==(e=this._fullRequestReader)||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class Yf{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();const i=process.getBuiltinModule("fs");i.promises.lstat(this._url).then(t=>{this._contentLength=t.size,this._setReadableStream(i.createReadStream(this._url)),this._headersCapability.resolve()},t=>{"ENOENT"===t.code&&(t=Nf(0,this._url.href)),this._storedError=t,this._headersCapability.reject(t)})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,null==(t=this.onProgress)||t.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(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",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Iu("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Kf{constructor(t,e,i){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const s=t.source;this._isStreamingSupported=!s.disableStream;const n=process.getBuiltinModule("fs");this._setReadableStream(n.createReadStream(this._url,{start:e,end:i-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,null==(t=this.onProgress)||t.call(this,{loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(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",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const Qf=Symbol("INITIAL_DATA");class Jf{constructor(){Gd(this,Wn),Gd(this,Nn,Object.create(null))}get(t,e=null){if(e){const i=Xd(this,Wn,Bn).call(this,t);return i.promise.then(()=>e(i.data)),null}const i=Vd(this,Nn)[t];if(!i||i.data===Qf)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){const e=Vd(this,Nn)[t];return!!e&&e.data!==Qf}delete(t){const e=Vd(this,Nn)[t];return!(!e||e.data===Qf||(delete Vd(this,Nn)[t],0))}resolve(t,e=null){const i=Xd(this,Wn,Bn).call(this,t);i.data=e,i.resolve()}clear(){var t;for(const e in Vd(this,Nn)){const{data:i}=Vd(this,Nn)[e];null==(t=null==i?void 0:i.bitmap)||t.close()}qd(this,Nn,Object.create(null))}*[Symbol.iterator](){for(const t in Vd(this,Nn)){const{data:e}=Vd(this,Nn)[t];e!==Qf&&(yield[t,e])}}}Nn=new WeakMap,Wn=new WeakSet,Bn=function(t){var e;return(e=Vd(this,Nn))[t]||(e[t]={...Promise.withResolvers(),data:Qf})};let Zf=(na=class{constructor({textContentSource:t,container:e,viewport:i}){var s;if(Gd(this,ca),Gd(this,jn,Promise.withResolvers()),Gd(this,Un,null),Gd(this,Hn,
1!1),Gd(this,$n,!!(null==(On=globalThis.FontInspector)?void 0:On.enabled)),Gd(this,zn,null),Gd(this,Vn,null),Gd(this,Gn,0),Gd(this,qn,0),Gd(this,Xn,null),Gd(this,Yn,null),Gd(this,Kn,0),Gd(this,Qn,0),Gd(this,Jn,Object.create(null)),Gd(this,Zn,[]),Gd(this,ta,null),Gd(this,ea,[]),Gd(this,ia,new WeakMap),Gd(this,sa,null),t instanceof ReadableStream)qd(this,ta,t);else{if("object"!=typeof t)throw new Error('No "textContentSource" parameter specified.');qd(this,ta,new ReadableStream({start(e){e.enqueue(t),e.close()}}))}qd(this,Un,qd(this,Yn,e)),qd(this,Qn,i.scale*gp.pixelRatio),qd(this,Kn,i.rotation),qd(this,Vn,{div:null,properties:null,ctx:null});const{pageWidth:n,pageHeight:a,pageX:r,pageY:o}=i.rawDims;qd(this,sa,[1,0,0,-1,-r,o+a]),qd(this,qn,n),qd(this,Gn,a),Xd(s=na,ga,va).call(s),pp(e,i),Vd(this,jn).promise.finally(()=>{Vd(na,ha).delete(this),qd(this,Vn,null),qd(this,Jn,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=Nu.platform;return Mu(this,"fontFamilyMap",new Map([["sans-serif",(t&&e?"Calibri, ":"")+"sans-serif"],["monospace",(t&&e?"Lucida Console, ":"")+"monospace"]]))}render(){const t=()=>{Vd(this,Xn).read().then(({value:e,done:i})=>{i?Vd(this,jn).resolve():(null!=Vd(this,zn)||qd(this,zn,e.lang),Object.assign(Vd(this,Jn),e.styles),Xd(this,ca,da).call(this,e.items),t())},Vd(this,jn).reject)};return qd(this,Xn,Vd(this,ta).getReader()),Vd(na,ha).add(this),t(),Vd(this,jn).promise}update({viewport:t,onBefore:e=null}){var i;const s=t.scale*gp.pixelRatio,n=t.rotation;if(n!==Vd(this,Kn)&&(null==e||e(),qd(this,Kn,n),pp(Vd(this,Yn),{rotation:n})),s!==Vd(this,Qn)){null==e||e(),qd(this,Qn,s);const t={div:null,properties:null,ctx:Xd(i=na,ga,fa).call(i,Vd(this,zn))};for(const e of Vd(this,ea))t.properties=Vd(this,ia).get(e),t.div=e,Xd(this,ca,pa).call(this,t)}}cancel(){var t;const e=new Iu("TextLayer task cancelled.");null==(t=Vd(this,Xn))||t.cancel(e).catch(()=>{}),qd(this,Xn,null),Vd(this,jn).reject(e)}get textDivs(){return Vd(this,ea)}get textContentItemsStr(){return Vd(this,Zn)}static cleanup(){if(!(Vd(this,ha).size>0)){Vd(this,aa).clear();for(const{canvas:t}of Vd(this,ra).values())t.remove();Vd(this,ra).clear()}}},jn=new WeakMap,Un=new WeakMap,Hn=new WeakMap,$n=new WeakMap,zn=new WeakMap,Vn=new WeakMap,Gn=new WeakMap,qn=new WeakMap,Xn=new WeakMap,Yn=new WeakMap,Kn=new WeakMap,Qn=new WeakMap,Jn=new WeakMap,Zn=new WeakMap,ta=new WeakMap,ea=new WeakMap,ia=new WeakMap,sa=new WeakMap,aa=new WeakMap,ra=new WeakMap,oa=new WeakMap,la=new WeakMap,ha=new WeakMap,ca=new WeakSet,da=function(t){var e,i;if(Vd(this,Hn))return;null!=(i=Vd(this,Vn)).ctx||(i.ctx=Xd(e=na,ga,fa).call(e,Vd(this,zn)));const s=Vd(this,ea),n=Vd(this,Zn);for(const a of t){if(s.length>1e5)return Au(),void qd(this,Hn,!0);if(void 0!==a.str)n.push(a.str),Xd(this,ca,ua).call(this,a);else if("beginMarkedContentProps"===a.type||"beginMarkedContent"===a.type){const t=Vd(this,Un);qd(this,Un,document.createElement("span")),Vd(this,Un).classList.add("markedContent"),a.id&&Vd(this,Un).setAttribute("id",`${a.id}`),t.append(Vd(this,Un))}else"endMarkedContent"===a.type&&qd(this,Un,Vd(this,Un).parentNode)}},ua=function(t){var e;const i=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};Vd(this,ea).push(i);const n=Bu.transform(Vd(this,sa),t.transform);let a=Math.atan2(n[1],n[0]);const r=Vd(this,Jn)[t.fontName];r.vertical&&(a+=Math.PI/2);let o=Vd(this,$n)&&r.fontSubstitution||r.fontFamily;o=na.fontFamilyMap.get(o)||o;const l=Math.hypot(n[2],n[3]),h=l*Xd(e=na,ga,wa).call(e,o,r,Vd(this,zn));let c,d;
10===a?(c=n[4],d=n[5]-h):(c=n[4]+h*Math.sin(a),d=n[5]-h*Math.cos(a));const u="calc(var(--total-scale-factor) *",p=i.style;Vd(this,Un)===Vd(this,Yn)?(p.left=`${(100*c/Vd(this,qn)).toFixed(2)}%`,p.top=`${(100*d/Vd(this,Gn)).toFixed(2)}%`):(p.left=`${u}${c.toFixed(2)}px)`,p.top=`${u}${d.toFixed(2)}px)`),p.fontSize=`${u}${(Vd(na,la)*l).toFixed(2)}px)`,p.fontFamily=o,s.fontSize=l,i.setAttribute("role","presentation"),i.textContent=t.str,i.dir=t.dir,Vd(this,$n)&&(i.dataset.fontName=r.fontSubstitutionLoadedName||t.fontName),0!==a&&(s.angle=a*(180/Math.PI));let g=!1;if(t.str.length>1)g=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(g=!0)}if(g&&(s.canvasWidth=r.vertical?t.height:t.width),Vd(this,ia).set(i,s),Vd(this,Vn).div=i,Vd(this,Vn).properties=s,Xd(this,ca,pa).call(this,Vd(this,Vn)),s.hasText&&Vd(this,Un).append(i),s.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation"),Vd(this,Un).append(t)}},pa=function(t){var e;const{div:i,properties:s,ctx:n}=t,{style:a}=i;let r="";if(Vd(na,la)>1&&(r=`scale(${1/Vd(na,la)})`),0!==s.canvasWidth&&s.hasText){const{fontFamily:t}=a,{canvasWidth:o,fontSize:l}=s;Xd(e=na,ga,ma).call(e,n,l*Vd(this,Qn),t);const{width:h}=n.measureText(i.textContent);h>0&&(r=`scaleX(${o*Vd(this,Qn)/h}) ${r}`)}0!==s.angle&&(r=`rotate(${s.angle}deg) ${r}`),r.length>0&&(a.transform=r)},ga=new WeakSet,fa=function(t=null){let e=Vd(this,ra).get(t||(t=""));if(!e){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),Vd(this,ra).set(t,e),Vd(this,oa).set(e,{size:0,family:""})}return e},ma=function(t,e,i){const s=Vd(this,oa).get(t);e===s.size&&i===s.family||(t.font=`${e}px ${i}`,s.size=e,s.family=i)},va=function(){if(null!==Vd(this,la))return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),qd(this,la,t.getBoundingClientRect().height),t.remove()},wa=function(t,e,i){const s=Vd(this,aa).get(t);if(s)return s;const n=Xd(this,ga,fa).call(this,i);n.canvas.width=n.canvas.height=30,Xd(this,ga,ma).call(this,n,30,t);const a=n.measureText(""),r=a.fontBoundingBoxAscent,o=Math.abs(a.fontBoundingBoxDescent);n.canvas.width=n.canvas.height=0;let l=.8;return r?l=r/(r+o):(Nu.platform.isFirefox,e.ascent?l=e.ascent:e.descent&&(l=1+e.desce
1nt)),Vd(this,aa).set(t,l),l},Gd(na,ga),Gd(na,aa,new Map),Gd(na,ra,new Map),Gd(na,oa,new WeakMap),Gd(na,la,null),Gd(na,ha,new Set),na);function tm(t={}){var e,i;"string"==typeof t||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});const s=new im,{docId:n}=s,a=t.url?function(t){if(t instanceof URL)return t.href;if("string"==typeof t){if(ru)return t;const e=URL.parse(t,window.location);if(e)return e.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(t.url):null,r=t.data?function(t){if(ru&&"undefined"!=typeof Buffer&&t instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"==typeof t)return Fu(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"==typeof t&&!isNaN(null==t?void 0:t.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(t.data):null,o=t.httpHeaders||null,l=!0===t.withCredentials,h=null!=(e=t.password)?e:null,c=t.range instanceof sm?t.range:null,d=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:65536;let u=t.worker instanceof om?t.worker:null;const p=t.verbosity,g="string"!=typeof t.docBaseUrl||tp(t.docBaseUrl)?null:t.docBaseUrl,f=ig(t.cMapUrl),m=!1!==t.cMapPacked,v=t.CMapReaderFactory||(ru?_g:ug),w=ig(t.iccUrl),b=ig(t.standardFontDataUrl),y=t.StandardFontDataFactory||(ru?xg:mg),A=ig(t.wasmUrl),_=t.WasmFactory||(ru?kg:wg),x=!0!==t.stopAtErrors,k=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,S=!1!==t.isEvalSupported,M="boolean"==typeof t.isOffscreenCanvasSupported?t.isOffscreenCanvasSupported:!ru,E="boolean"==typeof t.isImageDecoderSupported?t.isImageDecoderSupported:!ru&&(Nu.platform.isFirefox||!globalThis.chrome),C=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,T="boolean"==typeof t.disableFontFace?t.disableFontFace:ru,P=!0===t.fontExtraProperties,D=!0===t.enableXfa,R=t.ownerDocument||globalThis.document,I=!0===t.disableRange,L=!0===t.disableStream,F=!0===t.disableAutoFetch,N=!0===t.pdfBug,W=t.CanvasFactory||(ru?Ag:cg),B=t.FilterFactory||(ru?yg:gg),O=!0===t.enableHWA,j=!1!==t.useWasm,U=c?c.length:null!=(i=t.length)?i:NaN,H="boolean"==typeof t.useSystemFonts?t.useSystemFonts:!ru&&!T,$="boolean"==typeof t.useWorkerFetch?t.useWorkerFetch:!!(v===ug&&y===mg&&_===wg&&f&&b&&A&&ap(f,document.baseURI)&&ap(b,document.baseURI)&&ap(A,document.baseURI));var z;z=p,Number.isInteger(z)&&(bu=z);const V={canvasFactory:new W({ownerDocument:R,enableHWA:O}),filterFactory:new B({docId:n,ownerDocument:R}),cMapReaderFactory:$?null:new v({baseUrl:f,isCompressed:m}),standardFontDataFactory:$?null:new y({baseUrl:b}),wasmFactory:$?null:new _({baseUrl:A})};u||(u=om.create({verbosity:p,port:kf.workerPort}),s._worker=u);const G={docId:n,apiVersion:"5.4.296",data:r,password:h,disableAutoFetch:F,rangeChunkSize:d,length:U,docBaseUrl:g,enableXfa:D,evaluatorOptions:{maxImageSize:k,disableFontFace:T,ignoreErrors:x,isEvalSupported:S,isOffscreenCanvasSupported:M,isImageDecoderSupported:E,canvasMaxAreaInBytes:C,fontExtraProperties:P,useSystemFonts:H,useWasm:j,useWorkerFetch:$,cMapUrl:f,iccUrl:w,standardFontDataUrl:b,wasmUrl:A}},q={ownerDocument:R,pdfBug:N,styleElement:null,loadingParams:{disableAutoFetch:F,enableXfa:D}};return u.promise.then(function(){if(s.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const t=u.messageHandler.sendWithPromise("GetDocRequest",G,r?[r.buffer]:null);let e;if(c)e=new Tf(c,{disableRange:I,disableStream:L});else if(!r){if(!a)throw new Error("getDocument - no `url` parameter provided.");const t=ap(a)?jf:ru?Xf:zf;e=new t({url:a,length:U,httpHeaders:o,withCredentials:l,rangeChunkSize:d,disableRange:I,disableStream:L})}return t.then(t=>{if(s.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const i=new lg(n,t,u.port),a=new lm(i,s,e,q,V,O);s._transport=a,i.send("Ready",null)})}).catch(s._capability.reject),s}const em=class t{constructor(){$d(this,"_capability",Promise.withResolvers()),$d(this,"_transport",null),$d(this,"_worker",null),$d(this,"docId","d"+Yd(t,ba)._++),$d(this,"destroyed",!1),$d(this,"onPassword",null),$d(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var t,e,i,s;this.destroyed=!0;try{(null==(t=this._worker)?void 0:t.port)&&(this._worker._pendingDestroy=!0),await(null==(e=this._transport)?void 0:e.destroy())}catch(n){throw(null==(i=this._worker)?void 0:i.port)&&delete this._worker._pendingDestroy,n}this._transport=null,null==(s=this._worker)||s.destroy(),this._worker=null}async getData(){return this._transport.getData()}};ba=new WeakMap,Gd(em,ba,0);let im=em,sm=(Sa=class{constructor(t,e,i=!1,s=null){Gd(this,ya,Promise.withResolvers()),Gd(this,Aa,[]),Gd(this,_a,[]),Gd(this,xa,[]),Gd(this,ka,[]),this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=s}
1addRangeListener(t){Vd(this,ka).push(t)}addProgressListener(t){Vd(this,xa).push(t)}addProgressiveReadListener(t){Vd(this,_a).push(t)}addProgressiveDoneListener(t){Vd(this,Aa).push(t)}onDataRange(t,e){for(const i of Vd(this,ka))i(t,e)}onDataProgress(t,e){Vd(this,ya).promise.then(()=>{for(const i of Vd(this,xa))i(t,e)})}onDataProgressiveRead(t){Vd(this,ya).promise.then(()=>{for(const e of Vd(this,_a))e(t)})}onDataProgressiveDone(){Vd(this,ya).promise.then(()=>{for(const t of Vd(this,Aa))t()})}transportReady(){Vd(this,ya).resolve()}requestDataRange(t,e){_u("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},ya=new WeakMap,Aa=new WeakMap,_a=new WeakMap,xa=new WeakMap,ka=new WeakMap,Sa);class nm{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Mu(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAnnotationsByType(t,e){return this._transport.getAnnotationsByType(t,e)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:e}=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()}}class am{constructor(t,e,i,s=!1){Gd(this,Ea),Gd(this,Ma,!1),this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new np:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new Jf,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null}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:i=0,offsetY:s=0,dontFlip:n=!1}={}){return new Ju({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:n})}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 Mu(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return(null==(t=this._transport._htmlForXfa)?void 0:t.children[this._pageIndex])||null}
1render({canvasContext:t,canvas:e=t.canvas,viewport:i,intent:s="display",annotationMode:n=hu.ENABLE,transform:a=null,background:r=null,optionalContentConfigPromise:o=null,annotationCanvasMap:l=null,pageColors:h=null,printAnnotationStorage:c=null,isEditing:d=!1,recordOperations:u=!1,operationsFilter:p=null}){var g,f,m;null==(g=this._stats)||g.time("Overall");const v=this._transport.getRenderingIntent(s,n,c,d),{renderingIntent:w,cacheKey:b}=v;qd(this,Ma,!1),o||(o=this._transport.getOptionalContentConfig(w));let y=this._intentStates.get(b);y||(y=Object.create(null),this._intentStates.set(b,y)),y.streamReaderCancelTimeout&&(clearTimeout(y.streamReaderCancelTimeout),y.streamReaderCancelTimeout=null);const A=!!(4&w);y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null==(f=this._stats)||f.time("Page Request"),this._pumpOperatorList(v));const _=Boolean(this._pdfBug&&(null==(m=globalThis.StepperManager)?void 0:m.enabled)),x=!this.recordedBBoxes&&(u||_),k=t=>{var e,i;if(y.renderTasks.delete(S),x){const t=null==(e=S.gfx)?void 0:e.dependencyTracker.take();t&&(S.stepper&&S.stepper.setOperatorBBoxes(t,S.gfx.dependencyTracker.takeDebugMetadata()),u&&(this.recordedBBoxes=t))}A&&qd(this,Ma,!0),Xd(this,Ea,Ca).call(this),t?(S.capability.reject(t),this._abortOperatorList({intentState:y,reason:t instanceof Error?t:new Error(t)})):S.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(null==(i=globalThis.Stats)?void 0:i.enabled)&&globalThis.Stats.add(this.pageNumber,this._stats))},S=new dm({callback:k,params:{canvas:e,canvasContext:t,dependencyTracker:x?new Rg(e,y.operatorList.length,_):null,viewport:i,transform:a,background:r},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!A,pdfBug:this._pdfBug,pageColors:h,enableHWA:this._transport.enableHWA,operationsFilter:p});(y.renderTasks||(y.renderTasks=new Set)).add(S);const M=S.task;return Promise.all([y.displayReadyCapability.promise,o]).then(([t,e])=>{var i;if(this.destroyed)k();else{if(null==(i=this._stats)||i.time("Rendering"),!(e.renderingIntent&w))throw new Error("Mu
1st use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");S.initializeGraphics({transparency:t,optionalContentConfig:e}),S.operatorListChanged()}}).catch(k),M}getOperatorList({intent:t="display",annotationMode:e=hu.ENABLE,printAnnotationStorage:i=null,isEditing:s=!1}={}){var n;const a=this._transport.getRenderingIntent(t,e,i,s,!0);let r,o=this._intentStates.get(a.cacheKey);return o||(o=Object.create(null),this._intentStates.set(a.cacheKey,o)),o.opListReadCapability||(r=Object.create(null),r.operatorListChanged=function(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(r))},o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(r),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null==(n=this._stats)||n.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(t=>Gu.textContent(t));const e=this.streamTextContent(t);return new Promise(function(t,i){const s=e.getReader(),n={items:[],styles:Object.create(null),lang:null};!function e(){s.read().then(function({value:i,done:s}){s?t(n):(null!=n.lang||(n.lang=i.lang),Object.assign(n.styles,i.styles),n.items.push(...i.items),e())},i)}()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),qd(this,Ma,!1),Promise.all(t)}cleanup(t=!1){qd(this,Ma,!0);const e=Xd(this,Ea,Ca).call(this);return t&&e&&this._stats&&(this._stats=new np),e}_startRenderPage(t,e){var i,s;const n=this._intentStates.get(e);n&&(null==(i=this._stats)||i.timeEnd("Page Request"),null==(s=n.displayReadyCapability)||s.resolve(t))}_renderPageChunk(t,e){for(let i=0,s=t.length;i<s;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const i of e.renderTasks)i.operatorListChanged();t.lastChunk&&Xd(this,Ea,Ca).call(this)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:i,modifiedIds:s}){const{map:n,transfer:a}=i,r=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:n,modifiedIds:s},a).getReader(),o=this._intentStates.get(e);o.streamReader=r;const l=()=>{r.read().then(({value:t,done:e})=>{e?o.streamReader=null:this._transport.destroyed||(this._renderPageChunk(t,o),l())},t=>{if(o.streamReader=null,!this._transport.destroyed){if(o.operatorList){o.operatorList.lastChunk=!0;for(const t of o.renderTasks)t.operatorListChanged();Xd(this,Ea,Ca).call(this)}if(o.displayReadyCapability)o.displayReadyCapability.reject(t);else{if(!o.opListReadCapability)throw t;o.opListReadCapability.reject(t)}}})};l()}_abortOperatorList({intentState:t,reason:e,force:i=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!i){if(t.renderTasks.size>0)return;if(e instanceof Zu){let i=100;return e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),void(t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i))}}if(t.streamReader.cancel(new Iu(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[e,i]of this._intentStates)if(i===t){this._intentStates.delete(e);break}this.cleanup()}}}get stats(){return this._stats}}Ma=new WeakMap,Ea=new WeakSet,Ca=function(){if(!Vd(this,Ma)||this.destroyed)return!1;for(const{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),qd(this,Ma,!1),!0};const rm=class t{constructor({name:e=null,port:i=null,verbosity:s=yu()}={}){if(Gd(this,Na),Gd(this,Ta,Promise.withResolvers()),Gd(this,Pa,null),Gd(this,Da,null),Gd(this,Ra,null),this.name=e,this.destroyed=!1,this.verbosity=s,i){if
1(Vd(t,Fa).has(i))throw new Error("Cannot use more than one PDFWorker per port.");Vd(t,Fa).set(i,this),Xd(this,Na,Ba).call(this,i)}else Xd(this,Na,Oa).call(this)}get promise(){return Vd(this,Ta).promise}get port(){return Vd(this,Da)}get messageHandler(){return Vd(this,Pa)}destroy(){var e,i;this.destroyed=!0,null==(e=Vd(this,Ra))||e.terminate(),qd(this,Ra,null),Vd(t,Fa).delete(Vd(this,Da)),qd(this,Da,null),null==(i=Vd(this,Pa))||i.destroy(),qd(this,Pa,null)}static create(e){const i=Vd(this,Fa).get(null==e?void 0:e.port);if(i){if(i._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return i}return new t(e)}static get workerSrc(){if(kf.workerSrc)return kf.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Mu(this,"_setupFakeWorkerGlobal",(async()=>Vd(this,Ua,Ha)?Vd(this,Ua,Ha):(await import(this.workerSrc)).WorkerMessageHandler)())}};Ta=new WeakMap,Pa=new WeakMap,Da=new WeakMap,Ra=new WeakMap,Ia=new WeakMap,La=new WeakMap,Fa=new WeakMap,Na=new WeakSet,Wa=function(){Vd(this,Ta).resolve(),Vd(this,Pa).send("configure",{verbosity:this.verbosity})},Ba=function(t){qd(this,Da,t),qd(this,Pa,new lg("main","worker",t)),Vd(this,Pa).on("ready",()=>{}),Xd(this,Na,Wa).call(this)},Oa=function(){if(Vd(rm,La)||Vd(rm,Ua,Ha))return void Xd(this,Na,ja).call(this);let{workerSrc:t}=rm;try{rm._isSameOrigin(window.location,t)||(t=rm._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new lg("main","worker",e),s=()=>{n.abort(),i.destroy(),e.terminate(),this.destroyed?Vd(this,Ta).reject(new Error("Worker was destroyed")):Xd(this,Na,ja).call(this)},n=new AbortController;e.addEventListener("error",()=>{Vd(this,Ra)||s()},{signal:n.signal}),i.on("test",t=>{n.abort(),!this.destroyed&&t?(qd(this,Pa,i),qd(this,Da,e),qd(this,Ra,e),Xd(this,Na,Wa).call(this)):s()}),i.on("ready",t=>{if(n.abort(),this.destroyed)s();else try{a()}catch(e){Xd(this,Na,ja).call(this)}});const a=()=>{const t=new Uint8Array;i.send("test",t,[t.buffer])};return void a()}catch(e){}Xd(this,Na,ja).call(this)},ja=function(){Vd(rm,La)||qd(rm,La,!0),rm._setupFakeWorkerGlobal.then(t=>{if(this.destroyed)return void Vd(this,Ta).reject(new Error("Worker was destroyed"));const e=new ag;qd(this,Da,e);const i="fake"+Yd(rm,Ia)._++,s=new lg(i+"_worker",i,e);t.setup(s,e),qd(this,Pa,new lg(i,i+"_worker",e)),Xd(this,Na,Wa).call(this)}).catch(t=>{Vd(this,Ta).reject(new Error(`Setting up fake worker failed: "${t.message}".`))})},Ua=new WeakSet,Ha=function(){var t;try{return(null==(t=globalThis.pdfjsWorker)?void 0:t.WorkerMessageHandler)||null}catch(e){return null}},Gd(rm,Ua),Gd(rm,Ia,0),Gd(rm,La,!1),Gd(rm,Fa,new WeakMap),ru&&(qd(rm,La,!0),kf.workerSrc||(kf.workerSrc="./pdf.worker.mjs")),rm._isSameOrigin=(t,e)=>{const i=URL.parse(t);if(!(null==i?void 0:i.origin)||"null"===i.origin)return!1;const s=new URL(e,i);return i.origin===s.origin},rm._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},rm.fromPort=t=>{if(!(null==t?void 0:t.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return rm.create(t)};let om=rm;class lm{constructor(t,e,i,s,n,a){Gd(this,Xa),Gd(this,$a,new Map),Gd(this,za,new Map),Gd(this,Va,new Map),Gd(this,Ga,new Map),Gd(this,qa,null),this.messageHandler=t,this.loadingTask=e,this.commonObjs=new Jf,this.fontLoader=new tg({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.wasmFactory=n.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.enableHWA=a,this.setupMessageHandler()}get annotationStorage(){return Mu(this,"annotationStorage",new Jp)}
1getRenderingIntent(t,e=hu.ENABLE,i=null,s=!1,n=!1){let a=2,r=Qp;switch(t){case"any":a=1;break;case"display":break;case"print":a=4}const o=4&a&&i instanceof Zp?i:this.annotationStorage;switch(e){case hu.DISABLE:a+=64;break;case hu.ENABLE:break;case hu.ENABLE_FORMS:a+=16;break;case hu.ENABLE_STORAGE:a+=32,r=o.serializable}s&&(a+=128),n&&(a+=256);const{ids:l,hash:h}=o.modifiedIds;return{renderingIntent:a,cacheKey:[a,r.hash,h].join("_"),annotationStorageSerializable:r,modifiedIds:l}}destroy(){var t;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),null==(t=Vd(this,qa))||t.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const s of Vd(this,za).values())e.push(s._destroy());Vd(this,za).clear(),Vd(this,Va).clear(),Vd(this,Ga).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const i=this.messageHandler.sendWithPromise("Terminate",null);return e.push(i),Promise.all(e).then(()=>{var t,e;this.commonObjs.clear(),this.fontLoader.clear(),Vd(this,$a).clear(),this.filterFactory.destroy(),Zf.cleanup(),null==(t=this._networkStream)||t.cancelAllRequests(new Iu("Worker was terminated.")),null==(e=this.messageHandler)||e.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(t,e)=>{xu(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then(function({value:t,done:i}){i?e.close():(xu(t instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("ReaderHeadersReady",async t=>{var i;await this._fullReader.headersReady;const{isStreamingSupported:s,isRangeSupported:n,contentLength:a}=this._fullReader;return s&&n||(this._lastProgress&&(null==(i=e.onProgress)||i.call(e,this._lastProgress)),this._fullReader.onProgress=t=>{var i;null==(i=e.onProgress)||i.call(e,{loaded:t.loaded,total:t.total})}),{isStreamingSupported:s,isRangeSupported:n,contentLength:a}}),t.on("GetRangeReader",(t,e)=>{xu(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(t.begin,t.end);i?(e.onPull=()=>{i.read().then(function({value:t,done:i}){i?e.close():(xu(t instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{i.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}):e.close()}),t.on("GetDoc",({pdfInfo:t})=>{this._numPages=t.numPages,this._htmlForXfa=t.htmlForXfa,delete t.htmlForXfa,e._capability.resolve(new nm(t,this))}),t.on("DocException",t=>{e._capability.reject(og(t))}),t.on("PasswordRequest",t=>{qd(this,qa,Promise.withResolvers());try{if(!e.onPassword)throw og(t);const i=t=>{t instanceof Error?Vd(this,qa).reject(t):Vd(this,qa).resolve({password:t})};e.onPassword(i,t.code)}catch(i){Vd(this,qa).reject(i)}return Vd(this,qa).promise}),t.on("DataLoaded",t=>{var i;null==(i=e.onProgress)||i.call(e,{loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)}),t.on("StartRenderPage",t=>{this.destroyed||Vd(this,za).get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)}),t.on("commonobj",([e,i,s])=>{var n;if(this.destroyed)return null;if(this.commonObjs.has(e))return null;switch(i){case"Font":if("error"in s){const t=s.error;this.commonObjs.resolve(e,t);break}const a=new xf(s),r=this._params.pdfBug&&(null==(n=globalThis.FontInspector)?void 0:n.enabled)?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,o=new eg(a,r,s.extra,s.charProcOperatorList);this.fontLoader.bind(o).catch(()=>t.sendWithPromise("FontFallback",{id:e})).finally(()=>{!o.fontExtraProperties&&o.data&&o.clearData(),this.commonObjs.resolve(e,o)});break;case"CopyLocalImage":const{imageRef:l}=s;xu(l,"The imageRef must be defined.");for(const t of Vd(this,za).values())for(const[,i]of t.objs)if((null==i?void 0:i.ref)===l)return i.dataLen?(this.commonObjs.resolve(e,structuredClone(i)),i.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(e,s);break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([t,e,i,s])=>{var n;if(this.destroyed)return;const a=Vd(this,za).get(e);if(!a.objs.has(t))if(0!==a._intentStates.size)switch(i){case"Image":case"Pattern":a.objs.resolve(t,s);break;default:throw new Error(`Got unknown object type ${i}`)}else null==(n=null==s?void 0:s.bitmap)||n.close()}),t.on("DocProgress",t=>{var i;this.destroyed||null==(i=e.onProgress)||i.call(e,{loaded:t.loaded,total:t.total})}),t.on("FetchBinaryData",async t=>{if(this.destroyed)throw new Error("Worker was destroyed.");const e=this[t.type];if(!e)throw new Error(`${t.type} not initialized, see the \`useWorkerFetch\` parameter.`);return e.fetch(t)})}
1getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var t,e;this.annotationStorage.size;const{map:i,transfer:s}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:i,filename:null!=(e=null==(t=this._fullReader)?void 0:t.filename)?e:null},s).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,i=Vd(this,Va).get(e);if(i)return i;const s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&Vd(this,Ga).set(i.refStr,t);const s=new am(e,i,this,this._params.pdfBug);return Vd(this,za).set(e,s),s});return Vd(this,Va).set(e,s),s}getPageIndex(t){return sg(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 Xd(this,Xa,Ya).call(this,"GetFieldObjects")}hasJSActions(){return Xd(this,Xa,Ya).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!=typeof t?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}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)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return Xd(this,Xa,Ya).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 Xd(this,Xa,Ya).call(this,"GetOptionalContentConfig").then(e=>new Cf(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=Vd(this,$a).get(t);if(e)return e;const i=this.messageHandler.sendWithPromise(t,null).then(t=>{var e,i,s,n;return{info:t[0],metadata:t[1]?new Sf(t[1]):null,contentDispositionFilename:null!=(i=null==(e=this._fullReader)?void 0:e.filename)?i:null,contentLength:null!=(n=null==(s=this._fullReader)?void 0:s.contentLength)?n:null}});return Vd(this,$a).set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of Vd(this,za).values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),Vd(this,$a).clear(),this.filterFactory.destroy(!0),Zf.cleanup()}}cachedPageNumber(t){var e;if(!sg(t))return null;const i=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`;return null!=(e=Vd(this,Ga).get(i))?e:null}}$a=new WeakMap,za=new WeakMap,Va=new WeakMap,Ga=new WeakMap,qa=new WeakMap,Xa=new WeakSet,Ya=function(t,e=null){const i=Vd(this,$a).get(t);if(i)return i;const s=this.messageHandler.sendWithPromise(t,e);return Vd(this,$a).set(t,s),s};class hm{constructor(t){Gd(this,Ka,null),$d(this,"onContinue",null),$d(this,"onError",null),qd(this,Ka,t)}get promise(){return Vd(this,Ka).capability.promise}cancel(t=0){Vd(this,Ka).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=Vd(this,Ka).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=Vd(this,Ka);return t.form||t.canvas&&(null==e?void 0:e.size)>0}}Ka=new WeakMap;const cm=class t{constructor({callback:t,params:e,objs:i,commonObjs:s,annotationCanvasMap:n,operatorList:a,pageIndex:r,canvasFactory:o,filterFactory:l,useRequestAnimationFrame:h=!1,pdfBug:c=!1,pageColors:d=null,enableHWA:u=!1,operationsFilter:p=null}){Gd(this,Qa,null),this.callback=t,this.params=e,this.objs=i,this.commonObjs=s,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=r,this.canvasFactory=o,this.filterFactory=l,this._pdfBug=c,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===h&&"undefined"!=typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new hm(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvas,this._canvasContext=e.canvas?null:e.canvasContext,this._enableHWA=u,this._dependencyTracker=e.depen
1dencyTracker,this._operationsFilter=p}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:i}){var s,n;if(this.cancelled)return;if(this._canvas){if(Vd(t,Ja).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.");Vd(t,Ja).add(this._canvas)}this._pdfBug&&(null==(s=globalThis.StepperManager)?void 0:s.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:a,transform:r,background:o,dependencyTracker:l}=this.params,h=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new vf(h,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:i},this.annotationCanvasMap,this.pageColors,l),this.gfx.beginDrawing({transform:r,viewport:
1a,transparency:e,background:o}),this.operatorListIdx=0,this.graphicsReady=!0,null==(n=this.graphicsReadyCallback)||n.call(this)}cancel(e=null,i=0){var s,n,a;this.running=!1,this.cancelled=!0,null==(s=this.gfx)||s.endDrawing(),Vd(this,Qa)&&(window.cancelAnimationFrame(Vd(this,Qa)),qd(this,Qa,null)),Vd(t,Ja).delete(this._canvas),e||(e=new Zu(`Rendering cancelled, page ${this._pageIndex+1}`,i)),this.callback(e),null==(a=(n=this.task).onError)||a.call(n,e)}operatorListChanged(){var t,e;this.graphicsReady?(null==(t=this.gfx.dependencyTracker)||t.growOperationsCount(this.operatorList.fnArray.length),null==(e=this.stepper)||e.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?qd(this,Qa,window.requestAnimationFrame(()=>{qd(this,Qa,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),Vd(t,Ja).delete(this._canvas),this.callback())))}};Qa=new WeakMap,Ja=new WeakMap,Gd(cm,Ja,new WeakSet);let dm=cm;const um="5.4.296",pm="f56dc8601",gm=class t{constructor({editor:e=null,uiManager:i=null}){var s,n;Gd(this,cr),Gd(this,Za,null),Gd(this,tr,null),Gd(this,er),Gd(this,ir,null),Gd(this,sr,!1),Gd(this,nr,!1),Gd(this,ar,null),Gd(this,rr),Gd(this,or,null),Gd(this,lr,null),e?(qd(this,nr,!1),qd(this,ar,e)):qd(this,nr,!0),qd(this,lr,(null==e?void 0:e._uiManager)||i),qd(this,rr,Vd(this,lr)._eventBus),qd(this,er,(null==(s=null==e?void 0:e.color)?void 0:s.toUpperCase())||(null==(n=Vd(this,lr))?void 0:n.highlightColors.values().next().value)||"#FFFF98"),Vd(t,hr)||qd(t,hr,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return Mu(this,"_keyboardManager",new Lp([[["Escape","mac+Escape"],t.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],t.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],t.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],t.prototype._moveToPrevious],[["Home","mac+Home"],t.prototype._moveToBeginning],[["End","mac+End"],t.prototype._moveToEnd]]))}renderButton(){const t=qd(this,Za,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",Vd(this,ar)&&(t.ariaControls=`${Vd(this,ar).id}_colorpicker_dropdown`);const e=Vd(this,lr)._signal;t.addEventListener("click",Xd(this,cr,gr).bind(this),{signal:e}),t.addEventListener("keydown",Xd(this,cr,pr).bind(this),{signal:e});const i=qd(this,tr,document.createElement("span"));return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=Vd(this,er),t.append(i),t}renderMainDropdown(){const t=qd(this,ir,Xd(this,cr,dr).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===Vd(this,Za))return void Xd(this,cr,gr).call(this,t);const e=t.target.getAttribute("data-color");e&&Xd(this,cr,ur).call(this,e,t)}_moveToNext(t){var e,i;Vd(this,cr,mr)?t.target!==Vd(this,Za)?null==(i=t.target.nextSibling)||i.focus():null==(e=Vd(this,ir).firstChild)||e.focus():Xd(this,cr,gr).call(this,t)}_moveToPrevious(t){var e,i;t.target!==(null==(e=Vd(this,ir))?void 0:e.firstChild)&&t.target!==Vd(this,Za)?(Vd(this,cr,mr)||Xd(this,cr,gr).call(this,t),null==(i=t.target.previousSibling)||i.focus()):Vd(this,cr,mr)&&this._hideDropdownFromKeyboard()}_moveToBeginning(t){var e;Vd(this,cr,mr)?null==(e=Vd(this,ir).firstChild)||e.focus():Xd(this,cr,gr).call(this,t)}_moveToEnd(t){var e;Vd(this,cr,mr)?null==(e=Vd(this,ir).lastChild)||e.focus():Xd(this,cr,gr).call(this,t)}hideDropdown(){var t,e;null==(t=Vd(this,ir))||t.classList.add("hidden"),Vd(this,Za).ariaExpanded="false",null==(e=Vd(this,or))||e.abort(),qd(this,or,null)}_hideDropdownFromKeyboard(){var t;Vd(this,nr)||(Vd(this,cr,mr)?(this.hideDropdown(),Vd(this,Za).focus({preventScroll:!0,focusVisible:Vd(this,sr)})):null==(t=Vd(this,ar))||t.unselect())}updateColor(t){if(Vd(this,tr)&&(Vd(this,tr).style.backgroundColor=t),!Vd(this,ir))return;const e=Vd(this,lr).highlightColors.values();for(const i of Vd(this,ir).children)i.ariaSelected=e.next().value===t.toUpperCase()}destroy(){var t,e;null==(t=Vd(this,Za))||t.remove(),qd(this,Za,null),qd(this,tr,null),null==(e=Vd(this,ir))||e.remove(),qd(this,ir,null)}};Za=new WeakMap,tr=new WeakMap,er=new WeakMap,ir=new WeakMap,sr=new WeakMap,nr=new WeakMap,ar=new WeakMap,rr=new WeakMap,or=new WeakMap,lr=new WeakMap,hr=ne
1w WeakMap,cr=new WeakSet,dr=function(){const t=document.createElement("div"),e=Vd(this,lr)._signal;t.addEventListener("contextmenu",rp,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),Vd(this,ar)&&(t.id=`${Vd(this,ar).id}_colorpicker_dropdown`);for(const[i,s]of Vd(this,lr).highlightColors){const n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",s),n.title=i,n.setAttribute("data-l10n-id",Vd(gm,hr)[i]);const a=document.createElement("span");n.append(a),a.className="swatch",a.style.backgroundColor=s,n.ariaSelected=s===Vd(this,er),n.addEventListener("click",Xd(this,cr,ur).bind(this,s),{signal:e}),t.append(n)}return t.addEventListener("keydown",Xd(this,cr,pr).bind(this),{signal:e}),t},ur=function(t,e){e.stopPropagation(),Vd(this,rr).dispatch("switchannotationeditorparams",{source:this,type:uu.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)},pr=function(t){gm._keyboardManager.exec(this,t)},gr=function(t){if(Vd(this,cr,mr))return void this.hideDropdown();if(qd(this,sr,0===t.detail),Vd(this,or)||(qd(this,or,new AbortController),window.addEventListener("pointerdown",Xd(this,cr,fr).bind(this),{signal:Vd(this,lr).combinedSignal(Vd(this,or))})),Vd(this,Za).ariaExpanded="true",Vd(this,ir))return void Vd(this,ir).classList.remove("hidden");const e=qd(this,ir,Xd(this,cr,dr).call(this));Vd(this,Za).append(e)},fr=function(t){var e;(null==(e=Vd(this,ir))?void 0:e.contains(t.target))||this.hideDropdown()},mr=function(){return Vd(this,ir)&&!Vd(this,ir).classList.contains("hidden")},Gd(gm,hr,null);let fm=gm;const mm=class t{constructor(e){Gd(this,vr,null),Gd(this,wr,null),Gd(this,br,null),qd(this,wr,e),qd(this,br,e._uiManager),Vd(t,yr)||qd(t,yr,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(Vd(this,vr))return Vd(this,vr);const{editorType:e,colorType:i,colorValue:s}=Vd(this,wr),n=qd(this,vr,document.createElement("input"));return n.type="color",n.value=s||"#000000",n.className="basicColorPicker",n.tabIndex=0,n.setAttribute("data-l10n-id",Vd(t,yr)[e]),n.addEventListener("input",()=>{Vd(this,br).updateParams(i,n.value)},{signal:Vd(this,br)._signal}),n}update(t){Vd(this,vr)&&(Vd(this,vr).value=t)}destroy(){var t;null==(t=Vd(this,vr))||t.remove(),qd(this,vr,null)}hideDropdown(){}};vr=new WeakMap,wr=new WeakMap,br=new WeakMap,yr=new WeakMap,Gd(mm,yr,null);let vm=mm;function wm(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function bm(t){return Math.max(0,Math.min(255,255*t))}class ym{static CMYK_G([t,e,i,s]){return["G",1-Math.min(1,.3*t+.59*i+.11*e+s)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return[t=bm(t),t,t]}static G_HTML([t]){const e=wm(t);return`#${e}${e}${e}`}static RGB_G([t,e,i]){return["G",.3*t+.59*e+.11*i]}static RGB_rgb(t){return t.map(bm)}static RGB_HTML(t){return`#${t.map(wm).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,i,s]){return["RGB",1-Math.min(1,t+s),1-Math.min(1,i+s),1-Math.min(1,e+s)]}static CMYK_rgb([t,e,i,s]){return[bm(1-Math.min(1,t+s)),bm(1-Math.min(1,i+s)),bm(1-Math.min(1,e+s))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,i]){const s=1-t,n=1-e,a=1-i;return["CMYK",s,n,a,Math.min(s,n,a)]}}class Am{create(t,e,i=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),i||(s.setAttribute("width",`${t}px`),s.setAttribute("height",`${e}px`)),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${t} ${e}`),s}createElement(t){if("string"!=typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){_u("Abstract method `_createSVG` called.")}}class _m extends Am{_createSVG(t){return document.createElementNS(Xu,t)}}const xm=new WeakSet,km=60*(new Date).getTimezoneOffset()*1e3;class Sm{static create(t){switch(t.data.annotationType){case fu.LINK:return new Cm(t);case fu.TEXT:return new Tm(t);case fu.WIDGET:switch(t.data.fieldType){case"Tx":return new Dm(t);case"Btn":return t.data.radioButton?new Lm(t):t.data.checkBox?new Im(t):new Fm(t);case"Ch":return new Nm(t);case"Sig":return new Rm(t)}return new Pm(t);case fu.POPUP:return new Wm(t);case fu.FREETEXT:return new Om(t);case fu.LINE:return new jm(t);case fu.SQUARE:return new Um(t);case fu.CIRCLE:return new Hm(t);case fu.POLYLINE:return new $m(t);case fu.CARET:return new Vm(t);case fu.INK:return new Gm(t);case fu.POLYGON:return new zm(t);case fu.HIGHLIGHT:return new qm(t);case fu.UNDERLINE:return new Xm(t);case fu.SQUIGGLY:return new Ym(t);case fu.STRIKEOUT:return new Km(t);case fu.STAMP:return new Qm(t);case fu.FILEATTACHMENT:return new Jm(t);default:return new Mm(t)}}}Ar=new WeakMap,_r=new WeakMap,xr=new WeakMap,kr=new WeakSet,Sr=function(t){const{container:{style:e},data:{rect:i,rotation:s},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:a,pageX:r,pageY:o}}}}=this;null==i||i.splice(0,4,...t),e.left=100*(t[0]-r)/n+"%",e.top=100*(a-t[3]+o)/a+"%",0===s?(e.width=100*(t[2]-t[0])/n+"%",e.height=100*(t[3]-t[1])/a+"%"):this.setRotation(s)};let Mm=class t{constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:s=!1}={}){Gd(this,kr),Gd(this,Ar,null),Gd(this,_r,!1),Gd(this,xr,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.enableComment=t.enableComment,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(i)),s&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!(!(null==t?void 0:t.str)&&!(null==e?void 0:e.str))}get _isEditable(){return this.data.isEditable}get hasPopupData(){return t._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){var t;const{data:e}=this,i=null==(t=this.annotationStorage)?void 0:t.getEditor(e.id);return i?i.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}
1get commentButtonPosition(){var t;const e=null==(t=this.annotationStorage)?void 0:t.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;const{quadPoints:i,inkLists:s,rect:n}=this.data;let a=-1/0,r=-1/0;if((null==i?void 0:i.length)>=8){for(let t=0;t<i.length;t+=8)i[t+1]>r?(r=i[t+1],a=i[t+2]):i[t+1]===r&&(a=Math.max(a,i[t+2]));return[a,r]}if((null==s?void 0:s.length)>=1){for(const t of s)for(let e=0,i=t.length;e<i;e+=2)t[e+1]>r?(r=t[e+1],a=t[e]):t[e+1]===r&&(a=Math.max(a,t[e]));if(a!==1/0)return[a,r]}return n?[n[2],n[3]]:null}_normalizePoint(t){const{page:{view:e},viewport:{rawDims:{pageWidth:i,pageHeight:s,pageX:n,pageY:a}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-n)/i,t[1]=100*(t[1]-a)/s,t}get commentText(){var t,e,i;const{data:s}=this;return(null==(e=null==(t=this.annotationStorage.getRawValue(`${cu}${s.id}`))?void 0:t.popup)?void 0:e.contents)||(null==(i=s.contentsObj)?void 0:i.str)||""}set commentText(t){const{data:e}=this,i={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:i})||this.annotationStorage.setValue(`${cu}${e.id}`,{id:e.id,annotationType:e.annotationType,pageIndex:this.parent.page._pageIndex,popup:i,popupRef:e.popupRef,modificationDate:new Date}),t||this.removePopup()}removePopup(){var t,e;null==(e=(null==(t=Vd(this,xr))?void 0:t.popup)||this.popup)||e.remove(),qd(this,xr,this.popup=null)}updateEdited(t){var e;if(!this.container)return;t.rect&&(Vd(this,Ar)||qd(this,Ar,{rect:this.data.rect.slice(0)}));const{rect:i,popup:s}=t;i&&Xd(this,kr,Sr).call(this,i);let n=(null==(e=Vd(this,xr))?void 0:e.popup)||this.popup;!n&&(null==s?void 0:s.text)&&(this._createPopup(s),n=Vd(this,xr).popup),n&&(n.updateEdited(t),(null==s?void 0:s.deleted)&&(n.remove(),qd(this,xr,null),this.popup=null))}resetEdited(){var t;Vd(this,Ar)&&(Xd(this,kr,Sr).call(this,Vd(this,Ar).rect),null==(t=Vd(this,xr))||t.popup.resetEdited(),qd(this,Ar,null))}_createContainer(t){const{data:e,parent:{page:i,viewport:s}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),this instanceof Pm||this instanceof Cm||(n.tabIndex=0);const{style:a}=n;if(a.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof Wm){const{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,n),n}const{width:r,height:o}=this;if(!t&&e.borderStyle.width>0){a.borderWidth=`${e.borderStyle.width}px`;const t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;if(t>0||i>0){const e=`calc(${t}px * var(--total-scale-factor)) / calc(${i}px * var(--total-scale-factor))`;a.borderRadius=e}else if(this instanceof Lm){const t=`calc(${r}px * var(--total-scale-factor)) / calc(${o}px * var(--total-scale-factor))`;a.borderRadius=t}switch(e.borderStyle.style){case 1:a.borderStyle="solid";break;case 2:a.borderStyle="dashed";break;case 3:case 4:break;case 5:a.borderBottomStyle="solid"}const s=e.borderColor||null;s?(qd(this,_r,!0),a.borderColor=Bu.makeHexColor(0|s[0],0|s[1],0|s[2])):a.borderWidth=0}const l=Bu.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:h,pageHeight:c,pageX:d,pageY:u}=s.rawDims;a.left=100*(l[0]-d)/h+"%",a.top=100*(l[1]-u)/c+"%";const{rotation:p}=e;return e.hasOwnCanvas||0===p?(a.width=100*r/h+"%",a.height=100*o/c+"%"):this.setRotation(p,n),n}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:i,pageHeight:s}=this.parent.viewport.rawDims;let{width:n,height:a}=this;t%180!=0&&([n,a]=[a,n]),e.style.width=100*n/i+"%",e.style.height=100*a/s+"%",e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(t,e,i)=>{const s=i.detail[t],n=s[0],a=s.slice(1);i.target.style[e]=ym[`${n}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[e]:ym[`${n}_rgb`](a)})};return Mu(this,"_commonActions",{display:t=>{const{display:e}=t.detail,i=e%2==1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===e||2===e})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout(()=>
1t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{const e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){const i=this._commonActions;for(const s of Object.keys(e.detail)){const n=t[s]||i[s];null==n||n(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const[s,n]of Object.entries(e)){const a=i[s];a&&(a({detail:{[s]:n},target:t}),delete e[s])}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,i,s,n]=this.data.rect.map(t=>Math.fround(t));if(8===t.length){const[a,r,o,l]=t.subarray(2,6);if(s===a&&n===r&&e===o&&i===l)return}const{style:a}=this.container;let r;if(Vd(this,_r)){const{borderColor:t,borderWidth:e}=a;a.borderWidth=0,r=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${t}" stroke-width="${e}">`],this.container.classList.add("hasBorder")}const o=s-e,l=n-i,{svgFactory:h}=this,c=h.createElement("svg");c.classList.add("quadrilateralsContainer"),c.setAttribute("width",0),c.setAttribute("height",0),c.role="none";const d=h.createElement("defs");c.append(d);const u=h.createElement("clipPath"),p=`clippath_${this.data.id}`;u.setAttribute("id",p),u.setAttribute("clipPathUnits","objectBoundingBox"),d.append(u);for(let g=2,f=t.length;g<f;g+=8){const i=t[g],s=t[g+1],a=t[g+2],c=t[g+3],d=h.createElement("rect"),p=(a-e)/o,f=(n-s)/l,m=(i-a)/o,v=(s-c)/l;d.setAttribute("x",p),d.setAttribute("y",f),d.setAttribute("width",m),d.setAttribute("height",v),u.append(d),null==r||r.push(`<rect vector-effect="non-scaling-stroke" x="${p}" y="${f}" width="${m}" height="${v}"/>`)}Vd(this,_r)&&(r.push("</g></svg>')"),a.backgroundImage=r.join("")),this.container.append(c),this.container.style.clipPath=`url(#${p})`}_createPopup(t=null){const{data:e}=this;let i,s;t?(i={str:t.text},s=t.date):(i=e.contentsObj,s=e.modificationDate);const n=qd(this,xr,new Wm({data:{color:e.color,titleObj:e.titleObj,modificationDate:s,contentsObj:i,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}));this.parent._commentManager||this.parent.div.append(n.render())}get hasPopupElement(){return!!(Vd(this,xr)||this.popup||this.data.popupRef)}get extraPopupElement(){return Vd(this,xr)}render(){_u("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const i=[];if(this._fieldObjects){const s=this._fieldObjects[t];if(s)for(const{page:t,id:n,exportValues:a}of s){if(-1===t)continue;if(n===e)continue;const s="string"==typeof a?a:null,r=document.querySelector(`[data-element-id="${n}"]`);!r||xm.has(r)?i.push({id:n,exportValue:s,domElement:r}):Au()}return i}for(const s of document.getElementsByName(t)){const{exportValue:t}=s,n=s.getAttribute("data-element-id");n!==e&&xm.has(s)&&i.push({id:n,exportValue:t,domElement:s})}return i}show(){var t;this.container&&(this.container.hidden=!1),null==(t=this.popup)||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),null==(t=this.popup)||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")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var i;null==(i=this.linkService.eventBus)||i.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};class Em extends Mm{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.editor=t.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){const{editor:t}=this;t.hasComment&&(this._createPopup(t.comment),this.extraPopupElement.popup.renderCommentButton())}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}
1get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(t){this.editor.comment=t,t||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.container.remove(),this.container=null,this.removePopup()}}class Cm extends Mm{constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!(null==e?void 0:e.ignoreBorder),createQuadrilaterals:!0}),Gd(this,Mr),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let s=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),s=!0):t.action?(this._bindNamedAction(i,t.action,t.overlaidText),s=!0):t.attachment?(Xd(this,Mr,Cr).call(this,i,t.attachment,t.overlaidText,t.attachmentDest),s=!0):t.setOCGState?(Xd(this,Mr,Tr).call(this,i,t.setOCGState,t.overlaidText),s=!0):t.dest?(this._bindLink(i,t.dest,t.overlaidText),s=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),s=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),s=!0):this.isTooltipOnly&&!s&&(this._bindLink(i,""),s=!0)),this.container.classList.add("linkAnnotation"),s&&this.container.append(i),this.container}_bindLink(t,e,i=""){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&Xd(this,Mr,Er).call(this),i&&(t.title=i)}_bindNamedAction(t,e,i=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),i&&(t.title=i),Xd(this,Mr,Er).call(this)}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const s of Object.keys(e.actions)){const n=i.get(s);n&&(t[n]=()=>{var t;return null==(t=this.linkService.eventBus)||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:s}}),!1})}e.overlaidText&&(t.title=e.overlaidText),t.onclick||(t.onclick=()=>!1),Xd(this,Mr,Er).call(this)}_bindResetFormAction(t,e){const i=t.onclick;i||(t.href=this.linkService.getAnchorUrl("")),Xd(this,Mr,Er).call(this),this._fieldObjects?t.onclick=()=>{var t;null==i||i();const{fields:s,refs:n,include:a}=e,r=[];if(0!==s.length||0!==n.length){const t=new Set(n);for(const e of s){const i=this._fieldObjects[e]||[];for(const{id:e}of i)t.add(e)}for(const e of Object.values(this._fieldObjects))for(const i of e)t.has(i.id)===a&&r.push(i)}else for(const e of Object.values(this._fieldObjects))r.push(...e);const o=this.annotationStorage,l=[];for(const e of r){const{id:t}=e;switch(l.push(t),e.type){case"text":{const i=e.defaultValue||"";o.setValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;o.setValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";o.setValue(t,{value:i});break}default:continue}const i=document.querySelector(`[data-element-id="${t}"]`);i&&(xm.has(i)?i.dispatchEvent(new Event("resetform")):Au())}return this.enableScripting&&(null==(t=this.linkService.eventBus)||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:l,name:"ResetForm"}})),!1}:i||(t.onclick=()=>!1)}}Mr=new WeakSet,Er=function(){this.container.setAttribute("data-internal-link","")},Cr=function(t,e,i="",s=null){t.href=this.linkService.getAnchorUrl(""),e.description?t.title=e.description:i&&(t.title=i),t.onclick=()=>{var t;return null==(t=this.downloadManager)||t.openOrDownloadData(e.content,e.filename,s),!1},Xd(this,Mr,Er).call(this)},Tr=function(t,e,i=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),i&&(t.title=i),Xd(this,Mr,Er).call(this)};class Tm extends Mm{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}}
1class Pm extends Mm{render(){return this.container}showElementAndHideCanvas(t){var e;this.data.hasOwnCanvas&&("CANVAS"===(null==(e=t.previousSibling)?void 0:e.nodeName)&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return Nu.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,s,n){i.includes("mouse")?t.addEventListener(i,t=>{var e;null==(e=this.linkService.eventBus)||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:n(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})}):t.addEventListener(i,t=>{var a;if("blur"===i){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}n&&(null==(a=this.linkService.eventBus)||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:n(t)}}))})}_setEventListeners(t,e,i,s){var n,a,r;for(const[o,l]of i)("Action"===l||(null==(n=this.data.actions)?void 0:n[l]))&&("Focus"!==l&&"Blur"!==l||e||(e={focused:!1}),this._setEventListener(t,e,o,l,s),"Focus"!==l||(null==(a=this.data.actions)?void 0:a.Blur)?"Blur"!==l||(null==(r=this.data.actions)?void 0:r.Focus)||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null))}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":Bu.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const{fontColor:e}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||9,s=t.style;let n;const a=t=>Math.round(10*t)/10;if(this.data.multiLine){const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),e=t/(Math.round(t/(lu*i))||1);n=Math.min(i,a(e/lu))}else{const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2);n=Math.min(i,a(t/lu))}s.fontSize=`calc(${n}px * var(--total-scale-factor))`,s.color=Bu.makeHexColor(e[0],e[1],e[2]),null!==this.data.textAlignment&&(s.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class Dm extends Pm{constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,i,s){const n=this.annotationStorage;
1for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=i),n.setValue(a.id,{[s]:i})}render(){var t,e;const i=this.annotationStorage,s=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const a=i.getValue(s,{value:this.data.fieldValue});let r=a.value||"";const o=i.getValue(s,{charLimit:this.data.maxLen}).charLimit;o&&r.length>o&&(r=r.slice(0,o));let l=a.formattedValue||(null==(t=this.data.textContent)?void 0:t.join("\n"))||null;l&&this.data.comb&&(l=l.replaceAll(/\s+/g,""));const h={userValue:r,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=null!=l?l:r,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type=this.data.password?"password":"text",n.setAttribute("value",null!=l?l:r),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),xm.add(n),n.setAttribute("data-element-id",s),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=0;const{datetimeFormat:c,datetimeType:d,timeStep:u}=this.data,p=!!d&&this.enableScripting;c&&(n.title=c),this._setRequired(n,this.data.required),o&&(n.maxLength=o),n.addEventListener("input",t=>{i.setValue(s,{value:t.target.value}),this.setPropertyOnSiblings(n,"value",t.target.value,"value"),h.formattedValue=null}),n.addEventListener("resetform",t=>{var e;const i=null!=(e=this.data.defaultFieldValue)?e:"";n.value=h.userValue=i,h.formattedValue=null});let g=t=>{const{formattedValue:e}=h;null!=e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",t=>{var e;if(h.focused)return;const{target:i}=t;if(p&&(i.type=d,u&&(i.step=u)),h.userValue){const t=h.userValue;if(p)if("time"===d){const e=new Date(t),s=[e.getHours(),e.getMinutes(),e.getSeconds()];i.value=s.map(t=>t.toString().padStart(2,"0")).join(":")}else i.value=new Date(t-km).toISOString().split("date"===d?"T":".",1)[0];else i.value=t}h.lastCommittedValue=i.value,h.commitKey=1,(null==(e=this.data.actions)?void 0:e.Focus)||(h.focused=!0)}),n.addEventListener("updatefromsandbox",t=>{this.showElementAndHideCanvas(t.target);const e={value(t){var e;h.userValue=null!=(e=t.detail.value)?e:"",p||i.setValue(s,{value:h.userValue.toString()}),t.target.value=h.userValue},formattedValue(t){const{formattedValue:e}=t.detail;h.formattedValue=e,null!=e&&t.target!==document.activeElement&&(t.target.value=e);const n={formattedValue:e};p&&(n.value=e),i.setValue(s,n)},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:t=>{var e;const{charLimit:n}=t.detail,{target:a}=t;if(0===n)return void a.removeAttribute("maxLength");a.setAttribute("maxLength",n);let r=h.userValue;!r||r.length<=n||(r=r.slice(0,n),a.value=h.userValue=r,i.setValue(s,{value:r}),null==(e=this.linkService.eventBus)||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s,name:"Keystroke",value:r,willCommit:!0,commitKey:1,selStart:a.selectionStart,selEnd:a.selectionEnd}}))}};this._dispatchEventFromSandbox(e,t)}),n.addEventListener("keydown",t=>{var e;h.commitKey=1;let i=-1;if("Escape"===t.key?i=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(h.commitKey=3):i=2,-1===i)return;const{value:n}=t.target;h.lastCommittedValue!==n&&(h.lastCommittedValue=n,h.userValue=n,null==(e=this.linkService.eventBus)||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s,name:"Keystroke",value:n,willCommit:!0,commitKey:i,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))});const t=g;g=null,n.addEventListener("blur",e=>{var i,n;if(!h.focused||!e.relatedTarget)return;(null==(i=this.data.actions)?void 0:i.Blur)||(h.focused=!1);const{target:a}=e;let{value:r}=a;if(p){if(r&&"time"===d){const t=r.split(":").map(t=>parseInt(t,10));r=new Date(2e3,0,1,t[0],t[1],t[2]||0).valueOf(),a.step=""}else r.includes("T")||(r=`${r}T00:00`),r=new Date(r).valueOf();a.type="text"}h.userValue=r,h.lastCommittedValue!==r&&(null==(n=this.linkService.eventBus)||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s,name:"Keystroke",value:r,willC
vendor: 4,575 bytes, line 1
1ommit:!0,commitKey:h.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}})),t(e)}),(null==(e=this.data.actions)?void 0:e.Keystroke)&&n.addEventListener("beforeinput",t=>{var e;h.lastCommittedValue=null;const{data:i,target:n}=t,{value:a,selectionStart:r,selectionEnd:o}=n;let l=r,c=o;switch(t.inputType){case"deleteWordBackward":{const t=a.substring(0,r).match(/\w*[^\w]*$/);t&&(l-=t[0].length);break}case"deleteWordForward":{const t=a.substring(r).match(/^[^\w]*\w*/);t&&(c+=t[0].length);break}case"deleteContentBackward":r===o&&(l-=1);break;case"deleteContentForward":r===o&&(c+=1)}t.preventDefault(),null==(e=this.linkService.eventBus)||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s,name:"Keystroke",value:a,change:i||"",willCommit:!1,selStart:l,selEnd:c}})}),this._setEventListeners(n,h,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.value)}if(g&&n.addEventListener("blur",g),this.data.comb){const t=(this.data.rect[2]-this.data.rect[0])/o;n.classList.add("comb"),n.style.letterSpacing=`calc(${t}px * var(--total-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 Rm extends Pm{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class Im extends Pm{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,i=e.id;let s=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"==typeof s&&(s="Off"!==s,t.setValue(i,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return xm.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,s&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=0,n.addEventListener("change",s=>{const{name:n,checked:a}=s.target;for(const r of this._getElementsByName(n,i)){const i=a&&r.exportValue===e.exportValue;r.domElement&&(r.domElement.checked=i),t.setValue(r.id,{value:i})}t.setValue(i,{value:a})}),n.addEventListener("resetform",t=>{const i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",e=>{const s={value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}};this._dispatchEventFromSandbox(s,e)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Lm extends Pm{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,i=e.id;let s=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"==typeof s&&(s=s!==e.buttonValue,t.setValue(i,{value:s})),s)for(const a of this._getElementsByName(e.fieldName,i))t.setValue(a.id,{value:!1});const n=document.createElement("input");if(xm.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,s&&n.setAttribute("checked",!0),n.tabIndex=0,n.addEventListener("change",e=>{const{name:s,checked:n}=e.target;for(const a of this._getElementsByName(s,i))t.setValue(a.id,{value:!1});t.setValue(i,{value:n})}),n.addEventListener("resetform",t=>{const i=e.defaultFieldValue;t.target.checked=null!=i&&i===e.buttonValue}),this.enableScripting&&this.hasJSActions){const s=e.buttonValue;n.addEventListener("updatefromsandbox",e=>{const n={value:e=>{const n=s===e.detail.value;for(const s of this._getElementsByName(e.target.name)){const e=n&&s.id===i;s.domElement&&(s.domElement.checked=e),t.setValue(s.id,{value:e})}}};this._dispatchEventFromSandbox(n,e)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)}
1return this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Fm extends Cm{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({},t)})),t}}class Nm extends Pm{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),s=document.createElement("select");xm.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=0;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",t=>{const e=this.data.defaultFieldValue;for(const i of s.options)i.selected=i.value===e});for(const h of this.data.options){const t=document.createElement("option");t.textContent=h.displayValue,t.value=h.exportValue,i.value.includes(h.exportValue)&&(t.setAttribute("selected",!0),n=!1),s.append(t)}let a=null;if(n){const t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),s.prepend(t),a=()=>{t.remove(),s.removeEventListener("input",a),a=null},s.addEventListener("input",a)}const r=t=>{const e=t?"value":"textContent",{options:i,multiple:n}=s;return n?Array.prototype.filter.call(i,t=>t.selected).map(t=>t[e]):-1===i.selectedIndex?null:i[i.selectedIndex][e]};let o=r(!1);const l=t=>{const e=t.target.options;return Array.prototype.map.call(e,t=>({displayValue:t.textContent,exportValue:t.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",i=>{const n={value(i){null==a||a();const n=i.detail.value,l=new Set(Array.isArray(n)?n:[n]);for(const t of s.options)t.selected=l.has(t.value);t.setValue(e,{value:r(!0)}),o=r(!1)},multipleSelection(t){s.multiple=!0},remove(i){const n=s.options,a=i.detail.remove;n[a].selected=!1,s.remove(a),n.length>0&&-1===Array.prototype.findIndex.call(n,t=>t.selected)&&(n[0].selected=!0),t.setValue(e,{value:r(!0),items:l(i)}),o=r(!1)},clear(i){for(;0!==s.length;)s.remove(0);t.setValue(e,{value:null,items:[]}),o=r(!1)},insert(i){const{index:n,displayValue:a,exportValue:h}=i.detail.insert,c=s.children[n],d=document.createElement("option");d.textContent=a,d.value=h,c?c.before(d):s.append(d),t.setValue(e,{value:r(!0),items:l(i)}),o=r(!1)},items(i){const{items:n}=i.detail;for(;0!==s.length;)s.remove(0);for(const t of n){const{displayValue:e,exportValue:i}=t,n=document.createElement("option");n.textContent=e,n.value=i,s.append(n)}s.options.length>0&&(s.options[0].selected=!0),t.setValue(e,{value:r(!0),items:l(i)}),o=r(!1)},indices(i){const s=new Set(i.detail.indices);for(const t of i.target.options)t.selected=s.has(t.index);t.setValue(e,{value:r(!0)}),o=r(!1)},editable(t){t.target.disabled=!t.detail.editable}};this._dispatchEventFromSandbox(n,i)}),s.addEventListener("input",i=>{var s;const n=r(!0),a=r(!1);t.setValue(e,{value:n}),i.preventDefault(),null==(s=this.linkService.eventBus)||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:a,changeEx:n,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],t=>t.target.value)):s.addEventListener("input",function(i){t.setValue(e,{value:r(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Wm extends Mm{constructor(t){const{data:e,elements:i,parent:s}=t,n=!!s._commentManager;if(super(t,{isRenderable:!n&&Mm._hasPopupData(e)}),Gd(this,Pr),this.elements=i,n&&Mm._hasPopupData(e)){const t=this.popup=Xd(this,Pr,Dr).call(this);for(const e of i)e.popup=t}else this.popup=null}render(){const{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";
1const e=this.popup=Xd(this,Pr,Dr).call(this),i=[];for(const s of this.elements)s.popup=e,s.container.ariaHasPopup="dialog",i.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(t=>`${$u}${t}`).join(",")),this.container}}Pr=new WeakSet,Dr=function(){return new Bm({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})};class Bm{constructor({container:t,color:e,elements:i,titleObj:s,modificationDate:n,contentsObj:a,richText:r,parent:o,rect:l,parentRect:h,open:c,commentManager:d=null}){Gd(this,no),Gd(this,Rr,null),Gd(this,Ir,Xd(this,no,go).bind(this)),Gd(this,Lr,Xd(this,no,wo).bind(this)),Gd(this,Fr,Xd(this,no,vo).bind(this)),Gd(this,Nr,Xd(this,no,mo).bind(this)),Gd(this,Wr,null),Gd(this,Br,null),Gd(this,Or,null),Gd(this,jr,null),Gd(this,Ur,null),Gd(this,Hr,null),Gd(this,$r,null),Gd(this,zr,!1),Gd(this,Vr,null),Gd(this,Gr,null),Gd(this,qr,null),Gd(this,Xr,null),Gd(this,Yr,null),Gd(this,Kr,null),Gd(this,Qr,null),Gd(this,Jr,null),Gd(this,Zr,null),Gd(this,to,null),Gd(this,eo,!1),Gd(this,io,null),Gd(this,so,null),qd(this,Br,t),qd(this,Zr,s),qd(this,Or,a),qd(this,Jr,r),qd(this,Hr,o),qd(this,Wr,e),qd(this,Qr,l),qd(this,$r,h),qd(this,Ur,i),qd(this,Rr,d),qd(this,io,i[0]),qd(this,jr,lp.toDateObject(n)),this.trigger=i.flatMap(t=>t.getElementsToTriggerPopup()),d?this.renderCommentButton():(Xd(this,no,ao).call(this),Vd(this,Br).hidden=!0,c&&Xd(this,no,mo).call(this))}renderCommentButton(){if(Vd(this,Xr))return;if(Vd(this,Yr)||Xd(this,no,ro).call(this),!Vd(this,Yr))return;const{signal:t}=qd(this,Gr,new AbortController),e=!!Vd(this,io).extraPopupElement,i=()=>{Vd(this,Rr).toggleCommentPopup(this,!0,void 0,!e)},s=()=>{Vd(this,Rr).toggleCommentPopup(this,!1,!0,!e)},n=()=>{Vd(this,Rr).toggleCommentPopup(this,!1,!1)};if(e){qd(this,Xr,Vd(this,io).container);for(const e of this.trigger)e.ariaHasPopup="dialog",e.ariaControls="commentPopup",e.addEventListener("keydown",Vd(this,Ir),{signal:t}),e.addEventListener("click",i,{signal:t}),e.addEventListener("pointerenter",s,{signal:t}),e.addEventListener("pointerleave",n,{signal:t}),e.classList.add("popupTriggerArea")}else{const e=qd(this,Xr,document.createElement("button"));e.className="annotationCommentButton";const a=Vd(this,io).container;e.style.zIndex=a.style.zIndex+1,e.tabIndex=0,e.ariaHasPopup="dialog",e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button"),Xd(this,no,lo).call(this),Xd(this,no,oo).call(this),e.addEventListener("keydown",Vd(this,Ir),{signal:t}),e.addEventListener("click",i,{signal:t}),e.addEventListener("pointerenter",s,{signal:t}),e.addEventListener("pointerleave",n,{signal:t}),a.after(e)}}get commentButtonColor(){const{color:t,opacity:e}=Vd(this,io).commentData;return t?Vd(this,Hr)._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{var t;null==(t=Vd(this,Xr))||t.focus()},0)}getData(){const{richText:t,color:e,opacity:i,creationDate:s,modificationDate:n}=Vd(this,io).commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:i,creationDate:s,modificationDate:n}}get elementBeforePopup(){return Vd(this,Xr)}get comment(){return Vd(this,so)||qd(this,so,Vd(this,io).commentText),Vd(this,so)}set comment(t){t!==this.comment&&(Vd(this,io).commentText=qd(this,so,t))}get parentBoundingClientRect(){return Vd(this,io).layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){Vd(this,Xr)&&(Vd(this,Xr).classList.toggle("selected",t),Vd(this,Xr).ariaExpanded=e)}setSelectedCommentButton(t){Vd(this,Xr).classList.toggle("selected",t)}get commentPopupPosition(){if(Vd(this,Kr))return Vd(this,Kr);const{x:t,y:e,height:i}=Vd(this,Xr).getBoundingClientRect(),{x:s,y:n,width:a,height:r}=Vd(this,io).layer.getBoundingClientRect();return[(t-s)/a,(e+i-n)/r]}set commentPopupPosition(t){qd(this,Kr,t)}hasDefaultPopupPosition(){return null===Vd(this,Kr)}get commentButtonPosition(){return Vd(this,Yr)}get commentButtonWidth(){return Vd(this,Xr).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){const[e,i]=Vd(this,Kr)||this.commentButtonPosition.map(t=>t/100),s=this.parentBoundingClientRect,{x:n,y:a,width:r,height:o}=s;Vd(this,Rr).showDialog(null,this,n+e*r,a+i*o,{...t,parentDimensions:s})}render(){var t,e;if(Vd(this,Vr))return;const i=qd(this,Vr,document.createElement("div"));if(i.className="popup",Vd(this,Wr)){const t=i.style.outlineColor=Bu.makeHexColor(...Vd(this,Wr));i.style.backgroundColor=`color-mix(in srgb, ${t} 30%, white)`}const s=document.createElement("span");if(s.className="header",null==(t=Vd(this,Zr))?void 0:t.str){const t=document.createElement("span");t.className="title",s.append(t),({dir:t.dir,str:t.textContent}=Vd(this,Zr))}if(i.append(s),Vd(this,jr)){const t=document.createElement("time");t.className="popupDate",t.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),t.setAttribute("data-l10n-args",JSON.stringify({dateObj:Vd(this,jr).valueOf()})),t.dateTime=Vd(this,jr).toISOString(),s.append(t)}Sp({html:Vd(this,no,ho)||Vd(this,Or).str,dir:null==(e=Vd(this,Or))?void 0:e.dir,className:"popupContent"},i),Vd(this,Br).append(i)}updateEdited({rect:t,popup:e,deleted:i}){var s;if(Vd(this,Rr))return i?(this.remove(),qd(this,so,null)):e&&(e.deleted?this.remove():(Xd(this,no,lo).call(this),qd(this,so,e.text))),void(t&&(qd(this,Yr,null),Xd(this,no,ro).call(this),Xd(this,no,oo).call(this)));i||(null==e?void 0:e.deleted)?this.remove():(Xd(this,no,ao).call(this),Vd(this,to)||qd(this,to,{contentsObj:Vd(this,Or),richText:Vd(this,Jr)}),t&&qd(this,qr,null),e&&e.text&&(qd(this,Jr,Xd(this,no,po).call(this,e.text)),qd(this,jr,lp.toDateObject(e.date)),qd(this,Or,null)),null==(s=Vd(this,Vr))||s.remove(),qd(this,Vr,null))}resetEdited(){var t;Vd(this,to)&&(({contentsObj:Yd(this,Or)._,richText:Yd(this,Jr)._}=Vd(this,to)),qd(this,to,null),null==(t=Vd(this,Vr))||t.remove(),qd(this,Vr,null),qd(this,qr,null))}remove(){var t,e,i;if(null==(t=Vd(this,Gr))||t.abort(),qd(this,Gr,null),null==(e=Vd(this,Vr))||e.remove(),qd(this,Vr,null),qd(this,eo,!1),qd(this,zr,!1),null==(i=Vd(this,Xr))||i.remove(),qd(this,Xr,null),this.trigger)for(const s of this.trigger)s.classList.remove("popupTriggerArea")}forceHide(){qd(this,eo,this.isVisible),Vd(this,eo)&&(Vd(this,Br).hidden=!0)}maybeShow(){Vd(this,Rr)||(Xd(this,no,ao).call(this),Vd(this,eo)&&(Vd(this,Vr)||Xd(this,no,vo).call(this),qd(this,eo,!1),Vd(this,Br).hidden=!1))}get isVisible(){return!Vd(this,Rr)&&!1===Vd(this,Br).hidden}}Rr=new WeakMap,Ir=new WeakMap,Lr=new WeakMap,Fr=new WeakMap,Nr=new WeakMap,Wr=new WeakMap,Br=new WeakMap,Or=new WeakMap,jr=new WeakMap,Ur=new WeakMap,Hr=new WeakMap,$r=new WeakMap,zr=new WeakMap,Vr=new WeakMap,Gr=new WeakMap,qr=new WeakMap,Xr=new WeakMap,Yr=new WeakMap,Kr=new WeakMap,Qr=new WeakMap,Jr=new WeakMap,Zr=ne
1w WeakMap,to=new WeakMap,eo=new WeakMap,io=new WeakMap,so=new WeakMap,no=new WeakSet,ao=function(){var t;if(Vd(this,Gr))return;qd(this,Gr,new AbortController);const{signal:e}=Vd(this,Gr);for(const i of this.trigger)i.addEventListener("click",Vd(this,Nr),{signal:e}),i.addEventListener("pointerenter",Vd(this,Fr),{signal:e}),i.addEventListener("pointerleave",Vd(this,Lr),{signal:e}),i.classList.add("popupTriggerArea");for(const i of Vd(this,Ur))null==(t=i.container)||t.addEventListener("keydown",Vd(this,Ir),{signal:e})},ro=function(){const t=Vd(this,Ur).find(t=>t.hasCommentButton);t&&qd(this,Yr,t._normalizePoint(t.commentButtonPosition))},oo=function(){if(Vd(this,io).extraPopupElement&&!Vd(this,io).editor)return;this.renderCommentButton();const[t,e]=Vd(this,Yr),{style:i}=Vd(this,Xr);i.left=`calc(${t}%)`,i.top=`calc(${e}% - var(--comment-button-dim))`},lo=function(){Vd(this,io).extraPopupElement||(this.renderCommentButton(),Vd(this,Xr).style.backgroundColor=this.commentButtonColor||"")},ho=function(){const t=Vd(this,Jr),e=Vd(this,Or);return!(null==t?void 0:t.str)||(null==e?void 0:e.str)&&e.str!==t.str?null:Vd(this,Jr).html||null},co=function(){var t,e,i;return(null==(i=null==(e=null==(t=Vd(this,no,ho))?void 0:t.attributes)?void 0:e.style)?void 0:i.fontSize)||0},uo=function(){var t,e,i;return(null==(i=null==(e=null==(t=Vd(this,no,ho))?void 0:t.attributes)?void 0:e.style)?void 0:i.color)||null},po=function(t){const e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},s={style:{color:Vd(this,no,uo),fontSize:Vd(this,no,co)?`calc(${Vd(this,no,co)}px * var(--total-scale-factor))`:""}};for(const n of t.split("\n"))e.push({name:"span",value:n,attributes:s});return i},go=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&Vd(this,zr))&&Xd(this,no,mo).call(this)},fo=function(){if(null!==Vd(this,qr))return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:s,pageY:n}}}=Vd(this,Hr);let a=!!Vd(this,$r),r=Vd(this,a?$r:Qr);for(const u of Vd(this,Ur))if(!r||null!==Bu.intersect(u.data.rect,r)){r=u.data.rect,a=!0;break}const o=Bu.normalizeRect([r[0],t[3]-r[1]+t[1],r[2],t[3]-r[3]+t[1]]),l=a?r[2]-r[0]+5:0,h=o[0]+l,c=o[1];qd(this,qr,[100*(h-s)/e,100*(c-n)/i]);const{style:d}=Vd(this,Br);d.left=`${Vd(this,qr)[0]}%`,d.top=`${Vd(this,qr)[1]}%`},mo=function(){Vd(this,Rr)?Vd(this,Rr).toggleCommentPopup(this,!1):(qd(this,zr,!Vd(this,zr)),Vd(this,zr)?(Xd(this,no,vo).call(this),Vd(this,Br).addEventListener("click",Vd(this,Nr)),Vd(this,Br).addEventListener("keydown",Vd(this,Ir))):(Xd(this,no,wo).call(this),Vd(this,Br).removeEventListener("click",Vd(this,Nr)),Vd(this,Br).removeEventListener("keydown",Vd(this,Ir))))},vo=function(){Vd(this,Vr)||this.render(),this.isVisible?Vd(this,zr)&&Vd(this,Br).classList.add("focused"):(Xd(this,no,fo).call(this),Vd(this,Br).hidden=!1,Vd(this,Br).style.zIndex=parseInt(Vd(this,Br).style.zIndex)+1e3)},wo=function(){Vd(this,Br).classList.remove("focused"),!Vd(this,zr)&&this.isVisible&&(Vd(this,Br).hidden=!0,Vd(this,Br).style.zIndex=parseInt(Vd(this,Br).style.zIndex)-1e3)};class Om extends Mm{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=du.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 i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class jm extends Mm{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),Gd(this,bo,null)}render(){this.container.classList.add("lineAnnotation");const{data:t,width:e,height:i}=this,s=this.svgFactory.create(e,i,!0),n=qd(this,bo,this.svgFactory.createElement("svg:line"));return n.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),n.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),n.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),n.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),n.setAttribute("stroke-width",t.borderStyle.width||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),s.append(n),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return Vd(this,bo)}addHighlightArea(){this.container.classList.add("highlightArea")}}bo=new WeakMap;class Um extends Mm{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),Gd(this,yo,null)}render(){this.container.classList.add("squareAnnotation");const{data:t,width:e,height:i}=this,s=this.svgFactory.create(e,i,!0),n=t.borderStyle.width,a=qd(this,yo,this.svgFactory.createElement("svg:rect"));return a.setAttribute("x",n/2),a.setAttribute("y",n/2),a.setAttribute("width",e-n),a.setAttribute("height",i-n),a.setAttribute("stroke-width",n||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return Vd(this,yo)}addHighlightArea(){this.container.classList.add("highlightArea")}}yo=new WeakMap;class Hm extends Mm{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),Gd(this,Ao,null)}render(){this.container.classList.add("circleAnnotation");const{data:t,width:e,height:i}=this,s=this.svgFactory.create(e,i,!0),n=t.borderStyle.width,a=qd(this,Ao,this.svgFactory.createElement("svg:ellipse"));return a.setAttribute("cx",e/2),a.setAttribute("cy",i/2),a.setAttribute("rx",e/2-n/2),a.setAttribute("ry",i/2-n/2),a.setAttribute("stroke-width",n||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return Vd(this,Ao)}
1addHighlightArea(){this.container.classList.add("highlightArea")}}Ao=new WeakMap;class $m extends Mm{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),Gd(this,_o,null),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:e,borderStyle:i,popupRef:s},width:n,height:a}=this;if(!e)return this.container;const r=this.svgFactory.create(n,a,!0);let o=[];for(let h=0,c=e.length;h<c;h+=2){const i=e[h]-t[0],s=t[3]-e[h+1];o.push(`${i},${s}`)}o=o.join(" ");const l=qd(this,_o,this.svgFactory.createElement(this.svgElementName));return l.setAttribute("points",o),l.setAttribute("stroke-width",i.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),r.append(l),this.container.append(r),!s&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return Vd(this,_o)}addHighlightArea(){this.container.classList.add("highlightArea")}}_o=new WeakMap;class zm extends $m{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Vm extends Mm{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class Gm extends Mm{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),Gd(this,So),Gd(this,xo,null),Gd(this,ko,[]),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?du.HIGHLIGHT:du.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,rotation:e,inkLists:i,borderStyle:s,popupRef:n}}=this,{transform:a,width:r,height:o}=Xd(this,So,Mo).call(this,e,t),l=this.svgFactory.create(r,o,!0),h=qd(this,xo,this.svgFactory.createElement("svg:g"));l.append(h),h.setAttribute("stroke-width",s.width||1),h.setAttribute("stroke-linecap","round"),h.setAttribute("stroke-linejoin","round"),h.setAttribute("stroke-miterlimit",10),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),h.setAttribute("transform",a);for(let c=0,d=i.length;c<d;c++){const t=this.svgFactory.createElement(this.svgElementName);Vd(this,ko).push(t),t.setAttribute("points",i[c].join(",")),h.append(t)}return!n&&this.hasPopupData&&this._createPopup(),this.container.append(l),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);const{thickness:e,points:i,rect:s}=t,n=Vd(this,xo);if(e>=0&&n.setAttribute("stroke-width",e||1),i)for(let a=0,r=Vd(this,ko).length;a<r;a++)Vd(this,ko)[a].setAttribute("points",i[a].join(","));if(s){const{transform:t,width:e,height:i}=Xd(this,So,Mo).call(this,this.data.rotation,s);n.parentElement.setAttribute("viewBox",`0 0 ${e} ${i}`),n.setAttribute("transform",t)}}getElementsToTriggerPopup(){return Vd(this,ko)}addHighlightArea(){this.container.classList.add("highlightArea")}}xo=new WeakMap,ko=new WeakMap,So=new WeakSet,Mo=function(t,e){switch(t){case 90:return{transform:`rotate(90) translate(${-e[0]},${e[1]}) scale(1,-1)`,width:e[3]-e[1],height:e[2]-e[0]};case 180:return{transform:`rotate(180) translate(${-e[2]},${e[1]}) scale(1,-1)`,width:e[2]-e[0],height:e[3]-e[1]};case 270:return{transform:`rotate(270) translate(${-e[2]},${e[3]}) scale(1,-1)`,width:e[3]-e[1],height:e[2]-e[0]};default:return{transform:`translate(${-e[0]},${e[3]}) scale(1,-1)`,width:e[2]-e[0],height:e[3]-e[1]}}};class qm extends Mm{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=du.HIGHLIGHT}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){const e=document.createElement("mark");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class Xm extends Mm{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),t){const e=document.createElement("u");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}
1class Ym extends Mm{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),t){const e=document.createElement("u");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class Km extends Mm{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),t){const e=document.createElement("s");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class Qm extends Mm{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=du.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class Jm extends Mm{constructor(t){var e;super(t,{isRenderable:!0}),Gd(this,Co),Gd(this,Eo,null);const{file:i}=this.data;this.filename=i.filename,this.content=i.content,null==(e=this.linkService.eventBus)||e.dispatch("fileattachmentannotation",{source:this,...i})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:e}=this;let i;e.hasAppearance||0===e.fillAlpha?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(e.name)?"paperclip":"pushpin"}.svg`,e.fillAlpha&&e.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(100*e.fillAlpha)}%);`)),i.addEventListener("dblclick",Xd(this,Co,To).bind(this)),qd(this,Eo,i);const{isMac:s}=Nu.platform;return t.addEventListener("keydown",t=>{"Enter"===t.key&&(s?t.metaKey:t.ctrlKey)&&Xd(this,Co,To).call(this)}),!e.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return Vd(this,Eo)}addHighlightArea(){this.container.classList.add("highlightArea")}}Eo=new WeakMap,Co=new WeakSet,To=function(){var t;null==(t=this.downloadManager)||t.openOrDownloadData(this.content,this.filename)};let Zm=(Oo=class{constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:s,page:n,viewport:a,structTreeLayer:r,commentManager:o,linkService:l,annotationStorage:h}){Gd(this,No),Gd(this,Po,null),Gd(this,Do,null),Gd(this,Ro,null),Gd(this,Io,new Map),Gd(this,Lo,null),Gd(this,Fo,null),this.div=t,qd(this,Po,e),qd(this,Do,i),qd(this,Lo,r||null),qd(this,Fo,l||null),qd(this,Ro,h||new Jp),this.page=n,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=s,this._commentManager=o||null}hasEditableAnnotations(){return Vd(this,Io).size>0}async render(t){var e,i,s;const{annotations:n}=t,a=this.div;pp(a,this.viewport);const r=new Map,o={data:null,layer:a,linkService:Vd(this,Fo),downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new _m,annotationStorage:Vd(this,Ro),enableComment:!0===t.enableComment,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const l of n){if(l.noHTML)continue;const t=l.annotationType===fu.POPUP;if(t){const t=r.get(l.id);if(!t)continue;o.elements=t}else if(l.rect[2]===l.rect[0]||l.rect[3]===l.rect[1])continue;o.data=l;const n=Sm.create(o);if(!n.isRenderable)continue;if(!t&&l.popupRef){const t=r.get(l.popupRef);t?t.push(n):r.set(l.popupRef,[n])}const a=n.render();l.hidden&&(a.style.visibility="hidden"),await Xd(this,No,Wo).call(this,a,l.id,o.elements),null==(i=null==(e=n.extraPopupElement)?void 0:e.popup)||i.renderCommentButton(),n._isEditable&&(Vd(this,Io).set(n.data.id,n),null==(s=this._annotationEditorUIManager)||s.renderAnnotationElement(n))}Xd(this,No,Bo).call(this)}async addLinkAnnotations(t){const e={data:null,layer:this.div,linkService:Vd(this,Fo),svgFactory:new _m,parent:this};for(const i of t){i.borderStyle||(i.borderStyle=Oo._defaultBorderStyle),e.data=i;const t=Sm.create(e);if(!t.isRenderable)continue;const s=t.render();await Xd(this,No,Wo).call(this,s,i.id,null)}}update({viewport:t}){const e=this.div;this.viewport=t,pp(e,{rotation:t.rotation}),Xd(this,No,Bo).call(this),e.hidden=!1}getEditableAnnotations(){return Array.from(Vd(this,Io).values())}getEditableAnnotation(t){return Vd(this,Io).get(t)}addFakeAnnotation(t){var e;const{div:i}=this,{id:s,rotation:n}=t,a=new Em({data:{id:s,rect:t.getPDFRect(),rotation:n},editor:t,layer:i,parent:this,enableComment:!!this._commentManager,linkService:Vd(this,Fo),annotationStorage:Vd(this,Ro)}),r=a.render();return i.append(r),null==(e=Vd(this,Po))||e.moveElementInDOM(i,r,r,!1),a.createOrUpdatePopup(),a}static get _defaultBorderStyle(){return Mu(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:1,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},Po=new WeakMap,Do=new WeakMap,Ro=new WeakMap,Io=new WeakMap,Lo=new WeakMap,Fo=new WeakMap,No=new WeakSet,Wo=async function(t,e,
1i){var s,n;const a=t.firstChild||t,r=a.id=`${$u}${e}`,o=await(null==(s=Vd(this,Lo))?void 0:s.getAriaAttributes(r));if(o)for(const[l,h]of o)a.setAttribute(l,h);i?i.at(-1).container.after(t):(this.div.append(t),null==(n=Vd(this,Po))||n.moveElementInDOM(this.div,t,a,!1))},Bo=function(){var t;if(!Vd(this,Do))return;const e=this.div;for(const[i,s]of Vd(this,Do)){const n=e.querySelector(`[data-annotation-id="${i}"]`);if(!n)continue;s.className="annotationContent";const{firstChild:a}=n;a?"CANVAS"===a.nodeName?a.replaceWith(s):a.classList.contains("annotationContent")?a.after(s):a.before(s):n.append(s);const r=Vd(this,Io).get(i);r&&(r._hasNoCanvas?(null==(t=this._annotationEditorUIManager)||t.setMissingCanvas(i,n.id,s),r._hasNoCanvas=!1):r.canvas=s)}Vd(this,Do).clear()},Oo);const tv=/\r\n?|\n/g,ev=class t extends Vp{constructor(e){super({...e,name:"freeTextEditor"}),Gd(this,zo),Gd(this,jo,""),Gd(this,Uo,`${this.id}-editor`),Gd(this,Ho,null),Gd(this,$o),$d(this,"_colorPicker",null),this.color=e.color||t._defaultColor||Vp._defaultLineColor,qd(this,$o,e.fontSize||t._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static get _keyboardManager(){const e=t.prototype,i=t=>t.isEmpty(),s=Bp.TRANSLATE_SMALL,n=Bp.TRANSLATE_BIG;return Mu(this,"_keyboardManager",new Lp([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-s,0],checker:i}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:i}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[s,0],checker:i}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[n,0],checker:i}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-s],checker:i}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:i}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,s],checker:i}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,n],checker:i}]]))}static initialize(t,e){Vp.initialize(t,e);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,i){switch(e){case uu.FREETEXT_SIZE:t._defaultFontSize=i;break;case uu.FREETEXT_COLOR:t._defaultColor=i}}updateParams(t,e){switch(t){case uu.FREETEXT_SIZE:Xd(this,zo,Vo).call(this,e);break;case uu.FREETEXT_COLOR:Xd(this,zo,Go).call(this,e)}}static get defaultPropertiesToUpdate(){return[[uu.FREETEXT_SIZE,t._defaultFontSize],[uu.FREETEXT_COLOR,t._defaultColor||Vp._defaultLineColor]]}get propertiesToUpdate(){return[[uu.FREETEXT_SIZE,Vd(this,$o)],[uu.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new vm(this)),[["colorPicker",this._colorPicker]]}get colorType(){return uu.FREETEXT_COLOR}onUpdatedColor(){var t;this.editorDiv.style.color=this.color,null==(t=this._colorPicker)||t.update(this.color),super.onUpdatedColor()}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){const e=this.parentScale;return[-t._internalPadding*e,-(t._internalPadding+Vd(this,$o))*e]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),qd(this,Ho,new AbortController);const t=this._uiManager.combinedSignal(Vd(this,Ho));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t}),!0}disableEditMode(){var t;return!!super.disableEditMode()&&(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",Vd(this,Uo)),this._isDraggable=!0,null==(t=Vd(this,Ho))||t.abort(),qd(this,Ho,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0)}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(t){var e;this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),(null==(e=this._initialOptions)?void 0: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 t=Vd(this,jo),e=qd(this,jo,Xd(this,zo,qo).call(this).trimEnd());if(t===e)return;const i=t=>{qd(this,jo,t),t?(Xd(this,zo,Qo).call(this),this._uiManager.rebuild(this),Xd(this,zo,Xo).c
1all(this)):this.remove()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),Xd(this,zo,Xo).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(e){t._keyboardManager.exec(this,e)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let t,e;(this._isCopy||this.annotationElementId)&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",Vd(this,Uo)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${Vd(this,$o)}px * var(--total-scale-factor))`,i.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[i,s]=this.parentDimensions;if(this.annotationElementId){const{position:n}=this._initialData;let[a,r]=this.getInitialTranslation();[a,r]=this.pageTranslationToScreen(a,r);const[o,l]=this.pageDimensions,[h,c]=this.pageTranslation;let d,u;switch(this.rotation){case 0:d=t+(n[0]-h)/o,u=e+this.height-(n[1]-c)/l;break;case 90:d=t+(n[0]-h)/o,u=e-(n[1]-c)/l,[a,r]=[r,-a];break;case 180:d=t-this.width+(n[0]-h)/o,u=e-(n[1]-c)/l,[a,r]=[-a,-r];break;case 270:d=t+(n[0]-h-this.height*l)/o,u=e+(n[1]-c-this.width*o)/l,[a,r]=[-r,a]}this.setAt(d*i,u*s,a,r)}else this._moveAfterPaste(t,e);Xd(this,zo,Qo).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var i,s,n;const a=e.clipboardData||window.clipboardData,{types:r}=a;if(1===r.length&&"text/plain"===r[0])return;e.preventDefault();const o=Xd(i=t,Yo,Zo).call(i,a.getData("text")||"").replaceAll(tv,"\n");if(!o)return;const l=window.getSelection();if(!l.rangeCount)return;this.editorDiv.normalize(),l.deleteFromDocument();const h=l.getRangeAt(0);if(!o.includes("\n"))return h.insertNode(document.createTextNode(o)),this.editorDiv.normalize(),void l.collapseToStart();const{startContainer:c,startOffset:d}=h,u=[],p=[];if(c.nodeType===Node.TEXT_NODE){const e=c.parentElement;if(p.push(c.nodeValue.slice(d).replaceAll(tv,"")),e!==this.editorDiv){let i=u;for(const n of this.editorDiv.childNodes)n!==e?i.push(Xd(s=t,Yo,Ko).call(s,n)):i=p}u.push(c.nodeValue.slice(0,d).replaceAll(tv,""))}else if(c===this.editorDiv){let e=u,i=0;for(const s of this.editorDiv.childNodes)i++===d&&(e=p),e.push(Xd(n=t,Yo,Ko).call(n,s))}qd(this,jo,`${u.join("\n")}${o}${p.join("\n")}`),Xd(this,zo,Qo).call(this);const g=new Range;let f=Math.sumPrecise(u.map(t=>t.length));for(const{firstChild:t}of this.editorDiv.childNodes)if(t.nodeType===Node.TEXT_NODE){const e=t.nodeValue.length;if(f<=e){g.setStart(t,f),g.setEnd(t,f);break}f-=e}l.removeAllRanges(),l.addRange(g)}get contentDiv(){return this.editorDiv}getPDFRect(){const e=t._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,i,s){var n;let a=null;if(e instanceof Om){const{data:{defaultAppearanceData:{fontSize:t,fontColor:i},rect:s,rotation:n,id:r,popupRef:o,richText:l,contentsObj:h,creationDate:c,modificationDate:d},textContent:u,textPosition:p,parent:{page:{pageNumber:g}}}=e;if(!u||0===u.length)return null;a=e={annotationType:du.FREETEXT,color:Array.from(i),fontSize:t,value:u.join("\n"),position:p,pageIndex:g-1,rect:s.slice(0),rotation:n,annotationElementId:r,id:r,deleted:!1,popupRef:o,comment:(null==h?void 0:h.str)||null,richText:l,creationDate:c,modificationDate:d}}const r=await super.deserialize(e,i,s);return qd(r,$o,e.fontSize),r.color=Bu.makeHexColor(...e.color),qd(r,jo,Xd(n=t,Yo,Zo).call(n,e.value)),r._initialData=a,e.comment&&r.setCommentData(e),r}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const e=Vp._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(t),{color:e,fontSize:Vd(this,$o),value:Xd(this,zo,Jo).call(this)});return this.addComment(i),t?(i.isCopy=!0,i):this.annotationElementId&&!Xd(this,zo,tl).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(t){const e=super.renderAnnotationElement(t);if(!e)return null;const{style:i}=e;
1i.fontSize=`calc(${Vd(this,$o)}px * var(--total-scale-factor))`,i.color=this.color,e.replaceChildren();for(const s of Vd(this,jo).split("\n")){const t=document.createElement("div");t.append(s?document.createTextNode(s):document.createElement("br")),e.append(t)}return t.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:Vd(this,jo)}}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}};jo=new WeakMap,Uo=new WeakMap,Ho=new WeakMap,$o=new WeakMap,zo=new WeakSet,Vo=function(t){const e=t=>{this.editorDiv.style.fontSize=`calc(${t}px * var(--total-scale-factor))`,this.translate(0,-(t-Vd(this,$o))*this.parentScale),qd(this,$o,t),Xd(this,zo,Xo).call(this)},i=Vd(this,$o);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:uu.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},Go=function(t){const e=t=>{this.color=t,this.onUpdatedColor()},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:uu.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},qo=function(){var t;const e=[];this.editorDiv.normalize();let i=null;for(const s of this.editorDiv.childNodes)(null==i?void 0:i.nodeType)===Node.TEXT_NODE&&"BR"===s.nodeName||(e.push(Xd(t=ev,Yo,Ko).call(t,s)),i=s);return e.join("\n")},Xo=function(){const[t,e]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:t,div:e}=this,s=e.style.display,n=e.classList.contains("hidden");e.classList.remove("hidden"),e.style.display="hidden",t.div.append(this.div),i=e.getBoundingClientRect(),e.remove(),e.style.display=s,e.classList.toggle("hidden",n)}this.rotation%180==this.parentRotation%180?(this.width=i.width/t,this.height=i.height/e):(this.width=i.height/t,this.height=i.width/e),this.fixAndSetPosition()},Yo=new WeakSet,Ko=function(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(tv,"")},Qo=function(){if(this.editorDiv.replaceChildren(),Vd(this,jo))for(const t of Vd(this,jo).split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}},Jo=function(){return Vd(this,jo).replaceAll("Â "," ")},Zo=function(t){return t.replaceAll(" ","Â ")},tl=function(t){const{value:e,fontSize:i,color:s,pageIndex:n}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((t,e)=>t!==s[e])||t.pageIndex!==n},Gd(ev,Yo),$d(ev,"_freeTextDefaultContent",""),$d(ev,"_internalPadding",0),$d(ev,"_defaultColor",null),$d(ev,"_defaultFontSize",10),$d(ev,"_type","freetext"),$d(ev,"_editorType",du.FREETEXT);let iv=ev;class sv{toSVGPath(){_u("Abstract method `toSVGPath` must be implemented.")}get box(){_u("Abstract getter `box` must be implemented.")}serialize(t,e){_u("Abstract method `serialize` must be implemented.")}static _rescale(t,e,i,s,n,a){a||(a=new Float32Array(t.length));for(let r=0,o=t.length;r<o;r+=2)a[r]=e+t[r]*s,a[r+1]=i+t[r+1]*n;return a}static _rescaleAndSwap(t,e,i,s,n,a){a||(a=new Float32Array(t.length));for(let r=0,o=t.length;r<o;r+=2)a[r]=e+t[r+1]*s,a[r+1]=i+t[r]*n;return a}static _translate(t,e,i,s){s||(s=new Float32Array(t.length));for(let n=0,a=t.length;n<a;n+=2)s[n]=e+t[n],s[n+1]=i+t[n+1];return s}static svgRound(t){return Math.round(1e4*t)}static _normalizePoint(t,e,i,s,n){switch(n){case 90:return[1-e/i,t/s];case 180:return[1-t/i,1-e/s];case 270:return[e/i,1-t/s];default:return[t/i,e/s]}}static _normalizePagePoint(t,e,i){switch(i){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,i,s,n,a){return[(t+5*i)/6,(e+5*s)/6,(5*i+n)/6,(5*s+a)/6,(i+n)/2,(s+a)/2]}}$d(sv,"PRECISION",1e-4);const nv=class t{constructor({x:e,y:i},s,n,a,r,o=0){Gd(this,vl),Gd(this,el),Gd(this,il,[]),Gd(this,sl),Gd(this,nl),Gd(this,al,[]),Gd(this,rl,new Float32Array(18)),Gd(this,ol),Gd(this,ll),Gd(this,hl),Gd(this,cl),Gd(this,dl),Gd(this,ul),Gd(this,pl,[]),qd(this,el,s),qd(this,ul,a*n),qd(this,nl,r),Vd(this,rl).set([NaN,NaN,NaN,NaN,e,i],6),qd(this,sl,o),qd(this,cl,Vd(t,gl)*n),qd(this,hl,Vd(t,ml)*n),qd(this,dl,n),Vd(this,pl).push(e,i)}isEmpty(){return isNaN(Vd(this,rl)[8])}add({x:t,y:e}){var i;qd(this,ol,t),qd(this,ll,e);const[s,n,a,r]=Vd(this,el);let[o,l,h,c]=Vd(this,rl).subarray(8,12);const d=t-h,u=e-c,p=Math.hypot(d,u);if(p<Vd(this,hl))return!1;const g=p-Vd(this,cl),f=g/p,m=f*d,v=f*u;let w=o,b=l;o=h,l=c,h+=m,c+=v,null==(i=Vd(this,pl))||i.push(t,e);const y=m/g,A=-v/g*Vd(this,ul),_=y*Vd(this,ul);return Vd(this,rl).set(Vd(this,rl).subarray(2,8),0),Vd(this,rl).set([h+A,c+_],4),Vd(this,rl).set(Vd(this,rl).subarray(14,18),12),Vd(this,rl).set([h-A,c-_],16),isNaN(Vd(this,rl)[6])?(0===Vd(this,al).length&&(Vd(this,rl).set([o+A,l+_],2),Vd(this,al).push(NaN,NaN,NaN,NaN,(o+A-s)/a,(l+_-n)/r),Vd(this,rl).set([o-A,l-_],14),Vd(this,il).push(NaN,NaN,NaN,NaN,(o-A-s)/a,(l-_-n)/r)),Vd(this,rl).set([w,b,o,l,h,c],6),!this.isEmpty()):(Vd(this,rl).set([w,b,o,l,h,c],6),Math.abs(Math.atan2(b-l,w-o)-Math.atan2(v,m))<Math.PI/2?([o,l,h,c]=Vd(this,rl).subarray(2,6),Vd(this,al).push(NaN,NaN,NaN,NaN,((o+
1h)/2-s)/a,((l+c)/2-n)/r),[o,l,w,b]=Vd(this,rl).subarray(14,18),Vd(this,il).push(NaN,NaN,NaN,NaN,((w+o)/2-s)/a,((b+l)/2-n)/r),!0):([w,b,o,l,h,c]=Vd(this,rl).subarray(0,6),Vd(this,al).push(((w+5*o)/6-s)/a,((b+5*l)/6-n)/r,((5*o+h)/6-s)/a,((5*l+c)/6-n)/r,((o+h)/2-s)/a,((l+c)/2-n)/r),[h,c,o,l,w,b]=Vd(this,rl).subarray(12,18),Vd(this,il).push(((w+5*o)/6-s)/a,((b+5*l)/6-n)/r,((5*o+h)/6-s)/a,((5*l+c)/6-n)/r,((o+h)/2-s)/a,((l+c)/2-n)/r),!0))}toSVGPath(){if(this.isEmpty())return"";const t=Vd(this,al),e=Vd(this,il);if(isNaN(Vd(this,rl)[6])&&!this.isEmpty())return Xd(this,vl,bl).call(this);const i=[];i.push(`M${t[4]} ${t[5]}`);for(let s=6;s<t.length;s+=6)isNaN(t[s])?i.push(`L${t[s+4]} ${t[s+5]}`):i.push(`C${t[s]} ${t[s+1]} ${t[s+2]} ${t[s+3]} ${t[s+4]} ${t[s+5]}`);Xd(this,vl,Al).call(this,i);for(let s=e.length-6;s>=6;s-=6)isNaN(e[s])?i.push(`L${e[s+4]} ${e[s+5]}`):i.push(`C${e[s]} ${e[s+1]} ${e[s+2]} ${e[s+3]} ${e[s+4]} ${e[s+5]}`);return Xd(this,vl,yl).call(this,i),i.join(" ")}newFreeDrawOutline(t,e,i,s,n,a){return new rv(t,e,i,s,n,a)}getOutlines(){var t,e;const i=Vd(this,al),s=Vd(this,il),n=Vd(this,rl),[a,r,o,l]=Vd(this,el),h=new Float32Array((null!=(e=null==(t=Vd(this,pl))?void 0:t.length)?e:0)+2);for(let u=0,p=h.length-2;u<p;u+=2)h[u]=(Vd(this,pl)[u]-a)/o,h[u+1]=(Vd(this,pl)[u+1]-r)/l;if(h[h.length-2]=(Vd(this,ol)-a)/o,h[h.length-1]=(Vd(this,ll)-r)/l,isNaN(n[6])&&!this.isEmpty())return Xd(this,vl,_l).call(this,h);const c=new Float32Array(Vd(this,al).length+24+Vd(this,il).length);let d=i.length;for(let u=0;u<d;u+=2)isNaN(i[u])?c[u]=c[u+1]=NaN:(c[u]=i[u],c[u+1]=i[u+1]);d=Xd(this,vl,kl).call(this,c,d);for(let u=s.length-6;u>=6;u-=6)for(let t=0;t<6;t+=2)isNaN(s[u+t])?(c[d]=c[d+1]=NaN,d+=2):(c[d]=s[u+t],c[d+1]=s[u+t+1],d+=2);return Xd(this,vl,xl).call(this,c,d),this.newFreeDrawOutline(c,h,Vd(this,el),Vd(this,dl),Vd(this,sl),Vd(this,nl))}};el=new WeakMap,il=new WeakMap,sl=new WeakMap,nl=new WeakMap,al=new WeakMap,rl=new WeakMap,ol=new WeakMap,ll=new WeakMap,hl=new WeakMap,cl=new WeakMap,dl=new WeakMap,ul=new WeakMap,pl=new WeakMap,gl=new WeakMap,fl=new WeakMap,ml=new WeakMap,vl=new WeakSet,wl=function(){const t=Vd(this,rl).subarray(4,6),e=Vd(this,rl).subarray(16,18),[i,s,n,a]=Vd(this,el);return[(Vd(this,ol)+(t[0]-e[0])/2-i)/n,(Vd(this,ll)+(t[1]-e[1])/2-s)/a,(Vd(this,ol)+(e[0]-t[0])/2-i)/n,(Vd(this,ll)+(e[1]-t[1])/2-s)/a]},bl=function(){const[t,e,i,s]=Vd(this,el),[n,a,r,o]=Xd(this,vl,wl).call(this);return`M${(Vd(this,rl)[2]-t)/i} ${(Vd(this,rl)[3]-e)/s} L${(Vd(this,rl)[4]-t)/i} ${(Vd(this,rl)[5]-e)/s} L${n} ${a} L${r} ${o} L${(Vd(this,rl)[16]-t)/i} ${(Vd(this,rl)[17]-e)/s} L${(Vd(this,rl)[14]-t)/i} ${(Vd(this,rl)[15]-e)/s} Z`},yl=function(t){const e=Vd(this,il);t.push(`L${e[4]} ${e[5]} Z`)},Al=function(t){const[e,i,s,n]=Vd(this,el),a=Vd(this,rl).subarray(4,6),r=Vd(this,rl).subarray(16,18),[o,l,h,c]=Xd(this,vl,wl).call(this);t.push(`L${(a[0]-e)/s} ${(a[1]-i)/n} L${o} ${l} L${h} ${c} L${(r[0]-e)/s} ${(r[1]-i)/n}`)},_l=function(t){const e=Vd(this,rl),[i,s,n,a]=Vd(this,el),[r,o,l,h]=Xd(this,vl,wl).call(this),c=new Float32Array(36);return c.set([NaN,NaN,NaN,NaN,(e[2]-i)/n,(e[3]-s)/a,NaN,NaN,NaN,NaN,(e[4]-i)/n,(e[5]-s)/a,NaN,NaN,NaN,NaN,r,o,NaN,NaN,NaN,NaN,l,h,NaN,NaN,NaN,NaN,(e[16]-i)/n,(e[17]-s)/a,NaN,NaN,NaN,NaN,(e[14]-i)/n,(e[15]-s)/a],0),this.newFreeDrawOutline(c,t,Vd(this,el),Vd(this,dl),Vd(this,sl),Vd(this,nl))},xl=function(t,e){const i=Vd(this,il);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+6},kl=function(t,e){const i=Vd(this,rl).subarray(4,6),s=Vd(this,rl).subarray(16,18),[n,a,r,o]=Vd(this,el),[l,h,c,d]=Xd(this,vl,wl).call(this);return t.set([NaN,NaN,NaN,NaN,(i[0]-n)/r,(i[1]-a)/o,NaN,NaN,NaN,NaN,l,h,NaN,NaN,NaN,NaN,c,d,NaN,NaN,NaN,NaN,(s[0]-n)/r,(s[1]-a)/o],e),e+24},Gd(nv,gl,8),Gd(nv,fl,2),Gd(nv,ml,Vd(nv,gl)+Vd(nv,fl));let av=nv;class rv extends sv{constructor(t,e,i,s,n,a){super(),Gd(this,Rl),Gd(this,Sl),Gd(this,Ml,new Float32Array(4)),Gd(this,El),Gd(this,Cl),Gd(this,Tl),Gd(this,Pl),Gd(this,Dl),qd(this,Dl,t),qd(this,Tl,e),qd(this,Sl,i),qd(this,Pl,s),qd(this,El,n),qd(this,Cl,a),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],Xd(this,Rl,Il).call(this,a);const[r,o,l,h]=Vd(this,Ml);for(let c=0,d=t.length;c<d;c+=2)t[c]=(t[c]-r)/l,t[c+1]=(t[c+1]-o)/h;for(let c=0,d=e.length;c<d;c+=2)e[c]=(e[c]-r)/l,e[c+1]=(e[c+1]-o)/h}toSVGPath(){const t=[`M${Vd(this,Dl)[4]} ${Vd(this,Dl)[5]}`];for(let e=6,i=Vd(this,Dl).length;e<i;e+=6)isNaN(Vd(this,Dl)[e])?t.push(`L${Vd(this,Dl)[e+4]} ${Vd(this,Dl)[e+5]}`):t.push(`C${Vd(this,Dl)[e]} ${Vd(this,Dl)[e+1]} ${Vd(this,Dl)[e+2]} ${Vd(this,Dl)[e+3]} ${Vd(this,Dl)[e+4]} ${Vd(this,Dl)[e+5]}`);return t.push("Z"),t.join(" ")}serialize([t,e,i,s],n){const a=i-t,r=s-e;let o,l;switch(n){case 0:o=sv._rescale(Vd(this,Dl),t,s,a,-r),l=sv._rescale(Vd(this,Tl),t,s,a,-r);break;case 90:o=sv._rescaleAndSwap(Vd(this,Dl),t,e,a,r),l=sv._rescaleAndSwap(Vd(this,Tl),t,e,a,r);break;case 180:o=sv._rescale(Vd(this,Dl),i,e,-a,r),l=sv._rescale(Vd(this,Tl),i,e,-a,r);break;case 270:o=sv._rescaleAndSwap(Vd(this,Dl),i,s,-a,-r),l=sv._rescaleAndSwap(Vd(this,Tl),i,s,-a,-r)}return{outline:Array.from(o),points:[Array.from(l)]}}get box(){return Vd(this,Ml)}newOutliner(t,e,i,s,n,a=0){return new av(t,e,i,s,n,a)}getNewOutline(t,e){const[i,s,n,a]=Vd(this,Ml),[r,o,l,h]=Vd(this,Sl),c=n*l,d=a*h,u=i*l+r,p=s*h+o,g=this.newOutliner({x:Vd(this,Tl)[0]*c+u,y:Vd(this,Tl)[1]*d+p},Vd(this,Sl),Vd(this,Pl),t,Vd(this,Cl),null!=e?e:Vd(this,El));for(let f=2;f<Vd(this,Tl).length;f+=2)g.add({x:Vd(this,Tl)[f]*c+u,y:Vd(this,Tl)[f+1]*d+p});return g.getOutlines()}}Sl=new WeakMap,Ml=new WeakMap,El=new WeakMap,Cl=new WeakMap,Tl=new WeakMap,Pl=new WeakMap,Dl=new WeakMap,Rl=new WeakSet,Il=function(t){const e=Vd(this,Dl);let i=e[4],s=e[5];const n=[i,s,i,s];let a=i,r=s,o=i,l=s;const h=t?Math.max:Math.min,c=new Float32Array(4);for(let u=6,p=e.length;u<p;u+=6){const t=e[u+4],d=e[u+5];isNaN(e[u])?(Bu.pointBoundingBox(t,d,n),r>d?(a=t,r=d):r===d&&(a=h(a,t)),l<d?(o=t,l=d):l===d&&(o=h(o,t))):(c[0]=c[1]=1/0,c[2]=c[3]=-1/0,Bu.bezierBoundingBox(i,s,...e.slice(u,u+6),c),Bu.rectBoundingBox(c[0],c[1],c[2],c[3],n),r>c[1]?(a=c[0],r=c[1]):r===c[1]&&(a=h(a,c[0])),l<c[3]?(o=c[2],l=c[3]):l===c[3]&&(o=h(o,c[2]))),i=t,s=d}const d=Vd(this,Ml);d[0]=n[0]-Vd(this,El),d[1]=n[1]-Vd(this,El),d[2]=n[2]-n[0]+2*Vd(this,El),d[3]=n[3]-n[1]+2*Vd(this,El),this.firstPoint=[a,r],this.lastPoint=[o,l]};class ov{constructor(t,e=0,i=0,s=!0){Gd(this,Ol),Gd(this,Ll),Gd(this,Fl),Gd(this,Nl),Gd(this,Wl,[]),Gd(this,Bl,[]);const n=[1/0,1/0,-1/0,-1/0],a=10**-4;for(const{x:g,y:f,width:m,height:v}of t){const t=Math.floor((g-e)/a)*a,i=Math.ceil((g+m+e)/a)*a,s=Math.floor((f-e)/a)*a,r=Math.ceil((f+v+e)/a)*a,o=[t,s,r,!0],l=[i,s,r,!1];Vd(this,Wl).push(o,l),Bu.rectBoundingBox(t,s,i,r,n)}const r=n[2]-n[0]+2*i,o=n[3]-n[1]+2*i,l=n[0]-i,h=n[1]-i;let c=s?-1/0:1/0,d=1/0;const u=Vd(this,Wl).at(s?-1:-2),p=[u[0],u[2]];for(const g of Vd(this,Wl)){const[t,e,i,n]=g;!n&&s?e<d?(d=e,c=t):e===d&&(c=Math.max(c,t)):n&&!s&&(e<d?(d=e,c=t):e===d&&(c=Math.min(c,t))),g[0]=(t-l)/r,g[1]=(e-h)/o,g[2]=(i-h)/o}qd(this,Ll,new Float32Array([l,h,r,o])),qd(this,Fl,[c,d]),qd(this,Nl,p)}getOutlines(){Vd(this,Wl).sort((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]);const t=[];for(const e of Vd(this,Wl))e[3]?(t.push(...Xd(this,Ol,zl).call(this,e)),Xd(this,Ol,Hl).call(this,e)):(Xd(this,Ol,$l).call(this,e),t.push(...Xd(this,Ol,zl).call(this,e)));return Xd(this,Ol,jl).call(this,t)}}Ll=new WeakMap,Fl=new WeakMap,Nl=new WeakMap,Wl=new WeakMap,Bl=new WeakMap,Ol=new WeakSet,jl=function(t){const e=[],i=new Set;for(const a of t){const[t,i,s]=a;e.push([t,i,a],[t,s,a])}e.sort((t,e)=>t[1]-e[1]||t[0]-e[0]);for(let a=0,r=e.length;a<r;a+=2){const t=e[a][2],s=e[a+1][2];t.push(s),s.push(t),i.add(t),i.add(s)}const s=[];let n;for(;i.size>0;){const t=i.values().next().value;let[e,a,r,o,l]=t;i.delete(t);let h=e,c=a;for(n=[e,r],s.push(n);;){let t;if(i.has(o))t=o;else{if(!i.has(l))break;t=l}i.delete(t),[e,a,r,o,l]=t,h!==e&&(n.push(h,c,e,c===a?a:r),h=e),c=c===a?r:a}n.push(h,c)}return new lv(s,Vd(this,Ll),Vd(this,Fl),Vd(this,Nl))},Ul=function(t){const e=Vd(this,Bl);let i=0,s=e.length-1;for(;i<=s;){const n=i+s>>1,a=e[n][0];if(a===t)return n;a<t?i=n+1:s=n-1}return s+1},Hl=function([,t,e]){const i=Xd(this,Ol,Ul).call(this,t);Vd(this,Bl).splice(i,0,[t,e])},$l=function([,t,e]){const i=Xd(this,Ol,Ul).call(this,t);for(let s=i;s<Vd(this,Bl).length;s++){const[i,n]=Vd(this,Bl)[s];if(i!==t)break;
1if(i===t&&n===e)return void Vd(this,Bl).splice(s,1)}for(let s=i-1;s>=0;s--){const[i,n]=Vd(this,Bl)[s];if(i!==t)break;if(i===t&&n===e)return void Vd(this,Bl).splice(s,1)}},zl=function(t){const[e,i,s]=t,n=[[e,i,s]],a=Xd(this,Ol,Ul).call(this,s);for(let r=0;r<a;r++){const[t,i]=Vd(this,Bl)[r];for(let s=0,a=n.length;s<a;s++){const[,r,o]=n[s];if(!(i<=r||o<=t))if(r>=t)if(o>i)n[s][1]=i;else{if(1===a)return[];n.splice(s,1),s--,a--}else n[s][2]=t,o>i&&n.push([e,i,o])}}return n};class lv extends sv{constructor(t,e,i,s){super(),Gd(this,Vl),Gd(this,Gl),qd(this,Gl,t),qd(this,Vl,e),this.firstPoint=i,this.lastPoint=s}toSVGPath(){const t=[];for(const e of Vd(this,Gl)){let[i,s]=e;t.push(`M${i} ${s}`);for(let n=2;n<e.length;n+=2){const a=e[n],r=e[n+1];a===i?(t.push(`V${r}`),s=r):r===s&&(t.push(`H${a}`),i=a)}t.push("Z")}return t.join(" ")}serialize([t,e,i,s],n){const a=[],r=i-t,o=s-e;for(const l of Vd(this,Gl)){const e=new Array(l.length);for(let i=0;i<l.length;i+=2)e[i]=t+l[i]*r,e[i+1]=s-l[i+1]*o;a.push(e)}return a}get box(){return Vd(this,Vl)}get classNamesForOutlining(){return["highlightOutline"]}}Vl=new WeakMap,Gl=new WeakMap;class hv extends av{newFreeDrawOutline(t,e,i,s,n,a){return new cv(t,e,i,s,n,a)}}class cv extends rv{newOutliner(t,e,i,s,n,a=0){return new hv(t,e,i,s,n,a)}}const dv=class t extends Vp{constructor(e){super({...e,name:"highlightEditor"}),Gd(this,dh),Gd(this,ql,null),Gd(this,Xl,0),Gd(this,Yl),Gd(this,Kl,null),Gd(this,Ql,null),Gd(this,Jl,null),Gd(this,Zl,null),Gd(this,th,0),Gd(this,eh,null),Gd(this,ih,null),Gd(this,sh,null),Gd(this,nh,!1),Gd(this,ah,null),Gd(this,rh,null),Gd(this,oh,null),Gd(this,lh,""),Gd(this,hh),Gd(this,ch,""),this.color=e.color||t._defaultColor,qd(this,hh,e.thickness||t._defaultThickness),this.opacity=e.opacity||t._defaultOpacity,qd(this,Yl,e.boxes||null),qd(this,ch,e.methodOfCreation||""),qd(this,lh,e.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",e.highlightId>-1?(qd(this,nh,!0),Xd(this,dh,ph).call(this,e),Xd(this,dh,wh).call(this)):Vd(this,Yl)&&(qd(this,ql,e.anchorNode),qd(this,Xl,e.anchorOffset),qd(this,Zl,e.focusNode),qd(this,th,e.focusOffset),Xd(this,dh,uh).call(this),Xd(this,dh,wh).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const e=t.prototype;return Mu(this,"_keyboardManager",new Lp([[["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:Vd(this,nh)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:Vd(this,hh),methodOfCreation:Vd(this,ch)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(e,i){var s;Vp.initialize(e,i),t._defaultColor||(t._defaultColor=(null==(s=i.highlightColors)?void 0:s.values().next().value)||"#fff066")}static updateDefaultParams(e,i){switch(e){case uu.HIGHLIGHT_COLOR:t._defaultColor=i;break;case uu.HIGHLIGHT_THICKNESS:t._defaultThickness=i}}translateInPage(t,e){}get toolbarPosition(){return Vd(this,rh)}get commentButtonPosition(){return Vd(this,ah)}updateParams(t,e){switch(t){case uu.HIGHLIGHT_COLOR:Xd(this,dh,gh).call(this,e);break;case uu.HIGHLIGHT_THICKNESS:Xd(this,dh,fh).call(this,e)}}static get defaultPropertiesToUpdate(){return[[uu.HIGHLIGHT_COLOR,t._defaultColor],[uu.HIGHLIGHT_THICKNESS,t._defaultThickness]]}get propertiesToUpdate(){return[[uu.HIGHLIGHT_COLOR,this.color||t._defaultColor],[uu.HIGHLIGHT_THICKNESS,Vd(this,hh)||t._defaultThickness],[uu.HIGHLIGHT_FREE,Vd(this,nh)]]}onUpdatedColor(){var t,e;null==(t=this.parent)||t.drawLayer.updateProperties(Vd(this,sh),{root:{fill:this.color,"fill-opacity":this.opacity}}),null==(e=Vd(this,Ql))||e.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",qd(this,Ql,new fm({editor:this}))]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(Xd(this,dh,xh).call(this))}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,Xd(this,dh,xh).call(this))}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){Xd(this,dh,vh).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(Xd(this,dh,wh).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var e;let i=!1;this.parent&&!t?Xd(this,dh,vh).call(this):t&&(Xd(this,dh,wh).call(this,t),i=!this.parent&&(null==(e=this.div)?void 0:e.classList.contains("selectedEditor"))),super.setParent(t),this.show(this._isVisible),i&&this.select()}rotate(e){var i,s,n;const{drawLayer:a}=this.parent;let r;Vd(this,nh)?(e=(e-this.rotation+360)%360,r=Xd(i=t,bh,yh).call(i,Vd(this,ih).box,e)):r=Xd(s=t,bh,yh).call(s,[this.x,this.y,this.width,this.height],e),a.updateProperties(Vd(this,sh),{bbox:r,root:{"data-main-rotation":e}}),a.updateProperties(Vd(this,oh),{bbox:Xd(n=t,bh,yh).call(n,Vd(this,Jl).box,e),root:{"data-main-rotation":e}})}
1render(){if(this.div)return this.div;const t=super.render();Vd(this,lh)&&(t.setAttribute("aria-label",Vd(this,lh)),t.setAttribute("role","mark")),Vd(this,nh)?t.classList.add("free"):this.div.addEventListener("keydown",Xd(this,dh,Ah).bind(this),{signal:this._uiManager._signal});const e=qd(this,eh,document.createElement("div"));return t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=Vd(this,Kl),this.setDims(this.width,this.height),Tp(this,Vd(this,eh),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){var t;this.isSelected||null==(t=this.parent)||t.drawLayer.updateProperties(Vd(this,oh),{rootClass:{hovered:!0}})}pointerleave(){var t;this.isSelected||null==(t=this.parent)||t.drawLayer.updateProperties(Vd(this,oh),{rootClass:{hovered:!1}})}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:Xd(this,dh,_h).call(this,!0);break;case 1:case 3:Xd(this,dh,_h).call(this,!1)}}select(){var t;super.select(),Vd(this,oh)&&(null==(t=this.parent)||t.drawLayer.updateProperties(Vd(this,oh),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var t;super.unselect(),Vd(this,oh)&&(null==(t=this.parent)||t.drawLayer.updateProperties(Vd(this,oh),{rootClass:{selected:!1}}),Vd(this,nh)||Xd(this,dh,_h).call(this,!1))}get _mustFixPosition(){return!Vd(this,nh)}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(Vd(this,sh),{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(Vd(this,oh),{rootClass:{hidden:!t}}))}static startHighlighting(t,e,{target:i,x:s,y:n}){const{x:a,y:r,width:o,height:l}=i.getBoundingClientRect(),h=new AbortController,c=t.combinedSignal(h),d=e=>{h.abort(),Xd(this,bh,Eh).call(this,t,e)};window.addEventListener("blur",d,{signal:c}),window.addEventListener("pointerup",d,{signal:c}),window.addEventListener("pointerdown",op,{capture:!0,passive:!1,signal:c}),window.addEventListener("contextmenu",rp,{signal:c}),i.addEventListener("pointermove",Xd(this,bh,Mh).bind(this,t),{signal:c}),this._freeHighlight=new hv({x:s,y:n},[a,r,o,l],t.scale,this._defaultThickness/2,e,.001),({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0))}static async deserialize(t,e,i){var s,n,a,r;let o=null;if(t instanceof qm){const{data:{quadPoints:e,rect:i,rotation:s,id:n,color:a,opacity:r,popupRef:l,richText:h,contentsObj:c,creationDate:d,modificationDate:u},parent:{page:{pageNumber:p}}}=t;o=t={annotationType:du.HIGHLIGHT,color:Array.from(a),opacity:r,quadPoints:e,boxes:null,pageIndex:p-1,rect:i.slice(0),rotation:s,annotationElementId:n,id:n,deleted:!1,popupRef:l,richText:h,comment:(null==c?void 0:c.str)||null,creationDate:d,modificationDate:u}}else if(t instanceof Gm){const{data:{inkLists:e,rect:i,rotation:s,id:n,color:a,borderStyle:{rawWidth:r},popupRef:l,richText:h,contentsObj:c,creationDate:d,modificationDate:u},parent:{page:{pageNumber:p}}}=t;o=t={annotationType:du.HIGHLIGHT,color:Array.from(a),thickness:r,inkLists:e,boxes:null,pageIndex:p-1,rect:i.slice(0),rotation:s,annotationElementId:n,id:n,deleted:!1,popupRef:l,richText:h,comment:(null==c?void 0:c.str)||null,creationDate:d,modificationDate:u}}const{color:l,quadPoints:h,inkLists:c,opacity:d}=t,u=await super.deserialize(t,e,i);u.color=Bu.makeHexColor(...l),u.opacity=d||1,c&&qd(u,hh,t.thickness),u._initialData=o,t.comment&&u.setCommentData(t);const[p,g]=u.pageDimensions,[f,m]=u.pageTranslation;if(h){const t=qd(u,Yl,[]);for(let e=0;e<h.length;e+=8)t.push({x:(h[e]-f)/p,y:1-(h[e+1]-m)/g,width:(h[e+2]-h[e])/p,height:(h[e+1]-h[e+5])/g});Xd(s=u,dh,uh).call(s),Xd(n=u,dh,wh).call(n),u.rotate(u.rotation)}else if(c){qd(u,nh,!0);const t=c[0],i={x:t[0]-f,y:g-(t[1]-m)},s=new hv(i,[0,0,p,g],1,Vd(u,hh)/2,!0,.001);for(let e=0,a=t.length;e<a;e+=2)i.x=t[e]-f,i.y=g-(t[e+1]-m),s.add(i);const{id:n,clipPathId:o}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:u.color,"fill-opacity":u._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:s.toSVGPath()}},!0,!0);Xd(a=u,dh,ph).call(a,{highlightOutlines:s.getOutlines(),highlightId:n,clipPathId:o}),Xd(r=u,dh,wh).call(r),u.rotate(u.parentRotation)}return u}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const e=Vp._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),i=super.serialize(t);return Object.assign(i,{color:e,opacity:this.opacity,thickness:Vd(this,hh),quadPoints:Xd(this,dh,kh).call(this),outlines:Xd(this,dh,Sh).call(this,i.rect)}),this.addComment(i),this.annotationElementId&&!Xd(this,dh,Ch).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}};ql=new WeakMap,Xl=new WeakMap,Yl=new WeakMap,Kl=new WeakMap,Ql=new WeakMap,Jl=new WeakMap,Zl=new WeakMap,th=new WeakMap,eh=new WeakMap,ih=new WeakMap,sh=new WeakMap,nh=new WeakMap,ah=new WeakMap,rh=new WeakMap,oh=new WeakMap,lh=new WeakMap,hh=new WeakMap,ch=new WeakMap,dh=new WeakSet,uh=function(){const t=new ov(Vd(this,Yl),.001);qd(this,ih,t.getOutlines()),[this.x,this.y,this.width,this.height]=Vd(this,ih).box;const e=new ov(Vd(this,Yl),.0025,.001,"ltr"===this._uiManager.direction);qd(this,Jl,e.getOutlines());const{firstPoint:i}=Vd(this,ih);qd(this,ah,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]);const{lastPoint:s}=Vd(this,Jl);qd(this,rh,[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height])},ph=function({highlightOutlines:t,highlightId:e,clipPathId:i}){var s,n;if(qd(this,ih,t),qd(this,Jl,t.getNewOutline(Vd(this,hh)/2+1.5,.0025)),e>
1=0)qd(this,sh,e),qd(this,Kl,i),this.parent.drawLayer.finalizeDraw(e,{bbox:t.box,path:{d:t.toSVGPath()}}),qd(this,oh,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:Vd(this,Jl).box,path:{d:Vd(this,Jl).toSVGPath()}},!0));else if(this.parent){const e=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(Vd(this,sh),{bbox:Xd(s=dv,bh,yh).call(s,Vd(this,ih).box,(e-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(Vd(this,oh),{bbox:Xd(n=dv,bh,yh).call(n,Vd(this,Jl).box,e),path:{d:Vd(this,Jl).toSVGPath()}})}const[a,r,o,l]=t.box;switch(this.rotation){case 0:this.x=a,this.y=r,this.width=o,this.height=l;break;case 90:{const[t,e]=this.parentDimensions;this.x=r,this.y=1-a,this.width=o*e/t,this.height=l*t/e;break}case 180:this.x=1-a,this.y=1-r,this.width=o,this.height=l;break;case 270:{const[t,e]=this.parentDimensions;this.x=1-r,this.y=a,this.width=o*e/t,this.height=l*t/e;break}}const{firstPoint:h}=t;qd(this,ah,[(h[0]-a)/o,(h[1]-r)/l]);const{lastPoint:c}=Vd(this,Jl);qd(this,rh,[(c[0]-a)/o,(c[1]-r)/l])},gh=function(t){const e=(t,e)=>{this.color=t,this.opacity=e,this.onUpdatedColor()},i=this.color,s=this.opacity;this.addCommands({cmd:e.bind(this,t,dv._defaultOpacity),undo:e.bind(this,i,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:uu.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(t)},!0)},fh=function(t){const e=Vd(this,hh),i=t=>{qd(this,hh,t),Xd(this,dh,mh).call(this,t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:uu.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)},mh=function(t){Vd(this,nh)&&(Xd(this,dh,ph).call(this,{highlightOutlines:Vd(this,ih).getNewOutline(t/2)}),this.fixAndSetPosition(),this.setDims(this.width,this.height))},vh=function(){null!==Vd(this,sh)&&this.parent&&(this.parent.drawLayer.remove(Vd(this,sh)),qd(this,sh,null),this.parent.drawLayer.remove(Vd(this,oh)),qd(this,oh,null))},wh=function(t=this.parent){null===Vd(this,sh)&&(({id:Yd(this,sh)._,clipPathId:Yd(this,Kl)._}=t.drawLayer.draw({bbox:Vd(this,ih).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:Vd(this,nh)},path:{d:Vd(this,ih).toSVGPath()}},!1,!0)),qd(this,oh,t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:Vd(this,nh)},bbox:Vd(this,Jl).box,path:{d:Vd(this,Jl).toSVGPath()}},Vd(this,nh))),Vd(this,eh)&&(Vd(this,eh).style.clipPath=Vd(this,Kl)))},bh=new WeakSet,yh=function([t,e,i,s],n){switch(n){case 90:return[1-e-s,t,s,i];case 180:return[1-t-i,1-e-s,i,s];case 270:return[e,1-t-i,s,i]}return[t,e,i,s]},Ah=function(t){dv._keyboardManager.exec(this,t)},_h=function(t){if(!Vd(this,ql))return;const e=window.getSelection();t?e.setPosition(Vd(this,ql),Vd(this,Xl)):e.setPosition(Vd(this,Zl),Vd(this,th))},xh=function(){return Vd(this,nh)?this.rotation:0},kh=function(){if(Vd(this,nh))return null;const[t,e]=this.pageDimensions,[i,s]=this.pageTranslation,n=Vd(this,Yl),a=new Float32Array(8*n.length);let r=0;for(const{x:o,y:l,width:h,height:c}of n){const n=o*t+i,d=(1-l)*e+s;a[r]=a[r+4]=n,a[r+1]=a[r+3]=d,a[r+2]=a[r+6]=n+h*t,a[r+5]=a[r+7]=d-c*e,r+=8}return a},Sh=function(t){return Vd(this,ih).serialize(t,Xd(this,dh,xh).call(this))},Mh=function(t,e){this._freeHighlight.add(e)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},Eh=function(t,e){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},Ch=function(t){const{color:e}=this._initialData;return this.hasEditedComment||t.color.some((t,i)=>t!==e[i])},Gd(dv,bh),$d(dv,"_defaultColor",null),$d(dv,"_defaultOpacity",1),$d(dv,"_defaultThickness",12),$d(dv,"_type","highlight"),$d(dv,"_editorType",du.HIGHLIGHT),$d(dv,"_freeHighlightId",-1),$d(dv,"_freeHighlight",null),$d(dv,"_freeHighlightClipId","");let uv=dv;class pv{constructor(){Gd(this,Th,Object.create(null))}updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(const[e,i]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,i)}updateSVGProperty(t,e){Vd(this,Th)[t]=e}toSVGProperties(){const t=Vd(this,Th);return qd(this,Th,Object.create(null)),{root:t}}reset(){qd(this,Th,Object.create(null))}updateAll(t=this){this.updateProperties(t)}clone(){_u("Not implemented")}}Th=new WeakMap;const gv=class t extends Vp{constructor(t){super(t),Gd(this,Oh),Gd(this,Ph,null),Gd(this,Dh),$d(this,"_colorPicker",null),$d(this,"_drawId",null),qd(this,Dh,t.mustBeCommitted||!1),this._addOutlines(t)}onUpdatedColor(){var t;null==(t=this._colorPicker)||t.update(this.color),super.onUpdatedColor()}
1_addOutlines(t){t.drawOutlines&&(Xd(this,Oh,jh).call(this,t),Xd(this,Oh,$h).call(this))}static _mergeSVGProperties(t,e){const i=new Set(Object.keys(t));for(const[s,n]of Object.entries(e))i.has(s)?Object.assign(t[s],n):t[s]=n;return t}static getDefaultDrawingOptions(t){_u("Not implemented")}static get typesMap(){_u("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,i){const s=this.typesMap.get(e);s&&this._defaultDrawingOptions.updateProperty(s,i),this._currentParent&&(Vd(t,Rh).updateProperty(s,i),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,e){const i=this.constructor.typesMap.get(t);i&&this._updateProperty(t,i,e)}static get defaultPropertiesToUpdate(){const t=[],e=this._defaultDrawingOptions;for(const[i,s]of this.typesMap)t.push([i,e[s]]);return t}get propertiesToUpdate(){const t=[],{_drawingOptions:e}=this;for(const[i,s]of this.constructor.typesMap)t.push([i,e[s]]);return t}_updateProperty(t,e,i){const s=this._drawingOptions,n=s[e],a=i=>{var n;s.updateProperty(e,i);const a=Vd(this,Ph).updateProperty(e,i);a&&Xd(this,Oh,Gh).call(this,a),null==(n=this.parent)||n.drawLayer.updateProperties(this._drawId,s.toSVGProperties()),t===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:a.bind(this,i),undo:a.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var e;null==(e=this.parent)||e.drawLayer.updateProperties(this._drawId,t._mergeSVGProperties(Vd(this,Ph).getPathResizingSVGProperties(Xd(this,Oh,Vh).call(this)),{bbox:Xd(this,Oh,qh).call(this)}))}_onResized(){var e;null==(e=this.parent)||e.drawLayer.updateProperties(this._drawId,t._mergeSVGProperties(Vd(this,Ph).getPathResizedSVGProperties(Xd(this,Oh,Vh).call(this)),{bbox:Xd(this,Oh,qh).call(this)}))}_onTranslating(t,e){var i;null==(i=this.parent)||i.drawLayer.updateProperties(this._drawId,{bbox:Xd(this,Oh,qh).call(this)})}_onTranslated(){var e;null==(e=this.parent)||e.drawLayer.updateProperties(this._drawId,t._mergeSVGProperties(Vd(this,Ph).getPathTranslatedSVGProperties(Xd(this,Oh,Vh).call(this),this.parentDimensions),{bbox:Xd(this,Oh,qh).call(this)}))}_onStartDragging(){var t;null==(t=this.parent)||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var t;null==(t=this.parent)||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,Vd(this,Dh)&&(qd(this,Dh,!1),this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){Xd(this,Oh,Hh).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(Xd(this,Oh,$h).call(this),Xd(this,Oh,Gh).call(this,Vd(this,Ph).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var e;let i=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),Xd(this,Oh,Hh).call(this)):t&&(this._uiManager.addShouldRescale(this),Xd(this,Oh,$h).call(this,t),i=!this.parent&&(null==(e=this.div)?void 0:e.classList.contains("selectedEditor"))),super.setParent(t),i&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,t._mergeSVGProperties({bbox:Xd(this,Oh,qh).call(this)},Vd(this,Ph).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&Xd(this,Oh,Gh).call(this,Vd(this,Ph).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,e;this._isCopy&&(t=this.x,e=this.y);const i=super.render();i.classList.add("draw");const s=document.createElement("div");return i.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,e),i}static createDrawerInstance(t,e,i,s,n){_u("Not implemented")}static startDrawing(e,i,s,n){var a;const{target:r,offsetX:o,offsetY:l,pointerId:h,pointerType:c}=n;if(Vd(t,Nh)&&Vd(t,Nh)!==c)return;const{viewport:{rotation:d}}=e,{width:u,height:p}=r.getBoundingClientRect(),g=qd(t,Ih,new AbortController),f=e.combinedSignal(g);Vd(t,Fh)||qd(t,Fh,h),null!=Vd(t,Nh)||qd(t,Nh,c),window.addEventListener("pointerup",e=>{var i;Vd(t,Fh)===e.pointerId?this._endDraw(e):null==(i=Vd(t,Wh))||i.delete(e.pointerId)},{signal:f}),window.addEventListener("pointercancel",e=>{var i;Vd(t,Fh)===e.pointerId?this._currentParent.endDrawingSession():null==(i=Vd(t,Wh))||i.delete(e.pointerId)},{signal:f}),window.addEventListener("pointerdown",e=>{Vd(t,Nh)===e.pointerType&&((Vd(t,Wh)||qd(t,Wh,new Set)).add(e.pointerId),Vd(t,R
1h).isCancellable()&&(Vd(t,Rh).removeLastElement(),Vd(t,Rh).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",rp,{signal:f}),r.addEventListener("pointermove",this._drawMove.bind(this),{signal:f}),r.addEventListener("touchmove",e=>{e.timeStamp===Vd(t,Bh)&&op(e)},{signal:f}),e.toggleDrawing(),null==(a=i._editorUndoBar)||a.hide(),Vd(t,Rh)?e.drawLayer.updateProperties(this._currentDrawId,Vd(t,Rh).startNew(o,l,u,p,d)):(i.updateUIForDefaultProperties(this),qd(t,Rh,this.createDrawerInstance(o,l,u,p,d)),qd(t,Lh,this.getDefaultDrawingOptions()),this._currentParent=e,({id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(Vd(t,Lh).toSVGProperties(),Vd(t,Rh).defaultSVGProperties),!0,!1)))}static _drawMove(e){var i;if(qd(t,Bh,-1),!Vd(t,Rh))return;const{offsetX:s,offsetY:n,pointerId:a}=e;Vd(t,Fh)===a&&((null==(i=Vd(t,Wh))?void 0:i.size)>=1?this._endDraw(e):(this._currentParent.drawLayer.updateProperties(this._currentDrawId,Vd(t,Rh).add(s,n)),qd(t,Bh,e.timeStamp),op(e)))}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,qd(t,Rh,null),qd(t,Lh,null),qd(t,Nh,null),qd(t,Bh,NaN)),Vd(t,Ih)&&(Vd(t,Ih).abort(),qd(t,Ih,null),qd(t,Fh,NaN),qd(t,Wh,null))}static _endDraw(e){const i=this._currentParent;if(i){if(i.toggleDrawing(!0),this._cleanup(!1),(null==e?void 0:e.target)===i.div&&i.drawLayer.updateProperties(this._currentDrawId,Vd(t,Rh).end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){const e=Vd(t,Rh),s=this._currentDrawId,n=e.getLastElement();return void i.addCommands({cmd:()=>{i.drawLayer.updateProperties(s,e.setLastElement(n))},undo:()=>{i.drawLayer.updateProperties(s,e.removeLastElement())},mustExec:!1,type:uu.DRAW_STEP})}this.endDrawing(!1)}}static endDrawing(e){const i=this._currentParent;if(!i)return null;if(i.toggleDrawing(!0),i.cleanUndoStack(uu.DRAW_STEP),!Vd(t,Rh).isEmpty()){const{pageDimensions:[s,n],scale:a}=i,r=i.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:Vd(t,Rh).getOutlines(s*a,n*a,a,this._INNER_MARGIN),drawingOptions:Vd(t,Lh),mustBeCommitted:!e});return this._cleanup(!0),r}return i.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,e,i,s,n,a){_u("Not implemented")}static async deserialize(t,e,i){var s,n;const{rawDims:{pageWidth:a,pageHeight:r,pageX:o,pageY:l}}=e.viewport,h=this.deserializeDraw(o,l,a,r,this._INNER_MARGIN,t),c=await super.deserialize(t,e,i);return c.createDrawingOptions(t),Xd(s=c,Oh,jh).call(s,{drawOutlines:h}),Xd(n=c,Oh,$h).call(n),c.onScaleChanging(),c.rotate(),c}serializeDraw(t){const[e,i]=this.pageTranslation,[s,n]=this.pageDimensions;return Vd(this,Ph).serialize([e,i,s,n],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};Ph=new WeakMap,Dh=new WeakMap,Rh=new WeakMap,Ih=new WeakMap,Lh=new WeakMap,Fh=new WeakMap,Nh=new WeakMap,Wh=new WeakMap,Bh=new WeakMap,Oh=new WeakSet,jh=function({drawOutlines:t,drawId:e,drawingOptions:i}){qd(this,Ph,t),this._drawingOptions||(this._drawingOptions=i),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),e>=0?(this._drawId=e,this.parent.drawLayer.finalizeDraw(e,t.defaultProperties)):this._drawId=Xd(this,Oh,Uh).call(this,t,this.parent),Xd(this,Oh,Gh).call(this,t.box)},Uh=function(t,e){const{id:i}=e.drawLayer.draw(gv._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return i},Hh=function(){null!==this._drawId&&this.parent&&(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},$h=function(t=this.parent){null!==this._drawId&&this.parent===t||(null===this._drawId?(this._drawingOptions.updateAll(),this._drawId=Xd(this,Oh,Uh).call(this,Vd(this,Ph),t)):this.parent.drawLayer.updateParent(this._drawId,t.drawLayer))},zh=function([t,e,i,s]){const{parentDimensions:[n,a],rotation:r}=this;switch(r){case 90:return[e,1-t,i*(a/n),s*(n/a)];case 180:return[1-t,1-e,i,s];case 270:return[1-e,t,i*(a/n),s*(n/a)];default:return[t,e,i,s]}},Vh=function(){const{x:t,y:e,width:i,height:s,parentDimensions:[n,a],rotation:r}=this;switch(r){case 90:return[1-e,t,i*(n/a),s*(a/n)];case 180:return[1-t,1-e,i,s];case 270:return[e,1-t,i*(n/a),s*(a/n)];default:return[t,e,i,s]}},Gh=function(t){[this.x,this.y,this.width,this.height]=Xd(this,Oh,zh).call(this,t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},qh=function(){const{x:t,y:e,width:i,height:s,rotation:n,parentRotation:a,parentDimensions:[r,o]}=this;switch((4*n+a)/90){case 1:return[1-e-s,t,s,i];case 2:return[1-t-i,1-e-s,i,s];case 3:return[e,1-t-i,s,i];case 4:return[t,e-i*(r/o),s*(o/r),i*(r/o)];case 5:return[1-e,t,i*(r/o),s*(o/r)];case 6:return[1-t-s*(o/r),1-e,s*(o/r),i*(r/o)];case 7:return[e-i*(r/o),1-t-s*(o/r),i*(r/o),s*(o/r)];case 8:return[t-i,e-s,i,s];case 9:return[1-e,t-i,s,i];case 10:return[1-t,1-e,i,s];case 11:return[e-s,1-t,s,i];case 12:return[t-s*(o/r),e,s*(o/r),i*(r/o)];case 13:return[1-e-i*(r/o),t-s*(o/r),i*(r/o),s*(o/r)];case 14:return[1-t,1-e-i*(r/o),s*(o/r),i*(r/o)];case 15:return[e,1-t,i*(r/o),s*(o/r)];default:return[t,e,i,s]}},$d(gv,"_currentDrawId",-1),$d(gv,"_currentParent",null),Gd(gv,Rh,null),Gd(gv,Ih,null),Gd(gv,Lh,null),Gd(gv,Fh,NaN),Gd(gv,Nh,null),Gd(gv,Wh,null),Gd(gv,Bh,NaN),$d(gv,"_INNER_MARGIN",3);let fv=gv;class mv{constructor(t,e,i,s,n,a){Gd(this,ac),Gd(this,Xh,new Float64Array(6)),Gd(this,Yh),Gd(this,Kh),Gd(this,Qh),Gd(this,Jh),Gd(this,Zh),Gd(this,tc,""),Gd(this,ec,0),Gd(this,ic,new vv),Gd(this,sc),Gd(this,nc),qd(this,sc,i),qd(this,nc,s),qd(this,Qh,n),qd(this,Jh,a),[t,e]=Xd(this,ac,rc).call(this,t,e);const r=qd(this,Yh,[NaN,NaN,NaN,NaN,t,e]);qd(this,Zh,[t,e]),qd(this,Kh,[{line:r,points:Vd(this,Zh)}]),Vd(this,Xh).set(r,0)}updateProperty(t,e){"stroke-width"===t&&qd(this,Jh,e)}isEmpty(){return!Vd(this,Kh)||0===Vd(this,Kh).length}isCancellable(){return Vd(this,Zh).length<=10}add(t,e){[t,e]=Xd(this,ac,rc).call(this,t,e);const[i,s,n,a]=Vd(this,Xh).subarray(2,6),r=t-n,o=e-a;return Math.hypot(Vd(this,sc)*r,Vd(this,nc)*o)<=2?null:(Vd(this,Zh).push(t,e),isNaN(i)?(Vd(this,Xh).set([n,a,t,e],2),Vd(this,Yh).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(Vd(this,Xh)[0])&&Vd(this,Yh).splice(6,6),Vd(this,Xh).set([i,s,n,a,t,e],0),Vd(this,Yh).push(...sv.createBezierPoints(i,s,n,a,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){return this.add(t,e)||(2===Vd(this,Zh).length?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,i,s,n){qd(this,sc,i),qd(this,nc,s),qd(this,Qh,n),[t,e]=Xd(this,ac,rc).call(this,t,e);const a=qd(this,Yh,[NaN,NaN,NaN,NaN,t,e]);qd(this,Zh,[t,e]);const r=Vd(this,Kh).at(-1);return r&&(r.line=new Float32Array(r.line),r.points=new Float32Array(r.points)),Vd(this,Kh).push({line:a,points:Vd(this,Zh)}),Vd(this,Xh).set(a,0),qd(this,ec,0),this.toSVGPath(),null}getLastElement(){return Vd(this,Kh).at(-1)}setLastElement(t){return Vd(this,Kh)?(Vd(this,Kh).push(t),qd(this,Yh,t.line),qd(this,Zh,t.points),qd(this,ec,0),{path:{d:this.toSVGPath()}}):Vd(this,ic).setLastElement(t)}removeLastElement(){if(!Vd(this,Kh))return Vd(this,ic).removeLastElement();Vd(this,Kh).pop(),qd(this,tc,"");for(let t=0,e=Vd(this,Kh).length;t<e;t++){const{line:e,points:i}=Vd(this,Kh)[t];qd(this,Yh,e),qd(this,Zh,i),qd(this,ec,0),this.toSVGPath()}return{path:{d:Vd(this,tc)}}}toSVGPath(){const t=sv.svgRound(Vd(this,Yh)[4]),e=sv.svgRound(Vd(this,Yh)[5]);if(2===Vd(this,Zh).length)return qd(this,tc,`${Vd(this,tc)} M ${t} ${e} Z`),Vd(this,tc);if(Vd(this,Zh).length<=6){const i=Vd(this,tc).lastIndexOf("M");qd(this,tc,`${Vd(this,tc).slice(0,i)} M ${t} ${e}`),qd(this,ec,6)}if(4===Vd(this,Zh).length){const t=sv.svgRound(Vd(this,Yh)[10]),e=sv.svgRound(Vd(this,Yh)[11]);return qd(this,tc,`${Vd(this,tc)} L ${t} ${e}`),qd(this,ec,12),Vd(this,tc)}const i=[];0===Vd(this,ec)&&(i.push(`M ${t} ${e}`),qd(this,ec,6));for(let s=Vd(this,ec),n=Vd(this,Yh).length;s<n;s+=6){const[t,e,n,a,r,o]=Vd(this,Yh).slice(s,s+6).map(sv.svgRound);i.push(`C${t} ${e} ${n} ${a} ${r} ${o}`)}return qd(this,tc,Vd(this,tc)+i.join(" ")),qd(this,ec,Vd(this,Yh).length),Vd(this,tc)}getOutlines(t,e,i,s){const n=Vd(this,Kh).at(-1);return n.line=new Float32Array(n.line),n.points=new Float32Array(n.points),Vd(this,ic).build(Vd(this,Kh),t,e,i,Vd(this,Qh),Vd(this,Jh),s),qd(this,Xh,null),qd(this,Yh,null),qd(this,Kh,null),qd(this,tc,null),Vd(this,ic)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}Xh=new WeakMap,Yh=new WeakMap,Kh=new WeakMap,Qh=new WeakMap,Jh=new WeakMap,Zh=new WeakMap,tc=new WeakMap,ec=new WeakMap,ic=new WeakMap,sc=new WeakMap,nc=new WeakMap,ac=new WeakSet,rc=function(t,e){return sv._normalizePoint(t,e,Vd(this,sc),Vd(this,nc),Vd(this,Qh))};class vv extends sv{constructor(){super(...arguments),Gd(this,mc),Gd(this,oc),Gd(this,lc,0),Gd(this,hc),Gd(this,cc),Gd(this,dc),Gd(this,uc),Gd(this,pc),Gd(this,gc),Gd(this,fc)}build(t,e,i,s,n,a,r){qd(this,dc,e),qd(this,uc,i),qd(this,pc,s),qd(this,gc,n),qd(this,fc,a),qd(this,hc,null!=r?r:0),qd(this,cc,t),X
1d(this,mc,bc).call(this)}get thickness(){return Vd(this,fc)}setLastElement(t){return Vd(this,cc).push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return Vd(this,cc).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const t=[];for(const{line:e}of Vd(this,cc))if(t.push(`M${sv.svgRound(e[4])} ${sv.svgRound(e[5])}`),6!==e.length)if(12===e.length&&isNaN(e[6]))t.push(`L${sv.svgRound(e[10])} ${sv.svgRound(e[11])}`);else for(let i=6,s=e.length;i<s;i+=6){const[s,n,a,r,o,l]=e.subarray(i,i+6).map(sv.svgRound);t.push(`C${s} ${n} ${a} ${r} ${o} ${l}`)}else t.push("Z");return t.join("")}serialize([t,e,i,s],n){const a=[],r=[],[o,l,h,c]=Xd(this,mc,wc).call(this);let d,u,p,g,f,m,v,w,b;switch(Vd(this,gc)){case 0:b=sv._rescale,d=t,u=e+s,p=i,g=-s,f=t+o*i,m=e+(1-l-c)*s,v=t+(o+h)*i,w=e+(1-l)*s;break;case 90:b=sv._rescaleAndSwap,d=t,u=e,p=i,g=s,f=t+l*i,m=e+o*s,v=t+(l+c)*i,w=e+(o+h)*s;break;case 180:b=sv._rescale,d=t+i,u=e,p=-i,g=s,f=t+(1-o-h)*i,m=e+l*s,v=t+(1-o)*i,w=e+(l+c)*s;break;case 270:b=sv._rescaleAndSwap,d=t+i,u=e+s,p=-i,g=-s,f=t+(1-l-c)*i,m=e+(1-o-h)*s,v=t+(1-l)*i,w=e+(1-o)*s}for(const{line:y,points:A}of Vd(this,cc))a.push(b(y,d,u,p,g,n?new Array(y.length):null)),r.push(b(A,d,u,p,g,n?new Array(A.length):null));return{lines:a,points:r,rect:[f,m,v,w]}}static deserialize(t,e,i,s,n,{paths:{lines:a,points:r},rotation:o,thickness:l}){const h=[];let c,d,u,p,g;switch(o){case 0:g=sv._rescale,c=-t/i,d=e/s+1,u=1/i,p=-1/s;break;case 90:g=sv._rescaleAndSwap,c=-e/s,d=-t/i,u=1/s,p=1/i;break;case 180:g=sv._rescale,c=t/i+1,d=-e/s,u=-1/i,p=1/s;break;case 270:g=sv._rescaleAndSwap,c=e/s+1,d=t/i+1,u=-1/s,p=-1/i}if(!a){a=[];for(const t of r){const e=t.length;if(2===e){a.push(new Float32Array([NaN,NaN,NaN,NaN,t[0],t[1]]));continue}if(4===e){a.push(new Float32Array([NaN,NaN,NaN,NaN,t[0],t[1],NaN,NaN,NaN,NaN,t[2],t[3]]));continue}const i=new Float32Array(3*(e-2));a.push(i);let[s,n,r,o]=t.subarray(0,4);i.set([NaN,NaN,NaN,NaN,s,n],0);for(let a=4;a<e;a+=2){const e=t[a],l=t[a+1];i.set(sv.createBezierPoints(s,n,r,o,e,l),3*(a-2)),[s,n,r,o]=[r,o,e,l]}}}for(let m=0,v=a.length;m<v;m++)h.push({line:g(a[m].map(t=>null!=t?t:NaN),c,d,u,p),points:g(r[m].map(t=>null!=t?t:NaN),c,d,u,p)});const f=new this.prototype.constructor;return f.build(h,i,s,1,o,l,n),f}get box(){return Vd(this,oc)}updateProperty(t,e){return"stroke-width"===t?Xd(this,mc,yc).call(this,e):null}updateParentDimensions([t,e],i){const[s,n]=Xd(this,mc,vc).call(this);qd(this,dc,t),qd(this,uc,e),qd(this,pc,i);const[a,r]=Xd(this,mc,vc).call(this),o=a-s,l=r-n,h=Vd(this,oc);return h[0]-=o,h[1]-=l,h[2]+=2*o,h[3]+=2*l,h}updateRotation(t){return qd(this,lc,t),{path:{transform:this.rotationTransform}}}get viewBox(){return Vd(this,oc).map(sv.svgRound).join(" ")}get defaultProperties(){const[t,e]=Vd(this,oc);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${sv.svgRound(t)} ${sv.svgRound(e)}`}}}get rotationTransform(){const[,,t,e]=Vd(this,oc);let i=0,s=0,n=0,a=0,r=0,o=0;switch(Vd(this,lc)){case 90:s=e/t,n=-t/e,r=t;break;case 180:i=-1,a=-1,r=t,o=e;break;case 270:s=-e/t,n=t/e,o=e;break;default:return""}return`matrix(${i} ${s} ${n} ${a} ${sv.svgRound(r)} ${sv.svgRound(o)})`}getPathResizingSVGProperties([t,e,i,s]){const[n,a]=Xd(this,mc,vc).call(this),[r,o,l,h]=Vd(this,oc);if(Math.abs(l-n)<=sv.PRECISION||Math.abs(h-a)<=sv.PRECISION){const n=t+i/2-(r+l/2),a=e+s/2-(o+h/2);return{path:{"transform-origin":`${sv.svgRound(t)} ${sv.svgRound(e)}`,transform:`${this.rotationTransform} translate(${n} ${a})`}}}const c=(i-2*n)/(l-2*n),d=(s-2*a)/(h-2*a),u=l/i,p=h/s;return{path:{"transform-origin":`${sv.svgRound(r)} ${sv.svgRound(o)}`,transform:`${this.rotationTransform} scale(${u} ${p}) translate(${sv.svgRound(n)} ${sv.svgRound(a)}) scale(${c} ${d}) translate(${sv.svgRound(-n)} ${sv.svgRound(-a)})`}}}getPathResizedSVGProperties([t,e,i,s]){const[n,a]=Xd(this,mc,vc).call(this),r=Vd(this,oc),[o,l,h,c]=r;if(r[0]=t,r[1]=e,r[2]=i,r[3]=s,Math.abs(h-n)<=sv.PRECISION||Math.abs(c-a)<=sv.PRECISION){const n=t+i/2-(o+h
1/2),a=e+s/2-(l+c/2);for(const{line:t,points:e}of Vd(this,cc))sv._translate(t,n,a,t),sv._translate(e,n,a,e);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${sv.svgRound(t)} ${sv.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const d=(i-2*n)/(h-2*n),u=(s-2*a)/(c-2*a),p=-d*(o+n)+t+n,g=-u*(l+a)+e+a;if(1!==d||1!==u||0!==p||0!==g)for(const{line:f,points:m}of Vd(this,cc))sv._rescale(f,p,g,d,u,f),sv._rescale(m,p,g,d,u,m);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${sv.svgRound(t)} ${sv.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,e],i){const[s,n]=i,a=Vd(this,oc),r=t-a[0],o=e-a[1];if(Vd(this,dc)===s&&Vd(this,uc)===n)for(const{line:l,points:h}of Vd(this,cc))sv._translate(l,r,o,l),sv._translate(h,r,o,h);else{const t=Vd(this,dc)/s,e=Vd(this,uc)/n;qd(this,dc,s),qd(this,uc,n);for(const{line:i,points:s}of Vd(this,cc))sv._rescale(i,r,o,t,e,i),sv._rescale(s,r,o,t,e,s);a[2]*=t,a[3]*=e}return a[0]=t,a[1]=e,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${sv.svgRound(t)} ${sv.svgRound(e)}`}}}get defaultSVGProperties(){const t=Vd(this,oc);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${sv.svgRound(t[0])} ${sv.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}}oc=new WeakMap,lc=new WeakMap,hc=new WeakMap,cc=new WeakMap,dc=new WeakMap,uc=new WeakMap,pc=new WeakMap,gc=new WeakMap,fc=new WeakMap,mc=new WeakSet,vc=function(t=Vd(this,fc)){const e=Vd(this,hc)+t/2*Vd(this,pc);return Vd(this,gc)%180==0?[e/Vd(this,dc),e/Vd(this,uc)]:[e/Vd(this,uc),e/Vd(this,dc)]},wc=function(){const[t,e,i,s]=Vd(this,oc),[n,a]=Xd(this,mc,vc).call(this,0);return[t+n,e+a,i-2*n,s-2*a]},bc=function(){const t=qd(this,oc,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:s}of Vd(this,cc)){if(s.length<=12){for(let e=4,i=s.length;e<i;e+=6)Bu.pointBoundingBox(s[e],s[e+1],t);continue}let e=s[4],i=s[5];for(let n=6,a=s.length;n<a;n+=6){const[a,r,o,l,h,c]=s.subarray(n,n+6);Bu.bezierBoundingBox(e,i,a,r,o,l,h,c,t),e=h,i=c}}const[e,i]=Xd(this,mc,vc).call(this);t[0]=zu(t[0]-e,0,1),t[1]=zu(t[1]-i,0,1),t[2]=zu(t[2]+e,0,1),t[3]=zu(t[3]+i,0,1),t[2]-=t[0],t[3]-=t[1]},yc=function(t){const[e,i]=Xd(this,mc,vc).call(this);qd(this,fc,t);const[s,n]=Xd(this,mc,vc).call(this),[a,r]=[s-e,n-i],o=Vd(this,oc);return o[0]-=a,o[1]-=r,o[2]+=2*a,o[3]+=2*r,o};class wv extends pv{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:Vp._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){"stroke-width"===t&&(null!=e||(e=this["stroke-width"]),e*=this._viewParameters.realScale),super.updateSVGProperty(t,e)}clone(){const t=new wv(this._viewParameters);return t.updateAll(this),t}}const bv=class t extends fv{constructor(t){super({...t,name:"inkEditor"}),Gd(this,Ac),this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,e){Vp.initialize(t,e),this._defaultDrawingOptions=new wv(e.viewParameters)}static getDefaultDrawingOptions(t){const e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!0}static get typesMap(){return Mu(this,"typesMap",new Map([[uu.INK_THICKNESS,"stroke-width"],[uu.INK_COLOR,"stroke"],[uu.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,e,i,s,n){return new mv(t,e,i,s,n,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,e,i,s,n,a){return vv.deserialize(t,e,i,s,n,a)}static async deserialize(t,e,i){let s=null;if(t instanceof Gm){const{data:{inkLists:e,rect:i,rotation:n,id:a,color:r,opacity:o,borderStyle:{rawWidth:l},popupRef:h,richText:c,contentsObj:d,creationDate:u,modificationDate:p},parent:{page:{pageNumber:g}}}=t;s=t={annotationType:du.INK,color:Array.from(r),thickness:l,opacity:o,paths:{points:e},boxes:null,pageIndex:g-1,rect:i.slice(0),rotation:n,annotationElementId:a,id:a,deleted:!1,popupRef:h,richText:c,comment:(null==d?void 0:d.str)||null,creationDate:u,modificationDate:p}}const n=await super.deserialize(t,e,i);return n._initialData=s,t.comment&&n.setCommentData(t),n}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new vm(this)),[["colorPicker",this._colorPicker]]}get colorType(){return uu.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:t,_drawingOptions:e,parent:i}=this;e.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(t,e.toSVGProperties())}static onScaleChangingWhenDrawing(){const t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:i,opacity:s}){this._drawingOptions=t.getDefaultDrawingOptions({stroke:Bu.makeHexColor(...e),"stroke-width":i,"stroke-opacity":s})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:e,points:i}=this.serializeDraw(t),{_drawingOptions:{stroke:s,"stroke-opacity":n,"stroke-width":a}}=this,r=Object.assign(super.serialize(t),{color:Vp._colorManager.convert(s),opacity:n,thickness:a,paths:{lines:e,points:i}});return this.addComment(r),t?(r.isCopy=!0,r):this.annotationElementId&&!Xd(this,Ac,_c).call(this,r)?null:(r.id=this.annotationElementId,r)}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;const{points:e,rect:i}=this.serializeDraw(!1);return t.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:e,popup:this.comment}),null}};Ac=new WeakSet,_c=function(t){const{color:e,thickness:i,opacity:s,pageIndex:n}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((t,i)=>t!==e[i])||t.thickness!==i||t.opacity!==s||t.pageIndex!==n},$d(bv,"_type","ink"),$d(bv,"_editorType",du.INK),$d(bv,"_defaultDrawingOptions",null);let yv=bv;class Av extends vv{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}}class _v{static extractContoursFromText(t,{fontFamily:e,fontStyle:i,fontWeight:s},n,a,r,o){let l=new OffscreenCanvas(1,1),h=l.getContext("2d",{alpha:!1});const c=h.font=`${i} ${s} 200px ${e}`,{actualBoundingBoxLeft:d,actualBoundingBoxRight:u,actualBoundingBoxAscent:p,actualBoundingBoxDescent:g,fontBoundingBoxAscent:f,fontBoundingBoxDescent:m,width:v}=h.measureText(t),w=Math.ceil(1.5*Math.max(Math.abs(d)+Math.abs(u)||0,v)),b=Math.ceil(1.5*Math.max(Math.abs(p)+Math.abs(g)||200,Math.abs(f)+Math.abs(m)||200));l=new OffscreenCanvas(w,b),h=l.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=c,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,w,b),h.fillStyle="black",h.fillText(t,.5*w/2,1.5*b/2);const y=Xd(this,kc,Lc).call(this,h.getImageData(0,0,w,b).data),A=Xd(this,kc,Ic).call(this,y),_=Xd(this,kc,Fc).call(this,A),x=Xd(this,kc,Tc).call(this,y,w,b,_);return this.processDrawnLines({lines:{curves:x,width:w,height:b},pageWidth:n,pageHeight:a,rotation:r,innerMargin:o,mustSmooth:!0,areContours:!0})}
1static process(t,e,i,s,n){const[a,r,o]=Xd(this,kc,Nc).call(this,t),[l,h]=Xd(this,kc,Rc).call(this,a,r,o,Math.hypot(r,o)*Vd(this,xc).sigmaSFactor,Vd(this,xc).sigmaR,Vd(this,xc).kernelSize),c=Xd(this,kc,Fc).call(this,h),d=Xd(this,kc,Tc).call(this,l,r,o,c);return this.processDrawnLines({lines:{curves:d,width:r,height:o},pageWidth:e,pageHeight:i,rotation:s,innerMargin:n,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:i,rotation:s,innerMargin:n,mustSmooth:a,areContours:r}){var o;s%180!=0&&([e,i]=[i,e]);const{curves:l,width:h,height:c}=t,d=null!=(o=t.thickness)?o:0,u=[],p=Math.min(e/h,i/c),g=p/e,f=p/i,m=[];for(const{points:w}of l){const t=a?Xd(this,kc,Dc).call(this,w):w;if(!t)continue;m.push(t);const e=t.length,i=new Float32Array(e),s=new Float32Array(3*(2===e?2:e-2));if(u.push({line:s,points:i}),2===e){i[0]=t[0]*g,i[1]=t[1]*f,s.set([NaN,NaN,NaN,NaN,i[0],i[1]],0);continue}let[n,r,o,l]=t;n*=g,r*=f,o*=g,l*=f,i.set([n,r,o,l],0),s.set([NaN,NaN,NaN,NaN,n,r],0);for(let a=4;a<e;a+=2){const e=i[a]=t[a]*g,h=i[a+1]=t[a+1]*f;s.set(sv.createBezierPoints(n,r,o,l,e,h),3*(a-2)),[n,r,o,l]=[o,l,e,h]}}if(0===u.length)return null;const v=r?new Av:new vv;return v.build(u,e,i,1,s,r?0:d,n),{outline:v,newCurves:m,areContours:r,thickness:d,width:h,height:c}}static async compressSignature({outlines:t,areContours:e,thickness:i,width:s,height:n}){let a,r=1/0,o=-1/0,l=0;for(const v of t){l+=v.length;for(let t=2,e=v.length;t<e;t++){const e=v[t]-v[t-2];r=Math.min(r,e),o=Math.max(o,e)}}a=r>=-128&&o<=127?Int8Array:r>=-32768&&o<=32767?Int16Array:Int32Array;const h=t.length,c=8+3*h,d=new Uint32Array(c);let u=0;d[u++]=c*Uint32Array.BYTES_PER_ELEMENT+(l-2*h)*a.BYTES_PER_ELEMENT,d[u++]=0,d[u++]=s,d[u++]=n,d[u++]=e?0:1,d[u++]=Math.max(0,Math.floor(null!=i?i:0)),d[u++]=h,d[u++]=a.BYTES_PER_ELEMENT;for(const v of t)d[u++]=v.length-2,d[u++]=v[0],d[u++]=v[1];const p=new CompressionStream("deflate-raw"),g=p.writable.getWriter();await g.ready,g.write(d);const f=a.prototype.constructor;for(const v of t){const t=new f(v.length-2);for(let e=2,i=v.length;e<i;e++)t[e-2]=v[e]-v[e-2];g.write(t)}g.close();const m=await new Response(p.readable).arrayBuffer();return Vu(new Uint8Array(m))}static async decompressSignature(t){try{const i=(e=t,Uint8Array.fromBase64?Uint8Array.fromBase64(e):Fu(atob(e))),{readable:s,writable:n}=new DecompressionStream("deflate-raw"),a=n.getWriter();await a.ready,a.write(i).then(async()=>{await a.ready,await a.close()}).catch(()=>{});let r=null,o=0;for await(const t of s)r||(r=new Uint8Array(new Uint32Array(t.buffer,0,4)[0])),r.set(t,o),o+=t.length;const l=new Uint32Array(r.buffer,0,r.length>>2),h=l[1];if(0!==h)throw new Error(`Invalid version: ${h}`);const c=l[2],d=l[3],u=0===l[4],p=l[5],g=l[6],f=l[7],m=[],v=(8+3*g)*Uint32Array.BYTES_PER_ELEMENT;let w;switch(f){case Int8Array.BYTES_PER_ELEMENT:w=new Int8Array(r.buffer,v);break;case Int16Array.BYTES_PER_ELEMENT:w=new Int16Array(r.buffer,v);break;case Int32Array.BYTES_PER_ELEMENT:w=new Int32Array(r.buffer,v)}o=0;for(let t=0;t<g;t++){const e=l[3*t+8],i=new Float32Array(e+2);m.push(i);for(let s=0;s<2;s++)i[s]=l[3*t+8+s+1];for(let t=0;t<e;t++)i[t+2]=i[t]+w[o++]}return{areContours:u,thickness:p,outlines:m,width:c,height:d}}catch(i){return null}var e}}xc=new WeakMap,kc=new WeakSet,Sc=function(t,e,i,s){return s-=e,0===(i-=t)?s>0?0:4:1===i?s+6:2-s},Mc=new WeakMap,Ec=function(t,e,i,s,n,a,r){const o=Xd(this,kc,Sc).call(this,i,s,n,a);for(let l=0;l<8;l++){const n=(-l+o-r+16)%8;if(0!==t[(i+Vd(this,Mc)[2*n])*e+(s+Vd(this,Mc)[2*n+1])])return n}return-1},Cc=function(t,e,i,s,n,a,r){const o=Xd(this,kc,Sc).call(this,i,s,n,a);for(let l=0;l<8;l++){const n=(l+o+r+16)%8;if(0!==t[(i+Vd(this,Mc)[2*n])*e+(s+Vd(this,Mc)[2*n+1])])return n}return-1},Tc=function(t,e,i,s){const n=t.length,a=new Int32Array(n);for(let h=0;h<n;h++)a[h]=t[h]<=s?1:0;for(let h=1;h<i-1;h++)a[h*e]=a[h*e+e-1]=0;for(let h=0;h<e;h++)a[h]=a[e*i-1-h]=0;let r,o=1;const l=[];for(let h=1;h<i-1;h++){r=1;for(let t=1;t<e-1;t++){const i=h*e+t,s=a[i];if(0===s)continue;let n=h,c=t;if(1===s&&0===a[i-1])o+=1,c-=1;else{if(!(s>=1&&0===a[i+1])){1!==s&&(r=Math.abs(s));continue}o+=1,c+=1,s>1&&(r=s)}const d=[t,h],u=c===t+1,p={isHole:u,points:d,id:o,parent:0};let g;l.push(p);for(const t of l)if(t.id===r){g=t;break}g?g.isHole?p.parent=u?g.parent:r:p.parent=u?r:g.parent:p.parent=u?r:0;const f=Xd(this,kc,Ec).call(this,a,e,h,t,n,c,0);if(-1===f){a[i]=-o,1!==a[i]&&(r=Math.abs(a[i]));continue}let m=Vd(this,Mc)[2*f],v=Vd(this,Mc)[2*f+1];const w=h+m,b=t+v;n=w,c=b;let y=h,A=t;for(;;
1){const s=Xd(this,kc,Cc).call(this,a,e,y,A,n,c,1);m=Vd(this,Mc)[2*s],v=Vd(this,Mc)[2*s+1];const l=y+m,u=A+v;d.push(u,l);const p=y*e+A;if(0===a[p+1]?a[p]=-o:1===a[p]&&(a[p]=o),l===h&&u===t&&y===w&&A===b){1!==a[i]&&(r=Math.abs(a[i]));break}n=y,c=A,y=l,A=u}}}return l},Pc=function(t,e,i,s){if(i-e<=4){for(let n=e;n<i-2;n+=2)s.push(t[n],t[n+1]);return}const n=t[e],a=t[e+1],r=t[i-4]-n,o=t[i-3]-a,l=Math.hypot(r,o),h=r/l,c=o/l,d=h*a-c*n,u=o/r,p=1/l,g=Math.atan(u),f=Math.cos(g),m=Math.sin(g),v=p*(Math.abs(f)+Math.abs(m)),w=p*(1-v+v**2),b=Math.max(Math.atan(Math.abs(m+f)*w),Math.atan(Math.abs(m-f)*w));let y=0,A=e;for(let _=e+2;_<i-2;_+=2){const e=Math.abs(d-h*t[_+1]+c*t[_]);e>y&&(A=_,y=e)}y>(l*b)**2?(Xd(this,kc,Pc).call(this,t,e,A+2,s),Xd(this,kc,Pc).call(this,t,A,i,s)):s.push(n,a)},Dc=function(t){const e=[],i=t.length;return Xd(this,kc,Pc).call(this,t,0,i,e),e.push(t[i-2],t[i-1]),e.length<=4?null:e},Rc=function(t,e,i,s,n,a){const r=new Float32Array(a**2),o=-2*s**2,l=a>>1;for(let g=0;g<a;g++){const t=(g-l)**2;for(let e=0;e<a;e++)r[g*a+e]=Math.exp((t+(e-l)**2)/o)}const h=new Float32Array(256),c=-2*n**2;for(let g=0;g<256;g++)h[g]=Math.exp(g**2/c);const d=t.length,u=new Uint8Array(d),p=new Uint32Array(256);for(let g=0;g<i;g++)for(let s=0;s<e;s++){const n=g*e+s,o=t[n];let c=0,d=0;for(let u=0;u<a;u++){const n=g+u-l;if(!(n<0||n>=i))for(let i=0;i<a;i++){const p=s+i-l;if(p<0||p>=e)continue;const g=t[n*e+p],f=r[u*a+i]*h[Math.abs(g-o)];c+=g*f,d+=f}}p[u[n]=Math.round(c/d)]++}return[u,p]},Ic=function(t){const e=new Uint32Array(256);for(const i of t)e[i]++;return e},Lc=function(t){const e=t.length,i=new Uint8ClampedArray(e>>2);let s=-1/0,n=1/0;for(let r=0,o=i.length;r<o;r++){const e=i[r]=t[r<<2];s=Math.max(s,e),n=Math.min(n,e)}const a=255/(s-n);for(let r=0,o=i.length;r<o;r++)i[r]=(i[r]-n)*a;return i},Fc=function(t){let e,i=-1/0,s=-1/0;const n=t.findIndex(t=>0!==t);let a=n,r=n;for(e=n;e<256;e++){const n=t[e];n>i&&(e-a>s&&(s=e-a,r=e-1),i=n,a=e)}for(e=r-1;e>=0&&!(t[e]>t[e+1]);e--);return e},Nc=function(t){const e=t,{width:i,height:s}=t,{maxDim:n}=Vd(this,xc);let a=i,r=s;if(i>n||s>n){let o=i,l=s,h=Math.log2(Math.max(i,s)/n);const c=Math.floor(h);h=h===c?c-1:c;for(let i=0;i<h;i++){a=Math.ceil(o/2),r=Math.ceil(l/2);const i=new OffscreenCanvas(a,r);i.getContext("2d").drawImage(t,0,0,o,l,0,0,a,r),o=a,l=r,t!==e&&t.close(),t=i.transferToImageBitmap()}const d=Math.min(n/a,n/r);a=Math.round(a*d),r=Math.round(r*d)}const o=new OffscreenCanvas(a,r).getContext("2d",{willReadFrequently:!0});o.fillStyle="white",o.fillRect(0,0,a,r),o.filter="grayscale(1)",o.drawImage(t,0,0,t.width,t.height,0,0,a,r);const l=o.getImageData(0,0,a,r).data;return[Xd(this,kc,Lc).call(this,l),a,r]},Gd(_v,kc),Gd(_v,xc,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),Gd(_v,Mc,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class xv extends pv{constructor(){super(),super.updateProperties({fill:Vp._defaultLineColor,"stroke-width":0})}clone(){const t=new xv;return t.updateAll(this),t}}class kv extends wv{constructor(t){super(t),super.updateProperties({stroke:Vp._defaultLineColor,"stroke-width":1})}clone(){const t=new kv(this._viewParameters);return t.updateAll(this),t}}const Sv=class t extends fv{constructor(t){super({...t,mustBeCommitted:!0,name:"signatureEditor"}),Gd(this,Wc,!1),Gd(this,Bc,null),Gd(this,Oc,null),Gd(this,jc,null),this._willKeepAspectRatio=!0,qd(this,Oc,t.signatureData||null),qd(this,Bc,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,e){Vp.initialize(t,e),this._defaultDrawingOptions=new xv,this._defaultDrawnSignatureOptions=new kv(e.viewParameters)}static getDefaultDrawingOptions(t){const e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!1}static get typesMap(){return Mu(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!Vd(this,Bc)}}static computeTelemetryFinalData(t){var e,i;const s=t.get("hasDescription");return{hasAltText:null!=(e=s.get(!0))?e:0,hasNoAltText:null!=(i=s.get(!1))?i:0}}get isResizable(){return!0}onScaleChanging(){null!==this._drawId&&super.onScaleChanging()}
1render(){if(this.div)return this.div;let e,i;const{_isCopy:s}=this;if(s&&(this._isCopy=!1,e=this.x,i=this.y),super.render(),null===this._drawId)if(Vd(this,Oc)){const{lines:e,mustSmooth:i,areContours:s,description:n,uuid:a,heightInPage:r}=Vd(this,Oc),{rawDims:{pageWidth:o,pageHeight:l},rotation:h}=this.parent.viewport,c=_v.processDrawnLines({lines:e,pageWidth:o,pageHeight:l,rotation:h,innerMargin:t._INNER_MARGIN,mustSmooth:i,areContours:s});this.addSignature(c,r,n,a)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:Vd(this,Bc)||""}));return s&&(this._isCopy=!0,this._moveAfterPaste(e,i)),this.div}setUuid(t){qd(this,jc,t),this.addEditToolbar()}getUuid(){return Vd(this,jc)}get description(){return Vd(this,Bc)}set description(t){qd(this,Bc,t),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:t})),super.addEditToolbar().then(e=>{null==e||e.updateEditSignatureButton(t)}))}getSignaturePreview(){const{newCurves:t,areContours:e,thickness:i,width:s,height:n}=Vd(this,Oc),a=Math.max(s,n);return{areContours:e,outline:_v.processDrawnLines({lines:{curves:t.map(t=>({points:t})),thickness:i,width:s,height:n},pageWidth:a,pageHeight:a,rotation:0,innerMargin:0,mustSmooth:!1,areContours:e}).outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,i,s,n){const{x:a,y:r}=this,{outline:o}=qd(this,Oc,e);let l;qd(this,Wc,o instanceof Av),this.description=s,Vd(this,Wc)?l=t.getDefaultDrawingOptions():(l=t._defaultDrawnSignatureOptions.clone(),l.updateProperties({"stroke-width":o.thickness})),this._addOutlines({drawOutlines:o,drawingOptions:l});const[,h]=this.pageDimensions;let c=i/h;c=c>=1?.5:c,this.width*=c/this.height,this.width>=1&&(c*=.9/this.width,this.width=.9),this.height=c,this.setDims(),this.x=a,this.y=r,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(n),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!n,hasDescription:!!s}}),this.div.hidden=!1}getFromImage(e){const{rawDims:{pageWidth:i,pageHeight:s},rotation:n}=this.parent.viewport;return _v.process(e,i,s,n,t._INNER_MARGIN)}getFromText(e,i){const{rawDims:{pageWidth:s,pageHeight:n},rotation:a}=this.parent.viewport;return _v.extractContoursFromText(e,i,s,n,a,t._INNER_MARGIN)}getDrawnSignature(e){const{rawDims:{pageWidth:i,pageHeight:s},rotation:n}=this.parent.viewport;return _v.processDrawnLines({lines:e,pageWidth:i,pageHeight:s,rotation:n,innerMargin:t._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:i}){e?this._drawingOptions=t.getDefaultDrawingOptions():(this._drawingOptions=t._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":i}))}serialize(t=!1){if(this.isEmpty())return null;const{lines:e,points:i}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":s}}=this,n=Object.assign(super.serialize(t),{isSignature:!0,areContours:Vd(this,Wc),color:[0,0,0],thickness:Vd(this,Wc)?0:s});return this.addComment(n),t?(n.paths={lines:e,points:i},n.uuid=Vd(this,jc),n.isCopy=!0):n.lines=e,Vd(this,Bc)&&(n.accessibilityData={type:"Figure",alt:Vd(this,Bc)}),n}static deserializeDraw(t,e,i,s,n,a){return a.areContours?Av.deserialize(t,e,i,s,n,a):vv.deserialize(t,e,i,s,n,a)}static async deserialize(t,e,i){var s;const n=await super.deserialize(t,e,i);return qd(n,Wc,t.areContours),n.description=(null==(s=t.accessibilityData)?void 0:s.alt)||"",qd(n,jc,t.uuid),n}};Wc=new WeakMap,Bc=new WeakMap,Oc=new WeakMap,jc=new WeakMap,$d(Sv,"_type","signature"),$d(Sv,"_editorType",du.SIGNATURE),$d(Sv,"_defaultDrawingOptions",null);let Mv=Sv;class Ev extends Vp{constructor(t){super({...t,name:"stampEditor"}),Gd(this,Jc),Gd(this,Uc,null),Gd(this,Hc,null),Gd(this,$c,null),Gd(this,zc,null),Gd(this,Vc,null),Gd(this,Gc,""),Gd(this,qc,null),Gd(this,Xc,!1),Gd(this,Yc,null),Gd(this,Kc,!1),Gd(this,Qc,!1),qd(this,zc,t.bitmapUrl),qd(this,Vc,t.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,e){Vp.initialize(t,e)}static isHandlingMimeForPasting(t){return fp.includes(t)}static paste(t,e){e.pasteEditor({mode:du.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!!(null==(t=this.altTextData)?void 0:t.altText)}}static computeTelemetryFinalData(t){var e,i;const s=t.get("hasAltText");return{hasAltText:null!=(e=s.get(!0))?e:0,hasNoAltText:null!=(i=s.get(!1))?i:0}}async mlGuessAltText(t=null,e=!0){if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!(await i.isEnabledFor("altText")))throw new Error("ML isn't enabled for alt text.");const{data:s,width:n,height:a}=t||this.copyCanvas(null,null,!0).imageData,r=await i.guess({name:"altText",request:{data:s,width:n,height:a,channels:s.length/(n*a)}});if(!r)throw new Error("No response from the AI service.");if(r.error)throw new Error("Error from the AI service.");if(r.cancel)return null;if(!r.output)throw new Error("No valid response from the AI service.");const o=r.output;return await this.setGuessedAltText(o),e&&!this.hasAltTextData()&&(this.altTextData={alt:o,decorative:!1}),o}remove(){var t;Vd(this,Hc)&&(qd(this,Uc,null),this._uiManager.imageManager.deleteId(Vd(this,Hc)),null==(t=Vd(this,qc))||t.remove(),qd(this,qc,null),Vd(this,Yc)&&(clearTimeout(Vd(this,Yc)),qd(this,Yc,null))),super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(Vd(this,Hc)&&null===Vd(this,qc)&&Xd(this,Jc,ed).call(this),this.isAttachedToDOM||this.parent.add(this))):Vd(this,Hc)&&Xd(this,Jc,ed).call(this)}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(Vd(this,$c)||Vd(this,Uc)||Vd(this,zc)||Vd(this,Vc)||Vd(this,Hc)||Vd(this,Xc))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}
1render(){if(this.div)return this.div;let t,e;return this._isCopy&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.createAltText(),Vd(this,Xc)||(Vd(this,Uc)?Xd(this,Jc,id).call(this):Xd(this,Jc,ed).call(this)),this._isCopy&&this._moveAfterPaste(t,e),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,e){const{id:i,bitmap:s}=this._uiManager.imageManager.getFromCanvas(t,e);e.remove(),i&&this._uiManager.imageManager.isValidId(i)&&(qd(this,Hc,i),s&&qd(this,Uc,s),qd(this,Xc,!1),Xd(this,Jc,id).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){this.parent&&(null!==Vd(this,Yc)&&clearTimeout(Vd(this,Yc)),qd(this,Yc,setTimeout(()=>{qd(this,Yc,null),Xd(this,Jc,nd).call(this)},200)))}copyCanvas(t,e,i=!1){t||(t=224);const{width:s,height:n}=Vd(this,Uc),a=new gp;let r=Vd(this,Uc),o=s,l=n,h=null;if(e){if(s>e||n>e){const t=Math.min(e/s,e/n);o=Math.floor(s*t),l=Math.floor(n*t)}h=document.createElement("canvas");const t=h.width=Math.ceil(o*a.sx),i=h.height=Math.ceil(l*a.sy);Vd(this,Kc)||(r=Xd(this,Jc,sd).call(this,t,i));const c=h.getContext("2d");c.filter=this._uiManager.hcmFilter;let d="white",u="#cfcfd8";"none"!==this._uiManager.hcmFilter?u="black":mp.isDarkMode&&(d="#8f8f9d",u="#42414d");const p=15,g=p*a.sx,f=p*a.sy,m=new OffscreenCanvas(2*g,2*f),v=m.getContext("2d");v.fillStyle=d,v.fillRect(0,0,2*g,2*f),v.fillStyle=u,v.fillRect(0,0,g,f),v.fillRect(g,f,g,f),c.fillStyle=c.createPattern(m,"repeat"),c.fillRect(0,0,t,i),c.drawImage(r,0,0,r.width,r.height,0,0,t,i)}let c=null;if(i){let e,i;if(a.symmetric&&r.width<t&&r.height<t)e=r.width,i=r.height;else if(r=Vd(this,Uc),s>t||n>t){const a=Math.min(t/s,t/n);e=Math.floor(s*a),i=Math.floor(n*a),Vd(this,Kc)||(r=Xd(this,Jc,sd).call(this,e,i))}const o=new OffscreenCanvas(e,i).getContext("2d",{willReadFrequently:!0});o.drawImage(r,0,0,r.width,r.height,0,0,e,i),c={width:e,height:i,data:o.getImageData(0,0,e,i).data}}return{canvas:h,width:o,height:l,imageData:c}}static async deserialize(t,e,i){var s;let n=null,a=!1;if(t instanceof Qm){const{data:{rect:r,rotation:o,id:l,structParent:h,popupRef:c,richText:d,contentsObj:u,creationDate:p,modificationDate:g},container:f,parent:{page:{pageNumber:m}},canvas:v}=t;let w,b;v?(delete t.canvas,({id:w,bitmap:b}=i.imageManager.getFromCanvas(f.id,v)),v.remove()):(a=!0,t._hasNoCanvas=!0);const y=(null==(s=await e._structTree.getAriaAttributes(`${$u}${l}`))?void 0:s.get("aria-label"))||"";n=t={annotationType:du.STAMP,bitmapId:w,bitmap:b,pageIndex:m-1,rect:r.slice(0),rotation:o,annotationElementId:l,id:l,deleted:!1,accessibilityData:{decorative:!1,altText:y},isSvg:!1,structParent:h,popupRef:c,richText:d,comment:(null==u?void 0:u.str)||null,creationDate:p,modificationDate:g}}const r=await super.deserialize(t,e,i),{rect:o,bitmap:l,bitmapUrl:h,bitmapId:c,isSvg:d,accessibilityData:u}=t;a?(i.addMissingCanvas(t.id,r),qd(r,Xc,!0)):c&&i.imageManager.isValidId(c)?(qd(r,Hc,c),l&&qd(r,Uc,l)):qd(r,zc,h),qd(r,Kc,d);const[p,g]=r.pageDimensions;return r.width=(o[2]-o[0])/p,r.height=(o[3]-o[1])/g,u&&(r.altTextData=u),r._initialData=n,t.comment&&r.setCommentData(t),qd(r,Qc,!!n),r}serialize(t=!1,e=null){var i;if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s=Object.assign(super.serialize(t),{bitmapId:Vd(this,Hc),isSvg:Vd(this,Kc)});if(this.addComment(s),t)return s.bitmapUrl=Xd(this,Jc,ad).call(this,!0),s.accessibilityData=this.serializeAltText(!0),s.isCopy=!0,s;const{decorative:n,altText:a}=this.serializeAltText(!1);if(!n&&a&&(s.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const t=Xd(this,Jc,rd).call(this,s);return t.isSame?null:(t.isSameAltText?delete s.accessibilityData:s.accessibilityData.structParent=null!=(i=this._initialData.structParent)?i:-1,s.id=this.annotationElementId,delete s.bitmapId,s)}if(null===e)return s;e.stamps||(e.stamps=new Map);const r=Vd(this,Kc)?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(e.stamps.has(Vd(this,Hc))){if(Vd(this,Kc)){const t=e.stamps.get(Vd(this,Hc));r>t.area&&(t.area=r,t.serialized.bitmap.close(),t.serialized.bitmap=Xd(this,Jc,ad).call(this,!1))}}else e.stamps.set(Vd(this,Hc),{area:r,serialized:s}),s.bitmap=Xd(this,Jc,ad).call(this,!1);return s}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}Uc=new WeakMap,Hc=new WeakMap,$c=new WeakMap,zc=new WeakMap,Vc=new WeakMap,Gc=new WeakMap,qc=new WeakMap,Xc=new WeakMap,Yc=new WeakMap,Kc=new WeakMap,Qc=new WeakMap,Jc=new WeakSet,Zc=function(t,e=!1){t?(qd(this,Uc,t.bitmap),e||(qd(this,Hc,t.id),qd(this,Kc,t.isSvg)),t.file&&qd(this,Gc,t.file.name),Xd(this,Jc,id).call(this)):this.remove()},td=function(){if(qd(this,$c,null),this._uiManager.enableWaiting(!1),Vd(this,qc))if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&Vd(this,Uc))this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&Vd(this,Uc)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch(t){}}this.div.focus()}},ed=function(){if(Vd(this,Hc))return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(Vd(this,Hc)).then(t=>Xd(this,Jc,Zc).call(this,t,!0)).finally(()=>Xd(this,Jc,td).call(this));if(Vd(this,zc)){const t=Vd(this,zc);return qd(this,zc,null),this._uiManager.enableWaiting(!0),void qd(this,$c,this._uiManager.imageManager.getFromUrl(t).then(t=>Xd(this,Jc,Zc).call(this,t)).finally(()=>Xd(this,Jc,td).call(this)))}if(Vd(this,Vc)){const t=Vd(this,Vc);return qd(this,Vc,null),this._uiManager.enableWaiting(!0),void qd(this,$c,this._uiManager.imageManager.getFromFile(t).then(t=>Xd(this,Jc,Zc).call(this,t)).finally(()=>Xd(this,Jc,td).call(this)))}const t=document.createElement("input");t.type="file",t.accept=fp.join(",");const e=this._uiManager._signal;qd(this,$c,new Promise(i=>{t.addEventListener("change",async()=>
1{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);const e=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),Xd(this,Jc,Zc).call(this,e)}else this.remove();i()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:e})}).finally(()=>Xd(this,Jc,td).call(this))),t.click()},id=function(){var t;const{div:e}=this;let{width:i,height:s}=Vd(this,Uc);const[n,a]=this.pageDimensions,r=.75;if(this.width)i=this.width*n,s=this.height*a;else if(i>r*n||s>r*a){const t=Math.min(r*n/i,r*a/s);i*=t,s*=t}this._uiManager.enableWaiting(!1);const o=qd(this,qc,document.createElement("canvas"));o.setAttribute("role","img"),this.addContainer(o),this.width=i/n,this.height=s/a,this.setDims(),(null==(t=this._initialOptions)?void 0:t.isCentered)?this.center():this.fixAndSetPosition(),this._initialOptions=null,this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(e.hidden=!1),Xd(this,Jc,nd).call(this),Vd(this,Qc)||(this.parent.addUndoableEditor(this),qd(this,Qc,!0)),this._reportTelemetry({action:"inserted_image"}),Vd(this,Gc)&&this.div.setAttribute("aria-description",Vd(this,Gc)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},sd=function(t,e){const{width:i,height:s}=Vd(this,Uc);let n=i,a=s,r=Vd(this,Uc);for(;n>2*t||a>2*e;){const i=n,s=a;n>2*t&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2)),a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2));const o=new OffscreenCanvas(n,a);o.getContext("2d").drawImage(r,0,0,i,s,0,0,n,a),r=o.transferToImageBitmap()}return r},nd=function(){const[t,e]=this.parentDimensions,{width:i,height:s}=this,n=new gp,a=Math.ceil(i*t*n.sx),r=Math.ceil(s*e*n.sy),o=Vd(this,qc);if(!o||o.width===a&&o.height===r)return;o.width=a,o.height=r;const l=Vd(this,Kc)?Vd(this,Uc):Xd(this,Jc,sd).call(this,a,r),h=o.getContext("2d");h.filter=this._uiManager.hcmFilter,h.drawImage(l,0,0,l.width,l.height,0,0,a,r)},ad=function(t){if(t){if(Vd(this,Kc)){const t=this._uiManager.imageManager.getSvgUrl(Vd(this,Hc));if(t)return t}const t=document.createElement("canvas");return({width:t.width,height:t.height}=Vd(this,Uc)),t.getContext("2d").drawImage(Vd(this,Uc),0,0),t.toDataURL()}if(Vd(this,Kc)){const[t,e]=this.pageDimensions,i=Math.round(this.width*t*Ku.PDF_TO_CSS_UNITS),s=Math.round(this.height*e*Ku.PDF_TO_CSS_UNITS),n=new OffscreenCanvas(i,s);return n.getContext("2d").drawImage(Vd(this,Uc),0,0,Vd(this,Uc).width,Vd(this,Uc).height,0,0,i,s),n.transferToImageBitmap()}return structuredClone(Vd(this,Uc))},rd=function(t){var e;const{pageIndex:i,accessibilityData:{altText:s}}=this._initialData,n=t.pageIndex===i,a=((null==(e=t.accessibilityData)?void 0:e.alt)||"")===s;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&n&&a,isSameAltText:a}},$d(Ev,"_type","stamp"),$d(Ev,"_editorType",du.STAMP);const Cv=class t{constructor({uiManager:e,pageIndex:i,div:s,structTreeLayer:n,accessibilityManager:a,annotationLayer:r,drawLayer:o,textLayer:l,viewport:h,l10n:c}){Gd(this,kd),Gd(this,od),Gd(this,ld,!1),Gd(this,hd,null),Gd(this,cd,null),Gd(this,dd,null),Gd(this,ud,new Map),Gd(this,pd,!1),Gd(this,gd,!1),Gd(this,fd,!1),Gd(this,md,null),Gd(this,vd,null),Gd(this,wd,null),Gd(this,bd,null),Gd(this,yd,null),Gd(this,Ad,-1),Gd(this,_d);const d=[...Vd(t,xd).values()];if(!t._initialized){t._initialized=!0;for(const t of d)t.initialize(c,e)}e.registerEditorTypes(d),qd(this,_d,e),this.pageIndex=i,this.div=s,qd(this,od,a),qd(this,hd,r),this.viewport=h,qd(this,wd,l),this.drawLayer=o,this._structTree=n,Vd(this,_d).addLayer(this)}get isEmpty(){return 0===Vd(this,ud).size}get isInvisible(){return this.isEmpty&&Vd(this,_d).getMode()===du.NONE}updateToolbar(t){Vd(this,_d).updateToolbar(t)}updateMode(e=Vd(this,_d).getMode()){switch(Xd(this,kd,Pd).call(this),e){case du.NONE:return this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case du.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case du.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:i}=this.div;if(i.toggle("nonEditing",!1),e===du.POPUP)i.toggle("commentEditing",!0);else{i.toggle("commentEditing",!1);for(const s of Vd(t,xd).values())i.toggle(`${s._type}Editing`,e===s._editorType)}this.div.hidden=!1}hasTextLayer(t){var e;return t===(null==(e=Vd(this,wd))?void 0:e.div)}setEditingState(t){Vd(this,_d).setEditingState(t)}addCommands(t){Vd(this,_d).addCommands(t)}cleanUndoStack(t){Vd(this,_d).cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){var e;null==(e=Vd(this,hd))||e.div.classList.toggle("disabled",!t)}async enable(){var t;qd(this,fd,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),null==(t=Vd(this,yd))||t.abort(),qd(this,yd,null);const e=new Set;for(const s of Vd(this,kd,Sd))s.enableEditing(),s.show(!0),s.annotationElementId&&(Vd(this,_d).removeChangedExistingAnnotation(s),e.add(s.annotationElementId));const i=Vd(this,hd);if(i)for(const s of i.getEditableAnnotations()){if(s.hide(),Vd(this,_d).isDeletedAnnotationElement(s.data.id))continue;if(e.has(s.data.id))continue;const t=await this.deserialize(s);t&&(this.addOrRebuild(t),t.enableEditing())}qd(this,fd,!1),Vd(this,_d)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){var e;if(qd(this,gd,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),Vd(this,wd)&&!Vd(this,yd)){qd(this,yd,new AbortController);const t=Vd(this,_d).combinedSignal(Vd(this,yd));Vd(this,wd).div.addEventListener("pointerdown",t=>{const{clientX:e,clientY:i,timeStamp:s}=t;if(s-Vd(this,Ad)>500)return void qd(this,Ad,s);qd(this,Ad,-1);const{classList:n}=this.div;n.toggle("getElements",!0);const a=document.elementsFromPoint(e,i);if(n.toggle("getElements",!1),!this.div.contains(a[0]))return;let r;const o=new RegExp(`^${cu}[0-9]+$`);for(const h of a)if(o.test(h.id)){r=h.id;break}if(!r)return;const l=Vd(this,ud).get(r);null===(null==l?void 0:l.annotationElementId)&&(t.stopPropagation(),t.preventDefault(),l.dblclick(t))},{signal:t,capture:!0})}const i=Vd(this,hd);if(i){const t=new Map,s=new Map;for(const a of Vd(this,kd,Sd))a.disableEditing(),a.annotationElementId?null===a.serialize()?(s.set(a.annotationElementId,a),null==(e=this.getEditableAnnotation(a.annotationElementId))||e.show(),a.remove()):t.set(a.annotationElementId,a):a.updateFakeAnnotationElement(i);const n=i.getEditableAnnotations();for(const e of n){const{id:i}=e.data;if(Vd(this,_d).isDeletedAnnotationElement(i)){e.updateEdited({deleted:!0}
1);continue}let n=s.get(i);n?(n.resetAnnotationElement(e),n.show(!1),e.show()):(n=t.get(i),n&&(Vd(this,_d).addChangedExistingAnnotation(n),n.renderAnnotationElement(e)&&n.show(!1)),e.show())}}Xd(this,kd,Pd).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const n of Vd(t,xd).values())s.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),qd(this,gd,!1)}getEditableAnnotation(t){var e;return(null==(e=Vd(this,hd))?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){Vd(this,_d).getActive()!==t&&Vd(this,_d).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,(null==(t=Vd(this,wd))?void 0:t.div)&&!Vd(this,bd)){qd(this,bd,new AbortController);const t=Vd(this,_d).combinedSignal(Vd(this,bd));Vd(this,wd).div.addEventListener("pointerdown",Xd(this,kd,Md).bind(this),{signal:t}),Vd(this,wd).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,(null==(t=Vd(this,wd))?void 0:t.div)&&Vd(this,bd)&&(Vd(this,bd).abort(),qd(this,bd,null),Vd(this,wd).div.classList.remove("highlighting"))}enableClick(){if(Vd(this,cd))return;qd(this,cd,new AbortController);const t=Vd(this,_d).combinedSignal(Vd(this,cd));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});const e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){var t;null==(t=Vd(this,cd))||t.abort(),qd(this,cd,null)}attach(t){Vd(this,ud).set(t.id,t);const{annotationElementId:e}=t;e&&Vd(this,_d).isDeletedAnnotationElement(e)&&Vd(this,_d).removeDeletedAnnotationElement(t)}detach(t){var e;Vd(this,ud).delete(t.id),null==(e=Vd(this,od))||e.removePointerInTextLayer(t.contentDiv),!Vd(this,gd)&&t.annotationElementId&&Vd(this,_d).addDeletedAnnotationElement(t)}remove(t){this.detach(t),Vd(this,_d).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(Vd(this,_d).addDeletedAnnotationElement(t.annotationElementId),Vp.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),null==(e=t.parent)||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),Vd(this,_d).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!Vd(this,fd)),Vd(this,_d).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var e;if(!t.isAttachedToDOM)return;const{activeElement:i}=document;t.div.contains(i)&&!Vd(this,dd)&&(t._focusEventsAllowed=!1,qd(this,dd,setTimeout(()=>{qd(this,dd,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:Vd(this,_d)._signal}),i.focus())},0))),t._structTreeParentId=null==(e=Vd(this,od))?void 0:e.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){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getEditorByUID(t){for(const e of Vd(this,ud).values())if(e.uid===t)return e;return null}getNextId(){return Vd(this,_d).getId()}combinedSignal(t){return Vd(this,_d).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return null==(t=Vd(this,kd,Ed))?void 0:t.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await Vd(this,_d).updateMode(t.mode);const{offsetX:i,offsetY:s}=Xd(this,kd,Td).call(this),n=this.getNextId(),a=Xd(this,kd,Cd).call(this,{parent:this,id:n,x:i,y:s,uiManager:Vd(this,_d),isCentered:!0,...e});a&&this.add(a)}async deserialize(e){var i,s;return await(null==(s=Vd(t,xd).get(null!=(i=e.annotationType)?i:e.annotationEditorType))?void 0:s.deserialize(e,this,Vd(this,_d)))||null}createAndAddNewEditor(t,e,i={}){const s=this.getNextId(),n=Xd(this,kd,Cd).call(this,{parent:this,id:s,x:t.offsetX,y:t.offsetY,uiManager:Vd(this,_d),isCentered:e,...i});return n&&this.add(n),n}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(t={}){this.createAndAddNewEditor(Xd(this,kd,Td).call(this),!0,t)}setSelected(t){Vd(this,_d).setSelected(t)}toggleSelected(t){Vd(this,_d).toggleSelected(t)}unselect(t){Vd(this,_d).unselect(t)}pointerup(t){var e;const{isMac:i}=Nu.platform;if(0!==t.button||t.ctrlKey&&i)return;if(t.target!==this.div)return;if(!Vd(this,pd))return;if(qd(this,pd,!1),(null==(e=Vd(this,kd,Ed))?void 0:e.isDrawer)&&Vd(this,kd,Ed).supportMultipleDrawings)return;if(!Vd(this,ld))return void qd(this,ld,!0);const s=Vd(this,_d).getMode();s!==du.STAMP&&s!==du.SIGNATURE?this.createAndAddNewEditor(t,!1):Vd(this,_d).unselectAll()}pointerdown(t){var e;if(Vd(this,_d).getMode()===du.HIGHLIGHT&&this.enableTextSelection(),Vd(this,pd))return void qd(this,pd,!1);const{isMac:i}=Nu.platform;if(0!==t.button||t.ctrlKey&&i)return;if(t.target!==this.div)return;if(qd(this,pd,!0),null==(e=Vd(this,kd,Ed))?void 0:e.isDrawer)return void this.startDrawingSession(t);const s=Vd(this,_d).getActive();qd(this,ld,!s||s.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),Vd(this,md))return void Vd(this,kd,Ed).startDrawing(this,Vd(this,_d),!1,t);Vd(this,_d).setCurrentDrawingSession(this),qd(this,md,new AbortController);const e=Vd(this,_d).combinedSignal(Vd(this,md));this.div.addEventListener("blur",({relatedTarget:t})=>{t&&!this.div.contains(t)&&(qd(this,vd,null),this.commitOrRemove())},{signal:e}),Vd(this,kd,Ed).startDrawing(this,Vd(this,_d),!1,t)}pause(t){if(t){const{activeElement:t}=document;return void(this.div.contains(t)&&qd(this,vd,t))}Vd(this,vd)&&setTimeout(()=>{var t;
1null==(t=Vd(this,vd))||t.focus(),qd(this,vd,null)},0)}endDrawingSession(t=!1){return Vd(this,md)?(Vd(this,_d).setCurrentDrawingSession(null),Vd(this,md).abort(),qd(this,md,null),qd(this,vd,null),Vd(this,kd,Ed).endDrawing(t)):null}findNewParent(t,e,i){const s=Vd(this,_d).findParent(e,i);return null!==s&&s!==this&&(s.changeParent(t),!0)}commitOrRemove(){return!!Vd(this,md)&&(this.endDrawingSession(),!0)}onScaleChanging(){Vd(this,md)&&Vd(this,kd,Ed).onScaleChangingWhenDrawing(this)}destroy(){var t,e;this.commitOrRemove(),(null==(t=Vd(this,_d).getActive())?void 0:t.parent)===this&&(Vd(this,_d).commitOrRemove(),Vd(this,_d).setActiveEditor(null)),Vd(this,dd)&&(clearTimeout(Vd(this,dd)),qd(this,dd,null));for(const i of Vd(this,ud).values())null==(e=Vd(this,od))||e.removePointerInTextLayer(i.contentDiv),i.setParent(null),i.isAttachedToDOM=!1,i.div.remove();this.div=null,Vd(this,ud).clear(),Vd(this,_d).removeLayer(this)}render({viewport:t}){this.viewport=t,pp(this.div,t);for(const e of Vd(this,_d).getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){Vd(this,_d).commitOrRemove(),Xd(this,kd,Pd).call(this);const e=this.viewport.rotation,i=t.rotation;if(this.viewport=t,pp(this.div,{rotation:i}),e!==i)for(const s of Vd(this,ud).values())s.rotate(i)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return Vd(this,_d).viewParameters.realScale}};od=new WeakMap,ld=new WeakMap,hd=new WeakMap,cd=new WeakMap,dd=new WeakMap,ud=new WeakMap,pd=new WeakMap,gd=new WeakMap,fd=new WeakMap,md=new WeakMap,vd=new WeakMap,wd=new WeakMap,bd=new WeakMap,yd=new WeakMap,Ad=new WeakMap,_d=new WeakMap,xd=new WeakMap,kd=new WeakSet,Sd=function(){return 0!==Vd(this,ud).size?Vd(this,ud).values():Vd(this,_d).getEditors(this.pageIndex)},Md=function(t){Vd(this,_d).unselectAll();const{target:e}=t;if(e===Vd(this,wd).div||("img"===e.getAttribute("role")||e.classList.contains("endOfContent"))&&Vd(this,wd).div.contains(e)){const{isMac:e}=Nu.platform;if(0!==t.button||t.ctrlKey&&e)return;Vd(this,_d).showAllEditors("highlight",!0,!0),Vd(this,wd).div.classList.add("free"),this.toggleDrawing(),uv.startHighlighting(this,"ltr"===Vd(this,_d).direction,{target:Vd(this,wd).div,x:t.x,y:t.y}),Vd(this,wd).div.addEventListener("pointerup",()=>{Vd(this,wd).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:Vd(this,_d)._signal}),t.preventDefault()}},Ed=function(){return Vd(Cv,xd).get(Vd(this,_d).getMode())},Cd=function(t){const e=Vd(this,kd,Ed);return e?new e.prototype.constructor(t):null},Td=function(){const{x:t,y:e,width:i,height:s}=this.boundingClientRect,n=Math.max(0,t),a=Math.max(0,e),r=(n+Math.min(window.innerWidth,t+i))/2-t,o=(a+Math.min(window.innerHeight,e+s))/2-e,[l,h]=this.viewport.rotation%180==0?[r,o]:[o,r];return{offsetX:l,offsetY:h}},Pd=function(){for(const t of Vd(this,ud).values())t.isEmpty()&&t.remove()},$d(Cv,"_initialized",!1),Gd(Cv,xd,new Map([iv,yv,Ev,uv,Mv].map(t=>[t._editorType,t])));let Tv=Cv;const Pv=class t{constructor({pageIndex:t}){Gd(this,Wd),Gd(this,Dd,null),Gd(this,Rd,new Map),Gd(this,Id,new Map),this.pageIndex=t}setParent(t){if(Vd(this,Dd)){if(Vd(this,Dd)!==t){if(Vd(this,Rd).size>0)for(const e of Vd(this,Rd).values())e.remove(),t.append(e);qd(this,Dd,t)}}else qd(this,Dd,t)}static get _svgFactory(){return Mu(this,"_svgFactory",new _m)}draw(e,i=!1,s=!1){const n=Yd(t,Ld)._++,a=Xd(this,Wd,Bd).call(this),r=t._svgFactory.createElement("defs");a.append(r);const o=t._svgFactory.createElement("path");r.append(o);const l=`path_p${this.pageIndex}_${n}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),i&&Vd(this,Id).set(n,o);const h=s?Xd(this,Wd,Od).call(this,r,l):null,c=t._svgFactory.createElement("use");return a.append(c),c.setAttribute("href",`#${l}`),this.updateProperties(a,e),Vd(this,Rd).set(n,a),{id:n,clipPathId:`url(#${h})`}}drawOutline(e,i){const s=Yd(t,Ld)._++,n=Xd(this,Wd,Bd).call(this),a=t._svgFactory.createElement("defs");n.append(a);const r=t._svgFactory.createElement("path");a.append(r);const o=`path_p${this.pageIndex}_${s}`;let l;if(r.setAttribute("id",o),r.setAttribute("vector-effect","non-scaling-stroke"),i){const e=t._svgFactory.createElement("mask");a.append(e),l=`mask_p${this.pageIndex}_${s}`,e.setAttribute("id",l),e.setAttribute("maskUnits","objectBoundingBox");const i=t._svgFactory.createElement("rect");e.append(i),i.setAttribute("width","1"),i.setAttribute("height","1"),i.setAttribute("fill","white");const n=t._svgFactory.createElement("use");e.append(n),n.setAttribute("href",`#${o}`),n.setAttribute("stroke","none"),n.setAttribute("fill","black"),n.setAttribute("fill-rule","nonzero"),n.classList.add("mask")}const h=t._svgFactory.createElement("use");n.append(h),h.setAttribute("href",`#${o}`),l&&h.setAttribute("mask",`url(#${l})`);const c=h.cloneNode();return n.append(c),h.classList.add("mainOutline"),c.classList.add("secondaryOutline"),this.updateProperties(n,e),Vd(this,Rd).set(s,n),s}finalizeDraw(t,e){Vd(this,Id).delete(t),this.updateProperties(t,e)}updateProperties(e,i){var s;if(!i)return;const{root:n,bbox:a,rootClass:r,path:o}=i,l="number"==typeof e?Vd(this,Rd).get(e):e;
1if(l){if(n&&Xd(this,Wd,jd).call(this,l,n),a&&Xd(s=t,Fd,Nd).call(s,l,a),r){const{classList:t}=l;for(const[e,i]of Object.entries(r))t.toggle(e,i)}if(o){const t=l.firstChild.firstChild;Xd(this,Wd,jd).call(this,t,o)}}}updateParent(t,e){if(e===this)return;const i=Vd(this,Rd).get(t);i&&(Vd(e,Dd).append(i),Vd(this,Rd).delete(t),Vd(e,Rd).set(t,i))}remove(t){Vd(this,Id).delete(t),null!==Vd(this,Dd)&&(Vd(this,Rd).get(t).remove(),Vd(this,Rd).delete(t))}destroy(){qd(this,Dd,null);for(const t of Vd(this,Rd).values())t.remove();Vd(this,Rd).clear(),Vd(this,Id).clear()}};Dd=new WeakMap,Rd=new WeakMap,Id=new WeakMap,Ld=new WeakMap,Fd=new WeakSet,Nd=function(t,[e,i,s,n]){const{style:a}=t;a.top=100*i+"%",a.left=100*e+"%",a.width=100*s+"%",a.height=100*n+"%"},Wd=new WeakSet,Bd=function(){const t=Pv._svgFactory.create(1,1,!0);return Vd(this,Dd).append(t),t.setAttribute("aria-hidden",!0),t},Od=function(t,e){const i=Pv._svgFactory.createElement("clipPath");t.append(i);const s=`clip_${e}`;i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");const n=Pv._svgFactory.createElement("use");return i.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),s},jd=function(t,e){for(const[i,s]of Object.entries(e))null===s?t.removeAttribute(i):t.setAttribute(i,s)},Gd(Pv,Fd),Gd(Pv,Ld,0);let Dv=Pv;globalThis._pdfjsTestingUtils={HighlightOutliner:ov},globalThis.pdfjsLib={AbortException:Iu,AnnotationEditorLayer:Tv,AnnotationEditorParamsType:uu,AnnotationEditorType:du,AnnotationEditorUIManager:Bp,AnnotationLayer:Zm,AnnotationMode:hu,AnnotationType:fu,applyOpacity:wp,build:pm,ColorPicker:fm,createValidAbsoluteUrl:ku,CSSConstants:vp,DOMSVGFactory:_m,DrawLayer:Dv,FeatureTest:Nu,fetchData:Qu,findContrastColor:kp,getDocument:tm,getFilenameFromUrl:ip,getPdfFilenameFromUrl:sp,getRGB:cp,getUuid:Hu,getXfaPageViewport:hp,GlobalWorkerOptions:kf,ImageKind:gu,InvalidPDFException:Pu,isDataScheme:tp,isPdfFile:ep,isValidExplicitDest:ng,MathClamp:zu,noContextMenu:rp,normalizeUnicode:Uu,OPS:vu,OutputScale:gp,PasswordResponses:wu,PDFDataRangeTransport:sm,PDFDateString:lp,PDFWorker:om,PermissionFlag:pu,PixelsPerInch:Ku,RenderingCancelledException:Zu,renderRichText:Sp,ResponseException:Du,setLayerDimensions:pp,shadow:Mu,SignatureExtractor:_v,stopEvent:op,SupportedImageMimeTypes:fp,TextLayer:Zf,TouchManager:$p,updateUrlHash:Su,Util:Bu,VerbosityLevel:mu,version:um,XfaLayer:qu};const Rv=Object.freeze(Object.defineProperty({__proto__:null,AbortException:Iu,AnnotationEditorLayer:Tv,AnnotationEditorParamsType:uu,AnnotationEditorType:du,AnnotationEditorUIManager:Bp,AnnotationLayer:Zm,AnnotationMode:hu,AnnotationType:fu,CSSConstants:vp,ColorPicker:fm,DOMSVGFactory:_m,DrawLayer:Dv,FeatureTest:Nu,GlobalWorkerOptions:kf,ImageKind:gu,InvalidPDFException:Pu,MathClamp:zu,OPS:vu,OutputScale:gp,PDFDataRangeTransport:sm,PDFDateString:lp,PDFWorker:om,PasswordResponses:wu,PermissionFlag:pu,PixelsPerInch:Ku,RenderingCancelledException:Zu,ResponseException:Du,SignatureExtractor:_v,SupportedImageMimeTypes:fp,TextLayer:Zf,TouchManager:$p,Util:Bu,VerbosityLevel:mu,XfaLayer:qu,applyOpacity:wp,build:pm,createValidAbsoluteUrl:ku,fetchData:Qu,findContrastColor:kp,getDocument:tm,getFilenameFromUrl:ip,getPdfFilenameFromUrl:sp,getRGB:cp,getUuid:Hu,getXfaPageViewport:hp,isDataScheme:tp,isPdfFile:ep,isValidExplicitDest:ng,noContextMenu:rp,normalizeUnicode:Uu,renderRichText:Sp,setLayerDimensions:pp,shadow:Mu,stopEvent:op,updateUrlHash:Su,version:um},Symbol.toStringTag,{value:"Module"}));var Iv=Object.prototype.hasOwnProperty;function Lv(t,e,i){for(i of t.keys())if(Fv(i,e))return i}function Fv(t,e){var i,s,n;if(t===e)return!0;if(t&&e&&(i=t.constructor)===e.constructor){if(i===Date)return t.getTime()===e.getTime();if(i===RegExp)return t.toString()===e.toString();if(i===Array){if((s=t.length)===e.length)for(;s--&&Fv(t[s],e[s]););return-1===s}if(i===Set){if(t.size!==e.size)return!1;for(s of t){if((n=s)&&"object"==typeof n&&!(n=Lv(e,n)))return!1;if(!e.has(n))return!1}return!0}if(i===Map){if(t.size!==e.size)return!1;for(s of t){if((n=s[0])&&"object"==typeof n&&!(n=Lv(e,n)))return!1;if(!Fv(s[1],e.get(n)))return!1}return!0}if(i===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(i===DataView){if((s=t.byteLength)===e.byteLength)for(;s--&&t.getInt8(s)===e.getInt8(s););return-1===s}if(ArrayBuffer.isView(t)){if((s=t.byteLength)===e.byteLength)for(;s--&&t[s]===e[s];);return-1===s}if(!i||"object"==typeof t){for(i in s=0,t){if(Iv.call(t,i)&&++s&&!Iv.call(e,i))return!1;if(!(i in e)||!Fv(t[i],e[i]))return!1}return Object.keys(e).length===s}}return t!=t&&e!=e}function Nv(t){let e=!1;return{promise:new Promise((i,s)=>{t.then(t=>!e&&i(t)).catch(t=>!e&&s(t))}),cancel(){e=!0}}}const Wv=["onCopy","onCut","onPaste","onCompositionEnd","onCompositionStart","onCompositionUpdate","onFocus","onBlur","onInput","onInvalid","onReset","onSubmit","onLoad","onError","onKeyDown","onKeyPress","onKeyUp","onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting","onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onScroll","onWheel","onAnimationStart","onAnimationEnd","onAnimationIteration","onTransitionEnd","onChange","onToggle"];function Bv(t,e){const i={};for(const s of Wv){const n=t[s];n&&(i[s]=e?t=>n(t,e(s)):n)}return i}function Ov(t,e){if(!t)throw new Error("Invariant failed")}const jv=Kd(Zd()),Uv=Qd.createContext(null);class Hv{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}setHash(){}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return Ov(this.pdfViewer),this.pdfViewer.currentPageNumber||0}set page(t){Ov(this.pdfViewer),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}addLinkAttributes(t,e,i){t.href=e,t.rel=this.externalLinkRel||"noopener noreferrer nofollow",t.target=i?"_blank":this.externalLinkTarget||""}goToDestination(t){return new Promise(e=>{Ov(this.pdfDocument),Ov(t),"string"==typeof t?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(t=>{Ov(Array.isArray(t));const e=t[0];new Promise(t=>{Ov(this.pdfDocument),e instanceof Object?this.pdfDocument.getPageIndex(e).then(e=>{t(e)}).catch(()=>{Ov(!1)}):"number"==typeof e?t(e):Ov(!1)}).then(e=>{const i=e+1;Ov(this.pdfViewer),Ov(i>=1&&i<=this.pagesCount),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:e,pageNumber:i})})})}goToPage(t){const e=t-1;Ov(this.pdfViewer),Ov(t>=1&&t<=this.pagesCount),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}goToXY(){}cachePageRef(){}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}executeNamedAction(){}executeSetOCGState(){}isPageVisible(){return!0}isPageCached(){return!0}navigateTo(t){this.goToDestination(t)}}function $v({children:t,type:e}){return Jd.jsx("div",{className:`react-pdf__message react-pdf__message--${e}`,children:t})}function zv(t,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return t}}function Vv(){return Qd.useReducer(zv,{value:void 0,error:void 0})}const Gv="undefined"!=typeof window,qv=Gv&&"file:"===window.location.protocol;function Xv(t){return function(t){return void 0!==t}(t)&&null!==t}function Yv(t){return function(t){return"string"==typeof t}(t)&&/^data:/.test(t)}function Kv(t){Ov(Yv(t));const[e="",i=""]=t.split(",");return-1!==e.split(";").indexOf("base64")?atob(i):unescape(i)}function Qv(){return Gv&&window.devicePixelRatio||1}const Jv="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function Zv(){jv(!qv,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${Jv}`)}function tw(t){(null==t?void 0:t.cancel)&&t.cancel()}function ew(t,e){return Object.defineProperty(t,"width",{get(){return this.view[2]*e},configurable:!0}),Object.defineProperty(t,"height",{get(){return this.view[3]*e},configurable:!0}),Object.defineProperty(t,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(t,"originalHeight",{get(){return this.view[3]},configurable:!0}),t}const{PDFDataRangeTransport:iw}=Rv,sw=(t,e)=>{switch(e){case 1:t(prompt("Enter the password to open this PDF file."));break;case 2:t(prompt("Invalid password. Please try again."))}};function nw(t){return"object"==typeof t&&null!==t&&("data"in t||"range"in t||"url"in t)}const aw=Qd.forwardRef(function({children:t,className:e,error:i="Failed to load PDF file.",externalLinkRel:s,externalLinkTarget:n,file:a,inputRef:r,imageResourcesPath:o,loading:l="Loading PDFâ¦",noData:h="No PDF file specified.",onItemClick:c,onLoadError:d,onLoadProgress:u,onLoadSuccess:p,onPassword:g=sw,onSourceError:f,onSourceSuccess:m,options:v,renderMode:w,rotate:b,scale:y,...A},_){const[x,k]=Vv(),{value:S,error:M}=x,[E,C]=Vv(),{value:T,error:P}=E,D=Qd.useRef(new Hv),R=Qd.useRef([]),I=Qd.useRef(void 0),L=Qd.useRef(void 0);a&&a!==I.current&&nw(a)&&(jv(!Fv(a,I.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.'),I.current=a),v&&v!==L.current&&(jv(!Fv(v,L.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.'),L.current=v);const F=Qd.useRef({scrollPageIntoView:t=>{const{dest:e,pageNumber:i,pageIndex:s=i-1}=t;if(c)return void c({dest:e,pageIndex:s,pageNumber:i});const n=R.current[s];n?n.scrollIntoView():jv(!1,`An internal link leading to page ${i} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document>
1 and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});Qd.useImperativeHandle(_,()=>({linkService:D,pages:R,viewer:F}),[]),Qd.useEffect(function(){k({type:"RESET"})},[a,k]);const N=Qd.useCallback(async()=>{if(!a)return null;if("string"==typeof a)return Yv(a)?{data:Kv(a)}:(Zv(),{url:a});if(a instanceof iw)return{range:a};if(a instanceof ArrayBuffer)return{data:a};if(Gv&&(t=a,Ov(Gv),t instanceof Blob)){const t=await function(t){return new Promise((e,i)=>{const s=new FileReader;s.onload=()=>{if(!s.result)return i(new Error("Error while reading a file."));e(s.result)},s.onerror=t=>{if(!t.target)return i(new Error("Error while reading a file."));const{error:e}=t.target;if(!e)return i(new Error("Error while reading a file."));switch(e.code){case e.NOT_FOUND_ERR:return i(new Error("Error while reading a file: File not found."));case e.SECURITY_ERR:return i(new Error("Error while reading a file: Security error."));case e.ABORT_ERR:return i(new Error("Error while reading a file: Aborted."));default:return i(new Error("Error while reading a file."))}},s.readAsArrayBuffer(t)})}(a);return{data:t}}var t;if(Ov("object"==typeof a),Ov(nw(a)),"url"in a&&"string"==typeof a.url){if(Yv(a.url)){const{url:t,...e}=a;return{data:Kv(t),...e}}Zv()}return a},[a]);Qd.useEffect(()=>{const t=Nv(N());return t.promise.then(t=>{k({type:"RESOLVE",value:t})}).catch(t=>{k({type:"REJECT",error:t})}),()=>{tw(t)}},[N,k]),Qd.useEffect(()=>{void 0!==S&&(!1!==S?m&&m():M&&(jv(!1,M.toString()),f&&f(M)))},[S]),Qd.useEffect(function(){C({type:"RESET"})},[C,S]),Qd.useEffect(function(){if(!S)return;const t=tm(v?{...S,...v}:S);u&&(t.onProgress=u),g&&(t.onPassword=g);const e=t,i=e.promise.then(t=>{C({type:"RESOLVE",value:t})}).catch(t=>{e.destroyed||C({type:"REJECT",error:t})});return()=>{i.finally(()=>e.destroy())}},[v,C,S]),Qd.useEffect(()=>{void 0!==T&&(!1!==T?T&&(p&&p(T),R.current=new Array(T.numPages),D.current.setDocument(T)):P&&(jv(!1,P.toString()),d&&d(P)))},[T]),Qd.useEffect(function(){D.current.setViewer(F.current),D.current.setExternalLinkRel(s),D.current.setExternalLinkTarget(n)},[s,n]);const W=Qd.useCallback((t,e)=>{R.current[t]=e},[]),B=Qd.useCallback(t=>{delete R.current[t]},[]),O=Qd.useMemo(()=>({imageResourcesPath:o,linkService:D.current,onItemClick:c,pdf:T,registerPage:W,renderMode:w,rotate:b,scale:y,unregisterPage:B}),[o,c,T,W,w,b,y,B]),j=Qd.useMemo(()=>Bv(A,()=>T),[A,T]);return Jd.jsx("div",{className:au("react-pdf__Document",e),ref:r,...j,children:a?null==T?Jd.jsx($v,{type:"loading",children:"function"==typeof l?l():l}):!1===T?Jd.jsx($v,{type:"error",children:"function"==typeof i?i():i}):function(){if(e=O,!Boolean(null==e?void 0:e.pdf))throw new Error("pdf is undefined");var e;const i="function"==typeof t?t(O):t;return Jd.jsx(Uv.Provider,{value:O,children:i})}():Jd.jsx($v,{type:"no-data",children:"function"==typeof h?h():h})})});function rw(){return Qd.useContext(Uv)}function ow(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=t.filter(Boolean);return i.length<=1?i[0]||null:function(t){for(var e=0,s=i;e<s.length;e++){var n=s[e];"function"==typeof n?n(t):n&&(n.current=t)}}}const lw=Qd.createContext(null);function hw(){return Qd.useContext(lw)}function cw(){const t=rw(),e=hw();Ov(e);const i={...t,...e},{imageResourcesPath:s,linkService:n,onGetAnnotationsError:a,onGetAnnotationsSuccess:r,onRenderAnnotationLayerError:o,onRenderAnnotationLayerSuccess:l,page:h,pdf:c,renderForms:d,rotate:u,scale:p=1}=i;Ov(c),Ov(h),Ov(n);const[g,f]=Vv(),{value:m,error:v}=g,w=Qd.useRef(null);jv(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10),"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations"),Qd.useEffect(function(){f({type:"RESET"})},[f,h]),Qd.useEffect(function(){if(!h)return;const t=Nv(h.getAnnotations()),e=t;return t.promise.then(t=>{f({type:"RESOLVE",value:t})}).catch(t=>{f({type:"REJECT",error:t})}),()=>{tw(e)}},[f,h]),Qd.useEffect(()=>{void 0!==m&&(!1!==m?m&&r&&r(m):v&&(jv(!1,v.toString()),a&&a(v)))},[m]);const b=Qd.useMemo(()=>h.getViewport({scale:p,rotation:u}),[h,u,p]);return Qd.useEffect(function(){if(!(c&&h&&n&&m))return;const{current:t}=w;if(!t)return;const e=b.clone({dontFlip:!0}),i={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,annotationStorage:c.annotationStorage,commentManager:null,div:t,l10n:null,linkService:n,page:h,structTreeLayer:null,viewport:e},a={annotations:m,annotationStorage:c.annotationStorage,div:t,imageResourcesPath:s,linkService:n,page:h,renderForms:d,viewport:e};t.innerHTML="";try{new Zm(i).render(a),l&&l()}catch(r){!function(t){jv(!1,`${t}`),o&&o(t)}(r)}return()=>{}},[m,s,n,h,c,d,b]),Jd.jsx("div",{className:au("react-pdf__Page__annotations","annotationLayer"),ref:w})}const dw={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P
1: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},uw=/^H(\d+)$/;function pw(t){return"children"in t}function gw(t){return!!pw(t)&&1===t.children.length&&0 in t.children&&"id"in t.children[0]}function fw(t){const e={};if(pw(t)){const{role:i}=t,s=i.match(uw);if(s)e.role="heading",e["aria-level"]=Number(s[1]);else if(function(t){return t in dw}(i)){const t=dw[i];t&&(e.role=t)}}return e}function mw(t){const e={};if(pw(t)){if(void 0!==t.alt&&(e["aria-label"]=t.alt),void 0!==t.lang&&(e.lang=t.lang),gw(t)){const[i]=t.children;if(i){const t=mw(i);return{...e,...t}}}}else"id"in t&&(e["aria-owns"]=t.id);return e}function vw({className:t,node:e}){const i=Qd.useMemo(()=>function(t){return t?{...fw(t),...mw(t)}:null}(e),[e]),s=Qd.useMemo(()=>pw(e)?gw(e)?null:e.children.map((t,e)=>Jd.jsx(vw,{node:t},e)):null,[e]);return Jd.jsx("span",{className:t,...i,children:s})}function ww(){const t=hw();Ov(t);const{onGetStructTreeError:e,onGetStructTreeSuccess:i}=t,[s,n]=Vv(),{value:a,error:r}=s,{customTextRenderer:o,page:l}=t;return Qd.useEffect(function(){n({type:"RESET"})},[n,l]),Qd.useEffect(function(){if(o)return;if(!l)return;const t=Nv(l.getStructTree()),e=t;return t.promise.then(t=>{n({type:"RESOLVE",value:t})}).catch(t=>{n({type:"REJECT",error:t})}),()=>tw(e)},[o,l,n]),Qd.useEffect(()=>{void 0!==a&&(!1!==a?a&&i&&i(a):r&&(jv(!1,r.toString()),e&&e(r)))},[a]),a?Jd.jsx(vw,{className:"react-pdf__Page__structTree structTree",node:a}):null}const bw=hu;function yw(t){const e=hw();Ov(e);const i={...e,...t},{_className:s,canvasBackground:n,devicePixelRatio:a=Qv(),onRenderError:r,onRenderSuccess:o,page:l,renderForms:h,renderTextLayer:c,rotate:d,scale:u}=i,{canvasRef:p}=t;Ov(l);const g=Qd.useRef(null);
1function f(t){(function(t){return"RenderingCancelledException"===t.name})(t)||(jv(!1,t.toString()),r&&r(t))}const m=Qd.useMemo(()=>l.getViewport({scale:u*a,rotation:d}),[a,l,d,u]),v=Qd.useMemo(()=>l.getViewport({scale:u,rotation:d}),[l,d,u]);Qd.useEffect(function(){if(!l)return;l.cleanup();const{current:t}=g;if(!t)return;t.width=m.width,t.height=m.height,t.style.width=`${Math.floor(v.width)}px`,t.style.height=`${Math.floor(v.height)}px`,t.style.visibility="hidden";const e={annotationMode:h?bw.ENABLE_FORMS:bw.ENABLE,canvas:t,canvasContext:t.getContext("2d",{alpha:!1}),viewport:m};n&&(e.background=n);const i=l.render(e),s=i;return i.promise.then(()=>{t.style.visibility="",l&&o&&o(ew(l,u))}).catch(f),()=>tw(s)},[n,l,h,m,v]);const w=Qd.useCallback(()=>{const{current:t}=g;t&&(t.width=0,t.height=0)},[]);return Qd.useEffect(()=>w,[w]),Jd.jsx("canvas",{className:`${s}__canvas`,dir:"ltr",ref:ow(p,g),style:{display:"block",userSelect:"none"},children:c?Jd.jsx(ww,{}):null})}function Aw(){const t=hw();Ov(t);const{customTextRenderer:e,onGetTextError:i,onGetTextSuccess:s,onRenderTextLayerError:n,onRenderTextLayerSuccess:a,page:r,pageIndex:o,pageNumber:l,rotate:h,scale:c}=t;Ov(r);const[d,u]=Vv(),{value:p,error:g}=d,f=Qd.useRef(null);jv(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10),"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer"),Qd.useEffect(function(){u({type:"RESET"})},[r,u]),Qd.useEffect(function(){if(!r)return;const t=Nv(r.getTextContent()),e=t;return t.promise.then(t=>{u({type:"RESOLVE",value:t})}).catch(t=>{u({type:"REJECT",error:t})}),()=>tw(e)},[r,u]),Qd.useEffect(()=>{void 0!==p&&(!1!==p?p&&s&&s(p):g&&(jv(!1,g.toString()),i&&i(g)))},[p]);const m=Qd.useCallback(()=>{a&&a()},[a]),v=Qd.useCallback(t=>{jv(!1,t.toString()),n&&n(t)},[n]),w=Qd.useMemo(()=>r.getViewport({scale:c,rotation:h}),[r,h,c]);return Qd.useLayoutEffect(function(){if(!r||!p)return;const{current:t}=f;if(!t)return;t.innerHTML="";const i=r.streamTextContent({includeMarkedContent:!0}),s=new Zf({container:t,textContentSource:i,viewport:w}),n=s;return s.render().then(()=>{const i=document.createElement("div");i.className="endOfContent",t.append(i);const s=t.querySelectorAll('[role="presentation"]');if(e){let t=0;p.items.forEach((i,n)=>{if(!function(t){return"str"in t}(i))return;const a=s[t];if(!a)return;const r=e({pageIndex:o,pageNumber:l,itemIndex:n,...i});a.innerHTML=r,t+=i.str&&i.hasEOL?2:1})}m()}).catch(v),()=>tw(n)},[e,v,m,r,o,l,p,w]),Jd.jsx("div",{className:au("react-pdf__Page__textContent","textLayer"),onMouseUp:function(){const t=f.current;t&&t.classList.remove("selecting")},onMouseDown:function(){const t=f.current;t&&t.classList.add("selecting")},ref:f})}const _w=1;function xw(t){const e={...rw(),...t},{_className:i="react-pdf__Page",_enableRegisterUnregisterPage:s=!0,canvasBackground:n,canvasRef:a,children:r,className:o,customRenderer:l,customTextRenderer:h,devicePixelRatio:c,error:d="Failed to load the page.",height:u,inputRef:p,loading:g="Loading pageâ¦",noData:f="No page specified.",onGetAnnotationsError:m,onGetAnnotationsSuccess:v,onGetStructTreeError:w,onGetStructTreeSuccess:b,onGetTextError:y,onGetTextSuccess:A,onLoadError:_,onLoadSuccess:x,onRenderAnnotationLayerError:k,onRenderAnnotationLayerSuccess:S,onRenderError:M,onRenderSuccess:E,onRenderTextLayerError:C,onRenderTextLayerSuccess:T,pageIndex:P,pageNumber:D,pdf:R,registerPage:I,renderAnnotationLayer:L=!0,renderForms:F=!1,renderMode:N="canvas",renderTextLayer:W=!0,rotate:B,scale:O=_w,unregisterPage:j,width:U,...H}=e,[$,z]=Vv(),{value:V,error:G}=$,q=Qd.useRef(null);Ov(R);const X=Xv(D)?D-1:null!=P?P:null,Y=null!=D?D:Xv(P)?P+1:null,K=null!=B?B:V?V.rotate:null,Q=Qd.useMemo(()=>{if(!V)return null;let t=1;const e=null!=O?O:_w;if(U||u){const e=V.getViewport({scale:1,rotation:K});U?t=U/e.width:u&&(t=u/e.height)}return e*t},[u,V,K,O,U]);Qd.useEffect(function(){return()=>{Xv(X)&&s&&j&&j(X)}},[s,R,X,j]),Qd.useEffect(function(){z({type:"RESET"})},[z,R,X]),Qd.useEffect(function(){if(!R||!Y)return;const t=Nv(R.getPage(Y)),e=t;return t.promise.then(t=>{z({type:"RESOLVE",value:t})}).catch(t=>{z({type:"REJECT",error:t})}),()=>tw(e)},[z,R,Y]),Qd.useEffect(()=>{void 0!==V&&(!1!==V?function(){if(x){if(!V||!Q)return;x(ew(V,Q))}if(s&&I){if(!Xv(X)||!q.current)return;I(X,q.current)}}():G&&(jv(!1,G.toString()),_&&_(G)))},[V,Q]);const J=Qd.useMemo(()=>
1Xv(X)&&Y&&Xv(K)&&Xv(Q)?{_className:i,canvasBackground:n,customTextRenderer:h,devicePixelRatio:c,onGetAnnotationsError:m,onGetAnnotationsSuccess:v,onGetStructTreeError:w,onGetStructTreeSuccess:b,onGetTextError:y,onGetTextSuccess:A,onRenderAnnotationLayerError:k,onRenderAnnotationLayerSuccess:S,onRenderError:M,onRenderSuccess:E,onRenderTextLayerError:C,onRenderTextLayerSuccess:T,page:V,pageIndex:X,pageNumber:Y,renderForms:F,renderTextLayer:W,rotate:K,scale:Q}:null,[i,n,h,c,m,v,w,b,y,A,k,S,M,E,C,T,V,X,Y,F,W,K,Q]),Z=Qd.useMemo(()=>Bv(H,()=>V?Q?ew(V,Q):void 0:V),[H,V,Q]),tt=`${X}@${Q}/${K}`;function et(){switch(N){case"custom":return Ov(l),Jd.jsx(l,{},`${tt}_custom`);case"none":return null;default:return Jd.jsx(yw,{canvasRef:a},`${tt}_canvas`)}}return Jd.jsx("div",{className:au(i,o),"data-page-number":Y,ref:ow(p,q),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":`${Q}`,"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:n||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"},...Z,children:Y?null===R||null==V?Jd.jsx($v,{type:"loading",children:"function"==typeof g?g():g}):!1===R||!1===V?Jd.jsx($v,{type:"error",children:"function"==typeof d?d():d}):function(){if(t=J,!Boolean(null==t?void 0:t.page))throw new Error("page is undefined");var t;const e="function"==typeof r?r(J):r;return Jd.jsxs(lw.Provider,{value:J,children:[et(),W?Jd.jsx(Aw,{},`${tt}_text`):null,L?Jd.jsx(cw,{},`${tt}_annotations`):null,e]})}():Jd.jsx($v,{type:"no-data",children:"function"==typeof f?f():f})})}jv(!qv,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${Jv}`),kf.workerSrc="pdf.worker.mjs",kf.workerSrc="/assets/pdf.worker.min-DoN1TE3s.js";const kw=({parentClassName:t,pdfFile:e,viewport:i,onClose:s})=>{const[n,a]=Qd.useState(1),[r,o]=Qd.useState(1),[l,h]=Qd.useState(0),[c,d]=Qd.useState(1),[u,p]=Qd.useState(!1),[g,f]=Qd.useState("100%"),[m,v]=Qd.useState("100%"),w=t=>{n>=1&&n<=l&&a(n+t)},b=t=>{i.medium&&r>=1&&o(r+t),!i.medium&&c>=.3&&d(c+t)},y=Qd.useCallback(()=>{if(document.getElementsByClassName("react-pdf__Page__canvas").length){const t=document.getElementsByClassName("react-pdf__Page__canvas")[0],e=t.width,s=t.height,n=document.getElementsByClassName("pb-modal__content-wrapper")[0];if(n)if(i.medium){const t=e+32;n.style.maxWidth=t.toString().concat("px"),n.style.minWidth="auto";const i=n.clientHeight,a=e>n.clientWidth-32,r=s>i;a||r?(n.style.overflowX=a?"scroll":"hidden",n.style.overflowY=r?"scroll":"auto",p(!0)):(n.style.overflowX="hidden",n.style.overflowY="auto",p(!1))}else{t.style.width="100%",t.style.height="100%";const e=document.getElementsByClassName("react-pdf__Page__textContent")[0];e&&(e.style.height="auto"),n.style.width="100%",n.style.maxWidth="100%"}}},[i.medium,r]);Qd.useEffect(()=>{i.medium&&r>0&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{y()})})},[r,i.medium,y]);const A="pb-pdf-reader",_={[A]:!0,[t]:t},x=Jd.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"400px",width:"100%"},children:Jd.jsx(Qd.Suspense,{fallback:Jd.jsx(tu,{size:"flexi"}),children:Jd.jsx(aw,{file:e,onLoadSuccess:t=>{h(t.numPages);let e=document.getElementsByClassName("pb-modal__bounds")[0];f(e.clientWidth),v(e.clientHeight)},loading:Jd.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:g,height:m},children:Jd.jsx(tu,{size:"flexi"})}),error:"Something went wrong",children:Jd.jsx(xw,{pageNumber:n,scale:i.medium?r:c||1,onLoadSuccess:t=>{const e=document.getElementsByClassName("react-pdf__Document")[0];if(e){const i=e.clientWidth/t.originalWidth;d(i)}requestAnimationFrame(()=>{requestAnimationFrame(()=>{y()})})},loading:Jd.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:g,height:m},children:Jd.jsx(tu,{size:"flexi"})})})})})}),k=Jd.jsxs("div",{className:`${A}__pdf-btn-wrapper`,children:[Jd.jsx("button",{className:`${A}__zoom-btn`,disabled:i.medium?r<=1:c<.4,onClick:()=>b(-.1),children:Jd.jsx(eu,{name:"zoom-out",size:"sm"})}),Jd.jsx("button",{className:`${A}__zoom-btn`,disabled:r>2,onClick:()=>b(.1),children:Jd.jsx(eu,{name:"zoom-in",size:"sm"})}),Jd.jsx("button",{className:`${A}__zoom-btn`,disabled:n<=1,onClick:()=>w(-1),children:Jd.jsx(eu,{name:"chevron-left",size:"sm"})}),n,"/",l,Jd.jsx("button",{className:`${A}__zoom-btn`,onClick:()=>w(1),disabled:n>=l,children:Jd.jsx(eu,{name:"chevron-right",size:"sm"})})]});return Jd.jsx("div",{className:iu(_),children:Jd.jsx(su,{parentClassName:i.medium?`${A}__modal-wrapper`:`${A}__modal-mobile-wrapper`,onClose:s,footer:k,pdfModal:u||(i.medium?r>1:c>=.3),children:x})})};kw.propTypes={parentClassName:nu.string};export{kw as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.