UNPKG

@tuttarealstep/vue-pdf.js

Version:

A Vue component for displaying PDF files using the standard `pdf.js` viewer. This package provides a simple and powerful integration to embed PDF viewers in Vue applications.

2 lines 3.87 MB
(function(Ct,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],S):(Ct=typeof globalThis<"u"?globalThis:Ct||self,S(Ct.VuePDFjs={},Ct.Vue))})(this,function(Ct,S){"use strict";var E7=Object.defineProperty;var t2=Ct=>{throw TypeError(Ct)};var g7=(Ct,S,ns)=>S in Ct?E7(Ct,S,{enumerable:!0,configurable:!0,writable:!0,value:ns}):Ct[S]=ns;var se=(Ct,S,ns)=>g7(Ct,typeof S!="symbol"?S+"":S,ns),s2=(Ct,S,ns)=>S.has(Ct)||t2("Cannot "+ns),rJ=(Ct,S)=>Object(S)!==S?t2('Cannot use the "in" operator on this value'):Ct.has(S),o=(Ct,S,ns)=>(s2(Ct,S,"read from private field"),ns?ns.call(Ct):S.get(Ct)),R=(Ct,S,ns)=>S.has(Ct)?t2("Cannot add the same private member more than once"):S instanceof WeakSet?S.add(Ct):S.set(Ct,ns),u=(Ct,S,ns,Ks)=>(s2(Ct,S,"write to private field"),Ks?Ks.call(Ct,ns):S.set(Ct,ns),ns),g=(Ct,S,ns)=>(s2(Ct,S,"access private method"),ns);var ri=(Ct,S,ns,Ks)=>({set _(In){u(Ct,S,In,ns)},get _(){return o(Ct,S,Ks)}});var ld,WC,i2,OI,Gc,HQ,yn,xc,vI,Xr,PI,DR,FJ,xi,UJ,BJ,oZ,IJ,pC,_I,KQ,OQ,yc,EJ,gJ,uJ,qI,fr,$I,Oi,zr,MC,fs,Jc,eE,ps,wR,ZJ,jr,Kl,ai,yi,Hr,ad,Kr,Jn,Lc,Tc,Or,vQ,t0,ha,PQ,sE,iE,vr,lE,s0,kc,Pr,Yc,i0,nE,Dc,aE,wc,_Q,qQ,Xc,dE,gi,_t,dd,fc,$Q,cE,AE,zc,l0,cd,QE,Ln,xe,GC,l2,bJ,RJ,xC,CJ,NJ,mJ,n2,VJ,a2,d2,SJ,ul,cc,WJ,pJ,c2,MJ,hZ,A2,ui,n0,ra,qr,a0,Ol,$r,d0,Sl,Ad,eo,c0,jc,Fa,rZ,yC,eF,to,oE,hE,rE,FE,UE,Qd,so,od,io,hd,Hc,GJ,xJ,yJ,lo,Ua,rs,tF,Kc,BE,no,Ji,ao,rd,Oc,IE,co,vl,EE,Ao,Fd,A0,sF,iF,Tn,Qo,gE,XR,nt,Q2,uE,o2,JC,JJ,LJ,h2,LC,r2,TJ,kJ,YJ,F2,DJ,U2,wJ,XJ,fJ,B2,FZ,oo,ho,Li,fR,zJ,ZE,lF,Ud,zR,nF,kn,jJ,HJ,KJ,TC,Ba,I2,E2,g2,bE,ro,aF,Bd,Id,vi,Fo,Uo,ke,sl,UZ,lB,kC,nB,OJ,u2,aB,BZ,IZ,Z2,EZ,RE,CE,dF,NE,mE,VE,SE,cF,vc,es,AF,QF,WE,b2,Pl,pE,R2,QJ,Pc,Wl,ME,GE,Bo,Ed,oF,hF,Io,rF,FF,_c,UF,xE,BF,Eo,yE,JE,IF,go,LE,qc,EF,gd,vJ,PJ,C2,_l,YC,N2,_J,qJ,HR,uo,TE,kE,YE,DE,ud,Zo,gZ,$c,Ia,Zd,eA,OR,tA,bo,rl,DC,$J,eL,uZ,gF,wC,bd,Q0,uF,ZF,Rd,Ro,ZZ,Cd,sA,Co,mo,bF,RF,wE,m2,ql,Ph,tL,sL,CF,vR,PR,NF,mF,Ms,Nd,VF,XE,SF,WF,md,Ea,Vd,fE,Sd,zE,Vo,So,qt,XC,V2,iL,lL,nL,aL,fC,bZ,S2,jE,HE,KE,OE,vE,Wo,PE,W2,_E,qE,p2,$E,po,iA,eg,lA,M2,G2,ga,$l,tg,nA,en,qs,dL,cL,AL,zC,Wd,jC,HC,QL,x2,oL,tn,ua,pF,MF,o0,Wt,Mo,Go,sg,ig,GF,xF,aA,lg,_R,qR,ci,RZ,hL,rL,FL,UL,BL,IL,yF,xo,Md,ng,sn,ag,zs,$R,EL,dg,cg,dA,Za,Fl,gL,KC,uL,ZL,y2,Ag,JF,ba,yo,LF,Ai,Qg,TF,og,hg,cA,Ra,kF,rg,ts,J2,L2,T2,_h,bL,cQ,YF,Fg,Gd,Jo,DF,Ml,Ug,Bg,Lo,Yn,ln,Ti,wF,xd,Pi,XF,Dn,Ig,gt,k2,OC,RL,CL,NL,Y2,qh,wn,dB,mL,vC,CZ,VL,SL,WL,pL,ML,To,nn,fF,Zi,ko,Yo,AA,QA,oA,Do,Dt,D2,w2,X2,NZ,GL,PC,mZ,cB,h0,bi,Ri,wo,zF,Ul,ki,Xn,Xo,fo,zo,jF,_C,Bl,Eg,gg,an,r0,F0,HF,KF,jo,Yi,Ac,xL,yL,JL,eC,LL,Ho,vt,f2,Ca,TL,kL,z2,qC,YL,DL,wL,j2,H2,XL,hA,dn,rA,FA,Es,Ci,UA,yd,BA,vF,Jd,Ko,U0,An,PF,wt,VZ,SZ,$C,eN,tN,K2,sN,fL,Oo,_F,B0,IA,Ld,fn,EA,qF,vo,Na,Td,_i,kd,Oe,gA,gs,zL,L0,O2,v2,iN,Va,Il,Po,ug,tC,jL,I0,P2,HL,_2,uA,_o,ZA,$F,qo,oJ,bA,eU,Zg,bg,Rg,$o,Yd,Cg,RA,tU,Gl,sU,KL,OL,Qn,vL,PL,_L,qL,q2,mg,g0,th,Vg,$2,Sg,Wg,$s,pg,Mg,Dd,Gg,sh,ih,iU,CA,on,xg,yg,lU,nU,zn,aU,dU,Jg,lh,hn,Lg,js,nh,tt,$h,lN,WZ,$L,e1,T0,eT,t1,tT,sT,nN,s1,i1,iT,ah,u0,dh,cU,AU,NA,ch,Tg,us,pZ,l1,n1,a1,AB,lT,Ah,Sa,kg,mA,Yg,Qh,oh,wd,hh,Dg,Xd,fd,QU,rh,Fh,zd,wg,oU,Zs,nT,d1,aN,c1,A1,aT,dT,Q1,sC,cT,Xg,hU,fg,Gs,o1,h1,AT,r1,zg,F1,U1,MZ,QT,rU,Hg,VA,FU,SA,WA,Uh,Bh,Kg,Og,pA,xl,jd,Ih,Pg,Z0,B1,oT,I1,iC,hT,b0,Eh,Hd,R0,rT,FT,dN,MA,C0,GA,cN,UT,jn,ei,E1,GZ,g1,BT,u1,IT,oi,UU,gh,ze,ET,Z1,b1,gT,uT,R1,ZT,bT,AN,xZ,QB,RT,C1,N1,QN,CT,m1,V1,yZ,_g,BU,lC,NT,xA,Et,Qc,oN,hN,oB,rN,S1,mT,VT,W1,ST,WT,qg,p1,IU,qi,yA,JA,pt,pT,JZ,MT,GT,xT,yT,M1,JT,LZ,LT,TT,kT,YT,G1,N0,uh,$g,Zh,bh,eu,El,Kd,EU,ti,Hn,Ni,DT,FN,x1,wT,TZ,tu,Rh,su,LA,bs,hB,XT,y1,fT,UN,zT,J1,Ch,si,L1,T1,k1,jT,HT,kZ,$i,KT,Y1,D1,OT,vT,PT,iu,lu,nu,au,du,gU,TA,cu,Au,kA,Qu,m0,w1,X1,_T,nC,ou,Nh,YA,uU,ZU,bU,Od,DA,vd,aC,hu,f1,V0,Wa,dC,qT,RU,pa,CU,NU,mU,wA,S0,z1,$T,j1,Pd,Kn,_d,XA,VU,BN,ru,H1,fA,Fu,Uu,mh,W0,yl,zA,cC,e5,WU,t5,s5,Vh,HA,Bu,Iu,Eu,KA,OA,pU,gu,uu,Zu,MU,bu,qd,vA,ut,rB,IN,FB,K1,O1,v1,P1,_1,i5,l5,n5,q1,$d,Sh,Ru,$1,ec,Cu,Nu,Ma,rn,Wh,mu,Vu,Su,Wu,pu,Mu,Gu,xu,PA,yu,GU,Ga,ph,Mh,xU,_A,yU,Ju,JU,Gh,tc,LU,Lu,TU,qe,a5,d5,c5,YZ,EN,A5,eW,Q5,AQ,tW,o5,h5,r5,sW,F5,iW,gN,lW,xa,el,uN,U5,B5,nW,aW,Tu,On,ku,ya,Ja,Rs,Fn,La,sc,Ta,ka,p0,Jl,M0,xh,Yu,yh,ic,Du,qA,Jh,Lh,wu,Th,lc,$A,vn,Ll,G0,kU,YU,Xu,DU,fu,Ya,nc,zu,$e,I5,dW,DZ,cW,QQ,E5,g5,u5,AW,Z5,b5,ZN,QW,R5,C5,bN,N5,m5,eQ,wU,tQ,XU,fU,Yh,Dh,Da,V5,S5,oW,W5,zU,sQ,gl,hW,p5,rW,wZ,ju,AC,Hu,FW,Ku,UW,Ou,vu,QC,oC,Pu,HU,_u,hC,Kt,UB,M5,G5,RN,BB,x5,y5,J5,BW,Un,CN,NN,IW,x0,iQ,KU,OU,rC,vU,Pn,qu,UC,L5,wa,XZ,mN,$u,eZ,EW,Xh,PU,fh,tZ,sZ,zh,jh,gW,T5,nQ,IB,IC,k5,_U,Hh,Y5,ZW,lZ,bW,nZ,Kh,eB,D5,w5,aZ,gC,X5,_n,RW,CW,f5,z5,sB,Yt,Hs,j5,H5,K5,O5,v5,P5,NW,_5,q5,dZ,mW,vh,ZC,$5,tl,ek,VW,tk,VN,SW,cZ,bC,Ns,EB,fZ,WW,sk,pW,MW,aQ,AZ,Tl,GW,ik,lk,nk,xW;var ns=typeof document<"u"?document.currentScript:null;const Ks=(typeof PDFJSDev>"u"||PDFJSDev.test("GENERIC"))&&typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),In=[.001,0,0,.001,0,0],kl=1.35,zZ=.35,yW=zZ/kl,$t={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Fi={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},SN="pdfjs_internal_editor_",Re={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,SIGNATURE:101},ot={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35,DRAW_STEP:41},oQ={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Ui={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},ys={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},bt={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},WN={GROUP:"Group",REPLY:"R"},ss={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},qn={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864},En={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},JW={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"},ak={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},dk={O:"PageOpen",C:"PageClose"},er={ERRORS:0,WARNINGS:1,INFOS:5},x={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},Fs={moveTo:0,lineTo:1,curveTo:2,closePath:3},jZ={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let HZ=er.WARNINGS;function LW(s){Number.isInteger(s)&&(HZ=s)}function TW(){return HZ}function lt(s){HZ>=er.INFOS&&console.log(`Info: ${s}`)}function y(s){HZ>=er.WARNINGS&&console.log(`Warning: ${s}`)}function ge(s){throw new Error(s)}function Me(s,e){s||ge(e)}function ck(s){switch(s==null?void 0:s.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function oc(s,e=null,t=null){if(!s)return null;if(t&&typeof s=="string"){if(t.addDefaultProtocol&&s.startsWith("www.")){const l=s.match(/\./g);(l==null?void 0:l.length)>=2&&(s=`http://${s}`)}if(t.tryConvertEncoding)try{s=ZB(s)}catch{}}const i=e?URL.parse(s,e):URL.parse(s);return ck(i)?i:null}function hc(s,e,t=!1){const i=URL.parse(s);return i?(i.hash=e,i.href):t&&oc(s,"http://example.com")?s.split("#",1)[0]+`${e?`#${e}`:""}`:""}function P(s,e,t,i=!1){return(typeof PDFJSDev>"u"||PDFJSDev.test("TESTING"))&&Me(e in s,`shadow: Property "${e&&e.toString()}" not found in object.`),Object.defineProperty(s,e,{value:t,enumerable:!i,configurable:!0,writable:!1}),t}const Di=function(){function e(t,i){(typeof PDFJSDev>"u"||PDFJSDev.test("TESTING"))&&this.constructor===e&&ge("Cannot initialize BaseException."),this.message=t,this.name=i}return e.prototype=new Error,e.constructor=e,e}();class gB extends Di{constructor(e,t){super(e,"PasswordException"),this.code=t}}class pN extends Di{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class hQ extends Di{constructor(e){super(e,"InvalidPDFException")}}class uB extends Di{constructor(e,t,i){super(e,"ResponseException"),this.status=t,this.missing=i}}class v extends Di{constructor(e){super(e,"FormatError")}}class ms extends Di{constructor(e){super(e,"AbortException")}}function wi(s){(typeof s!="object"||(s==null?void 0:s.length)===void 0)&&ge("Invalid argument for bytesToString");const e=s.length,t=8192;if(e<t)return String.fromCharCode.apply(null,s);const i=[];for(let l=0;l<e;l+=t){const n=Math.min(l+t,e),a=s.subarray(l,n);i.push(String.fromCharCode.apply(null,a))}return i.join("")}function Ys(s){typeof s!="string"&&ge("Invalid argument for stringToBytes");const e=s.length,t=new Uint8Array(e);for(let i=0;i<e;++i)t[i]=s.charCodeAt(i)&255;return t}function Bi(s){return(typeof PDFJSDev>"u"||PDFJSDev.test("TESTING"))&&Me(typeof s=="number"&&Math.abs(s)<2**32,`string32: Unexpected input "${s}".`),String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,s&255)}function MN(s){return Object.keys(s).length}function Ak(){const s=new Uint8Array(4);return s[0]=1,new Uint32Array(s.buffer,0,1)[0]===1}function Qk(){try{return new Function(""),!0}catch{return!1}}class Xt{static get isLittleEndian(){return P(this,"isLittleEndian",Ak())}static get isEvalSupported(){return P(this,"isEvalSupported",Qk())}static get isOffscreenCanvasSupported(){return P(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return P(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:e,userAgent:t}=navigator;return P(this,"platform",{isAndroid:t.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:typeof PDFJSDev<"u"&&PDFJSDev.test("MOZCENTRAL")||t.includes("Firefox")})}static get isCSSRoundSupported(){var e,t;return P(this,"isCSSRoundSupported",(t=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:t.call(e,"width: round(1.5px, 1px)"))}}const tr=Array.from(Array(256).keys(),s=>s.toString(16).padStart(2,"0"));class Ze{static makeHexColor(e,t,i){return`#${tr[e]}${tr[t]}${tr[i]}`}static scaleMinMax(e,t){let i;e[0]?(e[0]<0&&(i=t[0],t[0]=t[2],t[2]=i),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(i=t[1],t[1]=t[3],t[3]=i),t[1]*=e[3],t[3]*=e[3]):(i=t[0],t[0]=t[1],t[1]=i,i=t[2],t[2]=t[3],t[3]=i,e[1]<0&&(i=t[1],t[1]=t[3],t[3]=i),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(i=t[0],t[0]=t[2],t[2]=i),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t,i=0){const l=e[i],n=e[i+1];e[i]=l*t[0]+n*t[2]+t[4],e[i+1]=l*t[1]+n*t[3]+t[5]}static applyTransformToBezier(e,t,i=0){const l=t[0],n=t[1],a=t[2],d=t[3],c=t[4],A=t[5];for(let Q=0;Q<6;Q+=2){const h=e[i+Q],r=e[i+Q+1];e[i+Q]=h*l+r*a+c,e[i+Q+1]=h*n+r*d+A}}static applyInverseTransform(e,t){const i=e[0],l=e[1],n=t[0]*t[3]-t[1]*t[2];e[0]=(i*t[3]-l*t[2]+t[2]*t[5]-t[4]*t[3])/n,e[1]=(-i*t[1]+l*t[0]+t[4]*t[1]-t[5]*t[0])/n}static axialAlignedBoundingBox(e,t,i){const l=t[0],n=t[1],a=t[2],d=t[3],c=t[4],A=t[5],Q=e[0],h=e[1],r=e[2],F=e[3];let U=l*Q+c,B=U,E=l*r+c,I=E,b=d*h+A,Z=b,C=d*F+A,N=C;if(n!==0||a!==0){const m=n*Q,V=n*r,p=a*h,W=a*F;U+=p,I+=p,E+=W,B+=W,b+=m,N+=m,C+=V,Z+=V}i[0]=Math.min(i[0],U,E,B,I),i[1]=Math.min(i[1],b,C,Z,N),i[2]=Math.max(i[2],U,E,B,I),i[3]=Math.max(i[3],b,C,Z,N)}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){const i=e[0],l=e[1],n=e[2],a=e[3],d=i**2+l**2,c=i*n+l*a,A=n**2+a**2,Q=(d+A)/2,h=Math.sqrt(Q**2-(d*A-c**2));t[0]=Math.sqrt(Q+h||1),t[1]=Math.sqrt(Q-h||1)}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const i=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),l=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(i>l)return null;const n=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return n>a?null:[i,n,l,a]}static pointBoundingBox(e,t,i){i[0]=Math.min(i[0],e),i[1]=Math.min(i[1],t),i[2]=Math.max(i[2],e),i[3]=Math.max(i[3],t)}static rectBoundingBox(e,t,i,l,n){n[0]=Math.min(n[0],e,i),n[1]=Math.min(n[1],t,l),n[2]=Math.max(n[2],e,i),n[3]=Math.max(n[3],t,l)}static bezierBoundingBox(e,t,i,l,n,a,d,c,A){A[0]=Math.min(A[0],e,d),A[1]=Math.min(A[1],t,c),A[2]=Math.max(A[2],e,d),A[3]=Math.max(A[3],t,c),g(this,ld,i2).call(this,e,i,n,d,t,l,a,c,3*(-e+3*(i-n)+d),6*(e-2*i+n),3*(i-e),A),g(this,ld,i2).call(this,e,i,n,d,t,l,a,c,3*(-t+3*(l-a)+c),6*(t-2*l+a),3*(l-t),A)}}ld=new WeakSet,WC=function(e,t,i,l,n,a,d,c,A,Q){if(A<=0||A>=1)return;const h=1-A,r=A*A,F=r*A,U=h*(h*(h*e+3*A*t)+3*r*i)+F*l,B=h*(h*(h*n+3*A*a)+3*r*d)+F*c;Q[0]=Math.min(Q[0],U),Q[1]=Math.min(Q[1],B),Q[2]=Math.max(Q[2],U),Q[3]=Math.max(Q[3],B)},i2=function(e,t,i,l,n,a,d,c,A,Q,h,r){if(Math.abs(A)<1e-12){Math.abs(Q)>=1e-12&&g(this,ld,WC).call(this,e,t,i,l,n,a,d,c,-h/Q,r);return}const F=Q**2-4*h*A;if(F<0)return;const U=Math.sqrt(F),B=2*A;g(this,ld,WC).call(this,e,t,i,l,n,a,d,c,(-Q+U)/B,r),g(this,ld,WC).call(this,e,t,i,l,n,a,d,c,(-Q-U)/B,r)},R(Ze,ld);const ok=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function Nt(s,e=!1){if(s[0]>="ï"){let i;if(s[0]==="þ"&&s[1]==="ÿ"?(i="utf-16be",s.length%2===1&&(s=s.slice(0,-1))):s[0]==="ÿ"&&s[1]==="þ"?(i="utf-16le",s.length%2===1&&(s=s.slice(0,-1))):s[0]==="ï"&&s[1]==="»"&&s[2]==="¿"&&(i="utf-8"),i)try{const l=new TextDecoder(i,{fatal:!0}),n=Ys(s),a=l.decode(n);return e||!a.includes("\x1B")?a:a.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g,"")}catch(l){y(`stringToPDFString: "${l}".`)}}const t=[];for(let i=0,l=s.length;i<l;i++){const n=s.charCodeAt(i);if(!e&&n===27){for(;++i<l&&s.charCodeAt(i)!==27;);continue}const a=ok[n];t.push(a?String.fromCharCode(a):s.charAt(i))}return t.join("")}function ZB(s){return decodeURIComponent(escape(s))}function GN(s){return unescape(encodeURIComponent(s))}function bB(s,e){if(s.length!==e.length)return!1;for(let t=0,i=s.length;t<i;t++)if(s[t]!==e[t])return!1;return!0}function k0(s=new Date){return[s.getUTCFullYear().toString(),(s.getUTCMonth()+1).toString().padStart(2,"0"),s.getUTCDate().toString().padStart(2,"0"),s.getUTCHours().toString().padStart(2,"0"),s.getUTCMinutes().toString().padStart(2,"0"),s.getUTCSeconds().toString().padStart(2,"0")].join("")}let xN=null,kW=null;function yN(s){return xN||(xN=/([\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,kW=new Map([["ſt","ſt"]])),s.replaceAll(xN,(e,t,i)=>t?t.normalize("NFKC"):kW.get(i))}function JN(){if(typeof PDFJSDev<"u"&&PDFJSDev.test("MOZCENTRAL")||typeof crypto.randomUUID=="function")return crypto.randomUUID();const s=new Uint8Array(32);return crypto.getRandomValues(s),wi(s)}const KZ="pdfjs_internal_id_";function YW(s,e,t){if(!Array.isArray(t)||t.length<2)return!1;const[i,l,...n]=t;if(!s(i)&&!Number.isInteger(i)||!e(l))return!1;const a=n.length;let d=!0;switch(l.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return a===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(a!==4)return!1;d=!1;break;default:return!1}for(const c of n)if(!(typeof c=="number"||d&&c===null))return!1;return!0}function yt(s,e,t){return Math.min(Math.max(s,e),t)}function DW(s){return Uint8Array.prototype.toHex?s.toHex():Array.from(s,e=>tr[e]).join("")}function wW(s){return Uint8Array.prototype.toBase64?s.toBase64():btoa(wi(s))}function XW(s){return Uint8Array.fromBase64?Uint8Array.fromBase64(s):Ys(atob(s))}(typeof PDFJSDev>"u"||PDFJSDev.test("SKIP_BABEL"))&&typeof Promise.try!="function"&&(Promise.try=function(s,...e){return new Promise(t=>{t(s(...e))})}),typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(s){return s.reduce((e,t)=>e+t,0)}),typeof PDFJSDev<"u"&&!PDFJSDev.test("SKIP_BABEL")&&typeof AbortSignal.any!="function"&&(AbortSignal.any=function(s){const e=new AbortController,{signal:t}=e;for(const i of s)if(i.aborted)return e.abort(i.reason),t;for(const i of s)i.addEventListener("abort",()=>{e.abort(i.reason)},{signal:t});return t});const Y0="http://www.w3.org/2000/svg",jQ=class jQ{};se(jQ,"CSS",96),se(jQ,"PDF",72),se(jQ,"PDF_TO_CSS_UNITS",jQ.CSS/jQ.PDF);let ii=jQ;async function rc(s,e="text"){if(typeof PDFJSDev<"u"&&PDFJSDev.test("MOZCENTRAL")||NB(s,document.baseURI)){const t=await fetch(s);if(!t.ok)throw new Error(t.statusText);switch(e){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"json":return t.json()}return t.text()}return new Promise((t,i)=>{const l=new XMLHttpRequest;l.open("GET",s,!0),l.responseType=e,l.onreadystatechange=()=>{if(l.readyState===XMLHttpRequest.DONE){if(l.status===200||l.status===0){switch(e){case"arraybuffer":case"blob":case"json":t(l.response);return}t(l.responseText);return}i(new Error(l.statusText))}},l.send(null)})}class RB{constructor({viewBox:e,userUnit:t,scale:i,rotation:l,offsetX:n=0,offsetY:a=0,dontFlip:d=!1}){this.viewBox=e,this.userUnit=t,this.scale=i,this.rotation=l,this.offsetX=n,this.offsetY=a,i*=t;const c=(e[2]+e[0])/2,A=(e[3]+e[1])/2;let Q,h,r,F;switch(l%=360,l<0&&(l+=360),l){case 180:Q=-1,h=0,r=0,F=1;break;case 90:Q=0,h=1,r=1,F=0;break;case 270:Q=0,h=-1,r=-1,F=0;break;case 0:Q=1,h=0,r=0,F=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}d&&(r=-r,F=-F);let U,B,E,I;Q===0?(U=Math.abs(A-e[1])*i+n,B=Math.abs(c-e[0])*i+a,E=(e[3]-e[1])*i,I=(e[2]-e[0])*i):(U=Math.abs(c-e[0])*i+n,B=Math.abs(A-e[1])*i+a,E=(e[2]-e[0])*i,I=(e[3]-e[1])*i),this.transform=[Q*i,h*i,r*i,F*i,U-Q*i*c-r*i*A,B-h*i*c-F*i*A],this.width=E,this.height=I}get rawDims(){const e=this.viewBox;return P(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:i=this.offsetX,offsetY:l=this.offsetY,dontFlip:n=!1}={}){return new RB({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:i,offsetY:l,dontFlip:n})}convertToViewportPoint(e,t){const i=[e,t];return Ze.applyTransform(i,this.transform),i}convertToViewportRectangle(e){const t=[e[0],e[1]];Ze.applyTransform(t,this.transform);const i=[e[2],e[3]];return Ze.applyTransform(i,this.transform),[t[0],t[1],i[0],i[1]]}convertToPdfPoint(e,t){const i=[e,t];return Ze.applyInverseTransform(i,this.transform),i}}class Fc extends Di{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function sr(s){const e=s.length;let t=0;for(;t<e&&s[t].trim()==="";)t++;return s.substring(t,t+5).toLowerCase()==="data:"}function CB(s){return typeof s=="string"&&/\.pdf$/i.test(s)}function fW(s){return[s]=s.split(/[#?]/,1),s.substring(s.lastIndexOf("/")+1)}function LN(s,e="document.pdf"){if(typeof s!="string")return e;if(sr(s))return y('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const t=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,l=t.exec(s);let n=i.exec(l[1])||i.exec(l[2])||i.exec(l[3]);if(n&&(n=n[0],n.includes("%")))try{n=i.exec(decodeURIComponent(n))[0]}catch{}return n||e}class zW{constructor(){se(this,"started",Object.create(null));se(this,"times",[])}time(e){e in this.started&&y(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||y(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const{name:i}of this.times)t=Math.max(i.length,t);for(const{name:i,start:l,end:n}of this.times)e.push(`${i.padEnd(t)} ${n-l}ms `);return e.join("")}}function NB(s,e){if(typeof PDFJSDev<"u"&&PDFJSDev.test("MOZCENTRAL"))throw new Error("Not implemented: isValidFetchUrl");const t=e?URL.parse(s,e):URL.parse(s);return(t==null?void 0:t.protocol)==="http:"||(t==null?void 0:t.protocol)==="https:"}function il(s){s.preventDefault()}function Ot(s){s.preventDefault(),s.stopPropagation()}function hk(s){console.log("Deprecated API usage: "+s)}class OZ{static toDateObject(e){if(!e||typeof e!="string")return null;o(this,OI)||u(this,OI,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const t=o(this,OI).exec(e);if(!t)return null;const i=parseInt(t[1],10);let l=parseInt(t[2],10);l=l>=1&&l<=12?l-1:0;let n=parseInt(t[3],10);n=n>=1&&n<=31?n:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let d=parseInt(t[5],10);d=d>=0&&d<=59?d:0;let c=parseInt(t[6],10);c=c>=0&&c<=59?c:0;const A=t[7]||"Z";let Q=parseInt(t[8],10);Q=Q>=0&&Q<=23?Q:0;let h=parseInt(t[9],10)||0;return h=h>=0&&h<=59?h:0,A==="-"?(a+=Q,d+=h):A==="+"&&(a-=Q,d-=h),new Date(Date.UTC(i,l,n,a,d,c))}}OI=new WeakMap,R(OZ,OI);function jW(s,{scale:e=1,rotation:t=0}){const{width:i,height:l}=s.attributes.style,n=[0,0,parseInt(i),parseInt(l)];return new RB({viewBox:n,userUnit:1,scale:e,rotation:t})}function TN(s){if(s.startsWith("#")){const e=parseInt(s.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return s.startsWith("rgb(")?s.slice(4,-1).split(",").map(e=>parseInt(e)):s.startsWith("rgba(")?s.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(y(`Not a valid color format: "${s}"`),[0,0,0])}function rk(s){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const t of s.keys()){e.style.color=t;const i=window.getComputedStyle(e).color;s.set(t,TN(i))}e.remove()}function Vs(s){const{a:e,b:t,c:i,d:l,e:n,f:a}=s.getTransform();return[e,t,i,l,n,a]}function fa(s){const{a:e,b:t,c:i,d:l,e:n,f:a}=s.getTransform().invertSelf();return[e,t,i,l,n,a]}function D0(s,e,t=!1,i=!0){if(e instanceof RB){const{pageWidth:l,pageHeight:n}=e.rawDims,{style:a}=s,d=Xt.isCSSRoundSupported,c=`var(--total-scale-factor) * ${l}px`,A=`var(--total-scale-factor) * ${n}px`,Q=d?`round(down, ${c}, var(--scale-round-x))`:`calc(${c})`,h=d?`round(down, ${A}, var(--scale-round-y))`:`calc(${A})`;!t||e.rotation%180===0?(a.width=Q,a.height=h):(a.width=h,a.height=Q)}i&&s.setAttribute("data-main-rotation",e.rotation)}class mi{constructor(){const{pixelRatio:e}=mi;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,t,i,l,n=-1){let a=1/0,d=1/0,c=1/0;i=mi.capPixels(i,n),i>0&&(a=Math.sqrt(i/(e*t))),l!==-1&&(d=l/e,c=l/t);const A=Math.min(a,d,c);return this.sx>A||this.sy>A?(this.sx=A,this.sy=A,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){const i=Math.ceil((typeof PDFJSDev<"u"&&PDFJSDev.test("TESTING")?window.innerWidth*window.innerHeight:window.screen.availWidth*window.screen.availHeight)*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,i):i}return e}}const rQ=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"],nd=class nd{constructor(e){R(this,xi);R(this,Gc,null);R(this,HQ,null);R(this,yn);R(this,xc,null);R(this,vI,null);R(this,Xr,null);u(this,yn,e),o(nd,PI)||u(nd,PI,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=u(this,Gc,document.createElement("div"));e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const t=o(this,yn)._uiManager._signal;e.addEventListener("contextmenu",il,{signal:t}),e.addEventListener("pointerdown",g(nd,DR,FJ),{signal:t});const i=u(this,xc,document.createElement("div"));i.className="buttons",e.append(i);const l=o(this,yn).toolbarPosition;if(l){const{style:n}=e,a=o(this,yn)._uiManager.direction==="ltr"?1-l[0]:l[0];n.insetInlineEnd=`${100*a}%`,n.top=`calc(${100*l[1]}% + var(--editor-toolbar-vert-offset))`}return g(this,xi,IJ).call(this),e}get div(){return o(this,Gc)}hide(){var e;o(this,Gc).classList.add("hidden"),(e=o(this,HQ))==null||e.hideDropdown()}show(){var e;o(this,Gc).classList.remove("hidden"),(e=o(this,vI))==null||e.shown()}async addAltText(e){const t=await e.render();g(this,xi,oZ).call(this,t),o(this,xc).prepend(t,o(this,xi,pC)),u(this,vI,e)}addColorPicker(e){u(this,HQ,e);const t=e.renderButton();g(this,xi,oZ).call(this,t),o(this,xc).prepend(t,o(this,xi,pC))}async addEditSignatureButton(e){const t=u(this,Xr,await e.renderEditButton(o(this,yn)));g(this,xi,oZ).call(this,t),o(this,xc).prepend(t,o(this,xi,pC))}updateEditSignatureButton(e){o(this,Xr)&&(o(this,Xr).title=e)}remove(){var e;o(this,Gc).remove(),(e=o(this,HQ))==null||e.destroy(),u(this,HQ,null)}};Gc=new WeakMap,HQ=new WeakMap,yn=new WeakMap,xc=new WeakMap,vI=new WeakMap,Xr=new WeakMap,PI=new WeakMap,DR=new WeakSet,FJ=function(e){e.stopPropagation()},xi=new WeakSet,UJ=function(e){o(this,yn)._focusEventsAllowed=!1,Ot(e)},BJ=function(e){o(this,yn)._focusEventsAllowed=!0,Ot(e)},oZ=function(e){const t=o(this,yn)._uiManager._signal;e.addEventListener("focusin",g(this,xi,UJ).bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",g(this,xi,BJ).bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",il,{signal:t})},IJ=function(){const{editorType:e,_uiManager:t}=o(this,yn),i=document.createElement("button");i.className="delete",i.tabIndex=0,i.setAttribute("data-l10n-id",o(nd,PI)[e]),g(this,xi,oZ).call(this,i),i.addEventListener("click",l=>{t.delete()},{signal:t._signal}),o(this,xc).append(i)},pC=function(){const e=document.createElement("div");return e.className="divider",e},R(nd,DR),R(nd,PI,null);let kN=nd;class Fk{constructor(e){R(this,yc);R(this,_I,null);R(this,KQ,null);R(this,OQ);u(this,OQ,e)}show(e,t,i){const[l,n]=g(this,yc,gJ).call(this,t,i),{style:a}=o(this,KQ)||u(this,KQ,g(this,yc,EJ).call(this));e.append(o(this,KQ)),a.insetInlineEnd=`${100*l}%`,a.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){o(this,KQ).remove()}}_I=new WeakMap,KQ=new WeakMap,OQ=new WeakMap,yc=new WeakSet,EJ=function(){const e=u(this,KQ,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",il,{signal:o(this,OQ)._signal});const t=u(this,_I,document.createElement("div"));return t.className="buttons",e.append(t),g(this,yc,uJ).call(this),e},gJ=function(e,t){let i=0,l=0;for(const n of e){const a=n.y+n.height;if(a<i)continue;const d=n.x+(t?n.width:0);if(a>i){l=d,i=a;continue}t?d>l&&(l=d):d<l&&(l=d)}return[t?1-l:l,i]},uJ=function(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const t=document.createElement("span");e.append(t),t.className="visuallyHidden",t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const i=o(this,OQ)._signal;e.addEventListener("contextmenu",il,{signal:i}),e.addEventListener("click",()=>{o(this,OQ).highlightSelection("floating_button")},{signal:i}),o(this,_I).append(e)};function HW(s,e,t){for(const i of t)e.addEventListener(i,s[i].bind(s))}class Uk{constructor(){R(this,qI,0);typeof PDFJSDev<"u"&&PDFJSDev.test("TESTING")&&Object.defineProperty(this,"reset",{value:()=>u(this,qI,0)})}get id(){return`${SN}${ri(this,qI)._++}`}}qI=new WeakMap;const fS=class fS{constructor(){R(this,zr);R(this,fr,JN());R(this,$I,0);R(this,Oi,null)}static get _isSVGFittingCanvas(){const e='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>',i=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),l=new Image;l.src=e;const n=l.decode().then(()=>(i.drawImage(l,0,0,1,1,0,0,1,3),new Uint32Array(i.getImageData(0,0,1,1).data.buffer)[0]===0));return P(this,"_isSVGFittingCanvas",n)}async getFromFile(e){const{lastModified:t,name:i,size:l,type:n}=e;return g(this,zr,MC).call(this,`${t}_${i}_${l}_${n}`,e)}async getFromUrl(e){return g(this,zr,MC).call(this,e,e)}async getFromBlob(e,t){const i=await t;return g(this,zr,MC).call(this,e,i)}async getFromId(e){o(this,Oi)||u(this,Oi,new Map);const t=o(this,Oi).get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){const{blobPromise:i}=t;return delete t.blobPromise,this.getFromBlob(t.id,i)}return this.getFromUrl(t.url)}getFromCanvas(e,t){o(this,Oi)||u(this,Oi,new Map);let i=o(this,Oi).get(e);if(i!=null&&i.bitmap)return i.refCounter+=1,i;const l=new OffscreenCanvas(t.width,t.height);return l.getContext("2d").drawImage(t,0,0),i={bitmap:l.transferToImageBitmap(),id:`image_${o(this,fr)}_${ri(this,$I)._++}`,refCounter:1,isSvg:!1},o(this,Oi).set(e,i),o(this,Oi).set(i.id,i),i}getSvgUrl(e){const t=o(this,Oi).get(e);return t!=null&&t.isSvg?t.svgUrl:null}deleteId(e){var l;o(this,Oi)||u(this,Oi,new Map);const t=o(this,Oi).get(e);if(!t||(t.refCounter-=1,t.refCounter!==0))return;const{bitmap:i}=t;if(!t.url&&!t.file){const n=new OffscreenCanvas(i.width,i.height);n.getContext("bitmaprenderer").transferFromImageBitmap(i),t.blobPromise=n.convertToBlob()}(l=i.close)==null||l.call(i),t.bitmap=null}isValidId(e){return e.startsWith(`image_${o(this,fr)}_`)}};fr=new WeakMap,$I=new WeakMap,Oi=new WeakMap,zr=new WeakSet,MC=async function(e,t){o(this,Oi)||u(this,Oi,new Map);let i=o(this,Oi).get(e);if(i===null)return null;if(i!=null&&i.bitmap)return i.refCounter+=1,i;try{i||(i={bitmap:null,id:`image_${o(this,fr)}_${ri(this,$I)._++}`,refCounter:0,isSvg:!1});let l;if(typeof t=="string"?(i.url=t,l=await rc(t,"blob")):t instanceof File?l=i.file=t:t instanceof Blob&&(l=t),l.type==="image/svg+xml"){const n=fS._isSVGFittingCanvas,a=new FileReader,d=new Image,c=new Promise((A,Q)=>{d.onload=()=>{i.bitmap=d,i.isSvg=!0,A()},a.onload=async()=>{const h=i.svgUrl=a.result;d.src=await n?`${h}#svgView(preserveAspectRatio(none))`:h},d.onerror=a.onerror=Q});a.readAsDataURL(l),await c}else i.bitmap=await createImageBitmap(l);i.refCounter=1}catch(l){y(l),i=null}return o(this,Oi).set(e,i),i&&o(this,Oi).set(i.id,i),i};let YN=fS;class Bk{constructor(e=128){R(this,fs,[]);R(this,Jc,!1);R(this,eE);R(this,ps,-1);u(this,eE,e)}add({cmd:e,undo:t,post:i,mustExec:l,type:n=NaN,overwriteIfSameType:a=!1,keepUndo:d=!1}){if(l&&e(),o(this,Jc))return;const c={cmd:e,undo:t,post:i,type:n};if(o(this,ps)===-1){o(this,fs).length>0&&(o(this,fs).length=0),u(this,ps,0),o(this,fs).push(c);return}if(a&&o(this,fs)[o(this,ps)].type===n){d&&(c.undo=o(this,fs)[o(this,ps)].undo),o(this,fs)[o(this,ps)]=c;return}const A=o(this,ps)+1;A===o(this,eE)?o(this,fs).splice(0,1):(u(this,ps,A),A<o(this,fs).length&&o(this,fs).splice(A)),o(this,fs).push(c)}undo(){if(o(this,ps)===-1)return;u(this,Jc,!0);const{undo:e,post:t}=o(this,fs)[o(this,ps)];e(),t==null||t(),u(this,Jc,!1),u(this,ps,o(this,ps)-1)}redo(){if(o(this,ps)<o(this,fs).length-1){u(this,ps,o(this,ps)+1),u(this,Jc,!0);const{cmd:e,post:t}=o(this,fs)[o(this,ps)];e(),t==null||t(),u(this,Jc,!1)}}hasSomethingToUndo(){return o(this,ps)!==-1}hasSomethingToRedo(){return o(this,ps)<o(this,fs).length-1}cleanType(e){if(o(this,ps)!==-1){for(let t=o(this,ps);t>=0;t--)if(o(this,fs)[t].type!==e){o(this,fs).splice(t+1,o(this,ps)-t),u(this,ps,t);return}o(this,fs).length=0,u(this,ps,-1)}}destroy(){u(this,fs,null)}}fs=new WeakMap,Jc=new WeakMap,eE=new WeakMap,ps=new WeakMap;class mB{constructor(e){R(this,wR);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=Xt.platform;for(const[i,l,n={}]of e)for(const a of i){const d=a.startsWith("mac+");t&&d?(this.callbacks.set(a.slice(4),{callback:l,options:n}),this.allKeys.add(a.split("+").at(-1))):!t&&!d&&(this.callbacks.set(a,{callback:l,options:n}),this.allKeys.add(a.split("+").at(-1)))}}exec(e,t){if(!this.allKeys.has(t.key))return;const i=this.callbacks.get(g(this,wR,ZJ).call(this,t));if(!i)return;const{callback:l,options:{bubbles:n=!1,args:a=[],checker:d=null}}=i;d&&!d(e,t)||(l.bind(e,...a,t)(),n||Ot(t))}}wR=new WeakSet,ZJ=function(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const t=this.buffer.join("+");return this.buffer.length=0,t};const tE=class tE{get _colors(){if(typeof PDFJSDev<"u"&&PDFJSDev.test("LIB")&&typeof document>"u")return P(this,"_colors",tE._colorsMapping);const e=new Map([["CanvasText",null],["Canvas",null]]);return rk(e),P(this,"_colors",e)}convert(e){const t=TN(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[i,l]of this._colors)if(l.every((n,a)=>n===t[a]))return tE._colorsMapping.get(i);return t}getHexCode(e){const t=this._colors.get(e);return t?Ze.makeHexColor(...t):e}};se(tE,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let DN=tE;const _r=class _r{constructor(e,t,i,l,n,a,d,c,A,Q,h,r,F,U){R(this,xe);R(this,jr,new AbortController);R(this,Kl,null);R(this,ai,new Map);R(this,yi,new Map);R(this,Hr,null);R(this,ad,null);R(this,Kr,null);R(this,Jn,new Bk);R(this,Lc,null);R(this,Tc,null);R(this,Or,0);R(this,vQ,new Set);R(this,t0,null);R(this,ha,null);R(this,PQ,new Set);se(this,"_editorUndoBar",null);R(this,sE,!1);R(this,iE,!1);R(this,vr,!1);R(this,lE,null);R(this,s0,null);R(this,kc,null);R(this,Pr,null);R(this,Yc,!1);R(this,i0,null);R(this,nE,new Uk);R(this,Dc,!1);R(this,aE,!1);R(this,wc,null);R(this,_Q,null);R(this,qQ,null);R(this,Xc,null);R(this,dE,null);R(this,gi,Re.NONE);R(this,_t,new Set);R(this,dd,null);R(this,fc,null);R(this,$Q,null);R(this,cE,null);R(this,AE,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});R(this,zc,[0,0]);R(this,l0,null);R(this,cd,null);R(this,QE,null);R(this,Ln,null);const B=this._signal=o(this,jr).signal;u(this,cd,e),u(this,QE,t),u(this,Hr,i),u(this,fc,l),this._eventBus=n,n._on("editingaction",this.onEditingAction.bind(this),{signal:B}),n._on("pagechanging",this.onPageChanging.bind(this),{signal:B}),n._on("scalechanging",this.onScaleChanging.bind(this),{signal:B}),n._on("rotationchanging",this.onRotationChanging.bind(this),{signal:B}),n._on("setpreference",this.onSetPreference.bind(this),{signal:B}),n._on("switchannotationeditorparams",E=>this.updateParams(E.type,E.value),{signal:B}),g(this,xe,CJ).call(this),g(this,xe,SJ).call(this),g(this,xe,n2).call(this),u(this,ad,a.annotationStorage),u(this,lE,a.filterFactory),u(this,$Q,d),u(this,Pr,c||null),u(this,sE,A),u(this,iE,Q),u(this,vr,h),u(this,dE,r||null),this.viewParameters={realScale:ii.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=F||null,this._supportsPinchToZoom=U!==!1,typeof PDFJSDev<"u"&&PDFJSDev.test("TESTING")&&Object.defineProperty(this,"reset",{value:()=>{this.selectAll(),this.delete(),o(this,nE).reset()}})}static get _keyboardManager(){const e=_r.prototype,t=a=>o(a,cd).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),i=(a,{target:d})=>{if(d instanceof HTMLInputElement){const{type:c}=d;return c!=="text"&&c!=="number"}return!0},l=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return P(this,"_keyboardManager",new mB([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],e.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:i}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(a,{target:d})=>!(d instanceof HTMLButtonElement)&&o(a,cd).contains(d)&&!a.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(a,{target:d})=>!(d instanceof HTMLButtonElement)&&o(a,cd).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-l,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-n,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[l,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[n,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-l],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-n],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,l],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,n],checker:t}]]))}destroy(){var e,t,i,l,n,a,d,c;(e=o(this,Ln))==null||e.resolve(),u(this,Ln,null),(t=o(this,jr))==null||t.abort(),u(this,jr,null),this._signal=null;for(const A of o(this,yi).values())A.destroy();o(this,yi).clear(),o(this,ai).clear(),o(this,PQ).clear(),(i=o(this,Xc))==null||i.clear(),u(this,Kl,null),o(this,_t).clear(),o(this,Jn).destroy(),(l=o(this,Hr))==null||l.destroy(),(n=o(this,fc))==null||n.destroy(),(a=o(this,i0))==null||a.hide(),u(this,i0,null),(d=o(this,qQ))==null||d.destroy(),u(this,qQ,null),o(this,s0)&&(clearTimeout(o(this,s0)),u(this,s0,null)),o(this,l0)&&(clearTimeout(o(this,l0)),u(this,l0,null)),(c=this._editorUndoBar)==null||c.destroy()}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return o(this,dE)}get useNewAltTextFlow(){return o(this,iE)}get useNewAltTextWhenAddingImage(){return o(this,vr)}get hcmFilter(){return P(this,"hcmFilter",o(this,$Q)?o(this,lE).addHCMFilter(o(this,$Q).foreground,o(this,$Q).background):"none")}get direction(){return P(this,"direction",getComputedStyle(o(this,cd)).direction)}get highlightColors(){return P(this,"highlightColors",o(this,Pr)?new Map(o(this,Pr).split(",").map(e=>e.split("=").map(t=>t.trim()))):null)}get highlightColorNames(){return P(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),u(this,Tc,e)}setMainHighlightColorPicker(e){u(this,qQ,e)}editAltText(e,t=!1){var i;(i=o(this,Hr))==null||i.editAltText(this,e,t)}getSignature(e){var t;(t=o(this,fc))==null||t.getSignature({uiManager:this,editor:e})}get signatureManager(){return o(this,fc)}switchToMode(e,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch("setpreference",{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){switch(e){case"enableNewAltTextWhenAddingImage":u(this,vr,t);break}}onPageChanging({pageNumber:e}){u(this,Or,e-1)}focusMainContainer(){o(this,cd).focus()}findParent(e,t){for(const i of o(this,yi).values()){const{x:l,y:n,width:a,height:d}=i.div.getBoundingClientRect();if(e>=l&&e<=l+a&&t>=n&&t<=n+d)return i}return null}disableUserSelect(e=!1){o(this,QE).classList.toggle("noUserSelect",e)}addShouldRescale(e){o(this,PQ).add(e)}removeShouldRescale(e){o(this,PQ).delete(e)}onScaleChanging({scale:e}){var t;this.commitOrRemove(),this.viewParameters.realScale=e*ii.PDF_TO_CSS_UNITS;for(const i of o(this,PQ))i.onScaleChanging();(t=o(this,Tc))==null||t.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e=""){const t=document.getSelection();if(!t||t.isCollapsed)return;const{anchorNode:i,anchorOffset:l,focusNode:n,focusOffset:a}=t,d=t.toString(),A=g(this,xe,GC).call(this,t).closest(".textLayer"),Q=this.getSelectionBoxes(A);if(!Q)return;t.empty();const h=g(this,xe,l2).call(this,A),r=o(this,gi)===Re.NONE,F=()=>{h==null||h.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:Q,anchorNode:i,anchorOffset:l,focusNode:n,focusOffset:a,text:d}),r&&this.showAllEditors("highlight",!0,!0)};if(r){this.switchToMode(Re.HIGHLIGHT,F);return}F()}addToAnnotationStorage(e){!e.isEmpty()&&o(this,ad)&&!o(this,ad).has(e.id)&&o(this,ad).setValue(e.id,e)}blur(){if(this.isShiftKeyDown=!1,o(this,Yc)&&(u(this,Yc,!1),g(this,xe,xC).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const t of o(this,_t))if(t.div.contains(e)){u(this,_Q,[t,e]),t._focusEventsAllowed=!1;break}}focus(){if(!o(this,_Q))return;const[e,t]=o(this,_Q);u(this,_Q,null),t.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}addEditListeners(){g(this,xe,n2).call(this),g(this,xe,a2).call(this)}removeEditListeners(){g(this,xe,VJ).call(this),g(this,xe,d2).call(this)}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const i of o(this,ha))if(i.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const t of e.dataTransfer.items)for(const i of o(this,ha))if(i.isHandlingMimeForPasting(t.type)){i.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){var i;if(e.preventDefault(),(i=o(this,Kl))==null||i.commitOrRemove(),!this.hasSelection)return;const t=[];for(const l of o(this,_t)){const n=l.serialize(!0);n&&t.push(n)}t.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:t}=e;for(const n of t.items)for(const a of o(this,ha))if(a.isHandlingMimeForPasting(n.type)){a.paste(n,this.currentLayer);return}let i=t.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(n){y(`paste: "${n.message}".`);return}if(!Array.isArray(i))return;this.unselectAll();const l=this.currentLayer;try{const n=[];for(const c of i){const A=await l.deserialize(c);if(!A)return;n.push(A)}const a=()=>{for(const c of n)g(this,xe,c2).call(this,c);g(this,xe,A2).call(this,n)},d=()=>{for(const c of n)c.remove()};this.addCommands({cmd:a,undo:d,mustExec:!0})}catch(n){y(`paste: "${n.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),o(this,gi)!==Re.NONE&&!this.isEditorHandlingKeyboard&&_r._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,o(this,Yc)&&(u(this,Yc,!1),g(this,xe,xC).call(this,"main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(e){e?(g(this,xe,NJ).call(this),g(this,xe,a2).call(this),g(this,xe,ul).call(this,{isEditing:o(this,gi)!==Re.NONE,isEmpty:g(this,xe,hZ).call(this),hasSomethingToUndo:o(this,Jn).hasSomethingToUndo(),hasSomethingToRedo:o(this,Jn).hasSomethingToRedo(),hasSelectedEditor:!1})):(g(this,xe,mJ).call(this),g(this,xe,d2).call(this),g(this,xe,ul).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!o(this,ha)){u(this,ha,e);for(const t of o(this,ha))g(this,xe,cc).call(this,t.defaultPropertiesToUpdate)}}getId(){return o(this,nE).id}get currentLayer(){return o(this,yi).get(o(this,Or))}getLayer(e){return o(this,yi).get(e)}get currentPageIndex(){return o(this,Or)}addLayer(e){o(this,yi).set(e.pageIndex,e),o(this,Dc)?e.enable():e.disable()}removeLayer(e){o(this,yi).delete(e.pageIndex)}async updateMode(e,t=null,i=!1){var l,n,a;if(o(this,gi)!==e&&!(o(this,Ln)&&(await o(this,Ln).promise,!o(this,Ln)))){if(u(this,Ln,Promise.withResolvers()),(l=o(this,Tc))==null||l.commitOrRemove(),u(this,gi,e),e===Re.NONE){this.setEditingState(!1),g(this,xe,pJ).call(this),(n=this._editorUndoBar)==null||n.hide(),o(this,Ln).resolve();return}e===Re.SIGNATURE&&await((a=o(this,fc))==null?void 0:a.loadSignatures()),this.setEditingState(!0),await g(this,xe,WJ).call(this),this.unselectAll();for(const d of o(this,yi).values())d.updateMode(e);if(!t){i&&this.addNewEditorFromKeyboard(),o(this,Ln).resolve();return}for(const d of o(this,ai).values())d.annotationElementId===t||d.id===t?(this.setSelected(d),d.enterInEditMode()):d.unselect();o(this,Ln).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==o(this,gi)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,t){var i;if(o(this,ha)){switch(e){case ot.CREATE:this.currentLayer.addNewEditor(t);return;case ot.HIGHLIGHT_DEFAULT_COLOR:(i=o(this,qQ))==null||i.updateColor(t);break;case ot.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(o(this,cE)||u(this,cE,new Map)).set(e,t),this.showAllEditors("highlight",t);break}for(const l of o(this,_t))l.updateParams(e,t);for(const l of o(this,ha))l.updateDefaultParams(e,t)}}showAllEditors(e,t,i=!1){var n;for(const a of o(this,ai).values())a.editorType===e&&a.show(t);(((n=o(this,cE))==null?void 0:n.get(ot.HIGHLIGHT_SHOW_ALL))??!0)!==t&&g(this,xe,cc).call(this,[[ot.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(o(this,aE)!==e){u(this,aE,e);for(const t of o(this,yi).values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}getEditors(e){const t=[];for(const i of o(this,ai).values())i.pageIndex===e&&t.push(i);return t}getEditor(e){return o(this,ai).get(e)}addEditor(e){o(this,ai).set(e.id,e)}removeEditor(e){var t,i;e.div.contains(document.activeElement)&&(o(this,s0)&&clearTimeout(o(this,s0)),u(this,s0,setTimeout(()=>{this.focusMainContainer(),u(this,s0,null)},0))),o(this,ai).delete(e.id),e.annotationElementId&&((t=o(this,Xc))==null||t.delete(e.annotationElementId)),this.unselect(e),(!e.annotationElementId||!o(this,vQ).has(e.annotationElementId))&&((i=o(this,ad))==null||i.remove(e.id))}addDeletedAnnotationElement(e){o(this,vQ).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return o(this,vQ).has(e)}removeDeletedAnnotationElement(e){o(this,vQ).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){o(this,Kl)!==e&&(u(this,Kl,e),e&&g(this,xe,cc).call(this,e.propertiesToUpdate))}updateUI(e){o(this,xe,MJ)===e&&g(this,xe,cc).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){g(this,xe,cc).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(o(this,_t).has(e)){o(this,_t).delete(e),e.unselect(),g(this,xe,ul).call(this,{hasSelectedEditor:this.hasSelection});return}o(this,_t).add(e),e.select(),g(this,xe,cc).call(this,e.propertiesToUpdate),g(this,xe,ul).call(this,{hasSelectedEditor:!0})}setSelected(e){var t;(t=o(this,Tc))==null||t.commitOrRemove();for(const i of o(this,_t))i!==e&&i.unselect();o(this,_t).clear(),o(this,_t).add(e),e.select(),g(this,xe,cc).call(this,e.propertiesToUpdate),g(this,xe,ul).call(this,{hasSelectedEditor:!0})}isSelected(e){return o(this,_t).has(e)}get firstSelectedEditor(){return o(this,_t).values().next().value}unselect(e){e.unselect(),o(this,_t).delete(e),g(this,xe,ul).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return o(this,_t).size!==0}get isEnterHandled(){return o(this,_t).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;o(this,Jn).undo(),g(this,xe,ul).call(this,{hasSomethingToUndo:o(this,Jn).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:g(this,xe,hZ).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){o(this,Jn).redo(),g(this,xe,ul).call(this,{hasSomethingToUndo:!0,hasSometh