@pksep/yui 0.1.220 → 0.1.221

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1359,7 +1359,7 @@ function print() { __p += __j.call(arguments, '') }
1359
1359
  `),position:p,pageIndex:y-1,rect:a.slice(0),rotation:d,annotationElementId:m,id:m,deleted:!1,popupRef:u,comment:(Z==null?void 0:Z.str)||null,richText:h,creationDate:w,modificationDate:G}}const A=await super.deserialize(I,e,t);return V(A,Wi,I.fontSize),A.color=Mg.makeHexColor(...I.color),V(A,wi,X(n=tC,_l,h5).call(n,I.value)),A._initialData=i,I.comment&&A.setCommentData(I),A}serialize(I=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const e=qI._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),t=Object.assign(super.serialize(I),{color:e,fontSize:c(this,Wi),value:X(this,EC,QT).call(this)});return this.addComment(t),I?(t.isCopy=!0,t):this.annotationElementId&&!X(this,EC,UT).call(this,t)?null:(t.id=this.annotationElementId,t)}renderAnnotationElement(I){const e=super.renderAnnotationElement(I);if(!e)return null;const{style:t}=e;t.fontSize=`calc(${c(this,Wi)}px * var(--total-scale-factor))`,t.color=this.color,e.replaceChildren();for(const i of c(this,wi).split(`
1360
1360
  `)){const A=document.createElement("div");A.append(i?document.createTextNode(i):document.createElement("br")),e.append(A)}return I.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:c(this,wi)}}),e}resetAnnotationElement(I){super.resetAnnotationElement(I),I.resetEdited()}};wi=new WeakMap,uZ=new WeakMap,nc=new WeakMap,Wi=new WeakMap,EC=new WeakSet,jT=function(I){const e=i=>{this.editorDiv.style.fontSize=`calc(${i}px * var(--total-scale-factor))`,this.translate(0,-(i-c(this,Wi))*this.parentScale),V(this,Wi,i),X(this,EC,w2).call(this)},t=c(this,Wi);this.addCommands({cmd:e.bind(this,I),undo:e.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:mI.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},xT=function(I){const e=i=>{this.color=i,this.onUpdatedColor()},t=this.color;this.addCommands({cmd:e.bind(this,I),undo:e.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:mI.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},OT=function(){var t;const I=[];this.editorDiv.normalize();let e=null;for(const i of this.editorDiv.childNodes)(e==null?void 0:e.nodeType)===Node.TEXT_NODE&&i.nodeName==="BR"||(I.push(X(t=tC,_l,W2).call(t,i)),e=i);return I.join(`
1361
1361
  `)},w2=function(){const[I,e]=this.parentDimensions;let t;if(this.isAttachedToDOM)t=this.div.getBoundingClientRect();else{const{currentLayer:i,div:A}=this,n=A.style.display,l=A.classList.contains("hidden");A.classList.remove("hidden"),A.style.display="hidden",i.div.append(this.div),t=A.getBoundingClientRect(),A.remove(),A.style.display=n,A.classList.toggle("hidden",l)}this.rotation%180===this.parentRotation%180?(this.width=t.width/I,this.height=t.height/e):(this.width=t.height/I,this.height=t.width/e),this.fixAndSetPosition()},_l=new WeakSet,W2=function(I){return(I.nodeType===Node.TEXT_NODE?I.nodeValue:I.innerText).replaceAll(qw,"")},B2=function(){if(this.editorDiv.replaceChildren(),!!c(this,wi))for(const I of c(this,wi).split(`
1362
- `)){const e=document.createElement("div");e.append(I?document.createTextNode(I):document.createElement("br")),this.editorDiv.append(e)}},QT=function(){return c(this,wi).replaceAll(" "," ")},h5=function(I){return I.replaceAll(" "," ")},UT=function(I){const{value:e,fontSize:t,color:i,pageIndex:A}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||I.value!==e||I.fontSize!==t||I.color.some((n,l)=>n!==i[l])||I.pageIndex!==A},f(tC,_l),cg(tC,"_freeTextDefaultContent",""),cg(tC,"_internalPadding",0),cg(tC,"_defaultColor",null),cg(tC,"_defaultFontSize",10),cg(tC,"_type","freetext"),cg(tC,"_editorType",Ug.FREETEXT);let yV=tC;class Vg{toSVGPath(){jI("Abstract method `toSVGPath` must be implemented.")}get box(){jI("Abstract getter `box` must be implemented.")}serialize(g,I){jI("Abstract method `serialize` must be implemented.")}static _rescale(g,I,e,t,i,A){A||(A=new Float32Array(g.length));for(let n=0,l=g.length;n<l;n+=2)A[n]=I+g[n]*t,A[n+1]=e+g[n+1]*i;return A}static _rescaleAndSwap(g,I,e,t,i,A){A||(A=new Float32Array(g.length));for(let n=0,l=g.length;n<l;n+=2)A[n]=I+g[n+1]*t,A[n+1]=e+g[n]*i;return A}static _translate(g,I,e,t){t||(t=new Float32Array(g.length));for(let i=0,A=g.length;i<A;i+=2)t[i]=I+g[i],t[i+1]=e+g[i+1];return t}static svgRound(g){return Math.round(g*1e4)}static _normalizePoint(g,I,e,t,i){switch(i){case 90:return[1-I/e,g/t];case 180:return[1-g/e,1-I/t];case 270:return[I/e,1-g/t];default:return[g/e,I/t]}}static _normalizePagePoint(g,I,e){switch(e){case 90:return[1-I,g];case 180:return[1-g,1-I];case 270:return[I,1-g];default:return[g,I]}}static createBezierPoints(g,I,e,t,i,A){return[(g+5*e)/6,(I+5*t)/6,(5*e+i)/6,(5*t+A)/6,(e+i)/2,(t+A)/2]}}cg(Vg,"PRECISION",1e-4);const $l=class $l{constructor({x:g,y:I},e,t,i,A,n=0){f(this,ee);f(this,Bi);f(this,xA,[]);f(this,Iu);f(this,Cu);f(this,jn,[]);f(this,lI,new Float32Array(18));f(this,lc);f(this,sc);f(this,hZ);f(this,bZ);f(this,eu);f(this,tu);f(this,vo,[]);V(this,Bi,e),V(this,tu,i*t),V(this,Cu,A),c(this,lI).set([NaN,NaN,NaN,NaN,g,I],6),V(this,Iu,n),V(this,bZ,c($l,ZZ)*t),V(this,hZ,c($l,ap)*t),V(this,eu,t),c(this,vo).push(g,I)}isEmpty(){return isNaN(c(this,lI)[8])}add({x:g,y:I}){var J;V(this,lc,g),V(this,sc,I);const[e,t,i,A]=c(this,Bi);let[n,l,o,a]=c(this,lI).subarray(8,12);const d=g-o,m=I-a,u=Math.hypot(d,m);if(u<c(this,hZ))return!1;const h=u-c(this,bZ),Z=h/u,w=Z*d,G=Z*m;let B=n,p=l;n=o,l=a,o+=w,a+=G,(J=c(this,vo))==null||J.push(g,I);const y=-G/h,Y=w/h,R=y*c(this,tu),M=Y*c(this,tu);return c(this,lI).set(c(this,lI).subarray(2,8),0),c(this,lI).set([o+R,a+M],4),c(this,lI).set(c(this,lI).subarray(14,18),12),c(this,lI).set([o-R,a-M],16),isNaN(c(this,lI)[6])?(c(this,jn).length===0&&(c(this,lI).set([n+R,l+M],2),c(this,jn).push(NaN,NaN,NaN,NaN,(n+R-e)/i,(l+M-t)/A),c(this,lI).set([n-R,l-M],14),c(this,xA).push(NaN,NaN,NaN,NaN,(n-R-e)/i,(l-M-t)/A)),c(this,lI).set([B,p,n,l,o,a],6),!this.isEmpty()):(c(this,lI).set([B,p,n,l,o,a],6),Math.abs(Math.atan2(p-l,B-n)-Math.atan2(G,w))<Math.PI/2?([n,l,o,a]=c(this,lI).subarray(2,6),c(this,jn).push(NaN,NaN,NaN,NaN,((n+o)/2-e)/i,((l+a)/2-t)/A),[n,l,B,p]=c(this,lI).subarray(14,18),c(this,xA).push(NaN,NaN,NaN,NaN,((B+n)/2-e)/i,((p+l)/2-t)/A),!0):([B,p,n,l,o,a]=c(this,lI).subarray(0,6),c(this,jn).push(((B+5*n)/6-e)/i,((p+5*l)/6-t)/A,((5*n+o)/6-e)/i,((5*l+a)/6-t)/A,((n+o)/2-e)/i,((l+a)/2-t)/A),[o,a,n,l,B,p]=c(this,lI).subarray(12,18),c(this,xA).push(((B+5*n)/6-e)/i,((p+5*l)/6-t)/A,((5*n+o)/6-e)/i,((5*l+a)/6-t)/A,((n+o)/2-e)/i,((l+a)/2-t)/A),!0))}toSVGPath(){if(this.isEmpty())return"";const g=c(this,jn),I=c(this,xA);if(isNaN(c(this,lI)[6])&&!this.isEmpty())return X(this,ee,ET).call(this);const e=[];e.push(`M${g[4]} ${g[5]}`);for(let t=6;t<g.length;t+=6)isNaN(g[t])?e.push(`L${g[t+4]} ${g[t+5]}`):e.push(`C${g[t]} ${g[t+1]} ${g[t+2]} ${g[t+3]} ${g[t+4]} ${g[t+5]}`);X(this,ee,_T).call(this,e);for(let t=I.length-6;t>=6;t-=6)isNaN(I[t])?e.push(`L${I[t+4]} ${I[t+5]}`):e.push(`C${I[t]} ${I[t+1]} ${I[t+2]} ${I[t+3]} ${I[t+4]} ${I[t+5]}`);return X(this,ee,PT).call(this,e),e.join(" ")}newFreeDrawOutline(g,I,e,t,i,A){return new VS(g,I,e,t,i,A)}getOutlines(){var d;const g=c(this,jn),I=c(this,xA),e=c(this,lI),[t,i,A,n]=c(this,Bi),l=new Float32Array((((d=c(this,vo))==null?void 0:d.length)??0)+2);for(let m=0,u=l.length-2;m<u;m+=2)l[m]=(c(this,vo)[m]-t)/A,l[m+1]=(c(this,vo)[m+1]-i)/n;if(l[l.length-2]=(c(this,lc)-t)/A,l[l.length-1]=(c(this,sc)-i)/n,isNaN(e[6])&&!this.isEmpty())return X(this,ee,$T).call(this,l);const o=new Float32Array(c(this,jn).length+24+c(this,xA).length);let a=g.length;for(let m=0;m<a;m+=2){if(isNaN(g[m])){o[m]=o[m+1]=NaN;continue}o[m]=g[m],o[m+1]=g[m+1]}a=X(this,ee,gv).call(this,o,a);for(let m=I.length-6;m>=6;m-=6)for(let u=0;u<6;u+=2){if(isNaN(I[m+u])){o[a]=o[a+1]=NaN,a+=2;continue}o[a]=I[m+u],o[a+1]=I[m+u+1],a+=2}return X(this,ee,qT).call(this,o,a),this.newFreeDrawOutline(o,l,c(this,Bi),c(this,eu),c(this,Iu),c(this,Cu))}};Bi=new WeakMap,xA=new WeakMap,Iu=new WeakMap,Cu=new WeakMap,jn=new WeakMap,lI=new WeakMap,lc=new WeakMap,sc=new WeakMap,hZ=new WeakMap,bZ=new WeakMap,eu=new WeakMap,tu=new WeakMap,vo=new WeakMap,ZZ=new WeakMap,op=new WeakMap,ap=new WeakMap,ee=new WeakSet,rG=function(){const g=c(this,lI).subarray(4,6),I=c(this,lI).subarray(16,18),[e,t,i,A]=c(this,Bi);return[(c(this,lc)+(g[0]-I[0])/2-e)/i,(c(this,sc)+(g[1]-I[1])/2-t)/A,(c(this,lc)+(I[0]-g[0])/2-e)/i,(c(this,sc)+(I[1]-g[1])/2-t)/A]},ET=function(){const[g,I,e,t]=c(this,Bi),[i,A,n,l]=X(this,ee,rG).call(this);return`M${(c(this,lI)[2]-g)/e} ${(c(this,lI)[3]-I)/t} L${(c(this,lI)[4]-g)/e} ${(c(this,lI)[5]-I)/t} L${i} ${A} L${n} ${l} L${(c(this,lI)[16]-g)/e} ${(c(this,lI)[17]-I)/t} L${(c(this,lI)[14]-g)/e} ${(c(this,lI)[15]-I)/t} Z`},PT=function(g){const I=c(this,xA);g.push(`L${I[4]} ${I[5]} Z`)},_T=function(g){const[I,e,t,i]=c(this,Bi),A=c(this,lI).subarray(4,6),n=c(this,lI).subarray(16,18),[l,o,a,d]=X(this,ee,rG).call(this);g.push(`L${(A[0]-I)/t} ${(A[1]-e)/i} L${l} ${o} L${a} ${d} L${(n[0]-I)/t} ${(n[1]-e)/i}`)},$T=function(g){const I=c(this,lI),[e,t,i,A]=c(this,Bi),[n,l,o,a]=X(this,ee,rG).call(this),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(I[2]-e)/i,(I[3]-t)/A,NaN,NaN,NaN,NaN,(I[4]-e)/i,(I[5]-t)/A,NaN,NaN,NaN,NaN,n,l,NaN,NaN,NaN,NaN,o,a,NaN,NaN,NaN,NaN,(I[16]-e)/i,(I[17]-t)/A,NaN,NaN,NaN,NaN,(I[14]-e)/i,(I[15]-t)/A],0),this.newFreeDrawOutline(d,g,c(this,Bi),c(this,eu),c(this,Iu),c(this,Cu))},qT=function(g,I){const e=c(this,xA);return g.set([NaN,NaN,NaN,NaN,e[4],e[5]],I),I+=6},gv=function(g,I){const e=c(this,lI).subarray(4,6),t=c(this,lI).subarray(16,18),[i,A,n,l]=c(this,Bi),[o,a,d,m]=X(this,ee,rG).call(this);return g.set([NaN,NaN,NaN,NaN,(e[0]-i)/n,(e[1]-A)/l,NaN,NaN,NaN,NaN,o,a,NaN,NaN,NaN,NaN,d,m,NaN,NaN,NaN,NaN,(t[0]-i)/n,(t[1]-A)/l],I),I+=24},f($l,ZZ,8),f($l,op,2),f($l,ap,c($l,ZZ)+c($l,op));let gW=$l;class VS extends Vg{constructor(I,e,t,i,A,n){super();f(this,dp);f(this,iu);f(this,oc,new Float32Array(4));f(this,ql);f(this,GZ);f(this,pi);f(this,wZ);f(this,KC);V(this,KC,I),V(this,pi,e),V(this,iu,t),V(this,wZ,i),V(this,ql,A),V(this,GZ,n),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],X(this,dp,Iv).call(this,n);const[l,o,a,d]=c(this,oc);for(let m=0,u=I.length;m<u;m+=2)I[m]=(I[m]-l)/a,I[m+1]=(I[m+1]-o)/d;for(let m=0,u=e.length;m<u;m+=2)e[m]=(e[m]-l)/a,e[m+1]=(e[m+1]-o)/d}toSVGPath(){const I=[`M${c(this,KC)[4]} ${c(this,KC)[5]}`];for(let e=6,t=c(this,KC).length;e<t;e+=6){if(isNaN(c(this,KC)[e])){I.push(`L${c(this,KC)[e+4]} ${c(this,KC)[e+5]}`);continue}I.push(`C${c(this,KC)[e]} ${c(this,KC)[e+1]} ${c(this,KC)[e+2]} ${c(this,KC)[e+3]} ${c(this,KC)[e+4]} ${c(this,KC)[e+5]}`)}return I.push("Z"),I.join(" ")}serialize([I,e,t,i],A){const n=t-I,l=i-e;let o,a;switch(A){case 0:o=Vg._rescale(c(this,KC),I,i,n,-l),a=Vg._rescale(c(this,pi),I,i,n,-l);break;case 90:o=Vg._rescaleAndSwap(c(this,KC),I,e,n,l),a=Vg._rescaleAndSwap(c(this,pi),I,e,n,l);break;case 180:o=Vg._rescale(c(this,KC),t,e,-n,l),a=Vg._rescale(c(this,pi),t,e,-n,l);break;case 270:o=Vg._rescaleAndSwap(c(this,KC),t,i,-n,-l),a=Vg._rescaleAndSwap(c(this,pi),t,i,-n,-l);break}return{outline:Array.from(o),points:[Array.from(a)]}}get box(){return c(this,oc)}newOutliner(I,e,t,i,A,n=0){return new gW(I,e,t,i,A,n)}getNewOutline(I,e){const[t,i,A,n]=c(this,oc),[l,o,a,d]=c(this,iu),m=A*a,u=n*d,h=t*a+l,Z=i*d+o,w=this.newOutliner({x:c(this,pi)[0]*m+h,y:c(this,pi)[1]*u+Z},c(this,iu),c(this,wZ),I,c(this,GZ),e??c(this,ql));for(let G=2;G<c(this,pi).length;G+=2)w.add({x:c(this,pi)[G]*m+h,y:c(this,pi)[G+1]*u+Z});return w.getOutlines()}}iu=new WeakMap,oc=new WeakMap,ql=new WeakMap,GZ=new WeakMap,pi=new WeakMap,wZ=new WeakMap,KC=new WeakMap,dp=new WeakSet,Iv=function(I){const e=c(this,KC);let t=e[4],i=e[5];const A=[t,i,t,i];let n=t,l=i,o=t,a=i;const d=I?Math.max:Math.min,m=new Float32Array(4);for(let h=6,Z=e.length;h<Z;h+=6){const w=e[h+4],G=e[h+5];isNaN(e[h])?(Mg.pointBoundingBox(w,G,A),l>G?(n=w,l=G):l===G&&(n=d(n,w)),a<G?(o=w,a=G):a===G&&(o=d(o,w))):(m[0]=m[1]=1/0,m[2]=m[3]=-1/0,Mg.bezierBoundingBox(t,i,...e.slice(h,h+6),m),Mg.rectBoundingBox(m[0],m[1],m[2],m[3],A),l>m[1]?(n=m[0],l=m[1]):l===m[1]&&(n=d(n,m[0])),a<m[3]?(o=m[2],a=m[3]):a===m[3]&&(o=d(o,m[2]))),t=w,i=G}const u=c(this,oc);u[0]=A[0]-c(this,ql),u[1]=A[1]-c(this,ql),u[2]=A[2]-A[0]+2*c(this,ql),u[3]=A[3]-A[1]+2*c(this,ql),this.firstPoint=[n,l],this.lastPoint=[o,a]};class YV{constructor(g,I=0,e=0,t=!0){f(this,Wt);f(this,WZ);f(this,BZ);f(this,pZ);f(this,jo,[]);f(this,OA,[]);const i=[1/0,1/0,-1/0,-1/0],n=10**-4;for(const{x:w,y:G,width:B,height:p}of g){const y=Math.floor((w-I)/n)*n,Y=Math.ceil((w+B+I)/n)*n,R=Math.floor((G-I)/n)*n,M=Math.ceil((G+p+I)/n)*n,S=[y,R,M,!0],J=[Y,R,M,!1];c(this,jo).push(S,J),Mg.rectBoundingBox(y,R,Y,M,i)}const l=i[2]-i[0]+2*e,o=i[3]-i[1]+2*e,a=i[0]-e,d=i[1]-e;let m=t?-1/0:1/0,u=1/0;const h=c(this,jo).at(t?-1:-2),Z=[h[0],h[2]];for(const w of c(this,jo)){const[G,B,p,y]=w;!y&&t?B<u?(u=B,m=G):B===u&&(m=Math.max(m,G)):y&&!t&&(B<u?(u=B,m=G):B===u&&(m=Math.min(m,G))),w[0]=(G-a)/l,w[1]=(B-d)/o,w[2]=(p-d)/o}V(this,WZ,new Float32Array([a,d,l,o])),V(this,BZ,[m,u]),V(this,pZ,Z)}getOutlines(){c(this,jo).sort((I,e)=>I[0]-e[0]||I[1]-e[1]||I[2]-e[2]);const g=[];for(const I of c(this,jo))I[3]?(g.push(...X(this,Wt,b5).call(this,I)),X(this,Wt,ev).call(this,I)):(X(this,Wt,tv).call(this,I),g.push(...X(this,Wt,b5).call(this,I)));return X(this,Wt,Cv).call(this,g)}}WZ=new WeakMap,BZ=new WeakMap,pZ=new WeakMap,jo=new WeakMap,OA=new WeakMap,Wt=new WeakSet,Cv=function(g){const I=[],e=new Set;for(const A of g){const[n,l,o]=A;I.push([n,l,A],[n,o,A])}I.sort((A,n)=>A[1]-n[1]||A[0]-n[0]);for(let A=0,n=I.length;A<n;A+=2){const l=I[A][2],o=I[A+1][2];l.push(o),o.push(l),e.add(l),e.add(o)}const t=[];let i;for(;e.size>0;){const A=e.values().next().value;let[n,l,o,a,d]=A;e.delete(A);let m=n,u=l;for(i=[n,o],t.push(i);;){let h;if(e.has(a))h=a;else if(e.has(d))h=d;else break;e.delete(h),[n,l,o,a,d]=h,m!==n&&(i.push(m,u,n,u===l?l:o),m=n),u=u===l?o:l}i.push(m,u)}return new _jg(t,c(this,WZ),c(this,BZ),c(this,pZ))},p2=function(g){const I=c(this,OA);let e=0,t=I.length-1;for(;e<=t;){const i=e+t>>1,A=I[i][0];if(A===g)return i;A<g?e=i+1:t=i-1}return t+1},ev=function([,g,I]){const e=X(this,Wt,p2).call(this,g);c(this,OA).splice(e,0,[g,I])},tv=function([,g,I]){const e=X(this,Wt,p2).call(this,g);for(let t=e;t<c(this,OA).length;t++){const[i,A]=c(this,OA)[t];if(i!==g)break;if(i===g&&A===I){c(this,OA).splice(t,1);return}}for(let t=e-1;t>=0;t--){const[i,A]=c(this,OA)[t];if(i!==g)break;if(i===g&&A===I){c(this,OA).splice(t,1);return}}},b5=function(g){const[I,e,t]=g,i=[[I,e,t]],A=X(this,Wt,p2).call(this,t);for(let n=0;n<A;n++){const[l,o]=c(this,OA)[n];for(let a=0,d=i.length;a<d;a++){const[,m,u]=i[a];if(!(o<=m||u<=l)){if(m>=l){if(u>o)i[a][1]=o;else{if(d===1)return[];i.splice(a,1),a--,d--}continue}i[a][2]=l,u>o&&i.push([I,o,u])}}}return i};class _jg extends Vg{constructor(I,e,t,i){super();f(this,yZ);f(this,Au);V(this,Au,I),V(this,yZ,e),this.firstPoint=t,this.lastPoint=i}toSVGPath(){const I=[];for(const e of c(this,Au)){let[t,i]=e;I.push(`M${t} ${i}`);for(let A=2;A<e.length;A+=2){const n=e[A],l=e[A+1];n===t?(I.push(`V${l}`),i=l):l===i&&(I.push(`H${n}`),t=n)}I.push("Z")}return I.join(" ")}serialize([I,e,t,i],A){const n=[],l=t-I,o=i-e;for(const a of c(this,Au)){const d=new Array(a.length);for(let m=0;m<a.length;m+=2)d[m]=I+a[m]*l,d[m+1]=i-a[m+1]*o;n.push(d)}return n}get box(){return c(this,yZ)}get classNamesForOutlining(){return["highlightOutline"]}}yZ=new WeakMap,Au=new WeakMap;class VV extends gW{newFreeDrawOutline(g,I,e,t,i,A){return new $jg(g,I,e,t,i,A)}}class $jg extends VS{newOutliner(g,I,e,t,i,A=0){return new VV(g,I,e,t,i,A)}}const WI=class WI extends qI{constructor(I){super({...I,name:"highlightEditor"});f(this,gI);f(this,nu,null);f(this,YZ,0);f(this,gs);f(this,ac,null);f(this,VZ,null);f(this,Et,null);f(this,NZ,null);f(this,MZ,0);f(this,dc,null);f(this,yi,null);f(this,Yi,null);f(this,De,!1);f(this,lu,null);f(this,su,null);f(this,_e,null);f(this,ou,"");f(this,oA);f(this,RZ,"");this.color=I.color||WI._defaultColor,V(this,oA,I.thickness||WI._defaultThickness),this.opacity=I.opacity||WI._defaultOpacity,V(this,gs,I.boxes||null),V(this,RZ,I.methodOfCreation||""),V(this,ou,I.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",I.highlightId>-1?(V(this,De,!0),X(this,gI,y2).call(this,I),X(this,gI,Fc).call(this)):c(this,gs)&&(V(this,nu,I.anchorNode),V(this,YZ,I.anchorOffset),V(this,NZ,I.focusNode),V(this,MZ,I.focusOffset),X(this,gI,Z5).call(this),X(this,gI,Fc).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const I=WI.prototype;return Og(this,"_keyboardManager",new Fh([[["ArrowLeft","mac+ArrowLeft"],I._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],I._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],I._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],I._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:c(this,De)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:c(this,oA),methodOfCreation:c(this,RZ)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(I){return{numberOfColors:I.get("color").size}}static initialize(I,e){var t;qI.initialize(I,e),WI._defaultColor||(WI._defaultColor=((t=e.highlightColors)==null?void 0:t.values().next().value)||"#fff066")}static updateDefaultParams(I,e){switch(I){case mI.HIGHLIGHT_COLOR:WI._defaultColor=e;break;case mI.HIGHLIGHT_THICKNESS:WI._defaultThickness=e;break}}translateInPage(I,e){}get toolbarPosition(){return c(this,su)}get commentButtonPosition(){return c(this,lu)}updateParams(I,e){switch(I){case mI.HIGHLIGHT_COLOR:X(this,gI,iv).call(this,e);break;case mI.HIGHLIGHT_THICKNESS:X(this,gI,Av).call(this,e);break}}static get defaultPropertiesToUpdate(){return[[mI.HIGHLIGHT_COLOR,WI._defaultColor],[mI.HIGHLIGHT_THICKNESS,WI._defaultThickness]]}get propertiesToUpdate(){return[[mI.HIGHLIGHT_COLOR,this.color||WI._defaultColor],[mI.HIGHLIGHT_THICKNESS,c(this,oA)||WI._defaultThickness],[mI.HIGHLIGHT_FREE,c(this,De)]]}onUpdatedColor(){var I,e;(I=this.parent)==null||I.drawLayer.updateProperties(c(this,Yi),{root:{fill:this.color,"fill-opacity":this.opacity}}),(e=c(this,VZ))==null||e.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",V(this,VZ,new Pw({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(X(this,gI,V2).call(this))}getBaseTranslation(){return[0,0]}getRect(I,e){return super.getRect(I,e,X(this,gI,V2).call(this))}onceAdded(I){this.annotationElementId||this.parent.addUndoableEditor(this),I&&this.div.focus()}remove(){X(this,gI,G5).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(X(this,gI,Fc).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(I){var t;let e=!1;this.parent&&!I?X(this,gI,G5).call(this):I&&(X(this,gI,Fc).call(this,I),e=!this.parent&&((t=this.div)==null?void 0:t.classList.contains("selectedEditor"))),super.setParent(I),this.show(this._isVisible),e&&this.select()}rotate(I){var i,A,n;const{drawLayer:e}=this.parent;let t;c(this,De)?(I=(I-this.rotation+360)%360,t=X(i=WI,aA,Tu).call(i,c(this,yi).box,I)):t=X(A=WI,aA,Tu).call(A,[this.x,this.y,this.width,this.height],I),e.updateProperties(c(this,Yi),{bbox:t,root:{"data-main-rotation":I}}),e.updateProperties(c(this,_e),{bbox:X(n=WI,aA,Tu).call(n,c(this,Et).box,I),root:{"data-main-rotation":I}})}render(){if(this.div)return this.div;const I=super.render();c(this,ou)&&(I.setAttribute("aria-label",c(this,ou)),I.setAttribute("role","mark")),c(this,De)?I.classList.add("free"):this.div.addEventListener("keydown",X(this,gI,lv).bind(this),{signal:this._uiManager._signal});const e=V(this,dc,document.createElement("div"));return I.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=c(this,ac),this.setDims(),LD(this,c(this,dc),["pointerover","pointerleave"]),this.enableEditing(),I}pointerover(){var I;this.isSelected||(I=this.parent)==null||I.drawLayer.updateProperties(c(this,_e),{rootClass:{hovered:!0}})}pointerleave(){var I;this.isSelected||(I=this.parent)==null||I.drawLayer.updateProperties(c(this,_e),{rootClass:{hovered:!1}})}_moveCaret(I){switch(this.parent.unselect(this),I){case 0:case 2:X(this,gI,Y2).call(this,!0);break;case 1:case 3:X(this,gI,Y2).call(this,!1);break}}select(){var I;super.select(),c(this,_e)&&((I=this.parent)==null||I.drawLayer.updateProperties(c(this,_e),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var I;super.unselect(),c(this,_e)&&((I=this.parent)==null||I.drawLayer.updateProperties(c(this,_e),{rootClass:{selected:!1}}),c(this,De)||X(this,gI,Y2).call(this,!1))}get _mustFixPosition(){return!c(this,De)}show(I=this._isVisible){super.show(I),this.parent&&(this.parent.drawLayer.updateProperties(c(this,Yi),{rootClass:{hidden:!I}}),this.parent.drawLayer.updateProperties(c(this,_e),{rootClass:{hidden:!I}}))}static startHighlighting(I,e,{target:t,x:i,y:A}){const{x:n,y:l,width:o,height:a}=t.getBoundingClientRect(),d=new AbortController,m=I.combinedSignal(d),u=h=>{d.abort(),X(this,aA,dv).call(this,I,h)};window.addEventListener("blur",u,{signal:m}),window.addEventListener("pointerup",u,{signal:m}),window.addEventListener("pointerdown",wC,{capture:!0,passive:!1,signal:m}),window.addEventListener("contextmenu",Ji,{signal:m}),t.addEventListener("pointermove",X(this,aA,av).bind(this,I),{signal:m}),this._freeHighlight=new VV({x:i,y:A},[n,l,o,a],I.scale,this._defaultThickness/2,e,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=I.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(I,e,t){var Z,w,G,B;let i=null;if(I instanceof yS){const{data:{quadPoints:p,rect:y,rotation:Y,id:R,color:M,opacity:S,popupRef:J,richText:D,contentsObj:H,creationDate:F,modificationDate:x},parent:{page:{pageNumber:q}}}=I;i=I={annotationType:Ug.HIGHLIGHT,color:Array.from(M),opacity:S,quadPoints:p,boxes:null,pageIndex:q-1,rect:y.slice(0),rotation:Y,annotationElementId:R,id:R,deleted:!1,popupRef:J,richText:D,comment:(H==null?void 0:H.str)||null,creationDate:F,modificationDate:x}}else if(I instanceof BV){const{data:{inkLists:p,rect:y,rotation:Y,id:R,color:M,borderStyle:{rawWidth:S},popupRef:J,richText:D,contentsObj:H,creationDate:F,modificationDate:x},parent:{page:{pageNumber:q}}}=I;i=I={annotationType:Ug.HIGHLIGHT,color:Array.from(M),thickness:S,inkLists:p,boxes:null,pageIndex:q-1,rect:y.slice(0),rotation:Y,annotationElementId:R,id:R,deleted:!1,popupRef:J,richText:D,comment:(H==null?void 0:H.str)||null,creationDate:F,modificationDate:x}}const{color:A,quadPoints:n,inkLists:l,opacity:o}=I,a=await super.deserialize(I,e,t);a.color=Mg.makeHexColor(...A),a.opacity=o||1,l&&V(a,oA,I.thickness),a._initialData=i,I.comment&&a.setCommentData(I);const[d,m]=a.pageDimensions,[u,h]=a.pageTranslation;if(n){const p=V(a,gs,[]);for(let y=0;y<n.length;y+=8)p.push({x:(n[y]-u)/d,y:1-(n[y+1]-h)/m,width:(n[y+2]-n[y])/d,height:(n[y+1]-n[y+5])/m});X(Z=a,gI,Z5).call(Z),X(w=a,gI,Fc).call(w),a.rotate(a.rotation)}else if(l){V(a,De,!0);const p=l[0],y={x:p[0]-u,y:m-(p[1]-h)},Y=new VV(y,[0,0,d,m],1,c(a,oA)/2,!0,.001);for(let S=0,J=p.length;S<J;S+=2)y.x=p[S]-u,y.y=m-(p[S+1]-h),Y.add(y);const{id:R,clipPathId:M}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:a.color,"fill-opacity":a._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:Y.toSVGPath()}},!0,!0);X(G=a,gI,y2).call(G,{highlightOutlines:Y.getOutlines(),highlightId:R,clipPathId:M}),X(B=a,gI,Fc).call(B),a.rotate(a.parentRotation)}return a}serialize(I=!1){if(this.isEmpty()||I)return null;if(this.deleted)return this.serializeDeleted();const e=qI._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),t=super.serialize(I);return Object.assign(t,{color:e,opacity:this.opacity,thickness:c(this,oA),quadPoints:X(this,gI,sv).call(this),outlines:X(this,gI,ov).call(this,t.rect)}),this.addComment(t),this.annotationElementId&&!X(this,gI,cv).call(this,t)?null:(t.id=this.annotationElementId,t)}renderAnnotationElement(I){return this.deleted?(I.hide(),null):(I.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}};nu=new WeakMap,YZ=new WeakMap,gs=new WeakMap,ac=new WeakMap,VZ=new WeakMap,Et=new WeakMap,NZ=new WeakMap,MZ=new WeakMap,dc=new WeakMap,yi=new WeakMap,Yi=new WeakMap,De=new WeakMap,lu=new WeakMap,su=new WeakMap,_e=new WeakMap,ou=new WeakMap,oA=new WeakMap,RZ=new WeakMap,gI=new WeakSet,Z5=function(){const I=new YV(c(this,gs),.001);V(this,yi,I.getOutlines()),[this.x,this.y,this.width,this.height]=c(this,yi).box;const e=new YV(c(this,gs),.0025,.001,this._uiManager.direction==="ltr");V(this,Et,e.getOutlines());const{firstPoint:t}=c(this,yi);V(this,lu,[(t[0]-this.x)/this.width,(t[1]-this.y)/this.height]);const{lastPoint:i}=c(this,Et);V(this,su,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])},y2=function({highlightOutlines:I,highlightId:e,clipPathId:t}){var m,u;if(V(this,yi,I),V(this,Et,I.getNewOutline(c(this,oA)/2+1.5,.0025)),e>=0)V(this,Yi,e),V(this,ac,t),this.parent.drawLayer.finalizeDraw(e,{bbox:I.box,path:{d:I.toSVGPath()}}),V(this,_e,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:c(this,Et).box,path:{d:c(this,Et).toSVGPath()}},!0));else if(this.parent){const h=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(c(this,Yi),{bbox:X(m=WI,aA,Tu).call(m,c(this,yi).box,(h-this.rotation+360)%360),path:{d:I.toSVGPath()}}),this.parent.drawLayer.updateProperties(c(this,_e),{bbox:X(u=WI,aA,Tu).call(u,c(this,Et).box,h),path:{d:c(this,Et).toSVGPath()}})}const[A,n,l,o]=I.box;switch(this.rotation){case 0:this.x=A,this.y=n,this.width=l,this.height=o;break;case 90:{const[h,Z]=this.parentDimensions;this.x=n,this.y=1-A,this.width=l*Z/h,this.height=o*h/Z;break}case 180:this.x=1-A,this.y=1-n,this.width=l,this.height=o;break;case 270:{const[h,Z]=this.parentDimensions;this.x=1-n,this.y=A,this.width=l*Z/h,this.height=o*h/Z;break}}const{firstPoint:a}=I;V(this,lu,[(a[0]-A)/l,(a[1]-n)/o]);const{lastPoint:d}=c(this,Et);V(this,su,[(d[0]-A)/l,(d[1]-n)/o])},iv=function(I){const e=(A,n)=>{this.color=A,this.opacity=n,this.onUpdatedColor()},t=this.color,i=this.opacity;this.addCommands({cmd:e.bind(this,I,WI._defaultOpacity),undo:e.bind(this,t,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:mI.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(I)},!0)},Av=function(I){const e=c(this,oA),t=i=>{V(this,oA,i),X(this,gI,nv).call(this,i)};this.addCommands({cmd:t.bind(this,I),undo:t.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:mI.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:I},!0)},nv=function(I){c(this,De)&&(X(this,gI,y2).call(this,{highlightOutlines:c(this,yi).getNewOutline(I/2)}),this.fixAndSetPosition(),this.setDims())},G5=function(){c(this,Yi)===null||!this.parent||(this.parent.drawLayer.remove(c(this,Yi)),V(this,Yi,null),this.parent.drawLayer.remove(c(this,_e)),V(this,_e,null))},Fc=function(I=this.parent){c(this,Yi)===null&&({id:ne(this,Yi)._,clipPathId:ne(this,ac)._}=I.drawLayer.draw({bbox:c(this,yi).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:c(this,De)},path:{d:c(this,yi).toSVGPath()}},!1,!0),V(this,_e,I.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:c(this,De)},bbox:c(this,Et).box,path:{d:c(this,Et).toSVGPath()}},c(this,De))),c(this,dc)&&(c(this,dc).style.clipPath=c(this,ac)))},aA=new WeakSet,Tu=function([I,e,t,i],A){switch(A){case 90:return[1-e-i,I,i,t];case 180:return[1-I-t,1-e-i,t,i];case 270:return[e,1-I-t,i,t]}return[I,e,t,i]},lv=function(I){WI._keyboardManager.exec(this,I)},Y2=function(I){if(!c(this,nu))return;const e=window.getSelection();I?e.setPosition(c(this,nu),c(this,YZ)):e.setPosition(c(this,NZ),c(this,MZ))},V2=function(){return c(this,De)?this.rotation:0},sv=function(){if(c(this,De))return null;const[I,e]=this.pageDimensions,[t,i]=this.pageTranslation,A=c(this,gs),n=new Float32Array(A.length*8);let l=0;for(const{x:o,y:a,width:d,height:m}of A){const u=o*I+t,h=(1-a)*e+i;n[l]=n[l+4]=u,n[l+1]=n[l+3]=h,n[l+2]=n[l+6]=u+d*I,n[l+5]=n[l+7]=h-m*e,l+=8}return n},ov=function(I){return c(this,yi).serialize(I,X(this,gI,V2).call(this))},av=function(I,e){this._freeHighlight.add(e)&&I.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},dv=function(I,e){this._freeHighlight.isEmpty()?I.drawLayer.remove(this._freeHighlightId):I.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},cv=function(I){const{color:e}=this._initialData;return this.hasEditedComment||I.color.some((t,i)=>t!==e[i])},f(WI,aA),cg(WI,"_defaultColor",null),cg(WI,"_defaultOpacity",1),cg(WI,"_defaultThickness",12),cg(WI,"_type","highlight"),cg(WI,"_editorType",Ug.HIGHLIGHT),cg(WI,"_freeHighlightId",-1),cg(WI,"_freeHighlight",null),cg(WI,"_freeHighlightClipId","");let IW=WI;class NS{constructor(){f(this,cc,Object.create(null))}updateProperty(g,I){this[g]=I,this.updateSVGProperty(g,I)}updateProperties(g){if(g)for(const[I,e]of Object.entries(g))I.startsWith("_")||this.updateProperty(I,e)}updateSVGProperty(g,I){c(this,cc)[g]=I}toSVGProperties(){const g=c(this,cc);return V(this,cc,Object.create(null)),{root:g}}reset(){V(this,cc,Object.create(null))}updateAll(g=this){this.updateProperties(g)}clone(){jI("Not implemented")}}cc=new WeakMap;const dI=class dI extends qI{constructor(I){super(I);f(this,ZI);f(this,Vi,null);f(this,au);cg(this,"_colorPicker",null);cg(this,"_drawId",null);V(this,au,I.mustBeCommitted||!1),this._addOutlines(I)}onUpdatedColor(){var I;(I=this._colorPicker)==null||I.update(this.color),super.onUpdatedColor()}_addOutlines(I){I.drawOutlines&&(X(this,ZI,w5).call(this,I),X(this,ZI,mG).call(this))}static _mergeSVGProperties(I,e){const t=new Set(Object.keys(I));for(const[i,A]of Object.entries(e))t.has(i)?Object.assign(I[i],A):I[i]=A;return I}static getDefaultDrawingOptions(I){jI("Not implemented")}static get typesMap(){jI("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(I,e){const t=this.typesMap.get(I);t&&this._defaultDrawingOptions.updateProperty(t,e),this._currentParent&&(c(dI,ue).updateProperty(t,e),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(I,e){const t=this.constructor.typesMap.get(I);t&&this._updateProperty(I,t,e)}static get defaultPropertiesToUpdate(){const I=[],e=this._defaultDrawingOptions;for(const[t,i]of this.typesMap)I.push([t,e[i]]);return I}get propertiesToUpdate(){const I=[],{_drawingOptions:e}=this;for(const[t,i]of this.constructor.typesMap)I.push([t,e[i]]);return I}_updateProperty(I,e,t){const i=this._drawingOptions,A=i[e],n=l=>{var a;i.updateProperty(e,l);const o=c(this,Vi).updateProperty(e,l);o&&X(this,ZI,uG).call(this,o),(a=this.parent)==null||a.drawLayer.updateProperties(this._drawId,i.toSVGProperties()),I===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,A),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:I,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var I;(I=this.parent)==null||I.drawLayer.updateProperties(this._drawId,dI._mergeSVGProperties(c(this,Vi).getPathResizingSVGProperties(X(this,ZI,N2).call(this)),{bbox:X(this,ZI,vu).call(this)}))}_onResized(){var I;(I=this.parent)==null||I.drawLayer.updateProperties(this._drawId,dI._mergeSVGProperties(c(this,Vi).getPathResizedSVGProperties(X(this,ZI,N2).call(this)),{bbox:X(this,ZI,vu).call(this)}))}_onTranslating(I,e){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{bbox:X(this,ZI,vu).call(this)})}_onTranslated(){var I;(I=this.parent)==null||I.drawLayer.updateProperties(this._drawId,dI._mergeSVGProperties(c(this,Vi).getPathTranslatedSVGProperties(X(this,ZI,N2).call(this),this.parentDimensions),{bbox:X(this,ZI,vu).call(this)}))}_onStartDragging(){var I;(I=this.parent)==null||I.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var I;(I=this.parent)==null||I.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(I){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,c(this,au)&&(V(this,au,!1),this.commit(),this.parent.setSelected(this),I&&this.isOnScreen&&this.div.focus())}remove(){X(this,ZI,B5).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(X(this,ZI,mG).call(this),X(this,ZI,uG).call(this,c(this,Vi).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(I){var t;let e=!1;this.parent&&!I?(this._uiManager.removeShouldRescale(this),X(this,ZI,B5).call(this)):I&&(this._uiManager.addShouldRescale(this),X(this,ZI,mG).call(this,I),e=!this.parent&&((t=this.div)==null?void 0:t.classList.contains("selectedEditor"))),super.setParent(I),e&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,dI._mergeSVGProperties({bbox:X(this,ZI,vu).call(this)},c(this,Vi).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&X(this,ZI,uG).call(this,c(this,Vi).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let I,e;this._isCopy&&(I=this.x,e=this.y);const t=super.render();t.classList.add("draw");const i=document.createElement("div");return t.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(I,e),t}static createDrawerInstance(I,e,t,i,A){jI("Not implemented")}static startDrawing(I,e,t,i){var w;const{target:A,offsetX:n,offsetY:l,pointerId:o,pointerType:a}=i;if(ve.isInitializedAndDifferentPointerType(a))return;const{viewport:{rotation:d}}=I,{width:m,height:u}=A.getBoundingClientRect(),h=V(dI,rc,new AbortController),Z=I.combinedSignal(h);if(ve.setPointer(a,o),window.addEventListener("pointerup",G=>{ve.isSamePointerIdOrRemove(G.pointerId)&&this._endDraw(G)},{signal:Z}),window.addEventListener("pointercancel",G=>{ve.isSamePointerIdOrRemove(G.pointerId)&&this._currentParent.endDrawingSession()},{signal:Z}),window.addEventListener("pointerdown",G=>{ve.isSamePointerType(G.pointerType)&&(ve.initializeAndAddPointerId(G.pointerId),c(dI,ue).isCancellable()&&(c(dI,ue).removeLastElement(),c(dI,ue).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:Z}),window.addEventListener("contextmenu",Ji,{signal:Z}),A.addEventListener("pointermove",this._drawMove.bind(this),{signal:Z}),A.addEventListener("touchmove",G=>{ve.isSameTimeStamp(G.timeStamp)&&wC(G)},{signal:Z}),I.toggleDrawing(),(w=e._editorUndoBar)==null||w.hide(),c(dI,ue)){I.drawLayer.updateProperties(this._currentDrawId,c(dI,ue).startNew(n,l,m,u,d));return}e.updateUIForDefaultProperties(this),V(dI,ue,this.createDrawerInstance(n,l,m,u,d)),V(dI,mc,this.getDefaultDrawingOptions()),this._currentParent=I,{id:this._currentDrawId}=I.drawLayer.draw(this._mergeSVGProperties(c(dI,mc).toSVGProperties(),c(dI,ue).defaultSVGProperties),!0,!1)}static _drawMove(I){if(ve.isSameTimeStamp(I.timeStamp),!c(dI,ue))return;const{offsetX:e,offsetY:t,pointerId:i}=I;if(ve.isSamePointerId(i)){if(ve.isUsingMultiplePointers()){this._endDraw(I);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,c(dI,ue).add(e,t)),ve.setTimeStamp(I.timeStamp),wC(I)}}static _cleanup(I){I&&(this._currentDrawId=-1,this._currentParent=null,V(dI,ue,null),V(dI,mc,null),ve.clearPointerType(),ve.clearTimeStamp()),c(dI,rc)&&(c(dI,rc).abort(),V(dI,rc,null),ve.clearPointerIds())}static _endDraw(I){const e=this._currentParent;if(e){if(e.toggleDrawing(!0),this._cleanup(!1),(I==null?void 0:I.target)===e.div&&e.drawLayer.updateProperties(this._currentDrawId,c(dI,ue).end(I.offsetX,I.offsetY)),this.supportMultipleDrawings){const t=c(dI,ue),i=this._currentDrawId,A=t.getLastElement();e.addCommands({cmd:()=>{e.drawLayer.updateProperties(i,t.setLastElement(A))},undo:()=>{e.drawLayer.updateProperties(i,t.removeLastElement())},mustExec:!1,type:mI.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(I){const e=this._currentParent;if(!e)return null;if(e.toggleDrawing(!0),e.cleanUndoStack(mI.DRAW_STEP),!c(dI,ue).isEmpty()){const{pageDimensions:[t,i],scale:A}=e,n=e.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:c(dI,ue).getOutlines(t*A,i*A,A,this._INNER_MARGIN),drawingOptions:c(dI,mc),mustBeCommitted:!I});return this._cleanup(!0),n}return e.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(I){}static deserializeDraw(I,e,t,i,A,n){jI("Not implemented")}static async deserialize(I,e,t){var d,m;const{rawDims:{pageWidth:i,pageHeight:A,pageX:n,pageY:l}}=e.viewport,o=this.deserializeDraw(n,l,i,A,this._INNER_MARGIN,I),a=await super.deserialize(I,e,t);return a.createDrawingOptions(I),X(d=a,ZI,w5).call(d,{drawOutlines:o}),X(m=a,ZI,mG).call(m),a.onScaleChanging(),a.rotate(),a}serializeDraw(I){const[e,t]=this.pageTranslation,[i,A]=this.pageDimensions;return c(this,Vi).serialize([e,t,i,A],I)}renderAnnotationElement(I){return I.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};Vi=new WeakMap,au=new WeakMap,ue=new WeakMap,rc=new WeakMap,mc=new WeakMap,ZI=new WeakSet,w5=function({drawOutlines:I,drawId:e,drawingOptions:t}){V(this,Vi,I),this._drawingOptions||(this._drawingOptions=t),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),e>=0?(this._drawId=e,this.parent.drawLayer.finalizeDraw(e,I.defaultProperties)):this._drawId=X(this,ZI,W5).call(this,I,this.parent),X(this,ZI,uG).call(this,I.box)},W5=function(I,e){const{id:t}=e.drawLayer.draw(dI._mergeSVGProperties(this._drawingOptions.toSVGProperties(),I.defaultSVGProperties),!1,!1);return t},B5=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},mG=function(I=this.parent){if(!(this._drawId!==null&&this.parent===I)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,I.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=X(this,ZI,W5).call(this,c(this,Vi),I)}},rv=function([I,e,t,i]){const{parentDimensions:[A,n],rotation:l}=this;switch(l){case 90:return[e,1-I,t*(n/A),i*(A/n)];case 180:return[1-I,1-e,t,i];case 270:return[1-e,I,t*(n/A),i*(A/n)];default:return[I,e,t,i]}},N2=function(){const{x:I,y:e,width:t,height:i,parentDimensions:[A,n],rotation:l}=this;switch(l){case 90:return[1-e,I,t*(A/n),i*(n/A)];case 180:return[1-I,1-e,t,i];case 270:return[e,1-I,t*(A/n),i*(n/A)];default:return[I,e,t,i]}},uG=function(I){[this.x,this.y,this.width,this.height]=X(this,ZI,rv).call(this,I),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},vu=function(){const{x:I,y:e,width:t,height:i,rotation:A,parentRotation:n,parentDimensions:[l,o]}=this;switch((A*4+n)/90){case 1:return[1-e-i,I,i,t];case 2:return[1-I-t,1-e-i,t,i];case 3:return[e,1-I-t,i,t];case 4:return[I,e-t*(l/o),i*(o/l),t*(l/o)];case 5:return[1-e,I,t*(l/o),i*(o/l)];case 6:return[1-I-i*(o/l),1-e,i*(o/l),t*(l/o)];case 7:return[e-t*(l/o),1-I-i*(o/l),t*(l/o),i*(o/l)];case 8:return[I-t,e-i,t,i];case 9:return[1-e,I-t,i,t];case 10:return[1-I,1-e,t,i];case 11:return[e-i,1-I,i,t];case 12:return[I-i*(o/l),e,i*(o/l),t*(l/o)];case 13:return[1-e-t*(l/o),I-i*(o/l),t*(l/o),i*(o/l)];case 14:return[1-I,1-e-t*(l/o),i*(o/l),t*(l/o)];case 15:return[e,1-I,t*(l/o),i*(o/l)];default:return[I,e,t,i]}},cg(dI,"_currentDrawId",-1),cg(dI,"_currentParent",null),f(dI,ue,null),f(dI,rc,null),f(dI,mc,null),cg(dI,"_INNER_MARGIN",3);let CW=dI;class qjg{constructor(g,I,e,t,i,A){f(this,cu);f(this,xn,new Float64Array(6));f(this,he);f(this,be);f(this,uc);f(this,du);f(this,Bt);f(this,Se,"");f(this,dA,0);f(this,hc,new Qh);f(this,bc);f(this,Zc);V(this,bc,e),V(this,Zc,t),V(this,uc,i),V(this,du,A),[g,I]=X(this,cu,M2).call(this,g,I);const n=V(this,he,[NaN,NaN,NaN,NaN,g,I]);V(this,Bt,[g,I]),V(this,be,[{line:n,points:c(this,Bt)}]),c(this,xn).set(n,0)}updateProperty(g,I){g==="stroke-width"&&V(this,du,I)}isEmpty(){return!c(this,be)||c(this,be).length===0}isCancellable(){return c(this,Bt).length<=10}add(g,I){[g,I]=X(this,cu,M2).call(this,g,I);const[e,t,i,A]=c(this,xn).subarray(2,6),n=g-i,l=I-A;return Math.hypot(c(this,bc)*n,c(this,Zc)*l)<=2?null:(c(this,Bt).push(g,I),isNaN(e)?(c(this,xn).set([i,A,g,I],2),c(this,he).push(NaN,NaN,NaN,NaN,g,I),{path:{d:this.toSVGPath()}}):(isNaN(c(this,xn)[0])&&c(this,he).splice(6,6),c(this,xn).set([e,t,i,A,g,I],0),c(this,he).push(...Vg.createBezierPoints(e,t,i,A,g,I)),{path:{d:this.toSVGPath()}}))}end(g,I){const e=this.add(g,I);return e||(c(this,Bt).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(g,I,e,t,i){V(this,bc,e),V(this,Zc,t),V(this,uc,i),[g,I]=X(this,cu,M2).call(this,g,I);const A=V(this,he,[NaN,NaN,NaN,NaN,g,I]);V(this,Bt,[g,I]);const n=c(this,be).at(-1);return n&&(n.line=new Float32Array(n.line),n.points=new Float32Array(n.points)),c(this,be).push({line:A,points:c(this,Bt)}),c(this,xn).set(A,0),V(this,dA,0),this.toSVGPath(),null}getLastElement(){return c(this,be).at(-1)}setLastElement(g){return c(this,be)?(c(this,be).push(g),V(this,he,g.line),V(this,Bt,g.points),V(this,dA,0),{path:{d:this.toSVGPath()}}):c(this,hc).setLastElement(g)}removeLastElement(){if(!c(this,be))return c(this,hc).removeLastElement();c(this,be).pop(),V(this,Se,"");for(let g=0,I=c(this,be).length;g<I;g++){const{line:e,points:t}=c(this,be)[g];V(this,he,e),V(this,Bt,t),V(this,dA,0),this.toSVGPath()}return{path:{d:c(this,Se)}}}toSVGPath(){const g=Vg.svgRound(c(this,he)[4]),I=Vg.svgRound(c(this,he)[5]);if(c(this,Bt).length===2)return V(this,Se,`${c(this,Se)} M ${g} ${I} Z`),c(this,Se);if(c(this,Bt).length<=6){const t=c(this,Se).lastIndexOf("M");V(this,Se,`${c(this,Se).slice(0,t)} M ${g} ${I}`),V(this,dA,6)}if(c(this,Bt).length===4){const t=Vg.svgRound(c(this,he)[10]),i=Vg.svgRound(c(this,he)[11]);return V(this,Se,`${c(this,Se)} L ${t} ${i}`),V(this,dA,12),c(this,Se)}const e=[];c(this,dA)===0&&(e.push(`M ${g} ${I}`),V(this,dA,6));for(let t=c(this,dA),i=c(this,he).length;t<i;t+=6){const[A,n,l,o,a,d]=c(this,he).slice(t,t+6).map(Vg.svgRound);e.push(`C${A} ${n} ${l} ${o} ${a} ${d}`)}return V(this,Se,c(this,Se)+e.join(" ")),V(this,dA,c(this,he).length),c(this,Se)}getOutlines(g,I,e,t){const i=c(this,be).at(-1);return i.line=new Float32Array(i.line),i.points=new Float32Array(i.points),c(this,hc).build(c(this,be),g,I,e,c(this,uc),c(this,du),t),V(this,xn,null),V(this,he,null),V(this,be,null),V(this,Se,null),c(this,hc)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}xn=new WeakMap,he=new WeakMap,be=new WeakMap,uc=new WeakMap,du=new WeakMap,Bt=new WeakMap,Se=new WeakMap,dA=new WeakMap,hc=new WeakMap,bc=new WeakMap,Zc=new WeakMap,cu=new WeakSet,M2=function(g,I){return Vg._normalizePoint(g,I,c(this,bc),c(this,Zc),c(this,uc))};class Qh extends Vg{constructor(){super(...arguments);f(this,Ke);f(this,pt);f(this,fZ,0);f(this,XZ);f(this,Ni);f(this,On);f(this,Qn);f(this,ru);f(this,mu);f(this,Gc)}build(I,e,t,i,A,n,l){V(this,On,e),V(this,Qn,t),V(this,ru,i),V(this,mu,A),V(this,Gc,n),V(this,XZ,l??0),V(this,Ni,I),X(this,Ke,uv).call(this)}get thickness(){return c(this,Gc)}setLastElement(I){return c(this,Ni).push(I),{path:{d:this.toSVGPath()}}}removeLastElement(){return c(this,Ni).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const I=[];for(const{line:e}of c(this,Ni)){if(I.push(`M${Vg.svgRound(e[4])} ${Vg.svgRound(e[5])}`),e.length===6){I.push("Z");continue}if(e.length===12&&isNaN(e[6])){I.push(`L${Vg.svgRound(e[10])} ${Vg.svgRound(e[11])}`);continue}for(let t=6,i=e.length;t<i;t+=6){const[A,n,l,o,a,d]=e.subarray(t,t+6).map(Vg.svgRound);I.push(`C${A} ${n} ${l} ${o} ${a} ${d}`)}}return I.join("")}serialize([I,e,t,i],A){const n=[],l=[],[o,a,d,m]=X(this,Ke,mv).call(this);let u,h,Z,w,G,B,p,y,Y;switch(c(this,mu)){case 0:Y=Vg._rescale,u=I,h=e+i,Z=t,w=-i,G=I+o*t,B=e+(1-a-m)*i,p=I+(o+d)*t,y=e+(1-a)*i;break;case 90:Y=Vg._rescaleAndSwap,u=I,h=e,Z=t,w=i,G=I+a*t,B=e+o*i,p=I+(a+m)*t,y=e+(o+d)*i;break;case 180:Y=Vg._rescale,u=I+t,h=e,Z=-t,w=i,G=I+(1-o-d)*t,B=e+a*i,p=I+(1-o)*t,y=e+(a+m)*i;break;case 270:Y=Vg._rescaleAndSwap,u=I+t,h=e+i,Z=-t,w=-i,G=I+(1-a-m)*t,B=e+(1-o-d)*i,p=I+(1-a)*t,y=e+(1-o)*i;break}for(const{line:R,points:M}of c(this,Ni))n.push(Y(R,u,h,Z,w,A?new Array(R.length):null)),l.push(Y(M,u,h,Z,w,A?new Array(M.length):null));return{lines:n,points:l,rect:[G,B,p,y]}}static deserialize(I,e,t,i,A,{paths:{lines:n,points:l},rotation:o,thickness:a}){const d=[];let m,u,h,Z,w;switch(o){case 0:w=Vg._rescale,m=-I/t,u=e/i+1,h=1/t,Z=-1/i;break;case 90:w=Vg._rescaleAndSwap,m=-e/i,u=-I/t,h=1/i,Z=1/t;break;case 180:w=Vg._rescale,m=I/t+1,u=-e/i,h=-1/t,Z=1/i;break;case 270:w=Vg._rescaleAndSwap,m=e/i+1,u=I/t+1,h=-1/i,Z=-1/t;break}if(!n){n=[];for(const B of l){const p=B.length;if(p===2){n.push(new Float32Array([NaN,NaN,NaN,NaN,B[0],B[1]]));continue}if(p===4){n.push(new Float32Array([NaN,NaN,NaN,NaN,B[0],B[1],NaN,NaN,NaN,NaN,B[2],B[3]]));continue}const y=new Float32Array(3*(p-2));n.push(y);let[Y,R,M,S]=B.subarray(0,4);y.set([NaN,NaN,NaN,NaN,Y,R],0);for(let J=4;J<p;J+=2){const D=B[J],H=B[J+1];y.set(Vg.createBezierPoints(Y,R,M,S,D,H),(J-2)*3),[Y,R,M,S]=[M,S,D,H]}}}for(let B=0,p=n.length;B<p;B++)d.push({line:w(n[B].map(y=>y??NaN),m,u,h,Z),points:w(l[B].map(y=>y??NaN),m,u,h,Z)});const G=new this.prototype.constructor;return G.build(d,t,i,1,o,a,A),G}get box(){return c(this,pt)}updateProperty(I,e){return I==="stroke-width"?X(this,Ke,hv).call(this,e):null}updateParentDimensions([I,e],t){const[i,A]=X(this,Ke,Gs).call(this);V(this,On,I),V(this,Qn,e),V(this,ru,t);const[n,l]=X(this,Ke,Gs).call(this),o=n-i,a=l-A,d=c(this,pt);return d[0]-=o,d[1]-=a,d[2]+=2*o,d[3]+=2*a,d}updateRotation(I){return V(this,fZ,I),{path:{transform:this.rotationTransform}}}get viewBox(){return c(this,pt).map(Vg.svgRound).join(" ")}get defaultProperties(){const[I,e]=c(this,pt);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Vg.svgRound(I)} ${Vg.svgRound(e)}`}}}get rotationTransform(){const[,,I,e]=c(this,pt);let t=0,i=0,A=0,n=0,l=0,o=0;switch(c(this,fZ)){case 90:i=e/I,A=-I/e,l=I;break;case 180:t=-1,n=-1,l=I,o=e;break;case 270:i=-e/I,A=I/e,o=e;break;default:return""}return`matrix(${t} ${i} ${A} ${n} ${Vg.svgRound(l)} ${Vg.svgRound(o)})`}getPathResizingSVGProperties([I,e,t,i]){const[A,n]=X(this,Ke,Gs).call(this),[l,o,a,d]=c(this,pt);if(Math.abs(a-A)<=Vg.PRECISION||Math.abs(d-n)<=Vg.PRECISION){const w=I+t/2-(l+a/2),G=e+i/2-(o+d/2);return{path:{"transform-origin":`${Vg.svgRound(I)} ${Vg.svgRound(e)}`,transform:`${this.rotationTransform} translate(${w} ${G})`}}}const m=(t-2*A)/(a-2*A),u=(i-2*n)/(d-2*n),h=a/t,Z=d/i;return{path:{"transform-origin":`${Vg.svgRound(l)} ${Vg.svgRound(o)}`,transform:`${this.rotationTransform} scale(${h} ${Z}) translate(${Vg.svgRound(A)} ${Vg.svgRound(n)}) scale(${m} ${u}) translate(${Vg.svgRound(-A)} ${Vg.svgRound(-n)})`}}}getPathResizedSVGProperties([I,e,t,i]){const[A,n]=X(this,Ke,Gs).call(this),l=c(this,pt),[o,a,d,m]=l;if(l[0]=I,l[1]=e,l[2]=t,l[3]=i,Math.abs(d-A)<=Vg.PRECISION||Math.abs(m-n)<=Vg.PRECISION){const G=I+t/2-(o+d/2),B=e+i/2-(a+m/2);for(const{line:p,points:y}of c(this,Ni))Vg._translate(p,G,B,p),Vg._translate(y,G,B,y);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Vg.svgRound(I)} ${Vg.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const u=(t-2*A)/(d-2*A),h=(i-2*n)/(m-2*n),Z=-u*(o+A)+I+A,w=-h*(a+n)+e+n;if(u!==1||h!==1||Z!==0||w!==0)for(const{line:G,points:B}of c(this,Ni))Vg._rescale(G,Z,w,u,h,G),Vg._rescale(B,Z,w,u,h,B);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Vg.svgRound(I)} ${Vg.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([I,e],t){const[i,A]=t,n=c(this,pt),l=I-n[0],o=e-n[1];if(c(this,On)===i&&c(this,Qn)===A)for(const{line:a,points:d}of c(this,Ni))Vg._translate(a,l,o,a),Vg._translate(d,l,o,d);else{const a=c(this,On)/i,d=c(this,Qn)/A;V(this,On,i),V(this,Qn,A);for(const{line:m,points:u}of c(this,Ni))Vg._rescale(m,l,o,a,d,m),Vg._rescale(u,l,o,a,d,u);n[2]*=a,n[3]*=d}return n[0]=I,n[1]=e,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Vg.svgRound(I)} ${Vg.svgRound(e)}`}}}get defaultSVGProperties(){const I=c(this,pt);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Vg.svgRound(I[0])} ${Vg.svgRound(I[1])}`,transform:this.rotationTransform||null},bbox:I}}}pt=new WeakMap,fZ=new WeakMap,XZ=new WeakMap,Ni=new WeakMap,On=new WeakMap,Qn=new WeakMap,ru=new WeakMap,mu=new WeakMap,Gc=new WeakMap,Ke=new WeakSet,Gs=function(I=c(this,Gc)){const e=c(this,XZ)+I/2*c(this,ru);return c(this,mu)%180===0?[e/c(this,On),e/c(this,Qn)]:[e/c(this,Qn),e/c(this,On)]},mv=function(){const[I,e,t,i]=c(this,pt),[A,n]=X(this,Ke,Gs).call(this,0);return[I+A,e+n,t-2*A,i-2*n]},uv=function(){const I=V(this,pt,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:i}of c(this,Ni)){if(i.length<=12){for(let l=4,o=i.length;l<o;l+=6)Mg.pointBoundingBox(i[l],i[l+1],I);continue}let A=i[4],n=i[5];for(let l=6,o=i.length;l<o;l+=6){const[a,d,m,u,h,Z]=i.subarray(l,l+6);Mg.bezierBoundingBox(A,n,a,d,m,u,h,Z,I),A=h,n=Z}}const[e,t]=X(this,Ke,Gs).call(this);I[0]=mt(I[0]-e,0,1),I[1]=mt(I[1]-t,0,1),I[2]=mt(I[2]+e,0,1),I[3]=mt(I[3]+t,0,1),I[2]-=I[0],I[3]-=I[1]},hv=function(I){const[e,t]=X(this,Ke,Gs).call(this);V(this,Gc,I);const[i,A]=X(this,Ke,Gs).call(this),[n,l]=[i-e,A-t],o=c(this,pt);return o[0]-=n,o[1]-=l,o[2]+=2*n,o[3]+=2*l,o};class eW extends NS{constructor(g){super(),this._viewParameters=g,super.updateProperties({fill:"none",stroke:qI._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(g,I){g==="stroke-width"&&(I??(I=this["stroke-width"]),I*=this._viewParameters.realScale),super.updateSVGProperty(g,I)}clone(){const g=new eW(this._viewParameters);return g.updateAll(this),g}}const uu=class uu extends CW{constructor(I){super({...I,name:"inkEditor"});f(this,cp);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(I,e){qI.initialize(I,e),this._defaultDrawingOptions=new eW(e.viewParameters)}static getDefaultDrawingOptions(I){const e=this._defaultDrawingOptions.clone();return e.updateProperties(I),e}static get supportMultipleDrawings(){return!0}static get typesMap(){return Og(this,"typesMap",new Map([[mI.INK_THICKNESS,"stroke-width"],[mI.INK_COLOR,"stroke"],[mI.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(I,e,t,i,A){return new qjg(I,e,t,i,A,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(I,e,t,i,A,n){return Qh.deserialize(I,e,t,i,A,n)}static async deserialize(I,e,t){let i=null;if(I instanceof BV){const{data:{inkLists:n,rect:l,rotation:o,id:a,color:d,opacity:m,borderStyle:{rawWidth:u},popupRef:h,richText:Z,contentsObj:w,creationDate:G,modificationDate:B},parent:{page:{pageNumber:p}}}=I;i=I={annotationType:Ug.INK,color:Array.from(d),thickness:u,opacity:m,paths:{points:n},boxes:null,pageIndex:p-1,rect:l.slice(0),rotation:o,annotationElementId:a,id:a,deleted:!1,popupRef:h,richText:Z,comment:(w==null?void 0:w.str)||null,creationDate:G,modificationDate:B}}const A=await super.deserialize(I,e,t);return A._initialData=i,I.comment&&A.setCommentData(I),A}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new _w(this)),[["colorPicker",this._colorPicker]]}get colorType(){return mI.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:I,_drawingOptions:e,parent:t}=this;e.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(I,e.toSVGProperties())}static onScaleChangingWhenDrawing(){const I=this._currentParent;I&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),I.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:I,thickness:e,opacity:t}){this._drawingOptions=uu.getDefaultDrawingOptions({stroke:Mg.makeHexColor(...I),"stroke-width":e,"stroke-opacity":t})}serialize(I=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:e,points:t}=this.serializeDraw(I),{_drawingOptions:{stroke:i,"stroke-opacity":A,"stroke-width":n}}=this,l=Object.assign(super.serialize(I),{color:qI._colorManager.convert(i),opacity:A,thickness:n,paths:{lines:e,points:t}});return this.addComment(l),I?(l.isCopy=!0,l):this.annotationElementId&&!X(this,cp,bv).call(this,l)?null:(l.id=this.annotationElementId,l)}renderAnnotationElement(I){if(this.deleted)return I.hide(),null;const{points:e,rect:t}=this.serializeDraw(!1);return I.updateEdited({rect:t,thickness:this._drawingOptions["stroke-width"],points:e,popup:this.comment}),null}};cp=new WeakSet,bv=function(I){const{color:e,thickness:t,opacity:i,pageIndex:A}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||I.color.some((n,l)=>n!==e[l])||I.thickness!==t||I.opacity!==i||I.pageIndex!==A},cg(uu,"_type","ink"),cg(uu,"_editorType",Ug.INK),cg(uu,"_defaultDrawingOptions",null);let NV=uu;class MV extends Qh{toSVGPath(){let g=super.toSVGPath();return g.endsWith("Z")||(g+="Z"),g}}const tW=8,Uh=3;class ll{static extractContoursFromText(g,{fontFamily:I,fontStyle:e,fontWeight:t},i,A,n,l){let o=new OffscreenCanvas(1,1),a=o.getContext("2d",{alpha:!1});const d=200,m=a.font=`${e} ${t} ${d}px ${I}`,{actualBoundingBoxLeft:u,actualBoundingBoxRight:h,actualBoundingBoxAscent:Z,actualBoundingBoxDescent:w,fontBoundingBoxAscent:G,fontBoundingBoxDescent:B,width:p}=a.measureText(g),y=1.5,Y=Math.ceil(Math.max(Math.abs(u)+Math.abs(h)||0,p)*y),R=Math.ceil(Math.max(Math.abs(Z)+Math.abs(w)||d,Math.abs(G)+Math.abs(B)||d)*y);o=new OffscreenCanvas(Y,R),a=o.getContext("2d",{alpha:!0,willReadFrequently:!0}),a.font=m,a.filter="grayscale(1)",a.fillStyle="white",a.fillRect(0,0,Y,R),a.fillStyle="black",a.fillText(g,Y*(y-1)/2,R*(3-y)/2);const M=X(this,pI,Y5).call(this,a.getImageData(0,0,Y,R).data),S=X(this,pI,Bv).call(this,M),J=X(this,pI,V5).call(this,S),D=X(this,pI,y5).call(this,M,Y,R,J);return this.processDrawnLines({lines:{curves:D,width:Y,height:R},pageWidth:i,pageHeight:A,rotation:n,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(g,I,e,t,i){const[A,n,l]=X(this,pI,pv).call(this,g),[o,a]=X(this,pI,Wv).call(this,A,n,l,Math.hypot(n,l)*c(this,wc).sigmaSFactor,c(this,wc).sigmaR,c(this,wc).kernelSize),d=X(this,pI,V5).call(this,a),m=X(this,pI,y5).call(this,o,n,l,d);return this.processDrawnLines({lines:{curves:m,width:n,height:l},pageWidth:I,pageHeight:e,rotation:t,innerMargin:i,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:g,pageWidth:I,pageHeight:e,rotation:t,innerMargin:i,mustSmooth:A,areContours:n}){t%180!==0&&([I,e]=[e,I]);const{curves:l,width:o,height:a}=g,d=g.thickness??0,m=[],u=Math.min(I/o,e/a),h=u/I,Z=u/e,w=[];for(const{points:B}of l){const p=A?X(this,pI,wv).call(this,B):B;if(!p)continue;w.push(p);const y=p.length,Y=new Float32Array(y),R=new Float32Array(3*(y===2?2:y-2));if(m.push({line:R,points:Y}),y===2){Y[0]=p[0]*h,Y[1]=p[1]*Z,R.set([NaN,NaN,NaN,NaN,Y[0],Y[1]],0);continue}let[M,S,J,D]=p;M*=h,S*=Z,J*=h,D*=Z,Y.set([M,S,J,D],0),R.set([NaN,NaN,NaN,NaN,M,S],0);for(let H=4;H<y;H+=2){const F=Y[H]=p[H]*h,x=Y[H+1]=p[H+1]*Z;R.set(Vg.createBezierPoints(M,S,J,D,F,x),(H-2)*3),[M,S,J,D]=[J,D,F,x]}}if(m.length===0)return null;const G=n?new MV:new Qh;return G.build(m,I,e,1,t,n?0:d,i),{outline:G,newCurves:w,areContours:n,thickness:d,width:o,height:a}}static async compressSignature({outlines:g,areContours:I,thickness:e,width:t,height:i}){let A=1/0,n=-1/0,l=0;for(const p of g){l+=p.length;for(let y=2,Y=p.length;y<Y;y++){const R=p[y]-p[y-2];A=Math.min(A,R),n=Math.max(n,R)}}let o;A>=-128&&n<=127?o=Int8Array:A>=-32768&&n<=32767?o=Int16Array:o=Int32Array;const a=g.length,d=tW+Uh*a,m=new Uint32Array(d);let u=0;m[u++]=d*Uint32Array.BYTES_PER_ELEMENT+(l-2*a)*o.BYTES_PER_ELEMENT,m[u++]=0,m[u++]=t,m[u++]=i,m[u++]=I?0:1,m[u++]=Math.max(0,Math.floor(e??0)),m[u++]=a,m[u++]=o.BYTES_PER_ELEMENT;for(const p of g)m[u++]=p.length-2,m[u++]=p[0],m[u++]=p[1];const h=new CompressionStream("deflate-raw"),Z=h.writable.getWriter();await Z.ready,Z.write(m);const w=o.prototype.constructor;for(const p of g){const y=new w(p.length-2);for(let Y=2,R=p.length;Y<R;Y++)y[Y-2]=p[Y]-p[Y-2];Z.write(y)}Z.close();const G=await new Response(h.readable).arrayBuffer(),B=new Uint8Array(G);return XD(B)}static async decompressSignature(g){try{const I=mvg(g),{readable:e,writable:t}=new DecompressionStream("deflate-raw"),i=t.getWriter();await i.ready,i.write(I).then(async()=>{await i.ready,await i.close()}).catch(()=>{});let A=null,n=0;for await(const p of e)A||(A=new Uint8Array(new Uint32Array(p.buffer,0,4)[0])),A.set(p,n),n+=p.length;const l=new Uint32Array(A.buffer,0,A.length>>2),o=l[1];if(o!==0)throw new Error(`Invalid version: ${o}`);const a=l[2],d=l[3],m=l[4]===0,u=l[5],h=l[6],Z=l[7],w=[],G=(tW+Uh*h)*Uint32Array.BYTES_PER_ELEMENT;let B;switch(Z){case Int8Array.BYTES_PER_ELEMENT:B=new Int8Array(A.buffer,G);break;case Int16Array.BYTES_PER_ELEMENT:B=new Int16Array(A.buffer,G);break;case Int32Array.BYTES_PER_ELEMENT:B=new Int32Array(A.buffer,G);break}n=0;for(let p=0;p<h;p++){const y=l[Uh*p+tW],Y=new Float32Array(y+2);w.push(Y);for(let R=0;R<Uh-1;R++)Y[R]=l[Uh*p+tW+R+1];for(let R=0;R<y;R++)Y[R+2]=Y[R]+B[n++]}return{areContours:m,thickness:u,outlines:w,width:a,height:d}}catch(I){return xg(`decompressSignature: ${I}`),null}}}wc=new WeakMap,pI=new WeakSet,p5=function(g,I,e,t){return e-=g,t-=I,e===0?t>0?0:4:e===1?t+6:2-t},QA=new WeakMap,Zv=function(g,I,e,t,i,A,n){const l=X(this,pI,p5).call(this,e,t,i,A);for(let o=0;o<8;o++){const a=(-o+l-n+16)%8,d=c(this,QA)[2*a],m=c(this,QA)[2*a+1];if(g[(e+d)*I+(t+m)]!==0)return a}return-1},Gv=function(g,I,e,t,i,A,n){const l=X(this,pI,p5).call(this,e,t,i,A);for(let o=0;o<8;o++){const a=(o+l+n+16)%8,d=c(this,QA)[2*a],m=c(this,QA)[2*a+1];if(g[(e+d)*I+(t+m)]!==0)return a}return-1},y5=function(g,I,e,t){const i=g.length,A=new Int32Array(i);for(let a=0;a<i;a++)A[a]=g[a]<=t?1:0;for(let a=1;a<e-1;a++)A[a*I]=A[a*I+I-1]=0;for(let a=0;a<I;a++)A[a]=A[I*e-1-a]=0;let n=1,l;const o=[];for(let a=1;a<e-1;a++){l=1;for(let d=1;d<I-1;d++){const m=a*I+d,u=A[m];if(u===0)continue;let h=a,Z=d;if(u===1&&A[m-1]===0)n+=1,Z-=1;else if(u>=1&&A[m+1]===0)n+=1,Z+=1,u>1&&(l=u);else{u!==1&&(l=Math.abs(u));continue}const w=[d,a],G=Z===d+1,B={isHole:G,points:w,id:n,parent:0};o.push(B);let p;for(const H of o)if(H.id===l){p=H;break}p?p.isHole?B.parent=G?p.parent:l:B.parent=G?l:p.parent:B.parent=G?l:0;const y=X(this,pI,Zv).call(this,A,I,a,d,h,Z,0);if(y===-1){A[m]=-n,A[m]!==1&&(l=Math.abs(A[m]));continue}let Y=c(this,QA)[2*y],R=c(this,QA)[2*y+1];const M=a+Y,S=d+R;h=M,Z=S;let J=a,D=d;for(;;){const H=X(this,pI,Gv).call(this,A,I,J,D,h,Z,1);Y=c(this,QA)[2*H],R=c(this,QA)[2*H+1];const F=J+Y,x=D+R;w.push(x,F);const q=J*I+D;if(A[q+1]===0?A[q]=-n:A[q]===1&&(A[q]=n),F===a&&x===d&&J===M&&D===S){A[m]!==1&&(l=Math.abs(A[m]));break}else h=J,Z=D,J=F,D=x}}}return o},R2=function(g,I,e,t){if(e-I<=4){for(let M=I;M<e-2;M+=2)t.push(g[M],g[M+1]);return}const i=g[I],A=g[I+1],n=g[e-4]-i,l=g[e-3]-A,o=Math.hypot(n,l),a=n/o,d=l/o,m=a*A-d*i,u=l/n,h=1/o,Z=Math.atan(u),w=Math.cos(Z),G=Math.sin(Z),B=h*(Math.abs(w)+Math.abs(G)),p=h*(1-B+B**2),y=Math.max(Math.atan(Math.abs(G+w)*p),Math.atan(Math.abs(G-w)*p));let Y=0,R=I;for(let M=I+2;M<e-2;M+=2){const S=Math.abs(m-a*g[M+1]+d*g[M]);S>Y&&(R=M,Y=S)}Y>(o*y)**2?(X(this,pI,R2).call(this,g,I,R+2,t),X(this,pI,R2).call(this,g,R,e,t)):t.push(i,A)},wv=function(g){const I=[],e=g.length;return X(this,pI,R2).call(this,g,0,e,I),I.push(g[e-2],g[e-1]),I.length<=4?null:I},Wv=function(g,I,e,t,i,A){const n=new Float32Array(A**2),l=-2*t**2,o=A>>1;for(let Z=0;Z<A;Z++){const w=(Z-o)**2;for(let G=0;G<A;G++)n[Z*A+G]=Math.exp((w+(G-o)**2)/l)}const a=new Float32Array(256),d=-2*i**2;for(let Z=0;Z<256;Z++)a[Z]=Math.exp(Z**2/d);const m=g.length,u=new Uint8Array(m),h=new Uint32Array(256);for(let Z=0;Z<e;Z++)for(let w=0;w<I;w++){const G=Z*I+w,B=g[G];let p=0,y=0;for(let R=0;R<A;R++){const M=Z+R-o;if(!(M<0||M>=e))for(let S=0;S<A;S++){const J=w+S-o;if(J<0||J>=I)continue;const D=g[M*I+J],H=n[R*A+S]*a[Math.abs(D-B)];p+=D*H,y+=H}}const Y=u[G]=Math.round(p/y);h[Y]++}return[u,h]},Bv=function(g){const I=new Uint32Array(256);for(const e of g)I[e]++;return I},Y5=function(g){const I=g.length,e=new Uint8ClampedArray(I>>2);let t=-1/0,i=1/0;for(let n=0,l=e.length;n<l;n++){const o=e[n]=g[n<<2];t=Math.max(t,o),i=Math.min(i,o)}const A=255/(t-i);for(let n=0,l=e.length;n<l;n++)e[n]=(e[n]-i)*A;return e},V5=function(g){let I,e=-1/0,t=-1/0;const i=g.findIndex(l=>l!==0);let A=i,n=i;for(I=i;I<256;I++){const l=g[I];l>e&&(I-A>t&&(t=I-A,n=I-1),e=l,A=I)}for(I=n-1;I>=0&&!(g[I]>g[I+1]);I--);return I},pv=function(g){const I=g,{width:e,height:t}=g,{maxDim:i}=c(this,wc);let A=e,n=t;if(e>i||t>i){let m=e,u=t,h=Math.log2(Math.max(e,t)/i);const Z=Math.floor(h);h=h===Z?Z-1:Z;for(let G=0;G<h;G++){A=Math.ceil(m/2),n=Math.ceil(u/2);const B=new OffscreenCanvas(A,n);B.getContext("2d").drawImage(g,0,0,m,u,0,0,A,n),m=A,u=n,g!==I&&g.close(),g=B.transferToImageBitmap()}const w=Math.min(i/A,i/n);A=Math.round(A*w),n=Math.round(n*w)}const o=new OffscreenCanvas(A,n).getContext("2d",{willReadFrequently:!0});o.fillStyle="white",o.fillRect(0,0,A,n),o.filter="grayscale(1)",o.drawImage(g,0,0,g.width,g.height,0,0,A,n);const a=o.getImageData(0,0,A,n).data;return[X(this,pI,Y5).call(this,a),A,n]},f(ll,pI),f(ll,wc,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),f(ll,QA,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class RV extends NS{constructor(){super(),super.updateProperties({fill:qI._defaultLineColor,"stroke-width":0})}clone(){const g=new RV;return g.updateAll(this),g}}class fV extends eW{constructor(g){super(g),super.updateProperties({stroke:qI._defaultLineColor,"stroke-width":1})}clone(){const g=new fV(this._viewParameters);return g.updateAll(this),g}}const Mi=class Mi extends CW{constructor(I){super({...I,mustBeCommitted:!0,name:"signatureEditor"});f(this,xo,!1);f(this,Un,null);f(this,Oo,null);f(this,Wc,null);this._willKeepAspectRatio=!0,V(this,Oo,I.signatureData||null),V(this,Un,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(I,e){qI.initialize(I,e),this._defaultDrawingOptions=new RV,this._defaultDrawnSignatureOptions=new fV(e.viewParameters)}static getDefaultDrawingOptions(I){const e=this._defaultDrawingOptions.clone();return e.updateProperties(I),e}static get supportMultipleDrawings(){return!1}static get typesMap(){return Og(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!c(this,Un)}}static computeTelemetryFinalData(I){const e=I.get("hasDescription");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let I,e;const{_isCopy:t}=this;if(t&&(this._isCopy=!1,I=this.x,e=this.y),super.render(),this._drawId===null)if(c(this,Oo)){const{lines:i,mustSmooth:A,areContours:n,description:l,uuid:o,heightInPage:a}=c(this,Oo),{rawDims:{pageWidth:d,pageHeight:m},rotation:u}=this.parent.viewport,h=ll.processDrawnLines({lines:i,pageWidth:d,pageHeight:m,rotation:u,innerMargin:Mi._INNER_MARGIN,mustSmooth:A,areContours:n});this.addSignature(h,a,l,o)}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:c(this,Un)||""}));return t&&(this._isCopy=!0,this._moveAfterPaste(I,e)),this.div}setUuid(I){V(this,Wc,I),this.addEditToolbar()}getUuid(){return c(this,Wc)}get description(){return c(this,Un)}set description(I){V(this,Un,I),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:I})),super.addEditToolbar().then(e=>{e==null||e.updateEditSignatureButton(I)}))}getSignaturePreview(){const{newCurves:I,areContours:e,thickness:t,width:i,height:A}=c(this,Oo),n=Math.max(i,A),l=ll.processDrawnLines({lines:{curves:I.map(o=>({points:o})),thickness:t,width:i,height:A},pageWidth:n,pageHeight:n,rotation:0,innerMargin:0,mustSmooth:!1,areContours:e});return{areContours:e,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(I,e,t,i){const{x:A,y:n}=this,{outline:l}=V(this,Oo,I);V(this,xo,l instanceof MV),this.description=t;let o;c(this,xo)?o=Mi.getDefaultDrawingOptions():(o=Mi._defaultDrawnSignatureOptions.clone(),o.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:o});const[,a]=this.pageDimensions;let d=e/a;d=d>=1?.5:d,this.width*=d/this.height,this.width>=1&&(d*=.9/this.width,this.width=.9),this.height=d,this.setDims(),this.x=A,this.y=n,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!i,hasDescription:!!t}}),this.div.hidden=!1}getFromImage(I){const{rawDims:{pageWidth:e,pageHeight:t},rotation:i}=this.parent.viewport;return ll.process(I,e,t,i,Mi._INNER_MARGIN)}getFromText(I,e){const{rawDims:{pageWidth:t,pageHeight:i},rotation:A}=this.parent.viewport;return ll.extractContoursFromText(I,e,t,i,A,Mi._INNER_MARGIN)}getDrawnSignature(I){const{rawDims:{pageWidth:e,pageHeight:t},rotation:i}=this.parent.viewport;return ll.processDrawnLines({lines:I,pageWidth:e,pageHeight:t,rotation:i,innerMargin:Mi._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:I,thickness:e}){I?this._drawingOptions=Mi.getDefaultDrawingOptions():(this._drawingOptions=Mi._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":e}))}serialize(I=!1){if(this.isEmpty())return null;const{lines:e,points:t}=this.serializeDraw(I),{_drawingOptions:{"stroke-width":i}}=this,A=Object.assign(super.serialize(I),{isSignature:!0,areContours:c(this,xo),color:[0,0,0],thickness:c(this,xo)?0:i});return this.addComment(A),I?(A.paths={lines:e,points:t},A.uuid=c(this,Wc),A.isCopy=!0):A.lines=e,c(this,Un)&&(A.accessibilityData={type:"Figure",alt:c(this,Un)}),A}static deserializeDraw(I,e,t,i,A,n){return n.areContours?MV.deserialize(I,e,t,i,A,n):Qh.deserialize(I,e,t,i,A,n)}static async deserialize(I,e,t){var A;const i=await super.deserialize(I,e,t);return V(i,xo,I.areContours),i.description=((A=I.accessibilityData)==null?void 0:A.alt)||"",V(i,Wc,I.uuid),i}};xo=new WeakMap,Un=new WeakMap,Oo=new WeakMap,Wc=new WeakMap,cg(Mi,"_type","signature"),cg(Mi,"_editorType",Ug.SIGNATURE),cg(Mi,"_defaultDrawingOptions",null);let XV=Mi;class HV extends qI{constructor(I){super({...I,name:"stampEditor"});f(this,GI);f(this,aC,null);f(this,Ze,null);f(this,Qo,null);f(this,Is,null);f(this,Uo,null);f(this,hu,"");f(this,Cs,null);f(this,Bc,!1);f(this,En,null);f(this,Ri,!1);f(this,bu,!1);V(this,Is,I.bitmapUrl),V(this,Uo,I.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(I,e){qI.initialize(I,e)}static isHandlingMimeForPasting(I){return $Y.includes(I)}static paste(I,e){e.pasteEditor({mode:Ug.STAMP},{bitmapFile:I.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var I;return{type:"stamp",hasAltText:!!((I=this.altTextData)!=null&&I.altText)}}static computeTelemetryFinalData(I){const e=I.get("hasAltText");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}async mlGuessAltText(I=null,e=!0){if(this.hasAltTextData())return null;const{mlManager:t}=this._uiManager;if(!t)throw new Error("No ML.");if(!await t.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:i,width:A,height:n}=I||this.copyCanvas(null,null,!0).imageData,l=await t.guess({name:"altText",request:{data:i,width:A,height:n,channels:i.length/(A*n)}});if(!l)throw new Error("No response from the AI service.");if(l.error)throw new Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw new Error("No valid response from the AI service.");const o=l.output;return await this.setGuessedAltText(o),e&&!this.hasAltTextData()&&(this.altTextData={alt:o,decorative:!1}),o}remove(){var I;c(this,Ze)&&(V(this,aC,null),this._uiManager.imageManager.deleteId(c(this,Ze)),(I=c(this,Cs))==null||I.remove(),V(this,Cs,null),c(this,En)&&(clearTimeout(c(this,En)),V(this,En,null))),super.remove()}rebuild(){if(!this.parent){c(this,Ze)&&X(this,GI,f2).call(this);return}super.rebuild(),this.div!==null&&(c(this,Ze)&&c(this,Cs)===null&&X(this,GI,f2).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(I){this._isDraggable=!0,I&&this.div.focus()}isEmpty(){return!(c(this,Qo)||c(this,aC)||c(this,Is)||c(this,Uo)||c(this,Ze)||c(this,Bc))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let I,e;return this._isCopy&&(I=this.x,e=this.y),super.render(),this.div.hidden=!0,this.createAltText(),c(this,Bc)||(c(this,aC)?X(this,GI,X2).call(this):X(this,GI,f2).call(this)),this._isCopy&&this._moveAfterPaste(I,e),this._uiManager.addShouldRescale(this),this.div}setCanvas(I,e){const{id:t,bitmap:i}=this._uiManager.imageManager.getFromCanvas(I,e);e.remove(),t&&this._uiManager.imageManager.isValidId(t)&&(V(this,Ze,t),i&&V(this,aC,i),V(this,Bc,!1),X(this,GI,X2).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;c(this,En)!==null&&clearTimeout(c(this,En)),V(this,En,setTimeout(()=>{V(this,En,null),X(this,GI,N5).call(this)},200))}copyCanvas(I,e,t=!1){I||(I=224);const{width:i,height:A}=c(this,aC),n=new un;let l=c(this,aC),o=i,a=A,d=null;if(e){if(i>e||A>e){const M=Math.min(e/i,e/A);o=Math.floor(i*M),a=Math.floor(A*M)}d=document.createElement("canvas");const u=d.width=Math.ceil(o*n.sx),h=d.height=Math.ceil(a*n.sy);c(this,Ri)||(l=X(this,GI,H2).call(this,u,h));const Z=d.getContext("2d");Z.filter=this._uiManager.hcmFilter;let w="white",G="#cfcfd8";this._uiManager.hcmFilter!=="none"?G="black":wvg.isDarkMode&&(w="#8f8f9d",G="#42414d");const B=15,p=B*n.sx,y=B*n.sy,Y=new OffscreenCanvas(p*2,y*2),R=Y.getContext("2d");R.fillStyle=w,R.fillRect(0,0,p*2,y*2),R.fillStyle=G,R.fillRect(0,0,p,y),R.fillRect(p,y,p,y),Z.fillStyle=Z.createPattern(Y,"repeat"),Z.fillRect(0,0,u,h),Z.drawImage(l,0,0,l.width,l.height,0,0,u,h)}let m=null;if(t){let u,h;if(n.symmetric&&l.width<I&&l.height<I)u=l.width,h=l.height;else if(l=c(this,aC),i>I||A>I){const G=Math.min(I/i,I/A);u=Math.floor(i*G),h=Math.floor(A*G),c(this,Ri)||(l=X(this,GI,H2).call(this,u,h))}const w=new OffscreenCanvas(u,h).getContext("2d",{willReadFrequently:!0});w.drawImage(l,0,0,l.width,l.height,0,0,u,h),m={width:u,height:h,data:w.getImageData(0,0,u,h).data}}return{canvas:d,width:o,height:a,imageData:m}}static async deserialize(I,e,t){var w;let i=null,A=!1;if(I instanceof YS){const{data:{rect:G,rotation:B,id:p,structParent:y,popupRef:Y,richText:R,contentsObj:M,creationDate:S,modificationDate:J},container:D,parent:{page:{pageNumber:H}},canvas:F}=I;let x,q;F?(delete I.canvas,{id:x,bitmap:q}=t.imageManager.getFromCanvas(D.id,F),F.remove()):(A=!0,I._hasNoCanvas=!0);const gg=((w=await e._structTree.getAriaAttributes(`${cr}${p}`))==null?void 0:w.get("aria-label"))||"";i=I={annotationType:Ug.STAMP,bitmapId:x,bitmap:q,pageIndex:H-1,rect:G.slice(0),rotation:B,annotationElementId:p,id:p,deleted:!1,accessibilityData:{decorative:!1,altText:gg},isSvg:!1,structParent:y,popupRef:Y,richText:R,comment:(M==null?void 0:M.str)||null,creationDate:S,modificationDate:J}}const n=await super.deserialize(I,e,t),{rect:l,bitmap:o,bitmapUrl:a,bitmapId:d,isSvg:m,accessibilityData:u}=I;A?(t.addMissingCanvas(I.id,n),V(n,Bc,!0)):d&&t.imageManager.isValidId(d)?(V(n,Ze,d),o&&V(n,aC,o)):V(n,Is,a),V(n,Ri,m);const[h,Z]=n.pageDimensions;return n.width=(l[2]-l[0])/h,n.height=(l[3]-l[1])/Z,u&&(n.altTextData=u),n._initialData=i,I.comment&&n.setCommentData(I),V(n,bu,!!i),n}serialize(I=!1,e=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const t=Object.assign(super.serialize(I),{bitmapId:c(this,Ze),isSvg:c(this,Ri)});if(this.addComment(t),I)return t.bitmapUrl=X(this,GI,D2).call(this,!0),t.accessibilityData=this.serializeAltText(!0),t.isCopy=!0,t;const{decorative:i,altText:A}=this.serializeAltText(!1);if(!i&&A&&(t.accessibilityData={type:"Figure",alt:A}),this.annotationElementId){const l=X(this,GI,yv).call(this,t);return l.isSame?null:(l.isSameAltText?delete t.accessibilityData:t.accessibilityData.structParent=this._initialData.structParent??-1,t.id=this.annotationElementId,delete t.bitmapId,t)}if(e===null)return t;e.stamps||(e.stamps=new Map);const n=c(this,Ri)?(t.rect[2]-t.rect[0])*(t.rect[3]-t.rect[1]):null;if(!e.stamps.has(c(this,Ze)))e.stamps.set(c(this,Ze),{area:n,serialized:t}),t.bitmap=X(this,GI,D2).call(this,!1);else if(c(this,Ri)){const l=e.stamps.get(c(this,Ze));n>l.area&&(l.area=n,l.serialized.bitmap.close(),l.serialized.bitmap=X(this,GI,D2).call(this,!1))}return t}renderAnnotationElement(I){return this.deleted?(I.hide(),null):(I.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}aC=new WeakMap,Ze=new WeakMap,Qo=new WeakMap,Is=new WeakMap,Uo=new WeakMap,hu=new WeakMap,Cs=new WeakMap,Bc=new WeakMap,En=new WeakMap,Ri=new WeakMap,bu=new WeakMap,GI=new WeakSet,hG=function(I,e=!1){if(!I){this.remove();return}V(this,aC,I.bitmap),e||(V(this,Ze,I.id),V(this,Ri,I.isSvg)),I.file&&V(this,hu,I.file.name),X(this,GI,X2).call(this)},bG=function(){if(V(this,Qo,null),this._uiManager.enableWaiting(!1),!!c(this,Cs)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&c(this,aC)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&c(this,aC)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},f2=function(){if(c(this,Ze)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(c(this,Ze)).then(t=>X(this,GI,hG).call(this,t,!0)).finally(()=>X(this,GI,bG).call(this));return}if(c(this,Is)){const t=c(this,Is);V(this,Is,null),this._uiManager.enableWaiting(!0),V(this,Qo,this._uiManager.imageManager.getFromUrl(t).then(i=>X(this,GI,hG).call(this,i)).finally(()=>X(this,GI,bG).call(this)));return}if(c(this,Uo)){const t=c(this,Uo);V(this,Uo,null),this._uiManager.enableWaiting(!0),V(this,Qo,this._uiManager.imageManager.getFromFile(t).then(i=>X(this,GI,hG).call(this,i)).finally(()=>X(this,GI,bG).call(this)));return}const I=document.createElement("input");I.type="file",I.accept=$Y.join(",");const e=this._uiManager._signal;V(this,Qo,new Promise(t=>{I.addEventListener("change",async()=>{if(!I.files||I.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const i=await this._uiManager.imageManager.getFromFile(I.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),X(this,GI,hG).call(this,i)}t()},{signal:e}),I.addEventListener("cancel",()=>{this.remove(),t()},{signal:e})}).finally(()=>X(this,GI,bG).call(this))),I.click()},X2=function(){var o;const{div:I}=this;let{width:e,height:t}=c(this,aC);const[i,A]=this.pageDimensions,n=.75;if(this.width)e=this.width*i,t=this.height*A;else if(e>n*i||t>n*A){const a=Math.min(n*i/e,n*A/t);e*=a,t*=a}this._uiManager.enableWaiting(!1);const l=V(this,Cs,document.createElement("canvas"));l.setAttribute("role","img"),this.addContainer(l),this.width=e/i,this.height=t/A,this.setDims(),(o=this._initialOptions)!=null&&o.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(I.hidden=!1),X(this,GI,N5).call(this),c(this,bu)||(this.parent.addUndoableEditor(this),V(this,bu,!0)),this._reportTelemetry({action:"inserted_image"}),c(this,hu)&&this.div.setAttribute("aria-description",c(this,hu)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},H2=function(I,e){const{width:t,height:i}=c(this,aC);let A=t,n=i,l=c(this,aC);for(;A>2*I||n>2*e;){const o=A,a=n;A>2*I&&(A=A>=16384?Math.floor(A/2)-1:Math.ceil(A/2)),n>2*e&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2));const d=new OffscreenCanvas(A,n);d.getContext("2d").drawImage(l,0,0,o,a,0,0,A,n),l=d.transferToImageBitmap()}return l},N5=function(){const[I,e]=this.parentDimensions,{width:t,height:i}=this,A=new un,n=Math.ceil(t*I*A.sx),l=Math.ceil(i*e*A.sy),o=c(this,Cs);if(!o||o.width===n&&o.height===l)return;o.width=n,o.height=l;const a=c(this,Ri)?c(this,aC):X(this,GI,H2).call(this,n,l),d=o.getContext("2d");d.filter=this._uiManager.hcmFilter,d.drawImage(a,0,0,a.width,a.height,0,0,n,l)},D2=function(I){if(I){if(c(this,Ri)){const i=this._uiManager.imageManager.getSvgUrl(c(this,Ze));if(i)return i}const e=document.createElement("canvas");return{width:e.width,height:e.height}=c(this,aC),e.getContext("2d").drawImage(c(this,aC),0,0),e.toDataURL()}if(c(this,Ri)){const[e,t]=this.pageDimensions,i=Math.round(this.width*e*zs.PDF_TO_CSS_UNITS),A=Math.round(this.height*t*zs.PDF_TO_CSS_UNITS),n=new OffscreenCanvas(i,A);return n.getContext("2d").drawImage(c(this,aC),0,0,c(this,aC).width,c(this,aC).height,0,0,i,A),n.transferToImageBitmap()}return structuredClone(c(this,aC))},yv=function(I){var n;const{pageIndex:e,accessibilityData:{altText:t}}=this._initialData,i=I.pageIndex===e,A=(((n=I.accessibilityData)==null?void 0:n.alt)||"")===t;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&i&&A,isSameAltText:A}},cg(HV,"_type","stamp"),cg(HV,"_editorType",Ug.STAMP);const EA=class EA{constructor({uiManager:g,pageIndex:I,div:e,structTreeLayer:t,accessibilityManager:i,annotationLayer:A,drawLayer:n,textLayer:l,viewport:o,l10n:a}){f(this,EI);f(this,pc);f(this,Zu,!1);f(this,Eo,null);f(this,Po,null);f(this,es,null);f(this,Pt,new Map);f(this,_o,!1);f(this,Gu,!1);f(this,wu,!1);f(this,UA,null);f(this,ts,null);f(this,Ge,null);f(this,is,null);f(this,$o,null);f(this,Wu,-1);f(this,Xg);const d=[...c(EA,qo).values()];if(!EA._initialized){EA._initialized=!0;for(const m of d)m.initialize(a,g)}g.registerEditorTypes(d),V(this,Xg,g),this.pageIndex=I,this.div=e,V(this,pc,i),V(this,Eo,A),this.viewport=o,V(this,Ge,l),this.drawLayer=n,this._structTree=t,c(this,Xg).addLayer(this)}get isEmpty(){return c(this,Pt).size===0}get isInvisible(){return this.isEmpty&&c(this,Xg).getMode()===Ug.NONE}updateToolbar(g){c(this,Xg).updateToolbar(g)}updateMode(g=c(this,Xg).getMode()){switch(X(this,EI,S2).call(this),g){case Ug.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Ug.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case Ug.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),g===Ug.POPUP)I.toggle("commentEditing",!0);else{I.toggle("commentEditing",!1);for(const e of c(EA,qo).values())I.toggle(`${e._type}Editing`,g===e._editorType)}this.div.hidden=!1}hasTextLayer(g){var I;return g===((I=c(this,Ge))==null?void 0:I.div)}setEditingState(g){c(this,Xg).setEditingState(g)}addCommands(g){c(this,Xg).addCommands(g)}cleanUndoStack(g){c(this,Xg).cleanUndoStack(g)}toggleDrawing(g=!1){this.div.classList.toggle("drawing",!g)}togglePointerEvents(g=!1){this.div.classList.toggle("disabled",!g)}toggleAnnotationLayerPointerEvents(g=!1){var I;(I=c(this,Eo))==null||I.togglePointerEvents(g)}async enable(){var e;V(this,wu,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),(e=c(this,$o))==null||e.abort(),V(this,$o,null);const g=new Set;for(const t of c(this,EI,M5))t.enableEditing(),t.show(!0),t.annotationElementId&&(c(this,Xg).removeChangedExistingAnnotation(t),g.add(t.annotationElementId));const I=c(this,Eo);if(I)for(const t of I.getEditableAnnotations()){if(t.hide(),c(this,Xg).isDeletedAnnotationElement(t.data.id)||g.has(t.data.id))continue;const i=await this.deserialize(t);i&&(this.addOrRebuild(i),i.enableEditing())}V(this,wu,!1),c(this,Xg)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){var t;if(V(this,Gu,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),c(this,Ge)&&!c(this,$o)){V(this,$o,new AbortController);const i=c(this,Xg).combinedSignal(c(this,$o));c(this,Ge).div.addEventListener("pointerdown",A=>{const{clientX:l,clientY:o,timeStamp:a}=A,d=c(this,Wu);if(a-d>500){V(this,Wu,a);return}V(this,Wu,-1);const{classList:m}=this.div;m.toggle("getElements",!0);const u=document.elementsFromPoint(l,o);if(m.toggle("getElements",!1),!this.div.contains(u[0]))return;let h;const Z=new RegExp(`^${Rh}[0-9]+$`);for(const G of u)if(Z.test(G.id)){h=G.id;break}if(!h)return;const w=c(this,Pt).get(h);(w==null?void 0:w.annotationElementId)===null&&(A.stopPropagation(),A.preventDefault(),w.dblclick(A))},{signal:i,capture:!0})}const g=c(this,Eo),I=[];if(g){const i=new Map,A=new Map;for(const l of c(this,EI,M5)){if(l.disableEditing(),!l.annotationElementId){I.push(l);continue}if(l.serialize()!==null){i.set(l.annotationElementId,l);continue}else A.set(l.annotationElementId,l);(t=this.getEditableAnnotation(l.annotationElementId))==null||t.show(),l.remove()}const n=g.getEditableAnnotations();for(const l of n){const{id:o}=l.data;if(c(this,Xg).isDeletedAnnotationElement(o)){l.updateEdited({deleted:!0});continue}let a=A.get(o);if(a){a.resetAnnotationElement(l),a.show(!1),l.show();continue}a=i.get(o),a&&(c(this,Xg).addChangedExistingAnnotation(a),a.renderAnnotationElement(l)&&a.show(!1)),l.show()}}X(this,EI,S2).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:e}=this.div;for(const i of c(EA,qo).values())e.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),g==null||g.updateFakeAnnotations(I),V(this,Gu,!1)}getEditableAnnotation(g){var I;return((I=c(this,Eo))==null?void 0:I.getEditableAnnotation(g))||null}setActiveEditor(g){c(this,Xg).getActive()!==g&&c(this,Xg).setActiveEditor(g)}enableTextSelection(){var g;if(this.div.tabIndex=-1,(g=c(this,Ge))!=null&&g.div&&!c(this,is)){V(this,is,new AbortController);const I=c(this,Xg).combinedSignal(c(this,is));c(this,Ge).div.addEventListener("pointerdown",X(this,EI,Yv).bind(this),{signal:I}),c(this,Ge).div.classList.add("highlighting")}}disableTextSelection(){var g;this.div.tabIndex=0,(g=c(this,Ge))!=null&&g.div&&c(this,is)&&(c(this,is).abort(),V(this,is,null),c(this,Ge).div.classList.remove("highlighting"))}enableClick(){if(c(this,Po))return;V(this,Po,new AbortController);const g=c(this,Xg).combinedSignal(c(this,Po));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:g});const I=this.pointerup.bind(this);this.div.addEventListener("pointerup",I,{signal:g}),this.div.addEventListener("pointercancel",I,{signal:g})}disableClick(){var g;(g=c(this,Po))==null||g.abort(),V(this,Po,null)}attach(g){c(this,Pt).set(g.id,g);const{annotationElementId:I}=g;I&&c(this,Xg).isDeletedAnnotationElement(I)&&c(this,Xg).removeDeletedAnnotationElement(g)}detach(g){var I;c(this,Pt).delete(g.id),(I=c(this,pc))==null||I.removePointerInTextLayer(g.contentDiv),!c(this,Gu)&&g.annotationElementId&&c(this,Xg).addDeletedAnnotationElement(g)}remove(g){this.detach(g),c(this,Xg).removeEditor(g),g.div.remove(),g.isAttachedToDOM=!1}changeParent(g){var I;g.parent!==this&&(g.parent&&g.annotationElementId&&(c(this,Xg).addDeletedAnnotationElement(g),qI.deleteAnnotationElement(g),g.annotationElementId=null),this.attach(g),(I=g.parent)==null||I.detach(g),g.setParent(this),g.div&&g.isAttachedToDOM&&(g.div.remove(),this.div.append(g.div)))}add(g){if(!(g.parent===this&&g.isAttachedToDOM)){if(this.changeParent(g),c(this,Xg).addEditor(g),this.attach(g),!g.isAttachedToDOM){const I=g.render();this.div.append(I),g.isAttachedToDOM=!0}g.fixAndSetPosition(),g.onceAdded(!c(this,wu)),c(this,Xg).addToAnnotationStorage(g),g._reportTelemetry(g.telemetryInitialData)}}moveEditorInDOM(g){var e;if(!g.isAttachedToDOM)return;const{activeElement:I}=document;g.div.contains(I)&&!c(this,es)&&(g._focusEventsAllowed=!1,V(this,es,setTimeout(()=>{V(this,es,null),g.div.contains(document.activeElement)?g._focusEventsAllowed=!0:(g.div.addEventListener("focusin",()=>{g._focusEventsAllowed=!0},{once:!0,signal:c(this,Xg)._signal}),I.focus())},0))),g._structTreeParentId=(e=c(this,pc))==null?void 0:e.moveElementInDOM(this.div,g.div,g.contentDiv,!0)}addOrRebuild(g){g.needsToBeRebuilt()?(g.parent||(g.parent=this),g.rebuild(),g.show()):this.add(g)}addUndoableEditor(g){const I=()=>g._uiManager.rebuild(g),e=()=>{g.remove()};this.addCommands({cmd:I,undo:e,mustExec:!1})}getEditorByUID(g){for(const I of c(this,Pt).values())if(I.uid===g)return I;return null}getNextId(){return c(this,Xg).getId()}combinedSignal(g){return c(this,Xg).combinedSignal(g)}canCreateNewEmptyEditor(){var g;return(g=c(this,EI,Cl))==null?void 0:g.canCreateNewEmptyEditor()}async pasteEditor(g,I){this.updateToolbar(g),await c(this,Xg).updateMode(g.mode);const{offsetX:e,offsetY:t}=X(this,EI,f5).call(this),i=this.getNextId(),A=X(this,EI,R5).call(this,{parent:this,id:i,x:e,y:t,uiManager:c(this,Xg),isCentered:!0,...I});A&&this.add(A)}async deserialize(g){var I;return await((I=c(EA,qo).get(g.annotationType??g.annotationEditorType))==null?void 0:I.deserialize(g,this,c(this,Xg)))||null}createAndAddNewEditor(g,I,e={}){const t=this.getNextId(),i=X(this,EI,R5).call(this,{parent:this,id:t,x:g.offsetX,y:g.offsetY,uiManager:c(this,Xg),isCentered:I,...e});return i&&this.add(i),i}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(g={}){this.createAndAddNewEditor(X(this,EI,f5).call(this),!0,g)}setSelected(g){c(this,Xg).setSelected(g)}toggleSelected(g){c(this,Xg).toggleSelected(g)}unselect(g){c(this,Xg).unselect(g)}pointerup(g){var t;const{isMac:I}=ye.platform;if(g.button!==0||g.ctrlKey&&I||g.target!==this.div||!c(this,_o)||(V(this,_o,!1),(t=c(this,EI,Cl))!=null&&t.isDrawer&&c(this,EI,Cl).supportMultipleDrawings))return;if(!c(this,Zu)){V(this,Zu,!0);return}const e=c(this,Xg).getMode();if(e===Ug.STAMP||e===Ug.SIGNATURE){c(this,Xg).unselectAll();return}this.createAndAddNewEditor(g,!1)}pointerdown(g){var t;if(c(this,Xg).getMode()===Ug.HIGHLIGHT&&this.enableTextSelection(),c(this,_o)){V(this,_o,!1);return}const{isMac:I}=ye.platform;if(g.button!==0||g.ctrlKey&&I||g.target!==this.div)return;if(V(this,_o,!0),(t=c(this,EI,Cl))!=null&&t.isDrawer){this.startDrawingSession(g);return}const e=c(this,Xg).getActive();V(this,Zu,!e||e.isEmpty())}startDrawingSession(g){if(this.div.focus({preventScroll:!0}),c(this,UA)){c(this,EI,Cl).startDrawing(this,c(this,Xg),!1,g);return}c(this,Xg).setCurrentDrawingSession(this),V(this,UA,new AbortController);const I=c(this,Xg).combinedSignal(c(this,UA));this.div.addEventListener("blur",({relatedTarget:e})=>{e&&!this.div.contains(e)&&(V(this,ts,null),this.commitOrRemove())},{signal:I}),c(this,EI,Cl).startDrawing(this,c(this,Xg),!1,g)}pause(g){if(g){const{activeElement:I}=document;this.div.contains(I)&&V(this,ts,I);return}c(this,ts)&&setTimeout(()=>{var I;(I=c(this,ts))==null||I.focus(),V(this,ts,null)},0)}endDrawingSession(g=!1){return c(this,UA)?(c(this,Xg).setCurrentDrawingSession(null),c(this,UA).abort(),V(this,UA,null),V(this,ts,null),c(this,EI,Cl).endDrawing(g)):null}findNewParent(g,I,e){const t=c(this,Xg).findParent(I,e);return t===null||t===this?!1:(t.changeParent(g),!0)}commitOrRemove(){return c(this,UA)?(this.endDrawingSession(),!0):!1}onScaleChanging(){c(this,UA)&&c(this,EI,Cl).onScaleChangingWhenDrawing(this)}destroy(){var g,I;this.commitOrRemove(),((g=c(this,Xg).getActive())==null?void 0:g.parent)===this&&(c(this,Xg).commitOrRemove(),c(this,Xg).setActiveEditor(null)),c(this,es)&&(clearTimeout(c(this,es)),V(this,es,null));for(const e of c(this,Pt).values())(I=c(this,pc))==null||I.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,c(this,Pt).clear(),c(this,Xg).removeLayer(this)}render({viewport:g}){this.viewport=g,za(this.div,g);for(const I of c(this,Xg).getEditors(this.pageIndex))this.add(I),I.rebuild();this.updateMode()}update({viewport:g}){c(this,Xg).commitOrRemove(),X(this,EI,S2).call(this);const I=this.viewport.rotation,e=g.rotation;if(this.viewport=g,za(this.div,{rotation:e}),I!==e)for(const t of c(this,Pt).values())t.rotate(e)}get pageDimensions(){const{pageWidth:g,pageHeight:I}=this.viewport.rawDims;return[g,I]}get scale(){return c(this,Xg).viewParameters.realScale}};pc=new WeakMap,Zu=new WeakMap,Eo=new WeakMap,Po=new WeakMap,es=new WeakMap,Pt=new WeakMap,_o=new WeakMap,Gu=new WeakMap,wu=new WeakMap,UA=new WeakMap,ts=new WeakMap,Ge=new WeakMap,is=new WeakMap,$o=new WeakMap,Wu=new WeakMap,Xg=new WeakMap,qo=new WeakMap,EI=new WeakSet,M5=function(){return c(this,Pt).size!==0?c(this,Pt).values():c(this,Xg).getEditors(this.pageIndex)},Yv=function(g){c(this,Xg).unselectAll();const{target:I}=g;if(I===c(this,Ge).div||(I.getAttribute("role")==="img"||I.classList.contains("endOfContent"))&&c(this,Ge).div.contains(I)){const{isMac:e}=ye.platform;if(g.button!==0||g.ctrlKey&&e)return;c(this,Xg).showAllEditors("highlight",!0,!0),c(this,Ge).div.classList.add("free"),this.toggleDrawing(),IW.startHighlighting(this,c(this,Xg).direction==="ltr",{target:c(this,Ge).div,x:g.x,y:g.y}),c(this,Ge).div.addEventListener("pointerup",()=>{c(this,Ge).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:c(this,Xg)._signal}),g.preventDefault()}},Cl=function(){return c(EA,qo).get(c(this,Xg).getMode())},R5=function(g){const I=c(this,EI,Cl);return I?new I.prototype.constructor(g):null},f5=function(){const{x:g,y:I,width:e,height:t}=this.boundingClientRect,i=Math.max(0,g),A=Math.max(0,I),n=Math.min(window.innerWidth,g+e),l=Math.min(window.innerHeight,I+t),o=(i+n)/2-g,a=(A+l)/2-I,[d,m]=this.viewport.rotation%180===0?[o,a]:[a,o];return{offsetX:d,offsetY:m}},S2=function(){for(const g of c(this,Pt).values())g.isEmpty()&&g.remove()},cg(EA,"_initialized",!1),f(EA,qo,new Map([yV,NV,HV,IW,XV].map(g=>[g._editorType,g])));let DV=EA;const te=class te{constructor({pageIndex:g}){f(this,Pn);f(this,PA,null);f(this,yt,new Map);f(this,yc,new Map);this.pageIndex=g}setParent(g){if(!c(this,PA)){V(this,PA,g);return}if(c(this,PA)!==g){if(c(this,yt).size>0)for(const I of c(this,yt).values())I.remove(),g.append(I);V(this,PA,g)}}static get _svgFactory(){return Og(this,"_svgFactory",new $w)}draw(g,I=!1,e=!1){const t=ne(te,HZ)._++,i=X(this,Pn,X5).call(this),A=te._svgFactory.createElement("defs");i.append(A);const n=te._svgFactory.createElement("path");A.append(n);const l=`path_p${this.pageIndex}_${t}`;n.setAttribute("id",l),n.setAttribute("vector-effect","non-scaling-stroke"),I&&c(this,yc).set(t,n);const o=e?X(this,Pn,Nv).call(this,A,l):null,a=te._svgFactory.createElement("use");return i.append(a),a.setAttribute("href",`#${l}`),this.updateProperties(i,g),c(this,yt).set(t,i),{id:t,clipPathId:`url(#${o})`}}drawOutline(g,I){const e=ne(te,HZ)._++,t=X(this,Pn,X5).call(this),i=te._svgFactory.createElement("defs");t.append(i);const A=te._svgFactory.createElement("path");i.append(A);const n=`path_p${this.pageIndex}_${e}`;A.setAttribute("id",n),A.setAttribute("vector-effect","non-scaling-stroke");let l;if(I){const d=te._svgFactory.createElement("mask");i.append(d),l=`mask_p${this.pageIndex}_${e}`,d.setAttribute("id",l),d.setAttribute("maskUnits","objectBoundingBox");const m=te._svgFactory.createElement("rect");d.append(m),m.setAttribute("width","1"),m.setAttribute("height","1"),m.setAttribute("fill","white");const u=te._svgFactory.createElement("use");d.append(u),u.setAttribute("href",`#${n}`),u.setAttribute("stroke","none"),u.setAttribute("fill","black"),u.setAttribute("fill-rule","nonzero"),u.classList.add("mask")}const o=te._svgFactory.createElement("use");t.append(o),o.setAttribute("href",`#${n}`),l&&o.setAttribute("mask",`url(#${l})`);const a=o.cloneNode();return t.append(a),o.classList.add("mainOutline"),a.classList.add("secondaryOutline"),this.updateProperties(t,g),c(this,yt).set(e,t),e}finalizeDraw(g,I){c(this,yc).delete(g),this.updateProperties(g,I)}updateProperties(g,I){var l;if(!I)return;const{root:e,bbox:t,rootClass:i,path:A}=I,n=typeof g=="number"?c(this,yt).get(g):g;if(n){if(e&&X(this,Pn,H5).call(this,n,e),t&&X(l=te,rp,Vv).call(l,n,t),i){const{classList:o}=n;for(const[a,d]of Object.entries(i))o.toggle(a,d)}if(A){const a=n.firstElementChild.firstElementChild;X(this,Pn,H5).call(this,a,A)}}}updateParent(g,I){if(I===this)return;const e=c(this,yt).get(g);e&&(c(I,PA).append(e),c(this,yt).delete(g),c(I,yt).set(g,e))}remove(g){c(this,yc).delete(g),c(this,PA)!==null&&(c(this,yt).get(g).remove(),c(this,yt).delete(g))}destroy(){V(this,PA,null);for(const g of c(this,yt).values())g.remove();c(this,yt).clear(),c(this,yc).clear()}};PA=new WeakMap,yt=new WeakMap,yc=new WeakMap,HZ=new WeakMap,rp=new WeakSet,Vv=function(g,[I,e,t,i]){const{style:A}=g;A.top=`${100*e}%`,A.left=`${100*I}%`,A.width=`${100*t}%`,A.height=`${100*i}%`},Pn=new WeakSet,X5=function(){const g=te._svgFactory.create(1,1,!0);return c(this,PA).append(g),g.setAttribute("aria-hidden",!0),g},Nv=function(g,I){const e=te._svgFactory.createElement("clipPath");g.append(e);const t=`clip_${I}`;e.setAttribute("id",t),e.setAttribute("clipPathUnits","objectBoundingBox");const i=te._svgFactory.createElement("use");return e.append(i),i.setAttribute("href",`#${I}`),i.classList.add("clip"),t},H5=function(g,I){for(const[e,t]of Object.entries(I))t===null?g.removeAttribute(e):g.setAttribute(e,t)},f(te,rp),f(te,HZ,0);let SV=te;globalThis._pdfjsTestingUtils={HighlightOutliner:YV},globalThis.pdfjsLib={AbortException:ks,AnnotationEditorLayer:DV,AnnotationEditorParamsType:mI,AnnotationEditorType:Ug,AnnotationEditorUIManager:Fa,AnnotationLayer:pV,AnnotationMode:Ks,AnnotationType:TC,applyOpacity:Bvg,build:Rjg,ColorPicker:Pw,createValidAbsoluteUrl:YD,CSSConstants:Wvg,DOMSVGFactory:$w,DrawLayer:SV,FeatureTest:ye,fetchData:Sh,findContrastColor:pvg,getDocument:hV,getFilenameFromUrl:uvg,getPdfFilenameFromUrl:hvg,getRGB:zh,getUuid:fD,getXfaPageViewport:Zvg,GlobalWorkerOptions:bn,ImageKind:Rw,InvalidPDFException:UY,isDataScheme:Sw,isPdfFile:rr,isValidExplicitDest:Dvg,MathClamp:mt,noContextMenu:Ji,normalizeUnicode:cvg,OPS:fh,OutputScale:un,PasswordResponses:tvg,PDFDataRangeTransport:ZS,PDFDateString:Kw,PDFWorker:xh,PermissionFlag:evg,PixelsPerInch:zs,RenderingCancelledException:_Y,renderRichText:FD,ResponseException:Dw,setLayerDimensions:za,shadow:Og,SignatureExtractor:ll,stopEvent:wC,SupportedImageMimeTypes:$Y,TextLayer:jh,TouchManager:Fw,updateUrlHash:VD,Util:Mg,VerbosityLevel:fw,version:Mjg,XfaLayer:HD};class gxg{constructor(){cg(this,"cache",{});cg(this,"cachePage",{})}setCache(g,I){this.cache[g]=I}getCache(g){return this.cache[g]}setPageCache(g,I){this.cachePage[g]=I}getPageCache(g){return this.cachePage[g]}}const Ta=new gxg,Ixg=["src"],sl=s.defineComponent({name:"PdfPreview",__name:"PdfPreview",props:{src:{},page:{}},emits:["load","error"],setup(C,{expose:g,emit:I}){bn.workerSrc=Cvg;const e=C,t=I,i=s.reactive({isError:!1,rotate:0}),A=s.ref(null);let n,l=null;s.watch([()=>e.src,()=>e.page],()=>{n==null||n.disconnect(),m(),i.isError=!1,s.nextTick(()=>{d()})}),s.watch(()=>e.src,()=>{i.rotate=0});const o=async()=>{try{if(!A.value||!e.src)throw new Error("Canvas not found");l&&(l==null||l.cancel(),l=null);let u;const h=Ta.getCache(e.src);if(h?u=h:(u=await hV(e.src).promise,Ta.setCache(e.src,u)),!u)throw new Error("Pdf not found");const Z=e.page??1,w=`${e.src}-${Z}`,G=Ta.getPageCache(w);let B;G?B=G:(B=await u.getPage(Z),Ta.setPageCache(w,B));const p=A.value.getBoundingClientRect(),y=B.getViewport({scale:1}),Y=p.width/y.width,R=p.height/y.height,M=Math.min(Y,R),S=window.devicePixelRatio||1,J=B.getViewport({scale:M*S,rotation:i.rotate}),D=A.value.getContext("2d");if(D===null)throw new Error("Context not found");A.value.width=J.width,A.value.height=J.height;const H=B.render({canvas:A.value,canvasContext:D,viewport:J});l=H,await H.promise,t("load")}catch(u){if(u&&typeof u=="object"&&"name"in u&&(u==null?void 0:u.name)==="RenderingCancelledException")return;console.error(u),i.isError=!0,t("error",u)}finally{l=null}},a=async u=>{try{if(!A.value)return;const h=Ta.getPageCache(`${e.src}-${e.page}`);if(!h)return;const Z=A.value.getContext("2d");if(!Z)return;const w=Math.round(u/90)*90;i.rotate+=w;const{width:G,height:B}=A.value;Z.clearRect(0,0,G,B);const p=h.getViewport({scale:1,rotation:i.rotate});A.value.width=p.width,A.value.height=p.height;const y=h.render({canvas:A.value,canvasContext:Z,viewport:p});l=y,await y.promise,t("load")}catch(h){if(h&&typeof h=="object"&&"name"in h&&(h==null?void 0:h.name)==="RenderingCancelledException")return;console.error(h),i.isError=!0}finally{l=null}},d=()=>{A.value&&(n=new IntersectionObserver((u,h)=>{u.forEach(Z=>{Z.isIntersecting&&(o(),h.unobserve(Z.target))},{rootMargin:"50px"})}),n.observe(A.value))},m=()=>{if(!A.value)return;const u=A.value.getContext("2d");u&&u.clearRect(0,0,A.value.width,A.value.height)};return g({clearCanvas:m,rotatePdf:a}),s.onMounted(()=>{d()}),(u,h)=>i.isError?(s.openBlock(),s.createElementBlock("img",{key:1,src:s.unref(rn)},null,8,Ixg)):(s.openBlock(),s.createElementBlock("canvas",{key:0,ref_key:"canvas",ref:A},null,512))}});var KV=(C=>(C.slideTop="slide-top",C.slideLeft="slide-left",C.fadeAndScale="fade-and-scale",C.fade="fade",C))(KV||{});const Cxg=()=>{const C=s.ref(0),g=s.ref([]),I=s.ref(null),e=l=>{g.value.push(l),i(l),A()},t=()=>{g.value.pop(),n(),g.value.length?i(g.value[g.value.length-1]):I.value=null},i=l=>{I.value=l},A=()=>{C.value+=1},n=()=>{C.value>0&&(C.value-=1)};return{countOpenedModal:C,openedModals:g,lastOpenedModal:I,addOpenedModal:e,reduceOpenedModal:t,setLastOpenedModal:i,incrementCountModal:A,decrementCountModal:n}},exg=["data-testid"],txg=["data-testid"],MS=Rg(s.defineComponent({__name:"Modal",props:{open:{type:Boolean},position:{default:"right"},width:{},height:{},disableCloseOnOutsideClick:{type:Boolean,default:!1},dataTestid:{default:"Modal"}},emits:["close","unmounted"],setup(C,{expose:g,emit:I}){const{lastOpenedModal:e,addOpenedModal:t,reduceOpenedModal:i}=Cxg(),A=C,n=s.ref(null),l=s.useAttrs(),o=s.ref(!1),a=s.computed(()=>({width:A.width,height:A.height})),d=I;let m=0;const u=()=>{m=Date.now(),n.value&&(A.open?(n.value.showModal(),t(n.value)):h())},h=()=>{Date.now()-m<300||(i(),d("close"))},Z=()=>{var y;(y=n.value)==null||y.close(),document.documentElement.focus(),B()},w=y=>{y.key==="Escape"&&e.value===n.value&&h()},G=()=>{if(document.querySelectorAll(".modal-yui-kit").length===1)return window.innerWidth-document.documentElement.clientWidth;{const Y=document.body.style.paddingRight;return Number(Y.replace(/\D/g,""))||0}},B=()=>{document.querySelectorAll(".modal-yui-kit").length===0&&NI({overflow:"","padding-right":""},document.body)},p=y=>{A.disableCloseOnOutsideClick||y.target===n.value&&h()};return g({closeDialog:Z}),s.onMounted(()=>{s.watchEffect(()=>{A.open!==o.value&&(u(),o.value=A.open,n.value&&n.value.focus())}),n.value&&n.value.addEventListener("cancel",Y=>{Y.preventDefault()});const y=G();NI({overflow:"hidden","padding-right":`${y}px`},document.body),document.addEventListener("keydown",w)}),s.onUnmounted(()=>{B(),document.removeEventListener("keydown",w),d("unmounted")}),(y,Y)=>(s.openBlock(),s.createElementBlock("dialog",s.mergeProps({ref_key:"dialog",ref:n},s.unref(l),{class:["modal-yui-kit",`modal-yui-kit_${A.position}`],"data-testid":A.dataTestid,onClick:s.withModifiers(p,["self","left"])}),[s.createElementVNode("div",{class:"modal-yui-kit__modal-content",style:s.normalizeStyle(a.value),"data-testid":`${A.dataTestid}-ModalContent`},[s.renderSlot(y.$slots,"default",{},void 0,!0)],12,txg)],16,exg))}}),[["__scopeId","data-v-3d242395"]]),Eh=Rg(s.defineComponent({__name:"ModalAnimated",props:{animateType:{},open:{type:Boolean},position:{default:"right"},width:{},height:{},disableCloseOnOutsideClick:{type:Boolean,default:!1},dataTestid:{default:"Modal"}},emits:["close","unmounted","end-animation"],setup(C,{emit:g}){const I=C,e=g,t=s.computed(()=>I.animateType===KV.fade?"fade":I.position==="bottom"?"slide-bottom":I.position==="right"?"slide-left":"fade-and-scale"),i=s.ref(null),A=s.reactive({function:()=>{}}),n=()=>{d()},l=()=>{e("unmounted")},o=()=>{d()},a=()=>{A.function(),e("end-animation")},d=()=>{var u;i.value&&(A.function=(u=i.value)==null?void 0:u.closeDialog)},m=()=>{d(),e("close")};return(u,h)=>(s.openBlock(),s.createBlock(s.Transition,{name:t.value,onAfterLeave:a,onBeforeLeave:o,onAfterEnter:n},{default:s.withCtx(()=>[I.open?(s.openBlock(),s.createBlock(MS,{key:0,ref_key:"modalRef",ref:i,open:I.open,position:I.position,width:I.width,height:I.height,"data-testid":I.dataTestid,onClose:m,onUnmounted:l,"disable-close-on-outside-click":I.disableCloseOnOutsideClick},{default:s.withCtx(()=>[s.renderSlot(u.$slots,"default",{},void 0,!0)]),_:3},8,["open","position","width","height","data-testid","disable-close-on-outside-click"])):s.createCommentVNode("",!0)]),_:3},8,["name"]))}}),[["__scopeId","data-v-75405c48"]]),RS=(C,g=window)=>{const I=C.getBoundingClientRect();if(g instanceof Window){const e=window.innerWidth,t=window.innerHeight;return I.top<t&&I.bottom>0&&I.left<e&&I.right>0}else{const e=g.getBoundingClientRect();return I.top<e.bottom&&I.bottom>e.top&&I.left<e.right&&I.right>e.left}},kV=(C,g=null)=>{if(!C)return;(g?RS(C,g):RS(C))||C.scrollIntoView({behavior:"smooth",block:"nearest"})},ixg=s.defineComponent({name:"BaseSlider",__name:"BaseSlider",props:{activeIndex:{default:0}},setup(C,{expose:g}){const I=C,e=s.reactive({children:null,activeIndex:I.activeIndex}),t=s.ref(null),i=s.ref(null);s.watch(()=>I.activeIndex,()=>{A(I.activeIndex)});const A=a=>{if(!t.value||!i.value)return;const d=[...t.value.children];a>d.length-1||a<0||(kV(d[a],i.value),e.activeIndex=a)},n=()=>{s.nextTick(()=>{!e.children||!i.value||kV(e.children[e.activeIndex],i.value)})},l=()=>(A(e.activeIndex+1),e.activeIndex),o=()=>(A(e.activeIndex-1),e.activeIndex);return s.onMounted(()=>{!t.value||!i.value||(e.children=[...t.value.children])}),g({shiftPosition:A,nextSlide:l,prevSlide:o,initScroll:n}),(a,d)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"sliderRef",ref:i,class:"base-slider"},[s.createElementVNode("div",{ref_key:"contentRef",ref:t,class:"base-slider__content"},[s.renderSlot(a.$slots,"default")],512)],512))}}),Axg={class:"base-slide__content"},nxg=s.defineComponent({name:"BaseSlide",__name:"BaseSlide",props:{isActive:{type:Boolean}},setup(C){const g=C,I=s.computed(()=>[{"base-slide_active":g.isActive}]);return(e,t)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["base-slide",I.value])},[s.createElementVNode("div",Axg,[s.renderSlot(e.$slots,"default")])],2))}}),fS=C=>{if(!C)return null;const g=C.split("?")[0],I=/\.\w+$/,e=g.match(I);return e?e[0].replace(".",""):null},iW=C=>{if(!C)return!1;if(C.startsWith("data:image/"))return!0;const g=fS(C);return g?Object.values(Nh).includes(g.toLowerCase()):!1},lxg=async(C,g="file")=>{const e=await(await fetch(C)).blob(),t=window.URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=g,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(t)};var XS={exports:{}};(function(C,g){(function(e,t){C.exports=t()})(window,function(){return function(I){var e={};function t(i){if(e[i])return e[i].exports;var A=e[i]={i,l:!1,exports:{}};return I[i].call(A.exports,A,A.exports,t),A.l=!0,A.exports}return t.m=I,t.c=e,t.d=function(i,A,n){t.o(i,A)||Object.defineProperty(i,A,{enumerable:!0,get:n})},t.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},t.t=function(i,A){if(A&1&&(i=t(i)),A&8||A&4&&typeof i=="object"&&i&&i.__esModule)return i;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:i}),A&2&&typeof i!="string")for(var l in i)t.d(n,l,(function(o){return i[o]}).bind(null,l));return n},t.n=function(i){var A=i&&i.__esModule?function(){return i.default}:function(){return i};return t.d(A,"a",A),A},t.o=function(i,A){return Object.prototype.hasOwnProperty.call(i,A)},t.p="",t(t.s=0)}({"./src/index.js":function(I,e,t){t.r(e),t("./src/sass/index.scss");var i=t("./src/js/init.js"),A=i.default.init;typeof window<"u"&&(window.printJS=A),e.default=A},"./src/js/browser.js":function(I,e,t){t.r(e);var i={isFirefox:function(){return typeof InstallTrigger<"u"},isIE:function(){return navigator.userAgent.indexOf("MSIE")!==-1||!!document.documentMode},isEdge:function(){return!i.isIE()&&!!window.StyleMedia},isChrome:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window;return!!n.chrome},isSafari:function(){return Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0||navigator.userAgent.toLowerCase().indexOf("safari")!==-1},isIOSChrome:function(){return navigator.userAgent.toLowerCase().indexOf("crios")!==-1}};e.default=i},"./src/js/functions.js":function(I,e,t){t.r(e),t.d(e,"addWrapper",function(){return l}),t.d(e,"capitalizePrint",function(){return o}),t.d(e,"collectStyles",function(){return a}),t.d(e,"addHeader",function(){return m}),t.d(e,"cleanUp",function(){return u}),t.d(e,"isRawHTML",function(){return h});var i=t("./src/js/modal.js"),A=t("./src/js/browser.js");function n(Z){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?n=function(G){return typeof G}:n=function(G){return G&&typeof Symbol=="function"&&G.constructor===Symbol&&G!==Symbol.prototype?"symbol":typeof G},n(Z)}function l(Z,w){var G="font-family:"+w.font+" !important; font-size: "+w.font_size+" !important; width:100%;";return'<div style="'+G+'">'+Z+"</div>"}function o(Z){return Z.charAt(0).toUpperCase()+Z.slice(1)}function a(Z,w){for(var G=document.defaultView||window,B="",p=G.getComputedStyle(Z,""),y=0;y<p.length;y++)(w.targetStyles.indexOf("*")!==-1||w.targetStyle.indexOf(p[y])!==-1||d(w.targetStyles,p[y]))&&p.getPropertyValue(p[y])&&(B+=p[y]+":"+p.getPropertyValue(p[y])+";");return B+="max-width: "+w.maxWidth+"px !important; font-size: "+w.font_size+" !important;",B}function d(Z,w){for(var G=0;G<Z.length;G++)if(n(w)==="object"&&w.indexOf(Z[G])!==-1)return!0;return!1}function m(Z,w){var G=document.createElement("div");if(h(w.header))G.innerHTML=w.header;else{var B=document.createElement("h1"),p=document.createTextNode(w.header);B.appendChild(p),B.setAttribute("style",w.headerStyle),G.appendChild(B)}Z.insertBefore(G,Z.childNodes[0])}function u(Z){Z.showModal&&i.default.close(),Z.onLoadingEnd&&Z.onLoadingEnd(),(Z.showModal||Z.onLoadingStart)&&window.URL.revokeObjectURL(Z.printable);var w="mouseover";(A.default.isChrome()||A.default.isFirefox())&&(w="focus");var G=function B(){window.removeEventListener(w,B),Z.onPrintDialogClose();var p=document.getElementById(Z.frameId);p&&p.remove()};window.addEventListener(w,G)}function h(Z){var w=new RegExp("<([A-Za-z][A-Za-z0-9]*)\\b[^>]*>(.*?)</\\1>");return w.test(Z)}},"./src/js/html.js":function(I,e,t){t.r(e);var i=t("./src/js/functions.js"),A=t("./src/js/print.js");function n(a){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?n=function(m){return typeof m}:n=function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},n(a)}e.default={print:function(d,m){var u=o(d.printable)?d.printable:document.getElementById(d.printable);if(!u){window.console.error("Invalid HTML element id: "+d.printable);return}d.printableElement=l(u,d),d.header&&Object(i.addHeader)(d.printableElement,d),A.default.send(d,m)}};function l(a,d){for(var m=a.cloneNode(),u=Array.prototype.slice.call(a.childNodes),h=0;h<u.length;h++)if(d.ignoreElements.indexOf(u[h].id)===-1){var Z=l(u[h],d);m.appendChild(Z)}switch(d.scanStyles&&a.nodeType===1&&m.setAttribute("style",Object(i.collectStyles)(a,d)),a.tagName){case"SELECT":m.value=a.value;break;case"CANVAS":m.getContext("2d").drawImage(a,0,0);break}return m}function o(a){return n(a)==="object"&&a&&(a instanceof HTMLElement||a.nodeType===1)}},"./src/js/image.js":function(I,e,t){t.r(e);var i=t("./src/js/functions.js"),A=t("./src/js/print.js"),n=t("./src/js/browser.js");e.default={print:function(o,a){o.printable.constructor!==Array&&(o.printable=[o.printable]),o.printableElement=document.createElement("div"),o.printable.forEach(function(d){var m=document.createElement("img");if(m.setAttribute("style",o.imageStyle),m.src=d,n.default.isFirefox()){var u=m.src;m.src=u}var h=document.createElement("div");h.appendChild(m),o.printableElement.appendChild(h)}),o.header&&Object(i.addHeader)(o.printableElement,o),A.default.send(o,a)}}},"./src/js/init.js":function(I,e,t){t.r(e);var i=t("./src/js/browser.js"),A=t("./src/js/modal.js"),n=t("./src/js/pdf.js"),l=t("./src/js/html.js"),o=t("./src/js/raw-html.js"),a=t("./src/js/image.js"),d=t("./src/js/json.js");function m(h){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?m=function(w){return typeof w}:m=function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},m(h)}var u=["pdf","html","image","json","raw-html"];e.default={init:function(){var Z={printable:null,fallbackPrintable:null,type:"pdf",header:null,headerStyle:"font-weight: 300;",maxWidth:800,properties:null,gridHeaderStyle:"font-weight: bold; padding: 5px; border: 1px solid #dddddd;",gridStyle:"border: 1px solid lightgray; margin-bottom: -1px;",showModal:!1,onError:function(R){throw R},onLoadingStart:null,onLoadingEnd:null,onPrintDialogClose:function(){},onIncompatibleBrowser:function(){},modalMessage:"Retrieving Document...",frameId:"printJS",printableElement:null,documentTitle:"Document",targetStyle:["clear","display","width","min-width","height","min-height","max-height"],targetStyles:["border","box","break","text-decoration"],ignoreElements:[],repeatTableHeader:!0,css:null,style:null,scanStyles:!0,base64:!1,onPdfOpen:null,font:"TimesNewRoman",font_size:"12pt",honorMarginPadding:!0,honorColor:!1,imageStyle:"max-width: 100%;"},w=arguments[0];if(w===void 0)throw new Error("printJS expects at least 1 attribute.");switch(m(w)){case"string":Z.printable=encodeURI(w),Z.fallbackPrintable=Z.printable,Z.type=arguments[1]||Z.type;break;case"object":Z.printable=w.printable,Z.fallbackPrintable=typeof w.fallbackPrintable<"u"?w.fallbackPrintable:Z.printable,Z.fallbackPrintable=Z.base64?"data:application/pdf;base64,".concat(Z.fallbackPrintable):Z.fallbackPrintable;for(var G in Z)G==="printable"||G==="fallbackPrintable"||(Z[G]=typeof w[G]<"u"?w[G]:Z[G]);break;default:throw new Error('Unexpected argument type! Expected "string" or "object", got '+m(w))}if(!Z.printable)throw new Error("Missing printable information.");if(!Z.type||typeof Z.type!="string"||u.indexOf(Z.type.toLowerCase())===-1)throw new Error("Invalid print type. Available types are: pdf, html, image and json.");Z.showModal&&A.default.show(Z),Z.onLoadingStart&&Z.onLoadingStart();var B=document.getElementById(Z.frameId);B&&B.parentNode.removeChild(B);var p=document.createElement("iframe");switch(i.default.isFirefox()?p.setAttribute("style","width: 1px; height: 100px; position: fixed; left: 0; top: 0; opacity: 0; border-width: 0; margin: 0; padding: 0"):p.setAttribute("style","visibility: hidden; height: 0; width: 0; position: absolute; border: 0"),p.setAttribute("id",Z.frameId),Z.type!=="pdf"&&(p.srcdoc="<html><head><title>"+Z.documentTitle+"</title>",Z.css&&(Array.isArray(Z.css)||(Z.css=[Z.css]),Z.css.forEach(function(Y){p.srcdoc+='<link rel="stylesheet" href="'+Y+'">'})),p.srcdoc+="</head><body></body></html>"),Z.type){case"pdf":if(i.default.isIE())try{console.info("Print.js doesn't support PDF printing in Internet Explorer.");var y=window.open(Z.fallbackPrintable,"_blank");y.focus(),Z.onIncompatibleBrowser()}catch(Y){Z.onError(Y)}finally{Z.showModal&&A.default.close(),Z.onLoadingEnd&&Z.onLoadingEnd()}else n.default.print(Z,p);break;case"image":a.default.print(Z,p);break;case"html":l.default.print(Z,p);break;case"raw-html":o.default.print(Z,p);break;case"json":d.default.print(Z,p);break}}}},"./src/js/json.js":function(I,e,t){t.r(e);var i=t("./src/js/functions.js"),A=t("./src/js/print.js");function n(o){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?n=function(d){return typeof d}:n=function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},n(o)}e.default={print:function(a,d){if(n(a.printable)!=="object")throw new Error("Invalid javascript data object (JSON).");if(typeof a.repeatTableHeader!="boolean")throw new Error("Invalid value for repeatTableHeader attribute (JSON).");if(!a.properties||!Array.isArray(a.properties))throw new Error("Invalid properties array for your JSON data.");a.properties=a.properties.map(function(m){return{field:n(m)==="object"?m.field:m,displayName:n(m)==="object"?m.displayName:m,columnSize:n(m)==="object"&&m.columnSize?m.columnSize+";":100/a.properties.length+"%;"}}),a.printableElement=document.createElement("div"),a.header&&Object(i.addHeader)(a.printableElement,a),a.printableElement.innerHTML+=l(a),A.default.send(a,d)}};function l(o){var a=o.printable,d=o.properties,m='<table style="border-collapse: collapse; width: 100%;">';o.repeatTableHeader&&(m+="<thead>"),m+="<tr>";for(var u=0;u<d.length;u++)m+='<th style="width:'+d[u].columnSize+";"+o.gridHeaderStyle+'">'+Object(i.capitalizePrint)(d[u].displayName)+"</th>";m+="</tr>",o.repeatTableHeader&&(m+="</thead>"),m+="<tbody>";for(var h=0;h<a.length;h++){m+="<tr>";for(var Z=0;Z<d.length;Z++){var w=a[h],G=d[Z].field.split(".");if(G.length>1)for(var B=0;B<G.length;B++)w=w[G[B]];else w=w[d[Z].field];m+='<td style="width:'+d[Z].columnSize+o.gridStyle+'">'+w+"</td>"}m+="</tr>"}return m+="</tbody></table>",m}},"./src/js/modal.js":function(I,e,t){t.r(e);var i={show:function(n){var l="font-family:sans-serif; display:table; text-align:center; font-weight:300; font-size:30px; left:0; top:0;position:fixed; z-index: 9990;color: #0460B5; width: 100%; height: 100%; background-color:rgba(255,255,255,.9);transition: opacity .3s ease;",o=document.createElement("div");o.setAttribute("style",l),o.setAttribute("id","printJS-Modal");var a=document.createElement("div");a.setAttribute("style","display:table-cell; vertical-align:middle; padding-bottom:100px;");var d=document.createElement("div");d.setAttribute("class","printClose"),d.setAttribute("id","printClose"),a.appendChild(d);var m=document.createElement("span");m.setAttribute("class","printSpinner"),a.appendChild(m);var u=document.createTextNode(n.modalMessage);a.appendChild(u),o.appendChild(a),document.getElementsByTagName("body")[0].appendChild(o),document.getElementById("printClose").addEventListener("click",function(){i.close()})},close:function(){var n=document.getElementById("printJS-Modal");n&&n.parentNode.removeChild(n)}};e.default=i},"./src/js/pdf.js":function(I,e,t){t.r(e);var i=t("./src/js/print.js"),A=t("./src/js/functions.js");e.default={print:function(o,a){if(o.base64){var d=Uint8Array.from(atob(o.printable),function(u){return u.charCodeAt(0)});n(o,a,d);return}o.printable=/^(blob|http|\/\/)/i.test(o.printable)?o.printable:window.location.origin+(o.printable.charAt(0)!=="/"?"/"+o.printable:o.printable);var m=new window.XMLHttpRequest;m.responseType="arraybuffer",m.addEventListener("error",function(){Object(A.cleanUp)(o),o.onError(m.statusText,m)}),m.addEventListener("load",function(){if([200,201].indexOf(m.status)===-1){Object(A.cleanUp)(o),o.onError(m.statusText,m);return}n(o,a,m.response)}),m.open("GET",o.printable,!0),m.send()}};function n(l,o,a){var d=new window.Blob([a],{type:"application/pdf"});d=window.URL.createObjectURL(d),o.setAttribute("src",d),i.default.send(l,o)}},"./src/js/print.js":function(I,e,t){t.r(e);var i=t("./src/js/browser.js"),A=t("./src/js/functions.js"),n={send:function(m,u){document.getElementsByTagName("body")[0].appendChild(u);var h=document.getElementById(m.frameId);h.onload=function(){if(m.type==="pdf"){i.default.isFirefox()?setTimeout(function(){return l(h,m)},1e3):l(h,m);return}var Z=h.contentWindow||h.contentDocument;if(Z.document&&(Z=Z.document),Z.body.appendChild(m.printableElement),m.type!=="pdf"&&m.style){var w=document.createElement("style");w.innerHTML=m.style,Z.head.appendChild(w)}var G=Z.getElementsByTagName("img");G.length>0?o(Array.from(G)).then(function(){return l(h,m)}):l(h,m)}}};function l(d,m){try{if(d.focus(),i.default.isEdge()||i.default.isIE())try{d.contentWindow.document.execCommand("print",!1,null)}catch{d.contentWindow.print()}else d.contentWindow.print()}catch(u){m.onError(u)}finally{i.default.isFirefox()&&(d.style.visibility="hidden",d.style.left="-1px"),Object(A.cleanUp)(m)}}function o(d){var m=d.map(function(u){if(u.src&&u.src!==window.location.href)return a(u)});return Promise.all(m)}function a(d){return new Promise(function(m){var u=function h(){!d||typeof d.naturalWidth>"u"||d.naturalWidth===0||!d.complete?setTimeout(h,500):m()};u()})}e.default=n},"./src/js/raw-html.js":function(I,e,t){t.r(e);var i=t("./src/js/print.js");e.default={print:function(n,l){n.printableElement=document.createElement("div"),n.printableElement.setAttribute("style","width:100%"),n.printableElement.innerHTML=n.printable,i.default.send(n,l)}}},"./src/sass/index.scss":function(I,e,t){},0:function(I,e,t){I.exports=t("./src/index.js")}}).default})})(XS);var sxg=XS.exports;const oxg=BTg(sxg),Zr=C=>{if(!C)return!1;const g=fS(C);return g?Object.values(Mh).includes(g):!1},axg=["src"],Ph=s.defineComponent({name:"VideoPreview",__name:"VideoPreview",props:{src:{}},emits:["error","load"],setup(C,{emit:g}){const I=C,e=g,t=s.reactive({isError:!1});s.watch(()=>I.src,()=>{t.isError=!1,s.nextTick(()=>{A()})});const i=s.ref(null),A=async()=>{var n;try{if(!i.value||!I.src)return;const l=document.createElement("video");l.muted=!0,l.preload="metadata";const o=await fetch(I.src);if(!o.ok)throw new Error("Failed to fetch video");const a=new Blob([await o.arrayBuffer()]);l.src=URL.createObjectURL(a);const d=(n=i==null?void 0:i.value)==null?void 0:n.getContext("2d");if(!d)return;l.addEventListener("loadeddata",()=>{l.currentTime=0,e("load")}),l.addEventListener("seeked",()=>{var m,u;i.value&&d.drawImage(l,0,0,(m=i.value)==null?void 0:m.width,(u=i.value)==null?void 0:u.height)}),l.addEventListener("error",m=>{t.isError=!0,e("error",m)})}catch{e("error",new Event("error")),t.isError=!0}};return s.onMounted(()=>{s.nextTick(()=>{A()})}),(n,l)=>t.isError?(s.openBlock(),s.createElementBlock("img",{key:1,src:s.unref(rn)},null,8,axg)):(s.openBlock(),s.createElementBlock("canvas",{key:0,ref_key:"canvasRef",ref:i,class:"video-preview"},null,512))}}),XA=C=>C?C instanceof File?C.type==="application/pdf":rr(C):!1;var qC=function(){return qC=Object.assign||function(g){for(var I,e=1,t=arguments.length;e<t;e++){I=arguments[e];for(var i in I)Object.prototype.hasOwnProperty.call(I,i)&&(g[i]=I[i])}return g},qC.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError,typeof window<"u"&&(window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),typeof window.CustomEvent!="function"&&(window.CustomEvent=function(g,I){I=I||{bubbles:!1,cancelable:!1,detail:null};var e=document.createEvent("CustomEvent");return e.initCustomEvent(g,I.bubbles,I.cancelable,I.detail),e}));var dxg=typeof document<"u"&&!!document.documentMode,zV;function cxg(){return zV||(zV=document.createElement("div").style)}var HS=["webkit","moz","ms"],AW={};function FV(C){if(AW[C])return AW[C];var g=cxg();if(C in g)return AW[C]=C;for(var I=C[0].toUpperCase()+C.slice(1),e=HS.length;e--;){var t="".concat(HS[e]).concat(I);if(t in g)return AW[C]=t}}function nW(C,g){return parseFloat(g[FV(C)])||0}function lW(C,g,I){I===void 0&&(I=window.getComputedStyle(C));var e=g==="border"?"Width":"";return{left:nW("".concat(g,"Left").concat(e),I),right:nW("".concat(g,"Right").concat(e),I),top:nW("".concat(g,"Top").concat(e),I),bottom:nW("".concat(g,"Bottom").concat(e),I)}}function Gr(C,g,I){C.style[FV(g)]=I}function rxg(C,g){var I=FV("transform");Gr(C,"transition","".concat(I," ").concat(g.duration,"ms ").concat(g.easing))}function mxg(C,g,I){var e=g.x,t=g.y,i=g.scale,A=g.isSVG;if(Gr(C,"transform","scale(".concat(i,") translate(").concat(e,"px, ").concat(t,"px)")),A&&dxg){var n=window.getComputedStyle(C).getPropertyValue("transform");C.setAttribute("transform",n)}}function JV(C){var g=C.parentNode,I=window.getComputedStyle(C),e=window.getComputedStyle(g),t=C.getBoundingClientRect(),i=g.getBoundingClientRect();return{elem:{style:I,width:t.width,height:t.height,top:t.top,bottom:t.bottom,left:t.left,right:t.right,margin:lW(C,"margin",I),border:lW(C,"border",I)},parent:{style:e,width:i.width,height:i.height,top:i.top,bottom:i.bottom,left:i.left,right:i.right,padding:lW(g,"padding",e),border:lW(g,"border",e)}}}var _h={down:"mousedown",move:"mousemove",up:"mouseup mouseleave"};typeof window<"u"&&(typeof window.PointerEvent=="function"?_h={down:"pointerdown",move:"pointermove",up:"pointerup pointerleave pointercancel"}:typeof window.TouchEvent=="function"&&(_h={down:"touchstart",move:"touchmove",up:"touchend touchcancel"}));function LV(C,g,I,e){_h[C].split(" ").forEach(function(t){g.addEventListener(t,I,e)})}function TV(C,g,I){_h[C].split(" ").forEach(function(e){g.removeEventListener(e,I)})}function DS(C,g){for(var I=C.length;I--;)if(C[I].pointerId===g.pointerId)return I;return-1}function vV(C,g){var I;if(g.touches){I=0;for(var e=0,t=g.touches;e<t.length;e++){var i=t[e];i.pointerId=I++,vV(C,i)}return}I=DS(C,g),I>-1&&C.splice(I,1),C.push(g)}function uxg(C,g){if(g.touches){for(;C.length;)C.pop();return}var I=DS(C,g);I>-1&&C.splice(I,1)}function SS(C){C=C.slice(0);for(var g=C.pop(),I;I=C.pop();)g={clientX:(I.clientX-g.clientX)/2+g.clientX,clientY:(I.clientY-g.clientY)/2+g.clientY};return g}function jV(C){if(C.length<2)return 0;var g=C[0],I=C[1];return Math.sqrt(Math.pow(Math.abs(I.clientX-g.clientX),2)+Math.pow(Math.abs(I.clientY-g.clientY),2))}function hxg(C){for(var g=C;g&&g.parentNode;){if(g.parentNode===document)return!0;g=g.parentNode instanceof ShadowRoot?g.parentNode.host:g.parentNode}return!1}function bxg(C){return(C.getAttribute("class")||"").trim()}function Zxg(C,g){return C.nodeType===1&&" ".concat(bxg(C)," ").indexOf(" ".concat(g," "))>-1}function Gxg(C,g){for(var I=C;I!=null;I=I.parentNode)if(Zxg(I,g.excludeClass)||g.exclude.indexOf(I)>-1)return!0;return!1}var wxg=/^http:[\w\.\/]+svg$/;function Wxg(C){return wxg.test(C.namespaceURI)&&C.nodeName.toLowerCase()!=="svg"}function Bxg(C){var g={};for(var I in C)C.hasOwnProperty(I)&&(g[I]=C[I]);return g}var KS={animate:!1,canvas:!1,cursor:"move",disablePan:!1,disableZoom:!1,disableXAxis:!1,disableYAxis:!1,duration:200,easing:"ease-in-out",exclude:[],excludeClass:"panzoom-exclude",handleStartEvent:function(C){C.preventDefault(),C.stopPropagation()},maxScale:4,minScale:.125,overflow:"hidden",panOnlyWhenZoomed:!1,pinchAndPan:!1,relative:!1,setTransform:mxg,startX:0,startY:0,startScale:1,step:.3,touchAction:"none"};function kS(C,g){if(!C)throw new Error("Panzoom requires an element as an argument");if(C.nodeType!==1)throw new Error("Panzoom requires an element with a nodeType of 1");if(!hxg(C))throw new Error("Panzoom should be called on elements that have been attached to the DOM");g=qC(qC({},KS),g);var I=Wxg(C),e=C.parentNode;e.style.overflow=g.overflow,e.style.userSelect="none",e.style.touchAction=g.touchAction,(g.canvas?e:C).style.cursor=g.cursor,C.style.userSelect="none",C.style.touchAction=g.touchAction,Gr(C,"transformOrigin",typeof g.origin=="string"?g.origin:I?"0 0":"50% 50%");function t(){e.style.overflow="",e.style.userSelect="",e.style.touchAction="",e.style.cursor="",C.style.cursor="",C.style.userSelect="",C.style.touchAction="",Gr(C,"transformOrigin","")}function i(Cg){Cg===void 0&&(Cg={});for(var mg in Cg)Cg.hasOwnProperty(mg)&&(g[mg]=Cg[mg]);(Cg.hasOwnProperty("cursor")||Cg.hasOwnProperty("canvas"))&&(e.style.cursor=C.style.cursor="",(g.canvas?e:C).style.cursor=g.cursor),Cg.hasOwnProperty("overflow")&&(e.style.overflow=Cg.overflow),Cg.hasOwnProperty("touchAction")&&(e.style.touchAction=Cg.touchAction,C.style.touchAction=Cg.touchAction)}var A=0,n=0,l=1,o=!1;Z(g.startScale,{animate:!1,force:!0}),setTimeout(function(){h(g.startX,g.startY,{animate:!1,force:!0})});function a(Cg,mg,yg){if(!yg.silent){var Gg=new CustomEvent(Cg,{detail:mg});C.dispatchEvent(Gg)}}function d(Cg,mg,yg){var Gg={x:A,y:n,scale:l,isSVG:I,originalEvent:yg};return requestAnimationFrame(function(){typeof mg.animate=="boolean"&&(mg.animate?rxg(C,mg):Gr(C,"transition","none")),mg.setTransform(C,Gg,mg),a(Cg,Gg,mg),a("panzoomchange",Gg,mg)}),Gg}function m(Cg,mg,yg,Gg){var ng=qC(qC({},g),Gg),Zg={x:A,y:n,opts:ng};if(!(Gg!=null&&Gg.force)&&(ng.disablePan||ng.panOnlyWhenZoomed&&l===ng.startScale))return Zg;if(Cg=parseFloat(Cg),mg=parseFloat(mg),ng.disableXAxis||(Zg.x=(ng.relative?A:0)+Cg),ng.disableYAxis||(Zg.y=(ng.relative?n:0)+mg),ng.contain){var bg=JV(C),AI=bg.elem.width/l,tI=bg.elem.height/l,iC=AI*yg,kC=tI*yg,RC=(iC-AI)/2,DI=(kC-tI)/2;if(ng.contain==="inside"){var $e=(-bg.elem.margin.left-bg.parent.padding.left+RC)/yg,_t=(bg.parent.width-iC-bg.parent.padding.left-bg.elem.margin.left-bg.parent.border.left-bg.parent.border.right+RC)/yg;Zg.x=Math.max(Math.min(Zg.x,_t),$e);var fC=(-bg.elem.margin.top-bg.parent.padding.top+DI)/yg,$t=(bg.parent.height-kC-bg.parent.padding.top-bg.elem.margin.top-bg.parent.border.top-bg.parent.border.bottom+DI)/yg;Zg.y=Math.max(Math.min(Zg.y,$t),fC)}else if(ng.contain==="outside"){var $e=(-(iC-bg.parent.width)-bg.parent.padding.left-bg.parent.border.left-bg.parent.border.right+RC)/yg,_t=(RC-bg.parent.padding.left)/yg;Zg.x=Math.max(Math.min(Zg.x,_t),$e);var fC=(-(kC-bg.parent.height)-bg.parent.padding.top-bg.parent.border.top-bg.parent.border.bottom+DI)/yg,$t=(DI-bg.parent.padding.top)/yg;Zg.y=Math.max(Math.min(Zg.y,$t),fC)}}return ng.roundPixels&&(Zg.x=Math.round(Zg.x),Zg.y=Math.round(Zg.y)),Zg}function u(Cg,mg){var yg=qC(qC({},g),mg),Gg={scale:l,opts:yg};if(!(mg!=null&&mg.force)&&yg.disableZoom)return Gg;var ng=g.minScale,Zg=g.maxScale;if(yg.contain){var bg=JV(C),AI=bg.elem.width/l,tI=bg.elem.height/l;if(AI>1&&tI>1){var iC=bg.parent.width-bg.parent.border.left-bg.parent.border.right,kC=bg.parent.height-bg.parent.border.top-bg.parent.border.bottom,RC=iC/AI,DI=kC/tI;g.contain==="inside"?Zg=Math.min(Zg,RC,DI):g.contain==="outside"&&(ng=Math.max(ng,RC,DI))}}return Gg.scale=Math.min(Math.max(Cg,ng),Zg),Gg}function h(Cg,mg,yg,Gg){var ng=m(Cg,mg,l,yg);return A!==ng.x||n!==ng.y?(A=ng.x,n=ng.y,d("panzoompan",ng.opts,Gg)):{x:A,y:n,scale:l,isSVG:I,originalEvent:Gg}}function Z(Cg,mg,yg){var Gg=u(Cg,mg),ng=Gg.opts;if(!(!(mg!=null&&mg.force)&&ng.disableZoom)){Cg=Gg.scale;var Zg=A,bg=n;if(ng.focal){var AI=ng.focal;Zg=(AI.x/Cg-AI.x/l+A*Cg)/Cg,bg=(AI.y/Cg-AI.y/l+n*Cg)/Cg}var tI=m(Zg,bg,Cg,{relative:!1,force:!0});return A=tI.x,n=tI.y,l=Cg,d("panzoomzoom",ng,yg)}}function w(Cg,mg){var yg=qC(qC(qC({},g),{animate:!0}),mg);return Z(l*Math.exp((Cg?1:-1)*yg.step),yg)}function G(Cg){return w(!0,Cg)}function B(Cg){return w(!1,Cg)}function p(Cg,mg,yg,Gg){var ng=JV(C),Zg={width:ng.parent.width-ng.parent.padding.left-ng.parent.padding.right-ng.parent.border.left-ng.parent.border.right,height:ng.parent.height-ng.parent.padding.top-ng.parent.padding.bottom-ng.parent.border.top-ng.parent.border.bottom},bg=mg.clientX-ng.parent.left-ng.parent.padding.left-ng.parent.border.left-ng.elem.margin.left,AI=mg.clientY-ng.parent.top-ng.parent.padding.top-ng.parent.border.top-ng.elem.margin.top;I||(bg-=ng.elem.width/l/2,AI-=ng.elem.height/l/2);var tI={x:bg/Zg.width*(Zg.width*Cg),y:AI/Zg.height*(Zg.height*Cg)};return Z(Cg,qC(qC({},yg),{animate:!1,focal:tI}),Gg)}function y(Cg,mg){Cg.preventDefault();var yg=qC(qC(qC({},g),mg),{animate:!1}),Gg=Cg.deltaY===0&&Cg.deltaX?Cg.deltaX:Cg.deltaY,ng=Gg<0?1:-1,Zg=u(l*Math.exp(ng*yg.step/3),yg).scale;return p(Zg,Cg,yg,Cg)}function Y(Cg){var mg=qC(qC(qC({},g),{animate:!0,force:!0}),Cg);l=u(mg.startScale,mg).scale;var yg=m(mg.startX,mg.startY,l,mg);return A=yg.x,n=yg.y,d("panzoomreset",mg)}var R,M,S,J,D,H,F=[];function x(Cg){if(!Gxg(Cg.target,g)){vV(F,Cg),o=!0,g.handleStartEvent(Cg),R=A,M=n,a("panzoomstart",{x:A,y:n,scale:l,isSVG:I,originalEvent:Cg},g);var mg=SS(F);S=mg.clientX,J=mg.clientY,D=l,H=jV(F)}}function q(Cg){if(!(!o||R===void 0||M===void 0||S===void 0||J===void 0)){vV(F,Cg);var mg=SS(F),yg=F.length>1,Gg=l;if(yg){H===0&&(H=jV(F));var ng=jV(F)-H;Gg=u(ng*g.step/80+D).scale,p(Gg,mg,{animate:!1},Cg)}(!yg||g.pinchAndPan)&&h(R+(mg.clientX-S)/Gg,M+(mg.clientY-J)/Gg,{animate:!1},Cg)}}function gg(Cg){F.length===1&&a("panzoomend",{x:A,y:n,scale:l,isSVG:I,originalEvent:Cg},g),uxg(F,Cg),o&&(o=!1,R=M=S=J=void 0)}var Q=!1;function _(){Q||(Q=!0,LV("down",g.canvas?e:C,x),LV("move",document,q,{passive:!0}),LV("up",document,gg,{passive:!0}))}function og(){Q=!1,TV("down",g.canvas?e:C,x),TV("move",document,q),TV("up",document,gg)}return g.noBind||_(),{bind:_,destroy:og,eventNames:_h,getPan:function(){return{x:A,y:n}},getScale:function(){return l},getOptions:function(){return Bxg(g)},handleDown:x,handleMove:q,handleUp:gg,pan:h,reset:Y,resetStyle:t,setOptions:i,setStyle:function(Cg,mg){return Gr(C,Cg,mg)},zoom:Z,zoomIn:G,zoomOut:B,zoomToPoint:p,zoomWithWheel:y}}kS.defaultOptions=KS;const pxg={ref:"contentRef",class:"slider-modal__content"},yxg=["onClick"],Yxg={class:"slider-modal__side-bar-count"},Vxg={key:0,class:"slider-modal__mobile-header"},Nxg={class:"slider-modal__mobile-header-block"},Mxg={class:"slider-modal__mobile-header-block"},Rxg={class:"slider-modal__counter"},fxg={class:"slider-modal__name"},Xxg=["src"],Hxg=["data-testid"],Dxg=["src"],Sxg=["src"],Kxg={class:"slider-modal__bottom"},kxg={class:"slider-modal__nav-block"},zxg=["disabled"],Fxg=["src","alt"],Jxg=["src"],Lxg=["disabled"],Txg={class:"slider-modal__nav-block"},vxg={class:"slider-modal__sub-nav"},jxg=["disabled"],xxg=["disabled"],Oxg=["disabled"],Qxg={class:"slider-modal__sub-nav"},Uxg=["disabled"],Exg=["disabled"],xV=80,zS=20,Pxg=80,_xg=20,sW=Rg(s.defineComponent({name:"SliderModal",__name:"SliderModal",props:{dataTestid:{default:"SliderModal"},animateType:{},open:{type:Boolean},position:{},width:{},height:{},disableCloseOnOutsideClick:{type:Boolean},items:{},defaultIndex:{default:0}},emits:["close","unmounted","end-animation"],setup(C,{emit:g}){const I=C,e=g,t=window.matchMedia("(max-width: 768px)"),i=s.reactive({defaultIndex:I.defaultIndex,file:I.items[I.defaultIndex],sideBarItems:[],sideBarIndex:0,sideBarLength:0,isErrorFile:!1,isClickOnExit:!1,isMobile:!1,isPointerActive:!1,isExistSwipe:!1,isChangeItemSwipe:!1,isSwipeNextSlide:!1,isSwipePrevSlide:!1,isExitScrollActive:!1,zoomValue:1,offsetX:0,offsetY:0,startX:0,startY:0,startXForMobile:0,startYForMobile:0,endXForMobile:0,endYForMobile:0,overscrollDelta:0,startScrollTop:0,rotateValue:0}),A=s.ref(null),n=s.ref(null),l=s.ref(null),o=s.ref(null),a=s.ref(null),d=s.ref(null),m=s.ref(null),u=s.ref(null);let h=null;const Z=s.computed(()=>i.defaultIndex===0),w=s.computed(()=>i.defaultIndex===I.items.length-1),G=s.computed(()=>{var lg,dg,Fg,sI;return!(XA((lg=i.file)==null?void 0:lg.path)||XA((dg=i.file)==null?void 0:dg.file)||iW((Fg=i.file)==null?void 0:Fg.path)||Zr((sI=i.file)==null?void 0:sI.path))}),B=s.computed(()=>{var dg,Fg;let lg=!i.file||i.isErrorFile||G.value;return lg=Zr((dg=i.file)==null?void 0:dg.path)||lg,lg=i.isMobile&&XA((Fg=i.file)==null?void 0:Fg.path)||lg,lg}),p=s.computed(()=>{var dg;let lg=!i.file||i.isErrorFile||G.value;return lg=Zr((dg=i.file)==null?void 0:dg.path)||lg,lg}),y=s.computed(()=>!i.file||i.isErrorFile||G.value),Y=s.computed(()=>{var dg;let lg=!i.file||i.isErrorFile||G.value;return lg=Zr((dg=i.file)==null?void 0:dg.path)||lg,lg}),R=s.computed(()=>({transform:`
1362
+ `)){const e=document.createElement("div");e.append(I?document.createTextNode(I):document.createElement("br")),this.editorDiv.append(e)}},QT=function(){return c(this,wi).replaceAll(" "," ")},h5=function(I){return I.replaceAll(" "," ")},UT=function(I){const{value:e,fontSize:t,color:i,pageIndex:A}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||I.value!==e||I.fontSize!==t||I.color.some((n,l)=>n!==i[l])||I.pageIndex!==A},f(tC,_l),cg(tC,"_freeTextDefaultContent",""),cg(tC,"_internalPadding",0),cg(tC,"_defaultColor",null),cg(tC,"_defaultFontSize",10),cg(tC,"_type","freetext"),cg(tC,"_editorType",Ug.FREETEXT);let yV=tC;class Vg{toSVGPath(){jI("Abstract method `toSVGPath` must be implemented.")}get box(){jI("Abstract getter `box` must be implemented.")}serialize(g,I){jI("Abstract method `serialize` must be implemented.")}static _rescale(g,I,e,t,i,A){A||(A=new Float32Array(g.length));for(let n=0,l=g.length;n<l;n+=2)A[n]=I+g[n]*t,A[n+1]=e+g[n+1]*i;return A}static _rescaleAndSwap(g,I,e,t,i,A){A||(A=new Float32Array(g.length));for(let n=0,l=g.length;n<l;n+=2)A[n]=I+g[n+1]*t,A[n+1]=e+g[n]*i;return A}static _translate(g,I,e,t){t||(t=new Float32Array(g.length));for(let i=0,A=g.length;i<A;i+=2)t[i]=I+g[i],t[i+1]=e+g[i+1];return t}static svgRound(g){return Math.round(g*1e4)}static _normalizePoint(g,I,e,t,i){switch(i){case 90:return[1-I/e,g/t];case 180:return[1-g/e,1-I/t];case 270:return[I/e,1-g/t];default:return[g/e,I/t]}}static _normalizePagePoint(g,I,e){switch(e){case 90:return[1-I,g];case 180:return[1-g,1-I];case 270:return[I,1-g];default:return[g,I]}}static createBezierPoints(g,I,e,t,i,A){return[(g+5*e)/6,(I+5*t)/6,(5*e+i)/6,(5*t+A)/6,(e+i)/2,(t+A)/2]}}cg(Vg,"PRECISION",1e-4);const $l=class $l{constructor({x:g,y:I},e,t,i,A,n=0){f(this,ee);f(this,Bi);f(this,xA,[]);f(this,Iu);f(this,Cu);f(this,jn,[]);f(this,lI,new Float32Array(18));f(this,lc);f(this,sc);f(this,hZ);f(this,bZ);f(this,eu);f(this,tu);f(this,vo,[]);V(this,Bi,e),V(this,tu,i*t),V(this,Cu,A),c(this,lI).set([NaN,NaN,NaN,NaN,g,I],6),V(this,Iu,n),V(this,bZ,c($l,ZZ)*t),V(this,hZ,c($l,ap)*t),V(this,eu,t),c(this,vo).push(g,I)}isEmpty(){return isNaN(c(this,lI)[8])}add({x:g,y:I}){var J;V(this,lc,g),V(this,sc,I);const[e,t,i,A]=c(this,Bi);let[n,l,o,a]=c(this,lI).subarray(8,12);const d=g-o,m=I-a,u=Math.hypot(d,m);if(u<c(this,hZ))return!1;const h=u-c(this,bZ),Z=h/u,w=Z*d,G=Z*m;let B=n,p=l;n=o,l=a,o+=w,a+=G,(J=c(this,vo))==null||J.push(g,I);const y=-G/h,Y=w/h,R=y*c(this,tu),M=Y*c(this,tu);return c(this,lI).set(c(this,lI).subarray(2,8),0),c(this,lI).set([o+R,a+M],4),c(this,lI).set(c(this,lI).subarray(14,18),12),c(this,lI).set([o-R,a-M],16),isNaN(c(this,lI)[6])?(c(this,jn).length===0&&(c(this,lI).set([n+R,l+M],2),c(this,jn).push(NaN,NaN,NaN,NaN,(n+R-e)/i,(l+M-t)/A),c(this,lI).set([n-R,l-M],14),c(this,xA).push(NaN,NaN,NaN,NaN,(n-R-e)/i,(l-M-t)/A)),c(this,lI).set([B,p,n,l,o,a],6),!this.isEmpty()):(c(this,lI).set([B,p,n,l,o,a],6),Math.abs(Math.atan2(p-l,B-n)-Math.atan2(G,w))<Math.PI/2?([n,l,o,a]=c(this,lI).subarray(2,6),c(this,jn).push(NaN,NaN,NaN,NaN,((n+o)/2-e)/i,((l+a)/2-t)/A),[n,l,B,p]=c(this,lI).subarray(14,18),c(this,xA).push(NaN,NaN,NaN,NaN,((B+n)/2-e)/i,((p+l)/2-t)/A),!0):([B,p,n,l,o,a]=c(this,lI).subarray(0,6),c(this,jn).push(((B+5*n)/6-e)/i,((p+5*l)/6-t)/A,((5*n+o)/6-e)/i,((5*l+a)/6-t)/A,((n+o)/2-e)/i,((l+a)/2-t)/A),[o,a,n,l,B,p]=c(this,lI).subarray(12,18),c(this,xA).push(((B+5*n)/6-e)/i,((p+5*l)/6-t)/A,((5*n+o)/6-e)/i,((5*l+a)/6-t)/A,((n+o)/2-e)/i,((l+a)/2-t)/A),!0))}toSVGPath(){if(this.isEmpty())return"";const g=c(this,jn),I=c(this,xA);if(isNaN(c(this,lI)[6])&&!this.isEmpty())return X(this,ee,ET).call(this);const e=[];e.push(`M${g[4]} ${g[5]}`);for(let t=6;t<g.length;t+=6)isNaN(g[t])?e.push(`L${g[t+4]} ${g[t+5]}`):e.push(`C${g[t]} ${g[t+1]} ${g[t+2]} ${g[t+3]} ${g[t+4]} ${g[t+5]}`);X(this,ee,_T).call(this,e);for(let t=I.length-6;t>=6;t-=6)isNaN(I[t])?e.push(`L${I[t+4]} ${I[t+5]}`):e.push(`C${I[t]} ${I[t+1]} ${I[t+2]} ${I[t+3]} ${I[t+4]} ${I[t+5]}`);return X(this,ee,PT).call(this,e),e.join(" ")}newFreeDrawOutline(g,I,e,t,i,A){return new VS(g,I,e,t,i,A)}getOutlines(){var d;const g=c(this,jn),I=c(this,xA),e=c(this,lI),[t,i,A,n]=c(this,Bi),l=new Float32Array((((d=c(this,vo))==null?void 0:d.length)??0)+2);for(let m=0,u=l.length-2;m<u;m+=2)l[m]=(c(this,vo)[m]-t)/A,l[m+1]=(c(this,vo)[m+1]-i)/n;if(l[l.length-2]=(c(this,lc)-t)/A,l[l.length-1]=(c(this,sc)-i)/n,isNaN(e[6])&&!this.isEmpty())return X(this,ee,$T).call(this,l);const o=new Float32Array(c(this,jn).length+24+c(this,xA).length);let a=g.length;for(let m=0;m<a;m+=2){if(isNaN(g[m])){o[m]=o[m+1]=NaN;continue}o[m]=g[m],o[m+1]=g[m+1]}a=X(this,ee,gv).call(this,o,a);for(let m=I.length-6;m>=6;m-=6)for(let u=0;u<6;u+=2){if(isNaN(I[m+u])){o[a]=o[a+1]=NaN,a+=2;continue}o[a]=I[m+u],o[a+1]=I[m+u+1],a+=2}return X(this,ee,qT).call(this,o,a),this.newFreeDrawOutline(o,l,c(this,Bi),c(this,eu),c(this,Iu),c(this,Cu))}};Bi=new WeakMap,xA=new WeakMap,Iu=new WeakMap,Cu=new WeakMap,jn=new WeakMap,lI=new WeakMap,lc=new WeakMap,sc=new WeakMap,hZ=new WeakMap,bZ=new WeakMap,eu=new WeakMap,tu=new WeakMap,vo=new WeakMap,ZZ=new WeakMap,op=new WeakMap,ap=new WeakMap,ee=new WeakSet,rG=function(){const g=c(this,lI).subarray(4,6),I=c(this,lI).subarray(16,18),[e,t,i,A]=c(this,Bi);return[(c(this,lc)+(g[0]-I[0])/2-e)/i,(c(this,sc)+(g[1]-I[1])/2-t)/A,(c(this,lc)+(I[0]-g[0])/2-e)/i,(c(this,sc)+(I[1]-g[1])/2-t)/A]},ET=function(){const[g,I,e,t]=c(this,Bi),[i,A,n,l]=X(this,ee,rG).call(this);return`M${(c(this,lI)[2]-g)/e} ${(c(this,lI)[3]-I)/t} L${(c(this,lI)[4]-g)/e} ${(c(this,lI)[5]-I)/t} L${i} ${A} L${n} ${l} L${(c(this,lI)[16]-g)/e} ${(c(this,lI)[17]-I)/t} L${(c(this,lI)[14]-g)/e} ${(c(this,lI)[15]-I)/t} Z`},PT=function(g){const I=c(this,xA);g.push(`L${I[4]} ${I[5]} Z`)},_T=function(g){const[I,e,t,i]=c(this,Bi),A=c(this,lI).subarray(4,6),n=c(this,lI).subarray(16,18),[l,o,a,d]=X(this,ee,rG).call(this);g.push(`L${(A[0]-I)/t} ${(A[1]-e)/i} L${l} ${o} L${a} ${d} L${(n[0]-I)/t} ${(n[1]-e)/i}`)},$T=function(g){const I=c(this,lI),[e,t,i,A]=c(this,Bi),[n,l,o,a]=X(this,ee,rG).call(this),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(I[2]-e)/i,(I[3]-t)/A,NaN,NaN,NaN,NaN,(I[4]-e)/i,(I[5]-t)/A,NaN,NaN,NaN,NaN,n,l,NaN,NaN,NaN,NaN,o,a,NaN,NaN,NaN,NaN,(I[16]-e)/i,(I[17]-t)/A,NaN,NaN,NaN,NaN,(I[14]-e)/i,(I[15]-t)/A],0),this.newFreeDrawOutline(d,g,c(this,Bi),c(this,eu),c(this,Iu),c(this,Cu))},qT=function(g,I){const e=c(this,xA);return g.set([NaN,NaN,NaN,NaN,e[4],e[5]],I),I+=6},gv=function(g,I){const e=c(this,lI).subarray(4,6),t=c(this,lI).subarray(16,18),[i,A,n,l]=c(this,Bi),[o,a,d,m]=X(this,ee,rG).call(this);return g.set([NaN,NaN,NaN,NaN,(e[0]-i)/n,(e[1]-A)/l,NaN,NaN,NaN,NaN,o,a,NaN,NaN,NaN,NaN,d,m,NaN,NaN,NaN,NaN,(t[0]-i)/n,(t[1]-A)/l],I),I+=24},f($l,ZZ,8),f($l,op,2),f($l,ap,c($l,ZZ)+c($l,op));let gW=$l;class VS extends Vg{constructor(I,e,t,i,A,n){super();f(this,dp);f(this,iu);f(this,oc,new Float32Array(4));f(this,ql);f(this,GZ);f(this,pi);f(this,wZ);f(this,KC);V(this,KC,I),V(this,pi,e),V(this,iu,t),V(this,wZ,i),V(this,ql,A),V(this,GZ,n),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],X(this,dp,Iv).call(this,n);const[l,o,a,d]=c(this,oc);for(let m=0,u=I.length;m<u;m+=2)I[m]=(I[m]-l)/a,I[m+1]=(I[m+1]-o)/d;for(let m=0,u=e.length;m<u;m+=2)e[m]=(e[m]-l)/a,e[m+1]=(e[m+1]-o)/d}toSVGPath(){const I=[`M${c(this,KC)[4]} ${c(this,KC)[5]}`];for(let e=6,t=c(this,KC).length;e<t;e+=6){if(isNaN(c(this,KC)[e])){I.push(`L${c(this,KC)[e+4]} ${c(this,KC)[e+5]}`);continue}I.push(`C${c(this,KC)[e]} ${c(this,KC)[e+1]} ${c(this,KC)[e+2]} ${c(this,KC)[e+3]} ${c(this,KC)[e+4]} ${c(this,KC)[e+5]}`)}return I.push("Z"),I.join(" ")}serialize([I,e,t,i],A){const n=t-I,l=i-e;let o,a;switch(A){case 0:o=Vg._rescale(c(this,KC),I,i,n,-l),a=Vg._rescale(c(this,pi),I,i,n,-l);break;case 90:o=Vg._rescaleAndSwap(c(this,KC),I,e,n,l),a=Vg._rescaleAndSwap(c(this,pi),I,e,n,l);break;case 180:o=Vg._rescale(c(this,KC),t,e,-n,l),a=Vg._rescale(c(this,pi),t,e,-n,l);break;case 270:o=Vg._rescaleAndSwap(c(this,KC),t,i,-n,-l),a=Vg._rescaleAndSwap(c(this,pi),t,i,-n,-l);break}return{outline:Array.from(o),points:[Array.from(a)]}}get box(){return c(this,oc)}newOutliner(I,e,t,i,A,n=0){return new gW(I,e,t,i,A,n)}getNewOutline(I,e){const[t,i,A,n]=c(this,oc),[l,o,a,d]=c(this,iu),m=A*a,u=n*d,h=t*a+l,Z=i*d+o,w=this.newOutliner({x:c(this,pi)[0]*m+h,y:c(this,pi)[1]*u+Z},c(this,iu),c(this,wZ),I,c(this,GZ),e??c(this,ql));for(let G=2;G<c(this,pi).length;G+=2)w.add({x:c(this,pi)[G]*m+h,y:c(this,pi)[G+1]*u+Z});return w.getOutlines()}}iu=new WeakMap,oc=new WeakMap,ql=new WeakMap,GZ=new WeakMap,pi=new WeakMap,wZ=new WeakMap,KC=new WeakMap,dp=new WeakSet,Iv=function(I){const e=c(this,KC);let t=e[4],i=e[5];const A=[t,i,t,i];let n=t,l=i,o=t,a=i;const d=I?Math.max:Math.min,m=new Float32Array(4);for(let h=6,Z=e.length;h<Z;h+=6){const w=e[h+4],G=e[h+5];isNaN(e[h])?(Mg.pointBoundingBox(w,G,A),l>G?(n=w,l=G):l===G&&(n=d(n,w)),a<G?(o=w,a=G):a===G&&(o=d(o,w))):(m[0]=m[1]=1/0,m[2]=m[3]=-1/0,Mg.bezierBoundingBox(t,i,...e.slice(h,h+6),m),Mg.rectBoundingBox(m[0],m[1],m[2],m[3],A),l>m[1]?(n=m[0],l=m[1]):l===m[1]&&(n=d(n,m[0])),a<m[3]?(o=m[2],a=m[3]):a===m[3]&&(o=d(o,m[2]))),t=w,i=G}const u=c(this,oc);u[0]=A[0]-c(this,ql),u[1]=A[1]-c(this,ql),u[2]=A[2]-A[0]+2*c(this,ql),u[3]=A[3]-A[1]+2*c(this,ql),this.firstPoint=[n,l],this.lastPoint=[o,a]};class YV{constructor(g,I=0,e=0,t=!0){f(this,Wt);f(this,WZ);f(this,BZ);f(this,pZ);f(this,jo,[]);f(this,OA,[]);const i=[1/0,1/0,-1/0,-1/0],n=10**-4;for(const{x:w,y:G,width:B,height:p}of g){const y=Math.floor((w-I)/n)*n,Y=Math.ceil((w+B+I)/n)*n,R=Math.floor((G-I)/n)*n,M=Math.ceil((G+p+I)/n)*n,S=[y,R,M,!0],J=[Y,R,M,!1];c(this,jo).push(S,J),Mg.rectBoundingBox(y,R,Y,M,i)}const l=i[2]-i[0]+2*e,o=i[3]-i[1]+2*e,a=i[0]-e,d=i[1]-e;let m=t?-1/0:1/0,u=1/0;const h=c(this,jo).at(t?-1:-2),Z=[h[0],h[2]];for(const w of c(this,jo)){const[G,B,p,y]=w;!y&&t?B<u?(u=B,m=G):B===u&&(m=Math.max(m,G)):y&&!t&&(B<u?(u=B,m=G):B===u&&(m=Math.min(m,G))),w[0]=(G-a)/l,w[1]=(B-d)/o,w[2]=(p-d)/o}V(this,WZ,new Float32Array([a,d,l,o])),V(this,BZ,[m,u]),V(this,pZ,Z)}getOutlines(){c(this,jo).sort((I,e)=>I[0]-e[0]||I[1]-e[1]||I[2]-e[2]);const g=[];for(const I of c(this,jo))I[3]?(g.push(...X(this,Wt,b5).call(this,I)),X(this,Wt,ev).call(this,I)):(X(this,Wt,tv).call(this,I),g.push(...X(this,Wt,b5).call(this,I)));return X(this,Wt,Cv).call(this,g)}}WZ=new WeakMap,BZ=new WeakMap,pZ=new WeakMap,jo=new WeakMap,OA=new WeakMap,Wt=new WeakSet,Cv=function(g){const I=[],e=new Set;for(const A of g){const[n,l,o]=A;I.push([n,l,A],[n,o,A])}I.sort((A,n)=>A[1]-n[1]||A[0]-n[0]);for(let A=0,n=I.length;A<n;A+=2){const l=I[A][2],o=I[A+1][2];l.push(o),o.push(l),e.add(l),e.add(o)}const t=[];let i;for(;e.size>0;){const A=e.values().next().value;let[n,l,o,a,d]=A;e.delete(A);let m=n,u=l;for(i=[n,o],t.push(i);;){let h;if(e.has(a))h=a;else if(e.has(d))h=d;else break;e.delete(h),[n,l,o,a,d]=h,m!==n&&(i.push(m,u,n,u===l?l:o),m=n),u=u===l?o:l}i.push(m,u)}return new _jg(t,c(this,WZ),c(this,BZ),c(this,pZ))},p2=function(g){const I=c(this,OA);let e=0,t=I.length-1;for(;e<=t;){const i=e+t>>1,A=I[i][0];if(A===g)return i;A<g?e=i+1:t=i-1}return t+1},ev=function([,g,I]){const e=X(this,Wt,p2).call(this,g);c(this,OA).splice(e,0,[g,I])},tv=function([,g,I]){const e=X(this,Wt,p2).call(this,g);for(let t=e;t<c(this,OA).length;t++){const[i,A]=c(this,OA)[t];if(i!==g)break;if(i===g&&A===I){c(this,OA).splice(t,1);return}}for(let t=e-1;t>=0;t--){const[i,A]=c(this,OA)[t];if(i!==g)break;if(i===g&&A===I){c(this,OA).splice(t,1);return}}},b5=function(g){const[I,e,t]=g,i=[[I,e,t]],A=X(this,Wt,p2).call(this,t);for(let n=0;n<A;n++){const[l,o]=c(this,OA)[n];for(let a=0,d=i.length;a<d;a++){const[,m,u]=i[a];if(!(o<=m||u<=l)){if(m>=l){if(u>o)i[a][1]=o;else{if(d===1)return[];i.splice(a,1),a--,d--}continue}i[a][2]=l,u>o&&i.push([I,o,u])}}}return i};class _jg extends Vg{constructor(I,e,t,i){super();f(this,yZ);f(this,Au);V(this,Au,I),V(this,yZ,e),this.firstPoint=t,this.lastPoint=i}toSVGPath(){const I=[];for(const e of c(this,Au)){let[t,i]=e;I.push(`M${t} ${i}`);for(let A=2;A<e.length;A+=2){const n=e[A],l=e[A+1];n===t?(I.push(`V${l}`),i=l):l===i&&(I.push(`H${n}`),t=n)}I.push("Z")}return I.join(" ")}serialize([I,e,t,i],A){const n=[],l=t-I,o=i-e;for(const a of c(this,Au)){const d=new Array(a.length);for(let m=0;m<a.length;m+=2)d[m]=I+a[m]*l,d[m+1]=i-a[m+1]*o;n.push(d)}return n}get box(){return c(this,yZ)}get classNamesForOutlining(){return["highlightOutline"]}}yZ=new WeakMap,Au=new WeakMap;class VV extends gW{newFreeDrawOutline(g,I,e,t,i,A){return new $jg(g,I,e,t,i,A)}}class $jg extends VS{newOutliner(g,I,e,t,i,A=0){return new VV(g,I,e,t,i,A)}}const WI=class WI extends qI{constructor(I){super({...I,name:"highlightEditor"});f(this,gI);f(this,nu,null);f(this,YZ,0);f(this,gs);f(this,ac,null);f(this,VZ,null);f(this,Et,null);f(this,NZ,null);f(this,MZ,0);f(this,dc,null);f(this,yi,null);f(this,Yi,null);f(this,De,!1);f(this,lu,null);f(this,su,null);f(this,_e,null);f(this,ou,"");f(this,oA);f(this,RZ,"");this.color=I.color||WI._defaultColor,V(this,oA,I.thickness||WI._defaultThickness),this.opacity=I.opacity||WI._defaultOpacity,V(this,gs,I.boxes||null),V(this,RZ,I.methodOfCreation||""),V(this,ou,I.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",I.highlightId>-1?(V(this,De,!0),X(this,gI,y2).call(this,I),X(this,gI,Fc).call(this)):c(this,gs)&&(V(this,nu,I.anchorNode),V(this,YZ,I.anchorOffset),V(this,NZ,I.focusNode),V(this,MZ,I.focusOffset),X(this,gI,Z5).call(this),X(this,gI,Fc).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const I=WI.prototype;return Og(this,"_keyboardManager",new Fh([[["ArrowLeft","mac+ArrowLeft"],I._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],I._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],I._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],I._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:c(this,De)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:c(this,oA),methodOfCreation:c(this,RZ)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(I){return{numberOfColors:I.get("color").size}}static initialize(I,e){var t;qI.initialize(I,e),WI._defaultColor||(WI._defaultColor=((t=e.highlightColors)==null?void 0:t.values().next().value)||"#fff066")}static updateDefaultParams(I,e){switch(I){case mI.HIGHLIGHT_COLOR:WI._defaultColor=e;break;case mI.HIGHLIGHT_THICKNESS:WI._defaultThickness=e;break}}translateInPage(I,e){}get toolbarPosition(){return c(this,su)}get commentButtonPosition(){return c(this,lu)}updateParams(I,e){switch(I){case mI.HIGHLIGHT_COLOR:X(this,gI,iv).call(this,e);break;case mI.HIGHLIGHT_THICKNESS:X(this,gI,Av).call(this,e);break}}static get defaultPropertiesToUpdate(){return[[mI.HIGHLIGHT_COLOR,WI._defaultColor],[mI.HIGHLIGHT_THICKNESS,WI._defaultThickness]]}get propertiesToUpdate(){return[[mI.HIGHLIGHT_COLOR,this.color||WI._defaultColor],[mI.HIGHLIGHT_THICKNESS,c(this,oA)||WI._defaultThickness],[mI.HIGHLIGHT_FREE,c(this,De)]]}onUpdatedColor(){var I,e;(I=this.parent)==null||I.drawLayer.updateProperties(c(this,Yi),{root:{fill:this.color,"fill-opacity":this.opacity}}),(e=c(this,VZ))==null||e.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",V(this,VZ,new Pw({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(X(this,gI,V2).call(this))}getBaseTranslation(){return[0,0]}getRect(I,e){return super.getRect(I,e,X(this,gI,V2).call(this))}onceAdded(I){this.annotationElementId||this.parent.addUndoableEditor(this),I&&this.div.focus()}remove(){X(this,gI,G5).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(X(this,gI,Fc).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(I){var t;let e=!1;this.parent&&!I?X(this,gI,G5).call(this):I&&(X(this,gI,Fc).call(this,I),e=!this.parent&&((t=this.div)==null?void 0:t.classList.contains("selectedEditor"))),super.setParent(I),this.show(this._isVisible),e&&this.select()}rotate(I){var i,A,n;const{drawLayer:e}=this.parent;let t;c(this,De)?(I=(I-this.rotation+360)%360,t=X(i=WI,aA,Tu).call(i,c(this,yi).box,I)):t=X(A=WI,aA,Tu).call(A,[this.x,this.y,this.width,this.height],I),e.updateProperties(c(this,Yi),{bbox:t,root:{"data-main-rotation":I}}),e.updateProperties(c(this,_e),{bbox:X(n=WI,aA,Tu).call(n,c(this,Et).box,I),root:{"data-main-rotation":I}})}render(){if(this.div)return this.div;const I=super.render();c(this,ou)&&(I.setAttribute("aria-label",c(this,ou)),I.setAttribute("role","mark")),c(this,De)?I.classList.add("free"):this.div.addEventListener("keydown",X(this,gI,lv).bind(this),{signal:this._uiManager._signal});const e=V(this,dc,document.createElement("div"));return I.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=c(this,ac),this.setDims(),LD(this,c(this,dc),["pointerover","pointerleave"]),this.enableEditing(),I}pointerover(){var I;this.isSelected||(I=this.parent)==null||I.drawLayer.updateProperties(c(this,_e),{rootClass:{hovered:!0}})}pointerleave(){var I;this.isSelected||(I=this.parent)==null||I.drawLayer.updateProperties(c(this,_e),{rootClass:{hovered:!1}})}_moveCaret(I){switch(this.parent.unselect(this),I){case 0:case 2:X(this,gI,Y2).call(this,!0);break;case 1:case 3:X(this,gI,Y2).call(this,!1);break}}select(){var I;super.select(),c(this,_e)&&((I=this.parent)==null||I.drawLayer.updateProperties(c(this,_e),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var I;super.unselect(),c(this,_e)&&((I=this.parent)==null||I.drawLayer.updateProperties(c(this,_e),{rootClass:{selected:!1}}),c(this,De)||X(this,gI,Y2).call(this,!1))}get _mustFixPosition(){return!c(this,De)}show(I=this._isVisible){super.show(I),this.parent&&(this.parent.drawLayer.updateProperties(c(this,Yi),{rootClass:{hidden:!I}}),this.parent.drawLayer.updateProperties(c(this,_e),{rootClass:{hidden:!I}}))}static startHighlighting(I,e,{target:t,x:i,y:A}){const{x:n,y:l,width:o,height:a}=t.getBoundingClientRect(),d=new AbortController,m=I.combinedSignal(d),u=h=>{d.abort(),X(this,aA,dv).call(this,I,h)};window.addEventListener("blur",u,{signal:m}),window.addEventListener("pointerup",u,{signal:m}),window.addEventListener("pointerdown",wC,{capture:!0,passive:!1,signal:m}),window.addEventListener("contextmenu",Ji,{signal:m}),t.addEventListener("pointermove",X(this,aA,av).bind(this,I),{signal:m}),this._freeHighlight=new VV({x:i,y:A},[n,l,o,a],I.scale,this._defaultThickness/2,e,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=I.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(I,e,t){var Z,w,G,B;let i=null;if(I instanceof yS){const{data:{quadPoints:p,rect:y,rotation:Y,id:R,color:M,opacity:S,popupRef:J,richText:D,contentsObj:H,creationDate:F,modificationDate:x},parent:{page:{pageNumber:q}}}=I;i=I={annotationType:Ug.HIGHLIGHT,color:Array.from(M),opacity:S,quadPoints:p,boxes:null,pageIndex:q-1,rect:y.slice(0),rotation:Y,annotationElementId:R,id:R,deleted:!1,popupRef:J,richText:D,comment:(H==null?void 0:H.str)||null,creationDate:F,modificationDate:x}}else if(I instanceof BV){const{data:{inkLists:p,rect:y,rotation:Y,id:R,color:M,borderStyle:{rawWidth:S},popupRef:J,richText:D,contentsObj:H,creationDate:F,modificationDate:x},parent:{page:{pageNumber:q}}}=I;i=I={annotationType:Ug.HIGHLIGHT,color:Array.from(M),thickness:S,inkLists:p,boxes:null,pageIndex:q-1,rect:y.slice(0),rotation:Y,annotationElementId:R,id:R,deleted:!1,popupRef:J,richText:D,comment:(H==null?void 0:H.str)||null,creationDate:F,modificationDate:x}}const{color:A,quadPoints:n,inkLists:l,opacity:o}=I,a=await super.deserialize(I,e,t);a.color=Mg.makeHexColor(...A),a.opacity=o||1,l&&V(a,oA,I.thickness),a._initialData=i,I.comment&&a.setCommentData(I);const[d,m]=a.pageDimensions,[u,h]=a.pageTranslation;if(n){const p=V(a,gs,[]);for(let y=0;y<n.length;y+=8)p.push({x:(n[y]-u)/d,y:1-(n[y+1]-h)/m,width:(n[y+2]-n[y])/d,height:(n[y+1]-n[y+5])/m});X(Z=a,gI,Z5).call(Z),X(w=a,gI,Fc).call(w),a.rotate(a.rotation)}else if(l){V(a,De,!0);const p=l[0],y={x:p[0]-u,y:m-(p[1]-h)},Y=new VV(y,[0,0,d,m],1,c(a,oA)/2,!0,.001);for(let S=0,J=p.length;S<J;S+=2)y.x=p[S]-u,y.y=m-(p[S+1]-h),Y.add(y);const{id:R,clipPathId:M}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:a.color,"fill-opacity":a._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:Y.toSVGPath()}},!0,!0);X(G=a,gI,y2).call(G,{highlightOutlines:Y.getOutlines(),highlightId:R,clipPathId:M}),X(B=a,gI,Fc).call(B),a.rotate(a.parentRotation)}return a}serialize(I=!1){if(this.isEmpty()||I)return null;if(this.deleted)return this.serializeDeleted();const e=qI._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),t=super.serialize(I);return Object.assign(t,{color:e,opacity:this.opacity,thickness:c(this,oA),quadPoints:X(this,gI,sv).call(this),outlines:X(this,gI,ov).call(this,t.rect)}),this.addComment(t),this.annotationElementId&&!X(this,gI,cv).call(this,t)?null:(t.id=this.annotationElementId,t)}renderAnnotationElement(I){return this.deleted?(I.hide(),null):(I.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}};nu=new WeakMap,YZ=new WeakMap,gs=new WeakMap,ac=new WeakMap,VZ=new WeakMap,Et=new WeakMap,NZ=new WeakMap,MZ=new WeakMap,dc=new WeakMap,yi=new WeakMap,Yi=new WeakMap,De=new WeakMap,lu=new WeakMap,su=new WeakMap,_e=new WeakMap,ou=new WeakMap,oA=new WeakMap,RZ=new WeakMap,gI=new WeakSet,Z5=function(){const I=new YV(c(this,gs),.001);V(this,yi,I.getOutlines()),[this.x,this.y,this.width,this.height]=c(this,yi).box;const e=new YV(c(this,gs),.0025,.001,this._uiManager.direction==="ltr");V(this,Et,e.getOutlines());const{firstPoint:t}=c(this,yi);V(this,lu,[(t[0]-this.x)/this.width,(t[1]-this.y)/this.height]);const{lastPoint:i}=c(this,Et);V(this,su,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])},y2=function({highlightOutlines:I,highlightId:e,clipPathId:t}){var m,u;if(V(this,yi,I),V(this,Et,I.getNewOutline(c(this,oA)/2+1.5,.0025)),e>=0)V(this,Yi,e),V(this,ac,t),this.parent.drawLayer.finalizeDraw(e,{bbox:I.box,path:{d:I.toSVGPath()}}),V(this,_e,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:c(this,Et).box,path:{d:c(this,Et).toSVGPath()}},!0));else if(this.parent){const h=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(c(this,Yi),{bbox:X(m=WI,aA,Tu).call(m,c(this,yi).box,(h-this.rotation+360)%360),path:{d:I.toSVGPath()}}),this.parent.drawLayer.updateProperties(c(this,_e),{bbox:X(u=WI,aA,Tu).call(u,c(this,Et).box,h),path:{d:c(this,Et).toSVGPath()}})}const[A,n,l,o]=I.box;switch(this.rotation){case 0:this.x=A,this.y=n,this.width=l,this.height=o;break;case 90:{const[h,Z]=this.parentDimensions;this.x=n,this.y=1-A,this.width=l*Z/h,this.height=o*h/Z;break}case 180:this.x=1-A,this.y=1-n,this.width=l,this.height=o;break;case 270:{const[h,Z]=this.parentDimensions;this.x=1-n,this.y=A,this.width=l*Z/h,this.height=o*h/Z;break}}const{firstPoint:a}=I;V(this,lu,[(a[0]-A)/l,(a[1]-n)/o]);const{lastPoint:d}=c(this,Et);V(this,su,[(d[0]-A)/l,(d[1]-n)/o])},iv=function(I){const e=(A,n)=>{this.color=A,this.opacity=n,this.onUpdatedColor()},t=this.color,i=this.opacity;this.addCommands({cmd:e.bind(this,I,WI._defaultOpacity),undo:e.bind(this,t,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:mI.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(I)},!0)},Av=function(I){const e=c(this,oA),t=i=>{V(this,oA,i),X(this,gI,nv).call(this,i)};this.addCommands({cmd:t.bind(this,I),undo:t.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:mI.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:I},!0)},nv=function(I){c(this,De)&&(X(this,gI,y2).call(this,{highlightOutlines:c(this,yi).getNewOutline(I/2)}),this.fixAndSetPosition(),this.setDims())},G5=function(){c(this,Yi)===null||!this.parent||(this.parent.drawLayer.remove(c(this,Yi)),V(this,Yi,null),this.parent.drawLayer.remove(c(this,_e)),V(this,_e,null))},Fc=function(I=this.parent){c(this,Yi)===null&&({id:ne(this,Yi)._,clipPathId:ne(this,ac)._}=I.drawLayer.draw({bbox:c(this,yi).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:c(this,De)},path:{d:c(this,yi).toSVGPath()}},!1,!0),V(this,_e,I.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:c(this,De)},bbox:c(this,Et).box,path:{d:c(this,Et).toSVGPath()}},c(this,De))),c(this,dc)&&(c(this,dc).style.clipPath=c(this,ac)))},aA=new WeakSet,Tu=function([I,e,t,i],A){switch(A){case 90:return[1-e-i,I,i,t];case 180:return[1-I-t,1-e-i,t,i];case 270:return[e,1-I-t,i,t]}return[I,e,t,i]},lv=function(I){WI._keyboardManager.exec(this,I)},Y2=function(I){if(!c(this,nu))return;const e=window.getSelection();I?e.setPosition(c(this,nu),c(this,YZ)):e.setPosition(c(this,NZ),c(this,MZ))},V2=function(){return c(this,De)?this.rotation:0},sv=function(){if(c(this,De))return null;const[I,e]=this.pageDimensions,[t,i]=this.pageTranslation,A=c(this,gs),n=new Float32Array(A.length*8);let l=0;for(const{x:o,y:a,width:d,height:m}of A){const u=o*I+t,h=(1-a)*e+i;n[l]=n[l+4]=u,n[l+1]=n[l+3]=h,n[l+2]=n[l+6]=u+d*I,n[l+5]=n[l+7]=h-m*e,l+=8}return n},ov=function(I){return c(this,yi).serialize(I,X(this,gI,V2).call(this))},av=function(I,e){this._freeHighlight.add(e)&&I.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},dv=function(I,e){this._freeHighlight.isEmpty()?I.drawLayer.remove(this._freeHighlightId):I.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},cv=function(I){const{color:e}=this._initialData;return this.hasEditedComment||I.color.some((t,i)=>t!==e[i])},f(WI,aA),cg(WI,"_defaultColor",null),cg(WI,"_defaultOpacity",1),cg(WI,"_defaultThickness",12),cg(WI,"_type","highlight"),cg(WI,"_editorType",Ug.HIGHLIGHT),cg(WI,"_freeHighlightId",-1),cg(WI,"_freeHighlight",null),cg(WI,"_freeHighlightClipId","");let IW=WI;class NS{constructor(){f(this,cc,Object.create(null))}updateProperty(g,I){this[g]=I,this.updateSVGProperty(g,I)}updateProperties(g){if(g)for(const[I,e]of Object.entries(g))I.startsWith("_")||this.updateProperty(I,e)}updateSVGProperty(g,I){c(this,cc)[g]=I}toSVGProperties(){const g=c(this,cc);return V(this,cc,Object.create(null)),{root:g}}reset(){V(this,cc,Object.create(null))}updateAll(g=this){this.updateProperties(g)}clone(){jI("Not implemented")}}cc=new WeakMap;const dI=class dI extends qI{constructor(I){super(I);f(this,ZI);f(this,Vi,null);f(this,au);cg(this,"_colorPicker",null);cg(this,"_drawId",null);V(this,au,I.mustBeCommitted||!1),this._addOutlines(I)}onUpdatedColor(){var I;(I=this._colorPicker)==null||I.update(this.color),super.onUpdatedColor()}_addOutlines(I){I.drawOutlines&&(X(this,ZI,w5).call(this,I),X(this,ZI,mG).call(this))}static _mergeSVGProperties(I,e){const t=new Set(Object.keys(I));for(const[i,A]of Object.entries(e))t.has(i)?Object.assign(I[i],A):I[i]=A;return I}static getDefaultDrawingOptions(I){jI("Not implemented")}static get typesMap(){jI("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(I,e){const t=this.typesMap.get(I);t&&this._defaultDrawingOptions.updateProperty(t,e),this._currentParent&&(c(dI,ue).updateProperty(t,e),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(I,e){const t=this.constructor.typesMap.get(I);t&&this._updateProperty(I,t,e)}static get defaultPropertiesToUpdate(){const I=[],e=this._defaultDrawingOptions;for(const[t,i]of this.typesMap)I.push([t,e[i]]);return I}get propertiesToUpdate(){const I=[],{_drawingOptions:e}=this;for(const[t,i]of this.constructor.typesMap)I.push([t,e[i]]);return I}_updateProperty(I,e,t){const i=this._drawingOptions,A=i[e],n=l=>{var a;i.updateProperty(e,l);const o=c(this,Vi).updateProperty(e,l);o&&X(this,ZI,uG).call(this,o),(a=this.parent)==null||a.drawLayer.updateProperties(this._drawId,i.toSVGProperties()),I===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,A),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:I,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var I;(I=this.parent)==null||I.drawLayer.updateProperties(this._drawId,dI._mergeSVGProperties(c(this,Vi).getPathResizingSVGProperties(X(this,ZI,N2).call(this)),{bbox:X(this,ZI,vu).call(this)}))}_onResized(){var I;(I=this.parent)==null||I.drawLayer.updateProperties(this._drawId,dI._mergeSVGProperties(c(this,Vi).getPathResizedSVGProperties(X(this,ZI,N2).call(this)),{bbox:X(this,ZI,vu).call(this)}))}_onTranslating(I,e){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{bbox:X(this,ZI,vu).call(this)})}_onTranslated(){var I;(I=this.parent)==null||I.drawLayer.updateProperties(this._drawId,dI._mergeSVGProperties(c(this,Vi).getPathTranslatedSVGProperties(X(this,ZI,N2).call(this),this.parentDimensions),{bbox:X(this,ZI,vu).call(this)}))}_onStartDragging(){var I;(I=this.parent)==null||I.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var I;(I=this.parent)==null||I.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(I){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,c(this,au)&&(V(this,au,!1),this.commit(),this.parent.setSelected(this),I&&this.isOnScreen&&this.div.focus())}remove(){X(this,ZI,B5).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(X(this,ZI,mG).call(this),X(this,ZI,uG).call(this,c(this,Vi).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(I){var t;let e=!1;this.parent&&!I?(this._uiManager.removeShouldRescale(this),X(this,ZI,B5).call(this)):I&&(this._uiManager.addShouldRescale(this),X(this,ZI,mG).call(this,I),e=!this.parent&&((t=this.div)==null?void 0:t.classList.contains("selectedEditor"))),super.setParent(I),e&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,dI._mergeSVGProperties({bbox:X(this,ZI,vu).call(this)},c(this,Vi).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&X(this,ZI,uG).call(this,c(this,Vi).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let I,e;this._isCopy&&(I=this.x,e=this.y);const t=super.render();t.classList.add("draw");const i=document.createElement("div");return t.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(I,e),t}static createDrawerInstance(I,e,t,i,A){jI("Not implemented")}static startDrawing(I,e,t,i){var w;const{target:A,offsetX:n,offsetY:l,pointerId:o,pointerType:a}=i;if(ve.isInitializedAndDifferentPointerType(a))return;const{viewport:{rotation:d}}=I,{width:m,height:u}=A.getBoundingClientRect(),h=V(dI,rc,new AbortController),Z=I.combinedSignal(h);if(ve.setPointer(a,o),window.addEventListener("pointerup",G=>{ve.isSamePointerIdOrRemove(G.pointerId)&&this._endDraw(G)},{signal:Z}),window.addEventListener("pointercancel",G=>{ve.isSamePointerIdOrRemove(G.pointerId)&&this._currentParent.endDrawingSession()},{signal:Z}),window.addEventListener("pointerdown",G=>{ve.isSamePointerType(G.pointerType)&&(ve.initializeAndAddPointerId(G.pointerId),c(dI,ue).isCancellable()&&(c(dI,ue).removeLastElement(),c(dI,ue).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:Z}),window.addEventListener("contextmenu",Ji,{signal:Z}),A.addEventListener("pointermove",this._drawMove.bind(this),{signal:Z}),A.addEventListener("touchmove",G=>{ve.isSameTimeStamp(G.timeStamp)&&wC(G)},{signal:Z}),I.toggleDrawing(),(w=e._editorUndoBar)==null||w.hide(),c(dI,ue)){I.drawLayer.updateProperties(this._currentDrawId,c(dI,ue).startNew(n,l,m,u,d));return}e.updateUIForDefaultProperties(this),V(dI,ue,this.createDrawerInstance(n,l,m,u,d)),V(dI,mc,this.getDefaultDrawingOptions()),this._currentParent=I,{id:this._currentDrawId}=I.drawLayer.draw(this._mergeSVGProperties(c(dI,mc).toSVGProperties(),c(dI,ue).defaultSVGProperties),!0,!1)}static _drawMove(I){if(ve.isSameTimeStamp(I.timeStamp),!c(dI,ue))return;const{offsetX:e,offsetY:t,pointerId:i}=I;if(ve.isSamePointerId(i)){if(ve.isUsingMultiplePointers()){this._endDraw(I);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,c(dI,ue).add(e,t)),ve.setTimeStamp(I.timeStamp),wC(I)}}static _cleanup(I){I&&(this._currentDrawId=-1,this._currentParent=null,V(dI,ue,null),V(dI,mc,null),ve.clearPointerType(),ve.clearTimeStamp()),c(dI,rc)&&(c(dI,rc).abort(),V(dI,rc,null),ve.clearPointerIds())}static _endDraw(I){const e=this._currentParent;if(e){if(e.toggleDrawing(!0),this._cleanup(!1),(I==null?void 0:I.target)===e.div&&e.drawLayer.updateProperties(this._currentDrawId,c(dI,ue).end(I.offsetX,I.offsetY)),this.supportMultipleDrawings){const t=c(dI,ue),i=this._currentDrawId,A=t.getLastElement();e.addCommands({cmd:()=>{e.drawLayer.updateProperties(i,t.setLastElement(A))},undo:()=>{e.drawLayer.updateProperties(i,t.removeLastElement())},mustExec:!1,type:mI.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(I){const e=this._currentParent;if(!e)return null;if(e.toggleDrawing(!0),e.cleanUndoStack(mI.DRAW_STEP),!c(dI,ue).isEmpty()){const{pageDimensions:[t,i],scale:A}=e,n=e.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:c(dI,ue).getOutlines(t*A,i*A,A,this._INNER_MARGIN),drawingOptions:c(dI,mc),mustBeCommitted:!I});return this._cleanup(!0),n}return e.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(I){}static deserializeDraw(I,e,t,i,A,n){jI("Not implemented")}static async deserialize(I,e,t){var d,m;const{rawDims:{pageWidth:i,pageHeight:A,pageX:n,pageY:l}}=e.viewport,o=this.deserializeDraw(n,l,i,A,this._INNER_MARGIN,I),a=await super.deserialize(I,e,t);return a.createDrawingOptions(I),X(d=a,ZI,w5).call(d,{drawOutlines:o}),X(m=a,ZI,mG).call(m),a.onScaleChanging(),a.rotate(),a}serializeDraw(I){const[e,t]=this.pageTranslation,[i,A]=this.pageDimensions;return c(this,Vi).serialize([e,t,i,A],I)}renderAnnotationElement(I){return I.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};Vi=new WeakMap,au=new WeakMap,ue=new WeakMap,rc=new WeakMap,mc=new WeakMap,ZI=new WeakSet,w5=function({drawOutlines:I,drawId:e,drawingOptions:t}){V(this,Vi,I),this._drawingOptions||(this._drawingOptions=t),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),e>=0?(this._drawId=e,this.parent.drawLayer.finalizeDraw(e,I.defaultProperties)):this._drawId=X(this,ZI,W5).call(this,I,this.parent),X(this,ZI,uG).call(this,I.box)},W5=function(I,e){const{id:t}=e.drawLayer.draw(dI._mergeSVGProperties(this._drawingOptions.toSVGProperties(),I.defaultSVGProperties),!1,!1);return t},B5=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},mG=function(I=this.parent){if(!(this._drawId!==null&&this.parent===I)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,I.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=X(this,ZI,W5).call(this,c(this,Vi),I)}},rv=function([I,e,t,i]){const{parentDimensions:[A,n],rotation:l}=this;switch(l){case 90:return[e,1-I,t*(n/A),i*(A/n)];case 180:return[1-I,1-e,t,i];case 270:return[1-e,I,t*(n/A),i*(A/n)];default:return[I,e,t,i]}},N2=function(){const{x:I,y:e,width:t,height:i,parentDimensions:[A,n],rotation:l}=this;switch(l){case 90:return[1-e,I,t*(A/n),i*(n/A)];case 180:return[1-I,1-e,t,i];case 270:return[e,1-I,t*(A/n),i*(n/A)];default:return[I,e,t,i]}},uG=function(I){[this.x,this.y,this.width,this.height]=X(this,ZI,rv).call(this,I),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},vu=function(){const{x:I,y:e,width:t,height:i,rotation:A,parentRotation:n,parentDimensions:[l,o]}=this;switch((A*4+n)/90){case 1:return[1-e-i,I,i,t];case 2:return[1-I-t,1-e-i,t,i];case 3:return[e,1-I-t,i,t];case 4:return[I,e-t*(l/o),i*(o/l),t*(l/o)];case 5:return[1-e,I,t*(l/o),i*(o/l)];case 6:return[1-I-i*(o/l),1-e,i*(o/l),t*(l/o)];case 7:return[e-t*(l/o),1-I-i*(o/l),t*(l/o),i*(o/l)];case 8:return[I-t,e-i,t,i];case 9:return[1-e,I-t,i,t];case 10:return[1-I,1-e,t,i];case 11:return[e-i,1-I,i,t];case 12:return[I-i*(o/l),e,i*(o/l),t*(l/o)];case 13:return[1-e-t*(l/o),I-i*(o/l),t*(l/o),i*(o/l)];case 14:return[1-I,1-e-t*(l/o),i*(o/l),t*(l/o)];case 15:return[e,1-I,t*(l/o),i*(o/l)];default:return[I,e,t,i]}},cg(dI,"_currentDrawId",-1),cg(dI,"_currentParent",null),f(dI,ue,null),f(dI,rc,null),f(dI,mc,null),cg(dI,"_INNER_MARGIN",3);let CW=dI;class qjg{constructor(g,I,e,t,i,A){f(this,cu);f(this,xn,new Float64Array(6));f(this,he);f(this,be);f(this,uc);f(this,du);f(this,Bt);f(this,Se,"");f(this,dA,0);f(this,hc,new Qh);f(this,bc);f(this,Zc);V(this,bc,e),V(this,Zc,t),V(this,uc,i),V(this,du,A),[g,I]=X(this,cu,M2).call(this,g,I);const n=V(this,he,[NaN,NaN,NaN,NaN,g,I]);V(this,Bt,[g,I]),V(this,be,[{line:n,points:c(this,Bt)}]),c(this,xn).set(n,0)}updateProperty(g,I){g==="stroke-width"&&V(this,du,I)}isEmpty(){return!c(this,be)||c(this,be).length===0}isCancellable(){return c(this,Bt).length<=10}add(g,I){[g,I]=X(this,cu,M2).call(this,g,I);const[e,t,i,A]=c(this,xn).subarray(2,6),n=g-i,l=I-A;return Math.hypot(c(this,bc)*n,c(this,Zc)*l)<=2?null:(c(this,Bt).push(g,I),isNaN(e)?(c(this,xn).set([i,A,g,I],2),c(this,he).push(NaN,NaN,NaN,NaN,g,I),{path:{d:this.toSVGPath()}}):(isNaN(c(this,xn)[0])&&c(this,he).splice(6,6),c(this,xn).set([e,t,i,A,g,I],0),c(this,he).push(...Vg.createBezierPoints(e,t,i,A,g,I)),{path:{d:this.toSVGPath()}}))}end(g,I){const e=this.add(g,I);return e||(c(this,Bt).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(g,I,e,t,i){V(this,bc,e),V(this,Zc,t),V(this,uc,i),[g,I]=X(this,cu,M2).call(this,g,I);const A=V(this,he,[NaN,NaN,NaN,NaN,g,I]);V(this,Bt,[g,I]);const n=c(this,be).at(-1);return n&&(n.line=new Float32Array(n.line),n.points=new Float32Array(n.points)),c(this,be).push({line:A,points:c(this,Bt)}),c(this,xn).set(A,0),V(this,dA,0),this.toSVGPath(),null}getLastElement(){return c(this,be).at(-1)}setLastElement(g){return c(this,be)?(c(this,be).push(g),V(this,he,g.line),V(this,Bt,g.points),V(this,dA,0),{path:{d:this.toSVGPath()}}):c(this,hc).setLastElement(g)}removeLastElement(){if(!c(this,be))return c(this,hc).removeLastElement();c(this,be).pop(),V(this,Se,"");for(let g=0,I=c(this,be).length;g<I;g++){const{line:e,points:t}=c(this,be)[g];V(this,he,e),V(this,Bt,t),V(this,dA,0),this.toSVGPath()}return{path:{d:c(this,Se)}}}toSVGPath(){const g=Vg.svgRound(c(this,he)[4]),I=Vg.svgRound(c(this,he)[5]);if(c(this,Bt).length===2)return V(this,Se,`${c(this,Se)} M ${g} ${I} Z`),c(this,Se);if(c(this,Bt).length<=6){const t=c(this,Se).lastIndexOf("M");V(this,Se,`${c(this,Se).slice(0,t)} M ${g} ${I}`),V(this,dA,6)}if(c(this,Bt).length===4){const t=Vg.svgRound(c(this,he)[10]),i=Vg.svgRound(c(this,he)[11]);return V(this,Se,`${c(this,Se)} L ${t} ${i}`),V(this,dA,12),c(this,Se)}const e=[];c(this,dA)===0&&(e.push(`M ${g} ${I}`),V(this,dA,6));for(let t=c(this,dA),i=c(this,he).length;t<i;t+=6){const[A,n,l,o,a,d]=c(this,he).slice(t,t+6).map(Vg.svgRound);e.push(`C${A} ${n} ${l} ${o} ${a} ${d}`)}return V(this,Se,c(this,Se)+e.join(" ")),V(this,dA,c(this,he).length),c(this,Se)}getOutlines(g,I,e,t){const i=c(this,be).at(-1);return i.line=new Float32Array(i.line),i.points=new Float32Array(i.points),c(this,hc).build(c(this,be),g,I,e,c(this,uc),c(this,du),t),V(this,xn,null),V(this,he,null),V(this,be,null),V(this,Se,null),c(this,hc)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}xn=new WeakMap,he=new WeakMap,be=new WeakMap,uc=new WeakMap,du=new WeakMap,Bt=new WeakMap,Se=new WeakMap,dA=new WeakMap,hc=new WeakMap,bc=new WeakMap,Zc=new WeakMap,cu=new WeakSet,M2=function(g,I){return Vg._normalizePoint(g,I,c(this,bc),c(this,Zc),c(this,uc))};class Qh extends Vg{constructor(){super(...arguments);f(this,Ke);f(this,pt);f(this,fZ,0);f(this,XZ);f(this,Ni);f(this,On);f(this,Qn);f(this,ru);f(this,mu);f(this,Gc)}build(I,e,t,i,A,n,l){V(this,On,e),V(this,Qn,t),V(this,ru,i),V(this,mu,A),V(this,Gc,n),V(this,XZ,l??0),V(this,Ni,I),X(this,Ke,uv).call(this)}get thickness(){return c(this,Gc)}setLastElement(I){return c(this,Ni).push(I),{path:{d:this.toSVGPath()}}}removeLastElement(){return c(this,Ni).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const I=[];for(const{line:e}of c(this,Ni)){if(I.push(`M${Vg.svgRound(e[4])} ${Vg.svgRound(e[5])}`),e.length===6){I.push("Z");continue}if(e.length===12&&isNaN(e[6])){I.push(`L${Vg.svgRound(e[10])} ${Vg.svgRound(e[11])}`);continue}for(let t=6,i=e.length;t<i;t+=6){const[A,n,l,o,a,d]=e.subarray(t,t+6).map(Vg.svgRound);I.push(`C${A} ${n} ${l} ${o} ${a} ${d}`)}}return I.join("")}serialize([I,e,t,i],A){const n=[],l=[],[o,a,d,m]=X(this,Ke,mv).call(this);let u,h,Z,w,G,B,p,y,Y;switch(c(this,mu)){case 0:Y=Vg._rescale,u=I,h=e+i,Z=t,w=-i,G=I+o*t,B=e+(1-a-m)*i,p=I+(o+d)*t,y=e+(1-a)*i;break;case 90:Y=Vg._rescaleAndSwap,u=I,h=e,Z=t,w=i,G=I+a*t,B=e+o*i,p=I+(a+m)*t,y=e+(o+d)*i;break;case 180:Y=Vg._rescale,u=I+t,h=e,Z=-t,w=i,G=I+(1-o-d)*t,B=e+a*i,p=I+(1-o)*t,y=e+(a+m)*i;break;case 270:Y=Vg._rescaleAndSwap,u=I+t,h=e+i,Z=-t,w=-i,G=I+(1-a-m)*t,B=e+(1-o-d)*i,p=I+(1-a)*t,y=e+(1-o)*i;break}for(const{line:R,points:M}of c(this,Ni))n.push(Y(R,u,h,Z,w,A?new Array(R.length):null)),l.push(Y(M,u,h,Z,w,A?new Array(M.length):null));return{lines:n,points:l,rect:[G,B,p,y]}}static deserialize(I,e,t,i,A,{paths:{lines:n,points:l},rotation:o,thickness:a}){const d=[];let m,u,h,Z,w;switch(o){case 0:w=Vg._rescale,m=-I/t,u=e/i+1,h=1/t,Z=-1/i;break;case 90:w=Vg._rescaleAndSwap,m=-e/i,u=-I/t,h=1/i,Z=1/t;break;case 180:w=Vg._rescale,m=I/t+1,u=-e/i,h=-1/t,Z=1/i;break;case 270:w=Vg._rescaleAndSwap,m=e/i+1,u=I/t+1,h=-1/i,Z=-1/t;break}if(!n){n=[];for(const B of l){const p=B.length;if(p===2){n.push(new Float32Array([NaN,NaN,NaN,NaN,B[0],B[1]]));continue}if(p===4){n.push(new Float32Array([NaN,NaN,NaN,NaN,B[0],B[1],NaN,NaN,NaN,NaN,B[2],B[3]]));continue}const y=new Float32Array(3*(p-2));n.push(y);let[Y,R,M,S]=B.subarray(0,4);y.set([NaN,NaN,NaN,NaN,Y,R],0);for(let J=4;J<p;J+=2){const D=B[J],H=B[J+1];y.set(Vg.createBezierPoints(Y,R,M,S,D,H),(J-2)*3),[Y,R,M,S]=[M,S,D,H]}}}for(let B=0,p=n.length;B<p;B++)d.push({line:w(n[B].map(y=>y??NaN),m,u,h,Z),points:w(l[B].map(y=>y??NaN),m,u,h,Z)});const G=new this.prototype.constructor;return G.build(d,t,i,1,o,a,A),G}get box(){return c(this,pt)}updateProperty(I,e){return I==="stroke-width"?X(this,Ke,hv).call(this,e):null}updateParentDimensions([I,e],t){const[i,A]=X(this,Ke,Gs).call(this);V(this,On,I),V(this,Qn,e),V(this,ru,t);const[n,l]=X(this,Ke,Gs).call(this),o=n-i,a=l-A,d=c(this,pt);return d[0]-=o,d[1]-=a,d[2]+=2*o,d[3]+=2*a,d}updateRotation(I){return V(this,fZ,I),{path:{transform:this.rotationTransform}}}get viewBox(){return c(this,pt).map(Vg.svgRound).join(" ")}get defaultProperties(){const[I,e]=c(this,pt);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Vg.svgRound(I)} ${Vg.svgRound(e)}`}}}get rotationTransform(){const[,,I,e]=c(this,pt);let t=0,i=0,A=0,n=0,l=0,o=0;switch(c(this,fZ)){case 90:i=e/I,A=-I/e,l=I;break;case 180:t=-1,n=-1,l=I,o=e;break;case 270:i=-e/I,A=I/e,o=e;break;default:return""}return`matrix(${t} ${i} ${A} ${n} ${Vg.svgRound(l)} ${Vg.svgRound(o)})`}getPathResizingSVGProperties([I,e,t,i]){const[A,n]=X(this,Ke,Gs).call(this),[l,o,a,d]=c(this,pt);if(Math.abs(a-A)<=Vg.PRECISION||Math.abs(d-n)<=Vg.PRECISION){const w=I+t/2-(l+a/2),G=e+i/2-(o+d/2);return{path:{"transform-origin":`${Vg.svgRound(I)} ${Vg.svgRound(e)}`,transform:`${this.rotationTransform} translate(${w} ${G})`}}}const m=(t-2*A)/(a-2*A),u=(i-2*n)/(d-2*n),h=a/t,Z=d/i;return{path:{"transform-origin":`${Vg.svgRound(l)} ${Vg.svgRound(o)}`,transform:`${this.rotationTransform} scale(${h} ${Z}) translate(${Vg.svgRound(A)} ${Vg.svgRound(n)}) scale(${m} ${u}) translate(${Vg.svgRound(-A)} ${Vg.svgRound(-n)})`}}}getPathResizedSVGProperties([I,e,t,i]){const[A,n]=X(this,Ke,Gs).call(this),l=c(this,pt),[o,a,d,m]=l;if(l[0]=I,l[1]=e,l[2]=t,l[3]=i,Math.abs(d-A)<=Vg.PRECISION||Math.abs(m-n)<=Vg.PRECISION){const G=I+t/2-(o+d/2),B=e+i/2-(a+m/2);for(const{line:p,points:y}of c(this,Ni))Vg._translate(p,G,B,p),Vg._translate(y,G,B,y);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Vg.svgRound(I)} ${Vg.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const u=(t-2*A)/(d-2*A),h=(i-2*n)/(m-2*n),Z=-u*(o+A)+I+A,w=-h*(a+n)+e+n;if(u!==1||h!==1||Z!==0||w!==0)for(const{line:G,points:B}of c(this,Ni))Vg._rescale(G,Z,w,u,h,G),Vg._rescale(B,Z,w,u,h,B);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Vg.svgRound(I)} ${Vg.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([I,e],t){const[i,A]=t,n=c(this,pt),l=I-n[0],o=e-n[1];if(c(this,On)===i&&c(this,Qn)===A)for(const{line:a,points:d}of c(this,Ni))Vg._translate(a,l,o,a),Vg._translate(d,l,o,d);else{const a=c(this,On)/i,d=c(this,Qn)/A;V(this,On,i),V(this,Qn,A);for(const{line:m,points:u}of c(this,Ni))Vg._rescale(m,l,o,a,d,m),Vg._rescale(u,l,o,a,d,u);n[2]*=a,n[3]*=d}return n[0]=I,n[1]=e,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Vg.svgRound(I)} ${Vg.svgRound(e)}`}}}get defaultSVGProperties(){const I=c(this,pt);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Vg.svgRound(I[0])} ${Vg.svgRound(I[1])}`,transform:this.rotationTransform||null},bbox:I}}}pt=new WeakMap,fZ=new WeakMap,XZ=new WeakMap,Ni=new WeakMap,On=new WeakMap,Qn=new WeakMap,ru=new WeakMap,mu=new WeakMap,Gc=new WeakMap,Ke=new WeakSet,Gs=function(I=c(this,Gc)){const e=c(this,XZ)+I/2*c(this,ru);return c(this,mu)%180===0?[e/c(this,On),e/c(this,Qn)]:[e/c(this,Qn),e/c(this,On)]},mv=function(){const[I,e,t,i]=c(this,pt),[A,n]=X(this,Ke,Gs).call(this,0);return[I+A,e+n,t-2*A,i-2*n]},uv=function(){const I=V(this,pt,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:i}of c(this,Ni)){if(i.length<=12){for(let l=4,o=i.length;l<o;l+=6)Mg.pointBoundingBox(i[l],i[l+1],I);continue}let A=i[4],n=i[5];for(let l=6,o=i.length;l<o;l+=6){const[a,d,m,u,h,Z]=i.subarray(l,l+6);Mg.bezierBoundingBox(A,n,a,d,m,u,h,Z,I),A=h,n=Z}}const[e,t]=X(this,Ke,Gs).call(this);I[0]=mt(I[0]-e,0,1),I[1]=mt(I[1]-t,0,1),I[2]=mt(I[2]+e,0,1),I[3]=mt(I[3]+t,0,1),I[2]-=I[0],I[3]-=I[1]},hv=function(I){const[e,t]=X(this,Ke,Gs).call(this);V(this,Gc,I);const[i,A]=X(this,Ke,Gs).call(this),[n,l]=[i-e,A-t],o=c(this,pt);return o[0]-=n,o[1]-=l,o[2]+=2*n,o[3]+=2*l,o};class eW extends NS{constructor(g){super(),this._viewParameters=g,super.updateProperties({fill:"none",stroke:qI._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(g,I){g==="stroke-width"&&(I??(I=this["stroke-width"]),I*=this._viewParameters.realScale),super.updateSVGProperty(g,I)}clone(){const g=new eW(this._viewParameters);return g.updateAll(this),g}}const uu=class uu extends CW{constructor(I){super({...I,name:"inkEditor"});f(this,cp);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(I,e){qI.initialize(I,e),this._defaultDrawingOptions=new eW(e.viewParameters)}static getDefaultDrawingOptions(I){const e=this._defaultDrawingOptions.clone();return e.updateProperties(I),e}static get supportMultipleDrawings(){return!0}static get typesMap(){return Og(this,"typesMap",new Map([[mI.INK_THICKNESS,"stroke-width"],[mI.INK_COLOR,"stroke"],[mI.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(I,e,t,i,A){return new qjg(I,e,t,i,A,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(I,e,t,i,A,n){return Qh.deserialize(I,e,t,i,A,n)}static async deserialize(I,e,t){let i=null;if(I instanceof BV){const{data:{inkLists:n,rect:l,rotation:o,id:a,color:d,opacity:m,borderStyle:{rawWidth:u},popupRef:h,richText:Z,contentsObj:w,creationDate:G,modificationDate:B},parent:{page:{pageNumber:p}}}=I;i=I={annotationType:Ug.INK,color:Array.from(d),thickness:u,opacity:m,paths:{points:n},boxes:null,pageIndex:p-1,rect:l.slice(0),rotation:o,annotationElementId:a,id:a,deleted:!1,popupRef:h,richText:Z,comment:(w==null?void 0:w.str)||null,creationDate:G,modificationDate:B}}const A=await super.deserialize(I,e,t);return A._initialData=i,I.comment&&A.setCommentData(I),A}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new _w(this)),[["colorPicker",this._colorPicker]]}get colorType(){return mI.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:I,_drawingOptions:e,parent:t}=this;e.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(I,e.toSVGProperties())}static onScaleChangingWhenDrawing(){const I=this._currentParent;I&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),I.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:I,thickness:e,opacity:t}){this._drawingOptions=uu.getDefaultDrawingOptions({stroke:Mg.makeHexColor(...I),"stroke-width":e,"stroke-opacity":t})}serialize(I=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:e,points:t}=this.serializeDraw(I),{_drawingOptions:{stroke:i,"stroke-opacity":A,"stroke-width":n}}=this,l=Object.assign(super.serialize(I),{color:qI._colorManager.convert(i),opacity:A,thickness:n,paths:{lines:e,points:t}});return this.addComment(l),I?(l.isCopy=!0,l):this.annotationElementId&&!X(this,cp,bv).call(this,l)?null:(l.id=this.annotationElementId,l)}renderAnnotationElement(I){if(this.deleted)return I.hide(),null;const{points:e,rect:t}=this.serializeDraw(!1);return I.updateEdited({rect:t,thickness:this._drawingOptions["stroke-width"],points:e,popup:this.comment}),null}};cp=new WeakSet,bv=function(I){const{color:e,thickness:t,opacity:i,pageIndex:A}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||I.color.some((n,l)=>n!==e[l])||I.thickness!==t||I.opacity!==i||I.pageIndex!==A},cg(uu,"_type","ink"),cg(uu,"_editorType",Ug.INK),cg(uu,"_defaultDrawingOptions",null);let NV=uu;class MV extends Qh{toSVGPath(){let g=super.toSVGPath();return g.endsWith("Z")||(g+="Z"),g}}const tW=8,Uh=3;class ll{static extractContoursFromText(g,{fontFamily:I,fontStyle:e,fontWeight:t},i,A,n,l){let o=new OffscreenCanvas(1,1),a=o.getContext("2d",{alpha:!1});const d=200,m=a.font=`${e} ${t} ${d}px ${I}`,{actualBoundingBoxLeft:u,actualBoundingBoxRight:h,actualBoundingBoxAscent:Z,actualBoundingBoxDescent:w,fontBoundingBoxAscent:G,fontBoundingBoxDescent:B,width:p}=a.measureText(g),y=1.5,Y=Math.ceil(Math.max(Math.abs(u)+Math.abs(h)||0,p)*y),R=Math.ceil(Math.max(Math.abs(Z)+Math.abs(w)||d,Math.abs(G)+Math.abs(B)||d)*y);o=new OffscreenCanvas(Y,R),a=o.getContext("2d",{alpha:!0,willReadFrequently:!0}),a.font=m,a.filter="grayscale(1)",a.fillStyle="white",a.fillRect(0,0,Y,R),a.fillStyle="black",a.fillText(g,Y*(y-1)/2,R*(3-y)/2);const M=X(this,pI,Y5).call(this,a.getImageData(0,0,Y,R).data),S=X(this,pI,Bv).call(this,M),J=X(this,pI,V5).call(this,S),D=X(this,pI,y5).call(this,M,Y,R,J);return this.processDrawnLines({lines:{curves:D,width:Y,height:R},pageWidth:i,pageHeight:A,rotation:n,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(g,I,e,t,i){const[A,n,l]=X(this,pI,pv).call(this,g),[o,a]=X(this,pI,Wv).call(this,A,n,l,Math.hypot(n,l)*c(this,wc).sigmaSFactor,c(this,wc).sigmaR,c(this,wc).kernelSize),d=X(this,pI,V5).call(this,a),m=X(this,pI,y5).call(this,o,n,l,d);return this.processDrawnLines({lines:{curves:m,width:n,height:l},pageWidth:I,pageHeight:e,rotation:t,innerMargin:i,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:g,pageWidth:I,pageHeight:e,rotation:t,innerMargin:i,mustSmooth:A,areContours:n}){t%180!==0&&([I,e]=[e,I]);const{curves:l,width:o,height:a}=g,d=g.thickness??0,m=[],u=Math.min(I/o,e/a),h=u/I,Z=u/e,w=[];for(const{points:B}of l){const p=A?X(this,pI,wv).call(this,B):B;if(!p)continue;w.push(p);const y=p.length,Y=new Float32Array(y),R=new Float32Array(3*(y===2?2:y-2));if(m.push({line:R,points:Y}),y===2){Y[0]=p[0]*h,Y[1]=p[1]*Z,R.set([NaN,NaN,NaN,NaN,Y[0],Y[1]],0);continue}let[M,S,J,D]=p;M*=h,S*=Z,J*=h,D*=Z,Y.set([M,S,J,D],0),R.set([NaN,NaN,NaN,NaN,M,S],0);for(let H=4;H<y;H+=2){const F=Y[H]=p[H]*h,x=Y[H+1]=p[H+1]*Z;R.set(Vg.createBezierPoints(M,S,J,D,F,x),(H-2)*3),[M,S,J,D]=[J,D,F,x]}}if(m.length===0)return null;const G=n?new MV:new Qh;return G.build(m,I,e,1,t,n?0:d,i),{outline:G,newCurves:w,areContours:n,thickness:d,width:o,height:a}}static async compressSignature({outlines:g,areContours:I,thickness:e,width:t,height:i}){let A=1/0,n=-1/0,l=0;for(const p of g){l+=p.length;for(let y=2,Y=p.length;y<Y;y++){const R=p[y]-p[y-2];A=Math.min(A,R),n=Math.max(n,R)}}let o;A>=-128&&n<=127?o=Int8Array:A>=-32768&&n<=32767?o=Int16Array:o=Int32Array;const a=g.length,d=tW+Uh*a,m=new Uint32Array(d);let u=0;m[u++]=d*Uint32Array.BYTES_PER_ELEMENT+(l-2*a)*o.BYTES_PER_ELEMENT,m[u++]=0,m[u++]=t,m[u++]=i,m[u++]=I?0:1,m[u++]=Math.max(0,Math.floor(e??0)),m[u++]=a,m[u++]=o.BYTES_PER_ELEMENT;for(const p of g)m[u++]=p.length-2,m[u++]=p[0],m[u++]=p[1];const h=new CompressionStream("deflate-raw"),Z=h.writable.getWriter();await Z.ready,Z.write(m);const w=o.prototype.constructor;for(const p of g){const y=new w(p.length-2);for(let Y=2,R=p.length;Y<R;Y++)y[Y-2]=p[Y]-p[Y-2];Z.write(y)}Z.close();const G=await new Response(h.readable).arrayBuffer(),B=new Uint8Array(G);return XD(B)}static async decompressSignature(g){try{const I=mvg(g),{readable:e,writable:t}=new DecompressionStream("deflate-raw"),i=t.getWriter();await i.ready,i.write(I).then(async()=>{await i.ready,await i.close()}).catch(()=>{});let A=null,n=0;for await(const p of e)A||(A=new Uint8Array(new Uint32Array(p.buffer,0,4)[0])),A.set(p,n),n+=p.length;const l=new Uint32Array(A.buffer,0,A.length>>2),o=l[1];if(o!==0)throw new Error(`Invalid version: ${o}`);const a=l[2],d=l[3],m=l[4]===0,u=l[5],h=l[6],Z=l[7],w=[],G=(tW+Uh*h)*Uint32Array.BYTES_PER_ELEMENT;let B;switch(Z){case Int8Array.BYTES_PER_ELEMENT:B=new Int8Array(A.buffer,G);break;case Int16Array.BYTES_PER_ELEMENT:B=new Int16Array(A.buffer,G);break;case Int32Array.BYTES_PER_ELEMENT:B=new Int32Array(A.buffer,G);break}n=0;for(let p=0;p<h;p++){const y=l[Uh*p+tW],Y=new Float32Array(y+2);w.push(Y);for(let R=0;R<Uh-1;R++)Y[R]=l[Uh*p+tW+R+1];for(let R=0;R<y;R++)Y[R+2]=Y[R]+B[n++]}return{areContours:m,thickness:u,outlines:w,width:a,height:d}}catch(I){return xg(`decompressSignature: ${I}`),null}}}wc=new WeakMap,pI=new WeakSet,p5=function(g,I,e,t){return e-=g,t-=I,e===0?t>0?0:4:e===1?t+6:2-t},QA=new WeakMap,Zv=function(g,I,e,t,i,A,n){const l=X(this,pI,p5).call(this,e,t,i,A);for(let o=0;o<8;o++){const a=(-o+l-n+16)%8,d=c(this,QA)[2*a],m=c(this,QA)[2*a+1];if(g[(e+d)*I+(t+m)]!==0)return a}return-1},Gv=function(g,I,e,t,i,A,n){const l=X(this,pI,p5).call(this,e,t,i,A);for(let o=0;o<8;o++){const a=(o+l+n+16)%8,d=c(this,QA)[2*a],m=c(this,QA)[2*a+1];if(g[(e+d)*I+(t+m)]!==0)return a}return-1},y5=function(g,I,e,t){const i=g.length,A=new Int32Array(i);for(let a=0;a<i;a++)A[a]=g[a]<=t?1:0;for(let a=1;a<e-1;a++)A[a*I]=A[a*I+I-1]=0;for(let a=0;a<I;a++)A[a]=A[I*e-1-a]=0;let n=1,l;const o=[];for(let a=1;a<e-1;a++){l=1;for(let d=1;d<I-1;d++){const m=a*I+d,u=A[m];if(u===0)continue;let h=a,Z=d;if(u===1&&A[m-1]===0)n+=1,Z-=1;else if(u>=1&&A[m+1]===0)n+=1,Z+=1,u>1&&(l=u);else{u!==1&&(l=Math.abs(u));continue}const w=[d,a],G=Z===d+1,B={isHole:G,points:w,id:n,parent:0};o.push(B);let p;for(const H of o)if(H.id===l){p=H;break}p?p.isHole?B.parent=G?p.parent:l:B.parent=G?l:p.parent:B.parent=G?l:0;const y=X(this,pI,Zv).call(this,A,I,a,d,h,Z,0);if(y===-1){A[m]=-n,A[m]!==1&&(l=Math.abs(A[m]));continue}let Y=c(this,QA)[2*y],R=c(this,QA)[2*y+1];const M=a+Y,S=d+R;h=M,Z=S;let J=a,D=d;for(;;){const H=X(this,pI,Gv).call(this,A,I,J,D,h,Z,1);Y=c(this,QA)[2*H],R=c(this,QA)[2*H+1];const F=J+Y,x=D+R;w.push(x,F);const q=J*I+D;if(A[q+1]===0?A[q]=-n:A[q]===1&&(A[q]=n),F===a&&x===d&&J===M&&D===S){A[m]!==1&&(l=Math.abs(A[m]));break}else h=J,Z=D,J=F,D=x}}}return o},R2=function(g,I,e,t){if(e-I<=4){for(let M=I;M<e-2;M+=2)t.push(g[M],g[M+1]);return}const i=g[I],A=g[I+1],n=g[e-4]-i,l=g[e-3]-A,o=Math.hypot(n,l),a=n/o,d=l/o,m=a*A-d*i,u=l/n,h=1/o,Z=Math.atan(u),w=Math.cos(Z),G=Math.sin(Z),B=h*(Math.abs(w)+Math.abs(G)),p=h*(1-B+B**2),y=Math.max(Math.atan(Math.abs(G+w)*p),Math.atan(Math.abs(G-w)*p));let Y=0,R=I;for(let M=I+2;M<e-2;M+=2){const S=Math.abs(m-a*g[M+1]+d*g[M]);S>Y&&(R=M,Y=S)}Y>(o*y)**2?(X(this,pI,R2).call(this,g,I,R+2,t),X(this,pI,R2).call(this,g,R,e,t)):t.push(i,A)},wv=function(g){const I=[],e=g.length;return X(this,pI,R2).call(this,g,0,e,I),I.push(g[e-2],g[e-1]),I.length<=4?null:I},Wv=function(g,I,e,t,i,A){const n=new Float32Array(A**2),l=-2*t**2,o=A>>1;for(let Z=0;Z<A;Z++){const w=(Z-o)**2;for(let G=0;G<A;G++)n[Z*A+G]=Math.exp((w+(G-o)**2)/l)}const a=new Float32Array(256),d=-2*i**2;for(let Z=0;Z<256;Z++)a[Z]=Math.exp(Z**2/d);const m=g.length,u=new Uint8Array(m),h=new Uint32Array(256);for(let Z=0;Z<e;Z++)for(let w=0;w<I;w++){const G=Z*I+w,B=g[G];let p=0,y=0;for(let R=0;R<A;R++){const M=Z+R-o;if(!(M<0||M>=e))for(let S=0;S<A;S++){const J=w+S-o;if(J<0||J>=I)continue;const D=g[M*I+J],H=n[R*A+S]*a[Math.abs(D-B)];p+=D*H,y+=H}}const Y=u[G]=Math.round(p/y);h[Y]++}return[u,h]},Bv=function(g){const I=new Uint32Array(256);for(const e of g)I[e]++;return I},Y5=function(g){const I=g.length,e=new Uint8ClampedArray(I>>2);let t=-1/0,i=1/0;for(let n=0,l=e.length;n<l;n++){const o=e[n]=g[n<<2];t=Math.max(t,o),i=Math.min(i,o)}const A=255/(t-i);for(let n=0,l=e.length;n<l;n++)e[n]=(e[n]-i)*A;return e},V5=function(g){let I,e=-1/0,t=-1/0;const i=g.findIndex(l=>l!==0);let A=i,n=i;for(I=i;I<256;I++){const l=g[I];l>e&&(I-A>t&&(t=I-A,n=I-1),e=l,A=I)}for(I=n-1;I>=0&&!(g[I]>g[I+1]);I--);return I},pv=function(g){const I=g,{width:e,height:t}=g,{maxDim:i}=c(this,wc);let A=e,n=t;if(e>i||t>i){let m=e,u=t,h=Math.log2(Math.max(e,t)/i);const Z=Math.floor(h);h=h===Z?Z-1:Z;for(let G=0;G<h;G++){A=Math.ceil(m/2),n=Math.ceil(u/2);const B=new OffscreenCanvas(A,n);B.getContext("2d").drawImage(g,0,0,m,u,0,0,A,n),m=A,u=n,g!==I&&g.close(),g=B.transferToImageBitmap()}const w=Math.min(i/A,i/n);A=Math.round(A*w),n=Math.round(n*w)}const o=new OffscreenCanvas(A,n).getContext("2d",{willReadFrequently:!0});o.fillStyle="white",o.fillRect(0,0,A,n),o.filter="grayscale(1)",o.drawImage(g,0,0,g.width,g.height,0,0,A,n);const a=o.getImageData(0,0,A,n).data;return[X(this,pI,Y5).call(this,a),A,n]},f(ll,pI),f(ll,wc,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),f(ll,QA,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class RV extends NS{constructor(){super(),super.updateProperties({fill:qI._defaultLineColor,"stroke-width":0})}clone(){const g=new RV;return g.updateAll(this),g}}class fV extends eW{constructor(g){super(g),super.updateProperties({stroke:qI._defaultLineColor,"stroke-width":1})}clone(){const g=new fV(this._viewParameters);return g.updateAll(this),g}}const Mi=class Mi extends CW{constructor(I){super({...I,mustBeCommitted:!0,name:"signatureEditor"});f(this,xo,!1);f(this,Un,null);f(this,Oo,null);f(this,Wc,null);this._willKeepAspectRatio=!0,V(this,Oo,I.signatureData||null),V(this,Un,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(I,e){qI.initialize(I,e),this._defaultDrawingOptions=new RV,this._defaultDrawnSignatureOptions=new fV(e.viewParameters)}static getDefaultDrawingOptions(I){const e=this._defaultDrawingOptions.clone();return e.updateProperties(I),e}static get supportMultipleDrawings(){return!1}static get typesMap(){return Og(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!c(this,Un)}}static computeTelemetryFinalData(I){const e=I.get("hasDescription");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let I,e;const{_isCopy:t}=this;if(t&&(this._isCopy=!1,I=this.x,e=this.y),super.render(),this._drawId===null)if(c(this,Oo)){const{lines:i,mustSmooth:A,areContours:n,description:l,uuid:o,heightInPage:a}=c(this,Oo),{rawDims:{pageWidth:d,pageHeight:m},rotation:u}=this.parent.viewport,h=ll.processDrawnLines({lines:i,pageWidth:d,pageHeight:m,rotation:u,innerMargin:Mi._INNER_MARGIN,mustSmooth:A,areContours:n});this.addSignature(h,a,l,o)}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:c(this,Un)||""}));return t&&(this._isCopy=!0,this._moveAfterPaste(I,e)),this.div}setUuid(I){V(this,Wc,I),this.addEditToolbar()}getUuid(){return c(this,Wc)}get description(){return c(this,Un)}set description(I){V(this,Un,I),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:I})),super.addEditToolbar().then(e=>{e==null||e.updateEditSignatureButton(I)}))}getSignaturePreview(){const{newCurves:I,areContours:e,thickness:t,width:i,height:A}=c(this,Oo),n=Math.max(i,A),l=ll.processDrawnLines({lines:{curves:I.map(o=>({points:o})),thickness:t,width:i,height:A},pageWidth:n,pageHeight:n,rotation:0,innerMargin:0,mustSmooth:!1,areContours:e});return{areContours:e,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(I,e,t,i){const{x:A,y:n}=this,{outline:l}=V(this,Oo,I);V(this,xo,l instanceof MV),this.description=t;let o;c(this,xo)?o=Mi.getDefaultDrawingOptions():(o=Mi._defaultDrawnSignatureOptions.clone(),o.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:o});const[,a]=this.pageDimensions;let d=e/a;d=d>=1?.5:d,this.width*=d/this.height,this.width>=1&&(d*=.9/this.width,this.width=.9),this.height=d,this.setDims(),this.x=A,this.y=n,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!i,hasDescription:!!t}}),this.div.hidden=!1}getFromImage(I){const{rawDims:{pageWidth:e,pageHeight:t},rotation:i}=this.parent.viewport;return ll.process(I,e,t,i,Mi._INNER_MARGIN)}getFromText(I,e){const{rawDims:{pageWidth:t,pageHeight:i},rotation:A}=this.parent.viewport;return ll.extractContoursFromText(I,e,t,i,A,Mi._INNER_MARGIN)}getDrawnSignature(I){const{rawDims:{pageWidth:e,pageHeight:t},rotation:i}=this.parent.viewport;return ll.processDrawnLines({lines:I,pageWidth:e,pageHeight:t,rotation:i,innerMargin:Mi._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:I,thickness:e}){I?this._drawingOptions=Mi.getDefaultDrawingOptions():(this._drawingOptions=Mi._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":e}))}serialize(I=!1){if(this.isEmpty())return null;const{lines:e,points:t}=this.serializeDraw(I),{_drawingOptions:{"stroke-width":i}}=this,A=Object.assign(super.serialize(I),{isSignature:!0,areContours:c(this,xo),color:[0,0,0],thickness:c(this,xo)?0:i});return this.addComment(A),I?(A.paths={lines:e,points:t},A.uuid=c(this,Wc),A.isCopy=!0):A.lines=e,c(this,Un)&&(A.accessibilityData={type:"Figure",alt:c(this,Un)}),A}static deserializeDraw(I,e,t,i,A,n){return n.areContours?MV.deserialize(I,e,t,i,A,n):Qh.deserialize(I,e,t,i,A,n)}static async deserialize(I,e,t){var A;const i=await super.deserialize(I,e,t);return V(i,xo,I.areContours),i.description=((A=I.accessibilityData)==null?void 0:A.alt)||"",V(i,Wc,I.uuid),i}};xo=new WeakMap,Un=new WeakMap,Oo=new WeakMap,Wc=new WeakMap,cg(Mi,"_type","signature"),cg(Mi,"_editorType",Ug.SIGNATURE),cg(Mi,"_defaultDrawingOptions",null);let XV=Mi;class HV extends qI{constructor(I){super({...I,name:"stampEditor"});f(this,GI);f(this,aC,null);f(this,Ze,null);f(this,Qo,null);f(this,Is,null);f(this,Uo,null);f(this,hu,"");f(this,Cs,null);f(this,Bc,!1);f(this,En,null);f(this,Ri,!1);f(this,bu,!1);V(this,Is,I.bitmapUrl),V(this,Uo,I.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(I,e){qI.initialize(I,e)}static isHandlingMimeForPasting(I){return $Y.includes(I)}static paste(I,e){e.pasteEditor({mode:Ug.STAMP},{bitmapFile:I.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var I;return{type:"stamp",hasAltText:!!((I=this.altTextData)!=null&&I.altText)}}static computeTelemetryFinalData(I){const e=I.get("hasAltText");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}async mlGuessAltText(I=null,e=!0){if(this.hasAltTextData())return null;const{mlManager:t}=this._uiManager;if(!t)throw new Error("No ML.");if(!await t.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:i,width:A,height:n}=I||this.copyCanvas(null,null,!0).imageData,l=await t.guess({name:"altText",request:{data:i,width:A,height:n,channels:i.length/(A*n)}});if(!l)throw new Error("No response from the AI service.");if(l.error)throw new Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw new Error("No valid response from the AI service.");const o=l.output;return await this.setGuessedAltText(o),e&&!this.hasAltTextData()&&(this.altTextData={alt:o,decorative:!1}),o}remove(){var I;c(this,Ze)&&(V(this,aC,null),this._uiManager.imageManager.deleteId(c(this,Ze)),(I=c(this,Cs))==null||I.remove(),V(this,Cs,null),c(this,En)&&(clearTimeout(c(this,En)),V(this,En,null))),super.remove()}rebuild(){if(!this.parent){c(this,Ze)&&X(this,GI,f2).call(this);return}super.rebuild(),this.div!==null&&(c(this,Ze)&&c(this,Cs)===null&&X(this,GI,f2).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(I){this._isDraggable=!0,I&&this.div.focus()}isEmpty(){return!(c(this,Qo)||c(this,aC)||c(this,Is)||c(this,Uo)||c(this,Ze)||c(this,Bc))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let I,e;return this._isCopy&&(I=this.x,e=this.y),super.render(),this.div.hidden=!0,this.createAltText(),c(this,Bc)||(c(this,aC)?X(this,GI,X2).call(this):X(this,GI,f2).call(this)),this._isCopy&&this._moveAfterPaste(I,e),this._uiManager.addShouldRescale(this),this.div}setCanvas(I,e){const{id:t,bitmap:i}=this._uiManager.imageManager.getFromCanvas(I,e);e.remove(),t&&this._uiManager.imageManager.isValidId(t)&&(V(this,Ze,t),i&&V(this,aC,i),V(this,Bc,!1),X(this,GI,X2).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;c(this,En)!==null&&clearTimeout(c(this,En)),V(this,En,setTimeout(()=>{V(this,En,null),X(this,GI,N5).call(this)},200))}copyCanvas(I,e,t=!1){I||(I=224);const{width:i,height:A}=c(this,aC),n=new un;let l=c(this,aC),o=i,a=A,d=null;if(e){if(i>e||A>e){const M=Math.min(e/i,e/A);o=Math.floor(i*M),a=Math.floor(A*M)}d=document.createElement("canvas");const u=d.width=Math.ceil(o*n.sx),h=d.height=Math.ceil(a*n.sy);c(this,Ri)||(l=X(this,GI,H2).call(this,u,h));const Z=d.getContext("2d");Z.filter=this._uiManager.hcmFilter;let w="white",G="#cfcfd8";this._uiManager.hcmFilter!=="none"?G="black":wvg.isDarkMode&&(w="#8f8f9d",G="#42414d");const B=15,p=B*n.sx,y=B*n.sy,Y=new OffscreenCanvas(p*2,y*2),R=Y.getContext("2d");R.fillStyle=w,R.fillRect(0,0,p*2,y*2),R.fillStyle=G,R.fillRect(0,0,p,y),R.fillRect(p,y,p,y),Z.fillStyle=Z.createPattern(Y,"repeat"),Z.fillRect(0,0,u,h),Z.drawImage(l,0,0,l.width,l.height,0,0,u,h)}let m=null;if(t){let u,h;if(n.symmetric&&l.width<I&&l.height<I)u=l.width,h=l.height;else if(l=c(this,aC),i>I||A>I){const G=Math.min(I/i,I/A);u=Math.floor(i*G),h=Math.floor(A*G),c(this,Ri)||(l=X(this,GI,H2).call(this,u,h))}const w=new OffscreenCanvas(u,h).getContext("2d",{willReadFrequently:!0});w.drawImage(l,0,0,l.width,l.height,0,0,u,h),m={width:u,height:h,data:w.getImageData(0,0,u,h).data}}return{canvas:d,width:o,height:a,imageData:m}}static async deserialize(I,e,t){var w;let i=null,A=!1;if(I instanceof YS){const{data:{rect:G,rotation:B,id:p,structParent:y,popupRef:Y,richText:R,contentsObj:M,creationDate:S,modificationDate:J},container:D,parent:{page:{pageNumber:H}},canvas:F}=I;let x,q;F?(delete I.canvas,{id:x,bitmap:q}=t.imageManager.getFromCanvas(D.id,F),F.remove()):(A=!0,I._hasNoCanvas=!0);const gg=((w=await e._structTree.getAriaAttributes(`${cr}${p}`))==null?void 0:w.get("aria-label"))||"";i=I={annotationType:Ug.STAMP,bitmapId:x,bitmap:q,pageIndex:H-1,rect:G.slice(0),rotation:B,annotationElementId:p,id:p,deleted:!1,accessibilityData:{decorative:!1,altText:gg},isSvg:!1,structParent:y,popupRef:Y,richText:R,comment:(M==null?void 0:M.str)||null,creationDate:S,modificationDate:J}}const n=await super.deserialize(I,e,t),{rect:l,bitmap:o,bitmapUrl:a,bitmapId:d,isSvg:m,accessibilityData:u}=I;A?(t.addMissingCanvas(I.id,n),V(n,Bc,!0)):d&&t.imageManager.isValidId(d)?(V(n,Ze,d),o&&V(n,aC,o)):V(n,Is,a),V(n,Ri,m);const[h,Z]=n.pageDimensions;return n.width=(l[2]-l[0])/h,n.height=(l[3]-l[1])/Z,u&&(n.altTextData=u),n._initialData=i,I.comment&&n.setCommentData(I),V(n,bu,!!i),n}serialize(I=!1,e=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const t=Object.assign(super.serialize(I),{bitmapId:c(this,Ze),isSvg:c(this,Ri)});if(this.addComment(t),I)return t.bitmapUrl=X(this,GI,D2).call(this,!0),t.accessibilityData=this.serializeAltText(!0),t.isCopy=!0,t;const{decorative:i,altText:A}=this.serializeAltText(!1);if(!i&&A&&(t.accessibilityData={type:"Figure",alt:A}),this.annotationElementId){const l=X(this,GI,yv).call(this,t);return l.isSame?null:(l.isSameAltText?delete t.accessibilityData:t.accessibilityData.structParent=this._initialData.structParent??-1,t.id=this.annotationElementId,delete t.bitmapId,t)}if(e===null)return t;e.stamps||(e.stamps=new Map);const n=c(this,Ri)?(t.rect[2]-t.rect[0])*(t.rect[3]-t.rect[1]):null;if(!e.stamps.has(c(this,Ze)))e.stamps.set(c(this,Ze),{area:n,serialized:t}),t.bitmap=X(this,GI,D2).call(this,!1);else if(c(this,Ri)){const l=e.stamps.get(c(this,Ze));n>l.area&&(l.area=n,l.serialized.bitmap.close(),l.serialized.bitmap=X(this,GI,D2).call(this,!1))}return t}renderAnnotationElement(I){return this.deleted?(I.hide(),null):(I.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}aC=new WeakMap,Ze=new WeakMap,Qo=new WeakMap,Is=new WeakMap,Uo=new WeakMap,hu=new WeakMap,Cs=new WeakMap,Bc=new WeakMap,En=new WeakMap,Ri=new WeakMap,bu=new WeakMap,GI=new WeakSet,hG=function(I,e=!1){if(!I){this.remove();return}V(this,aC,I.bitmap),e||(V(this,Ze,I.id),V(this,Ri,I.isSvg)),I.file&&V(this,hu,I.file.name),X(this,GI,X2).call(this)},bG=function(){if(V(this,Qo,null),this._uiManager.enableWaiting(!1),!!c(this,Cs)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&c(this,aC)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&c(this,aC)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},f2=function(){if(c(this,Ze)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(c(this,Ze)).then(t=>X(this,GI,hG).call(this,t,!0)).finally(()=>X(this,GI,bG).call(this));return}if(c(this,Is)){const t=c(this,Is);V(this,Is,null),this._uiManager.enableWaiting(!0),V(this,Qo,this._uiManager.imageManager.getFromUrl(t).then(i=>X(this,GI,hG).call(this,i)).finally(()=>X(this,GI,bG).call(this)));return}if(c(this,Uo)){const t=c(this,Uo);V(this,Uo,null),this._uiManager.enableWaiting(!0),V(this,Qo,this._uiManager.imageManager.getFromFile(t).then(i=>X(this,GI,hG).call(this,i)).finally(()=>X(this,GI,bG).call(this)));return}const I=document.createElement("input");I.type="file",I.accept=$Y.join(",");const e=this._uiManager._signal;V(this,Qo,new Promise(t=>{I.addEventListener("change",async()=>{if(!I.files||I.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const i=await this._uiManager.imageManager.getFromFile(I.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),X(this,GI,hG).call(this,i)}t()},{signal:e}),I.addEventListener("cancel",()=>{this.remove(),t()},{signal:e})}).finally(()=>X(this,GI,bG).call(this))),I.click()},X2=function(){var o;const{div:I}=this;let{width:e,height:t}=c(this,aC);const[i,A]=this.pageDimensions,n=.75;if(this.width)e=this.width*i,t=this.height*A;else if(e>n*i||t>n*A){const a=Math.min(n*i/e,n*A/t);e*=a,t*=a}this._uiManager.enableWaiting(!1);const l=V(this,Cs,document.createElement("canvas"));l.setAttribute("role","img"),this.addContainer(l),this.width=e/i,this.height=t/A,this.setDims(),(o=this._initialOptions)!=null&&o.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(I.hidden=!1),X(this,GI,N5).call(this),c(this,bu)||(this.parent.addUndoableEditor(this),V(this,bu,!0)),this._reportTelemetry({action:"inserted_image"}),c(this,hu)&&this.div.setAttribute("aria-description",c(this,hu)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},H2=function(I,e){const{width:t,height:i}=c(this,aC);let A=t,n=i,l=c(this,aC);for(;A>2*I||n>2*e;){const o=A,a=n;A>2*I&&(A=A>=16384?Math.floor(A/2)-1:Math.ceil(A/2)),n>2*e&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2));const d=new OffscreenCanvas(A,n);d.getContext("2d").drawImage(l,0,0,o,a,0,0,A,n),l=d.transferToImageBitmap()}return l},N5=function(){const[I,e]=this.parentDimensions,{width:t,height:i}=this,A=new un,n=Math.ceil(t*I*A.sx),l=Math.ceil(i*e*A.sy),o=c(this,Cs);if(!o||o.width===n&&o.height===l)return;o.width=n,o.height=l;const a=c(this,Ri)?c(this,aC):X(this,GI,H2).call(this,n,l),d=o.getContext("2d");d.filter=this._uiManager.hcmFilter,d.drawImage(a,0,0,a.width,a.height,0,0,n,l)},D2=function(I){if(I){if(c(this,Ri)){const i=this._uiManager.imageManager.getSvgUrl(c(this,Ze));if(i)return i}const e=document.createElement("canvas");return{width:e.width,height:e.height}=c(this,aC),e.getContext("2d").drawImage(c(this,aC),0,0),e.toDataURL()}if(c(this,Ri)){const[e,t]=this.pageDimensions,i=Math.round(this.width*e*zs.PDF_TO_CSS_UNITS),A=Math.round(this.height*t*zs.PDF_TO_CSS_UNITS),n=new OffscreenCanvas(i,A);return n.getContext("2d").drawImage(c(this,aC),0,0,c(this,aC).width,c(this,aC).height,0,0,i,A),n.transferToImageBitmap()}return structuredClone(c(this,aC))},yv=function(I){var n;const{pageIndex:e,accessibilityData:{altText:t}}=this._initialData,i=I.pageIndex===e,A=(((n=I.accessibilityData)==null?void 0:n.alt)||"")===t;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&i&&A,isSameAltText:A}},cg(HV,"_type","stamp"),cg(HV,"_editorType",Ug.STAMP);const EA=class EA{constructor({uiManager:g,pageIndex:I,div:e,structTreeLayer:t,accessibilityManager:i,annotationLayer:A,drawLayer:n,textLayer:l,viewport:o,l10n:a}){f(this,EI);f(this,pc);f(this,Zu,!1);f(this,Eo,null);f(this,Po,null);f(this,es,null);f(this,Pt,new Map);f(this,_o,!1);f(this,Gu,!1);f(this,wu,!1);f(this,UA,null);f(this,ts,null);f(this,Ge,null);f(this,is,null);f(this,$o,null);f(this,Wu,-1);f(this,Xg);const d=[...c(EA,qo).values()];if(!EA._initialized){EA._initialized=!0;for(const m of d)m.initialize(a,g)}g.registerEditorTypes(d),V(this,Xg,g),this.pageIndex=I,this.div=e,V(this,pc,i),V(this,Eo,A),this.viewport=o,V(this,Ge,l),this.drawLayer=n,this._structTree=t,c(this,Xg).addLayer(this)}get isEmpty(){return c(this,Pt).size===0}get isInvisible(){return this.isEmpty&&c(this,Xg).getMode()===Ug.NONE}updateToolbar(g){c(this,Xg).updateToolbar(g)}updateMode(g=c(this,Xg).getMode()){switch(X(this,EI,S2).call(this),g){case Ug.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Ug.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case Ug.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),g===Ug.POPUP)I.toggle("commentEditing",!0);else{I.toggle("commentEditing",!1);for(const e of c(EA,qo).values())I.toggle(`${e._type}Editing`,g===e._editorType)}this.div.hidden=!1}hasTextLayer(g){var I;return g===((I=c(this,Ge))==null?void 0:I.div)}setEditingState(g){c(this,Xg).setEditingState(g)}addCommands(g){c(this,Xg).addCommands(g)}cleanUndoStack(g){c(this,Xg).cleanUndoStack(g)}toggleDrawing(g=!1){this.div.classList.toggle("drawing",!g)}togglePointerEvents(g=!1){this.div.classList.toggle("disabled",!g)}toggleAnnotationLayerPointerEvents(g=!1){var I;(I=c(this,Eo))==null||I.togglePointerEvents(g)}async enable(){var e;V(this,wu,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),(e=c(this,$o))==null||e.abort(),V(this,$o,null);const g=new Set;for(const t of c(this,EI,M5))t.enableEditing(),t.show(!0),t.annotationElementId&&(c(this,Xg).removeChangedExistingAnnotation(t),g.add(t.annotationElementId));const I=c(this,Eo);if(I)for(const t of I.getEditableAnnotations()){if(t.hide(),c(this,Xg).isDeletedAnnotationElement(t.data.id)||g.has(t.data.id))continue;const i=await this.deserialize(t);i&&(this.addOrRebuild(i),i.enableEditing())}V(this,wu,!1),c(this,Xg)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){var t;if(V(this,Gu,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),c(this,Ge)&&!c(this,$o)){V(this,$o,new AbortController);const i=c(this,Xg).combinedSignal(c(this,$o));c(this,Ge).div.addEventListener("pointerdown",A=>{const{clientX:l,clientY:o,timeStamp:a}=A,d=c(this,Wu);if(a-d>500){V(this,Wu,a);return}V(this,Wu,-1);const{classList:m}=this.div;m.toggle("getElements",!0);const u=document.elementsFromPoint(l,o);if(m.toggle("getElements",!1),!this.div.contains(u[0]))return;let h;const Z=new RegExp(`^${Rh}[0-9]+$`);for(const G of u)if(Z.test(G.id)){h=G.id;break}if(!h)return;const w=c(this,Pt).get(h);(w==null?void 0:w.annotationElementId)===null&&(A.stopPropagation(),A.preventDefault(),w.dblclick(A))},{signal:i,capture:!0})}const g=c(this,Eo),I=[];if(g){const i=new Map,A=new Map;for(const l of c(this,EI,M5)){if(l.disableEditing(),!l.annotationElementId){I.push(l);continue}if(l.serialize()!==null){i.set(l.annotationElementId,l);continue}else A.set(l.annotationElementId,l);(t=this.getEditableAnnotation(l.annotationElementId))==null||t.show(),l.remove()}const n=g.getEditableAnnotations();for(const l of n){const{id:o}=l.data;if(c(this,Xg).isDeletedAnnotationElement(o)){l.updateEdited({deleted:!0});continue}let a=A.get(o);if(a){a.resetAnnotationElement(l),a.show(!1),l.show();continue}a=i.get(o),a&&(c(this,Xg).addChangedExistingAnnotation(a),a.renderAnnotationElement(l)&&a.show(!1)),l.show()}}X(this,EI,S2).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:e}=this.div;for(const i of c(EA,qo).values())e.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),g==null||g.updateFakeAnnotations(I),V(this,Gu,!1)}getEditableAnnotation(g){var I;return((I=c(this,Eo))==null?void 0:I.getEditableAnnotation(g))||null}setActiveEditor(g){c(this,Xg).getActive()!==g&&c(this,Xg).setActiveEditor(g)}enableTextSelection(){var g;if(this.div.tabIndex=-1,(g=c(this,Ge))!=null&&g.div&&!c(this,is)){V(this,is,new AbortController);const I=c(this,Xg).combinedSignal(c(this,is));c(this,Ge).div.addEventListener("pointerdown",X(this,EI,Yv).bind(this),{signal:I}),c(this,Ge).div.classList.add("highlighting")}}disableTextSelection(){var g;this.div.tabIndex=0,(g=c(this,Ge))!=null&&g.div&&c(this,is)&&(c(this,is).abort(),V(this,is,null),c(this,Ge).div.classList.remove("highlighting"))}enableClick(){if(c(this,Po))return;V(this,Po,new AbortController);const g=c(this,Xg).combinedSignal(c(this,Po));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:g});const I=this.pointerup.bind(this);this.div.addEventListener("pointerup",I,{signal:g}),this.div.addEventListener("pointercancel",I,{signal:g})}disableClick(){var g;(g=c(this,Po))==null||g.abort(),V(this,Po,null)}attach(g){c(this,Pt).set(g.id,g);const{annotationElementId:I}=g;I&&c(this,Xg).isDeletedAnnotationElement(I)&&c(this,Xg).removeDeletedAnnotationElement(g)}detach(g){var I;c(this,Pt).delete(g.id),(I=c(this,pc))==null||I.removePointerInTextLayer(g.contentDiv),!c(this,Gu)&&g.annotationElementId&&c(this,Xg).addDeletedAnnotationElement(g)}remove(g){this.detach(g),c(this,Xg).removeEditor(g),g.div.remove(),g.isAttachedToDOM=!1}changeParent(g){var I;g.parent!==this&&(g.parent&&g.annotationElementId&&(c(this,Xg).addDeletedAnnotationElement(g),qI.deleteAnnotationElement(g),g.annotationElementId=null),this.attach(g),(I=g.parent)==null||I.detach(g),g.setParent(this),g.div&&g.isAttachedToDOM&&(g.div.remove(),this.div.append(g.div)))}add(g){if(!(g.parent===this&&g.isAttachedToDOM)){if(this.changeParent(g),c(this,Xg).addEditor(g),this.attach(g),!g.isAttachedToDOM){const I=g.render();this.div.append(I),g.isAttachedToDOM=!0}g.fixAndSetPosition(),g.onceAdded(!c(this,wu)),c(this,Xg).addToAnnotationStorage(g),g._reportTelemetry(g.telemetryInitialData)}}moveEditorInDOM(g){var e;if(!g.isAttachedToDOM)return;const{activeElement:I}=document;g.div.contains(I)&&!c(this,es)&&(g._focusEventsAllowed=!1,V(this,es,setTimeout(()=>{V(this,es,null),g.div.contains(document.activeElement)?g._focusEventsAllowed=!0:(g.div.addEventListener("focusin",()=>{g._focusEventsAllowed=!0},{once:!0,signal:c(this,Xg)._signal}),I.focus())},0))),g._structTreeParentId=(e=c(this,pc))==null?void 0:e.moveElementInDOM(this.div,g.div,g.contentDiv,!0)}addOrRebuild(g){g.needsToBeRebuilt()?(g.parent||(g.parent=this),g.rebuild(),g.show()):this.add(g)}addUndoableEditor(g){const I=()=>g._uiManager.rebuild(g),e=()=>{g.remove()};this.addCommands({cmd:I,undo:e,mustExec:!1})}getEditorByUID(g){for(const I of c(this,Pt).values())if(I.uid===g)return I;return null}getNextId(){return c(this,Xg).getId()}combinedSignal(g){return c(this,Xg).combinedSignal(g)}canCreateNewEmptyEditor(){var g;return(g=c(this,EI,Cl))==null?void 0:g.canCreateNewEmptyEditor()}async pasteEditor(g,I){this.updateToolbar(g),await c(this,Xg).updateMode(g.mode);const{offsetX:e,offsetY:t}=X(this,EI,f5).call(this),i=this.getNextId(),A=X(this,EI,R5).call(this,{parent:this,id:i,x:e,y:t,uiManager:c(this,Xg),isCentered:!0,...I});A&&this.add(A)}async deserialize(g){var I;return await((I=c(EA,qo).get(g.annotationType??g.annotationEditorType))==null?void 0:I.deserialize(g,this,c(this,Xg)))||null}createAndAddNewEditor(g,I,e={}){const t=this.getNextId(),i=X(this,EI,R5).call(this,{parent:this,id:t,x:g.offsetX,y:g.offsetY,uiManager:c(this,Xg),isCentered:I,...e});return i&&this.add(i),i}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(g={}){this.createAndAddNewEditor(X(this,EI,f5).call(this),!0,g)}setSelected(g){c(this,Xg).setSelected(g)}toggleSelected(g){c(this,Xg).toggleSelected(g)}unselect(g){c(this,Xg).unselect(g)}pointerup(g){var t;const{isMac:I}=ye.platform;if(g.button!==0||g.ctrlKey&&I||g.target!==this.div||!c(this,_o)||(V(this,_o,!1),(t=c(this,EI,Cl))!=null&&t.isDrawer&&c(this,EI,Cl).supportMultipleDrawings))return;if(!c(this,Zu)){V(this,Zu,!0);return}const e=c(this,Xg).getMode();if(e===Ug.STAMP||e===Ug.SIGNATURE){c(this,Xg).unselectAll();return}this.createAndAddNewEditor(g,!1)}pointerdown(g){var t;if(c(this,Xg).getMode()===Ug.HIGHLIGHT&&this.enableTextSelection(),c(this,_o)){V(this,_o,!1);return}const{isMac:I}=ye.platform;if(g.button!==0||g.ctrlKey&&I||g.target!==this.div)return;if(V(this,_o,!0),(t=c(this,EI,Cl))!=null&&t.isDrawer){this.startDrawingSession(g);return}const e=c(this,Xg).getActive();V(this,Zu,!e||e.isEmpty())}startDrawingSession(g){if(this.div.focus({preventScroll:!0}),c(this,UA)){c(this,EI,Cl).startDrawing(this,c(this,Xg),!1,g);return}c(this,Xg).setCurrentDrawingSession(this),V(this,UA,new AbortController);const I=c(this,Xg).combinedSignal(c(this,UA));this.div.addEventListener("blur",({relatedTarget:e})=>{e&&!this.div.contains(e)&&(V(this,ts,null),this.commitOrRemove())},{signal:I}),c(this,EI,Cl).startDrawing(this,c(this,Xg),!1,g)}pause(g){if(g){const{activeElement:I}=document;this.div.contains(I)&&V(this,ts,I);return}c(this,ts)&&setTimeout(()=>{var I;(I=c(this,ts))==null||I.focus(),V(this,ts,null)},0)}endDrawingSession(g=!1){return c(this,UA)?(c(this,Xg).setCurrentDrawingSession(null),c(this,UA).abort(),V(this,UA,null),V(this,ts,null),c(this,EI,Cl).endDrawing(g)):null}findNewParent(g,I,e){const t=c(this,Xg).findParent(I,e);return t===null||t===this?!1:(t.changeParent(g),!0)}commitOrRemove(){return c(this,UA)?(this.endDrawingSession(),!0):!1}onScaleChanging(){c(this,UA)&&c(this,EI,Cl).onScaleChangingWhenDrawing(this)}destroy(){var g,I;this.commitOrRemove(),((g=c(this,Xg).getActive())==null?void 0:g.parent)===this&&(c(this,Xg).commitOrRemove(),c(this,Xg).setActiveEditor(null)),c(this,es)&&(clearTimeout(c(this,es)),V(this,es,null));for(const e of c(this,Pt).values())(I=c(this,pc))==null||I.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,c(this,Pt).clear(),c(this,Xg).removeLayer(this)}render({viewport:g}){this.viewport=g,za(this.div,g);for(const I of c(this,Xg).getEditors(this.pageIndex))this.add(I),I.rebuild();this.updateMode()}update({viewport:g}){c(this,Xg).commitOrRemove(),X(this,EI,S2).call(this);const I=this.viewport.rotation,e=g.rotation;if(this.viewport=g,za(this.div,{rotation:e}),I!==e)for(const t of c(this,Pt).values())t.rotate(e)}get pageDimensions(){const{pageWidth:g,pageHeight:I}=this.viewport.rawDims;return[g,I]}get scale(){return c(this,Xg).viewParameters.realScale}};pc=new WeakMap,Zu=new WeakMap,Eo=new WeakMap,Po=new WeakMap,es=new WeakMap,Pt=new WeakMap,_o=new WeakMap,Gu=new WeakMap,wu=new WeakMap,UA=new WeakMap,ts=new WeakMap,Ge=new WeakMap,is=new WeakMap,$o=new WeakMap,Wu=new WeakMap,Xg=new WeakMap,qo=new WeakMap,EI=new WeakSet,M5=function(){return c(this,Pt).size!==0?c(this,Pt).values():c(this,Xg).getEditors(this.pageIndex)},Yv=function(g){c(this,Xg).unselectAll();const{target:I}=g;if(I===c(this,Ge).div||(I.getAttribute("role")==="img"||I.classList.contains("endOfContent"))&&c(this,Ge).div.contains(I)){const{isMac:e}=ye.platform;if(g.button!==0||g.ctrlKey&&e)return;c(this,Xg).showAllEditors("highlight",!0,!0),c(this,Ge).div.classList.add("free"),this.toggleDrawing(),IW.startHighlighting(this,c(this,Xg).direction==="ltr",{target:c(this,Ge).div,x:g.x,y:g.y}),c(this,Ge).div.addEventListener("pointerup",()=>{c(this,Ge).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:c(this,Xg)._signal}),g.preventDefault()}},Cl=function(){return c(EA,qo).get(c(this,Xg).getMode())},R5=function(g){const I=c(this,EI,Cl);return I?new I.prototype.constructor(g):null},f5=function(){const{x:g,y:I,width:e,height:t}=this.boundingClientRect,i=Math.max(0,g),A=Math.max(0,I),n=Math.min(window.innerWidth,g+e),l=Math.min(window.innerHeight,I+t),o=(i+n)/2-g,a=(A+l)/2-I,[d,m]=this.viewport.rotation%180===0?[o,a]:[a,o];return{offsetX:d,offsetY:m}},S2=function(){for(const g of c(this,Pt).values())g.isEmpty()&&g.remove()},cg(EA,"_initialized",!1),f(EA,qo,new Map([yV,NV,HV,IW,XV].map(g=>[g._editorType,g])));let DV=EA;const te=class te{constructor({pageIndex:g}){f(this,Pn);f(this,PA,null);f(this,yt,new Map);f(this,yc,new Map);this.pageIndex=g}setParent(g){if(!c(this,PA)){V(this,PA,g);return}if(c(this,PA)!==g){if(c(this,yt).size>0)for(const I of c(this,yt).values())I.remove(),g.append(I);V(this,PA,g)}}static get _svgFactory(){return Og(this,"_svgFactory",new $w)}draw(g,I=!1,e=!1){const t=ne(te,HZ)._++,i=X(this,Pn,X5).call(this),A=te._svgFactory.createElement("defs");i.append(A);const n=te._svgFactory.createElement("path");A.append(n);const l=`path_p${this.pageIndex}_${t}`;n.setAttribute("id",l),n.setAttribute("vector-effect","non-scaling-stroke"),I&&c(this,yc).set(t,n);const o=e?X(this,Pn,Nv).call(this,A,l):null,a=te._svgFactory.createElement("use");return i.append(a),a.setAttribute("href",`#${l}`),this.updateProperties(i,g),c(this,yt).set(t,i),{id:t,clipPathId:`url(#${o})`}}drawOutline(g,I){const e=ne(te,HZ)._++,t=X(this,Pn,X5).call(this),i=te._svgFactory.createElement("defs");t.append(i);const A=te._svgFactory.createElement("path");i.append(A);const n=`path_p${this.pageIndex}_${e}`;A.setAttribute("id",n),A.setAttribute("vector-effect","non-scaling-stroke");let l;if(I){const d=te._svgFactory.createElement("mask");i.append(d),l=`mask_p${this.pageIndex}_${e}`,d.setAttribute("id",l),d.setAttribute("maskUnits","objectBoundingBox");const m=te._svgFactory.createElement("rect");d.append(m),m.setAttribute("width","1"),m.setAttribute("height","1"),m.setAttribute("fill","white");const u=te._svgFactory.createElement("use");d.append(u),u.setAttribute("href",`#${n}`),u.setAttribute("stroke","none"),u.setAttribute("fill","black"),u.setAttribute("fill-rule","nonzero"),u.classList.add("mask")}const o=te._svgFactory.createElement("use");t.append(o),o.setAttribute("href",`#${n}`),l&&o.setAttribute("mask",`url(#${l})`);const a=o.cloneNode();return t.append(a),o.classList.add("mainOutline"),a.classList.add("secondaryOutline"),this.updateProperties(t,g),c(this,yt).set(e,t),e}finalizeDraw(g,I){c(this,yc).delete(g),this.updateProperties(g,I)}updateProperties(g,I){var l;if(!I)return;const{root:e,bbox:t,rootClass:i,path:A}=I,n=typeof g=="number"?c(this,yt).get(g):g;if(n){if(e&&X(this,Pn,H5).call(this,n,e),t&&X(l=te,rp,Vv).call(l,n,t),i){const{classList:o}=n;for(const[a,d]of Object.entries(i))o.toggle(a,d)}if(A){const a=n.firstElementChild.firstElementChild;X(this,Pn,H5).call(this,a,A)}}}updateParent(g,I){if(I===this)return;const e=c(this,yt).get(g);e&&(c(I,PA).append(e),c(this,yt).delete(g),c(I,yt).set(g,e))}remove(g){c(this,yc).delete(g),c(this,PA)!==null&&(c(this,yt).get(g).remove(),c(this,yt).delete(g))}destroy(){V(this,PA,null);for(const g of c(this,yt).values())g.remove();c(this,yt).clear(),c(this,yc).clear()}};PA=new WeakMap,yt=new WeakMap,yc=new WeakMap,HZ=new WeakMap,rp=new WeakSet,Vv=function(g,[I,e,t,i]){const{style:A}=g;A.top=`${100*e}%`,A.left=`${100*I}%`,A.width=`${100*t}%`,A.height=`${100*i}%`},Pn=new WeakSet,X5=function(){const g=te._svgFactory.create(1,1,!0);return c(this,PA).append(g),g.setAttribute("aria-hidden",!0),g},Nv=function(g,I){const e=te._svgFactory.createElement("clipPath");g.append(e);const t=`clip_${I}`;e.setAttribute("id",t),e.setAttribute("clipPathUnits","objectBoundingBox");const i=te._svgFactory.createElement("use");return e.append(i),i.setAttribute("href",`#${I}`),i.classList.add("clip"),t},H5=function(g,I){for(const[e,t]of Object.entries(I))t===null?g.removeAttribute(e):g.setAttribute(e,t)},f(te,rp),f(te,HZ,0);let SV=te;globalThis._pdfjsTestingUtils={HighlightOutliner:YV},globalThis.pdfjsLib={AbortException:ks,AnnotationEditorLayer:DV,AnnotationEditorParamsType:mI,AnnotationEditorType:Ug,AnnotationEditorUIManager:Fa,AnnotationLayer:pV,AnnotationMode:Ks,AnnotationType:TC,applyOpacity:Bvg,build:Rjg,ColorPicker:Pw,createValidAbsoluteUrl:YD,CSSConstants:Wvg,DOMSVGFactory:$w,DrawLayer:SV,FeatureTest:ye,fetchData:Sh,findContrastColor:pvg,getDocument:hV,getFilenameFromUrl:uvg,getPdfFilenameFromUrl:hvg,getRGB:zh,getUuid:fD,getXfaPageViewport:Zvg,GlobalWorkerOptions:bn,ImageKind:Rw,InvalidPDFException:UY,isDataScheme:Sw,isPdfFile:rr,isValidExplicitDest:Dvg,MathClamp:mt,noContextMenu:Ji,normalizeUnicode:cvg,OPS:fh,OutputScale:un,PasswordResponses:tvg,PDFDataRangeTransport:ZS,PDFDateString:Kw,PDFWorker:xh,PermissionFlag:evg,PixelsPerInch:zs,RenderingCancelledException:_Y,renderRichText:FD,ResponseException:Dw,setLayerDimensions:za,shadow:Og,SignatureExtractor:ll,stopEvent:wC,SupportedImageMimeTypes:$Y,TextLayer:jh,TouchManager:Fw,updateUrlHash:VD,Util:Mg,VerbosityLevel:fw,version:Mjg,XfaLayer:HD};class gxg{constructor(){cg(this,"cache",{});cg(this,"cachePage",{})}setCache(g,I){this.cache[g]=I}getCache(g){return this.cache[g]}setPageCache(g,I){this.cachePage[g]=I}getPageCache(g){return this.cachePage[g]}}const Ta=new gxg,Ixg=["src"],sl=s.defineComponent({name:"PdfPreview",__name:"PdfPreview",props:{src:{},page:{}},emits:["load","error"],setup(C,{expose:g,emit:I}){bn.workerSrc=Cvg;const e=C,t=I,i=s.reactive({isError:!1,rotate:0}),A=s.ref(null);let n,l=null;s.watch([()=>e.src,()=>e.page],()=>{n==null||n.disconnect(),m(),i.isError=!1,s.nextTick(()=>{d()})}),s.watch(()=>e.src,()=>{i.rotate=0});const o=async()=>{try{if(!A.value||!e.src)throw new Error("Canvas not found");l&&(l==null||l.cancel(),l=null);let u;const h=Ta.getCache(e.src);if(h?u=h:(u=await hV(e.src).promise,Ta.setCache(e.src,u)),!u)throw new Error("Pdf not found");const Z=e.page??1,w=`${e.src}-${Z}`,G=Ta.getPageCache(w);let B;G?B=G:(B=await u.getPage(Z),Ta.setPageCache(w,B));const p=A.value.getBoundingClientRect(),y=B.getViewport({scale:1}),Y=p.width/y.width,R=p.height/y.height,M=Math.min(Y,R),S=window.devicePixelRatio||1,J=B.getViewport({scale:M*S,rotation:i.rotate}),D=A.value.getContext("2d");if(D===null)throw new Error("Context not found");A.value.width=J.width,A.value.height=J.height;const H=B.render({canvas:A.value,canvasContext:D,viewport:J});l=H,await H.promise,t("load")}catch(u){if(u&&typeof u=="object"&&"name"in u&&(u==null?void 0:u.name)==="RenderingCancelledException")return;console.error(u),i.isError=!0,t("error",u)}finally{l=null}},a=async u=>{try{if(!A.value)return;const h=Ta.getPageCache(`${e.src}-${e.page}`);if(!h)return;const Z=A.value.getContext("2d");if(!Z)return;const w=Math.round(u/90)*90;i.rotate+=w;const{width:G,height:B}=A.value;Z.clearRect(0,0,G,B);const p=h.getViewport({scale:1,rotation:i.rotate});A.value.width=p.width,A.value.height=p.height;const y=h.render({canvas:A.value,canvasContext:Z,viewport:p});l=y,await y.promise,t("load")}catch(h){if(h&&typeof h=="object"&&"name"in h&&(h==null?void 0:h.name)==="RenderingCancelledException")return;console.error(h),i.isError=!0}finally{l=null}},d=()=>{A.value&&(n=new IntersectionObserver((u,h)=>{u.forEach(Z=>{Z.isIntersecting&&(o(),h.unobserve(Z.target))},{rootMargin:"50px"})}),n.observe(A.value))},m=()=>{if(!A.value)return;const u=A.value.getContext("2d");u&&u.clearRect(0,0,A.value.width,A.value.height)};return g({clearCanvas:m,rotatePdf:a}),s.onMounted(()=>{d()}),(u,h)=>i.isError?(s.openBlock(),s.createElementBlock("img",{key:1,src:s.unref(rn)},null,8,Ixg)):(s.openBlock(),s.createElementBlock("canvas",{key:0,ref_key:"canvas",ref:A},null,512))}});var KV=(C=>(C.slideTop="slide-top",C.slideLeft="slide-left",C.fadeAndScale="fade-and-scale",C.fade="fade",C))(KV||{});const Cxg=()=>{const C=s.ref(0),g=s.ref([]),I=s.ref(null),e=l=>{g.value.push(l),i(l),A()},t=()=>{g.value.pop(),n(),g.value.length?i(g.value[g.value.length-1]):I.value=null},i=l=>{I.value=l},A=()=>{C.value+=1},n=()=>{C.value>0&&(C.value-=1)};return{countOpenedModal:C,openedModals:g,lastOpenedModal:I,addOpenedModal:e,reduceOpenedModal:t,setLastOpenedModal:i,incrementCountModal:A,decrementCountModal:n}},exg=["data-testid"],txg=["data-testid"],MS=Rg(s.defineComponent({__name:"Modal",props:{open:{type:Boolean},position:{default:"right"},width:{},height:{},disableCloseOnOutsideClick:{type:Boolean,default:!1},dataTestid:{default:"Modal"}},emits:["close","unmounted"],setup(C,{expose:g,emit:I}){const{lastOpenedModal:e,addOpenedModal:t,reduceOpenedModal:i}=Cxg(),A=C,n=s.ref(null),l=s.useAttrs(),o=s.ref(!1),a=s.computed(()=>({width:A.width,height:A.height})),d=I;let m=0;const u=()=>{m=Date.now(),n.value&&(A.open?(n.value.showModal(),t(n.value)):h())},h=()=>{Date.now()-m<300||(i(),d("close"))},Z=()=>{var Y;(Y=n.value)==null||Y.close(),document.documentElement.focus(),window.removeEventListener("mouseup",p),B()},w=Y=>{Y.key==="Escape"&&e.value===n.value&&h()},G=()=>{if(document.querySelectorAll(".modal-yui-kit").length===1)return window.innerWidth-document.documentElement.clientWidth;{const R=document.body.style.paddingRight;return Number(R.replace(/\D/g,""))||0}},B=()=>{document.querySelectorAll(".modal-yui-kit").length===0&&NI({overflow:"","padding-right":""},document.body)},p=Y=>{if(Y.target===n.value){if(A.disableCloseOnOutsideClick)return;h()}window.removeEventListener("mouseup",p)},y=()=>{window.removeEventListener("mouseup",p),window.addEventListener("mouseup",p)};return g({closeDialog:Z}),s.onMounted(()=>{s.watchEffect(()=>{A.open!==o.value&&(u(),o.value=A.open,n.value&&n.value.focus())}),n.value&&n.value.addEventListener("cancel",R=>{R.preventDefault()});const Y=G();NI({overflow:"hidden","padding-right":`${Y}px`},document.body),document.addEventListener("keydown",w)}),s.onUnmounted(()=>{B(),window.removeEventListener("mouseup",p),document.removeEventListener("keydown",w),d("unmounted")}),(Y,R)=>(s.openBlock(),s.createElementBlock("dialog",s.mergeProps({ref_key:"dialog",ref:n},s.unref(l),{class:["modal-yui-kit",`modal-yui-kit_${A.position}`],"data-testid":A.dataTestid,onMousedown:s.withModifiers(y,["self","left"])}),[s.createElementVNode("div",{class:"modal-yui-kit__modal-content",style:s.normalizeStyle(a.value),"data-testid":`${A.dataTestid}-ModalContent`},[s.renderSlot(Y.$slots,"default",{},void 0,!0)],12,txg)],16,exg))}}),[["__scopeId","data-v-c8dd59d1"]]),Eh=Rg(s.defineComponent({__name:"ModalAnimated",props:{animateType:{},open:{type:Boolean},position:{default:"right"},width:{},height:{},disableCloseOnOutsideClick:{type:Boolean,default:!1},dataTestid:{default:"Modal"}},emits:["close","unmounted","end-animation"],setup(C,{emit:g}){const I=C,e=g,t=s.computed(()=>I.animateType===KV.fade?"fade":I.position==="bottom"?"slide-bottom":I.position==="right"?"slide-left":"fade-and-scale"),i=s.ref(null),A=s.reactive({function:()=>{}}),n=()=>{d()},l=()=>{e("unmounted")},o=()=>{d()},a=()=>{A.function(),e("end-animation")},d=()=>{var u;i.value&&(A.function=(u=i.value)==null?void 0:u.closeDialog)},m=()=>{d(),e("close")};return(u,h)=>(s.openBlock(),s.createBlock(s.Transition,{name:t.value,onAfterLeave:a,onBeforeLeave:o,onAfterEnter:n},{default:s.withCtx(()=>[I.open?(s.openBlock(),s.createBlock(MS,{key:0,ref_key:"modalRef",ref:i,open:I.open,position:I.position,width:I.width,height:I.height,"data-testid":I.dataTestid,onClose:m,onUnmounted:l,"disable-close-on-outside-click":I.disableCloseOnOutsideClick},{default:s.withCtx(()=>[s.renderSlot(u.$slots,"default",{},void 0,!0)]),_:3},8,["open","position","width","height","data-testid","disable-close-on-outside-click"])):s.createCommentVNode("",!0)]),_:3},8,["name"]))}}),[["__scopeId","data-v-75405c48"]]),RS=(C,g=window)=>{const I=C.getBoundingClientRect();if(g instanceof Window){const e=window.innerWidth,t=window.innerHeight;return I.top<t&&I.bottom>0&&I.left<e&&I.right>0}else{const e=g.getBoundingClientRect();return I.top<e.bottom&&I.bottom>e.top&&I.left<e.right&&I.right>e.left}},kV=(C,g=null)=>{if(!C)return;(g?RS(C,g):RS(C))||C.scrollIntoView({behavior:"smooth",block:"nearest"})},ixg=s.defineComponent({name:"BaseSlider",__name:"BaseSlider",props:{activeIndex:{default:0}},setup(C,{expose:g}){const I=C,e=s.reactive({children:null,activeIndex:I.activeIndex}),t=s.ref(null),i=s.ref(null);s.watch(()=>I.activeIndex,()=>{A(I.activeIndex)});const A=a=>{if(!t.value||!i.value)return;const d=[...t.value.children];a>d.length-1||a<0||(kV(d[a],i.value),e.activeIndex=a)},n=()=>{s.nextTick(()=>{!e.children||!i.value||kV(e.children[e.activeIndex],i.value)})},l=()=>(A(e.activeIndex+1),e.activeIndex),o=()=>(A(e.activeIndex-1),e.activeIndex);return s.onMounted(()=>{!t.value||!i.value||(e.children=[...t.value.children])}),g({shiftPosition:A,nextSlide:l,prevSlide:o,initScroll:n}),(a,d)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"sliderRef",ref:i,class:"base-slider"},[s.createElementVNode("div",{ref_key:"contentRef",ref:t,class:"base-slider__content"},[s.renderSlot(a.$slots,"default")],512)],512))}}),Axg={class:"base-slide__content"},nxg=s.defineComponent({name:"BaseSlide",__name:"BaseSlide",props:{isActive:{type:Boolean}},setup(C){const g=C,I=s.computed(()=>[{"base-slide_active":g.isActive}]);return(e,t)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["base-slide",I.value])},[s.createElementVNode("div",Axg,[s.renderSlot(e.$slots,"default")])],2))}}),fS=C=>{if(!C)return null;const g=C.split("?")[0],I=/\.\w+$/,e=g.match(I);return e?e[0].replace(".",""):null},iW=C=>{if(!C)return!1;if(C.startsWith("data:image/"))return!0;const g=fS(C);return g?Object.values(Nh).includes(g.toLowerCase()):!1},lxg=async(C,g="file")=>{const e=await(await fetch(C)).blob(),t=window.URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=g,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(t)};var XS={exports:{}};(function(C,g){(function(e,t){C.exports=t()})(window,function(){return function(I){var e={};function t(i){if(e[i])return e[i].exports;var A=e[i]={i,l:!1,exports:{}};return I[i].call(A.exports,A,A.exports,t),A.l=!0,A.exports}return t.m=I,t.c=e,t.d=function(i,A,n){t.o(i,A)||Object.defineProperty(i,A,{enumerable:!0,get:n})},t.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},t.t=function(i,A){if(A&1&&(i=t(i)),A&8||A&4&&typeof i=="object"&&i&&i.__esModule)return i;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:i}),A&2&&typeof i!="string")for(var l in i)t.d(n,l,(function(o){return i[o]}).bind(null,l));return n},t.n=function(i){var A=i&&i.__esModule?function(){return i.default}:function(){return i};return t.d(A,"a",A),A},t.o=function(i,A){return Object.prototype.hasOwnProperty.call(i,A)},t.p="",t(t.s=0)}({"./src/index.js":function(I,e,t){t.r(e),t("./src/sass/index.scss");var i=t("./src/js/init.js"),A=i.default.init;typeof window<"u"&&(window.printJS=A),e.default=A},"./src/js/browser.js":function(I,e,t){t.r(e);var i={isFirefox:function(){return typeof InstallTrigger<"u"},isIE:function(){return navigator.userAgent.indexOf("MSIE")!==-1||!!document.documentMode},isEdge:function(){return!i.isIE()&&!!window.StyleMedia},isChrome:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window;return!!n.chrome},isSafari:function(){return Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0||navigator.userAgent.toLowerCase().indexOf("safari")!==-1},isIOSChrome:function(){return navigator.userAgent.toLowerCase().indexOf("crios")!==-1}};e.default=i},"./src/js/functions.js":function(I,e,t){t.r(e),t.d(e,"addWrapper",function(){return l}),t.d(e,"capitalizePrint",function(){return o}),t.d(e,"collectStyles",function(){return a}),t.d(e,"addHeader",function(){return m}),t.d(e,"cleanUp",function(){return u}),t.d(e,"isRawHTML",function(){return h});var i=t("./src/js/modal.js"),A=t("./src/js/browser.js");function n(Z){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?n=function(G){return typeof G}:n=function(G){return G&&typeof Symbol=="function"&&G.constructor===Symbol&&G!==Symbol.prototype?"symbol":typeof G},n(Z)}function l(Z,w){var G="font-family:"+w.font+" !important; font-size: "+w.font_size+" !important; width:100%;";return'<div style="'+G+'">'+Z+"</div>"}function o(Z){return Z.charAt(0).toUpperCase()+Z.slice(1)}function a(Z,w){for(var G=document.defaultView||window,B="",p=G.getComputedStyle(Z,""),y=0;y<p.length;y++)(w.targetStyles.indexOf("*")!==-1||w.targetStyle.indexOf(p[y])!==-1||d(w.targetStyles,p[y]))&&p.getPropertyValue(p[y])&&(B+=p[y]+":"+p.getPropertyValue(p[y])+";");return B+="max-width: "+w.maxWidth+"px !important; font-size: "+w.font_size+" !important;",B}function d(Z,w){for(var G=0;G<Z.length;G++)if(n(w)==="object"&&w.indexOf(Z[G])!==-1)return!0;return!1}function m(Z,w){var G=document.createElement("div");if(h(w.header))G.innerHTML=w.header;else{var B=document.createElement("h1"),p=document.createTextNode(w.header);B.appendChild(p),B.setAttribute("style",w.headerStyle),G.appendChild(B)}Z.insertBefore(G,Z.childNodes[0])}function u(Z){Z.showModal&&i.default.close(),Z.onLoadingEnd&&Z.onLoadingEnd(),(Z.showModal||Z.onLoadingStart)&&window.URL.revokeObjectURL(Z.printable);var w="mouseover";(A.default.isChrome()||A.default.isFirefox())&&(w="focus");var G=function B(){window.removeEventListener(w,B),Z.onPrintDialogClose();var p=document.getElementById(Z.frameId);p&&p.remove()};window.addEventListener(w,G)}function h(Z){var w=new RegExp("<([A-Za-z][A-Za-z0-9]*)\\b[^>]*>(.*?)</\\1>");return w.test(Z)}},"./src/js/html.js":function(I,e,t){t.r(e);var i=t("./src/js/functions.js"),A=t("./src/js/print.js");function n(a){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?n=function(m){return typeof m}:n=function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},n(a)}e.default={print:function(d,m){var u=o(d.printable)?d.printable:document.getElementById(d.printable);if(!u){window.console.error("Invalid HTML element id: "+d.printable);return}d.printableElement=l(u,d),d.header&&Object(i.addHeader)(d.printableElement,d),A.default.send(d,m)}};function l(a,d){for(var m=a.cloneNode(),u=Array.prototype.slice.call(a.childNodes),h=0;h<u.length;h++)if(d.ignoreElements.indexOf(u[h].id)===-1){var Z=l(u[h],d);m.appendChild(Z)}switch(d.scanStyles&&a.nodeType===1&&m.setAttribute("style",Object(i.collectStyles)(a,d)),a.tagName){case"SELECT":m.value=a.value;break;case"CANVAS":m.getContext("2d").drawImage(a,0,0);break}return m}function o(a){return n(a)==="object"&&a&&(a instanceof HTMLElement||a.nodeType===1)}},"./src/js/image.js":function(I,e,t){t.r(e);var i=t("./src/js/functions.js"),A=t("./src/js/print.js"),n=t("./src/js/browser.js");e.default={print:function(o,a){o.printable.constructor!==Array&&(o.printable=[o.printable]),o.printableElement=document.createElement("div"),o.printable.forEach(function(d){var m=document.createElement("img");if(m.setAttribute("style",o.imageStyle),m.src=d,n.default.isFirefox()){var u=m.src;m.src=u}var h=document.createElement("div");h.appendChild(m),o.printableElement.appendChild(h)}),o.header&&Object(i.addHeader)(o.printableElement,o),A.default.send(o,a)}}},"./src/js/init.js":function(I,e,t){t.r(e);var i=t("./src/js/browser.js"),A=t("./src/js/modal.js"),n=t("./src/js/pdf.js"),l=t("./src/js/html.js"),o=t("./src/js/raw-html.js"),a=t("./src/js/image.js"),d=t("./src/js/json.js");function m(h){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?m=function(w){return typeof w}:m=function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},m(h)}var u=["pdf","html","image","json","raw-html"];e.default={init:function(){var Z={printable:null,fallbackPrintable:null,type:"pdf",header:null,headerStyle:"font-weight: 300;",maxWidth:800,properties:null,gridHeaderStyle:"font-weight: bold; padding: 5px; border: 1px solid #dddddd;",gridStyle:"border: 1px solid lightgray; margin-bottom: -1px;",showModal:!1,onError:function(R){throw R},onLoadingStart:null,onLoadingEnd:null,onPrintDialogClose:function(){},onIncompatibleBrowser:function(){},modalMessage:"Retrieving Document...",frameId:"printJS",printableElement:null,documentTitle:"Document",targetStyle:["clear","display","width","min-width","height","min-height","max-height"],targetStyles:["border","box","break","text-decoration"],ignoreElements:[],repeatTableHeader:!0,css:null,style:null,scanStyles:!0,base64:!1,onPdfOpen:null,font:"TimesNewRoman",font_size:"12pt",honorMarginPadding:!0,honorColor:!1,imageStyle:"max-width: 100%;"},w=arguments[0];if(w===void 0)throw new Error("printJS expects at least 1 attribute.");switch(m(w)){case"string":Z.printable=encodeURI(w),Z.fallbackPrintable=Z.printable,Z.type=arguments[1]||Z.type;break;case"object":Z.printable=w.printable,Z.fallbackPrintable=typeof w.fallbackPrintable<"u"?w.fallbackPrintable:Z.printable,Z.fallbackPrintable=Z.base64?"data:application/pdf;base64,".concat(Z.fallbackPrintable):Z.fallbackPrintable;for(var G in Z)G==="printable"||G==="fallbackPrintable"||(Z[G]=typeof w[G]<"u"?w[G]:Z[G]);break;default:throw new Error('Unexpected argument type! Expected "string" or "object", got '+m(w))}if(!Z.printable)throw new Error("Missing printable information.");if(!Z.type||typeof Z.type!="string"||u.indexOf(Z.type.toLowerCase())===-1)throw new Error("Invalid print type. Available types are: pdf, html, image and json.");Z.showModal&&A.default.show(Z),Z.onLoadingStart&&Z.onLoadingStart();var B=document.getElementById(Z.frameId);B&&B.parentNode.removeChild(B);var p=document.createElement("iframe");switch(i.default.isFirefox()?p.setAttribute("style","width: 1px; height: 100px; position: fixed; left: 0; top: 0; opacity: 0; border-width: 0; margin: 0; padding: 0"):p.setAttribute("style","visibility: hidden; height: 0; width: 0; position: absolute; border: 0"),p.setAttribute("id",Z.frameId),Z.type!=="pdf"&&(p.srcdoc="<html><head><title>"+Z.documentTitle+"</title>",Z.css&&(Array.isArray(Z.css)||(Z.css=[Z.css]),Z.css.forEach(function(Y){p.srcdoc+='<link rel="stylesheet" href="'+Y+'">'})),p.srcdoc+="</head><body></body></html>"),Z.type){case"pdf":if(i.default.isIE())try{console.info("Print.js doesn't support PDF printing in Internet Explorer.");var y=window.open(Z.fallbackPrintable,"_blank");y.focus(),Z.onIncompatibleBrowser()}catch(Y){Z.onError(Y)}finally{Z.showModal&&A.default.close(),Z.onLoadingEnd&&Z.onLoadingEnd()}else n.default.print(Z,p);break;case"image":a.default.print(Z,p);break;case"html":l.default.print(Z,p);break;case"raw-html":o.default.print(Z,p);break;case"json":d.default.print(Z,p);break}}}},"./src/js/json.js":function(I,e,t){t.r(e);var i=t("./src/js/functions.js"),A=t("./src/js/print.js");function n(o){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?n=function(d){return typeof d}:n=function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},n(o)}e.default={print:function(a,d){if(n(a.printable)!=="object")throw new Error("Invalid javascript data object (JSON).");if(typeof a.repeatTableHeader!="boolean")throw new Error("Invalid value for repeatTableHeader attribute (JSON).");if(!a.properties||!Array.isArray(a.properties))throw new Error("Invalid properties array for your JSON data.");a.properties=a.properties.map(function(m){return{field:n(m)==="object"?m.field:m,displayName:n(m)==="object"?m.displayName:m,columnSize:n(m)==="object"&&m.columnSize?m.columnSize+";":100/a.properties.length+"%;"}}),a.printableElement=document.createElement("div"),a.header&&Object(i.addHeader)(a.printableElement,a),a.printableElement.innerHTML+=l(a),A.default.send(a,d)}};function l(o){var a=o.printable,d=o.properties,m='<table style="border-collapse: collapse; width: 100%;">';o.repeatTableHeader&&(m+="<thead>"),m+="<tr>";for(var u=0;u<d.length;u++)m+='<th style="width:'+d[u].columnSize+";"+o.gridHeaderStyle+'">'+Object(i.capitalizePrint)(d[u].displayName)+"</th>";m+="</tr>",o.repeatTableHeader&&(m+="</thead>"),m+="<tbody>";for(var h=0;h<a.length;h++){m+="<tr>";for(var Z=0;Z<d.length;Z++){var w=a[h],G=d[Z].field.split(".");if(G.length>1)for(var B=0;B<G.length;B++)w=w[G[B]];else w=w[d[Z].field];m+='<td style="width:'+d[Z].columnSize+o.gridStyle+'">'+w+"</td>"}m+="</tr>"}return m+="</tbody></table>",m}},"./src/js/modal.js":function(I,e,t){t.r(e);var i={show:function(n){var l="font-family:sans-serif; display:table; text-align:center; font-weight:300; font-size:30px; left:0; top:0;position:fixed; z-index: 9990;color: #0460B5; width: 100%; height: 100%; background-color:rgba(255,255,255,.9);transition: opacity .3s ease;",o=document.createElement("div");o.setAttribute("style",l),o.setAttribute("id","printJS-Modal");var a=document.createElement("div");a.setAttribute("style","display:table-cell; vertical-align:middle; padding-bottom:100px;");var d=document.createElement("div");d.setAttribute("class","printClose"),d.setAttribute("id","printClose"),a.appendChild(d);var m=document.createElement("span");m.setAttribute("class","printSpinner"),a.appendChild(m);var u=document.createTextNode(n.modalMessage);a.appendChild(u),o.appendChild(a),document.getElementsByTagName("body")[0].appendChild(o),document.getElementById("printClose").addEventListener("click",function(){i.close()})},close:function(){var n=document.getElementById("printJS-Modal");n&&n.parentNode.removeChild(n)}};e.default=i},"./src/js/pdf.js":function(I,e,t){t.r(e);var i=t("./src/js/print.js"),A=t("./src/js/functions.js");e.default={print:function(o,a){if(o.base64){var d=Uint8Array.from(atob(o.printable),function(u){return u.charCodeAt(0)});n(o,a,d);return}o.printable=/^(blob|http|\/\/)/i.test(o.printable)?o.printable:window.location.origin+(o.printable.charAt(0)!=="/"?"/"+o.printable:o.printable);var m=new window.XMLHttpRequest;m.responseType="arraybuffer",m.addEventListener("error",function(){Object(A.cleanUp)(o),o.onError(m.statusText,m)}),m.addEventListener("load",function(){if([200,201].indexOf(m.status)===-1){Object(A.cleanUp)(o),o.onError(m.statusText,m);return}n(o,a,m.response)}),m.open("GET",o.printable,!0),m.send()}};function n(l,o,a){var d=new window.Blob([a],{type:"application/pdf"});d=window.URL.createObjectURL(d),o.setAttribute("src",d),i.default.send(l,o)}},"./src/js/print.js":function(I,e,t){t.r(e);var i=t("./src/js/browser.js"),A=t("./src/js/functions.js"),n={send:function(m,u){document.getElementsByTagName("body")[0].appendChild(u);var h=document.getElementById(m.frameId);h.onload=function(){if(m.type==="pdf"){i.default.isFirefox()?setTimeout(function(){return l(h,m)},1e3):l(h,m);return}var Z=h.contentWindow||h.contentDocument;if(Z.document&&(Z=Z.document),Z.body.appendChild(m.printableElement),m.type!=="pdf"&&m.style){var w=document.createElement("style");w.innerHTML=m.style,Z.head.appendChild(w)}var G=Z.getElementsByTagName("img");G.length>0?o(Array.from(G)).then(function(){return l(h,m)}):l(h,m)}}};function l(d,m){try{if(d.focus(),i.default.isEdge()||i.default.isIE())try{d.contentWindow.document.execCommand("print",!1,null)}catch{d.contentWindow.print()}else d.contentWindow.print()}catch(u){m.onError(u)}finally{i.default.isFirefox()&&(d.style.visibility="hidden",d.style.left="-1px"),Object(A.cleanUp)(m)}}function o(d){var m=d.map(function(u){if(u.src&&u.src!==window.location.href)return a(u)});return Promise.all(m)}function a(d){return new Promise(function(m){var u=function h(){!d||typeof d.naturalWidth>"u"||d.naturalWidth===0||!d.complete?setTimeout(h,500):m()};u()})}e.default=n},"./src/js/raw-html.js":function(I,e,t){t.r(e);var i=t("./src/js/print.js");e.default={print:function(n,l){n.printableElement=document.createElement("div"),n.printableElement.setAttribute("style","width:100%"),n.printableElement.innerHTML=n.printable,i.default.send(n,l)}}},"./src/sass/index.scss":function(I,e,t){},0:function(I,e,t){I.exports=t("./src/index.js")}}).default})})(XS);var sxg=XS.exports;const oxg=BTg(sxg),Zr=C=>{if(!C)return!1;const g=fS(C);return g?Object.values(Mh).includes(g):!1},axg=["src"],Ph=s.defineComponent({name:"VideoPreview",__name:"VideoPreview",props:{src:{}},emits:["error","load"],setup(C,{emit:g}){const I=C,e=g,t=s.reactive({isError:!1});s.watch(()=>I.src,()=>{t.isError=!1,s.nextTick(()=>{A()})});const i=s.ref(null),A=async()=>{var n;try{if(!i.value||!I.src)return;const l=document.createElement("video");l.muted=!0,l.preload="metadata";const o=await fetch(I.src);if(!o.ok)throw new Error("Failed to fetch video");const a=new Blob([await o.arrayBuffer()]);l.src=URL.createObjectURL(a);const d=(n=i==null?void 0:i.value)==null?void 0:n.getContext("2d");if(!d)return;l.addEventListener("loadeddata",()=>{l.currentTime=0,e("load")}),l.addEventListener("seeked",()=>{var m,u;i.value&&d.drawImage(l,0,0,(m=i.value)==null?void 0:m.width,(u=i.value)==null?void 0:u.height)}),l.addEventListener("error",m=>{t.isError=!0,e("error",m)})}catch{e("error",new Event("error")),t.isError=!0}};return s.onMounted(()=>{s.nextTick(()=>{A()})}),(n,l)=>t.isError?(s.openBlock(),s.createElementBlock("img",{key:1,src:s.unref(rn)},null,8,axg)):(s.openBlock(),s.createElementBlock("canvas",{key:0,ref_key:"canvasRef",ref:i,class:"video-preview"},null,512))}}),XA=C=>C?C instanceof File?C.type==="application/pdf":rr(C):!1;var qC=function(){return qC=Object.assign||function(g){for(var I,e=1,t=arguments.length;e<t;e++){I=arguments[e];for(var i in I)Object.prototype.hasOwnProperty.call(I,i)&&(g[i]=I[i])}return g},qC.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError,typeof window<"u"&&(window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),typeof window.CustomEvent!="function"&&(window.CustomEvent=function(g,I){I=I||{bubbles:!1,cancelable:!1,detail:null};var e=document.createEvent("CustomEvent");return e.initCustomEvent(g,I.bubbles,I.cancelable,I.detail),e}));var dxg=typeof document<"u"&&!!document.documentMode,zV;function cxg(){return zV||(zV=document.createElement("div").style)}var HS=["webkit","moz","ms"],AW={};function FV(C){if(AW[C])return AW[C];var g=cxg();if(C in g)return AW[C]=C;for(var I=C[0].toUpperCase()+C.slice(1),e=HS.length;e--;){var t="".concat(HS[e]).concat(I);if(t in g)return AW[C]=t}}function nW(C,g){return parseFloat(g[FV(C)])||0}function lW(C,g,I){I===void 0&&(I=window.getComputedStyle(C));var e=g==="border"?"Width":"";return{left:nW("".concat(g,"Left").concat(e),I),right:nW("".concat(g,"Right").concat(e),I),top:nW("".concat(g,"Top").concat(e),I),bottom:nW("".concat(g,"Bottom").concat(e),I)}}function Gr(C,g,I){C.style[FV(g)]=I}function rxg(C,g){var I=FV("transform");Gr(C,"transition","".concat(I," ").concat(g.duration,"ms ").concat(g.easing))}function mxg(C,g,I){var e=g.x,t=g.y,i=g.scale,A=g.isSVG;if(Gr(C,"transform","scale(".concat(i,") translate(").concat(e,"px, ").concat(t,"px)")),A&&dxg){var n=window.getComputedStyle(C).getPropertyValue("transform");C.setAttribute("transform",n)}}function JV(C){var g=C.parentNode,I=window.getComputedStyle(C),e=window.getComputedStyle(g),t=C.getBoundingClientRect(),i=g.getBoundingClientRect();return{elem:{style:I,width:t.width,height:t.height,top:t.top,bottom:t.bottom,left:t.left,right:t.right,margin:lW(C,"margin",I),border:lW(C,"border",I)},parent:{style:e,width:i.width,height:i.height,top:i.top,bottom:i.bottom,left:i.left,right:i.right,padding:lW(g,"padding",e),border:lW(g,"border",e)}}}var _h={down:"mousedown",move:"mousemove",up:"mouseup mouseleave"};typeof window<"u"&&(typeof window.PointerEvent=="function"?_h={down:"pointerdown",move:"pointermove",up:"pointerup pointerleave pointercancel"}:typeof window.TouchEvent=="function"&&(_h={down:"touchstart",move:"touchmove",up:"touchend touchcancel"}));function LV(C,g,I,e){_h[C].split(" ").forEach(function(t){g.addEventListener(t,I,e)})}function TV(C,g,I){_h[C].split(" ").forEach(function(e){g.removeEventListener(e,I)})}function DS(C,g){for(var I=C.length;I--;)if(C[I].pointerId===g.pointerId)return I;return-1}function vV(C,g){var I;if(g.touches){I=0;for(var e=0,t=g.touches;e<t.length;e++){var i=t[e];i.pointerId=I++,vV(C,i)}return}I=DS(C,g),I>-1&&C.splice(I,1),C.push(g)}function uxg(C,g){if(g.touches){for(;C.length;)C.pop();return}var I=DS(C,g);I>-1&&C.splice(I,1)}function SS(C){C=C.slice(0);for(var g=C.pop(),I;I=C.pop();)g={clientX:(I.clientX-g.clientX)/2+g.clientX,clientY:(I.clientY-g.clientY)/2+g.clientY};return g}function jV(C){if(C.length<2)return 0;var g=C[0],I=C[1];return Math.sqrt(Math.pow(Math.abs(I.clientX-g.clientX),2)+Math.pow(Math.abs(I.clientY-g.clientY),2))}function hxg(C){for(var g=C;g&&g.parentNode;){if(g.parentNode===document)return!0;g=g.parentNode instanceof ShadowRoot?g.parentNode.host:g.parentNode}return!1}function bxg(C){return(C.getAttribute("class")||"").trim()}function Zxg(C,g){return C.nodeType===1&&" ".concat(bxg(C)," ").indexOf(" ".concat(g," "))>-1}function Gxg(C,g){for(var I=C;I!=null;I=I.parentNode)if(Zxg(I,g.excludeClass)||g.exclude.indexOf(I)>-1)return!0;return!1}var wxg=/^http:[\w\.\/]+svg$/;function Wxg(C){return wxg.test(C.namespaceURI)&&C.nodeName.toLowerCase()!=="svg"}function Bxg(C){var g={};for(var I in C)C.hasOwnProperty(I)&&(g[I]=C[I]);return g}var KS={animate:!1,canvas:!1,cursor:"move",disablePan:!1,disableZoom:!1,disableXAxis:!1,disableYAxis:!1,duration:200,easing:"ease-in-out",exclude:[],excludeClass:"panzoom-exclude",handleStartEvent:function(C){C.preventDefault(),C.stopPropagation()},maxScale:4,minScale:.125,overflow:"hidden",panOnlyWhenZoomed:!1,pinchAndPan:!1,relative:!1,setTransform:mxg,startX:0,startY:0,startScale:1,step:.3,touchAction:"none"};function kS(C,g){if(!C)throw new Error("Panzoom requires an element as an argument");if(C.nodeType!==1)throw new Error("Panzoom requires an element with a nodeType of 1");if(!hxg(C))throw new Error("Panzoom should be called on elements that have been attached to the DOM");g=qC(qC({},KS),g);var I=Wxg(C),e=C.parentNode;e.style.overflow=g.overflow,e.style.userSelect="none",e.style.touchAction=g.touchAction,(g.canvas?e:C).style.cursor=g.cursor,C.style.userSelect="none",C.style.touchAction=g.touchAction,Gr(C,"transformOrigin",typeof g.origin=="string"?g.origin:I?"0 0":"50% 50%");function t(){e.style.overflow="",e.style.userSelect="",e.style.touchAction="",e.style.cursor="",C.style.cursor="",C.style.userSelect="",C.style.touchAction="",Gr(C,"transformOrigin","")}function i(Cg){Cg===void 0&&(Cg={});for(var mg in Cg)Cg.hasOwnProperty(mg)&&(g[mg]=Cg[mg]);(Cg.hasOwnProperty("cursor")||Cg.hasOwnProperty("canvas"))&&(e.style.cursor=C.style.cursor="",(g.canvas?e:C).style.cursor=g.cursor),Cg.hasOwnProperty("overflow")&&(e.style.overflow=Cg.overflow),Cg.hasOwnProperty("touchAction")&&(e.style.touchAction=Cg.touchAction,C.style.touchAction=Cg.touchAction)}var A=0,n=0,l=1,o=!1;Z(g.startScale,{animate:!1,force:!0}),setTimeout(function(){h(g.startX,g.startY,{animate:!1,force:!0})});function a(Cg,mg,yg){if(!yg.silent){var Gg=new CustomEvent(Cg,{detail:mg});C.dispatchEvent(Gg)}}function d(Cg,mg,yg){var Gg={x:A,y:n,scale:l,isSVG:I,originalEvent:yg};return requestAnimationFrame(function(){typeof mg.animate=="boolean"&&(mg.animate?rxg(C,mg):Gr(C,"transition","none")),mg.setTransform(C,Gg,mg),a(Cg,Gg,mg),a("panzoomchange",Gg,mg)}),Gg}function m(Cg,mg,yg,Gg){var ng=qC(qC({},g),Gg),Zg={x:A,y:n,opts:ng};if(!(Gg!=null&&Gg.force)&&(ng.disablePan||ng.panOnlyWhenZoomed&&l===ng.startScale))return Zg;if(Cg=parseFloat(Cg),mg=parseFloat(mg),ng.disableXAxis||(Zg.x=(ng.relative?A:0)+Cg),ng.disableYAxis||(Zg.y=(ng.relative?n:0)+mg),ng.contain){var bg=JV(C),AI=bg.elem.width/l,tI=bg.elem.height/l,iC=AI*yg,kC=tI*yg,RC=(iC-AI)/2,DI=(kC-tI)/2;if(ng.contain==="inside"){var $e=(-bg.elem.margin.left-bg.parent.padding.left+RC)/yg,_t=(bg.parent.width-iC-bg.parent.padding.left-bg.elem.margin.left-bg.parent.border.left-bg.parent.border.right+RC)/yg;Zg.x=Math.max(Math.min(Zg.x,_t),$e);var fC=(-bg.elem.margin.top-bg.parent.padding.top+DI)/yg,$t=(bg.parent.height-kC-bg.parent.padding.top-bg.elem.margin.top-bg.parent.border.top-bg.parent.border.bottom+DI)/yg;Zg.y=Math.max(Math.min(Zg.y,$t),fC)}else if(ng.contain==="outside"){var $e=(-(iC-bg.parent.width)-bg.parent.padding.left-bg.parent.border.left-bg.parent.border.right+RC)/yg,_t=(RC-bg.parent.padding.left)/yg;Zg.x=Math.max(Math.min(Zg.x,_t),$e);var fC=(-(kC-bg.parent.height)-bg.parent.padding.top-bg.parent.border.top-bg.parent.border.bottom+DI)/yg,$t=(DI-bg.parent.padding.top)/yg;Zg.y=Math.max(Math.min(Zg.y,$t),fC)}}return ng.roundPixels&&(Zg.x=Math.round(Zg.x),Zg.y=Math.round(Zg.y)),Zg}function u(Cg,mg){var yg=qC(qC({},g),mg),Gg={scale:l,opts:yg};if(!(mg!=null&&mg.force)&&yg.disableZoom)return Gg;var ng=g.minScale,Zg=g.maxScale;if(yg.contain){var bg=JV(C),AI=bg.elem.width/l,tI=bg.elem.height/l;if(AI>1&&tI>1){var iC=bg.parent.width-bg.parent.border.left-bg.parent.border.right,kC=bg.parent.height-bg.parent.border.top-bg.parent.border.bottom,RC=iC/AI,DI=kC/tI;g.contain==="inside"?Zg=Math.min(Zg,RC,DI):g.contain==="outside"&&(ng=Math.max(ng,RC,DI))}}return Gg.scale=Math.min(Math.max(Cg,ng),Zg),Gg}function h(Cg,mg,yg,Gg){var ng=m(Cg,mg,l,yg);return A!==ng.x||n!==ng.y?(A=ng.x,n=ng.y,d("panzoompan",ng.opts,Gg)):{x:A,y:n,scale:l,isSVG:I,originalEvent:Gg}}function Z(Cg,mg,yg){var Gg=u(Cg,mg),ng=Gg.opts;if(!(!(mg!=null&&mg.force)&&ng.disableZoom)){Cg=Gg.scale;var Zg=A,bg=n;if(ng.focal){var AI=ng.focal;Zg=(AI.x/Cg-AI.x/l+A*Cg)/Cg,bg=(AI.y/Cg-AI.y/l+n*Cg)/Cg}var tI=m(Zg,bg,Cg,{relative:!1,force:!0});return A=tI.x,n=tI.y,l=Cg,d("panzoomzoom",ng,yg)}}function w(Cg,mg){var yg=qC(qC(qC({},g),{animate:!0}),mg);return Z(l*Math.exp((Cg?1:-1)*yg.step),yg)}function G(Cg){return w(!0,Cg)}function B(Cg){return w(!1,Cg)}function p(Cg,mg,yg,Gg){var ng=JV(C),Zg={width:ng.parent.width-ng.parent.padding.left-ng.parent.padding.right-ng.parent.border.left-ng.parent.border.right,height:ng.parent.height-ng.parent.padding.top-ng.parent.padding.bottom-ng.parent.border.top-ng.parent.border.bottom},bg=mg.clientX-ng.parent.left-ng.parent.padding.left-ng.parent.border.left-ng.elem.margin.left,AI=mg.clientY-ng.parent.top-ng.parent.padding.top-ng.parent.border.top-ng.elem.margin.top;I||(bg-=ng.elem.width/l/2,AI-=ng.elem.height/l/2);var tI={x:bg/Zg.width*(Zg.width*Cg),y:AI/Zg.height*(Zg.height*Cg)};return Z(Cg,qC(qC({},yg),{animate:!1,focal:tI}),Gg)}function y(Cg,mg){Cg.preventDefault();var yg=qC(qC(qC({},g),mg),{animate:!1}),Gg=Cg.deltaY===0&&Cg.deltaX?Cg.deltaX:Cg.deltaY,ng=Gg<0?1:-1,Zg=u(l*Math.exp(ng*yg.step/3),yg).scale;return p(Zg,Cg,yg,Cg)}function Y(Cg){var mg=qC(qC(qC({},g),{animate:!0,force:!0}),Cg);l=u(mg.startScale,mg).scale;var yg=m(mg.startX,mg.startY,l,mg);return A=yg.x,n=yg.y,d("panzoomreset",mg)}var R,M,S,J,D,H,F=[];function x(Cg){if(!Gxg(Cg.target,g)){vV(F,Cg),o=!0,g.handleStartEvent(Cg),R=A,M=n,a("panzoomstart",{x:A,y:n,scale:l,isSVG:I,originalEvent:Cg},g);var mg=SS(F);S=mg.clientX,J=mg.clientY,D=l,H=jV(F)}}function q(Cg){if(!(!o||R===void 0||M===void 0||S===void 0||J===void 0)){vV(F,Cg);var mg=SS(F),yg=F.length>1,Gg=l;if(yg){H===0&&(H=jV(F));var ng=jV(F)-H;Gg=u(ng*g.step/80+D).scale,p(Gg,mg,{animate:!1},Cg)}(!yg||g.pinchAndPan)&&h(R+(mg.clientX-S)/Gg,M+(mg.clientY-J)/Gg,{animate:!1},Cg)}}function gg(Cg){F.length===1&&a("panzoomend",{x:A,y:n,scale:l,isSVG:I,originalEvent:Cg},g),uxg(F,Cg),o&&(o=!1,R=M=S=J=void 0)}var Q=!1;function _(){Q||(Q=!0,LV("down",g.canvas?e:C,x),LV("move",document,q,{passive:!0}),LV("up",document,gg,{passive:!0}))}function og(){Q=!1,TV("down",g.canvas?e:C,x),TV("move",document,q),TV("up",document,gg)}return g.noBind||_(),{bind:_,destroy:og,eventNames:_h,getPan:function(){return{x:A,y:n}},getScale:function(){return l},getOptions:function(){return Bxg(g)},handleDown:x,handleMove:q,handleUp:gg,pan:h,reset:Y,resetStyle:t,setOptions:i,setStyle:function(Cg,mg){return Gr(C,Cg,mg)},zoom:Z,zoomIn:G,zoomOut:B,zoomToPoint:p,zoomWithWheel:y}}kS.defaultOptions=KS;const pxg={ref:"contentRef",class:"slider-modal__content"},yxg=["onClick"],Yxg={class:"slider-modal__side-bar-count"},Vxg={key:0,class:"slider-modal__mobile-header"},Nxg={class:"slider-modal__mobile-header-block"},Mxg={class:"slider-modal__mobile-header-block"},Rxg={class:"slider-modal__counter"},fxg={class:"slider-modal__name"},Xxg=["src"],Hxg=["data-testid"],Dxg=["src"],Sxg=["src"],Kxg={class:"slider-modal__bottom"},kxg={class:"slider-modal__nav-block"},zxg=["disabled"],Fxg=["src","alt"],Jxg=["src"],Lxg=["disabled"],Txg={class:"slider-modal__nav-block"},vxg={class:"slider-modal__sub-nav"},jxg=["disabled"],xxg=["disabled"],Oxg=["disabled"],Qxg={class:"slider-modal__sub-nav"},Uxg=["disabled"],Exg=["disabled"],xV=80,zS=20,Pxg=80,_xg=20,sW=Rg(s.defineComponent({name:"SliderModal",__name:"SliderModal",props:{dataTestid:{default:"SliderModal"},animateType:{},open:{type:Boolean},position:{},width:{},height:{},disableCloseOnOutsideClick:{type:Boolean},items:{},defaultIndex:{default:0}},emits:["close","unmounted","end-animation"],setup(C,{emit:g}){const I=C,e=g,t=window.matchMedia("(max-width: 768px)"),i=s.reactive({defaultIndex:I.defaultIndex,file:I.items[I.defaultIndex],sideBarItems:[],sideBarIndex:0,sideBarLength:0,isErrorFile:!1,isClickOnExit:!1,isMobile:!1,isPointerActive:!1,isExistSwipe:!1,isChangeItemSwipe:!1,isSwipeNextSlide:!1,isSwipePrevSlide:!1,isExitScrollActive:!1,zoomValue:1,offsetX:0,offsetY:0,startX:0,startY:0,startXForMobile:0,startYForMobile:0,endXForMobile:0,endYForMobile:0,overscrollDelta:0,startScrollTop:0,rotateValue:0}),A=s.ref(null),n=s.ref(null),l=s.ref(null),o=s.ref(null),a=s.ref(null),d=s.ref(null),m=s.ref(null),u=s.ref(null);let h=null;const Z=s.computed(()=>i.defaultIndex===0),w=s.computed(()=>i.defaultIndex===I.items.length-1),G=s.computed(()=>{var lg,dg,Fg,sI;return!(XA((lg=i.file)==null?void 0:lg.path)||XA((dg=i.file)==null?void 0:dg.file)||iW((Fg=i.file)==null?void 0:Fg.path)||Zr((sI=i.file)==null?void 0:sI.path))}),B=s.computed(()=>{var dg,Fg;let lg=!i.file||i.isErrorFile||G.value;return lg=Zr((dg=i.file)==null?void 0:dg.path)||lg,lg=i.isMobile&&XA((Fg=i.file)==null?void 0:Fg.path)||lg,lg}),p=s.computed(()=>{var dg;let lg=!i.file||i.isErrorFile||G.value;return lg=Zr((dg=i.file)==null?void 0:dg.path)||lg,lg}),y=s.computed(()=>!i.file||i.isErrorFile||G.value),Y=s.computed(()=>{var dg;let lg=!i.file||i.isErrorFile||G.value;return lg=Zr((dg=i.file)==null?void 0:dg.path)||lg,lg}),R=s.computed(()=>({transform:`
1363
1363
  scale(${i.zoomValue})
1364
1364
  `})),M=()=>{if(!u.value)return;S();const lg=u.value.parentElement;if(!lg)return;const dg=lg.getBoundingClientRect(),Fg=u.value.getBoundingClientRect(),sI=(dg.width-Fg.width)/2,PI=(dg.height-Fg.height)/2;h=kS(u.value,{maxScale:3,minScale:1,startX:sI,startY:PI,panOnlyWhenZoomed:!0,startScale:1,animate:!0,cursor:"default",setTransform:(XC,{x:gt,y:$n,scale:fi})=>{XC.parentElement&&(i.isMobile&&(fi=Math.max(Math.min(fi,3),1),i.zoomValue=fi),h==null||h.setStyle("transform",`translate(${gt}px, ${$n}px) scale(${fi}) rotate(${i.rotateValue}deg)`))}}),h.handleUp=()=>{if(!h||!u.value)return;const XC=u.value;if(h.getScale()<=1){J();return}const{top:$n,left:fi,bottom:ns,right:Ca}=lg.getBoundingClientRect(),{x:ea,y:ta}=h.getPan(),{top:PC,left:We,right:ls,bottom:GM}=XC.getBoundingClientRect();let DZ=ea,SZ=ta;const KZ=We-fi,Bu=Ca-ls,kZ=PC-$n,zZ=ns-GM;KZ>0&&Bu<0&&(DZ=ea-KZ),Bu>0&&KZ<0&&(DZ=ea+Bu),kZ>0&&zZ<0&&(SZ=ta-kZ),zZ>0&&kZ<0&&(SZ=ta+zZ),h.pan(DZ,SZ,{force:!0})},document.addEventListener("pointerup",h.handleUp),window.addEventListener("resize",J)},S=()=>{h&&(window.removeEventListener("resize",J),document.removeEventListener("pointerup",h.handleUp),h.destroy(),u.value&&NI({transform:"none",transition:"none"},u.value))},J=()=>{if(!h||!u.value)return;const lg=u.value.parentElement;if(!lg)return;const dg=lg.getBoundingClientRect(),Fg=u.value.offsetWidth,sI=u.value.offsetHeight,PI=(dg.width-Fg)/2,XC=(dg.height-sI)/2;h.pan(PI,XC,{force:!0})};s.watch([()=>I.items,()=>I.defaultIndex],()=>{i.file=I.items[I.defaultIndex??0],i.defaultIndex=I.defaultIndex??0,S()}),s.watch([()=>i.file,()=>I.open],()=>{if(!I.open){cA(),i.file=null;return}i.zoomValue=1,$t(),i.file||(i.file=I.items[I.defaultIndex??0]),i.isErrorFile=!1,we()}),s.watch(()=>I.open,()=>{if(!I.open){h==null||h.destroy(),S(),$t();return}s.nextTick(()=>{m.value&&m.value.initScroll()}),i.defaultIndex=I.defaultIndex??0}),s.watch(()=>i.sideBarIndex,()=>{_n()});const D=()=>{i.isClickOnExit&&e("close")},H=lg=>{_A(lg)},F=lg=>{i.sideBarIndex=lg},x=lg=>{i.isMobile||Yt(lg.deltaY)},q=()=>{Yc(!0)},gg=()=>{Yc(!1)},Q=()=>{if(d.value&&d.value.rotatePdf(-90),u.value){i.rotateValue+=-90;let lg=0,dg=0;const Fg=_t();lg=(h==null?void 0:h.getPan().x)||0,dg=(h==null?void 0:h.getPan().y)||0;const sI={transform:`translate(${lg||0}px, ${dg||0}px) rotate(${i.rotateValue}deg) scale(${Fg||1})`};NI(sI,u.value)}},_=()=>{var sI,PI,XC;if(!((sI=i.file)!=null&&sI.path))return;let lg="pdf",dg="",Fg="";iW((PI=i.file)==null?void 0:PI.path)&&(lg="image",dg=`
1365
1365
  @page {